Example #1
0
 /**
  * Constructor
  * @param string $query String of Files to load, separated by ;
  * @return void
  */
 public function __construct($query = NULL)
 {
     parent::__construct();
     global $browser;
     if ($query) {
         $this->load_file($query);
     }
 }
Example #2
0
/**
 * load_apply
 * Finds @load lines, includes the files
 * @param array $lines The lines to prcoess
 * @return array $new The new lines with the loaded files included
 */
function load_apply($lines)
{
    global $cssp;
    $new = array();
    foreach ($lines as $line) {
        if (preg_match('/^[\\s]*@load[\\s]+url\\((.*?)\\)/', $line, $matches)) {
            if (count($matches) == 2) {
                $loadfilepath = $matches[1];
                // Apply global path constants;
                foreach ($cssp->global_constants as $g_constant => $g_value) {
                    $loadfilepath = preg_replace('/(\\$_' . $g_constant . ')\\b/', $g_value, $loadfilepath);
                }
                $basedir = dirname($loadfilepath);
                // Load the file
                if (file_exists($loadfilepath)) {
                    $newlines = file($loadfilepath);
                    $newlines_indention_char = Parser2::get_indention_char($newlines);
                    // Fix the indention of the new lines
                    if ($cssp->indention_char != $newlines_indention_char) {
                        $newlines = load_fix_indention($newlines, $cssp->indention_char, $newlines_indention_char);
                    }
                    // Apply the basedir to $_FILEPATH
                    $newlines = load_fix_filepath($newlines, $basedir);
                    // Apply the loader plugin to the loaded files
                    $newlines = load_apply($newlines);
                    // Import the new lines
                    foreach ($newlines as $imported) {
                        $new[] = $imported;
                    }
                } else {
                    $cssp->report_error('Loader plugin could not find file ' . $loadfilepath . '.');
                }
            }
        } else {
            $new[] = $line;
        }
    }
    return $new;
}
Example #3
0
 /**
  * set_indention_char
  * Sets the indention char
  * @param string $char The whitespace char(s) used for indention
  * @return void
  */
 public function set_indention_char($char = null)
 {
     if (!$char) {
         $char = Parser2::get_indention_char($this->code);
     }
     $this->indention_char = $char;
 }
Example #4
0
 function splitTemplate($str) {
   $str = preg_replace('/\[(.*?)\]/e', "'<#'.strtolower('\\1').'#>'", $str);
   parent::splitTemplate($str);
 }
 function splitTemplate($str)
 {
     $str = preg_replace('/\\[#\\s*(.*?)\\s*#\\]/e', "'<#\\1#>'", $str);
     parent::splitTemplate($str);
 }