Login   Register  
PHP Classes
elePHPant
Icontem

File: plugins/PHP_code_plugin.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Full name  >  x64Template Engine  >  plugins/PHP_code_plugin.php  >  Download  
File: plugins/PHP_code_plugin.php
Role: Class source
Content type: text/plain
Description: Plugin example
Class: x64Template Engine
Template engine extensible with plug-in classes
Author: By
Last change: Moved to an other folder and updated to the new plugins system
Date: 8 years ago
Size: 794 bytes
 

Contents

Class file image Download
<?php

require_once("dependencies/PHP_Highlight.php");

class 
php_code_plugin
{
    function 
setup($s=null)
    {
        return array(
'refresh_object'=>false);
    }

    function 
parse($contents,&$object)
    {
        
$code=null;
        
$tags=$object->get_tags('php','code');

        while ((
$code=x64Template::get_statement($tags,$contents))!==false)
        {
            
$_code=html_entity_decode($code);
            
$code_highlighter=new PHP_Highlight();
            
$code_highlighter->loadString($_code);
            
$_code=$code_highlighter->toList(true,false);
            
$contents=str_replace($tags['b'].$code.$tags['e'],$_code,$contents);
        }
        return 
$contents;
    }
    function 
version($of_what)
    {
        switch (
$of_what)
        {
            case 
"protocol":
                return 
"1.0";
                break;
            case 
"plugin":
                return 
"0.1.1";
                break;
        }
    }
}
?>