You are here

public static function GeshiFilterProcess::geshiFactory in GeSHi Filter for syntax highlighting 8

Same name and namespace in other branches
  1. 8.2 src/GeshiFilterProcess.php \Drupal\geshifilter\GeshiFilterProcess::geshiFactory()

Helper function for generating a GeSHi object.

Parameters

string $source_code: The source code to process.

string $language: The language to generate a GeSHi object for.

Return value

\GeSHi Return a Geshi class object.

2 calls to GeshiFilterProcess::geshiFactory()
GeshiFilterCss::generateLanguagesCssRules in src/GeshiFilterCss.php
Helper function for generating the CSS rules.
GeshiFilterProcess::geshiProcess in src/GeshiFilterProcess.php
Geshifilter wrapper for GeSHi processing.

File

src/GeshiFilterProcess.php, line 194

Class

GeshiFilterProcess
Helpers functions related to processing the source code with geshi.

Namespace

Drupal\geshifilter

Code

public static function geshiFactory($source_code, $language) {
  $available_languages = GeshiFilter::getAvailableLanguages();
  $geshi = new \GeSHi($source_code, $language);
  $geshi
    ->set_language_path($available_languages[$language]['language_path']);
  return $geshi;
}