コード例 #1
0
ファイル: phphelper.php プロジェクト: Jakobo/chippino
 protected function resolveCtxDeclarations($string)
 {
     $string = str_replace('$$', '__DBLDOLLAR__', $string);
     preg_match_all('/\\$(?:\\{|\\[)(.*?)(?:\\}|\\])/', $string, $matches);
     if (!$matches[0]) {
         return $string;
     }
     $replaces = array();
     // foreach ${term}, convert it to a PHP statement and resolve
     // like a TALES expression
     foreach ($matches[1] as $idx => $attr) {
         $c = $this->createLocalVariable();
         $structure = FALSE;
         $dump = FALSE;
         if (strpos($attr, 'structure ') === 0) {
             $attr = trim(substr($attr, 10));
             $structure = TRUE;
         }
         if (strpos($attr, 'dump ') === 0) {
             $attr = trim(substr($attr, 5));
             $dump = TRUE;
         }
         $str = PXHTMLTales::getInstance()->process($attr, $c . ' = %s;');
         if ($structure) {
             $php_inst = '<' . '?php ' . $str . 'echo ' . $c . '; unset(' . $c . ');' . '?' . '>';
         } elseif ($dump) {
             $php_inst = '<' . '?php ' . $str . 'var_dump(' . $c . '); unset(' . $c . ');' . '?' . '>';
         } else {
             $php_inst = '<' . '?php ' . $str . 'echo htmlspecialchars(' . $c . '); unset(' . $c . ');' . '?' . '>';
         }
         $replaces[$matches[0][$idx]] = $php_inst;
     }
     return str_replace('__DBLDOLLAR__', '$', str_replace(array_keys($replaces), array_values($replaces), $string));
 }
コード例 #2
0
ファイル: node.php プロジェクト: Jakobo/chippino
 public function __construct($Dom, $XPath)
 {
     $this->Dom = $Dom;
     $this->XPath = $XPath;
     $this->Tales = PXHTMLTales::getInstance();
 }
コード例 #3
0
ファイル: pxhtml.php プロジェクト: Jakobo/chippino
 public static function registerTales($pfx, $classname)
 {
     PXHTMLTales::cfg()->registerTales($pfx, $classname);
 }