Support » Plugin: WP-Syntax » Patch to set default language

  • Sometimes I like to use <pre line=”1″> or <pre highlight=”7″>, but then Geshi spits out tons of PHP warnings because no “lang” attribute is defined.

    This patch for wp-syntax.php fixes the warnings by setting the language to “text” if a “lang” isn’t given:

    @@ -110,6 +110,10 @@ function wp_syntax_highlight($match)
         $match = $wp_syntax_matches[$i];
    
         $language = strtolower(trim($match[1]));
    +    if (empty($language)) {
    +      $language = "text";
    +    }
    +
         $line = trim($match[2]);
         $escaped = trim($match[3]);
  • The topic ‘Patch to set default language’ is closed to new replies.