PHP Classes

File: example1.php

Recommend this page to a friend!
  Classes of toby lawrence  >  Highlight Code  >  example1.php  >  Download  
File: example1.php
Role: Example script
Content type: text/plain
Description: Example of the usage of the highlighter
Class: Highlight Code
Highlighting PHP code
Author: By
Last change: Explained replace line to cover the protection of vars that contain passwords/logins/etc
Date: 18 years ago
Size: 576 bytes


Class file image Download

include "class.hlight.php";

// code goes here...

// code to tell when to show the source..

$fp = fopen($script,"r");
$contents = fread($fp, filesize($script));

// this code was from one of my own projects, replace $dsn
// to any var that you want to be protected during the
// showing of the source

$contents = preg_replace('{(\\$db.*?) = ".*?";}',
'$1="*****";', $contents);

$highlighter = new SyntaxHighlighter_php;
$contents = $highlighter->highlight($contents);


For more information send a message to info at phpclasses dot org.