Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/web45/html/cognovo.net/forum/Sources/Subs-Package.php on line 235

Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/web45/html/cognovo.net/forum/Sources/Subs-Package.php on line 237

Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/web45/html/cognovo.net/forum/Sources/Subs-Package.php on line 278

Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/web45/html/cognovo.net/forum/Sources/Subs-Package.php on line 280

Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/web45/html/cognovo.net/forum/Sources/Subs-Package.php on line 2707

Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/web45/html/cognovo.net/forum/Sources/Subs-Package.php on line 2707

Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/web45/html/cognovo.net/forum/Sources/Subs-Package.php on line 2707

Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/web45/html/cognovo.net/forum/Sources/Subs-Package.php on line 2822

Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/web45/html/cognovo.net/forum/Sources/Subs-Editor.php on line 900

Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/web45/html/cognovo.net/forum/Sources/Subs-Editor.php on line 908

Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/web45/html/cognovo.net/forum/Sources/Subs-Editor.php on line 920

Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/web45/html/cognovo.net/forum/Sources/Subs-Editor.php on line 932

Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/web45/html/cognovo.net/forum/Sources/Subs-Editor.php on line 934
Syntax highlighting mod installed

Category > General discussion

Syntax highlighting mod installed

(1/1)

admin:
This script highlights syntax in code examples on the forum. It i based on "highlight.js" - see https://highlightjs.org/
The script works automatically, i.e., it finds blocks of code, detects the programming language, highlights it accordingly.
Supported languages include: HTML/XML, Javascript, CSS, PHP, Ruby, Perl, Python, C++, C#, Java, SQL, Bash, etc. pp.

--- Code: --- <?php
 if ( isset( $_FILES['fupload'] ) ) {

     print "name: ".     $_FILES['fupload']['name']       ."<br />";
     print "size: ".     $_FILES['fupload']['size'] ." bytes<br />";
     print "temp name: ".$_FILES['fupload']['tmp_name']   ."<br />";
     print "type: ".     $_FILES['fupload']['type']       ."<br />";
     print "error: ".    $_FILES['fupload']['error']      ."<br />";

     if ( $_FILES['fupload']['type'] == "image/gif" ) {

         $source = $_FILES['fupload']['tmp_name'];
         $target = "upload/".$_FILES['fupload']['name'];
         move_uploaded_file( $source, $target );// or die ("Couldn't copy");
         $size = getImageSize( $target );

         $imgstr = "<p><img width=\"$size[0]\" height=\"$size[1]\" ";
         $imgstr .= "src=\"$target\" alt=\"uploaded image\" /></p>";

         print $imgstr;
     }
 }
 ?>

--- End code ---

Features:

    You can choose code formatting scheme
    You can choose font size within code blocks
    Highlighting works automatically: finds blocks of code, detects a language, highlights it — you don't need specify any language

URL: https://github.com/dragomano/Code-Highlighting

Navigation

[0] Message Index

Go to full version