diff --git a/classes/Convert.php b/classes/Convert.php index d50e794c41b10b6ebcff0b4e4deaf9f57ef6a5da..111c0b4da82b558d77ba80e507e0517b4eb19de2 100644 --- a/classes/Convert.php +++ b/classes/Convert.php @@ -2,114 +2,113 @@ namespace uib\ub\loadspeakr; -//Based (but corrected) from http://www.php.net/manual/en/language.types.object.php#102735 - use Exception; use stdClass; -final class Convert { - # Convert a stdClass to an Array. - static public function object_to_array(stdClass $Class){ - # Typecast to (array) automatically converts stdClass -> array. - $newClass = array(); - - # Iterate through the former properties looking for any stdClass properties. - # Recursively apply (array). - foreach($Class as $key => $value){ - if(is_object($value)&&get_class($value)==='stdClass'){ - $newClass[$key] = self::object_to_array($value); - }else{ - $newClass[$key] = $value; - } - } - return $newClass; - } - - # Convert an Array to stdClass. - static public function array_to_object(array $array){ - # Iterate through our array looking for array values. - # If found recurvisely call itself. - $obj = new stdClass(); - foreach($array as $key => $value){ - if(is_array($value)){ - $obj->$key = self::array_to_object($value); - }else{ - $obj->$key = $value; - } - } - - # Typecast to (object) will automatically convert array -> stdClass - return $obj; - } - - - //Taken from http://www.php.net/manual/en/ref.array.php#81081 - - static public function array_copy (array $aSource) { - // check if input is really an array - if (!is_array($aSource)) { - throw new Exception("Input is not an Array"); - } - - // initialize return array - $aRetAr = array(); - - // get array keys - $aKeys = array_keys($aSource); - // get array values - $aVals = array_values($aSource); - - // loop through array and assign keys+values to new return array - for ($x=0;$x<count($aKeys);$x++) { - // clone if object - if (is_object($aVals[$x])) { - $aRetAr[$aKeys[$x]]=clone $aVals[$x]; - // recursively add array - } elseif (is_array($aVals[$x])) { - $aRetAr[$aKeys[$x]]=self::array_copy ($aVals[$x]); - // assign just a plain scalar value - } else { - $aRetAr[$aKeys[$x]]=$aVals[$x]; - } - } - - return $aRetAr; - } - - - static public function getPaths ($r, $path) { - global $lodspk; - global $conf; - $arr = array(); - foreach($r as $k => $v){ - if($k == "params" ){ - continue; - } - if($k == "0"){//if query - return NULL; - } - $next = self::getPaths($r->$k, $path."endpoint.".$k."/", $arr); - if($next == NULL){ - $aux = $path.$k; - $root = array(); - $pointer = &$root; - $aux2 = explode("/", $aux); - $key = str_ireplace("endpoint.", "", array_shift($aux2)); - foreach($aux2 as $w){ - $x = str_ireplace("endpoint.", "", $w); - $pointer[$x] = array(); - $pointer = &$pointer[$x]; - } - $pointer = $lodspk['baseUrl'].'components/'.$conf[$lodspk['module']]['prefix']."/".$lodspk['componentName']."/queries/".$aux.".query"; // TSL : removed hardcoded /lodspeakr - if(isset($lodspk['source'][$key])){ - $lodspk['queries'][$key] = array_merge($lodspk['source'][$key], $root); - }else{ - $lodspk['queries'][$key] = $root; - } - } +final class Convert +{ + # Convert a stdClass to an Array. + static public function object_to_array(stdClass $Class) + { + # Typecast to (array) automatically converts stdClass -> array. + $newClass = array(); + + # Iterate through the former properties looking for any stdClass properties. + # Recursively apply (array). + foreach ($Class as $key => $value) { + if (is_object($value) && get_class($value) === 'stdClass') { + $newClass[$key] = self::object_to_array($value); + } else { + $newClass[$key] = $value; + } + } + return $newClass; } - return 1; - } -} + # Convert an Array to stdClass. + static public function array_to_object(array $array) + { + # Iterate through our array looking for array values. + # If found recurvisely call itself. + $obj = new stdClass(); + foreach ($array as $key => $value) { + if (is_array($value)) { + $obj->$key = self::array_to_object($value); + } else { + $obj->$key = $value; + } + } + + # Typecast to (object) will automatically convert array -> stdClass + return $obj; + } + + //Taken from http://www.php.net/manual/en/ref.array.php#81081 + static public function array_copy(array $aSource) + { + // check if input is really an array + if (!is_array($aSource)) { + throw new Exception("Input is not an Array"); + } + + // initialize return array + $aRetAr = array(); + // get array keys + $aKeys = array_keys($aSource); + // get array values + $aVals = array_values($aSource); + + // loop through array and assign keys+values to new return array + for ($x = 0; $x < count($aKeys); $x++) { + // clone if object + if (is_object($aVals[$x])) { + $aRetAr[$aKeys[$x]] = clone $aVals[$x]; + // recursively add array + } elseif (is_array($aVals[$x])) { + $aRetAr[$aKeys[$x]] = self::array_copy($aVals[$x]); + // assign just a plain scalar value + } else { + $aRetAr[$aKeys[$x]] = $aVals[$x]; + } + } + + return $aRetAr; + } + + static public function getPaths($r, $path) + { + global $lodspk; + global $conf; + $arr = array(); + foreach ($r as $k => $v) { + if ($k == "params") { + continue; + } + if ($k == "0") {//if query + return null; + } + $next = self::getPaths($r->$k, $path . "endpoint." . $k . "/", $arr); + if ($next == null) { + $aux = $path . $k; + $root = array(); + $pointer = &$root; + $aux2 = explode("/", $aux); + $key = str_ireplace("endpoint.", "", array_shift($aux2)); + foreach ($aux2 as $w) { + $x = str_ireplace("endpoint.", "", $w); + $pointer[$x] = array(); + $pointer = &$pointer[$x]; + } + $pointer = $lodspk['baseUrl'] . 'components/' . $conf[$lodspk['module']]['prefix'] . "/" . $lodspk['componentName'] . "/queries/" . $aux . ".query"; // TSL : removed hardcoded /lodspeakr + if (isset($lodspk['source'][$key])) { + $lodspk['queries'][$key] = array_merge($lodspk['source'][$key], $root); + } else { + $lodspk['queries'][$key] = $root; + } + } + } + return 1; + } + +} diff --git a/classes/Endpoint.php b/classes/Endpoint.php index 69e2bd8b319c46716e9078eac5154d30bda2cbf1..d8b6744a1d41f6dc1be5f95c774957e50ecb177d 100644 --- a/classes/Endpoint.php +++ b/classes/Endpoint.php @@ -3,119 +3,128 @@ namespace uib\ub\loadspeakr; -class Endpoint { - private $sparqlUrl; - private $params; - - public function __construct($sparqlUrl, $params){ - $this->sparqlUrl = $sparqlUrl; - $this->params = $params; - } - - public function query($q, $output = 'json'){ - global $conf; - if (!empty($this->params['output'])){ - $auxoutput = $this->params['output']; - } - $accept = 'application/sparql-results+json'; - if($output != null){ - $this->params['output'] = $output; - } - if($output == 'xml'){ - $accept = 'application/sparql-results+xml'; - }elseif($output == 'rdf'){ - $accept = 'application/rdf+xml'; - } - $aux = ""; - $modified = 0; - $now = time(); - $cacheFile = ""; - if(!empty($conf['cache']['global']) && is_int($conf['cache']['global']) && $conf['cache']['global'] > 0){ - $cacheFile = $conf['home']."cache/query".md5($this->sparqlUrl.$q); - if(file_exists($cacheFile)){ - $modified = filemtime($cacheFile); - } +class Endpoint +{ + private $sparqlUrl; + private $params; + + public function __construct($sparqlUrl, $params) + { + $this->sparqlUrl = $sparqlUrl; + $this->params = $params; } - if(is_int($conf['cache']['global']) && $conf['cache']['global'] > 0 && $modified + $conf['cache']['global'] > $now){ - if($conf['debug']){ - $msg = "Taking data from cache ($cacheFile). Renewal in ".($modified + $conf['cache']['global'] - $now)." seconds\n"; - Logging::log($msg); - echo $msg; - } - $aux = (file_get_contents($cacheFile)); - }else{ - $c = curl_init(); - $context = array(); - $context[0] = 'Connection: close'; - $context[1] = 'Accept: '.$accept; - $params = $this->params; - $params['query'] = $q; - $url = $this->sparqlUrl.'?'.http_build_query($params, '', '&'); - curl_setopt($c, CURLOPT_URL, $url); - curl_setopt($c, CURLOPT_HTTPHEADER, $context); - curl_setopt($c, CURLOPT_USERAGENT, "LODSPeaKr version ".$conf['version']); - curl_setopt($c, CURLOPT_RETURNTRANSFER, true); - $aux = curl_exec($c); // execute the curl command - if($conf['debug']){ - if($aux == false){ - Logging::log("Error executing SPARQL query (".$this->sparqlUrl."): ".curl_error($c), E_USER_ERROR); - echo("Error executing SPARQL query (".$this->sparqlUrl."): ".curl_error($c)); + + public function query($q, $output = 'json') + { + global $conf; + if (!empty($this->params['output'])) { + $auxoutput = $this->params['output']; } - } - $http_status = intval(curl_getinfo($c, CURLINFO_HTTP_CODE)); - curl_close($c); - if (!empty($auxoutput)) { - $this->params['output'] = $auxoutput; - } - if(is_int($conf['cache']['global']) && $conf['cache']['global'] > 0 && $http_status == 200){ - file_put_contents($cacheFile,($aux), LOCK_EX); - if($conf['debug']){ - $msg = "Notice: Writing results in ".$cacheFile."\n"; - Logging::log($msg, E_USER_NOTICE); - echo($msg); + $accept = 'application/sparql-results+json'; + if ($output != null) { + $this->params['output'] = $output; } - } - } - if(preg_match("/select/i", $q)){ - $r = json_decode($aux, true); - if($conf['debug']){ - if($r == false){ - Logging::log("Warning: Results from a SELECT sparql query couldn't get parsed", E_USER_WARNING); - echo("Warning: Results from a SELECT sparql query couldn't get parsed"); + if ($output == 'xml') { + $accept = 'application/sparql-results+xml'; + } elseif ($output == 'rdf') { + $accept = 'application/rdf+xml'; + } + $aux = ""; + $modified = 0; + $now = time(); + $cacheFile = ""; + if (!empty($conf['cache']['global']) && is_int($conf['cache']['global']) && $conf['cache']['global'] > 0) { + $cacheFile = $conf['home'] . "cache/query" . md5($this->sparqlUrl . $q); + if (file_exists($cacheFile)) { + $modified = filemtime($cacheFile); + } + } + if (is_int( + $conf['cache']['global'] + ) && $conf['cache']['global'] > 0 && $modified + $conf['cache']['global'] > $now) { + if ($conf['debug']) { + $msg = "Taking data from cache ($cacheFile). Renewal in " . ($modified + $conf['cache']['global'] - $now) . " seconds\n"; + Logging::log($msg); + echo $msg; + } + $aux = (file_get_contents($cacheFile)); + } else { + $c = curl_init(); + $context = array(); + $context[0] = 'Connection: close'; + $context[1] = 'Accept: ' . $accept; + $params = $this->params; + $params['query'] = $q; + $url = $this->sparqlUrl . '?' . http_build_query($params, '', '&'); + curl_setopt($c, CURLOPT_URL, $url); + curl_setopt($c, CURLOPT_HTTPHEADER, $context); + curl_setopt($c, CURLOPT_USERAGENT, "LODSPeaKr version " . $conf['version']); + curl_setopt($c, CURLOPT_RETURNTRANSFER, true); + $aux = curl_exec($c); // execute the curl command + if ($conf['debug']) { + if ($aux == false) { + Logging::log( + "Error executing SPARQL query (" . $this->sparqlUrl . "): " . curl_error($c), + E_USER_ERROR + ); + echo("Error executing SPARQL query (" . $this->sparqlUrl . "): " . curl_error($c)); + } + } + $http_status = intval(curl_getinfo($c, CURLINFO_HTTP_CODE)); + curl_close($c); + if (!empty($auxoutput)) { + $this->params['output'] = $auxoutput; + } + if (is_int($conf['cache']['global']) && $conf['cache']['global'] > 0 && $http_status == 200) { + file_put_contents($cacheFile, ($aux), LOCK_EX); + if ($conf['debug']) { + $msg = "Notice: Writing results in " . $cacheFile . "\n"; + Logging::log($msg, E_USER_NOTICE); + echo($msg); + } + } + } + if (preg_match("/select/i", $q)) { + $r = json_decode($aux, true); + if ($conf['debug']) { + if ($r == false) { + Logging::log("Warning: Results from a SELECT sparql query couldn't get parsed", E_USER_WARNING); + echo("Warning: Results from a SELECT sparql query couldn't get parsed"); + } + } + return $r; + } + + + if (preg_match("/describe/i", $q)) { + return $aux; + } + if (preg_match("/construct/i", $q)) { + return $aux; + } + if (preg_match("/ask/i", $q)) { + $r = json_decode($aux, true); + return $r; } - } - return $r; - } - - - if(preg_match("/describe/i", $q)){ - return $aux; } - if(preg_match("/construct/i", $q)){ - return $aux; + + public function queryPost($q) + { + $params = $this->params; + $params['query'] = $q; + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $this->sparqlUrl); + curl_setopt($ch, CURLOPT_POST, count($params)); + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params)); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + //execute post + $result = curl_exec($ch); + return $result; } - if(preg_match("/ask/i", $q)){ - $r = json_decode($aux, true); - return $r; + + public function getSparqlURL() + { + return $this->sparqlUrl; } - } - - public function queryPost($q){ - $params = $this->params; - $params['query'] = $q; - $ch = curl_init(); - curl_setopt($ch,CURLOPT_URL,$this->sparqlUrl); - curl_setopt($ch,CURLOPT_POST,count($params)); - curl_setopt($ch,CURLOPT_POSTFIELDS,http_build_query($params)); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - //execute post - $result = curl_exec($ch); - return $result; - } - - public function getSparqlURL(){ - return $this->sparqlUrl; - } - -} +} diff --git a/classes/Exporter.php b/classes/Exporter.php index 7431b2ec4324fa37f6e7a99600cbcb07273478a8..89084dcd72524a74f3fdc3427c84ce0bda060f10 100644 --- a/classes/Exporter.php +++ b/classes/Exporter.php @@ -2,545 +2,538 @@ namespace uib\ub\loadspeakr; - use ARC2; -class Exporter { - private $serialization; - private $graph; - - public function __construct(){ - $this->serialization = ""; - $this->graph = array(); - define("CNT", "http://www.w3.org/2011/content#"); - define("NSVIZON", "http://graves.cl/vizon/"); - define("LS", "http://lodspeakr.org/lda/"); - define("LDA", "http://tw.rpi.edu/lda/"); - define("DC", "http://purl.org/dc/terms/"); - define("RDF", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); - define("RDFS", "http://www.w3.org/2000/01/rdf-schema#"); - define("OPMV", "http://openprovenance.org/ontology#"); - define("SKOS", "http://www.w3.org/2004/02/skos/core#"); - } - - public function run(){ - global $conf; - $triples = array(); - $t = array(); - $t['s'] = $conf['basedir']; - $t['s_type'] = 'uri'; - $t['p'] = RDF.'type'; - $t['o'] = OPMV.'Agent'; - $t['o_type'] = 'uri'; - array_push($triples, $t); - $t['o'] = SKOS.'Concept'; - array_push($triples, $t); - $t['o'] = LS.'Application'; - array_push($triples, $t); - if($conf['parentApp'] != NULL){ - $t['p'] = OPMV.'wasDerivedFrom'; - $t['o'] = $conf['parentApp']; - array_push($triples, $t); - } - - $t['p'] = LS.'usedParameter'; - $t['o'] = uniqid("_:b"); - $t['o_type'] = 'bnode'; - array_push($triples, $t); - - $t2 = array(); - $t2['s'] = $t['o']; - $t2['s_type'] = 'uri'; - $t2['p'] = RDF.'type'; - $t2['o'] = LS."Parameter"; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - $t2['p'] = RDFS.'label'; - $t2['o'] = 'root'; - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - $t2['p'] = DC.'hasFormat'; - $t2['o'] = uniqid("_:b"); - $t2['o_type'] = 'bnode'; - array_push($triples, $t2); - - $t2['s'] = $t2['o']; - $t2['s_type'] = 'bnode'; - $t2['p'] = RDF.'type'; - $t2['o'] = CNT."ContentAsText"; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - $t2['p'] = CNT.'chars'; - $t2['o'] = ($conf['root']); - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - $t2['p'] = DC.'format'; - $t2['o'] = 'text/plain;charset=utf-8'; - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - - - $t['s'] = $conf['basedir'].'endpointManagerComponent'; - $t['s_type'] = 'uri'; - $t['p'] = SKOS.'broader'; - $t['o'] = $conf['basedir']; - $t['o_type'] = 'uri'; - array_push($triples, $t); - $t['p'] = RDF.'type'; - $t['o'] = LS.'LodspeakrEndpointManagerComponent'; - $t['o_type'] = 'uri'; - array_push($triples, $t); - - $t2 = array(); - $t2['s'] = $t['o']; - $t2['s_type'] = 'uri'; - $t2['p'] = RDFS.'subClassOf'; - $t2['o'] = LDA."SparqlEndpointRetriever"; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - - //Endpoints - foreach($conf['endpoint'] as $k => $v){ - $t['p'] = LS.'usedParameter'; - $t['o'] = uniqid("_:b"); - $t['o_type'] = 'bnode'; - array_push($triples, $t); - - $t2 = array(); - $t2['s'] = $t['o']; - $t2['s_type'] = 'uri'; - $t2['p'] = RDF.'type'; - $t2['o'] = LS."Parameter"; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - $t2['p'] = RDFS.'label'; - $t2['o'] = $k; - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - $t2['p'] = DC.'hasFormat'; - $t2['o'] = uniqid("_:b"); - $t2['o_type'] = 'bnode'; - array_push($triples, $t2); - - $t2['s'] = $t2['o']; - $t2['s_type'] = 'bnode'; - $t2['p'] = RDF.'type'; - $t2['o'] = CNT."ContentAsText"; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - $t2['p'] = CNT.'chars'; - $t2['o'] = ($v); - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - $t2['p'] = DC.'format'; - $t2['o'] = 'text/plain;charset=utf-8'; - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - - } - - $t['s'] = $conf['basedir'].'namespaceManagerComponent'; - $t['s_type'] = 'uri'; - $t['p'] = SKOS.'broader'; - $t['o'] = $conf['basedir']; - $t['o_type'] = 'uri'; - array_push($triples, $t); - $t['p'] = RDF.'type'; - $t['o'] = LS.'LodspeakrNamespaceManagerComponent'; - $t['o_type'] = 'uri'; - array_push($triples, $t); - $t2['s'] = $t['o']; - $t2['s_type'] = 'uri'; - $t2['p'] = RDFS.'subClassOf'; - $t2['o'] = LDA."ProcessComponent"; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - - //Namepsaces - foreach($conf['ns'] as $k => $v){ - $t['p'] = LS.'usedParameter'; - $t['o'] = uniqid("_:b"); - $t['o_type'] = 'bnode'; - array_push($triples, $t); - - $t2 = array(); - $t2['s'] = $t['o']; - $t2['s_type'] = 'uri'; - $t2['p'] = RDF.'type'; - $t2['o'] = LS."Parameter"; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - $t2['p'] = RDFS.'label'; - $t2['o'] = $k; - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - $t2['p'] = DC.'hasFormat'; - $t2['o'] = uniqid("_:b"); - $t2['o_type'] = 'bnode'; - array_push($triples, $t2); - - $t2['s'] = $t2['o']; - $t2['s_type'] = 'bnode'; - $t2['p'] = RDF.'type'; - $t2['o'] = CNT."ContentAsText"; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - $t2['p'] = CNT.'chars'; - $t2['o'] = ($v); - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - $t2['p'] = DC.'format'; - $t2['o'] = 'text/plain;charset=utf-8'; - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - - } - - $ser = ARC2::getTurtleSerializer(); - $sparqlComponent = $conf['basedir'].'sparqlComponent';//uniqid("_:b"); - //echo $ser->getSerializedTriples($triples); - //var_dump($this->getComponents($conf['home'].$conf['view']['directory'])); - $models = $this->getComponents($conf['home'].$conf['model']['directory'], ''); - - //Define Process - $t = array(); - $t['s'] = uniqid("_:b"); - $t['s_type'] = 'bnode'; - $t['p'] = RDF.'type'; - $t['o'] = OPMV.'Process'; - $t['o_type'] = 'uri'; - array_push($triples, $t); - foreach($models as $k=>$m){ - - - - //Controlled by - $t['p'] = OPMV.'wasControlledBy'; - $t['o'] = $sparqlComponent; - $t['o_type'] = 'bnode'; - array_push($triples, $t); - - //Associated Agent to this installation - $aux = $t['o']; - $t['s'] = $t['o']; - $t['p'] = SKOS.'broader'; - $t['o'] = $conf['basedir']; - $t['o_type'] = 'uri'; - array_push($triples, $t); - - //Return object for later triple - $t['o'] = $sparqlComponent; - - // Type of query - $t2 = array(); - $t2['s'] = $t['o']; - $t2['s_type'] = 'bnode'; - $t2['p'] = RDF.'type'; - $t2['o'] = LS.'LodspeakrSparqlEndpointRetriever'; - $t2['o_type'] = 'uri'; - - $t3 = array(); - $t3['s'] = $t2['o']; - $t3['s_type'] = 'uri'; - $t3['p'] = RDFS.'subClassOf'; - $t3['o'] = LDA."ProcessComponent"; - $t3['o_type'] = 'uri'; - array_push($triples, $t3); - - array_push($triples, $t2); - $t2['p'] = RDFS.'label'; - $t2['o'] = 'Sparql endpoint component for LODSPeaKr'; - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - - $t['p'] = LS.'usedInput'; - $t['o'] = $conf['basedir'].$conf['model']['directory'].$k; - $t['o_type'] = 'uri'; - array_push($triples, $t); - - $t2 = array(); - $t2['s'] = $t['o']; - $t2['s_type'] = 'uri'; - $t2['p'] = RDF.'type'; - $t2['o'] = LS."Input"; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - $t2['p'] = RDFS.'label'; - $t2['o'] = $conf['model']['directory'].$k; - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - - $t2['p'] = DC.'hasFormat'; - $t2['o'] = uniqid("_:b"); - $t2['o_type'] = 'bnode'; - array_push($triples, $t2); - - $t2['s'] = $t2['o']; - $t2['s_type'] = 'bnode'; - $t2['p'] = RDF.'type'; - $t2['o'] = CNT."ContentAsText"; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - $t2['p'] = CNT.'chars'; - $t2['o'] = ($m); - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - $t2['p'] = DC.'format'; - $t2['o'] = 'text/plain;charset=utf-8'; - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - //break; - } - - - //Views - - $viewsComponent = $conf['basedir'].'visualizationComponent';//uniqid("_:b"); - $views = $this->getComponents($conf['home'].$conf['view']['directory'], ''); - - //Define Process - $t = array(); - $t['s'] = uniqid("_:b"); - $t['s_type'] = 'bnode'; - $t['p'] = RDF.'type'; - $t['o'] = OPMV.'Process'; - $t['o_type'] = 'uri'; - array_push($triples, $t); - foreach($views as $k=>$m){ - - - - //Controlled by - $t['p'] = OPMV.'wasControlledBy'; - $t['o'] = $viewsComponent; - $t['o_type'] = 'bnode'; - array_push($triples, $t); - - //Associated Agent to this installation - $aux = $t['o']; - $t['s'] = $t['o']; - $t['p'] = SKOS.'broader'; - $t['o'] = $conf['basedir']; - $t['o_type'] = 'uri'; - array_push($triples, $t); - - //Return object for later triple - $t['o'] = $viewsComponent; - - // Type of query - $t2 = array(); - $t2['s'] = $t['o']; - $t2['s_type'] = 'bnode'; - $t2['p'] = RDF.'type'; - $t2['o'] = LS.'LodspeakrVisualComponent'; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - - $t3 = array(); - $t3['s'] = $t2['o']; - $t3['s_type'] = 'uri'; - $t3['p'] = RDFS.'subClassOf'; - $t3['o'] = LDA."VisualComponent"; - $t3['o_type'] = 'uri'; - array_push($triples, $t3); - - $t2['p'] = RDFS.'label'; - $t2['o'] = 'Haanga-based visualization component for LODSPeaKr'; - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - - $t['p'] = LS.'usedInput'; - $t['o'] = $conf['basedir'].$conf['view']['directory'].$k; - $t['o_type'] = 'uri'; - array_push($triples, $t); - - - $t2 = array(); - $t2['s'] = $t['o']; - $t2['s_type'] = 'uri'; - $t2['p'] = RDF.'type'; - $t2['o'] = LS."Input"; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - $t2['p'] = RDFS.'label'; - $t2['o'] = $conf['view']['directory'].$k; - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - $t2['p'] = DC.'hasFormat'; - $t2['o'] = uniqid("_:b"); - $t2['o_type'] = 'bnode'; - array_push($triples, $t2); - - $t2['s'] = $t2['o']; - $t2['s_type'] = 'bnode'; - $t2['p'] = RDF.'type'; - $t2['o'] = CNT."ContentAsText"; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - $t2['p'] = CNT.'chars'; - $t2['o'] = ($m); - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - $t2['p'] = DC.'format'; - $t2['o'] = 'text/plain;charset=utf-8'; - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - //break; - } - - //Static files - - $staticComponent = $conf['basedir'].'staticComponent';//uniqid("_:b"); - $statics = $this->getComponents($conf['home'].$conf['static']['directory'], ''); - - //Define Process - $t = array(); - $t['s'] = uniqid("_:b"); - $t['s_type'] = 'bnode'; - $t['p'] = RDF.'type'; - $t['o'] = OPMV.'Process'; - $t['o_type'] = 'uri'; - array_push($triples, $t); - foreach($statics as $k=>$m){ - - - - //Controlled by - $t['p'] = OPMV.'wasControlledBy'; - $t['o'] = $staticComponent; - $t['o_type'] = 'bnode'; - array_push($triples, $t); - - //Associated Agent to this installation - $aux = $t['o']; - $t['s'] = $t['o']; - $t['p'] = SKOS.'broader'; - $t['o'] = $conf['basedir']; - $t['o_type'] = 'uri'; - array_push($triples, $t); - - //Return object for later triple - $t['o'] = $staticComponent; - - // Type of query - $t2 = array(); - $t2['s'] = $t['o']; - $t2['s_type'] = 'bnode'; - $t2['p'] = RDF.'type'; - $t2['o'] = LS.'LodspeakrStaticElementsComponent'; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - - $t3 = array(); - $t3['s'] = $t2['o']; - $t3['s_type'] = 'uri'; - $t3['p'] = RDFS.'subClassOf'; - $t3['o'] = LDA."ProcessComponent"; - $t3['o_type'] = 'uri'; - array_push($triples, $t3); - - array_push($triples, $t2); - $t2['p'] = RDFS.'label'; - $t2['o'] = 'Component of LODSPeaKr in charge of static content'; - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - - $t['p'] = LS.'usedInput'; - $t['o'] = $conf['basedir'].$conf['static']['directory'].$k; - $t['o_type'] = 'uri'; - array_push($triples, $t); - - $t2 = array(); - $t2['s'] = $t['o']; - $t2['s_type'] = 'uri'; - $t2['p'] = RDF.'type'; - $t2['o'] = LS."Input"; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - $t2['p'] = RDFS.'label'; - $t2['o'] = $conf['static']['directory'].$k; - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - - $t2['p'] = DC.'hasFormat'; - $t2['o'] = uniqid("_:b"); - $t2['o_type'] = 'bnode'; - array_push($triples, $t2); - - $t2['s'] = $t2['o']; - $t2['s_type'] = 'bnode'; - $t2['p'] = RDF.'type'; - $t2['o'] = CNT."ContentAsText"; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - $t2['p'] = CNT.'chars'; - $t2['o'] = ($m); - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - $t2['p'] = DC.'format'; - $t2['o'] = 'text/plain;charset=utf-8'; - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - //break; - } - - - echo "#You can copy and paste the following data into a new\n"; - echo "#LODSPeaKr instance at http://exampleofinstance.org/import\n"; - echo "#As a side note: this is a turtle document but is served as text/plain to make it easier to copy&paste\n\n\n"; - echo $ser->getSerializedTriples($triples); - } - - private static function getTriple($s, $p, $o){ - } - - private function createParameter($name, $value){ - $s = uniqid("_:b"); - $s_type = 'bnode'; - $p = RDF."type"; - $o = NSVIZON."Parameter"; - $o_type = 'uri'; - - - } - - private function getViews($dir){ - global $conf; - $files = ""; - chdir($dir); - $handle = opendir('.'); - while (false !== ($viewFile = readdir($handle))) { - if($viewFile != "." && $viewFile != ".."){ - $files .= $viewFile.": ".htmlspecialchars(file_get_contents($viewFile))."\n"; - $t = array(); - } - } - chdir(".."); - return $files; - } - - private function getComponents($dir, $prefix){ - global $conf; - $files = array(); - $subDirs = array(); - chdir($dir); - $handle = opendir('.'); - while (false !== ($modelFile = readdir($handle))) { - if($modelFile != "." && $modelFile != ".."){ - if(is_dir($modelFile)){ - //Save it for later, after all the queries in the current directory has been resolved - $subDirs[]=$modelFile; - }else{ - $files[$prefix.$modelFile] = (file_get_contents($modelFile))."\n"; - } - } - } - - foreach($subDirs as $dir){ - //$files[$dir] = array(); - $files = array_merge($files, $this->getComponents($dir, $prefix.$dir."/")); +class Exporter +{ + private $serialization; + private $graph; + + public function __construct() + { + $this->serialization = ""; + $this->graph = array(); + define("CNT", "http://www.w3.org/2011/content#"); + define("NSVIZON", "http://graves.cl/vizon/"); + define("LS", "http://lodspeakr.org/lda/"); + define("LDA", "http://tw.rpi.edu/lda/"); + define("DC", "http://purl.org/dc/terms/"); + define("RDF", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); + define("RDFS", "http://www.w3.org/2000/01/rdf-schema#"); + define("OPMV", "http://openprovenance.org/ontology#"); + define("SKOS", "http://www.w3.org/2004/02/skos/core#"); + } + + public function run() + { + global $conf; + $triples = array(); + $t = array(); + $t['s'] = $conf['basedir']; + $t['s_type'] = 'uri'; + $t['p'] = RDF . 'type'; + $t['o'] = OPMV . 'Agent'; + $t['o_type'] = 'uri'; + array_push($triples, $t); + $t['o'] = SKOS . 'Concept'; + array_push($triples, $t); + $t['o'] = LS . 'Application'; + array_push($triples, $t); + if ($conf['parentApp'] != null) { + $t['p'] = OPMV . 'wasDerivedFrom'; + $t['o'] = $conf['parentApp']; + array_push($triples, $t); + } + + $t['p'] = LS . 'usedParameter'; + $t['o'] = uniqid("_:b"); + $t['o_type'] = 'bnode'; + array_push($triples, $t); + + $t2 = array(); + $t2['s'] = $t['o']; + $t2['s_type'] = 'uri'; + $t2['p'] = RDF . 'type'; + $t2['o'] = LS . "Parameter"; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + $t2['p'] = RDFS . 'label'; + $t2['o'] = 'root'; + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + $t2['p'] = DC . 'hasFormat'; + $t2['o'] = uniqid("_:b"); + $t2['o_type'] = 'bnode'; + array_push($triples, $t2); + + $t2['s'] = $t2['o']; + $t2['s_type'] = 'bnode'; + $t2['p'] = RDF . 'type'; + $t2['o'] = CNT . "ContentAsText"; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + $t2['p'] = CNT . 'chars'; + $t2['o'] = ($conf['root']); + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + $t2['p'] = DC . 'format'; + $t2['o'] = 'text/plain;charset=utf-8'; + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + + + $t['s'] = $conf['basedir'] . 'endpointManagerComponent'; + $t['s_type'] = 'uri'; + $t['p'] = SKOS . 'broader'; + $t['o'] = $conf['basedir']; + $t['o_type'] = 'uri'; + array_push($triples, $t); + $t['p'] = RDF . 'type'; + $t['o'] = LS . 'LodspeakrEndpointManagerComponent'; + $t['o_type'] = 'uri'; + array_push($triples, $t); + + $t2 = array(); + $t2['s'] = $t['o']; + $t2['s_type'] = 'uri'; + $t2['p'] = RDFS . 'subClassOf'; + $t2['o'] = LDA . "SparqlEndpointRetriever"; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + + //Endpoints + foreach ($conf['endpoint'] as $k => $v) { + $t['p'] = LS . 'usedParameter'; + $t['o'] = uniqid("_:b"); + $t['o_type'] = 'bnode'; + array_push($triples, $t); + + $t2 = array(); + $t2['s'] = $t['o']; + $t2['s_type'] = 'uri'; + $t2['p'] = RDF . 'type'; + $t2['o'] = LS . "Parameter"; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + $t2['p'] = RDFS . 'label'; + $t2['o'] = $k; + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + $t2['p'] = DC . 'hasFormat'; + $t2['o'] = uniqid("_:b"); + $t2['o_type'] = 'bnode'; + array_push($triples, $t2); + + $t2['s'] = $t2['o']; + $t2['s_type'] = 'bnode'; + $t2['p'] = RDF . 'type'; + $t2['o'] = CNT . "ContentAsText"; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + $t2['p'] = CNT . 'chars'; + $t2['o'] = ($v); + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + $t2['p'] = DC . 'format'; + $t2['o'] = 'text/plain;charset=utf-8'; + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + } + + $t['s'] = $conf['basedir'] . 'namespaceManagerComponent'; + $t['s_type'] = 'uri'; + $t['p'] = SKOS . 'broader'; + $t['o'] = $conf['basedir']; + $t['o_type'] = 'uri'; + array_push($triples, $t); + $t['p'] = RDF . 'type'; + $t['o'] = LS . 'LodspeakrNamespaceManagerComponent'; + $t['o_type'] = 'uri'; + array_push($triples, $t); + $t2['s'] = $t['o']; + $t2['s_type'] = 'uri'; + $t2['p'] = RDFS . 'subClassOf'; + $t2['o'] = LDA . "ProcessComponent"; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + + //Namepsaces + foreach ($conf['ns'] as $k => $v) { + $t['p'] = LS . 'usedParameter'; + $t['o'] = uniqid("_:b"); + $t['o_type'] = 'bnode'; + array_push($triples, $t); + + $t2 = array(); + $t2['s'] = $t['o']; + $t2['s_type'] = 'uri'; + $t2['p'] = RDF . 'type'; + $t2['o'] = LS . "Parameter"; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + $t2['p'] = RDFS . 'label'; + $t2['o'] = $k; + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + $t2['p'] = DC . 'hasFormat'; + $t2['o'] = uniqid("_:b"); + $t2['o_type'] = 'bnode'; + array_push($triples, $t2); + + $t2['s'] = $t2['o']; + $t2['s_type'] = 'bnode'; + $t2['p'] = RDF . 'type'; + $t2['o'] = CNT . "ContentAsText"; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + $t2['p'] = CNT . 'chars'; + $t2['o'] = ($v); + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + $t2['p'] = DC . 'format'; + $t2['o'] = 'text/plain;charset=utf-8'; + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + } + + $ser = ARC2::getTurtleSerializer(); + $sparqlComponent = $conf['basedir'] . 'sparqlComponent';//uniqid("_:b"); + //echo $ser->getSerializedTriples($triples); + //var_dump($this->getComponents($conf['home'].$conf['view']['directory'])); + $models = $this->getComponents($conf['home'] . $conf['model']['directory'], ''); + + //Define Process + $t = array(); + $t['s'] = uniqid("_:b"); + $t['s_type'] = 'bnode'; + $t['p'] = RDF . 'type'; + $t['o'] = OPMV . 'Process'; + $t['o_type'] = 'uri'; + array_push($triples, $t); + foreach ($models as $k => $m) { + //Controlled by + $t['p'] = OPMV . 'wasControlledBy'; + $t['o'] = $sparqlComponent; + $t['o_type'] = 'bnode'; + array_push($triples, $t); + + //Associated Agent to this installation + $aux = $t['o']; + $t['s'] = $t['o']; + $t['p'] = SKOS . 'broader'; + $t['o'] = $conf['basedir']; + $t['o_type'] = 'uri'; + array_push($triples, $t); + + //Return object for later triple + $t['o'] = $sparqlComponent; + + // Type of query + $t2 = array(); + $t2['s'] = $t['o']; + $t2['s_type'] = 'bnode'; + $t2['p'] = RDF . 'type'; + $t2['o'] = LS . 'LodspeakrSparqlEndpointRetriever'; + $t2['o_type'] = 'uri'; + + $t3 = array(); + $t3['s'] = $t2['o']; + $t3['s_type'] = 'uri'; + $t3['p'] = RDFS . 'subClassOf'; + $t3['o'] = LDA . "ProcessComponent"; + $t3['o_type'] = 'uri'; + array_push($triples, $t3); + + array_push($triples, $t2); + $t2['p'] = RDFS . 'label'; + $t2['o'] = 'Sparql endpoint component for LODSPeaKr'; + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + + $t['p'] = LS . 'usedInput'; + $t['o'] = $conf['basedir'] . $conf['model']['directory'] . $k; + $t['o_type'] = 'uri'; + array_push($triples, $t); + + $t2 = array(); + $t2['s'] = $t['o']; + $t2['s_type'] = 'uri'; + $t2['p'] = RDF . 'type'; + $t2['o'] = LS . "Input"; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + $t2['p'] = RDFS . 'label'; + $t2['o'] = $conf['model']['directory'] . $k; + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + + $t2['p'] = DC . 'hasFormat'; + $t2['o'] = uniqid("_:b"); + $t2['o_type'] = 'bnode'; + array_push($triples, $t2); + + $t2['s'] = $t2['o']; + $t2['s_type'] = 'bnode'; + $t2['p'] = RDF . 'type'; + $t2['o'] = CNT . "ContentAsText"; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + $t2['p'] = CNT . 'chars'; + $t2['o'] = ($m); + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + $t2['p'] = DC . 'format'; + $t2['o'] = 'text/plain;charset=utf-8'; + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + //break; + } + + + //Views + + $viewsComponent = $conf['basedir'] . 'visualizationComponent';//uniqid("_:b"); + $views = $this->getComponents($conf['home'] . $conf['view']['directory'], ''); + + //Define Process + $t = array(); + $t['s'] = uniqid("_:b"); + $t['s_type'] = 'bnode'; + $t['p'] = RDF . 'type'; + $t['o'] = OPMV . 'Process'; + $t['o_type'] = 'uri'; + array_push($triples, $t); + foreach ($views as $k => $m) { + //Controlled by + $t['p'] = OPMV . 'wasControlledBy'; + $t['o'] = $viewsComponent; + $t['o_type'] = 'bnode'; + array_push($triples, $t); + + //Associated Agent to this installation + $aux = $t['o']; + $t['s'] = $t['o']; + $t['p'] = SKOS . 'broader'; + $t['o'] = $conf['basedir']; + $t['o_type'] = 'uri'; + array_push($triples, $t); + + //Return object for later triple + $t['o'] = $viewsComponent; + + // Type of query + $t2 = array(); + $t2['s'] = $t['o']; + $t2['s_type'] = 'bnode'; + $t2['p'] = RDF . 'type'; + $t2['o'] = LS . 'LodspeakrVisualComponent'; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + + $t3 = array(); + $t3['s'] = $t2['o']; + $t3['s_type'] = 'uri'; + $t3['p'] = RDFS . 'subClassOf'; + $t3['o'] = LDA . "VisualComponent"; + $t3['o_type'] = 'uri'; + array_push($triples, $t3); + + $t2['p'] = RDFS . 'label'; + $t2['o'] = 'Haanga-based visualization component for LODSPeaKr'; + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + + $t['p'] = LS . 'usedInput'; + $t['o'] = $conf['basedir'] . $conf['view']['directory'] . $k; + $t['o_type'] = 'uri'; + array_push($triples, $t); + + + $t2 = array(); + $t2['s'] = $t['o']; + $t2['s_type'] = 'uri'; + $t2['p'] = RDF . 'type'; + $t2['o'] = LS . "Input"; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + $t2['p'] = RDFS . 'label'; + $t2['o'] = $conf['view']['directory'] . $k; + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + $t2['p'] = DC . 'hasFormat'; + $t2['o'] = uniqid("_:b"); + $t2['o_type'] = 'bnode'; + array_push($triples, $t2); + + $t2['s'] = $t2['o']; + $t2['s_type'] = 'bnode'; + $t2['p'] = RDF . 'type'; + $t2['o'] = CNT . "ContentAsText"; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + $t2['p'] = CNT . 'chars'; + $t2['o'] = ($m); + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + $t2['p'] = DC . 'format'; + $t2['o'] = 'text/plain;charset=utf-8'; + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + //break; + } + + //Static files + + $staticComponent = $conf['basedir'] . 'staticComponent';//uniqid("_:b"); + $statics = $this->getComponents($conf['home'] . $conf['static']['directory'], ''); + + //Define Process + $t = array(); + $t['s'] = uniqid("_:b"); + $t['s_type'] = 'bnode'; + $t['p'] = RDF . 'type'; + $t['o'] = OPMV . 'Process'; + $t['o_type'] = 'uri'; + array_push($triples, $t); + foreach ($statics as $k => $m) { + //Controlled by + $t['p'] = OPMV . 'wasControlledBy'; + $t['o'] = $staticComponent; + $t['o_type'] = 'bnode'; + array_push($triples, $t); + + //Associated Agent to this installation + $aux = $t['o']; + $t['s'] = $t['o']; + $t['p'] = SKOS . 'broader'; + $t['o'] = $conf['basedir']; + $t['o_type'] = 'uri'; + array_push($triples, $t); + + //Return object for later triple + $t['o'] = $staticComponent; + + // Type of query + $t2 = array(); + $t2['s'] = $t['o']; + $t2['s_type'] = 'bnode'; + $t2['p'] = RDF . 'type'; + $t2['o'] = LS . 'LodspeakrStaticElementsComponent'; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + + $t3 = array(); + $t3['s'] = $t2['o']; + $t3['s_type'] = 'uri'; + $t3['p'] = RDFS . 'subClassOf'; + $t3['o'] = LDA . "ProcessComponent"; + $t3['o_type'] = 'uri'; + array_push($triples, $t3); + + array_push($triples, $t2); + $t2['p'] = RDFS . 'label'; + $t2['o'] = 'Component of LODSPeaKr in charge of static content'; + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + + $t['p'] = LS . 'usedInput'; + $t['o'] = $conf['basedir'] . $conf['static']['directory'] . $k; + $t['o_type'] = 'uri'; + array_push($triples, $t); + + $t2 = array(); + $t2['s'] = $t['o']; + $t2['s_type'] = 'uri'; + $t2['p'] = RDF . 'type'; + $t2['o'] = LS . "Input"; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + $t2['p'] = RDFS . 'label'; + $t2['o'] = $conf['static']['directory'] . $k; + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + + $t2['p'] = DC . 'hasFormat'; + $t2['o'] = uniqid("_:b"); + $t2['o_type'] = 'bnode'; + array_push($triples, $t2); + + $t2['s'] = $t2['o']; + $t2['s_type'] = 'bnode'; + $t2['p'] = RDF . 'type'; + $t2['o'] = CNT . "ContentAsText"; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + $t2['p'] = CNT . 'chars'; + $t2['o'] = ($m); + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + $t2['p'] = DC . 'format'; + $t2['o'] = 'text/plain;charset=utf-8'; + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + //break; + } + + + echo "#You can copy and paste the following data into a new\n"; + echo "#LODSPeaKr instance at http://exampleofinstance.org/import\n"; + echo "#As a side note: this is a turtle document but is served as text/plain to make it easier to copy&paste\n\n\n"; + echo $ser->getSerializedTriples($triples); + } + + private static function getTriple($s, $p, $o) + { + } + + private function createParameter($name, $value) + { + $s = uniqid("_:b"); + $s_type = 'bnode'; + $p = RDF . "type"; + $o = NSVIZON . "Parameter"; + $o_type = 'uri'; + } + + private function getViews($dir) + { + global $conf; + $files = ""; + chdir($dir); + $handle = opendir('.'); + while (false !== ($viewFile = readdir($handle))) { + if ($viewFile != "." && $viewFile != "..") { + $files .= $viewFile . ": " . htmlspecialchars(file_get_contents($viewFile)) . "\n"; + $t = array(); + } + } + chdir(".."); + return $files; + } + + private function getComponents($dir, $prefix) + { + global $conf; + $files = array(); + $subDirs = array(); + chdir($dir); + $handle = opendir('.'); + while (false !== ($modelFile = readdir($handle))) { + if ($modelFile != "." && $modelFile != "..") { + if (is_dir($modelFile)) { + //Save it for later, after all the queries in the current directory has been resolved + $subDirs[] = $modelFile; + } else { + $files[$prefix . $modelFile] = (file_get_contents($modelFile)) . "\n"; + } + } + } + + foreach ($subDirs as $dir) { + //$files[$dir] = array(); + $files = array_merge($files, $this->getComponents($dir, $prefix . $dir . "/")); + } + chdir(".."); + return $files; } - chdir(".."); - return $files; - } } diff --git a/classes/HTTPStatus.php b/classes/HTTPStatus.php index 579d6bbda781d33e1fb2326900366a43e18de620..5355dca7c4410ec6e1e858695a6fbe83209e59bf 100644 --- a/classes/HTTPStatus.php +++ b/classes/HTTPStatus.php @@ -4,61 +4,67 @@ namespace uib\ub\loadspeakr; use stdClass; -class HTTPStatus { - - public static function send303($uri, $ext){ - header("HTTP/1.0 303 See Other"); - header("Location: ".$uri); - header("Content-type: ".$ext); - echo HTTPStatus::_getContent("303", $uri); - exit(0); - } +class HTTPStatus +{ + public static function send303($uri, $ext) + { + header("HTTP/1.0 303 See Other"); + header("Location: " . $uri); + header("Content-type: " . $ext); + echo HTTPStatus::_getContent("303", $uri); + exit(0); + } + + public static function send401($uri) + { + header("HTTP/1.0 401 Forbidden"); + echo HTTPStatus::_getContent("401", $uri); + exit(0); + } + + public static function send404($uri) + { + header("HTTP/1.0 404 Not Found"); + $alt = "LODSPeaKr couldn't find the resource " . $uri; + echo HTTPStatus::_getContent("404", $alt); + exit(0); + } + + public static function send406($uri) + { + header("HTTP/1.0 406 Not Acceptable"); + $alt = "LODSPeaKr can't return content acceptable according to the Accept headers sent in the request for " . $uri; + echo HTTPStatus::_getContent("406", $alt); + exit(0); + } + + public static function send500($uri) + { + header("HTTP/1.0 500 Internal Server Error"); + $alt = "There was an internal error when processing " . $uri; + echo HTTPStatus::_getContent("500", $alt); + exit(0); + } + + private static function _getContent($n, $alt) + { + global $conf; + global $lodspk; + $lodspk['root'] = $conf['root']; + $lodspk['home'] = $conf['basedir']; + $lodspk['baseUrl'] = $conf['basedir']; + $lodspk['ns'] = $conf['ns']; + $lodspk['this']['value'] = $uri; + $lodspk['this']['curie'] = Utils::uri2curie($uri); + $lodspk['this']['local'] = $localUri; + + $file = $conf['httpStatus']['directory'] . "/" . $n . ".template"; - public static function send401($uri){ - header("HTTP/1.0 401 Forbidden"); - echo HTTPStatus::_getContent("401", $uri); - exit(0); - } - - public static function send404($uri){ - header("HTTP/1.0 404 Not Found"); - $alt = "LODSPeaKr couldn't find the resource ".$uri; - echo HTTPStatus::_getContent("404", $alt); - exit(0); - } - - public static function send406($uri){ - header("HTTP/1.0 406 Not Acceptable"); - $alt = "LODSPeaKr can't return content acceptable according to the Accept headers sent in the request for ".$uri; - echo HTTPStatus::_getContent("406", $alt); - exit(0); - } - - public static function send500($uri){ - header("HTTP/1.0 500 Internal Server Error"); - $alt = "There was an internal error when processing ".$uri; - echo HTTPStatus::_getContent("500", $alt); - exit(0); - } - - private static function _getContent($n, $alt){ - global $conf; - global $lodspk; - $lodspk['root'] = $conf['root']; - $lodspk['home'] = $conf['basedir']; - $lodspk['baseUrl'] = $conf['basedir']; - $lodspk['ns'] = $conf['ns']; - $lodspk['this']['value'] = $uri; - $lodspk['this']['curie'] = Utils::uri2curie($uri); - $lodspk['this']['local'] = $localUri; - - $file = $conf['httpStatus']['directory']."/".$n.".template"; - - if(file_exists($conf['home'].$file)){ - require_once("Utils.php"); - Utils::showView($lodspk, new stdClass(), $file); - }else{ - return $alt."\n\n"; + if (file_exists($conf['home'] . $file)) { + require_once("Utils.php"); + Utils::showView($lodspk, new stdClass(), $file); + } else { + return $alt . "\n\n"; + } } - } } diff --git a/classes/Importer.php b/classes/Importer.php index 48a9ef3198bcbf86f91e7722eaeebdd7ac31027d..7ace900372e2a1004e0acfc3c31653498b811ebb 100644 --- a/classes/Importer.php +++ b/classes/Importer.php @@ -13,314 +13,322 @@ define("CNT", "http://www.w3.org/2011/content#"); define("RDFS", "http://www.w3.org/2000/01/rdf-schema#"); define("FILE", "settings.inc.php"); -class Importer { - - private $basedir; - private $external_basedir; +class Importer +{ + private $basedir; + private $external_basedir; - public function run(){ - set_time_limit(0); - error_reporting(E_ERROR); - if(is_file(FILE)){ - echo "There is an existing ".FILE." file on this installation. Please remove it before importing a new one"; - exit(0); - } - if(!isset($_GET['import']) && !isset($_POST['importtext'])){ - $this->showInterface(); - exit(0); - } - if(!is_writable('.')){ - echo 'The webserver needs write permissions in "lodspeakr/" "lodspeakr/models/" and "lodspeakr/views/" dirs to import settings.'; - exit(0); - } - - echo $this->external_basedir; - $parser = ARC2::getTurtleParser(); - - if(isset($_GET['import'])){ - $parser->parse($_GET['import']); - $this->external_basedir = str_replace('export', '', $_GET['import']); - }elseif(isset($_POST['importtext'])){ - $parser->parse(RDF, $_POST['importtext']); - }else{ - HTTPStatus::send500(); - exit(0); - } - $triples = $parser->getTriples(); - - $appArr = $this->search($triples, null, RDF.'type', LS.'Application'); - if(!(sizeof($appArr) > 0)){ - echo "I can't find an application from the URL given"; - exit(0); - } - - $app = $appArr[0]['s']; - $this->external_basedir = $app; - $compArr = $this->search($triples, null, SKOS.'broader', $app); - $content = "<?\n\$conf['debug'] = false;\n\$conf['mirror_external_uris'] = true;\n\n"; - - $this->basedir = preg_replace('/import$/', '', (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']); - - //$arr = explode("lodspeakr/benegesserit", $this->basedir); - //$this->basedir = $arr[0]; - $content .= "\$conf['basedir'] = \"$this->basedir\";\n"; - $content .= "\$conf['parentApp'] = \"$app\";\n"; - $pwd = getcwd(); - $content .= "\$conf['home'] = \"$pwd/\";\n"; - - //App params - - $q = $this->search($triples, $app, LS.'usedParameter', null); - $appParams = array(); - foreach($q as $p){ - $param = $p['o']; - $labelArr = $this->search($triples, $param, RDFS.'label', null); - $label = $labelArr[0]['o']; - $format = $this->search($triples, $param, DC.'hasFormat', null); - $cntArr = $this->search($triples, $format[0]['o'], CNT.'chars', null); - $cnt = $cntArr[0]['o']; - $appParams[$label] = $cnt; - } - foreach($appParams as $k => $v){ - $content .= "\$conf['$k'] = \"$v\";\n"; - } - $content .= "/*ATTENTION: By default this application is available to + public function run() + { + set_time_limit(0); + error_reporting(E_ERROR); + if (is_file(FILE)) { + echo "There is an existing " . FILE . " file on this installation. Please remove it before importing a new one"; + exit(0); + } + if (!isset($_GET['import']) && !isset($_POST['importtext'])) { + $this->showInterface(); + exit(0); + } + if (!is_writable('.')) { + echo 'The webserver needs write permissions in "lodspeakr/" "lodspeakr/models/" and "lodspeakr/views/" dirs to import settings.'; + exit(0); + } + + echo $this->external_basedir; + $parser = ARC2::getTurtleParser(); + + if (isset($_GET['import'])) { + $parser->parse($_GET['import']); + $this->external_basedir = str_replace('export', '', $_GET['import']); + } elseif (isset($_POST['importtext'])) { + $parser->parse(RDF, $_POST['importtext']); + } else { + HTTPStatus::send500(); + exit(0); + } + $triples = $parser->getTriples(); + + $appArr = $this->search($triples, null, RDF . 'type', LS . 'Application'); + if (!(sizeof($appArr) > 0)) { + echo "I can't find an application from the URL given"; + exit(0); + } + + $app = $appArr[0]['s']; + $this->external_basedir = $app; + $compArr = $this->search($triples, null, SKOS . 'broader', $app); + $content = "<?\n\$conf['debug'] = false;\n\$conf['mirror_external_uris'] = true;\n\n"; + + $this->basedir = preg_replace( + '/import$/', + '', + (!empty($_SERVER['HTTPS'])) ? "https://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] : "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] + ); + + //$arr = explode("lodspeakr/benegesserit", $this->basedir); + //$this->basedir = $arr[0]; + $content .= "\$conf['basedir'] = \"$this->basedir\";\n"; + $content .= "\$conf['parentApp'] = \"$app\";\n"; + $pwd = getcwd(); + $content .= "\$conf['home'] = \"$pwd/\";\n"; + + //App params + + $q = $this->search($triples, $app, LS . 'usedParameter', null); + $appParams = array(); + foreach ($q as $p) { + $param = $p['o']; + $labelArr = $this->search($triples, $param, RDFS . 'label', null); + $label = $labelArr[0]['o']; + $format = $this->search($triples, $param, DC . 'hasFormat', null); + $cntArr = $this->search($triples, $format[0]['o'], CNT . 'chars', null); + $cnt = $cntArr[0]['o']; + $appParams[$label] = $cnt; + } + foreach ($appParams as $k => $v) { + $content .= "\$conf['$k'] = \"$v\";\n"; + } + $content .= "/*ATTENTION: By default this application is available to * be exported and copied (its configuration) * by others. If you do not want that, * turn the next option as false */ \$conf['export'] = true;\n\n"; - //Components - foreach($compArr as $v){ - $component = $v['s']; - $componentTypeArr = $this->search($triples, $component, RDF.'type', null); - $compType = $componentTypeArr[0]['o']; - - $params = array(); - $q = $this->search($triples, $component, LS.'usedParameter', null); - foreach($q as $p){ - $param = $p['o']; - $labelArr = $this->search($triples, $param, RDFS.'label', null); - $label = $labelArr[0]['o']; - $format = $this->search($triples, $param, DC.'hasFormat', null); - $cntArr = $this->search($triples, $format[0]['o'], CNT.'chars', null); - $cnt = $cntArr[0]['o']; - $params[$label] = $cnt; - } - - $inputs = array(); - $q = $this->search($triples, $component, LS.'usedInput', null); - foreach($q as $p){ - $param = $p['o']; - $labelArr = $this->search($triples, $param, RDFS.'label', null); - if(sizeof($labelArr)>0){ - $label = $labelArr[0]['o']; - $format = $this->search($triples, $param, DC.'hasFormat', null); - $cntArr = $this->search($triples, $format[0]['o'], CNT.'chars', null); - $cnt = $cntArr[0]['o']; - $inputs[$label] = $cnt; - } - } - if($compType == LS."LodspeakrEndpointManagerComponent"){ - $content .= $this->createEndpoints($params); - }elseif($compType == LS."LodspeakrNamespaceManagerComponent"){ - $content .= $this->createNamespaces($params); - }elseif($compType == LS."LodspeakrSparqlEndpointRetriever"){ - $this->createModels($inputs); - }elseif($compType == LS."LodspeakrStaticElementsComponent"){ - $this->createStatics($inputs); - }elseif($compType == LS."LodspeakrVisualComponent"){ - $this->createViews($inputs); - }else{ - if($conf['debug']){ - Logging::log("Component '$component' (of type $compType) not supported", E_USER_WARNING); - } - } - } - $content .= "?>\n"; - try{ - $fh = fopen(FILE, 'a'); - fwrite($fh, $content); - fclose($fh); - } catch (Exception $e) { - echo 'Caught exception while writing settings: ', $e->getMessage(), "\n"; - exit(1); - } - $this->showFinishing(); - } - - private function createEndpoints($ep){ - require('common.inc.php'); - $endpoints = ""; - try{ - foreach($ep as $k => $v){ - if($conf['endpoint'][$k] != $v){ - $endpoints .= "\$conf[\"endpoint\"][\"$k\"] = \"$v\";\n"; - } - } - $endpoints .= "\n\n"; - } catch (Exception $e) { - echo 'Caught exception while importing endpoints: ', $e->getMessage(), "\n"; - exit(1); - } - return $endpoints; - } - - private function createNamespaces($ns){ - require('namespaces.php'); - $namespaces = ""; - try{ - foreach($ns as $k => $v){ - if($conf["ns"][$k] != $v){ - if(preg_match("|^".$this->external_basedir."|", $v)){ - $newns = preg_replace("|^".$this->external_basedir."|", $this->basedir, $v); - $namespaces .= "\$conf[\"ns\"][\"".$k."_ext\"] = \"$newns\";\n"; - } - $namespaces .= "\$conf[\"ns\"][\"$k\"] = \"$v\";\n"; - } - } - $namespaces .= "\$conf[\"ns\"][\"basedir\"] = \"$this->basedir\";\n"; - $namespaces .= "\n\n"; - } catch (Exception $e) { - echo 'Caught exception while importing namespaces: ', $e->getMessage(), "\n"; - exit(1); - } - return $namespaces; - } - - private function createModels($models){ - try{ - foreach($models as $k => $v){ - $path = explode("/", $k); - for($i=0; $i<sizeof($path)-1; $i++){ - if(file_exists($path[$i])){ - if(!is_dir($path[$i])){ - unlink($path[$i]); - mkdir($path[$i]); - } - }else{ - mkdir($path[$i]); - } - chdir($path[$i]); - } - - $fh = fopen(end($path), 'w'); - fwrite($fh, $v); - fclose($fh); - for($i=0; $i<sizeof($path)-1; $i++){ - chdir('..'); - } - } - } catch (Exception $e) { - echo 'Caught exception while importing models: ', $e->getMessage(), "\n"; - exit(1); - } - } - - - private function createViews($views){ - try{ - foreach($views as $k => $v){ - $path = explode("/", $k); - for($i=0; $i<sizeof($path)-1; $i++){ - if(file_exists($path[$i])){ - if(!is_dir($path[$i])){ - unlink($path[$i]); - mkdir($path[$i]); - } - }else{ - mkdir($path[$i]); - } - chdir($path[$i]); - } - - $fh = fopen(end($path), 'w'); - fwrite($fh, $v); - fclose($fh); - for($i=0; $i<sizeof($path)-1; $i++){ - chdir('..'); - } - } - } catch (Exception $e) { - echo 'Caught exception while importing views: ', $e->getMessage(), "\n"; - exit(1); - } - } - - - private function createStatics($statics){ - try{ - foreach($statics as $k => $v){ - $path = explode("/", $k); - for($i=0; $i<sizeof($path)-1; $i++){ - if(file_exists($path[$i])){ - if(!is_dir($path[$i])){ - unlink($path[$i]); - mkdir($path[$i]); - } - }else{ - mkdir($path[$i]); - } - chdir($path[$i]); - } - - $fh = fopen(end($path), 'w'); - fwrite($fh, $v); - fclose($fh); - for($i=0; $i<sizeof($path)-1; $i++){ - chdir('..'); - } - } - } catch (Exception $e) { - echo 'Caught exception while importing statics: ', $e->getMessage(), "\n"; - exit(1); - } - } - - - private function search($graph, $s = null, $p = null, $o = null){ - $results = array(); - foreach($graph as $v){ - $threeOks = 0; - - //Check subject - if($s != null){ - if($v['s'] == $s){ - $threeOks++; - } - }else{ - $threeOks++; - } - - //Check predicate - if($p != null){ - if($v['p'] == $p){ - $threeOks++; - } - }else{ - $threeOks++; - } - - //Check object - if($o != null){ - if($v['o'] == $o){ - $threeOks++; - } - }else{ - $threeOks++; - } - - if($threeOks == 3){ - array_push($results, $v); - } - - } - return $results; - //$this->showFinishing(); - } - - private function showInterface(){ - $doc = "<html> + //Components + foreach ($compArr as $v) { + $component = $v['s']; + $componentTypeArr = $this->search($triples, $component, RDF . 'type', null); + $compType = $componentTypeArr[0]['o']; + + $params = array(); + $q = $this->search($triples, $component, LS . 'usedParameter', null); + foreach ($q as $p) { + $param = $p['o']; + $labelArr = $this->search($triples, $param, RDFS . 'label', null); + $label = $labelArr[0]['o']; + $format = $this->search($triples, $param, DC . 'hasFormat', null); + $cntArr = $this->search($triples, $format[0]['o'], CNT . 'chars', null); + $cnt = $cntArr[0]['o']; + $params[$label] = $cnt; + } + + $inputs = array(); + $q = $this->search($triples, $component, LS . 'usedInput', null); + foreach ($q as $p) { + $param = $p['o']; + $labelArr = $this->search($triples, $param, RDFS . 'label', null); + if (sizeof($labelArr) > 0) { + $label = $labelArr[0]['o']; + $format = $this->search($triples, $param, DC . 'hasFormat', null); + $cntArr = $this->search($triples, $format[0]['o'], CNT . 'chars', null); + $cnt = $cntArr[0]['o']; + $inputs[$label] = $cnt; + } + } + if ($compType == LS . "LodspeakrEndpointManagerComponent") { + $content .= $this->createEndpoints($params); + } elseif ($compType == LS . "LodspeakrNamespaceManagerComponent") { + $content .= $this->createNamespaces($params); + } elseif ($compType == LS . "LodspeakrSparqlEndpointRetriever") { + $this->createModels($inputs); + } elseif ($compType == LS . "LodspeakrStaticElementsComponent") { + $this->createStatics($inputs); + } elseif ($compType == LS . "LodspeakrVisualComponent") { + $this->createViews($inputs); + } else { + if ($conf['debug']) { + Logging::log("Component '$component' (of type $compType) not supported", E_USER_WARNING); + } + } + } + $content .= "?>\n"; + try { + $fh = fopen(FILE, 'a'); + fwrite($fh, $content); + fclose($fh); + } catch (Exception $e) { + echo 'Caught exception while writing settings: ', $e->getMessage(), "\n"; + exit(1); + } + $this->showFinishing(); + } + + private function createEndpoints($ep) + { + require('common.inc.php'); + $endpoints = ""; + try { + foreach ($ep as $k => $v) { + if ($conf['endpoint'][$k] != $v) { + $endpoints .= "\$conf[\"endpoint\"][\"$k\"] = \"$v\";\n"; + } + } + $endpoints .= "\n\n"; + } catch (Exception $e) { + echo 'Caught exception while importing endpoints: ', $e->getMessage(), "\n"; + exit(1); + } + return $endpoints; + } + + private function createNamespaces($ns) + { + require('namespaces.php'); + $namespaces = ""; + try { + foreach ($ns as $k => $v) { + if ($conf["ns"][$k] != $v) { + if (preg_match("|^" . $this->external_basedir . "|", $v)) { + $newns = preg_replace("|^" . $this->external_basedir . "|", $this->basedir, $v); + $namespaces .= "\$conf[\"ns\"][\"" . $k . "_ext\"] = \"$newns\";\n"; + } + $namespaces .= "\$conf[\"ns\"][\"$k\"] = \"$v\";\n"; + } + } + $namespaces .= "\$conf[\"ns\"][\"basedir\"] = \"$this->basedir\";\n"; + $namespaces .= "\n\n"; + } catch (Exception $e) { + echo 'Caught exception while importing namespaces: ', $e->getMessage(), "\n"; + exit(1); + } + return $namespaces; + } + + private function createModels($models) + { + try { + foreach ($models as $k => $v) { + $path = explode("/", $k); + for ($i = 0; $i < sizeof($path) - 1; $i++) { + if (file_exists($path[$i])) { + if (!is_dir($path[$i])) { + unlink($path[$i]); + mkdir($path[$i]); + } + } else { + mkdir($path[$i]); + } + chdir($path[$i]); + } + + $fh = fopen(end($path), 'w'); + fwrite($fh, $v); + fclose($fh); + for ($i = 0; $i < sizeof($path) - 1; $i++) { + chdir('..'); + } + } + } catch (Exception $e) { + echo 'Caught exception while importing models: ', $e->getMessage(), "\n"; + exit(1); + } + } + + private function createViews($views) + { + try { + foreach ($views as $k => $v) { + $path = explode("/", $k); + for ($i = 0; $i < sizeof($path) - 1; $i++) { + if (file_exists($path[$i])) { + if (!is_dir($path[$i])) { + unlink($path[$i]); + mkdir($path[$i]); + } + } else { + mkdir($path[$i]); + } + chdir($path[$i]); + } + + $fh = fopen(end($path), 'w'); + fwrite($fh, $v); + fclose($fh); + for ($i = 0; $i < sizeof($path) - 1; $i++) { + chdir('..'); + } + } + } catch (Exception $e) { + echo 'Caught exception while importing views: ', $e->getMessage(), "\n"; + exit(1); + } + } + + private function createStatics($statics) + { + try { + foreach ($statics as $k => $v) { + $path = explode("/", $k); + for ($i = 0; $i < sizeof($path) - 1; $i++) { + if (file_exists($path[$i])) { + if (!is_dir($path[$i])) { + unlink($path[$i]); + mkdir($path[$i]); + } + } else { + mkdir($path[$i]); + } + chdir($path[$i]); + } + + $fh = fopen(end($path), 'w'); + fwrite($fh, $v); + fclose($fh); + for ($i = 0; $i < sizeof($path) - 1; $i++) { + chdir('..'); + } + } + } catch (Exception $e) { + echo 'Caught exception while importing statics: ', $e->getMessage(), "\n"; + exit(1); + } + } + + private function search($graph, $s = null, $p = null, $o = null) + { + $results = array(); + foreach ($graph as $v) { + $threeOks = 0; + + //Check subject + if ($s != null) { + if ($v['s'] == $s) { + $threeOks++; + } + } else { + $threeOks++; + } + + //Check predicate + if ($p != null) { + if ($v['p'] == $p) { + $threeOks++; + } + } else { + $threeOks++; + } + + //Check object + if ($o != null) { + if ($v['o'] == $o) { + $threeOks++; + } + } else { + $threeOks++; + } + + if ($threeOks == 3) { + array_push($results, $v); + } + } + return $results; + //$this->showFinishing(); + } + + private function showInterface() + { + $doc = "<html> <head> <title>Importing options</title> </head> @@ -335,21 +343,21 @@ class Importer { </form> </body> </html>"; - echo $doc; - } - - private function showFinishing(){ - $doc = "<html> + echo $doc; + } + + private function showFinishing() + { + $doc = "<html> <head> <title>Finishing import</title> </head> <body> <h2>Import finished</h2> - Your new application is ready. Please go to the <a href='".$this->basedir."'>home page</a>. + Your new application is ready. Please go to the <a href='" . $this->basedir . "'>home page</a>. </body> </html>"; - echo $doc; - } - -} + echo $doc; + } +} diff --git a/classes/Logging.php b/classes/Logging.php index efbcc3f314d52c7264145c1ade449c5f55c0c25d..d047d45611b530098a234de3d24f994c7e0186cb 100644 --- a/classes/Logging.php +++ b/classes/Logging.php @@ -2,44 +2,44 @@ namespace uib\ub\loadspeakr; - -class Logging { - - public static function init(){ - $logs = array(); - if ($handle = opendir('cache/')) { - while (false !== ($entry = readdir($handle))) { - if (strpos($entry, ".log") == strlen($entry)-4) { - $logs[] = $entry; +class Logging +{ + public static function init() + { + $logs = array(); + if ($handle = opendir('cache/')) { + while (false !== ($entry = readdir($handle))) { + if (strpos($entry, ".log") == strlen($entry) - 4) { + $logs[] = $entry; + } + } + closedir($handle); } - } - closedir($handle); - } - sort($logs); - $alogs = ""; - $list = array(); - foreach($logs as $v){ - $newtokens = array( ".", "/"); - $oldtokens = array("___DOT___", "___SLASH___"); - $label = str_replace($oldtokens, $newtokens, $v); - $x = explode("_", $label); - $y = array_shift($x); - array_shift($x); - if(!isset($list[$y])){ - $list[$y] = array(); - } - $list[$y][] = array("name" => implode("_", $x), "url" => $v); - //$alogs .= "<p><a href='#lodspeakr/cache/$v'>$label</a></p>"; - } - krsort($list); - foreach($list as $k => $v){ - $alogs .= "<li>".date("H:i:s", $k)."<ul>\n"; - foreach($v as $w){ - $alogs .= " <li><a href='#cache/".$w['url']."'>".$w['name']."</a></li>\n"; // TSL : removed hardcoded "lodspeakr" after # - } - $alogs .="</ul></li>"; - } - echo " + sort($logs); + $alogs = ""; + $list = array(); + foreach ($logs as $v) { + $newtokens = array(".", "/"); + $oldtokens = array("___DOT___", "___SLASH___"); + $label = str_replace($oldtokens, $newtokens, $v); + $x = explode("_", $label); + $y = array_shift($x); + array_shift($x); + if (!isset($list[$y])) { + $list[$y] = array(); + } + $list[$y][] = array("name" => implode("_", $x), "url" => $v); + //$alogs .= "<p><a href='#lodspeakr/cache/$v'>$label</a></p>"; + } + krsort($list); + foreach ($list as $k => $v) { + $alogs .= "<li>" . date("H:i:s", $k) . "<ul>\n"; + foreach ($v as $w) { + $alogs .= " <li><a href='#cache/" . $w['url'] . "'>" . $w['name'] . "</a></li>\n"; // TSL : removed hardcoded "lodspeakr" after # + } + $alogs .= "</ul></li>"; + } + echo " <!DOCTYPE html> <html> <head> @@ -122,27 +122,30 @@ class Logging { </script> </body> </html>"; - } - public static function log($msg){ - global $conf; - $log = array('timestamp' => time()); - $log['message'] = $msg; - if($conf['logfile'] != null){ - fwrite($conf['logfile'], ", ".json_encode($log)); } - } - public static function createLogFile($url){ - $oldtokens = array( ".", "/"); - $newtokens = array("___DOT___", "___SLASH___"); - $filename = str_replace($oldtokens, $newtokens, $url); - $logfile = fopen("cache/".time()."_".rand()."_".$filename.".log", "w"); - if($logfile === FALSE){ - die("Can't create log file. Check permissions in <tt>cache/</tt> directory."); + public static function log($msg) + { + global $conf; + $log = array('timestamp' => time()); + $log['message'] = $msg; + if ($conf['logfile'] != null) { + fwrite($conf['logfile'], ", " . json_encode($log)); + } } - $initialmsg = array('timestamp' => time(), 'message' => "Starting log for ".$url); - fwrite($logfile, "{ \"logs\": [".json_encode($initialmsg)); - return $logfile; - } + public static function createLogFile($url) + { + $oldtokens = array(".", "/"); + $newtokens = array("___DOT___", "___SLASH___"); + $filename = str_replace($oldtokens, $newtokens, $url); + $logfile = fopen("cache/" . time() . "_" . rand() . "_" . $filename . ".log", "w"); + if ($logfile === false) { + die("Can't create log file. Check permissions in <tt>cache/</tt> directory."); + } + $initialmsg = array('timestamp' => time(), 'message' => "Starting log for " . $url); + fwrite($logfile, "{ \"logs\": [" . json_encode($initialmsg)); + + return $logfile; + } } diff --git a/classes/MetaDb.php b/classes/MetaDb.php index 97d448cc3fa8afe71a14d4ddec7a67b73293ec3c..528ac74ba325a0a4724c7896ddcab14430de1529 100644 --- a/classes/MetaDb.php +++ b/classes/MetaDb.php @@ -2,51 +2,55 @@ namespace uib\ub\loadspeakr; - use Exception; use PDO; use PDOException; -class MetaDb { - private $dbLocation; - - public function __construct($location){ - $this->dbLocation = $location; - } - - public function query($q){ +class MetaDb +{ + private $dbLocation; + + public function __construct($location) + { + $this->dbLocation = $location; + } + + public function query($q) + { global $conf; - try{ - $db = new PDO('sqlite:'.$this->dbLocation); - $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); - - $results = array(); - foreach($db->query($q) as $entry) { - array_push($results, $entry); - } - $db = NULL; - }catch(PDOException $e){ - print 'Exception query : '.$e->getMessage()."\nDatabase used:".$this->dbLocation."\nPlease check the webserver has write permissions to the file AND the directory, as well as you have installed the driver for PHP and SQLite"; - exit(10); - } + try { + $db = new PDO('sqlite:' . $this->dbLocation); + $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); + + $results = array(); + foreach ($db->query($q) as $entry) { + array_push($results, $entry); + } + $db = null; + } catch (PDOException $e) { + print 'Exception query : ' . $e->getMessage( + ) . "\nDatabase used:" . $this->dbLocation . "\nPlease check the webserver has write permissions to the file AND the directory, as well as you have installed the driver for PHP and SQLite"; + exit(10); + } return $results; - } - - public function write($q){ + } + + public function write($q) + { global $conf; - try{ - $db = new PDO('sqlite:'.$this->dbLocation); - $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $results = $db->exec($q); - $db = NULL; - }catch(Exception $e){ - echo "Can't write in SQLite database. Please check you have granted write permissions to <tt>meta/</tt> and <tt>meta/db.sqlite</tt>.<br/>Also you can check a list of <a href='https://github.com/alangrafu/lodspeakr/wiki/CommonErrors'>common errors</a> and how to <a href='https://github.com/alangrafu/lodspeakr/wiki/Wipe-out-the-database'>wipe out the database</a>'"; - if($conf['debug']){ - Logging::log('Exception exec: '.$e->getMessage(), E_USER_ERROR); - } - exit(1); - } + try { + $db = new PDO('sqlite:' . $this->dbLocation); + $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $results = $db->exec($q); + $db = null; + } catch (Exception $e) { + echo "Can't write in SQLite database. Please check you have granted write permissions to <tt>meta/</tt> and <tt>meta/db.sqlite</tt>.<br/>Also you can check a list of <a href='https://github.com/alangrafu/lodspeakr/wiki/CommonErrors'>common errors</a> and how to <a href='https://github.com/alangrafu/lodspeakr/wiki/Wipe-out-the-database'>wipe out the database</a>'"; + if ($conf['debug']) { + Logging::log('Exception exec: ' . $e->getMessage(), E_USER_ERROR); + } + exit(1); + } return $results; - } - + } + } diff --git a/classes/Queries.php b/classes/Queries.php index ece59d1b33e807b5bd9e1a7090eebce5029d0775..4c52e09fa8fca24bd7da60d12c6b75c0cec7f133 100644 --- a/classes/Queries.php +++ b/classes/Queries.php @@ -5,9 +5,11 @@ namespace uib\ub\loadspeakr; use Exception; -class Queries { - public static function uriExist($uri, $e){ - $q = "ASK WHERE{ +class Queries +{ + public static function uriExist($uri, $e) + { + $q = "ASK WHERE{ { GRAPH ?g{ {<$uri> ?p1 []} @@ -24,15 +26,16 @@ class Queries { {[] ?p2 <$uri>} } }"; - $r = $e->query($q); - if($r['boolean'] && strtolower($r['boolean']) !== false){ - return true; - } - return false; - } - - public static function getClass($uri, $e){ - $q = "SELECT DISTINCT ?class ?inst WHERE{ + $r = $e->query($q); + if ($r['boolean'] && strtolower($r['boolean']) !== false) { + return true; + } + return false; + } + + public static function getClass($uri, $e) + { + $q = "SELECT DISTINCT ?class ?inst WHERE{ { GRAPH ?g{ { @@ -49,69 +52,67 @@ class Queries { } } }"; - try{ - $r = $e->query($q); - }catch (Exception $ex){ - echo $ex->getMessage(); - } - $result = array(); - /*if(sizeof($r['results']['bindings']) == 0){ - return 'http://www.w3.org/2000/01/rdf-schema#Resource'; //default value if no type is present - }*/ - //$result[] = 'http://www.w3.org/2000/01/rdf-schema#Resource'; //All resources are rdf:type rdfs:Resource - foreach($r['results']['bindings'] as $v){ - $result[]= $v['class']['value']; - } - return $result; - } - - - public static function getMetadata($uri, $format, $e){ - global $conf; - $q = <<<QUERY + try { + $r = $e->query($q); + } catch (Exception $ex) { + echo $ex->getMessage(); + } + $result = array(); + /*if(sizeof($r['results']['bindings']) == 0){ + return 'http://www.w3.org/2000/01/rdf-schema#Resource'; //default value if no type is present + }*/ + //$result[] = 'http://www.w3.org/2000/01/rdf-schema#Resource'; //All resources are rdf:type rdfs:Resource + foreach ($r['results']['bindings'] as $v) { + $result[] = $v['class']['value']; + } + return $result; + } + + public static function getMetadata($uri, $format, $e) + { + global $conf; + $q = <<<QUERY SELECT uri, doc, format FROM document WHERE (uri = "$uri" AND format = "$format") OR doc = "$uri" LIMIT 1 QUERY; - $r = $e->query($q); - if(sizeof($r) > 0){ - $u = $r[0]['uri']; - $p = $r[0]['doc']; - $f = $r[0]['format']; - return array($u, $p, $f); - }else{ - return NULL; - } - } - + $r = $e->query($q); + if (sizeof($r) > 0) { + $u = $r[0]['uri']; + $p = $r[0]['doc']; + $f = $r[0]['format']; + return array($u, $p, $f); + } else { + return null; + } + } + + public static function createPage($uri, $localUri, $contentType, $e) + { + global $conf; - public static function createPage($uri, $localUri, $contentType, $e){ - global $conf; - - $ext = 'html'; - $inserts = ""; - foreach($conf['http_accept'] as $extension => $f){ - $page = $localUri.$conf['extension_connector'].$extension; - foreach($f as $v){ - if($contentType == $v){ - $returnPage = $localUri.$conf['extension_connector'].$extension; - } - if($inserts != ""){ - $inserts .= "UNION "; - } - $inserts .= "SELECT '$uri', '$page', '$v' \n"; - if($v == $contentType){ - $ext = $extension; - } - } - } - $q = <<<QUERY + $ext = 'html'; + $inserts = ""; + foreach ($conf['http_accept'] as $extension => $f) { + $page = $localUri . $conf['extension_connector'] . $extension; + foreach ($f as $v) { + if ($contentType == $v) { + $returnPage = $localUri . $conf['extension_connector'] . $extension; + } + if ($inserts != "") { + $inserts .= "UNION "; + } + $inserts .= "SELECT '$uri', '$page', '$v' \n"; + if ($v == $contentType) { + $ext = $extension; + } + } + } + $q = <<<QUERY INSERT INTO document (uri, doc, format) $inserts QUERY; - $r = $e->write($q); - - return $returnPage; - } - -} + $r = $e->write($q); + return $returnPage; + } +} diff --git a/classes/Utils.php b/classes/Utils.php index 7e082224f00955c81dd70dfc265bfaeb67bd87c3..01fc9b90cc2ae25590c29d2bf87a02bb5b7ab33b 100644 --- a/classes/Utils.php +++ b/classes/Utils.php @@ -2,820 +2,853 @@ namespace uib\ub\loadspeakr; - use ARC2; use Exception; use Haanga; use stdClass; -class Utils { - - public static function uri2curie($uri){ - global $conf; - $ns = $conf['ns']; - $curie = $uri; - - $aux = $uri; - foreach($ns as $k => $v){ - $aux = preg_replace("|^$v|", "", $uri); - if($aux != $uri){ - $uriSegments = explode("/", $aux); - $lastSegment = array_pop($uriSegments); - if(sizeof($uriSegments)>0){ - $prefix = $k."_".(implode("_", $uriSegments)); - //Adding "new" namespace - $conf['ns'][$prefix] = $v.implode("/", $uriSegments)."/"; - }else{ - $prefix = $k; - } - $curie = $prefix.":".$lastSegment; - break; - } - } - return $curie; - } - - public static function curie2uri($curie){ - global $conf; - $ns = $conf['ns']; - $parts = explode(':', $curie); - //Avoid if we have a namespace prefix called 'http' - if(preg_match('|^//|', $parts[1])){ - return $curie; - } - if(sizeof($parts)>1 ){ - if(!isset($ns[$parts[0]])){ - $prefixSegments = explode("_", $parts[0]); - $realPrefix = array_shift($prefixSegments); - $conf['ns'][$parts[0]] = $ns[$realPrefix].join("/", $prefixSegments); - return $ns[$realPrefix].join("/", $prefixSegments)."/".$parts[1]; - }else{ - return $ns[$parts[0]].$parts[1]; - } - }else{ - return $curie; - } - } - - public static function getPrefix($curie){ - global $conf; - $ns = $conf['ns']; - $parts = explode(':', $curie); - //Avoid if we have a namespace prefix called 'http' - if(preg_match('|^//|', $parts[1])){ - return $curie; - } - return array('ns' => $ns[$parts[0]], 'prefix' => $parts[0]); - } - - public static function getTemplate($uri){ - $filename = str_replace(":", "_", $uri); - if(file_exists ($filename)){ - include_once($filename); - } - } - - private static function sparqlResult2Obj($data){ - global $conf; - $obj = array(); - if(!isset($data['results'])){ - foreach($data as $k => $v){ - $obj[$k] = Utils::sparqlResult2Obj($v); - } - }else{ - $aux = $data['results']['bindings']; - if(sizeof($aux)>0){ - foreach($aux as $w){ - $row = array(); - foreach($w as $k => $v){ - - $row[$k]['value'] = $v['value']; - if($v['type'] == 'uri'){ - $row[$k]['curie'] = Utils::uri2curie($v['value']); - $exploded = explode(":",$row[$k]['curie']); - $row[$k]['localname'] = array_pop($exploded); - $row[$k]['uri'] = 1; - }elseif($v['type'] == 'bnode'){ - $row[$k]['curie'] = 'blankNode'; - $row[$k]['blank'] = 1; - }else{ - $row[$k]['literal'] = 1; - $row[$k]['curie'] = $v['value']; - if(isset($v['datatype'])){ - $row[$k]['type'] = $v['datatype']; - } - if(isset($v['xml:lang'])){ - $row[$k]['lang'] = $v['xml:lang']; - } - - } - } - /*if(sizeof($aux) == 1){ - $obj = $row; - }*/ - if(sizeof($row) >0){ - array_push($obj, $row); - } - - } - } - } - return $obj; - } - - - - public static function getExtension($accept_string){ - global $conf; - $extension = "html"; - foreach($conf['http_accept'] as $ext => $accept_arr){ - if(in_array($accept_string, $accept_arr)){ - $extension = $ext; - } - } - return $extension; - } - - public static function getBestContentType($accept_string){ - global $conf; - $a = explode(",", $accept_string); - $b = array(); - foreach($a as $v){ - foreach($conf['http_accept'] as $formatTypeArray){ - if(strstr($v, ";")){ - $aux = explode(";", $v); - $aux[0] = trim($aux[0]); - if(in_array($aux[0], $formatTypeArray)){ - $b[$aux[0]] = floatval(trim(str_replace("q=","",$aux[1]))); - } - }else{ - $value = trim($v); - if(in_array($value, $formatTypeArray)){ - $b[$value] = 1.0; - } - } - } - } - $a = $b; - arsort($a); - $ct = 'text/html'; - foreach($a as $k => $v){ - $ct = $k; - break; - } - if($ct == NULL || $ct == "" || $ct == "*/*"){ - $ct = 'text/html'; - } - return $ct; - } - - - private static function travelTree($tree){ - $results = array(); - if(is_string($tree)){ - return $tree; - } - foreach($tree as $t){ - $aux = Utils::travelTree($t); - if(is_array($aux)){ - $results = array_merge($results, $aux); - }else{ - array_push($results, $aux); - } - } - return $results; - } - - - public static function serializeRdf($data, $extension='rdf'){ - global $conf; - global $lodspk; - $ser; - $dPointer; - $docs = Utils::travelTree($data); - $parser = ARC2::getRDFParser(); - $triples = array(); - - foreach($docs as $d){ - $parser->parse($conf['basedir'], $d); - $t = $parser->getTriples(); - $triples = array_merge($triples, $t); - } - if($lodspk['mirror_external_uris']){ - global $uri; - global $localUri; - $t = array(); - $t['s'] = $localUri; - $t['s_type'] = 'uri'; - $t['p'] = "http://www.w3.org/2002/07/owl#sameAs"; - $t['o'] = $uri; - $t['o_type'] = 'uri'; - array_push($triples, $t); - $t['p'] = "http://www.w3.org/2000/10/swap/pim/contact#preferredURI"; - array_push($triples, $t); - } - switch ($extension){ - case 'ttl': - $ser = ARC2::getTurtleSerializer(); - break; - case 'nt': - $ser = ARC2::getNTriplesSerializer(); - break; - case 'json': - $ser = ARC2::getRDFJSONSerializer(); - break; - case 'jsonp': - $ser = ARC2::getRDFJSONSerializer(); - break; - case 'rdf': - $ser = ARC2::getRDFXMLSerializer(); - break; - case 'html': - return array("content" => $triples, "serialized" => false); - break; - default: - $ser = null; - } - if($ser != null){ - $doc = $ser->getSerializedTriples($triples); - }else{ - $doc = var_export($data, true); - } - return array("content" => $doc, "serialized" => true); - } - - public static function processDocument($viewFile, $lodspk, $data){ - global $conf; - global $lodspk; - $contentType = $lodspk['contentType']; - $extension = Utils::getExtension($contentType); - - header('Content-Type: '.$contentType); - if(isset($lodspk['resultRdf']) && $lodspk['resultRdf'] == true){ - $rdfData = Utils::serializeRdf($data, $extension); - if($rdfData["serialized"]){ - echo $rdfData["content"]; - }else{ - $data['rdf'] = new stdClass(); - - $subjectCounter = 0; - $sIndex = array(); - $sCounter = array(); - $spCounter = array(); - foreach($rdfData["content"] as $t){ - //SUBJECT - if($t['s_type'] == 'uri'){ - $subject = $t['s']; - $subjectCurie = Utils::uri2curie($subject); - $subjectMethod = str_replace(":", "__", $subjectCurie); - }else{ - if(isset($sIndex[$t['s']])){ - $subject = $sIndex[$t['s']]; - $subjectCurie = $sIndex[$t['s']]; - $subjectMethod = $sIndex[$t['s']]; - }else{ - $subject = "_bnode".$subjectCounter; - $subjectCurie = "_bnode".$subjectCounter; - $subjectMethod = "_bnode".$subjectCounter; - $sIndex[$t['s']] = "_bnode".$subjectCounter++; - } - } - if(!isset($data['rdf']->subjects)){ - $data['rdf']->subjects = new stdClass(); - } - - if(!isset($data['rdf']->$subjectMethod)){ - $data['rdf']->$subjectMethod = new stdClass(); - $data['rdf']->$subjectMethod->predicates = new stdClass(); - } - $data['rdf']->$subjectMethod->mirroredUri = $subject; - $data['rdf']->$subjectMethod->mirroredCurie = $subjectCurie; - - $data['rdf']->$subjectMethod->value = Utils::getUnMirroredUri($subject); - $data['rdf']->$subjectMethod->curie = Utils::uri2curie( $data['rdf']->$subjectMethod->value); - - if(!isset($data['rdf']->subjects->$subjectMethod)){ - $data['rdf']->subjects->$subjectMethod = $data['rdf']->$subjectMethod; - } - - - - - //PREDICATE - $predicate = $t['p']; - $predicateCurie = Utils::uri2curie($predicate); - $predicateMethod = str_replace(":", "__", $predicateCurie); - if(!isset($data['rdf']->$subjectMethod->$predicateMethod)){ - $data['rdf']->$subjectMethod->$predicateMethod = new stdClass(); - } - - - $data['rdf']->$subjectMethod->$predicateMethod->mirroredUri = $predicate; - $data['rdf']->$subjectMethod->$predicateMethod->mirroredCurie = $predicateCurie; - $data['rdf']->$subjectMethod->$predicateMethod->value = Utils::getUnMirroredUri($predicate); - $data['rdf']->$subjectMethod->$predicateMethod->curie = Utils::uri2curie( $data['rdf']->$subjectMethod->$predicateMethod->value); - - - if(!isset($data['rdf']->$subjectMethod->predicates)){ - $data['rdf']->$subjectMethod->predicates = new stdClass(); - } - if(!isset($sCounter[$subjectMethod])){ - $sCounter[$subjectMethod] = 0; - } - $sCount = $sCounter[$subjectMethod]++; - $data['rdf']->$subjectMethod->predicates->$sCount = $data['rdf']->$subjectMethod->$predicateMethod; - - - //OBJECT - if($t['o_type'] == 'uri'){ - $object = $t['o']; - $objectCurie = Utils::uri2curie($object); - }elseif($t['o_type'] == 'literal'){ - $object = $t['o']; - $objectCurie = $object; - }else{ - if(isset($sIndex[$t['o']])){ - $object = $sIndex[$t['o']]; - $objectCurie = $sIndex[$t['o']]; - }else{ - $object = "_bnode".$objectCounter; - $objectCurie = "_bnode".$objectCounter; - $sIndex[$t['s']] = "_bnode".$objectCounter++; - } - } - - - $obj = new stdClass(); - $obj->mirroredUri = $object; - $obj->mirroredCurie = $objectCurie; - $obj->value = Utils::getUnMirroredUri($object); - $obj->curie = Utils::uri2curie($obj->value); - - - if(!isset($spCounter[$subjectMethod." ".$predicateMethod])){ - $spCounter[$subjectMethod." ".$predicateMethod] = 0; - } - $sCount = $spCounter[$subjectMethod." ".$predicateMethod]++; - $data['rdf']->$subjectMethod->$predicateMethod->objects->$sCount = $obj; - } - Utils::showView($lodspk, $data, $viewFile); - } - }else{ - Utils::showView($lodspk, $data, $viewFile); - } - } - - public static function getResultsType($query){ - global $conf; - global $uri; - if(preg_match("/select/i", $query)){ - return $conf['output']['select']; - }elseif(preg_match("/describe/i", $query)){ - return $conf['output']['describe']; - }elseif(preg_match("/construct/i", $query)){ - return $conf['output']['describe']; - }elseif(preg_match("/ask/i", $query)){ - return $conf['output']['ask']; - }else{ - HTTPStatus::send500($uri); - } - } - - public static function queryDir($modelDir, &$r, &$f){ - global $conf; - global $uri; - global $lodspk; - global $endpoints; - global $results; - $strippedModelDir = str_replace('endpoint.', '', $modelDir); - $lodspk['model'] = $modelDir; - $originalDir = getcwd(); - $subDirs= array(); - if($conf['debug']){ - Logging::log("Entering $strippedModelDir from ".getcwd(), E_USER_NOTICE); - } - chdir($modelDir); - $handle = opendir('.'); - - while (false !== ($modelFile = readdir($handle))) { - if($modelFile != "." && $modelFile != ".." && strpos($modelFile, ".") !== 0){ - if(is_dir($modelFile)){ - if(strpos('endpoint.', $modelFile) == 0){ - if($conf['debug']){ - Logging::log("Save $modelFile for later, after all the queries in the current directory has been resolved", E_USER_NOTICE); - } - $subDirs[]=$modelFile; - } - }else{ - if(preg_match('/\.query$/', $modelFile)){ - $e = null; - if(!isset($endpoints[$strippedModelDir])){ - if($conf['debug']){ - Logging::log("Creating endpoint for $strippedModelDir", E_USER_NOTICE); - } - if(!isset($conf['endpoint'][$strippedModelDir])){ - if($conf['debug']){ - Logging::log("Couldn't find $strippedModelDir as a list of available endpoints. Will continue using 'local'", E_USER_WARNING); - } - $e = $endpoints['local']; - }else{ - $endpoints[$strippedModelDir] = new Endpoint($conf['endpoint'][$strippedModelDir], $conf['endpoint']['config']); - $e = $endpoints[$strippedModelDir]; - } - }else{ - $e = $endpoints[$strippedModelDir]; - } - if($modelDir != $lodspk['type']){ - if(!isset($r[$strippedModelDir]) ){ - $r[$strippedModelDir] = array(); - $f[$strippedModelDir] = array(); - } - Utils::queryFile($modelFile, $e, $r[$strippedModelDir], $f); - }else{ - Utils::queryFile($modelFile, $e, $r, $f); - } - } - } - } - } - closedir($handle); - $originalDir = $lodspk['model']; - if(isset($subDirs)){ - foreach($subDirs as $v){ - if(!isset($r[$modelDir])){ - $r[$modelDir] = array(); - } - if($modelDir != $lodspk['type']){ - Utils::queryDir($v, $r[$strippedModelDir], $f[$strippedModelDir]); - }else{ - Utils::queryDir($v, $r, $f); - } - } - } - // chdir($conf['home']); - //return $data; - } - - - public static function queryFile($modelFile, $e, &$rPointer, &$fPointer){ - global $conf; - global $lodspk; - global $results; - global $firstResults; - global $uri; - $data = array(); - $strippedModelFile = str_replace('endpoint.', '', str_replace('.query', '',$modelFile)); - if(!is_dir($modelFile)){ - require_once($conf['home'].'lib/Haanga/lib/Haanga.php'); - Haanga::configure(array( - 'cache_dir' => $conf['home'].'cache/', - 'autoescape' => FALSE, - )); - - //Haanga supports the dot (.) convention only for objects - if(is_array($lodspk) && !empty($lodspk)){ - $lodspkObj = Convert::array_to_object($lodspk); - $lodspk = $lodspkObj; - } - $r2 = Convert::array_copy($results); - $models = Convert::array_to_object($r2); - $f2 = Convert::array_copy($firstResults); - $first = Convert::array_to_object($f2); - $vars = compact('uri', 'lodspk', 'conf', 'models', 'first'); - $q = file_get_contents($modelFile); - if($q == false){ - HTTPStatus::send500("I can't load ".$modelFile." in ".getcwd()); - } - $fnc = Haanga::compile($q); - $query = $fnc($vars, TRUE); - - if(is_object($lodspk)){ - $lodspkObj = Convert::object_to_array($lodspk); - $lodspk = $lodspkObj; - } - $query = Utils::addPrefixes($query); - if(!empty($lodspk['transform_select_query']) && $lodspk['transform_select_query']==true){ - $parser = ARC2::getSPARQLParser(); - $parser->parse($query); - $sparqlConstruct = array(); - if (!$parser->getErrors()) { - $resultVars = array(); - $q_infos = $parser->getQueryInfos(); - foreach($q_infos['query']['result_vars'] as $v){ - if($v['type'] == 'var'){ - $resultVars[$v['value']] = 1; - } - }; - $x = Utils::extractObj($q_infos['query']['pattern']); - foreach($x as $v){ - if(($resultVars[$v['s']] && $v['s_type'] == 'var') - || ($resultVars[$v['p']] && $v['p_type'] == 'var') - || ($resultVars[$v['o']] && $v['o_type'] == 'var')){ - array_push($sparqlConstruct, $v); - } - } - $construct = ""; - foreach($sparqlConstruct as $v){ - if($v['s_type'] == 'uri'){ - $construct .= "<".$v['s']."> "; - }elseif($v['s_type'] == 'var'){ - $construct .= '?'.$v['s'].' '; - }else{ - $construct.= $v['s']." "; - } - - if($v['p_type'] == 'uri'){ - $construct .= "<".$v['p']."> "; - }elseif($v['p_type'] == 'var'){ - $construct .= '?'.$v['p'].' '; - }else{ - $construct.= $v['p']." "; - } - - if($v['o_type'] == 'uri'){ - $construct .= "<".$v['o']."> "; - }elseif($v['o_type'] == 'literal'){ - $construct .= '"'.$v['o'].'" '; - }elseif($v['o_type'] == 'var'){ - $construct .= '?'.$v['o'].' '; - }else{ - $construct.= $v['o']." "; - } - - $construct .= ".\n"; - } - if($construct == ""){ - if(sizeof($q_infos['query']['result_vars'])>0){ - //For now, assuming variables are in the GRAPH ?g - $query = "CONSTRUCT {?g ?x ?y} WHERE{GRAPH ?g{?g ?x ?y}}"; - }else{ - if(!preg_match('/construct/i', $query)){ - HTTPStatus::send500(); - } - } - }else{ - $query = preg_replace('/select\s*[^{]*\s*(where)?\s*{/i', 'CONSTRUCT {'.$construct.'} WHERE{', $query); - } - }else { - return; - //HTTPStatus::send500("invalid query: " . var_export($parser->getErrors(), true)."\n\nQUERY:\n".$query); - } - } - if($conf['debug']){ - Logging::log($modelFile." against ".$e->getSparqlUrl()); - Logging::log($query); - Logging::log("Running query from ".$modelFile." on endpoint ".$e->getSparqlURL(), E_USER_NOTICE); - } - $initTime = microtime(true); - $aux = $e->query($query, Utils::getResultsType($query)); - $endTime = microtime(true); - if($conf['debug']){ - Logging::log("Execution time: ".($endTime - $initTime)." seconds"); - } - $timeObj = new stdClass(); - $timeObj->query = new stdClass(); - $timeObj->query->value = $strippedModelFile; - $timeObj->time = new stdClass(); - $timeObj->time->value = ($endTime - $initTime); - $lodspk['queryTimes'][$strippedModelFile] = $timeObj; - if($modelFile != $lodspk['type']){ - if(!isset($rPointer[$strippedModelFile])){ - $rPointer[$strippedModelFile] = array(); - $firstResults[$strippedModelFile] = array(); - } - if(Utils::getResultsType($query) == $conf['output']['select']){ - $rPointer[$strippedModelFile] = Utils::sparqlResult2Obj($aux); - if (!empty($rPointer[$strippedModelFile][0])) { - $fPointer[$strippedModelFile] = $rPointer[$strippedModelFile][0]; +class Utils +{ + public static function uri2curie($uri) + { + global $conf; + $ns = $conf['ns']; + $curie = $uri; + + $aux = $uri; + foreach ($ns as $k => $v) { + $aux = preg_replace("|^$v|", "", $uri); + if ($aux != $uri) { + $uriSegments = explode("/", $aux); + $lastSegment = array_pop($uriSegments); + if (sizeof($uriSegments) > 0) { + $prefix = $k . "_" . (implode("_", $uriSegments)); + //Adding "new" namespace + $conf['ns'][$prefix] = $v . implode("/", $uriSegments) . "/"; + } else { + $prefix = $k; + } + $curie = $prefix . ":" . $lastSegment; + break; + } + } + return $curie; + } + + public static function curie2uri($curie) + { + global $conf; + $ns = $conf['ns']; + $parts = explode(':', $curie); + //Avoid if we have a namespace prefix called 'http' + if (preg_match('|^//|', $parts[1])) { + return $curie; + } + if (sizeof($parts) > 1) { + if (!isset($ns[$parts[0]])) { + $prefixSegments = explode("_", $parts[0]); + $realPrefix = array_shift($prefixSegments); + $conf['ns'][$parts[0]] = $ns[$realPrefix] . join("/", $prefixSegments); + return $ns[$realPrefix] . join("/", $prefixSegments) . "/" . $parts[1]; + } else { + return $ns[$parts[0]] . $parts[1]; + } + } else { + return $curie; + } + } + + public static function getPrefix($curie) + { + global $conf; + $ns = $conf['ns']; + $parts = explode(':', $curie); + //Avoid if we have a namespace prefix called 'http' + if (preg_match('|^//|', $parts[1])) { + return $curie; + } + return array('ns' => $ns[$parts[0]], 'prefix' => $parts[0]); + } + + public static function getTemplate($uri) + { + $filename = str_replace(":", "_", $uri); + if (file_exists($filename)) { + include_once($filename); + } + } + + private static function sparqlResult2Obj($data) + { + global $conf; + $obj = array(); + if (!isset($data['results'])) { + foreach ($data as $k => $v) { + $obj[$k] = Utils::sparqlResult2Obj($v); + } + } else { + $aux = $data['results']['bindings']; + if (sizeof($aux) > 0) { + foreach ($aux as $w) { + $row = array(); + foreach ($w as $k => $v) { + $row[$k]['value'] = $v['value']; + if ($v['type'] == 'uri') { + $row[$k]['curie'] = Utils::uri2curie($v['value']); + $exploded = explode(":", $row[$k]['curie']); + $row[$k]['localname'] = array_pop($exploded); + $row[$k]['uri'] = 1; + } elseif ($v['type'] == 'bnode') { + $row[$k]['curie'] = 'blankNode'; + $row[$k]['blank'] = 1; + } else { + $row[$k]['literal'] = 1; + $row[$k]['curie'] = $v['value']; + if (isset($v['datatype'])) { + $row[$k]['type'] = $v['datatype']; + } + if (isset($v['xml:lang'])) { + $row[$k]['lang'] = $v['xml:lang']; + } + } + } + /*if(sizeof($aux) == 1){ + $obj = $row; + }*/ + if (sizeof($row) > 0) { + array_push($obj, $row); } - }else{ - $lodspk['resultRdf'] = true; - $rPointer[$strippedModelFile] = $aux; - } - }else{ - if(Utils::getResultsType($query) == $conf['output']['select']){ - $rPointer = Utils::sparqlResult2Obj($aux); - $fPointer[$strippedModelFile] = $rPointer[0]; - }else{ - $lodspk['resultRdf'] = true; - $rPointer = $aux; - } - } - }else{ - if(strpos('endpoint.', $modelFile) == 0){ - if($conf['debug']){ - Logging::log("$modelFile is a directory, will process it later", E_USER_NOTICE); - } - if($modelFile != $lodspk['type']){ - if(!isset($rPointer[$strippedModelFile])){ - $rPointer[$strippedModelFile] = array(); - } - Utils::queryDir($modelFile, $rPointer[$strippedModelFile], $fPointer[$strippedModelFile]); - }else{ - Utils::queryDir($modelFile, $rPointer, $fPointer); - } - } - } - } - - public static function internalize($array){ - global $conf; - $firstResultsKeyAppearance = true; - foreach($array as $key => $value){ - if(!isset($value['value'])){ - $array[$key] = Utils::internalize($value); - /*if($firstResultsKeyAppearance){ - $firstResultsKeyAppearance = false; - $array['_firstResults']=$array[$key]; - }*/ - }else{ - if(isset($value['uri']) && $value['uri'] == 1){ - //If there is no mirroring, it wouldn't hurt to have available this value (e.g., using templates from a mirrored instance to a non-mirrored one) - $value['mirroredUri'] = $value['value']; - $value['mirroredCurie'] = Utils::uri2curie($value['value']); - if(isset($conf['mirror_external_uris']) && $conf['mirror_external_uris'] != false){ - $value['value'] = Utils::getUnMirroredUri($value['value']); - } - $value['curie'] = Utils::uri2curie($value['value']); - $array[$key] = $value; - } - } - } - return $array; - } - - public static function getfirstResults($array){ - global $conf; - $firstResultsKeyAppearance = true; - if (is_iterable($array)){ - foreach($array as $key => $value){ - if(!isset($value['value'])){ - $aux = Utils::getfirstResults($value); - if(isset($aux['0'])){ - $array[$key] = $aux['0']; - }else{ - $array[$key] = $aux; - } - } - } + } + } + } + return $obj; } - return $array; - } - - - public static function showView($lodspkData, $data, $view){ - global $conf; - global $uri; - global $lodspk; - global $extension; - //$lodspk = $conf['view']['standard']; - $lodspk = $lodspkData; - if(isset($lodspkData['params'])){ - $lodspk['this']['params'] = $lodspkData['params']; - } - if(isset($lodspk['queryTimes'])){ - $lodspk['queryTimes'] = Convert::array_to_object($lodspk['queryTimes']); - } - require_once($conf['home'].'lib/Haanga/lib/Haanga.php'); - $viewAux = explode("/",$view); - $viewFile = array_pop($viewAux); - //$viewFile = $view; - $viewPath = join("/", $viewAux); - Haanga::configure(array( - 'template_dir' => $viewPath, - 'cache_dir' => $conf['home'].'cache/', - )); - $rdf = null; - if(array_key_exists('rdf', $data)){ - $rdf = $data['rdf']; - unset($data['rdf']); - }else{ - } - $models = $data; - Convert::getPaths($models, ""); - $first = $lodspk['firstResults']; - unset($lodspk['firstResults']); - //unset($lodspk); - $vars = compact('uri','lodspk', 'conf', 'models', 'rdf', 'first'); - if($conf['debug']){ - //Logging::log(var_export($vars, true)); - } - if(is_string($data)){ - echo($data); - }elseif(is_file($view)){ - try{ - Haanga::Load($viewFile, $vars); - }catch(Exception $e){ - echo '<pre>'; - echo($e->getMessage()."' in ".$e->getFile().":".$e->getLine()."\nStack trace:\n".$e->getTraceAsString()); - echo '</pre>'; - } - }elseif($view == null){ - $fnc = Haanga::compile('{{models|safe}}'); - $fnc($vars, TRUE); - }else{ - echo $conf['home'].$viewPath." ".$viewFile; - $fnc = Haanga::compile($view); - $fnc($vars, TRUE); - } - - } - - private static function extractObj($obj, $term = 'triple'){ - $triples = array(); - if(is_array($obj)){ - foreach($obj as $k => $v){ - if($v['type'] != 'triple'){ - $aux = Utils::extractObj($v); - if($aux['type'] != 'triple'){ - $triples = array_merge($triples,$aux); - }else{ - $triples = array_merge($triples, $aux); - } - }else{ - array_push($triples, $v); - } - } - } - return $triples; - } - - public static function addPrefixes($q){ - global $conf; - $matches = array(); - $visited = array(); - $newQuery = $q; - if(preg_match_all("|\s(\w+):\w+|", $q, $matches) > 0){ - foreach($matches[1] as $v){ - if(!isset($visited[$v]) && isset($conf['ns'][$v])){ - $newQuery = "PREFIX ".$v.": <".$conf['ns'][$v].">\n".$newQuery; - $visited[$v] = true; - } - } + + public static function getExtension($accept_string) + { + global $conf; + $extension = "html"; + foreach ($conf['http_accept'] as $ext => $accept_arr) { + if (in_array($accept_string, $accept_arr)) { + $extension = $ext; + } + } + return $extension; } - - return $newQuery; - } - - public static function filterTriples($triples, $pattern){ - //Simples match/filter function possible - $result = array(); - foreach($triples as $t){ - if( (($pattern[0] != null && $pattern[0] == $t['s']) || $pattern[0] == null) && - (($pattern[1] != null && $pattern[1] == $t['p']) || $pattern[1] == null) && - (($pattern[2] != null && $pattern[2] == $t['o']) || $pattern[2] == null) ){ - $result[] = array($t['s'], $t['p'], $t['o']); - } + + public static function getBestContentType($accept_string) + { + global $conf; + $a = explode(",", $accept_string); + $b = array(); + foreach ($a as $v) { + foreach ($conf['http_accept'] as $formatTypeArray) { + if (strstr($v, ";")) { + $aux = explode(";", $v); + $aux[0] = trim($aux[0]); + if (in_array($aux[0], $formatTypeArray)) { + $b[$aux[0]] = floatval(trim(str_replace("q=", "", $aux[1]))); + } + } else { + $value = trim($v); + if (in_array($value, $formatTypeArray)) { + $b[$value] = 1.0; + } + } + } + } + $a = $b; + arsort($a); + $ct = 'text/html'; + foreach ($a as $k => $v) { + $ct = $k; + break; + } + if ($ct == null || $ct == "" || $ct == "*/*") { + $ct = 'text/html'; + } + return $ct; } - return $result; - } - - public static function getMirroredUri($localUri){ - global $conf; - $uri = $localUri; - if(isset($conf['mirror_external_uris']) && $conf['mirror_external_uris'] != false){ - if(is_bool($conf['mirror_external_uris'])){ - $uri = preg_replace("|^".$conf['basedir']."|", $conf['ns']['base'], $localUri); - }elseif(is_string($conf['mirror_external_uris'])){ - $uri = preg_replace("|^".$conf['basedir']."|", $conf['mirror_external_uris'], $localUri); - }elseif(is_array($conf['mirror_external_uris'])){ - $defaultKey = ""; //Default namespace is empty string "" - $namespaceFragment = array_shift(split("/", str_replace($conf['basedir'], "", $localUri))); - $uri = preg_replace("|^".$conf['basedir']."|",$conf['mirror_external_uris'][$defaultKey], $localUri); - foreach($conf['mirror_external_uris'] as $k => $v){ - if($namespaceFragment == $k){ - $uri = preg_replace("|^".$conf['basedir'].$k."/"."|",$conf['mirror_external_uris'][$k], $localUri); - break; - } - } - }else{ - HTTPStatus::send500("Error in mirroring configuration"); - exit(1); - } + + private static function travelTree($tree) + { + $results = array(); + if (is_string($tree)) { + return $tree; + } + foreach ($tree as $t) { + $aux = Utils::travelTree($t); + if (is_array($aux)) { + $results = array_merge($results, $aux); + } else { + array_push($results, $aux); + } + } + return $results; } - return $uri; - } - - public static function getUnMirroredUri($uri){ - global $conf; - $localUri = $uri; - if(is_bool($conf['mirror_external_uris'])){ - $localUri = preg_replace("|^".$conf['ns']['local']."|", $conf['basedir'], $uri); - }elseif(is_string($conf['mirror_external_uris'])){ - $localUri = preg_replace("|^".$conf['mirror_external_uris']."|", $conf['basedir'], $uri); - }elseif(is_array($conf['mirror_external_uris'])){ - //Instead of doing expensive regex, jsut use str_replace - foreach($conf['mirror_external_uris'] as $k => $v){ - if(strlen(str_replace($v, "", $uri)) != strlen($uri)){ - $fragment = ($k == "")?$k: $k."/"; - $localUri = preg_replace("|^".$v."|",$conf['basedir'].$fragment, $uri); - break; - } - } - }else{ - HTTPStatus::send500("Error in mirroring configuration"); - exit(1); + + public static function serializeRdf($data, $extension = 'rdf') + { + global $conf; + global $lodspk; + $ser; + $dPointer; + $docs = Utils::travelTree($data); + $parser = ARC2::getRDFParser(); + $triples = array(); + + foreach ($docs as $d) { + $parser->parse($conf['basedir'], $d); + $t = $parser->getTriples(); + $triples = array_merge($triples, $t); + } + if ($lodspk['mirror_external_uris']) { + global $uri; + global $localUri; + $t = array(); + $t['s'] = $localUri; + $t['s_type'] = 'uri'; + $t['p'] = "http://www.w3.org/2002/07/owl#sameAs"; + $t['o'] = $uri; + $t['o_type'] = 'uri'; + array_push($triples, $t); + $t['p'] = "http://www.w3.org/2000/10/swap/pim/contact#preferredURI"; + array_push($triples, $t); + } + switch ($extension) { + case 'ttl': + $ser = ARC2::getTurtleSerializer(); + break; + case 'nt': + $ser = ARC2::getNTriplesSerializer(); + break; + case 'json': + $ser = ARC2::getRDFJSONSerializer(); + break; + case 'jsonp': + $ser = ARC2::getRDFJSONSerializer(); + break; + case 'rdf': + $ser = ARC2::getRDFXMLSerializer(); + break; + case 'html': + return array("content" => $triples, "serialized" => false); + break; + default: + $ser = null; + } + if ($ser != null) { + $doc = $ser->getSerializedTriples($triples); + } else { + $doc = var_export($data, true); + } + return array("content" => $doc, "serialized" => true); } - return $localUri; - } + + public static function processDocument($viewFile, $lodspk, $data) + { + global $conf; + global $lodspk; + $contentType = $lodspk['contentType']; + $extension = Utils::getExtension($contentType); + + header('Content-Type: ' . $contentType); + if (isset($lodspk['resultRdf']) && $lodspk['resultRdf'] == true) { + $rdfData = Utils::serializeRdf($data, $extension); + if ($rdfData["serialized"]) { + echo $rdfData["content"]; + } else { + $data['rdf'] = new stdClass(); + + $subjectCounter = 0; + $sIndex = array(); + $sCounter = array(); + $spCounter = array(); + foreach ($rdfData["content"] as $t) { + //SUBJECT + if ($t['s_type'] == 'uri') { + $subject = $t['s']; + $subjectCurie = Utils::uri2curie($subject); + $subjectMethod = str_replace(":", "__", $subjectCurie); + } else { + if (isset($sIndex[$t['s']])) { + $subject = $sIndex[$t['s']]; + $subjectCurie = $sIndex[$t['s']]; + $subjectMethod = $sIndex[$t['s']]; + } else { + $subject = "_bnode" . $subjectCounter; + $subjectCurie = "_bnode" . $subjectCounter; + $subjectMethod = "_bnode" . $subjectCounter; + $sIndex[$t['s']] = "_bnode" . $subjectCounter++; + } + } + if (!isset($data['rdf']->subjects)) { + $data['rdf']->subjects = new stdClass(); + } + + if (!isset($data['rdf']->$subjectMethod)) { + $data['rdf']->$subjectMethod = new stdClass(); + $data['rdf']->$subjectMethod->predicates = new stdClass(); + } + $data['rdf']->$subjectMethod->mirroredUri = $subject; + $data['rdf']->$subjectMethod->mirroredCurie = $subjectCurie; + + $data['rdf']->$subjectMethod->value = Utils::getUnMirroredUri($subject); + $data['rdf']->$subjectMethod->curie = Utils::uri2curie($data['rdf']->$subjectMethod->value); + + if (!isset($data['rdf']->subjects->$subjectMethod)) { + $data['rdf']->subjects->$subjectMethod = $data['rdf']->$subjectMethod; + } + + + //PREDICATE + $predicate = $t['p']; + $predicateCurie = Utils::uri2curie($predicate); + $predicateMethod = str_replace(":", "__", $predicateCurie); + if (!isset($data['rdf']->$subjectMethod->$predicateMethod)) { + $data['rdf']->$subjectMethod->$predicateMethod = new stdClass(); + } + + + $data['rdf']->$subjectMethod->$predicateMethod->mirroredUri = $predicate; + $data['rdf']->$subjectMethod->$predicateMethod->mirroredCurie = $predicateCurie; + $data['rdf']->$subjectMethod->$predicateMethod->value = Utils::getUnMirroredUri($predicate); + $data['rdf']->$subjectMethod->$predicateMethod->curie = Utils::uri2curie( + $data['rdf']->$subjectMethod->$predicateMethod->value + ); + + + if (!isset($data['rdf']->$subjectMethod->predicates)) { + $data['rdf']->$subjectMethod->predicates = new stdClass(); + } + if (!isset($sCounter[$subjectMethod])) { + $sCounter[$subjectMethod] = 0; + } + $sCount = $sCounter[$subjectMethod]++; + $data['rdf']->$subjectMethod->predicates->$sCount = $data['rdf']->$subjectMethod->$predicateMethod; + + + //OBJECT + if ($t['o_type'] == 'uri') { + $object = $t['o']; + $objectCurie = Utils::uri2curie($object); + } elseif ($t['o_type'] == 'literal') { + $object = $t['o']; + $objectCurie = $object; + } else { + if (isset($sIndex[$t['o']])) { + $object = $sIndex[$t['o']]; + $objectCurie = $sIndex[$t['o']]; + } else { + $object = "_bnode" . $objectCounter; + $objectCurie = "_bnode" . $objectCounter; + $sIndex[$t['s']] = "_bnode" . $objectCounter++; + } + } + + + $obj = new stdClass(); + $obj->mirroredUri = $object; + $obj->mirroredCurie = $objectCurie; + $obj->value = Utils::getUnMirroredUri($object); + $obj->curie = Utils::uri2curie($obj->value); + + + if (!isset($spCounter[$subjectMethod . " " . $predicateMethod])) { + $spCounter[$subjectMethod . " " . $predicateMethod] = 0; + } + $sCount = $spCounter[$subjectMethod . " " . $predicateMethod]++; + $data['rdf']->$subjectMethod->$predicateMethod->objects->$sCount = $obj; + } + Utils::showView($lodspk, $data, $viewFile); + } + } else { + Utils::showView($lodspk, $data, $viewFile); + } + } + + public static function getResultsType($query) + { + global $conf; + global $uri; + if (preg_match("/select/i", $query)) { + return $conf['output']['select']; + } elseif (preg_match("/describe/i", $query)) { + return $conf['output']['describe']; + } elseif (preg_match("/construct/i", $query)) { + return $conf['output']['describe']; + } elseif (preg_match("/ask/i", $query)) { + return $conf['output']['ask']; + } else { + HTTPStatus::send500($uri); + } + } + + public static function queryDir($modelDir, &$r, &$f) + { + global $conf; + global $uri; + global $lodspk; + global $endpoints; + global $results; + $strippedModelDir = str_replace('endpoint.', '', $modelDir); + $lodspk['model'] = $modelDir; + $originalDir = getcwd(); + $subDirs = array(); + if ($conf['debug']) { + Logging::log("Entering $strippedModelDir from " . getcwd(), E_USER_NOTICE); + } + chdir($modelDir); + $handle = opendir('.'); + + while (false !== ($modelFile = readdir($handle))) { + if ($modelFile != "." && $modelFile != ".." && strpos($modelFile, ".") !== 0) { + if (is_dir($modelFile)) { + if (strpos('endpoint.', $modelFile) == 0) { + if ($conf['debug']) { + Logging::log( + "Save $modelFile for later, after all the queries in the current directory has been resolved", + E_USER_NOTICE + ); + } + $subDirs[] = $modelFile; + } + } else { + if (preg_match('/\.query$/', $modelFile)) { + $e = null; + if (!isset($endpoints[$strippedModelDir])) { + if ($conf['debug']) { + Logging::log("Creating endpoint for $strippedModelDir", E_USER_NOTICE); + } + if (!isset($conf['endpoint'][$strippedModelDir])) { + if ($conf['debug']) { + Logging::log( + "Couldn't find $strippedModelDir as a list of available endpoints. Will continue using 'local'", + E_USER_WARNING + ); + } + $e = $endpoints['local']; + } else { + $endpoints[$strippedModelDir] = new Endpoint( + $conf['endpoint'][$strippedModelDir], + $conf['endpoint']['config'] + ); + $e = $endpoints[$strippedModelDir]; + } + } else { + $e = $endpoints[$strippedModelDir]; + } + if ($modelDir != $lodspk['type']) { + if (!isset($r[$strippedModelDir])) { + $r[$strippedModelDir] = array(); + $f[$strippedModelDir] = array(); + } + Utils::queryFile($modelFile, $e, $r[$strippedModelDir], $f); + } else { + Utils::queryFile($modelFile, $e, $r, $f); + } + } + } + } + } + closedir($handle); + $originalDir = $lodspk['model']; + if (isset($subDirs)) { + foreach ($subDirs as $v) { + if (!isset($r[$modelDir])) { + $r[$modelDir] = array(); + } + if ($modelDir != $lodspk['type']) { + Utils::queryDir($v, $r[$strippedModelDir], $f[$strippedModelDir]); + } else { + Utils::queryDir($v, $r, $f); + } + } + } + // chdir($conf['home']); + //return $data; + } + + public static function queryFile($modelFile, $e, &$rPointer, &$fPointer) + { + global $conf; + global $lodspk; + global $results; + global $firstResults; + global $uri; + $data = array(); + $strippedModelFile = str_replace('endpoint.', '', str_replace('.query', '', $modelFile)); + if (!is_dir($modelFile)) { + require_once __DIR__ . '/../vendor/ubbdst/haanga/lib/Haanga.php'; + Haanga::configure(array( + 'cache_dir' => $conf['home'] . 'cache/', + 'autoescape' => false, + )); + + //Haanga supports the dot (.) convention only for objects + if (is_array($lodspk) && !empty($lodspk)) { + $lodspkObj = Convert::array_to_object($lodspk); + $lodspk = $lodspkObj; + } + $r2 = Convert::array_copy($results); + $models = Convert::array_to_object($r2); + $f2 = Convert::array_copy($firstResults); + $first = Convert::array_to_object($f2); + $vars = compact('uri', 'lodspk', 'conf', 'models', 'first'); + $q = file_get_contents($modelFile); + if ($q == false) { + HTTPStatus::send500("I can't load " . $modelFile . " in " . getcwd()); + } + $fnc = Haanga::compile($q); + $query = $fnc($vars, true); + + if (is_object($lodspk)) { + $lodspkObj = Convert::object_to_array($lodspk); + $lodspk = $lodspkObj; + } + $query = Utils::addPrefixes($query); + if (!empty($lodspk['transform_select_query']) && $lodspk['transform_select_query'] == true) { + $parser = ARC2::getSPARQLParser(); + $parser->parse($query); + $sparqlConstruct = array(); + if (!$parser->getErrors()) { + $resultVars = array(); + $q_infos = $parser->getQueryInfos(); + foreach ($q_infos['query']['result_vars'] as $v) { + if ($v['type'] == 'var') { + $resultVars[$v['value']] = 1; + } + }; + $x = Utils::extractObj($q_infos['query']['pattern']); + foreach ($x as $v) { + if (($resultVars[$v['s']] && $v['s_type'] == 'var') + || ($resultVars[$v['p']] && $v['p_type'] == 'var') + || ($resultVars[$v['o']] && $v['o_type'] == 'var')) { + array_push($sparqlConstruct, $v); + } + } + $construct = ""; + foreach ($sparqlConstruct as $v) { + if ($v['s_type'] == 'uri') { + $construct .= "<" . $v['s'] . "> "; + } elseif ($v['s_type'] == 'var') { + $construct .= '?' . $v['s'] . ' '; + } else { + $construct .= $v['s'] . " "; + } + + if ($v['p_type'] == 'uri') { + $construct .= "<" . $v['p'] . "> "; + } elseif ($v['p_type'] == 'var') { + $construct .= '?' . $v['p'] . ' '; + } else { + $construct .= $v['p'] . " "; + } + + if ($v['o_type'] == 'uri') { + $construct .= "<" . $v['o'] . "> "; + } elseif ($v['o_type'] == 'literal') { + $construct .= '"' . $v['o'] . '" '; + } elseif ($v['o_type'] == 'var') { + $construct .= '?' . $v['o'] . ' '; + } else { + $construct .= $v['o'] . " "; + } + + $construct .= ".\n"; + } + if ($construct == "") { + if (sizeof($q_infos['query']['result_vars']) > 0) { + //For now, assuming variables are in the GRAPH ?g + $query = "CONSTRUCT {?g ?x ?y} WHERE{GRAPH ?g{?g ?x ?y}}"; + } else { + if (!preg_match('/construct/i', $query)) { + HTTPStatus::send500(); + } + } + } else { + $query = preg_replace( + '/select\s*[^{]*\s*(where)?\s*{/i', + 'CONSTRUCT {' . $construct . '} WHERE{', + $query + ); + } + } else { + return; + //HTTPStatus::send500("invalid query: " . var_export($parser->getErrors(), true)."\n\nQUERY:\n".$query); + } + } + if ($conf['debug']) { + Logging::log($modelFile . " against " . $e->getSparqlUrl()); + Logging::log($query); + Logging::log("Running query from " . $modelFile . " on endpoint " . $e->getSparqlURL(), E_USER_NOTICE); + } + $initTime = microtime(true); + $aux = $e->query($query, Utils::getResultsType($query)); + $endTime = microtime(true); + if ($conf['debug']) { + Logging::log("Execution time: " . ($endTime - $initTime) . " seconds"); + } + $timeObj = new stdClass(); + $timeObj->query = new stdClass(); + $timeObj->query->value = $strippedModelFile; + $timeObj->time = new stdClass(); + $timeObj->time->value = ($endTime - $initTime); + $lodspk['queryTimes'][$strippedModelFile] = $timeObj; + if ($modelFile != $lodspk['type']) { + if (!isset($rPointer[$strippedModelFile])) { + $rPointer[$strippedModelFile] = array(); + $firstResults[$strippedModelFile] = array(); + } + if (Utils::getResultsType($query) == $conf['output']['select']) { + $rPointer[$strippedModelFile] = Utils::sparqlResult2Obj($aux); + if (!empty($rPointer[$strippedModelFile][0])) { + $fPointer[$strippedModelFile] = $rPointer[$strippedModelFile][0]; + } + } else { + $lodspk['resultRdf'] = true; + $rPointer[$strippedModelFile] = $aux; + } + } else { + if (Utils::getResultsType($query) == $conf['output']['select']) { + $rPointer = Utils::sparqlResult2Obj($aux); + $fPointer[$strippedModelFile] = $rPointer[0]; + } else { + $lodspk['resultRdf'] = true; + $rPointer = $aux; + } + } + } else { + if (strpos('endpoint.', $modelFile) == 0) { + if ($conf['debug']) { + Logging::log("$modelFile is a directory, will process it later", E_USER_NOTICE); + } + if ($modelFile != $lodspk['type']) { + if (!isset($rPointer[$strippedModelFile])) { + $rPointer[$strippedModelFile] = array(); + } + Utils::queryDir($modelFile, $rPointer[$strippedModelFile], $fPointer[$strippedModelFile]); + } else { + Utils::queryDir($modelFile, $rPointer, $fPointer); + } + } + } + } + + public static function internalize($array) + { + global $conf; + $firstResultsKeyAppearance = true; + foreach ($array as $key => $value) { + if (!isset($value['value'])) { + $array[$key] = Utils::internalize($value); + /*if($firstResultsKeyAppearance){ + $firstResultsKeyAppearance = false; + $array['_firstResults']=$array[$key]; + }*/ + } else { + if (isset($value['uri']) && $value['uri'] == 1) { + //If there is no mirroring, it wouldn't hurt to have available this value (e.g., using templates from a mirrored instance to a non-mirrored one) + $value['mirroredUri'] = $value['value']; + $value['mirroredCurie'] = Utils::uri2curie($value['value']); + if (isset($conf['mirror_external_uris']) && $conf['mirror_external_uris'] != false) { + $value['value'] = Utils::getUnMirroredUri($value['value']); + } + $value['curie'] = Utils::uri2curie($value['value']); + $array[$key] = $value; + } + } + } + return $array; + } + + public static function getfirstResults($array) + { + global $conf; + $firstResultsKeyAppearance = true; + if (is_iterable($array)) { + foreach ($array as $key => $value) { + if (!isset($value['value'])) { + $aux = Utils::getfirstResults($value); + if (isset($aux['0'])) { + $array[$key] = $aux['0']; + } else { + $array[$key] = $aux; + } + } + } + } + return $array; + } + + public static function showView($lodspkData, $data, $view) + { + global $conf; + global $uri; + global $lodspk; + global $extension; + //$lodspk = $conf['view']['standard']; + $lodspk = $lodspkData; + if (isset($lodspkData['params'])) { + $lodspk['this']['params'] = $lodspkData['params']; + } + if (isset($lodspk['queryTimes'])) { + $lodspk['queryTimes'] = Convert::array_to_object($lodspk['queryTimes']); + } + require_once __DIR__ . '/../vendor/ubbdst/haanga/lib/Haanga.php'; + $viewAux = explode("/", $view); + $viewFile = array_pop($viewAux); + //$viewFile = $view; + $viewPath = join("/", $viewAux); + Haanga::configure(array( + 'template_dir' => $viewPath, + 'cache_dir' => $conf['home'] . 'cache/', + )); + $rdf = null; + if (array_key_exists('rdf', $data)) { + $rdf = $data['rdf']; + unset($data['rdf']); + } else { + } + $models = $data; + Convert::getPaths($models, ""); + $first = $lodspk['firstResults']; + unset($lodspk['firstResults']); + //unset($lodspk); + $vars = compact('uri', 'lodspk', 'conf', 'models', 'rdf', 'first'); + if ($conf['debug']) { + //Logging::log(var_export($vars, true)); + } + if (is_string($data)) { + echo($data); + } elseif (is_file($view)) { + try { + Haanga::Load($viewFile, $vars); + } catch (Exception $e) { + echo '<pre>'; + echo($e->getMessage() . "' in " . $e->getFile() . ":" . $e->getLine( + ) . "\nStack trace:\n" . $e->getTraceAsString()); + echo '</pre>'; + } + } elseif ($view == null) { + $fnc = Haanga::compile('{{models|safe}}'); + $fnc($vars, true); + } else { + echo $conf['home'] . $viewPath . " " . $viewFile; + $fnc = Haanga::compile($view); + $fnc($vars, true); + } + } + + private static function extractObj($obj, $term = 'triple') + { + $triples = array(); + if (is_array($obj)) { + foreach ($obj as $k => $v) { + if ($v['type'] != 'triple') { + $aux = Utils::extractObj($v); + if ($aux['type'] != 'triple') { + $triples = array_merge($triples, $aux); + } else { + $triples = array_merge($triples, $aux); + } + } else { + array_push($triples, $v); + } + } + } + return $triples; + } + + public static function addPrefixes($q) + { + global $conf; + $matches = array(); + $visited = array(); + $newQuery = $q; + if (preg_match_all("|\s(\w+):\w+|", $q, $matches) > 0) { + foreach ($matches[1] as $v) { + if (!isset($visited[$v]) && isset($conf['ns'][$v])) { + $newQuery = "PREFIX " . $v . ": <" . $conf['ns'][$v] . ">\n" . $newQuery; + $visited[$v] = true; + } + } + } + + return $newQuery; + } + + public static function filterTriples($triples, $pattern) + { + //Simples match/filter function possible + $result = array(); + foreach ($triples as $t) { + if ((($pattern[0] != null && $pattern[0] == $t['s']) || $pattern[0] == null) && + (($pattern[1] != null && $pattern[1] == $t['p']) || $pattern[1] == null) && + (($pattern[2] != null && $pattern[2] == $t['o']) || $pattern[2] == null)) { + $result[] = array($t['s'], $t['p'], $t['o']); + } + } + return $result; + } + + public static function getMirroredUri($localUri) + { + global $conf; + $uri = $localUri; + if (isset($conf['mirror_external_uris']) && $conf['mirror_external_uris'] != false) { + if (is_bool($conf['mirror_external_uris'])) { + $uri = preg_replace("|^" . $conf['basedir'] . "|", $conf['ns']['base'], $localUri); + } elseif (is_string($conf['mirror_external_uris'])) { + $uri = preg_replace("|^" . $conf['basedir'] . "|", $conf['mirror_external_uris'], $localUri); + } elseif (is_array($conf['mirror_external_uris'])) { + $defaultKey = ""; //Default namespace is empty string "" + $namespaceFragment = array_shift(split("/", str_replace($conf['basedir'], "", $localUri))); + $uri = preg_replace( + "|^" . $conf['basedir'] . "|", + $conf['mirror_external_uris'][$defaultKey], + $localUri + ); + foreach ($conf['mirror_external_uris'] as $k => $v) { + if ($namespaceFragment == $k) { + $uri = preg_replace( + "|^" . $conf['basedir'] . $k . "/" . "|", + $conf['mirror_external_uris'][$k], + $localUri + ); + break; + } + } + } else { + HTTPStatus::send500("Error in mirroring configuration"); + exit(1); + } + } + return $uri; + } + + public static function getUnMirroredUri($uri) + { + global $conf; + $localUri = $uri; + if (is_bool($conf['mirror_external_uris'])) { + $localUri = preg_replace("|^" . $conf['ns']['local'] . "|", $conf['basedir'], $uri); + } elseif (is_string($conf['mirror_external_uris'])) { + $localUri = preg_replace("|^" . $conf['mirror_external_uris'] . "|", $conf['basedir'], $uri); + } elseif (is_array($conf['mirror_external_uris'])) { + //Instead of doing expensive regex, jsut use str_replace + foreach ($conf['mirror_external_uris'] as $k => $v) { + if (strlen(str_replace($v, "", $uri)) != strlen($uri)) { + $fragment = ($k == "") ? $k : $k . "/"; + $localUri = preg_replace("|^" . $v . "|", $conf['basedir'] . $fragment, $uri); + break; + } + } + } else { + HTTPStatus::send500("Error in mirroring configuration"); + exit(1); + } + return $localUri; + } + } diff --git a/classes/modules/abstractModule.php b/classes/modules/abstractModule.php index 4eb137a990dda2a9550fb82ed7886b857c92fdef..e9bcbe4fb5eaac64e9ad6e5312b9bce8a135077c 100644 --- a/classes/modules/abstractModule.php +++ b/classes/modules/abstractModule.php @@ -1,6 +1,8 @@ <?php -abstract class AbstractModule { - abstract protected function match($uri); - abstract protected function execute($params); +abstract class AbstractModule +{ + abstract protected function match($uri); + + abstract protected function execute($params); } diff --git a/classes/modules/adminModule.php b/classes/modules/adminModule.php index 10805ee8fc667d4d433b9b890f21066e703b4db0..9a2cfd3864df851e26a97cb39cd5e983301b4fbe 100644 --- a/classes/modules/adminModule.php +++ b/classes/modules/adminModule.php @@ -6,9 +6,10 @@ use uib\ub\loadspeakr\Utils; require_once('abstractModule.php'); -class AdminModule extends abstractModule { - //Service module - private $head = "<!DOCTYPE html> +class AdminModule extends abstractModule +{ + //Service module + private $head = "<!DOCTYPE html> <html lang='en'> <head> <meta charset='utf-8'> @@ -186,7 +187,7 @@ class AdminModule extends abstractModule { <div class='container'> <img src='../img/lodspeakr_logotype.png' style='opacity: 0.1; position: absolute; right:0px; top:60%'/> "; - private $foot =" <div id='embed-box' class='modal hide fade'> + private $foot = " <div id='embed-box' class='modal hide fade'> <div class='modal-header'> <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>×</button> <h3>Embed this code</h3> @@ -206,92 +207,100 @@ class AdminModule extends abstractModule { </html> "; + public function match($uri) + { + global $localUri; + global $conf; + //URLs used by this component. Other URLs starting with admin/* won't be considered by this module - public function match($uri){ - global $localUri; - global $conf; - //URLs used by this component. Other URLs starting with admin/* won't be considered by this module - - $operations = array("menu", /*"load", "remove",*/ "endpoints", "namespaces", "components", ""); - $q = preg_replace('|^'.$conf['basedir'].'|', '', $localUri); - $qArr = explode('/', $q); - if(sizeof($qArr)==0){ - return FALSE; - } - if($qArr[0] == "admin" && array_search($qArr[1], $operations) !== FALSE){ - if($conf['admin']['pass'] !== FALSE && !$this->auth()){ - HTTPStatus::send401("Forbidden\n"); - exit(0); - } - return $qArr; - } - return FALSE; - } - - public function execute($params){ - global $conf; - global $localUri; - global $uri; - global $acceptContentType; - global $endpoints; - global $lodspk; - global $firstResults; - if(sizeof($params) == 1){ - header( 'Location: admin/menu' ) ; - exit(0); - } - if($params[1] == ""){ - header( 'Location: menu' ) ; - exit(0); - } - switch($params[1]){ - case "menu": - $this->homeMenu(); - break; - /*case "start": - $this->startEndpoint(); - break; - case "stop": - $this->stopEndpoint(); - break;*/ - /*case "load": - $this->loadRDF(); - break; - case "remove": - $this->deleteRDF(); - break;*/ - case "namespaces": - $this->editNamespaces(); - break; - case "endpoints": - $this->editEndpoints(); - break; - case "components": - if(sizeof($params) == 2){ - $this->componentEditor(); - }else{ - $this->componentEditorApi(array_slice($params, 2)); - } - break; - default: - HTTPStatus::send404($params[1]); - } - exit(0); - } - - protected function loadRDF(){ - global $conf; - if(!isset($conf['updateendpoint']['local'])){ - echo $this->head." + $operations = array( + "menu", /*"load", "remove",*/ + "endpoints", + "namespaces", + "components", + "" + ); + $q = preg_replace('|^' . $conf['basedir'] . '|', '', $localUri); + $qArr = explode('/', $q); + if (sizeof($qArr) == 0) { + return false; + } + if ($qArr[0] == "admin" && array_search($qArr[1], $operations) !== false) { + if ($conf['admin']['pass'] !== false && !$this->auth()) { + HTTPStatus::send401("Forbidden\n"); + exit(0); + } + return $qArr; + } + return false; + } + + public function execute($params) + { + global $conf; + global $localUri; + global $uri; + global $acceptContentType; + global $endpoints; + global $lodspk; + global $firstResults; + if (sizeof($params) == 1) { + header('Location: admin/menu'); + exit(0); + } + if ($params[1] == "") { + header('Location: menu'); + exit(0); + } + switch ($params[1]) { + case "menu": + $this->homeMenu(); + break; + /*case "start": + $this->startEndpoint(); + break; + case "stop": + $this->stopEndpoint(); + break;*/ + /*case "load": + $this->loadRDF(); + break; + case "remove": + $this->deleteRDF(); + break;*/ + case "namespaces": + $this->editNamespaces(); + break; + case "endpoints": + $this->editEndpoints(); + break; + case "components": + if (sizeof($params) == 2) { + $this->componentEditor(); + } else { + $this->componentEditorApi(array_slice($params, 2)); + } + break; + default: + HTTPStatus::send404($params[1]); + } + exit(0); + } + + protected function loadRDF() + { + global $conf; + if (!isset($conf['updateendpoint']['local'])) { + echo $this->head . " <div class='fluid-row'> <div class='span8'> <div class='alert alert-error'><strong>Error:</strong> No SPARQL/UPDATE server found. Please include it in <code>\$conf['updateendpoint']['local']</code> at <strong>settings.inc.php</strong></div> </div> </div> - ".$this->foot; - }else{ - if($_SERVER['REQUEST_METHOD'] == 'GET'){ - echo $this->head." + " . $this->foot; + } else { + if ($_SERVER['REQUEST_METHOD'] == 'GET') { + echo $this->head . " <div class='fluid-row'> <div class='span5'> <form action='load' method='post' @@ -313,73 +322,83 @@ class AdminModule extends abstractModule { <div id='ng'></div> </div> </div> - <script type='text/javascript' src='".$conf['basedir']."js/jquery.js'></script> - <script type='text/javascript' src='".$conf['basedir']."js/namedgraphs.js'></script> - ".$this->foot; - }elseif($_SERVER['REQUEST_METHOD'] == 'POST'){ - if ($_FILES["file"]["error"] > 0){ - HTTPStatus::send409("No file was included in the request"); - }else{ - $ng = (isset($_POST['namedgraph']))?$_POST['namedgraph']:'default'; - - require_once __DIR__ . '/../../vendor/semsol/arc2/ARC2.php'; - $parser = ARC2::getRDFParser(); - $parser->parse($_FILES["file"]["tmp_name"]); - $triples = $parser->getTriples(); - if(sizeof($triples) > 0){ - $c = curl_init(); - $body = $parser->toTurtle($triples); - $fp = fopen('php://temp/maxmemory:256000', 'w'); - if (!$fp) { - die('could not open temp memory data'); - } - fwrite($fp, $body); - fseek($fp, 0); - - curl_setopt($c, CURLOPT_URL, $conf['updateendpoint']['local']."?graph=".$ng); - curl_setopt($c, CURLOPT_CUSTOMREQUEST, "PUT"); - curl_setopt($c, CURLOPT_PUT, 1); - curl_setopt($c, CURLOPT_BINARYTRANSFER, true); - curl_setopt($c, CURLOPT_RETURNTRANSFER, true); - curl_setopt($c, CURLOPT_HTTPHEADER, array('X-HTTP-Method-Override: PUT',"Content-Type: text/turtle")); - curl_setopt($c, CURLOPT_USERAGENT, "LODSPeaKr version ".$conf['version']); - curl_setopt($c, CURLOPT_RETURNTRANSFER, true); - curl_setopt($c, CURLOPT_INFILE, $fp); // file pointer - curl_setopt($c, CURLOPT_INFILESIZE, strlen($body)); - curl_exec($c); // execute the curl command - $http_status = curl_getinfo($c, CURLINFO_HTTP_CODE); - if(intval($http_status)>=200 && intval($http_status) <300){ - echo $this->head."<h2>Success!!</h2><div class='alert alert-success'>The file ".$_FILES["file"]["name"]." (".$_FILES["file"]["size"]." bytes, ".sizeof($triples)." triples) was stored successfully on $ng.</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>".$this->foot; - }else{ - HTTPStatus::send502($this->head."<h2>Error!!</h2><div class='alert alert-success'>The file ".$_FILES["file"]["name"]." couldn't be loaded into the triples store. The server was acting as a gateway or proxy and received an invalid response (".$http_status.") from the upstream server</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>".$this->foot); + <script type='text/javascript' src='" . $conf['basedir'] . "js/jquery.js'></script> + <script type='text/javascript' src='" . $conf['basedir'] . "js/namedgraphs.js'></script> + " . $this->foot; + } elseif ($_SERVER['REQUEST_METHOD'] == 'POST') { + if ($_FILES["file"]["error"] > 0) { + HTTPStatus::send409("No file was included in the request"); + } else { + $ng = (isset($_POST['namedgraph'])) ? $_POST['namedgraph'] : 'default'; + + require_once __DIR__ . '/../../vendor/semsol/arc2/ARC2.php'; + $parser = ARC2::getRDFParser(); + $parser->parse($_FILES["file"]["tmp_name"]); + $triples = $parser->getTriples(); + if (sizeof($triples) > 0) { + $c = curl_init(); + $body = $parser->toTurtle($triples); + $fp = fopen('php://temp/maxmemory:256000', 'w'); + if (!$fp) { + die('could not open temp memory data'); + } + fwrite($fp, $body); + fseek($fp, 0); + + curl_setopt($c, CURLOPT_URL, $conf['updateendpoint']['local'] . "?graph=" . $ng); + curl_setopt($c, CURLOPT_CUSTOMREQUEST, "PUT"); + curl_setopt($c, CURLOPT_PUT, 1); + curl_setopt($c, CURLOPT_BINARYTRANSFER, true); + curl_setopt($c, CURLOPT_RETURNTRANSFER, true); + curl_setopt( + $c, + CURLOPT_HTTPHEADER, + array('X-HTTP-Method-Override: PUT', "Content-Type: text/turtle") + ); + curl_setopt($c, CURLOPT_USERAGENT, "LODSPeaKr version " . $conf['version']); + curl_setopt($c, CURLOPT_RETURNTRANSFER, true); + curl_setopt($c, CURLOPT_INFILE, $fp); // file pointer + curl_setopt($c, CURLOPT_INFILESIZE, strlen($body)); + curl_exec($c); // execute the curl command + $http_status = curl_getinfo($c, CURLINFO_HTTP_CODE); + if (intval($http_status) >= 200 && intval($http_status) < 300) { + echo $this->head . "<h2>Success!!</h2><div class='alert alert-success'>The file " . $_FILES["file"]["name"] . " (" . $_FILES["file"]["size"] . " bytes, " . sizeof( + $triples + ) . " triples) was stored successfully on $ng.</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>" . $this->foot; + } else { + HTTPStatus::send502( + $this->head . "<h2>Error!!</h2><div class='alert alert-success'>The file " . $_FILES["file"]["name"] . " couldn't be loaded into the triples store. The server was acting as a gateway or proxy and received an invalid response (" . $http_status . ") from the upstream server</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>" . $this->foot + ); + } + curl_close($c); + fclose($fp); + } else { + HTTPStatus::send409( + $this->head . "<h2>Error!!</h2><div class='alert alert-error'>The file was not a valid RDF document.</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>" . $this->foot + ); + } + } + } else { + HTTPStatus::send405($_SERVER['REQUEST_METHOD']); } - curl_close($c); - fclose($fp); - - }else{ - HTTPStatus::send409($this->head."<h2>Error!!</h2><div class='alert alert-error'>The file was not a valid RDF document.</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>".$this->foot); - } + exit(0); } - }else{ - HTTPStatus::send405($_SERVER['REQUEST_METHOD']); - } - exit(0); } - } - - protected function deleteRDF(){ - global $conf; - if(!isset($conf['updateendpoint']['local'])){ - echo $this->head." + + protected function deleteRDF() + { + global $conf; + if (!isset($conf['updateendpoint']['local'])) { + echo $this->head . " <div class='fluid-row'> <div class='span8'> <div class='alert alert-error'><strong>Error:</strong> No SPARQL/UPDATE server found. Please include it in <code>\$conf['updateendpoint']['local']</code> at <strong>settings.inc.php</strong></div> </div> </div> - ".$this->foot; - }else{ - if($_SERVER['REQUEST_METHOD'] == 'GET'){ - echo $this->head." + " . $this->foot; + } else { + if ($_SERVER['REQUEST_METHOD'] == 'GET') { + echo $this->head . " <div class='fluid-row'> <div class='span5'> <form action='remove' method='post' @@ -396,43 +415,44 @@ class AdminModule extends abstractModule { <div id='ng'></div> </div> </div> - <script type='text/javascript' src='".$conf['basedir']."js/jquery.js'></script> - <script type='text/javascript' src='".$conf['basedir']."js/namedgraphs.js'></script> - ".$this->foot; - }elseif($_SERVER['REQUEST_METHOD'] == 'POST'){ - $ng = (isset($_POST['namedgraph']))?$_POST['namedgraph']:'default'; - $c = curl_init(); - curl_setopt($c, CURLOPT_URL, $conf['updateendpoint']['local']."?graph=".$ng); - curl_setopt($c, CURLOPT_CUSTOMREQUEST, 'DELETE'); - curl_setopt($c, CURLOPT_BINARYTRANSFER, true); - curl_setopt($c, CURLOPT_RETURNTRANSFER, true); - curl_setopt($c, CURLOPT_USERAGENT, "LODSPeaKr version ".$conf['version']); - curl_setopt($c, CURLOPT_RETURNTRANSFER, true); - curl_exec($c); // execute the curl command - $http_status = curl_getinfo($c, CURLINFO_HTTP_CODE); - if(intval($http_status)>=200 && intval($http_status) <300){ - echo $this->head."<h2>Success!!</h2><div class='alert alert-success'>The named graph $ng was removed successfully</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>".$this->foot; - }else{ - HTTPStatus::send502($this->head."<h2>Error!!</h2><div class='alert alert-error'>The named graph $ng couldn't be removed from the endpoint. The server was acting as a gateway or proxy and received an invalid response (".$http_status.") from the upstream server</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>".$this->foot); + <script type='text/javascript' src='" . $conf['basedir'] . "js/jquery.js'></script> + <script type='text/javascript' src='" . $conf['basedir'] . "js/namedgraphs.js'></script> + " . $this->foot; + } elseif ($_SERVER['REQUEST_METHOD'] == 'POST') { + $ng = (isset($_POST['namedgraph'])) ? $_POST['namedgraph'] : 'default'; + $c = curl_init(); + curl_setopt($c, CURLOPT_URL, $conf['updateendpoint']['local'] . "?graph=" . $ng); + curl_setopt($c, CURLOPT_CUSTOMREQUEST, 'DELETE'); + curl_setopt($c, CURLOPT_BINARYTRANSFER, true); + curl_setopt($c, CURLOPT_RETURNTRANSFER, true); + curl_setopt($c, CURLOPT_USERAGENT, "LODSPeaKr version " . $conf['version']); + curl_setopt($c, CURLOPT_RETURNTRANSFER, true); + curl_exec($c); // execute the curl command + $http_status = curl_getinfo($c, CURLINFO_HTTP_CODE); + if (intval($http_status) >= 200 && intval($http_status) < 300) { + echo $this->head . "<h2>Success!!</h2><div class='alert alert-success'>The named graph $ng was removed successfully</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>" . $this->foot; + } else { + HTTPStatus::send502( + $this->head . "<h2>Error!!</h2><div class='alert alert-error'>The named graph $ng couldn't be removed from the endpoint. The server was acting as a gateway or proxy and received an invalid response (" . $http_status . ") from the upstream server</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>" . $this->foot + ); + } + curl_close($c); + } else { + HTTPStatus::send405($_SERVER['REQUEST_METHOD']); + } } - curl_close($c); - - }else{ - HTTPStatus::send405($_SERVER['REQUEST_METHOD']); - } + exit(0); } - exit(0); - } - - - protected function editNamespaces(){ - global $conf; - if($_SERVER['REQUEST_METHOD'] == 'GET'){ - $nstable = ""; - foreach($conf['ns'] as $k=>$v){ - $nstable .= "<tr><td>".$k."</td><td id='$k'>".$v."</td><td><button class='button btn edit-button' data-prefix='$k' data-ns='$v'>Edit</button></tr>"; - } - echo $this->head." + + protected function editNamespaces() + { + global $conf; + if ($_SERVER['REQUEST_METHOD'] == 'GET') { + $nstable = ""; + foreach ($conf['ns'] as $k => $v) { + $nstable .= "<tr><td>" . $k . "</td><td id='$k'>" . $v . "</td><td><button class='button btn edit-button' data-prefix='$k' data-ns='$v'>Edit</button></tr>"; + } + echo $this->head . " <div class='fluid-row'> <div class='span7'> <form action='namespaces' method='post' @@ -442,21 +462,21 @@ class AdminModule extends abstractModule { <input type='text' name='prefix' id='prefix' value='local'/> <span class='help-block'>The prefix to describe this namespace ('local' is the one used to mirror URIs of the data in this server)</span> <label for='file'>Namespace</label> - <input type='text' name='namespace' id='namespace' value='".$conf['ns']['local']."'/> + <input type='text' name='namespace' id='namespace' value='" . $conf['ns']['local'] . "'/> <span class='help-block'>The namespace of the data being served</span> <br /> <button type='submit' class='btn'>Submit</button></form> </div> <div class='span4 well'> <legend>Edit local namespace</legend> - <p>'local' namespace defines which types of URI will be mirrored in this server. Thus, it is possible to serve data about <code>http://example.org/myresource</code> by dereferencing <code>".$conf['ns']['local']."myresource</code></p> + <p>'local' namespace defines which types of URI will be mirrored in this server. Thus, it is possible to serve data about <code>http://example.org/myresource</code> by dereferencing <code>" . $conf['ns']['local'] . "myresource</code></p> <legend>Add a new namespace</legend> <p>To add a new namespace, simply change the prefix from 'local' to the new one you want to add and include the namespaces in the following box.</p> <legend>Edit other namespace</legend> <p>Click on 'edit' in the proper row in the following table and modify the values in the form.</p> </div> </div> - <script type='text/javascript' src='".$conf['basedir']."js/jquery.js'></script> + <script type='text/javascript' src='" . $conf['basedir'] . "js/jquery.js'></script> <script type='text/javascript'> //<![CDATA[ $(document).ready(function(){ @@ -475,31 +495,30 @@ class AdminModule extends abstractModule { <legend>Edit other namespaces</legend> <table class='table table-striped'> <thead><td>Prefix</td><td>Namespace</td><td>Edit</td></thead>$nstable</table> - ".$this->foot; - }elseif($_SERVER['REQUEST_METHOD'] == 'POST'){ - $ns = (isset($_POST['namespace']))?$_POST['namespace']:'http://'.$_SERVER['SERVER_NAME'].'/'; - $prefix = (isset($_POST['prefix']))?$_POST['prefix']:'local'; - $return_var = 0; - exec ("php utils/modules/remove-namespace.php ".$prefix, $output, $return_var); - exec ("php utils/modules/add-namespace.php ".$prefix." ".$ns, $output, $return_var); - if($return_var == 0){ - echo $this->head ."<div class='alert alert-success'>Your main namespace was updated successfully to $ns</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>".$this->foot; - }else{ - echo $this->head ."<div class='alert alert-error'>Error: Update did not finished successfullt. Please check setting.inc.php located at ".$conf['home'].".</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>".$this->foot; - } + " . $this->foot; + } elseif ($_SERVER['REQUEST_METHOD'] == 'POST') { + $ns = (isset($_POST['namespace'])) ? $_POST['namespace'] : 'http://' . $_SERVER['SERVER_NAME'] . '/'; + $prefix = (isset($_POST['prefix'])) ? $_POST['prefix'] : 'local'; + $return_var = 0; + exec("php utils/modules/remove-namespace.php " . $prefix, $output, $return_var); + exec("php utils/modules/add-namespace.php " . $prefix . " " . $ns, $output, $return_var); + if ($return_var == 0) { + echo $this->head . "<div class='alert alert-success'>Your main namespace was updated successfully to $ns</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>" . $this->foot; + } else { + echo $this->head . "<div class='alert alert-error'>Error: Update did not finished successfullt. Please check setting.inc.php located at " . $conf['home'] . ".</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>" . $this->foot; + } + } } - } - - - - protected function editEndpoints(){ - global $conf; - if($_SERVER['REQUEST_METHOD'] == 'GET'){ - $nstable = ""; - foreach($conf['endpoint'] as $k=>$v){ - $nstable .= "<tr><td>".$k."</td><td id='$k'>".$v."</td><td><button class='button btn edit-button' data-prefix='$k' data-ns='$v'>Edit</button></tr>"; - } - echo $this->head." + + protected function editEndpoints() + { + global $conf; + if ($_SERVER['REQUEST_METHOD'] == 'GET') { + $nstable = ""; + foreach ($conf['endpoint'] as $k => $v) { + $nstable .= "<tr><td>" . $k . "</td><td id='$k'>" . $v . "</td><td><button class='button btn edit-button' data-prefix='$k' data-ns='$v'>Edit</button></tr>"; + } + echo $this->head . " <div class='fluid-row'> <div class='span7'> <form action='endpoints' method='post' @@ -509,7 +528,7 @@ class AdminModule extends abstractModule { <input type='text' name='prefix' id='prefix' value='local'/> <span class='help-block'>The prefix to describe this namespace ('local' is the one used to mirror URIs of the data in this server)</span> <label for='file'>Endpoint</label> - <input type='text' name='endpoint' id='endpoint' value='".$conf['endpoint']['local']."'/> + <input type='text' name='endpoint' id='endpoint' value='" . $conf['endpoint']['local'] . "'/> <span class='help-block'>The endpoint URL</span> <br /> <button type='submit' class='btn'>Submit</button></form> @@ -520,7 +539,7 @@ class AdminModule extends abstractModule { <p>To edit an endpoint, click on 'edit' in the proper row in the following table and modify the values in the form.</p> </div> </div> - <script type='text/javascript' src='".$conf['basedir']."js/jquery.js'></script> + <script type='text/javascript' src='" . $conf['basedir'] . "js/jquery.js'></script> <script type='text/javascript'> //<![CDATA[ $(document).ready(function(){ @@ -539,65 +558,68 @@ class AdminModule extends abstractModule { <legend>Edit other namespaces</legend> <table class='table table-striped'> <thead><td>Prefix</td><td>Namespace</td><td>Edit</td></thead>$nstable</table> - ".$this->foot; - }elseif($_SERVER['REQUEST_METHOD'] == 'POST'){ - $ns = (isset($_POST['endpoint']))?$_POST['endpoint']:'http://'.$_SERVER['SERVER_NAME'].'/'; - $prefix = (isset($_POST['prefix']))?$_POST['prefix']:'local'; - $return_var = 0; - exec ("php utils/modules/remove-endpoint.php ".$prefix, $output, $return_var); - exec ("php utils/modules/add-endpoint.php ".$prefix." ".$ns, $output, $return_var); - if($return_var == 0){ - echo $this->head ."<div class='alert alert-success'>Your endpoint was updated successfully to $ns</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>".$this->foot; - }else{ - echo $this->head ."<div class='alert alert-error'>Error: Update did not finished successfully. Please check setting.inc.php located at ".$conf['home'].".</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>".$this->foot; - } - } - } - - protected function startEndpoint(){ - $return_var = 0; - exec ("utils/modules/start-endpoint.sh", $output, $return_var); - if($return_var == 0){ - echo $this->head ."<div class='alert alert-success'>Endpoint starter successfully</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>".$this->foot; - }else{ - echo $this->head ."<div class='alert alert-error'>Error: /tmp/fusekiPid already exists. This probably means Fuseki is already running. You could also try to <a href='stop'>stop</a> the endpoint first.</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>".$this->foot; - } - } - - protected function componentEditor(){ - global $lodspk; - global $conf; - exec ("utils/lodspk.sh list components", $output, $return_var); - $menu = ""; - $endpointOptions = ""; - foreach($conf['endpoint'] as $k => $v){ - $selected = ""; - if($k == "local") - $selected = 'selected'; - $endpointOptions .= "<option $selected value='$k'>$k ($v)</option>"; + " . $this->foot; + } elseif ($_SERVER['REQUEST_METHOD'] == 'POST') { + $ns = (isset($_POST['endpoint'])) ? $_POST['endpoint'] : 'http://' . $_SERVER['SERVER_NAME'] . '/'; + $prefix = (isset($_POST['prefix'])) ? $_POST['prefix'] : 'local'; + $return_var = 0; + exec("php utils/modules/remove-endpoint.php " . $prefix, $output, $return_var); + exec("php utils/modules/add-endpoint.php " . $prefix . " " . $ns, $output, $return_var); + if ($return_var == 0) { + echo $this->head . "<div class='alert alert-success'>Your endpoint was updated successfully to $ns</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>" . $this->foot; + } else { + echo $this->head . "<div class='alert alert-error'>Error: Update did not finished successfully. Please check setting.inc.php located at " . $conf['home'] . ".</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>" . $this->foot; + } + } } - $namespaces = "var ns = ".json_encode($conf['ns']); - $lastComponentType=""; - $onlyService = false; - foreach($output as $line){ - if($line == ""){ - $menu .= "</ul>\n"; - }else{ - if(preg_match("/^\w/", $line) ){ - $lastComponentType = trim($line); - $singleLastComponentType = preg_replace('/(.*)s$/', '\1', $lastComponentType); - $menu .= "<ul class='nav nav-list'> - <li class='nav-header'>".$lastComponentType." <button class='btn btn-mini btn-info new-button' style='float:right' data-type='$singleLastComponentType'>new</button></li>\n"; - }else{ - $componentName = trim($line); - $menu .= "<li class='component-li'> <button type='button' class='close hide lodspk-delete-component' data-component-type='$singleLastComponentType' data-component-name='$componentName' style='align:left'>x</button> - <a href='#$componentName' class='lodspk-component' data-component-type='$lastComponentType' data-component-name='$componentName'>".$componentName."</a></li>\n"; + + protected function startEndpoint() + { + $return_var = 0; + exec("utils/modules/start-endpoint.sh", $output, $return_var); + if ($return_var == 0) { + echo $this->head . "<div class='alert alert-success'>Endpoint starter successfully</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>" . $this->foot; + } else { + echo $this->head . "<div class='alert alert-error'>Error: /tmp/fusekiPid already exists. This probably means Fuseki is already running. You could also try to <a href='stop'>stop</a> the endpoint first.</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>" . $this->foot; } - } } - echo $this->head ." + + protected function componentEditor() + { + global $lodspk; + global $conf; + exec("utils/lodspk.sh list components", $output, $return_var); + $menu = ""; + $endpointOptions = ""; + foreach ($conf['endpoint'] as $k => $v) { + $selected = ""; + if ($k == "local") { + $selected = 'selected'; + } + $endpointOptions .= "<option $selected value='$k'>$k ($v)</option>"; + } + $namespaces = "var ns = " . json_encode($conf['ns']); + $lastComponentType = ""; + $onlyService = false; + foreach ($output as $line) { + if ($line == "") { + $menu .= "</ul>\n"; + } else { + if (preg_match("/^\w/", $line)) { + $lastComponentType = trim($line); + $singleLastComponentType = preg_replace('/(.*)s$/', '\1', $lastComponentType); + $menu .= "<ul class='nav nav-list'> + <li class='nav-header'>" . $lastComponentType . " <button class='btn btn-mini btn-info new-button' style='float:right' data-type='$singleLastComponentType'>new</button></li>\n"; + } else { + $componentName = trim($line); + $menu .= "<li class='component-li'> <button type='button' class='close hide lodspk-delete-component' data-component-type='$singleLastComponentType' data-component-name='$componentName' style='align:left'>x</button> + <a href='#$componentName' class='lodspk-component' data-component-type='$lastComponentType' data-component-name='$componentName'>" . $componentName . "</a></li>\n"; + } + } + } + echo $this->head . " <script type='application/javascript'> - var home='".$conf['basedir']."'; + var home='" . $conf['basedir'] . "'; $namespaces </script> <div class='row-fluid'> @@ -653,214 +675,220 @@ class AdminModule extends abstractModule { </div> </div> </div> - <script src='".$conf['basedir'] ."admin/codemirror/lib/codemirror.js'></script> - <script src='".$conf['basedir'] ."admin/codemirror/lib/util/overlay.js'></script> - <script src='".$conf['basedir'] ."admin/codemirror/mode/xml/xml.js'></script> - <script src='".$conf['basedir'] ."admin/codemirror/mode/sparql/sparql.js'></script> - <script src='".$conf['basedir'] ."admin/js/editor.js'></script> - - - ".$this->foot; - } - - - protected function componentEditorApi($params){ - switch($params[0]){ - case "details": - $this->getComponentDetails(array_slice($params, 1)); - break; - case "save": - if(sizeof($params) > 2){ - $this->saveComponent($params); - }else{ - HTTPStatus::send404($params[1]); - } - break; - case "create": - if(sizeof($params) > 2){ - $this->createComponent($params); - }else{ - HTTPStatus::send404($params[1]); - } - break; - case "delete": - if(sizeof($params) > 2){ - $this->deleteComponent($params); - }else{ - HTTPStatus::send404($params[1]); - } - break; - case "add": - if(sizeof($params) > 2){ - $this->addFile($params); - }else{ - HTTPStatus::send404($params[1]); - } - break; - case "remove": - if(sizeof($params) > 2){ - $this->deleteFile($params); - }else{ - HTTPStatus::send404($params[1]); - } - break; - case "query": - $this->queryEndpoint($_POST); - break; - default: - HTTPStatus::send404($params[1]); - } - } - - protected function queryEndpoint($data){ - global $endpoints; - global $conf; - $query = $data['query']; - $endpoint = $data['endpoint']; - if(isset($endpoint) && isset($conf['endpoint'][$endpoint])){ - if(!isset($endpoints[$endpoint])){ - $e = new Endpoint($conf['endpoint'][$endpoint], $conf['endpoint']['config']); - }else{ - $e = $endpoints[$endpoint]; - } - $aux = $e->query($query, Utils::getResultsType($query)); - header("Content-type: ".$data['format']); - $jaux = json_encode($aux); - if(isset($jaux)){ - echo $jaux; - }else{ - echo $aux; - HTTPStatus::send404($params[1]); - } - }else{ - echo "no endpoint"; - HTTPStatus::send404($params[1]); + <script src='" . $conf['basedir'] . "admin/codemirror/lib/codemirror.js'></script> + <script src='" . $conf['basedir'] . "admin/codemirror/lib/util/overlay.js'></script> + <script src='" . $conf['basedir'] . "admin/codemirror/mode/xml/xml.js'></script> + <script src='" . $conf['basedir'] . "admin/codemirror/mode/sparql/sparql.js'></script> + <script src='" . $conf['basedir'] . "admin/js/editor.js'></script> + + + " . $this->foot; } - } - - protected function getComponentDetails($params){ - $componentType = $params[0]; - $componentName = $params[1]; - if(!isset($componentType) || !isset($componentName)){ - HTTPStatus::send404(); - exit(0); - } - $return_var = 0; - exec ("utils/modules/detail-component.sh $componentType $componentName", $output, $return_var); - if($return_var == 0){ - $comps = array(); - $lastKey = ""; - foreach($output as $line){ - if($line == ""){ - $menu .= "</ul>\n"; - }else{ - if(preg_match("/^\w/", $line) ){ - $lastKey = trim($line); - $comps[$lastKey] = array(); - }else{ - array_push($comps[$lastKey], trim($line)); - } + + protected function componentEditorApi($params) + { + switch ($params[0]) { + case "details": + $this->getComponentDetails(array_slice($params, 1)); + break; + case "save": + if (sizeof($params) > 2) { + $this->saveComponent($params); + } else { + HTTPStatus::send404($params[1]); + } + break; + case "create": + if (sizeof($params) > 2) { + $this->createComponent($params); + } else { + HTTPStatus::send404($params[1]); + } + break; + case "delete": + if (sizeof($params) > 2) { + $this->deleteComponent($params); + } else { + HTTPStatus::send404($params[1]); + } + break; + case "add": + if (sizeof($params) > 2) { + $this->addFile($params); + } else { + HTTPStatus::send404($params[1]); + } + break; + case "remove": + if (sizeof($params) > 2) { + $this->deleteFile($params); + } else { + HTTPStatus::send404($params[1]); + } + break; + case "query": + $this->queryEndpoint($_POST); + break; + default: + HTTPStatus::send404($params[1]); } - } - header("Content-type: application/json"); - echo json_encode($comps); - }else{ - HTTPStatus::send500(); - exit(0); } - } - - protected function saveComponent($params){ - if($_SERVER['REQUEST_METHOD'] == 'POST'){ - $path = implode("/", array_slice($params, 1)); - if(file_exists("components/".$path)){ - $result = file_put_contents("components/".$path,$_POST['content'] ); - if($result === FALSE){ + + protected function queryEndpoint($data) + { + global $endpoints; + global $conf; + $query = $data['query']; + $endpoint = $data['endpoint']; + if (isset($endpoint) && isset($conf['endpoint'][$endpoint])) { + if (!isset($endpoints[$endpoint])) { + $e = new Endpoint($conf['endpoint'][$endpoint], $conf['endpoint']['config']); + } else { + $e = $endpoints[$endpoint]; + } + $aux = $e->query($query, Utils::getResultsType($query)); + header("Content-type: " . $data['format']); + $jaux = json_encode($aux); + if (isset($jaux)) { + echo $jaux; + } else { + echo $aux; + HTTPStatus::send404($params[1]); + } + } else { + echo "no endpoint"; + HTTPStatus::send404($params[1]); + } + } + + protected function getComponentDetails($params) + { + $componentType = $params[0]; + $componentName = $params[1]; + if (!isset($componentType) || !isset($componentName)) { + HTTPStatus::send404(); + exit(0); + } + $return_var = 0; + exec("utils/modules/detail-component.sh $componentType $componentName", $output, $return_var); + if ($return_var == 0) { + $comps = array(); + $lastKey = ""; + foreach ($output as $line) { + if ($line == "") { + $menu .= "</ul>\n"; + } else { + if (preg_match("/^\w/", $line)) { + $lastKey = trim($line); + $comps[$lastKey] = array(); + } else { + array_push($comps[$lastKey], trim($line)); + } + } + } + header("Content-type: application/json"); + echo json_encode($comps); + } else { + HTTPStatus::send500(); + exit(0); + } + } + + protected function saveComponent($params) + { + if ($_SERVER['REQUEST_METHOD'] == 'POST') { + $path = implode("/", array_slice($params, 1)); + if (file_exists("components/" . $path)) { + $result = file_put_contents("components/" . $path, $_POST['content']); + if ($result === false) { + HTTPStatus::send500(); + } else { + echo json_encode(array('success' => true, 'size' => $result)); + } + } else { HTTPStatus::send500(); - }else{ - echo json_encode(array('success' => true, 'size' => $result)); + exit(0); + } } - }else{ - HTTPStatus::send500(); - exit(0); - } } - } - - protected function createComponent($params){ - $path = implode("/", array_slice($params, 1)); - if($_SERVER['REQUEST_METHOD'] == 'POST'){ - if(sizeof($params) != 3){ - HTTPStatus::send404(); - exit(0); - } - $return_var = 0; - exec ("utils/lodspk.sh create ".$params[1]." ".$params[2], $output, $return_var); - //echo $return_var;exit(0); - if($return_var !== 0){ - HTTPStatus::send500($params[0]." ".$params[1]); - }else{ - echo json_encode(array('success' => true, 'size' => $result)); - } - }else{ - HTTPStatus::send406(); - exit(0); + + protected function createComponent($params) + { + $path = implode("/", array_slice($params, 1)); + if ($_SERVER['REQUEST_METHOD'] == 'POST') { + if (sizeof($params) != 3) { + HTTPStatus::send404(); + exit(0); + } + $return_var = 0; + exec("utils/lodspk.sh create " . $params[1] . " " . $params[2], $output, $return_var); + //echo $return_var;exit(0); + if ($return_var !== 0) { + HTTPStatus::send500($params[0] . " " . $params[1]); + } else { + echo json_encode(array('success' => true, 'size' => $result)); + } + } else { + HTTPStatus::send406(); + exit(0); + } } - } - protected function deleteComponent($params){ - $path = implode("/", array_slice($params, 1)); - if($_SERVER['REQUEST_METHOD'] == 'POST'){ - if(sizeof($params) != 3){ - HTTPStatus::send404(); - exit(0); - } - $return_var = 0; - exec ("utils/lodspk.sh delete ".$params[1]." ".$params[2], $output, $return_var); - if($return_var !== 0){ - HTTPStatus::send500($params[0]." ".$params[1]); - }else{ - echo json_encode(array('success' => true, 'size' => $result)); - } - }else{ - HTTPStatus::send406(); - exit(0); + protected function deleteComponent($params) + { + $path = implode("/", array_slice($params, 1)); + if ($_SERVER['REQUEST_METHOD'] == 'POST') { + if (sizeof($params) != 3) { + HTTPStatus::send404(); + exit(0); + } + $return_var = 0; + exec("utils/lodspk.sh delete " . $params[1] . " " . $params[2], $output, $return_var); + if ($return_var !== 0) { + HTTPStatus::send500($params[0] . " " . $params[1]); + } else { + echo json_encode(array('success' => true, 'size' => $result)); + } + } else { + HTTPStatus::send406(); + exit(0); + } } - } - - protected function deleteFile($params){ - $path = "components/".implode("/", array_slice($params, 1)); - if($_SERVER['REQUEST_METHOD'] == 'POST'){ - if(sizeof($params) < 3){ - HTTPStatus::send404(); - exit(0); - } - $return_var = 0; - if(strpos($path, "components") === 0 && strpos($path, '..') === FALSE){ - exec ("rm ".$path, $output, $return_var); - if($return_var !== 0){ - echo json_encode(array('success' => false, path => $path)); - }else{ - echo json_encode(array('success' => true, path => $path)); + + protected function deleteFile($params) + { + $path = "components/" . implode("/", array_slice($params, 1)); + if ($_SERVER['REQUEST_METHOD'] == 'POST') { + if (sizeof($params) < 3) { + HTTPStatus::send404(); + exit(0); + } + $return_var = 0; + if (strpos($path, "components") === 0 && strpos($path, '..') === false) { + exec("rm " . $path, $output, $return_var); + if ($return_var !== 0) { + echo json_encode(array('success' => false, path => $path)); + } else { + echo json_encode(array('success' => true, path => $path)); + } + } else { + HTTPStatus::send406(); + exit(0); + } + } else { + echo json_encode(array('success' => false, path => $path)); } - }else{ - HTTPStatus::send406(); - exit(0); - } - }else{ - echo json_encode(array('success' => false, path => $path)); } - } - - - protected function addFile($params){ - $path = "components/".implode("/", array_slice($params, 1)); - $basicContent = "SELECT * WHERE{ + + protected function addFile($params) + { + $path = "components/" . implode("/", array_slice($params, 1)); + $basicContent = "SELECT * WHERE{ ?s ?p ?o }LIMIT 10"; - if(strpos($path, ".template") !== FALSE){ - //It is not a query, but a template - $basicContent = "<!DOCTYPE html> + if (strpos($path, ".template") !== false) { + //It is not a query, but a template + $basicContent = "<!DOCTYPE html> <html> <head> <meta http-equiv='Content-type' content='text/html; charset=utf-8'> @@ -868,58 +896,59 @@ class AdminModule extends abstractModule { <body> </body> </html>"; - } - if($_SERVER['REQUEST_METHOD'] == 'POST'){ - if(sizeof($params) < 3){ - HTTPStatus::send404(); - exit(0); - } - $return_var = 0; - if(file_exists($path)){ - echo json_encode(array('success' => false)); - return; - } - $dirpath=$path; - $dirArray = explode("/", $path); - array_pop($dirArray); - $dirpath = implode("/", $dirArray); - if(!is_dir($dirpath)){ - $oldumask = umask(0); - $return_var = mkdir($dirpath, 0755, true); - umask($oldumask); - if($return_var === FALSE){ - HTTPStatus::send500("mkdir ".var_export($return_var, true)." ".$dirpath); } - } - $return_var = file_put_contents($path, $basicContent ); - - //echo $return_var;exit(0); - if($return_var === FALSE){ - HTTPStatus::send500("file_puts_content ".var_export($return_var, true)." ".$path); - }else{ - echo json_encode(array('success' => true, 'return' => $return_var)); - } - }else{ - HTTPStatus::send406(); - exit(0); + if ($_SERVER['REQUEST_METHOD'] == 'POST') { + if (sizeof($params) < 3) { + HTTPStatus::send404(); + exit(0); + } + $return_var = 0; + if (file_exists($path)) { + echo json_encode(array('success' => false)); + return; + } + $dirpath = $path; + $dirArray = explode("/", $path); + array_pop($dirArray); + $dirpath = implode("/", $dirArray); + if (!is_dir($dirpath)) { + $oldumask = umask(0); + $return_var = mkdir($dirpath, 0755, true); + umask($oldumask); + if ($return_var === false) { + HTTPStatus::send500("mkdir " . var_export($return_var, true) . " " . $dirpath); + } + } + $return_var = file_put_contents($path, $basicContent); + + //echo $return_var;exit(0); + if ($return_var === false) { + HTTPStatus::send500("file_puts_content " . var_export($return_var, true) . " " . $path); + } else { + echo json_encode(array('success' => true, 'return' => $return_var)); + } + } else { + HTTPStatus::send406(); + exit(0); + } } - } - - - protected function stopEndpoint(){ - $return_var = 0; - exec ("utils/modules/stop-endpoint.sh", $output, $return_var); - if($return_var == 0){ - echo $this->head ."<div class='alert alert-success'>Endpoint stopped successfully</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>".$this->foot; - }else{ - echo $this->head ."<div class='alert alert-error'>Error: Something went wrong. Are you sure the endpoint is running?</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>".$this->foot; + + protected function stopEndpoint() + { + $return_var = 0; + exec("utils/modules/stop-endpoint.sh", $output, $return_var); + if ($return_var == 0) { + echo $this->head . "<div class='alert alert-success'>Endpoint stopped successfully</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>" . $this->foot; + } else { + echo $this->head . "<div class='alert alert-error'>Error: Something went wrong. Are you sure the endpoint is running?</div><div class='alert'>You can now return to the <a href='menu'>home menu</a>.</div>" . $this->foot; + } } - } - - protected function homeMenu(){ - global $conf; - $output = array(); - echo $this->head." + + protected function homeMenu() + { + global $conf; + $output = array(); + echo $this->head . " <div class='well span5'> <h2>Components Editor</h2> <p>You can create, remove and edit components (services types, etc) using the <a href='components'>editor</a></p> @@ -933,59 +962,72 @@ class AdminModule extends abstractModule { <li>Add, remove or <a href='endpoints'>edit endpoints</a></li> </ul> </div> - ".$this->foot; - - } - - protected function auth(){ - global $conf; - $realm = 'Restricted area'; - //user => password - $users = array('admin' => $conf['admin']['pass']); - if (empty($_SERVER['PHP_AUTH_DIGEST'])) { - header('HTTP/1.1 401 Unauthorized'); - header('WWW-Authenticate: Digest realm="'.$realm. - '",qop="auth",nonce="'.uniqid().'",opaque="'.md5($realm).'"'); - - die('Access to administration menu requires valid authentication'); + " . $this->foot; } - // analyze the PHP_AUTH_DIGEST variable - if (!($data = $this->http_digest_parse($_SERVER['PHP_AUTH_DIGEST'])) || - !isset($users[$data['username']])) - return FALSE; - - //die('Wrong Credentials!'); - // generate the valid response - $A1 = md5($data['username'] . ':' . $realm . ':' . $users[$data['username']]); - $A2 = md5($_SERVER['REQUEST_METHOD'].':'.$data['uri']); - $valid_response = md5($A1.':'.$data['nonce'].':'.$data['nc'].':'.$data['cnonce'].':'.$data['qop'].':'.$A2); - - if ($data['response'] != $valid_response) - return FALSE; + + protected function auth() + { + global $conf; + $realm = 'Restricted area'; + //user => password + $users = array('admin' => $conf['admin']['pass']); + if (empty($_SERVER['PHP_AUTH_DIGEST'])) { + header('HTTP/1.1 401 Unauthorized'); + header( + 'WWW-Authenticate: Digest realm="' . $realm . + '",qop="auth",nonce="' . uniqid() . '",opaque="' . md5($realm) . '"' + ); + + die('Access to administration menu requires valid authentication'); + } + // analyze the PHP_AUTH_DIGEST variable + if (!($data = $this->http_digest_parse($_SERVER['PHP_AUTH_DIGEST'])) || + !isset($users[$data['username']])) { + return false; + } + + //die('Wrong Credentials!'); + // generate the valid response + $A1 = md5($data['username'] . ':' . $realm . ':' . $users[$data['username']]); + $A2 = md5($_SERVER['REQUEST_METHOD'] . ':' . $data['uri']); + $valid_response = md5( + $A1 . ':' . $data['nonce'] . ':' . $data['nc'] . ':' . $data['cnonce'] . ':' . $data['qop'] . ':' . $A2 + ); + + if ($data['response'] != $valid_response) { + return false; + } // die('Wrong Credentials!'); - - // ok, valid username & password - //echo 'You are logged in as: ' . $data['username']; - return TRUE; - - } - - // function to parse the http auth header - protected function http_digest_parse($txt) - { - // protect against missing data - $needed_parts = array('nonce'=>1, 'nc'=>1, 'cnonce'=>1, 'qop'=>1, 'username'=>1, 'uri'=>1, 'response'=>1); - $data = array(); - $keys = implode('|', array_keys($needed_parts)); - - preg_match_all('@(' . $keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))@', $txt, $matches, PREG_SET_ORDER); - - foreach ($matches as $m) { - $data[$m[1]] = $m[3] ? $m[3] : $m[4]; - unset($needed_parts[$m[1]]); + + // ok, valid username & password + //echo 'You are logged in as: ' . $data['username']; + return true; } - - return $needed_parts ? false : $data; - } - + + // function to parse the http auth header + protected function http_digest_parse($txt) + { + // protect against missing data + $needed_parts = array( + 'nonce' => 1, + 'nc' => 1, + 'cnonce' => 1, + 'qop' => 1, + 'username' => 1, + 'uri' => 1, + 'response' => 1 + ); + $data = array(); + $keys = implode('|', array_keys($needed_parts)); + + preg_match_all('@(' . $keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))@', $txt, $matches, PREG_SET_ORDER); + + foreach ($matches as $m) { + $data[$m[1]] = $m[3] ? $m[3] : $m[4]; + unset($needed_parts[$m[1]]); + } + + return $needed_parts ? false : $data; + } + } diff --git a/classes/modules/exportModule.php b/classes/modules/exportModule.php index a8233ea302698a26949c0242f7d13f62c9e35fab..5dc6c61b99863b6263b9843d6a63c383f9f86b87 100644 --- a/classes/modules/exportModule.php +++ b/classes/modules/exportModule.php @@ -2,376 +2,381 @@ require_once('abstractModule.php'); -class ExportModule extends abstractModule { - private $serialization; - private $graph; - - public function match($uri){ - global $conf; - global $localUri; - $q = preg_replace('|^'.$conf['basedir'].'|', '', $localUri); - return $q == "export"; - } - - public function execute($service){ - global $conf; - $this->serialization = ""; - $this->graph = array(); - header('Content-Type: text/plain'); - define("CNT", "http://www.w3.org/2011/content#"); - define("NSVIZON", "http://graves.cl/vizon/"); - define("LS", "http://lodspeakr.org/lda/"); - define("LDA", "http://tw.rpi.edu/lda/"); - define("DC", "http://purl.org/dc/terms/"); - define("RDF", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); - define("RDFS", "http://www.w3.org/2000/01/rdf-schema#"); - define("OPMV", "http://openprovenance.org/ontology#"); - define("SKOS", "http://www.w3.org/2004/02/skos/core#"); - require __DIR__ . '/../../vendor/semsol/arc2/ARC2.php'; - $ser = ARC2::getTurtleSerializer(); - - $triples = array(); - $t = array(); - $t['s'] = $conf['basedir']; - $t['s_type'] = 'uri'; - $t['p'] = RDF.'type'; - $t['o'] = OPMV.'Agent'; - $t['o_type'] = 'uri'; - array_push($triples, $t); - $t['o'] = SKOS.'Concept'; - array_push($triples, $t); - $t['o'] = LS.'Application'; - array_push($triples, $t); - if($conf['parentApp'] != NULL){ - $t['p'] = OPMV.'wasDerivedFrom'; - $t['o'] = $conf['parentApp']; - array_push($triples, $t); - } - - $sparqlComponent = $conf['basedir'].'sparqlComponent';//uniqid("_:b"); - $baseComponent = $conf['basedir'];//uniqid("_:b"); - $components = $this->getComponents($conf['home'].$conf['view']['directory']."/".$conf['service']['prefix'], ''); - //var_dump($components);exit(0); - //Define Process - $t = array(); - foreach($components as $k=>$m){ - - $process = uniqid("_:b"); - $t['s'] = $process; - $t['s_type'] = 'bnode'; - $t['p'] = RDF.'type'; - $t['o'] = OPMV.'Process'; - $t['o_type'] = 'uri'; - array_push($triples, $t); - - - //Controlled by - $component = $baseComponent.$conf['service']['prefix']."/".$k; - $t['p'] = OPMV.'wasControlledBy'; - $t['o'] = $component; - $t['o_type'] = 'uri'; - array_push($triples, $t); - - //Associated Agent to this installation - $aux = $t['o']; - $t['s'] = $t['o']; - $t['p'] = RDF.'type'; - $t['o'] =OPMV.'Component'; - array_push($triples, $t); - $t['p'] = SKOS.'broader'; - $t['o'] = $conf['basedir']; - $t['o_type'] = 'uri'; - array_push($triples, $t); - - //$t['s'] = $process; - //$t['s_type'] = 'bnode'; - $visualPart=uniqid("_:b"); - $queryPart=uniqid("_:b"); - $t['p'] = SKOS.'broader'; - $t['s'] = $queryPart; - $t['s_type'] = 'bnode'; - $t['o'] = $component; - array_push($triples, $t); - $t['s'] = $visualPart; - array_push($triples, $t); - - foreach($m as $l => $v){ - if(strpos($l, "query")>-1){ - $t2['s'] = $queryPart; - $t2['p'] = RDF.'type'; - $t2['o'] = LS.'LodspeakrDataComponent'; - $t2['o_type'] = 'uri'; - - }else{ - $t2['s'] = $visualPart; - $t2['p'] = RDF.'type'; - $t2['o'] = LS.'LodspeakrVisualComponent'; - $t2['o_type'] = 'uri'; - } - array_push($triples, $t2); - $t2['p'] = NSVIZON.'hasInput'; - $t2['o'] = $baseComponent.$conf['service']['prefix']."/".$k."/".$l; - $t2['o_type'] = 'uri'; - - array_push($triples, $t2); - $t2['s'] = $t2['o']; - $t2['p'] = DC."hasFormat"; - $t2['o'] = uniqid("_:b"); - $t2['o_type'] = 'bnode'; - array_push($triples, $t2); - $t2['s'] = $t2['o']; - $t2['s_type'] = $t2['o_type']; - $t2['p'] = RDF.'type'; - $t2['o'] = NSVIZON.'Component'; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - $t2['s_type'] = $t2['o_type']; - $t2['p'] = DC.'format'; - $t2['o'] = 'text/plain;charset=utf-8'; - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - $t2['p'] = CNT.'ContentAsText'; - $t2['o'] = $v; - array_push($triples, $t2); } - //Return object for later triple - //$t['o'] = $baseComponent; - /* - // Type of query - $t2 = array(); - $t2['s'] = $t['o']; - $t2['s_type'] = 'bnode'; - $t2['p'] = RDF.'type'; - $t2['o'] = LS.'LodspeakrVisualComponent'; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - - $t3 = array(); - $t3['s'] = $t2['o']; - $t3['s_type'] = 'uri'; - $t3['p'] = RDFS.'subClassOf'; - $t3['o'] = LDA."VisualComponent"; - $t3['o_type'] = 'uri'; - array_push($triples, $t3); - - $t2['p'] = RDFS.'label'; - $t2['o'] = 'Haanga-based visualization component for LODSPeaKr'; - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - - $t['p'] = LS.'usedInput'; - $t['o'] = $conf['basedir'].$conf['view']['directory'].$k; - $t['o_type'] = 'uri'; - array_push($triples, $t); - - - $t2 = array(); - $t2['s'] = $t['o']; - $t2['s_type'] = 'uri'; - $t2['p'] = RDF.'type'; - $t2['o'] = LS."Input"; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - $t2['p'] = RDFS.'label'; - $t2['o'] = $conf['view']['directory'].$k; - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - $t2['p'] = DC.'hasFormat'; - $t2['o'] = uniqid("_:b"); - $t2['o_type'] = 'bnode'; - array_push($triples, $t2); - - $t2['s'] = $t2['o']; - $t2['s_type'] = 'bnode'; - $t2['p'] = RDF.'type'; - $t2['o'] = CNT."ContentAsText"; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - $t2['p'] = CNT.'chars'; - $t2['o'] = ($m); - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - $t2['p'] = DC.'format'; - $t2['o'] = 'text/plain;charset=utf-8'; - $t2['o_type'] = 'literal'; */ - // array_push($triples, $t2); - //break; - } - - //Static files - - $staticComponent = $conf['basedir'].'staticComponent';//uniqid("_:b"); - //$statics = $this->getComponents($conf['home'].$conf['static']['directory'], ''); - - //Define Process - $t = array(); - $t['s'] = uniqid("_:b"); - $t['s_type'] = 'bnode'; - $t['p'] = RDF.'type'; - $t['o'] = OPMV.'Process'; - $t['o_type'] = 'uri'; - array_push($triples, $t); - foreach($statics as $k=>$m){ - - - - //Controlled by - $t['p'] = OPMV.'wasControlledBy'; - $t['o'] = $staticComponent; - $t['o_type'] = 'bnode'; - array_push($triples, $t); - - //Associated Agent to this installation - $aux = $t['o']; - $t['s'] = $t['o']; - $t['p'] = SKOS.'broader'; - $t['o'] = $conf['basedir']; - $t['o_type'] = 'uri'; - array_push($triples, $t); - - //Return object for later triple - $t['o'] = $staticComponent; - - // Type of query - $t2 = array(); - $t2['s'] = $t['o']; - $t2['s_type'] = 'bnode'; - $t2['p'] = RDF.'type'; - $t2['o'] = LS.'LodspeakrStaticElementsComponent'; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - - $t3 = array(); - $t3['s'] = $t2['o']; - $t3['s_type'] = 'uri'; - $t3['p'] = RDFS.'subClassOf'; - $t3['o'] = LDA."ProcessComponent"; - $t3['o_type'] = 'uri'; - array_push($triples, $t3); - - array_push($triples, $t2); - $t2['p'] = RDFS.'label'; - $t2['o'] = 'Component of LODSPeaKr in charge of static content'; - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - - $t['p'] = LS.'usedInput'; - $t['o'] = $conf['basedir'].$conf['static']['directory'].$k; - $t['o_type'] = 'uri'; - array_push($triples, $t); - - $t2 = array(); - $t2['s'] = $t['o']; - $t2['s_type'] = 'uri'; - $t2['p'] = RDF.'type'; - $t2['o'] = LS."Input"; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - $t2['p'] = RDFS.'label'; - $t2['o'] = $conf['static']['directory'].$k; - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - - $t2['p'] = DC.'hasFormat'; - $t2['o'] = uniqid("_:b"); - $t2['o_type'] = 'bnode'; - array_push($triples, $t2); - - $t2['s'] = $t2['o']; - $t2['s_type'] = 'bnode'; - $t2['p'] = RDF.'type'; - $t2['o'] = CNT."ContentAsText"; - $t2['o_type'] = 'uri'; - array_push($triples, $t2); - $t2['p'] = CNT.'chars'; - $t2['o'] = ($m); - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - $t2['p'] = DC.'format'; - $t2['o'] = 'text/plain;charset=utf-8'; - $t2['o_type'] = 'literal'; - array_push($triples, $t2); - //break; - } - - - echo "#You can copy and paste the following data into a new\n"; - echo "#LODSPeaKr instance at http://exampleofinstance.org/import\n"; - echo "#As a side note: this is a turtle document but is served as text/plain to make it easier to copy&paste\n\n\n"; - echo $ser->getSerializedTriples($triples); - } - - private static function getTriple($s, $p, $o){ - } - - private function createParameter($name, $value){ - $s = uniqid("_:b"); - $s_type = 'bnode'; - $p = RDF."type"; - $o = NSVIZON."Parameter"; - $o_type = 'uri'; - - - } - - private function getViews($dir){ - global $conf; - $files = ""; - chdir($dir); - $handle = opendir('.'); - while (false !== ($viewFile = readdir($handle))) { - if($viewFile != "." && $viewFile != ".."){ - $files .= $viewFile.": ".htmlspecialchars(file_get_contents($viewFile))."\n"; - $t = array(); - } - } - chdir(".."); - return $files; - } - - private function getComponents($dir){ - global $conf; - $list = array(); - $components = array(); - chdir($dir); - $handle = opendir('.'); - while (false !== ($componentDir = readdir($handle))) { - if($componentDir != "." && $componentDir != ".."){ - if(is_dir($componentDir)){ - $list[] = $componentDir; - } - } - } - closedir($handle); - foreach($list as $v){ - $components[$v] = $this::getComponentsFiles($v); - } - return $components; - } - - - private function getComponentsFiles($dir, $prefix){ - global $conf; - $files = array(); - $subDirs = array(); - $currentDir = getcwd(); - chdir($dir); - $handle = opendir('.'); - while (false !== ($modelFile = readdir($handle))) { - if($modelFile != "." && $modelFile != ".."){ - if(is_dir($modelFile)){ - //Save it for later, after all the queries in the current directory has been resolved - $subDirs[]=$modelFile; - }else{ - $files[$prefix.$modelFile] = (file_get_contents($modelFile))."\n"; - } - } - } - - foreach($subDirs as $dir){ - //$files[$dir] = array(); - $files = array_merge($files, $this->getComponentsFiles($dir, $prefix.$dir."/")); +class ExportModule extends abstractModule +{ + private $serialization; + private $graph; + + public function match($uri) + { + global $conf; + global $localUri; + $q = preg_replace('|^' . $conf['basedir'] . '|', '', $localUri); + return $q == "export"; } - chdir($currentDir); - return $files; - } + + public function execute($service) + { + global $conf; + $this->serialization = ""; + $this->graph = array(); + header('Content-Type: text/plain'); + define("CNT", "http://www.w3.org/2011/content#"); + define("NSVIZON", "http://graves.cl/vizon/"); + define("LS", "http://lodspeakr.org/lda/"); + define("LDA", "http://tw.rpi.edu/lda/"); + define("DC", "http://purl.org/dc/terms/"); + define("RDF", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); + define("RDFS", "http://www.w3.org/2000/01/rdf-schema#"); + define("OPMV", "http://openprovenance.org/ontology#"); + define("SKOS", "http://www.w3.org/2004/02/skos/core#"); + require __DIR__ . '/../../vendor/semsol/arc2/ARC2.php'; + $ser = ARC2::getTurtleSerializer(); + + $triples = array(); + $t = array(); + $t['s'] = $conf['basedir']; + $t['s_type'] = 'uri'; + $t['p'] = RDF . 'type'; + $t['o'] = OPMV . 'Agent'; + $t['o_type'] = 'uri'; + array_push($triples, $t); + $t['o'] = SKOS . 'Concept'; + array_push($triples, $t); + $t['o'] = LS . 'Application'; + array_push($triples, $t); + if ($conf['parentApp'] != null) { + $t['p'] = OPMV . 'wasDerivedFrom'; + $t['o'] = $conf['parentApp']; + array_push($triples, $t); + } + + $sparqlComponent = $conf['basedir'] . 'sparqlComponent';//uniqid("_:b"); + $baseComponent = $conf['basedir'];//uniqid("_:b"); + $components = $this->getComponents( + $conf['home'] . $conf['view']['directory'] . "/" . $conf['service']['prefix'], + '' + ); + //var_dump($components);exit(0); + //Define Process + $t = array(); + foreach ($components as $k => $m) { + $process = uniqid("_:b"); + $t['s'] = $process; + $t['s_type'] = 'bnode'; + $t['p'] = RDF . 'type'; + $t['o'] = OPMV . 'Process'; + $t['o_type'] = 'uri'; + array_push($triples, $t); + + + //Controlled by + $component = $baseComponent . $conf['service']['prefix'] . "/" . $k; + $t['p'] = OPMV . 'wasControlledBy'; + $t['o'] = $component; + $t['o_type'] = 'uri'; + array_push($triples, $t); + + //Associated Agent to this installation + $aux = $t['o']; + $t['s'] = $t['o']; + $t['p'] = RDF . 'type'; + $t['o'] = OPMV . 'Component'; + array_push($triples, $t); + $t['p'] = SKOS . 'broader'; + $t['o'] = $conf['basedir']; + $t['o_type'] = 'uri'; + array_push($triples, $t); + + //$t['s'] = $process; + //$t['s_type'] = 'bnode'; + $visualPart = uniqid("_:b"); + $queryPart = uniqid("_:b"); + $t['p'] = SKOS . 'broader'; + $t['s'] = $queryPart; + $t['s_type'] = 'bnode'; + $t['o'] = $component; + array_push($triples, $t); + $t['s'] = $visualPart; + array_push($triples, $t); + + foreach ($m as $l => $v) { + if (strpos($l, "query") > -1) { + $t2['s'] = $queryPart; + $t2['p'] = RDF . 'type'; + $t2['o'] = LS . 'LodspeakrDataComponent'; + $t2['o_type'] = 'uri'; + } else { + $t2['s'] = $visualPart; + $t2['p'] = RDF . 'type'; + $t2['o'] = LS . 'LodspeakrVisualComponent'; + $t2['o_type'] = 'uri'; + } + array_push($triples, $t2); + $t2['p'] = NSVIZON . 'hasInput'; + $t2['o'] = $baseComponent . $conf['service']['prefix'] . "/" . $k . "/" . $l; + $t2['o_type'] = 'uri'; + + array_push($triples, $t2); + $t2['s'] = $t2['o']; + $t2['p'] = DC . "hasFormat"; + $t2['o'] = uniqid("_:b"); + $t2['o_type'] = 'bnode'; + array_push($triples, $t2); + $t2['s'] = $t2['o']; + $t2['s_type'] = $t2['o_type']; + $t2['p'] = RDF . 'type'; + $t2['o'] = NSVIZON . 'Component'; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + $t2['s_type'] = $t2['o_type']; + $t2['p'] = DC . 'format'; + $t2['o'] = 'text/plain;charset=utf-8'; + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + $t2['p'] = CNT . 'ContentAsText'; + $t2['o'] = $v; + array_push($triples, $t2); + } + //Return object for later triple + //$t['o'] = $baseComponent; + /* + // Type of query + $t2 = array(); + $t2['s'] = $t['o']; + $t2['s_type'] = 'bnode'; + $t2['p'] = RDF.'type'; + $t2['o'] = LS.'LodspeakrVisualComponent'; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + + $t3 = array(); + $t3['s'] = $t2['o']; + $t3['s_type'] = 'uri'; + $t3['p'] = RDFS.'subClassOf'; + $t3['o'] = LDA."VisualComponent"; + $t3['o_type'] = 'uri'; + array_push($triples, $t3); + + $t2['p'] = RDFS.'label'; + $t2['o'] = 'Haanga-based visualization component for LODSPeaKr'; + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + + $t['p'] = LS.'usedInput'; + $t['o'] = $conf['basedir'].$conf['view']['directory'].$k; + $t['o_type'] = 'uri'; + array_push($triples, $t); + + + $t2 = array(); + $t2['s'] = $t['o']; + $t2['s_type'] = 'uri'; + $t2['p'] = RDF.'type'; + $t2['o'] = LS."Input"; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + $t2['p'] = RDFS.'label'; + $t2['o'] = $conf['view']['directory'].$k; + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + $t2['p'] = DC.'hasFormat'; + $t2['o'] = uniqid("_:b"); + $t2['o_type'] = 'bnode'; + array_push($triples, $t2); + + $t2['s'] = $t2['o']; + $t2['s_type'] = 'bnode'; + $t2['p'] = RDF.'type'; + $t2['o'] = CNT."ContentAsText"; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + $t2['p'] = CNT.'chars'; + $t2['o'] = ($m); + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + $t2['p'] = DC.'format'; + $t2['o'] = 'text/plain;charset=utf-8'; + $t2['o_type'] = 'literal'; */ + // array_push($triples, $t2); + //break; + } + + //Static files + + $staticComponent = $conf['basedir'] . 'staticComponent';//uniqid("_:b"); + //$statics = $this->getComponents($conf['home'].$conf['static']['directory'], ''); + + //Define Process + $t = array(); + $t['s'] = uniqid("_:b"); + $t['s_type'] = 'bnode'; + $t['p'] = RDF . 'type'; + $t['o'] = OPMV . 'Process'; + $t['o_type'] = 'uri'; + array_push($triples, $t); + foreach ($statics as $k => $m) { + //Controlled by + $t['p'] = OPMV . 'wasControlledBy'; + $t['o'] = $staticComponent; + $t['o_type'] = 'bnode'; + array_push($triples, $t); + + //Associated Agent to this installation + $aux = $t['o']; + $t['s'] = $t['o']; + $t['p'] = SKOS . 'broader'; + $t['o'] = $conf['basedir']; + $t['o_type'] = 'uri'; + array_push($triples, $t); + + //Return object for later triple + $t['o'] = $staticComponent; + + // Type of query + $t2 = array(); + $t2['s'] = $t['o']; + $t2['s_type'] = 'bnode'; + $t2['p'] = RDF . 'type'; + $t2['o'] = LS . 'LodspeakrStaticElementsComponent'; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + + $t3 = array(); + $t3['s'] = $t2['o']; + $t3['s_type'] = 'uri'; + $t3['p'] = RDFS . 'subClassOf'; + $t3['o'] = LDA . "ProcessComponent"; + $t3['o_type'] = 'uri'; + array_push($triples, $t3); + + array_push($triples, $t2); + $t2['p'] = RDFS . 'label'; + $t2['o'] = 'Component of LODSPeaKr in charge of static content'; + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + + $t['p'] = LS . 'usedInput'; + $t['o'] = $conf['basedir'] . $conf['static']['directory'] . $k; + $t['o_type'] = 'uri'; + array_push($triples, $t); + + $t2 = array(); + $t2['s'] = $t['o']; + $t2['s_type'] = 'uri'; + $t2['p'] = RDF . 'type'; + $t2['o'] = LS . "Input"; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + $t2['p'] = RDFS . 'label'; + $t2['o'] = $conf['static']['directory'] . $k; + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + + $t2['p'] = DC . 'hasFormat'; + $t2['o'] = uniqid("_:b"); + $t2['o_type'] = 'bnode'; + array_push($triples, $t2); + + $t2['s'] = $t2['o']; + $t2['s_type'] = 'bnode'; + $t2['p'] = RDF . 'type'; + $t2['o'] = CNT . "ContentAsText"; + $t2['o_type'] = 'uri'; + array_push($triples, $t2); + $t2['p'] = CNT . 'chars'; + $t2['o'] = ($m); + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + $t2['p'] = DC . 'format'; + $t2['o'] = 'text/plain;charset=utf-8'; + $t2['o_type'] = 'literal'; + array_push($triples, $t2); + //break; + } + + + echo "#You can copy and paste the following data into a new\n"; + echo "#LODSPeaKr instance at http://exampleofinstance.org/import\n"; + echo "#As a side note: this is a turtle document but is served as text/plain to make it easier to copy&paste\n\n\n"; + echo $ser->getSerializedTriples($triples); + } + + private static function getTriple($s, $p, $o) + { + } + + private function createParameter($name, $value) + { + $s = uniqid("_:b"); + $s_type = 'bnode'; + $p = RDF . "type"; + $o = NSVIZON . "Parameter"; + $o_type = 'uri'; + } + + private function getViews($dir) + { + global $conf; + $files = ""; + chdir($dir); + $handle = opendir('.'); + while (false !== ($viewFile = readdir($handle))) { + if ($viewFile != "." && $viewFile != "..") { + $files .= $viewFile . ": " . htmlspecialchars(file_get_contents($viewFile)) . "\n"; + $t = array(); + } + } + chdir(".."); + return $files; + } + + private function getComponents($dir) + { + global $conf; + $list = array(); + $components = array(); + chdir($dir); + $handle = opendir('.'); + while (false !== ($componentDir = readdir($handle))) { + if ($componentDir != "." && $componentDir != "..") { + if (is_dir($componentDir)) { + $list[] = $componentDir; + } + } + } + closedir($handle); + foreach ($list as $v) { + $components[$v] = $this::getComponentsFiles($v); + } + return $components; + } + + private function getComponentsFiles($dir, $prefix) + { + global $conf; + $files = array(); + $subDirs = array(); + $currentDir = getcwd(); + chdir($dir); + $handle = opendir('.'); + while (false !== ($modelFile = readdir($handle))) { + if ($modelFile != "." && $modelFile != "..") { + if (is_dir($modelFile)) { + //Save it for later, after all the queries in the current directory has been resolved + $subDirs[] = $modelFile; + } else { + $files[$prefix . $modelFile] = (file_get_contents($modelFile)) . "\n"; + } + } + } + + foreach ($subDirs as $dir) { + //$files[$dir] = array(); + $files = array_merge($files, $this->getComponentsFiles($dir, $prefix . $dir . "/")); + } + chdir($currentDir); + return $files; + } + } diff --git a/classes/modules/redirectModule.php b/classes/modules/redirectModule.php index 7135a5d35ea6f9dc102ddfe41553eada6abaf63f..614367ff0b90d991008469fc3f9ac835170e2de3 100644 --- a/classes/modules/redirectModule.php +++ b/classes/modules/redirectModule.php @@ -4,34 +4,35 @@ use uib\ub\loadspeakr\MetaDb; require_once('abstractModule.php'); -class RedirectModule extends abstractModule { - //Class module - - public function match($uri){ - global $conf; - global $localUri; - global $uri; - global $acceptContentType; - global $endpoints; - global $lodspk; - - require_once($conf['home'].'classes/MetaDb.php'); - $metaDb = new MetaDb($conf['metadata']['db']['location']); - - return true; - } - - public function execute($pair){ - global $conf; - global $localUri; - global $uri; - global $acceptContentType; - global $endpoints; - global $lodspk; - global $results; - global $firstResults; - - echo $uri." is The uri"; - } - +class RedirectModule extends abstractModule +{ + public function match($uri) + { + global $conf; + global $localUri; + global $uri; + global $acceptContentType; + global $endpoints; + global $lodspk; + + require_once($conf['home'] . 'classes/MetaDb.php'); + $metaDb = new MetaDb($conf['metadata']['db']['location']); + + return true; + } + + public function execute($pair) + { + global $conf; + global $localUri; + global $uri; + global $acceptContentType; + global $endpoints; + global $lodspk; + global $results; + global $firstResults; + + echo $uri . " is The uri"; + } + } diff --git a/classes/modules/serviceModule.php b/classes/modules/serviceModule.php index 069c9a022ad076d0716e3e485899a997ad9b2328..0d5001b4c4df6bd56d3041701e89ae86907c4524 100644 --- a/classes/modules/serviceModule.php +++ b/classes/modules/serviceModule.php @@ -7,241 +7,264 @@ use uib\ub\loadspeakr\Utils; require_once('abstractModule.php'); -class ServiceModule extends abstractModule { - //Service module - - public function match($uri){ - global $conf; - global $acceptContentType; - global $localUri; - global $lodspk; - - $lodspk['model'] = null; - $lodspk['view'] = null; - $q = preg_replace('|^'.$conf['basedir'].'|', '', $localUri); - $qArr = explode('/', $q); - if(sizeof($qArr)==0){ - return FALSE; - } - - - $extension = Utils::getExtension($acceptContentType); - $viewFile = null; - $tokens = $qArr; - $arguments = array(); - while(sizeof($tokens) > 0){ - $serviceName = join("%2F", $tokens); - //Use .extension at the end of the service to force a particular content type - $lastSegment = end($tokens); - if(strpos($lastSegment, '.')>0){ - $aux = explode(".", $lastSegment); - if(sizeof($aux)>1){ - $requestExtension = array_pop($aux); - $contentTypes = $conf['http_accept'][$requestExtension]; - if($contentTypes != null){ - $acceptContentType = $contentTypes[0]; - $extension = $requestExtension; - } - } - $serviceName = join(".",$aux); - } - - //checking default components - if(file_exists($conf['model']['directory'].'/'.$conf['service']['prefix'].'/'.$serviceName.'/scaffold.ttl')){ - $subDir = $this->readScaffold($conf['model']['directory'].'/'.$conf['service']['prefix'].'/'.$serviceName.'/scaffold.ttl', join("/", $arguments)); - $subDir.= '/'; - $lodspk['model'] = $conf['home'].$conf['model']['directory'].'/'.$conf['service']['prefix'].'/'.$serviceName.'/'.$subDir; - $lodspk['view'] = $conf['view']['directory'].'/'.$conf['service']['prefix'].'/'.$serviceName.'/'.$subDir.$extension.'.template'; - }elseif(file_exists($conf['home'].$conf['model']['directory'].'/'.$conf['service']['prefix'].'/'.$serviceName)){ - $lodspk['model'] = $conf['home'].$conf['model']['directory'].'/'.$conf['service']['prefix'].'/'.$serviceName.'/'; - $lodspk['view'] = $conf['home'].$conf['view']['directory'].'/'.$conf['service']['prefix'].'/'.$serviceName.'/'.$extension.'.template'; - }else{ - if(is_null($lodspk['model']) && is_null($lodspk['view'])){ - //checking other components - if(!empty($conf['components']['services']) && count($conf['components']['services'])>0){ - foreach($conf['components']['services'] as $service){ - $serviceArray = explode("/", $service); - if($serviceName == end($serviceArray)){ - array_pop($serviceArray); - $conf['service']['prefix'] = array_pop($serviceArray); - $conf['model']['directory'] = join("/", $serviceArray); - $conf['view']['directory'] = $conf['model']['directory']; - if(file_exists($conf['model']['directory'].'/'.$conf['service']['prefix'].'/'.$serviceName.'/scaffold.ttl')){ - $subDir = $this->readScaffold($conf['model']['directory'].'/'.$conf['service']['prefix'].'/'.$serviceName.'/scaffold.ttl', join("/", $arguments)); - $subDir.= '/'; - $lodspk['model'] = $conf['model']['directory'].'/'.$conf['service']['prefix'].'/'.$serviceName.'/'.$subDir; - $lodspk['view'] = $conf['view']['directory'].'/'.$conf['service']['prefix'].'/'.$serviceName.'/'.$subDir.$extension.'.template'; - }elseif(file_exists($conf['model']['directory'].'/'.$conf['service']['prefix'].'/'.$serviceName)){ - $lodspk['model'] = $conf['model']['directory'].'/'.$conf['service']['prefix'].'/'.$serviceName.'/'; - $lodspk['view'] = $conf['view']['directory'].'/'.$conf['service']['prefix'].'/'.$serviceName.'/'.$extension.'.template'; - } - } - } - } - } - } - - $lodspk['serviceName'] = join("/", $tokens); - $lodspk['componentName'] = $lodspk['serviceName']; - $modelFile = $lodspk['model'].$extension.'.queries'; - if(file_exists($lodspk['model'].$extension.'.queries')){ - if(!file_exists($lodspk['view'])){ - $viewFile = null; - }else{ - $viewFile = $lodspk['view']; - } - return array($modelFile, $viewFile); - }elseif(file_exists($lodspk['model'].'queries')){ - $modelFile = $lodspk['model'].'queries'; - if(!file_exists($lodspk['view'])){ - $lodspk['resultRdf'] = true; - $viewFile = null; - }else{ - $viewFile = $lodspk['view']; - } - return array($modelFile, $viewFile); - }elseif(file_exists($lodspk['model'])){ - HTTPStatus::send406($uri); - return null; - } - array_unshift($arguments, array_pop($tokens)); - } - return FALSE; - } - - public function execute($service){ - global $conf; - global $localUri; - global $uri; - global $acceptContentType; - global $endpoints; - global $lodspk; - global $firstResults; - global $results; - $context = array(); - $context['contentType'] = $acceptContentType; - $context['endpoints'] = $endpoints; - //$f = $this->getFunction($localUri); - $params = $this->getParams($localUri); - //$params[] = $context; - //$acceptContentType = Utils::getBestContentType($_SERVER['HTTP_ACCEPT']); - $extension = Utils::getExtension($acceptContentType); - $args = array(); - list($modelFile, $viewFile) = $service; - try{ - $prefixHeader = array(); - - for($i=0;$i<sizeof($params);$i++){ - if($conf['mirror_external_uris'] != false){ - $altUri = Utils::curie2uri($params[$i]); - $altUri = preg_replace("|^".$conf['basedir']."|", $conf['ns']['local'], $altUri); - $params[$i] = Utils::uri2curie($altUri); - } - } - - $segmentConnector = ""; - for($i=0;$i<sizeof($params);$i++){ - Utils::curie2uri($params[$i]); - //echo $params[$i]." ".Utils::curie2uri($params[$i]);exit(0); - $auxPrefix = Utils::getPrefix($params[$i]); - if($auxPrefix['ns'] != NULL){ - $prefixHeader[] = $auxPrefix; - } - $args["arg".$i]=$params[$i]; - $args["all"] .= $segmentConnector.$params[$i]; - if($segmentConnector == ""){ - $segmentConnector = "/"; - } - } - $results['params'] = $params; - - - $lodspk['home'] = $conf['basedir']; - $lodspk['baseUrl'] = $conf['basedir']; - $lodspk['module'] = 'service'; - $lodspk['root'] = $conf['root']; - $lodspk['contentType'] = $acceptContentType; - $lodspk['ns'] = $conf['ns']; - $lodspk['this']['value'] = $uri; - $lodspk['this']['curie'] = Utils::uri2curie($uri); - $lodspk['local']['value'] = $localUri; - $lodspk['local']['curie'] = Utils::uri2curie($localUri); - $lodspk['contentType'] = $acceptContentType; - $lodspk['endpoint'] = $conf['endpoint']; - - $lodspk['type'] = $modelFile; - $lodspk['header'] = $prefixHeader; - $lodspk['args'] = $args; - $lodspk['add_mirrored_uris'] = false; - $lodspk['baseUrl'] = $conf['basedir']; - $lodspk['this']['value'] = $uri; - if($viewFile == null){ - $lodspk['transform_select_query'] = true; - } - // chdir($lodspk['model']); - Utils::queryFile($modelFile, $endpoints['local'], $results, $firstResults); - if(!$lodspk['resultRdf']){ - $results = Utils::internalize($results); - $firstAux = Utils::getfirstResults($results); - - // chdir($conf['home']); - if(is_array($results)){ - $resultsObj = Convert::array_to_object($results); - $results = $resultsObj; - }else{ - $resultsObj = $results; - } - $lodspk['firstResults'] = Convert::array_to_object($firstAux); - }else{ - $resultsObj = $results; - } - //Need to redefine viewFile as 'local' i.e., inside service.foo/ so I can load files with the relative path correctly - //$viewFile = $extension.".template"; - //chdir($conf['home']); - Utils::processDocument($viewFile, $lodspk, $results); - }catch (Exception $ex){ - echo $ex->getMessage(); - if($conf['debug']){ - Logging::log($ex->getMessage(), E_ERROR); - } - HTTPStatus::send500($uri); - } - } - - - protected function getParams($uri){ - global $conf; - global $lodspk; - $count = 1; - $prefixUri = $conf['basedir']; - $functionAndParams = explode('/', str_replace($prefixUri.$lodspk['serviceName'], '', $uri, $count)); - if(sizeof($functionAndParams) > 1){ - array_shift($functionAndParams); - return $functionAndParams; - }else{ - return array(null); - } - } - - protected function readScaffold($scaffold, $serviceArgs){ - global $conf; - require_once __DIR__ . '/../../vendor/semsol/arc2/ARC2.php'; - $parser = ARC2::getTurtleParser(); - $parser->parse($scaffold); - $triples = $parser->getTriples(); - $aux=Utils::filterTriples($triples, array(null, "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "http://lodspeakr.org/vocab/ScaffoldedService")); - $scaffoldUri = $aux[0][0]; - $aux=Utils::filterTriples($triples, array($scaffoldUri, "http://lodspeakr.org/vocab/scaffold", null)); - foreach($aux as $r){ - $patterns = Utils::filterTriples($triples, array($r[2], "http://lodspeakr.org/vocab/uriPattern", null)); - $pattern = stripcslashes($patterns[0][2]); - if(preg_match("|$pattern|", $serviceArgs) > 0){ -// echo "match ! \n ".$pattern."\n"; - $patternDir = Utils::filterTriples($triples, array($r[2], "http://lodspeakr.org/vocab/subComponent", null)); - return $patternDir[0][2]; - } +class ServiceModule extends abstractModule +{ + public function match($uri) + { + global $conf; + global $acceptContentType; + global $localUri; + global $lodspk; + + $lodspk['model'] = null; + $lodspk['view'] = null; + $q = preg_replace('|^' . $conf['basedir'] . '|', '', $localUri); + $qArr = explode('/', $q); + if (sizeof($qArr) == 0) { + return false; + } + + + $extension = Utils::getExtension($acceptContentType); + $viewFile = null; + $tokens = $qArr; + $arguments = array(); + while (sizeof($tokens) > 0) { + $serviceName = join("%2F", $tokens); + //Use .extension at the end of the service to force a particular content type + $lastSegment = end($tokens); + if (strpos($lastSegment, '.') > 0) { + $aux = explode(".", $lastSegment); + if (sizeof($aux) > 1) { + $requestExtension = array_pop($aux); + $contentTypes = $conf['http_accept'][$requestExtension]; + if ($contentTypes != null) { + $acceptContentType = $contentTypes[0]; + $extension = $requestExtension; + } + } + $serviceName = join(".", $aux); + } + + //checking default components + if (file_exists( + $conf['model']['directory'] . '/' . $conf['service']['prefix'] . '/' . $serviceName . '/scaffold.ttl' + )) { + $subDir = $this->readScaffold( + $conf['model']['directory'] . '/' . $conf['service']['prefix'] . '/' . $serviceName . '/scaffold.ttl', + join("/", $arguments) + ); + $subDir .= '/'; + $lodspk['model'] = $conf['home'] . $conf['model']['directory'] . '/' . $conf['service']['prefix'] . '/' . $serviceName . '/' . $subDir; + $lodspk['view'] = $conf['view']['directory'] . '/' . $conf['service']['prefix'] . '/' . $serviceName . '/' . $subDir . $extension . '.template'; + } elseif (file_exists( + $conf['home'] . $conf['model']['directory'] . '/' . $conf['service']['prefix'] . '/' . $serviceName + )) { + $lodspk['model'] = $conf['home'] . $conf['model']['directory'] . '/' . $conf['service']['prefix'] . '/' . $serviceName . '/'; + $lodspk['view'] = $conf['home'] . $conf['view']['directory'] . '/' . $conf['service']['prefix'] . '/' . $serviceName . '/' . $extension . '.template'; + } else { + if (is_null($lodspk['model']) && is_null($lodspk['view'])) { + //checking other components + if (!empty($conf['components']['services']) && count($conf['components']['services']) > 0) { + foreach ($conf['components']['services'] as $service) { + $serviceArray = explode("/", $service); + if ($serviceName == end($serviceArray)) { + array_pop($serviceArray); + $conf['service']['prefix'] = array_pop($serviceArray); + $conf['model']['directory'] = join("/", $serviceArray); + $conf['view']['directory'] = $conf['model']['directory']; + if (file_exists( + $conf['model']['directory'] . '/' . $conf['service']['prefix'] . '/' . $serviceName . '/scaffold.ttl' + )) { + $subDir = $this->readScaffold( + $conf['model']['directory'] . '/' . $conf['service']['prefix'] . '/' . $serviceName . '/scaffold.ttl', + join("/", $arguments) + ); + $subDir .= '/'; + $lodspk['model'] = $conf['model']['directory'] . '/' . $conf['service']['prefix'] . '/' . $serviceName . '/' . $subDir; + $lodspk['view'] = $conf['view']['directory'] . '/' . $conf['service']['prefix'] . '/' . $serviceName . '/' . $subDir . $extension . '.template'; + } elseif (file_exists( + $conf['model']['directory'] . '/' . $conf['service']['prefix'] . '/' . $serviceName + )) { + $lodspk['model'] = $conf['model']['directory'] . '/' . $conf['service']['prefix'] . '/' . $serviceName . '/'; + $lodspk['view'] = $conf['view']['directory'] . '/' . $conf['service']['prefix'] . '/' . $serviceName . '/' . $extension . '.template'; + } + } + } + } + } + } + + $lodspk['serviceName'] = join("/", $tokens); + $lodspk['componentName'] = $lodspk['serviceName']; + $modelFile = $lodspk['model'] . $extension . '.queries'; + if (file_exists($lodspk['model'] . $extension . '.queries')) { + if (!file_exists($lodspk['view'])) { + $viewFile = null; + } else { + $viewFile = $lodspk['view']; + } + return array($modelFile, $viewFile); + } elseif (file_exists($lodspk['model'] . 'queries')) { + $modelFile = $lodspk['model'] . 'queries'; + if (!file_exists($lodspk['view'])) { + $lodspk['resultRdf'] = true; + $viewFile = null; + } else { + $viewFile = $lodspk['view']; + } + return array($modelFile, $viewFile); + } elseif (file_exists($lodspk['model'])) { + HTTPStatus::send406($uri); + return null; + } + array_unshift($arguments, array_pop($tokens)); + } + return false; + } + + public function execute($service) + { + global $conf; + global $localUri; + global $uri; + global $acceptContentType; + global $endpoints; + global $lodspk; + global $firstResults; + global $results; + $context = array(); + $context['contentType'] = $acceptContentType; + $context['endpoints'] = $endpoints; + //$f = $this->getFunction($localUri); + $params = $this->getParams($localUri); + //$params[] = $context; + //$acceptContentType = Utils::getBestContentType($_SERVER['HTTP_ACCEPT']); + $extension = Utils::getExtension($acceptContentType); + $args = array(); + list($modelFile, $viewFile) = $service; + try { + $prefixHeader = array(); + + for ($i = 0; $i < sizeof($params); $i++) { + if ($conf['mirror_external_uris'] != false) { + $altUri = Utils::curie2uri($params[$i]); + $altUri = preg_replace("|^" . $conf['basedir'] . "|", $conf['ns']['local'], $altUri); + $params[$i] = Utils::uri2curie($altUri); + } + } + + $segmentConnector = ""; + for ($i = 0; $i < sizeof($params); $i++) { + Utils::curie2uri($params[$i]); + //echo $params[$i]." ".Utils::curie2uri($params[$i]);exit(0); + $auxPrefix = Utils::getPrefix($params[$i]); + if ($auxPrefix['ns'] != null) { + $prefixHeader[] = $auxPrefix; + } + $args["arg" . $i] = $params[$i]; + $args["all"] .= $segmentConnector . $params[$i]; + if ($segmentConnector == "") { + $segmentConnector = "/"; + } + } + $results['params'] = $params; + + + $lodspk['home'] = $conf['basedir']; + $lodspk['baseUrl'] = $conf['basedir']; + $lodspk['module'] = 'service'; + $lodspk['root'] = $conf['root']; + $lodspk['contentType'] = $acceptContentType; + $lodspk['ns'] = $conf['ns']; + $lodspk['this']['value'] = $uri; + $lodspk['this']['curie'] = Utils::uri2curie($uri); + $lodspk['local']['value'] = $localUri; + $lodspk['local']['curie'] = Utils::uri2curie($localUri); + $lodspk['contentType'] = $acceptContentType; + $lodspk['endpoint'] = $conf['endpoint']; + + $lodspk['type'] = $modelFile; + $lodspk['header'] = $prefixHeader; + $lodspk['args'] = $args; + $lodspk['add_mirrored_uris'] = false; + $lodspk['baseUrl'] = $conf['basedir']; + $lodspk['this']['value'] = $uri; + if ($viewFile == null) { + $lodspk['transform_select_query'] = true; + } + // chdir($lodspk['model']); + Utils::queryFile($modelFile, $endpoints['local'], $results, $firstResults); + if (!$lodspk['resultRdf']) { + $results = Utils::internalize($results); + $firstAux = Utils::getfirstResults($results); + + // chdir($conf['home']); + if (is_array($results)) { + $resultsObj = Convert::array_to_object($results); + $results = $resultsObj; + } else { + $resultsObj = $results; + } + $lodspk['firstResults'] = Convert::array_to_object($firstAux); + } else { + $resultsObj = $results; + } + //Need to redefine viewFile as 'local' i.e., inside service.foo/ so I can load files with the relative path correctly + //$viewFile = $extension.".template"; + //chdir($conf['home']); + Utils::processDocument($viewFile, $lodspk, $results); + } catch (Exception $ex) { + echo $ex->getMessage(); + if ($conf['debug']) { + Logging::log($ex->getMessage(), E_ERROR); + } + HTTPStatus::send500($uri); + } + } + + protected function getParams($uri) + { + global $conf; + global $lodspk; + $count = 1; + $prefixUri = $conf['basedir']; + $functionAndParams = explode('/', str_replace($prefixUri . $lodspk['serviceName'], '', $uri, $count)); + if (sizeof($functionAndParams) > 1) { + array_shift($functionAndParams); + return $functionAndParams; + } else { + return array(null); + } } + + protected function readScaffold($scaffold, $serviceArgs) + { + global $conf; + require_once __DIR__ . '/../../vendor/semsol/arc2/ARC2.php'; + $parser = ARC2::getTurtleParser(); + $parser->parse($scaffold); + $triples = $parser->getTriples(); + $aux = Utils::filterTriples( + $triples, + array(null, "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "http://lodspeakr.org/vocab/ScaffoldedService") + ); + $scaffoldUri = $aux[0][0]; + $aux = Utils::filterTriples($triples, array($scaffoldUri, "http://lodspeakr.org/vocab/scaffold", null)); + foreach ($aux as $r) { + $patterns = Utils::filterTriples($triples, array($r[2], "http://lodspeakr.org/vocab/uriPattern", null)); + $pattern = stripcslashes($patterns[0][2]); + if (preg_match("|$pattern|", $serviceArgs) > 0) { +// echo "match ! \n ".$pattern."\n"; + $patternDir = Utils::filterTriples( + $triples, + array($r[2], "http://lodspeakr.org/vocab/subComponent", null) + ); + return $patternDir[0][2]; + } + } // exit(0); - return ""; - } + return ""; + } + } diff --git a/classes/modules/sessionModule.php b/classes/modules/sessionModule.php index a5d55f5275c3e9fdd5a2924cf3ab68090f0414a2..9dbe2bfa8e89000231adfae17fe6f1ca409bb6ee 100644 --- a/classes/modules/sessionModule.php +++ b/classes/modules/sessionModule.php @@ -3,84 +3,89 @@ use uib\ub\loadspeakr\HTTPStatus; require_once('abstractModule.php'); -class SessionModule extends abstractModule{ - //Session module - private $sessionUri = "session"; - - public function match($uri){ - global $conf; - global $localUri; - global $lodspk; - $method = ucwords($_SERVER['REQUEST_METHOD']); - $uriSegment = str_replace($conf['basedir'], '', $localUri); - //Check if looking for session validation - if($uriSegment === $this->sessionUri){ - //GET will return the form - if($method == "GET"){ - $this->showSessionForm(); - return true; - } - //POST will take the data and validate it - if($method == "POST"){ - if($this->validateAuthentication($_POST)){ - session_start(); - $_SESSION['lodspk'] = 1; - HTTPStatus::send303($conf['basedir'], ''); - return false; - }else{ - HTTPStatus::send401("Authentication not valid."); - return true; + +class SessionModule extends abstractModule +{ + //Session module + private $sessionUri = "session"; + + public function match($uri) + { + global $conf; + global $localUri; + global $lodspk; + $method = ucwords($_SERVER['REQUEST_METHOD']); + $uriSegment = str_replace($conf['basedir'], '', $localUri); + //Check if looking for session validation + if ($uriSegment === $this->sessionUri) { + //GET will return the form + if ($method == "GET") { + $this->showSessionForm(); + return true; + } + //POST will take the data and validate it + if ($method == "POST") { + if ($this->validateAuthentication($_POST)) { + session_start(); + $_SESSION['lodspk'] = 1; + HTTPStatus::send303($conf['basedir'], ''); + return false; + } else { + HTTPStatus::send401("Authentication not valid."); + return true; + } + } + } else { + session_start(); + if (isset($_SESSION['lodspk'])) { + return false; + } else { + HTTPStatus::send303($conf['basedir'] . $this->sessionUri, ''); + return true; + } } - } - }else{ - session_start(); - if(isset($_SESSION['lodspk'])){ - return false; - }else{ - HTTPStatus::send303($conf['basedir'].$this->sessionUri, ''); + } + + public function execute($uri) + { + global $conf; + global $localUri; + global $uri; + global $acceptContentType; + global $endpoints; + global $lodspk; + global $firstResults; return true; - } } - - } - - public function execute($uri){ - global $conf; - global $localUri; - global $uri; - global $acceptContentType; - global $endpoints; - global $lodspk; - global $firstResults; - return true; - } - - - private function showSessionForm(){ - echo "<html> + + private function showSessionForm() + { + echo "<html> <head> <title>Login</title> </head> <body> - <form action='".$this->sessionUri."' method='POST'> + <form action='" . $this->sessionUri . "' method='POST'> <input name='user' type='text' /> <input name='password' type='password' /><br/> <input name='submit' type='submit' /> </form> </body> </html>"; - exit(0); - } - - private function validateAuthentication($data){ - global $conf; - if(isset($conf['session']['user']) && isset($conf['session']['password'])){ - if($data['user'] == $conf['session']['user'] && $data['password'] == $conf['session']['password']){ - return true; - } - - return false; + exit(0); } - return false; - } + + private function validateAuthentication($data) + { + global $conf; + if (isset($conf['session']['user']) && isset($conf['session']['password'])) { + if ($data['user'] == $conf['session']['user'] && $data['password'] == $conf['session']['password']) { + return true; + } + + return false; + } + return false; + } + } diff --git a/classes/modules/sparqlFilterModule.php b/classes/modules/sparqlFilterModule.php index 041960cf2bc40930c53bc5a5fa250882db342698..1a51b91740f9322344d711c74676fa42492a3ad4 100644 --- a/classes/modules/sparqlFilterModule.php +++ b/classes/modules/sparqlFilterModule.php @@ -9,197 +9,202 @@ use uib\ub\loadspeakr\Utils; require_once('abstractModule.php'); -class sparqlFilterModule extends abstractModule{ - //Class module - - public function match($uri){ - global $conf; - global $localUri; - global $uri; - global $acceptContentType; - global $endpoints; - global $lodspk; - global $results; - global $firstResults; - - require_once($conf['home'].'classes/MetaDb.php'); - $metaDb = new MetaDb($conf['metadata']['db']['location']); - - $pair = Queries::getMetadata($localUri, $acceptContentType, $metaDb); - - if($pair == NULL){ // Original URI is not in metadata - if(Queries::uriExist($uri, $endpoints['local'])){ - $page = Queries::createPage($uri, $localUri, $acceptContentType, $metaDb); - if($page == NULL){ - HTTPStatus::send500("Can't write sqlite database."); - } - HTTPStatus::send303($page, $acceptContentType); - exit(0); - }else{ - return false; - } - } - - list($res, $page, $format) = $pair; - $uri = $res; - $queries = $this->getQueries(); - $e = $endpoints['local']; - require_once($conf['home'].'lib/Haanga/lib/Haanga.php'); - Haanga::configure(array( - 'cache_dir' => $conf['home'].'cache/', - 'autoescape' => FALSE, - )); - $vars = compact('uri', 'lodspk', 'models', 'first'); - - foreach($queries as $l => $v){ - $q = Utils::addPrefixes(file_get_contents($v)); - $fnc = Haanga::compile($q); - $query = $fnc($vars, TRUE); - $aux = $e->query($query, Utils::getResultsType($query)); - if($aux["boolean"] === true){ - $pair[] = $l; - return $pair; - } - } - return false; - } - -public function execute($pair){ - global $conf; - global $localUri; - global $uri; - global $acceptContentType; - global $endpoints; - global $lodspk; - global $results; - global $firstResults; - $results = array(); - list($res, $page, $format, $filter) = $pair; - //If resource is not the page, send a 303 to the document - if($res == $localUri){ - HTTPStatus::send303($page, $acceptContentType); - } - - $uri = $res; - if($conf['mirror_external_uris'] != false){ - $localUri = preg_replace("|^".$conf['ns']['local']."|", $conf['basedir'], $res); - } - - $extension = Utils::getExtension($format); - - /*Redefine Content type based on the - * dcterms:format for this page - */ - $acceptContentType = $format; - //Check if files for model and view exist - $t = array($pair[3]); - $obj = $this->getModelandView($t, $extension); - $modelFile = $obj['modelFile']; - $lodspk['model'] = $conf['model']['directory']; - $viewFile = $obj['viewFile']; - $lodspk['view'] = $obj['view']['directory']; - if($viewFile == null){ - $lodspk['transform_select_query'] = true; - } - - $lodspk['sparqlFilter'] = $modelFile; - $lodspk['home'] = $conf['basedir']; - $lodspk['baseUrl'] = $conf['basedir']; - $lodspk['module'] = 'sparqlFilter'; - $lodspk['root'] = $conf['root']; - $lodspk['contentType'] = $acceptContentType; - $lodspk['ns'] = $conf['ns']; - $lodspk['endpoint'] = $conf['endpoint']; - $lodspk['view'] = $conf['view']['directory']; - $lodspk['type'] = $modelFile; - - $lodspk['add_mirrored_uris'] = true; - $lodspk['this']['value'] = $uri; - $lodspk['this']['curie'] = Utils::uri2curie($uri); - $lodspk['local']['value'] = $localUri; - $lodspk['local']['curie'] = Utils::uri2curie($localUri); - $lodspk['this']['extension'] = $extension; - //chdir($conf['home'].$conf['model']['directory']); - - Utils::queryFile($modelFile, $endpoints['local'], $results, $firstResults); - if(!$lodspk['resultRdf']){ - $results = Utils::internalize($results); - $firstAux = Utils::getfirstResults($results); - - //chdir($conf['home']); - if(is_array($results)){ - $resultsObj = Convert::array_to_object($results); - $results = $resultsObj; - }else{ - $resultsObj = $results; - } - $lodspk['firstResults'] = Convert::array_to_object($firstAux); - }else{ - $resultsObj = $results; - } - //chdir($conf['home'].$conf['model']['directory']); - Utils::processDocument($viewFile, $lodspk, $resultsObj); - - } - - private function getQueries(){ - global $conf; - $results = array(); - $dir = $conf['home'].$conf['model']['directory'].'/'.$conf['sparqlFilter']['prefix']; - if ($handle = opendir($dir)) { - - /* This is the correct way to loop over the directory. */ - while (false !== ($entry = readdir($handle))) { - if($entry != '.' && $entry != '..'){ - if(file_exists($dir.'/'.$entry.'/'.$conf['sparqlFilter']['filterFileName'])) - $results[$entry] = $dir.'/'.$entry.'/'.$conf['sparqlFilter']['filterFileName']; +class sparqlFilterModule extends abstractModule +{ + public function match($uri) + { + global $conf; + global $localUri; + global $uri; + global $acceptContentType; + global $endpoints; + global $lodspk; + global $results; + global $firstResults; + + require_once($conf['home'] . 'classes/MetaDb.php'); + $metaDb = new MetaDb($conf['metadata']['db']['location']); + + $pair = Queries::getMetadata($localUri, $acceptContentType, $metaDb); + + if ($pair == null) { // Original URI is not in metadata + if (Queries::uriExist($uri, $endpoints['local'])) { + $page = Queries::createPage($uri, $localUri, $acceptContentType, $metaDb); + if ($page == null) { + HTTPStatus::send500("Can't write sqlite database."); + } + HTTPStatus::send303($page, $acceptContentType); + exit(0); + } else { + return false; + } + } + + list($res, $page, $format) = $pair; + $uri = $res; + $queries = $this->getQueries(); + $e = $endpoints['local']; + require_once __DIR__ . '/../../vendor/ubbdst/haanga/lib/Haanga.php'; + Haanga::configure(array( + 'cache_dir' => $conf['home'] . 'cache/', + 'autoescape' => false, + )); + $vars = compact('uri', 'lodspk', 'models', 'first'); + + foreach ($queries as $l => $v) { + $q = Utils::addPrefixes(file_get_contents($v)); + $fnc = Haanga::compile($q); + $query = $fnc($vars, true); + $aux = $e->query($query, Utils::getResultsType($query)); + if ($aux["boolean"] === true) { + $pair[] = $l; + return $pair; + } + } + return false; + } + + public function execute($pair) + { + global $conf; + global $localUri; + global $uri; + global $acceptContentType; + global $endpoints; + global $lodspk; + global $results; + global $firstResults; + $results = array(); + list($res, $page, $format, $filter) = $pair; + //If resource is not the page, send a 303 to the document + if ($res == $localUri) { + HTTPStatus::send303($page, $acceptContentType); + } + + $uri = $res; + if ($conf['mirror_external_uris'] != false) { + $localUri = preg_replace("|^" . $conf['ns']['local'] . "|", $conf['basedir'], $res); + } + + $extension = Utils::getExtension($format); + + /*Redefine Content type based on the + * dcterms:format for this page + */ + $acceptContentType = $format; + //Check if files for model and view exist + $t = array($pair[3]); + $obj = $this->getModelandView($t, $extension); + $modelFile = $obj['modelFile']; + $lodspk['model'] = $conf['model']['directory']; + $viewFile = $obj['viewFile']; + $lodspk['view'] = $obj['view']['directory']; + if ($viewFile == null) { + $lodspk['transform_select_query'] = true; + } + + $lodspk['sparqlFilter'] = $modelFile; + $lodspk['home'] = $conf['basedir']; + $lodspk['baseUrl'] = $conf['basedir']; + $lodspk['module'] = 'sparqlFilter'; + $lodspk['root'] = $conf['root']; + $lodspk['contentType'] = $acceptContentType; + $lodspk['ns'] = $conf['ns']; + $lodspk['endpoint'] = $conf['endpoint']; + $lodspk['view'] = $conf['view']['directory']; + $lodspk['type'] = $modelFile; + + $lodspk['add_mirrored_uris'] = true; + $lodspk['this']['value'] = $uri; + $lodspk['this']['curie'] = Utils::uri2curie($uri); + $lodspk['local']['value'] = $localUri; + $lodspk['local']['curie'] = Utils::uri2curie($localUri); + $lodspk['this']['extension'] = $extension; + //chdir($conf['home'].$conf['model']['directory']); + + Utils::queryFile($modelFile, $endpoints['local'], $results, $firstResults); + if (!$lodspk['resultRdf']) { + $results = Utils::internalize($results); + $firstAux = Utils::getfirstResults($results); + + //chdir($conf['home']); + if (is_array($results)) { + $resultsObj = Convert::array_to_object($results); + $results = $resultsObj; + } else { + $resultsObj = $results; + } + $lodspk['firstResults'] = Convert::array_to_object($firstAux); + } else { + $resultsObj = $results; + } + //chdir($conf['home'].$conf['model']['directory']); + Utils::processDocument($viewFile, $lodspk, $resultsObj); + } + + private function getQueries() + { + global $conf; + $results = array(); + $dir = $conf['home'] . $conf['model']['directory'] . '/' . $conf['sparqlFilter']['prefix']; + if ($handle = opendir($dir)) { + /* This is the correct way to loop over the directory. */ + while (false !== ($entry = readdir($handle))) { + if ($entry != '.' && $entry != '..') { + if (file_exists($dir . '/' . $entry . '/' . $conf['sparqlFilter']['filterFileName'])) { + $results[$entry] = $dir . '/' . $entry . '/' . $conf['sparqlFilter']['filterFileName']; + } + } + } + + closedir($handle); + return $results; + } else { + return null; + } + } + + private static function getModelandView($t, $extension) + { + global $conf; + global $results; + global $rPointer; + global $lodspk; + $objResult = array('modelFile' => null, 'viewFile' => null); + //Defining default views and models + $curieType = ""; + //Get the firstResults type available + foreach ($t as $v) { + if ($v == null) { + continue; + } + $auxViewFile = $conf['view']['directory'] . '/' . $conf['sparqlFilter']['prefix'] . '/' . $v . '/' . $extension . '.template'; + $auxModelFile = $conf['model']['directory'] . '/' . $conf['sparqlFilter']['prefix'] . '/' . $v . '/' . $extension . 'queries'; + if (file_exists($auxModelFile)) { + $objResult['modelFile'] = $auxModelFile;//$conf['sparqlFilter']['prefix'].'/'.$v.'/'.$extensionModel.'queries'; + if (file_exists($auxViewFile)) { + $objResult['viewFile'] = $auxViewFile;//$conf['sparqlFilter']['prefix'].'/'.$v.'/'.$extensionView.'template'; + } elseif ($extension != 'html') { //View doesn't exists (and is not HTML) + $objResult['viewFile'] = null; + } + return $objResult; + } elseif (file_exists( + $conf['model']['directory'] . '/' . $conf['sparqlFilter']['prefix'] . '/' . $v . '/queries' + )) { + $objResult['modelFile'] = $conf['model']['directory'] . '/' . $conf['sparqlFilter']['prefix'] . '/' . $v . '/queries'; + if (file_exists($auxViewFile)) { + $objResult['viewFile'] = $auxViewFile; + } else { + $lodspk['transform_select_query'] = true; + $objResult['viewFile'] = null; + } + if ($conf['debug']) { + Logging::log("LODSPeaKr can't find the proper query. Using HTML query instead.", E_USER_NOTICE); + } + break; + } } - } - - closedir($handle); - return $results; - }else{ - return null; + return $objResult; } - } - - - private static function getModelandView($t, $extension){ - global $conf; - global $results; - global $rPointer; - global $lodspk; - $objResult = array('modelFile' => null, 'viewFile' => null); - //Defining default views and models - $curieType=""; - //Get the firstResults type available - foreach($t as $v){ - if($v == null){continue;} - $auxViewFile = $conf['view']['directory'].'/'.$conf['sparqlFilter']['prefix'].'/'.$v.'/'.$extension.'.template'; - $auxModelFile = $conf['model']['directory'].'/'.$conf['sparqlFilter']['prefix'].'/'.$v.'/'.$extension.'queries'; - if(file_exists($auxModelFile)){ - $objResult['modelFile'] = $auxModelFile;//$conf['sparqlFilter']['prefix'].'/'.$v.'/'.$extensionModel.'queries'; - if(file_exists($auxViewFile)){ - $objResult['viewFile'] = $auxViewFile;//$conf['sparqlFilter']['prefix'].'/'.$v.'/'.$extensionView.'template'; - }elseif($extension != 'html'){ //View doesn't exists (and is not HTML) - $objResult['viewFile'] = null; - } - return $objResult; - }elseif(file_exists($conf['model']['directory'].'/'.$conf['sparqlFilter']['prefix'].'/'.$v.'/queries')){ - $objResult['modelFile'] = $conf['model']['directory'].'/'.$conf['sparqlFilter']['prefix'].'/'.$v.'/queries'; - if(file_exists($auxViewFile) ){ - $objResult['viewFile'] = $auxViewFile; - }else{ - $lodspk['transform_select_query'] = true; - $objResult['viewFile'] = null; - } - if($conf['debug']){ - Logging::log("LODSPeaKr can't find the proper query. Using HTML query instead.", E_USER_NOTICE); - } - break; - } - } - return $objResult; - } } diff --git a/classes/modules/staticModule.php b/classes/modules/staticModule.php index 4c295c4d4b55de3e7bb849ae5a175fa8c7483fc2..d438b560078d9b87126b34c0910414d9930a0350 100644 --- a/classes/modules/staticModule.php +++ b/classes/modules/staticModule.php @@ -6,120 +6,124 @@ use uib\ub\loadspeakr\Utils; require_once('abstractModule.php'); -class StaticModule extends abstractModule { - - public function match($uri) - { - global $conf; - global $localUri; - global $uri; - global $acceptContentType; - global $endpoints; - global $lodspk; - $q = preg_replace('|^' . $conf['basedir'] . '|', '', $localUri); - - if (strlen($q) > 0 && file_exists($conf['home'] . $conf['static']['directory'] . $q)) { - return $q; +class StaticModule extends abstractModule +{ + public function match($uri) + { + global $conf; + global $localUri; + global $uri; + global $acceptContentType; + global $endpoints; + global $lodspk; + $q = preg_replace('|^' . $conf['basedir'] . '|', '', $localUri); + + if (strlen($q) > 0 && file_exists($conf['home'] . $conf['static']['directory'] . $q)) { + return $q; + } + + return false; } - return FALSE; - } - - public function execute($file) - { - global $conf; - global $localUri; - global $uri; - global $acceptContentType; - global $endpoints; - global $lodspk; - $this->validateDirectory($conf, $file); - $filenamearray = explode(".", $file); - $extension = end($filenamearray); - $ct = $this->getContentType($extension); - header("Content-type: " . $ct); - $uri = $localUri; - - if ($conf['debug']) { - Logging::log("In " . $conf['static']['directory'] . " static file $file"); + public function execute($file) + { + global $conf; + global $localUri; + global $uri; + global $acceptContentType; + global $endpoints; + global $lodspk; + $this->validateDirectory($conf, $file); + $filenamearray = explode(".", $file); + $extension = end($filenamearray); + $ct = $this->getContentType($extension); + header("Content-type: " . $ct); + $uri = $localUri; + + if ($conf['debug']) { + Logging::log("In " . $conf['static']['directory'] . " static file $file"); + } + + $htmlExtension = 'html'; + + if ($conf['static']['haanga'] && substr_compare( + $file, + $htmlExtension, + -strlen($htmlExtension), + strlen($htmlExtension) + ) === 0) { + $lodspk['home'] = $conf['basedir']; + $lodspk['baseUrl'] = $conf['basedir']; + $lodspk['module'] = 'static'; + $lodspk['root'] = $conf['root']; + $lodspk['contentType'] = $acceptContentType; + $lodspk['ns'] = $conf['ns']; + $lodspk['this']['value'] = $localUri; + $lodspk['this']['curie'] = Utils::uri2curie($localUri); + $lodspk['local']['value'] = $localUri; + $lodspk['local']['curie'] = Utils::uri2curie($localUri); + $lodspk['contentType'] = $acceptContentType; + $lodspk['endpoint'] = $conf['endpoint']; + $lodspk['baseUrl'] = $conf['basedir']; + + Utils::processDocument($conf['static']['directory'] . $file, $lodspk, null); + } else { + echo file_get_contents($conf['static']['directory'] . $file); + } } - $htmlExtension = 'html'; - - if ($conf['static']['haanga'] && substr_compare($file, $htmlExtension, -strlen($htmlExtension), strlen($htmlExtension)) === 0) { - $lodspk['home'] = $conf['basedir']; - $lodspk['baseUrl'] = $conf['basedir']; - $lodspk['module'] = 'static'; - $lodspk['root'] = $conf['root']; - $lodspk['contentType'] = $acceptContentType; - $lodspk['ns'] = $conf['ns']; - $lodspk['this']['value'] = $localUri; - $lodspk['this']['curie'] = Utils::uri2curie($localUri); - $lodspk['local']['value'] = $localUri; - $lodspk['local']['curie'] = Utils::uri2curie($localUri); - $lodspk['contentType'] = $acceptContentType; - $lodspk['endpoint'] = $conf['endpoint']; - $lodspk['baseUrl'] = $conf['basedir']; - - Utils::processDocument($conf['static']['directory'] . $file, $lodspk, null); - } - else { - echo file_get_contents($conf['static']['directory'] . $file); - } - } - - private function getContentType($e) - { - $contentTypes = [ - 'html' => 'text/html', - 'css' => 'text/css', - 'js' => 'application/javascript', - 'json' => 'application/json', - 'jsonp' => 'application/javascript', - 'nt' => 'text/plain', - 'ttl' => 'text/turtle', - 'png' => 'image/png', - 'jpg' => 'image/jpeg', - 'gif' => 'image/gif', - 'bmp' => 'image/bmp', - 'pdf' => 'application/pdf', - 'zip' => 'application/zip', - 'gz' => 'application/gzip', - 'svg' => 'image/svg+xml', - ]; - - //Add new/override existing mime types defined by user. - if (isset($conf['static']['mimetypes'])) { - foreach ($conf['static']['mimetypes'] as $k => $v) { - $contentTypes[$k] = $v; - } + private function getContentType($e) + { + $contentTypes = [ + 'html' => 'text/html', + 'css' => 'text/css', + 'js' => 'application/javascript', + 'json' => 'application/json', + 'jsonp' => 'application/javascript', + 'nt' => 'text/plain', + 'ttl' => 'text/turtle', + 'png' => 'image/png', + 'jpg' => 'image/jpeg', + 'gif' => 'image/gif', + 'bmp' => 'image/bmp', + 'pdf' => 'application/pdf', + 'zip' => 'application/zip', + 'gz' => 'application/gzip', + 'svg' => 'image/svg+xml', + ]; + + //Add new/override existing mime types defined by user. + if (isset($conf['static']['mimetypes'])) { + foreach ($conf['static']['mimetypes'] as $k => $v) { + $contentTypes[$k] = $v; + } + } + + if (isset($contentTypes[$e])) { + return $contentTypes[$e]; + } + + return ""; } - if (isset($contentTypes[$e])) { - return $contentTypes[$e]; + /** + * Validate that resource directory is valid and safe to use. + * + * @param array $conf + * Global configuration. + * @param $file + * + * @return void + */ + private function validateDirectory(array $conf, $file): void + { + $staticDirectory = realpath($conf['static']['directory']); + $imgDirectory = realpath($conf['static']['directory'] . "img"); + $resourcePath = realpath($conf['static']['directory'] . $file); + + if (strpos($resourcePath, $staticDirectory) !== 0 && strpos($resourcePath, $imgDirectory) !== 0) { + HTTPStatus::send404($file); + } } - return ""; - } - - /** - * Validate that resource directory is valid and safe to use. - * - * @param array $conf - * Global configuration. - * @param $file - * - * @return void - */ - private function validateDirectory(array $conf, $file): void - { - $staticDirectory = realpath($conf['static']['directory']); - $imgDirectory = realpath($conf['static']['directory'] . "img"); - $resourcePath = realpath($conf['static']['directory'] . $file); - - if (strpos($resourcePath, $staticDirectory) !== 0 && strpos($resourcePath, $imgDirectory) !== 0) { - HTTPStatus::send404($file); - } - } - } diff --git a/classes/modules/typeModule.php b/classes/modules/typeModule.php index 0809429ee15b05bf438cdf360cd8f2fa9f07d0d4..10126d6005afd85cc52d84f0a110bee1dff5cd01 100644 --- a/classes/modules/typeModule.php +++ b/classes/modules/typeModule.php @@ -9,211 +9,217 @@ use uib\ub\loadspeakr\Utils; require_once('abstractModule.php'); -class TypeModule extends abstractModule { - //Class module - - public function match($uri){ - global $conf; - global $localUri; - global $uri; - global $acceptContentType; - global $endpoints; - global $lodspk; - - require_once($conf['home'].'classes/MetaDb.php'); - $metaDb = new MetaDb($conf['metadata']['db']['location']); - - $pair = Queries::getMetadata($localUri, $acceptContentType, $metaDb); - - if($pair == NULL){ // Original URI is not in metadata - if(Queries::uriExist($uri, $endpoints['local'])){ - $page = Queries::createPage($uri, $localUri, $acceptContentType, $metaDb); - if($page == NULL){ - HTTPStatus::send500("Can't write sqlite database."); - } - if($conf['debug']){ - Logging::log("URI found, redirecting to ".$page); - } - HTTPStatus::send303($page, $acceptContentType); - exit(0); - }else{ - return false; - } - } - return $pair; - } - - public function execute($pair){ - global $conf; - global $localUri; - global $uri; - global $acceptContentType; - global $endpoints; - global $lodspk; - global $results; - global $firstResults; - list($res, $page, $format) = $pair; - //If resource is not the page, send a 303 to the document - if($res == $localUri){ - HTTPStatus::send303($page, $acceptContentType); - } - - $uri = $res; - if($conf['mirror_external_uris'] != false){ - $localUri = preg_replace("|^".$conf['ns']['local']."|", $conf['basedir'], $res); - } - - $extension = Utils::getExtension($format); - - /*Redefine Content type based on the - * dcterms:format for this page - */ - $acceptContentType = $format; - //Check if files for model and view exist - $t=Queries::getClass($uri, $endpoints['local']); - - $obj = $this->getModelandView($t, $extension); - $modelFile = $obj['modelFile']; - $lodspk['model'] = $conf['model']['directory']; - $viewFile = $obj['viewFile']; - if (!empty($obj['view'])){ - $lodspk['view'] = $obj['view']['directory']; +class TypeModule extends abstractModule +{ + public function match($uri) + { + global $conf; + global $localUri; + global $uri; + global $acceptContentType; + global $endpoints; + global $lodspk; + + require_once($conf['home'] . 'classes/MetaDb.php'); + $metaDb = new MetaDb($conf['metadata']['db']['location']); + + $pair = Queries::getMetadata($localUri, $acceptContentType, $metaDb); + + if ($pair == null) { // Original URI is not in metadata + if (Queries::uriExist($uri, $endpoints['local'])) { + $page = Queries::createPage($uri, $localUri, $acceptContentType, $metaDb); + if ($page == null) { + HTTPStatus::send500("Can't write sqlite database."); + } + if ($conf['debug']) { + Logging::log("URI found, redirecting to " . $page); + } + HTTPStatus::send303($page, $acceptContentType); + exit(0); + } else { + return false; + } } - if($viewFile == null){ - $lodspk['transform_select_query'] = true; - } - - $lodspk['type'] = $modelFile; - $lodspk['home'] = $conf['basedir']; - $lodspk['baseUrl'] = $conf['basedir']; - $lodspk['module'] = 'type'; - $lodspk['root'] = $conf['root']; - $lodspk['contentType'] = $acceptContentType; - $lodspk['ns'] = $conf['ns']; - $lodspk['endpoint'] = $conf['endpoint']; - $lodspk['view'] = $conf['view']['directory']; - - $lodspk['add_mirrored_uris'] = true; - $lodspk['this']['value'] = $uri; - $lodspk['this']['curie'] = Utils::uri2curie($uri); - $lodspk['local']['value'] = $localUri; - $lodspk['local']['curie'] = Utils::uri2curie($localUri); - $lodspk['this']['extension'] = $extension; - //chdir($conf['home'].$conf['model']['directory']); - - Utils::queryFile($modelFile, $endpoints['local'], $results, $firstResults); - if(empty($lodspk['resultRdf'])){ - $results = Utils::internalize($results); - $firstAux = Utils::getfirstResults($results); - - //chdir($conf['home']); - if(is_array($results)){ - $resultsObj = Convert::array_to_object($results); - $results = $resultsObj; - }else{ - $resultsObj = $results; - } - $lodspk['firstResults'] = Convert::array_to_object($firstAux); - }else{ - $resultsObj = $results; - } - //chdir($conf['home'].$conf['model']['directory']); - Utils::processDocument($viewFile, $lodspk, $resultsObj); - - } - - private static function getModelandView($t, $extension){ - global $conf; - global $results; - global $rPointer; - global $lodspk; - $objResult = array('modelFile' => null, 'viewFile' => null); - //Defining default views and models - $curieType=""; - //Get the firstResults type available - //$typesAndValues = array('rdfs:Resource' => -1); - //$typesAndValues = array('rdfs__Resource' => -1); - //$typesAndValues = array('bibo:Document' => -1); - if (isset($conf['typesAndValues'])){ - $typesAndValues = $conf['typesAndValues']; + return $pair; } - else{ - $typesAndValues = array('bibo__Document' => -1); + + public function execute($pair) + { + global $conf; + global $localUri; + global $uri; + global $acceptContentType; + global $endpoints; + global $lodspk; + global $results; + global $firstResults; + list($res, $page, $format) = $pair; + //If resource is not the page, send a 303 to the document + if ($res == $localUri) { + HTTPStatus::send303($page, $acceptContentType); + } + + $uri = $res; + if ($conf['mirror_external_uris'] != false) { + $localUri = preg_replace("|^" . $conf['ns']['local'] . "|", $conf['basedir'], $res); + } + + $extension = Utils::getExtension($format); + + /*Redefine Content type based on the + * dcterms:format for this page + */ + $acceptContentType = $format; + //Check if files for model and view exist + $t = Queries::getClass($uri, $endpoints['local']); + + $obj = $this->getModelandView($t, $extension); + $modelFile = $obj['modelFile']; + $lodspk['model'] = $conf['model']['directory']; + $viewFile = $obj['viewFile']; + if (!empty($obj['view'])) { + $lodspk['view'] = $obj['view']['directory']; + } + if ($viewFile == null) { + $lodspk['transform_select_query'] = true; + } + + $lodspk['type'] = $modelFile; + $lodspk['home'] = $conf['basedir']; + $lodspk['baseUrl'] = $conf['basedir']; + $lodspk['module'] = 'type'; + $lodspk['root'] = $conf['root']; + $lodspk['contentType'] = $acceptContentType; + $lodspk['ns'] = $conf['ns']; + $lodspk['endpoint'] = $conf['endpoint']; + $lodspk['view'] = $conf['view']['directory']; + + $lodspk['add_mirrored_uris'] = true; + $lodspk['this']['value'] = $uri; + $lodspk['this']['curie'] = Utils::uri2curie($uri); + $lodspk['local']['value'] = $localUri; + $lodspk['local']['curie'] = Utils::uri2curie($localUri); + $lodspk['this']['extension'] = $extension; + //chdir($conf['home'].$conf['model']['directory']); + + Utils::queryFile($modelFile, $endpoints['local'], $results, $firstResults); + if (empty($lodspk['resultRdf'])) { + $results = Utils::internalize($results); + $firstAux = Utils::getfirstResults($results); + + //chdir($conf['home']); + if (is_array($results)) { + $resultsObj = Convert::array_to_object($results); + $results = $resultsObj; + } else { + $resultsObj = $results; + } + $lodspk['firstResults'] = Convert::array_to_object($firstAux); + } else { + $resultsObj = $results; + } + //chdir($conf['home'].$conf['model']['directory']); + Utils::processDocument($viewFile, $lodspk, $resultsObj); + } + + private static function getModelandView($t, $extension) + { + global $conf; + global $results; + global $rPointer; + global $lodspk; + $objResult = array('modelFile' => null, 'viewFile' => null); + //Defining default views and models + $curieType = ""; + //Get the firstResults type available + //$typesAndValues = array('rdfs:Resource' => -1); + //$typesAndValues = array('rdfs__Resource' => -1); + //$typesAndValues = array('bibo:Document' => -1); + if (isset($conf['typesAndValues'])) { + $typesAndValues = $conf['typesAndValues']; + } else { + $typesAndValues = array('bibo__Document' => -1); + } + + if (!isset($conf['disableComponents']) || $conf['disableComponents'] != true) { + foreach ($t as $v) { + $curie = Utils::uri2curie($v); + $typesAndValues[$curie] = 0; + $typesAndValues[str_replace(":", "__", $curie)] = 0; + if (isset($conf['type']['priority'][$curie]) && $conf['type']['priority'][$curie] >= 0) { + $typesAndValues[$curie] = $conf['type']['priority'][$curie]; + $typesAndValues[str_replace(":", "__", $curie)] = $conf['type']['priority'][$curie]; + } + } + } + arsort($typesAndValues); + $extensionView = $extension . "."; + $extensionModel = ''; + if ($extension != 'html') { + $extensionModel = $extension . '.'; + } + foreach ($typesAndValues as $v => $w) { + $auxViewFile = $conf['home'] . $conf['view']['directory'] . '/' . $conf['type']['prefix'] . '/' . $v . '/' . $extension . '.template'; + $auxModelFile = $conf['home'] . $conf['model']['directory'] . '/' . $conf['type']['prefix'] . '/' . $v . '/' . $extension . '.queries'; + if ($v == null) { + continue; + } + $lodspk['componentName'] = $v; + if (file_exists($auxModelFile)) { + $objResult['modelFile'] = $auxModelFile;//$conf['type']['prefix'].'/'.$v.'/'.$extensionModel.'queries'; + if (file_exists($auxViewFile)) { + $objResult['viewFile'] = $auxViewFile;//$conf['type']['prefix'].'/'.$v.'/'.$extensionView.'template'; + } elseif ($extension != 'html') { //View doesn't exists (and is not HTML) + $objResult['viewFile'] = null; + } + break;//return $objResult; + } elseif (file_exists( + $conf['home'] . $conf['model']['directory'] . '/' . $conf['type']['prefix'] . '/' . $v . '/queries' + )) { + $objResult['modelFile'] = $conf['home'] . $conf['model']['directory'] . '/' . $conf['type']['prefix'] . '/' . $v . '/queries'; + if (file_exists($auxViewFile)) { + $objResult['viewFile'] = $auxViewFile; + } else { + $lodspk['transform_select_query'] = true; + $objResult['viewFile'] = null; + } + if ($conf['debug']) { + Logging::log("LODSPeaKr can't find the proper query. Using HTML query instead.", E_USER_NOTICE); + } + break; + } else { + $found = false; + if (!empty($conf['components']['types']) && sizeof($conf['components']['types']) > 0) { + foreach ($conf['components']['types'] as $type) { + $typeArray = explode("/", $type); + $typeName = end($typeArray); + if ($v == $typeName && file_exists($type)) { + array_pop($typeArray); + $conf['type']['prefix'] = array_pop($typeArray); + $conf['model']['directory'] = join("/", $typeArray); + $conf['view']['directory'] = $conf['model']['directory']; + $lodspk['model'] = $conf['model']['directory'] . '/' . $conf['type']['prefix'] . '/' . $typeName . '/queries'; + $lodspk['view'] = $conf['view']['directory'] . '/' . $conf['type']['prefix'] . '/' . $typeName . '/' . $extension . '.template'; + $objResult['viewFile'] = $lodspk['view']; + $objResult['modelFile'] = $lodspk['model']; + $found = true; + if (!file_exists($objResult['viewFile'])) { + $lodspk['transform_select_query'] = true; + $objResult['viewFile'] = null; + } + return $objResult; + } + } + } + if ($found) { + break; + } + } + /*if($objResult['viewFile'] == null && $extensionView == 'html'){ + $objResult['viewFile'] = 'html.template'; + }*/ + } + return $objResult; } - - if(!isset($conf['disableComponents']) || $conf['disableComponents'] != true){ - foreach($t as $v){ - $curie = Utils::uri2curie($v); - $typesAndValues[$curie] = 0; - $typesAndValues[str_replace(":", "__", $curie)] = 0; - if(isset($conf['type']['priority'][$curie]) && $conf['type']['priority'][$curie] >= 0){ - $typesAndValues[$curie] = $conf['type']['priority'][$curie]; - $typesAndValues[str_replace(":", "__", $curie)] = $conf['type']['priority'][$curie]; - } - } - } - arsort($typesAndValues); - $extensionView = $extension."."; - $extensionModel = ''; - if($extension != 'html'){ - $extensionModel = $extension.'.'; - } - foreach($typesAndValues as $v => $w){ - $auxViewFile = $conf['home'].$conf['view']['directory'].'/'.$conf['type']['prefix'].'/'.$v.'/'.$extension.'.template'; - $auxModelFile = $conf['home'].$conf['model']['directory'].'/'.$conf['type']['prefix'].'/'.$v.'/'.$extension.'.queries'; - if($v == null){continue;} - $lodspk['componentName'] = $v; - if(file_exists($auxModelFile)){ - $objResult['modelFile'] = $auxModelFile;//$conf['type']['prefix'].'/'.$v.'/'.$extensionModel.'queries'; - if(file_exists($auxViewFile)){ - $objResult['viewFile'] = $auxViewFile;//$conf['type']['prefix'].'/'.$v.'/'.$extensionView.'template'; - }elseif($extension != 'html'){ //View doesn't exists (and is not HTML) - $objResult['viewFile'] = null; - } - break;//return $objResult; - }elseif(file_exists($conf['home'].$conf['model']['directory'].'/'.$conf['type']['prefix'].'/'.$v.'/queries')){ - $objResult['modelFile'] = $conf['home'].$conf['model']['directory'].'/'.$conf['type']['prefix'].'/'.$v.'/queries'; - if(file_exists($auxViewFile) ){ - $objResult['viewFile'] = $auxViewFile; - }else{ - $lodspk['transform_select_query'] = true; - $objResult['viewFile'] = null; - } - if($conf['debug']){ - Logging::log("LODSPeaKr can't find the proper query. Using HTML query instead.", E_USER_NOTICE); - } - break; - }else{ - $found = false; - if(!empty($conf['components']['types']) && sizeof($conf['components']['types'])>0){ - foreach($conf['components']['types'] as $type){ - $typeArray = explode("/", $type); - $typeName = end($typeArray); - if($v == $typeName && file_exists($type)){ - array_pop($typeArray); - $conf['type']['prefix'] = array_pop($typeArray); - $conf['model']['directory'] = join("/", $typeArray); - $conf['view']['directory'] = $conf['model']['directory']; - $lodspk['model'] = $conf['model']['directory'].'/'.$conf['type']['prefix'].'/'.$typeName.'/queries'; - $lodspk['view'] = $conf['view']['directory'].'/'.$conf['type']['prefix'].'/'.$typeName.'/'.$extension.'.template'; - $objResult['viewFile'] = $lodspk['view']; - $objResult['modelFile'] = $lodspk['model']; - $found = true; - if(!file_exists($objResult['viewFile']) ){ - $lodspk['transform_select_query'] = true; - $objResult['viewFile'] = null; - } - return $objResult; - } - } - } - if($found){break;} - } - /*if($objResult['viewFile'] == null && $extensionView == 'html'){ - $objResult['viewFile'] = 'html.template'; - }*/ - } - return $objResult; - } - + } diff --git a/classes/modules/uriModule.php b/classes/modules/uriModule.php index 05aee962d163ffb6a4605e213ee8aa0ca3b4be84..b816028775b4c209d4bd2eadf56d4ee0c3a8312b 100644 --- a/classes/modules/uriModule.php +++ b/classes/modules/uriModule.php @@ -9,168 +9,172 @@ use uib\ub\loadspeakr\Utils; require_once('abstractModule.php'); -class UriModule extends abstractModule { - - public function match($uri){ - global $conf; - global $localUri; - global $uri; - global $acceptContentType; - global $endpoints; - global $lodspk; - - if(!empty($conf['disableComponents']) && $conf['disableComponents'] == true){ - return FALSE; - } - require_once('classes/MetaDb.php'); - $metaDb = new MetaDb($conf['metadata']['db']['location']); - #LocalURI as is for looking up existing metadata. Fix fails if first paramater is changed to stripped localUri. - $pair = Queries::getMetadata($localUri, $acceptContentType, $metaDb); - #Stripping html to look up and write correct url in database if not exists - #Fix to handle pages that have not been loaded after cleaning out database - $localUri_stripped = preg_replace("/^(.+)\.html$/i", "\\1", $localUri); - $uri_stripped = preg_replace("/^(.+)\.html$/i", "\\1", $uri); - if($pair == NULL){ // Original URI is not in metadata - if(Queries::uriExist($uri_stripped, $endpoints['local'])){ - $page = Queries::createPage($uri_stripped, $localUri_stripped, $acceptContentType, $metaDb); - if($page == NULL){ - HTTPStatus::send500("Can't write sqlite database."); - } - HTTPStatus::send303($page, $acceptContentType); - exit(0); - }else{ - return false; - } - } - $extension = Utils::getExtension($pair[2]); - $curie = Utils::uri2curie($pair[0]); - list($modelFile, $viewFile) = $this->getModelandView($curie, $extension); - if($modelFile == NULL){ - return FALSE; - } - $result = array( 'res' => $pair[0], - 'page' => $pair[1], - 'format' => $pair[2], - 'modelFile' => $modelFile, - 'viewFile' => $viewFile); - - return $result; - } - - public function execute($p){ - global $conf; - global $localUri; - global $uri; - global $acceptContentType; - global $endpoints; - global $lodspk; - global $results; - global $firstResults; - $res = $p['res']; - $page = $p['page']; - $format = $p['format']; - $modelFile = $p['modelFile']; - $viewFile = $p['viewFile']; - $uri = $res; - $curie = Utils::uri2curie($res); - - //If resource is not the page, send a 303 to the document - if($res == $localUri){ - HTTPStatus::send303($page, $acceptContentType); - } - - $uri = $res; - if($conf['mirror_external_uris'] != false){ - $localUri = preg_replace("|^".$conf['ns']['local']."|", $conf['basedir'], $res); - } - - $extension = Utils::getExtension($format); - - /*Redefine Content type based on the - * dcterms:format for this page - */ - $acceptContentType = $format; - - $curie = Utils::uri2curie($uri); - if($modelFile == NULL){ - return; - } - - //$lodspk = $conf['view']['standard']; - - $lodspk['type'] = $modelFile; - $lodspk['home'] = $conf['basedir']; - - $lodspk['module'] = 'uri'; - $lodspk['add_mirrored_uris'] = true; - $lodspk['this']['value'] = $uri; - $lodspk['this']['curie'] = Utils::uri2curie($uri); - $lodspk['local']['value'] = $localUri; - $lodspk['local']['curie'] = Utils::uri2curie($localUri); - $lodspk['contentType'] = $acceptContentType; - $lodspk['model'] = $conf['model']['directory']; - $lodspk['view'] = $conf['view']['directory']; - $lodspk['ns'] = $conf['ns']; - - - //chdir($conf['home'].$conf['model']['directory']); - Utils::queryFile($modelFile, $endpoints['local'], $results, $firstResults); - if(!$lodspk['resultRdf']){ - $results = Utils::internalize($results); - $firstAux = Utils::getfirstResults($results); - - chdir($conf['home']); - if(is_array($results)){ - $resultsObj = Convert::array_to_object($results); - $results = $resultsObj; - }else{ - $resultsObj = $results; - } - $lodspk['firstResults'] = Convert::array_to_object($firstAux); - }else{ - $resultsObj = $results; - } - //chdir($conf['home']); - if($conf['debug']){ - Logging::log("Using template ".$viewFile); - } - Utils::processDocument($viewFile, $lodspk, $resultsObj); - - } - - private static function getModelandView($uri, $extension){ - global $conf; - global $lodspk; - $auxViewFile = $conf['view']['directory'].'/'.$conf['uri']['prefix'].'/'.$uri.'/'.$extension.'.template'; - $auxModelFile = $conf['model']['directory'].'/'.$conf['uri']['prefix'].'/'.$uri.'/'.$extension.'.queries'; - if(file_exists($auxModelFile)){ - //Model exists - $modelFile = $auxModelFile;//$conf['uri']['prefix'].$uri.'/'.$extension.'.queries'; - if(file_exists($auxViewFile) ){ - //View exists, everything is fine - $viewFile = $conf['model']['directory'].'/'.$conf['uri']['prefix'].'/'.$uri.'/'.$extension.'.template'; - }elseif($extension != 'html'){ - //View doesn't exists (and is not HTML) - $viewFile = null; - }else{ - //No HTML representation as fallback, then not recognized by URI module - return array(null, null); - } - return array($modelFile, $viewFile); - }elseif(file_exists($conf['model']['directory'].'/'.$conf['uri']['prefix'].'/'.$uri.'/queries')){ - $modelFile = $conf['model']['directory'].'/'.$conf['uri']['prefix'].'/'.$uri.'/queries';//$conf['uri']['prefix'].$uri.'/html.queries'; - if(file_exists($auxViewFile) ){ - //View exists, everything is fine - $viewFile = $conf['model']['directory'].'/'.$conf['uri']['prefix'].'/'.$uri.'/'.$extension.'.template'; - }elseif($extension != 'html'){ - //View doesn't exists (and is not HTML) - $lodspk['transform_select_query'] = true; - $viewFile = null; - } - return array($modelFile, $viewFile); - } - - return array(NULL, NULL); - } - +class UriModule extends abstractModule +{ + public function match($uri) + { + global $conf; + global $localUri; + global $uri; + global $acceptContentType; + global $endpoints; + global $lodspk; + + if (!empty($conf['disableComponents']) && $conf['disableComponents'] == true) { + return false; + } + require_once('classes/MetaDb.php'); + $metaDb = new MetaDb($conf['metadata']['db']['location']); + #LocalURI as is for looking up existing metadata. Fix fails if first paramater is changed to stripped localUri. + $pair = Queries::getMetadata($localUri, $acceptContentType, $metaDb); + #Stripping html to look up and write correct url in database if not exists + #Fix to handle pages that have not been loaded after cleaning out database + $localUri_stripped = preg_replace("/^(.+)\.html$/i", "\\1", $localUri); + $uri_stripped = preg_replace("/^(.+)\.html$/i", "\\1", $uri); + if ($pair == null) { // Original URI is not in metadata + if (Queries::uriExist($uri_stripped, $endpoints['local'])) { + $page = Queries::createPage($uri_stripped, $localUri_stripped, $acceptContentType, $metaDb); + if ($page == null) { + HTTPStatus::send500("Can't write sqlite database."); + } + HTTPStatus::send303($page, $acceptContentType); + exit(0); + } else { + return false; + } + } + $extension = Utils::getExtension($pair[2]); + $curie = Utils::uri2curie($pair[0]); + list($modelFile, $viewFile) = $this->getModelandView($curie, $extension); + if ($modelFile == null) { + return false; + } + $result = array( + 'res' => $pair[0], + 'page' => $pair[1], + 'format' => $pair[2], + 'modelFile' => $modelFile, + 'viewFile' => $viewFile + ); + + return $result; + } + + public function execute($p) + { + global $conf; + global $localUri; + global $uri; + global $acceptContentType; + global $endpoints; + global $lodspk; + global $results; + global $firstResults; + $res = $p['res']; + $page = $p['page']; + $format = $p['format']; + $modelFile = $p['modelFile']; + $viewFile = $p['viewFile']; + $uri = $res; + $curie = Utils::uri2curie($res); + + //If resource is not the page, send a 303 to the document + if ($res == $localUri) { + HTTPStatus::send303($page, $acceptContentType); + } + + $uri = $res; + if ($conf['mirror_external_uris'] != false) { + $localUri = preg_replace("|^" . $conf['ns']['local'] . "|", $conf['basedir'], $res); + } + + $extension = Utils::getExtension($format); + + /*Redefine Content type based on the + * dcterms:format for this page + */ + $acceptContentType = $format; + + $curie = Utils::uri2curie($uri); + if ($modelFile == null) { + return; + } + + //$lodspk = $conf['view']['standard']; + + $lodspk['type'] = $modelFile; + $lodspk['home'] = $conf['basedir']; + + $lodspk['module'] = 'uri'; + $lodspk['add_mirrored_uris'] = true; + $lodspk['this']['value'] = $uri; + $lodspk['this']['curie'] = Utils::uri2curie($uri); + $lodspk['local']['value'] = $localUri; + $lodspk['local']['curie'] = Utils::uri2curie($localUri); + $lodspk['contentType'] = $acceptContentType; + $lodspk['model'] = $conf['model']['directory']; + $lodspk['view'] = $conf['view']['directory']; + $lodspk['ns'] = $conf['ns']; + + + //chdir($conf['home'].$conf['model']['directory']); + Utils::queryFile($modelFile, $endpoints['local'], $results, $firstResults); + if (!$lodspk['resultRdf']) { + $results = Utils::internalize($results); + $firstAux = Utils::getfirstResults($results); + + chdir($conf['home']); + if (is_array($results)) { + $resultsObj = Convert::array_to_object($results); + $results = $resultsObj; + } else { + $resultsObj = $results; + } + $lodspk['firstResults'] = Convert::array_to_object($firstAux); + } else { + $resultsObj = $results; + } + //chdir($conf['home']); + if ($conf['debug']) { + Logging::log("Using template " . $viewFile); + } + Utils::processDocument($viewFile, $lodspk, $resultsObj); + } + + private static function getModelandView($uri, $extension) + { + global $conf; + global $lodspk; + $auxViewFile = $conf['view']['directory'] . '/' . $conf['uri']['prefix'] . '/' . $uri . '/' . $extension . '.template'; + $auxModelFile = $conf['model']['directory'] . '/' . $conf['uri']['prefix'] . '/' . $uri . '/' . $extension . '.queries'; + if (file_exists($auxModelFile)) { + //Model exists + $modelFile = $auxModelFile;//$conf['uri']['prefix'].$uri.'/'.$extension.'.queries'; + if (file_exists($auxViewFile)) { + //View exists, everything is fine + $viewFile = $conf['model']['directory'] . '/' . $conf['uri']['prefix'] . '/' . $uri . '/' . $extension . '.template'; + } elseif ($extension != 'html') { + //View doesn't exists (and is not HTML) + $viewFile = null; + } else { + //No HTML representation as fallback, then not recognized by URI module + return array(null, null); + } + return array($modelFile, $viewFile); + } elseif (file_exists($conf['model']['directory'] . '/' . $conf['uri']['prefix'] . '/' . $uri . '/queries')) { + $modelFile = $conf['model']['directory'] . '/' . $conf['uri']['prefix'] . '/' . $uri . '/queries';//$conf['uri']['prefix'].$uri.'/html.queries'; + if (file_exists($auxViewFile)) { + //View exists, everything is fine + $viewFile = $conf['model']['directory'] . '/' . $conf['uri']['prefix'] . '/' . $uri . '/' . $extension . '.template'; + } elseif ($extension != 'html') { + //View doesn't exists (and is not HTML) + $lodspk['transform_select_query'] = true; + $viewFile = null; + } + return array($modelFile, $viewFile); + } + + return array(null, null); + } + } diff --git a/composer.json b/composer.json index 806a4de6da8c037a2011601ba02c020ac15467db..960033977e93fa6b7ec76eaf91a0a1c0d8234b72 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,14 @@ "email": "alvaro@graves.cl" } ], + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/ubbdst/Haanga" + } + ], "require": { + "ubbdst/haanga": "^1.0.7", "semsol/arc2": "^2", "symfony/http-foundation": "^5.3", "ext-pdo": "*", @@ -30,6 +37,7 @@ "roave/security-advisories": "dev-latest", "phan/phan": "4.x", "phpstan/phpstan": "^0.12.83", - "phpunit/phpunit": "^9" + "phpunit/phpunit": "^9", + "squizlabs/php_codesniffer": "3.*" } } diff --git a/composer.lock b/composer.lock index 6862f0e1cdd6802133fac7ba8205247ed295f6bc..b4c4a755d88a41e75fb5f7ed3bcd1d8aee63ded4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "77cecd8dfdc25f5d82abe93078f58607", + "content-hash": "6a721a617a138fb2f051106c7f959a79", "packages": [ { "name": "psr/cache", @@ -1037,6 +1037,38 @@ "source": "https://github.com/ThingEngineer/PHP-MySQLi-Database-Class/tree/v2.9.3" }, "time": "2019-08-24T09:28:56+00:00" + }, + { + "name": "ubbdst/haanga", + "version": "v1.0.7", + "source": { + "type": "git", + "url": "https://github.com/ubbdst/Haanga.git", + "reference": "29f88109c1294415f91842136e9413ae0e6ea3d5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ubbdst/Haanga/zipball/29f88109c1294415f91842136e9413ae0e6ea3d5", + "reference": "29f88109c1294415f91842136e9413ae0e6ea3d5", + "shasum": "" + }, + "type": "library", + "autoload": { + "classmap": [ + "lib/" + ] + }, + "authors": [ + { + "name": "César D. Rodas", + "email": "crodas@php.net" + } + ], + "description": "Template compiler for PHP, Django-style (as much as possible). Pretty efficent by avoiding to have anything at run-time.", + "support": { + "source": "https://github.com/ubbdst/Haanga/tree/1.0.7" + }, + "time": "2016-02-06T07:04:31+00:00" } ], "packages-dev": [ @@ -2413,12 +2445,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "05f521f12b6e072bc77aaa78191907987d0454ff" + "reference": "8cebf1673eccd7e6552732142039c147c1023214" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/05f521f12b6e072bc77aaa78191907987d0454ff", - "reference": "05f521f12b6e072bc77aaa78191907987d0454ff", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/8cebf1673eccd7e6552732142039c147c1023214", + "reference": "8cebf1673eccd7e6552732142039c147c1023214", "shasum": "" }, "conflict": { @@ -2494,7 +2526,7 @@ "ezsystems/ezplatform-rest": ">=1.2,<=1.2.2|>=1.3,<=1.3.1", "ezsystems/ezplatform-user": ">=1,<1.0.1", "ezsystems/ezpublish-kernel": "<=6.13.8.1|>=7,<=7.5.15.1", - "ezsystems/ezpublish-legacy": ">=5.3,<5.3.12.6|>=5.4,<5.4.14.2|>=2011,<2017.12.7.3|>=2018.6,<2018.6.1.4|>=2018.9,<2018.9.1.3|>=2019.3,<2019.3.5.1", + "ezsystems/ezpublish-legacy": "<=2017.12.7.3|>=2018.6,<=2019.3.5.1", "ezsystems/platform-ui-assets-bundle": ">=4.2,<4.2.3", "ezsystems/repository-forms": ">=2.3,<2.3.2.1", "ezyang/htmlpurifier": "<4.1.1", @@ -2507,7 +2539,7 @@ "flarum/tags": "<=0.1-beta.13", "fluidtypo3/vhs": "<5.1.1", "fooman/tcpdf": "<6.2.22", - "forkcms/forkcms": "<5.8.3", + "forkcms/forkcms": "<=5.9.2", "fossar/tcpdf-parser": "<6.2.22", "francoisjacquet/rosariosis": "<6.5.1", "friendsofsymfony/oauth2-php": "<1.3", @@ -2525,6 +2557,7 @@ "grumpydictator/firefly-iii": "<5.6", "guzzlehttp/guzzle": ">=4-rc.2,<4.2.4|>=5,<5.3.1|>=6,<6.2.1", "helloxz/imgurl": "<=2.31", + "icecoder/icecoder": "<=8", "illuminate/auth": ">=4,<4.0.99|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.10", "illuminate/cookie": ">=4,<=4.0.11|>=4.1,<=4.1.99999|>=4.2,<=4.2.99999|>=5,<=5.0.99999|>=5.1,<=5.1.99999|>=5.2,<=5.2.99999|>=5.3,<=5.3.99999|>=5.4,<=5.4.99999|>=5.5,<=5.5.49|>=5.6,<=5.6.99999|>=5.7,<=5.7.99999|>=5.8,<=5.8.99999|>=6,<6.18.31|>=7,<7.22.4", "illuminate/database": "<6.20.26|>=7,<8.40", @@ -2634,7 +2667,7 @@ "shopware/core": "<=6.4.3", "shopware/platform": "<=6.4.3", "shopware/production": "<=6.3.5.2", - "shopware/shopware": "<=5.6.9", + "shopware/shopware": "<5.6.10", "showdoc/showdoc": "<=2.9.8", "silverstripe/admin": ">=1.0.3,<1.0.4|>=1.1,<1.1.1", "silverstripe/assets": ">=1,<1.4.7|>=1.5,<1.5.2", @@ -2662,6 +2695,7 @@ "ssddanbrown/bookstack": "<0.29.2", "stormpath/sdk": ">=0,<9.9.99", "studio-42/elfinder": "<2.1.59", + "subrion/cms": "<=4.2.1", "sulu/sulu": "<1.6.41|>=2,<2.0.10|>=2.1,<2.1.1", "swiftmailer/swiftmailer": ">=4,<5.4.5", "sylius/admin-bundle": ">=1,<1.0.17|>=1.1,<1.1.9|>=1.2,<1.2.2", @@ -2803,7 +2837,7 @@ "type": "tidelift" } ], - "time": "2021-09-03T16:04:40+00:00" + "time": "2021-09-09T17:11:22+00:00" }, { "name": "sabre/event", @@ -3836,6 +3870,62 @@ ], "time": "2020-09-28T06:39:44+00:00" }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.6.0", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ffced0d2c8fa8e6cdc4d695a743271fab6c38625", + "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards" + ], + "support": { + "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", + "source": "https://github.com/squizlabs/PHP_CodeSniffer", + "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + }, + "time": "2021-04-09T00:54:41+00:00" + }, { "name": "symfony/console", "version": "v5.3.7", @@ -4378,7 +4468,11 @@ }, "prefer-stable": false, "prefer-lowest": false, - "platform": [], + "platform": { + "ext-pdo": "*", + "ext-json": "*", + "ext-curl": "*" + }, "platform-dev": [], "platform-overrides": { "php": "7.4" diff --git a/lib/Haanga/.travis.yml b/lib/Haanga/.travis.yml deleted file mode 100644 index ed16720990e345c35fe2de9f904fb0a9de0e47f6..0000000000000000000000000000000000000000 --- a/lib/Haanga/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: php -script: phpunit - -php: - - 5.3 - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - hhvm - -before_script: - - curl -s http://getcomposer.org/installer | php - - php composer.phar install - diff --git a/lib/Haanga/LICENSE b/lib/Haanga/LICENSE deleted file mode 100644 index f70e9f63bb37f8e2d662309eb31ab5164b7fec88..0000000000000000000000000000000000000000 --- a/lib/Haanga/LICENSE +++ /dev/null @@ -1,30 +0,0 @@ -Copyright (c) 2011, César D. Rodas <crodas@php.net> and Menéame Comunicacions S.L. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. All advertising materials mentioning features or use of this software - must display the following acknowledgement: - This product includes software developed by César D. Rodas. - -4. Neither the name of the Menéame Comunicacions S.L. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY MENÉAME COMUNICACIONS S.L. ''AS IS'' AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL CÉSAR D. RODAS BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE diff --git a/lib/Haanga/Makefile b/lib/Haanga/Makefile deleted file mode 100644 index 721a31ce378078c1878cce9d6d6c8d381ae2b632..0000000000000000000000000000000000000000 --- a/lib/Haanga/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -all: build test - -build: - #plex lib/Haanga/Compiler/Lexer.lex - phplemon lib/Haanga/Compiler/Parser.y - - -test: - cd tests; ~/bin/php-5.2/bin/php /usr/bin/phpunit --colors --verbose TestSuite.php - cd tests; php /usr/bin/phpunit --coverage-html coverage/ --colors --verbose TestSuite.php - -test-fast: - cd tests; php /usr/bin/phpunit --stop-on-failure --colors --verbose TestSuite.php - - -edit: - vim lib/Haanga/Compiler/Parser.y lib/Haanga/Compiler/Tokenizer.php -O diff --git a/lib/Haanga/README b/lib/Haanga/README deleted file mode 100644 index 49fd8572bdf4192e7dfd213cbe1fcbfacc95a363..0000000000000000000000000000000000000000 --- a/lib/Haanga/README +++ /dev/null @@ -1,3 +0,0 @@ -This project was created* and sponsored by Menéame (http://meneame.net/) - -[*] http://twitter.com/gallir/status/16256084676 diff --git a/lib/Haanga/composer.json b/lib/Haanga/composer.json deleted file mode 100644 index 3eec6ed7f0645018c6c316d60e40b278cc33a49b..0000000000000000000000000000000000000000 --- a/lib/Haanga/composer.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "crodas/Haanga", - "description": "Template compiler for PHP, Django-style (as much as possible). Pretty efficent by avoiding to have anything at run-time.", - "version": "v1.0.7", - "authors": [ - { - "name": "César D. Rodas", - "email": "crodas@php.net" - } - ], - "require": { - - }, - "autoload": { - "classmap": [ - "lib/" - ] - } -} diff --git a/lib/Haanga/contrib/dummy.php b/lib/Haanga/contrib/dummy.php deleted file mode 100644 index 9f50eaf0334ffb49bd10200a4a53c2454b27fddf..0000000000000000000000000000000000000000 --- a/lib/Haanga/contrib/dummy.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -Class Haanga_Extension_Tag_Dummy -{ - public $is_block = TRUE; - - static function main($html) - { - return strtolower($html); - } -} diff --git a/lib/Haanga/contrib/meneame_pagination.php b/lib/Haanga/contrib/meneame_pagination.php deleted file mode 100644 index c8e440252ce31a7233e78b0ebdf3761b6429bb7d..0000000000000000000000000000000000000000 --- a/lib/Haanga/contrib/meneame_pagination.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php - -class Haanga_Extension_Tag_MeneamePagination -{ - public $is_block = FALSE; - - static function generator($cmp, $args, $redirected) - { - if (count($args) != 3 && count($args) != 4) { - throw new Haanga_CompilerException("Memeame_Pagination requires 3 or 4 parameters"); - } - - if (count($args) == 3) { - $args[3] = 5; - } - - $current = hvar('mnm_current'); - $total = hvar('mnm_total'); - $start = hvar('mnm_start'); - $end = hvar('mnm_end'); - $prev = hvar('mnm_prev'); - $next = hvar('mnm_next'); - $pages = 'mnm_pages'; - - $code = hcode(); - - $code->decl($current, $args[0]); - $code->decl($total, hexec('ceil', hexpr($args[2], '/', $args[1])) ); - $code->decl($start, hexec('max', hexpr($current, '-', hexec('intval', hexpr($args[3],'/', 2))), 1)); - $code->decl($end, hexpr($start, '+', $args[3], '-', 1)); - $code->decl($prev, hexpr_cond( hexpr(1, '==', $current), FALSE, hexpr($current, '-', 1)) ); - $code->decl($next, hexpr_cond( hexpr($args[2], '<', 0, '||', $current, '<', $total), hexpr($current, '+', 1), FALSE)); - $code->decl('mnm_pages', hexec('range', $start, hexpr_cond(hexpr($end,'<', $total), $end, $total))); - - $cmp->set_safe($current); - $cmp->set_safe($total); - $cmp->set_safe($prev); - $cmp->set_safe($next); - $cmp->set_safe($pages); - - - return $code; - } - -} diff --git a/lib/Haanga/examples/complex/base.html b/lib/Haanga/examples/complex/base.html deleted file mode 100644 index 091a75b4a3a092a121ffd1e67500534baf3ee6a9..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/complex/base.html +++ /dev/null @@ -1,62 +0,0 @@ -<script> -var i = 5 % 4; /* changed */ -function foo_bar () { - cesar {$rodas} -} -</script> - -{# Testing Comment #} -<table> -{% for var in some_list %} - - <tr class="{% cycle 'row1 \' cesar' 'row2' %}"> - <td style="background-color: {% ifchanged var %}{%cycle 'red' '#c0c0c0' %}{% else %}{%cycle 'gray' 'white' %}{% endifchanged %}"> - Foobar {{ var }} - {% filter lower|upper %} - {% ifchanged %} - cesar - {% ifchanged %} - Date {{ var }} foo - dasdasdasdasdasldaksdhasd - asdlkasjdlkasjdlkasjdlkajdas - dasa - {% endifchanged %} - {% endifchanged %} - out of ifchanged - {% endfilter %} - </td> - <td> - {{ forloop.counter0 }} - </td> - <td> - {% block test %} - test - {% block foo %}foo{% endblock foo %} - {% for var in some_list %} - {%upper%} - {# Define a custom filter (AKA call a PHP function) #} - i must be uppercase - {% endupper %} - {{ forloop.counter }}<br/> - {{ forloop.counter0 }}<br/> - {% endfor %} - - {% endblock test %} - </td> - <td> - {% block td %} - {% filter lower|upper %} - Testing block with filter {{ forloop.counter }} :-) - {% endfilter %} - {% endblock %} - </td> - </tr> -{% empty %} -<tr> - <td> - Dear {{user}} you found a bug ;-) - </td> -</tr> -{% endfor %} - </tr> -</table> diff --git a/lib/Haanga/examples/complex/include.html b/lib/Haanga/examples/complex/include.html deleted file mode 100644 index 9925f3cf72f79a7154d5d64c80c189f513576244..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/complex/include.html +++ /dev/null @@ -1,8 +0,0 @@ - {% for var in some_list %} - ({% if forloop.counter % 2 == 0 AND 1 == 1 %} - Par - {% else %} - Inpar - {% endif %} - {{ forloop.counter }}) - {% endfor %} diff --git a/lib/Haanga/examples/complex/index-test.html b/lib/Haanga/examples/complex/index-test.html deleted file mode 100644 index 6f8c25bb0a0e4dfb1081e7a3693a27e5fd06f079..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/complex/index-test.html +++ /dev/null @@ -1,5 +0,0 @@ -{% extends base_template %} - -{% block test %} - hello -{% endblock test %} diff --git a/lib/Haanga/examples/complex/index.html b/lib/Haanga/examples/complex/index.html deleted file mode 100644 index 2060c87f3f18b6a669cb4ff06c27a41aaaae47b6..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/complex/index.html +++ /dev/null @@ -1,34 +0,0 @@ -{% regroup people by gender as gender_list %} - -<h1>Users ({{ people|length }} in {{ gender_list|length }} genders)</h1> -<ul> -{% for i,gender in gender_list %} - <li>"{{ gender['grouper'] }}" is equals to "{{ gender_list[i]["grouper"] }}" - <ul> - {% for item in gender['list'] %} - <li>{{ item['first_name']|upper|safe }} {{ item['last_name']|safe }} ({% firstof item['foobar'] item['bar'] "unset both" %}) {{ item['bar']|default:"default value"|upper }} - {% if "das" in item['last_name'] %} - (Last name contains "das") - {% endif %} - {% if forloop.last %} - { Last item } - {% endif %}</li> - - - {% endfor %} - </ul> - </li> -{% endfor %} -</ul> - -{% if "ab" in "abcd" %} - <h1>here</h1> -{% endif %} - -{# Show list of dates #} -{% for date in days %} - {% ifchanged %}<h3>{{ date|date:"F" }}</h3>{% endifchanged %} - <a href="{{ date|date:"M/d"|lower }}/">{{ date|date:"j" }}</a> -{% endfor %} - -{% include templates.base %} diff --git a/lib/Haanga/examples/complex/subtemplate.html b/lib/Haanga/examples/complex/subtemplate.html deleted file mode 100644 index 3cb3e9c7b476553132934f23eca7400f3be3e76e..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/complex/subtemplate.html +++ /dev/null @@ -1,10 +0,0 @@ -{% extends "base.html" %} - - -{% block td %} - {% include "include.html" %} -{% endblock %} -{% block foo %} - simplest output - [{{ block.super }}] -{% endblock %} diff --git a/lib/Haanga/examples/django-yui-layout-templates/README b/lib/Haanga/examples/django-yui-layout-templates/README deleted file mode 100644 index 8e4f0a41b452f368f5f4e3d1414e043b2aae1eea..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/django-yui-layout-templates/README +++ /dev/null @@ -1,5 +0,0 @@ -Original project: -http://code.google.com/p/django-yui-layout-templates/ - -- Changes - Changed some block names, since we only support [a-zA-Z][a-zA-Z0-9_\.]* names diff --git a/lib/Haanga/examples/django-yui-layout-templates/layout_1_column_full_width.html b/lib/Haanga/examples/django-yui-layout-templates/layout_1_column_full_width.html deleted file mode 100644 index 35bcd078f576831ea5d16c852cf7b7087af0f72a..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/django-yui-layout-templates/layout_1_column_full_width.html +++ /dev/null @@ -1,8 +0,0 @@ -{% extends 'layout_overrides.html' %} - -{% block yahooui %}id="doc3"{% endblock yahooui %} - -{% block body_content %} - {% block 1 %} - {% endblock 1 %} -{% endblock body_content %} diff --git a/lib/Haanga/examples/django-yui-layout-templates/layout_2_columns_narrow_left_column.html b/lib/Haanga/examples/django-yui-layout-templates/layout_2_columns_narrow_left_column.html deleted file mode 100644 index f7da60d53fd0c91be18890e6d9328127a15d49ee..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/django-yui-layout-templates/layout_2_columns_narrow_left_column.html +++ /dev/null @@ -1,16 +0,0 @@ -{% extends 'layout_overrides.html' %} - -{% block yahooui %}id="doc3" class="yui-t2"{% endblock yahooui %} - -{% block body_content %} - <div class="yui-b"> - {% block 1 %} - {% endblock 1 %} - </div> - <div id="yui-main"> - <div class="yui-b"> - {% block 2 %} - {% endblock 2 %} - </div> - </div> -{% endblock body_content %} diff --git a/lib/Haanga/examples/django-yui-layout-templates/layout_2_columns_narrow_right_column.html b/lib/Haanga/examples/django-yui-layout-templates/layout_2_columns_narrow_right_column.html deleted file mode 100644 index 85c07ad539ddc3700bf342c1879f424fb37267b3..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/django-yui-layout-templates/layout_2_columns_narrow_right_column.html +++ /dev/null @@ -1,16 +0,0 @@ -{% extends 'layout_overrides.html' %} - -{% block yahooui %}id="doc3" class="yui-t4"{% endblock yahooui %} - -{% block body_content %} - <div id="yui-main"> - <div class="yui-b"> - {% block 1 %} - {% endblock 1 %} - </div> - </div> - <div class="yui-b"> - {% block 2 %} - {% endblock 2 %} - </div> -{% endblock body_content %} \ No newline at end of file diff --git a/lib/Haanga/examples/django-yui-layout-templates/layout_2_equal_columns.html b/lib/Haanga/examples/django-yui-layout-templates/layout_2_equal_columns.html deleted file mode 100644 index f24789784d631fd56e39bf35a41340bc8557d349..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/django-yui-layout-templates/layout_2_equal_columns.html +++ /dev/null @@ -1,20 +0,0 @@ -{% extends 'layout_overrides.html' %} - -{% block yahooui %}id="doc3"{% endblock yahooui %} - -{% block body_content %} - <div id="yui-main"> - <div class="yui-b"> - <div class="yui-g"> - <div class="yui-u first"> - {% block 1 %} - {% endblock 1 %} - </div> - <div class="yui-u"> - {% block 2 %} - {% endblock 2 %} - </div> - </div> - </div> - </div> -{% endblock body_content %} diff --git a/lib/Haanga/examples/django-yui-layout-templates/layout_3_columns_quarter_half_quarter.html b/lib/Haanga/examples/django-yui-layout-templates/layout_3_columns_quarter_half_quarter.html deleted file mode 100644 index 7f74bd8331ebddf0e33509df28743ef07288fa8f..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/django-yui-layout-templates/layout_3_columns_quarter_half_quarter.html +++ /dev/null @@ -1,30 +0,0 @@ -{% extends 'layout_overrides.html' %} - -{% block yahooui %}id="doc3"{% endblock yahooui %} - -{% block body_content %} - <div id="yui-main"> - <div class="yui-b"> - <div class="yui-gf"> - <div class="yui-u first"> - {% block 1 %} - {% endblock 1 %} - </div> - <div class="yui-u"> - <div class="yui-b"> - <div class="yui-ge"> - <div class="yui-u first"> - {% block 2 %} - {% endblock 2 %} - </div> - </div> - <div class="yui-u"> - {% block 3 %} - {% endblock 3 %} - </div> - </div> - </div> - </div> - </div> - </div> -{% endblock body_content %} diff --git a/lib/Haanga/examples/django-yui-layout-templates/layout_3_columns_varying_width.html b/lib/Haanga/examples/django-yui-layout-templates/layout_3_columns_varying_width.html deleted file mode 100644 index 87b219d8f576358864b98937be1eb36aed3ce2c3..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/django-yui-layout-templates/layout_3_columns_varying_width.html +++ /dev/null @@ -1,24 +0,0 @@ -{% extends 'layout_overrides.html' %} - -{% block yahooui %}id="doc3" class="yui-t2"{% endblock yahooui %} - -{% block body_content %} - <div id="yui-main"> - <div class="yui-b"> - <div {% block nested_yahooui %}class="yui-ge"{% endblock nested_yahooui %}> - <div class="yui-u first"> - {% block 2 %} - {% endblock 2 %} - </div> - </div> - <div class="yui-u"> - {% block 3 %} - {% endblock 3 %} - </div> - </div> - </div> - <div class="yui-b"> - {% block 1 %} - {% endblock 1 %} - </div> -{% endblock body_content %} diff --git a/lib/Haanga/examples/django-yui-layout-templates/layout_3_equal_columns.html b/lib/Haanga/examples/django-yui-layout-templates/layout_3_equal_columns.html deleted file mode 100644 index d330fec506ba2aaa08ea4e3bedac8afcfd8085c4..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/django-yui-layout-templates/layout_3_equal_columns.html +++ /dev/null @@ -1,24 +0,0 @@ -{% extends 'layout_overrides.html' %} - -{% block yahooui %}id="doc3"{% endblock yahooui %} - -{% block body_content %} - <div id="yui-main"> - <div class="yui-b"> - <div class="yui-gb"> - <div class="yui-u first"> - {% block 1 %} - {% endblock 1 %} - </div> - <div class="yui-u"> - {% block 2 %} - {% endblock 2 %} - </div> - <div class="yui-u"> - {% block 3 %} - {% endblock 3 %} - </div> - </div> - </div> - </div> -{% endblock body_content %} diff --git a/lib/Haanga/examples/django-yui-layout-templates/layout_4_equal_columns.html b/lib/Haanga/examples/django-yui-layout-templates/layout_4_equal_columns.html deleted file mode 100644 index a4b3823bc96b5b86407157d82c760428e34bcc92..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/django-yui-layout-templates/layout_4_equal_columns.html +++ /dev/null @@ -1,34 +0,0 @@ -{% extends 'layout_overrides.html' %} - -{% block yahooui %}id="doc3"{% endblock yahooui %} - -{% block body_content %} - <div id="content" class="clearfix"> - <div id="yui-main"> - <div class="yui-b"> - <div class="yui-g"> - <div class="yui-g first"> - <div class="yui-u first"> - {% block 1 %} - {% endblock 1 %} - </div> - <div class="yui-u"> - {% block 2 %} - {% endblock 2 %} - </div> - </div> - <div class="yui-g"> - <div class="yui-u first"> - {% block 3 %} - {% endblock 3 %} - </div> - <div class="yui-u"> - {% block 4 %} - {% endblock 4 %} - </div> - </div> - </div> - </div> - </div> - </div> -{% endblock body_content %} diff --git a/lib/Haanga/examples/django-yui-layout-templates/layout_base.html b/lib/Haanga/examples/django-yui-layout-templates/layout_base.html deleted file mode 100644 index fdfe3547013cd21828b1688f44067c9dd1463700..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/django-yui-layout-templates/layout_base.html +++ /dev/null @@ -1,87 +0,0 @@ -{% block layout.base %} -{% block doctype %}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">{% endblock doctype %} -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -{% block head %} -<head> - {% block meta %} - <meta http-equiv="content-type" content="{% block meta['content-type'] %}text/html;charset=UTF-8{% endblock meta['content-type'] %}" /> - <meta name="description" content="{% block meta.description %}{% endblock meta.description %}" /> - <meta name="keywords" content="{% block meta.keywords %}{% endblock meta.keywords %}" /> - {% endblock meta %} - - <title>{% block title %}{% endblock title %}</title> - - {% block css %} - {% block css.shared %} - <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.6.0/build/reset-fonts-grids/reset-fonts-grids.css" /> - <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.6.0/build/base/base-min.css" /> - {% endblock css.shared %} - {% block css.custom %}{% endblock css.custom %} - {% endblock css%} - - {% block js %} - {% block js.shared %}{% endblock js.shared %} - {% block js.custom %}{% endblock js.custom %} - {% endblock js%} -</head> -{% endblock head %} - -<body{% block bodyonload %}{% endblock bodyonload %}> - <div {% block yahooui %}{% endblock yahooui %}> - {% block header %} - <!-- BEGIN header --> - <div id="hd"> - {% block header_content %}{% include 'shared/header.html' %}{% endblock header_content %} - </div> - <!-- END header --> - {% endblock header %} - - {% block body %} - <!-- BEGIN body --> - <div id="bd"> - {% block body_content %}{% endblock body_content %} - </div> - <!-- END body --> - {% endblock body %} - - {% block footer %} - <!-- BEGIN footer --> - <div id="ft"> - {% block footer_content %}{% include 'shared/footer.html' %}{% endblock footer_content %} - </div> - <!-- END footer --> - {% endblock footer %} - - {% block sql_debug %} - {% if debug %} - <!-- BEGIN debug --> - <div id="debug"> - <h2>Queries</h2> - <p>{{ sql_queries|length }} Queries {% ifnotequal sql_queries|length 0 %} (<span style="cursor: pointer;" onclick="document.getElementById('debugQueryTable').style.display='';">Show</span>) {% endifnotequal %}</p> - <table id="debugQueryTable" style="display: none;"> - <col width="1"></col> - <col></col> - <col width="1"></col> - <thead> - <tr> - <th scope="col">#</th> - <th scope="col">SQL</th> - <th scope="col">Time</th> - </tr> - </thead> - <tbody> - {% for query in sql_queries %}<tr class="{% cycle "odd","even" %}"> - <td>{{ forloop.counter }}</td> - <td>{{ query.sql|escape }}</td> - <td>{{ query.time }}</td> - </tr>{% endfor %} - </tbody> - </table> - </div> - <!-- END debug --> - {% endif %} - {% endblock sql_debug %} - </div> -</body> -</html> -{% endblock layout.base %} diff --git a/lib/Haanga/examples/django-yui-layout-templates/layout_overrides.html b/lib/Haanga/examples/django-yui-layout-templates/layout_overrides.html deleted file mode 100644 index 2f97e1b4233b0a89951587ae159c04271bf5960b..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/django-yui-layout-templates/layout_overrides.html +++ /dev/null @@ -1,3 +0,0 @@ -{% extends 'layout_base.html' %} - -# This file should contain any override to the layout_base.html diff --git a/lib/Haanga/examples/django-yui-layout-templates/shared/footer.html b/lib/Haanga/examples/django-yui-layout-templates/shared/footer.html deleted file mode 100644 index 64d3d833169f782935da16954f9331c4ab203d61..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/django-yui-layout-templates/shared/footer.html +++ /dev/null @@ -1,3 +0,0 @@ -{% for file in files %} - <a href="?layout={{ file }}">{{ file }}</a> | -{% endfor %} diff --git a/lib/Haanga/examples/django-yui-layout-templates/shared/header.html b/lib/Haanga/examples/django-yui-layout-templates/shared/header.html deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/examples/django-yui.php b/lib/Haanga/examples/django-yui.php deleted file mode 100644 index 2443c2681a1b9d9b8343f6718f4b246859fd8ca4..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/django-yui.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -require "../lib/Haanga.php"; -$config = array( - 'cache_dir' => 'tmp/', - 'template_dir' => 'django-yui-layout-templates/', -); - -if (is_callable('xcache_isset')) { - /* don't check for changes in the template for the next 5 min */ - $config['check_ttl'] = 300; - $config['check_get'] = 'xcache_get'; - $config['check_set'] = 'xcache_set'; -} - -Haanga::Configure($config); - -$files = array(); -foreach (glob("django-yui-layout-templates/*.html") as $html) { - if (is_file($html)) { - $files[basename($html)] = TRUE; - } -} - -if (!isset($_GET['layout']) || !isset($files[$_GET['layout']])) { - $_GET['layout'] = key($files); -} - -$blocks = array( - '1' => 'Content on div 1', - '2' => 'Content on div 2', - '3' => 'Content on div 3', - '4' => 'Content on div 4', - 'title' => $_GET['layout']." template", -); - -$debug = TRUE; -$sql_queries = array( - array('sql' => 'select * from foobar', 'time' => '1'), - array('sql' => 'select * from php', 'time' => '1'), -); - -$files = array_keys($files); -$time = microtime(TRUE); -$mem = memory_get_usage(); - -Haanga::Load($_GET['layout'], compact('debug', 'files', 'sql_queries'), FALSE, $blocks); -var_dump(array( - 'memory (mb)' => (memory_get_usage()-$mem)/(1024*1024), - 'time' => microtime(TRUE)-$time - )); diff --git a/lib/Haanga/examples/index.php b/lib/Haanga/examples/index.php deleted file mode 100644 index 4a180403bc7972313b0acb89170f921881a819a7..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/index.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php - -require "../lib/Haanga.php"; -#apd_set_pprof_trace('/tmp/apd/'); -$config = array( - 'cache_dir' => 'tmp/', - 'template_dir' => 'complex/', -); - -if (is_callable('xcache_isset')) { - /* don't check for changes in the template for the next 5 min */ - $config['check_ttl'] = 300; - $config['check_get'] = 'xcache_get'; - $config['check_set'] = 'xcache_set'; -} - -Haanga::Configure($config); - -$people = array( - array('first_name' => 'George </br>', 'last_name' => 'Bush', 'gender' => 'Male', 'foobar' => 'extra'), - array('first_name' => 'Bill', 'last_name' => 'Clinton', 'gender' => 'Male'), - array('first_name' => 'Margaret', 'last_name' => 'Thatcher', 'gender' => 'Female'), - array('first_name' => 'Condoleezza', 'last_name' => 'Rice', 'gender' => 'Female'), - array('first_name' => 'Pat', 'last_name' => 'Smith', 'gender' => 'Unknown', 'bar' => 'foo'), - array('first_name' => '"Cesar', 'last_name' => 'Rodas"', 'gender' => 'Male'), -); - -$vars = array( - 'some_list' => array(1, 2, 3, 4, 4, 4, 5), - 'user' => 'crodas', - 'base_template' => 'subtemplate.html', - 'people' => $people, - 'days' => array( - strtotime("01/27/2010"), - strtotime("01/28/2010"), - strtotime("02/22/2010"), - strtotime("02/28/2010"), - strtotime("08/25/2010"), - strtotime("08/30/2010"), - ), - 'templates' => array('base' => 'index-test.html'), -); - - -$time = microtime(TRUE); -$mem = memory_get_usage(); -Haanga::load('index.html', $vars); -var_dump(array('memory' => (memory_get_usage()-$mem)/(1024*1024), 'seconds' => microtime(TRUE)-$time)); diff --git a/lib/Haanga/examples/inheritance.php b/lib/Haanga/examples/inheritance.php deleted file mode 100644 index 831780c54de5446b9fb5552f6ec8e1609d4567c8..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/inheritance.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php -/** - * Simple example rendering a user list - * ------------------------------------ - * - * @credit - adapt from ptemplates sample - */ -require "../lib/Haanga.php"; - -Haanga::registerAutoload(); -Haanga::setCacheDir('tmp/'); -Haanga::setTEmplateDir('inheritance/'); - -$time_start = microtime(true); - -Haanga::Load('page.html', array( - 'title' => microtime(TRUE), - 'users' => array( - array( - 'username' => 'peter', - 'tasks' => array('school', 'writing'), - 'user_id' => 1, - ), - array( - 'username' => 'anton', - 'tasks' => array('go shopping'), - 'user_id' => 2, - ), - array( - 'username' => 'john doe', - 'tasks' => array('write report', 'call tony', 'meeting with arron'), - 'user_id' => 3 - ), - array( - 'username' => 'foobar', - 'tasks' => array(), - 'user_id' => 4 - ) - ) -)); - -echo "in ".(microtime(true) - $time_start)." seconds\n<br/>"; diff --git a/lib/Haanga/examples/inheritance/layout.html b/lib/Haanga/examples/inheritance/layout.html deleted file mode 100644 index e0e2a67d421521a4063234068ddcaadd6c77b8a6..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/inheritance/layout.html +++ /dev/null @@ -1,48 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Frameset//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> -<html> - <head> - <title>{% block title %}Default title{% endblock %}</title> - <style type="text/css"> - {% block style %} - body { - background-color: #333; - color: #eee; - font-family: 'Arial', sans-serif; - font-size: 0.9em; - } - - a { - color: #d00; - } - {% endblock %} - </style> - </head> - <body> - {% block body %} - <div id="header"> - <h1>My Webpage</h1> - <h2>My Subtitle</h2> - </div> - - <div id="navigation"> - <ul> - {% block navigation %} - <li><a href="index.html">My Home</a></li> - <li><a href="downloads.html">Download</a></li> - <li><a href="about.html">About us</a></li> - {% endblock %} - </ul> - </div> - - <div id="content"> - {% block content %}{% endblock %} - </div> - <div id="footer"> - {% include 'shared/about.html' %} - - © Copyright 2007 by Yourself - </div> - {% endblock %} - </body> -</html> diff --git a/lib/Haanga/examples/inheritance/page.html b/lib/Haanga/examples/inheritance/page.html deleted file mode 100644 index 8a4b0e70961d4413214374c242a246ded915492f..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/inheritance/page.html +++ /dev/null @@ -1,24 +0,0 @@ -{% extends 'section.html' %} - - -{% block title %}Userlist | {{ block.super }} -- {{title}}{% endblock %} - -{% block content %} -{% spaceless %} -<h2>Userlist</h2> -<ul> -{% for user in users %} - <li><a href="/users/{{ user.username|urlencode|safe }}">{{ user.username|escape }}</a></li> - - {% if user.username != 'foobar' %} - haha - {% endif %} - -{% endfor %} -</ul> - -[{{ block.super }}] - -{% endspaceless %} -{% endblock %} - diff --git a/lib/Haanga/examples/inheritance/section.html b/lib/Haanga/examples/inheritance/section.html deleted file mode 100644 index 6fd5f78f2d146a10e1bfe9c5b1d3f20f77d0659b..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/inheritance/section.html +++ /dev/null @@ -1,15 +0,0 @@ -{% extends 'layout.html' %} -{% block title %} User Section | [{{ block.super }}] {% endblock %} - -{% block header %} - <h1>Section of a website</h1> -{% endblock %} - -{% block content %} -cesar -{% endblock content %} - -{% block body %} -<h1>new Body</h1> -{{ block.super }} -{% endblock body %} diff --git a/lib/Haanga/examples/inheritance/shared/about.html b/lib/Haanga/examples/inheritance/shared/about.html deleted file mode 100644 index 236a02f803a281d74db65c185ab9403c19766c74..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/inheritance/shared/about.html +++ /dev/null @@ -1 +0,0 @@ -included file \ No newline at end of file diff --git a/lib/Haanga/examples/template_runtime.php b/lib/Haanga/examples/template_runtime.php deleted file mode 100644 index 77d060bc61ea0135917d27daab6f890f119f4970..0000000000000000000000000000000000000000 --- a/lib/Haanga/examples/template_runtime.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -require "../lib/Haanga.php"; - -$fnc = Haanga::compile(<<<EOT - <h1>{{foobar}}{{ foobar }}</h1> - - Este template será compilado a una función PHP ({{foo|default:foobar}}) - - -EOT -); - -$fnc(array("foobar" => 'hola', 'foo' => '.I.'), FALSE /* print it */); -$fnc(array("foobar" => 'chau'), FALSE /* print it */); diff --git a/lib/Haanga/examples/tmp/.empty b/lib/Haanga/examples/tmp/.empty deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/haanga-cli.php b/lib/Haanga/haanga-cli.php deleted file mode 100644 index d48534bbf69e1fcedf11c96b34566dca38634011..0000000000000000000000000000000000000000 --- a/lib/Haanga/haanga-cli.php +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/php -<?php - -require dirname(__FILE__)."/lib/Haanga.php"; - -Haanga::registerAutoload(); - -Haanga_Compiler::main_cli(); diff --git a/lib/Haanga/lib/Haanga.php b/lib/Haanga/lib/Haanga.php deleted file mode 100644 index 6232fa13c6565807f317e65d6c1d4af95a821bb5..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga.php +++ /dev/null @@ -1,451 +0,0 @@ -<?php -/* - +---------------------------------------------------------------------------------+ - | Copyright (c) 2010 César Rodas and Menéame Comunicacions S.L. | - +---------------------------------------------------------------------------------+ - | Redistribution and use in source and binary forms, with or without | - | modification, are permitted provided that the following conditions are met: | - | 1. Redistributions of source code must retain the above copyright | - | notice, this list of conditions and the following disclaimer. | - | | - | 2. Redistributions in binary form must reproduce the above copyright | - | notice, this list of conditions and the following disclaimer in the | - | documentation and/or other materials provided with the distribution. | - | | - | 3. All advertising materials mentioning features or use of this software | - | must display the following acknowledgement: | - | This product includes software developed by César D. Rodas. | - | | - | 4. Neither the name of the César D. Rodas nor the | - | names of its contributors may be used to endorse or promote products | - | derived from this software without specific prior written permission. | - | | - | THIS SOFTWARE IS PROVIDED BY CÉSAR D. RODAS ''AS IS'' AND ANY | - | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | - | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | - | DISCLAIMED. IN NO EVENT SHALL CÉSAR D. RODAS BE LIABLE FOR ANY | - | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | - | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | - | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | - | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | - | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | - | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE | - +---------------------------------------------------------------------------------+ - | Authors: César Rodas <crodas@php.net> | - +---------------------------------------------------------------------------------+ -*/ - -if (!defined('HAANGA_VERSION')) { - /* anyone can override this value to force recompilation */ - define('HAANGA_VERSION', '1.0.7'); -} - - -/** - * Haanga Runtime class - * - * Simple class to call templates efficiently. This class aims - * to reduce the compilation of a template as less a possible. Also - * it will not load in memory the compiler, except when there is not - * cache (compiled template) or it is out-dated. - * - */ -class Haanga -{ - protected static $cache_dir; - protected static $templates_dir=array('.'); - protected static $debug; - protected static $bootstrap = NULL; - protected static $check_ttl; - protected static $check_get; - protected static $check_set; - protected static $use_autoload = TRUE; - protected static $hash_filename = TRUE; - protected static $compiler = array(); - - public static $has_compiled; - - private function __construct() - { - /* The class can't be instanced */ - } - - public static function getTemplateDir() - { - return self::$templates_dir; - } - - // configure(Array $opts) {{{ - /** - * Configuration to load Haanga - * - * Options: - * - * - (string) cache_dir - * - (string) tempalte_dir - * - (callback) on_compile - * - (boolean) debug - * - (int) check_ttl - * - (callback) check_get - * - (callback) check_set - * - (boolean) autoload - * - (boolean) use_hash_filename - * - * @return void - */ - final public static function configure(Array $opts) - { - foreach ($opts as $option => $value) { - switch (strtolower($option)) { - case 'cache_dir': - self::$cache_dir = $value; - break; - case 'template_dir': - self::$templates_dir = (Array)$value; - break; - case 'bootstrap': - if (is_callable($value)) { - self::$bootstrap = $value; - } - break; - case 'debug': - self::enableDebug((bool)$value); - break; - case 'check_ttl': - self::$check_ttl = (int)$value; - break; - case 'check_get': - if (is_callable($value)) { - self::$check_get = $value; - } - break; - case 'check_set': - if (is_callable($value)) { - self::$check_set = $value; - } - break; - case 'autoload': - self::$use_autoload = (bool)$value; - break; - case 'use_hash_filename': - self::$hash_filename = (bool)$value; - break; - case 'compiler': - if (is_array($value)) { - self::$compiler = $value; - } - break; - default: - continue 2; - } - } - } - // }}} - - // checkCacheDir(string $dir) {{{ - /** - * Check the directory where the compiled templates - * are stored. - * - * @param string $dir - * - * @return void - */ - public static function checkCacheDir() - { - $dir = self::$cache_dir; - if (!is_dir($dir)) { - $old = umask(0); - if (!mkdir($dir, 0777, TRUE)) { - throw new Haanga_Exception("{$dir} is not a valid directory"); - } - umask($old); - } - if (!is_writable($dir)) { - throw new Haanga_Exception("{$dir} can't be written"); - } - } - // }}} - - // enableDebug($bool) {{{ - public static function enableDebug($bool) - { - self::$debug = $bool; - } - // }}} - - // getCompiler($checkdir=TRUE) {{{ - /** - * This function is a singleton for the Haanga_Compiler_Runtime class. - * The instance is already set up properly and resetted. - * - * - * @param bool $checkdir TRUE - * - * @return Haanga_Compiler_Runtime - */ - protected static function getCompiler($checkdir=TRUE) - { - static $compiler; - static $has_checkdir = FALSE; - - if (!$compiler) { - - /* Load needed files (to avoid autoload as much as possible) */ - $dir = dirname(__FILE__); - require_once "{$dir}/Haanga/AST.php"; - require_once "{$dir}/Haanga/Compiler.php"; - require_once "{$dir}/Haanga/Compiler/Runtime.php"; - require_once "{$dir}/Haanga/Compiler/Parser.php"; - require_once "{$dir}/Haanga/Compiler/Tokenizer.php"; - require_once "{$dir}/Haanga/Generator/PHP.php"; - require_once "{$dir}/Haanga/Extension.php"; - require_once "{$dir}/Haanga/Extension/Filter.php"; - require_once "{$dir}/Haanga/Extension/Tag.php"; - - /* load compiler (done just once) */ - if (self::$use_autoload) { - require_once "{$dir}/Haanga/Loader.php"; - } - - $compiler = new Haanga_Compiler_Runtime; - - if (self::$bootstrap) { - /* call bootstrap hook, just the first time */ - call_user_func(self::$bootstrap); - } - - if (count(self::$compiler) != 0) { - foreach (self::$compiler as $opt => $value) { - Haanga_Compiler::setOption($opt, $value); - } - } - - } - - if ($checkdir && !$has_checkdir) { - self::checkCacheDir(); - $has_checkdir = TRUE; - } - - $compiler->reset(); - return $compiler; - } - // }}} - - // callback compile(string $tpl, $context=array()) {{{ - /** - * Compile one template and return a PHP function - * - * @param string $tpl Template body - * @param array $context Context variables useful to generate efficient code (for array, objects and array) - * - * @return callback($vars=array(), $return=TRUE, $block=array()) - */ - public static function compile($tpl, $context=array()) - { - $compiler = self::getCompiler(FALSE); - - foreach ($context as $var => $value) { - $compiler->set_context($var, $value); - } - - $code = $compiler->compile($tpl); - - return create_function('$' . $compiler->getScopeVariable(NULL, TRUE) . '=array(), $return=TRUE, $blocks=array()', $code); - } - // }}} - - public static function getTemplatePath($file) - { - foreach (self::$templates_dir as $dir) { - $tpl = $dir .'/'.$file; - if (is_file($tpl)) { - return realpath($tpl); - } - } - throw new \RuntimeException("Cannot find {$file} file (looked in " . implode(",", self::$templates_dir) . ")"); - } - - // safe_load(string $file, array $vars, bool $return, array $blocks) {{{ - public static function Safe_Load($file, $vars = array(), $return=FALSE, $blocks=array()) - { - try { - - $tpl = self::getTemplatePath($file); - if (file_exists($tpl)) { - /* call load if the tpl file exists */ - return self::Load($file, $vars, $return, $blocks); - } - } Catch (Exception $e) { - } - /* some error but we don't care at all */ - return ""; - } - // }}} - - // load(string $file, array $vars, bool $return, array $blocks) {{{ - /** - * Load - * - * Load template. If the template is already compiled, just the compiled - * PHP file will be included an used. If the template is new, or it - * had changed, the Haanga compiler is loaded in memory, and the template - * is compiled. - * - * - * @param string $file - * @param array $vars - * @param bool $return - * @param array $blocks - * - * @return string|NULL - */ - public static function Load($file, $vars = array(), $return=FALSE, $blocks=array()) - { - if (empty(self::$cache_dir)) { - throw new Haanga_Exception("Cache dir or template dir is missing"); - } - - self::$has_compiled = FALSE; - - $tpl = self::getTemplatePath($file); - $fnc = sha1($tpl); - $callback = "haanga_".$fnc; - - if (is_callable($callback)) { - return $callback($vars, $return, $blocks); - } - - $php = self::$hash_filename ? $fnc : $file; - $php = self::$cache_dir.'/'.$php.'.php'; - - $check = TRUE; - - if (self::$check_ttl && self::$check_get && self::$check_set) { - /* */ - if (call_user_func(self::$check_get, $callback)) { - /* disable checking for the next $check_ttl seconds */ - $check = FALSE; - } else { - $result = call_user_func(self::$check_set, $callback, TRUE, self::$check_ttl); - } - } - - $mtpl = filemtime($tpl); - - if (!is_file($php) || ($check && $mtpl > filemtime($php))) { - if (!is_file($tpl)) { - /* There is no template nor compiled file */ - throw new Exception("View {$file} doesn't exists"); - } - - if (!is_dir(dirname($php))) { - $old = umask(0); - mkdir(dirname($php), 0777, TRUE); - umask($old); - } - - $fp = fopen($php, "a+"); - /* try to block PHP file */ - if (!flock($fp, LOCK_EX | LOCK_NB)) { - /* couldn't block, another process is already compiling */ - fclose($fp); - if (is_file($php)) { - /* - ** if there is an old version of the cache - ** load it - */ - require $php; - if (is_callable($callback)) { - return $callback($vars, $return, $blocks); - } - } - /* - ** no luck, probably the template is new - ** the compilation will be done, but we won't - ** save it (we'll use eval instead) - */ - unset($fp); - } - - /* recompile */ - $compiler = self::getCompiler(); - - if (self::$debug) { - $compiler->setDebug($php.".dump"); - } - - try { - $code = $compiler->compile_file($tpl, FALSE, $vars); - } catch (Exception $e) { - if (isset($fp)) { - /* - ** set the $php file as old (to force future - ** recompilation) - */ - touch($php, 300, 300); - chmod($php, 0777); - } - /* re-throw exception */ - throw $e; - } - - if (isset($fp)) { - ftruncate($fp, 0); // truncate file - fwrite($fp, "<?php".$code); - flock($fp, LOCK_UN); // release the lock - fclose($fp); - touch($php, $mtpl, $mtpl); - } else { - /* local eval */ - eval($code); - } - - self::$has_compiled = TRUE; - } - - if (!is_callable($callback)) { - /* Load the cached PHP file */ - require $php; - if (!is_callable($callback)) { - /* - really weird case ($php is empty, another process is compiling - the $tpl for the first time), so create a lambda function - for the template. - - To be safe we're invalidating its time, because its content - is no longer valid to us - */ - touch($php, 300, 300); - chmod($php, 0777); - - - // compile temporarily - $compiler = self::getCompiler(); - $code = $compiler->compile_file($tpl, FALSE, $vars); - eval($code); - - return $callback($vars, $return, $blocks); - } - } - - if (!isset($HAANGA_VERSION) || $HAANGA_VERSION != HAANGA_VERSION) { - touch($php, 300, 300); - chmod($php, 0777); - } - - return $callback($vars, $return, $blocks); - } - // }}} - -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/lib/Haanga/lib/Haanga/AST.php b/lib/Haanga/lib/Haanga/AST.php deleted file mode 100644 index d745b2edca087d89b609b6840ebde964d8d25ca8..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/AST.php +++ /dev/null @@ -1,548 +0,0 @@ -<?php -/* - +---------------------------------------------------------------------------------+ - | Copyright (c) 2010 César Rodas and Menéame Comunicacions S.L. | - +---------------------------------------------------------------------------------+ - | Redistribution and use in source and binary forms, with or without | - | modification, are permitted provided that the following conditions are met: | - | 1. Redistributions of source code must retain the above copyright | - | notice, this list of conditions and the following disclaimer. | - | | - | 2. Redistributions in binary form must reproduce the above copyright | - | notice, this list of conditions and the following disclaimer in the | - | documentation and/or other materials provided with the distribution. | - | | - | 3. All advertising materials mentioning features or use of this software | - | must display the following acknowledgement: | - | This product includes software developed by César D. Rodas. | - | | - | 4. Neither the name of the César D. Rodas nor the | - | names of its contributors may be used to endorse or promote products | - | derived from this software without specific prior written permission. | - | | - | THIS SOFTWARE IS PROVIDED BY CÉSAR D. RODAS ''AS IS'' AND ANY | - | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | - | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | - | DISCLAIMED. IN NO EVENT SHALL CÉSAR D. RODAS BE LIABLE FOR ANY | - | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | - | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | - | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | - | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | - | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | - | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE | - +---------------------------------------------------------------------------------+ - | Authors: César Rodas <crodas@php.net> | - +---------------------------------------------------------------------------------+ -*/ - -/** - * Simple AST (abstract syntax tree) helper class. This - * helps to generate array structure that is then translated by - * the Haanga_Generator class. - * - */ -class Haanga_AST -{ - public $stack = array(); - public $current = array(); - public $doesPrint = FALSE; - - - // getLast() {{{ - /** - * Return a refernce to the last element - * of the AST stack. - * - * @return array - */ - function & getLast() - { - $f = array(); - if (count($this->stack) == 0) { - return $f; - } - return $this->stack[count($this->stack)-1]; - } - // }}} - - - static protected function check_type($obj, $type) - { - if (is_string($obj)) { - return FALSE; - } - if (is_object($obj)) { - $obj = $obj->getArray(); - } - return isset($obj[$type]); - } - - public static function is_str($arr) - { - return self::check_type($arr, 'string'); - } - - public static function is_var($arr) - { - return self::check_type($arr, 'var'); - } - - public static function is_exec($arr) - { - return self::check_type($arr, 'exec'); - } - - public static function is_expr($arr) - { - return self::check_type($arr, 'op_expr'); - } - - - public static function str($string) - { - return array("string" => $string); - } - - public static function num($number) - { - return array("number" => $number); - } - - function stack_size() - { - return count($this->stack); - } - - function append_ast(Haanga_AST $obj) - { - $this->end(); - $obj->end(); - $this->stack = array_merge($this->stack, $obj->stack); - - return $this; - } - - static function constant($str) - { - return array('constant' => $str); - } - - function comment($str) - { - $this->stack[] = array("op" => "comment", 'comment' => $str); - - return $this; - } - - function declare_function($name) - { - $this->stack[] = array('op' => 'function', 'name' => $name); - - return $this; - } - - function do_return($name) - { - $this->getValue($name, $expr); - $this->stack[] = array('op' => 'return', $expr); - - return $this; - } - - function do_if($expr) - { - $this->getValue($expr, $vexpr); - $this->stack[] = array('op' => 'if', 'expr' => $vexpr); - - return $this; - } - - function do_else() - { - $this->stack[] = array('op' => 'else'); - - return $this; - } - - function do_endif() - { - $this->stack[] = array('op' => 'end_if'); - - return $this; - } - - function do_endfunction() - { - $this->stack[] = array('op' => 'end_function'); - - return $this; - } - - function v() - { - $var = array(); - foreach (func_get_args() as $id => $def) { - if ($id == 0) { - $var[$id] = $def; - } else { - $this->getValue($def, $value); - $var[$id] = $value; - } - } - if (count($var) == 1) { - $var = $var[0]; - } - $this->current = array('var' => $var); - - return $this; - } - - final function __get($property) - { - $property = strtolower($property); - if (isset($this->current[$property])) { - return $this->current[$property]; - } - return FALSE; - } - - static function fromArrayGetAST($obj) - { - $class = __CLASS__; - if ($obj InstanceOf $class) { - return $obj; - } - foreach (array('op_expr', 'expr_cond', 'exec', 'var', 'string', 'number', 'constant') as $type) { - if (isset($obj[$type])) { - $nobj = new $class; - $nobj->stack[] = $obj; - return $nobj; - } - } - } - - static function getValue($obj, &$value, $get_all=FALSE) - { - $class = __CLASS__; - - if ($obj InstanceOf $class) { - $value = $obj->getArray($get_all); - } else if (is_string($obj)) { - $value = self::str($obj); - } else if (is_numeric($obj) or $obj === 0) { - $value = self::num($obj); - } else if ($obj === FALSE) { - $value = array('expr' => FALSE); - } else if ($obj === TRUE) { - $value = array('expr' => TRUE); - } else if (is_array($obj)) { - foreach (array('expr_cond', 'op_expr', 'exec', 'var', 'string', 'number', 'constant') as $type) { - if (isset($obj[$type])) { - $value = $obj; - return; - } - } - $h = hcode()->arr(); - $first = 0; - foreach($obj as $key => $value) { - if ($key === $first) { - $key = NULL; - $first++; - } - $h->element($key, $value); - } - $value = $h->getArray(); - } else if ($obj === NULL) { - $value = array(); - } else { - var_Dump($obj); - throw new Exception("Imposible to get the value of the object"); - } - } - - function getArray($get_all=FALSE) - { - $this->end(); - if ($get_all) { - return $this->stack; - } - return isset($this->stack[0]) ? $this->stack[0] : NULL; - } - - function do_for($index, $min, $max, $step, Haanga_AST $body) - { - $def = array( - 'op' => 'for', - 'index' => $index, - 'min' => $min, - 'max' => $max, - 'step' => $step, - ); - - $this->stack[] = $def; - $this->stack = array_merge($this->stack, $body->getArray(TRUE)); - $this->stack[] = array('op' => 'end_for'); - - return $this; - } - - function do_foreach($array, $value, $key, Haanga_AST $body) - { - foreach (array('array', 'value', 'key') as $var) { - if ($$var === NULL) { - continue; - } - $var1 = & $$var; - if (is_string($var1)) { - $var1 = hvar($var1); - } - if (is_object($var1)) { - $var1 = $var1->getArray(); - } - if (empty($var1['var'])) { - throw new Exception("Can't iterate, apparently $var isn't a variable"); - } - $var1 = $var1['var']; - } - $def = array('op' => 'foreach', 'array' => $array, 'value' => $value); - if ($key) { - $def['key'] = $key; - } - $this->stack[] = $def; - $this->stack = array_merge($this->stack, $body->getArray(TRUE)); - $this->stack[] = array('op' => 'end_foreach'); - - return $this; - } - - function do_echo($stmt) - { - $this->getValue($stmt, $value); - $this->stack[] = array('op' => 'print', $value); - return $this; - } - - function do_global($array) - { - $this->stack[] = array('op' => 'global', 'vars' => $array); - - return $this; - } - - function do_exec() - { - $params = func_get_args(); - $exec = call_user_func_array('hexec', $params); - $this->stack[] = array('op' => 'expr', $exec->getArray()); - - return $this; - } - - function exec($function) - { - $this->current = array('exec' => $function, 'args' => array()); - foreach (func_get_args() as $id => $param) { - if ($id > 0) { - $this->param($param); - } - } - return $this; - } - - function expr($operation, $term1, $term2=NULL) - { - $this->getValue($term1, $value1); - if ($term2 !== NULL) { - $this->getValue($term2, $value2); - } else { - $value2 = NULL; - } - $this->current = array('op_expr' => $operation, $value1, $value2); - - return $this; - } - - function expr_cond($expr, $if_true, $if_false) - { - $this->getValue($expr, $vExpr); - $this->getValue($if_true, $vIfTrue); - $this->getValue($if_false, $vIfFalse); - - $this->current = array('expr_cond' => $vExpr, 'true' => $vIfTrue, 'false' => $vIfFalse); - - return $this; - } - - - function arr() - { - $this->current = array('array' => array()); - - return $this; - } - - function element($key=NULL, $value) - { - $last = & $this->current; - - if (!isset($last['array'])) { - throw new Exception("Invalid call to element()"); - } - - $this->getValue($value, $val); - if ($key !== NULL) { - $this->getValue($key, $kval); - $val = array('key' => array($kval, $val)); - } - $last['array'][] = $val; - } - - function decl_raw($name, $value) - { - if (is_string($name)) { - $name = hvar($name); - } - $this->getValue($name, $name); - $array = array('op' => 'declare', 'name' => $name['var']); - foreach (func_get_args() as $id => $value) { - if ($id != 0) { - $array[] = $value; - } - } - $this->stack[] = $array; - return $this; - } - - function decl($name, $value) - { - if (is_string($name)) { - $name = hvar($name); - } - $this->getValue($name, $name); - $array = array('op' => 'declare', 'name' => $name['var']); - foreach (func_get_args() as $id => $value) { - if ($id != 0) { - $this->getValue($value, $stmt); - $array[] = $stmt; - } - } - $this->stack[] = $array; - return $this; - } - - function append($name, $value) - { - if (is_string($name)) { - $name = hvar($name); - } - $this->getValue($value, $stmt); - $this->getValue($name, $name); - $this->stack[] = array('op' => 'append_var', 'name' => $name['var'], $stmt); - return $this; - } - - function param($param) - { - $last = & $this->current; - - if (!isset($last['exec'])) { - throw new Exception("Invalid call to param()"); - } - - $this->getValue($param, $value); - $last['args'][] = $value; - - return $this; - } - - function end() - { - if (count($this->current) > 0) { - $this->stack[] = $this->current; - $this->current = array(); - } - - return $this; - } -} - -function hcode() -{ - return new Haanga_AST; -} - -function hexpr($term1, $op='expr', $term2=NULL, $op2=NULL) -{ - $code = hcode(); - switch ($op2) { - case '+': - case '-': - case '/': - case '*': - case '%': - case '||': - case '&&': - case '<': - case '>': - case '<=': - case '>=': - case '==': - case '!=': - /* call recursive to resolve term2 */ - $args = func_get_args(); - $term2 = call_user_func_array('hexpr', array_slice($args, 2)); - break; - } - return $code->expr($op, $term1, $term2); -} - -function hexpr_cond($expr, $if_true, $if_false) -{ - $code = hcode(); - $code->expr_cond($expr, $if_true, $if_false); - - return $code; -} - -function hexec() -{ - $code = hcode(); - $args = func_get_args(); - return call_user_func_array(array($code, 'exec'), $args); -} - -function hconst($str) -{ - return Haanga_AST::Constant($str); -} - -// hvar() {{{ -/** - * Create the representation of a variable - * - * @return Haanga_AST - */ -function hvar() -{ - $args = func_get_args(); - return hvar_ex($args); -} - -function hvar_ex($args) -{ - $code = hcode(); - if (is_object($args)) { - return $args->stack[0]; - } - return call_user_func_array(array($code, 'v'), $args); -} -// }}} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/lib/Haanga/lib/Haanga/Compiler.php b/lib/Haanga/lib/Haanga/Compiler.php deleted file mode 100644 index f523bae00fbaff5d6ba04303047ca44d0724a7fb..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Compiler.php +++ /dev/null @@ -1,1541 +0,0 @@ -<?php -/* - +---------------------------------------------------------------------------------+ - | Copyright (c) 2010 César Rodas and Menéame Comunicacions S.L. | - +---------------------------------------------------------------------------------+ - | Redistribution and use in source and binary forms, with or without | - | modification, are permitted provided that the following conditions are met: | - | 1. Redistributions of source code must retain the above copyright | - | notice, this list of conditions and the following disclaimer. | - | | - | 2. Redistributions in binary form must reproduce the above copyright | - | notice, this list of conditions and the following disclaimer in the | - | documentation and/or other materials provided with the distribution. | - | | - | 3. All advertising materials mentioning features or use of this software | - | must display the following acknowledgement: | - | This product includes software developed by César D. Rodas. | - | | - | 4. Neither the name of the César D. Rodas nor the | - | names of its contributors may be used to endorse or promote products | - | derived from this software without specific prior written permission. | - | | - | THIS SOFTWARE IS PROVIDED BY CÉSAR D. RODAS ''AS IS'' AND ANY | - | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | - | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | - | DISCLAIMED. IN NO EVENT SHALL CÉSAR D. RODAS BE LIABLE FOR ANY | - | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | - | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | - | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | - | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | - | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | - | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE | - +---------------------------------------------------------------------------------+ - | Authors: César Rodas <crodas@php.net> | - +---------------------------------------------------------------------------------+ -*/ - -class Haanga_Compiler -{ - - // properties {{{ - protected static $block_var=NULL; - protected $generator; - protected $forloop = array(); - protected $forid = 0; - protected $sub_template = FALSE; - protected $name; - protected $check_function = FALSE; - protected $blocks=array(); - protected $line=0; - protected $file; - /** - * number of blocks :-) - */ - protected $in_block=0; - /** - * output buffers :-) - */ - protected $ob_start=0; - protected $append; - protected $prepend_op; - /** - * Context at compile time - */ - protected $context; - /** - * Table which contains all variables - * aliases defined in the template - */ - protected $var_alias; - /** - * Flag the current variable as safe. This means - * that escape won't be called if autoescape is - * activated (which is activated by default) - */ - public $var_is_safe=FALSE; - public $safes; - - /* compiler options */ - static protected $autoescape = TRUE; - static protected $if_empty = TRUE; - static protected $dot_as_object = TRUE; - static protected $strip_whitespace = FALSE; - static protected $is_exec_enabled = FALSE; - static protected $global_context = array(); - static protected $echo_concat = '.'; - static protected $enable_load = TRUE; - - /** - * Debug file - */ - protected $debug; - // }}} - - function __construct() - { - $this->generator = new Haanga_Generator_PHP; - if (self::$block_var===NULL) { - self::$block_var = '{{block.'.md5('super').'}}'; - } - } - - public function getScopeVariable($part = NULL, $string = FALSE) - { - static $var = NULL; - - if ($var === NULL) { - $var = 'vars' . uniqid(true); - } - - if ($string) { - return $var; - } - - if ($part !== NULL) { - return hvar($var, $part); - } - return hvar($var); - } - - // getOption($option) {{{ - public static function getOption($option) - { - $value = NULL; - switch (strtolower($option)) { - case 'enable_load': - $value = self::$enable_load; - break; - case 'if_empty': - $value = self::$if_empty; - break; - case 'autoescape': - $value = self::$autoescape; - break; - case 'dot_as_object': - $value = self::$dot_as_object; - break; - case 'echo_concat': - $value = self::$echo_concat; - break; - case 'strip_whitespace': - $value = self::$strip_whitespace; - break; - case 'is_exec_enabled': - case 'allow_exec': - $value = self::$is_exec_enabled; - break; - case 'global': - $value = self::$global_context; - break; - } - return $value; - } - // }}} - - // setOption($option, $value) {{{ - /** - * Set Compiler option. - * - * @return void - */ - public static function setOption($option, $value) - { - switch (strtolower($option)) { - case 'if_empty': - self::$if_empty = (bool)$value; - break; - case 'enable_load': - self::$enable_load = (bool)$value; - case 'echo_concat': - if ($value == '.' || $value == ',') { - self::$echo_concat = $value; - } - break; - - case 'autoescape': - self::$autoescape = (bool)$value; - break; - case 'dot_as_object': - self::$dot_as_object = (bool)$value; - break; - case 'strip_whitespace': - self::$strip_whitespace = (bool)$value; - break; - case 'is_exec_enabled': - case 'allow_exec': - self::$is_exec_enabled = (bool)$value; - break; - case 'global': - if (!is_array($value)) { - $value = array($value); - } - self::$global_context = $value; - break; - } - } - // }}} - - // setDebug($file) {{{ - function setDebug($file) - { - $this->debug = $file; - } - // }}} - - // reset() {{{ - function reset() - { - foreach (array_keys(get_object_vars($this)) as $key) { - if (isset($avoid_cleaning[$key])) { - continue; - } - $this->$key = NULL; - } - $this->generator = new Haanga_Generator_PHP; - $this->blocks = array(); - $this->cycle = array(); - } - // }}} - - // get_template_name() {{{ - final function get_template_name() - { - return $this->name; - } - // }}} - - // Set template name {{{ - function set_template_name($path) - { - $file = basename($path); - $pos = strpos($file,'.'); - return ($this->name = substr($file, 0, $pos)); - } - // }}} - - // get_function_name(string $name) {{{ - function get_function_name($name) - { - return "{$name}_template"; - } - // }}} - - // Compile ($code, $name=NULL) {{{ - final function compile($code, $name=NULL, $file=NULL) - { - $this->name = $name; - - if (count(self::$global_context) > 0) { - /* add global variables (if any) to the current context */ - foreach (self::$global_context as $var) { - $this->set_context($var, $GLOBALS[$var]); - } - } - - $parsed = Haanga_Compiler_Tokenizer::init($code, $this, $file); - $code = ""; - $this->subtemplate = FALSE; - - $body = new Haanga_AST; - $this->prepend_op = hcode(); - - if (isset($parsed[0]) && $parsed[0]['operation'] == 'base') { - /* {% base ... %} found */ - $base = $parsed[0][0]; - $code .= $this->get_base_template($base); - unset($parsed[0]); - } - - if (defined('HAANGA_VERSION')) { - $body->decl('HAANGA_VERSION', HAANGA_VERSION); - } - - if ($name) { - $func_name = $this->get_function_name($name); - if ($this->check_function) { - $body->do_if(hexpr(hexec('function_exists', $func_name), '===', FALSE)); - } - if (!empty($this->file)) { - $body->comment("Generated from ".$this->file); - } - - $body->declare_function($func_name); - } - if (count(self::$global_context) > 0) { - $body->do_global(self::$global_context); - } - - - $body->do_exec('extract', $this->getScopeVariable()); - $body->do_if(hexpr(hvar('return'), '==', TRUE)); - $body->do_exec('ob_start'); - $body->do_endif(); - - - $this->generate_op_code($parsed, $body); - if ($this->subtemplate) { - $expr = $this->expr_call_base_template(); - $this->do_print($body, $expr); - } - - $body->do_if(hexpr(hvar('return'), '==', TRUE)); - $body->do_return(hexec('ob_get_clean')); - $body->do_endif(); - - if ($name) { - $body->do_endfunction(); - if ($this->check_function) { - $body->do_endif(); - } - } - - if ($this->prepend_op->stack_size() > 0) { - $this->prepend_op->append_ast($body); - $body = $this->prepend_op; - } - - $op_code = $body->getArray(TRUE); - - - $code .= $this->generator->getCode($op_code, $this->getScopeVariable(NULL, TRUE)); - if (!empty($this->append)) { - $code .= $this->append; - } - - if (!empty($this->debug)) { - $op_code['php'] = $code; - file_put_contents($this->debug, print_r($op_code, TRUE), LOCK_EX); - } - return $code; - } - // }}} - - // compile_file($file) {{{ - /** - * Compile a file - * - * @param string $file File path - * @param bool $safe Whether or not add check if the function is already defined - * - * @return Generated PHP code - */ - final function compile_file($file, $safe=FALSE, $context=array()) - { - if (!is_readable($file)) { - throw new Haanga_Compiler_Exception("$file is not a file"); - } - - $this->_base_dir = dirname($file); - $this->file = realpath($file); - $this->line = 0; - $this->check_function = $safe; - $this->context = $context; - $name = $this->set_template_name($file); - try { - return $this->compile(file_get_contents($file), $name, $file); - } catch (Exception $e) { - $this->Error((string)$e); - } - } - // }}} - - // getOpCodes($code, $file='') {{{ - /** - * Compile the $code and return the "opcodes" - * (the Abstract syntax tree). - * - * @param string $code Template content - * @param string $file File path (used for erro reporting) - * - * @return Haanga_AST - * - */ - public function getOpCodes($code, $file) - { - $oldfile = $this->file; - $this->file = $file; - $parsed = Haanga_Compiler_Tokenizer::init($code, $this, $file); - $body = new Haanga_AST; - if (isset($parsed[0]) && $parsed[0]['operation'] == 'base') { - throw new Exception("{% base is not supported on inlines %}"); - } - $body = new Haanga_AST; - $this->generate_op_code($parsed, $body); - $this->file = $oldfile; - return $body; - } - // }}} - - // Error($errtxt) {{{ - /** - * Throw an exception and appends information about the template (the path and - * the last processed line). - * - * - */ - public function Error($err) - { - throw new Haanga_Compiler_Exception("{$err} in {$this->file}:$this->line"); - } - // }}} - - // is_expr methods {{{ - function is_var_filter($cmd) - { - return isset($cmd['var_filter']); - } - - // }}} - - // expr_call_base_template() {{{ - /** - * Generate code to call base template - * - */ - function expr_call_base_template() - { - return hexec( - $this->get_function_name($this->subtemplate), - $this->getScopeVariable(), TRUE, - hvar('blocks') - ); - } - // }}} - - // get_base_template($base) {{{ - /** - * Handle {% base "" %} definition. By default only - * static (string) are supported, but this can be overrided - * on subclasses. - * - * This method load the base class, compile it and return - * the generated code. - * - * @param array $base Base structure - * - * @return string Generated source code - */ - function get_base_template($base) - { - if (!Haanga_AST::is_str($base)) { - throw new Exception("Dynamic inheritance is not supported for compilated templates"); - } - $file = $base['string']; - list($this->subtemplate, $new_code) = $this->compile_required_template($file); - return $new_code."\n\n"; - } - // }}} - - // {% base "foo.html" %} {{{ - protected function generate_op_base() - { - throw new Exception("{% base %} can be only as first statement"); - } - // }}} - - // Main Loop {{{ - protected function generate_op_code($parsed, &$body) - { - if (!is_array($parsed)) { - throw new Exception("Invalid \$parsed array"); - } - foreach ($parsed as $op) { - if (!is_array($op)) { - continue; - } - if (!isset($op['operation'])) { - throw new Exception("Malformed array:".print_r($op, TRUE)); - } - if (isset($op['line'])) { - $this->line = $op['line']; - } - - if ($this->subtemplate && $this->in_block == 0 && $op['operation'] != 'block') { - /* ignore most of tokens in subtemplates */ - continue; - } - - $method = "generate_op_".$op['operation']; - if (!is_callable(array($this, $method))) { - throw new Exception("Compiler: Missing method $method"); - } - $this->$method($op, $body); - } - } - // }}} - - // Check the current expr {{{ - protected function check_expr(&$expr) - { - if (Haanga_AST::is_expr($expr)) { - if ($expr['op_expr'] == 'in') { - for ($id=0; $id < 2; $id++) { - if ($this->is_var_filter($expr[$id])) { - $expr[$id] = $this->get_filtered_var($expr[$id]['var_filter'], $var); - } - } - if (Haanga_AST::is_str($expr[1])) { - $expr = hexpr(hexec('strpos', $expr[1], $expr[0]), '!==', FALSE); - } else { - $expr = hexpr( - hexpr_cond( - hexec('is_array', $expr[1]), - hexec('array_search', $expr[0], $expr[1]), - hexec('strpos', $expr[1], $expr[0]) - ) - ,'!==', FALSE - ); - } - } - if (is_object($expr)) { - $expr = $expr->getArray(); - } - $this->check_expr($expr[0]); - $this->check_expr($expr[1]); - } else if (is_array($expr)) { - if ($this->is_var_filter($expr)) { - $expr = $this->get_filtered_var($expr['var_filter'], $var); - } else if (isset($expr['args'])) { - /* check every arguments */ - foreach ($expr['args'] as &$v) { - $this->check_expr($v); - } - unset($v); - } else if (isset($expr['expr_cond'])) { - /* Check expr conditions */ - $this->check_expr($expr['expr_cond']); - $this->check_expr($expr['true']); - $this->check_expr($expr['false']); - } - } - } - // }}} - - // ifequal|ifnot equal <var_filtered|string|number> <var_fitlered|string|number> ... else ... {{{ - protected function generate_op_ifequal($details, &$body) - { - $if['expr'] = hexpr($details[1], $details['cmp'], $details[2])->getArray(); - $if['body'] = $details['body']; - if (isset($details['else'])) { - $if['else'] = $details['else']; - } - $this->generate_op_if($if, $body); - } - // }}} - - // {% if <expr> %} HTML {% else %} TWO {% endif $} {{{ - protected function generate_op_if($details, &$body) - { - if (self::$if_empty && $this->is_var_filter($details['expr']) && count($details['expr']['var_filter']) == 1) { - /* if we are doing if <Variable> it should check - if it exists without throw any warning */ - $expr = $details['expr']; - $expr['var_filter'][] = 'empty'; - - $variable = $this->get_filtered_var($expr['var_filter'], $var); - - $details['expr'] = hexpr($variable, '===', FALSE)->getArray(); - } - $this->check_expr($details['expr']); - $expr = Haanga_AST::fromArrayGetAST($details['expr']); - $body->do_if($expr); - $this->generate_op_code($details['body'], $body); - if (isset($details['else'])) { - $body->do_else(); - $this->generate_op_code($details['else'], $body); - } - $body->do_endif(); - } - // }}} - - // Override template {{{ - protected function compile_required_template($file) - { - if (!is_file($file)) { - if (isset($this->_base_dir)) { - $file = $this->_base_dir.'/'.$file; - } - } - if (!is_file($file)) { - throw new Exception("can't find {$file} file template"); - } - $class = get_class($this); - $comp = new $class; - $comp->reset(); - $code = $comp->compile_file($file, $this->check_function); - return array($comp->get_template_name(), $code); - } - // }}} - - // include "file.html" | include <var1> {{{ - protected function generate_op_include($details, &$body) - { - if (!$details[0]['string']) { - throw new Exception("Dynamic inheritance is not supported for compilated templates"); - } - list($name,$code) = $this->compile_required_template($details[0]['string']); - $this->append .= "\n\n{$code}"; - $this->do_print($body, - hexec($this->get_function_name($name), - $this->getScopeVariable(), TRUE, hvar('blocks')) - ); - } - // }}} - - // Handle HTML code {{{ - protected function generate_op_html($details, &$body) - { - $string = Haanga_AST::str($details['html']); - $this->do_print($body, $string); - } - // }}} - - function isMethod($varname, &$expr) - { - if (is_array($varname)) { - $tmp = $varname; - $method = array_pop($tmp); - $object = $this->get_context($tmp); - if (!empty($method['object']) && is_string($method['object'])) { - $property = $method['object']; - if (is_object($object) && !isset($object->$property) && is_callable(array($object, $property))) { - $expr = hexec($varname); - return TRUE; - } - } - } - return FALSE; - } - - // get_var_filtered {{{ - /** - * This method handles all the filtered variable (piped_list(X)'s - * output in the parser. - * - * - * @param array $variable (Output of piped_list(B) (parser)) - * @param array &$varname Variable name - * @param bool $accept_string TRUE is string output are OK (ie: block.parent) - * - * @return expr - * - */ - function get_filtered_var($variable, &$varname, $accept_string=NULL) - { - $this->var_is_safe = FALSE; - - if ($accept_string === NULL && is_array($variable[0]) && - !Haanga_AST::is_exec($variable[0])) { - $accept_string = !empty($variable[0]['string']) - || $variable[0][0] === 'block'; - } - - if (count($variable) > 1) { - $count = count($variable); - if ($accept_string && isset($variable[0]['string'])) { - $target = $variable[0]; - } else if (Haanga_AST::is_exec($variable[0])) { - $target = $variable[0]; - } else { - $target = $this->generate_variable_name($variable[0]); - } - - if (!empty($variable[0][0]) && $variable[0][0] == 'block') { - /* block.super can't have any filter */ - throw new Exception("This variable can't have any filter"); - } - - if (!empty($target['var']) && $this->isMethod($target['var'], $return)) { - $target = $return; - } - - for ($i=1; $i < $count; $i++) { - $func_name = $variable[$i]; - if ($func_name == 'escape') { - /* to avoid double cleaning */ - $this->var_is_safe = TRUE; - } - $args = array(isset($exec) ? $exec : $target); - $exec = $this->do_filtering($func_name, $args); - } - unset($variable); - $varname = $args[0]; - $details = $exec; - } else { - if (Haanga_AST::is_exec($variable[0])) { - return $variable[0]; - } - - $details = $this->generate_variable_name($variable[0]); - $varname = $variable[0]; - - if ($this->isMethod($varname, $return)) { - return $return; - } - - if (!Haanga_AST::is_var($details) && !$accept_string) { - /* generate_variable_name didn't replied a variable, weird case - currently just used for {{block.super}}. - */ - throw new Exception("Invalid variable name {$variable[0]}"); - } - } - - return $details; - } - // }}} - - // generate_op_print_var {{{ - /** - * Generate code to print a variable with its filters, if there is any. - * - * All variable (except those flagged as |safe) are automatically - * escaped if autoescape is "on". - * - */ - protected function generate_op_print_var($details, &$body) - { - $expr = $details['expr']; - $this->check_expr($expr); - - - if (!$this->is_safe($expr) && self::$autoescape) { - $args = array($expr); - $expr = $this->do_filtering('escape', $args); - } - - $this->do_print($body, $expr); - } - // }}} - - // {# something #} {{{ - protected function generate_op_comment($details, &$body) - { - /* comments are annoying */ - //$body->comment($details['comment']); - } - // }}} - - // {% block 'name' %} ... {% endblock %} {{{ - protected function generate_op_block($details, &$body) - { - if (is_array($details['name'])) { - $name = ""; - foreach ($details['name'] as $part) { - if (is_string($part)) { - $name .= "{$part}"; - } else if (is_array($part)) { - if (Haanga_AST::is_str($part)) { - $name .= "{$part['string']}"; - } elseif (isset($part['object'])) { - $name .= "{$part['object']}"; - } else { - throw new Exception("Invalid blockname"); - } - } - $name .= "."; - } - $details['name'] = substr($name, 0, -1); - } - $this->in_block++; - $this->blocks[] = $details['name']; - $block_name = hvar('blocks', $details['name']); - - $this->ob_start($body); - $buffer_var = 'buffer'.$this->ob_start; - - $content = hcode(); - $this->generate_op_code($details['body'], $content); - - $body->append_ast($content); - $this->ob_start--; - - $buffer = hvar($buffer_var); - - /* {{{ */ - /** - * isset previous block (parent block)? - * TRUE - * has reference to self::$block_var ? - * TRUE - * replace self::$block_var for current block value (buffer) - * FALSE - * print parent block - * FALSE - * print current block - * - */ - $declare = hexpr_cond( - hexec('isset', $block_name), - hexpr_cond( - hexpr(hexec('strpos', $block_name, self::$block_var), '===', FALSE), - $block_name, - hexec('str_replace', self::$block_var, $buffer, $block_name) - ), $buffer); - /* }}} */ - - if (!$this->subtemplate) { - $this->do_print($body, $declare); - } else { - $body->decl($block_name, $declare); - if ($this->in_block > 1) { - $this->do_print($body, $block_name); - } - } - array_pop($this->blocks); - $this->in_block--; - - } - // }}} - - // regroup <var1> by <field> as <foo> {{{ - protected function generate_op_regroup($details, &$body) - { - $body->comment("Temporary sorting"); - - $array = $this->get_filtered_var($details['array'], $varname); - - if (Haanga_AST::is_exec($array)) { - $varname = hvar($details['as']); - $body->decl($varname, $array); - } - $var = hvar('item', $details['row']); - - $body->decl('temp_group', array()); - - $body->do_foreach($varname, 'item', NULL, - hcode()->decl(hvar('temp_group', $var, NULL), hvar('item')) - ); - - $body->comment("Proper format"); - $body->decl($details['as'], array()); - $body->do_foreach('temp_group', 'item', 'group', - hcode()->decl( - hvar($details['as'], NULL), - array("grouper" => hvar('group'), "list" => hvar('item')) - ) - ); - $body->comment("Sorting done"); - } - // }}} - - // variable context {{{ - /** - * Variables context - * - * These two functions are useful to detect if a variable - * separated by dot (foo.bar) is an array or object. To avoid - * overhead we decide it at compile time, rather than - * ask over and over at rendering time. - * - * foo.bar: - * + If foo exists at compile time, - * and it is an array, it would be foo['bar'] - * otherwise it'd be foo->bar. - * + If foo don't exists at compile time, - * it would be foo->bar if the compiler option - * dot_as_object is TRUE (by default) otherwise - * it'd be foo['bar'] - * - * @author crodas - * @author gallir (ideas) - * - */ - function set_context($varname, $value) - { - $this->context[$varname] = $value; - } - - function get_context($variable) - { - if (!is_array($variable)) { - $variable = array($variable); - } - $varname = $variable[0]; - if (isset($this->context[$varname])) { - if (count($variable) == 1) { - return $this->context[$varname]; - } - $var = & $this->context[$varname]; - foreach ($variable as $id => $part) { - if ($id != 0) { - if (is_array($part) && isset($part['object'])) { - if (is_array($part['object']) && isset($part['object']['var'])) { - /* object $foo->$bar */ - $name = $part['object']['var']; - $name = $this->get_context($name); - if (!isset($var->$name)) { - return NULL; - } - $var = &$var->$name; - } else { - if (!isset($var->{$part['object']})) { - return NULL; - } - $var = &$var->{$part['object']}; - } - } else if (is_object($var)) { - if (!isset($var->$part)) { - return NULL; - } - $var = &$var->$part; - } else { - if (!is_scalar($part) || empty($part) || !isset($var[$part])) { - return NULL; - } - $var = &$var[$part]; - } - } - } - $variable = $var; - unset($var); - return $variable; - } - - return NULL; - } - - function var_is_object(Array $variable, $default=NULL) - { - $varname = $variable[0]; - switch ($varname) { - case 'GLOBALS': - case '_SERVER': - case '_GET': - case '_POST': - case '_FILES': - case '_COOKIE': - case '_SESSION': - case '_REQUEST': - case '_ENV': - case 'forloop': - case 'block': - return FALSE; /* these are arrays */ - } - - $variable = $this->get_context($variable); - if (is_array($variable) || is_object($variable)) { - return $default ? is_object($variable) : is_object($variable) && !$variable InstanceOf Iterator && !$variable Instanceof ArrayAccess; - } - - return $default===NULL ? self::$dot_as_object : $default; - } - // }}} - - // Get variable name {{{ - function generate_variable_name($variable, $special=true) - { - if (is_array($variable)) { - switch ($variable[0]) { - case 'forloop': - if (!$special) { - return array('var' => $variable); - } - if (!$this->forid) { - throw new Exception("Invalid forloop reference outside of a loop"); - } - - switch ($variable[1]['object']) { - case 'counter': - $this->forloop[$this->forid]['counter'] = TRUE; - $variable = 'forcounter1_'.$this->forid; - break; - case 'counter0': - $this->forloop[$this->forid]['counter0'] = TRUE; - $variable = 'forcounter0_'.$this->forid; - break; - case 'last': - $this->forloop[$this->forid]['counter'] = TRUE; - $this->forloop[$this->forid]['last'] = TRUE; - $variable = 'islast_'.$this->forid; - break; - case 'first': - $this->forloop[$this->forid]['first'] = TRUE; - $variable = 'isfirst_'.$this->forid; - break; - case 'revcounter': - $this->forloop[$this->forid]['revcounter'] = TRUE; - $variable = 'revcount_'.$this->forid; - break; - case 'revcounter0': - $this->forloop[$this->forid]['revcounter0'] = TRUE; - $variable = 'revcount0_'.$this->forid; - break; - case 'parentloop': - unset($variable[1]); - $this->forid--; - $variable = $this->generate_variable_name(array_values($variable)); - $variable = $variable['var']; - $this->forid++; - break; - default: - throw new Exception("Unexpected forloop.{$variable[1]}"); - } - /* no need to escape it */ - $this->var_is_safe = TRUE; - break; - case 'block': - if (!$special) { - return array('var' => $variable); - } - if ($this->in_block == 0) { - throw new Exception("Can't use block.super outside a block"); - } - if (!$this->subtemplate) { - throw new Exception("Only subtemplates can call block.super"); - } - /* no need to escape it */ - $this->var_is_safe = TRUE; - return Haanga_AST::str(self::$block_var); - break; - default: - /* choose array or objects */ - - if ($special) { - // this section is resolved on the parser.y - return array('var' => $variable); - } - - for ($i=1; $i < count($variable); $i++) { - $var_part = array_slice($variable, 0, $i); - $def_arr = TRUE; - - if (is_array($variable[$i])) { - if (isset($variable[$i]['class'])) { - // no type guess for static properties - continue; - } - if (isset($variable[$i]['object'])) { - $def_arr = FALSE; - } - if (!Haanga_AST::is_var($variable[$i])) { - $variable[$i] = current($variable[$i]); - } else { - $variable[$i] = $this->generate_variable_name($variable[$i]['var']); - } - } - - $is_obj = $this->var_is_object($var_part, 'unknown'); - - if ( $is_obj === TRUE || ($is_obj == 'unknown' && !$def_arr)) { - $variable[$i] = array('object' => $variable[$i]); - } - } - - break; - } - - } else if (isset($this->var_alias[$variable])) { - $variable = $this->var_alias[$variable]['var']; - } - - return hvar($variable)->getArray(); - } - // }}} - - // Print {{{ - public function do_print(Haanga_AST $code, $stmt) - { - /* Flag this object as a printing one */ - $code->doesPrint = TRUE; - - if (self::$strip_whitespace && Haanga_AST::is_str($stmt)) { - $stmt['string'] = preg_replace('/\s+/', ' ', $stmt['string']); - } - - if ($this->ob_start == 0) { - $code->do_echo($stmt); - return; - } - - $buffer = hvar('buffer'.$this->ob_start); - $code->append($buffer, $stmt); - - } - - // }}} - - // for [<key>,]<val> in <array> {{{ - protected function generate_op_loop($details, &$body) - { - if (isset($details['empty'])) { - $body->do_if(hexpr(hexec('count', hvar($details['array'])), '==', 0)); - $this->generate_op_code($details['empty'], $body); - $body->do_else(); - } - - /* ForID */ - $oldid = $this->forid; - $this->forid = $oldid+1; - $this->forloop[$this->forid] = array(); - - if (isset($details['range'])) { - $this->set_safe($details['variable']); - } else { - /* check variable context */ - - /* Check if the array to iterate is an object */ - $var = &$details['array'][0]; - if (is_string($var) && $this->var_is_object(array($var), FALSE)) { - /* It is an object, call to get_object_vars */ - $body->decl($var.'_arr', hexec('get_object_vars', hvar($var))); - $var .= '_arr'; - } - unset($var); - /* variables */ - $array = $this->get_filtered_var($details['array'], $varname); - - /* Loop body */ - if ($this->is_safe(hvar($varname))) { - $this->set_safe(hvar($details['variable'])); - } - - if ($array Instanceof Haanga_AST) { - // filtered var - $tmp = hvar('tmp'.($oldid+1)); - $body->decl($tmp, $array); - $array = $tmp; - } - $details['array'] = $array; - } - - /* for_body {{{ */ - $for_body = hcode(); - $this->generate_op_code($details['body'], $for_body); - - - $oid = $this->forid; - $size = hvar('psize_'.$oid); - - // counter {{{ - if (isset($this->forloop[$oid]['counter'])) { - $var = hvar('forcounter1_'.$oid); - $body->decl($var, 1); - $for_body->decl($var, hexpr($var, '+', 1)); - } - // }}} - - // counter0 {{{ - if (isset($this->forloop[$oid]['counter0'])) { - $var = hvar('forcounter0_'.$oid); - $body->decl($var, 0); - $for_body->decl($var, hexpr($var, '+', 1)); - } - // }}} - - // last {{{ - if (isset($this->forloop[$oid]['last'])) { - if (!isset($cnt)) { - $body->decl('psize_'.$oid, hexec('count', hvar_ex($details['array']))); - $cnt = TRUE; - } - $var = 'islast_'.$oid; - $body->decl($var, hexpr(hvar('forcounter1_'.$oid), '==', $size)); - $for_body->decl($var, hexpr(hvar('forcounter1_'.$oid), '==', $size)); - } - // }}} - - // first {{{ - if (isset($this->forloop[$oid]['first'])) { - $var = hvar('isfirst_'.$oid); - $body->decl($var, TRUE); - $for_body->decl($var, FALSE); - } - // }}} - - // revcounter {{{ - if (isset($this->forloop[$oid]['revcounter'])) { - if (!isset($cnt)) { - $body->decl('psize_'.$oid, hexec('count', hvar_ex($details['array']))); - $cnt = TRUE; - } - $var = hvar('revcount_'.$oid); - $body->decl($var, $size); - $for_body->decl($var, hexpr($var, '-', 1)); - } - // }}} - - // revcounter0 {{{ - if (isset($this->forloop[$oid]['revcounter0'])) { - if (!isset($cnt)) { - $body->decl('psize_'.$oid, hexec('count', hvar_ex($details['array']))); - $cnt = TRUE; - } - $var = hvar('revcount0_'.$oid); - $body->decl($var, hexpr($size, "-", 1)); - $for_body->decl($var, hexpr($var, '-', 1)); - } - // }}} - - /* }}} */ - - /* Restore old ForID */ - $this->forid = $oldid; - - /* Merge loop body */ - if (!isset($details['range'])) { - $body->do_foreach($array, $details['variable'], $details['index'], $for_body); - - if ($this->is_safe(hvar($varname))) { - $this->set_unsafe($details['variable']); - } - } else { - for ($i=0; $i < 2; $i++) { - if (Haanga_AST::is_var($details['range'][$i])) { - $details['range'][$i] = $this->generate_variable_name($details['range'][$i]['var']); - } - } - - if (Haanga_AST::is_var($details['step'])) { - $details['step'] = $this->generate_variable_name($details['step']['var']); - } - $body->do_for($details['variable'], $details['range'][0], $details['range'][1], $details['step'], $for_body); - $this->set_unsafe(hvar($details['variable'])); - } - - if (isset($details['empty'])) { - $body->do_endif(); - } - } - // }}} - - function generate_op_set($details, &$body) - { - $var = $this->generate_variable_name($details['var']); - $this->check_expr($details['expr']); - $body->decl_raw($var, $details['expr']); - $body->decl($this->getScopeVariable($var['var']), $var); - } - - - // ifchanged [<var1> <var2] {{{ - protected function generate_op_ifchanged($details, &$body) - { - static $ifchanged = 0; - - $ifchanged++; - $var1 = 'ifchanged'.$ifchanged; - if (!isset($details['check'])) { - /* ugly */ - $this->ob_start($body); - $var2 = hvar('buffer'.$this->ob_start); - - - $this->generate_op_code($details['body'], $body); - $this->ob_start--; - $body->do_if(hexpr(hexec('isset', hvar($var1)), '==', FALSE, '||', hvar($var1), '!=', $var2)); - $this->do_print($body, $var2); - $body->decl($var1, $var2); - } else { - /* beauty :-) */ - foreach ($details['check'] as $id=>$type) { - if (!Haanga_AST::is_var($type)) { - throw new Exception("Unexpected string {$type['string']}, expected a varabile"); - } - - $this_expr = hexpr(hexpr( - hexec('isset', hvar($var1, $id)), '==', FALSE, - '||', hvar($var1, $id), '!=', $type - )); - - if (isset($expr)) { - $this_expr = hexpr($expr, '||', $this_expr); - } - - $expr = $this_expr; - - } - $body->do_if($expr); - $this->generate_op_code($details['body'], $body); - $body->decl($var1, $details['check']); - } - - if (isset($details['else'])) { - $body->do_else(); - $this->generate_op_code($details['else'], $body); - } - $body->do_endif(); - } - // }}} - - // autoescape ON|OFF {{{ - function generate_op_autoescape($details, &$body) - { - $old_autoescape = self::$autoescape; - self::$autoescape = strtolower($details['value']) == 'on'; - $this->generate_op_code($details['body'], $body); - self::$autoescape = $old_autoescape; - } - // }}} - - // {% spacefull %} Set to OFF strip_whitespace for a block (the compiler option) {{{ - function generate_op_spacefull($details, &$body) - { - $old_strip_whitespace = self::$strip_whitespace; - self::$strip_whitespace = FALSE; - $this->generate_op_code($details['body'], $body); - self::$strip_whitespace = $old_strip_whitespace; - } - // }}} - - // ob_Start(array &$body) {{{ - /** - * Start a new buffering - * - */ - function ob_start(&$body) - { - $this->ob_start++; - $body->decl('buffer'.$this->ob_start, ""); - } - // }}} - - // Custom Tags {{{ - function get_custom_tag($name) - { - $function = $this->get_function_name($this->name).'_tag_'.$name; - $this->append .= "\n\n".Haanga_Extension::getInstance('Tag')->getFunctionBody($name, $function); - return $function; - } - - /** - * Generate needed code for custom tags (tags that aren't - * handled by the compiler). - * - */ - function generate_op_custom_tag($details, &$body) - { - static $tags; - if (!$tags) { - $tags = Haanga_Extension::getInstance('Tag'); - } - - foreach ($details['list'] as $id => $arg) { - if (Haanga_AST::is_var($arg)) { - $details['list'][$id] = $this->generate_variable_name($arg['var']); - } - } - - - $tag_name = $details['name']; - $tagFunction = $tags->getFunctionAlias($tag_name); - - if (!$tagFunction && !$tags->hasGenerator($tag_name)) { - $function = $this->get_custom_tag($tag_name, isset($details['as'])); - } else { - $function = $tagFunction; - } - if (isset($details['body'])) { - /* - if the custom tag has 'body' - then it behave the same way as a filter - */ - $this->ob_start($body); - $this->generate_op_code($details['body'], $body); - $target = hvar('buffer'.$this->ob_start); - if ($tags->hasGenerator($tag_name)) { - $args = array_merge(array($target), $details['list']); - $exec = $tags->generator($tag_name, $this, $args); - if (!$exec InstanceOf Haanga_AST) { - throw new Exception("Invalid output of custom filter {$tag_name}"); - } - if ($exec->stack_size() >= 2 || $exec->doesPrint) { - /* - The generator returned more than one statement, - so we assume the output is already handled - by one of those stmts. - */ - $body->append_ast($exec); - $this->ob_start--; - return; - } - } else { - $exec = hexec($function, $target); - } - $this->ob_start--; - $this->do_print($body, $exec); - return; - } - - $var = isset($details['as']) ? $details['as'] : NULL; - $args = array_merge(array($function), $details['list']); - - if ($tags->hasGenerator($tag_name)) { - $exec = $tags->generator($tag_name, $this, $details['list'], $var); - if ($exec InstanceOf Haanga_AST) { - if ($exec->stack_size() >= 2 || $exec->doesPrint || $var !== NULL) { - /* - The generator returned more than one statement, - so we assume the output is already handled - by one of those stmts. - */ - $body->append_ast($exec); - return; - } - } else { - throw new Exception("Invalid output of the custom tag {$tag_name}"); - } - } else { - $fnc = array_shift($args); - $exec = hexec($fnc); - foreach ($args as $arg) { - $exec->param($arg); - } - } - - if ($var) { - $body->decl($var, $exec); - } else { - $this->do_print($body, $exec); - } - } - // }}} - - // with <variable> as <var> {{{ - /** - * - * - */ - function generate_op_alias($details, &$body) - { - $this->var_alias[ $details['as'] ] = $this->generate_variable_name($details['var']); - $this->generate_op_code($details['body'], $body); - unset($this->var_alias[ $details['as'] ] ); - } - // }}} - - // Custom Filters {{{ - function get_custom_filter($name) - { - $function = $this->get_function_name($this->name).'_filter_'.$name; - $this->append .= "\n\n".Haanga_Extension::getInstance('Filter')->getFunctionBody($name, $function); - return $function; - } - - - function do_filtering($name, $args) - { - static $filter; - if (!$filter) { - $filter = Haanga_Extension::getInstance('Filter'); - } - - if (is_array($name)) { - /* - prepare array for ($func_name, $arg1, $arg2 ... ) - where $arg1 = last expression and $arg2.. $argX is - defined in the template - */ - $args = array_merge($args, $name['args']); - $name = $name[0]; - } - - if (!$filter->isValid($name)) { - throw new Exception("{$name} is an invalid filter"); - } - - if ($filter->isSafe($name)) { - /* check if the filter is return HTML-safe data (to avoid double scape) */ - $this->var_is_safe = TRUE; - } - - - if ($filter->hasGenerator($name)) { - return $filter->generator($name, $this, $args); - } - $fnc = $filter->getFunctionAlias($name); - if (!$fnc) { - $fnc = $this->get_custom_filter($name); - } - - $args = array_merge(array($fnc), $args); - $exec = call_user_func_array('hexec', $args); - - return $exec; - } - - function generate_op_filter($details, &$body) - { - $this->ob_start($body); - $this->generate_op_code($details['body'], $body); - $target = hvar('buffer'.$this->ob_start); - foreach ($details['functions'] as $f) { - $param = (isset($exec) ? $exec : $target); - $exec = $this->do_filtering($f, array($param)); - } - $this->ob_start--; - $this->do_print($body, $exec); - } - // }}} - - /* variable safety {{{ */ - function set_safe($name) - { - if (!Haanga_AST::is_Var($name)) { - $name = hvar($name)->getArray(); - } - $this->safes[serialize($name)] = TRUE; - } - - function set_unsafe($name) - { - if (!Haanga_AST::is_Var($name)) { - $name = hvar($name)->getArray(); - } - unset($this->safes[serialize($name)]); - } - - function is_safe($name) - { - if ($this->var_is_safe) { - return TRUE; - } - if (isset($this->safes[serialize($name)])) { - return TRUE; - } - return FALSE; - } - /* }}} */ - - final static function main_cli() - { - $argv = $GLOBALS['argv']; - $haanga = new Haanga_Compiler; - $code = $haanga->compile_file($argv[1], TRUE); - if (!isset($argv[2]) || $argv[2] != '--notags') { - $code = "<?php\n\n$code"; - } - echo $code; - } - -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/lib/Haanga/lib/Haanga/Compiler/Exception.php b/lib/Haanga/lib/Haanga/Compiler/Exception.php deleted file mode 100644 index 5fbfec0ddc9270fe389c9137d33f8accd504f26e..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Compiler/Exception.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/* - +---------------------------------------------------------------------------------+ - | Copyright (c) 2010 César Rodas and Menéame Comunicacions S.L. | - +---------------------------------------------------------------------------------+ - | Redistribution and use in source and binary forms, with or without | - | modification, are permitted provided that the following conditions are met: | - | 1. Redistributions of source code must retain the above copyright | - | notice, this list of conditions and the following disclaimer. | - | | - | 2. Redistributions in binary form must reproduce the above copyright | - | notice, this list of conditions and the following disclaimer in the | - | documentation and/or other materials provided with the distribution. | - | | - | 3. All advertising materials mentioning features or use of this software | - | must display the following acknowledgement: | - | This product includes software developed by César D. Rodas. | - | | - | 4. Neither the name of the César D. Rodas nor the | - | names of its contributors may be used to endorse or promote products | - | derived from this software without specific prior written permission. | - | | - | THIS SOFTWARE IS PROVIDED BY CÉSAR D. RODAS ''AS IS'' AND ANY | - | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | - | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | - | DISCLAIMED. IN NO EVENT SHALL CÉSAR D. RODAS BE LIABLE FOR ANY | - | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | - | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | - | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | - | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | - | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | - | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE | - +---------------------------------------------------------------------------------+ - | Authors: César Rodas <crodas@php.net> | - +---------------------------------------------------------------------------------+ -*/ - -// Exception Class {{{ -/** - * Exception class - * - */ -class Haanga_Compiler_Exception extends Exception -{ -} -// }}} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/lib/Haanga/lib/Haanga/Compiler/Parser.php b/lib/Haanga/lib/Haanga/Compiler/Parser.php deleted file mode 100644 index 4e0b94210c23b8b4d3c2218262c52a82a20e4ee9..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Compiler/Parser.php +++ /dev/null @@ -1,2428 +0,0 @@ -<?php -/* Driver template for the PHP_Haanga_rGenerator parser generator. (PHP port of LEMON) -*/ - -/** - * This can be used to store both the string representation of - * a token, and any useful meta-data associated with the token. - * - * meta-data should be stored as an array - */ -class Haanga_yyToken implements ArrayAccess -{ - public $string = ''; - public $metadata = array(); - - function __construct($s, $m = array()) - { - if ($s instanceof Haanga_yyToken) { - $this->string = $s->string; - $this->metadata = $s->metadata; - } else { - $this->string = (string) $s; - if ($m instanceof Haanga_yyToken) { - $this->metadata = $m->metadata; - } elseif (is_array($m)) { - $this->metadata = $m; - } - } - } - - function __toString() - { - return $this->string; - } - - function offsetExists($offset) - { - return isset($this->metadata[$offset]); - } - - function offsetGet($offset) - { - return $this->metadata[$offset]; - } - - function offsetSet($offset, $value) - { - if ($offset === null) { - if (isset($value[0])) { - $x = ($value instanceof Haanga_yyToken) ? - $value->metadata : $value; - $this->metadata = array_merge($this->metadata, $x); - return; - } - $offset = count($this->metadata); - } - if ($value === null) { - return; - } - if ($value instanceof Haanga_yyToken) { - if ($value->metadata) { - $this->metadata[$offset] = $value->metadata; - } - } elseif ($value) { - $this->metadata[$offset] = $value; - } - } - - function offsetUnset($offset) - { - unset($this->metadata[$offset]); - } -} - -/** The following structure represents a single element of the - * parser's stack. Information stored includes: - * - * + The state number for the parser at this level of the stack. - * - * + The value of the token stored at this level of the stack. - * (In other words, the "major" token.) - * - * + The semantic value stored at this level of the stack. This is - * the information used by the action routines in the grammar. - * It is sometimes called the "minor" token. - */ -class Haanga_yyStackEntry -{ - public $stateno; /* The state-number */ - public $major; /* The major token value. This is the code - ** number for the token at this stack level */ - public $minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; - -// code external to the class is included here -#line 2 "lib/Haanga/Compiler/Parser.y" - -/* - +---------------------------------------------------------------------------------+ - | Copyright (c) 2010 César Rodas and Menéame Comunicacions S.L. | - +---------------------------------------------------------------------------------+ - | Redistribution and use in source and binary forms, with or without | - | modification, are permitted provided that the following conditions are met: | - | 1. Redistributions of source code must retain the above copyright | - | notice, this list of conditions and the following disclaimer. | - | | - | 2. Redistributions in binary form must reproduce the above copyright | - | notice, this list of conditions and the following disclaimer in the | - | documentation and/or other materials provided with the distribution. | - | | - | 3. All advertising materials mentioning features or use of this software | - | must display the following acknowledgement: | - | This product includes software developed by César D. Rodas. | - | | - | 4. Neither the name of the César D. Rodas nor the | - | names of its contributors may be used to endorse or promote products | - | derived from this software without specific prior written permission. | - | | - | THIS SOFTWARE IS PROVIDED BY CÉSAR D. RODAS ''AS IS'' AND ANY | - | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | - | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | - | DISCLAIMED. IN NO EVENT SHALL CÉSAR D. RODAS BE LIABLE FOR ANY | - | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | - | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | - | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | - | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | - | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | - | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE | - +---------------------------------------------------------------------------------+ - | Authors: César Rodas <crodas@php.net> | - +---------------------------------------------------------------------------------+ -*/ -#line 136 "lib/Haanga/Compiler/Parser.php" - -// declare_class is output here -#line 39 "lib/Haanga/Compiler/Parser.y" - class Haanga_Compiler_Parser #line 141 "lib/Haanga/Compiler/Parser.php" -{ -/* First off, code is included which follows the "include_class" declaration -** in the input file. */ -#line 40 "lib/Haanga/Compiler/Parser.y" - - protected $lex; - protected $file; - - function __construct($lex, $file='') - { - $this->lex = $lex; - $this->file = $file; - } - - function Error($text) - { - throw new Haanga_Compiler_Exception($text.' in '.$this->file.':'.$this->lex->getLine()); - } - -#line 162 "lib/Haanga/Compiler/Parser.php" - -/* Next is all token values, as class constants -*/ -/* -** These constants (all generated automatically by the parser generator) -** specify the various kinds of tokens (terminals) that the parser -** understands. -** -** Each symbol here is a terminal symbol in the grammar. -*/ - const T_TAG_OPEN = 1; - const T_NOT = 2; - const T_AND = 3; - const T_OR = 4; - const T_QUESTION = 5; - const T_COLON = 6; - const T_EQ = 7; - const T_NE = 8; - const T_GT = 9; - const T_GE = 10; - const T_LT = 11; - const T_LE = 12; - const T_IN = 13; - const T_PLUS = 14; - const T_MINUS = 15; - const T_CONCAT = 16; - const T_TIMES = 17; - const T_DIV = 18; - const T_MOD = 19; - const T_PIPE = 20; - const T_BITWISE = 21; - const T_FILTER_PIPE = 22; - const T_HTML = 23; - const T_COMMENT = 24; - const T_PRINT_OPEN = 25; - const T_PRINT_CLOSE = 26; - const T_EXTENDS = 27; - const T_TAG_CLOSE = 28; - const T_INCLUDE = 29; - const T_AUTOESCAPE = 30; - const T_CUSTOM_END = 31; - const T_CUSTOM_TAG = 32; - const T_AS = 33; - const T_CUSTOM_BLOCK = 34; - const T_SPACEFULL = 35; - const T_WITH = 36; - const T_SET = 37; - const T_ASSIGN = 38; - const T_LOAD = 39; - const T_FOR = 40; - const T_COMMA = 41; - const T_STEP = 42; - const T_EMPTY = 43; - const T_IF = 44; - const T_ELSE = 45; - const T_IFCHANGED = 46; - const T_IFEQUAL = 47; - const T_IFNOTEQUAL = 48; - const T_BLOCK = 49; - const T_FILTER = 50; - const T_REGROUP = 51; - const T_BY = 52; - const T_TRUE = 53; - const T_FALSE = 54; - const T_STRING = 55; - const T_INTL = 56; - const T_RPARENT = 57; - const T_LPARENT = 58; - const T_OBJ = 59; - const T_DOT = 60; - const T_CLASS = 61; - const T_BRACKETS_OPEN = 62; - const T_BRACKETS_CLOSE = 63; - const T_ALPHA = 64; - const T_DOTDOT = 65; - const T_NUMERIC = 66; - const YY_NO_ACTION = 374; - const YY_ACCEPT_ACTION = 373; - const YY_ERROR_ACTION = 372; - -/* Next are that tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < self::YYNSTATE Shift N. That is, -** push the lookahead -** token onto the stack -** and goto state N. -** -** self::YYNSTATE <= N < self::YYNSTATE+self::YYNRULE Reduce by rule N-YYNSTATE. -** -** N == self::YYNSTATE+self::YYNRULE A syntax error has occurred. -** -** N == self::YYNSTATE+self::YYNRULE+1 The parser accepts its -** input. (and concludes parsing) -** -** N == self::YYNSTATE+self::YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. -** -** The action table is constructed as a single large static array $yy_action. -** Given state S and lookahead X, the action is computed as -** -** self::$yy_action[self::$yy_shift_ofst[S] + X ] -** -** If the index value self::$yy_shift_ofst[S]+X is out of range or if the value -** self::$yy_lookahead[self::$yy_shift_ofst[S]+X] is not equal to X or if -** self::$yy_shift_ofst[S] is equal to self::YY_SHIFT_USE_DFLT, it means that -** the action is not in the table and that self::$yy_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the static $yy_reduce_ofst array is used in place of -** the static $yy_shift_ofst array and self::YY_REDUCE_USE_DFLT is used in place of -** self::YY_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** self::$yy_action A single table containing all actions. -** self::$yy_lookahead A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** self::$yy_shift_ofst For each state, the offset into self::$yy_action for -** shifting terminals. -** self::$yy_reduce_ofst For each state, the offset into self::$yy_action for -** shifting non-terminals after a reduce. -** self::$yy_default Default action for each state. -*/ - const YY_SZ_ACTTAB = 1586; -static public $yy_action = array( - /* 0 */ 33, 34, 35, 32, 31, 31, 31, 31, 31, 31, - /* 10 */ 31, 36, 36, 36, 27, 27, 27, 25, 30, 54, - /* 20 */ 62, 51, 74, 193, 43, 241, 45, 175, 66, 71, - /* 30 */ 255, 101, 65, 251, 144, 117, 28, 195, 46, 39, - /* 40 */ 40, 61, 58, 56, 54, 70, 51, 74, 168, 43, - /* 50 */ 69, 45, 175, 66, 71, 55, 101, 65, 105, 252, - /* 60 */ 38, 28, 160, 46, 39, 40, 61, 58, 56, 33, - /* 70 */ 34, 35, 60, 31, 31, 31, 31, 31, 31, 31, - /* 80 */ 36, 36, 36, 27, 27, 27, 25, 30, 67, 33, - /* 90 */ 34, 35, 204, 31, 31, 31, 31, 31, 31, 31, - /* 100 */ 36, 36, 36, 27, 27, 27, 25, 30, 54, 37, - /* 110 */ 51, 74, 146, 43, 369, 45, 175, 66, 71, 261, - /* 120 */ 101, 65, 373, 80, 167, 28, 153, 46, 39, 40, - /* 130 */ 61, 58, 56, 192, 258, 134, 220, 273, 273, 120, - /* 140 */ 273, 25, 30, 270, 54, 190, 51, 74, 183, 43, - /* 150 */ 203, 45, 175, 66, 71, 273, 101, 65, 246, 227, - /* 160 */ 177, 28, 249, 46, 39, 40, 61, 58, 56, 174, - /* 170 */ 273, 54, 63, 51, 74, 155, 43, 232, 45, 175, - /* 180 */ 66, 71, 208, 101, 65, 259, 115, 123, 28, 158, - /* 190 */ 46, 39, 40, 61, 58, 56, 33, 34, 35, 174, - /* 200 */ 31, 31, 31, 31, 31, 31, 31, 36, 36, 36, - /* 210 */ 27, 27, 27, 25, 30, 273, 273, 198, 273, 110, - /* 220 */ 238, 106, 54, 55, 51, 74, 169, 43, 263, 45, - /* 230 */ 175, 66, 71, 273, 101, 65, 205, 230, 228, 28, - /* 240 */ 165, 46, 39, 40, 61, 58, 56, 229, 273, 54, - /* 250 */ 238, 51, 74, 100, 43, 272, 45, 175, 66, 71, - /* 260 */ 102, 101, 65, 253, 262, 277, 28, 68, 46, 39, - /* 270 */ 40, 61, 58, 56, 54, 62, 51, 74, 150, 43, - /* 280 */ 122, 45, 175, 66, 71, 209, 101, 65, 103, 109, - /* 290 */ 104, 28, 119, 46, 39, 40, 61, 58, 56, 54, - /* 300 */ 57, 51, 74, 185, 43, 212, 45, 175, 66, 71, - /* 310 */ 118, 101, 65, 59, 254, 239, 28, 217, 46, 39, - /* 320 */ 40, 61, 58, 56, 54, 86, 51, 74, 151, 43, - /* 330 */ 201, 45, 175, 66, 71, 111, 101, 65, 206, 218, - /* 340 */ 224, 28, 207, 46, 39, 40, 61, 58, 56, 33, - /* 350 */ 34, 35, 116, 31, 31, 31, 31, 31, 31, 31, - /* 360 */ 36, 36, 36, 27, 27, 27, 25, 30, 200, 54, - /* 370 */ 176, 51, 74, 196, 43, 82, 45, 175, 66, 71, - /* 380 */ 275, 101, 65, 240, 95, 96, 28, 98, 46, 39, - /* 390 */ 40, 61, 58, 56, 54, 81, 51, 74, 64, 43, - /* 400 */ 97, 45, 175, 66, 71, 90, 101, 65, 88, 93, - /* 410 */ 89, 28, 235, 46, 39, 40, 61, 58, 56, 54, - /* 420 */ 99, 51, 74, 152, 43, 91, 45, 175, 66, 71, - /* 430 */ 83, 101, 65, 84, 87, 92, 28, 77, 46, 39, - /* 440 */ 40, 61, 58, 56, 54, 78, 51, 74, 172, 43, - /* 450 */ 94, 45, 175, 66, 71, 85, 101, 65, 79, 192, - /* 460 */ 192, 28, 192, 46, 39, 40, 61, 58, 56, 54, - /* 470 */ 192, 51, 74, 197, 43, 192, 45, 175, 66, 71, - /* 480 */ 192, 101, 65, 192, 192, 192, 28, 192, 46, 39, - /* 490 */ 40, 61, 58, 56, 54, 192, 51, 74, 173, 43, - /* 500 */ 192, 45, 175, 66, 71, 192, 101, 65, 192, 192, - /* 510 */ 192, 28, 192, 46, 39, 40, 61, 58, 56, 54, - /* 520 */ 192, 51, 74, 154, 43, 192, 45, 175, 66, 71, - /* 530 */ 192, 101, 65, 192, 192, 192, 28, 192, 46, 39, - /* 540 */ 40, 61, 58, 56, 54, 192, 51, 74, 179, 43, - /* 550 */ 192, 45, 175, 66, 71, 192, 101, 65, 192, 192, - /* 560 */ 192, 28, 192, 46, 39, 40, 61, 58, 56, 54, - /* 570 */ 192, 51, 74, 194, 43, 192, 45, 175, 66, 71, - /* 580 */ 192, 101, 65, 192, 192, 192, 28, 192, 46, 39, - /* 590 */ 40, 61, 58, 56, 54, 192, 51, 74, 187, 43, - /* 600 */ 192, 45, 175, 66, 71, 192, 101, 65, 192, 192, - /* 610 */ 192, 28, 192, 46, 39, 40, 61, 58, 56, 54, - /* 620 */ 192, 51, 74, 148, 43, 192, 45, 175, 66, 71, - /* 630 */ 192, 101, 65, 192, 192, 192, 28, 192, 46, 39, - /* 640 */ 40, 61, 58, 56, 54, 192, 51, 74, 170, 43, - /* 650 */ 192, 45, 175, 66, 71, 192, 101, 65, 192, 192, - /* 660 */ 192, 28, 192, 46, 39, 40, 61, 58, 56, 54, - /* 670 */ 192, 51, 74, 178, 43, 192, 45, 175, 66, 71, - /* 680 */ 192, 101, 65, 268, 134, 220, 28, 192, 46, 39, - /* 690 */ 40, 61, 58, 56, 34, 35, 192, 31, 31, 31, - /* 700 */ 31, 31, 31, 31, 36, 36, 36, 27, 27, 27, - /* 710 */ 25, 30, 35, 192, 31, 31, 31, 31, 31, 31, - /* 720 */ 31, 36, 36, 36, 27, 27, 27, 25, 30, 31, - /* 730 */ 31, 31, 31, 31, 31, 31, 36, 36, 36, 27, - /* 740 */ 27, 27, 25, 30, 174, 192, 226, 62, 273, 273, - /* 750 */ 192, 273, 192, 274, 192, 192, 257, 225, 174, 250, - /* 760 */ 273, 273, 73, 273, 192, 260, 273, 134, 220, 192, - /* 770 */ 52, 219, 192, 24, 273, 273, 72, 273, 273, 178, - /* 780 */ 192, 273, 256, 256, 251, 144, 174, 192, 62, 247, - /* 790 */ 134, 220, 273, 273, 121, 238, 256, 256, 251, 144, - /* 800 */ 192, 178, 273, 273, 163, 273, 143, 273, 192, 238, - /* 810 */ 192, 269, 134, 220, 174, 192, 62, 192, 273, 273, - /* 820 */ 273, 273, 216, 192, 266, 266, 251, 144, 192, 26, - /* 830 */ 273, 273, 192, 273, 192, 273, 273, 238, 192, 192, - /* 840 */ 52, 192, 251, 144, 17, 174, 192, 192, 273, 192, - /* 850 */ 192, 273, 256, 256, 251, 144, 237, 192, 114, 236, - /* 860 */ 192, 273, 273, 273, 273, 238, 214, 215, 29, 257, - /* 870 */ 49, 52, 250, 192, 174, 192, 192, 192, 260, 273, - /* 880 */ 134, 220, 19, 256, 256, 251, 144, 107, 236, 192, - /* 890 */ 273, 273, 192, 273, 273, 192, 238, 192, 257, 47, - /* 900 */ 52, 250, 192, 174, 214, 215, 29, 260, 273, 134, - /* 910 */ 220, 192, 256, 256, 251, 144, 113, 192, 192, 273, - /* 920 */ 273, 192, 273, 273, 137, 238, 192, 163, 142, 136, - /* 930 */ 141, 164, 174, 202, 269, 134, 220, 273, 192, 134, - /* 940 */ 220, 256, 256, 251, 144, 112, 236, 192, 273, 273, - /* 950 */ 192, 273, 273, 192, 238, 192, 257, 50, 192, 250, - /* 960 */ 27, 27, 27, 25, 30, 260, 273, 134, 220, 192, - /* 970 */ 256, 256, 251, 144, 44, 76, 76, 75, 53, 192, - /* 980 */ 192, 273, 192, 238, 199, 192, 174, 156, 245, 244, - /* 990 */ 242, 243, 233, 222, 223, 221, 131, 210, 276, 5, - /* 1000 */ 108, 192, 273, 273, 181, 273, 202, 178, 134, 220, - /* 1010 */ 166, 192, 191, 192, 174, 271, 267, 269, 134, 220, - /* 1020 */ 273, 214, 215, 29, 256, 256, 251, 144, 234, 192, - /* 1030 */ 273, 273, 210, 273, 192, 273, 192, 238, 188, 211, - /* 1040 */ 174, 202, 192, 134, 220, 11, 192, 192, 273, 134, - /* 1050 */ 220, 192, 256, 256, 251, 144, 273, 273, 192, 273, - /* 1060 */ 192, 192, 192, 273, 192, 238, 192, 214, 215, 29, - /* 1070 */ 192, 192, 178, 192, 273, 163, 126, 138, 266, 266, - /* 1080 */ 251, 144, 269, 134, 220, 192, 192, 178, 192, 273, - /* 1090 */ 166, 238, 191, 135, 192, 271, 267, 269, 134, 220, - /* 1100 */ 192, 192, 192, 192, 178, 192, 139, 166, 192, 191, - /* 1110 */ 192, 192, 271, 267, 269, 134, 220, 178, 192, 189, - /* 1120 */ 166, 124, 191, 192, 192, 271, 267, 269, 134, 220, - /* 1130 */ 134, 220, 178, 192, 157, 166, 125, 191, 192, 192, - /* 1140 */ 271, 267, 269, 134, 220, 134, 220, 178, 192, 127, - /* 1150 */ 166, 192, 191, 192, 192, 271, 267, 269, 134, 220, - /* 1160 */ 178, 192, 133, 166, 192, 191, 192, 192, 271, 267, - /* 1170 */ 269, 134, 220, 178, 192, 162, 166, 132, 191, 192, - /* 1180 */ 192, 271, 267, 269, 134, 220, 134, 220, 178, 192, - /* 1190 */ 130, 166, 192, 191, 192, 192, 271, 267, 269, 134, - /* 1200 */ 220, 178, 192, 192, 166, 264, 191, 192, 192, 271, - /* 1210 */ 267, 269, 134, 220, 174, 192, 178, 192, 192, 166, - /* 1220 */ 192, 191, 192, 128, 271, 267, 269, 134, 220, 147, - /* 1230 */ 273, 273, 192, 273, 178, 1, 192, 166, 192, 191, - /* 1240 */ 134, 220, 271, 267, 269, 134, 220, 192, 273, 192, - /* 1250 */ 265, 192, 192, 192, 251, 144, 3, 214, 215, 29, - /* 1260 */ 4, 178, 192, 273, 166, 238, 191, 192, 192, 271, - /* 1270 */ 267, 269, 134, 220, 129, 213, 192, 192, 214, 215, - /* 1280 */ 29, 192, 214, 215, 29, 178, 134, 220, 166, 192, - /* 1290 */ 191, 192, 192, 271, 267, 269, 134, 220, 178, 192, - /* 1300 */ 192, 166, 192, 191, 192, 192, 42, 267, 269, 134, - /* 1310 */ 220, 178, 192, 186, 166, 192, 191, 192, 192, 161, - /* 1320 */ 267, 269, 134, 220, 134, 220, 178, 192, 192, 166, - /* 1330 */ 192, 191, 192, 192, 149, 267, 269, 134, 220, 178, - /* 1340 */ 192, 192, 166, 236, 191, 192, 192, 41, 267, 269, - /* 1350 */ 134, 220, 192, 257, 48, 192, 250, 192, 192, 145, - /* 1360 */ 192, 192, 260, 192, 134, 220, 192, 6, 192, 257, - /* 1370 */ 192, 192, 250, 192, 192, 231, 192, 192, 260, 192, - /* 1380 */ 134, 220, 159, 192, 192, 257, 192, 184, 250, 214, - /* 1390 */ 215, 29, 257, 192, 260, 250, 134, 220, 134, 220, - /* 1400 */ 171, 260, 192, 134, 220, 178, 192, 192, 163, 248, - /* 1410 */ 140, 134, 220, 182, 192, 269, 134, 220, 22, 257, - /* 1420 */ 192, 16, 250, 257, 13, 192, 250, 180, 260, 192, - /* 1430 */ 134, 220, 260, 8, 134, 220, 21, 192, 134, 220, - /* 1440 */ 214, 215, 29, 214, 215, 29, 214, 215, 29, 7, - /* 1450 */ 192, 192, 192, 192, 192, 214, 215, 29, 214, 215, - /* 1460 */ 29, 9, 192, 192, 192, 192, 192, 192, 192, 192, - /* 1470 */ 192, 214, 215, 29, 15, 192, 192, 192, 192, 192, - /* 1480 */ 192, 192, 192, 214, 215, 29, 2, 192, 192, 192, - /* 1490 */ 192, 192, 192, 192, 192, 192, 214, 215, 29, 23, - /* 1500 */ 192, 192, 192, 192, 192, 192, 192, 192, 214, 215, - /* 1510 */ 29, 20, 192, 192, 192, 192, 192, 192, 192, 192, - /* 1520 */ 192, 214, 215, 29, 10, 192, 192, 192, 192, 192, - /* 1530 */ 192, 192, 192, 214, 215, 29, 18, 192, 192, 192, - /* 1540 */ 192, 192, 192, 192, 192, 192, 214, 215, 29, 12, - /* 1550 */ 192, 192, 192, 192, 192, 192, 192, 192, 214, 215, - /* 1560 */ 29, 14, 192, 192, 192, 192, 192, 192, 192, 192, - /* 1570 */ 192, 214, 215, 29, 192, 192, 192, 192, 192, 192, - /* 1580 */ 192, 192, 192, 214, 215, 29, - ); - static public $yy_lookahead = array( - /* 0 */ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - /* 10 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 27, - /* 20 */ 22, 29, 30, 31, 32, 63, 34, 35, 36, 37, - /* 30 */ 28, 39, 40, 55, 56, 28, 44, 45, 46, 47, - /* 40 */ 48, 49, 50, 51, 27, 33, 29, 30, 31, 32, - /* 50 */ 52, 34, 35, 36, 37, 6, 39, 40, 28, 28, - /* 60 */ 13, 44, 45, 46, 47, 48, 49, 50, 51, 3, - /* 70 */ 4, 5, 42, 7, 8, 9, 10, 11, 12, 13, - /* 80 */ 14, 15, 16, 17, 18, 19, 20, 21, 41, 3, - /* 90 */ 4, 5, 26, 7, 8, 9, 10, 11, 12, 13, - /* 100 */ 14, 15, 16, 17, 18, 19, 20, 21, 27, 38, - /* 110 */ 29, 30, 31, 32, 65, 34, 35, 36, 37, 28, - /* 120 */ 39, 40, 68, 69, 83, 44, 45, 46, 47, 48, - /* 130 */ 49, 50, 51, 92, 28, 94, 95, 31, 32, 28, - /* 140 */ 34, 20, 21, 57, 27, 55, 29, 30, 31, 32, - /* 150 */ 28, 34, 35, 36, 37, 49, 39, 40, 28, 28, - /* 160 */ 43, 44, 28, 46, 47, 48, 49, 50, 51, 15, - /* 170 */ 64, 27, 22, 29, 30, 31, 32, 28, 34, 35, - /* 180 */ 36, 37, 28, 39, 40, 28, 28, 28, 44, 45, - /* 190 */ 46, 47, 48, 49, 50, 51, 3, 4, 5, 15, - /* 200 */ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - /* 210 */ 17, 18, 19, 20, 21, 31, 32, 28, 34, 28, - /* 220 */ 66, 28, 27, 6, 29, 30, 31, 32, 28, 34, - /* 230 */ 35, 36, 37, 49, 39, 40, 28, 28, 28, 44, - /* 240 */ 45, 46, 47, 48, 49, 50, 51, 28, 64, 27, - /* 250 */ 66, 29, 30, 31, 32, 28, 34, 35, 36, 37, - /* 260 */ 28, 39, 40, 28, 57, 28, 44, 33, 46, 47, - /* 270 */ 48, 49, 50, 51, 27, 22, 29, 30, 31, 32, - /* 280 */ 28, 34, 35, 36, 37, 28, 39, 40, 28, 28, - /* 290 */ 28, 44, 28, 46, 47, 48, 49, 50, 51, 27, - /* 300 */ 13, 29, 30, 31, 32, 28, 34, 35, 36, 37, - /* 310 */ 28, 39, 40, 65, 28, 66, 44, 28, 46, 47, - /* 320 */ 48, 49, 50, 51, 27, 69, 29, 30, 31, 32, - /* 330 */ 28, 34, 35, 36, 37, 28, 39, 40, 28, 28, - /* 340 */ 28, 44, 28, 46, 47, 48, 49, 50, 51, 3, - /* 350 */ 4, 5, 28, 7, 8, 9, 10, 11, 12, 13, - /* 360 */ 14, 15, 16, 17, 18, 19, 20, 21, 70, 27, - /* 370 */ 92, 29, 30, 31, 32, 69, 34, 35, 36, 37, - /* 380 */ 86, 39, 40, 95, 69, 69, 44, 69, 46, 47, - /* 390 */ 48, 49, 50, 51, 27, 69, 29, 30, 31, 32, - /* 400 */ 69, 34, 35, 36, 37, 69, 39, 40, 69, 69, - /* 410 */ 69, 44, 95, 46, 47, 48, 49, 50, 51, 27, - /* 420 */ 69, 29, 30, 31, 32, 69, 34, 35, 36, 37, - /* 430 */ 69, 39, 40, 69, 69, 69, 44, 69, 46, 47, - /* 440 */ 48, 49, 50, 51, 27, 69, 29, 30, 31, 32, - /* 450 */ 69, 34, 35, 36, 37, 69, 39, 40, 69, 96, - /* 460 */ 96, 44, 96, 46, 47, 48, 49, 50, 51, 27, - /* 470 */ 96, 29, 30, 31, 32, 96, 34, 35, 36, 37, - /* 480 */ 96, 39, 40, 96, 96, 96, 44, 96, 46, 47, - /* 490 */ 48, 49, 50, 51, 27, 96, 29, 30, 31, 32, - /* 500 */ 96, 34, 35, 36, 37, 96, 39, 40, 96, 96, - /* 510 */ 96, 44, 96, 46, 47, 48, 49, 50, 51, 27, - /* 520 */ 96, 29, 30, 31, 32, 96, 34, 35, 36, 37, - /* 530 */ 96, 39, 40, 96, 96, 96, 44, 96, 46, 47, - /* 540 */ 48, 49, 50, 51, 27, 96, 29, 30, 31, 32, - /* 550 */ 96, 34, 35, 36, 37, 96, 39, 40, 96, 96, - /* 560 */ 96, 44, 96, 46, 47, 48, 49, 50, 51, 27, - /* 570 */ 96, 29, 30, 31, 32, 96, 34, 35, 36, 37, - /* 580 */ 96, 39, 40, 96, 96, 96, 44, 96, 46, 47, - /* 590 */ 48, 49, 50, 51, 27, 96, 29, 30, 31, 32, - /* 600 */ 96, 34, 35, 36, 37, 96, 39, 40, 96, 96, - /* 610 */ 96, 44, 96, 46, 47, 48, 49, 50, 51, 27, - /* 620 */ 96, 29, 30, 31, 32, 96, 34, 35, 36, 37, - /* 630 */ 96, 39, 40, 96, 96, 96, 44, 96, 46, 47, - /* 640 */ 48, 49, 50, 51, 27, 96, 29, 30, 31, 32, - /* 650 */ 96, 34, 35, 36, 37, 96, 39, 40, 96, 96, - /* 660 */ 96, 44, 96, 46, 47, 48, 49, 50, 51, 27, - /* 670 */ 96, 29, 30, 83, 32, 96, 34, 35, 36, 37, - /* 680 */ 96, 39, 40, 93, 94, 95, 44, 96, 46, 47, - /* 690 */ 48, 49, 50, 51, 4, 5, 96, 7, 8, 9, - /* 700 */ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - /* 710 */ 20, 21, 5, 96, 7, 8, 9, 10, 11, 12, - /* 720 */ 13, 14, 15, 16, 17, 18, 19, 20, 21, 7, - /* 730 */ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - /* 740 */ 18, 19, 20, 21, 15, 96, 73, 22, 31, 32, - /* 750 */ 96, 34, 96, 28, 96, 96, 83, 28, 15, 86, - /* 760 */ 31, 32, 33, 34, 96, 92, 49, 94, 95, 96, - /* 770 */ 41, 28, 96, 2, 31, 32, 33, 34, 49, 83, - /* 780 */ 96, 64, 53, 54, 55, 56, 15, 96, 22, 93, - /* 790 */ 94, 95, 49, 64, 28, 66, 53, 54, 55, 56, - /* 800 */ 96, 83, 31, 32, 86, 34, 88, 64, 96, 66, - /* 810 */ 96, 93, 94, 95, 15, 96, 22, 96, 31, 32, - /* 820 */ 49, 34, 28, 96, 53, 54, 55, 56, 96, 58, - /* 830 */ 31, 32, 96, 34, 96, 64, 49, 66, 96, 96, - /* 840 */ 41, 96, 55, 56, 1, 15, 96, 96, 49, 96, - /* 850 */ 96, 64, 53, 54, 55, 56, 57, 96, 28, 73, - /* 860 */ 96, 31, 32, 64, 34, 66, 23, 24, 25, 83, - /* 870 */ 84, 41, 86, 96, 15, 96, 96, 96, 92, 49, - /* 880 */ 94, 95, 1, 53, 54, 55, 56, 28, 73, 96, - /* 890 */ 31, 32, 96, 34, 64, 96, 66, 96, 83, 84, - /* 900 */ 41, 86, 96, 15, 23, 24, 25, 92, 49, 94, - /* 910 */ 95, 96, 53, 54, 55, 56, 28, 96, 96, 31, - /* 920 */ 32, 96, 34, 64, 83, 66, 96, 86, 83, 88, - /* 930 */ 89, 90, 15, 92, 93, 94, 95, 49, 96, 94, - /* 940 */ 95, 53, 54, 55, 56, 28, 73, 96, 31, 32, - /* 950 */ 96, 34, 64, 96, 66, 96, 83, 84, 96, 86, - /* 960 */ 17, 18, 19, 20, 21, 92, 49, 94, 95, 96, - /* 970 */ 53, 54, 55, 56, 58, 59, 60, 61, 62, 96, - /* 980 */ 96, 64, 96, 66, 71, 96, 15, 74, 75, 76, - /* 990 */ 77, 78, 79, 80, 81, 82, 72, 83, 85, 1, - /* 1000 */ 87, 96, 31, 32, 90, 34, 92, 83, 94, 95, - /* 1010 */ 86, 96, 88, 96, 15, 91, 92, 93, 94, 95, - /* 1020 */ 49, 23, 24, 25, 53, 54, 55, 56, 57, 96, - /* 1030 */ 31, 32, 83, 34, 96, 64, 96, 66, 83, 90, - /* 1040 */ 15, 92, 96, 94, 95, 1, 96, 96, 49, 94, - /* 1050 */ 95, 96, 53, 54, 55, 56, 31, 32, 96, 34, - /* 1060 */ 96, 96, 96, 64, 96, 66, 96, 23, 24, 25, - /* 1070 */ 96, 96, 83, 96, 49, 86, 72, 88, 53, 54, - /* 1080 */ 55, 56, 93, 94, 95, 96, 96, 83, 96, 64, - /* 1090 */ 86, 66, 88, 72, 96, 91, 92, 93, 94, 95, - /* 1100 */ 96, 96, 96, 96, 83, 96, 72, 86, 96, 88, - /* 1110 */ 96, 96, 91, 92, 93, 94, 95, 83, 96, 83, - /* 1120 */ 86, 72, 88, 96, 96, 91, 92, 93, 94, 95, - /* 1130 */ 94, 95, 83, 96, 83, 86, 72, 88, 96, 96, - /* 1140 */ 91, 92, 93, 94, 95, 94, 95, 83, 96, 72, - /* 1150 */ 86, 96, 88, 96, 96, 91, 92, 93, 94, 95, - /* 1160 */ 83, 96, 72, 86, 96, 88, 96, 96, 91, 92, - /* 1170 */ 93, 94, 95, 83, 96, 83, 86, 72, 88, 96, - /* 1180 */ 96, 91, 92, 93, 94, 95, 94, 95, 83, 96, - /* 1190 */ 72, 86, 96, 88, 96, 96, 91, 92, 93, 94, - /* 1200 */ 95, 83, 96, 96, 86, 72, 88, 96, 96, 91, - /* 1210 */ 92, 93, 94, 95, 15, 96, 83, 96, 96, 86, - /* 1220 */ 96, 88, 96, 72, 91, 92, 93, 94, 95, 83, - /* 1230 */ 31, 32, 96, 34, 83, 1, 96, 86, 96, 88, - /* 1240 */ 94, 95, 91, 92, 93, 94, 95, 96, 49, 96, - /* 1250 */ 72, 96, 96, 96, 55, 56, 1, 23, 24, 25, - /* 1260 */ 1, 83, 96, 64, 86, 66, 88, 96, 96, 91, - /* 1270 */ 92, 93, 94, 95, 72, 83, 96, 96, 23, 24, - /* 1280 */ 25, 96, 23, 24, 25, 83, 94, 95, 86, 96, - /* 1290 */ 88, 96, 96, 91, 92, 93, 94, 95, 83, 96, - /* 1300 */ 96, 86, 96, 88, 96, 96, 91, 92, 93, 94, - /* 1310 */ 95, 83, 96, 83, 86, 96, 88, 96, 96, 91, - /* 1320 */ 92, 93, 94, 95, 94, 95, 83, 96, 96, 86, - /* 1330 */ 96, 88, 96, 96, 91, 92, 93, 94, 95, 83, - /* 1340 */ 96, 96, 86, 73, 88, 96, 96, 91, 92, 93, - /* 1350 */ 94, 95, 96, 83, 84, 96, 86, 96, 96, 73, - /* 1360 */ 96, 96, 92, 96, 94, 95, 96, 1, 96, 83, - /* 1370 */ 96, 96, 86, 96, 96, 73, 96, 96, 92, 96, - /* 1380 */ 94, 95, 73, 96, 96, 83, 96, 83, 86, 23, - /* 1390 */ 24, 25, 83, 96, 92, 86, 94, 95, 94, 95, - /* 1400 */ 83, 92, 96, 94, 95, 83, 96, 96, 86, 73, - /* 1410 */ 88, 94, 95, 73, 96, 93, 94, 95, 1, 83, - /* 1420 */ 96, 1, 86, 83, 1, 96, 86, 83, 92, 96, - /* 1430 */ 94, 95, 92, 1, 94, 95, 1, 96, 94, 95, - /* 1440 */ 23, 24, 25, 23, 24, 25, 23, 24, 25, 1, - /* 1450 */ 96, 96, 96, 96, 96, 23, 24, 25, 23, 24, - /* 1460 */ 25, 1, 96, 96, 96, 96, 96, 96, 96, 96, - /* 1470 */ 96, 23, 24, 25, 1, 96, 96, 96, 96, 96, - /* 1480 */ 96, 96, 96, 23, 24, 25, 1, 96, 96, 96, - /* 1490 */ 96, 96, 96, 96, 96, 96, 23, 24, 25, 1, - /* 1500 */ 96, 96, 96, 96, 96, 96, 96, 96, 23, 24, - /* 1510 */ 25, 1, 96, 96, 96, 96, 96, 96, 96, 96, - /* 1520 */ 96, 23, 24, 25, 1, 96, 96, 96, 96, 96, - /* 1530 */ 96, 96, 96, 23, 24, 25, 1, 96, 96, 96, - /* 1540 */ 96, 96, 96, 96, 96, 96, 23, 24, 25, 1, - /* 1550 */ 96, 96, 96, 96, 96, 96, 96, 96, 23, 24, - /* 1560 */ 25, 1, 96, 96, 96, 96, 96, 96, 96, 96, - /* 1570 */ 96, 23, 24, 25, 96, 96, 96, 96, 96, 96, - /* 1580 */ 96, 96, 96, 23, 24, 25, -); - const YY_SHIFT_USE_DFLT = -39; - const YY_SHIFT_MAX = 197; - static public $yy_shift_ofst = array( - /* 0 */ -39, 144, 195, 81, -8, 117, 17, 542, 517, 592, - /* 10 */ 567, 617, 392, 492, 297, 272, 247, 222, 342, 442, - /* 20 */ 367, 467, 417, 642, 771, 771, 771, 771, 771, 771, - /* 30 */ 771, 771, 771, 771, 771, 771, 771, 771, 1199, 1025, - /* 40 */ 1025, 1025, 1025, 743, 971, 917, 888, 729, 830, 799, - /* 50 */ 859, 999, 999, 999, 999, 999, 787, 787, 787, 184, - /* 60 */ 184, 184, 717, 717, 106, 717, 717, 717, 717, 717, - /* 70 */ 717, 717, 717, 717, 717, 717, 717, 1535, 1560, 1510, - /* 80 */ 1498, 1485, 1523, 1548, 1423, 1255, 1259, 1234, 1417, 998, - /* 90 */ 1044, 843, 881, 1366, 1460, 1435, 1448, 1473, 1432, 1420, - /* 100 */ 154, -22, -39, -39, -39, -39, -39, -39, -39, -39, - /* 110 */ -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, - /* 120 */ -39, -39, -39, -39, 86, -3, 193, 66, 346, 346, - /* 130 */ 690, 707, 722, 722, 916, 943, 725, 49, 766, 121, - /* 140 */ 794, 30, 47, -2, 90, 149, 134, 71, 131, 158, - /* 150 */ 189, 122, 31, 7, 2, 91, 130, 12, 111, -38, - /* 160 */ 159, 324, 287, 150, 248, 282, 150, 264, 277, 286, - /* 170 */ 289, 312, 314, 311, 249, 307, 310, 261, 217, 219, - /* 180 */ 209, 191, 208, 227, 252, 257, 237, 235, 234, 262, - /* 190 */ 207, 253, 232, 200, 210, 260, 302, 157, -); - const YY_REDUCE_USE_DFLT = -1; - const YY_REDUCE_MAX = 123; - static public $yy_reduce_ofst = array( - /* 0 */ 54, 913, 913, 913, 913, 913, 913, 913, 913, 913, - /* 10 */ 913, 913, 913, 913, 913, 913, 913, 913, 913, 913, - /* 20 */ 913, 913, 913, 913, 1202, 1178, 1049, 1034, 1004, 1077, - /* 30 */ 1133, 1105, 1090, 1118, 924, 1064, 1021, 1151, 841, 1256, - /* 40 */ 1215, 1243, 1228, 815, 786, 1270, 873, 673, 673, 673, - /* 50 */ 673, 1286, 1302, 1309, 1340, 1336, 718, 1322, 989, 949, - /* 60 */ 914, 41, 696, 590, 1230, 845, 955, 1092, 1304, 1051, - /* 70 */ 1192, 1146, 1317, 1344, 1036, 288, 317, 298, 298, 298, - /* 80 */ 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, - /* 90 */ 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, - /* 100 */ 278, 294, 356, 306, 315, 339, 256, 340, 341, 336, - /* 110 */ 331, 316, 318, 326, 351, 386, 365, 364, 361, 389, - /* 120 */ 366, 368, 381, 376, -); - static public $yyExpectedTokens = array( - /* 0 */ array(), - /* 1 */ array(27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, ), - /* 2 */ array(27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, ), - /* 3 */ array(27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, ), - /* 4 */ array(27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, ), - /* 5 */ array(27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 43, 44, 46, 47, 48, 49, 50, 51, ), - /* 6 */ array(27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 44, 45, 46, 47, 48, 49, 50, 51, ), - /* 7 */ array(27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 44, 46, 47, 48, 49, 50, 51, ), - /* 8 */ array(27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 44, 46, 47, 48, 49, 50, 51, ), - /* 9 */ array(27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 44, 46, 47, 48, 49, 50, 51, ), - /* 10 */ array(27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 44, 46, 47, 48, 49, 50, 51, ), - /* 11 */ array(27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 44, 46, 47, 48, 49, 50, 51, ), - /* 12 */ array(27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 44, 46, 47, 48, 49, 50, 51, ), - /* 13 */ array(27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 44, 46, 47, 48, 49, 50, 51, ), - /* 14 */ array(27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 44, 46, 47, 48, 49, 50, 51, ), - /* 15 */ array(27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 44, 46, 47, 48, 49, 50, 51, ), - /* 16 */ array(27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 44, 46, 47, 48, 49, 50, 51, ), - /* 17 */ array(27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 44, 46, 47, 48, 49, 50, 51, ), - /* 18 */ array(27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 44, 46, 47, 48, 49, 50, 51, ), - /* 19 */ array(27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 44, 46, 47, 48, 49, 50, 51, ), - /* 20 */ array(27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 44, 46, 47, 48, 49, 50, 51, ), - /* 21 */ array(27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 44, 46, 47, 48, 49, 50, 51, ), - /* 22 */ array(27, 29, 30, 31, 32, 34, 35, 36, 37, 39, 40, 44, 46, 47, 48, 49, 50, 51, ), - /* 23 */ array(27, 29, 30, 32, 34, 35, 36, 37, 39, 40, 44, 46, 47, 48, 49, 50, 51, ), - /* 24 */ array(2, 15, 31, 32, 34, 49, 53, 54, 55, 56, 58, 64, 66, ), - /* 25 */ array(2, 15, 31, 32, 34, 49, 53, 54, 55, 56, 58, 64, 66, ), - /* 26 */ array(2, 15, 31, 32, 34, 49, 53, 54, 55, 56, 58, 64, 66, ), - /* 27 */ array(2, 15, 31, 32, 34, 49, 53, 54, 55, 56, 58, 64, 66, ), - /* 28 */ array(2, 15, 31, 32, 34, 49, 53, 54, 55, 56, 58, 64, 66, ), - /* 29 */ array(2, 15, 31, 32, 34, 49, 53, 54, 55, 56, 58, 64, 66, ), - /* 30 */ array(2, 15, 31, 32, 34, 49, 53, 54, 55, 56, 58, 64, 66, ), - /* 31 */ array(2, 15, 31, 32, 34, 49, 53, 54, 55, 56, 58, 64, 66, ), - /* 32 */ array(2, 15, 31, 32, 34, 49, 53, 54, 55, 56, 58, 64, 66, ), - /* 33 */ array(2, 15, 31, 32, 34, 49, 53, 54, 55, 56, 58, 64, 66, ), - /* 34 */ array(2, 15, 31, 32, 34, 49, 53, 54, 55, 56, 58, 64, 66, ), - /* 35 */ array(2, 15, 31, 32, 34, 49, 53, 54, 55, 56, 58, 64, 66, ), - /* 36 */ array(2, 15, 31, 32, 34, 49, 53, 54, 55, 56, 58, 64, 66, ), - /* 37 */ array(2, 15, 31, 32, 34, 49, 53, 54, 55, 56, 58, 64, 66, ), - /* 38 */ array(15, 31, 32, 34, 49, 55, 56, 64, 66, ), - /* 39 */ array(15, 31, 32, 34, 49, 53, 54, 55, 56, 64, 66, ), - /* 40 */ array(15, 31, 32, 34, 49, 53, 54, 55, 56, 64, 66, ), - /* 41 */ array(15, 31, 32, 34, 49, 53, 54, 55, 56, 64, 66, ), - /* 42 */ array(15, 31, 32, 34, 49, 53, 54, 55, 56, 64, 66, ), - /* 43 */ array(15, 28, 31, 32, 33, 34, 49, 53, 54, 55, 56, 64, 66, ), - /* 44 */ array(15, 31, 32, 34, 49, 53, 54, 55, 56, 57, 64, 66, ), - /* 45 */ array(15, 28, 31, 32, 34, 49, 53, 54, 55, 56, 64, 66, ), - /* 46 */ array(15, 28, 31, 32, 34, 49, 53, 54, 55, 56, 64, 66, ), - /* 47 */ array(15, 28, 31, 32, 33, 34, 41, 49, 53, 54, 55, 56, 64, 66, ), - /* 48 */ array(15, 28, 31, 32, 34, 41, 49, 53, 54, 55, 56, 64, 66, ), - /* 49 */ array(15, 31, 32, 34, 41, 49, 53, 54, 55, 56, 57, 64, 66, ), - /* 50 */ array(15, 28, 31, 32, 34, 41, 49, 53, 54, 55, 56, 64, 66, ), - /* 51 */ array(15, 31, 32, 34, 49, 53, 54, 55, 56, 64, 66, ), - /* 52 */ array(15, 31, 32, 34, 49, 53, 54, 55, 56, 64, 66, ), - /* 53 */ array(15, 31, 32, 34, 49, 53, 54, 55, 56, 64, 66, ), - /* 54 */ array(15, 31, 32, 34, 49, 53, 54, 55, 56, 64, 66, ), - /* 55 */ array(15, 31, 32, 34, 49, 53, 54, 55, 56, 64, 66, ), - /* 56 */ array(31, 32, 34, 49, 55, 56, 64, ), - /* 57 */ array(31, 32, 34, 49, 55, 56, 64, ), - /* 58 */ array(31, 32, 34, 49, 55, 56, 64, ), - /* 59 */ array(15, 31, 32, 34, 49, 64, 66, ), - /* 60 */ array(15, 31, 32, 34, 49, 64, 66, ), - /* 61 */ array(15, 31, 32, 34, 49, 64, 66, ), - /* 62 */ array(31, 32, 34, 49, 64, ), - /* 63 */ array(31, 32, 34, 49, 64, ), - /* 64 */ array(28, 31, 32, 34, 49, 64, ), - /* 65 */ array(31, 32, 34, 49, 64, ), - /* 66 */ array(31, 32, 34, 49, 64, ), - /* 67 */ array(31, 32, 34, 49, 64, ), - /* 68 */ array(31, 32, 34, 49, 64, ), - /* 69 */ array(31, 32, 34, 49, 64, ), - /* 70 */ array(31, 32, 34, 49, 64, ), - /* 71 */ array(31, 32, 34, 49, 64, ), - /* 72 */ array(31, 32, 34, 49, 64, ), - /* 73 */ array(31, 32, 34, 49, 64, ), - /* 74 */ array(31, 32, 34, 49, 64, ), - /* 75 */ array(31, 32, 34, 49, 64, ), - /* 76 */ array(31, 32, 34, 49, 64, ), - /* 77 */ array(1, 23, 24, 25, ), - /* 78 */ array(1, 23, 24, 25, ), - /* 79 */ array(1, 23, 24, 25, ), - /* 80 */ array(1, 23, 24, 25, ), - /* 81 */ array(1, 23, 24, 25, ), - /* 82 */ array(1, 23, 24, 25, ), - /* 83 */ array(1, 23, 24, 25, ), - /* 84 */ array(1, 23, 24, 25, ), - /* 85 */ array(1, 23, 24, 25, ), - /* 86 */ array(1, 23, 24, 25, ), - /* 87 */ array(1, 23, 24, 25, ), - /* 88 */ array(1, 23, 24, 25, ), - /* 89 */ array(1, 23, 24, 25, ), - /* 90 */ array(1, 23, 24, 25, ), - /* 91 */ array(1, 23, 24, 25, ), - /* 92 */ array(1, 23, 24, 25, ), - /* 93 */ array(1, 23, 24, 25, ), - /* 94 */ array(1, 23, 24, 25, ), - /* 95 */ array(1, 23, 24, 25, ), - /* 96 */ array(1, 23, 24, 25, ), - /* 97 */ array(1, 23, 24, 25, ), - /* 98 */ array(1, 23, 24, 25, ), - /* 99 */ array(1, 23, 24, 25, ), - /* 100 */ array(15, 28, 66, ), - /* 101 */ array(55, 56, ), - /* 102 */ array(), - /* 103 */ array(), - /* 104 */ array(), - /* 105 */ array(), - /* 106 */ array(), - /* 107 */ array(), - /* 108 */ array(), - /* 109 */ array(), - /* 110 */ array(), - /* 111 */ array(), - /* 112 */ array(), - /* 113 */ array(), - /* 114 */ array(), - /* 115 */ array(), - /* 116 */ array(), - /* 117 */ array(), - /* 118 */ array(), - /* 119 */ array(), - /* 120 */ array(), - /* 121 */ array(), - /* 122 */ array(), - /* 123 */ array(), - /* 124 */ array(3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 57, ), - /* 125 */ array(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, ), - /* 126 */ array(3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 28, ), - /* 127 */ array(3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 26, ), - /* 128 */ array(3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, ), - /* 129 */ array(3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, ), - /* 130 */ array(4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, ), - /* 131 */ array(5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, ), - /* 132 */ array(7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, ), - /* 133 */ array(7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, ), - /* 134 */ array(58, 59, 60, 61, 62, ), - /* 135 */ array(17, 18, 19, 20, 21, ), - /* 136 */ array(22, 28, ), - /* 137 */ array(6, 65, ), - /* 138 */ array(22, 28, ), - /* 139 */ array(20, 21, ), - /* 140 */ array(22, 28, ), - /* 141 */ array(28, 42, ), - /* 142 */ array(13, 41, ), - /* 143 */ array(22, 52, ), - /* 144 */ array(55, ), - /* 145 */ array(28, ), - /* 146 */ array(28, ), - /* 147 */ array(38, ), - /* 148 */ array(28, ), - /* 149 */ array(28, ), - /* 150 */ array(28, ), - /* 151 */ array(28, ), - /* 152 */ array(28, ), - /* 153 */ array(28, ), - /* 154 */ array(28, ), - /* 155 */ array(28, ), - /* 156 */ array(28, ), - /* 157 */ array(33, ), - /* 158 */ array(28, ), - /* 159 */ array(63, ), - /* 160 */ array(28, ), - /* 161 */ array(28, ), - /* 162 */ array(13, ), - /* 163 */ array(22, ), - /* 164 */ array(65, ), - /* 165 */ array(28, ), - /* 166 */ array(22, ), - /* 167 */ array(28, ), - /* 168 */ array(28, ), - /* 169 */ array(28, ), - /* 170 */ array(28, ), - /* 171 */ array(28, ), - /* 172 */ array(28, ), - /* 173 */ array(28, ), - /* 174 */ array(66, ), - /* 175 */ array(28, ), - /* 176 */ array(28, ), - /* 177 */ array(28, ), - /* 178 */ array(6, ), - /* 179 */ array(28, ), - /* 180 */ array(28, ), - /* 181 */ array(28, ), - /* 182 */ array(28, ), - /* 183 */ array(28, ), - /* 184 */ array(28, ), - /* 185 */ array(28, ), - /* 186 */ array(28, ), - /* 187 */ array(28, ), - /* 188 */ array(33, ), - /* 189 */ array(28, ), - /* 190 */ array(57, ), - /* 191 */ array(22, ), - /* 192 */ array(28, ), - /* 193 */ array(28, ), - /* 194 */ array(28, ), - /* 195 */ array(28, ), - /* 196 */ array(28, ), - /* 197 */ array(28, ), - /* 198 */ array(), - /* 199 */ array(), - /* 200 */ array(), - /* 201 */ array(), - /* 202 */ array(), - /* 203 */ array(), - /* 204 */ array(), - /* 205 */ array(), - /* 206 */ array(), - /* 207 */ array(), - /* 208 */ array(), - /* 209 */ array(), - /* 210 */ array(), - /* 211 */ array(), - /* 212 */ array(), - /* 213 */ array(), - /* 214 */ array(), - /* 215 */ array(), - /* 216 */ array(), - /* 217 */ array(), - /* 218 */ array(), - /* 219 */ array(), - /* 220 */ array(), - /* 221 */ array(), - /* 222 */ array(), - /* 223 */ array(), - /* 224 */ array(), - /* 225 */ array(), - /* 226 */ array(), - /* 227 */ array(), - /* 228 */ array(), - /* 229 */ array(), - /* 230 */ array(), - /* 231 */ array(), - /* 232 */ array(), - /* 233 */ array(), - /* 234 */ array(), - /* 235 */ array(), - /* 236 */ array(), - /* 237 */ array(), - /* 238 */ array(), - /* 239 */ array(), - /* 240 */ array(), - /* 241 */ array(), - /* 242 */ array(), - /* 243 */ array(), - /* 244 */ array(), - /* 245 */ array(), - /* 246 */ array(), - /* 247 */ array(), - /* 248 */ array(), - /* 249 */ array(), - /* 250 */ array(), - /* 251 */ array(), - /* 252 */ array(), - /* 253 */ array(), - /* 254 */ array(), - /* 255 */ array(), - /* 256 */ array(), - /* 257 */ array(), - /* 258 */ array(), - /* 259 */ array(), - /* 260 */ array(), - /* 261 */ array(), - /* 262 */ array(), - /* 263 */ array(), - /* 264 */ array(), - /* 265 */ array(), - /* 266 */ array(), - /* 267 */ array(), - /* 268 */ array(), - /* 269 */ array(), - /* 270 */ array(), - /* 271 */ array(), - /* 272 */ array(), - /* 273 */ array(), - /* 274 */ array(), - /* 275 */ array(), - /* 276 */ array(), - /* 277 */ array(), -); - static public $yy_default = array( - /* 0 */ 280, 372, 372, 372, 372, 372, 372, 372, 372, 372, - /* 10 */ 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - /* 20 */ 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - /* 30 */ 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - /* 40 */ 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - /* 50 */ 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - /* 60 */ 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - /* 70 */ 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - /* 80 */ 278, 372, 372, 372, 372, 372, 372, 372, 372, 372, - /* 90 */ 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - /* 100 */ 372, 372, 280, 280, 280, 280, 280, 280, 280, 280, - /* 110 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - /* 120 */ 280, 280, 280, 280, 372, 372, 372, 372, 305, 349, - /* 130 */ 350, 351, 353, 348, 361, 352, 372, 334, 372, 354, - /* 140 */ 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - /* 150 */ 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - /* 160 */ 372, 372, 372, 372, 372, 372, 345, 372, 372, 372, - /* 170 */ 372, 372, 372, 372, 372, 372, 372, 372, 334, 372, - /* 180 */ 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, - /* 190 */ 372, 342, 372, 372, 372, 372, 372, 372, 302, 281, - /* 200 */ 279, 328, 368, 319, 284, 285, 327, 311, 326, 312, - /* 210 */ 369, 367, 317, 329, 282, 283, 309, 313, 296, 297, - /* 220 */ 365, 295, 293, 294, 298, 299, 335, 304, 303, 301, - /* 230 */ 300, 336, 292, 291, 359, 362, 337, 360, 370, 371, - /* 240 */ 363, 364, 289, 290, 288, 287, 286, 330, 333, 320, - /* 250 */ 341, 346, 318, 315, 316, 321, 340, 338, 324, 323, - /* 260 */ 339, 322, 347, 314, 355, 356, 344, 343, 331, 332, - /* 270 */ 357, 358, 310, 366, 308, 307, 306, 325, -); -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** self::YYNOCODE is a number which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** self::YYFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** self::YYSTACKDEPTH is the maximum depth of the parser's stack. -** self::YYNSTATE the combined number of states. -** self::YYNRULE the number of rules in the grammar -** self::YYERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ - const YYNOCODE = 97; - const YYSTACKDEPTH = 100; - const YYNSTATE = 278; - const YYNRULE = 94; - const YYERRORSYMBOL = 67; - const YYERRSYMDT = 'yy0'; - const YYFALLBACK = 0; - /** The next table maps tokens into fallback tokens. If a construct - * like the following: - * - * %fallback ID X Y Z. - * - * appears in the grammer, then ID becomes a fallback token for X, Y, - * and Z. Whenever one of the tokens X, Y, or Z is input to the parser - * but it does not parse, the type of the token is changed to ID and - * the parse is retried before an error is thrown. - */ - static public $yyFallback = array( - ); - /** - * Turn parser tracing on by giving a stream to which to write the trace - * and a prompt to preface each trace message. Tracing is turned off - * by making either argument NULL - * - * Inputs: - * - * - A stream resource to which trace output should be written. - * If NULL, then tracing is turned off. - * - A prefix string written at the beginning of every - * line of trace output. If NULL, then tracing is - * turned off. - * - * Outputs: - * - * - None. - * @param resource - * @param string - */ - static function Trace($TraceFILE, $zTracePrompt) - { - if (!$TraceFILE) { - $zTracePrompt = 0; - } elseif (!$zTracePrompt) { - $TraceFILE = 0; - } - self::$yyTraceFILE = $TraceFILE; - self::$yyTracePrompt = $zTracePrompt; - } - - /** - * Output debug information to output (php://output stream) - */ - static function PrintTrace() - { - self::$yyTraceFILE = fopen('php://output', 'w'); - self::$yyTracePrompt = ''; - } - - /** - * @var resource|0 - */ - static public $yyTraceFILE; - /** - * String to prepend to debug output - * @var string|0 - */ - static public $yyTracePrompt; - /** - * @var int - */ - public $yyidx = -1; /* Index of top element in stack */ - /** - * @var int - */ - public $yyerrcnt; /* Shifts left before out of the error */ - /** - * @var array - */ - public $yystack = array(); /* The parser's stack */ - - /** - * For tracing shifts, the names of all terminals and nonterminals - * are required. The following table supplies these names - * @var array - */ - static public $yyTokenName = array( - '$', 'T_TAG_OPEN', 'T_NOT', 'T_AND', - 'T_OR', 'T_QUESTION', 'T_COLON', 'T_EQ', - 'T_NE', 'T_GT', 'T_GE', 'T_LT', - 'T_LE', 'T_IN', 'T_PLUS', 'T_MINUS', - 'T_CONCAT', 'T_TIMES', 'T_DIV', 'T_MOD', - 'T_PIPE', 'T_BITWISE', 'T_FILTER_PIPE', 'T_HTML', - 'T_COMMENT', 'T_PRINT_OPEN', 'T_PRINT_CLOSE', 'T_EXTENDS', - 'T_TAG_CLOSE', 'T_INCLUDE', 'T_AUTOESCAPE', 'T_CUSTOM_END', - 'T_CUSTOM_TAG', 'T_AS', 'T_CUSTOM_BLOCK', 'T_SPACEFULL', - 'T_WITH', 'T_SET', 'T_ASSIGN', 'T_LOAD', - 'T_FOR', 'T_COMMA', 'T_STEP', 'T_EMPTY', - 'T_IF', 'T_ELSE', 'T_IFCHANGED', 'T_IFEQUAL', - 'T_IFNOTEQUAL', 'T_BLOCK', 'T_FILTER', 'T_REGROUP', - 'T_BY', 'T_TRUE', 'T_FALSE', 'T_STRING', - 'T_INTL', 'T_RPARENT', 'T_LPARENT', 'T_OBJ', - 'T_DOT', 'T_CLASS', 'T_BRACKETS_OPEN', 'T_BRACKETS_CLOSE', - 'T_ALPHA', 'T_DOTDOT', 'T_NUMERIC', 'error', - 'start', 'body', 'code', 'stmts', - 'expr', 'var_or_string', 'stmt', 'for_stmt', - 'ifchanged_stmt', 'block_stmt', 'filter_stmt', 'if_stmt', - 'custom_tag', 'alias', 'ifequal', 'varname', - 'params', 'regroup', 'string', 'for_def', - 'filtered_var', 'range', 'numvar', 'fvar_or_string', - 'number', 'varname_args', 'varpart', 'varpart_single', - ); - - /** - * For tracing reduce actions, the names of all rules are required. - * @var array - */ - static public $yyRuleName = array( - /* 0 */ "start ::= body", - /* 1 */ "body ::= body code", - /* 2 */ "body ::=", - /* 3 */ "code ::= T_TAG_OPEN stmts", - /* 4 */ "code ::= T_HTML", - /* 5 */ "code ::= T_COMMENT", - /* 6 */ "code ::= T_PRINT_OPEN expr T_PRINT_CLOSE", - /* 7 */ "stmts ::= T_EXTENDS var_or_string T_TAG_CLOSE", - /* 8 */ "stmts ::= stmt T_TAG_CLOSE", - /* 9 */ "stmts ::= for_stmt", - /* 10 */ "stmts ::= ifchanged_stmt", - /* 11 */ "stmts ::= block_stmt", - /* 12 */ "stmts ::= filter_stmt", - /* 13 */ "stmts ::= if_stmt", - /* 14 */ "stmts ::= T_INCLUDE var_or_string T_TAG_CLOSE", - /* 15 */ "stmts ::= custom_tag", - /* 16 */ "stmts ::= alias", - /* 17 */ "stmts ::= ifequal", - /* 18 */ "stmts ::= T_AUTOESCAPE varname T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 19 */ "custom_tag ::= T_CUSTOM_TAG T_TAG_CLOSE", - /* 20 */ "custom_tag ::= T_CUSTOM_TAG T_AS varname T_TAG_CLOSE", - /* 21 */ "custom_tag ::= T_CUSTOM_TAG params T_TAG_CLOSE", - /* 22 */ "custom_tag ::= T_CUSTOM_TAG params T_AS varname T_TAG_CLOSE", - /* 23 */ "custom_tag ::= T_CUSTOM_BLOCK T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 24 */ "custom_tag ::= T_CUSTOM_BLOCK params T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 25 */ "custom_tag ::= T_SPACEFULL T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 26 */ "alias ::= T_WITH varname T_AS varname T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 27 */ "stmt ::= T_SET varname T_ASSIGN expr", - /* 28 */ "stmt ::= regroup", - /* 29 */ "stmt ::= T_LOAD string", - /* 30 */ "for_def ::= T_FOR varname T_IN filtered_var T_TAG_CLOSE", - /* 31 */ "for_def ::= T_FOR varname T_COMMA varname T_IN filtered_var T_TAG_CLOSE", - /* 32 */ "for_stmt ::= for_def body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 33 */ "for_stmt ::= T_FOR varname T_IN range T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 34 */ "for_stmt ::= T_FOR varname T_IN range T_STEP numvar T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 35 */ "for_stmt ::= for_def body T_TAG_OPEN T_EMPTY T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 36 */ "if_stmt ::= T_IF expr T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 37 */ "if_stmt ::= T_IF expr T_TAG_CLOSE body T_TAG_OPEN T_ELSE T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 38 */ "ifchanged_stmt ::= T_IFCHANGED T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 39 */ "ifchanged_stmt ::= T_IFCHANGED params T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 40 */ "ifchanged_stmt ::= T_IFCHANGED T_TAG_CLOSE body T_TAG_OPEN T_ELSE T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 41 */ "ifchanged_stmt ::= T_IFCHANGED params T_TAG_CLOSE body T_TAG_OPEN T_ELSE T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 42 */ "ifequal ::= T_IFEQUAL fvar_or_string fvar_or_string T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 43 */ "ifequal ::= T_IFEQUAL fvar_or_string fvar_or_string T_TAG_CLOSE body T_TAG_OPEN T_ELSE T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 44 */ "ifequal ::= T_IFNOTEQUAL fvar_or_string fvar_or_string T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 45 */ "ifequal ::= T_IFNOTEQUAL fvar_or_string fvar_or_string T_TAG_CLOSE body T_TAG_OPEN T_ELSE T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 46 */ "block_stmt ::= T_BLOCK varname T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 47 */ "block_stmt ::= T_BLOCK varname T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END varname T_TAG_CLOSE", - /* 48 */ "block_stmt ::= T_BLOCK number T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 49 */ "block_stmt ::= T_BLOCK number T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END number T_TAG_CLOSE", - /* 50 */ "filter_stmt ::= T_FILTER filtered_var T_TAG_CLOSE body T_TAG_OPEN T_CUSTOM_END T_TAG_CLOSE", - /* 51 */ "regroup ::= T_REGROUP filtered_var T_BY varname T_AS varname", - /* 52 */ "filtered_var ::= filtered_var T_FILTER_PIPE varname_args", - /* 53 */ "filtered_var ::= string T_FILTER_PIPE varname_args", - /* 54 */ "filtered_var ::= varname_args", - /* 55 */ "varname_args ::= varname T_COLON var_or_string", - /* 56 */ "varname_args ::= varname", - /* 57 */ "params ::= params var_or_string", - /* 58 */ "params ::= params T_COMMA var_or_string", - /* 59 */ "params ::= var_or_string", - /* 60 */ "var_or_string ::= varname", - /* 61 */ "var_or_string ::= number", - /* 62 */ "var_or_string ::= T_TRUE|T_FALSE", - /* 63 */ "var_or_string ::= string", - /* 64 */ "fvar_or_string ::= filtered_var", - /* 65 */ "fvar_or_string ::= number", - /* 66 */ "fvar_or_string ::= T_TRUE|T_FALSE", - /* 67 */ "fvar_or_string ::= string", - /* 68 */ "string ::= T_STRING", - /* 69 */ "string ::= T_INTL T_STRING T_RPARENT", - /* 70 */ "expr ::= expr T_QUESTION expr T_COLON expr", - /* 71 */ "expr ::= T_NOT expr", - /* 72 */ "expr ::= expr T_AND expr", - /* 73 */ "expr ::= expr T_OR expr", - /* 74 */ "expr ::= expr T_PLUS|T_MINUS|T_CONCAT expr", - /* 75 */ "expr ::= expr T_EQ|T_NE|T_GT|T_GE|T_LT|T_LE|T_IN expr", - /* 76 */ "expr ::= expr T_TIMES|T_DIV|T_MOD expr", - /* 77 */ "expr ::= expr T_BITWISE expr", - /* 78 */ "expr ::= expr T_PIPE expr", - /* 79 */ "expr ::= T_LPARENT expr T_RPARENT", - /* 80 */ "expr ::= fvar_or_string", - /* 81 */ "varname ::= varpart T_LPARENT T_RPARENT", - /* 82 */ "varname ::= varpart T_LPARENT params T_RPARENT", - /* 83 */ "varname ::= varpart", - /* 84 */ "varpart ::= varpart T_OBJ|T_DOT varpart_single", - /* 85 */ "varpart ::= varpart T_CLASS varpart_single", - /* 86 */ "varpart ::= varpart T_BRACKETS_OPEN var_or_string T_BRACKETS_CLOSE", - /* 87 */ "varpart ::= varpart_single", - /* 88 */ "varpart_single ::= T_ALPHA|T_BLOCK|T_CUSTOM_TAG|T_CUSTOM_END|T_CUSTOM_BLOCK", - /* 89 */ "range ::= numvar T_DOTDOT numvar", - /* 90 */ "numvar ::= number", - /* 91 */ "numvar ::= varname", - /* 92 */ "number ::= T_NUMERIC", - /* 93 */ "number ::= T_MINUS T_NUMERIC", - ); - - /** - * This function returns the symbolic name associated with a token - * value. - * @param int - * @return string - */ - function tokenName($tokenType) - { - if ($tokenType === 0) { - return 'End of Input'; - } - if ($tokenType > 0 && $tokenType < count(self::$yyTokenName)) { - return self::$yyTokenName[$tokenType]; - } else { - return "Unknown"; - } - } - - /** - * The following function deletes the value associated with a - * symbol. The symbol can be either a terminal or nonterminal. - * @param int the symbol code - * @param mixed the symbol's value - */ - static function yy_destructor($yymajor, $yypminor) - { - switch ($yymajor) { - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - default: break; /* If no destructor action specified: do nothing */ - } - } - - /** - * Pop the parser's stack once. - * - * If there is a destructor routine associated with the token which - * is popped from the stack, then call it. - * - * Return the major token number for the symbol popped. - * @param Haanga_yyParser - * @return int - */ - function yy_pop_parser_stack() - { - if (!count($this->yystack)) { - return; - } - $yytos = array_pop($this->yystack); - if (self::$yyTraceFILE && $this->yyidx >= 0) { - fwrite(self::$yyTraceFILE, - self::$yyTracePrompt . 'Popping ' . self::$yyTokenName[$yytos->major] . - "\n"); - } - $yymajor = $yytos->major; - self::yy_destructor($yymajor, $yytos->minor); - $this->yyidx--; - return $yymajor; - } - - /** - * Deallocate and destroy a parser. Destructors are all called for - * all stack elements before shutting the parser down. - */ - function __destruct() - { - while ($this->yyidx >= 0) { - $this->yy_pop_parser_stack(); - } - if (is_resource(self::$yyTraceFILE)) { - fclose(self::$yyTraceFILE); - } - } - - /** - * Based on the current state and parser stack, get a list of all - * possible lookahead tokens - * @param int - * @return array - */ - function yy_get_expected_tokens($token) - { - $state = $this->yystack[$this->yyidx]->stateno; - $expected = self::$yyExpectedTokens[$state]; - if (in_array($token, self::$yyExpectedTokens[$state], true)) { - return $expected; - } - $stack = $this->yystack; - $yyidx = $this->yyidx; - do { - $yyact = $this->yy_find_shift_action($token); - if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) { - // reduce action - $done = 0; - do { - if ($done++ == 100) { - $this->yyidx = $yyidx; - $this->yystack = $stack; - // too much recursion prevents proper detection - // so give up - return array_unique($expected); - } - $yyruleno = $yyact - self::YYNSTATE; - $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs']; - $nextstate = $this->yy_find_reduce_action( - $this->yystack[$this->yyidx]->stateno, - self::$yyRuleInfo[$yyruleno]['lhs']); - if (isset(self::$yyExpectedTokens[$nextstate])) { - $expected += self::$yyExpectedTokens[$nextstate]; - if (in_array($token, - self::$yyExpectedTokens[$nextstate], true)) { - $this->yyidx = $yyidx; - $this->yystack = $stack; - return array_unique($expected); - } - } - if ($nextstate < self::YYNSTATE) { - // we need to shift a non-terminal - $this->yyidx++; - $x = new Haanga_yyStackEntry; - $x->stateno = $nextstate; - $x->major = self::$yyRuleInfo[$yyruleno]['lhs']; - $this->yystack[$this->yyidx] = $x; - continue 2; - } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) { - $this->yyidx = $yyidx; - $this->yystack = $stack; - // the last token was just ignored, we can't accept - // by ignoring input, this is in essence ignoring a - // syntax error! - return array_unique($expected); - } elseif ($nextstate === self::YY_NO_ACTION) { - $this->yyidx = $yyidx; - $this->yystack = $stack; - // input accepted, but not shifted (I guess) - return $expected; - } else { - $yyact = $nextstate; - } - } while (true); - } - break; - } while (true); - return array_unique($expected); - } - - /** - * Based on the parser state and current parser stack, determine whether - * the lookahead token is possible. - * - * The parser will convert the token value to an error token if not. This - * catches some unusual edge cases where the parser would fail. - * @param int - * @return bool - */ - function yy_is_expected_token($token) - { - if ($token === 0) { - return true; // 0 is not part of this - } - $state = $this->yystack[$this->yyidx]->stateno; - if (in_array($token, self::$yyExpectedTokens[$state], true)) { - return true; - } - $stack = $this->yystack; - $yyidx = $this->yyidx; - do { - $yyact = $this->yy_find_shift_action($token); - if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) { - // reduce action - $done = 0; - do { - if ($done++ == 100) { - $this->yyidx = $yyidx; - $this->yystack = $stack; - // too much recursion prevents proper detection - // so give up - return true; - } - $yyruleno = $yyact - self::YYNSTATE; - $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs']; - $nextstate = $this->yy_find_reduce_action( - $this->yystack[$this->yyidx]->stateno, - self::$yyRuleInfo[$yyruleno]['lhs']); - if (isset(self::$yyExpectedTokens[$nextstate]) && - in_array($token, self::$yyExpectedTokens[$nextstate], true)) { - $this->yyidx = $yyidx; - $this->yystack = $stack; - return true; - } - if ($nextstate < self::YYNSTATE) { - // we need to shift a non-terminal - $this->yyidx++; - $x = new Haanga_yyStackEntry; - $x->stateno = $nextstate; - $x->major = self::$yyRuleInfo[$yyruleno]['lhs']; - $this->yystack[$this->yyidx] = $x; - continue 2; - } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) { - $this->yyidx = $yyidx; - $this->yystack = $stack; - if (!$token) { - // end of input: this is valid - return true; - } - // the last token was just ignored, we can't accept - // by ignoring input, this is in essence ignoring a - // syntax error! - return false; - } elseif ($nextstate === self::YY_NO_ACTION) { - $this->yyidx = $yyidx; - $this->yystack = $stack; - // input accepted, but not shifted (I guess) - return true; - } else { - $yyact = $nextstate; - } - } while (true); - } - break; - } while (true); - $this->yyidx = $yyidx; - $this->yystack = $stack; - return true; - } - - /** - * Find the appropriate action for a parser given the terminal - * look-ahead token iLookAhead. - * - * If the look-ahead token is YYNOCODE, then check to see if the action is - * independent of the look-ahead. If it is, return the action, otherwise - * return YY_NO_ACTION. - * @param int The look-ahead token - */ - function yy_find_shift_action($iLookAhead) - { - $stateno = $this->yystack[$this->yyidx]->stateno; - - /* if ($this->yyidx < 0) return self::YY_NO_ACTION; */ - if (!isset(self::$yy_shift_ofst[$stateno])) { - // no shift actions - return self::$yy_default[$stateno]; - } - $i = self::$yy_shift_ofst[$stateno]; - if ($i === self::YY_SHIFT_USE_DFLT) { - return self::$yy_default[$stateno]; - } - if ($iLookAhead == self::YYNOCODE) { - return self::YY_NO_ACTION; - } - $i += $iLookAhead; - if ($i < 0 || $i >= self::YY_SZ_ACTTAB || - self::$yy_lookahead[$i] != $iLookAhead) { - if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback) - && ($iFallback = self::$yyFallback[$iLookAhead]) != 0) { - if (self::$yyTraceFILE) { - fwrite(self::$yyTraceFILE, self::$yyTracePrompt . "FALLBACK " . - self::$yyTokenName[$iLookAhead] . " => " . - self::$yyTokenName[$iFallback] . "\n"); - } - return $this->yy_find_shift_action($iFallback); - } - return self::$yy_default[$stateno]; - } else { - return self::$yy_action[$i]; - } - } - - /** - * Find the appropriate action for a parser given the non-terminal - * look-ahead token $iLookAhead. - * - * If the look-ahead token is self::YYNOCODE, then check to see if the action is - * independent of the look-ahead. If it is, return the action, otherwise - * return self::YY_NO_ACTION. - * @param int Current state number - * @param int The look-ahead token - */ - function yy_find_reduce_action($stateno, $iLookAhead) - { - /* $stateno = $this->yystack[$this->yyidx]->stateno; */ - - if (!isset(self::$yy_reduce_ofst[$stateno])) { - return self::$yy_default[$stateno]; - } - $i = self::$yy_reduce_ofst[$stateno]; - if ($i == self::YY_REDUCE_USE_DFLT) { - return self::$yy_default[$stateno]; - } - if ($iLookAhead == self::YYNOCODE) { - return self::YY_NO_ACTION; - } - $i += $iLookAhead; - if ($i < 0 || $i >= self::YY_SZ_ACTTAB || - self::$yy_lookahead[$i] != $iLookAhead) { - return self::$yy_default[$stateno]; - } else { - return self::$yy_action[$i]; - } - } - - /** - * Perform a shift action. - * @param int The new state to shift in - * @param int The major token to shift in - * @param mixed the minor token to shift in - */ - function yy_shift($yyNewState, $yyMajor, $yypMinor) - { - $this->yyidx++; - if ($this->yyidx >= self::YYSTACKDEPTH) { - $this->yyidx--; - if (self::$yyTraceFILE) { - fprintf(self::$yyTraceFILE, "%sStack Overflow!\n", self::$yyTracePrompt); - } - while ($this->yyidx >= 0) { - $this->yy_pop_parser_stack(); - } - /* Here code is inserted which will execute if the parser - ** stack ever overflows */ - return; - } - $yytos = new Haanga_yyStackEntry; - $yytos->stateno = $yyNewState; - $yytos->major = $yyMajor; - $yytos->minor = $yypMinor; - array_push($this->yystack, $yytos); - if (self::$yyTraceFILE && $this->yyidx > 0) { - fprintf(self::$yyTraceFILE, "%sShift %d\n", self::$yyTracePrompt, - $yyNewState); - fprintf(self::$yyTraceFILE, "%sStack:", self::$yyTracePrompt); - for ($i = 1; $i <= $this->yyidx; $i++) { - fprintf(self::$yyTraceFILE, " %s", - self::$yyTokenName[$this->yystack[$i]->major]); - } - fwrite(self::$yyTraceFILE,"\n"); - } - } - - /** - * The following table contains information about every rule that - * is used during the reduce. - * - * <pre> - * array( - * array( - * int $lhs; Symbol on the left-hand side of the rule - * int $nrhs; Number of right-hand side symbols in the rule - * ),... - * ); - * </pre> - */ - static public $yyRuleInfo = array( - array( 'lhs' => 68, 'rhs' => 1 ), - array( 'lhs' => 69, 'rhs' => 2 ), - array( 'lhs' => 69, 'rhs' => 0 ), - array( 'lhs' => 70, 'rhs' => 2 ), - array( 'lhs' => 70, 'rhs' => 1 ), - array( 'lhs' => 70, 'rhs' => 1 ), - array( 'lhs' => 70, 'rhs' => 3 ), - array( 'lhs' => 71, 'rhs' => 3 ), - array( 'lhs' => 71, 'rhs' => 2 ), - array( 'lhs' => 71, 'rhs' => 1 ), - array( 'lhs' => 71, 'rhs' => 1 ), - array( 'lhs' => 71, 'rhs' => 1 ), - array( 'lhs' => 71, 'rhs' => 1 ), - array( 'lhs' => 71, 'rhs' => 1 ), - array( 'lhs' => 71, 'rhs' => 3 ), - array( 'lhs' => 71, 'rhs' => 1 ), - array( 'lhs' => 71, 'rhs' => 1 ), - array( 'lhs' => 71, 'rhs' => 1 ), - array( 'lhs' => 71, 'rhs' => 7 ), - array( 'lhs' => 80, 'rhs' => 2 ), - array( 'lhs' => 80, 'rhs' => 4 ), - array( 'lhs' => 80, 'rhs' => 3 ), - array( 'lhs' => 80, 'rhs' => 5 ), - array( 'lhs' => 80, 'rhs' => 6 ), - array( 'lhs' => 80, 'rhs' => 7 ), - array( 'lhs' => 80, 'rhs' => 6 ), - array( 'lhs' => 81, 'rhs' => 9 ), - array( 'lhs' => 74, 'rhs' => 4 ), - array( 'lhs' => 74, 'rhs' => 1 ), - array( 'lhs' => 74, 'rhs' => 2 ), - array( 'lhs' => 87, 'rhs' => 5 ), - array( 'lhs' => 87, 'rhs' => 7 ), - array( 'lhs' => 75, 'rhs' => 5 ), - array( 'lhs' => 75, 'rhs' => 9 ), - array( 'lhs' => 75, 'rhs' => 11 ), - array( 'lhs' => 75, 'rhs' => 9 ), - array( 'lhs' => 79, 'rhs' => 7 ), - array( 'lhs' => 79, 'rhs' => 11 ), - array( 'lhs' => 76, 'rhs' => 6 ), - array( 'lhs' => 76, 'rhs' => 7 ), - array( 'lhs' => 76, 'rhs' => 10 ), - array( 'lhs' => 76, 'rhs' => 11 ), - array( 'lhs' => 82, 'rhs' => 8 ), - array( 'lhs' => 82, 'rhs' => 12 ), - array( 'lhs' => 82, 'rhs' => 8 ), - array( 'lhs' => 82, 'rhs' => 12 ), - array( 'lhs' => 77, 'rhs' => 7 ), - array( 'lhs' => 77, 'rhs' => 8 ), - array( 'lhs' => 77, 'rhs' => 7 ), - array( 'lhs' => 77, 'rhs' => 8 ), - array( 'lhs' => 78, 'rhs' => 7 ), - array( 'lhs' => 85, 'rhs' => 6 ), - array( 'lhs' => 88, 'rhs' => 3 ), - array( 'lhs' => 88, 'rhs' => 3 ), - array( 'lhs' => 88, 'rhs' => 1 ), - array( 'lhs' => 93, 'rhs' => 3 ), - array( 'lhs' => 93, 'rhs' => 1 ), - array( 'lhs' => 84, 'rhs' => 2 ), - array( 'lhs' => 84, 'rhs' => 3 ), - array( 'lhs' => 84, 'rhs' => 1 ), - array( 'lhs' => 73, 'rhs' => 1 ), - array( 'lhs' => 73, 'rhs' => 1 ), - array( 'lhs' => 73, 'rhs' => 1 ), - array( 'lhs' => 73, 'rhs' => 1 ), - array( 'lhs' => 91, 'rhs' => 1 ), - array( 'lhs' => 91, 'rhs' => 1 ), - array( 'lhs' => 91, 'rhs' => 1 ), - array( 'lhs' => 91, 'rhs' => 1 ), - array( 'lhs' => 86, 'rhs' => 1 ), - array( 'lhs' => 86, 'rhs' => 3 ), - array( 'lhs' => 72, 'rhs' => 5 ), - array( 'lhs' => 72, 'rhs' => 2 ), - array( 'lhs' => 72, 'rhs' => 3 ), - array( 'lhs' => 72, 'rhs' => 3 ), - array( 'lhs' => 72, 'rhs' => 3 ), - array( 'lhs' => 72, 'rhs' => 3 ), - array( 'lhs' => 72, 'rhs' => 3 ), - array( 'lhs' => 72, 'rhs' => 3 ), - array( 'lhs' => 72, 'rhs' => 3 ), - array( 'lhs' => 72, 'rhs' => 3 ), - array( 'lhs' => 72, 'rhs' => 1 ), - array( 'lhs' => 83, 'rhs' => 3 ), - array( 'lhs' => 83, 'rhs' => 4 ), - array( 'lhs' => 83, 'rhs' => 1 ), - array( 'lhs' => 94, 'rhs' => 3 ), - array( 'lhs' => 94, 'rhs' => 3 ), - array( 'lhs' => 94, 'rhs' => 4 ), - array( 'lhs' => 94, 'rhs' => 1 ), - array( 'lhs' => 95, 'rhs' => 1 ), - array( 'lhs' => 89, 'rhs' => 3 ), - array( 'lhs' => 90, 'rhs' => 1 ), - array( 'lhs' => 90, 'rhs' => 1 ), - array( 'lhs' => 92, 'rhs' => 1 ), - array( 'lhs' => 92, 'rhs' => 2 ), - ); - - /** - * The following table contains a mapping of reduce action to method name - * that handles the reduction. - * - * If a rule is not set, it has no handler. - */ - static public $yyReduceMap = array( - 0 => 0, - 1 => 1, - 2 => 2, - 3 => 3, - 4 => 4, - 5 => 5, - 6 => 6, - 7 => 7, - 8 => 8, - 69 => 8, - 9 => 9, - 10 => 9, - 11 => 9, - 12 => 9, - 13 => 9, - 15 => 9, - 16 => 9, - 17 => 9, - 28 => 9, - 56 => 9, - 68 => 9, - 80 => 9, - 87 => 9, - 88 => 9, - 90 => 9, - 92 => 9, - 14 => 14, - 18 => 18, - 19 => 19, - 20 => 20, - 21 => 21, - 22 => 22, - 23 => 23, - 24 => 24, - 25 => 25, - 26 => 26, - 27 => 27, - 29 => 29, - 30 => 30, - 31 => 31, - 32 => 32, - 33 => 33, - 34 => 34, - 35 => 35, - 36 => 36, - 37 => 37, - 38 => 38, - 39 => 39, - 40 => 40, - 41 => 41, - 42 => 42, - 43 => 43, - 44 => 44, - 45 => 45, - 46 => 46, - 47 => 47, - 49 => 47, - 48 => 48, - 50 => 50, - 51 => 51, - 52 => 52, - 58 => 52, - 53 => 53, - 54 => 54, - 59 => 54, - 55 => 55, - 57 => 57, - 60 => 60, - 91 => 60, - 61 => 61, - 65 => 61, - 62 => 62, - 66 => 62, - 63 => 63, - 67 => 63, - 64 => 64, - 70 => 70, - 71 => 71, - 72 => 72, - 73 => 72, - 74 => 72, - 76 => 72, - 75 => 75, - 77 => 77, - 78 => 78, - 79 => 79, - 81 => 81, - 82 => 82, - 83 => 83, - 84 => 84, - 85 => 85, - 86 => 86, - 89 => 89, - 93 => 93, - ); - /* Beginning here are the reduction cases. A typical example - ** follows: - ** #line <lineno> <grammarfile> - ** function yy_r0($yymsp){ ... } // User supplied code - ** #line <lineno> <thisfile> - */ -#line 81 "lib/Haanga/Compiler/Parser.y" - function yy_r0(){ $this->body = $this->yystack[$this->yyidx + 0]->minor; } -#line 1765 "lib/Haanga/Compiler/Parser.php" -#line 83 "lib/Haanga/Compiler/Parser.y" - function yy_r1(){ $this->_retvalue=$this->yystack[$this->yyidx + -1]->minor; $this->_retvalue[] = $this->yystack[$this->yyidx + 0]->minor; } -#line 1768 "lib/Haanga/Compiler/Parser.php" -#line 84 "lib/Haanga/Compiler/Parser.y" - function yy_r2(){ $this->_retvalue = array(); } -#line 1771 "lib/Haanga/Compiler/Parser.php" -#line 87 "lib/Haanga/Compiler/Parser.y" - function yy_r3(){ if (count($this->yystack[$this->yyidx + 0]->minor)) $this->yystack[$this->yyidx + 0]->minor['line'] = $this->lex->getLine(); $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; } -#line 1774 "lib/Haanga/Compiler/Parser.php" -#line 89 "lib/Haanga/Compiler/Parser.y" - function yy_r4(){ - $this->_retvalue = array('operation' => 'html', 'html' => $this->yystack[$this->yyidx + 0]->minor, 'line' => $this->lex->getLine() ); - } -#line 1779 "lib/Haanga/Compiler/Parser.php" -#line 93 "lib/Haanga/Compiler/Parser.y" - function yy_r5(){ - $this->yystack[$this->yyidx + 0]->minor=rtrim($this->yystack[$this->yyidx + 0]->minor); $this->_retvalue = array('operation' => 'comment', 'comment' => $this->yystack[$this->yyidx + 0]->minor); - } -#line 1784 "lib/Haanga/Compiler/Parser.php" -#line 97 "lib/Haanga/Compiler/Parser.y" - function yy_r6(){ - $this->_retvalue = array('operation' => 'print_var', 'expr' => $this->yystack[$this->yyidx + -1]->minor, 'line' => $this->lex->getLine() ); - } -#line 1789 "lib/Haanga/Compiler/Parser.php" -#line 101 "lib/Haanga/Compiler/Parser.y" - function yy_r7(){ $this->_retvalue = array('operation' => 'base', $this->yystack[$this->yyidx + -1]->minor); } -#line 1792 "lib/Haanga/Compiler/Parser.php" -#line 102 "lib/Haanga/Compiler/Parser.y" - function yy_r8(){ $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor; } -#line 1795 "lib/Haanga/Compiler/Parser.php" -#line 103 "lib/Haanga/Compiler/Parser.y" - function yy_r9(){ $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; } -#line 1798 "lib/Haanga/Compiler/Parser.php" -#line 108 "lib/Haanga/Compiler/Parser.y" - function yy_r14(){ $this->_retvalue = array('operation' => 'include', $this->yystack[$this->yyidx + -1]->minor); } -#line 1801 "lib/Haanga/Compiler/Parser.php" -#line 112 "lib/Haanga/Compiler/Parser.y" - function yy_r18(){ - $this->yystack[$this->yyidx + -5]->minor = strtolower($this->yystack[$this->yyidx + -5]->minor); - if ($this->yystack[$this->yyidx + -5]->minor != 'on' && $this->yystack[$this->yyidx + -5]->minor != 'off') { - $this->Error("Invalid autoescape param (".$this->yystack[$this->yyidx + -5]->minor."), it must be on or off"); - } - if ($this->yystack[$this->yyidx + -1]->minor != "endautoescape") { - $this->Error("Invalid close tag ".$this->yystack[$this->yyidx + -1]->minor.", it must be endautoescape"); - } - $this->_retvalue = array('operation' => 'autoescape', 'value' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1813 "lib/Haanga/Compiler/Parser.php" -#line 126 "lib/Haanga/Compiler/Parser.y" - function yy_r19(){ - $this->_retvalue = array('operation' => 'custom_tag', 'name' => $this->yystack[$this->yyidx + -1]->minor, 'list'=>array()); - } -#line 1818 "lib/Haanga/Compiler/Parser.php" -#line 129 "lib/Haanga/Compiler/Parser.y" - function yy_r20(){ - $this->_retvalue = array('operation' => 'custom_tag', 'name' => $this->yystack[$this->yyidx + -3]->minor, 'as' => $this->yystack[$this->yyidx + -1]->minor, 'list'=>array()); - } -#line 1823 "lib/Haanga/Compiler/Parser.php" -#line 132 "lib/Haanga/Compiler/Parser.y" - function yy_r21(){ - $this->_retvalue = array('operation' => 'custom_tag', 'name' => $this->yystack[$this->yyidx + -2]->minor, 'list' => $this->yystack[$this->yyidx + -1]->minor); - } -#line 1828 "lib/Haanga/Compiler/Parser.php" -#line 135 "lib/Haanga/Compiler/Parser.y" - function yy_r22(){ - $this->_retvalue = array('operation' => 'custom_tag', 'name' => $this->yystack[$this->yyidx + -4]->minor, 'as' => $this->yystack[$this->yyidx + -1]->minor, 'list' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1833 "lib/Haanga/Compiler/Parser.php" -#line 140 "lib/Haanga/Compiler/Parser.y" - function yy_r23(){ - if ('end'.$this->yystack[$this->yyidx + -5]->minor != $this->yystack[$this->yyidx + -1]->minor) { - $this->error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor); - } - $this->_retvalue = array('operation' => 'custom_tag', 'name' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor, 'list' => array()); - } -#line 1841 "lib/Haanga/Compiler/Parser.php" -#line 146 "lib/Haanga/Compiler/Parser.y" - function yy_r24(){ - if ('end'.$this->yystack[$this->yyidx + -6]->minor != $this->yystack[$this->yyidx + -1]->minor) { - $this->error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor); - } - $this->_retvalue = array('operation' => 'custom_tag', 'name' => $this->yystack[$this->yyidx + -6]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor, 'list' => $this->yystack[$this->yyidx + -5]->minor); - } -#line 1849 "lib/Haanga/Compiler/Parser.php" -#line 154 "lib/Haanga/Compiler/Parser.y" - function yy_r25(){ - if ('endspacefull' != $this->yystack[$this->yyidx + -1]->minor) { - $this->error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor); - } - $this->_retvalue = array('operation' => 'spacefull', 'body' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1857 "lib/Haanga/Compiler/Parser.php" -#line 162 "lib/Haanga/Compiler/Parser.y" - function yy_r26(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endwith") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endwith"); - } - $this->_retvalue = array('operation' => 'alias', 'var' => $this->yystack[$this->yyidx + -7]->minor, 'as' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1865 "lib/Haanga/Compiler/Parser.php" -#line 170 "lib/Haanga/Compiler/Parser.y" - function yy_r27(){ $this->_retvalue = array('operation' => 'set', 'var' => $this->yystack[$this->yyidx + -2]->minor,'expr' => $this->yystack[$this->yyidx + 0]->minor); } -#line 1868 "lib/Haanga/Compiler/Parser.php" -#line 172 "lib/Haanga/Compiler/Parser.y" - function yy_r29(){ - if (is_file(dirname($this->file) . '/' . $this->yystack[$this->yyidx + 0]->minor)) { - $this->yystack[$this->yyidx + 0]->minor = dirname($this->file) . '/' . $this->yystack[$this->yyidx + 0]->minor; - } else if (is_file(getcwd() . '/' . $this->yystack[$this->yyidx + 0]->minor)) { - $this->yystack[$this->yyidx + 0]->minor = getcwd() . '/' . $this->yystack[$this->yyidx + 0]->minor; - } - if (!is_file($this->yystack[$this->yyidx + 0]->minor) || !Haanga_Compiler::getOption('enable_load')) { - $this->error($this->yystack[$this->yyidx + 0]->minor." is not a valid file"); - } - require_once $this->yystack[$this->yyidx + 0]->minor; - } -#line 1881 "lib/Haanga/Compiler/Parser.php" -#line 186 "lib/Haanga/Compiler/Parser.y" - function yy_r30(){ - $var = $this->compiler->get_context($this->yystack[$this->yyidx + -1]->minor[0]); - if (is_array($var) || $var instanceof Iterator) { - /* let's check if it is an object or array */ - $this->compiler->set_context($this->yystack[$this->yyidx + -3]->minor, current($var)); - } - $this->_retvalue = array('operation' => 'loop', 'variable' => $this->yystack[$this->yyidx + -3]->minor, 'index' => NULL, 'array' => $this->yystack[$this->yyidx + -1]->minor); - } -#line 1891 "lib/Haanga/Compiler/Parser.php" -#line 194 "lib/Haanga/Compiler/Parser.y" - function yy_r31(){ - $var = $this->compiler->get_context($this->yystack[$this->yyidx + -1]->minor[0]); - if (is_array($var) || $var instanceof Iterator) { - /* let's check if it is an object or array */ - $this->compiler->set_context($this->yystack[$this->yyidx + -3]->minor, current($var)); - } - $this->_retvalue = array('operation' => 'loop', 'variable' => $this->yystack[$this->yyidx + -3]->minor, 'index' => $this->yystack[$this->yyidx + -5]->minor, 'array' => $this->yystack[$this->yyidx + -1]->minor); - - } -#line 1902 "lib/Haanga/Compiler/Parser.php" -#line 204 "lib/Haanga/Compiler/Parser.y" - function yy_r32(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endfor") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endfor"); - } - $this->_retvalue = $this->yystack[$this->yyidx + -4]->minor; - $this->_retvalue['body'] = $this->yystack[$this->yyidx + -3]->minor; - } -#line 1911 "lib/Haanga/Compiler/Parser.php" -#line 212 "lib/Haanga/Compiler/Parser.y" - function yy_r33(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endfor") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endfor"); - } - $this->_retvalue = array('operation' => 'loop', 'variable' => $this->yystack[$this->yyidx + -7]->minor, 'range' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor, 'variable' => $this->yystack[$this->yyidx + -7]->minor, 'step' => 1); - } -#line 1919 "lib/Haanga/Compiler/Parser.php" -#line 219 "lib/Haanga/Compiler/Parser.y" - function yy_r34(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endfor") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endfor"); - } - $this->_retvalue = array('operation' => 'loop', 'variable' => $this->yystack[$this->yyidx + -9]->minor, 'range' => $this->yystack[$this->yyidx + -7]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor, 'variable' => $this->yystack[$this->yyidx + -9]->minor, 'step' => $this->yystack[$this->yyidx + -5]->minor); - } -#line 1927 "lib/Haanga/Compiler/Parser.php" -#line 226 "lib/Haanga/Compiler/Parser.y" - function yy_r35(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endfor") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endfor"); - } - $this->_retvalue = $this->yystack[$this->yyidx + -8]->minor; - $this->_retvalue['body'] = $this->yystack[$this->yyidx + -7]->minor; - $this->_retvalue['empty'] = $this->yystack[$this->yyidx + -3]->minor; - } -#line 1937 "lib/Haanga/Compiler/Parser.php" -#line 235 "lib/Haanga/Compiler/Parser.y" - function yy_r36(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endif") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endif"); - } - $this->_retvalue = array('operation' => 'if', 'expr' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1945 "lib/Haanga/Compiler/Parser.php" -#line 241 "lib/Haanga/Compiler/Parser.y" - function yy_r37(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endif") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endif"); - } - $this->_retvalue = array('operation' => 'if', 'expr' => $this->yystack[$this->yyidx + -9]->minor, 'body' => $this->yystack[$this->yyidx + -7]->minor, 'else' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1953 "lib/Haanga/Compiler/Parser.php" -#line 249 "lib/Haanga/Compiler/Parser.y" - function yy_r38(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endifchanged") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endifchanged"); - } - $this->_retvalue = array('operation' => 'ifchanged', 'body' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1961 "lib/Haanga/Compiler/Parser.php" -#line 256 "lib/Haanga/Compiler/Parser.y" - function yy_r39(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endifchanged") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endifchanged"); - } - $this->_retvalue = array('operation' => 'ifchanged', 'body' => $this->yystack[$this->yyidx + -3]->minor, 'check' => $this->yystack[$this->yyidx + -5]->minor); - } -#line 1969 "lib/Haanga/Compiler/Parser.php" -#line 262 "lib/Haanga/Compiler/Parser.y" - function yy_r40(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endifchanged") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endifchanged"); - } - $this->_retvalue = array('operation' => 'ifchanged', 'body' => $this->yystack[$this->yyidx + -7]->minor, 'else' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1977 "lib/Haanga/Compiler/Parser.php" -#line 269 "lib/Haanga/Compiler/Parser.y" - function yy_r41(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endifchanged") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endifchanged"); - } - $this->_retvalue = array('operation' => 'ifchanged', 'body' => $this->yystack[$this->yyidx + -7]->minor, 'check' => $this->yystack[$this->yyidx + -9]->minor, 'else' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1985 "lib/Haanga/Compiler/Parser.php" -#line 277 "lib/Haanga/Compiler/Parser.y" - function yy_r42(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endifequal") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endifequal"); - } - $this->_retvalue = array('operation' => 'ifequal', 'cmp' => '==', 1 => $this->yystack[$this->yyidx + -6]->minor, 2 => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 1993 "lib/Haanga/Compiler/Parser.php" -#line 283 "lib/Haanga/Compiler/Parser.y" - function yy_r43(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endifequal") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endifequal"); - } - $this->_retvalue = array('operation' => 'ifequal', 'cmp' => '==', 1 => $this->yystack[$this->yyidx + -10]->minor, 2 => $this->yystack[$this->yyidx + -9]->minor, 'body' => $this->yystack[$this->yyidx + -7]->minor, 'else' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 2001 "lib/Haanga/Compiler/Parser.php" -#line 289 "lib/Haanga/Compiler/Parser.y" - function yy_r44(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endifnotequal") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endifnotequal"); - } - $this->_retvalue = array('operation' => 'ifequal', 'cmp' => '!=', 1 => $this->yystack[$this->yyidx + -6]->minor, 2 => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 2009 "lib/Haanga/Compiler/Parser.php" -#line 295 "lib/Haanga/Compiler/Parser.y" - function yy_r45(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endifnotequal") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endifnotequal"); - } - $this->_retvalue = array('operation' => 'ifequal', 'cmp' => '!=', 1 => $this->yystack[$this->yyidx + -10]->minor, 2 => $this->yystack[$this->yyidx + -9]->minor, 'body' => $this->yystack[$this->yyidx + -7]->minor, 'else' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 2017 "lib/Haanga/Compiler/Parser.php" -#line 303 "lib/Haanga/Compiler/Parser.y" - function yy_r46(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endblock") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endblock"); - } - $this->_retvalue = array('operation' => 'block', 'name' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 2025 "lib/Haanga/Compiler/Parser.php" -#line 310 "lib/Haanga/Compiler/Parser.y" - function yy_r47(){ - if ($this->yystack[$this->yyidx + -2]->minor != "endblock") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -2]->minor.", expecting endblock"); - } - $this->_retvalue = array('operation' => 'block', 'name' => $this->yystack[$this->yyidx + -6]->minor, 'body' => $this->yystack[$this->yyidx + -4]->minor); - } -#line 2033 "lib/Haanga/Compiler/Parser.php" -#line 317 "lib/Haanga/Compiler/Parser.y" - function yy_r48(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endblock") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endblock"); - } - $this->_retvalue = array('operation' => 'block', 'name' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 2041 "lib/Haanga/Compiler/Parser.php" -#line 332 "lib/Haanga/Compiler/Parser.y" - function yy_r50(){ - if ($this->yystack[$this->yyidx + -1]->minor != "endfilter") { - $this->Error("Unexpected ".$this->yystack[$this->yyidx + -1]->minor.", expecting endfilter"); - } - $this->_retvalue = array('operation' => 'filter', 'functions' => $this->yystack[$this->yyidx + -5]->minor, 'body' => $this->yystack[$this->yyidx + -3]->minor); - } -#line 2049 "lib/Haanga/Compiler/Parser.php" -#line 340 "lib/Haanga/Compiler/Parser.y" - function yy_r51(){ $this->_retvalue=array('operation' => 'regroup', 'array' => $this->yystack[$this->yyidx + -4]->minor, 'row' => $this->yystack[$this->yyidx + -2]->minor, 'as' => $this->yystack[$this->yyidx + 0]->minor); } -#line 2052 "lib/Haanga/Compiler/Parser.php" -#line 343 "lib/Haanga/Compiler/Parser.y" - function yy_r52(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor; $this->_retvalue[] = $this->yystack[$this->yyidx + 0]->minor; } -#line 2055 "lib/Haanga/Compiler/Parser.php" -#line 344 "lib/Haanga/Compiler/Parser.y" - function yy_r53(){ $this->_retvalue = array(array('string' => $this->yystack[$this->yyidx + -2]->minor)); $this->_retvalue[] = $this->yystack[$this->yyidx + 0]->minor; } -#line 2058 "lib/Haanga/Compiler/Parser.php" -#line 345 "lib/Haanga/Compiler/Parser.y" - function yy_r54(){ $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor); } -#line 2061 "lib/Haanga/Compiler/Parser.php" -#line 347 "lib/Haanga/Compiler/Parser.y" - function yy_r55(){ $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor, 'args'=>array($this->yystack[$this->yyidx + 0]->minor)); } -#line 2064 "lib/Haanga/Compiler/Parser.php" -#line 351 "lib/Haanga/Compiler/Parser.y" - function yy_r57(){ $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor; $this->_retvalue[] = $this->yystack[$this->yyidx + 0]->minor; } -#line 2067 "lib/Haanga/Compiler/Parser.php" -#line 357 "lib/Haanga/Compiler/Parser.y" - function yy_r60(){ $this->_retvalue = array('var' => $this->yystack[$this->yyidx + 0]->minor); } -#line 2070 "lib/Haanga/Compiler/Parser.php" -#line 358 "lib/Haanga/Compiler/Parser.y" - function yy_r61(){ $this->_retvalue = array('number' => $this->yystack[$this->yyidx + 0]->minor); } -#line 2073 "lib/Haanga/Compiler/Parser.php" -#line 359 "lib/Haanga/Compiler/Parser.y" - function yy_r62(){ $this->_retvalue = trim(@$this->yystack[$this->yyidx + 0]->minor); } -#line 2076 "lib/Haanga/Compiler/Parser.php" -#line 360 "lib/Haanga/Compiler/Parser.y" - function yy_r63(){ $this->_retvalue = array('string' => $this->yystack[$this->yyidx + 0]->minor); } -#line 2079 "lib/Haanga/Compiler/Parser.php" -#line 363 "lib/Haanga/Compiler/Parser.y" - function yy_r64(){ - $this->_retvalue = array('var_filter' => $this->yystack[$this->yyidx + 0]->minor); - } -#line 2084 "lib/Haanga/Compiler/Parser.php" -#line 375 "lib/Haanga/Compiler/Parser.y" - function yy_r70(){ - $this->_retvalue = array('expr_cond' => $this->yystack[$this->yyidx + -4]->minor, 'true' => $this->yystack[$this->yyidx + -2]->minor, 'false' => $this->yystack[$this->yyidx + 0]->minor); - } -#line 2089 "lib/Haanga/Compiler/Parser.php" -#line 378 "lib/Haanga/Compiler/Parser.y" - function yy_r71(){ $this->_retvalue = array('op_expr' => 'not', $this->yystack[$this->yyidx + 0]->minor); } -#line 2092 "lib/Haanga/Compiler/Parser.php" -#line 379 "lib/Haanga/Compiler/Parser.y" - function yy_r72(){ $this->_retvalue = array('op_expr' => @$this->yystack[$this->yyidx + -1]->minor, $this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor); } -#line 2095 "lib/Haanga/Compiler/Parser.php" -#line 382 "lib/Haanga/Compiler/Parser.y" - function yy_r75(){ $this->_retvalue = array('op_expr' => trim(@$this->yystack[$this->yyidx + -1]->minor), $this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor); } -#line 2098 "lib/Haanga/Compiler/Parser.php" -#line 384 "lib/Haanga/Compiler/Parser.y" - function yy_r77(){ $this->_retvalue = array('op_expr' => 'expr', array('op_expr' => @$this->yystack[$this->yyidx + -1]->minor, $this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor)); } -#line 2101 "lib/Haanga/Compiler/Parser.php" -#line 385 "lib/Haanga/Compiler/Parser.y" - function yy_r78(){ $this->_retvalue = array('op_expr' => 'expr', array('op_expr' => '|', $this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor)); } -#line 2104 "lib/Haanga/Compiler/Parser.php" -#line 386 "lib/Haanga/Compiler/Parser.y" - function yy_r79(){ $this->_retvalue = array('op_expr' => 'expr', $this->yystack[$this->yyidx + -1]->minor); } -#line 2107 "lib/Haanga/Compiler/Parser.php" -#line 391 "lib/Haanga/Compiler/Parser.y" - function yy_r81(){ - $this->_retvalue = hexec($this->yystack[$this->yyidx + -2]->minor)->getArray(); - } -#line 2112 "lib/Haanga/Compiler/Parser.php" -#line 395 "lib/Haanga/Compiler/Parser.y" - function yy_r82(){ - $tmp = hcode(); - $args = array_merge(array($this->yystack[$this->yyidx + -3]->minor), $this->yystack[$this->yyidx + -1]->minor); - $this->_retvalue = call_user_func_array(array($tmp, 'exec'), $args); - } -#line 2119 "lib/Haanga/Compiler/Parser.php" -#line 401 "lib/Haanga/Compiler/Parser.y" - function yy_r83(){ $this->_retvalue = current($this->compiler->generate_variable_name($this->yystack[$this->yyidx + 0]->minor, false)); } -#line 2122 "lib/Haanga/Compiler/Parser.php" -#line 403 "lib/Haanga/Compiler/Parser.y" - function yy_r84(){ - if (!is_array($this->yystack[$this->yyidx + -2]->minor)) { $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor); } - else { $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor; } $this->_retvalue[]=array('object' => $this->yystack[$this->yyidx + 0]->minor); - } -#line 2128 "lib/Haanga/Compiler/Parser.php" -#line 408 "lib/Haanga/Compiler/Parser.y" - function yy_r85(){ - if (!is_array($this->yystack[$this->yyidx + -2]->minor)) { $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor); } - else { $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor; } $this->_retvalue[]=array('class' => '$'.$this->yystack[$this->yyidx + 0]->minor); - } -#line 2134 "lib/Haanga/Compiler/Parser.php" -#line 413 "lib/Haanga/Compiler/Parser.y" - function yy_r86(){ - if (!is_array($this->yystack[$this->yyidx + -3]->minor)) { $this->_retvalue = array($this->yystack[$this->yyidx + -3]->minor); } - else { $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor; } $this->_retvalue[]=$this->yystack[$this->yyidx + -1]->minor; - } -#line 2140 "lib/Haanga/Compiler/Parser.php" -#line 422 "lib/Haanga/Compiler/Parser.y" - function yy_r89(){ $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor, $this->yystack[$this->yyidx + 0]->minor); } -#line 2143 "lib/Haanga/Compiler/Parser.php" -#line 428 "lib/Haanga/Compiler/Parser.y" - function yy_r93(){ $this->_retvalue = -1 * ($this->yystack[$this->yyidx + 0]->minor); } -#line 2146 "lib/Haanga/Compiler/Parser.php" - - /** - * placeholder for the left hand side in a reduce operation. - * - * For a parser with a rule like this: - * <pre> - * rule(A) ::= B. { A = 1; } - * </pre> - * - * The parser will translate to something like: - * - * <code> - * function yy_r0(){$this->_retvalue = 1;} - * </code> - */ - private $_retvalue; - - /** - * Perform a reduce action and the shift that must immediately - * follow the reduce. - * - * For a rule such as: - * - * <pre> - * A ::= B blah C. { dosomething(); } - * </pre> - * - * This function will first call the action, if any, ("dosomething();" in our - * example), and then it will pop three states from the stack, - * one for each entry on the right-hand side of the expression - * (B, blah, and C in our example rule), and then push the result of the action - * back on to the stack with the resulting state reduced to (as described in the .out - * file) - * @param int Number of the rule by which to reduce - */ - function yy_reduce($yyruleno) - { - //int $yygoto; /* The next state */ - //int $yyact; /* The next action */ - //mixed $yygotominor; /* The LHS of the rule reduced */ - //Haanga_yyStackEntry $yymsp; /* The top of the parser's stack */ - //int $yysize; /* Amount to pop the stack */ - $yymsp = $this->yystack[$this->yyidx]; - if (self::$yyTraceFILE && $yyruleno >= 0 - && $yyruleno < count(self::$yyRuleName)) { - fprintf(self::$yyTraceFILE, "%sReduce (%d) [%s].\n", - self::$yyTracePrompt, $yyruleno, - self::$yyRuleName[$yyruleno]); - } - - $this->_retvalue = $yy_lefthand_side = null; - if (array_key_exists($yyruleno, self::$yyReduceMap)) { - // call the action - $this->_retvalue = null; - $this->{'yy_r' . self::$yyReduceMap[$yyruleno]}(); - $yy_lefthand_side = $this->_retvalue; - } - $yygoto = self::$yyRuleInfo[$yyruleno]['lhs']; - $yysize = self::$yyRuleInfo[$yyruleno]['rhs']; - $this->yyidx -= $yysize; - for ($i = $yysize; $i; $i--) { - // pop all of the right-hand side parameters - array_pop($this->yystack); - } - $yyact = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, $yygoto); - if ($yyact < self::YYNSTATE) { - /* If we are not debugging and the reduce action popped at least - ** one element off the stack, then we can push the new element back - ** onto the stack here, and skip the stack overflow test in yy_shift(). - ** That gives a significant speed improvement. */ - if (!self::$yyTraceFILE && $yysize) { - $this->yyidx++; - $x = new Haanga_yyStackEntry; - $x->stateno = $yyact; - $x->major = $yygoto; - $x->minor = $yy_lefthand_side; - $this->yystack[$this->yyidx] = $x; - } else { - $this->yy_shift($yyact, $yygoto, $yy_lefthand_side); - } - } elseif ($yyact == self::YYNSTATE + self::YYNRULE + 1) { - $this->yy_accept(); - } - } - - /** - * The following code executes when the parse fails - * - * Code from %parse_fail is inserted here - */ - function yy_parse_failed() - { - if (self::$yyTraceFILE) { - fprintf(self::$yyTraceFILE, "%sFail!\n", self::$yyTracePrompt); - } - while ($this->yyidx >= 0) { - $this->yy_pop_parser_stack(); - } - /* Here code is inserted which will be executed whenever the - ** parser fails */ - } - - /** - * The following code executes when a syntax error first occurs. - * - * %syntax_error code is inserted here - * @param int The major type of the error token - * @param mixed The minor type of the error token - */ - function yy_syntax_error($yymajor, $TOKEN) - { -#line 72 "lib/Haanga/Compiler/Parser.y" - - $expect = array(); - foreach ($this->yy_get_expected_tokens($yymajor) as $token) { - $expect[] = self::$yyTokenName[$token]; - } - $this->Error('Unexpected ' . $this->tokenName($yymajor) . '(' . $TOKEN. ')'); -#line 2266 "lib/Haanga/Compiler/Parser.php" - } - - /** - * The following is executed when the parser accepts - * - * %parse_accept code is inserted here - */ - function yy_accept() - { - if (self::$yyTraceFILE) { - fprintf(self::$yyTraceFILE, "%sAccept!\n", self::$yyTracePrompt); - } - while ($this->yyidx >= 0) { - $stack = $this->yy_pop_parser_stack(); - } - /* Here code is inserted which will be executed whenever the - ** parser accepts */ -#line 57 "lib/Haanga/Compiler/Parser.y" - -#line 2287 "lib/Haanga/Compiler/Parser.php" - } - - /** - * The main parser program. - * - * The first argument is the major token number. The second is - * the token value string as scanned from the input. - * - * @param int $yymajor the token number - * @param mixed $yytokenvalue the token value - * @param mixed ... any extra arguments that should be passed to handlers - * - * @return void - */ - function doParse($yymajor, $yytokenvalue) - { -// $yyact; /* The parser action. */ -// $yyendofinput; /* True if we are at the end of input */ - $yyerrorhit = 0; /* True if yymajor has invoked an error */ - - /* (re)initialize the parser, if necessary */ - if ($this->yyidx === null || $this->yyidx < 0) { - /* if ($yymajor == 0) return; // not sure why this was here... */ - $this->yyidx = 0; - $this->yyerrcnt = -1; - $x = new Haanga_yyStackEntry; - $x->stateno = 0; - $x->major = 0; - $this->yystack = array(); - array_push($this->yystack, $x); - } - $yyendofinput = ($yymajor==0); - - if (self::$yyTraceFILE) { - fprintf( - self::$yyTraceFILE, - "%sInput %s\n", - self::$yyTracePrompt, - self::$yyTokenName[$yymajor] - ); - } - - do { - $yyact = $this->yy_find_shift_action($yymajor); - if ($yymajor < self::YYERRORSYMBOL - && !$this->yy_is_expected_token($yymajor) - ) { - // force a syntax error - $yyact = self::YY_ERROR_ACTION; - } - if ($yyact < self::YYNSTATE) { - $this->yy_shift($yyact, $yymajor, $yytokenvalue); - $this->yyerrcnt--; - if ($yyendofinput && $this->yyidx >= 0) { - $yymajor = 0; - } else { - $yymajor = self::YYNOCODE; - } - } elseif ($yyact < self::YYNSTATE + self::YYNRULE) { - $this->yy_reduce($yyact - self::YYNSTATE); - } elseif ($yyact == self::YY_ERROR_ACTION) { - if (self::$yyTraceFILE) { - fprintf( - self::$yyTraceFILE, - "%sSyntax Error!\n", - self::$yyTracePrompt - ); - } - if (self::YYERRORSYMBOL) { - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if ($this->yyerrcnt < 0) { - $this->yy_syntax_error($yymajor, $yytokenvalue); - } - $yymx = $this->yystack[$this->yyidx]->major; - if ($yymx == self::YYERRORSYMBOL || $yyerrorhit ) { - if (self::$yyTraceFILE) { - fprintf( - self::$yyTraceFILE, - "%sDiscard input token %s\n", - self::$yyTracePrompt, - self::$yyTokenName[$yymajor] - ); - } - $this->yy_destructor($yymajor, $yytokenvalue); - $yymajor = self::YYNOCODE; - } else { - while ($this->yyidx >= 0 - && $yymx != self::YYERRORSYMBOL - && ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE - ) { - $this->yy_pop_parser_stack(); - } - if ($this->yyidx < 0 || $yymajor==0) { - $this->yy_destructor($yymajor, $yytokenvalue); - $this->yy_parse_failed(); - $yymajor = self::YYNOCODE; - } elseif ($yymx != self::YYERRORSYMBOL) { - $u2 = 0; - $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2); - } - } - $this->yyerrcnt = 3; - $yyerrorhit = 1; - } else { - /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if ($this->yyerrcnt <= 0) { - $this->yy_syntax_error($yymajor, $yytokenvalue); - } - $this->yyerrcnt = 3; - $this->yy_destructor($yymajor, $yytokenvalue); - if ($yyendofinput) { - $this->yy_parse_failed(); - } - $yymajor = self::YYNOCODE; - } - } else { - $this->yy_accept(); - $yymajor = self::YYNOCODE; - } - } while ($yymajor != self::YYNOCODE && $this->yyidx >= 0); - } -} diff --git a/lib/Haanga/lib/Haanga/Compiler/Parser.y b/lib/Haanga/lib/Haanga/Compiler/Parser.y deleted file mode 100644 index 9b890e32d75b731c260c49629d6d841177d741f7..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Compiler/Parser.y +++ /dev/null @@ -1,431 +0,0 @@ -%name Haanga_ -%include { -/* - +---------------------------------------------------------------------------------+ - | Copyright (c) 2010 César Rodas and Menéame Comunicacions S.L. | - +---------------------------------------------------------------------------------+ - | Redistribution and use in source and binary forms, with or without | - | modification, are permitted provided that the following conditions are met: | - | 1. Redistributions of source code must retain the above copyright | - | notice, this list of conditions and the following disclaimer. | - | | - | 2. Redistributions in binary form must reproduce the above copyright | - | notice, this list of conditions and the following disclaimer in the | - | documentation and/or other materials provided with the distribution. | - | | - | 3. All advertising materials mentioning features or use of this software | - | must display the following acknowledgement: | - | This product includes software developed by César D. Rodas. | - | | - | 4. Neither the name of the César D. Rodas nor the | - | names of its contributors may be used to endorse or promote products | - | derived from this software without specific prior written permission. | - | | - | THIS SOFTWARE IS PROVIDED BY CÉSAR D. RODAS ''AS IS'' AND ANY | - | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | - | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | - | DISCLAIMED. IN NO EVENT SHALL CÉSAR D. RODAS BE LIABLE FOR ANY | - | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | - | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | - | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | - | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | - | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | - | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE | - +---------------------------------------------------------------------------------+ - | Authors: César Rodas <crodas@php.net> | - +---------------------------------------------------------------------------------+ -*/ -} - -%declare_class { class Haanga_Compiler_Parser } -%include_class { - protected $lex; - protected $file; - - function __construct($lex, $file='') - { - $this->lex = $lex; - $this->file = $file; - } - - function Error($text) - { - throw new Haanga_Compiler_Exception($text.' in '.$this->file.':'.$this->lex->getLine()); - } - -} - -%parse_accept { -} - -%right T_TAG_OPEN. -%right T_NOT. -%left T_AND. -%left T_OR. -%left T_QUESTION T_COLON. -%nonassoc T_EQ T_NE. -%nonassoc T_GT T_GE T_LT T_LE. -%nonassoc T_IN. -%left T_PLUS T_MINUS T_CONCAT. -%left T_TIMES T_DIV T_MOD. -%left T_PIPE T_BITWISE T_FILTER_PIPE. - -%syntax_error { - $expect = array(); - foreach ($this->yy_get_expected_tokens($yymajor) as $token) { - $expect[] = self::$yyTokenName[$token]; - } - $this->Error('Unexpected ' . $this->tokenName($yymajor) . '(' . $TOKEN. ')'); -} - - -start ::= body(B). { $this->body = B; } - -body(A) ::= body(B) code(C). { A=B; A[] = C; } -body(A) ::= . { A = array(); } - -/* List of statements */ -code(A) ::= T_TAG_OPEN stmts(B). { if (count(B)) B['line'] = $this->lex->getLine(); A = B; } - -code(A) ::= T_HTML(B). { - A = array('operation' => 'html', 'html' => B, 'line' => $this->lex->getLine() ); -} - -code(A) ::= T_COMMENT(B). { - B=rtrim(B); A = array('operation' => 'comment', 'comment' => B); -} - -code(A) ::= T_PRINT_OPEN expr(B) T_PRINT_CLOSE. { - A = array('operation' => 'print_var', 'expr' => B, 'line' => $this->lex->getLine() ); -} - -stmts(A) ::= T_EXTENDS var_or_string(B) T_TAG_CLOSE. { A = array('operation' => 'base', B); } -stmts(A) ::= stmt(B) T_TAG_CLOSE. { A = B; } -stmts(A) ::= for_stmt(B). { A = B; } -stmts(A) ::= ifchanged_stmt(B). { A = B; } -stmts(A) ::= block_stmt(B). { A = B; } -stmts(A) ::= filter_stmt(B). { A = B; } -stmts(A) ::= if_stmt(B). { A = B; } -stmts(A) ::= T_INCLUDE var_or_string(B) T_TAG_CLOSE. { A = array('operation' => 'include', B); } -stmts(A) ::= custom_tag(B). { A = B; } -stmts(A) ::= alias(B). { A = B; } -stmts(A) ::= ifequal(B). { A = B; } -stmts(A) ::= T_AUTOESCAPE varname(B) T_TAG_CLOSE body(X) T_TAG_OPEN T_CUSTOM_END(E) T_TAG_CLOSE. { - B = strtolower(B); - if (B != 'on' && B != 'off') { - $this->Error("Invalid autoescape param (".B."), it must be on or off"); - } - if (E != "endautoescape") { - $this->Error("Invalid close tag ".E.", it must be endautoescape"); - } - A = array('operation' => 'autoescape', 'value' => B, 'body' => X); -} - -/* Statement */ - -/* CUSTOM TAGS */ -custom_tag(A) ::= T_CUSTOM_TAG(B) T_TAG_CLOSE. { - A = array('operation' => 'custom_tag', 'name' => B, 'list'=>array()); -} -custom_tag(A) ::= T_CUSTOM_TAG(B) T_AS varname(C) T_TAG_CLOSE. { - A = array('operation' => 'custom_tag', 'name' => B, 'as' => C, 'list'=>array()); -} -custom_tag(A) ::= T_CUSTOM_TAG(B) params(X) T_TAG_CLOSE. { - A = array('operation' => 'custom_tag', 'name' => B, 'list' => X); -} -custom_tag(A) ::= T_CUSTOM_TAG(B) params(X) T_AS varname(C) T_TAG_CLOSE. { - A = array('operation' => 'custom_tag', 'name' => B, 'as' => C, 'list' => X); -} - -/* tags as blocks */ -custom_tag(A) ::= T_CUSTOM_BLOCK(B) T_TAG_CLOSE body(X) T_TAG_OPEN T_CUSTOM_END(C) T_TAG_CLOSE. { - if ('end'.B != C) { - $this->error("Unexpected ".C); - } - A = array('operation' => 'custom_tag', 'name' => B, 'body' => X, 'list' => array()); -} -custom_tag(A) ::= T_CUSTOM_BLOCK(B) params(L) T_TAG_CLOSE body(X) T_TAG_OPEN T_CUSTOM_END(C) T_TAG_CLOSE. { - if ('end'.B != C) { - $this->error("Unexpected ".C); - } - A = array('operation' => 'custom_tag', 'name' => B, 'body' => X, 'list' => L); -} - -/* Spacefull is very special, and it is handled in the compiler class */ -custom_tag(A) ::= T_SPACEFULL T_TAG_CLOSE body(X) T_TAG_OPEN T_CUSTOM_END(C) T_TAG_CLOSE. { - if ('endspacefull' != C) { - $this->error("Unexpected ".C); - } - A = array('operation' => 'spacefull', 'body' => X); -} - -/* variable alias (easier to handle in the compiler class) */ -alias(A) ::= T_WITH varname(B) T_AS varname(C) T_TAG_CLOSE body(X) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endwith") { - $this->Error("Unexpected ".Z.", expecting endwith"); - } - A = array('operation' => 'alias', 'var' => B, 'as' => C, 'body' => X); -} - -/* Simple statements (don't require a end_tag or a body ) */ -stmt(A) ::= T_SET varname(C) T_ASSIGN expr(X). { A = array('operation' => 'set', 'var' => C,'expr' => X); } -stmt(A) ::= regroup(B). { A = B; } -stmt ::= T_LOAD string(B). { - if (is_file(dirname($this->file) . '/' . B)) { - B = dirname($this->file) . '/' . B; - } else if (is_file(getcwd() . '/' . B)) { - B = getcwd() . '/' . B; - } - if (!is_file(B) || !Haanga_Compiler::getOption('enable_load')) { - $this->error(B." is not a valid file"); - } - require_once B; -} - -/* FOR loop */ - -for_def(A) ::= T_FOR varname(B) T_IN filtered_var(C) T_TAG_CLOSE . { - $var = $this->compiler->get_context(C[0]); - if (is_array($var) || $var instanceof Iterator) { - /* let's check if it is an object or array */ - $this->compiler->set_context(B, current($var)); - } - A = array('operation' => 'loop', 'variable' => B, 'index' => NULL, 'array' => C); -} - -for_def(A) ::= T_FOR varname(I) T_COMMA varname(B) T_IN filtered_var(C) T_TAG_CLOSE . { - $var = $this->compiler->get_context(C[0]); - if (is_array($var) || $var instanceof Iterator) { - /* let's check if it is an object or array */ - $this->compiler->set_context(B, current($var)); - } - A = array('operation' => 'loop', 'variable' => B, 'index' => I, 'array' => C); - -} - - -for_stmt(A) ::= for_def(B) body(D) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endfor") { - $this->Error("Unexpected ".Z.", expecting endfor"); - } - A = B; - A['body'] = D; -} - -for_stmt(A) ::= T_FOR varname(B) T_IN range(X) T_TAG_CLOSE body(E) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endfor") { - $this->Error("Unexpected ".Z.", expecting endfor"); - } - A = array('operation' => 'loop', 'variable' => B, 'range' => X, 'body' => E, 'variable' => B, 'step' => 1); -} - -for_stmt(A) ::= T_FOR varname(B) T_IN range(X) T_STEP numvar(S) T_TAG_CLOSE body(E) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endfor") { - $this->Error("Unexpected ".Z.", expecting endfor"); - } - A = array('operation' => 'loop', 'variable' => B, 'range' => X, 'body' => E, 'variable' => B, 'step' => S); -} - -for_stmt(A) ::= for_def(B) body(D) T_TAG_OPEN T_EMPTY T_TAG_CLOSE body(E) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endfor") { - $this->Error("Unexpected ".Z.", expecting endfor"); - } - A = B; - A['body'] = D; - A['empty'] = E; -} -/* IF */ -if_stmt(A) ::= T_IF expr(B) T_TAG_CLOSE body(X) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endif") { - $this->Error("Unexpected ".Z.", expecting endif"); - } - A = array('operation' => 'if', 'expr' => B, 'body' => X); -} -if_stmt(A) ::= T_IF expr(B) T_TAG_CLOSE body(X) T_TAG_OPEN T_ELSE T_TAG_CLOSE body(Y) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endif") { - $this->Error("Unexpected ".Z.", expecting endif"); - } - A = array('operation' => 'if', 'expr' => B, 'body' => X, 'else' => Y); -} - -/* ifchanged */ -ifchanged_stmt(A) ::= T_IFCHANGED T_TAG_CLOSE body(B) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endifchanged") { - $this->Error("Unexpected ".Z.", expecting endifchanged"); - } - A = array('operation' => 'ifchanged', 'body' => B); -} - -ifchanged_stmt(A) ::= T_IFCHANGED params(X) T_TAG_CLOSE body(B) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endifchanged") { - $this->Error("Unexpected ".Z.", expecting endifchanged"); - } - A = array('operation' => 'ifchanged', 'body' => B, 'check' => X); -} -ifchanged_stmt(A) ::= T_IFCHANGED T_TAG_CLOSE body(B) T_TAG_OPEN T_ELSE T_TAG_CLOSE body(C) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endifchanged") { - $this->Error("Unexpected ".Z.", expecting endifchanged"); - } - A = array('operation' => 'ifchanged', 'body' => B, 'else' => C); -} - -ifchanged_stmt(A) ::= T_IFCHANGED params(X) T_TAG_CLOSE body(B) T_TAG_OPEN T_ELSE T_TAG_CLOSE body(C) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endifchanged") { - $this->Error("Unexpected ".Z.", expecting endifchanged"); - } - A = array('operation' => 'ifchanged', 'body' => B, 'check' => X, 'else' => C); -} - -/* ifequal */ -ifequal(A) ::= T_IFEQUAL fvar_or_string(B) fvar_or_string(C) T_TAG_CLOSE body(X) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endifequal") { - $this->Error("Unexpected ".Z.", expecting endifequal"); - } - A = array('operation' => 'ifequal', 'cmp' => '==', 1 => B, 2 => C, 'body' => X); -} -ifequal(A) ::= T_IFEQUAL fvar_or_string(B) fvar_or_string(C) T_TAG_CLOSE body(X) T_TAG_OPEN T_ELSE T_TAG_CLOSE body(Y) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endifequal") { - $this->Error("Unexpected ".Z.", expecting endifequal"); - } - A = array('operation' => 'ifequal', 'cmp' => '==', 1 => B, 2 => C, 'body' => X, 'else' => Y); -} -ifequal(A) ::= T_IFNOTEQUAL fvar_or_string(B) fvar_or_string(C) T_TAG_CLOSE body(X) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endifnotequal") { - $this->Error("Unexpected ".Z.", expecting endifnotequal"); - } - A = array('operation' => 'ifequal', 'cmp' => '!=', 1 => B, 2 => C, 'body' => X); -} -ifequal(A) ::= T_IFNOTEQUAL fvar_or_string(B) fvar_or_string(C) T_TAG_CLOSE body(X) T_TAG_OPEN T_ELSE T_TAG_CLOSE body(Y) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endifnotequal") { - $this->Error("Unexpected ".Z.", expecting endifnotequal"); - } - A = array('operation' => 'ifequal', 'cmp' => '!=', 1 => B, 2 => C, 'body' => X, 'else' => Y); -} - -/* block stmt */ -block_stmt(A) ::= T_BLOCK varname(B) T_TAG_CLOSE body(C) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endblock") { - $this->Error("Unexpected ".Z.", expecting endblock"); - } - A = array('operation' => 'block', 'name' => B, 'body' => C); -} - -block_stmt(A) ::= T_BLOCK varname(B) T_TAG_CLOSE body(C) T_TAG_OPEN T_CUSTOM_END(Z) varname T_TAG_CLOSE. { - if (Z != "endblock") { - $this->Error("Unexpected ".Z.", expecting endblock"); - } - A = array('operation' => 'block', 'name' => B, 'body' => C); -} - -block_stmt(A) ::= T_BLOCK number(B) T_TAG_CLOSE body(C) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endblock") { - $this->Error("Unexpected ".Z.", expecting endblock"); - } - A = array('operation' => 'block', 'name' => B, 'body' => C); -} - -block_stmt(A) ::= T_BLOCK number(B) T_TAG_CLOSE body(C) T_TAG_OPEN T_CUSTOM_END(Z) number T_TAG_CLOSE. { - if (Z != "endblock") { - $this->Error("Unexpected ".Z.", expecting endblock"); - } - A = array('operation' => 'block', 'name' => B, 'body' => C); -} - -/* filter stmt */ -filter_stmt(A) ::= T_FILTER filtered_var(B) T_TAG_CLOSE body(X) T_TAG_OPEN T_CUSTOM_END(Z) T_TAG_CLOSE. { - if (Z != "endfilter") { - $this->Error("Unexpected ".Z.", expecting endfilter"); - } - A = array('operation' => 'filter', 'functions' => B, 'body' => X); -} - -/* regroup stmt */ -regroup(A) ::= T_REGROUP filtered_var(B) T_BY varname(C) T_AS varname(X). { A=array('operation' => 'regroup', 'array' => B, 'row' => C, 'as' => X); } - -/* variables with filters */ -filtered_var(A) ::= filtered_var(B) T_FILTER_PIPE varname_args(C). { A = B; A[] = C; } -filtered_var(A) ::= string(B) T_FILTER_PIPE varname_args(C). { A = array(array('string' => B)); A[] = C; } -filtered_var(A) ::= varname_args(B). { A = array(B); } - -varname_args(A) ::= varname(B) T_COLON var_or_string(X) . { A = array(B, 'args'=>array(X)); } -varname_args(A) ::= varname(B). { A = B; } - -/* List of variables */ -params(A) ::= params(B) var_or_string(C). { A = B; A[] = C; } -params(A) ::= params(B) T_COMMA var_or_string(C). { A = B; A[] = C; } -params(A) ::= var_or_string(B). { A = array(B); } - - -/* variable or string (used on params) */ -var_or_string(A) ::= varname(B). { A = array('var' => B); } -var_or_string(A) ::= number(B). { A = array('number' => B); } -var_or_string(A) ::= T_TRUE|T_FALSE(B). { A = trim(@B); } -var_or_string(A) ::= string(B). { A = array('string' => B); } - -/* filtered variables */ -fvar_or_string(A) ::= filtered_var(B). { - A = array('var_filter' => B); -} -fvar_or_string(A) ::= number(B). { A = array('number' => B); } -fvar_or_string(A) ::= T_TRUE|T_FALSE(B). { A = trim(@B); } -fvar_or_string(A) ::= string(B). { A = array('string' => B); } - -/* */ -string(A) ::= T_STRING(B). { A = B; } -string(A) ::= T_INTL T_STRING(B) T_RPARENT. { A = B; } - -/* expr */ -expr(A) ::= expr(Z) T_QUESTION expr(B) T_COLON expr(C). { - A = array('expr_cond' => Z, 'true' => B, 'false' => C); -} -expr(A) ::= T_NOT expr(B). { A = array('op_expr' => 'not', B); } -expr(A) ::= expr(B) T_AND(X) expr(C). { A = array('op_expr' => @X, B, C); } -expr(A) ::= expr(B) T_OR(X) expr(C). { A = array('op_expr' => @X, B, C); } -expr(A) ::= expr(B) T_PLUS|T_MINUS|T_CONCAT(X) expr(C). { A = array('op_expr' => @X, B, C); } -expr(A) ::= expr(B) T_EQ|T_NE|T_GT|T_GE|T_LT|T_LE|T_IN(X) expr(C). { A = array('op_expr' => trim(@X), B, C); } -expr(A) ::= expr(B) T_TIMES|T_DIV|T_MOD(X) expr(C). { A = array('op_expr' => @X, B, C); } -expr(A) ::= expr(B) T_BITWISE(X) expr(C). { A = array('op_expr' => 'expr', array('op_expr' => @X, B, C)); } -expr(A) ::= expr(B) T_PIPE expr(C). { A = array('op_expr' => 'expr', array('op_expr' => '|', B, C)); } -expr(A) ::= T_LPARENT expr(B) T_RPARENT. { A = array('op_expr' => 'expr', B); } -expr(A) ::= fvar_or_string(B). { A = B; } - -/* Variable name */ - -varname(A) ::= varpart(B) T_LPARENT T_RPARENT. { - A = hexec(B)->getArray(); -} - -varname(A) ::= varpart(B) T_LPARENT params(X) T_RPARENT. { - $tmp = hcode(); - $args = array_merge(array(B), X); - A = call_user_func_array(array($tmp, 'exec'), $args); -} - -varname(A) ::= varpart(B). { A = current($this->compiler->generate_variable_name(B, false)); } - -varpart(A) ::= varpart(B) T_OBJ|T_DOT varpart_single(C). { - if (!is_array(B)) { A = array(B); } - else { A = B; } A[]=array('object' => C); -} - -varpart(A) ::= varpart(B) T_CLASS varpart_single(C). { - if (!is_array(B)) { A = array(B); } - else { A = B; } A[]=array('class' => '$'.C); -} - -varpart(A) ::= varpart(B) T_BRACKETS_OPEN var_or_string(C) T_BRACKETS_CLOSE. { - if (!is_array(B)) { A = array(B); } - else { A = B; } A[]=C; -} -varpart(A) ::= varpart_single(B). { A = B; } - -/* T_BLOCK|T_CUSTOM|T_CUSTOM_BLOCK are also T_ALPHA */ -varpart_single(A) ::= T_ALPHA|T_BLOCK|T_CUSTOM_TAG|T_CUSTOM_END|T_CUSTOM_BLOCK(B). { A = B; } - -range(A) ::= numvar(B) T_DOTDOT numvar(C). { A = array(B, C); } - -numvar(A) ::= number(B). { A = B; } -numvar(A) ::= varname(B). { A = array('var' => B); } - -number(A) ::= T_NUMERIC(B). { A = B; } -number(A) ::= T_MINUS T_NUMERIC(B). { A = -1 * (B); } diff --git a/lib/Haanga/lib/Haanga/Compiler/Runtime.php b/lib/Haanga/lib/Haanga/Compiler/Runtime.php deleted file mode 100644 index ce3736b858474436cc43bca6ae1785c1ca169e31..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Compiler/Runtime.php +++ /dev/null @@ -1,136 +0,0 @@ -<?php -/* - +---------------------------------------------------------------------------------+ - | Copyright (c) 2010 César Rodas and Menéame Comunicacions S.L. | - +---------------------------------------------------------------------------------+ - | Redistribution and use in source and binary forms, with or without | - | modification, are permitted provided that the following conditions are met: | - | 1. Redistributions of source code must retain the above copyright | - | notice, this list of conditions and the following disclaimer. | - | | - | 2. Redistributions in binary form must reproduce the above copyright | - | notice, this list of conditions and the following disclaimer in the | - | documentation and/or other materials provided with the distribution. | - | | - | 3. All advertising materials mentioning features or use of this software | - | must display the following acknowledgement: | - | This product includes software developed by César D. Rodas. | - | | - | 4. Neither the name of the César D. Rodas nor the | - | names of its contributors may be used to endorse or promote products | - | derived from this software without specific prior written permission. | - | | - | THIS SOFTWARE IS PROVIDED BY CÉSAR D. RODAS ''AS IS'' AND ANY | - | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | - | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | - | DISCLAIMED. IN NO EVENT SHALL CÉSAR D. RODAS BE LIABLE FOR ANY | - | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | - | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | - | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | - | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | - | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | - | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE | - +---------------------------------------------------------------------------------+ - | Authors: César Rodas <crodas@php.net> | - +---------------------------------------------------------------------------------+ -*/ - -/** - * Runtime compiler - * - */ -final class Haanga_Compiler_Runtime extends Haanga_Compiler -{ - - // get_function_name($name=NULL) {{{ - /** - * - * - */ - function get_function_name($name) - { - return "haanga_".sha1($name); - } - // }}} - - // set_template_name($path) {{{ - function set_template_name($path) - { - return $path; - } - // }}} - - // Override {% include %} {{{ - protected function generate_op_include($details, &$body) - { - $this->do_print($body, - hexec('Haanga::Load', $details[0], $this->getScopeVariable(), - TRUE, - hvar('blocks')) - ); - } - // }}} - - // {% base "" %} {{{ - function expr_call_base_template() - { - return hexec('Haanga::Load', $this->subtemplate, - $this->getScopeVariable(), TRUE, hvar('blocks')); - } - // }}} - - // get_base_template($base) {{{ - function get_base_template($base) - { - $this->subtemplate = $base; - } - // }}} - - // Override get_Custom_tag {{{ - /** - * - * - */ - function get_custom_tag($name) - { - static $tag = NULL; - if (!$tag) $tag = Haanga_Extension::getInstance('Tag'); - $loaded = &$this->tags; - - if (!isset($loaded[$name])) { - $this->prepend_op->comment("Load tag {$name} definition"); - $this->prepend_op->do_exec('require_once', $tag->getFilePath($name, FALSE)); - $loaded[$name] = TRUE; - } - - return $tag->getClassName($name)."::main"; - } - // }}} - - // Override get_custom_filter {{{ - function get_custom_filter($name) - { - static $filter = NULL; - if (!$filter) $filter=Haanga_Extension::getInstance('Filter'); - $loaded = &$this->filters; - - if (!isset($loaded[$name])) { - $this->prepend_op->comment("Load filter {$name} definition"); - $this->prepend_op->do_exec('require_once', $filter->getFilePath($name, FALSE)); - $loaded[$name] = TRUE; - } - - return $filter->getClassName($name)."::main"; - } - // }}} - -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/lib/Haanga/lib/Haanga/Compiler/Tokenizer.php b/lib/Haanga/lib/Haanga/Compiler/Tokenizer.php deleted file mode 100644 index 2d3e804cc1e6890645907b94b7787d9283be2ec7..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Compiler/Tokenizer.php +++ /dev/null @@ -1,585 +0,0 @@ -<?php -/* - +---------------------------------------------------------------------------------+ - | Copyright (c) 2010 César Rodas and Menéame Comunicacions S.L. | - +---------------------------------------------------------------------------------+ - | Redistribution and use in source and binary forms, with or without | - | modification, are permitted provided that the following conditions are met: | - | 1. Redistributions of source code must retain the above copyright | - | notice, this list of conditions and the following disclaimer. | - | | - | 2. Redistributions in binary form must reproduce the above copyright | - | notice, this list of conditions and the following disclaimer in the | - | documentation and/or other materials provided with the distribution. | - | | - | 3. All advertising materials mentioning features or use of this software | - | must display the following acknowledgement: | - | This product includes software developed by César D. Rodas. | - | | - | 4. Neither the name of the César D. Rodas nor the | - | names of its contributors may be used to endorse or promote products | - | derived from this software without specific prior written permission. | - | | - | THIS SOFTWARE IS PROVIDED BY CÉSAR D. RODAS ''AS IS'' AND ANY | - | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | - | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | - | DISCLAIMED. IN NO EVENT SHALL CÉSAR D. RODAS BE LIABLE FOR ANY | - | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | - | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | - | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | - | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | - | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | - | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE | - +---------------------------------------------------------------------------------+ - | Authors: César Rodas <crodas@php.net> | - +---------------------------------------------------------------------------------+ -*/ - -class HG_Parser Extends Haanga_Compiler_Parser -{ - /* subclass to made easier references to constants */ -} - - -/** - * Hand-written Tokenizer class inspired by SQLite's tokenize.c - * - */ -class Haanga_Compiler_Tokenizer -{ - /* they are case sensitive and sorted! */ - static $keywords = array( - 'AND' => HG_Parser::T_AND, - 'FALSE' => HG_Parser::T_FALSE, - 'NOT' => HG_Parser::T_NOT, - 'OR' => HG_Parser::T_OR, - 'TRUE' => HG_Parser::T_TRUE, - '_(' => HG_Parser::T_INTL, - 'as' => HG_Parser::T_AS, - 'autoescape' => HG_Parser::T_AUTOESCAPE, - 'block' => HG_Parser::T_BLOCK, - 'by' => HG_Parser::T_BY, - 'else' => HG_Parser::T_ELSE, - 'empty' => HG_Parser::T_EMPTY, - 'extends' => HG_Parser::T_EXTENDS, - 'filter' => HG_Parser::T_FILTER, - 'for' => HG_Parser::T_FOR, - 'if' => HG_Parser::T_IF, - 'ifchanged' => HG_Parser::T_IFCHANGED, - 'ifequal' => HG_Parser::T_IFEQUAL, - 'ifnotequal' => HG_Parser::T_IFNOTEQUAL, - 'in' => HG_Parser::T_IN, - 'include' => HG_Parser::T_INCLUDE, - 'load' => HG_Parser::T_LOAD, - 'not' => HG_Parser::T_NOT, - 'regroup' => HG_Parser::T_REGROUP, - 'set' => HG_Parser::T_SET, - 'spacefull' => HG_Parser::T_SPACEFULL, - 'step' => HG_Parser::T_STEP, - 'with' => HG_Parser::T_WITH, - ); - - /* common operations */ - static $operators_single = array( - '!' => HG_Parser::T_NOT, - '%' => HG_Parser::T_MOD, - '&' => HG_Parser::T_BITWISE, - '(' => HG_Parser::T_LPARENT, - ')' => HG_Parser::T_RPARENT, - '*' => HG_Parser::T_TIMES, - '+' => HG_Parser::T_PLUS, - ',' => HG_Parser::T_COMMA, - '-' => HG_Parser::T_MINUS, - '.' => HG_Parser::T_DOT, - '/' => HG_Parser::T_DIV, - ':' => HG_Parser::T_COLON, - '<' => HG_Parser::T_LT, - '=' => HG_Parser::T_ASSIGN, - '>' => HG_Parser::T_GT, - '?' => HG_Parser::T_QUESTION, - '[' => HG_Parser::T_BRACKETS_OPEN, - ']' => HG_Parser::T_BRACKETS_CLOSE, - '|' => HG_Parser::T_FILTER_PIPE, - ); - static $operators = array( - '!==' => HG_Parser::T_NE, - '!=' => HG_Parser::T_NE, - '&&' => HG_Parser::T_AND, - '->' => HG_Parser::T_OBJ, - '..' => HG_Parser::T_DOTDOT, - '::' => HG_Parser::T_CLASS, - '<<' => HG_Parser::T_BITWISE, - '<=' => HG_Parser::T_LE, - '===' => HG_Parser::T_EQ, - '==' => HG_Parser::T_EQ, - '>=' => HG_Parser::T_GE, - '>>' => HG_Parser::T_BITWISE, - '||' => HG_Parser::T_PIPE, - ); - - static $close_tags = array(); - - static $open_tag = "{%"; - static $end_tag = "%}"; - static $open_comment = "{#"; - static $end_comment = "#}"; - static $open_print = "{{"; - static $end_print = "}}"; - - public $open_tags; - public $value; - public $token; - public $status = self::IN_NONE; - - const IN_NONE = 0; - const IN_HTML = 1; - const IN_TAG = 2; - const IN_ECHO = 3; - - protected $echoFirstToken = false; - - function __construct($data, $compiler, $file) - { - $this->data = $data; - $this->compiler = $compiler; - $this->line = 1; - $this->N = 0; - $this->file = $file; - $this->length = strlen($data); - - - /*$tmp1 = self::$operators; - $tmp2 = $tmp1; - ksort($tmp2); - var_dump($tmp2, $tmp1 === $tmp2);die();/**/ - - self::$close_tags =array( - self::$end_tag => HG_Parser::T_TAG_CLOSE, - self::$end_print => HG_Parser::T_PRINT_CLOSE, - ); - - - $this->open_tags = array( - self::$open_tag => HG_Parser::T_TAG_OPEN, - self::$open_print => HG_Parser::T_PRINT_OPEN, - self::$open_comment => HG_Parser::T_COMMENT, - ); - } - - function yylex() - { - $this->token = NULL; - - if ($this->length == $this->N) { - if ($this->status != self::IN_NONE && $this->status != self::IN_HTML) { - $this->Error("Unexpected end"); - } - return FALSE; - } - - if ($this->status == self::IN_NONE) { - $i = &$this->N; - $data = substr($this->data, $i, 12); - - static $lencache = array(); - foreach ($this->open_tags as $value => $token) { - if (!isset($lencache[$value])) { - $lencache[$value] = strlen($value); - } - $len = $lencache[$value]; - if (strncmp($data, $value, $len) == 0) { - $this->value = $value; - $this->token = $token; - $i += $len; - switch ($this->token) { - case HG_Parser::T_TAG_OPEN: - $this->status = self::IN_TAG; - break; - case HG_Parser::T_COMMENT: - $zdata = & $this->data; - - if (($pos=strpos($zdata, self::$end_comment, $i)) === FALSE) { - $this->error("unexpected end"); - } - - $this->value = substr($zdata, $i, $pos-2); - $this->status = self::IN_NONE; - $i = $pos + 2; - break; - case HG_Parser::T_PRINT_OPEN: - $this->status = self::IN_ECHO; - $this->echoFirstToken = false; - break; - } - return TRUE; - } - } - - $this->status = self::IN_HTML; - } - - switch ($this->status) - { - case self::IN_TAG: - case self::IN_ECHO: - $this->yylex_main(); - break; - default: - $this->yylex_html(); - } - - - if (empty($this->token)) { - if ($this->status != self::IN_NONE && $this->status != self::IN_HTML) { - $this->Error("Unexpected end"); - } - return FALSE; - } - - return TRUE; - - } - - function yylex_html() - { - $data = &$this->data; - $i = &$this->N; - - foreach ($this->open_tags as $value => $status) { - $pos = strpos($data, $value, $i); - if ($pos === FALSE) { - continue; - } - if (!isset($lowest_pos) || $lowest_pos > $pos) { - $lowest_pos = $pos; - } - } - - if (isset($lowest_pos)) { - $this->value = substr($data, $i, $lowest_pos-$i); - $this->token = HG_Parser::T_HTML; - $this->status = self::IN_NONE; - $i += $lowest_pos - $i; - } else { - $this->value = substr($data, $i); - $this->token = HG_Parser::T_HTML; - $i = $this->length; - } - - $this->line += substr_count($this->value, "\n"); - - } - - - function yylex_main() - { - $data = &$this->data; - - for ($i=&$this->N; is_null($this->token) && $i < $this->length; ++$i) { - switch ($data[$i]) { - - /* strings {{{ */ - case '"': - case "'": - $end = $data[$i]; - $value = ""; - while ($data[++$i] != $end) { - switch ($data[$i]) { - case "\\": - switch ($data[++$i]) { - case "n": - $value .= "\n"; - break; - case "t": - $value .= "\t"; - break; - default: - $value .= $data[$i]; - } - break; - case $end: - --$i; - break 2; - default: - if ($data[$i] == "\n") { - $this->line++; - } - $value .= $data[$i]; - } - if (!isset($data[$i+1])) { - $this->Error("unclosed string"); - } - } - $this->value = $value; - $this->token = HG_Parser::T_STRING; - break; - /* }}} */ - - /* number {{{ */ - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - $value = ""; - $dot = FALSE; - for ($e=0; $i < $this->length; ++$e, ++$i) { - switch ($data[$i]) { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - $value .= $data[$i]; - break; - case '.': - if (!$dot) { - $value .= "."; - $dot = TRUE; - } else { - $this->error("Invalid number"); - } - break; - default: - break 2; /* break the main loop */ - } - } - if (!$this->is_token_end($data[$i]) && - !isset(self::$operators_single[$data[$i]]) || $value[$e-1] == '.') { - $this->error("Unexpected '{$data[$i]}'"); - } - $this->value = $value; - $this->token = HG_Parser::T_NUMERIC; - break 2; - /* }}} */ - - case "\n": case " ": case "\t": case "\r": case "\f": - for (; is_null($this->token) && $i < $this->length; ++$i) { - switch ($data[$i]) { - case "\n": - $this->line++; - case " ": case "\t": case "\r": case "\f": - break; - case '.': - if ($data[$i+1] != '.') { - $this->token = HG_Parser::T_CONCAT; - $this->value = '.'; - $i++; - return; - } - default: - /* break main loop */ - /* and decrease because last processed byte */ - /* wasn't a dot (T_CONCAT) */ - --$i; - break 2; - } - } - break; /* whitespaces are ignored */ - default: - if (!$this->getTag() && !$this->getOperator()) { - $alpha = $this->getAlpha(); - if ($alpha === FALSE) { - $this->error("error: unexpected ".substr($data, $i)); - } - static $tag=NULL; - if (!$tag) { - $tag = Haanga_Extension::getInstance('Tag'); - } - - if ($this->status == self::IN_ECHO && !$this->echoFirstToken) { - $this->token = HG_Parser::T_ALPHA; - } else { - $value = $tag->isValid($alpha); - $this->token = $value ? $value : HG_Parser::T_ALPHA; - } - $this->value = $alpha; - - } - break 2; - } - } - - if ($this->status == self::IN_ECHO) { - $this->echoFirstToken = true; - } - - if ($this->token == HG_Parser::T_TAG_CLOSE || - $this->token == HG_Parser::T_PRINT_CLOSE) { - $this->status = self::IN_NONE; - } - - } - - function getTag() - { - static $lencache = array(); - - $i = &$this->N; - $data = substr($this->data, $i, 12); - foreach (self::$close_tags as $value => $token) { - if (!isset($lencache[$value])) { - $lencache[$value] = strlen($value); - } - $len = $lencache[$value]; - if (strncmp($data, $value, $len) == 0) { - $this->token = $token; - $this->value = $value; - $i += $len; - return TRUE; - } - } - - foreach (self::$keywords as $value => $token) { - if (!isset($lencache[$value])) { - $lencache[$value] = strlen($value); - } - $len = $lencache[$value]; - switch (strncmp($data, $value, $len)) { - case -1: - break 2; - case 0: // match - if (isset($data[$len]) && !$this->is_token_end($data[$len])) { - /* probably a variable name TRUEfoo (and not TRUE) */ - continue 2; - } - $this->token = $token; - $this->value = $value; - $i += $len; - return TRUE; - } - } - - /* /end([a-zA-Z][a-zA-Z0-9]*)/ */ - if (strncmp($data, "end", 3) == 0) { - $this->value = $this->getAlpha(); - $this->token = HG_Parser::T_CUSTOM_END; - return TRUE; - } - - return FALSE; - } - - function Error($text) - { - throw new Haanga_Compiler_Exception($text." in ".$this->file.":".$this->line); - } - - function getOperator() - { - static $lencache = array(); - - $i = &$this->N; - $data = substr($this->data, $i, 12); - - foreach (self::$operators as $value => $token) { - if (!isset($lencache[$value])) { - $lencache[$value] = strlen($value); - } - $len = $lencache[$value]; - switch (strncmp($data, $value, $len)) { - case -1: - if (strlen($data) == $len) { - break 2; - } - break; - case 0: - $this->token = $token; - $this->value = $value; - $i += $len; - return TRUE; - } - } - - $data = $this->data[$i]; - foreach (self::$operators_single as $value => $token) { - if ($value == $data) { - $this->token = $token; - $this->value = $value; - $i += 1; - return TRUE; - } else if ($value > $data) { - break; - } - } - - - return FALSE; - } - - - /** - * Return TRUE if $letter is a valid "token_end". We use token_end - * to avoid confuse T_ALPHA TRUEfoo with TRUE and foo (T_ALPHA) - * - * @param string $letter - * - * @return bool - */ - protected function is_token_end($letter) - { - /* [^a-zA-Z0-9_] */ - return !( - ('a' <= $letter && 'z' >= $letter) || - ('A' <= $letter && 'Z' >= $letter) || - ('0' <= $letter && '9' >= $letter) || - $letter == "_" - ); - } - - function getAlpha() - { - /* [a-zA-Z_][a-zA-Z0-9_]* */ - $i = &$this->N; - $data = &$this->data; - - if ( !('a' <= $data[$i] && 'z' >= $data[$i]) && - !('A' <= $data[$i] && 'Z' >= $data[$i]) && $data[$i] != '_') { - return FALSE; - } - - $value = ""; - for (; $i < $this->length; ++$i) { - if ( - ('a' <= $data[$i] && 'z' >= $data[$i]) || - ('A' <= $data[$i] && 'Z' >= $data[$i]) || - ('0' <= $data[$i] && '9' >= $data[$i]) || - $data[$i] == "_" - ) { - $value .= $data[$i]; - } else { - break; - } - } - - return $value; - } - - function getLine() - { - return $this->line; - } - - - static function init($template, $compiler, $file='') - { - $lexer = new Haanga_Compiler_Tokenizer($template, $compiler, $file); - $parser = new Haanga_Compiler_Parser($lexer, $file); - - $parser->compiler = $compiler; - - try { - for($i=0; ; $i++) { - if (!$lexer->yylex()) { - break; - } - $parser->doParse($lexer->token, $lexer->value); - } - } catch (Exception $e) { - /* destroy the parser */ - try { - $parser->doParse(0,0); - } catch (Exception $y) {} - throw $e; /* re-throw exception */ - } - - $parser->doParse(0, 0); - - return (array)$parser->body; - - } -} diff --git a/lib/Haanga/lib/Haanga/Exception.php b/lib/Haanga/lib/Haanga/Exception.php deleted file mode 100644 index 04594018c7feb34af71b89e70b7765f0914372a7..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Exception.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php -/* - +---------------------------------------------------------------------------------+ - | Copyright (c) 2010 César Rodas and Menéame Comunicacions S.L. | - +---------------------------------------------------------------------------------+ - | Redistribution and use in source and binary forms, with or without | - | modification, are permitted provided that the following conditions are met: | - | 1. Redistributions of source code must retain the above copyright | - | notice, this list of conditions and the following disclaimer. | - | | - | 2. Redistributions in binary form must reproduce the above copyright | - | notice, this list of conditions and the following disclaimer in the | - | documentation and/or other materials provided with the distribution. | - | | - | 3. All advertising materials mentioning features or use of this software | - | must display the following acknowledgement: | - | This product includes software developed by César D. Rodas. | - | | - | 4. Neither the name of the César D. Rodas nor the | - | names of its contributors may be used to endorse or promote products | - | derived from this software without specific prior written permission. | - | | - | THIS SOFTWARE IS PROVIDED BY CÉSAR D. RODAS ''AS IS'' AND ANY | - | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | - | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | - | DISCLAIMED. IN NO EVENT SHALL CÉSAR D. RODAS BE LIABLE FOR ANY | - | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | - | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | - | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | - | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | - | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | - | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE | - +---------------------------------------------------------------------------------+ - | Authors: César Rodas <crodas@php.net> | - +---------------------------------------------------------------------------------+ -*/ - -// Haanga_Exception {{{ -/** - * General exception class. It is thrown - * when something is not configured properly - * - */ -class Haanga_Exception extends Exception -{ -} -// }}} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ - diff --git a/lib/Haanga/lib/Haanga/Extension.php b/lib/Haanga/lib/Haanga/Extension.php deleted file mode 100644 index 1720b4ffdc806543039db703b5b7d04889e6a210..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension.php +++ /dev/null @@ -1,183 +0,0 @@ -<?php -/* - +---------------------------------------------------------------------------------+ - | Copyright (c) 2010 César Rodas and Menéame Comunicacions S.L. | - +---------------------------------------------------------------------------------+ - | Redistribution and use in source and binary forms, with or without | - | modification, are permitted provided that the following conditions are met: | - | 1. Redistributions of source code must retain the above copyright | - | notice, this list of conditions and the following disclaimer. | - | | - | 2. Redistributions in binary form must reproduce the above copyright | - | notice, this list of conditions and the following disclaimer in the | - | documentation and/or other materials provided with the distribution. | - | | - | 3. All advertising materials mentioning features or use of this software | - | must display the following acknowledgement: | - | This product includes software developed by César D. Rodas. | - | | - | 4. Neither the name of the César D. Rodas nor the | - | names of its contributors may be used to endorse or promote products | - | derived from this software without specific prior written permission. | - | | - | THIS SOFTWARE IS PROVIDED BY CÉSAR D. RODAS ''AS IS'' AND ANY | - | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | - | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | - | DISCLAIMED. IN NO EVENT SHALL CÉSAR D. RODAS BE LIABLE FOR ANY | - | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | - | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | - | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | - | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | - | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | - | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE | - +---------------------------------------------------------------------------------+ - | Authors: César Rodas <crodas@php.net> | - +---------------------------------------------------------------------------------+ -*/ - -Abstract Class Haanga_Extension -{ - private static $_instances; - - final private function __construct() - { - } - - final static function getInstance($name) - { - $name = 'Haanga_Extension_'.$name; - if (!class_exists($name)) { - throw new Haanga_Compiler_Exception("{$name} is not a class"); - } - if (!is_subclass_of($name, __CLASS__)) { - throw new Haanga_Compiler_Exception("{$name} is not a sub-class of ".__CLASS__); - } - - if (!isset(self::$_instances[$name])) { - self::$_instances[$name] = new $name; - } - return self::$_instances[$name]; - } - - abstract function isValid($name); - abstract function getClassName($name); - - final function getFilePath($name, $rel=TRUE, $pref=NULL) - { - try { - $reflection = new ReflectionClass($this->getClassName($name)); - $file = $reflection->getFileName(); - } catch (Exception $e) { - $file = ""; - } - return $file; - } - - final public function getFunctionAlias($name) - { - if (!$this->isValid($name)) { - return NULL; - } - $zclass = $this->getClassName($name); - $properties = get_class_vars($zclass); - if (isset($properties['php_alias'])) { - return $properties['php_alias']; - } - return NULL; - } - - final public function isSafe($name) - { - if (!$this->isValid($name)) { - return NULL; - } - $zclass = $this->getClassName($name); - $properties = get_class_vars($zclass); - return isset($properties['is_safe']) ? $properties['is_safe'] : FALSE; - } - - // generator(string $name, Haanga_Compiler $compiler, Array $args) {{{ - /** - * Executer the generator method of the extension. If - * the extension doesn't has any generator method, an empty - * will be returned. - * - * @param string $name extension name - * @param Haanga_Compiler Compiler object - * @param array Arrays - * @param mixed Extra param - * - * @return array - */ - function generator($name, Haanga_Compiler $compiler, $args, $extra=NULL) - { - if (!$this->hasGenerator($name)) { - return array(); - } - $zclass = $this->getClassName($name); - return call_user_func(array($zclass, 'generator'), $compiler, $args, $extra); - } - // }}} - - // hasGenerator(string $name) {{{ - /** - * Return TRUE if the extension has a - * generator method - * - * @param string $name Extension name - * - * @return bool - */ - function hasGenerator($name) - { - if (!$this->isValid($name)) { - return NULL; - } - $zclass = $this->getClassName($name); - return is_callable(array($zclass, 'generator')); - } - // }}} - - // getFunctionBody(string $name, string $name) {{{ - /** - * Return the body function of the custom extension main method. - * - * @param string $name - * @param string $name - * - * @return string - */ - function getFunctionBody($tag_name, $name) - { - if (!$this->isValid($tag_name)) { - return NULL; - } - $zclass = $this->getClassName($tag_name); - if (!is_callable(array($zclass, 'main'))) { - throw new Haanga_Compiler_Exception("{$name}: missing main method in {$zclass} class"); - } - - $reflection = new ReflectionMethod($zclass, 'main'); - $content = file($this->getFilePath($tag_name)); - - $start = $reflection->getStartLine()-1; - $end = $reflection->getEndLine(); - $content = array_slice($content, $start, $end-$start); - - $content[0] = str_replace("main", $name, $content[0]); - - - return "if (!function_exists('{$name}')) {\n".implode("", $content)."}"; - } - // }}} - -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/lib/Haanga/lib/Haanga/Extension/Filter.php b/lib/Haanga/lib/Haanga/Extension/Filter.php deleted file mode 100644 index 2a2fa16c0100dbf94fccae66f2dabc0f8ad66b7a..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter.php +++ /dev/null @@ -1,79 +0,0 @@ -<?php -/* - +---------------------------------------------------------------------------------+ - | Copyright (c) 2010 César Rodas and Menéame Comunicacions S.L. | - +---------------------------------------------------------------------------------+ - | Redistribution and use in source and binary forms, with or without | - | modification, are permitted provided that the following conditions are met: | - | 1. Redistributions of source code must retain the above copyright | - | notice, this list of conditions and the following disclaimer. | - | | - | 2. Redistributions in binary form must reproduce the above copyright | - | notice, this list of conditions and the following disclaimer in the | - | documentation and/or other materials provided with the distribution. | - | | - | 3. All advertising materials mentioning features or use of this software | - | must display the following acknowledgement: | - | This product includes software developed by César D. Rodas. | - | | - | 4. Neither the name of the César D. Rodas nor the | - | names of its contributors may be used to endorse or promote products | - | derived from this software without specific prior written permission. | - | | - | THIS SOFTWARE IS PROVIDED BY CÉSAR D. RODAS ''AS IS'' AND ANY | - | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | - | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | - | DISCLAIMED. IN NO EVENT SHALL CÉSAR D. RODAS BE LIABLE FOR ANY | - | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | - | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | - | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | - | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | - | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | - | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE | - +---------------------------------------------------------------------------------+ - | Authors: César Rodas <crodas@php.net> | - +---------------------------------------------------------------------------------+ -*/ - -class Haanga_Extension_Filter extends Haanga_Extension -{ - /** - * isValid - * - * - */ - final function isValid($filter) - { - static $cache = array(); - $filter = strtolower($filter); - - if (!isset($cache[$filter])) { - $class_name = $this->getClassName($filter); - if (class_exists($class_name)) { - $cache[$filter] = TRUE; - } else { - $cache[$filter] = FALSE; - } - } - - return $cache[$filter]; - } - - final function getClassName($filter) - { - $filter = str_replace("_", "", ucfirst($filter)); - return "Haanga_Extension_Filter_{$filter}"; - } - - -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ - diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Alert.php b/lib/Haanga/lib/Haanga/Extension/Filter/Alert.php deleted file mode 100644 index 14b1e7a135fd817041b649de30e1950d113a1c08..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Alert.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Alert -{ -public $is_safe = TRUE; - static function generator($compiler, $args) - { - if (count($args) != 1) { - $compiler->Error("alert filter only needs one parameter"); - } - $x = $args[0]; - $pre = '<script type="text/javascript">alert("'; - $post = '");</script>'; - return hexec('html_entity_decode', - hexec('preg_replace', '/$/', $post, - hexec('preg_replace', '/^/', $pre, $x))); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Capfirst.php b/lib/Haanga/lib/Haanga/Extension/Filter/Capfirst.php deleted file mode 100644 index 109408f2160b2e8e94c2edbf8d60474584806210..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Capfirst.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Capfirst -{ - public $php_alias = "ucfirst"; -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Count.php b/lib/Haanga/lib/Haanga/Extension/Filter/Count.php deleted file mode 100644 index 01d1bb625cd8610367dce0e8c70b07e6f356555b..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Count.php +++ /dev/null @@ -1,7 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Count -{ - public $php_alias = "count"; - public $is_safe = TRUE; /* a number if safe */ -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Cut.php b/lib/Haanga/lib/Haanga/Extension/Filter/Cut.php deleted file mode 100644 index 123beee3e292eaa046122fbb56c263365ef31f2b..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Cut.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - -Class Haanga_Extension_Filter_Cut -{ - - /** - * We implement "cut" filter at compilation time, to - * avoid senseless includes for simple things. - * - * We can also define an "php_alias" that will simple - * call this function (therefore it must exists at - * rendering time). - * - * Also a Main() static method could be declared, this will - * included at runtime or copied as a function if the CLI is used (more - * or less django style). - * - */ - static function generator($compiler, $args) - { - return hexec('str_replace', $args[1], "", $args[0]); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/D3circlepacking.php b/lib/Haanga/lib/Haanga/Extension/Filter/D3circlepacking.php deleted file mode 100644 index f97d2990a57163fefa1495eba662f88ac9f91647..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/D3circlepacking.php +++ /dev/null @@ -1,147 +0,0 @@ -<?php - -class Haanga_Extension_Filter_D3CirclePacking{ - public $is_safe = TRUE; - static function main($obj, $varname){ - - $nodesArr = array(); - $n=0; - $first=""; - $nodes = array(); - $links = array(); - $names = explode(",", $varname); - $varList = array(); - $randId = uniqid("_ID_"); - foreach($names as $v){ - if(strpos($v,"=")){ - break; - } - $variable['name'] = $v; - $variable['value'] = 'value'; - if(strpos($v, ".")){ - $aux = explode(".", $v); - $variable['name'] = $aux[0]; - $variable['value'] = $aux[1]; - } - $fieldCounter++; - $columnType = 'number'; - if($firstColumn){ - $columnType = 'string'; - $firstColumn = false; - } - array_push($varList, $variable); - //$data .= " data.addColumn('".$columnType."', '".$variable['name']."');\n"; - } - //options - $options = array(); - $options['width'] = 960; - $options['height'] = 600; - $options['color'] = '#aec7e8'; - $options['highlightedColor'] = '#00477f'; - $options['radius'] = 10; - $options['highlightedStrokeWidth'] = '3px'; - $options['strokeWidth'] = '1px'; - for($z=2; $z < count($names); $z++){ - $pair = explode("=", $names[$z]); - $key = trim($pair[0], "\" '"); - $value = trim($pair[1], "\" '"); - $options[$key] = $value; - } - - $maps = array(); - $quantities = array(); - $links = array(); - $rootNode = NULL; - $id = $varList[0]['name']; - $quantity = $varList[2]['name']; - $link = $varList[3]['name']; - $parentId = $varList[1]['name']; - - foreach($obj as $k){ - if(!isset($maps[$k->$parentId->value])){ - $maps[$k->$parentId->value] = array(); - } - if(isset($k->$quantity)){ - $quantities[$k->$id->value] = $k->$quantity->value; - } - if(isset($k->$link)){ - $links[$k->$id->value] = $k->$link->value; - } - array_push($maps[$k->$parentId->value], $k->$id->value); - } - function travelCirclePacking($node, $tree, $quantities, $links){ - $total = array(); - foreach($tree[$node] as $v){ - $branch = array(); - if(!isset($tree[$v])){ - if(isset($quantities[$v])){ - $branch['size'] = $quantities[$v]; - } - if(isset($links[$v])){ - $branch['link'] = $links[$v]; - } - }else{ - $branch['children'] = travelCirclePacking($v, $tree, $quantities, $links); - } - $branch['name'] = $v; - array_push($total, $branch); - } - return $total; - } - - $json['name'] = $rootNode; - $json['children'] = travelCirclePacking($rootNode, $maps, $quantities, $links); - - - $pre = '<div id="clusterpacking'.$randId.'"><div id="name'.$randId.'" style="font-family:sans-serif;font-size:15px;height:25px"><h2> </h2></div></div><script src="http://d3js.org/d3.v2.min.js?2.9.3"></script> -<script> -// Based on http://bost.ocks.org/mike/treemap/ -function initD3CirclePacking'.$randId.'(json){ -var width = '.$options['width'].', - height = '.$options['height'].', - format = d3.format(",d"); - -var pack = d3.layout.pack() - .size([width - 4, height - 4]) - .value(function(d) { return d.size; }); - -var vis = d3.select("#clusterpacking'.$randId.'").append("svg") - .attr("width", width) - .attr("height", height) - .attr("class", "pack").style("font", "10px sans-serif") - .append("g") - .attr("transform", "translate(2, 2)"); - - var node = vis.data([json]).selectAll("g.node") - .data(pack.nodes) - .enter().append("g") - .attr("class", function(d) { return d.children ? "node" : "leaf node"; }) - .attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; }); - - node.append("title") - .text(function(d) { return d.name + (d.children ? "" : ": " + format(d.size)); }); - - node.append("circle").style("fill", function(d) { return d.children ? "rgb(31, 119, 180)" : "#ff7f0e"; }) - .style("fill-opacity", function(d) { return d.children ? ".25" : "1"; }) - .style("stroke", "rgb(31, 119, 180)").style("stroke-width", "1px") - .attr("r", function(d) { return d.r; }); - - node.filter(function(d) { return !d.children && !d.link; }).append("text") - .attr("text-anchor", "middle") - .attr("dy", ".3em") - .text(function(d) { return d.name.substring(0, d.r / 3); }); - - node.filter(function(d) { return !d.children && d.link; }).append("a").attr("xlink:href", function(d){return d.link}).append("text") - .attr("text-anchor", "middle") - .attr("dy", ".3em") - .text(function(d) { return d.name.substring(0, d.r / 3); }); - - -} - -var jsonD3'.$randId.' = '.json_encode($json).'; -initD3CirclePacking'.$randId.'(jsonD3'.$randId.') -</script>'; - return $pre.$post; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/D3dendrogram.php b/lib/Haanga/lib/Haanga/Extension/Filter/D3dendrogram.php deleted file mode 100644 index 1e83aa92281cf4ae736ae3e5933d1573dcfaccea..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/D3dendrogram.php +++ /dev/null @@ -1,136 +0,0 @@ -<?php - -class Haanga_Extension_Filter_D3Dendrogram{ - public $is_safe = TRUE; - static function main($obj, $varname){ - - $nodesArr = array(); - $n=0; - $first=""; - $nodes = array(); - $links = array(); - $names = explode(",", $varname); - $varList = array(); - $randId = uniqid("_ID_"); - - foreach($names as $v){ - if(strpos($v,"=")){ - break; - } - $variable['name'] = $v; - $variable['value'] = 'value'; - if(strpos($v, ".")){ - $aux = explode(".", $v); - $variable['name'] = $aux[0]; - $variable['value'] = $aux[1]; - } - $fieldCounter++; - $columnType = 'number'; - if($firstColumn){ - $columnType = 'string'; - $firstColumn = false; - } - array_push($varList, $variable); - //$data .= " data.addColumn('".$columnType."', '".$variable['name']."');\n"; - } - //options - $options = array(); - $options['width'] = 600; - $options['height'] = 500; - $options['color'] = '#aec7e8'; - $options['highlightedColor'] = '#00477f'; - $options['radius'] = 10; - $options['highlightedStrokeWidth'] = '3px'; - $options['strokeWidth'] = '1px'; - for($z=2; $z < count($names); $z++){ - $pair = explode("=", $names[$z]); - $key = trim($pair[0], "\" '"); - $value = trim($pair[1], "\" '"); - $options[$key] = $value; - } - - $maps = array(); - $rootNode = NULL; - $id = $varList[0]['name']; - $parentId = $varList[1]['name']; - foreach($obj as $k){ - if(!isset($k->$parentId)){ - //root - $rootNode = $k->$id->value; - }else{ - if(!isset($maps[$k->$parentId->value])){ - $maps[$k->$parentId->value] = array(); - } - array_push($maps[$k->$parentId->value], $k->$id->value); - } - } - - function travel($node, $tree){ - $total = array(); - foreach($tree[$node] as $v){ - $branch = array(); - if(!isset($tree[$v])){ - $branch['value'] = 1000; - }else{ - $branch['children'] = travel($v, $tree); - } - $branch['name'] = $v; - array_push($total, $branch); - } - return $total; - } - - $json['name'] = $rootNode; - $json['children'] = travel($rootNode, $maps); - - - $pre = '<div id="dendrogram'.$randId.'"><div id="name'.$randId.'" style="font-family:sans-serif;font-size:15px;height:25px"><h2> </h2></div></div><script src="http://d3js.org/d3.v2.min.js?2.9.3"></script> -<script> -// Based on http://bost.ocks.org/mike/treemap/ -function initD3TreeMaps'.$randId.'(json){ -var width = '.$options['width'].', - height = '.$options['height'].'; - - var cluster = d3.layout.cluster() - .size([height, width - 200]); - - var diagonal = d3.svg.diagonal() - .projection(function(d) { return [d.y, d.x]; }); - - var vis = d3.select("#dendrogram'.$randId.'").append("svg") - .attr("width", width) - .attr("height", height) - .append("g") - .attr("transform", "translate(80, 0)"); - - var nodes = cluster.nodes(json); - - var link = vis.selectAll("path.link") - .data(cluster.links(nodes)) - .enter().append("path").style("fill", "none").style("stroke", "#CCC") - .attr("class", "link") - .attr("d", diagonal); - - var node = vis.selectAll("g.node") - .data(nodes) - .enter().append("g") - .attr("class", "node") - .attr("transform", function(d) { return "translate(" + d.y + "," + d.x + ")"; }) - - node.append("circle") - .attr("r", 4.5).style("fill", "white").style("stroke", "steelblue").style("stroke-width", "1.5px"); - - node.append("text").style("font", "10px sans-serif") - .attr("dx", function(d) { return d.children ? -8 : 8; }) - .attr("dy", 3) - .attr("text-anchor", function(d) { return d.children ? "end" : "start"; }) - .text(function(d) { return d.name; }); - -} - -var jsonD3'.$randId.' = '.json_encode($json).'; -initD3TreeMaps'.$randId.'(jsonD3'.$randId.') -</script>'; - return $pre.$post; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/D3forcegraph.php b/lib/Haanga/lib/Haanga/Extension/Filter/D3forcegraph.php deleted file mode 100644 index ba4a431b65c4aa8d3a5a9407e406bc88f929dbe1..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/D3forcegraph.php +++ /dev/null @@ -1,166 +0,0 @@ -<?php - -class Haanga_Extension_Filter_D3ForceGraph{ - public $is_safe = TRUE; - static function main($obj, $varname){ - - $nodesArr = array(); - $n=0; - $first=""; - $nodes = array(); - $links = array(); - $names = explode(",", $varname); - $varList = array(); - $randId = uniqid("_ID_"); - - foreach($names as $v){ - if(strpos($v,"=")){ - break; - } - $variable['name'] = $v; - $variable['value'] = 'value'; - if(strpos($v, ".")){ - $aux = explode(".", $v); - $variable['name'] = $aux[0]; - $variable['value'] = $aux[1]; - } - $fieldCounter++; - $columnType = 'number'; - if($firstColumn){ - $columnType = 'string'; - $firstColumn = false; - } - array_push($varList, $variable); - //$data .= " data.addColumn('".$columnType."', '".$variable['name']."');\n"; - } - - //options - $options = array(); - $options['width'] = 960; - $options['height'] = 500; - $options['color'] = '#aec7e8'; - $options['radius'] = 10; - $options['gravity'] = 0.05; - $options['distance'] = 100; - $options['charge'] = -100; - for($z=2; $z < count($names); $z++){ - $pair = explode("=", $names[$z]); - $key = trim($pair[0], "\" '"); - $value = trim($pair[1], "\" '"); - $options[$key] = $value; - } - - - foreach($obj as $k){ - $nameSource = $varList[0]['name']; - $valSource = $varList[0]['value']; - if(!isset($nodesArr[$k->$nameSource->value])){ - $nodesArr[$k->$nameSource->value] = $n++; - array_push($nodes, array("name" => $k->$nameSource->$valSource)); - } - $nameTarget = $varList[1]['name']; - $valTarget = $varList[1]['value']; - if(!isset($nodesArr[$k->$nameTarget->value])){ - $nodesArr[$k->$nameTarget->value] = $n++; - array_push($nodes, array("name" => $k->$nameTarget->$valTarget)); - } - array_push($links, array("source" => $nodesArr[$k->$nameSource->value], "target" => $nodesArr[$k->$nameTarget->value], "type" => "suit")); - - } - - $json['nodes'] = $nodes; - $json['links'] = $links; - - - $pre = '<div id="'.$randId.'"></div><script src="http://d3js.org/d3.v2.min.js?2.9.3"></script> -<script> -/* -Based on -http://jsfiddle.net/nrabinowitz/QMKm3/ -http://bl.ocks.org/3680999 -*/ - function initD3ForceGraph'.$randId.'(json) { - - var width = '.$options['width'].', - height = '.$options['height'].' - - - var svg = d3.select("#'.$randId.'") - .append("svg:svg") - .attr("width", width) - .attr("height", height) - .attr("pointer-events", "all") - .append("svg:g") - .call(d3.behavior.zoom().scaleExtent([0.1, 20]).on("zoom", redraw)) - .append("svg:g"); - -svg.append("svg:rect") - .attr("width", width) - .attr("height", height) - .attr("fill", "white"); - -function redraw() { - svg.attr("transform", - "translate(" + d3.event.translate + ")" - + " scale(" + d3.event.scale + ")"); -} - - - svg.append("svg:defs").append("svg:marker").attr("id", "marker") - .attr("viewBox", "0 -5 10 10") - .attr("refX", 15) - .attr("refY", -1.5) - .attr("markerWidth", 6) - .attr("markerHeight", 6) - .attr("orient", "auto") - .append("svg:path") - .attr("d", "M0,-5L10,0L0,5"); - - - var force = d3.layout.force() - .gravity('.$options['gravity'].') - .distance('.$options['distance'].') - .charge('.$options['charge'].') - .size([width, height]); - - force - .nodes(json.nodes) - .links(json.links) - .start(); - - var link = svg.append("svg:g").selectAll("path") - .data(force.links()) - .enter().append("svg:path").style("fill", "none").style("stroke", "#999").style("stroke-width", "1.8px") - .attr("class", function(d) { return "link " + d.type; }) - .attr("marker-end", "url(#marker)"); - - var node = svg.selectAll(".node") - .data(json.nodes) - .enter().append("g") - .attr("class", "node") - .call(force.drag); - - node.append("circle").attr("r", '.$options['radius'].').style("fill", "'.$options['color'].'").style("stroke", "#798ba2") - - node.append("text").style("font", "10px sans-serif") - .attr("dx", 12) - .attr("dy", ".35em") - .text(function(d) { return d.name }); - - force.on("tick", function() { - link.attr("d", function(d) { - var dx = d.target.x - d.source.x, - dy = d.target.y - d.source.y, - dr = Math.sqrt(dx * dx + dy * dy); - return "M" + d.source.x + "," + d.source.y + "A" + dr + "," + dr + " 0 0,1 " + d.target.x + "," + d.target.y; - }); - node.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; }); - }); -} - -var jsonD3'.$randId.' = '.json_encode($json).'; -initD3ForceGraph'.$randId.'(jsonD3'.$randId.') -</script>'; - return $pre.$post; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/D3linechart.php b/lib/Haanga/lib/Haanga/Extension/Filter/D3linechart.php deleted file mode 100644 index 4ba053e490dd00322394404c986f7e329ce54bf5..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/D3linechart.php +++ /dev/null @@ -1,272 +0,0 @@ -<?php - -class Haanga_Extension_Filter_D3LineChart{ - public $is_safe = TRUE; - static function main($obj, $varname){ - $data = array(); - $i = 0; - $options = array(); - $randId = rand(); - $firstColumn = true; - $names = explode(",", $varname); - $j = 0; - - - $fieldCounter=0; - $varList = array(); - foreach($names as $v){ - if(strpos($v,"=")){ - break; - } - $variable['name'] = $v; - $variable['value'] = 'value'; - if(strpos($v, ".")){ - $aux = explode(".", $v); - $variable['name'] = $aux[0]; - $variable['value'] = $aux[1]; - } - $fieldCounter++; - array_push($varList, $variable); - } - - $columnsAsSeries = false; - $series = array(); - if($columnsAsSeries){ - foreach($obj as $k){ - $newItem = array(); - foreach($varList as $v){ - $name = $v['name']; - $val = $v['value']; - - if($j==0){ - //$newItem[$j]['x'] = $value; - }else{ - $series[$name]['key'] = $name; - $series[$name]['values'][] = $k->$name->$val; - } - $j++; - } - $i++; - $j=0; - // array_push($data, $newItem); - } - foreach($series as $v){ - $data[] = $v; - } - }else{ - foreach($obj as $k){ - $newSerie = array(); - $currentSerie = null; - $newItem = array(); - foreach($varList as $v){ - $name = $v['name']; - $val = $v['value']; - - if($j==0){ - $currentSerie = $k->$name->$val; - if(!isset($data[$currentSerie])){ $data[$currentSerie] = array();} - }elseif($j == 1){ - $newItem['key'] = $k->$name->$val; - }elseif($j == sizeof($varList)-1){ - $newItem['uri'] = $k->$name->$val; - $data[$currentSerie][] = $newItem; - $newItem = array(); - }else{ - $newItem['values'] = floatval($k->$name->$val); - } - $j++; - } - $i++; - $j=0; - // array_push($data, $newItem); - } - /* $data = array( - array('key' => 'zxc', 'values' => array( 1, 2)), - array('key' => 'asd', 'values' => array(10, 2)), - array('key' => 'zxc1', 'values' => array( 11, 2)), - array('key' => 'asd1', 'values' => array(21, 2)), - array('key' => 'zxc2', 'values' => array( 23, 2)), - array('key' => 'asd3', 'values' => array(20, 2)), - );*/ - } - - //Getting options - $options['height'] = 300; - $options['width'] = 1000; - $options['padding'] = 20; - $options['barsProportion'] = 0.8; - $options['legendSpace'] = 15; - $options['intermediateLines'] = 4; - $options['numberOfBars'] = 0; - $options['chartProportion'] = .8; - for($z=$fieldCounter; $z < count($names); $z++){ - $pair = explode("=", $names[$z]); - $key = trim($pair[0], "\" '"); - $value = trim($pair[1], "\" '"); - $options[$key] = $value; - } - - $divId = uniqid("d3linechart_div"); - $pre = "<div id='".$divId."'></div> - <script src='http://d3js.org/d3.v2.min.js?2.9.3'></script> - <script type='text/javascript'> - //Adding namespaces - d3.ns.prefix['vsr'] = 'http://purl.org/twc/vocab/vsr#'; - d3.ns.prefix['rdf'] = 'http://www.w3.org/2000/01/rdf-schema#'; - d3.ns.prefix['grddl'] = 'http://www.w3.org/2003/g/data-view#'; - - var options_$divId = ".json_encode($options)."; - var dataset_$divId = ".json_encode($data)."; - var color = d3.scale.category10(); - var stroke = function(d){ - s = ['', '5,5', '5,10', '10,5']; - return s[d%s.length]; - } - - var maxValue_$divId = getMax(dataset_".$divId."); - var svg = d3.selectAll('#".$divId."') - .append('svg') - .attr('width', options_$divId.width) - .attr('height', options_$divId.height) - .attr('xmlns:xmlns:vsr','http://purl.org/twc/vocab/vsr#') - .attr('xmlns:xmlns:grddl', 'http://www.w3.org/2003/g/data-view#') - .attr('xmlns:xmlns:rdf','http://www.w3.org/2000/01/rdf-schema#'); - - svg.append('svg:metadata').attr('grddl:grddl:transformation', 'https://raw.github.com/timrdf/vsr/master/src/xsl/grddl/svg.xsl'); - -//Tooltip -tooltip_$divId = svg.append('text').style('opacity', 0).style('font-family', 'sans-serif').style('font-size', '11px').style('stroke-width', '.5'); - -var maxHeight_$divId = options_$divId.chartProportion*options_$divId.height; - var labels_$divId = getLabels(dataset_$divId); - options_$divId.numberOfBars = getNumberOfBars(dataset_$divId); - - function getMax(d){ - maxValue = 0; - for(var i in d){ - e = d[i]; - for(var j in e){ - if(maxValue < parseInt(e[j].values)){ - maxValue = parseInt(e[j].values); - } - } - } - return maxValue+1; - } - - function getNumberOfBars(d){ - numberOfBars = 0; - for(var i in d){ - e = d[i]; - aux = 0; - for(var j in e){ - aux++; - } - if(aux > numberOfBars){ - numberOfBars = aux; - } - } - return numberOfBars; - } - - function getLabels(d){ - labels = []; - for(i in d){ - e = d[i]; - for(j in e){ - labels.push(e[j].key); - } - return labels - } - } - //Axis - var xaxis = svg.append('g'); - xaxis.append('line').style('stroke', 'black').style('stroke-width', '2px').attr('x1', 1+options_$divId.legendSpace).attr('y1', maxHeight_$divId).attr('x2', options_$divId.width+options_$divId.padding+ options_$divId.legendSpace).attr('y2', maxHeight_$divId) - xaxis.selectAll('line.stub') - var labels_$divId = xaxis.selectAll('text.xaxis') - .data(labels_".$divId.") - .enter().append('text').text(function(d){return d}) - .style('font-size', '12px').style('font-family', 'sans-serif') - .attr('class', 'xaxis') - .attr('x', function(d, i){return options_$divId.chartProportion*i*(parseInt(options_$divId.width)/ options_$divId.numberOfBars) + 4*options_$divId.padding + options_$divId.legendSpace}) - .attr('y', function(d, i){return maxHeight_$divId+30;}) - .attr('transform', function(d){return 'translate(-'+(this.getBBox().width/2)+')'}); - - - var yaxis = svg.append('g'); - yaxis.append('line').style('stroke', 'black').style('stroke-width', '2px').attr('x1', 1+options_$divId.padding + options_$divId.legendSpace).attr('y1', maxHeight_$divId).attr('x2', 1+options_$divId.padding + options_$divId.legendSpace).attr('y2', 1) - for(i=0; i<options_$divId.intermediateLines; i++){ - yaxis.append('line').style('stroke', 'grey').style('stroke-width', '1px').attr('x1', 1 + options_$divId.legendSpace).attr('y1', maxHeight_$divId*(i/options_$divId.intermediateLines)+1).attr('x2', options_$divId.width).attr('y2', maxHeight_$divId*(i/options_$divId.intermediateLines)) - } - - -//Values -var line = d3.svg.line() - .x(function(d, i){return options_$divId.chartProportion*i*(parseInt(options_$divId.width) / options_$divId.numberOfBars) + 4*options_$divId.padding + options_$divId.legendSpace}) - .y(function(d, i) {return (1-d.values/maxValue_$divId)*maxHeight_$divId; }); - -var j=0; -for(var k in dataset_".$divId."){ - svg.append('path').attr('class', 'line_$divId') - .datum(dataset_".$divId."[k]) - .attr('d', line) - .style('opacity', 0.8) - .style('stroke', function(d, i){return color(k)}) - .style('stroke-width', '2px') - .style('stroke-dasharray', stroke(j)) - .style('fill', 'none') .append('svg:metadata') - .append('vsr:vsr:depicts') - .attr('rdf:rdf:resource', function(d){target = ''; for(var x in d){target += d[x].uri+' ';} return target;}); - - svg.selectAll('circle.points_$divId_'+j).data(dataset_".$divId."[k]).enter() - .append('circle').attr('class', 'points_$divId_'+j) - .attr('r', 4) - .attr('cx', function(d, i){return options_$divId.chartProportion*i*(parseInt(options_$divId.width) / options_$divId.numberOfBars) + 4*options_$divId.padding + options_$divId.legendSpace}) - .attr('cy', function(d, i) {return (1-d.values/maxValue_$divId)*maxHeight_$divId; }) - .style('fill', function(d, i){return color(k)}).append('svg:metadata') - .append('vsr:vsr:depicts') - .attr('rdf:rdf:resource', function(d){ return d.uri}); - j++ -} - - d3.selectAll('rect.bar') - .on('mouseover', function(){ - d3.select(this).style('opacity', 1); - }).on('mouseout', function(){ - d3.select(this).style('opacity', 0.8); - }); -//Scale - for(i=0; i<options_$divId.intermediateLines; i++){ - yaxis.append('text') - .attr('x', 1) - .attr('y', maxHeight_$divId*(i/options_$divId.intermediateLines)+1) - .attr('font-family', 'sans-serif') - .attr('font-size', '10px') - .text(maxValue_$divId*(1-i/options_$divId.intermediateLines)) - .attr('transform', 'translate(0,10)'); - } - -//Events -svg.selectAll('circle').on('mouseover', function(e){ - tooltipColor = 'black'; - newX = parseFloat(d3.select(this).attr('cx')) - 10; - newY = parseFloat(d3.select(this).attr('cy')) - 5; - if(newY > maxHeight_$divId){ - newY -=10; - } - if(newY < 10){ - newY +=21; - } - - tooltip_$divId.style('opacity', 1).style('fill', tooltipColor).attr('y', newY).attr('x', newX).text(e.values); - d3.select(this).style('opacity', 1); - }).on('mouseout', function(){ - d3.select(this).style('opacity', 0.8); - tooltip_$divId.style('opacity', 0); - }); - </script> - "; - - return $pre; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/D3parallelcoordinates.php b/lib/Haanga/lib/Haanga/Extension/Filter/D3parallelcoordinates.php deleted file mode 100644 index cdd9f37337ac6a858cd83de48ef4a1a7ecd4bcac..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/D3parallelcoordinates.php +++ /dev/null @@ -1,169 +0,0 @@ -<?php - -class Haanga_Extension_Filter_D3ParallelCoordinates{ - public $is_safe = TRUE; - static function main($obj, $varname){ - - $nodesArr = array(); - $n=0; - $first=""; - $nodes = array(); - $links = array(); - $names = explode(",", $varname); - $varList = array(); - $randId = uniqid("_ID_"); - - foreach($names as $v){ - if(strpos($v,"=")){ - break; - } - $variable['name'] = $v; - $variable['value'] = 'value'; - if(strpos($v, ".")){ - $aux = explode(".", $v); - $variable['name'] = $aux[0]; - $variable['value'] = $aux[1]; - } - $fieldCounter++; - $columnType = 'number'; - if($firstColumn){ - $columnType = 'string'; - $firstColumn = false; - } - array_push($varList, $variable); - //$data .= " data.addColumn('".$columnType."', '".$variable['name']."');\n"; - } - //options - $options = array(); - $options['width'] = 960; - $options['height'] = 500; - $options['color'] = '#aec7e8'; - $options['highlightedColor'] = '#00477f'; - $options['radius'] = 10; - $options['highlightedStrokeWidth'] = '3px'; - $options['strokeWidth'] = '1px'; - for($z=2; $z < count($names); $z++){ - $pair = explode("=", $names[$z]); - $key = trim($pair[0], "\" '"); - $value = trim($pair[1], "\" '"); - $options[$key] = $value; - } - - $rows = array(); - foreach($obj as $k){ - $row = array(); - foreach($varList as $v){ - $variable = $v['name']; - $val = $v['value']; - $row[$variable] = $k->$variable->$val; - } - array_push($rows, $row); - } - - $json = $rows; - - - $pre = '<div id="'.$randId.'"><div id="name'.$randId.'" style="font-family:sans-serif;font-size:15px;height:25px"><h2> </h2></div></div><script src="http://d3js.org/d3.v2.min.js?2.9.3"></script> -<script> -/* Based on http://bl.ocks.org/1341021 */ -function initD3ParallelCoordinates'.$randId.'(json){ -var width = '.$options['width'].', - height = '.$options['height'].' - -var m = [30, 10, 10, 10], - w = '.$options['width'].' - m[1] - m[3], - h = '.$options['height'].' - m[0] - m[2]; -var line = d3.svg.line(), - axis = d3.svg.axis().orient("left"), - background, - foreground; - -var svg = d3.select("#'.$randId.'").append("svg") - .attr("width", width) - .attr("height", height).style("font", "10px sans-serif") - .append("svg:g") - .attr("transform", "translate(" + m[3] + "," + m[0] + ")"); -; - -var x = d3.scale.ordinal().rangePoints([0, w], 1), - y = {}; - - // Extract the list of dimensions and create a scale for each. - x.domain(dimensions = d3.keys(json[0]).filter(function(d) { - return d != "'.$varList[0]['name'].'" && (y[d] = d3.scale.linear() - .domain(d3.extent(json, function(p) { return +p[d]; })) - .range([h, 0])); - })); - - // Add grey background lines for context. - background = svg.append("g") - .attr("class", "background") - .selectAll("path") - .data(json) - .enter().append("path").style("fill", "none").style("stroke", "#ccc").style("stroke-opacity", .4).style("shape-rendering", "crispEdges") - .attr("d", path); - - // Add blue foreground lines for focus. - foreground = svg.append("g") - .attr("class", "foreground") - .selectAll("path") - .data(json) - .enter().append("path").style("fill", "none").style("stroke-width", "'.$options['strokeWidth'].'").style("stroke", "'.$options['color'].'").style("stroke-opacity", .7) - .attr("d", path).attr("name", function(d){console.log("Adding "+d.'.$varList[0]['name'].');return d.'.$varList[0]['name'].'}).on("mouseover", mouseover).on("mouseout", mouseout); - - // Add a group element for each dimension. - var g = svg.selectAll(".dimension") - .data(dimensions) - .enter().append("g") - .attr("class", "dimension") - .attr("transform", function(d) { return "translate(" + x(d) + ")"; }); - - // Add an axis and title. - g.append("g") - .attr("class", "axis") - .each(function(d) { d3.select(this).call(axis.scale(y[d])); }) - .append("text") - .attr("text-anchor", "middle") - .attr("y", -9) - .text(String); - svg.selectAll(".axis line, .axis path").style("fill", "none").style("stroke", "#000") - // Add and store a brush for each axis. - g.append("g") - .attr("class", "brush").style("fill-opacity",.3).style("stroke", "#fff").style("shape-rendering", "crispEdges") - .each(function(d) { d3.select(this).call(y[d].brush = d3.svg.brush().y(y[d]).on("brush", brush)); }) - .selectAll("rect") - .attr("x", -8) - .attr("width", 16); - -// Returns the path for a given data point. -function path(d) { - return line(dimensions.map(function(p) { return [x(p), y[p](d[p])]; })); -} - -// Handles a brush event, toggling the display of foreground lines. -function brush() { - var actives = dimensions.filter(function(p) { return !y[p].brush.empty(); }), - extents = actives.map(function(p) { return y[p].brush.extent(); }); - foreground.style("display", function(d) { - return actives.every(function(p, i) { - return extents[i][0] <= d[p] && d[p] <= extents[i][1]; - }) ? null : "none"; - }); -} - -function mouseover(){ - d3.select(this).style("stroke-width", "'.$options['highlightedStrokeWidth'].'").style("stroke", "'.$options['highlightedColor'].'"); - d3.select("#name'.$randId.'").html("<h2>"+d3.select(this).attr("name")+"</h2>"); -} -function mouseout(){ - d3.select(this).style("stroke-width", "'.$options['strokeWidth'].'").style("stroke", "'.$options['color'].'"); - d3.select("#name'.$randId.'").html("<h2></h2>"); -} -} - -var jsonD3'.$randId.' = '.json_encode($json).'; -initD3ParallelCoordinates'.$randId.'(jsonD3'.$randId.') -</script>'; - return $pre.$post; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/D3radarchart.php b/lib/Haanga/lib/Haanga/Extension/Filter/D3radarchart.php deleted file mode 100644 index 5ece0696c0624e869e76bfb78175622d734081b4..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/D3radarchart.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php - -class Haanga_Extension_Filter_D3RadarChart{ - public $is_safe = TRUE; - static function main($obj, $varname){ - - $nodesArr = array(); - $n=0; - $first=""; - $nodes = array(); - $links = array(); - $names = explode(",", $varname); - $varList = array(); - $randId = uniqid("_ID_"); - - foreach($names as $v){ - if(strpos($v,"=")){ - break; - } - $variable['name'] = $v; - $variable['value'] = 'value'; - if(strpos($v, ".")){ - $aux = explode(".", $v); - $variable['name'] = $aux[0]; - $variable['value'] = $aux[1]; - } - $fieldCounter++; - $columnType = 'number'; - if($firstColumn){ - $columnType = 'string'; - $firstColumn = false; - } - array_push($varList, $variable); - } - - //options - $options = array(); - $options['width'] = 400; - $options['height'] = 400; - for($z=$fieldCounter; $z < count($names); $z++){ - $pair = explode("=", $names[$z]); - $key = trim($pair[0], "\" '"); - $value = trim($pair[1], "\" '"); - $options[$key] = $value; - } - $optionJson = json_encode($options); - $rows = array(); - foreach($obj as $k){ - $row = array(); - foreach($varList as $v){ - $variable = $v['name']; - $val = $v['value']; - $row[] = array('axis' => $variable, 'value' => floatval($k->$variable->$val)); - } - array_push($rows, $row); - } - - $json = $rows; - - - $pre = '<div id="'.$randId.'"></div> -<script src="http://d3js.org/d3.v2.min.js?2.9.3"></script> -<script src="https://raw.github.com/alangrafu/radar-chart-d3/master/src/radar-chart-min.js"></script> -<script> -var jsonD3'.$randId.' = '.json_encode($json).'; -options'.$randId.' = '.$optionJson.'; -RadarChart.draw("#'.$randId.'", jsonD3'.$randId.', options'.$randId.'); -</script>'; - return $pre.$post; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/D3stackedcolumnchart.php b/lib/Haanga/lib/Haanga/Extension/Filter/D3stackedcolumnchart.php deleted file mode 100644 index 60b2c9be19191ba4f8f0da7011b2efc8ab034061..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/D3stackedcolumnchart.php +++ /dev/null @@ -1,273 +0,0 @@ -<?php - -class Haanga_Extension_Filter_D3StackedColumnChart{ - public $is_safe = TRUE; - static function main($obj, $varname){ - $data = array(); - $i = 0; - $options = array(); - $randId = rand(); - $firstColumn = true; - $names = explode(",", $varname); - $j = 0; - - - - $fieldCounter=0; - $varList = array(); - foreach($names as $v){ - if(strpos($v,"=")){ - break; - } - $variable['name'] = $v; - $variable['value'] = 'value'; - if(strpos($v, ".")){ - $aux = explode(".", $v); - $variable['name'] = $aux[0]; - $variable['value'] = $aux[1]; - } - $fieldCounter++; - array_push($varList, $variable); - } - - $columnsAsSeries = false; - $series = array(); - if($columnsAsSeries){ - foreach($obj as $k){ - $newItem = array(); - foreach($varList as $v){ - $name = $v['name']; - $val = $v['value']; - - if($j==0){ - //$newItem[$j]['x'] = $value; - }else{ - $series[$name]['key'] = $name; - $series[$name]['values'][] = $k->$name->$val; - } - $j++; - } - $i++; - $j=0; - // array_push($data, $newItem); - } - foreach($series as $v){ - $data[] = $v; - } - }else{ - foreach($obj as $k){ - $newSerie = array(); - $currentSerie = null; - $newItem = array(); - foreach($varList as $v){ - $name = $v['name']; - $val = $v['value']; - - if($j==0){ - $currentSerie = $k->$name->$val; - if(!isset($data[$currentSerie])){ $data[$currentSerie] = array();} - }elseif($j == 1){ - $newItem['key'] = $k->$name->$val; - }elseif($j == sizeof($varList)-1){ - $newItem['uri'] = $k->$name->$val; - $data[$currentSerie][] = $newItem; - $newItem = array(); - }else{ - $newItem['values'] = floatval($k->$name->$val); - } - $j++; - } - $i++; - $j=0; - // array_push($data, $newItem); - } - /* $data = array( - array('key' => 'zxc', 'values' => array( 1, 2)), - array('key' => 'asd', 'values' => array(10, 2)), - array('key' => 'zxc1', 'values' => array( 11, 2)), - array('key' => 'asd1', 'values' => array(21, 2)), - array('key' => 'zxc2', 'values' => array( 23, 2)), - array('key' => 'asd3', 'values' => array(20, 2)), - );*/ - } - - //Getting options - $options['height'] = 300; - $options['width'] = 1000; - $options['padding'] = 20; - $options['barsProportion'] = 0.8; - $options['legendSpace'] = 15; - $options['intermediateLines'] = 4; - $options['numberOfBars'] = 0; - for($z=$fieldCounter; $z < count($names); $z++){ - $pair = explode("=", $names[$z]); - $key = trim($pair[0], "\" '"); - $value = trim($pair[1], "\" '"); - $options[$key] = $value; - } - - $divId = uniqid("columnchart_div"); - $pre = "<div id='".$divId."' xmlns:vsr='http://purl.org/twc/vocab/vsr#' xmlns:rdf='http://www.w3.org/2000/01/rdf-schema#' xmlns:grddl='http://www.w3.org/2003/g/data-view#'> - </div> - <script src='http://d3js.org/d3.v2.min.js?2.9.3'></script> - <script type='text/javascript'> - //Adding namespaces - d3.ns.prefix['vsr'] = 'http://purl.org/twc/vocab/vsr#'; - d3.ns.prefix['rdf'] = 'http://www.w3.org/2000/01/rdf-schema#'; - d3.ns.prefix['grddl'] = 'http://www.w3.org/2003/g/data-view#'; - - var options_$divId = ".json_encode($options)."; - var dataset_$divId = ".json_encode($data)."; - var color = function(d){ - s = ['#5078a9', 'brown', 'gold', 'ForestGreen']; - return s[d%s.length]; - }; - - var maxValue_$divId = getMax(dataset_$divId); - options_$divId.numberOfBars = getNumberOfBars(dataset_$divId); - labels_$divId = getLabels(dataset_$divId); - - var svg = d3.selectAll('#".$divId."') - .append('svg') - .attr('width', options_$divId.width) - .attr('height', options_$divId.height) - .attr('xmlns:xmlns:vsr','http://purl.org/twc/vocab/vsr#') - .attr('xmlns:xmlns:grddl', 'http://www.w3.org/2003/g/data-view#') - .attr('xmlns:xmlns:rdf','http://www.w3.org/2000/01/rdf-schema#') - .attr('grddl:grddl:transformation', 'https://raw.github.com/timrdf/vsr/master/src/xsl/grddl/svg.xsl'); - - svg.append('svg:metadata').attr('grddl:grddl:transformation', 'https://raw.github.com/timrdf/vsr/master/src/xsl/grddl/svg.xsl'); - - var maxHeight_$divId = options_$divId.barsProportion*options_$divId.height; - - - function getMax(d){ - maxValues = []; - for(var i in d){ - e = d[i]; - for(var j in e){ - if(maxValues[e[j].key] == undefined){ - maxValues[e[j].key] = 0; - } - maxValues[e[j].key] += parseInt(e[j].values); - } - } - r = 0; - for(var i in maxValues){ - aux = parseInt(maxValues[i]); - if(aux > r){ - r = aux; - } - } - return r+1; - } - - function getNumberOfBars(d){ - numberOfBars = 0; - for(var i in d){ - e = d[i]; - aux = 0; - for(var j in e){ - aux++; - } - if(aux > numberOfBars){ - numberOfBars = aux; - } - } - return numberOfBars; - } - - function getLabels(d){ - labels = []; - for(i in d){ - e = d[i]; - for(j in e){ - labels.push(e[j].key); - } - return labels - } - } - -//Axis - var xaxis = svg.append('g'); - xaxis.append('line').style('stroke', 'black').style('stroke-width', '2px').attr('x1', 1+options_$divId.legendSpace).attr('y1', maxHeight_$divId).attr('x2', options_$divId.width+options_$divId.padding+ options_$divId.legendSpace).attr('y2', maxHeight_$divId) - xaxis.selectAll('line.stub') - var labels_$divId = xaxis.selectAll('text.xaxis') - .data(labels_$divId) - .enter().append('text').text(function(d){return d}) - .style('font-size', '12px').style('font-family', 'sans-serif') - .attr('class', 'xaxis') - .attr('x', function(d, i){return options_$divId.barsProportion * i* (parseInt(options_$divId.width) / options_$divId.numberOfBars) + 2*options_$divId.padding + options_$divId.legendSpace + this.getBBox().width}) - .attr('y', function(d, i){return maxHeight_$divId+30;}); -// .attr('transform', function(d, i){return ' rotate(-45 '+(options_$divId.barsProportion *i* (parseInt(options_$divId.width) / options_$divId.numberOfBars) + options_$divId.padding + options_$divId.legendSpace)+' '+(maxHeight_$divId+30)+') translate(-'+this.getBBox().width/2+',0)'}); - - - var yaxis = svg.append('g'); - yaxis.append('line').style('stroke', 'black').style('stroke-width', '2px').attr('x1', 1+options_$divId.padding + options_$divId.legendSpace).attr('y1', maxHeight_$divId).attr('x2', 1+options_$divId.padding + options_$divId.legendSpace).attr('y2', 1) - for(i=0; i<options_$divId.intermediateLines; i++){ - yaxis.append('line').style('stroke', 'grey').style('stroke-width', '1px').attr('x1', 1 + options_$divId.legendSpace).attr('y1', maxHeight_$divId*(i/options_$divId.intermediateLines)+1).attr('x2', options_$divId.width).attr('y2', maxHeight_$divId*(i/options_$divId.intermediateLines)) - } - - -//Values -baseline = []; -var j=0, l=0; -for(var k in dataset_$divId){ -j=0; - svg.selectAll('d.series') - .data(dataset_".$divId."[k]).enter() - .append('rect').attr('class', 'bar_$divId') - .attr('x', function(d, i) { - j++; - return options_$divId.barsProportion *j* (parseInt(options_$divId.width) / options_$divId.numberOfBars) + options_$divId.padding + options_$divId.legendSpace; - }) - .attr('y', function(d, i){ - if(baseline[d.key] == undefined){baseline[d.key]=maxHeight_$divId;} - r = maxHeight_$divId*(1-parseInt(d.values)/maxValue_$divId) - (maxHeight_$divId - baseline[d.key]); - baseline[d.key] = r - return r; - - }) - .attr('width', options_$divId.width / options_$divId.numberOfBars - options_$divId.padding) - .attr('height', function(d){ - return maxHeight_$divId*d.values/maxValue_$divId - }) - .style('opacity', 0.8).style('fill', function(d, i){return color(l)}) - .append('svg:metadata') - .append('vsr:vsr:depicts') - .attr('rdf:rdf:resource', function(d){return d.uri;}); - l++; -} - - -//Tooltip -tooltip_$divId = svg.append('text').style('opacity', 0).style('font-family', 'sans-serif').style('font-size', '11px').style('stroke-width', '.5'); - -//Events -svg.selectAll('rect.bar_$divId') - .on('mouseover', function(e){ - tooltipColor = 'black'; - newX = parseFloat(d3.select(this).attr('x')); - newY = parseFloat(d3.select(this).attr('y')); - if(newY > maxHeight_$divId){ - newY -=10; - } - if(newY < 10){ - newY +=11; - tooltipColor = 'white'; - } - tooltip_$divId.style('opacity', 1).style('fill', tooltipColor).attr('y', newY).attr('x', newX).text(e.values); - d3.select(this).style('opacity', 1); - }).on('mouseout', function(){ - d3.select(this).style('opacity', 0.8); - tooltip_$divId.style('opacity', 0); - }); - - for(i=0; i<options_$divId.intermediateLines; i++){ - yaxis.append('text').attr('x', 1).attr('y', maxHeight_$divId*(i/options_$divId.intermediateLines)+1).attr('font-family', 'sans-serif').attr('font-size', '10px').text(maxValue_$divId*(1-i/options_$divId.intermediateLines)).attr('transform', 'translate(0,10)'); - } - </script> - "; - return $pre; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/D3wordcloud.php b/lib/Haanga/lib/Haanga/Extension/Filter/D3wordcloud.php deleted file mode 100644 index c0b6fd4825c7ce30f6d175543093caa287f8784f..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/D3wordcloud.php +++ /dev/null @@ -1,150 +0,0 @@ -<?php - -class Haanga_Extension_Filter_D3WordCloud{ - public $is_safe = TRUE; - static function main($obj, $varname){ - global $conf; - $names = explode(",", $varname); - $varList = array(); - $randId = uniqid("_ID_"); - $words = array(); - $fieldCounter=0; - foreach($names as $v){ - if(strpos($v,"=")){ - break; - } - $variable['name'] = $v; - $variable['value'] = 'value'; - if(strpos($v, ".")){ - $aux = explode(".", $v); - $variable['name'] = $aux[0]; - $variable['value'] = $aux[1]; - } - $fieldCounter++; - array_push($varList, $variable); - } - - //options - $options = array(); - $options['width'] = 960; - $options['height'] = 500; - $options['color'] = '#aec7e8'; - $options['radius'] = 10; - $options['count'] = false; - for($z=count($varList); $z < count($names); $z++){ - $pair = explode("=", $names[$z]); - $key = trim($pair[0], "\" '"); - $value = trim($pair[1], "\" '"); - $options[$key] = $value; - } - - if(count($varList) < 2){ - foreach($obj as $k){ - foreach($varList as $var){ - $name = $var['name']; - $val = $var['value']; - $words = array_merge($words, preg_split("/[\s,\.]+/", $k->$name->$val)); - } - } - }else{ - $options['count'] = true; - $wordValue = $varList[0]['value']; - $wordVar = $varList[0]['name']; - $countValue = $varList[1]['value']; - $countVar = $varList[1]['name']; - if(isset($varList[2])){ - $linkValue = $varList[2]['value']; - $linkVar = $varList[2]['name']; - } - foreach($obj as $k){ - $currentArray = array("name"=>$k->$wordVar->$wordValue, "total" => intval($k->$countVar->$countValue), ); - if(isset($varList[2])){ - $currentArray['link'] = $k->$linkVar->$linkValue; - } - $words[] = $currentArray; - - } - } - - - $pre = '<div id="wordcloud'.$randId.'"></div> -<script src="http://d3js.org/d3.v2.min.js?2.9.3"></script> -<script src="'.$conf['basedir'].'js/d3.layout.cloud.js"></script> -<script> -// Based on http://www.jasondavies.com/wordcloud -function D3WordCloud'.$randId.'(words, newcfg){ - var cfg = {width: 300, - height: 300, - font: "sans-serif", - minsize: 10, - maxsize: 100, - wordOrientation: "random", - color: "black", - stopwords: ["of", "the", "a", "or", "to", "and", "for", "at", "with", "without", "in", "from", "is", "are", "were", "was", "this", "that", "these", "those", "in", "on"] - }; - for(i in newcfg){ - cfg[i] = newcfg[i]; - } - var countingWords = {}; - var totalWords = new Array(); - - if(!cfg.count){ - for(i in words){ - var d = words[i].replace(/[()\.]/gi, ""); - if(cfg.stopwords.indexOf(d)<0){ - if(countingWords[d] != undefined){ - countingWords[d] += 1 - }else{ - countingWords[d] = 1 - } - } - } - for(i in countingWords){ - totalWords.push({name: i, total: countingWords[i]}); - } - }else{ - totalWords = words; - } - var maxValue = Math.max.apply(Math, totalWords.map(function(d){return d.total;})); - var wordLinks = new Array(); - for(i in totalWords){ - wordLinks[totalWords[i].name] = totalWords[i].link || undefined; - } - d3.layout.cloud().size([cfg.width, cfg.height]) - .words(totalWords.map(function(d) { - return {text: d.name, size: parseInt(cfg.minsize + (cfg.maxsize-cfg.minsize)*(d.total/maxValue))}; - })) - .rotate(function() { var x=~~(Math.random() * 2) * 90; if(cfg.wordOrientation == "horizontal"){x = 0;}if(cfg.wordOrientation == "vertical"){x = 90;} return x; }) - .padding(1) - .font("arial") - .fontSize(function(d) { return d.size; }) - .on("end", draw) - .start(); - - function draw(words) { - var svg = d3.select("#wordcloud'.$randId.'").append("svg"); - - var g = svg.attr("width", cfg.width) - .attr("height", cfg.height).append("g") - .attr("transform", "translate("+cfg.width/2+","+cfg.height/2+")"); - - g.selectAll("text").data(words) - .enter().append("a").attr("xlink:href", function(d){return wordLinks[d.text]}).append("text") - .style("font-family", cfg.font) - .style("font-size", function(d) { return d.size + "px"; }) - .style("fill", cfg.color) - .attr("text-anchor", "middle") - .attr("transform", function(d) { - return "translate(" + [d.x, d.y] + ")rotate(" + d.rotate + ")"; - }) - .text(function(d) { return d.text; }); - - } -} -var words'.$randId.' = '.json_encode($words).'; -var options'.$randId.' = '.json_encode($options).' -D3WordCloud'.$randId.'(words'.$randId.', options'.$randId.'); -</script>'; - return $pre; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Date.php b/lib/Haanga/lib/Haanga/Extension/Filter/Date.php deleted file mode 100644 index b60b299e17a592dff1ca31d6dd9049961b53848b..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Date.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Date -{ - static function generator($compiler, $args) - { - return hexec('date', $args[1], $args[0]); - } -} - - diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Decodedescription.php b/lib/Haanga/lib/Haanga/Extension/Filter/Decodedescription.php deleted file mode 100644 index 02a39b2c86e6bffa87bcd35e624743bd7c57af6d..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Decodedescription.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php -//decodes a any text containing a -class Haanga_Extension_Filter_Decodedescription -{ - static function main($args) { - - $allowed_tags = "<u><b><i><strong><br><p><ul><ol><li><iframe><a><img>"; - - $description = strip_tags(html_entity_decode(htmlspecialchars(html_entity_decode($args,ENT_QUOTES,"UTF-8"),ENT_QUOTES,"UTF-8"),ENT_QUOTES,"UTF-8"),$allowed_tags); - - preg_match("/<p(\s[^>]*)?>/i",$description,$matches); - if ($matches) - {return $description ; } - else - { return "<p>". $description . "</p>"; } - -} -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Default.php b/lib/Haanga/lib/Haanga/Extension/Filter/Default.php deleted file mode 100644 index 10ee70c6df34f08d4fe3eac4e999936b81af1aa2..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Default.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Default -{ - static function generator($compiler, $args) - { - return hexpr_cond(hexpr(hexec('empty', $args[0]), '==', TRUE), $args[1], $args[0]); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Deurifier.php b/lib/Haanga/lib/Haanga/Extension/Filter/Deurifier.php deleted file mode 100644 index 767bc8c3ec74ac3b8501d5cc64e0ceb7ae831fc4..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Deurifier.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Deurifier -{ - static function main($uri) - { - $newUri = preg_replace('/^http\//', 'http://', $uri); - $newUri = preg_replace('/__hash__/', '#', $newUri); - $newUri = preg_replace('/__qmark__/', '?', $newUri); - return $newUri; - } -} - - diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Dictsort.php b/lib/Haanga/lib/Haanga/Extension/Filter/Dictsort.php deleted file mode 100644 index e528a830310d077cd17554f8fa0d589f04ce43a6..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Dictsort.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Dictsort -{ - /** - * Sorted a nested array by '$sort_by' - * property on each sub-array. This - * filter is included at rendering time, if you want - * to see the generated version see tags/dictsort.php - */ - static function main($array, $sort_by) - { - $field = array(); - foreach ($array as $key => $item) { - $field[$key] = $item[$sort_by]; - } - array_multisort($field, SORT_REGULAR, $array); - return $array; - - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Divisibleby.php b/lib/Haanga/lib/Haanga/Extension/Filter/Divisibleby.php deleted file mode 100755 index fa0bb378847f178142c642f9096c4d8555534a37..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Divisibleby.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Divisibleby -{ - static function main($number, $divisible_by) - { - return ($number % $divisible_by) == 0; - - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Empty.php b/lib/Haanga/lib/Haanga/Extension/Filter/Empty.php deleted file mode 100644 index 65fbb9b40f8cf885a71112313ba54c5fff959543..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Empty.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Empty -{ - public $php_alias = 'empty'; -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Escape.php b/lib/Haanga/lib/Haanga/Extension/Filter/Escape.php deleted file mode 100644 index d4e25369857d3db7415fbe0649b3dcb8fef894c8..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Escape.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Escape -{ - public $php_alias = "htmlspecialchars"; -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Exists.php b/lib/Haanga/lib/Haanga/Extension/Filter/Exists.php deleted file mode 100644 index 6aa0dbc08e17cf56e84365626aa83bd7f1461184..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Exists.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Exists -{ - public $php_alias = 'isset'; -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Explode.php b/lib/Haanga/lib/Haanga/Extension/Filter/Explode.php deleted file mode 100644 index de7561a415756682c83fb043457a74cc3ee420bd..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Explode.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Explode -{ - public static function generator($compiler, $args) - { - if (count($args) == 1 || $args[1] == "") { - return hexec("str_split", $args[0]); - } - return hexec("explode", $args[1], $args[0]); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Googlemaps.php b/lib/Haanga/lib/Haanga/Extension/Filter/Googlemaps.php deleted file mode 100644 index c208981e092f756dc703ebb37a3f4a9f3d46eb40..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Googlemaps.php +++ /dev/null @@ -1,102 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Googlemaps{ - public $is_safe = TRUE; - static function main($obj, $varname){ - $data = ""; - $i = 0; - $j = 0; - $randId = uniqid("_mapID_"); - $firstColumn = true; - $names = explode(",", $varname); - $north = -90; $south=90; $east=-180; $west = 180; - $latArr =""; $longArr=""; $nameArr = ""; - $options = array(); - $options['width'] = 700; - $options['height'] = 600; - for($z=3; $z < count($names); $z++){ - $pair = explode("=", $names[$z]); - $key = trim($pair[0], "\" '"); - $value = trim($pair[1], "\" '"); - $options[$key] = $value; - } - $w = $options['width']; - $h = $options['height']; - $z = intval($options['zoom']); - - $points = array(); - foreach($obj as $k){ - $currentPoint = array(); - if($north < $k->$names[0]->value){ - $north = $k->$names[0]->value; - } - $currentPoint['lat'] = $k->$names[0]->value; - if($south > $k->$names[0]->value){ - $south = $k->$names[0]->value; - } - - if($west > $k->$names[1]->value){ - $west = $k->$names[1]->value; - } - if($east < $k->$names[1]->value){ - $east = $k->$names[1]->value; - } - $currentPoint['long'] = $k->$names[1]->value; - - $currentPoint['label'] = $k->$names[2]->value; - $firstColumn = false; - array_push($points, $currentPoint); - } - $pre = "<div style='height:".$h."px;'><div id='map_canvas' style='height:100%;width:100%;border: 1px solid #333;' ></div></div> - <script src='https://maps.googleapis.com/maps/api/js?sensor=false'></script> - <script type='text/javascript'> - //<![CDATA[ - function initialize_$randId() { - - var southWest = new google.maps.LatLng(".$south.", ".$west."); - var northEast = new google.maps.LatLng(".$north.", ".$east."); - - - var lngSpan = southWest.lng() - northEast.lng(); - var latSpan = southWest.lat() + northEast.lat(); - var locations = ".json_encode($points)."; - - var mapOptions$randId = ".json_encode($options)."; - mapOptions$randId.mapTypeId= google.maps.MapTypeId.ROADMAP; - - var map = new google.maps.Map(document.getElementById('map_canvas'),mapOptions$randId); - var bounds = new google.maps.LatLngBounds(southWest, northEast); - if(mapOptions$randId.zoom){ - var zoomChangeBoundsListener = google.maps.event.addListener(map, 'bounds_changed', function(event) { - google.maps.event.removeListener(zoomChangeBoundsListener); - map.setZoom( mapOptions$randId.zoom ); - }); - } - map.fitBounds(bounds); - - var infowindow = new google.maps.InfoWindow(); - - var marker, i; - - for (i = 0; i < locations.length; i++) { - marker = new google.maps.Marker({ - position: new google.maps.LatLng(locations[i].lat, locations[i].long), - title: locations[i].label, - map: map - }); - - google.maps.event.addListener(marker, 'click', (function(marker, i) { - return function() { - infowindow.setContent('<p>'+locations[i].label+'</p>') - infowindow.open(map, marker); - } - })(marker, i)); - } - - } - initialize_$randId(); - //]]> - </script>"; - return $pre; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Googlevizannotatedtimeline.php b/lib/Haanga/lib/Haanga/Extension/Filter/Googlevizannotatedtimeline.php deleted file mode 100644 index 7f8156f9edcfd50c5de80d2d560c794f1be46fac..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Googlevizannotatedtimeline.php +++ /dev/null @@ -1,85 +0,0 @@ -<?php - -class Haanga_Extension_Filter_GoogleVizAnnotatedTimeline{ - public $is_safe = TRUE; - static function main($obj, $varname){ - $data = ""; - $i = 0; - $j = 0; - $firstColumn = true; - $options = array(); - $names = explode(",", $varname); - - $fieldCounter=0; - $varList = array(); - foreach($names as $v){ - $variable['name'] = $v; - $variable['value'] = 'value'; - if(strpos($v,"=")){ - break; - } - if(strpos($v, ".")){ - $aux = explode(".", $v); - $variable['name'] = $aux[0]; - $variable['value'] = $aux[1]; - } - array_push($varList, $variable); - - $columnType = 'number'; - - if($firstColumn){ - $columnType = 'date'; - $firstColumn = false; - }elseif(($fieldCounter - 2) %3 == 0 || ($fieldCounter - 3) %3 == 0){ - $columnType = 'string'; - } - array_push($varList, $v); - $data .= " data.addColumn('".$columnType."', '".$variable['name']."');\n"; - $fieldCounter++; - } - - foreach($obj as $k){ - $j=0; - foreach($varList as $v){ - $name = $v['name']; - $val = $v['value']; - $value = $k->$name->$val."ASDASD"; - if($j==0){ - $value = "new Date(".date("Y, m, d", strtotime($k->$name->$val)).")"; - }elseif($j-2>=0 && (($j - 2) %3 == 0 || ($j - 3) %3 == 0)){ - $value = "'".$k->$name->$val."'"; - } - $data .=" data.setCell($i, $j, ".$value.");\n"; - $j++; - } - $i++; - } - - - //Getting options - $options['height'] = 400; - $options['width'] = 400; - $options['displayAnnotations'] = 'true'; - for($z=$fieldCounter; $z < count($names); $z++){ - $pair = explode("=", $names[$z]); - $key = trim($pair[0], "\" '"); - $value = trim($pair[1], "\" '"); - $options[$key] = $value; - } - - $divId = uniqid("timeline_div"); - $pre = "<div id='".$divId."' style='width: 700px; height: 240px;'></div><script type='text/javascript' src='https://www.google.com/jsapi'></script> - <script type='text/javascript'> - var options_$divId = ".json_encode($options)."; - google.load('visualization', '1', {packages:['annotatedtimeline']}); - google.setOnLoadCallback(drawChart); - function drawChart() { - var data = new google.visualization.DataTable(); - data.addRows(".$i.");\n -".$data." var timeline = new google.visualization.AnnotatedTimeLine(document.getElementById('".$divId."')); -timeline.draw(data, options_$divId); - } - </script>"; - return $pre; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Googlevizbarchart.php b/lib/Haanga/lib/Haanga/Extension/Filter/Googlevizbarchart.php deleted file mode 100644 index 9f31009a91329735e217b4c742a38243777bfa68..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Googlevizbarchart.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php - -class Haanga_Extension_Filter_GoogleVizBarChart{ - public $is_safe = TRUE; - static function main($obj, $varname){ - $data = ""; - $i = 0; - $j = 0; - $firstColumn = true; - $options = array(); - $names = explode(",", $varname); - - $fieldCounter=0; - $varList = array(); - foreach($names as $v){ - if(strpos($v,"=")){ - break; - } - $variable['name'] = $v; - $variable['value'] = 'value'; - if(strpos($v, ".")){ - $aux = explode(".", $v); - $variable['name'] = $aux[0]; - $variable['value'] = $aux[1]; - } - $fieldCounter++; - $columnType = 'number'; - if($firstColumn){ - $columnType = 'string'; - $firstColumn = false; - } - array_push($varList, $variable); - $data .= " data.addColumn('".$columnType."', '".$variable['name']."');\n"; - } - - foreach($obj as $k){ - foreach($varList as $v){ - $name = $v['name']; - $val = $v['value']; - $value = ($j==0)?"'".str_replace("'", "\'",$k->$name->$val)."'":floatval($k->$name->$val); - $data .=" data.setCell($i, $j, ".$value.");\n"; - $j++; - } - $i++; - $j=0; - } - - - //Getting options - $options['height'] = 600; -// $options['width'] = 400; - for($z=$fieldCounter; $z < count($names); $z++){ - $pair = explode("=", $names[$z]); - $key = trim($pair[0], "\" '"); - $value = trim($pair[1], "\" '"); - $options[$key] = $value; - } - - $divId = uniqid("columnchart_div"); - $pre = "<div id='".$divId."'></div><script type='text/javascript' src='https://www.google.com/jsapi'></script> - <script type='text/javascript'> - var options_$divId = ".json_encode($options)."; - google.load('visualization', '1', {packages:['corechart']}); - google.setOnLoadCallback(drawChart); - function drawChart() { - var data = new google.visualization.DataTable(); - data.addRows(".$i.");\n -".$data." var barchart = new google.visualization.BarChart(document.getElementById('".$divId."')); -barchart.draw(data, options_$divId); - } - </script>"; - return $pre; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Googlevizcolumnchart.php b/lib/Haanga/lib/Haanga/Extension/Filter/Googlevizcolumnchart.php deleted file mode 100644 index c241665789248b8f7114df31a9db49984c313687..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Googlevizcolumnchart.php +++ /dev/null @@ -1,79 +0,0 @@ -<?php - -class Haanga_Extension_Filter_GoogleVizColumnChart{ - public $is_safe = TRUE; - static function main($obj, $varname){ - $data = ""; - $i = 0; - $options = array(); - $randId = rand(); - $firstColumn = true; - $names = explode(",", $varname); - $j = 0; - - - //$options['width'] = 400; - $options['height'] = 600; - - $fieldCounter=0; - $varList = array(); - foreach($names as $v){ - if(strpos($v,"=")){ - break; - } - $variable['name'] = $v; - $variable['value'] = 'value'; - if(strpos($v, ".")){ - $aux = explode(".", $v); - $variable['name'] = $aux[0]; - $variable['value'] = $aux[1]; - } - $fieldCounter++; - $columnType = 'number'; - if($firstColumn){ - $columnType = 'string'; - $firstColumn = false; - } - array_push($varList, $variable); - $data .= " data.addColumn('".$columnType."', '".$variable['name']."');\n"; - } - - foreach($obj as $k){ - foreach($varList as $v){ - $name = $v['name']; - $val = $v['value']; - $value = ($j==0)?"'".str_replace("'", "\'",$k->$name->$val)."'":floatval($k->$name->$val); - $data .=" data.setCell($i, $j, ".$value.");\n"; - $j++; - } - $i++; - $j=0; - } - - - //Getting options - $options['height'] = 600; - //$options['width'] = 400; - for($z=$fieldCounter; $z < count($names); $z++){ - $pair = explode("=", $names[$z]); - $key = trim($pair[0], "\" '"); - $value = trim($pair[1], "\" '"); - $options[$key] = $value; - } - - $divId = uniqid("columnchart_div"); - $pre = "<div id='".$divId."'></div><script type='text/javascript' src='https://www.google.com/jsapi'></script> - <script type='text/javascript'> - var options_$divId = ".json_encode($options)."; - google.load('visualization', '1', {packages:['corechart']}); - google.setOnLoadCallback(drawChart); - function drawChart() { - var data = new google.visualization.DataTable(); - data.addRows(".$i.");\n -".$data." var columnchart = new google.visualization.ColumnChart(document.getElementById('".$divId."')); -columnchart.draw(data, options_$divId); - } - </script>"; - return $pre; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Googlevizlinechart.php b/lib/Haanga/lib/Haanga/Extension/Filter/Googlevizlinechart.php deleted file mode 100644 index efe92fde0fdec5c404e11115d030edf2b550b881..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Googlevizlinechart.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php - -class Haanga_Extension_Filter_GoogleVizLineChart{ - public $is_safe = TRUE; - static function main($obj, $varname){ - $data = ""; - $i = 0; - $j = 0; - $firstColumn = true; - $options = array(); - $names = explode(",", $varname); - - $fieldCounter=0; - $varList = array(); - foreach($names as $v){ - if(strpos($v,"=")){ - break; - } - $variable['name'] = $v; - $variable['value'] = 'value'; - if(strpos($v, ".")){ - $aux = explode(".", $v); - $variable['name'] = $aux[0]; - $variable['value'] = $aux[1]; - } - $fieldCounter++; - $columnType = 'number'; - if($firstColumn){ - $columnType = 'string'; - $firstColumn = false; - } - array_push($varList, $variable); - $data .= " data.addColumn('".$columnType."', '".$variable['name']."');\n"; - } - - foreach($obj as $k){ - foreach($varList as $v){ - $name = $v['name']; - $val = $v['value']; - $value = ($j==0)?"'".str_replace("'", "\'",$k->$name->$val)."'":floatval($k->$name->$val); - $data .=" data.setCell($i, $j, ".$value.");\n"; - $j++; - } - $i++; - $j=0; - } - - - //Getting options - $options['height'] = 400; - $options['width'] = 400; - for($z=$fieldCounter; $z < count($names); $z++){ - $pair = explode("=", $names[$z]); - $key = trim($pair[0], "\" '"); - $value = trim($pair[1], "\" '"); - $options[$key] = $value; - } - - $divId = uniqid("linechart_div"); - $pre = "<div id='".$divId."'></div><script type='text/javascript' src='https://www.google.com/jsapi'></script> - <script type='text/javascript'> - var options_$divId = ".json_encode($options)."; - google.load('visualization', '1', {packages:['corechart']}); - google.setOnLoadCallback(drawChart); - function drawChart() { - var data = new google.visualization.DataTable(); - data.addRows(".$i.");\n -".$data." var barchart = new google.visualization.LineChart(document.getElementById('".$divId."')); -barchart.draw(data, options_$divId); - } - </script>"; - return $pre; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Googlevizpiechart.php b/lib/Haanga/lib/Haanga/Extension/Filter/Googlevizpiechart.php deleted file mode 100644 index 188a5c0f231f224c5c33bdb623dc4fafbdcf33dc..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Googlevizpiechart.php +++ /dev/null @@ -1,76 +0,0 @@ -<?php - -class Haanga_Extension_Filter_GoogleVizPieChart{ - public $is_safe = TRUE; - static function main($obj, $varname){ - $data = ""; - $i = 0; - $j = 0; - $options = array(); - $randId = rand(); - $firstColumn = true; - $names = explode(",", $varname); - $w = "400"; - $h = "400"; - - $options['width'] = $w; - $options['height'] = $h; - - $fieldCounter=0; - $varList = array(); - foreach($names as $v){ - if(strpos($v,"=")){ - break; - } - $variable['name'] = $v; - $variable['value'] = 'value'; - if(strpos($v, ".")){ - $aux = explode(".", $v); - $variable['name'] = $aux[0]; - $variable['value'] = $aux[1]; - } - $fieldCounter++; - $columnType = 'number'; - if($firstColumn){ - $columnType = 'string'; - $firstColumn = false; - } - array_push($varList, $variable); - $data .= " data.addColumn('".$columnType."', '".$variable['name']."');\n"; - } - - foreach($obj as $k){ - foreach($varList as $v){ - $name = $v['name']; - $val = $v['value']; - $value = ($j==0)?"'".str_replace("'", "\'",$k->$name->$val)."'":floatval($k->$name->$val); - $data .=" data.setCell($i, $j, ".$value.");\n"; - $j++; - } - $i++; - $j=0; - } - - //Getting options - for($j=2; $j < count($names); $j++){ - $pair = explode("=", $names[$j]); - $key = trim($pair[0], "\" '"); - $value = trim($pair[1], "\" '"); - $options[$key] = $value; - } - - $pre = "<div id='piechart_div_".$randId."'></div><script type='text/javascript' src='https://www.google.com/jsapi'></script> - <script type='text/javascript'> - var options_$randId = ".json_encode($options)."; - google.load('visualization', '1', {packages:['corechart']}); - google.setOnLoadCallback(drawChart_".$randId."); - function drawChart_".$randId."() { - var data = new google.visualization.DataTable(); - data.addRows(".$i.");\n - ".$data." var piechart = new google.visualization.PieChart(document.getElementById('piechart_div_".$randId."')); - piechart.draw(data, options_$randId); - } - </script>"; - return $pre; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Googlevizscatterchart.php b/lib/Haanga/lib/Haanga/Extension/Filter/Googlevizscatterchart.php deleted file mode 100644 index 9cac73c1d918ab2cf9893beb32b8a324366977f4..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Googlevizscatterchart.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php - -class Haanga_Extension_Filter_GoogleVizScatterChart{ - public $is_safe = TRUE; - static function main($obj, $varname){ - $data = ""; - $i = 0; - $j = 0; - $firstColumn = true; - $options = array(); - $names = explode(",", $varname); - - $fieldCounter=0; - $varList = array(); - foreach($names as $v){ - if(strpos($v,"=")){ - break; - } - $variable['name'] = $v; - $variable['value'] = 'value'; - if(strpos($v, ".")){ - $aux = explode(".", $v); - $variable['name'] = $aux[0]; - $variable['value'] = $aux[1]; - } - $fieldCounter++; - $columnType = 'number'; - array_push($varList, $variable); - $data .= " data.addColumn('".$columnType."', '".$variable['name']."');\n"; - } - - foreach($obj as $k){ - foreach($varList as $v){ - $name = $v['name']; - $val = $v['value']; - $value = $k->$name->$val; - $data .=" data.setCell($i, $j, ".$value.");\n"; - $j++; - } - $i++; - $j=0; - } - - - //Getting options - $options['height'] = 400; - $options['width'] = 400; - for($z=$fieldCounter; $z < count($names); $z++){ - $pair = explode("=", $names[$z]); - $key = trim($pair[0], "\" '"); - $value = trim($pair[1], "\" '"); - $options[$key] = $value; - } - - $divId = uniqid("scatterchart_div"); - $pre = "<div id='".$divId."'></div><script type='text/javascript' src='https://www.google.com/jsapi'></script> - <script type='text/javascript'> - var options_$divId = ".json_encode($options)."; - google.load('visualization', '1', {packages:['corechart']}); - google.setOnLoadCallback(drawChart); - function drawChart() { - var data = new google.visualization.DataTable(); - data.addRows(".$i.");\n -".$data." var barchart = new google.visualization.ScatterChart(document.getElementById('".$divId."')); -barchart.draw(data, options_$divId); - } - </script>"; - return $pre; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Googleviztable.php b/lib/Haanga/lib/Haanga/Extension/Filter/Googleviztable.php deleted file mode 100644 index 61f19ab2faa53e70755f9644cbf6013244b97c5b..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Googleviztable.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php - -class Haanga_Extension_Filter_GoogleVizTable{ - public $is_safe = TRUE; - static function main($obj, $varname){ - $data = ""; - $i = 0; - $j = 0; - $randId = rand(); - $names = explode(",", $varname); - $varList = array(); - foreach($names as $v){ - $variable['name'] = $v; - $variable['value'] = 'value'; - if(strpos($v, ".")){ - $aux = explode(".", $v); - $variable['name'] = $aux[0]; - $variable['value'] = $aux[1]; - } - array_push($varList, $variable); - $data .= " data.addColumn('string', '".$variable['name']."');\n"; - } - - - foreach($obj as $k){ - foreach($varList as $v){ - $name = $v['name']; - $val = $v['value']; - $data .=" data.setCell($i, $j, '".str_replace("'", "\'",$k->$name->$val)."');\n"; - $j++; - } - $i++; - $j=0; - } - - $pre = "<div id='table_div_".$randId."'></div><script type='text/javascript' src='https://www.google.com/jsapi'></script> - <script type='text/javascript'> - google.load('visualization', '1', {packages:['table']}); - google.setOnLoadCallback(drawTable); - function drawTable() { - var data = new google.visualization.DataTable(); - data.addRows(".$i.");\n -".$data." var table = new google.visualization.Table(document.getElementById('table_div_".$randId."')); -table.draw(data, {showRowNumber: true, width: '80%'}); - } - </script>"; - return $pre; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Hostname.php b/lib/Haanga/lib/Haanga/Extension/Filter/Hostname.php deleted file mode 100644 index f58d0c0129d0539bda3c37538d34b380446746b1..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Hostname.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Hostname -{ - static function generator($cmp, $args) - { - return hexec('parse_url', $args[0], hconst('PHP_URL_HOST')); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Intval.php b/lib/Haanga/lib/Haanga/Extension/Filter/Intval.php deleted file mode 100644 index e74d065b748b389791ef018685d042887ff7e412..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Intval.php +++ /dev/null @@ -1,7 +0,0 @@ -<?php - -class Haanga_Extension_Filter_intval -{ - public $php_alias = 'intval'; -} - diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Isarray.php b/lib/Haanga/lib/Haanga/Extension/Filter/Isarray.php deleted file mode 100644 index 9bf113780f40706f5ca8a6f0e5132b9d8deaeca4..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Isarray.php +++ /dev/null @@ -1,7 +0,0 @@ -<?php - -class Haanga_Extension_Filter_IsArray -{ - public $php_alias = "is_array"; - public $is_safe = TRUE; /* boolean if safe */ -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Join.php b/lib/Haanga/lib/Haanga/Extension/Filter/Join.php deleted file mode 100644 index ac0b430b574775dbd3898e76f1875fd7b2cfc80c..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Join.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Join -{ - public static function generator($compiler, $args) - { - if (count($args) == 1) { - $args[1] = ""; - } - return hexec("implode", $args[1], $args[0]); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Json.php b/lib/Haanga/lib/Haanga/Extension/Filter/Json.php deleted file mode 100644 index 3ef6caf866ce20d19e470da371ee36ceead3b30e..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Json.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Json -{ - public $php_alias = "json_encode"; -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Leafletmaps.php b/lib/Haanga/lib/Haanga/Extension/Filter/Leafletmaps.php deleted file mode 100644 index 5b48ede6c62f3bc6ead566f21add71634b522e9f..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Leafletmaps.php +++ /dev/null @@ -1,91 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Leafletmaps{ - public $is_safe = TRUE; - static function main($obj, $varname){ - $data = ""; - $i = 0; - $j = 0; - $randId = rand(); - $firstColumn = true; - $names = explode(",", $varname); - $north = -90; $south=90; $east=-180; $west = 180; - $latArr =""; $longArr=""; $nameArr = ""; - $options = array(); - $options['width'] = 500; - $options['height'] = 500; - $options['zoom'] = 10; - for($z=3; $z < count($names); $z++){ - $pair = explode("=", $names[$z]); - $key = trim($pair[0], "\" '"); - $value = trim($pair[1], "\" '"); - $options[$key] = $value; - } - $w = $options['width']; - $h = $options['height']; - $z = intval($options['zoom']); - - $points = array(); - foreach($obj as $k){ - $currentPoint = array(); - if($north < $k->$names[0]->value){ - $north = $k->$names[0]->value; - } - $currentPoint['lat'] = $k->$names[0]->value; - if($south > $k->$names[0]->value){ - $south = $k->$names[0]->value; - } - - if($west > $k->$names[1]->value){ - $west = $k->$names[1]->value; - } - if($east < $k->$names[1]->value){ - $east = $k->$names[1]->value; - } - $currentPoint['long'] = $k->$names[1]->value; - - $currentPoint['label'] = $k->$names[2]->value; - $firstColumn = false; - array_push($points, $currentPoint); - } - - $centerLat = ($south+$north)/2; - $centerLon = ($east+$west)/2; - $pre = "<div id='map_$randId' style='height: 580px;'></div> - <script src='http://cdn.leafletjs.com/leaflet-0.4/leaflet.js'></script> - <script type='text/javascript'> - //<![CDATA[ - - function loadCssFile() { - var fileref=document.createElement('link'); - fileref.setAttribute('rel', 'stylesheet'); - fileref.setAttribute('type', 'text/css'); - fileref.setAttribute('href', 'http://cdn.leafletjs.com/leaflet-0.4/leaflet.css'); - document.getElementsByTagName('head')[0].appendChild(fileref); - } - - - function initialize_$randId() { - var locations = ".json_encode($points)."; - var mapOptions = ".json_encode($options)."; - mapOptions.attribution = osmAttrib; - - map = new L.Map('map_$randId'); - var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; - var osmAttrib='Map data © <a href=\"http://openstreetmap.org\">OpenStreetMap</a> contributors'; - var osm = new L.TileLayer(osmUrl, mapOptions ); - map.setView([$centerLat, $centerLon],mapOptions.zoom); - map.addLayer(osm); - - for(var i=0;i<locations.length;i++){ - L.marker([locations[i].lat, locations[i].long]).addTo(map).bindPopup(locations[i].label) - } - } - -// loadCssFile(); - initialize_$randId(); - //]]> - </script>"; - return $pre; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Length.php b/lib/Haanga/lib/Haanga/Extension/Filter/Length.php deleted file mode 100644 index 952f377c66ac47f9d330b95cdb92584421c00171..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Length.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Length -{ - public $is_safe = TRUE; /* a number if safe */ - static function generator($compiler, $args) - { - $count = hexec('count', $args[0]); - $strlen = hexec('strlen', $args[0]); - $vars = hexec('count', hexec('get_object_vars', $args[0])); - $guess = hexpr_cond(hexec('is_array', $args[0]), hexec('count', $args[0]), - hexec('strlen', $args[0])); - - if (Haanga_AST::is_var($args[0])) { - /* if it is a variable, best effort to detect - its type at compile time */ - $value = $compiler->get_context($args[0]['var']); - if (is_array($value)) { - return $count; - } else if (is_string($value)) { - return $strlen; - } else if (is_object($value)) { - return $vars; - } else { - return $gess; - } - } - - if (Haanga_AST::is_str($args[0])) { - return $strlen; - } - - return $guess; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Linebreaksbr.php b/lib/Haanga/lib/Haanga/Extension/Filter/Linebreaksbr.php deleted file mode 100644 index 7be1e83f1a1fa563c93fd4e035ff48ebeb797ac0..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Linebreaksbr.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Linebreaksbr -{ - static function generator($compiler, $args) - { - $compiler->var_is_safe = TRUE; /* we assume that if you use |linebreaksbr, you also want |safe */ - return hexec('preg_replace', "/\r\n|\r|\n/", "<br />\n", $args[0]); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Lower.php b/lib/Haanga/lib/Haanga/Extension/Filter/Lower.php deleted file mode 100644 index d9e8341cf8b12a3abebc08aee99182fed44c9e5f..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Lower.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Lower -{ - public $php_alias = "strtolower"; -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Null.php b/lib/Haanga/lib/Haanga/Extension/Filter/Null.php deleted file mode 100644 index ebf3fdfb7cd81a399750e205856dba352d4de526..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Null.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Null -{ - public $php_alias = 'is_null'; -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Pluralize.php b/lib/Haanga/lib/Haanga/Extension/Filter/Pluralize.php deleted file mode 100644 index af79623f5ebd93274ab1ea8364a0cccb9daf172a..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Pluralize.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Pluralize -{ - static function generator($compiler, $args) - { - if (count($args) > 1) { - if (!Haanga_AST::is_str($args[1])) { - $compiler->Error("pluralize: First parameter must be an string"); - } - $parts = explode(",", $args[1]['string']); - $singular = ""; - if (count($parts) == 1) { - $plural = $parts[0]; - } else { - $singular = $parts[0]; - $plural = $parts[1]; - } - } else { - $singular = ""; - $plural = "s"; - } - - return hexpr_cond(hexpr($args[0], '<=', 1), $singular, $plural); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Pop.php b/lib/Haanga/lib/Haanga/Extension/Filter/Pop.php deleted file mode 100644 index 5d3914a415d0ed10eded2a564030ccb15d786581..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Pop.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Pop -{ - static function generator($compiler, $args) - { - if (count($args) != 1) { - $compiler->Error("Pop only needs two parameter"); - } - - return hexec('array_pop', $args[0]); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Raphaeltimeline.php b/lib/Haanga/lib/Haanga/Extension/Filter/Raphaeltimeline.php deleted file mode 100644 index c8c9f5586b5085687aaff4c8e53eeda51df1bce4..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Raphaeltimeline.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php - -class Haanga_Extension_Filter_RaphaelTimeline{ - public $is_safe = TRUE; - static function main($obj, $varname){ - $data = ""; - $i = 0; - $j = 0; - $firstColumn = true; - $options = array(); - $names = explode(",", $varname); - - $fieldCounter=0; - $varList = array(); - foreach($names as $v){ - if(strpos($v,"=")){ - break; - } - - $columnType = 'number'; - - if($firstColumn){ - $columnType = 'date'; - $firstColumn = false; - }elseif(($fieldCounter - 2) %3 == 0 || ($fieldCounter - 3) %3 == 0){ - $columnType = 'string'; - } - array_push($varList, $v); - $data .= " data.addColumn('".$columnType."', '".$v."');\n"; - $fieldCounter++; - } - - foreach($obj as $k){ - $j=0; - foreach($varList as $v){ - $value = $k->$v->value; - if($j==0){ - $value = "new Date(".date("Y, m, d", strtotime($k->$v->value)).")"; - }elseif(($j - 2) %3 == 0 || ($j - 3) %3 == 0){ - $value = "'".$k->$v->value."'"; - } - $data .=" data.setCell($i, $j, ".$value.");\n"; - $j++; - } - $i++; - } - - - //Getting options - $options['height'] = 400; - $options['width'] = 400; - $options['displayAnnotations'] = 'true'; - for($z=$fieldCounter; $z < count($names); $z++){ - $pair = explode("=", $names[$z]); - $key = trim($pair[0], "\" '"); - $value = trim($pair[1], "\" '"); - $options[$key] = $value; - } - - $divId = uniqid("timeline_div"); - $pre = "<div id='".$divId."' style='width: 700px; height: 240px;'></div><script type='text/javascript' src='https://www.google.com/jsapi'></script> - <script type='text/javascript'> - var options_$divId = ".json_encode($options)."; - google.load('visualization', '1', {packages:['annotatedtimeline']}); - google.setOnLoadCallback(drawChart); - function drawChart() { - var data = new google.visualization.DataTable(); - data.addRows(".$i.");\n -".$data." var timeline = new google.visualization.AnnotatedTimeLine(document.getElementById('".$divId."')); -timeline.draw(data, options_$divId); - } - </script>"; - return $pre; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Reverse.php b/lib/Haanga/lib/Haanga/Extension/Filter/Reverse.php deleted file mode 100644 index 836dd0f804cbff99e89d3b17c82c37a838d3524e..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Reverse.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Reverse -{ - static function generator($compiler, $args) - { - if (count($args) != 1) { - $compiler->Error("Reverse only needs one parameter"); - } - - return hexec('array_reverse', $args[0], TRUE); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Safe.php b/lib/Haanga/lib/Haanga/Extension/Filter/Safe.php deleted file mode 100644 index eef6ca166beeb04bf68d371a285678f250c8e254..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Safe.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Safe -{ - static function generator($compiler, $args) - { - $compiler->var_is_safe = TRUE; - return current($args); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Slugify.php b/lib/Haanga/lib/Haanga/Extension/Filter/Slugify.php deleted file mode 100644 index 8e4418ed4e5cc2c695b4b6da1fff4f1161a36718..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Slugify.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Slugify -{ - static function generator($compiler, $args) - { - if (count($args) != 1) { - $compiler->Error("slugify filter only needs one parameter"); - } - - $arg = hexec('strtolower', $args[0]); - $arg = hexec('str_replace'," ","-",$arg); - $arg = hexec('preg_replace',"/[^\d\w-_]/",'',$arg); - return $arg; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Stringformat.php b/lib/Haanga/lib/Haanga/Extension/Filter/Stringformat.php deleted file mode 100644 index 271bb2dac35b01cee8feb9ed1079c400fe092c62..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Stringformat.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -class Haanga_Extension_Filter_StringFormat -{ - static function generator($compiler, $args) - { - return hexec('sprintf', $args[1], $args[0]); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Striptags.php b/lib/Haanga/lib/Haanga/Extension/Filter/Striptags.php deleted file mode 100644 index c454d37f2d3f1d10452209e7d073f9b3b9add8c4..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Striptags.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Striptags -{ - static function main($text) - { - return strip_tags(html_entity_decode($text,ENT_QUOTES,"UTF-8")); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Strlen.php b/lib/Haanga/lib/Haanga/Extension/Filter/Strlen.php deleted file mode 100644 index be69ca6b242e2397a4de876554fb5421e1b9e85e..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Strlen.php +++ /dev/null @@ -1,7 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Length -{ - public $php_alias = "strlen"; - public $is_safe = TRUE; /* a number if safe */ -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Substr.php b/lib/Haanga/lib/Haanga/Extension/Filter/Substr.php deleted file mode 100644 index 35b393a001e150976b81f18d16594e1a9d26a103..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Substr.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Substr -{ - public static function generator($cmp, $args) - { - if (count($args) != 2) { - $cmp->Error("substr parameter must have one param"); - } - if (!isset($args[1]['string'])) { - $cmp->Error("substr parameter must be a string"); - } - list($start, $end) = explode(",", $args[1]['string']); - return hexec('substr', $args[0], (int)$start, (int)$end); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Timeknot.php b/lib/Haanga/lib/Haanga/Extension/Filter/Timeknot.php deleted file mode 100644 index 2a1b18f0700d93e3a9022cdaf35b9a0a8ca92b9f..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Timeknot.php +++ /dev/null @@ -1,84 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Timeknot{ - public $is_safe = TRUE; - static function main($obj, $varname){ - global $lodspk; - $data = array(); - $i = 0; - $j = 0; - $firstColumn = true; - $options = array(); - $names = explode(",", $varname); - - $fieldCounter=0; - $varList = array(); - foreach($names as $v){ - if(strpos($v,"=")){ - break; - } - $variable['name'] = $v; - $variable['value'] = 'value'; - if(strpos($v, ".")){ - $aux = explode(".", $v); - $variable['name'] = $aux[0]; - $variable['value'] = $aux[1]; - } - switch ($fieldCounter){ - case 0: - $variable['key'] = 'date'; - break; - case 1: - $variable['key'] = 'name'; - break; - case 2: - $variable['key'] = 'img'; - break; - case 3: - $variable['key'] = 'series'; - break; - } - $fieldCounter++; - array_push($varList, $variable); - } - - $options = array(); - - foreach($obj as $k){ - $knot = array(); - foreach($varList as $v){ - $name = $v['name']; - $val = $v['value']; - $key = $v['key']; - $value = $k->$name->$val; - $knot[$key] = $value; - } - array_push($data, $knot); - } - - - //Getting options - for($z=$fieldCounter; $z < count($names); $z++){ - $pair = explode("=", $names[$z]); - $key = trim($pair[0], "\" '"); - $value = trim($pair[1], "\" '"); - if(strcasecmp($value, 'true') == 0){ - $options[$key] = TRUE; - }elseif(strcasecmp($value, 'false') == 0){ - $options[$key] = FALSE; - }else{ - $options[$key] = $value; - } - } - - $divId = uniqid("timeknot_div"); - $pre = "<div id='".$divId."'></div> -<script type='text/javascript' src='".$lodspk['home']."vendor/timeknots/src/d3.v2.min.js'></script> -<script type='text/javascript' src='".$lodspk['home']."vendor/timeknots/src/timeknots-min.js'></script> -<script type='text/javascript'> - - TimeKnots.draw(\"#$divId\", ".json_encode($data).", ".json_encode($options)."); - </script>"; - return $pre; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Title.php b/lib/Haanga/lib/Haanga/Extension/Filter/Title.php deleted file mode 100644 index a68251b69528198df618ee98b2bf2bd590174406..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Title.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Title -{ - static function generator($compiler, $args) - { - if (count($args) != 1) { - $compiler->Error("title filter only needs one parameter"); - } - - return hexec('ucwords', hexec('strtolower', $args[0])); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Trans.php b/lib/Haanga/lib/Haanga/Extension/Filter/Trans.php deleted file mode 100644 index b077e0d2e58d3d12ffd14f2b936956b271ed5902..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Trans.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Trans -{ - public $php_alias = '_'; -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Translation.php b/lib/Haanga/lib/Haanga/Extension/Filter/Translation.php deleted file mode 100644 index eb53696bb95e1474e40eed23a168758dd4445922..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Translation.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Translation extends Haanga_Extension_Filter_Trans -{ -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Trim.php b/lib/Haanga/lib/Haanga/Extension/Filter/Trim.php deleted file mode 100644 index d4f397f20acf867ecb51e76e14d8915e35a2917f..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Trim.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Trim -{ - public $php_alias = "trim"; -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Truncatechars.php b/lib/Haanga/lib/Haanga/Extension/Filter/Truncatechars.php deleted file mode 100644 index 2f1f228df6a6a90cd81d8bf1b2b8a187fabd0582..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Truncatechars.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Truncatechars -{ - static function main($text, $limit) - { - if(strlen($text) <= $limit) - return $text; - $trunctext = substr($text, 0, $limit); - $trunctext[$limit-3] = '.'; - $trunctext[$limit-2] = '.'; - $trunctext[$limit-1] = '.'; - return $trunctext; - } -} - diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Truncatewords.php b/lib/Haanga/lib/Haanga/Extension/Filter/Truncatewords.php deleted file mode 100644 index e74edffa0865ce19130303b3c86b4a1e38f1b4cd..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Truncatewords.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Truncatewords -{ - static function main($text, $limit) - { - $words = explode(" ", $text,$limit+1); - if (count($words) >= $limit+1) { - $words[$limit] = '...'; - } - return implode(" ", $words); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Upper.php b/lib/Haanga/lib/Haanga/Extension/Filter/Upper.php deleted file mode 100644 index f02557d60b3fbe08d635ee55c7173501a670f19a..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Upper.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Upper -{ - public $php_alias = "strtoupper"; -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Urifier.php b/lib/Haanga/lib/Haanga/Extension/Filter/Urifier.php deleted file mode 100644 index b917b9a4b6031c283d897bef17d03ead3030586a..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Urifier.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Urifier -{ - static function main($uri) - { - $newUri = preg_replace('/^http:\/\//', 'http/', $uri); - $newUri = preg_replace('/#/', '__hash__', $newUri); - $newUri = preg_replace('/\?/', '__qmark__', $newUri); - return $newUri; - } -} - - diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Urifragment.php b/lib/Haanga/lib/Haanga/Extension/Filter/Urifragment.php deleted file mode 100644 index d84b3f152cbfc1cff040ccdc6fcaca9f65800c82..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Urifragment.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Urifragment -{ - static function generator($cmp, $args) - { - return hexec('parse_url', $args[0], hconst('PHP_URL_FRAGMENT')); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Uripath.php b/lib/Haanga/lib/Haanga/Extension/Filter/Uripath.php deleted file mode 100644 index 1de855ab2bc46ae82f823d72f14c89826de9c9f3..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Uripath.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Uripath -{ - static function generator($cmp, $args) - { - return hexec('parse_url', $args[0], hconst('PHP_URL_PATH')); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Urischeme.php b/lib/Haanga/lib/Haanga/Extension/Filter/Urischeme.php deleted file mode 100644 index 2fc5457f344c1fd4d065de4a9d183989af397c43..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Urischeme.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Urischeme -{ - static function generator($cmp, $args) - { - return hexec('parse_url', $args[0], hconst('PHP_URL_SCHEME')); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Urldecode.php b/lib/Haanga/lib/Haanga/Extension/Filter/Urldecode.php deleted file mode 100644 index b0b213385a31a722cba962c72c1d6808447ee456..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Urldecode.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -class Haanga_Extension_Filter_UrlDecode -{ - - public static function generator($cmp, $args) - { - $cmp->var_is_safe = TRUE; - return hexec('urldecode', $args[0]); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/Urlencode.php b/lib/Haanga/lib/Haanga/Extension/Filter/Urlencode.php deleted file mode 100644 index 4c2cc94d0b6eca193271996226c2a3151e27d55a..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/Urlencode.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -class Haanga_Extension_Filter_UrlEncode -{ - - public static function generator($cmp, $args) - { - $cmp->var_is_safe = TRUE; - return hexec('urlencode', $args[0]); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/gRaphaelBarChart.php b/lib/Haanga/lib/Haanga/Extension/Filter/gRaphaelBarChart.php deleted file mode 100644 index 1f2d29ee1e9d3546bdc005a3693c4556d6ceba4f..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/gRaphaelBarChart.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php - -class Haanga_Extension_Filter_gRaphaelBarChart{ - public $is_safe = TRUE; - static function main($obj, $varname){ - global $conf; - $data = ""; - $i = 0; - $j = 0; - $firstColumn = true; - $names = explode(",", $varname); - $labels = "["; - $data = "[["; - $firstLabel = true; - - foreach($obj as $k){ - if(!$firstLabel){ - $labels .= ','; - $data .= ','; - } - $firstLabel = false; - $labels .='"'.$k->$names[0]->value.'"'; - $data .='"'.$k->$names[1]->value.'"'; - } - $labels .= "]"; - $data .= "]]"; - - $pre = '<div id="raphaelholder"></div><script src="'.$conf['basedir'].'js/raphael/raphael.js"></script> - <script src="'.$conf['basedir'].'js/raphael/g.raphael.js"></script> - <script src="'.$conf['basedir'].'js/raphael/g.bar.js"></script> - <script type="text/javascript"> - window.onload = function () { - var r = Raphael("raphaelholder"), - fin = function () { - this.flag = r.popup(this.bar.x, this.bar.y, this.bar.value || "0").insertBefore(this); - }, - fout = function () { - this.flag.animate({opacity: 0}, 300, function () {this.remove();}); - }, - fin2 = function () { - var y = [], res = []; - for (var i = this.bars.length; i--;) { - y.push(this.bars[i].y); - res.push(this.bars[i].value || "0"); - } - this.flag = r.popup(this.bars[0].x, Math.min.apply(Math, y), res.join(", ")).insertBefore(this); - }, - fout2 = function () { - this.flag.animate({opacity: 0}, 300, function () {this.remove();}); - }, - txtattr = { font: "12px sans-serif" }; - var data = '.$data.'; - var labels = '.$labels.'; - r.barchart(10, 10, 320, 220, data).hover(fin, fout); - console.log(r);//.axis(20, 140, 620, 10, 580, labels.length, 0, labels, "+", 5); - } - </script>'; - return $pre; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Filter/old-Length.php b/lib/Haanga/lib/Haanga/Extension/Filter/old-Length.php deleted file mode 100644 index d0fb526222eff1a0a67b739bfb575686a093a222..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Filter/old-Length.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php - -class Haanga_Extension_Filter_Length -{ - public $is_safe = TRUE; /* a number if safe */ - static function generator($compiler, $args) - { - $count = hexec('count', $args[0]); - $strlen = hexec('strlen', $args[0]); - $guess = hexpr_cond(hexec('is_array', $args[0]), hexec('count', $args[0]), - hexec('strlen', $args[0])); - - if (Haanga_AST::is_var($args[0])) { - /* if it is a variable, best effort to detect - its type at compile time */ - $value = $compiler->get_context($args[0]['var']); - if (is_array($value)) { - return $count; - } else if (is_string($value)) { - return $strlen; - } else { - return $guess; - } - } - - if (Haanga_AST::is_str($args[0])) { - return $strlen; - } - - return $guess; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Tag.php b/lib/Haanga/lib/Haanga/Extension/Tag.php deleted file mode 100644 index 4b344fb7b7ae2dd305870085829184ad05fd485d..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Tag.php +++ /dev/null @@ -1,93 +0,0 @@ -<?php -/* - +---------------------------------------------------------------------------------+ - | Copyright (c) 2010 César Rodas and Menéame Comunicacions S.L. | - +---------------------------------------------------------------------------------+ - | Redistribution and use in source and binary forms, with or without | - | modification, are permitted provided that the following conditions are met: | - | 1. Redistributions of source code must retain the above copyright | - | notice, this list of conditions and the following disclaimer. | - | | - | 2. Redistributions in binary form must reproduce the above copyright | - | notice, this list of conditions and the following disclaimer in the | - | documentation and/or other materials provided with the distribution. | - | | - | 3. All advertising materials mentioning features or use of this software | - | must display the following acknowledgement: | - | This product includes software developed by César D. Rodas. | - | | - | 4. Neither the name of the César D. Rodas nor the | - | names of its contributors may be used to endorse or promote products | - | derived from this software without specific prior written permission. | - | | - | THIS SOFTWARE IS PROVIDED BY CÉSAR D. RODAS ''AS IS'' AND ANY | - | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | - | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | - | DISCLAIMED. IN NO EVENT SHALL CÉSAR D. RODAS BE LIABLE FOR ANY | - | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | - | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | - | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | - | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | - | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | - | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE | - +---------------------------------------------------------------------------------+ - | Authors: César Rodas <crodas@php.net> | - +---------------------------------------------------------------------------------+ -*/ - - -class Haanga_Extension_Tag extends Haanga_Extension -{ - /** - * isValid - * - * Check if the current $tag (string) is registered as a custom - * tag, if so, it check wether it is just a custom tag or a custom block. - * - * This method is called from the lexer for each alpha (within {% %}), - * to avoid parsing conflicts. - * - * @param string $tag Tag to check - * - * @return int|bool HG_Parser::T_CUSTOM_TAG, HG_Parser::T_CUSTOM_TAG or FALSE - */ - final function isValid($tag) - { - static $cache = array(); - $tag = strtolower($tag); - - if (!isset($cache[$tag])) { - $class_name = $this->getClassName($tag); - if (class_exists($class_name)) { - $properties = get_class_vars($class_name); - $is_block = FALSE; - if (isset($properties['is_block'])) { - $is_block = (bool)$properties['is_block']; - } - $cache[$tag] = $is_block ? HG_Parser::T_CUSTOM_BLOCK : HG_Parser::T_CUSTOM_TAG; - } - if (!isset($cache[$tag])) { - $cache[$tag] = FALSE; - } - } - - return $cache[$tag]; - } - - final function getClassName($tag) - { - $tag = str_replace("_", "", ucfirst($tag)); - return "Haanga_Extension_Tag_{$tag}"; - } - - -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/lib/Haanga/lib/Haanga/Extension/Tag/Buffer.php b/lib/Haanga/lib/Haanga/Extension/Tag/Buffer.php deleted file mode 100644 index e89817cc2fe0b4c50d359cc0ae11c27b0bbb9343..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Tag/Buffer.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -class Haanga_Extension_Tag_Buffer -{ - public $is_block = TRUE; - - static function generator($cmp, $args, $redirected) - { - if (count($args) != 2) { - $cmp->Error("buffer filter must have one parameter"); - } - - /* get new code object */ - $code = hcode(); - /* redirect buffer to $args[1] */ - $code->decl($args[1], $args[0]); - /* telling to Haanga that we're handling the output */ - $code->doesPrint = TRUE; - - /* $args[1] is already safe (it might have HTML) */ - $cmp->set_safe($args[1]['var']); - - return $code; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Tag/Currenttime.php b/lib/Haanga/lib/Haanga/Extension/Tag/Currenttime.php deleted file mode 100644 index c1233c02d5e85e5838a3d9d686853aa169267762..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Tag/Currenttime.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php - -class Haanga_Extension_Tag_CurrentTime -{ - public static $is_block = FALSE; - /* This tag calls to a PHP native function */ - public static $php_alias = "date"; -} diff --git a/lib/Haanga/lib/Haanga/Extension/Tag/Cycle.php b/lib/Haanga/lib/Haanga/Extension/Tag/Cycle.php deleted file mode 100644 index 6cff3105ef580363b8f6da93e08e6066ad37085b..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Tag/Cycle.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php - -class Haanga_Extension_Tag_Cycle -{ - public $is_block = FALSE; - - static function generator($cmp, $args, $declared) - { - static $cycle = 0; - if (!isset($cmp->cycle)) { - $cmp->cycle = array(); - } - - $code = hcode(); - - $index = 'index_'.$cycle; - $def = 'def_cycle_'.$cycle; - - if (count($args) == 1 && Haanga_AST::is_var($args[0]) && isset($cmp->cycle[$args[0]['var']])) { - $id = $cmp->cycle[$args[0]['var']]; - $index = 'index_'.$id; - $def = 'def_cycle_'.$id; - } else { - if (!$declared) { - $code->do_if(hexpr(hexec('isset', hvar($def)), '==', FALSE)); - } - $code->decl($def, $args); - if (!$declared) { - $code->do_endif(); - } - } - - /* isset($var) == FALSE */ - $expr = hexpr(hexec('isset', hvar($index)), '==', FALSE); - $inc = hexpr(hexpr(hexpr(hvar($index), '+', 1)), '%', hexec('count', hvar($def))); - - - if (!$declared) { - if (isset($id)) { - $code->decl($index, $inc); - } else { - $code->decl($index, hexpr_cond($expr, 0, $inc)); - } - $code->end(); - $var = hvar($def, hvar($index)); - $cmp->do_print($code, $var); - } else { - $code->decl($index, -1); - $cmp->cycle[$declared] = $cycle; - } - - $cycle++; - - return $code; - - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Tag/Dictsort.php b/lib/Haanga/lib/Haanga/Extension/Tag/Dictsort.php deleted file mode 100644 index c558cc47255182a93f4055edb25761dd424372b6..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Tag/Dictsort.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -class Haanga_Extension_Tag_Dictsort -{ - - /** - * Sorted a nested array by '$sort_by' - * property on each sub-array. , if you want - * to see the original php file look filters/dictsort.php - */ - static function generator($cmp, $args, $redirected) - { - if (!$redirected) { - $cmp->Error("dictsort must be redirected to a variable using AS <varname>"); - } - if (count($args) != 2) { - $cmp->Error("Dictsort must have two params"); - } - - if (!Haanga_AST::is_var($args[0])) { - $cmp->Error("Dictsort: First parameter must be an array"); - } - - $var = $cmp->get_context($args[0]['var']); - $cmp->set_context($redirected, $var); - - $redirected = hvar($redirected); - $field = hvar('field'); - $key = hvar('key'); - - $code = hcode(); - $body = hcode(); - - $body->decl(hvar('field', $key), hvar('item', $args[1])); - - $code->decl($redirected, $args[0]); - $code->decl($field, array()); - $code->do_foreach($redirected, 'item', $key, $body); - $code->do_exec('array_multisort', $field, hconst('SORT_REGULAR'), $redirected); - - return $code; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Tag/Escape.php b/lib/Haanga/lib/Haanga/Extension/Tag/Escape.php deleted file mode 100644 index e4e4a0107114a8a25c7d6ab33abaa7fe5093fe4d..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Tag/Escape.php +++ /dev/null @@ -1,7 +0,0 @@ -<?php - -class Haanga_Extension_Tag_Escape -{ - public static $is_block = TRUE; - public $php_alias = "htmlspecialchars"; -} diff --git a/lib/Haanga/lib/Haanga/Extension/Tag/Exec.php b/lib/Haanga/lib/Haanga/Extension/Tag/Exec.php deleted file mode 100644 index 6fe85a2e14382f861ba149024a1223de3633749d..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Tag/Exec.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php - - -class Haanga_Extension_Tag_Exec -{ - public $is_block = FALSE; - - static function generator($cmp, $args, $assign=NULL) - { - if (!$cmp->getOption('allow_exec')) { - $cmp->Error("Tag exec is disabled for security reasons"); - } - - - $code = hcode(); - if (Haanga_AST::is_var($args[0])) { - $args[0] = $args[0]['var']; - } else if (Haanga_AST::is_str($args[0])) { - $args[0] = $args[0]['string']; - } else { - $cmp->Error("invalid param"); - } - - // fix for static calls {{{ - if (is_array($args[0])) { - $end = end($args[0]); - if (isset($end['class'])) { - $args[0][ key($args[0]) ]['class'] = substr($end['class'], 1); - } - } - // }}} - - $exec = hexec($args[0]); - for ($i=1; $i < count($args); $i++) { - $exec->param($args[$i]); - } - $exec->end(); - if ($assign) { - $code->decl($assign, $exec); - - // make it global - $code->decl($cmp->getScopeVariable($assign), hvar($assign)); - } else { - $cmp->do_print($code, $exec); - } - return $code; - } -} - diff --git a/lib/Haanga/lib/Haanga/Extension/Tag/Firstof.php b/lib/Haanga/lib/Haanga/Extension/Tag/Firstof.php deleted file mode 100644 index a47e37cd9428f43aea12c7dcbd4413347a98d8e8..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Tag/Firstof.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -class Haanga_Extension_Tag_FirstOf -{ - /** - * firstof tag - * - */ - static function generator($cmp, $args) - { - $count = count($args); - $args = array_reverse($args); - for ($i=0; $i < $count; $i++) { - if (isset($expr) && Haanga_AST::is_var($args[$i])) { - $expr = hexpr_cond(hexpr(hexec('empty', $args[$i]),'==', FALSE), $args[$i], $expr); - } else { - $expr = $args[$i]; - } - } - return $expr; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Tag/Inline.php b/lib/Haanga/lib/Haanga/Extension/Tag/Inline.php deleted file mode 100644 index aeb593e95a43252961aa219850120be6850b8b64..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Tag/Inline.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php - -class Haanga_Extension_Tag_Inline -{ - public static function generator($cmp, $args, $redirected) - { - if (count($args) != 1) { - $cmp->Error("inline needs one argument"); - } - - if ($redirected) { - $cmp->Error("inline can't be redirected to one variable"); - } - - if (!Haanga_AST::is_str($args[0])) { - $cmp->Error("The argument to inline must be an string"); - } - $file = $args[0]['string']; - - if (class_exists('Haanga')) { - $file = Haanga::getTemplatePath($file); - } - - if (!is_file($file)) { - $cmp->Error("{$file} is not a template"); - } - - return $cmp->getOpCodes(file_get_contents($file), $file); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Tag/Lower.php b/lib/Haanga/lib/Haanga/Extension/Tag/Lower.php deleted file mode 100644 index 823ae9a71490a8df5bba1d705d52159e03295907..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Tag/Lower.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php - -class Haanga_Extension_Tag_Lower -{ - public static $is_block = TRUE; - /* This tag calls to a PHP native function */ - public static $php_alias = "strtolower"; -} diff --git a/lib/Haanga/lib/Haanga/Extension/Tag/Min.php b/lib/Haanga/lib/Haanga/Extension/Tag/Min.php deleted file mode 100644 index 1623f0ac8f43867bac55118caf058e03dd0bb306..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Tag/Min.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -class Haanga_Extension_Tag_Min -{ - public $php_alias = "min"; -} diff --git a/lib/Haanga/lib/Haanga/Extension/Tag/Setsafe.php b/lib/Haanga/lib/Haanga/Extension/Tag/Setsafe.php deleted file mode 100644 index 75d08c9f9c3121b99e7f8f343b04ee0e8619135e..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Tag/Setsafe.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php - -class Haanga_Extension_Tag_SetSafe -{ - public $is_block = FALSE; - - static function generator($cmp, $args) - { - foreach ($args as $arg) { - if (Haanga_AST::is_var($arg)) { - $cmp->set_safe($arg['var']); - } - } - - return hcode(); - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Tag/Spaceless.php b/lib/Haanga/lib/Haanga/Extension/Tag/Spaceless.php deleted file mode 100644 index 21a9f188615c4606f68286f21894b85bc2706b00..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Tag/Spaceless.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -/** - * Spaceless custom tag - * - * @author crodas - */ -class Haanga_Extension_Tag_Spaceless -{ - /* This tag is a block */ - public $is_block = TRUE; - - /** - * main() {{{ - * - * This static function contains the definition of spaceless - * tag, it is important not to refence to $compiler since it - * will copied and paste in the generated PHP code from the - * template as a static function. - * - * It is also important to put the start and the end of the - * static function in new lines. - * - * - static static function main($html) - { - $regex = array( - '/>[ \t\r\n]+</sU', - '/^[ \t\r\n]+</sU', - '/>[ \t\r\n]+$/sU', - ); - $replaces = array('><', '<', '>'); - $html = preg_replace($regex, $replaces, $html); - return $html; - } }}} */ - - /** - * spaceless now uses generated code instead of - * calling Spaceless_Tag::main() at everytime. - * - */ - static function generator($compiler, $args) - { - $regex = array('/>[ \t\r\n]+</sU','/^[ \t\r\n]+</sU','/>[ \t\r\n]+$/sU'); - $repl = array('><', '<', '>'); - - return hexec('preg_replace', $regex, $repl, $args[0]); - } - - -} diff --git a/lib/Haanga/lib/Haanga/Extension/Tag/Templatetag.php b/lib/Haanga/lib/Haanga/Extension/Tag/Templatetag.php deleted file mode 100644 index cd0ebbcbcd12916a2a44563fea7ca8cbff7d20c5..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Tag/Templatetag.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php - -class Haanga_Extension_Tag_Templatetag -{ - static function generator($compiler, $args) - { - if (count($args) != 1) { - $compiler->Error("templatetag only needs one parameter"); - } - - if (Haanga_AST::is_var($args[0])) { - $type = $args[0]['var']; - if (!is_string($type)) { - $compiler->Error("Invalid parameter"); - } - } else if (Haanga_AST::is_str($args[0])) { - $type = $args[0]['string']; - } - - switch ($type) - { - case 'openblock': - $str = '{%'; - break; - case 'closeblock': - $str = '%}'; - break; - case 'openbrace': - $str = '{'; - break; - case 'closebrace': - $str = '}'; - break; - case 'openvariable': - $str = '{{'; - break; - case 'closevariable': - $str = '}}'; - break; - case 'opencomment': - $str = '{#'; - break; - case 'closecomment': - $str = '#}'; - break; - default: - $compiler->Error("Invalid parameter"); - break; - } - - $code = hcode(); - $compiler->do_print($code, Haanga_AST::str($str)); - - return $code; - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Tag/Trans.php b/lib/Haanga/lib/Haanga/Extension/Tag/Trans.php deleted file mode 100644 index 8c8497f157a555c8ce1caba45bd4d0ca8bfdb0e7..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Tag/Trans.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php - -class Haanga_Extension_Tag_Trans -{ - public $is_block = FALSE; - - static function generator($cmp, $args, $redirect) - { - $code = hcode(); - - $exec = hexec('_', $args[0]); - - if (count($args) > 1) { - $exec = hexec('sprintf', $exec); - foreach ($args as $id => $arg) { - if ($id !== 0) { - $exec->param($arg); - } - } - } - - - if ($redirect) { - $code->decl($redirect, $exec); - } else { - $cmp->do_print($code, $exec); - } - - return $code; - } - -} diff --git a/lib/Haanga/lib/Haanga/Extension/Tag/Tryinclude.php b/lib/Haanga/lib/Haanga/Extension/Tag/Tryinclude.php deleted file mode 100644 index c7d18057d0342893912b364622f7d5a76742ec38..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Tag/Tryinclude.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -class Haanga_Extension_Tag_Tryinclude -{ - static function generator($cmp, $args, $declared) - { - if ($declared) { - $cmp->Error("try_include can't be redirected to a variable"); - } - - $code = hcode(); - $exec = hexec('Haanga::Safe_Load', $args[0], $cmp->getScopeVariable(), TRUE, array()); - - $cmp->do_print($code, $exec); - - return $code; - - } -} diff --git a/lib/Haanga/lib/Haanga/Extension/Tag/Upper.php b/lib/Haanga/lib/Haanga/Extension/Tag/Upper.php deleted file mode 100644 index 1fd0eb2fe8187583091fc5daea7840b239ca8d0e..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Extension/Tag/Upper.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php - -class Haanga_Extension_Tag_Upper -{ - public static $is_block = TRUE; - /* This tag calls to a PHP native function */ - public static $php_alias = "strtoupper"; -} diff --git a/lib/Haanga/lib/Haanga/Generator/PHP.php b/lib/Haanga/lib/Haanga/Generator/PHP.php deleted file mode 100644 index 09e8a648fcae4dd815fcbbfffd0204e47604cbb8..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Generator/PHP.php +++ /dev/null @@ -1,681 +0,0 @@ -<?php -/* - +---------------------------------------------------------------------------------+ - | Copyright (c) 2010 César Rodas and Menéame Comunicacions S.L. | - +---------------------------------------------------------------------------------+ - | Redistribution and use in source and binary forms, with or without | - | modification, are permitted provided that the following conditions are met: | - | 1. Redistributions of source code must retain the above copyright | - | notice, this list of conditions and the following disclaimer. | - | | - | 2. Redistributions in binary form must reproduce the above copyright | - | notice, this list of conditions and the following disclaimer in the | - | documentation and/or other materials provided with the distribution. | - | | - | 3. All advertising materials mentioning features or use of this software | - | must display the following acknowledgement: | - | This product includes software developed by César D. Rodas. | - | | - | 4. Neither the name of the César D. Rodas nor the | - | names of its contributors may be used to endorse or promote products | - | derived from this software without specific prior written permission. | - | | - | THIS SOFTWARE IS PROVIDED BY CÉSAR D. RODAS ''AS IS'' AND ANY | - | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | - | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | - | DISCLAIMED. IN NO EVENT SHALL CÉSAR D. RODAS BE LIABLE FOR ANY | - | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | - | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | - | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | - | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | - | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | - | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE | - +---------------------------------------------------------------------------------+ - | Authors: César Rodas <crodas@php.net> | - +---------------------------------------------------------------------------------+ -*/ - -// addslashes_ex($string) {{{ -/** - * addslashes like function for single quote string ('foo') - * - * @return string - */ -function addslashes_ex($string) -{ - return str_replace(array("\\", "'"), array("\\\\", "\\'"), $string); -} -// }}} - -/** - * Haanga_Generator_PHP class - * - * This class takes the generated AST structure (arrays), - * and generated the PHP represantion. - * - * - */ -class Haanga_Generator_PHP -{ - protected $ident; - protected $tab = " "; - protected $scopeVariableName; - - // getCode (AST $op_code) {{{ - /** - * Transform the AST generated by the Haanga_Compiler class - * and return the equivalent PHP code. - * - * @param array $op_code - * - * @return string - */ - final function getCode($op_code, $scope) - { - $this->scopeVariableName = $scope; - $this->ident = 0; - $code = ""; - $size = count($op_code); - for ($i=0; $i < $size; $i++) { - $op = $op_code[$i]; - if (!isset($op['op'])) { - throw new Haanga_Compiler_Exception("Invalid \$op_code ".print_r($op, TRUE)); - } - - /* echo optimization {{{ */ - if ($op['op'] == 'print') { - do { - $next_op = $op_code[$i+1]; - if (!isset($next_op) || $next_op['op'] != 'print') { - break; - } - for ($e=0; $e < count($next_op); $e++) { - if (!isset($next_op[$e])) { - break; - } - $op[] = $next_op[$e]; - } - $i++; - } while(TRUE); - } - /* }}} */ - - /* declare optimization {{{ */ - if ($op['op'] == 'declare' || $op['op'] == 'append_var') { - /* Code optimization - ** - ** If a variable declaration, or append variable is followed - ** by several append_var, then merge everything into a - ** single STMT. - ** - */ - do { - $next_op = $op_code[$i+1]; - if (!isset($next_op) || $next_op['op'] != 'append_var' || $next_op['name'] != $op['name']) { - break; - } - for ($e=0; $e < count($next_op); $e++) { - if (!isset($next_op[$e])) { - break; - } - $op[] = $next_op[$e]; - } - $i++; - } while(TRUE); - } - /* }}} */ - - $method = "php_{$op['op']}"; - if (!is_callable(array($this, $method))) { - throw new Exception("CodeGenerator: Missing method $method"); - } - switch ($op['op']) { - case 'end_for': - case 'end_foreach': - case 'end_if': - case 'end_function': - case 'else': - break; - default: - $code .= $this->ident(); - } - $code .= $this->$method($op); - } - return $code; - } - // }}} - - // ident() {{{ - /** - * Get the string for the current tabulation - * - * @return string - */ - protected function ident() - { - $code = PHP_EOL; - $code .= str_repeat($this->tab, $this->ident); - - return $code; - } - // }}} - - // php_else() {{{ - /** - * Return code for "else" - * - * @return string - */ - protected function php_else() - { - $this->ident--; - $code = $this->ident()."} else {"; - $this->ident++; - return $code; - } - // }}} - - // php_comment() {{{ - /** - * Return code for "comments" - * - * @return string - */ - function php_comment($op) - { - return "/* {$op['comment']} */"; - } - // }}} - - // php_function(array $op) {{{ - /** - * Return the function declaration of the class, for now - * it has fixed params, this should change soon to generate - * any sort of functions - * - * @return string - */ - function php_function($op) - { - $code = "function {$op['name']}(\${$this->scopeVariableName}, \$return=FALSE, \$blocks=array())".$this->ident()."{"; - $this->ident++; - return $code; - } - // }}} - - // php_if(array $op) {{{ - /** - * Return the "if" declaration and increase $this->ident - * - * @return string - */ - protected function php_if($op) - { - $code = "if (".$this->php_generate_expr($op['expr']).") {"; - $this->ident++; - return $code; - } - // }}} - - // php_expr($op) {{{ - /** - * Return a stand-alone statement - * - * @return string - */ - protected function php_expr($op) - { - return $this->php_generate_expr($op[0]).";"; - } - // }}} - - // php_end_block() {{{ - /** - * Finish the current block (if, for, function, etc), - * return the final "}", and decrease $this->ident - * - * @return string - */ - protected function php_end_block() - { - $this->ident--; - return $this->ident()."}"; - } - // }}} - - // php_end_function() {{{ - /** - * Return code to end a function - * - * @return string - */ - protected function php_end_function() - { - return $this->php_end_block(); - } - // }}} - - // php_end_if() {{{ - /** - * Return code to end a if - * - * @return string - */ - protected function php_end_if() - { - return $this->php_end_block(); - } - // }}} - - // php_end_for() {{{ - /** - * Return code to end a for - * - * @return string - */ - protected function php_end_for() - { - return $this->php_end_block(); - } - // }}} - - // php_end_foreach() {{{ - /** - * Return code to end a foreach - * - * @return string - */ - protected function php_end_foreach() - { - return $this->php_end_block(); - } - // }}} - - // php_for() {{{ - /** - * - */ - protected function php_for($op) - { - $index = $this->php_get_varname($op['index']); - foreach (array('min', 'max', 'step') as $type) { - if (is_array($op[$type])) { - $$type = $this->php_get_varname($op[$type]['var']); - } else { - $$type = $op[$type]; - } - } - $cmp = "<="; - if (is_numeric($step) && $step < 0) { - $cmp = ">="; - } - if (is_numeric($min) && is_numeric($max) && $max < $min) { - if (is_numeric($step) && $step > 0) { - $step *= -1; - } - $cmp = ">="; - } - - $code = "for ({$index} = {$min}; {$index} {$cmp} {$max}; {$index} += {$step}) {"; - $this->ident++; - - return $code; - } - // }}} - - // php_foreach(array $op) {{{ - /** - * Return the declaration of a "foreach" statement. - * - * @return string - */ - protected function php_foreach($op) - { - $op['array'] = $this->php_get_varname($op['array']); - $op['value'] = $this->php_get_varname($op['value']); - $code = "foreach ({$op['array']} as "; - if (!isset($op['key'])) { - $code .= " {$op['value']}"; - } else { - $op['key'] = $this->php_get_varname($op['key']); - $code .= " {$op['key']} => {$op['value']}"; - } - - $code .= ") {"; - $this->ident++; - return $code; - } - // }}} - - // php_append_var(array $op) {{{ - /** - * Return code to append something to a variable - * - * @return string - */ - protected function php_append_var($op) - { - return $this->php_declare($op, '.='); - } - // }}} - - // php_exec($op) {{{ - /** - * Return code for a function calling. - * - * @return string - */ - protected function php_exec($op) - { - $code = ""; - if (is_string($op['name'])) { - $code .= $op['name']; - } else { - $function = $this->php_get_varname($op['name']); - $code .= $function; - } - $code .= '('; - if (isset($op['args'])) { - $code .= $this->php_generate_list($op['args']); - } - $code .= ')'; - return $code; - } - // }}} - - // php_global($op) {{{ - function php_global($op) - { - return "global \$".implode(", \$", $op['vars']).";"; - } - // }}} - - // php_generate_expr($op) {{{ - /** - * Return an expression - * - * @return string - */ - protected function php_generate_expr($expr) - { - $code = ''; - if (is_object($expr)) { - $expr = $expr->getArray(); - } - if (is_array($expr) && isset($expr['op_expr'])) { - if ($expr['op_expr'] == 'expr') { - $code .= "("; - $code .= $this->php_generate_expr($expr[0]); - $code .= ")"; - } else if ($expr['op_expr'] == 'not') { - $code .= "!".$this->php_generate_expr($expr[0]); - } else { - $code .= $this->php_generate_expr($expr[0]); - if (is_object($expr['op_expr'])) { - var_dump($expr);die('unexpected error'); - } - $code .= " {$expr['op_expr']} "; - $code .= $this->php_generate_expr($expr[1]); - } - } else { - if (is_array($expr)) { - $code .= $this->php_generate_stmt(array($expr)); - } else { - if ($expr === FALSE) { - $expr = 'FALSE'; - } else if ($expr === TRUE) { - $expr = 'TRUE'; - } - $code .= $expr; - } - } - return $code; - } - // }}} - - // php_generate_list(array ($array) {{{ - /** - * Return a list of expressions for parameters - * of a function - * - * @return string - */ - protected function php_generate_list($array) - { - $code = ""; - foreach ($array as $value) { - $code .= $this->php_generate_stmt(array($value)); - $code .= ", "; - } - return substr($code, 0, -2); - } - // }}} - - // php_generate_stmt(Array $op) {{{ - /** - * Return the representation of a statement - * - * @return string - */ - protected function php_generate_stmt($op, $concat='.') - { - $code = ""; - - for ($i=0; $i < count($op); $i++) { - if (!isset($op[$i])) { - continue; - } - if (!is_Array($op[$i])) { - throw new Haanga_Compiler_Exception("Malformed declaration ".print_r($op, TRUE)); - } - $key = key($op[$i]); - $value = current($op[$i]); - switch ($key) { - case 'array': - $code .= "Array("; - $code .= $this->php_generate_list($value); - $code .= ")"; - break; - case 'function': - case 'exec': - if (strlen($code) != 0 && $code[strlen($code) -1] != $concat) { - $code .= $concat; - } - - $value = array('name' => $value, 'args' => $op[$i]['args']); - $code .= $this->php_exec($value, FALSE); - $code .= $concat; - break; - case 'key': - $code .= $this->php_generate_stmt(array($value[0]))." => ".$this->php_generate_stmt(array($value[1])); - break; - case 'string': - if ($code != "" && $code[strlen($code)-1] == "'") { - $code = substr($code, 0, -1); - } else { - $code .= "'"; - } - $html = addslashes_ex($value); - $code .= $html."'"; - break; - case 'var': - if (strlen($code) != 0 && $code[strlen($code) -1] != $concat) { - $code .= $concat; - } - $code .= $this->php_get_varname($value). $concat; - break; - case 'number': - if (!is_numeric($value)) { - throw new Exception("$value is not a valid number"); - } - $code .= $value; - break; - case 'op_expr': - if (strlen($code) != 0 && $code[strlen($code) -1] != $concat) { - $code .= $concat; - } - $code .= '(' . $this->php_generate_expr($op[$i]) . ')'; - $code .= $concat; - break; - case 'expr': - if (strlen($code) != 0 && $code[strlen($code) -1] != $concat) { - $code .= $concat; - } - $code .= $this->php_generate_expr($value); - $code .= $concat; - break; - case 'expr_cond': - if (strlen($code) != 0 && $code[strlen($code) -1] != $concat) { - $code .= $concat; - } - $code .= "("; - $code .= $this->php_generate_expr($value); - $code .= " ? "; - $code .= $this->php_generate_stmt(array($op[$i]['true'])); - $code .= " : "; - $code .= $this->php_generate_stmt(array($op[$i]['false'])); - $code .= "){$concat}"; - break; - case 'constant': - $code = $value; - break; - default: - throw new Exception("Don't know how to declare {$key} = {$value} (".print_r($op, TRUE)); - } - } - - if ($code != "" && $code[strlen($code)-1] == $concat) { - $code = substr($code, 0, -1); - } - - return $code; - } - // }}} - - // php_print(array $op) {{{ - /** - * Return an echo of an stmt - * - * @return string - */ - protected function php_print($op) - { - $output = $this->php_generate_stmt($op, Haanga_Compiler::getOption('echo_concat')); - if ($output == "' '" && Haanga_Compiler::getOption('strip_whitespace')) { - return; /* ignore this */ - } - return 'echo '.$output.';'; - } - // }}} - - // php_inc(array $op) {{{ - /** - * Return increment a variable ($var++) - * - * @return string - */ - protected function php_inc($op) - { - return "++".$this->php_get_varname($op['name']); - } - // }}} - - // php_declare(array $op, $assign='=') {{{ - /** - * Return a variable declaration - * - * @return string - */ - protected function php_declare($op, $assign=' =') - { - $op['name'] = $this->php_get_varname($op['name']); - $code = "{$op['name']} {$assign} ".$this->php_generate_stmt($op).";"; - return $code; - } - // }}} - - // php_get_varname(mixed $var) {{{ - /** - * Return a variable - * - * @param mixed $var - * - * @return string - */ - protected function php_get_varname($var) - { - if (is_array($var)) { - if (!is_string($var[0])) { - if (count($var) == 1) { - return $this->php_get_varname($var[0]); - } else { - throw new Exception("Invalid variable definition ".print_r($var, TRUE)); - } - } - $var_str = $this->php_get_varname($var[0]); - for ($i=1; $i < count($var); $i++) { - if (is_string($var[$i])) { - $var_str .= "['".addslashes_ex($var[$i])."']"; - } else if (is_array($var[$i])) { - if (isset($var[$i]['var'])) { - /* index is a variable */ - $var_str .= '['.$this->php_get_varname($var[$i]['var']).']'; - } else if (isset($var[$i]['string'])) { - /* index is a string */ - $var_str .= "['".addslashes_ex($var[$i]['string'])."']"; - } else if (isset($var[$i]['number'])) { - /* index is a number */ - $var_str .= '['.$var[$i]['number'].']'; - } else if (isset($var[$i]['object'])) { - /* Accessing a object's property */ - if (is_array($var[$i]['object'])) { - $var_str .= '->{'.$this->php_get_varname($var[$i]['object']['var']).'}'; - } else { - $var_str .= '->'.$var[$i]['object']; - } - } else if (isset($var[$i]['class'])) { - /* Accessing a class' property */ - $var_str = substr($var_str, 1); - if (is_array($var[$i]['class'])) { - $var_str .= '::{'.$this->php_get_varname($var[$i]['class']['var']).'}'; - } else { - $var_str .= '::'.$var[$i]['class']; - } - } else if ($var[$i] === array()) { - /* index is a NULL (do append) */ - $var_str .= '[]'; - } else { - throw new Haanga_Compiler_Exception('Unknown variable definition '.print_r($var, TRUE)); - } - } - } - return $var_str; - } else { - return "\$".$var; - } - } - // }}} - - // php_return($op) {{{ - /** - * Return "return" - * - * @return string - */ - protected function php_return($op) - { - $code = "return ".$this->php_generate_stmt($op).";"; - return $code; - } - // }}} - -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: sw=4 ts=4 fdm=marker - * vim<600: sw=4 ts=4 - */ diff --git a/lib/Haanga/lib/Haanga/Loader.php b/lib/Haanga/lib/Haanga/Loader.php deleted file mode 100644 index 434162113cb5ba5a6562d8ba79b4211352de3674..0000000000000000000000000000000000000000 --- a/lib/Haanga/lib/Haanga/Loader.php +++ /dev/null @@ -1,134 +0,0 @@ -<?php -/** - * Autoloader function generated by crodas/Autoloader - * - * https://github.com/crodas/Autoloader - * - * This is a generated file, do not modify it. - */ - -spl_autoload_register(function ($class) { - /* - This array has a map of (class => file) - */ - - // classes {{{ - static $classes = array ( - 'haanga' => '/../Haanga.php', - 'haanga_extension' => '/Extension.php', - 'haanga_exception' => '/Exception.php', - 'haanga_compiler' => '/Compiler.php', - 'hg_parser' => '/Compiler/Tokenizer.php', - 'haanga_compiler_parser' => '/Compiler/Parser.php', - 'haanga_compiler_tokenizer' => '/Compiler/Tokenizer.php', - 'haanga_compiler_runtime' => '/Compiler/Runtime.php', - 'haanga_compiler_exception' => '/Compiler/Exception.php', - 'haanga_yytoken' => '/Compiler/Parser.php', - 'haanga_yystackentry' => '/Compiler/Parser.php', - 'haanga_generator_php' => '/Generator/PHP.php', - 'haanga_extension_filter' => '/Extension/Filter.php', - 'haanga_extension_filter_pluralize' => '/Extension/Filter/Pluralize.php', - 'haanga_extension_filter_count' => '/Extension/Filter/Count.php', - 'haanga_extension_filter_json' => '/Extension/Filter/Json.php', - 'haanga_extension_filter_translation' => '/Extension/Filter/Translation.php', - 'haanga_extension_filter_trans' => '/Extension/Filter/Trans.php', - 'haanga_extension_filter_upper' => '/Extension/Filter/Upper.php', - 'haanga_extension_filter_date' => '/Extension/Filter/Date.php', - 'haanga_extension_filter_empty' => '/Extension/Filter/Empty.php', - 'haanga_extension_filter_reverse' => '/Extension/Filter/Reverse.php', - 'haanga_extension_filter_capfirst' => '/Extension/Filter/Capfirst.php', - 'haanga_extension_filter_exists' => '/Extension/Filter/Exists.php', - 'haanga_extension_filter_intval' => '/Extension/Filter/Intval.php', - 'haanga_extension_filter_null' => '/Extension/Filter/Null.php', - 'haanga_extension_filter_safe' => '/Extension/Filter/Safe.php', - 'haanga_extension_filter_truncatechars' => '/Extension/Filter/Truncatechars.php', - 'haanga_extension_filter_hostname' => '/Extension/Filter/Hostname.php', - 'haanga_extension_filter_length' => '/Extension/Filter/Length.php', - 'haanga_extension_filter_trim' => '/Extension/Filter/Trim.php', - 'haanga_extension_filter_title' => '/Extension/Filter/Title.php', - 'haanga_extension_filter_escape' => '/Extension/Filter/Escape.php', - 'haanga_extension_filter_stringformat' => '/Extension/Filter/Stringformat.php', - 'haanga_extension_filter_join' => '/Extension/Filter/Join.php', - 'haanga_extension_filter_linebreaksbr' => '/Extension/Filter/Linebreaksbr.php', - 'haanga_extension_filter_default' => '/Extension/Filter/Default.php', - 'haanga_extension_filter_dictsort' => '/Extension/Filter/Dictsort.php', - 'haanga_extension_filter_substr' => '/Extension/Filter/Substr.php', - 'haanga_extension_filter_urlencode' => '/Extension/Filter/Urlencode.php', - 'haanga_extension_filter_cut' => '/Extension/Filter/Cut.php', - 'haanga_extension_filter_lower' => '/Extension/Filter/Lower.php', - 'haanga_extension_filter_truncatewords' => '/Extension/Filter/Truncatewords.php', - 'haanga_extension_filter_explode' => '/Extension/Filter/Explode.php', - 'haanga_extension_filter_isarray' => '/Extension/Filter/Isarray.php', - 'haanga_extension_filter_slugify' => '/Extension/Filter/Slugify.php', - 'haanga_extension_filter_decodedescription' => '/Extension/Filter/Decodedescription.php', - 'haanga_extension_filter_deurifier' => '/Extension/Filter/Deurifier.php', - 'haanga_extension_filter_striptags' => '/Extension/Filter/Striptags.php', - - - 'haanga_extension_tag' => '/Extension/Tag.php', - 'haanga_extension_tag_min' => '/Extension/Tag/Min.php', - 'haanga_extension_tag_upper' => '/Extension/Tag/Upper.php', - 'haanga_extension_tag_tryinclude' => '/Extension/Tag/Tryinclude.php', - 'haanga_extension_tag_setsafe' => '/Extension/Tag/Setsafe.php', - 'haanga_extension_tag_trans' => '/Extension/Tag/Trans.php', - 'haanga_extension_tag_inline' => '/Extension/Tag/Inline.php', - 'haanga_extension_tag_exec' => '/Extension/Tag/Exec.php', - 'haanga_extension_tag_buffer' => '/Extension/Tag/Buffer.php', - 'haanga_extension_tag_currenttime' => '/Extension/Tag/Currenttime.php', - 'haanga_extension_tag_spaceless' => '/Extension/Tag/Spaceless.php', - 'haanga_extension_tag_templatetag' => '/Extension/Tag/Templatetag.php', - 'haanga_extension_tag_cycle' => '/Extension/Tag/Cycle.php', - 'haanga_extension_tag_dictsort' => '/Extension/Tag/Dictsort.php', - 'haanga_extension_tag_firstof' => '/Extension/Tag/Firstof.php', - 'haanga_extension_tag_lower' => '/Extension/Tag/Lower.php', - 'haanga_ast' => '/AST.php', -); - // }}} - - // deps {{{ - static $deps = array ( - 'hg_parser' => - array ( - 0 => 'haanga_compiler_parser', - ), - 'haanga_compiler_runtime' => - array ( - 0 => 'haanga_compiler', - ), - 'haanga_extension_filter' => - array ( - 0 => 'haanga_extension', - ), - 'haanga_extension_filter_translation' => - array ( - 0 => 'haanga_extension_filter_trans', - ), - 'haanga_extension_tag' => - array ( - 0 => 'haanga_extension', - ), -); - // }}} - - $class = strtolower($class); - if (isset($classes[$class])) { - if (!empty($deps[$class])) { - foreach ($deps[$class] as $zclass) { - if (!class_exists($zclass, false)) { - require __DIR__ . $classes[$zclass]; - } - } - } - - if (!class_exists($class, false)) { - - require __DIR__ . $classes[$class]; - - } - return true; - } - - return false; -}); - - diff --git a/lib/Haanga/phpunit.xml b/lib/Haanga/phpunit.xml deleted file mode 100644 index ca09d1aa48a38dca2ef43d6b4b70f4a888f56fac..0000000000000000000000000000000000000000 --- a/lib/Haanga/phpunit.xml +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html --> -<phpunit - backupGlobals = "false" - backupStaticAttributes = "false" - colors = "true" - convertErrorsToExceptions = "true" - convertNoticesToExceptions = "true" - convertWarningsToExceptions = "true" - processIsolation = "false" - stopOnError = "true" - stopOnFailure = "true" - stopOnIncomplete = "true" - stopOnSkipped = "ture" - syntaxCheck = "true" - strict = "false" - verbose = "true" - debug = "true" - bootstrap = "tests/bootstrap.php" > - - <testsuites> - <testsuite name="Haanga tests"> - <directory>tests/</directory> - </testsuite> - </testsuites> - - <filter> - <whitelist> - <directory>tests/</directory> - <directory suffix=".php">lib/</directory> - </whitelist> - </filter> - -</phpunit> diff --git a/lib/Haanga/tests/TestSuite.php b/lib/Haanga/tests/TestSuite.php deleted file mode 100644 index 9724201d65d8f7863a8f75090b749b1b2aaa1a15..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/TestSuite.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php - -require dirname(__FILE__)."/../lib/Haanga.php"; -require dirname(__FILE__)."/../lib/Haanga/Compiler.php"; -require dirname(__FILE__)."/templateTest.php"; -require dirname(__FILE__)."/errorTest.php"; - - -class TestSuite extends PHPUnit_Framework_TestSuite -{ - public static function suite() - { - $suite = new TestSuite('Haanga test suite'); - $suite->addTestSuite('templateTest'); - $suite->addTestSuite('errorTest'); - - return $suite; - } - - public static function Init() - { - $config = array( - 'cache_dir' => 'tmp/', - 'template_dir' => '.', - 'debug' => TRUE, - 'use_hash_filename' => FALSE, - 'compiler' => array( - 'allow_exec' => TRUE, - 'global' => array('test_global', 'global1'), - ) - ); - - Haanga::Configure($config); - } -} diff --git a/lib/Haanga/tests/assert_templates/autoescape.html b/lib/Haanga/tests/assert_templates/autoescape.html deleted file mode 100644 index 818370f0b7afa85cd78e2b80d6bc15ea584ee28f..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/autoescape.html +++ /dev/null @@ -1,10 +0,0 @@ -<b>foo</b> -<b>foo</b> -{ <b>foo</b> } - - <b>foo</b> - - <b>foo</b> - - -<b>foo</b> diff --git a/lib/Haanga/tests/assert_templates/autoescape.php b/lib/Haanga/tests/assert_templates/autoescape.php deleted file mode 100644 index 2d5e41907cefe8f253ce775598a79a38224d2eda..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/autoescape.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -$data = array('variable' => '<b>foo</b>'); diff --git a/lib/Haanga/tests/assert_templates/autoescape.tpl b/lib/Haanga/tests/assert_templates/autoescape.tpl deleted file mode 100644 index 4dcab38bbbc6e007c843eb044ed06ae46127092c..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/autoescape.tpl +++ /dev/null @@ -1,10 +0,0 @@ -{{ variable }} -{{ variable|escape }} -{ {{ variable|safe }} } -{% autoescape off %} - {{ variable }} - {% autoescape on %} - {{ variable }} - {% endautoescape %} -{% endautoescape %} -{{ variable }} diff --git a/lib/Haanga/tests/assert_templates/base.html b/lib/Haanga/tests/assert_templates/base.html deleted file mode 100644 index f0d5a47eb11705c306c5b4cb2b101cbb65953120..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/base.html +++ /dev/null @@ -1,20 +0,0 @@ -<html> -<head> - <title>Default Title</title> -</head> - -<body> - <h1>Menu</h1> - - <ul> - - <li><a href="http://php.net/"><PHP></a></li> - - <li><a href="http://www.google.com/"><Google></a></li> - - </ul> - - Partial part - -</body> -</html> diff --git a/lib/Haanga/tests/assert_templates/base.php b/lib/Haanga/tests/assert_templates/base.php deleted file mode 100644 index 3f78cc7bb8dc9c9c11cc6a9f72e83ee927722f58..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/base.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -$data = array( - 'menu' => array( - array('url' => 'http://php.net/', 'name' => '<PHP>'), - array('url' => 'http://www.google.com/', 'name' => '<Google>'), - ) -); - diff --git a/lib/Haanga/tests/assert_templates/base.tpl b/lib/Haanga/tests/assert_templates/base.tpl deleted file mode 100644 index 4f4e53cd8d693f8e6aca6d00965a4d07df68cf78..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/base.tpl +++ /dev/null @@ -1,17 +0,0 @@ -<html> -<head> - <title>{% block title %}Default Title{% endblock %}</title> -</head> - -<body> - <h1>Menu</h1> - {% block main.menu %} - <ul> - {% for item in menu %} - <li><a href="{{ item.url|safe }}">{{ item.name }}</a></li> - {% endfor %} - </ul> - {% endblock %} - {% block main['include-end'] %}{% include "assert_templates/partial.tpl" %}{% endblock %} -</body> -</html> diff --git a/lib/Haanga/tests/assert_templates/bitwise.html b/lib/Haanga/tests/assert_templates/bitwise.html deleted file mode 100644 index 5024255510d2cce7d742355d65c4da486bcf06e8..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/bitwise.html +++ /dev/null @@ -1,9 +0,0 @@ - - Match - - - Match - - - Match - diff --git a/lib/Haanga/tests/assert_templates/bitwise.tpl b/lib/Haanga/tests/assert_templates/bitwise.tpl deleted file mode 100644 index d64ae12792236cdb6c28701dc98122e8c4833c8f..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/bitwise.tpl +++ /dev/null @@ -1,9 +0,0 @@ -{% if 15 & 7 == 7 %} - Match -{% endif %} -{% if 13 & 2 == 0 %} - Match -{% endif %} -{% if 15 || 8 == 15 %} - Match -{% endif %} diff --git a/lib/Haanga/tests/assert_templates/bug24.html b/lib/Haanga/tests/assert_templates/bug24.html deleted file mode 100644 index b3267050fec84b25d9d7a612c9f732b315de1088..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/bug24.html +++ /dev/null @@ -1,5 +0,0 @@ - - a - - b - diff --git a/lib/Haanga/tests/assert_templates/bug24.php b/lib/Haanga/tests/assert_templates/bug24.php deleted file mode 100644 index c9ba9ea840afbfd42df0672f0ff9b28dea110aac..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/bug24.php +++ /dev/null @@ -1,7 +0,0 @@ -<?php - -if (!class_exists('Obj', false)) { - require __DIR__ . '/bug25_class.php'; -} - -$data = array('obj' => new Obj); diff --git a/lib/Haanga/tests/assert_templates/bug24.tpl b/lib/Haanga/tests/assert_templates/bug24.tpl deleted file mode 100644 index 4df0e17f9d89a430d6f3ef73bb63950ab2f8191f..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/bug24.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{% for a in obj.method %} - {{ a }} -{% endfor %} diff --git a/lib/Haanga/tests/assert_templates/bug25.html b/lib/Haanga/tests/assert_templates/bug25.html deleted file mode 100644 index 63494e843ee4698b48068d05354e306785b1bef9..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/bug25.html +++ /dev/null @@ -1,11 +0,0 @@ - - a - - - - a - - - test - - diff --git a/lib/Haanga/tests/assert_templates/bug25.php b/lib/Haanga/tests/assert_templates/bug25.php deleted file mode 100644 index 779f690ba214dc997deedce29833ad6e398d8d42..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/bug25.php +++ /dev/null @@ -1,7 +0,0 @@ -<?php - -if (!class_exists('Obj', false)) { - require __DIR__ . '/bug25_class.php'; -} - -$data = array('obj' => new Obj, 'base' => array('endpoint' => 'a')); diff --git a/lib/Haanga/tests/assert_templates/bug25.tpl b/lib/Haanga/tests/assert_templates/bug25.tpl deleted file mode 100644 index 06328b6f70b512b05e0520620133df7fde65e753..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/bug25.tpl +++ /dev/null @@ -1,7 +0,0 @@ -{% for a in obj.endpoint %} - {{ base.endpoint }} - - {% if forloop.last %} - test - {% endif %} -{% endfor %} diff --git a/lib/Haanga/tests/assert_templates/bug25_class.php b/lib/Haanga/tests/assert_templates/bug25_class.php deleted file mode 100644 index df02a7d3cef537417a1cdf70726a40f5a579e1d2..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/bug25_class.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -class Obj -{ - public function endpoint() { - return $this->method(); - } - - public function method(){ - return array('a', 'b'); - } -} diff --git a/lib/Haanga/tests/assert_templates/bug_#14.html b/lib/Haanga/tests/assert_templates/bug_#14.html deleted file mode 100644 index 7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/bug_#14.html +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/lib/Haanga/tests/assert_templates/bug_#14.php b/lib/Haanga/tests/assert_templates/bug_#14.php deleted file mode 100644 index de1a98c0ba5c6ba549f278c684ba7b6e684bb3ae..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/bug_#14.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -$data = array( - 'endsomething' => array('endbar' => 5), -); diff --git a/lib/Haanga/tests/assert_templates/bug_#14.tpl b/lib/Haanga/tests/assert_templates/bug_#14.tpl deleted file mode 100644 index c1a6b843e5ec3489ee796286c2ac9df43eb8b80c..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/bug_#14.tpl +++ /dev/null @@ -1 +0,0 @@ -{{ endsomething.endbar }} diff --git a/lib/Haanga/tests/assert_templates/bug_001.html b/lib/Haanga/tests/assert_templates/bug_001.html deleted file mode 100644 index d00491fd7e5bb6fa28c517a0bb32b8b506539d4d..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/bug_001.html +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/lib/Haanga/tests/assert_templates/bug_001.php b/lib/Haanga/tests/assert_templates/bug_001.php deleted file mode 100644 index d435b8f3ec9f1da925e8388d0524b0a8a65e352e..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/bug_001.php +++ /dev/null @@ -1,2 +0,0 @@ -<?php -$data = array('date_end' => 1); diff --git a/lib/Haanga/tests/assert_templates/bug_001.tpl b/lib/Haanga/tests/assert_templates/bug_001.tpl deleted file mode 100644 index 022f73c4e706279c91956d14b41e8fb55d83dd7c..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/bug_001.tpl +++ /dev/null @@ -1 +0,0 @@ -{{ date_end }} diff --git a/lib/Haanga/tests/assert_templates/class_static.html b/lib/Haanga/tests/assert_templates/class_static.html deleted file mode 100644 index eebb2751f1abf939e6df72bcd47d67609fa8c02a..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/class_static.html +++ /dev/null @@ -1,5 +0,0 @@ -haanga -foo -Foo - -something diff --git a/lib/Haanga/tests/assert_templates/class_static.tpl b/lib/Haanga/tests/assert_templates/class_static.tpl deleted file mode 100644 index ca55e0426da76d764deb8e25098793584360dc5d..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/class_static.tpl +++ /dev/null @@ -1,5 +0,0 @@ -{{ Foo_Bar::Bar }} -{{ Foo_Bar::Arr[0] }} -{{ Foo_Bar::Arr['Bar'] }} -{% exec Foo_Bar::something as foo %} -{{ foo }} diff --git a/lib/Haanga/tests/assert_templates/concat.html b/lib/Haanga/tests/assert_templates/concat.html deleted file mode 100644 index 173ed86e77fdadb636c59c3cdf14a660dbc6b431..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/concat.html +++ /dev/null @@ -1,3 +0,0 @@ - - -foobarbar diff --git a/lib/Haanga/tests/assert_templates/concat.tpl b/lib/Haanga/tests/assert_templates/concat.tpl deleted file mode 100644 index 94a630176be8e3a25abbdc06401e9ff65d7efc3a..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/concat.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{% set bar = "bar" %} -{% set foo = "foo" . "bar" . bar %} -{{ foo }} diff --git a/lib/Haanga/tests/assert_templates/concat1.html b/lib/Haanga/tests/assert_templates/concat1.html deleted file mode 100644 index 9bcafce67476ad69c9125d5cfd5d1ba21a816ff0..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/concat1.html +++ /dev/null @@ -1,3 +0,0 @@ - - Match - diff --git a/lib/Haanga/tests/assert_templates/concat1.tpl b/lib/Haanga/tests/assert_templates/concat1.tpl deleted file mode 100644 index 84fe4983a722c7fdabe45552ca8fa5325a335ce4..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/concat1.tpl +++ /dev/null @@ -1,5 +0,0 @@ -{% if "foo" . "bar" == "foobar" %} - Match -{% else %} - Error -{% endif %} diff --git a/lib/Haanga/tests/assert_templates/custom_tag.html.php b/lib/Haanga/tests/assert_templates/custom_tag.html.php deleted file mode 100644 index e5b81b48564d2eee4ba667c9433ec6134cd06be1..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/custom_tag.html.php +++ /dev/null @@ -1 +0,0 @@ -<?php echo date("Y")."\n".date("Y")."\n";?> diff --git a/lib/Haanga/tests/assert_templates/custom_tag.tpl b/lib/Haanga/tests/assert_templates/custom_tag.tpl deleted file mode 100644 index 0877670b99f7ccaac81ac6c7ff9cdb461434580f..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/custom_tag.tpl +++ /dev/null @@ -1,2 +0,0 @@ -{% current_time "Y" %} -{% current_time "U" as foo %}{{ foo|date:"Y" }} diff --git a/lib/Haanga/tests/assert_templates/cycle.html b/lib/Haanga/tests/assert_templates/cycle.html deleted file mode 100644 index 03772bc34b063453c5effdb0d741a15de90c67b2..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/cycle.html +++ /dev/null @@ -1,19 +0,0 @@ - - uno - - dos - - tres - - uno - - dos - - tres - ------------------------------------------------ - -uno -dos -tres -uno diff --git a/lib/Haanga/tests/assert_templates/cycle.php b/lib/Haanga/tests/assert_templates/cycle.php deleted file mode 100644 index 160be706158139eeb74c2bfbf7b413c3b39b195c..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/cycle.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -$data = array('array' => array(1,2,3,4,5,6)); diff --git a/lib/Haanga/tests/assert_templates/cycle.tpl b/lib/Haanga/tests/assert_templates/cycle.tpl deleted file mode 100644 index a9c51984e3fd756004d82f3860b71d60bbfca7b5..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/cycle.tpl +++ /dev/null @@ -1,9 +0,0 @@ -{% for user in array %} - {% cycle 'uno' 'dos' 'tres' %} -{% endfor %} ------------------------------------------------ -{% cycle 'uno' 'dos' 'tres' as foo %} -{% cycle foo %} -{% cycle foo %} -{% cycle foo %} -{% cycle foo %} diff --git a/lib/Haanga/tests/assert_templates/dummy.html b/lib/Haanga/tests/assert_templates/dummy.html deleted file mode 100644 index ca49f5533b7b2dcda9d579a9bd40b0e44b51fd49..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/dummy.html +++ /dev/null @@ -1,4 +0,0 @@ - - - testing dummy tag - diff --git a/lib/Haanga/tests/assert_templates/dummy.tpl b/lib/Haanga/tests/assert_templates/dummy.tpl deleted file mode 100644 index 0626b2818a3d3109b5f82f2c5728711e17a9cd58..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/dummy.tpl +++ /dev/null @@ -1,4 +0,0 @@ -{% load "../contrib/dummy.php" %} -{% dummy %} - testing DUMMY TaG -{% enddummy %} diff --git a/lib/Haanga/tests/assert_templates/empty_block.html b/lib/Haanga/tests/assert_templates/empty_block.html deleted file mode 100644 index 0b49feddb1e8159a9db96784d8bd88798a578110..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/empty_block.html +++ /dev/null @@ -1,10 +0,0 @@ -bar - - -this is inner1 - - -this is inner2 - - -foo diff --git a/lib/Haanga/tests/assert_templates/empty_block.tpl b/lib/Haanga/tests/assert_templates/empty_block.tpl deleted file mode 100644 index 286f45cc8df2702a362ff9cb9e7f36c977f8e65e..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/empty_block.tpl +++ /dev/null @@ -1,11 +0,0 @@ -{% extends "assert_templates/empty_block_base.tpl"%} - - -{% block outer %} -{% block inner1 %} -this is inner1 -{% endblock inner1 %} -{% block inner2 %} -this is inner2 -{% endblock inner2 %} -{% endblock outer %} diff --git a/lib/Haanga/tests/assert_templates/empty_block_base.tpl b/lib/Haanga/tests/assert_templates/empty_block_base.tpl deleted file mode 100644 index 0626e091171c93507a85e00a90d1d9a823632ec4..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/empty_block_base.tpl +++ /dev/null @@ -1,3 +0,0 @@ -bar -{% block outer %}{% endblock %} -foo diff --git a/lib/Haanga/tests/assert_templates/empty_loop.html b/lib/Haanga/tests/assert_templates/empty_loop.html deleted file mode 100644 index 4330d6163e3ea00fa742eb09c0d27589e6e61058..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/empty_loop.html +++ /dev/null @@ -1,3 +0,0 @@ - - Else - diff --git a/lib/Haanga/tests/assert_templates/empty_loop.php b/lib/Haanga/tests/assert_templates/empty_loop.php deleted file mode 100644 index 25bb1e1a6f087a26a97b5b332a4e3077aeb1b321..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/empty_loop.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -$data = array('users' => array()); diff --git a/lib/Haanga/tests/assert_templates/empty_loop.tpl b/lib/Haanga/tests/assert_templates/empty_loop.tpl deleted file mode 100644 index 500d93921e02876a56d59b8de93a320e3b61529b..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/empty_loop.tpl +++ /dev/null @@ -1,7 +0,0 @@ -{% for id,user in users %} - {{ forloop.last }} - {{ forloop.counter0 }} - Inside loop -{% empty %} - Else -{% endfor %} diff --git a/lib/Haanga/tests/assert_templates/exec-inc.tpl b/lib/Haanga/tests/assert_templates/exec-inc.tpl deleted file mode 100644 index db8a8a4090c9ec68311e233db93e761cf06852dc..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/exec-inc.tpl +++ /dev/null @@ -1 +0,0 @@ -{{ foo }} diff --git a/lib/Haanga/tests/assert_templates/exec.html.php b/lib/Haanga/tests/assert_templates/exec.html.php deleted file mode 100644 index 4a179f65ec80f6cc616ab678df2bd659c559c132..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/exec.html.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php echo php_uname();?> - - -<?php echo php_uname();?> - - diff --git a/lib/Haanga/tests/assert_templates/exec.tpl b/lib/Haanga/tests/assert_templates/exec.tpl deleted file mode 100644 index b57c7e320799cf8884fb8286f1d9b99d72fb6495..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/exec.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{% exec php_uname %} -{% exec php_uname as foo %} -{% include "assert_templates/exec-inc.tpl" %} diff --git a/lib/Haanga/tests/assert_templates/explode.html b/lib/Haanga/tests/assert_templates/explode.html deleted file mode 100644 index 29b55c5153a36984c195806ef653eb5de2dd446a..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/explode.html +++ /dev/null @@ -1,20 +0,0 @@ - - 1: f - - 1: o - - 1: o - - 1: , - - 1: b - - 1: a - - 1: r - - - w: foo - - w: bar - diff --git a/lib/Haanga/tests/assert_templates/explode.php b/lib/Haanga/tests/assert_templates/explode.php deleted file mode 100644 index cefa262d8832bd09aff6fc885c9301e7e22f93f9..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/explode.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -$data = array('text' => 'foo,bar'); diff --git a/lib/Haanga/tests/assert_templates/explode.tpl b/lib/Haanga/tests/assert_templates/explode.tpl deleted file mode 100644 index b705b5f0369c85309094aea937bc3c7f52a9a4df..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/explode.tpl +++ /dev/null @@ -1,6 +0,0 @@ -{% for w in text|explode %} - 1: {{ w }} -{% endfor %} -{% for w in text|explode:"," %} - w: {{ w }} -{% endfor %} diff --git a/lib/Haanga/tests/assert_templates/expr.html b/lib/Haanga/tests/assert_templates/expr.html deleted file mode 100644 index 39c7ef6e387c80a104f0f935aba476a4964674cc..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/expr.html +++ /dev/null @@ -1,3 +0,0 @@ - - hola - diff --git a/lib/Haanga/tests/assert_templates/expr.php b/lib/Haanga/tests/assert_templates/expr.php deleted file mode 100644 index b80db9ce6ca932b3a73129af3d4b444516245436..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/expr.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php -$data = array( - 'self' => array( - 'status' => true, - 'tiene_negativos' => true, - 'nsfw' => false, - ) -); diff --git a/lib/Haanga/tests/assert_templates/expr.tpl b/lib/Haanga/tests/assert_templates/expr.tpl deleted file mode 100644 index 85ffb69c45da41a86d0fae36a39d9fd3354dec77..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/expr.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{% if self.status == 'published' AND self.tiene_negativos AND !self.nsfw %} - hola -{% endif %} diff --git a/lib/Haanga/tests/assert_templates/filter.html b/lib/Haanga/tests/assert_templates/filter.html deleted file mode 100644 index be6f0a9ae890594eca83aecdca08f12942ee64da..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/filter.html +++ /dev/null @@ -1,13 +0,0 @@ -"value" -"VALUE" -"value" -"vale" -7 -DEFAULT VALUE - - HOLA QUE - -tal - - hllo world - diff --git a/lib/Haanga/tests/assert_templates/filter.php b/lib/Haanga/tests/assert_templates/filter.php deleted file mode 100644 index 0721054dc088997e05682eef0710cdf1586ed31c..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/filter.php +++ /dev/null @@ -1,2 +0,0 @@ -<?php -$data = array('var' => '"value"'); diff --git a/lib/Haanga/tests/assert_templates/filter.tpl b/lib/Haanga/tests/assert_templates/filter.tpl deleted file mode 100644 index baacc2e0c28480a68651eef82ddbd50274b66677..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/filter.tpl +++ /dev/null @@ -1,13 +0,0 @@ -{{ var|default:"foobar" }} -{{ var|upper }} -{{ var|upper|lower }} -{{ var|cut:"u" }} -{{ var|length }} -{{ foobar|default:"default value"|upper}} -{% upper %} - hola que -{% endupper %} -{% lower %}TAL{% endlower %} -{% filter upper|lower|cut:"e" %} - hello world -{% endfilter %} diff --git a/lib/Haanga/tests/assert_templates/first_of.html b/lib/Haanga/tests/assert_templates/first_of.html deleted file mode 100644 index 26053ecc428ae78ad6feac96ce178cd83366aa2d..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/first_of.html +++ /dev/null @@ -1,6 +0,0 @@ -variable2's content -default -5 -variable2's content -default -5 diff --git a/lib/Haanga/tests/assert_templates/first_of.php b/lib/Haanga/tests/assert_templates/first_of.php deleted file mode 100644 index dc401f36b4e0983a9e394e43b790656789cae67e..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/first_of.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -$data = array('variable2' => 'variable2\'s content'); diff --git a/lib/Haanga/tests/assert_templates/first_of.tpl b/lib/Haanga/tests/assert_templates/first_of.tpl deleted file mode 100644 index 038d02b1faec234bca9e038a808bf6420161df55..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/first_of.tpl +++ /dev/null @@ -1,6 +0,0 @@ -{% firstof xvar variable1 variable2 "default" %} -{% firstof xvar variable1 variablex "default" %} -{% firstof xvar variable1 variablex 5 %} -{% firstof xvar,variable1,variable2,"default" %} -{% firstof xvar,variable1,variablex,"default" %} -{% firstof xvar,variable1,variablex,5 %} diff --git a/lib/Haanga/tests/assert_templates/for_range.html b/lib/Haanga/tests/assert_templates/for_range.html deleted file mode 100644 index f0f4899d7e4ad82438d6f486f20aba509a27087f..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/for_range.html +++ /dev/null @@ -1,11 +0,0 @@ - - 1 - - 2 - - 3 - - 4 - - 5 - diff --git a/lib/Haanga/tests/assert_templates/for_range.tpl b/lib/Haanga/tests/assert_templates/for_range.tpl deleted file mode 100644 index 71e655a29e39225be34c23b32b011feac9597db7..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/for_range.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{% for i in 1 .. 5 %} - {{i}} -{% endfor %} diff --git a/lib/Haanga/tests/assert_templates/for_range1.html b/lib/Haanga/tests/assert_templates/for_range1.html deleted file mode 100644 index 8ac8f019ed2f36475981c1bff2abfc30935564c1..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/for_range1.html +++ /dev/null @@ -1,7 +0,0 @@ - - 1 - - 3 - - 5 - diff --git a/lib/Haanga/tests/assert_templates/for_range1.tpl b/lib/Haanga/tests/assert_templates/for_range1.tpl deleted file mode 100644 index 2e2f24afcf44f44645e28d93a7d7d59cf128d530..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/for_range1.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{% for i in 1 .. 5 step 2 %} - {{i}} -{% endfor %} diff --git a/lib/Haanga/tests/assert_templates/for_range2.html b/lib/Haanga/tests/assert_templates/for_range2.html deleted file mode 100644 index 3f331d8e1b69b4ee0a9a8d5d240038e4a4f22622..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/for_range2.html +++ /dev/null @@ -1,7 +0,0 @@ - - 5 - - 3 - - 1 - diff --git a/lib/Haanga/tests/assert_templates/for_range2.tpl b/lib/Haanga/tests/assert_templates/for_range2.tpl deleted file mode 100644 index e7523e2bae74a2e8c18d28dfbeef8c2894c57884..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/for_range2.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{% for i in 5 .. 1 step -2 %} - {{i}} -{% endfor %} diff --git a/lib/Haanga/tests/assert_templates/for_range3.html b/lib/Haanga/tests/assert_templates/for_range3.html deleted file mode 100644 index 3f331d8e1b69b4ee0a9a8d5d240038e4a4f22622..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/for_range3.html +++ /dev/null @@ -1,7 +0,0 @@ - - 5 - - 3 - - 1 - diff --git a/lib/Haanga/tests/assert_templates/for_range3.tpl b/lib/Haanga/tests/assert_templates/for_range3.tpl deleted file mode 100644 index 2d763976caf39c9bafc61e393cabdf5b5826aa3b..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/for_range3.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{% for i in 5 .. 1 step 2 %} - {{i}} -{% endfor %} diff --git a/lib/Haanga/tests/assert_templates/for_range4.html b/lib/Haanga/tests/assert_templates/for_range4.html deleted file mode 100644 index 3f331d8e1b69b4ee0a9a8d5d240038e4a4f22622..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/for_range4.html +++ /dev/null @@ -1,7 +0,0 @@ - - 5 - - 3 - - 1 - diff --git a/lib/Haanga/tests/assert_templates/for_range4.php b/lib/Haanga/tests/assert_templates/for_range4.php deleted file mode 100644 index a475ffa2a4647f42a9ea996d37f986a22f1e9d1c..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/for_range4.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -$data = array('min' => 5, 'max' => 1); diff --git a/lib/Haanga/tests/assert_templates/for_range4.tpl b/lib/Haanga/tests/assert_templates/for_range4.tpl deleted file mode 100644 index 3618603198d287c2caac07826180e692c397504a..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/for_range4.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{% for i in min .. max step -2 %} - {{i}} -{% endfor %} diff --git a/lib/Haanga/tests/assert_templates/for_range5.html b/lib/Haanga/tests/assert_templates/for_range5.html deleted file mode 100644 index 3f331d8e1b69b4ee0a9a8d5d240038e4a4f22622..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/for_range5.html +++ /dev/null @@ -1,7 +0,0 @@ - - 5 - - 3 - - 1 - diff --git a/lib/Haanga/tests/assert_templates/for_range5.php b/lib/Haanga/tests/assert_templates/for_range5.php deleted file mode 100644 index 250f292cffcbb38552e106515ecf8027f0a79014..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/for_range5.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -$data = array('e' => array('min' => 5, 'max' => 1)); diff --git a/lib/Haanga/tests/assert_templates/for_range5.tpl b/lib/Haanga/tests/assert_templates/for_range5.tpl deleted file mode 100644 index efa64197ee951a5ed020f090768796ae63686891..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/for_range5.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{% for i in e.min .. e.max step -2 %} - {{i}} -{% endfor %} diff --git a/lib/Haanga/tests/assert_templates/foreach_vars.html b/lib/Haanga/tests/assert_templates/foreach_vars.html deleted file mode 100644 index f0990b02bc8614ad22581b09ea8cffe36e61c7e5..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/foreach_vars.html +++ /dev/null @@ -1,24 +0,0 @@ -<div class='container'> - - <div class='mainCategoryList'>foo - <ul> - - <li class='secondaryCategoryList'> - - one,</li> - - - <li class='secondaryCategoryList'> - - two,</li> - - - <li class='secondaryCategoryList'> - - tree</li> - - - </ul> - </div> - -</div> diff --git a/lib/Haanga/tests/assert_templates/foreach_vars.php b/lib/Haanga/tests/assert_templates/foreach_vars.php deleted file mode 100644 index 6ceead7ed5b694de770b6e8f1d8393364bd03082..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/foreach_vars.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php -$data = array( - 'categoriesArray' => array( - array( - 'cat' => array('categoria' => 'foo'), - 'subCategories' => array( - array('categoria' => 'one'), - array('categoria' => 'two'), - array('categoria' => 'tree'), - ), - ), - ), -); diff --git a/lib/Haanga/tests/assert_templates/foreach_vars.tpl b/lib/Haanga/tests/assert_templates/foreach_vars.tpl deleted file mode 100644 index 281e8015146cac472828f55762e5c30a1a3d9383..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/foreach_vars.tpl +++ /dev/null @@ -1,16 +0,0 @@ -<div class='container'> -{% for category in categoriesArray %} - <div class='mainCategoryList'>{{ category.cat.categoria }} - <ul> - {% for secondaryCategory in category.subCategories %} - <li class='secondaryCategoryList'> - {% if forloop.last %} - {{ secondaryCategory.categoria }}</li> - {% else %} - {{ secondaryCategory.categoria }},</li> - {% endif %} - {% endfor %} - </ul> - </div> -{% endfor %} -</div> diff --git a/lib/Haanga/tests/assert_templates/global.html b/lib/Haanga/tests/assert_templates/global.html deleted file mode 100644 index 16051ac805ae90c1a39d2b49a356d9e2f275f5ac..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/global.html +++ /dev/null @@ -1,5 +0,0 @@ - -string c xxx -string c -c -c diff --git a/lib/Haanga/tests/assert_templates/global.php b/lib/Haanga/tests/assert_templates/global.php deleted file mode 100644 index 50bc3ef26f3aab84455a42a4d1d7004ec19176bd..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/global.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -$obj = new stdclass; -$obj->str = 'foo'; -$data = array('index' => array('name' => $obj), 'indexstr' => 'foo'); -$obj = new Stdclass; -$obj->foo = array('bar' => 'c'); - -global $test_global, $global1; - -$test_global = array('b' => 'string'); -$global1 = array('foo' => $obj); - -if (!is_callable('set_global_template')) { - function set_global_template() - { - global $test_global, $global1; - $global1['bar'] = new stdclass; - $global1['bar']->xxx = new stdclass; - $global1['bar']->xxx->yyyy = 'xxx'; - } -} diff --git a/lib/Haanga/tests/assert_templates/global.tpl b/lib/Haanga/tests/assert_templates/global.tpl deleted file mode 100644 index 1c2bc83fad45c616abc1b4a77836cf6b22d4181a..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/global.tpl +++ /dev/null @@ -1,5 +0,0 @@ -{% exec set_global_template %} -{{ test_global.b }} {{global1.foo.foo.bar}} {{global1.bar.xxx.yyyy|default:"yyy"}} -{{ test_global['b'] }} {{global1['foo']['foo']['bar']}} -{{ global1['foo'][index.name.str]['bar'] }} -{{ global1['foo'][indexstr]['bar'] }} diff --git a/lib/Haanga/tests/assert_templates/if_else_simple.html b/lib/Haanga/tests/assert_templates/if_else_simple.html deleted file mode 100644 index 4f01fb4d3ee506d479be1a670743d50ffa103a98..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/if_else_simple.html +++ /dev/null @@ -1,8 +0,0 @@ -True -False -True -True -False -False -True -True diff --git a/lib/Haanga/tests/assert_templates/if_else_simple.php b/lib/Haanga/tests/assert_templates/if_else_simple.php deleted file mode 100644 index b765c9ba4461981bc51ab15f076fbab41acc9c36..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/if_else_simple.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -$data = array('var' => 'cesar'); diff --git a/lib/Haanga/tests/assert_templates/if_else_simple.tpl b/lib/Haanga/tests/assert_templates/if_else_simple.tpl deleted file mode 100644 index b69333a8e87d5702e31ec49a0d303be4e89aa1a5..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/if_else_simple.tpl +++ /dev/null @@ -1,8 +0,0 @@ -{% if 1 == 2 OR 1+2 == 3 %}True{% else %}False{% endif %} -{% if var|upper == var %}True{% else %}False{% endif %} -{% if 1 === 2 OR 1+2 === 3 %}True{% else %}False{% endif %} -{% if 1 !== 2 %}True{% else %}False{% endif %} -{% if 1 > 2 %}True{% else %}False{% endif %} -{% if 1 >= 2 %}True{% else %}False{% endif %} -{% if 1 <= 2 %}True{% else %}False{% endif %} -{% if 1 < 2 %}True{% else %}False{% endif %} diff --git a/lib/Haanga/tests/assert_templates/ifchanged.html b/lib/Haanga/tests/assert_templates/ifchanged.html deleted file mode 100644 index 3a3c90657756df68ec68f02b0a69931a8c19ffe1..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/ifchanged.html +++ /dev/null @@ -1,28 +0,0 @@ - - - Users with 22 years - bar - - - foo - - Users with 23 years - older Bar - - - older Foo - - - - Users with 22 years - bar - - Users with 22 years - foo - - Users with 23 years - older Bar - - continue - older Foo - diff --git a/lib/Haanga/tests/assert_templates/ifchanged.php b/lib/Haanga/tests/assert_templates/ifchanged.php deleted file mode 100644 index 4838d397f9405e7abb4226f51a3d11b3bdba496e..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/ifchanged.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -$data = array('users' => array( - array( - 'name' => 'foo', - 'age' => 22, - 'foo' => 2, - ), - array( - 'name' => 'older Foo', - 'age' => 23, - 'foo' => 2 - ), - array( - 'name' => 'older Bar', - 'age' => 23, - 'foo' => 2 - ), - array( - 'name' => 'bar', - 'age' => 22, - 'foo' => 1 - ), - ), - 'regroup_field' => 'age', -); diff --git a/lib/Haanga/tests/assert_templates/ifchanged.tpl b/lib/Haanga/tests/assert_templates/ifchanged.tpl deleted file mode 100644 index 68a4e3c1b934481be0c87d2b3c2b6e6c206637a8..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/ifchanged.tpl +++ /dev/null @@ -1,10 +0,0 @@ -{% dictsort users regroup_field as sorted_users %} -{% for user in sorted_users %} - {% ifchanged %}Users with {{user['age'] }} years{% endifchanged %} - {{ user['name'] }} -{% endfor %} - -{% for user in sorted_users %} - {% ifchanged user['age'] user['foo'] %}Users with {{user['age']}} years{% else %}continue{% endifchanged %} - {{ user['name'] }} -{% endfor %} diff --git a/lib/Haanga/tests/assert_templates/ifequals.html b/lib/Haanga/tests/assert_templates/ifequals.html deleted file mode 100644 index 7baee23c5100a637e70ac6b237847f8d4866c72f..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/ifequals.html +++ /dev/null @@ -1,6 +0,0 @@ - - Non Equals - - - Non Equals - diff --git a/lib/Haanga/tests/assert_templates/ifequals.tpl b/lib/Haanga/tests/assert_templates/ifequals.tpl deleted file mode 100644 index dea066a00bba8408ec8fc8e0d8304fd268555a9d..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/ifequals.tpl +++ /dev/null @@ -1,10 +0,0 @@ -{% ifequal 1 2 %} - Equals -{% else %} - Non Equals -{% endifequal %} -{% ifnotequal 1 2 %} - Non Equals -{% else %} - Equals -{% endifnotequal %} diff --git a/lib/Haanga/tests/assert_templates/in.html b/lib/Haanga/tests/assert_templates/in.html deleted file mode 100644 index 11e70b4ebc7e52ee3eee4fa40ada940498b5c5f3..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/in.html +++ /dev/null @@ -1,12 +0,0 @@ - - Here - - - Here - - - Here - - - Here - diff --git a/lib/Haanga/tests/assert_templates/in.php b/lib/Haanga/tests/assert_templates/in.php deleted file mode 100644 index fe1724666590543f45aba613c4f0299cd1757362..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/in.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -$data = array( - 'names' => array('cesar', 'd.', 'rodas'), - 'search' => 'rodas', -); diff --git a/lib/Haanga/tests/assert_templates/in.tpl b/lib/Haanga/tests/assert_templates/in.tpl deleted file mode 100644 index adf1bcca011ef4f391c7cb21340d4cfa486b33b8..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/in.tpl +++ /dev/null @@ -1,12 +0,0 @@ -{% if "d." in "cesar d. rodas" %} - Here -{% endif %} -{% if "d." in names %} - Here -{% endif %} -{% if search in "cesar d. rodas" %} - Here -{% endif %} -{% if search in names %} - Here -{% endif %} diff --git a/lib/Haanga/tests/assert_templates/inheritence_nested_block.html b/lib/Haanga/tests/assert_templates/inheritence_nested_block.html deleted file mode 100644 index 9296af489339260cc1d7f0b08034b1101ee7fa86..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/inheritence_nested_block.html +++ /dev/null @@ -1,11 +0,0 @@ - - - -this is inner1 - - -this is inner2 - - -new stuff - diff --git a/lib/Haanga/tests/assert_templates/inheritence_nested_block.tpl b/lib/Haanga/tests/assert_templates/inheritence_nested_block.tpl deleted file mode 100644 index 84f75d87318af6771053acf861ab8f216f3dd2e3..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/inheritence_nested_block.tpl +++ /dev/null @@ -1,6 +0,0 @@ -{% extends "assert_templates/nested_block.tpl" %} - -{% block outer %} -{{ block.super }} -new stuff -{% endblock outer %} diff --git a/lib/Haanga/tests/assert_templates/inheritence_nested_block_duplicated.html b/lib/Haanga/tests/assert_templates/inheritence_nested_block_duplicated.html deleted file mode 100644 index e9a0dea3529f54dacbd27e06bc4ae388b89daa49..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/inheritence_nested_block_duplicated.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -this is inner1 - - -new inner2 - - -new stuff - -new inner2 - - diff --git a/lib/Haanga/tests/assert_templates/inheritence_nested_block_duplicated.tpl b/lib/Haanga/tests/assert_templates/inheritence_nested_block_duplicated.tpl deleted file mode 100644 index a2c0e33065bd826885843dd4efc07a010d4dfd13..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/inheritence_nested_block_duplicated.tpl +++ /dev/null @@ -1,10 +0,0 @@ -{% extends "assert_templates/nested_block.tpl" %} - -{% block outer %} -{{ block.super }} -new stuff -{% block inner2 %} -new inner2 -{% endblock inner2 %} -{% endblock outer %} - diff --git a/lib/Haanga/tests/assert_templates/inline.html b/lib/Haanga/tests/assert_templates/inline.html deleted file mode 100644 index c3719232f09ead499db917153ebcd04897a0f9f2..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/inline.html +++ /dev/null @@ -1,11 +0,0 @@ - - -Foobar text -Partial part - - - - another <b>text</b> - - - diff --git a/lib/Haanga/tests/assert_templates/inline.tpl b/lib/Haanga/tests/assert_templates/inline.tpl deleted file mode 100644 index de005128ba2f946f0aa656032cb7a8dcff321481..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/inline.tpl +++ /dev/null @@ -1,6 +0,0 @@ -{% buffer html %} -Foobar text -{% inline "assert_templates/partial.tpl" %} -{% inline "assert_templates/inline_buffer.tpl" %} -{% endbuffer %} -{{ html }} diff --git a/lib/Haanga/tests/assert_templates/inline_buffer.tpl b/lib/Haanga/tests/assert_templates/inline_buffer.tpl deleted file mode 100644 index afba4fbba80bcef6f09bccc2885403a5814a1cd9..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/inline_buffer.tpl +++ /dev/null @@ -1,4 +0,0 @@ -{% buffer html1 %} - another <b>text</b> -{% endbuffer %} -{{ html1 }} diff --git a/lib/Haanga/tests/assert_templates/intval.html b/lib/Haanga/tests/assert_templates/intval.html deleted file mode 100644 index 7ed6ff82de6bcc2a78243fc9c54d3ef5ac14da69..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/intval.html +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/lib/Haanga/tests/assert_templates/intval.php b/lib/Haanga/tests/assert_templates/intval.php deleted file mode 100644 index ce4d81bfe10718b577ae5e04de7e14c2a043af56..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/intval.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php -$float = 5.5; -$data = compact('float'); diff --git a/lib/Haanga/tests/assert_templates/intval.tpl b/lib/Haanga/tests/assert_templates/intval.tpl deleted file mode 100644 index 0f5d8a5c6866235ae019e34ce99b4e2ef0043c90..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/intval.tpl +++ /dev/null @@ -1 +0,0 @@ -{{ float|intval }} diff --git a/lib/Haanga/tests/assert_templates/is_array.html b/lib/Haanga/tests/assert_templates/is_array.html deleted file mode 100644 index 8180953eec624616e288e98056e86fdb896e2edc..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/is_array.html +++ /dev/null @@ -1,2 +0,0 @@ - true - diff --git a/lib/Haanga/tests/assert_templates/is_array.php b/lib/Haanga/tests/assert_templates/is_array.php deleted file mode 100644 index d07615fe56cc5acc5fd43d76542613276b294fd1..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/is_array.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -$data = array('zfoo' => new stdclass, 'foo' => array()); diff --git a/lib/Haanga/tests/assert_templates/is_array.tpl b/lib/Haanga/tests/assert_templates/is_array.tpl deleted file mode 100644 index 18f742972737275535cc9186abf07e74f7c54c8b..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/is_array.tpl +++ /dev/null @@ -1,2 +0,0 @@ -{%if foo|isarray %} true {% endif %} -{%if zfoo|isarray %} true {% endif %} diff --git a/lib/Haanga/tests/assert_templates/join.html b/lib/Haanga/tests/assert_templates/join.html deleted file mode 100644 index 1b82e2030df9f22ac52ae44fef3d5418d01c01a4..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/join.html +++ /dev/null @@ -1,3 +0,0 @@ -one // two // three -onetwothree -three // two // one diff --git a/lib/Haanga/tests/assert_templates/join.php b/lib/Haanga/tests/assert_templates/join.php deleted file mode 100644 index eab58ddfcc65e4739d3121b1ef5b3a5c4638f9f8..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/join.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -$data = array("array" => array("one", "two", "three")); diff --git a/lib/Haanga/tests/assert_templates/join.tpl b/lib/Haanga/tests/assert_templates/join.tpl deleted file mode 100644 index 30c7a4ee6e649628889f888260dd40629db83910..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/join.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{{ array|join:" // " }} -{{ array|join }} -{{ array|reverse|join:" // " }} diff --git a/lib/Haanga/tests/assert_templates/load.html b/lib/Haanga/tests/assert_templates/load.html deleted file mode 100644 index 28ab773e5debe847d6e8900dd6d36e850d45c62f..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/load.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - <span class="nextprev">« Previous</span> - - - - <a href="?page=1">1</a>'; - <span>...</span> - - - - - <a href="?page=8">8</a> - - - - <a href="?page=9">9</a> - - - - <span class="current">10</span> - - - - <a href="?page=11">11</a> - - - - <a href="?page=12">12</a> - - - - - <span>...</span> - <a href="?page=50">50</a> - - - - <a href="?page=11">» Next</a> - diff --git a/lib/Haanga/tests/assert_templates/load.php b/lib/Haanga/tests/assert_templates/load.php deleted file mode 100644 index 3909085a431b767d0aed95770df0f8af25a1b205..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/load.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php -$page = 10; -$total = 500; -$results_per_page = 10; - -$data = compact('page', 'total', 'results_per_page'); diff --git a/lib/Haanga/tests/assert_templates/load.tpl b/lib/Haanga/tests/assert_templates/load.tpl deleted file mode 100644 index 1b77a885828d85056b1e5c7133326d0b4a1aadde..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/load.tpl +++ /dev/null @@ -1,31 +0,0 @@ -{% load "../../contrib/meneame_pagination.php" %} -{% meneame_pagination page results_per_page total %} -{% if mnm_prev %} - <span class="nextprev">« Previous</span> -{% else %} - <a href="?page{{ mnm_prev }}">« Previous</a> -{% endif %} - -{% if mnm_start > 1 %} - <a href="?page=1">1</a>'; - <span>...</span> -{% endif %} - -{% for page in mnm_pages %} - {% if mnm_current == page %} - <span class="current">{{page}}</span> - {% else %} - <a href="?page={{page}}">{{page}}</a> - {% endif %} -{% endfor %} - -{% if mnm_total > mnm_end %} - <span>...</span> - <a href="?page={{ mnm_total}}">{{ mnm_total }}</a> -{% endif %} - -{% if mnm_next %} - <a href="?page={{mnm_next}}">» Next</a> -{% else %} - <span class="nextprev">» Next</span> -{% endif %} diff --git a/lib/Haanga/tests/assert_templates/locale/en/LC_MESSAGES/messages.mo b/lib/Haanga/tests/assert_templates/locale/en/LC_MESSAGES/messages.mo deleted file mode 100644 index a57cf97126f56a4e13a5b4aca29642d6389645ad..0000000000000000000000000000000000000000 Binary files a/lib/Haanga/tests/assert_templates/locale/en/LC_MESSAGES/messages.mo and /dev/null differ diff --git a/lib/Haanga/tests/assert_templates/locale/en/LC_MESSAGES/messages.po b/lib/Haanga/tests/assert_templates/locale/en/LC_MESSAGES/messages.po deleted file mode 100644 index 06818db4bd1d7255577b9955142fda6da8dcc0de..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/locale/en/LC_MESSAGES/messages.po +++ /dev/null @@ -1,31 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-07-03 16:17+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: LANGUAGE <LL@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: -msgid "hello" -msgstr "hola" - - -#: assert_templates/trans.tpl:1 assert_templates/trans.tpl:1 -msgid "Translation" -msgstr "Traducción" - -#: assert_templates/trans.tpl:2 assert_templates/trans.tpl:2 -#, c-format -msgid "Translation by %s" -msgstr "Traducción por %s" diff --git a/lib/Haanga/tests/assert_templates/locale/es_ES/LC_MESSAGES/messages.mo b/lib/Haanga/tests/assert_templates/locale/es_ES/LC_MESSAGES/messages.mo deleted file mode 100644 index 1d9ef284a06be7e4d182d2cf6848fe60a41195bb..0000000000000000000000000000000000000000 Binary files a/lib/Haanga/tests/assert_templates/locale/es_ES/LC_MESSAGES/messages.mo and /dev/null differ diff --git a/lib/Haanga/tests/assert_templates/locale/es_ES/LC_MESSAGES/messages.po b/lib/Haanga/tests/assert_templates/locale/es_ES/LC_MESSAGES/messages.po deleted file mode 100644 index 451dbebaae0329c8eb526601b4f011037c75055d..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/locale/es_ES/LC_MESSAGES/messages.po +++ /dev/null @@ -1,31 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-08-03 23:34-0400\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: LANGUAGE <LL@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: -msgid "hello" -msgstr "hola" - - -#: assert_templates/trans.tpl:1 assert_templates/trans.tpl:1 -msgid "Translation" -msgstr "Traducción" - -#: assert_templates/trans.tpl:2 assert_templates/trans.tpl:2 -#, c-format -msgid "Translation by %s" -msgstr "Traducción por %s" diff --git a/lib/Haanga/tests/assert_templates/loop.html b/lib/Haanga/tests/assert_templates/loop.html deleted file mode 100644 index 4f56d1a81bb2fa646ce1c7a40f804b7c06e03fd5..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/loop.html +++ /dev/null @@ -1,49 +0,0 @@ - - 3 - - 2 - - 1 - - 0 - - - - 4 - - 3 - - 2 - - 1 - - -Last 4 - -Last 3 - - Last 3 - - Last 3 - - Last 3 - - - - Last 3 - - Last 3 - -first 0 - - first 0 - - first 0 - - first 0 - - - - first 0 - - first 0 diff --git a/lib/Haanga/tests/assert_templates/loop.php b/lib/Haanga/tests/assert_templates/loop.php deleted file mode 100644 index ec8dfff9247f6a0c572ffd07c3977cf08a822450..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/loop.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -$data = array( - 'array' => range(1, 4), - 'array_nested' => array( - array(range(1,4), range(1, 2)), - array(range(1,5), range(1,90)), - array(range(2, 4), range(1, 1000)), - array(range(1,4), range(1, 2)), - ) -); diff --git a/lib/Haanga/tests/assert_templates/loop.tpl b/lib/Haanga/tests/assert_templates/loop.tpl deleted file mode 100644 index 6fccd64944a5022356897f78dfa93eeddb200fe6..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/loop.tpl +++ /dev/null @@ -1,32 +0,0 @@ -{% for i in array %} - {{ forloop.revcounter0 }} -{% endfor %} - -{% for i in array %} - {{ forloop.revcounter }} -{% endfor %} - -{% for i in array %}{% filter trim %} - {% if forloop.last %} Last {{ i }}{% endif %} - -{% endfilter %}{% endfor %} - -{% for k,sub in array_nested %}{% filter trim %} - - {% for arr in sub %} - {% for val in arr %} - {% if forloop.parentloop.parentloop.last %} Last {{ k }}{% endif %} - {% endfor %} - {% endfor %} - -{% endfilter %}{% endfor %} - -{% for k,sub in array_nested %}{% filter trim %} - - {% for arr in sub %} - {% for val in arr %} - {% if forloop.parentloop.parentloop.first %} first {{ k }}{% endif %} - {% endfor %} - {% endfor %} - -{% endfilter %}{% endfor %} diff --git a/lib/Haanga/tests/assert_templates/loop_object.html b/lib/Haanga/tests/assert_templates/loop_object.html deleted file mode 100644 index de4996f9f9de4c73cc97d696c4f5f57a53afed56..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/loop_object.html +++ /dev/null @@ -1,9 +0,0 @@ - - foo bar - - nombre crodas - - - - bar - diff --git a/lib/Haanga/tests/assert_templates/loop_object.php b/lib/Haanga/tests/assert_templates/loop_object.php deleted file mode 100644 index 61291009509a0f611f8b990ca34a3922efbe2b30..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/loop_object.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -$obj = new stdclass; -$obj->foo = 'bar'; -$obj->nombre = 'crodas'; - -$objects = array($obj); - -$data = compact('obj', 'objects'); diff --git a/lib/Haanga/tests/assert_templates/loop_object.tpl b/lib/Haanga/tests/assert_templates/loop_object.tpl deleted file mode 100644 index 3c9aaa0e23efd63b8a3c0ed506c5490093a75ba4..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/loop_object.tpl +++ /dev/null @@ -1,7 +0,0 @@ -{% for prop,value in obj %} - {{ prop }} {{ value }} -{% endfor %} - -{% for i in objects %} - {{ i.foo }} -{% endfor %} diff --git a/lib/Haanga/tests/assert_templates/method.html b/lib/Haanga/tests/assert_templates/method.html deleted file mode 100644 index cf0aca4e31a72fe5d9b902056083c4b98af2350f..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/method.html +++ /dev/null @@ -1,6 +0,0 @@ -foo -foo -FOO -FOO -bar -BAR diff --git a/lib/Haanga/tests/assert_templates/method.php b/lib/Haanga/tests/assert_templates/method.php deleted file mode 100644 index e4846428f0225289c3c0153de837244e67a8d3d0..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/method.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -$data = array( - 'Object' => new Foo_Bar, -); diff --git a/lib/Haanga/tests/assert_templates/method.tpl b/lib/Haanga/tests/assert_templates/method.tpl deleted file mode 100644 index 39054f77f6a896b6c9c91bdc203851f955b7b159..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/method.tpl +++ /dev/null @@ -1,6 +0,0 @@ -{{ Object.method }} -{{ Object.method() }} -{{ Object.method|upper }} -{{ Object.method()|upper }} -{{ Object.bar }} -{{ Object.bar|upper }} diff --git a/lib/Haanga/tests/assert_templates/nested_block.html b/lib/Haanga/tests/assert_templates/nested_block.html deleted file mode 100644 index f191b38f7f35019d84ec299200854f09ab70b42f..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/nested_block.html +++ /dev/null @@ -1,8 +0,0 @@ - - -this is inner1 - - -this is inner2 - - diff --git a/lib/Haanga/tests/assert_templates/nested_block.tpl b/lib/Haanga/tests/assert_templates/nested_block.tpl deleted file mode 100644 index 44397b281478745e18d94b1b17db4827ffdcb238..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/nested_block.tpl +++ /dev/null @@ -1,8 +0,0 @@ -{% block outer %} -{% block inner1 %} -this is inner1 -{% endblock inner1 %} -{% block inner2 %} -this is inner2 -{% endblock inner2 %} -{% endblock outer %} diff --git a/lib/Haanga/tests/assert_templates/nested_block_second_parent.html b/lib/Haanga/tests/assert_templates/nested_block_second_parent.html deleted file mode 100644 index e25a408d50c88874f134c215721423f693a45b52..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/nested_block_second_parent.html +++ /dev/null @@ -1,11 +0,0 @@ - - -this is inner1 - - - inner2's new value - - 2.1 - - - diff --git a/lib/Haanga/tests/assert_templates/nested_block_second_parent.tpl b/lib/Haanga/tests/assert_templates/nested_block_second_parent.tpl deleted file mode 100644 index ec98256fc9698233d013c3b365f6edb1d1fae8a1..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/nested_block_second_parent.tpl +++ /dev/null @@ -1,8 +0,0 @@ -{% extends "assert_templates/nested_block.tpl" %} - -{% block inner2 %} - inner2's new value - {% block inner2_1 %} - 2.1 - {% endblock %} -{% endblock %} diff --git a/lib/Haanga/tests/assert_templates/nested_block_second_parent_override.html b/lib/Haanga/tests/assert_templates/nested_block_second_parent_override.html deleted file mode 100644 index 8bdab0c5dc4baee8e8d99a340551d7e529b1f1b0..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/nested_block_second_parent_override.html +++ /dev/null @@ -1,11 +0,0 @@ - - -this is inner1 - - - inner2's new value - - 2.1-overrided - - - diff --git a/lib/Haanga/tests/assert_templates/nested_block_second_parent_override.tpl b/lib/Haanga/tests/assert_templates/nested_block_second_parent_override.tpl deleted file mode 100644 index 018412a93928a9c14818117c240c049a6cc3f581..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/nested_block_second_parent_override.tpl +++ /dev/null @@ -1,5 +0,0 @@ -{% extends "assert_templates/nested_block_second_parent.tpl" %} - -{% block inner2_1 %} - 2.1-overrided -{% endblock %} diff --git a/lib/Haanga/tests/assert_templates/null.html b/lib/Haanga/tests/assert_templates/null.html deleted file mode 100644 index 1af338ce1e8aed346e4702a1f50a81810e2a68c9..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/null.html +++ /dev/null @@ -1,13 +0,0 @@ - - - foo is null - - - - bar is not null - - - - foobar is not null - - diff --git a/lib/Haanga/tests/assert_templates/null.php b/lib/Haanga/tests/assert_templates/null.php deleted file mode 100644 index 4c0ae20e7a1fab8a4535c927f56b696b447f9b41..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/null.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php - -$data = array( -'obj' => array( - 'foo' => NULL, - 'bar' => false, - 'foobar' => 0, -)); diff --git a/lib/Haanga/tests/assert_templates/null.tpl b/lib/Haanga/tests/assert_templates/null.tpl deleted file mode 100644 index bd47ea72f48bcabcf23765e1b2c04ae37a2b2780..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/null.tpl +++ /dev/null @@ -1,7 +0,0 @@ -{% for k,val in obj %} - {% if val|null %} - {{ k }} is null - {% else %} - {{ k }} is not null - {% endif %} -{% endfor %} diff --git a/lib/Haanga/tests/assert_templates/object.html b/lib/Haanga/tests/assert_templates/object.html deleted file mode 100644 index ca9d80a9958d9bc642294b6d6fc3ac7beb8375b7..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/object.html +++ /dev/null @@ -1,4 +0,0 @@ -foo -bar -foo -bar diff --git a/lib/Haanga/tests/assert_templates/object.php b/lib/Haanga/tests/assert_templates/object.php deleted file mode 100644 index b8005fcbde01b423d9cd3b26632fef178ccbc725..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/object.php +++ /dev/null @@ -1,7 +0,0 @@ -<?php - -$obj = new Stdclass; -$obj->name = 'foo'; -$obj->obj['name'] = 'bar'; -$arr['obj'] = $obj; -$data = compact('obj', 'arr'); diff --git a/lib/Haanga/tests/assert_templates/object.tpl b/lib/Haanga/tests/assert_templates/object.tpl deleted file mode 100644 index db836906c935534699cfe3f41c0ba68996b5ba5f..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/object.tpl +++ /dev/null @@ -1,4 +0,0 @@ -{{ obj->name }} -{{ obj.obj.name }} -{{ arr.obj->name }} -{{ arr.obj->obj.name }} diff --git a/lib/Haanga/tests/assert_templates/partial.tpl b/lib/Haanga/tests/assert_templates/partial.tpl deleted file mode 100644 index f51052cf06771aac58ddfecc6c3a5272ac6f703f..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/partial.tpl +++ /dev/null @@ -1 +0,0 @@ -Partial part diff --git a/lib/Haanga/tests/assert_templates/pluralize.html b/lib/Haanga/tests/assert_templates/pluralize.html deleted file mode 100644 index c080be39b890fded89717902e12ab02692587c8f..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/pluralize.html +++ /dev/null @@ -1,6 +0,0 @@ -message -walrus -cherry -messages -walruses -cherries diff --git a/lib/Haanga/tests/assert_templates/pluralize.php b/lib/Haanga/tests/assert_templates/pluralize.php deleted file mode 100644 index 3fdd7c2e860b947be8e3a507380b0f1256dcd5a0..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/pluralize.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -$data = array( - 'num1' => 1, - 'num2' => 3, -); diff --git a/lib/Haanga/tests/assert_templates/pluralize.tpl b/lib/Haanga/tests/assert_templates/pluralize.tpl deleted file mode 100644 index ac9c682311683f8c7688ce029b15be5844895ab0..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/pluralize.tpl +++ /dev/null @@ -1,6 +0,0 @@ -message{{ num1|pluralize }} -walrus{{ num1|pluralize:"es" }} -cherr{{ num1|pluralize:"y,ies" }} -message{{ num2|pluralize }} -walrus{{ num2|pluralize:"es" }} -cherr{{ num2|pluralize:"y,ies" }} diff --git a/lib/Haanga/tests/assert_templates/print_expr.html b/lib/Haanga/tests/assert_templates/print_expr.html deleted file mode 100644 index 13c11b896b141eebc9152e9e96c8ca014df5d1ac..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/print_expr.html +++ /dev/null @@ -1,4 +0,0 @@ -hi I'm 5 ! -Hola -hi I'm 5 ! -hi I'm 5 ! diff --git a/lib/Haanga/tests/assert_templates/print_expr.php b/lib/Haanga/tests/assert_templates/print_expr.php deleted file mode 100644 index 0f7acce40f1a0312a1346fecb6205a71b4beedd7..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/print_expr.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -$data = array('b' => 3); diff --git a/lib/Haanga/tests/assert_templates/print_expr.tpl b/lib/Haanga/tests/assert_templates/print_expr.tpl deleted file mode 100644 index f7afb9edca87330e089430e635d95b309851ef1d..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/print_expr.tpl +++ /dev/null @@ -1,4 +0,0 @@ -hi I'm {{ 1+1+b }} ! -{{ "hola"|title}} -hi I'm {{ 1+1+b|title }} ! -hi I'm {{ 1 > 2 ? 4 : 5 }} ! diff --git a/lib/Haanga/tests/assert_templates/regroup.html b/lib/Haanga/tests/assert_templates/regroup.html deleted file mode 100644 index a941bc2ab6f4137f4a354b284a4805971ab6c9f0..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/regroup.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - 22 - - 1-3-2 (1). Middle (first) - - 2-2-1 (1). Bar () - - 3-1-0 (1). Foo (last) - - - 23 - - 1-2-1 (2). Older Bar (first) - - 2-1-0 (2). Older Foo (last) - - diff --git a/lib/Haanga/tests/assert_templates/regroup.php b/lib/Haanga/tests/assert_templates/regroup.php deleted file mode 100644 index d885bd1659771d6f96b006d0a94b34d13f10e0ba..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/regroup.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -$data = array('users' => array( - array( - 'name' => 'foo', - 'age' => 22, - ), - array( - 'name' => 'Middle', - 'age' => 22, - ), - array( - 'name' => 'older Foo', - 'age' => 23, - ), - array( - 'name' => 'older Bar', - 'age' => 23, - ), - array( - 'name' => 'bar', - 'age' => 22, - ), -), 'regroup_by' => 'name'); diff --git a/lib/Haanga/tests/assert_templates/regroup.tpl b/lib/Haanga/tests/assert_templates/regroup.tpl deleted file mode 100644 index 196a795dcced88b475e5826b53e2a1229d968f51..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/regroup.tpl +++ /dev/null @@ -1,15 +0,0 @@ -{# Test regroup with filters, and without filters #} -{% regroup users|dictsort:regroup_by by age as sorted_users %} -{% dictsort users regroup_by as t_users %} -{% regroup t_users by age as sorted_users1 %} - -{% if sorted_users != sorted_users1 %} - Error -{% endif %} - -{% for user in sorted_users %} - {{user['grouper'] }} - {% for u in user['list'] %} - {{forloop.counter}}-{{forloop.revcounter}}-{{forloop.revcounter0}} ({{forloop.parentloop.counter}}). {{ u['name']|capfirst }} ({% if forloop.first %}first{% else %}{% if forloop.last %}last{% endif %}{% endif %}) - {% endfor %} -{% endfor %} diff --git a/lib/Haanga/tests/assert_templates/set.html b/lib/Haanga/tests/assert_templates/set.html deleted file mode 100644 index 8d55b15f1a9bcf598831b5d5d7c436dee87ab5a7..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/set.html +++ /dev/null @@ -1,5 +0,0 @@ - - -6 -testing - diff --git a/lib/Haanga/tests/assert_templates/set.tpl b/lib/Haanga/tests/assert_templates/set.tpl deleted file mode 100644 index fedc42171c5c8c7b228d0d9a9161a6f9a732aa7b..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/set.tpl +++ /dev/null @@ -1,4 +0,0 @@ -{% set foo = 5+1 %} -{% set bar = 'testing' %} -{{ foo }} -{% include "assert_templates/sub_set.tpl" %} diff --git a/lib/Haanga/tests/assert_templates/spaceless.html b/lib/Haanga/tests/assert_templates/spaceless.html deleted file mode 100644 index 5bd8e0eae80701f2095d296ea879a59dcaddc754..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/spaceless.html +++ /dev/null @@ -1,6 +0,0 @@ -<p><a href="foo/"> Foo </a></p> -=========================== -<b><pre> - Something cool - - </pre></b> diff --git a/lib/Haanga/tests/assert_templates/spaceless.tpl b/lib/Haanga/tests/assert_templates/spaceless.tpl deleted file mode 100644 index 205234a743e10ab6d49ace2c474bcda21cea8f2b..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/spaceless.tpl +++ /dev/null @@ -1,20 +0,0 @@ -{% spaceless %} -<p> - <a href="foo/"> Foo </a> - </p> {%endspaceless %} -=========================== -{% spaceless %} -<b> - <pre> - Something cool - - </pre> - - - - - - - - -</b> {% endspaceless %} diff --git a/lib/Haanga/tests/assert_templates/strip_whitespace.html b/lib/Haanga/tests/assert_templates/strip_whitespace.html deleted file mode 100644 index db2d5f95dbc00b4a240655675bf54abe04ea05f0..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/strip_whitespace.html +++ /dev/null @@ -1,7 +0,0 @@ - string string <b> Texto laargo </b> <pre> -Este es un texto - -con - espacios - -</pre> Another text diff --git a/lib/Haanga/tests/assert_templates/strip_whitespace.tpl b/lib/Haanga/tests/assert_templates/strip_whitespace.tpl deleted file mode 100644 index e20ac568073f832cd5e04c51b46fa3e59961bee4..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/strip_whitespace.tpl +++ /dev/null @@ -1,33 +0,0 @@ -{% if test_global %} -{% for i in test_global %} - {{ i }} {{ i }} -{%endfor %} - -{% endif %} - -<b> - - Texto laargo - - - -</b> - -{% spacefull %}<pre> -Este es un texto - -con - espacios - -</pre>{% endspacefull %} - - -Another - - - - - - - - text diff --git a/lib/Haanga/tests/assert_templates/sub_set.tpl b/lib/Haanga/tests/assert_templates/sub_set.tpl deleted file mode 100644 index 37c083f43a52c442773502c8042d7a78b0d6b981..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/sub_set.tpl +++ /dev/null @@ -1 +0,0 @@ -{{ bar }} diff --git a/lib/Haanga/tests/assert_templates/subtemplate.html b/lib/Haanga/tests/assert_templates/subtemplate.html deleted file mode 100644 index 4f38504f9547289435af740f43410f5cefd15c67..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/subtemplate.html +++ /dev/null @@ -1,24 +0,0 @@ -<html> -<head> - <title>My Title - Default Title</title> -</head> - -<body> - <h1>Menu</h1> - - - <ul> - - <li><a href="http://php.net/"><PHP></a></li> - - <li><a href="http://www.google.com/"><Google></a></li> - - </ul> - - - :-) - - Partial part - -</body> -</html> diff --git a/lib/Haanga/tests/assert_templates/subtemplate.php b/lib/Haanga/tests/assert_templates/subtemplate.php deleted file mode 100644 index 3f78cc7bb8dc9c9c11cc6a9f72e83ee927722f58..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/subtemplate.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -$data = array( - 'menu' => array( - array('url' => 'http://php.net/', 'name' => '<PHP>'), - array('url' => 'http://www.google.com/', 'name' => '<Google>'), - ) -); - diff --git a/lib/Haanga/tests/assert_templates/subtemplate.tpl b/lib/Haanga/tests/assert_templates/subtemplate.tpl deleted file mode 100644 index 90d42435d1f946130e4b6241d7359bbc30a6cb5c..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/subtemplate.tpl +++ /dev/null @@ -1,9 +0,0 @@ -{% extends "assert_templates/base.tpl" %} - -{% block title %}My Title - {{ block.super }}{% endblock %} - -{% block main.menu %} - {{ block.super}} - - :-) -{% endblock %} diff --git a/lib/Haanga/tests/assert_templates/templatetag.html b/lib/Haanga/tests/assert_templates/templatetag.html deleted file mode 100644 index 427757d20904f38113bdf0798ac30174f22a64f5..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/templatetag.html +++ /dev/null @@ -1,5 +0,0 @@ -{%foo%} -{%foo%} -{{foo}} -{foo} -{#foo#} diff --git a/lib/Haanga/tests/assert_templates/templatetag.tpl b/lib/Haanga/tests/assert_templates/templatetag.tpl deleted file mode 100644 index 5274d1edd011ab144cdf1d09f79ec6ff93053660..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/templatetag.tpl +++ /dev/null @@ -1,5 +0,0 @@ -{% templatetag openblock %}foo{%templatetag closeblock %} -{% templatetag "openblock" %}foo{%templatetag "closeblock" %} -{% templatetag openvariable %}foo{%templatetag closevariable %} -{% templatetag openbrace %}foo{%templatetag closebrace %} -{% templatetag opencomment %}foo{%templatetag closecomment %} diff --git a/lib/Haanga/tests/assert_templates/title.html b/lib/Haanga/tests/assert_templates/title.html deleted file mode 100644 index 557db03de997c86a4a028e1ebd3a1ceb225be238..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/title.html +++ /dev/null @@ -1 +0,0 @@ -Hello World diff --git a/lib/Haanga/tests/assert_templates/title.php b/lib/Haanga/tests/assert_templates/title.php deleted file mode 100644 index 279628709e289925cdba0fe80ea53baf751f5e9b..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/title.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -$data = array('title' => 'HELLO wOrld'); diff --git a/lib/Haanga/tests/assert_templates/title.tpl b/lib/Haanga/tests/assert_templates/title.tpl deleted file mode 100644 index 9a6e1da89183e2e83e2eb90f772460886b6f6adf..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/title.tpl +++ /dev/null @@ -1 +0,0 @@ -{{ title|title }} diff --git a/lib/Haanga/tests/assert_templates/trans.html b/lib/Haanga/tests/assert_templates/trans.html deleted file mode 100644 index 06363a2a7bc13ab994880ec6d255de7743c1a876..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/trans.html +++ /dev/null @@ -1,4 +0,0 @@ -Traducción -Traducción por cesar -hola -Hola diff --git a/lib/Haanga/tests/assert_templates/trans.php b/lib/Haanga/tests/assert_templates/trans.php deleted file mode 100644 index 3e7bd89fbc2033c99025a10dabb2020331d9d0a2..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/trans.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php -$data = array('text' => 'hello'); - -if (!is_callable('bindtextdomain')) { - throw new Exception('no gettext enabled'); -} - -$locale='en_US.utf8'; -putenv("LC_ALL=$locale"); -if (!setlocale(LC_ALL, $locale)) { - throw new Exception('no gettext enabled'); -} - -bindtextdomain("messages", dirname(__FILE__) . "/locale"); -textdomain("messages"); diff --git a/lib/Haanga/tests/assert_templates/trans.tpl b/lib/Haanga/tests/assert_templates/trans.tpl deleted file mode 100644 index 44d85c329caca58ca295f7d0d3264cb63b576714..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/trans.tpl +++ /dev/null @@ -1,4 +0,0 @@ -{% trans _("Translation") %} -{% trans _("Translation by %s") "cesar" %} -{{ text|trans }} -{{ text|translation|capfirst }} diff --git a/lib/Haanga/tests/assert_templates/truncatewords.html b/lib/Haanga/tests/assert_templates/truncatewords.html deleted file mode 100644 index 845439b0e71fec83dc2c7f1d5c8456c78cfbc945..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/truncatewords.html +++ /dev/null @@ -1,2 +0,0 @@ -Hello World<br/> -Hello Haanga ... diff --git a/lib/Haanga/tests/assert_templates/truncatewords.php b/lib/Haanga/tests/assert_templates/truncatewords.php deleted file mode 100644 index 46c3e63e3e3d5893e0a2810a6d5404b771f2b16f..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/truncatewords.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -$data = array( - 'short_text' => 'hello world<br/>', - 'text' => 'hello haanga world<br/>' -); diff --git a/lib/Haanga/tests/assert_templates/truncatewords.tpl b/lib/Haanga/tests/assert_templates/truncatewords.tpl deleted file mode 100644 index 6dd4bf02497d57e504062f78167f97520467e868..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/truncatewords.tpl +++ /dev/null @@ -1,2 +0,0 @@ -{{ short_text|truncatewords:2|title }} -{{ text|truncatewords:2|title }} diff --git a/lib/Haanga/tests/assert_templates/try_include.html b/lib/Haanga/tests/assert_templates/try_include.html deleted file mode 100644 index 523a059e3cac810d1c8de132116276d6aaf7d59d..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/try_include.html +++ /dev/null @@ -1,3 +0,0 @@ - -Partial part - diff --git a/lib/Haanga/tests/assert_templates/try_include.tpl b/lib/Haanga/tests/assert_templates/try_include.tpl deleted file mode 100644 index 6352d722ef535354094c844b6cbb0b5d44356506..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/try_include.tpl +++ /dev/null @@ -1,2 +0,0 @@ -{% try_include "foobar-tpl.tpl" %} -{% try_include "assert_templates/partial.tpl" %} diff --git a/lib/Haanga/tests/assert_templates/variable_existe.html b/lib/Haanga/tests/assert_templates/variable_existe.html deleted file mode 100644 index 2a77a60511bc8deb4c7a63682b20084a98a252e7..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/variable_existe.html +++ /dev/null @@ -1 +0,0 @@ - No diff --git a/lib/Haanga/tests/assert_templates/variable_existe.tpl b/lib/Haanga/tests/assert_templates/variable_existe.tpl deleted file mode 100644 index 7b793fd9323a9b722f2b8e1bfbd298e70091265f..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/variable_existe.tpl +++ /dev/null @@ -1 +0,0 @@ -{% if var.exists|default:"" %} Yes {% else %} No {% endif %} diff --git a/lib/Haanga/tests/assert_templates/with.html b/lib/Haanga/tests/assert_templates/with.html deleted file mode 100644 index de046157e7b5b6c31fbfa2f6f8ccaf3345bfc226..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/with.html +++ /dev/null @@ -1,9 +0,0 @@ - - - FOO == FOO - - - - OLDER FOO == OLDER FOO - - diff --git a/lib/Haanga/tests/assert_templates/with.php b/lib/Haanga/tests/assert_templates/with.php deleted file mode 100644 index 0863445f2d33cc99cb491b16c6d434c9c9a863af..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/with.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -$data = array('users' => array( - array( - 'name' => 'foo', - 'age' => 22, - ), - array( - 'name' => 'older Foo', - 'age' => 23, - ), -)); diff --git a/lib/Haanga/tests/assert_templates/with.tpl b/lib/Haanga/tests/assert_templates/with.tpl deleted file mode 100644 index aa91530a3f67e153af1cf1dc103cec779d1a2726..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/assert_templates/with.tpl +++ /dev/null @@ -1,5 +0,0 @@ -{% for user in users %} - {% with user.name as name %} - {{name|upper}} == {{user.name|upper}} - {% endwith %} -{% endfor %} diff --git a/lib/Haanga/tests/bootstrap.php b/lib/Haanga/tests/bootstrap.php deleted file mode 100644 index ab54a2a4d3bd988aa4ca50a1abc96117440236cf..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/bootstrap.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -require __DIR__ . '/../vendor/autoload.php'; - -$config = array( - 'cache_dir' => __DIR__ . '/tmp/', - 'autoload' => true, - 'template_dir' => __DIR__, - 'debug' => TRUE, - 'use_hash_filename' => FALSE, - 'compiler' => array( - 'allow_exec' => TRUE, - 'global' => array('test_global', 'global1'), - ) -); - -Haanga::Configure($config); - -date_default_timezone_set('UTC'); - -@mkdir(__DIR__ . "/tmp/"); -foreach (glob(__DIR__ . "/tmp/*/*") as $file) { - @unlink($file); -} diff --git a/lib/Haanga/tests/err_templates/block.tpl b/lib/Haanga/tests/err_templates/block.tpl deleted file mode 100644 index 28ba9c6d85323f4b9972bf23a7ecdfbf673ad4d4..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/block.tpl +++ /dev/null @@ -1 +0,0 @@ -{{ block.super }} diff --git a/lib/Haanga/tests/err_templates/block_nonparent.tpl b/lib/Haanga/tests/err_templates/block_nonparent.tpl deleted file mode 100644 index b9c0e022401b32209bf66e888a62bfacbcf92de0..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/block_nonparent.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{% block parent %} - {{ block.super }} -{% endblock %} diff --git a/lib/Haanga/tests/err_templates/block_super.tpl b/lib/Haanga/tests/err_templates/block_super.tpl deleted file mode 100644 index 28ba9c6d85323f4b9972bf23a7ecdfbf673ad4d4..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/block_super.tpl +++ /dev/null @@ -1 +0,0 @@ -{{ block.super }} diff --git a/lib/Haanga/tests/err_templates/block_super_filter.tpl b/lib/Haanga/tests/err_templates/block_super_filter.tpl deleted file mode 100644 index fa373c8b8503eb6e3ca7964b93fb873682101fd0..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/block_super_filter.tpl +++ /dev/null @@ -1,6 +0,0 @@ -{% extends "assert_templates/base.tpl" %} - -{% block menu %} - {{block.super|upper}} -{% endblock %} - diff --git a/lib/Haanga/tests/err_templates/block_super_nonsubtemplate.tpl b/lib/Haanga/tests/err_templates/block_super_nonsubtemplate.tpl deleted file mode 100644 index b9c0e022401b32209bf66e888a62bfacbcf92de0..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/block_super_nonsubtemplate.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{% block parent %} - {{ block.super }} -{% endblock %} diff --git a/lib/Haanga/tests/err_templates/dictsort.tpl b/lib/Haanga/tests/err_templates/dictsort.tpl deleted file mode 100644 index 7a329f6a2200c55b144fd0f631c68a34d00a2b3c..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/dictsort.tpl +++ /dev/null @@ -1 +0,0 @@ -{% dictsort foo "bar" %} diff --git a/lib/Haanga/tests/err_templates/dictsort1.tpl b/lib/Haanga/tests/err_templates/dictsort1.tpl deleted file mode 100644 index 0d35793e731951bbcde74097aac2384c819ddfa9..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/dictsort1.tpl +++ /dev/null @@ -1 +0,0 @@ -{% dictsort "foo" "bar" as bar %} diff --git a/lib/Haanga/tests/err_templates/dictsort2.tpl b/lib/Haanga/tests/err_templates/dictsort2.tpl deleted file mode 100644 index a5deff5ee6edce375e104a5c60ec3259c9a29e51..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/dictsort2.tpl +++ /dev/null @@ -1 +0,0 @@ -{% dictsort foo bar foo as bar %} diff --git a/lib/Haanga/tests/err_templates/err_block.tpl b/lib/Haanga/tests/err_templates/err_block.tpl deleted file mode 100644 index 28ba9c6d85323f4b9972bf23a7ecdfbf673ad4d4..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/err_block.tpl +++ /dev/null @@ -1 +0,0 @@ -{{ block.super }} diff --git a/lib/Haanga/tests/err_templates/err_block_nonparent.tpl b/lib/Haanga/tests/err_templates/err_block_nonparent.tpl deleted file mode 100644 index b9c0e022401b32209bf66e888a62bfacbcf92de0..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/err_block_nonparent.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{% block parent %} - {{ block.super }} -{% endblock %} diff --git a/lib/Haanga/tests/err_templates/err_block_super.tpl b/lib/Haanga/tests/err_templates/err_block_super.tpl deleted file mode 100644 index 28ba9c6d85323f4b9972bf23a7ecdfbf673ad4d4..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/err_block_super.tpl +++ /dev/null @@ -1 +0,0 @@ -{{ block.super }} diff --git a/lib/Haanga/tests/err_templates/err_block_super_filter.tpl b/lib/Haanga/tests/err_templates/err_block_super_filter.tpl deleted file mode 100644 index fa373c8b8503eb6e3ca7964b93fb873682101fd0..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/err_block_super_filter.tpl +++ /dev/null @@ -1,6 +0,0 @@ -{% extends "assert_templates/base.tpl" %} - -{% block menu %} - {{block.super|upper}} -{% endblock %} - diff --git a/lib/Haanga/tests/err_templates/err_block_super_nonsubtemplate.tpl b/lib/Haanga/tests/err_templates/err_block_super_nonsubtemplate.tpl deleted file mode 100644 index b9c0e022401b32209bf66e888a62bfacbcf92de0..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/err_block_super_nonsubtemplate.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{% block parent %} - {{ block.super }} -{% endblock %} diff --git a/lib/Haanga/tests/err_templates/err_dictsort.tpl b/lib/Haanga/tests/err_templates/err_dictsort.tpl deleted file mode 100644 index 7a329f6a2200c55b144fd0f631c68a34d00a2b3c..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/err_dictsort.tpl +++ /dev/null @@ -1 +0,0 @@ -{% dictsort foo "bar" %} diff --git a/lib/Haanga/tests/err_templates/err_dictsort1.tpl b/lib/Haanga/tests/err_templates/err_dictsort1.tpl deleted file mode 100644 index 0d35793e731951bbcde74097aac2384c819ddfa9..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/err_dictsort1.tpl +++ /dev/null @@ -1 +0,0 @@ -{% dictsort "foo" "bar" as bar %} diff --git a/lib/Haanga/tests/err_templates/err_dictsort2.tpl b/lib/Haanga/tests/err_templates/err_dictsort2.tpl deleted file mode 100644 index a5deff5ee6edce375e104a5c60ec3259c9a29e51..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/err_dictsort2.tpl +++ /dev/null @@ -1 +0,0 @@ -{% dictsort foo bar foo as bar %} diff --git a/lib/Haanga/tests/err_templates/err_forloop.tpl b/lib/Haanga/tests/err_templates/err_forloop.tpl deleted file mode 100644 index 2d91e44dec35755899702d2c6e4cb4c76b5aa615..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/err_forloop.tpl +++ /dev/null @@ -1,2 +0,0 @@ -{# Invalid forloop reference (outside of an loop) #} -{{ forloop.last }} diff --git a/lib/Haanga/tests/err_templates/err_forloop1.tpl b/lib/Haanga/tests/err_templates/err_forloop1.tpl deleted file mode 100644 index 32bad41e329baf86bd0e3df047750b7000647039..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/err_forloop1.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{% for i in array %} - {{ forloop.foobar }} -{% endfor %} diff --git a/lib/Haanga/tests/err_templates/err_ifchanged.tpl b/lib/Haanga/tests/err_templates/err_ifchanged.tpl deleted file mode 100644 index 8cf21cd5ef25b201e2a275a045d1c028cf7a0110..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/err_ifchanged.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{% ifchanged var1_ok "invalid" %} - -{% endifchanged %} diff --git a/lib/Haanga/tests/err_templates/err_invalid_blockname.tpl b/lib/Haanga/tests/err_templates/err_invalid_blockname.tpl deleted file mode 100644 index 22cabe85b0272f02b0d426f31cd0edef2565b232..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/err_invalid_blockname.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{% block invalid[blockname] %} - -{% endblock %} diff --git a/lib/Haanga/tests/err_templates/err_invalid_tryinclude.tpl b/lib/Haanga/tests/err_templates/err_invalid_tryinclude.tpl deleted file mode 100644 index 0b2cf0ffa07b660e3176dae23c762914d0fde62f..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/err_invalid_tryinclude.tpl +++ /dev/null @@ -1 +0,0 @@ -{% try_include "foobar.tpl" as foo %} diff --git a/lib/Haanga/tests/err_templates/err_load1.tpl b/lib/Haanga/tests/err_templates/err_load1.tpl deleted file mode 100644 index 6497454a02e806dcd6846c77b786ff489f4e07a4..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/err_load1.tpl +++ /dev/null @@ -1 +0,0 @@ -{% load "foobar.html" %} diff --git a/lib/Haanga/tests/err_templates/err_load2.tpl b/lib/Haanga/tests/err_templates/err_load2.tpl deleted file mode 100644 index df4aeffd08c3e9e640e558726c6a7a75b479f654..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/err_load2.tpl +++ /dev/null @@ -1 +0,0 @@ -{% load "../tests.sh" %} diff --git a/lib/Haanga/tests/err_templates/err_loop_varname.tpl b/lib/Haanga/tests/err_templates/err_loop_varname.tpl deleted file mode 100644 index 7fcc8454dd74d1b7c55defca466dc51a1cc903b5..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/err_loop_varname.tpl +++ /dev/null @@ -1,6 +0,0 @@ -{% extends "assert_templates/base.tpl" %} - -{% block foo %} - {% for i in block.super %} - {% endfor %} -{% endblock %} diff --git a/lib/Haanga/tests/err_templates/err_pluralize.tpl b/lib/Haanga/tests/err_templates/err_pluralize.tpl deleted file mode 100644 index 77097a244547356b7d5f3e5622a74bf492d9904a..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/err_pluralize.tpl +++ /dev/null @@ -1 +0,0 @@ -{{ var|pluralize:bar}} diff --git a/lib/Haanga/tests/err_templates/err_reverse.tpl b/lib/Haanga/tests/err_templates/err_reverse.tpl deleted file mode 100644 index dc2256be15c5b1a9262b4dc9b19ce16a3b4ccff2..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/err_reverse.tpl +++ /dev/null @@ -1 +0,0 @@ -{{ foo|reverse:"bar"}} diff --git a/lib/Haanga/tests/err_templates/err_templatetag1.tpl b/lib/Haanga/tests/err_templates/err_templatetag1.tpl deleted file mode 100644 index 00ee3c0d00d667cbf93e8a1e3aeba15266b6ca3d..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/err_templatetag1.tpl +++ /dev/null @@ -1 +0,0 @@ -{% templatetag invalid.name %} diff --git a/lib/Haanga/tests/err_templates/err_templatetag2.tpl b/lib/Haanga/tests/err_templates/err_templatetag2.tpl deleted file mode 100644 index 24c7f36ee61fd88048cbb9a37afd4ef70ce7215d..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/err_templatetag2.tpl +++ /dev/null @@ -1 +0,0 @@ -{% templatetag invalid args count %} diff --git a/lib/Haanga/tests/err_templates/err_templatetag3.tpl b/lib/Haanga/tests/err_templates/err_templatetag3.tpl deleted file mode 100644 index 08681ce650a5bcfc3a09c58c7cc511a1b14b600d..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/err_templatetag3.tpl +++ /dev/null @@ -1 +0,0 @@ -{% templatetag unknown_arg %} diff --git a/lib/Haanga/tests/err_templates/err_title.tpl b/lib/Haanga/tests/err_templates/err_title.tpl deleted file mode 100644 index 9877418e9d6db64042304e1a0d31b37873457e55..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/err_title.tpl +++ /dev/null @@ -1 +0,0 @@ -{{ foo|title:"another useless param"}} diff --git a/lib/Haanga/tests/err_templates/exec_notallowed.tpl b/lib/Haanga/tests/err_templates/exec_notallowed.tpl deleted file mode 100644 index 0b877b08aa3c65e2631b92ba31f3071498f59202..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/exec_notallowed.tpl +++ /dev/null @@ -1 +0,0 @@ -{% exec date %} diff --git a/lib/Haanga/tests/err_templates/forloop.tpl b/lib/Haanga/tests/err_templates/forloop.tpl deleted file mode 100644 index 2d91e44dec35755899702d2c6e4cb4c76b5aa615..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/forloop.tpl +++ /dev/null @@ -1,2 +0,0 @@ -{# Invalid forloop reference (outside of an loop) #} -{{ forloop.last }} diff --git a/lib/Haanga/tests/err_templates/forloop1.tpl b/lib/Haanga/tests/err_templates/forloop1.tpl deleted file mode 100644 index 32bad41e329baf86bd0e3df047750b7000647039..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/forloop1.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{% for i in array %} - {{ forloop.foobar }} -{% endfor %} diff --git a/lib/Haanga/tests/err_templates/ifchanged.tpl b/lib/Haanga/tests/err_templates/ifchanged.tpl deleted file mode 100644 index 8cf21cd5ef25b201e2a275a045d1c028cf7a0110..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/ifchanged.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{% ifchanged var1_ok "invalid" %} - -{% endifchanged %} diff --git a/lib/Haanga/tests/err_templates/inline1.tpl b/lib/Haanga/tests/err_templates/inline1.tpl deleted file mode 100644 index 619c4e60d753836417913be393807cab2562a906..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/inline1.tpl +++ /dev/null @@ -1 +0,0 @@ -{% inline "inexistent.tpl" %} diff --git a/lib/Haanga/tests/err_templates/inline2.tpl b/lib/Haanga/tests/err_templates/inline2.tpl deleted file mode 100644 index 38ef6c8404be27c29cca23bef45b4d7f09f093b0..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/inline2.tpl +++ /dev/null @@ -1 +0,0 @@ -{% inline "assert_templates/partial.tpl" as foobar %} diff --git a/lib/Haanga/tests/err_templates/inline3.tpl b/lib/Haanga/tests/err_templates/inline3.tpl deleted file mode 100644 index bb99f28ccece71e0cf5a6efe37a66788e976054a..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/inline3.tpl +++ /dev/null @@ -1 +0,0 @@ -{% inline foobar %} diff --git a/lib/Haanga/tests/err_templates/inline4.tpl b/lib/Haanga/tests/err_templates/inline4.tpl deleted file mode 100644 index 526822f5f74c24e2409b6bf03aadfaeeaa4d993f..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/inline4.tpl +++ /dev/null @@ -1 +0,0 @@ -{% inline foo bar %} diff --git a/lib/Haanga/tests/err_templates/inline5.tpl b/lib/Haanga/tests/err_templates/inline5.tpl deleted file mode 100644 index 30df2f44eb896689feab3cfdc38cbc4981addc2e..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/inline5.tpl +++ /dev/null @@ -1 +0,0 @@ -{% inline "assert_templates/subtemplate.tpl" %} diff --git a/lib/Haanga/tests/err_templates/invalid_blockname.tpl b/lib/Haanga/tests/err_templates/invalid_blockname.tpl deleted file mode 100644 index 22cabe85b0272f02b0d426f31cd0edef2565b232..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/invalid_blockname.tpl +++ /dev/null @@ -1,3 +0,0 @@ -{% block invalid[blockname] %} - -{% endblock %} diff --git a/lib/Haanga/tests/err_templates/loop_varname.tpl b/lib/Haanga/tests/err_templates/loop_varname.tpl deleted file mode 100644 index 7fcc8454dd74d1b7c55defca466dc51a1cc903b5..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/loop_varname.tpl +++ /dev/null @@ -1,6 +0,0 @@ -{% extends "assert_templates/base.tpl" %} - -{% block foo %} - {% for i in block.super %} - {% endfor %} -{% endblock %} diff --git a/lib/Haanga/tests/err_templates/pluralize.tpl b/lib/Haanga/tests/err_templates/pluralize.tpl deleted file mode 100644 index 77097a244547356b7d5f3e5622a74bf492d9904a..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/pluralize.tpl +++ /dev/null @@ -1 +0,0 @@ -{{ var|pluralize:bar}} diff --git a/lib/Haanga/tests/err_templates/reverse.tpl b/lib/Haanga/tests/err_templates/reverse.tpl deleted file mode 100644 index dc2256be15c5b1a9262b4dc9b19ce16a3b4ccff2..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/reverse.tpl +++ /dev/null @@ -1 +0,0 @@ -{{ foo|reverse:"bar"}} diff --git a/lib/Haanga/tests/err_templates/templatetag1.tpl b/lib/Haanga/tests/err_templates/templatetag1.tpl deleted file mode 100644 index 00ee3c0d00d667cbf93e8a1e3aeba15266b6ca3d..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/templatetag1.tpl +++ /dev/null @@ -1 +0,0 @@ -{% templatetag invalid.name %} diff --git a/lib/Haanga/tests/err_templates/templatetag2.tpl b/lib/Haanga/tests/err_templates/templatetag2.tpl deleted file mode 100644 index 24c7f36ee61fd88048cbb9a37afd4ef70ce7215d..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/templatetag2.tpl +++ /dev/null @@ -1 +0,0 @@ -{% templatetag invalid args count %} diff --git a/lib/Haanga/tests/err_templates/templatetag3.tpl b/lib/Haanga/tests/err_templates/templatetag3.tpl deleted file mode 100644 index 08681ce650a5bcfc3a09c58c7cc511a1b14b600d..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/templatetag3.tpl +++ /dev/null @@ -1 +0,0 @@ -{% templatetag unknown_arg %} diff --git a/lib/Haanga/tests/err_templates/title.tpl b/lib/Haanga/tests/err_templates/title.tpl deleted file mode 100644 index 9877418e9d6db64042304e1a0d31b37873457e55..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/title.tpl +++ /dev/null @@ -1 +0,0 @@ -{{ foo|title:"another useless param"}} diff --git a/lib/Haanga/tests/err_templates/tokenizer_1.tpl b/lib/Haanga/tests/err_templates/tokenizer_1.tpl deleted file mode 100644 index fc6fb1a7457dd022e7b662dd628994978a2d6c94..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/tokenizer_1.tpl +++ /dev/null @@ -1 +0,0 @@ -{{ foobar diff --git a/lib/Haanga/tests/err_templates/tokenizer_2.tpl b/lib/Haanga/tests/err_templates/tokenizer_2.tpl deleted file mode 100644 index 3abdb9c5722a73cd491e931791c28793c087c508..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/tokenizer_2.tpl +++ /dev/null @@ -1 +0,0 @@ -{{ 9foo }} diff --git a/lib/Haanga/tests/err_templates/tokenizer_3.tpl b/lib/Haanga/tests/err_templates/tokenizer_3.tpl deleted file mode 100644 index bb710cbf5efdfd79deea6bb4311b24bfc6d5e105..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/tokenizer_3.tpl +++ /dev/null @@ -1 +0,0 @@ -{{ 5.9.9 }} diff --git a/lib/Haanga/tests/err_templates/tokenizer_4.tpl b/lib/Haanga/tests/err_templates/tokenizer_4.tpl deleted file mode 100644 index 0383b20d8426d84e427ad143eb208c6131a48c07..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/tokenizer_4.tpl +++ /dev/null @@ -1 +0,0 @@ -{# comment and no end :P diff --git a/lib/Haanga/tests/err_templates/tokenizer_5.tpl b/lib/Haanga/tests/err_templates/tokenizer_5.tpl deleted file mode 100644 index 8043ee38035ae141f7e674ff7122e272530331bf..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/err_templates/tokenizer_5.tpl +++ /dev/null @@ -1 +0,0 @@ -{% if 5.9 + 5. == 10.9 %}True{% endif %} diff --git a/lib/Haanga/tests/errorTest.php b/lib/Haanga/tests/errorTest.php deleted file mode 100644 index e74e828d1971767c0c69ce7305d9c5d4f5681aa3..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/errorTest.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php - -/** - * @runTestsInSeparateProcess - */ -class errorTest extends PHPUnit_Framework_TestCase -{ - /** - * @dataProvider tplProvider - * - */ - public function testInvalidTemplates($tpl) - { - Haanga_Compiler::setOption('allow_exec', FALSE); - try { - Haanga::Load($tpl); - $this->assertTrue(FALSE); - } Catch (Haanga_Compiler_Exception $e) { - $i = preg_match("/in.*:[0-9]+/", $e->getMessage()); - $this->assertEquals(1, $i); - } - } - - public static function tplProvider() - { - $datas = array(); - foreach (glob(__DIR__ . "/err_templates/*.tpl") as $err_file) { - $datas[] = array(substr($err_file, strlen(__DIR__))); - } - - return $datas; - } - -} - diff --git a/lib/Haanga/tests/templateTest.php b/lib/Haanga/tests/templateTest.php deleted file mode 100644 index af1fd16dd112e7b165156a37fd7bbbac0f33e793..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/templateTest.php +++ /dev/null @@ -1,106 +0,0 @@ -<?php - -class Foo_Bar { - static $Bar = 'haanga'; - static $Arr = array('foo', 'Bar' => 'Foo'); - protected $foo = 'foo'; - public $bar = 'bar'; - - static function something() - { - return 'something'; - } - - function method() { - return $this->foo; - } - - function bar() { - return "something else"; - } -} - -/** - * @runTestsInSeparateProcess - */ -class templateTest extends PHPUnit_Framework_TestCase -{ - public function init($test_file, &$expected) - { - Haanga_Compiler::setOption('allow_exec', true); - if ($test_file === '/assert_templates/strip_whitespace.tpl') { - Haanga_Compiler::setOption('strip_whitespace', TRUE); - $expected = rtrim($expected). ' '; /* weird output */ - } else { - Haanga_Compiler::setOption('strip_whitespace', FALSE); - } - } - /** - * @dataProvider tplProvider - */ - public function testRuntime($test_file, $data, $expected) - { - $this->init($test_file, $expected); - $output = Haanga::Load($test_file, $data, TRUE); - $this->assertEquals($output, $expected); - $this->assertTrue(filemtime(__DIR__ . $test_file) <= filemtime(__DIR__ . '/tmp/assert_templates/' . basename($test_file) . '.php')); - } - - /** - * @dataProvider tplProvider - */ - public function testLambda($test_file, $data, $expected) - { - chdir(dirname(__DIR__ . '/' . $test_file)); - $this->init($test_file, $expected); - $callback = Haanga::compile(file_get_contents(__DIR__ . $test_file), $data); - $output = $callback($data); - $this->assertEquals($output, $expected); - } - - - /** - * @dataProvider tplProvider - */ - public function testIsCached($test_file, $data, $expected) - { - /* same as above, but we ensure that the file wasn't compiled */ - $this->init($test_file, $expected); - $output = Haanga::Load($test_file, $data, TRUE); - $this->assertEquals($output, $expected); - $this->assertFalse(Haanga::$has_compiled); - } - - public static function tplProvider() - { - $datas = array(); - foreach (glob(__DIR__ . "/assert_templates/*.tpl") as $test_file) { - $data = array(); - $data_file = substr($test_file, 0, -3)."php"; - $expected = substr($test_file, 0, -3)."html"; - $test_file = substr($test_file, strlen(__DIR__)); - if (!is_file($expected)) { - if (!is_file($expected.".php")) { - continue; - } - $expected .= ".php"; - ob_start(); - require $expected; - $expected = ob_get_clean(); - } else { - $expected = file_get_contents($expected); - } - - if (is_file($data_file)) { - try { - include $data_file; - } Catch (Exception $e) { - continue; - } - } - $datas[] = array($test_file, $data, $expected); - } - - return $datas; - } -} diff --git a/lib/Haanga/tests/tmp/assert_templates/autoescape.tpl.php b/lib/Haanga/tests/tmp/assert_templates/autoescape.tpl.php deleted file mode 100644 index 94f8db55c1671a42eb02b3a25c2686e8e0fb893f..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/autoescape.tpl.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/autoescape.tpl */ -function haanga_3b6900b2fc1304e5fbbae2d5df785169d9f530ee($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo htmlspecialchars($variable).' -'.htmlspecialchars($variable).' -{ '.$variable.' } - - '.$variable.' - - '.htmlspecialchars($variable).' - - -'.htmlspecialchars($variable).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/autoescape.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/autoescape.tpl.php.dump deleted file mode 100644 index 0a6f454e1efdb40d191be935313aee06ee596351..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/autoescape.tpl.php.dump +++ /dev/null @@ -1,370 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/autoescape.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_3b6900b2fc1304e5fbbae2d5df785169d9f530ee - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => variable - ) - - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => variable - ) - - ) - - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => -{ - ) - - ) - - [12] => Array - ( - [op] => print - [0] => Array - ( - [var] => variable - ) - - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => } - - ) - - ) - - [14] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [15] => Array - ( - [op] => print - [0] => Array - ( - [var] => variable - ) - - ) - - [16] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [17] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [18] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => variable - ) - - ) - - ) - - ) - - [19] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [20] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [21] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [22] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => variable - ) - - ) - - ) - - ) - - [23] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [24] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [25] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [26] => Array - ( - [op] => end_if - ) - - [27] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/autoescape.tpl */ -function haanga_3b6900b2fc1304e5fbbae2d5df785169d9f530ee($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo htmlspecialchars($variable).' -'.htmlspecialchars($variable).' -{ '.$variable.' } - - '.$variable.' - - '.htmlspecialchars($variable).' - - -'.htmlspecialchars($variable).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/base.tpl.php b/lib/Haanga/tests/tmp/assert_templates/base.tpl.php deleted file mode 100644 index 58ff94efa47fb634f4fccfc78852e6ebf5f21ab4..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/base.tpl.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/base.tpl */ -function haanga_d2f931b3242b3187b9a3d407f38c7d9d691df84f($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo '<html> -<head> - <title>'; - $buffer1 = 'Default Title'; - echo (isset($blocks['title']) ? (strpos($blocks['title'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['title'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['title'])) : $buffer1).'</title> -</head> - -<body> - <h1>Menu</h1> - '; - $buffer1 = ' - <ul> - '; - foreach ($menu as $item) { - $buffer1 .= ' - <li><a href="'.$item['url'].'">'.htmlspecialchars($item['name']).'</a></li> - '; - } - $buffer1 .= ' - </ul> - '; - echo (isset($blocks['main.menu']) ? (strpos($blocks['main.menu'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['main.menu'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['main.menu'])) : $buffer1).' - '; - $buffer1 = ''.Haanga::Load('assert_templates/partial.tpl', $vars, TRUE, $blocks); - echo (isset($blocks['main.include-end']) ? (strpos($blocks['main.include-end'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['main.include-end'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['main.include-end'])) : $buffer1).' -</body> -</html> -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/base.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/base.tpl.php.dump deleted file mode 100644 index 37f37f7f2782072c8a308809cbb793dd4af6d049..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/base.tpl.php.dump +++ /dev/null @@ -1,803 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/base.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_d2f931b3242b3187b9a3d407f38c7d9d691df84f - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [string] => <html> -<head> - <title> - ) - - ) - - [9] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [10] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => Default Title - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [expr_cond] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => title - ) - - ) - - ) - - ) - - ) - - [true] => Array - ( - [expr_cond] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => strpos - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => title - ) - - ) - - ) - - [1] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => title - ) - - ) - - ) - - [false] => Array - ( - [exec] => str_replace - [args] => Array - ( - [0] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - [1] => Array - ( - [var] => buffer1 - ) - - [2] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => title - ) - - ) - - ) - - ) - - ) - - ) - - [false] => Array - ( - [var] => buffer1 - ) - - ) - - ) - - [12] => Array - ( - [op] => print - [0] => Array - ( - [string] => </title> -</head> - -<body> - <h1>Menu</h1> - - ) - - ) - - [13] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [14] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - <ul> - - ) - - ) - - [15] => Array - ( - [op] => foreach - [array] => menu - [value] => item - ) - - [16] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - <li><a href=" - ) - - ) - - [17] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [var] => Array - ( - [0] => item - [1] => url - ) - - ) - - ) - - [18] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => "> - ) - - ) - - [19] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => item - [1] => name - ) - - ) - - ) - - ) - - ) - - [20] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => </a></li> - - ) - - ) - - [21] => Array - ( - [op] => end_foreach - ) - - [22] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - </ul> - - ) - - ) - - [23] => Array - ( - [op] => print - [0] => Array - ( - [expr_cond] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => main.menu - ) - - ) - - ) - - ) - - ) - - [true] => Array - ( - [expr_cond] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => strpos - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => main.menu - ) - - ) - - ) - - [1] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => main.menu - ) - - ) - - ) - - [false] => Array - ( - [exec] => str_replace - [args] => Array - ( - [0] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - [1] => Array - ( - [var] => buffer1 - ) - - [2] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => main.menu - ) - - ) - - ) - - ) - - ) - - ) - - [false] => Array - ( - [var] => buffer1 - ) - - ) - - ) - - [24] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [25] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [26] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [exec] => Haanga::Load - [args] => Array - ( - [0] => Array - ( - [string] => assert_templates/partial.tpl - ) - - [1] => Array - ( - [var] => vars - ) - - [2] => Array - ( - [expr] => 1 - ) - - [3] => Array - ( - [var] => blocks - ) - - ) - - ) - - ) - - [27] => Array - ( - [op] => print - [0] => Array - ( - [expr_cond] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => main.include-end - ) - - ) - - ) - - ) - - ) - - [true] => Array - ( - [expr_cond] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => strpos - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => main.include-end - ) - - ) - - ) - - [1] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => main.include-end - ) - - ) - - ) - - [false] => Array - ( - [exec] => str_replace - [args] => Array - ( - [0] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - [1] => Array - ( - [var] => buffer1 - ) - - [2] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => main.include-end - ) - - ) - - ) - - ) - - ) - - ) - - [false] => Array - ( - [var] => buffer1 - ) - - ) - - ) - - [28] => Array - ( - [op] => print - [0] => Array - ( - [string] => -</body> -</html> - - ) - - ) - - [29] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [30] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [31] => Array - ( - [op] => end_if - ) - - [32] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/base.tpl */ -function haanga_d2f931b3242b3187b9a3d407f38c7d9d691df84f($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo '<html> -<head> - <title>'; - $buffer1 = 'Default Title'; - echo (isset($blocks['title']) ? (strpos($blocks['title'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['title'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['title'])) : $buffer1).'</title> -</head> - -<body> - <h1>Menu</h1> - '; - $buffer1 = ' - <ul> - '; - foreach ($menu as $item) { - $buffer1 .= ' - <li><a href="'.$item['url'].'">'.htmlspecialchars($item['name']).'</a></li> - '; - } - $buffer1 .= ' - </ul> - '; - echo (isset($blocks['main.menu']) ? (strpos($blocks['main.menu'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['main.menu'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['main.menu'])) : $buffer1).' - '; - $buffer1 = ''.Haanga::Load('assert_templates/partial.tpl', $vars, TRUE, $blocks); - echo (isset($blocks['main.include-end']) ? (strpos($blocks['main.include-end'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['main.include-end'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['main.include-end'])) : $buffer1).' -</body> -</html> -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/bitwise.tpl.php b/lib/Haanga/tests/tmp/assert_templates/bitwise.tpl.php deleted file mode 100644 index fef2c2c1a0bcf28d1dd3e24e9df1e725cdb56947..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/bitwise.tpl.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/bitwise.tpl */ -function haanga_49e8d0a4f387f3c9583f254234500e05c2b533a2($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - if ((15 & 7) == 7) { - echo ' - Match -'; - } - echo ' -'; - if ((13 & 2) == 0) { - echo ' - Match -'; - } - echo ' -'; - if ((15 | 8) == 15) { - echo ' - Match -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/bitwise.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/bitwise.tpl.php.dump deleted file mode 100644 index 404ce5dcfe8601098bfdd260332aeb992fe316c2..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/bitwise.tpl.php.dump +++ /dev/null @@ -1,366 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/bitwise.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_49e8d0a4f387f3c9583f254234500e05c2b533a2 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [op_expr] => expr - [0] => Array - ( - [op_expr] => & - [0] => Array - ( - [number] => 15 - ) - - [1] => Array - ( - [number] => 7 - ) - - ) - - [1] => - ) - - [1] => Array - ( - [number] => 7 - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - Match - - ) - - ) - - [10] => Array - ( - [op] => end_if - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [12] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [op_expr] => expr - [0] => Array - ( - [op_expr] => & - [0] => Array - ( - [number] => 13 - ) - - [1] => Array - ( - [number] => 2 - ) - - ) - - [1] => - ) - - [1] => Array - ( - [number] => 0 - ) - - ) - - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - Match - - ) - - ) - - [14] => Array - ( - [op] => end_if - ) - - [15] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [16] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [op_expr] => expr - [0] => Array - ( - [op_expr] => | - [0] => Array - ( - [number] => 15 - ) - - [1] => Array - ( - [number] => 8 - ) - - ) - - [1] => - ) - - [1] => Array - ( - [number] => 15 - ) - - ) - - ) - - [17] => Array - ( - [op] => print - [0] => Array - ( - [string] => - Match - - ) - - ) - - [18] => Array - ( - [op] => end_if - ) - - [19] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [20] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [21] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [22] => Array - ( - [op] => end_if - ) - - [23] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/bitwise.tpl */ -function haanga_49e8d0a4f387f3c9583f254234500e05c2b533a2($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - if ((15 & 7) == 7) { - echo ' - Match -'; - } - echo ' -'; - if ((13 & 2) == 0) { - echo ' - Match -'; - } - echo ' -'; - if ((15 | 8) == 15) { - echo ' - Match -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/bug_001.tpl.php b/lib/Haanga/tests/tmp/assert_templates/bug_001.tpl.php deleted file mode 100644 index 1686985fb5a008c3f11a22a29f8389fffa964754..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/bug_001.tpl.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/bug_001.tpl */ -function haanga_715ccf083fda98adcfc4c99d2f583a6d19336adc($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo htmlspecialchars($date_end).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/bug_001.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/bug_001.tpl.php.dump deleted file mode 100644 index ce88db4591ca2b0a3bd158bbfc8b47238781b81c..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/bug_001.tpl.php.dump +++ /dev/null @@ -1,185 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/bug_001.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_715ccf083fda98adcfc4c99d2f583a6d19336adc - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => date_end - ) - - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [11] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [12] => Array - ( - [op] => end_if - ) - - [13] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/bug_001.tpl */ -function haanga_715ccf083fda98adcfc4c99d2f583a6d19336adc($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo htmlspecialchars($date_end).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/class_static.tpl.php b/lib/Haanga/tests/tmp/assert_templates/class_static.tpl.php deleted file mode 100644 index b51899a7f0aba161e0d19fce1428a48bba7c8f7a..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/class_static.tpl.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/class_static.tpl */ -function haanga_e5111161052e0480a9a2c62368c1510eb7d28820($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo htmlspecialchars(Foo_Bar::$Bar).' -'.htmlspecialchars(Foo_Bar::$Arr['0']).' -'.htmlspecialchars(Foo_Bar::$Arr['Bar']).' -'; - $foo = Foo_Bar::something(); - echo ' -'.htmlspecialchars($foo).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/class_static.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/class_static.tpl.php.dump deleted file mode 100644 index 26569c05400136cc125785441f1fc21d7bea58a7..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/class_static.tpl.php.dump +++ /dev/null @@ -1,345 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/class_static.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_e5111161052e0480a9a2c62368c1510eb7d28820 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => Foo_Bar - [1] => Array - ( - [class] => $Bar - ) - - ) - - ) - - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => Foo_Bar - [1] => Array - ( - [class] => $Arr - ) - - [2] => 0 - ) - - ) - - ) - - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [12] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => Foo_Bar - [1] => Array - ( - [class] => $Arr - ) - - [2] => Bar - ) - - ) - - ) - - ) - - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => declare - [name] => foo - [0] => Array - ( - [exec] => Array - ( - [0] => Foo_Bar - [1] => Array - ( - [class] => something - ) - - ) - - [args] => Array - ( - ) - - ) - - ) - - [15] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [16] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => foo - ) - - ) - - ) - - ) - - [17] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [18] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [19] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [20] => Array - ( - [op] => end_if - ) - - [21] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/class_static.tpl */ -function haanga_e5111161052e0480a9a2c62368c1510eb7d28820($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo htmlspecialchars(Foo_Bar::$Bar).' -'.htmlspecialchars(Foo_Bar::$Arr['0']).' -'.htmlspecialchars(Foo_Bar::$Arr['Bar']).' -'; - $foo = Foo_Bar::something(); - echo ' -'.htmlspecialchars($foo).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/concat.tpl.php b/lib/Haanga/tests/tmp/assert_templates/concat.tpl.php deleted file mode 100644 index 8b475edcac668e6fa557e0130c89d3dcb9c15cb1..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/concat.tpl.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/concat.tpl */ -function haanga_d4ac2b21a364b7d698afe669b918b6fdcc7d2396($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $bar = 'bar'; - $vars['bar'] = $bar; - echo ' -'; - $foo = ('foo' . 'bar' . $bar); - $vars['foo'] = $foo; - echo ' -'.htmlspecialchars($foo).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/concat.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/concat.tpl.php.dump deleted file mode 100644 index 3464df96ee4082baae874548641edd8c45d90f6b..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/concat.tpl.php.dump +++ /dev/null @@ -1,296 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/concat.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_d4ac2b21a364b7d698afe669b918b6fdcc7d2396 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => declare - [name] => bar - [0] => Array - ( - [string] => bar - ) - - ) - - [9] => Array - ( - [op] => declare - [name] => Array - ( - [0] => vars - [1] => Array - ( - [string] => bar - ) - - ) - - [0] => Array - ( - [var] => bar - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [11] => Array - ( - [op] => declare - [name] => foo - [0] => Array - ( - [op_expr] => . - [0] => Array - ( - [op_expr] => . - [0] => Array - ( - [string] => foo - ) - - [1] => Array - ( - [string] => bar - ) - - ) - - [1] => Array - ( - [var] => bar - ) - - ) - - ) - - [12] => Array - ( - [op] => declare - [name] => Array - ( - [0] => vars - [1] => Array - ( - [string] => foo - ) - - ) - - [0] => Array - ( - [var] => foo - ) - - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => foo - ) - - ) - - ) - - ) - - [15] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [16] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [17] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [18] => Array - ( - [op] => end_if - ) - - [19] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/concat.tpl */ -function haanga_d4ac2b21a364b7d698afe669b918b6fdcc7d2396($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $bar = 'bar'; - $vars['bar'] = $bar; - echo ' -'; - $foo = ('foo' . 'bar' . $bar); - $vars['foo'] = $foo; - echo ' -'.htmlspecialchars($foo).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/concat1.tpl.php b/lib/Haanga/tests/tmp/assert_templates/concat1.tpl.php deleted file mode 100644 index 8a4ec851ef86a7864a8a2e665cb6e50d1fb357f1..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/concat1.tpl.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/concat1.tpl */ -function haanga_11c8df5ae845da7ed78f1fb1c0bbb317bc451777($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - if ('foo' . 'bar' == 'foobar') { - echo ' - Match -'; - } else { - echo ' - Error -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/concat1.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/concat1.tpl.php.dump deleted file mode 100644 index 70f453953a13721ef6d459198bfb35f5ad727091..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/concat1.tpl.php.dump +++ /dev/null @@ -1,239 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/concat1.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_11c8df5ae845da7ed78f1fb1c0bbb317bc451777 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [op_expr] => . - [0] => Array - ( - [string] => foo - ) - - [1] => Array - ( - [string] => bar - ) - - ) - - [1] => Array - ( - [string] => foobar - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - Match - - ) - - ) - - [10] => Array - ( - [op] => else - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - Error - - ) - - ) - - [12] => Array - ( - [op] => end_if - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [15] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [16] => Array - ( - [op] => end_if - ) - - [17] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/concat1.tpl */ -function haanga_11c8df5ae845da7ed78f1fb1c0bbb317bc451777($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - if ('foo' . 'bar' == 'foobar') { - echo ' - Match -'; - } else { - echo ' - Error -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/custom_tag.tpl.php b/lib/Haanga/tests/tmp/assert_templates/custom_tag.tpl.php deleted file mode 100644 index b524d2b6b0d083bee5166c1d7d3af22dc372b333..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/custom_tag.tpl.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/custom_tag.tpl */ -function haanga_d10dbccd9d65b519706f053a50a078dbb3e14070($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo date('Y').' -'; - $foo = date('U'); - echo htmlspecialchars(date('Y', $foo)).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/custom_tag.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/custom_tag.tpl.php.dump deleted file mode 100644 index bbe36899f877b1386968aa2411a2539262ae54d9..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/custom_tag.tpl.php.dump +++ /dev/null @@ -1,252 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/custom_tag.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_d10dbccd9d65b519706f053a50a078dbb3e14070 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [exec] => date - [args] => Array - ( - [0] => Array - ( - [string] => Y - ) - - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => declare - [name] => foo - [0] => Array - ( - [exec] => date - [args] => Array - ( - [0] => Array - ( - [string] => U - ) - - ) - - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [exec] => date - [args] => Array - ( - [0] => Array - ( - [string] => Y - ) - - [1] => Array - ( - [var] => foo - ) - - ) - - ) - - ) - - ) - - ) - - [12] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [13] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [14] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [15] => Array - ( - [op] => end_if - ) - - [16] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/custom_tag.tpl */ -function haanga_d10dbccd9d65b519706f053a50a078dbb3e14070($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo date('Y').' -'; - $foo = date('U'); - echo htmlspecialchars(date('Y', $foo)).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/cycle.tpl.php b/lib/Haanga/tests/tmp/assert_templates/cycle.tpl.php deleted file mode 100644 index 30841dcea870846740635bef836666568d671291..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/cycle.tpl.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/cycle.tpl */ -function haanga_ce9ab0a21d381cdfd181f6d4b9c01a720d4c7320($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - foreach ($array as $user) { - echo ' - '; - if (isset($def_cycle_0) == FALSE) { - $def_cycle_0 = Array('uno', 'dos', 'tres'); - } - $index_0 = (isset($index_0) == FALSE ? 0 : (($index_0 + 1) % count($def_cycle_0))); - echo $def_cycle_0[$index_0].' -'; - } - echo ' ------------------------------------------------ -'; - $def_cycle_1 = Array('uno', 'dos', 'tres'); - $index_1 = -1; - echo ' -'; - $index_1 = (($index_1 + 1) % count($def_cycle_1)); - echo $def_cycle_1[$index_1].' -'; - $index_1 = (($index_1 + 1) % count($def_cycle_1)); - echo $def_cycle_1[$index_1].' -'; - $index_1 = (($index_1 + 1) % count($def_cycle_1)); - echo $def_cycle_1[$index_1].' -'; - $index_1 = (($index_1 + 1) % count($def_cycle_1)); - echo $def_cycle_1[$index_1].' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/cycle.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/cycle.tpl.php.dump deleted file mode 100644 index 92cfeb7555478ec53d9c52698902a2c7839cf4d4..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/cycle.tpl.php.dump +++ /dev/null @@ -1,744 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/cycle.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_ce9ab0a21d381cdfd181f6d4b9c01a720d4c7320 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => foreach - [array] => array - [value] => user - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => def_cycle_0 - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - ) - - [11] => Array - ( - [op] => declare - [name] => def_cycle_0 - [0] => Array - ( - [array] => Array - ( - [0] => Array - ( - [string] => uno - ) - - [1] => Array - ( - [string] => dos - ) - - [2] => Array - ( - [string] => tres - ) - - ) - - ) - - ) - - [12] => Array - ( - [op] => end_if - ) - - [13] => Array - ( - [op] => declare - [name] => index_0 - [0] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => index_0 - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [number] => 0 - ) - - [false] => Array - ( - [op_expr] => % - [0] => Array - ( - [op_expr] => expr - [0] => Array - ( - [op_expr] => + - [0] => Array - ( - [var] => index_0 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - [1] => - ) - - [1] => Array - ( - [exec] => count - [args] => Array - ( - [0] => Array - ( - [var] => def_cycle_0 - ) - - ) - - ) - - ) - - ) - - ) - - [14] => Array - ( - [op] => print - [0] => Array - ( - [var] => Array - ( - [0] => def_cycle_0 - [1] => Array - ( - [var] => index_0 - ) - - ) - - ) - - ) - - [15] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [16] => Array - ( - [op] => end_foreach - ) - - [17] => Array - ( - [op] => print - [0] => Array - ( - [string] => ------------------------------------------------ - - ) - - ) - - [18] => Array - ( - [op] => declare - [name] => def_cycle_1 - [0] => Array - ( - [array] => Array - ( - [0] => Array - ( - [string] => uno - ) - - [1] => Array - ( - [string] => dos - ) - - [2] => Array - ( - [string] => tres - ) - - ) - - ) - - ) - - [19] => Array - ( - [op] => declare - [name] => index_1 - [0] => Array - ( - [number] => -1 - ) - - ) - - [20] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [21] => Array - ( - [op] => declare - [name] => index_1 - [0] => Array - ( - [op_expr] => % - [0] => Array - ( - [op_expr] => expr - [0] => Array - ( - [op_expr] => + - [0] => Array - ( - [var] => index_1 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - [1] => - ) - - [1] => Array - ( - [exec] => count - [args] => Array - ( - [0] => Array - ( - [var] => def_cycle_1 - ) - - ) - - ) - - ) - - ) - - [22] => Array - ( - [op] => print - [0] => Array - ( - [var] => Array - ( - [0] => def_cycle_1 - [1] => Array - ( - [var] => index_1 - ) - - ) - - ) - - ) - - [23] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [24] => Array - ( - [op] => declare - [name] => index_1 - [0] => Array - ( - [op_expr] => % - [0] => Array - ( - [op_expr] => expr - [0] => Array - ( - [op_expr] => + - [0] => Array - ( - [var] => index_1 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - [1] => - ) - - [1] => Array - ( - [exec] => count - [args] => Array - ( - [0] => Array - ( - [var] => def_cycle_1 - ) - - ) - - ) - - ) - - ) - - [25] => Array - ( - [op] => print - [0] => Array - ( - [var] => Array - ( - [0] => def_cycle_1 - [1] => Array - ( - [var] => index_1 - ) - - ) - - ) - - ) - - [26] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [27] => Array - ( - [op] => declare - [name] => index_1 - [0] => Array - ( - [op_expr] => % - [0] => Array - ( - [op_expr] => expr - [0] => Array - ( - [op_expr] => + - [0] => Array - ( - [var] => index_1 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - [1] => - ) - - [1] => Array - ( - [exec] => count - [args] => Array - ( - [0] => Array - ( - [var] => def_cycle_1 - ) - - ) - - ) - - ) - - ) - - [28] => Array - ( - [op] => print - [0] => Array - ( - [var] => Array - ( - [0] => def_cycle_1 - [1] => Array - ( - [var] => index_1 - ) - - ) - - ) - - ) - - [29] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [30] => Array - ( - [op] => declare - [name] => index_1 - [0] => Array - ( - [op_expr] => % - [0] => Array - ( - [op_expr] => expr - [0] => Array - ( - [op_expr] => + - [0] => Array - ( - [var] => index_1 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - [1] => - ) - - [1] => Array - ( - [exec] => count - [args] => Array - ( - [0] => Array - ( - [var] => def_cycle_1 - ) - - ) - - ) - - ) - - ) - - [31] => Array - ( - [op] => print - [0] => Array - ( - [var] => Array - ( - [0] => def_cycle_1 - [1] => Array - ( - [var] => index_1 - ) - - ) - - ) - - ) - - [32] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [33] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [34] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [35] => Array - ( - [op] => end_if - ) - - [36] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/cycle.tpl */ -function haanga_ce9ab0a21d381cdfd181f6d4b9c01a720d4c7320($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - foreach ($array as $user) { - echo ' - '; - if (isset($def_cycle_0) == FALSE) { - $def_cycle_0 = Array('uno', 'dos', 'tres'); - } - $index_0 = (isset($index_0) == FALSE ? 0 : (($index_0 + 1) % count($def_cycle_0))); - echo $def_cycle_0[$index_0].' -'; - } - echo ' ------------------------------------------------ -'; - $def_cycle_1 = Array('uno', 'dos', 'tres'); - $index_1 = -1; - echo ' -'; - $index_1 = (($index_1 + 1) % count($def_cycle_1)); - echo $def_cycle_1[$index_1].' -'; - $index_1 = (($index_1 + 1) % count($def_cycle_1)); - echo $def_cycle_1[$index_1].' -'; - $index_1 = (($index_1 + 1) % count($def_cycle_1)); - echo $def_cycle_1[$index_1].' -'; - $index_1 = (($index_1 + 1) % count($def_cycle_1)); - echo $def_cycle_1[$index_1].' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/dummy.tpl.php b/lib/Haanga/tests/tmp/assert_templates/dummy.tpl.php deleted file mode 100644 index f464767386661d3d4668df7d1f67384da57c9c75..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/dummy.tpl.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php -/* Load tag dummy definition */ -require_once('/home/crodas/projects/playground/haanga/contrib/dummy.php'); -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/dummy.tpl */ -function haanga_d2345f9cf4a619dac02b83afccf7c2e1c4530687($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo ' -'; - $buffer1 = ' - testing DUMMY TaG -'; - echo Haanga_Extension_Tag_Dummy::main($buffer1).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/dummy.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/dummy.tpl.php.dump deleted file mode 100644 index b1deb34b04f544693027adc6630bae5eb041968f..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/dummy.tpl.php.dump +++ /dev/null @@ -1,252 +0,0 @@ -Array -( - [0] => Array - ( - [op] => comment - [comment] => Load tag dummy definition - ) - - [1] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => require_once - [args] => Array - ( - [0] => Array - ( - [string] => /home/crodas/projects/playground/haanga/contrib/dummy.php - ) - - ) - - ) - - ) - - [2] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [3] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/dummy.tpl - ) - - [4] => Array - ( - [op] => function - [name] => haanga_d2345f9cf4a619dac02b83afccf7c2e1c4530687 - ) - - [5] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [7] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [8] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [9] => Array - ( - [op] => end_if - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [11] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [12] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - testing DUMMY TaG - - ) - - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [exec] => Haanga_Extension_Tag_Dummy::main - [args] => Array - ( - [0] => Array - ( - [var] => buffer1 - ) - - ) - - ) - - ) - - [14] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [15] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [16] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [17] => Array - ( - [op] => end_if - ) - - [18] => Array - ( - [op] => end_function - ) - - [php] => -/* Load tag dummy definition */ -require_once('/home/crodas/projects/playground/haanga/contrib/dummy.php'); -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/dummy.tpl */ -function haanga_d2345f9cf4a619dac02b83afccf7c2e1c4530687($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo ' -'; - $buffer1 = ' - testing DUMMY TaG -'; - echo Haanga_Extension_Tag_Dummy::main($buffer1).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/empty_block.tpl.php b/lib/Haanga/tests/tmp/assert_templates/empty_block.tpl.php deleted file mode 100644 index 96d98f557247aafd77f5a9e283fbe84607292923..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/empty_block.tpl.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/empty_block.tpl */ -function haanga_464bf9fc69ec3d748e58e59c7b427e138da5ab9b($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $buffer1 = ' -'; - $buffer2 = ' -this is inner1 -'; - $blocks['inner1'] = (isset($blocks['inner1']) ? (strpos($blocks['inner1'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['inner1'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer2, $blocks['inner1'])) : $buffer2); - $buffer1 .= $blocks['inner1'].' -'; - $buffer2 = ' -this is inner2 -'; - $blocks['inner2'] = (isset($blocks['inner2']) ? (strpos($blocks['inner2'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['inner2'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer2, $blocks['inner2'])) : $buffer2); - $buffer1 .= $blocks['inner2'].' -'; - $blocks['outer'] = (isset($blocks['outer']) ? (strpos($blocks['outer'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['outer'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['outer'])) : $buffer1); - echo Haanga::Load('assert_templates/empty_block_base.tpl', $vars, TRUE, $blocks); - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/empty_block.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/empty_block.tpl.php.dump deleted file mode 100644 index ad086552345e0d42f946c04739d7e09552ceafc7..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/empty_block.tpl.php.dump +++ /dev/null @@ -1,746 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/empty_block.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_464bf9fc69ec3d748e58e59c7b427e138da5ab9b - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [9] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => declare - [name] => buffer2 - [0] => Array - ( - [string] => - ) - - ) - - [11] => Array - ( - [op] => append_var - [name] => buffer2 - [0] => Array - ( - [string] => -this is inner1 - - ) - - ) - - [12] => Array - ( - [op] => declare - [name] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner1 - ) - - ) - - [0] => Array - ( - [expr_cond] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner1 - ) - - ) - - ) - - ) - - ) - - [true] => Array - ( - [expr_cond] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => strpos - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner1 - ) - - ) - - ) - - [1] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner1 - ) - - ) - - ) - - [false] => Array - ( - [exec] => str_replace - [args] => Array - ( - [0] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - [1] => Array - ( - [var] => buffer2 - ) - - [2] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner1 - ) - - ) - - ) - - ) - - ) - - ) - - [false] => Array - ( - [var] => buffer2 - ) - - ) - - ) - - [13] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner1 - ) - - ) - - ) - - ) - - [14] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [15] => Array - ( - [op] => declare - [name] => buffer2 - [0] => Array - ( - [string] => - ) - - ) - - [16] => Array - ( - [op] => append_var - [name] => buffer2 - [0] => Array - ( - [string] => -this is inner2 - - ) - - ) - - [17] => Array - ( - [op] => declare - [name] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2 - ) - - ) - - [0] => Array - ( - [expr_cond] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2 - ) - - ) - - ) - - ) - - ) - - [true] => Array - ( - [expr_cond] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => strpos - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2 - ) - - ) - - ) - - [1] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2 - ) - - ) - - ) - - [false] => Array - ( - [exec] => str_replace - [args] => Array - ( - [0] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - [1] => Array - ( - [var] => buffer2 - ) - - [2] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2 - ) - - ) - - ) - - ) - - ) - - ) - - [false] => Array - ( - [var] => buffer2 - ) - - ) - - ) - - [18] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2 - ) - - ) - - ) - - ) - - [19] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [20] => Array - ( - [op] => declare - [name] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - [0] => Array - ( - [expr_cond] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - ) - - ) - - ) - - [true] => Array - ( - [expr_cond] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => strpos - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - ) - - [1] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - ) - - [false] => Array - ( - [exec] => str_replace - [args] => Array - ( - [0] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - [1] => Array - ( - [var] => buffer1 - ) - - [2] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - ) - - ) - - ) - - ) - - [false] => Array - ( - [var] => buffer1 - ) - - ) - - ) - - [21] => Array - ( - [op] => print - [0] => Array - ( - [exec] => Haanga::Load - [args] => Array - ( - [0] => Array - ( - [string] => assert_templates/empty_block_base.tpl - ) - - [1] => Array - ( - [var] => vars - ) - - [2] => Array - ( - [expr] => 1 - ) - - [3] => Array - ( - [var] => blocks - ) - - ) - - ) - - ) - - [22] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [23] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [24] => Array - ( - [op] => end_if - ) - - [25] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/empty_block.tpl */ -function haanga_464bf9fc69ec3d748e58e59c7b427e138da5ab9b($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $buffer1 = ' -'; - $buffer2 = ' -this is inner1 -'; - $blocks['inner1'] = (isset($blocks['inner1']) ? (strpos($blocks['inner1'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['inner1'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer2, $blocks['inner1'])) : $buffer2); - $buffer1 .= $blocks['inner1'].' -'; - $buffer2 = ' -this is inner2 -'; - $blocks['inner2'] = (isset($blocks['inner2']) ? (strpos($blocks['inner2'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['inner2'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer2, $blocks['inner2'])) : $buffer2); - $buffer1 .= $blocks['inner2'].' -'; - $blocks['outer'] = (isset($blocks['outer']) ? (strpos($blocks['outer'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['outer'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['outer'])) : $buffer1); - echo Haanga::Load('assert_templates/empty_block_base.tpl', $vars, TRUE, $blocks); - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/empty_block_base.tpl.php b/lib/Haanga/tests/tmp/assert_templates/empty_block_base.tpl.php deleted file mode 100644 index 7029ea8c8ff61baca39b183d467e79604ae4e095..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/empty_block_base.tpl.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/empty_block_base.tpl */ -function haanga_2528569ca0e05d02c2082a15590d5d42ee692207($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo 'bar -'; - $buffer1 = ''; - echo (isset($blocks['outer']) ? (strpos($blocks['outer'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['outer'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['outer'])) : $buffer1).' -foo -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/empty_block_base.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/empty_block_base.tpl.php.dump deleted file mode 100644 index e1737f5f19da3c34ca56362e198e8169647b81fc..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/empty_block_base.tpl.php.dump +++ /dev/null @@ -1,319 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/empty_block_base.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_2528569ca0e05d02c2082a15590d5d42ee692207 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [string] => bar - - ) - - ) - - [9] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [expr_cond] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - ) - - ) - - ) - - [true] => Array - ( - [expr_cond] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => strpos - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - ) - - [1] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - ) - - [false] => Array - ( - [exec] => str_replace - [args] => Array - ( - [0] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - [1] => Array - ( - [var] => buffer1 - ) - - [2] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - ) - - ) - - ) - - ) - - [false] => Array - ( - [var] => buffer1 - ) - - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => -foo - - ) - - ) - - [12] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [13] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [14] => Array - ( - [op] => end_if - ) - - [15] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/empty_block_base.tpl */ -function haanga_2528569ca0e05d02c2082a15590d5d42ee692207($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo 'bar -'; - $buffer1 = ''; - echo (isset($blocks['outer']) ? (strpos($blocks['outer'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['outer'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['outer'])) : $buffer1).' -foo -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/empty_loop.tpl.php b/lib/Haanga/tests/tmp/assert_templates/empty_loop.tpl.php deleted file mode 100644 index 6fa33b2661403bf40a3bc9cdec983d58435ba59f..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/empty_loop.tpl.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/empty_loop.tpl */ -function haanga_b81b868120adb871819ede8f37c652aea054b73d($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - if (count($users) == 0) { - echo ' - Else -'; - } else { - $forcounter1_1 = 1; - $forcounter0_1 = 0; - $psize_1 = count($users); - $islast_1 = ($forcounter1_1 == $psize_1); - foreach ($users as $id => $user) { - echo ' - '.$islast_1.' - '.$forcounter0_1.' - Inside loop -'; - $forcounter1_1 = ($forcounter1_1 + 1); - $forcounter0_1 = ($forcounter0_1 + 1); - $islast_1 = ($forcounter1_1 == $psize_1); - } - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/empty_loop.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/empty_loop.tpl.php.dump deleted file mode 100644 index 1f183b8fcead235d8bcf1499cd510b38521fa308..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/empty_loop.tpl.php.dump +++ /dev/null @@ -1,434 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/empty_loop.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_b81b868120adb871819ede8f37c652aea054b73d - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => count - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => users - ) - - ) - - ) - - ) - - [1] => Array - ( - [number] => 0 - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - Else - - ) - - ) - - [10] => Array - ( - [op] => else - ) - - [11] => Array - ( - [op] => declare - [name] => forcounter1_1 - [0] => Array - ( - [number] => 1 - ) - - ) - - [12] => Array - ( - [op] => declare - [name] => forcounter0_1 - [0] => Array - ( - [number] => 0 - ) - - ) - - [13] => Array - ( - [op] => declare - [name] => psize_1 - [0] => Array - ( - [exec] => count - [args] => Array - ( - [0] => Array - ( - [var] => users - ) - - ) - - ) - - ) - - [14] => Array - ( - [op] => declare - [name] => islast_1 - [0] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => forcounter1_1 - ) - - [1] => Array - ( - [var] => psize_1 - ) - - ) - - ) - - [15] => Array - ( - [op] => foreach - [array] => users - [value] => user - [key] => id - ) - - [16] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [17] => Array - ( - [op] => print - [0] => Array - ( - [var] => islast_1 - ) - - ) - - [18] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [19] => Array - ( - [op] => print - [0] => Array - ( - [var] => forcounter0_1 - ) - - ) - - [20] => Array - ( - [op] => print - [0] => Array - ( - [string] => - Inside loop - - ) - - ) - - [21] => Array - ( - [op] => declare - [name] => forcounter1_1 - [0] => Array - ( - [op_expr] => + - [0] => Array - ( - [var] => forcounter1_1 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - ) - - [22] => Array - ( - [op] => declare - [name] => forcounter0_1 - [0] => Array - ( - [op_expr] => + - [0] => Array - ( - [var] => forcounter0_1 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - ) - - [23] => Array - ( - [op] => declare - [name] => islast_1 - [0] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => forcounter1_1 - ) - - [1] => Array - ( - [var] => psize_1 - ) - - ) - - ) - - [24] => Array - ( - [op] => end_foreach - ) - - [25] => Array - ( - [op] => end_if - ) - - [26] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [27] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [28] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [29] => Array - ( - [op] => end_if - ) - - [30] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/empty_loop.tpl */ -function haanga_b81b868120adb871819ede8f37c652aea054b73d($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - if (count($users) == 0) { - echo ' - Else -'; - } else { - $forcounter1_1 = 1; - $forcounter0_1 = 0; - $psize_1 = count($users); - $islast_1 = ($forcounter1_1 == $psize_1); - foreach ($users as $id => $user) { - echo ' - '.$islast_1.' - '.$forcounter0_1.' - Inside loop -'; - $forcounter1_1 = ($forcounter1_1 + 1); - $forcounter0_1 = ($forcounter0_1 + 1); - $islast_1 = ($forcounter1_1 == $psize_1); - } - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/exec.tpl.php b/lib/Haanga/tests/tmp/assert_templates/exec.tpl.php deleted file mode 100644 index 15eefb8f5649cb9ff729fe2463104f3697083d97..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/exec.tpl.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/exec.tpl */ -function haanga_dd5c8878b71dd3298b301bb14c576dd0b842f320($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo php_uname().' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/exec.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/exec.tpl.php.dump deleted file mode 100644 index 3497b6893a5d428d23275cfcc86d2ec0609b2070..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/exec.tpl.php.dump +++ /dev/null @@ -1,180 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/exec.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_dd5c8878b71dd3298b301bb14c576dd0b842f320 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [exec] => php_uname - [args] => Array - ( - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [11] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [12] => Array - ( - [op] => end_if - ) - - [13] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/exec.tpl */ -function haanga_dd5c8878b71dd3298b301bb14c576dd0b842f320($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo php_uname().' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/filter.tpl.php b/lib/Haanga/tests/tmp/assert_templates/filter.tpl.php deleted file mode 100644 index 9afbf8da44f65d03203908345f6b75527f956785..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/filter.tpl.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/filter.tpl */ -function haanga_7c948c919295fb106667df66f458e608eb775422($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo htmlspecialchars(strtoupper($var)).' -'.htmlspecialchars(strtolower(strtoupper($var))).' -'.htmlspecialchars(str_replace('u', '', $var)).' -'.strlen($var).' -'.htmlspecialchars(strtoupper((empty($foobar) == TRUE ? 'default value' : $foobar))).' -'; - $buffer1 = ' - hola que -'; - echo strtoupper($buffer1).' -'; - $buffer1 = 'TAL'; - echo strtolower($buffer1).' -'; - $buffer1 = ' - hello world -'; - echo str_replace('e', '', strtolower(strtoupper($buffer1))).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/filter.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/filter.tpl.php.dump deleted file mode 100644 index 54e080da3da69b1a4b0f1c3d6676dca35961f5dd..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/filter.tpl.php.dump +++ /dev/null @@ -1,598 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/filter.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_7c948c919295fb106667df66f458e608eb775422 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [exec] => strtoupper - [args] => Array - ( - [0] => Array - ( - [var] => var - ) - - ) - - ) - - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [exec] => strtolower - [args] => Array - ( - [0] => Array - ( - [exec] => strtoupper - [args] => Array - ( - [0] => Array - ( - [var] => var - ) - - ) - - ) - - ) - - ) - - ) - - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [12] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [exec] => str_replace - [args] => Array - ( - [0] => Array - ( - [string] => u - ) - - [1] => Array - ( - [string] => - ) - - [2] => Array - ( - [var] => var - ) - - ) - - ) - - ) - - ) - - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => print - [0] => Array - ( - [exec] => strlen - [args] => Array - ( - [0] => Array - ( - [var] => var - ) - - ) - - ) - - ) - - [15] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [16] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [exec] => strtoupper - [args] => Array - ( - [0] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => foobar - ) - - ) - - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - [true] => Array - ( - [string] => default value - ) - - [false] => Array - ( - [var] => foobar - ) - - ) - - ) - - ) - - ) - - ) - - ) - - [17] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [18] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [19] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - hola que - - ) - - ) - - [20] => Array - ( - [op] => print - [0] => Array - ( - [exec] => strtoupper - [args] => Array - ( - [0] => Array - ( - [var] => buffer1 - ) - - ) - - ) - - ) - - [21] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [22] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [23] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => TAL - ) - - ) - - [24] => Array - ( - [op] => print - [0] => Array - ( - [exec] => strtolower - [args] => Array - ( - [0] => Array - ( - [var] => buffer1 - ) - - ) - - ) - - ) - - [25] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [26] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [27] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - hello world - - ) - - ) - - [28] => Array - ( - [op] => print - [0] => Array - ( - [exec] => str_replace - [args] => Array - ( - [0] => Array - ( - [string] => e - ) - - [1] => Array - ( - [string] => - ) - - [2] => Array - ( - [exec] => strtolower - [args] => Array - ( - [0] => Array - ( - [exec] => strtoupper - [args] => Array - ( - [0] => Array - ( - [var] => buffer1 - ) - - ) - - ) - - ) - - ) - - ) - - ) - - ) - - [29] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [30] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [31] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [32] => Array - ( - [op] => end_if - ) - - [33] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/filter.tpl */ -function haanga_7c948c919295fb106667df66f458e608eb775422($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo htmlspecialchars(strtoupper($var)).' -'.htmlspecialchars(strtolower(strtoupper($var))).' -'.htmlspecialchars(str_replace('u', '', $var)).' -'.strlen($var).' -'.htmlspecialchars(strtoupper((empty($foobar) == TRUE ? 'default value' : $foobar))).' -'; - $buffer1 = ' - hola que -'; - echo strtoupper($buffer1).' -'; - $buffer1 = 'TAL'; - echo strtolower($buffer1).' -'; - $buffer1 = ' - hello world -'; - echo str_replace('e', '', strtolower(strtoupper($buffer1))).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/first_of.tpl.php b/lib/Haanga/tests/tmp/assert_templates/first_of.tpl.php deleted file mode 100644 index de600f7bbb68bb817aff730855b8070e71ecb7fe..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/first_of.tpl.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/first_of.tpl */ -function haanga_a826d0f6cb5e39095560cc1bd5fd99cec2771f48($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo (empty($xvar) == FALSE ? $xvar : (empty($variable1) == FALSE ? $variable1 : (empty($variable2) == FALSE ? $variable2 : 'default'))).' -'.(empty($xvar) == FALSE ? $xvar : (empty($variable1) == FALSE ? $variable1 : (empty($variablex) == FALSE ? $variablex : 'default'))).' -'.(empty($xvar) == FALSE ? $xvar : (empty($variable1) == FALSE ? $variable1 : (empty($variablex) == FALSE ? $variablex : 5))).' -'.(empty($xvar) == FALSE ? $xvar : (empty($variable1) == FALSE ? $variable1 : (empty($variable2) == FALSE ? $variable2 : 'default'))).' -'.(empty($xvar) == FALSE ? $xvar : (empty($variable1) == FALSE ? $variable1 : (empty($variablex) == FALSE ? $variablex : 'default'))).' -'.(empty($xvar) == FALSE ? $xvar : (empty($variable1) == FALSE ? $variable1 : (empty($variablex) == FALSE ? $variablex : 5))).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/first_of.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/first_of.tpl.php.dump deleted file mode 100644 index 991533328665ade6182c0f551cf1c66688b86aae..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/first_of.tpl.php.dump +++ /dev/null @@ -1,880 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/first_of.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_a826d0f6cb5e39095560cc1bd5fd99cec2771f48 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => xvar - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => xvar - ) - - [false] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => variable1 - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => variable1 - ) - - [false] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => variable2 - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => variable2 - ) - - [false] => Array - ( - [string] => default - ) - - ) - - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => xvar - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => xvar - ) - - [false] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => variable1 - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => variable1 - ) - - [false] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => variablex - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => variablex - ) - - [false] => Array - ( - [string] => default - ) - - ) - - ) - - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [12] => Array - ( - [op] => print - [0] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => xvar - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => xvar - ) - - [false] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => variable1 - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => variable1 - ) - - [false] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => variablex - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => variablex - ) - - [false] => Array - ( - [number] => 5 - ) - - ) - - ) - - ) - - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => print - [0] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => xvar - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => xvar - ) - - [false] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => variable1 - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => variable1 - ) - - [false] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => variable2 - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => variable2 - ) - - [false] => Array - ( - [string] => default - ) - - ) - - ) - - ) - - ) - - [15] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [16] => Array - ( - [op] => print - [0] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => xvar - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => xvar - ) - - [false] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => variable1 - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => variable1 - ) - - [false] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => variablex - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => variablex - ) - - [false] => Array - ( - [string] => default - ) - - ) - - ) - - ) - - ) - - [17] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [18] => Array - ( - [op] => print - [0] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => xvar - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => xvar - ) - - [false] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => variable1 - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => variable1 - ) - - [false] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => variablex - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => variablex - ) - - [false] => Array - ( - [number] => 5 - ) - - ) - - ) - - ) - - ) - - [19] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [20] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [21] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [22] => Array - ( - [op] => end_if - ) - - [23] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/first_of.tpl */ -function haanga_a826d0f6cb5e39095560cc1bd5fd99cec2771f48($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo (empty($xvar) == FALSE ? $xvar : (empty($variable1) == FALSE ? $variable1 : (empty($variable2) == FALSE ? $variable2 : 'default'))).' -'.(empty($xvar) == FALSE ? $xvar : (empty($variable1) == FALSE ? $variable1 : (empty($variablex) == FALSE ? $variablex : 'default'))).' -'.(empty($xvar) == FALSE ? $xvar : (empty($variable1) == FALSE ? $variable1 : (empty($variablex) == FALSE ? $variablex : 5))).' -'.(empty($xvar) == FALSE ? $xvar : (empty($variable1) == FALSE ? $variable1 : (empty($variable2) == FALSE ? $variable2 : 'default'))).' -'.(empty($xvar) == FALSE ? $xvar : (empty($variable1) == FALSE ? $variable1 : (empty($variablex) == FALSE ? $variablex : 'default'))).' -'.(empty($xvar) == FALSE ? $xvar : (empty($variable1) == FALSE ? $variable1 : (empty($variablex) == FALSE ? $variablex : 5))).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/for_range.tpl.php b/lib/Haanga/tests/tmp/assert_templates/for_range.tpl.php deleted file mode 100644 index adc51acf6104c67fc448de1f4dbc3488125ef08a..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/for_range.tpl.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/for_range.tpl */ -function haanga_4d539b8ce541e6398b254786c86ca7fd1338ca04($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - for ($i = 1; $i <= 5; $i += 1) { - echo ' - '.$i.' -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/for_range.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/for_range.tpl.php.dump deleted file mode 100644 index 4ef1ea3f15e8ca11baca2c2750800acc6c591fd0..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/for_range.tpl.php.dump +++ /dev/null @@ -1,217 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/for_range.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_4d539b8ce541e6398b254786c86ca7fd1338ca04 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => for - [index] => i - [min] => 1 - [max] => 5 - [step] => 1 - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [var] => i - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [12] => Array - ( - [op] => end_for - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [15] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [16] => Array - ( - [op] => end_if - ) - - [17] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/for_range.tpl */ -function haanga_4d539b8ce541e6398b254786c86ca7fd1338ca04($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - for ($i = 1; $i <= 5; $i += 1) { - echo ' - '.$i.' -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/for_range1.tpl.php b/lib/Haanga/tests/tmp/assert_templates/for_range1.tpl.php deleted file mode 100644 index 0718365a1daabe3594aca51c1381bc4b35dcbd1e..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/for_range1.tpl.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/for_range1.tpl */ -function haanga_6153c3274a39928f85c724583ea8ab169cbc4b9b($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - for ($i = 1; $i <= 5; $i += 2) { - echo ' - '.$i.' -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/for_range1.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/for_range1.tpl.php.dump deleted file mode 100644 index b90a1652c1781660a8ff8e2a21097b44d2ed3933..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/for_range1.tpl.php.dump +++ /dev/null @@ -1,217 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/for_range1.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_6153c3274a39928f85c724583ea8ab169cbc4b9b - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => for - [index] => i - [min] => 1 - [max] => 5 - [step] => 2 - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [var] => i - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [12] => Array - ( - [op] => end_for - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [15] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [16] => Array - ( - [op] => end_if - ) - - [17] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/for_range1.tpl */ -function haanga_6153c3274a39928f85c724583ea8ab169cbc4b9b($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - for ($i = 1; $i <= 5; $i += 2) { - echo ' - '.$i.' -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/for_range2.tpl.php b/lib/Haanga/tests/tmp/assert_templates/for_range2.tpl.php deleted file mode 100644 index 54a8a090fcb900cda1b642d41543b1a865df626b..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/for_range2.tpl.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/for_range2.tpl */ -function haanga_24ef455b6f61d9f2c1060d3bf0ffe3695f34e451($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - for ($i = 5; $i >= 1; $i += -2) { - echo ' - '.$i.' -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/for_range2.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/for_range2.tpl.php.dump deleted file mode 100644 index 85fb83d0206c611f97b3d1ad80d80533462eda00..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/for_range2.tpl.php.dump +++ /dev/null @@ -1,217 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/for_range2.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_24ef455b6f61d9f2c1060d3bf0ffe3695f34e451 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => for - [index] => i - [min] => 5 - [max] => 1 - [step] => -2 - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [var] => i - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [12] => Array - ( - [op] => end_for - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [15] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [16] => Array - ( - [op] => end_if - ) - - [17] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/for_range2.tpl */ -function haanga_24ef455b6f61d9f2c1060d3bf0ffe3695f34e451($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - for ($i = 5; $i >= 1; $i += -2) { - echo ' - '.$i.' -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/for_range3.tpl.php b/lib/Haanga/tests/tmp/assert_templates/for_range3.tpl.php deleted file mode 100644 index 8b897c719dffa2d3fa43fde51adde6cb08050c1a..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/for_range3.tpl.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/for_range3.tpl */ -function haanga_859654b3095e22d09c8658e87249d91cf6234bff($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - for ($i = 5; $i >= 1; $i += -2) { - echo ' - '.$i.' -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/for_range3.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/for_range3.tpl.php.dump deleted file mode 100644 index a4cef97f188144d97243755cb276b14f2089bc45..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/for_range3.tpl.php.dump +++ /dev/null @@ -1,217 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/for_range3.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_859654b3095e22d09c8658e87249d91cf6234bff - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => for - [index] => i - [min] => 5 - [max] => 1 - [step] => 2 - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [var] => i - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [12] => Array - ( - [op] => end_for - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [15] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [16] => Array - ( - [op] => end_if - ) - - [17] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/for_range3.tpl */ -function haanga_859654b3095e22d09c8658e87249d91cf6234bff($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - for ($i = 5; $i >= 1; $i += -2) { - echo ' - '.$i.' -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/for_range4.tpl.php b/lib/Haanga/tests/tmp/assert_templates/for_range4.tpl.php deleted file mode 100644 index e889c399efa6b3b87ffe5fc008377bad157d17a1..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/for_range4.tpl.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/for_range4.tpl */ -function haanga_862550ab5e80dc16c8f0f5fafed8f6b4d4b7e56f($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - for ($i = $min; $i >= $max; $i += -2) { - echo ' - '.$i.' -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/for_range4.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/for_range4.tpl.php.dump deleted file mode 100644 index 35102710aa14f0d140083daa4d7f37dd26d521e0..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/for_range4.tpl.php.dump +++ /dev/null @@ -1,225 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/for_range4.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_862550ab5e80dc16c8f0f5fafed8f6b4d4b7e56f - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => for - [index] => i - [min] => Array - ( - [var] => min - ) - - [max] => Array - ( - [var] => max - ) - - [step] => -2 - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [var] => i - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [12] => Array - ( - [op] => end_for - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [15] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [16] => Array - ( - [op] => end_if - ) - - [17] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/for_range4.tpl */ -function haanga_862550ab5e80dc16c8f0f5fafed8f6b4d4b7e56f($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - for ($i = $min; $i >= $max; $i += -2) { - echo ' - '.$i.' -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/for_range5.tpl.php b/lib/Haanga/tests/tmp/assert_templates/for_range5.tpl.php deleted file mode 100644 index a870bb95d41d49f67f730ada99026d40ba947ac5..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/for_range5.tpl.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/for_range5.tpl */ -function haanga_ce579af7079d634f492d7742076d8a6ef88b4895($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - for ($i = $e['min']; $i >= $e['max']; $i += -2) { - echo ' - '.$i.' -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/for_range5.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/for_range5.tpl.php.dump deleted file mode 100644 index e5aad6f5111992803ca87e21cb1875f6382b9819..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/for_range5.tpl.php.dump +++ /dev/null @@ -1,235 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/for_range5.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_ce579af7079d634f492d7742076d8a6ef88b4895 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => for - [index] => i - [min] => Array - ( - [var] => Array - ( - [0] => e - [1] => min - ) - - ) - - [max] => Array - ( - [var] => Array - ( - [0] => e - [1] => max - ) - - ) - - [step] => -2 - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [var] => i - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [12] => Array - ( - [op] => end_for - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [15] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [16] => Array - ( - [op] => end_if - ) - - [17] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/for_range5.tpl */ -function haanga_ce579af7079d634f492d7742076d8a6ef88b4895($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - for ($i = $e['min']; $i >= $e['max']; $i += -2) { - echo ' - '.$i.' -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/foreach_vars.tpl.php b/lib/Haanga/tests/tmp/assert_templates/foreach_vars.tpl.php deleted file mode 100644 index 887fa702bcb82b2ebf7dcfc17ed19f8a02c24ede..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/foreach_vars.tpl.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/foreach_vars.tpl */ -function haanga_a6632e6016b7fd6dac1f8c9fdbeb007fa154dfb9($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo '<div class=\'container\'> -'; - foreach ($categoriesArray as $category) { - echo ' - <div class=\'mainCategoryList\'>'.htmlspecialchars($category['cat']['categoria']).' - <ul> - '; - $forcounter1_2 = 1; - $psize_2 = count($category['subCategories']); - $islast_2 = ($forcounter1_2 == $psize_2); - foreach ($category['subCategories'] as $secondaryCategory) { - echo ' - <li class=\'secondaryCategoryList\'> - '; - if (empty($islast_2) === FALSE) { - echo ' - '.htmlspecialchars($secondaryCategory['categoria']).'</li> - '; - } else { - echo ' - '.htmlspecialchars($secondaryCategory['categoria']).',</li> - '; - } - echo ' - '; - $forcounter1_2 = ($forcounter1_2 + 1); - $islast_2 = ($forcounter1_2 == $psize_2); - } - echo ' - </ul> - </div> -'; - } - echo ' -</div> -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/foreach_vars.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/foreach_vars.tpl.php.dump deleted file mode 100644 index 5bec13720e814d379f4ccabe714137a9c1c6035a..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/foreach_vars.tpl.php.dump +++ /dev/null @@ -1,555 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/foreach_vars.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_a6632e6016b7fd6dac1f8c9fdbeb007fa154dfb9 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [string] => <div class='container'> - - ) - - ) - - [9] => Array - ( - [op] => foreach - [array] => categoriesArray - [value] => category - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [string] => - <div class='mainCategoryList'> - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => category - [1] => cat - [2] => categoria - ) - - ) - - ) - - ) - - ) - - [12] => Array - ( - [op] => print - [0] => Array - ( - [string] => - <ul> - - ) - - ) - - [13] => Array - ( - [op] => declare - [name] => forcounter1_2 - [0] => Array - ( - [number] => 1 - ) - - ) - - [14] => Array - ( - [op] => declare - [name] => psize_2 - [0] => Array - ( - [exec] => count - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => category - [1] => subCategories - ) - - ) - - ) - - ) - - ) - - [15] => Array - ( - [op] => declare - [name] => islast_2 - [0] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => forcounter1_2 - ) - - [1] => Array - ( - [var] => psize_2 - ) - - ) - - ) - - [16] => Array - ( - [op] => foreach - [array] => Array - ( - [0] => category - [1] => subCategories - ) - - [value] => secondaryCategory - ) - - [17] => Array - ( - [op] => print - [0] => Array - ( - [string] => - <li class='secondaryCategoryList'> - - ) - - ) - - [18] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => islast_2 - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - ) - - [19] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [20] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => secondaryCategory - [1] => categoria - ) - - ) - - ) - - ) - - ) - - [21] => Array - ( - [op] => print - [0] => Array - ( - [string] => </li> - - ) - - ) - - [22] => Array - ( - [op] => else - ) - - [23] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [24] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => secondaryCategory - [1] => categoria - ) - - ) - - ) - - ) - - ) - - [25] => Array - ( - [op] => print - [0] => Array - ( - [string] => ,</li> - - ) - - ) - - [26] => Array - ( - [op] => end_if - ) - - [27] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [28] => Array - ( - [op] => declare - [name] => forcounter1_2 - [0] => Array - ( - [op_expr] => + - [0] => Array - ( - [var] => forcounter1_2 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - ) - - [29] => Array - ( - [op] => declare - [name] => islast_2 - [0] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => forcounter1_2 - ) - - [1] => Array - ( - [var] => psize_2 - ) - - ) - - ) - - [30] => Array - ( - [op] => end_foreach - ) - - [31] => Array - ( - [op] => print - [0] => Array - ( - [string] => - </ul> - </div> - - ) - - ) - - [32] => Array - ( - [op] => end_foreach - ) - - [33] => Array - ( - [op] => print - [0] => Array - ( - [string] => -</div> - - ) - - ) - - [34] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [35] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [36] => Array - ( - [op] => end_if - ) - - [37] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/foreach_vars.tpl */ -function haanga_a6632e6016b7fd6dac1f8c9fdbeb007fa154dfb9($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo '<div class=\'container\'> -'; - foreach ($categoriesArray as $category) { - echo ' - <div class=\'mainCategoryList\'>'.htmlspecialchars($category['cat']['categoria']).' - <ul> - '; - $forcounter1_2 = 1; - $psize_2 = count($category['subCategories']); - $islast_2 = ($forcounter1_2 == $psize_2); - foreach ($category['subCategories'] as $secondaryCategory) { - echo ' - <li class=\'secondaryCategoryList\'> - '; - if (empty($islast_2) === FALSE) { - echo ' - '.htmlspecialchars($secondaryCategory['categoria']).'</li> - '; - } else { - echo ' - '.htmlspecialchars($secondaryCategory['categoria']).',</li> - '; - } - echo ' - '; - $forcounter1_2 = ($forcounter1_2 + 1); - $islast_2 = ($forcounter1_2 == $psize_2); - } - echo ' - </ul> - </div> -'; - } - echo ' -</div> -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/global.tpl.php b/lib/Haanga/tests/tmp/assert_templates/global.tpl.php deleted file mode 100644 index 0788aa52d91c921463f7afd7007de43d48502127..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/global.tpl.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/global.tpl */ -function haanga_7a375fb2704088e2b14f656c72d527d8203027fe($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo set_global_template().' -'.htmlspecialchars($test_global['b']).' '.htmlspecialchars($global1['foo']->foo['bar']).' '.(empty($global1['bar']->xxx->yyyy) == TRUE ? 'yyy' : $global1['bar']->xxx->yyyy).' -'.htmlspecialchars($test_global['b']).' '.htmlspecialchars($global1['foo']->foo['bar']).' -'.htmlspecialchars($global1['foo']->{$index['name']->str}['bar']).' -'.htmlspecialchars($global1['foo']->{$indexstr}['bar']).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/global.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/global.tpl.php.dump deleted file mode 100644 index c11b47b3bf48e8c31c5139d7f438d4908c80dcf5..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/global.tpl.php.dump +++ /dev/null @@ -1,517 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/global.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_7a375fb2704088e2b14f656c72d527d8203027fe - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [exec] => set_global_template - [args] => Array - ( - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => test_global - [1] => b - ) - - ) - - ) - - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - ) - - ) - - [12] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => global1 - [1] => foo - [2] => Array - ( - [object] => foo - ) - - [3] => bar - ) - - ) - - ) - - ) - - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - ) - - ) - - [14] => Array - ( - [op] => print - [0] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => global1 - [1] => bar - [2] => Array - ( - [object] => xxx - ) - - [3] => Array - ( - [object] => yyyy - ) - - ) - - ) - - ) - - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - [true] => Array - ( - [string] => yyy - ) - - [false] => Array - ( - [var] => Array - ( - [0] => global1 - [1] => bar - [2] => Array - ( - [object] => xxx - ) - - [3] => Array - ( - [object] => yyyy - ) - - ) - - ) - - ) - - ) - - [15] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [16] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => test_global - [1] => b - ) - - ) - - ) - - ) - - ) - - [17] => Array - ( - [op] => print - [0] => Array - ( - [string] => - ) - - ) - - [18] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => global1 - [1] => foo - [2] => Array - ( - [object] => foo - ) - - [3] => bar - ) - - ) - - ) - - ) - - ) - - [19] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [20] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => global1 - [1] => foo - [2] => Array - ( - [object] => Array - ( - [var] => Array - ( - [0] => index - [1] => name - [2] => Array - ( - [object] => str - ) - - ) - - ) - - ) - - [3] => bar - ) - - ) - - ) - - ) - - ) - - [21] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [22] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => global1 - [1] => foo - [2] => Array - ( - [object] => Array - ( - [var] => indexstr - ) - - ) - - [3] => bar - ) - - ) - - ) - - ) - - ) - - [23] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [24] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [25] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [26] => Array - ( - [op] => end_if - ) - - [27] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/global.tpl */ -function haanga_7a375fb2704088e2b14f656c72d527d8203027fe($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo set_global_template().' -'.htmlspecialchars($test_global['b']).' '.htmlspecialchars($global1['foo']->foo['bar']).' '.(empty($global1['bar']->xxx->yyyy) == TRUE ? 'yyy' : $global1['bar']->xxx->yyyy).' -'.htmlspecialchars($test_global['b']).' '.htmlspecialchars($global1['foo']->foo['bar']).' -'.htmlspecialchars($global1['foo']->{$index['name']->str}['bar']).' -'.htmlspecialchars($global1['foo']->{$indexstr}['bar']).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/if_else_simple.tpl.php b/lib/Haanga/tests/tmp/assert_templates/if_else_simple.tpl.php deleted file mode 100644 index 800754887d3fa8ac80dcdadfd44a1174a9d2d145..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/if_else_simple.tpl.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/if_else_simple.tpl */ -function haanga_e7733880179030f69680f92d682d991e9f93c62e($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - if (1 == 2 || 1 + 2 == 3) { - echo 'True'; - } else { - echo 'False'; - } - echo ' -'; - if (strtoupper($var) == $var) { - echo 'True'; - } else { - echo 'False'; - } - echo ' -'; - if (1 === 2 || 1 + 2 === 3) { - echo 'True'; - } else { - echo 'False'; - } - echo ' -'; - if (1 !== 2) { - echo 'True'; - } else { - echo 'False'; - } - echo ' -'; - if (1 > 2) { - echo 'True'; - } else { - echo 'False'; - } - echo ' -'; - if (1 >= 2) { - echo 'True'; - } else { - echo 'False'; - } - echo ' -'; - if (1 <= 2) { - echo 'True'; - } else { - echo 'False'; - } - echo ' -'; - if (1 < 2) { - echo 'True'; - } else { - echo 'False'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/if_else_simple.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/if_else_simple.tpl.php.dump deleted file mode 100644 index 2990043611b892216476e3ee71d113598eeaa961..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/if_else_simple.tpl.php.dump +++ /dev/null @@ -1,779 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/if_else_simple.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_e7733880179030f69680f92d682d991e9f93c62e - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => || - [0] => Array - ( - [op_expr] => == - [0] => Array - ( - [number] => 1 - ) - - [1] => Array - ( - [number] => 2 - ) - - ) - - [1] => Array - ( - [op_expr] => == - [0] => Array - ( - [op_expr] => + - [0] => Array - ( - [number] => 1 - ) - - [1] => Array - ( - [number] => 2 - ) - - ) - - [1] => Array - ( - [number] => 3 - ) - - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => True - ) - - ) - - [10] => Array - ( - [op] => else - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => False - ) - - ) - - [12] => Array - ( - [op] => end_if - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Haanga_AST Object - ( - [stack] => Array - ( - [0] => Array - ( - [exec] => strtoupper - [args] => Array - ( - [0] => Array - ( - [var] => var - ) - - ) - - ) - - ) - - [current] => Array - ( - ) - - [doesPrint] => - ) - - [1] => Array - ( - [var] => var - ) - - ) - - ) - - [15] => Array - ( - [op] => print - [0] => Array - ( - [string] => True - ) - - ) - - [16] => Array - ( - [op] => else - ) - - [17] => Array - ( - [op] => print - [0] => Array - ( - [string] => False - ) - - ) - - [18] => Array - ( - [op] => end_if - ) - - [19] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [20] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => || - [0] => Array - ( - [op_expr] => === - [0] => Array - ( - [number] => 1 - ) - - [1] => Array - ( - [number] => 2 - ) - - ) - - [1] => Array - ( - [op_expr] => === - [0] => Array - ( - [op_expr] => + - [0] => Array - ( - [number] => 1 - ) - - [1] => Array - ( - [number] => 2 - ) - - ) - - [1] => Array - ( - [number] => 3 - ) - - ) - - ) - - ) - - [21] => Array - ( - [op] => print - [0] => Array - ( - [string] => True - ) - - ) - - [22] => Array - ( - [op] => else - ) - - [23] => Array - ( - [op] => print - [0] => Array - ( - [string] => False - ) - - ) - - [24] => Array - ( - [op] => end_if - ) - - [25] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [26] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => !== - [0] => Array - ( - [number] => 1 - ) - - [1] => Array - ( - [number] => 2 - ) - - ) - - ) - - [27] => Array - ( - [op] => print - [0] => Array - ( - [string] => True - ) - - ) - - [28] => Array - ( - [op] => else - ) - - [29] => Array - ( - [op] => print - [0] => Array - ( - [string] => False - ) - - ) - - [30] => Array - ( - [op] => end_if - ) - - [31] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [32] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => > - [0] => Array - ( - [number] => 1 - ) - - [1] => Array - ( - [number] => 2 - ) - - ) - - ) - - [33] => Array - ( - [op] => print - [0] => Array - ( - [string] => True - ) - - ) - - [34] => Array - ( - [op] => else - ) - - [35] => Array - ( - [op] => print - [0] => Array - ( - [string] => False - ) - - ) - - [36] => Array - ( - [op] => end_if - ) - - [37] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [38] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => >= - [0] => Array - ( - [number] => 1 - ) - - [1] => Array - ( - [number] => 2 - ) - - ) - - ) - - [39] => Array - ( - [op] => print - [0] => Array - ( - [string] => True - ) - - ) - - [40] => Array - ( - [op] => else - ) - - [41] => Array - ( - [op] => print - [0] => Array - ( - [string] => False - ) - - ) - - [42] => Array - ( - [op] => end_if - ) - - [43] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [44] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => <= - [0] => Array - ( - [number] => 1 - ) - - [1] => Array - ( - [number] => 2 - ) - - ) - - ) - - [45] => Array - ( - [op] => print - [0] => Array - ( - [string] => True - ) - - ) - - [46] => Array - ( - [op] => else - ) - - [47] => Array - ( - [op] => print - [0] => Array - ( - [string] => False - ) - - ) - - [48] => Array - ( - [op] => end_if - ) - - [49] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [50] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => < - [0] => Array - ( - [number] => 1 - ) - - [1] => Array - ( - [number] => 2 - ) - - ) - - ) - - [51] => Array - ( - [op] => print - [0] => Array - ( - [string] => True - ) - - ) - - [52] => Array - ( - [op] => else - ) - - [53] => Array - ( - [op] => print - [0] => Array - ( - [string] => False - ) - - ) - - [54] => Array - ( - [op] => end_if - ) - - [55] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [56] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [57] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [58] => Array - ( - [op] => end_if - ) - - [59] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/if_else_simple.tpl */ -function haanga_e7733880179030f69680f92d682d991e9f93c62e($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - if (1 == 2 || 1 + 2 == 3) { - echo 'True'; - } else { - echo 'False'; - } - echo ' -'; - if (strtoupper($var) == $var) { - echo 'True'; - } else { - echo 'False'; - } - echo ' -'; - if (1 === 2 || 1 + 2 === 3) { - echo 'True'; - } else { - echo 'False'; - } - echo ' -'; - if (1 !== 2) { - echo 'True'; - } else { - echo 'False'; - } - echo ' -'; - if (1 > 2) { - echo 'True'; - } else { - echo 'False'; - } - echo ' -'; - if (1 >= 2) { - echo 'True'; - } else { - echo 'False'; - } - echo ' -'; - if (1 <= 2) { - echo 'True'; - } else { - echo 'False'; - } - echo ' -'; - if (1 < 2) { - echo 'True'; - } else { - echo 'False'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/ifchanged.tpl.php b/lib/Haanga/tests/tmp/assert_templates/ifchanged.tpl.php deleted file mode 100644 index 8c77fcd1de9e1ea264d4ef823550d8e25dd6d365..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/ifchanged.tpl.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/ifchanged.tpl */ -function haanga_be17029b5fd2998df7c922a92652b6886d7780fd($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $sorted_users = $users; - $field = Array(); - foreach ($sorted_users as $key => $item) { - $field[$key] = $item[$regroup_field]; - } - array_multisort($field, SORT_REGULAR, $sorted_users); - echo ' -'; - foreach ($sorted_users as $user) { - echo ' - '; - $buffer1 = 'Users with '.htmlspecialchars($user['age']).' years'; - if (isset($ifchanged1) == FALSE || $ifchanged1 != $buffer1) { - echo $buffer1; - $ifchanged1 = $buffer1; - } - echo ' - '.htmlspecialchars($user['name']).' -'; - } - echo ' - -'; - foreach ($sorted_users as $user) { - echo ' - '; - if ((isset($ifchanged2[0]) == FALSE || $ifchanged2[0] != $user['age']) && (isset($ifchanged2[1]) == FALSE || $ifchanged2[1] != $user['foo'])) { - echo 'Users with '.htmlspecialchars($user['age']).' years'; - $ifchanged2 = Array($user['age'], $user['foo']); - } else { - echo 'continue'; - } - echo ' - '.htmlspecialchars($user['name']).' -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/ifchanged.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/ifchanged.tpl.php.dump deleted file mode 100644 index ee90159e26b7c72fac9eabfac5da1c8d2e6ca860..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/ifchanged.tpl.php.dump +++ /dev/null @@ -1,846 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/ifchanged.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_be17029b5fd2998df7c922a92652b6886d7780fd - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => declare - [name] => sorted_users - [0] => Array - ( - [var] => users - ) - - ) - - [9] => Array - ( - [op] => declare - [name] => field - [0] => Array - ( - [array] => Array - ( - ) - - ) - - ) - - [10] => Array - ( - [op] => foreach - [array] => sorted_users - [value] => item - [key] => key - ) - - [11] => Array - ( - [op] => declare - [name] => Array - ( - [0] => field - [1] => Array - ( - [var] => key - ) - - ) - - [0] => Array - ( - [var] => Array - ( - [0] => item - [1] => Array - ( - [var] => regroup_field - ) - - ) - - ) - - ) - - [12] => Array - ( - [op] => end_foreach - ) - - [13] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => array_multisort - [args] => Array - ( - [0] => Array - ( - [var] => field - ) - - [1] => Array - ( - [constant] => SORT_REGULAR - ) - - [2] => Array - ( - [var] => sorted_users - ) - - ) - - ) - - ) - - [14] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [15] => Array - ( - [op] => foreach - [array] => sorted_users - [value] => user - ) - - [16] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [17] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [18] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => Users with - ) - - ) - - [19] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => user - [1] => age - ) - - ) - - ) - - ) - - ) - - [20] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => years - ) - - ) - - [21] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => ifchanged1 - ) - - ) - - ) - - [1] => Array - ( - [op_expr] => || - [0] => Array - ( - [expr] => - ) - - [1] => Array - ( - [op_expr] => != - [0] => Array - ( - [var] => ifchanged1 - ) - - [1] => Array - ( - [var] => buffer1 - ) - - ) - - ) - - ) - - ) - - [22] => Array - ( - [op] => print - [0] => Array - ( - [var] => buffer1 - ) - - ) - - [23] => Array - ( - [op] => declare - [name] => ifchanged1 - [0] => Array - ( - [var] => buffer1 - ) - - ) - - [24] => Array - ( - [op] => end_if - ) - - [25] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [26] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => user - [1] => name - ) - - ) - - ) - - ) - - ) - - [27] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [28] => Array - ( - [op] => end_foreach - ) - - [29] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - - ) - - ) - - [30] => Array - ( - [op] => foreach - [array] => sorted_users - [value] => user - ) - - [31] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [32] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => && - [0] => Array - ( - [op_expr] => expr - [0] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => ifchanged2 - [1] => Array - ( - [number] => 0 - ) - - ) - - ) - - ) - - ) - - [1] => Array - ( - [op_expr] => || - [0] => Array - ( - [expr] => - ) - - [1] => Array - ( - [op_expr] => != - [0] => Array - ( - [var] => Array - ( - [0] => ifchanged2 - [1] => Array - ( - [number] => 0 - ) - - ) - - ) - - [1] => Array - ( - [var] => Array - ( - [0] => user - [1] => age - ) - - ) - - ) - - ) - - ) - - [1] => - ) - - [1] => Array - ( - [op_expr] => expr - [0] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => ifchanged2 - [1] => Array - ( - [number] => 1 - ) - - ) - - ) - - ) - - ) - - [1] => Array - ( - [op_expr] => || - [0] => Array - ( - [expr] => - ) - - [1] => Array - ( - [op_expr] => != - [0] => Array - ( - [var] => Array - ( - [0] => ifchanged2 - [1] => Array - ( - [number] => 1 - ) - - ) - - ) - - [1] => Array - ( - [var] => Array - ( - [0] => user - [1] => foo - ) - - ) - - ) - - ) - - ) - - [1] => - ) - - ) - - ) - - [33] => Array - ( - [op] => print - [0] => Array - ( - [string] => Users with - ) - - ) - - [34] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => user - [1] => age - ) - - ) - - ) - - ) - - ) - - [35] => Array - ( - [op] => print - [0] => Array - ( - [string] => years - ) - - ) - - [36] => Array - ( - [op] => declare - [name] => ifchanged2 - [0] => Array - ( - [array] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => user - [1] => age - ) - - ) - - [1] => Array - ( - [var] => Array - ( - [0] => user - [1] => foo - ) - - ) - - ) - - ) - - ) - - [37] => Array - ( - [op] => else - ) - - [38] => Array - ( - [op] => print - [0] => Array - ( - [string] => continue - ) - - ) - - [39] => Array - ( - [op] => end_if - ) - - [40] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [41] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => user - [1] => name - ) - - ) - - ) - - ) - - ) - - [42] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [43] => Array - ( - [op] => end_foreach - ) - - [44] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [45] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [46] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [47] => Array - ( - [op] => end_if - ) - - [48] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/ifchanged.tpl */ -function haanga_be17029b5fd2998df7c922a92652b6886d7780fd($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $sorted_users = $users; - $field = Array(); - foreach ($sorted_users as $key => $item) { - $field[$key] = $item[$regroup_field]; - } - array_multisort($field, SORT_REGULAR, $sorted_users); - echo ' -'; - foreach ($sorted_users as $user) { - echo ' - '; - $buffer1 = 'Users with '.htmlspecialchars($user['age']).' years'; - if (isset($ifchanged1) == FALSE || $ifchanged1 != $buffer1) { - echo $buffer1; - $ifchanged1 = $buffer1; - } - echo ' - '.htmlspecialchars($user['name']).' -'; - } - echo ' - -'; - foreach ($sorted_users as $user) { - echo ' - '; - if ((isset($ifchanged2[0]) == FALSE || $ifchanged2[0] != $user['age']) && (isset($ifchanged2[1]) == FALSE || $ifchanged2[1] != $user['foo'])) { - echo 'Users with '.htmlspecialchars($user['age']).' years'; - $ifchanged2 = Array($user['age'], $user['foo']); - } else { - echo 'continue'; - } - echo ' - '.htmlspecialchars($user['name']).' -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/ifequals.tpl.php b/lib/Haanga/tests/tmp/assert_templates/ifequals.tpl.php deleted file mode 100644 index b6c983ca53830ef78f615ad2d97bb197c4380ba6..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/ifequals.tpl.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/ifequals.tpl */ -function haanga_0c118610d6837670c71af0327fb53e43cea00877($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - if (1 == 2) { - echo ' - Equals -'; - } else { - echo ' - Non Equals -'; - } - echo ' -'; - if (1 != 2) { - echo ' - Non Equals -'; - } else { - echo ' - Equals -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/ifequals.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/ifequals.tpl.php.dump deleted file mode 100644 index c4be26735d4532e6e14142ccd20f20c1f16ee3b1..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/ifequals.tpl.php.dump +++ /dev/null @@ -1,305 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/ifequals.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_0c118610d6837670c71af0327fb53e43cea00877 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [number] => 1 - ) - - [1] => Array - ( - [number] => 2 - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - Equals - - ) - - ) - - [10] => Array - ( - [op] => else - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - Non Equals - - ) - - ) - - [12] => Array - ( - [op] => end_if - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => != - [0] => Array - ( - [number] => 1 - ) - - [1] => Array - ( - [number] => 2 - ) - - ) - - ) - - [15] => Array - ( - [op] => print - [0] => Array - ( - [string] => - Non Equals - - ) - - ) - - [16] => Array - ( - [op] => else - ) - - [17] => Array - ( - [op] => print - [0] => Array - ( - [string] => - Equals - - ) - - ) - - [18] => Array - ( - [op] => end_if - ) - - [19] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [20] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [21] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [22] => Array - ( - [op] => end_if - ) - - [23] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/ifequals.tpl */ -function haanga_0c118610d6837670c71af0327fb53e43cea00877($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - if (1 == 2) { - echo ' - Equals -'; - } else { - echo ' - Non Equals -'; - } - echo ' -'; - if (1 != 2) { - echo ' - Non Equals -'; - } else { - echo ' - Equals -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/in.tpl.php b/lib/Haanga/tests/tmp/assert_templates/in.tpl.php deleted file mode 100644 index e7cb8a512593d8d6b5406efae360fa79b3395444..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/in.tpl.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/in.tpl */ -function haanga_8815cff61dc42c8002f44fd73612611e6bc333e6($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - if (strpos('cesar d. rodas', 'd.') !== FALSE) { - echo ' - Here -'; - } - echo ' -'; - if ((is_array($names) ? array_search('d.', $names) : strpos($names, 'd.')) !== FALSE) { - echo ' - Here -'; - } - echo ' -'; - if (strpos('cesar d. rodas', $search) !== FALSE) { - echo ' - Here -'; - } - echo ' -'; - if ((is_array($names) ? array_search($search, $names) : strpos($names, $search)) !== FALSE) { - echo ' - Here -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/in.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/in.tpl.php.dump deleted file mode 100644 index 1af57895185a88a44ae251b247d783024cc6cf4a..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/in.tpl.php.dump +++ /dev/null @@ -1,503 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/in.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_8815cff61dc42c8002f44fd73612611e6bc333e6 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => !== - [0] => Array - ( - [exec] => strpos - [args] => Array - ( - [0] => Array - ( - [string] => cesar d. rodas - ) - - [1] => Array - ( - [string] => d. - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - Here - - ) - - ) - - [10] => Array - ( - [op] => end_if - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [12] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => !== - [0] => Array - ( - [expr_cond] => Array - ( - [exec] => is_array - [args] => Array - ( - [0] => Array - ( - [var] => names - ) - - ) - - ) - - [true] => Array - ( - [exec] => array_search - [args] => Array - ( - [0] => Array - ( - [string] => d. - ) - - [1] => Array - ( - [var] => names - ) - - ) - - ) - - [false] => Array - ( - [exec] => strpos - [args] => Array - ( - [0] => Array - ( - [var] => names - ) - - [1] => Array - ( - [string] => d. - ) - - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - Here - - ) - - ) - - [14] => Array - ( - [op] => end_if - ) - - [15] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [16] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => !== - [0] => Array - ( - [exec] => strpos - [args] => Array - ( - [0] => Array - ( - [string] => cesar d. rodas - ) - - [1] => Array - ( - [var] => search - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - ) - - [17] => Array - ( - [op] => print - [0] => Array - ( - [string] => - Here - - ) - - ) - - [18] => Array - ( - [op] => end_if - ) - - [19] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [20] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => !== - [0] => Array - ( - [expr_cond] => Array - ( - [exec] => is_array - [args] => Array - ( - [0] => Array - ( - [var] => names - ) - - ) - - ) - - [true] => Array - ( - [exec] => array_search - [args] => Array - ( - [0] => Array - ( - [var] => search - ) - - [1] => Array - ( - [var] => names - ) - - ) - - ) - - [false] => Array - ( - [exec] => strpos - [args] => Array - ( - [0] => Array - ( - [var] => names - ) - - [1] => Array - ( - [var] => search - ) - - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - ) - - [21] => Array - ( - [op] => print - [0] => Array - ( - [string] => - Here - - ) - - ) - - [22] => Array - ( - [op] => end_if - ) - - [23] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [24] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [25] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [26] => Array - ( - [op] => end_if - ) - - [27] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/in.tpl */ -function haanga_8815cff61dc42c8002f44fd73612611e6bc333e6($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - if (strpos('cesar d. rodas', 'd.') !== FALSE) { - echo ' - Here -'; - } - echo ' -'; - if ((is_array($names) ? array_search('d.', $names) : strpos($names, 'd.')) !== FALSE) { - echo ' - Here -'; - } - echo ' -'; - if (strpos('cesar d. rodas', $search) !== FALSE) { - echo ' - Here -'; - } - echo ' -'; - if ((is_array($names) ? array_search($search, $names) : strpos($names, $search)) !== FALSE) { - echo ' - Here -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/inheritence_nested_block.tpl.php b/lib/Haanga/tests/tmp/assert_templates/inheritence_nested_block.tpl.php deleted file mode 100644 index 451e536be3196134cbe9bf5a5af6a408b7ddb320..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/inheritence_nested_block.tpl.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/inheritence_nested_block.tpl */ -function haanga_a2c536c1d9b6f09d66feff81ca9b1e993d15d32e($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $buffer1 = ' -{{block.1b3231655cebb7a1f783eddf27d254ca}} -new stuff -'; - $blocks['outer'] = (isset($blocks['outer']) ? (strpos($blocks['outer'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['outer'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['outer'])) : $buffer1); - echo Haanga::Load('assert_templates/nested_block.tpl', $vars, TRUE, $blocks); - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/inheritence_nested_block.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/inheritence_nested_block.tpl.php.dump deleted file mode 100644 index 2850f726f81f32c9d03d0d75d0e8f694cf01e3ae..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/inheritence_nested_block.tpl.php.dump +++ /dev/null @@ -1,376 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/inheritence_nested_block.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_a2c536c1d9b6f09d66feff81ca9b1e993d15d32e - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [9] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - ) - - [11] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => -new stuff - - ) - - ) - - [12] => Array - ( - [op] => declare - [name] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - [0] => Array - ( - [expr_cond] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - ) - - ) - - ) - - [true] => Array - ( - [expr_cond] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => strpos - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - ) - - [1] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - ) - - [false] => Array - ( - [exec] => str_replace - [args] => Array - ( - [0] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - [1] => Array - ( - [var] => buffer1 - ) - - [2] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - ) - - ) - - ) - - ) - - [false] => Array - ( - [var] => buffer1 - ) - - ) - - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [exec] => Haanga::Load - [args] => Array - ( - [0] => Array - ( - [string] => assert_templates/nested_block.tpl - ) - - [1] => Array - ( - [var] => vars - ) - - [2] => Array - ( - [expr] => 1 - ) - - [3] => Array - ( - [var] => blocks - ) - - ) - - ) - - ) - - [14] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [15] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [16] => Array - ( - [op] => end_if - ) - - [17] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/inheritence_nested_block.tpl */ -function haanga_a2c536c1d9b6f09d66feff81ca9b1e993d15d32e($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $buffer1 = ' -{{block.1b3231655cebb7a1f783eddf27d254ca}} -new stuff -'; - $blocks['outer'] = (isset($blocks['outer']) ? (strpos($blocks['outer'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['outer'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['outer'])) : $buffer1); - echo Haanga::Load('assert_templates/nested_block.tpl', $vars, TRUE, $blocks); - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/inheritence_nested_block_duplicated.tpl.php b/lib/Haanga/tests/tmp/assert_templates/inheritence_nested_block_duplicated.tpl.php deleted file mode 100644 index 7b3826d1f8e756a05998c2bd7423b786b54a9b2e..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/inheritence_nested_block_duplicated.tpl.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/inheritence_nested_block_duplicated.tpl */ -function haanga_2f06ae0d3b252465fa65c3a02cc1ebab4d90396f($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $buffer1 = ' -{{block.1b3231655cebb7a1f783eddf27d254ca}} -new stuff -'; - $buffer2 = ' -new inner2 -'; - $blocks['inner2'] = (isset($blocks['inner2']) ? (strpos($blocks['inner2'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['inner2'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer2, $blocks['inner2'])) : $buffer2); - $buffer1 .= $blocks['inner2'].' -'; - $blocks['outer'] = (isset($blocks['outer']) ? (strpos($blocks['outer'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['outer'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['outer'])) : $buffer1); - echo Haanga::Load('assert_templates/nested_block.tpl', $vars, TRUE, $blocks); - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/inheritence_nested_block_duplicated.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/inheritence_nested_block_duplicated.tpl.php.dump deleted file mode 100644 index eb1a7addcac2fd8a78713147724472b2b46ec727..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/inheritence_nested_block_duplicated.tpl.php.dump +++ /dev/null @@ -1,574 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/inheritence_nested_block_duplicated.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_2f06ae0d3b252465fa65c3a02cc1ebab4d90396f - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [9] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - ) - - [11] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => -new stuff - - ) - - ) - - [12] => Array - ( - [op] => declare - [name] => buffer2 - [0] => Array - ( - [string] => - ) - - ) - - [13] => Array - ( - [op] => append_var - [name] => buffer2 - [0] => Array - ( - [string] => -new inner2 - - ) - - ) - - [14] => Array - ( - [op] => declare - [name] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2 - ) - - ) - - [0] => Array - ( - [expr_cond] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2 - ) - - ) - - ) - - ) - - ) - - [true] => Array - ( - [expr_cond] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => strpos - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2 - ) - - ) - - ) - - [1] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2 - ) - - ) - - ) - - [false] => Array - ( - [exec] => str_replace - [args] => Array - ( - [0] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - [1] => Array - ( - [var] => buffer2 - ) - - [2] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2 - ) - - ) - - ) - - ) - - ) - - ) - - [false] => Array - ( - [var] => buffer2 - ) - - ) - - ) - - [15] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2 - ) - - ) - - ) - - ) - - [16] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [17] => Array - ( - [op] => declare - [name] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - [0] => Array - ( - [expr_cond] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - ) - - ) - - ) - - [true] => Array - ( - [expr_cond] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => strpos - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - ) - - [1] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - ) - - [false] => Array - ( - [exec] => str_replace - [args] => Array - ( - [0] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - [1] => Array - ( - [var] => buffer1 - ) - - [2] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - ) - - ) - - ) - - ) - - [false] => Array - ( - [var] => buffer1 - ) - - ) - - ) - - [18] => Array - ( - [op] => print - [0] => Array - ( - [exec] => Haanga::Load - [args] => Array - ( - [0] => Array - ( - [string] => assert_templates/nested_block.tpl - ) - - [1] => Array - ( - [var] => vars - ) - - [2] => Array - ( - [expr] => 1 - ) - - [3] => Array - ( - [var] => blocks - ) - - ) - - ) - - ) - - [19] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [20] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [21] => Array - ( - [op] => end_if - ) - - [22] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/inheritence_nested_block_duplicated.tpl */ -function haanga_2f06ae0d3b252465fa65c3a02cc1ebab4d90396f($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $buffer1 = ' -{{block.1b3231655cebb7a1f783eddf27d254ca}} -new stuff -'; - $buffer2 = ' -new inner2 -'; - $blocks['inner2'] = (isset($blocks['inner2']) ? (strpos($blocks['inner2'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['inner2'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer2, $blocks['inner2'])) : $buffer2); - $buffer1 .= $blocks['inner2'].' -'; - $blocks['outer'] = (isset($blocks['outer']) ? (strpos($blocks['outer'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['outer'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['outer'])) : $buffer1); - echo Haanga::Load('assert_templates/nested_block.tpl', $vars, TRUE, $blocks); - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/inline.tpl.php b/lib/Haanga/tests/tmp/assert_templates/inline.tpl.php deleted file mode 100644 index 9bd97959aef9be84ee8cf6e3890992c211f1ac3b..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/inline.tpl.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/inline.tpl */ -function haanga_f59d9314f581283c9140ff747fa5e3efeadc54a7($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $buffer1 = ' -Foobar text -Partial part - -'; - $buffer2 = ' - another <b>text</b> -'; - $html1 = $buffer2; - $buffer1 .= ' -'.$html1.' - -'; - $html = $buffer1; - echo ' -'.$html.' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/inline.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/inline.tpl.php.dump deleted file mode 100644 index ba3eaab1a0ef7737fdc585a4b3b6b9a54531bb28..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/inline.tpl.php.dump +++ /dev/null @@ -1,343 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/inline.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_f59d9314f581283c9140ff747fa5e3efeadc54a7 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [9] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => -Foobar text - - ) - - ) - - [10] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => Partial part - - ) - - ) - - [11] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [12] => Array - ( - [op] => declare - [name] => buffer2 - [0] => Array - ( - [string] => - ) - - ) - - [13] => Array - ( - [op] => append_var - [name] => buffer2 - [0] => Array - ( - [string] => - another <b>text</b> - - ) - - ) - - [14] => Array - ( - [op] => declare - [name] => html1 - [0] => Array - ( - [var] => buffer2 - ) - - ) - - [15] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [16] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [var] => html1 - ) - - ) - - [17] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [18] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [19] => Array - ( - [op] => declare - [name] => html - [0] => Array - ( - [var] => buffer1 - ) - - ) - - [20] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [21] => Array - ( - [op] => print - [0] => Array - ( - [var] => html - ) - - ) - - [22] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [23] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [24] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [25] => Array - ( - [op] => end_if - ) - - [26] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/inline.tpl */ -function haanga_f59d9314f581283c9140ff747fa5e3efeadc54a7($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $buffer1 = ' -Foobar text -Partial part - -'; - $buffer2 = ' - another <b>text</b> -'; - $html1 = $buffer2; - $buffer1 .= ' -'.$html1.' - -'; - $html = $buffer1; - echo ' -'.$html.' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/intval.tpl.php b/lib/Haanga/tests/tmp/assert_templates/intval.tpl.php deleted file mode 100644 index a181af71baadd3fe036b59ca2fd1f85d0c1975f5..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/intval.tpl.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/intval.tpl */ -function haanga_97d0fec2255e31f51478c5d222c422dc247322f7($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo htmlspecialchars(intval($float)).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/intval.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/intval.tpl.php.dump deleted file mode 100644 index 2f2a880847df0f2885c3aaf1816868ca03afe1f9..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/intval.tpl.php.dump +++ /dev/null @@ -1,194 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/intval.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_97d0fec2255e31f51478c5d222c422dc247322f7 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [exec] => intval - [args] => Array - ( - [0] => Array - ( - [var] => float - ) - - ) - - ) - - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [11] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [12] => Array - ( - [op] => end_if - ) - - [13] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/intval.tpl */ -function haanga_97d0fec2255e31f51478c5d222c422dc247322f7($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo htmlspecialchars(intval($float)).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/join.tpl.php b/lib/Haanga/tests/tmp/assert_templates/join.tpl.php deleted file mode 100644 index d3edf2b53750f8b713b99ff29443ad35e014fae4..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/join.tpl.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/join.tpl */ -function haanga_1d992f3d68f25e0f67960320816915d87f8e6120($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo htmlspecialchars(implode(' // ', $array)).' -'.htmlspecialchars(implode('', $array)).' -'.htmlspecialchars(implode(' // ', array_reverse($array, TRUE))).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/join.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/join.tpl.php.dump deleted file mode 100644 index 2873ee146fab7865c2e6901339828d6abcbc8788..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/join.tpl.php.dump +++ /dev/null @@ -1,303 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/join.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_1d992f3d68f25e0f67960320816915d87f8e6120 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [exec] => implode - [args] => Array - ( - [0] => Array - ( - [string] => // - ) - - [1] => Array - ( - [var] => array - ) - - ) - - ) - - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [exec] => implode - [args] => Array - ( - [0] => Array - ( - [string] => - ) - - [1] => Array - ( - [var] => array - ) - - ) - - ) - - ) - - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [12] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [exec] => implode - [args] => Array - ( - [0] => Array - ( - [string] => // - ) - - [1] => Array - ( - [exec] => array_reverse - [args] => Array - ( - [0] => Array - ( - [var] => array - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - ) - - ) - - ) - - ) - - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [15] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [16] => Array - ( - [op] => end_if - ) - - [17] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/join.tpl */ -function haanga_1d992f3d68f25e0f67960320816915d87f8e6120($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo htmlspecialchars(implode(' // ', $array)).' -'.htmlspecialchars(implode('', $array)).' -'.htmlspecialchars(implode(' // ', array_reverse($array, TRUE))).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/load.tpl.php b/lib/Haanga/tests/tmp/assert_templates/load.tpl.php deleted file mode 100644 index 23f31132fa0a37dd09fe667d371d7edceda46cc1..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/load.tpl.php +++ /dev/null @@ -1,84 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/load.tpl */ -function haanga_8d56a9a504af63b0aa1f9e966ad860de9c65c99b($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo ' -'; - $mnm_current = $page; - $mnm_total = ceil(($total / $results_per_page)); - $mnm_start = max(($mnm_current - intval((5 / 2))), 1); - $mnm_end = ($mnm_start + 5 - 1); - $mnm_prev = (1 == $mnm_current ? FALSE : ($mnm_current - 1)); - $mnm_next = ($total < 0 || $mnm_current < $mnm_total ? ($mnm_current + 1) : FALSE); - $mnm_pages = range($mnm_start, ($mnm_end < $mnm_total ? $mnm_end : $mnm_total)); - echo ' -'; - if (empty($mnm_prev) === FALSE) { - echo ' - <span class="nextprev">« Previous</span> -'; - } else { - echo ' - <a href="?page'.htmlspecialchars($mnm_prev).'">« Previous</a> -'; - } - echo ' - -'; - if ($mnm_start > 1) { - echo ' - <a href="?page=1">1</a>\'; - <span>...</span> -'; - } - echo ' - -'; - foreach ($mnm_pages as $page) { - echo ' - '; - if ($mnm_current == $page) { - echo ' - <span class="current">'.htmlspecialchars($page).'</span> - '; - } else { - echo ' - <a href="?page='.htmlspecialchars($page).'">'.htmlspecialchars($page).'</a> - '; - } - echo ' -'; - } - echo ' - -'; - if ($mnm_total > $mnm_end) { - echo ' - <span>...</span> - <a href="?page='.htmlspecialchars($mnm_total).'">'.htmlspecialchars($mnm_total).'</a> -'; - } - echo ' - -'; - if (empty($mnm_next) === FALSE) { - echo ' - <a href="?page='.htmlspecialchars($mnm_next).'">» Next</a> -'; - } else { - echo ' - <span class="nextprev">» Next</span> -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/load.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/load.tpl.php.dump deleted file mode 100644 index fdc073357952127fe1493dbf1c02b2533a8eb92f..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/load.tpl.php.dump +++ /dev/null @@ -1,1082 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/load.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_8d56a9a504af63b0aa1f9e966ad860de9c65c99b - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [9] => Array - ( - [op] => declare - [name] => mnm_current - [0] => Array - ( - [var] => page - ) - - ) - - [10] => Array - ( - [op] => declare - [name] => mnm_total - [0] => Array - ( - [exec] => ceil - [args] => Array - ( - [0] => Array - ( - [op_expr] => / - [0] => Array - ( - [var] => total - ) - - [1] => Array - ( - [var] => results_per_page - ) - - ) - - ) - - ) - - ) - - [11] => Array - ( - [op] => declare - [name] => mnm_start - [0] => Array - ( - [exec] => max - [args] => Array - ( - [0] => Array - ( - [op_expr] => - - [0] => Array - ( - [var] => mnm_current - ) - - [1] => Array - ( - [exec] => intval - [args] => Array - ( - [0] => Array - ( - [op_expr] => / - [0] => Array - ( - [number] => 5 - ) - - [1] => Array - ( - [number] => 2 - ) - - ) - - ) - - ) - - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - ) - - ) - - [12] => Array - ( - [op] => declare - [name] => mnm_end - [0] => Array - ( - [op_expr] => + - [0] => Array - ( - [var] => mnm_start - ) - - [1] => Array - ( - [op_expr] => - - [0] => Array - ( - [number] => 5 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - ) - - ) - - [13] => Array - ( - [op] => declare - [name] => mnm_prev - [0] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [number] => 1 - ) - - [1] => Array - ( - [var] => mnm_current - ) - - ) - - [true] => Array - ( - [expr] => - ) - - [false] => Array - ( - [op_expr] => - - [0] => Array - ( - [var] => mnm_current - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - ) - - ) - - [14] => Array - ( - [op] => declare - [name] => mnm_next - [0] => Array - ( - [expr_cond] => Array - ( - [op_expr] => < - [0] => Array - ( - [var] => total - ) - - [1] => Array - ( - [op_expr] => || - [0] => Array - ( - [number] => 0 - ) - - [1] => Array - ( - [op_expr] => < - [0] => Array - ( - [var] => mnm_current - ) - - [1] => Array - ( - [var] => mnm_total - ) - - ) - - ) - - ) - - [true] => Array - ( - [op_expr] => + - [0] => Array - ( - [var] => mnm_current - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - [false] => Array - ( - [expr] => - ) - - ) - - ) - - [15] => Array - ( - [op] => declare - [name] => mnm_pages - [0] => Array - ( - [exec] => range - [args] => Array - ( - [0] => Array - ( - [var] => mnm_start - ) - - [1] => Array - ( - [expr_cond] => Array - ( - [op_expr] => < - [0] => Array - ( - [var] => mnm_end - ) - - [1] => Array - ( - [var] => mnm_total - ) - - ) - - [true] => Array - ( - [var] => mnm_end - ) - - [false] => Array - ( - [var] => mnm_total - ) - - ) - - ) - - ) - - ) - - [16] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [17] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => mnm_prev - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - ) - - [18] => Array - ( - [op] => print - [0] => Array - ( - [string] => - <span class="nextprev">« Previous</span> - - ) - - ) - - [19] => Array - ( - [op] => else - ) - - [20] => Array - ( - [op] => print - [0] => Array - ( - [string] => - <a href="?page - ) - - ) - - [21] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => mnm_prev - ) - - ) - - ) - - ) - - [22] => Array - ( - [op] => print - [0] => Array - ( - [string] => ">« Previous</a> - - ) - - ) - - [23] => Array - ( - [op] => end_if - ) - - [24] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - - ) - - ) - - [25] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => > - [0] => Array - ( - [var] => mnm_start - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - ) - - [26] => Array - ( - [op] => print - [0] => Array - ( - [string] => - <a href="?page=1">1</a>'; - <span>...</span> - - ) - - ) - - [27] => Array - ( - [op] => end_if - ) - - [28] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - - ) - - ) - - [29] => Array - ( - [op] => foreach - [array] => mnm_pages - [value] => page - ) - - [30] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [31] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => mnm_current - ) - - [1] => Array - ( - [var] => page - ) - - ) - - ) - - [32] => Array - ( - [op] => print - [0] => Array - ( - [string] => - <span class="current"> - ) - - ) - - [33] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => page - ) - - ) - - ) - - ) - - [34] => Array - ( - [op] => print - [0] => Array - ( - [string] => </span> - - ) - - ) - - [35] => Array - ( - [op] => else - ) - - [36] => Array - ( - [op] => print - [0] => Array - ( - [string] => - <a href="?page= - ) - - ) - - [37] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => page - ) - - ) - - ) - - ) - - [38] => Array - ( - [op] => print - [0] => Array - ( - [string] => "> - ) - - ) - - [39] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => page - ) - - ) - - ) - - ) - - [40] => Array - ( - [op] => print - [0] => Array - ( - [string] => </a> - - ) - - ) - - [41] => Array - ( - [op] => end_if - ) - - [42] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [43] => Array - ( - [op] => end_foreach - ) - - [44] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - - ) - - ) - - [45] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => > - [0] => Array - ( - [var] => mnm_total - ) - - [1] => Array - ( - [var] => mnm_end - ) - - ) - - ) - - [46] => Array - ( - [op] => print - [0] => Array - ( - [string] => - <span>...</span> - <a href="?page= - ) - - ) - - [47] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => mnm_total - ) - - ) - - ) - - ) - - [48] => Array - ( - [op] => print - [0] => Array - ( - [string] => "> - ) - - ) - - [49] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => mnm_total - ) - - ) - - ) - - ) - - [50] => Array - ( - [op] => print - [0] => Array - ( - [string] => </a> - - ) - - ) - - [51] => Array - ( - [op] => end_if - ) - - [52] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - - ) - - ) - - [53] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => mnm_next - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - ) - - [54] => Array - ( - [op] => print - [0] => Array - ( - [string] => - <a href="?page= - ) - - ) - - [55] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => mnm_next - ) - - ) - - ) - - ) - - [56] => Array - ( - [op] => print - [0] => Array - ( - [string] => ">» Next</a> - - ) - - ) - - [57] => Array - ( - [op] => else - ) - - [58] => Array - ( - [op] => print - [0] => Array - ( - [string] => - <span class="nextprev">» Next</span> - - ) - - ) - - [59] => Array - ( - [op] => end_if - ) - - [60] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [61] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [62] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [63] => Array - ( - [op] => end_if - ) - - [64] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/load.tpl */ -function haanga_8d56a9a504af63b0aa1f9e966ad860de9c65c99b($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo ' -'; - $mnm_current = $page; - $mnm_total = ceil(($total / $results_per_page)); - $mnm_start = max(($mnm_current - intval((5 / 2))), 1); - $mnm_end = ($mnm_start + 5 - 1); - $mnm_prev = (1 == $mnm_current ? FALSE : ($mnm_current - 1)); - $mnm_next = ($total < 0 || $mnm_current < $mnm_total ? ($mnm_current + 1) : FALSE); - $mnm_pages = range($mnm_start, ($mnm_end < $mnm_total ? $mnm_end : $mnm_total)); - echo ' -'; - if (empty($mnm_prev) === FALSE) { - echo ' - <span class="nextprev">« Previous</span> -'; - } else { - echo ' - <a href="?page'.htmlspecialchars($mnm_prev).'">« Previous</a> -'; - } - echo ' - -'; - if ($mnm_start > 1) { - echo ' - <a href="?page=1">1</a>\'; - <span>...</span> -'; - } - echo ' - -'; - foreach ($mnm_pages as $page) { - echo ' - '; - if ($mnm_current == $page) { - echo ' - <span class="current">'.htmlspecialchars($page).'</span> - '; - } else { - echo ' - <a href="?page='.htmlspecialchars($page).'">'.htmlspecialchars($page).'</a> - '; - } - echo ' -'; - } - echo ' - -'; - if ($mnm_total > $mnm_end) { - echo ' - <span>...</span> - <a href="?page='.htmlspecialchars($mnm_total).'">'.htmlspecialchars($mnm_total).'</a> -'; - } - echo ' - -'; - if (empty($mnm_next) === FALSE) { - echo ' - <a href="?page='.htmlspecialchars($mnm_next).'">» Next</a> -'; - } else { - echo ' - <span class="nextprev">» Next</span> -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/loop.tpl.php b/lib/Haanga/tests/tmp/assert_templates/loop.tpl.php deleted file mode 100644 index 180656e3f960ff3920a3d6bcbf45b152333695cf..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/loop.tpl.php +++ /dev/null @@ -1,115 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/loop.tpl */ -function haanga_4726e18009acee8a1c86a79b620c7ded71be5ddf($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $psize_1 = count($array); - $revcount0_1 = ($psize_1 - 1); - foreach ($array as $i) { - echo ' - '.$revcount0_1.' -'; - $revcount0_1 = ($revcount0_1 - 1); - } - echo ' - -'; - $psize_1 = count($array); - $revcount_1 = $psize_1; - foreach ($array as $i) { - echo ' - '.$revcount_1.' -'; - $revcount_1 = ($revcount_1 - 1); - } - echo ' - -'; - $forcounter1_1 = 1; - $psize_1 = count($array); - $islast_1 = ($forcounter1_1 == $psize_1); - foreach ($array as $i) { - $buffer1 = ' - '; - if (empty($islast_1) === FALSE) { - $buffer1 .= ' Last '.htmlspecialchars($i); - } - $buffer1 .= ' - -'; - echo trim($buffer1); - $forcounter1_1 = ($forcounter1_1 + 1); - $islast_1 = ($forcounter1_1 == $psize_1); - } - echo ' - -'; - $forcounter1_1 = 1; - $psize_1 = count($array_nested); - $islast_1 = ($forcounter1_1 == $psize_1); - foreach ($array_nested as $k => $sub) { - $buffer1 = ' - - '; - foreach ($sub as $arr) { - $buffer1 .= ' - '; - foreach ($arr as $val) { - $buffer1 .= ' - '; - if (empty($islast_1) === FALSE) { - $buffer1 .= ' Last '.htmlspecialchars($k); - } - $buffer1 .= ' - '; - } - $buffer1 .= ' - '; - } - $buffer1 .= ' - -'; - echo trim($buffer1); - $forcounter1_1 = ($forcounter1_1 + 1); - $islast_1 = ($forcounter1_1 == $psize_1); - } - echo ' - -'; - $isfirst_1 = TRUE; - foreach ($array_nested as $k => $sub) { - $buffer1 = ' - - '; - foreach ($sub as $arr) { - $buffer1 .= ' - '; - foreach ($arr as $val) { - $buffer1 .= ' - '; - if (empty($isfirst_1) === FALSE) { - $buffer1 .= ' first '.htmlspecialchars($k); - } - $buffer1 .= ' - '; - } - $buffer1 .= ' - '; - } - $buffer1 .= ' - -'; - echo trim($buffer1); - $isfirst_1 = FALSE; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/loop.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/loop.tpl.php.dump deleted file mode 100644 index 56e61f037ae14b15cba3122370fb032bbc7493a3..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/loop.tpl.php.dump +++ /dev/null @@ -1,1269 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/loop.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_4726e18009acee8a1c86a79b620c7ded71be5ddf - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => declare - [name] => psize_1 - [0] => Array - ( - [exec] => count - [args] => Array - ( - [0] => Array - ( - [var] => array - ) - - ) - - ) - - ) - - [9] => Array - ( - [op] => declare - [name] => revcount0_1 - [0] => Array - ( - [op_expr] => - - [0] => Array - ( - [var] => psize_1 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - ) - - [10] => Array - ( - [op] => foreach - [array] => array - [value] => i - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [12] => Array - ( - [op] => print - [0] => Array - ( - [var] => revcount0_1 - ) - - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => declare - [name] => revcount0_1 - [0] => Array - ( - [op_expr] => - - [0] => Array - ( - [var] => revcount0_1 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - ) - - [15] => Array - ( - [op] => end_foreach - ) - - [16] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - - ) - - ) - - [17] => Array - ( - [op] => declare - [name] => psize_1 - [0] => Array - ( - [exec] => count - [args] => Array - ( - [0] => Array - ( - [var] => array - ) - - ) - - ) - - ) - - [18] => Array - ( - [op] => declare - [name] => revcount_1 - [0] => Array - ( - [var] => psize_1 - ) - - ) - - [19] => Array - ( - [op] => foreach - [array] => array - [value] => i - ) - - [20] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [21] => Array - ( - [op] => print - [0] => Array - ( - [var] => revcount_1 - ) - - ) - - [22] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [23] => Array - ( - [op] => declare - [name] => revcount_1 - [0] => Array - ( - [op_expr] => - - [0] => Array - ( - [var] => revcount_1 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - ) - - [24] => Array - ( - [op] => end_foreach - ) - - [25] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - - ) - - ) - - [26] => Array - ( - [op] => declare - [name] => forcounter1_1 - [0] => Array - ( - [number] => 1 - ) - - ) - - [27] => Array - ( - [op] => declare - [name] => psize_1 - [0] => Array - ( - [exec] => count - [args] => Array - ( - [0] => Array - ( - [var] => array - ) - - ) - - ) - - ) - - [28] => Array - ( - [op] => declare - [name] => islast_1 - [0] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => forcounter1_1 - ) - - [1] => Array - ( - [var] => psize_1 - ) - - ) - - ) - - [29] => Array - ( - [op] => foreach - [array] => array - [value] => i - ) - - [30] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [31] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [32] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => islast_1 - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - ) - - [33] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => Last - ) - - ) - - [34] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => i - ) - - ) - - ) - - ) - - [35] => Array - ( - [op] => end_if - ) - - [36] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - - ) - - ) - - [37] => Array - ( - [op] => print - [0] => Array - ( - [exec] => trim - [args] => Array - ( - [0] => Array - ( - [var] => buffer1 - ) - - ) - - ) - - ) - - [38] => Array - ( - [op] => declare - [name] => forcounter1_1 - [0] => Array - ( - [op_expr] => + - [0] => Array - ( - [var] => forcounter1_1 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - ) - - [39] => Array - ( - [op] => declare - [name] => islast_1 - [0] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => forcounter1_1 - ) - - [1] => Array - ( - [var] => psize_1 - ) - - ) - - ) - - [40] => Array - ( - [op] => end_foreach - ) - - [41] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - - ) - - ) - - [42] => Array - ( - [op] => declare - [name] => forcounter1_1 - [0] => Array - ( - [number] => 1 - ) - - ) - - [43] => Array - ( - [op] => declare - [name] => psize_1 - [0] => Array - ( - [exec] => count - [args] => Array - ( - [0] => Array - ( - [var] => array_nested - ) - - ) - - ) - - ) - - [44] => Array - ( - [op] => declare - [name] => islast_1 - [0] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => forcounter1_1 - ) - - [1] => Array - ( - [var] => psize_1 - ) - - ) - - ) - - [45] => Array - ( - [op] => foreach - [array] => array_nested - [value] => sub - [key] => k - ) - - [46] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [47] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - - ) - - ) - - [48] => Array - ( - [op] => foreach - [array] => sub - [value] => arr - ) - - [49] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [50] => Array - ( - [op] => foreach - [array] => arr - [value] => val - ) - - [51] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [52] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => islast_1 - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - ) - - [53] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => Last - ) - - ) - - [54] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => k - ) - - ) - - ) - - ) - - [55] => Array - ( - [op] => end_if - ) - - [56] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [57] => Array - ( - [op] => end_foreach - ) - - [58] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [59] => Array - ( - [op] => end_foreach - ) - - [60] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - - ) - - ) - - [61] => Array - ( - [op] => print - [0] => Array - ( - [exec] => trim - [args] => Array - ( - [0] => Array - ( - [var] => buffer1 - ) - - ) - - ) - - ) - - [62] => Array - ( - [op] => declare - [name] => forcounter1_1 - [0] => Array - ( - [op_expr] => + - [0] => Array - ( - [var] => forcounter1_1 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - ) - - [63] => Array - ( - [op] => declare - [name] => islast_1 - [0] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => forcounter1_1 - ) - - [1] => Array - ( - [var] => psize_1 - ) - - ) - - ) - - [64] => Array - ( - [op] => end_foreach - ) - - [65] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - - ) - - ) - - [66] => Array - ( - [op] => declare - [name] => isfirst_1 - [0] => Array - ( - [expr] => 1 - ) - - ) - - [67] => Array - ( - [op] => foreach - [array] => array_nested - [value] => sub - [key] => k - ) - - [68] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [69] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - - ) - - ) - - [70] => Array - ( - [op] => foreach - [array] => sub - [value] => arr - ) - - [71] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [72] => Array - ( - [op] => foreach - [array] => arr - [value] => val - ) - - [73] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [74] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => isfirst_1 - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - ) - - [75] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => first - ) - - ) - - [76] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => k - ) - - ) - - ) - - ) - - [77] => Array - ( - [op] => end_if - ) - - [78] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [79] => Array - ( - [op] => end_foreach - ) - - [80] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [81] => Array - ( - [op] => end_foreach - ) - - [82] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - - ) - - ) - - [83] => Array - ( - [op] => print - [0] => Array - ( - [exec] => trim - [args] => Array - ( - [0] => Array - ( - [var] => buffer1 - ) - - ) - - ) - - ) - - [84] => Array - ( - [op] => declare - [name] => isfirst_1 - [0] => Array - ( - [expr] => - ) - - ) - - [85] => Array - ( - [op] => end_foreach - ) - - [86] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [87] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [88] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [89] => Array - ( - [op] => end_if - ) - - [90] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/loop.tpl */ -function haanga_4726e18009acee8a1c86a79b620c7ded71be5ddf($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $psize_1 = count($array); - $revcount0_1 = ($psize_1 - 1); - foreach ($array as $i) { - echo ' - '.$revcount0_1.' -'; - $revcount0_1 = ($revcount0_1 - 1); - } - echo ' - -'; - $psize_1 = count($array); - $revcount_1 = $psize_1; - foreach ($array as $i) { - echo ' - '.$revcount_1.' -'; - $revcount_1 = ($revcount_1 - 1); - } - echo ' - -'; - $forcounter1_1 = 1; - $psize_1 = count($array); - $islast_1 = ($forcounter1_1 == $psize_1); - foreach ($array as $i) { - $buffer1 = ' - '; - if (empty($islast_1) === FALSE) { - $buffer1 .= ' Last '.htmlspecialchars($i); - } - $buffer1 .= ' - -'; - echo trim($buffer1); - $forcounter1_1 = ($forcounter1_1 + 1); - $islast_1 = ($forcounter1_1 == $psize_1); - } - echo ' - -'; - $forcounter1_1 = 1; - $psize_1 = count($array_nested); - $islast_1 = ($forcounter1_1 == $psize_1); - foreach ($array_nested as $k => $sub) { - $buffer1 = ' - - '; - foreach ($sub as $arr) { - $buffer1 .= ' - '; - foreach ($arr as $val) { - $buffer1 .= ' - '; - if (empty($islast_1) === FALSE) { - $buffer1 .= ' Last '.htmlspecialchars($k); - } - $buffer1 .= ' - '; - } - $buffer1 .= ' - '; - } - $buffer1 .= ' - -'; - echo trim($buffer1); - $forcounter1_1 = ($forcounter1_1 + 1); - $islast_1 = ($forcounter1_1 == $psize_1); - } - echo ' - -'; - $isfirst_1 = TRUE; - foreach ($array_nested as $k => $sub) { - $buffer1 = ' - - '; - foreach ($sub as $arr) { - $buffer1 .= ' - '; - foreach ($arr as $val) { - $buffer1 .= ' - '; - if (empty($isfirst_1) === FALSE) { - $buffer1 .= ' first '.htmlspecialchars($k); - } - $buffer1 .= ' - '; - } - $buffer1 .= ' - '; - } - $buffer1 .= ' - -'; - echo trim($buffer1); - $isfirst_1 = FALSE; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/loop_object.tpl.php b/lib/Haanga/tests/tmp/assert_templates/loop_object.tpl.php deleted file mode 100644 index 378ecb2466950f1c393d11ca078bebc926de0253..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/loop_object.tpl.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/loop_object.tpl */ -function haanga_2def2b6ad1167d6f400b0d9db576e1c9d2b51fa9($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $obj_arr = get_object_vars($obj); - foreach ($obj_arr as $prop => $value) { - echo ' - '.htmlspecialchars($prop).' '.htmlspecialchars($value).' -'; - } - echo ' - -'; - foreach ($objects as $i) { - echo ' - '.htmlspecialchars($i->foo).' -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/loop_object.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/loop_object.tpl.php.dump deleted file mode 100644 index aad36c93be5ea83693b7e4777e1bcbfc9ff3ddfb..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/loop_object.tpl.php.dump +++ /dev/null @@ -1,357 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/loop_object.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_2def2b6ad1167d6f400b0d9db576e1c9d2b51fa9 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => declare - [name] => obj_arr - [0] => Array - ( - [exec] => get_object_vars - [args] => Array - ( - [0] => Array - ( - [var] => obj - ) - - ) - - ) - - ) - - [9] => Array - ( - [op] => foreach - [array] => obj_arr - [value] => value - [key] => prop - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => prop - ) - - ) - - ) - - ) - - [12] => Array - ( - [op] => print - [0] => Array - ( - [string] => - ) - - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => value - ) - - ) - - ) - - ) - - [14] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [15] => Array - ( - [op] => end_foreach - ) - - [16] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - - ) - - ) - - [17] => Array - ( - [op] => foreach - [array] => objects - [value] => i - ) - - [18] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [19] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => i - [1] => Array - ( - [object] => foo - ) - - ) - - ) - - ) - - ) - - ) - - [20] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [21] => Array - ( - [op] => end_foreach - ) - - [22] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [23] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [24] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [25] => Array - ( - [op] => end_if - ) - - [26] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/loop_object.tpl */ -function haanga_2def2b6ad1167d6f400b0d9db576e1c9d2b51fa9($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $obj_arr = get_object_vars($obj); - foreach ($obj_arr as $prop => $value) { - echo ' - '.htmlspecialchars($prop).' '.htmlspecialchars($value).' -'; - } - echo ' - -'; - foreach ($objects as $i) { - echo ' - '.htmlspecialchars($i->foo).' -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/method.tpl.php b/lib/Haanga/tests/tmp/assert_templates/method.tpl.php deleted file mode 100644 index 5176a060be59654406989c808df3c1a8becf0eba..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/method.tpl.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/method.tpl */ -function haanga_f81c9f0e9effd460454499c94e9b5ac06ff75347($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo htmlspecialchars($Object->method()).' -'.htmlspecialchars(strtoupper($Object->method())).' -'.htmlspecialchars($Object->bar).' -'.htmlspecialchars(strtoupper($Object->bar)).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/method.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/method.tpl.php.dump deleted file mode 100644 index 1ecd7e3767ff5a50984db1ef7fdc059f6b8ace00..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/method.tpl.php.dump +++ /dev/null @@ -1,340 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/method.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_f81c9f0e9effd460454499c94e9b5ac06ff75347 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [exec] => Array - ( - [0] => Object - [1] => Array - ( - [object] => method - ) - - ) - - [args] => Array - ( - ) - - ) - - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [exec] => strtoupper - [args] => Array - ( - [0] => Array - ( - [exec] => Array - ( - [0] => Object - [1] => Array - ( - [object] => method - ) - - ) - - [args] => Array - ( - ) - - ) - - ) - - ) - - ) - - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [12] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => Object - [1] => Array - ( - [object] => bar - ) - - ) - - ) - - ) - - ) - - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [exec] => strtoupper - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => Object - [1] => Array - ( - [object] => bar - ) - - ) - - ) - - ) - - ) - - ) - - ) - - ) - - [15] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [16] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [17] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [18] => Array - ( - [op] => end_if - ) - - [19] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/method.tpl */ -function haanga_f81c9f0e9effd460454499c94e9b5ac06ff75347($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo htmlspecialchars($Object->method()).' -'.htmlspecialchars(strtoupper($Object->method())).' -'.htmlspecialchars($Object->bar).' -'.htmlspecialchars(strtoupper($Object->bar)).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/nested_block.tpl.php b/lib/Haanga/tests/tmp/assert_templates/nested_block.tpl.php deleted file mode 100644 index 64cf3af02375c8eef0bfefaca0ae109c3fe2b2af..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/nested_block.tpl.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/nested_block.tpl */ -function haanga_57c4ad33715ae7aa88250c99f9339224979afde7($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $buffer1 = ' -'; - $buffer2 = ' -this is inner1 -'; - $buffer1 .= (isset($blocks['inner1']) ? (strpos($blocks['inner1'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['inner1'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer2, $blocks['inner1'])) : $buffer2).' -'; - $buffer2 = ' -this is inner2 -'; - $buffer1 .= (isset($blocks['inner2']) ? (strpos($blocks['inner2'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['inner2'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer2, $blocks['inner2'])) : $buffer2).' -'; - echo (isset($blocks['outer']) ? (strpos($blocks['outer'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['outer'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['outer'])) : $buffer1).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/nested_block.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/nested_block.tpl.php.dump deleted file mode 100644 index 7ef2ebf4e9abbdac52b751dbe1ec855425fe1d1b..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/nested_block.tpl.php.dump +++ /dev/null @@ -1,653 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/nested_block.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_57c4ad33715ae7aa88250c99f9339224979afde7 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [9] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => declare - [name] => buffer2 - [0] => Array - ( - [string] => - ) - - ) - - [11] => Array - ( - [op] => append_var - [name] => buffer2 - [0] => Array - ( - [string] => -this is inner1 - - ) - - ) - - [12] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [expr_cond] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner1 - ) - - ) - - ) - - ) - - ) - - [true] => Array - ( - [expr_cond] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => strpos - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner1 - ) - - ) - - ) - - [1] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner1 - ) - - ) - - ) - - [false] => Array - ( - [exec] => str_replace - [args] => Array - ( - [0] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - [1] => Array - ( - [var] => buffer2 - ) - - [2] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner1 - ) - - ) - - ) - - ) - - ) - - ) - - [false] => Array - ( - [var] => buffer2 - ) - - ) - - ) - - [13] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => declare - [name] => buffer2 - [0] => Array - ( - [string] => - ) - - ) - - [15] => Array - ( - [op] => append_var - [name] => buffer2 - [0] => Array - ( - [string] => -this is inner2 - - ) - - ) - - [16] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [expr_cond] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2 - ) - - ) - - ) - - ) - - ) - - [true] => Array - ( - [expr_cond] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => strpos - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2 - ) - - ) - - ) - - [1] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2 - ) - - ) - - ) - - [false] => Array - ( - [exec] => str_replace - [args] => Array - ( - [0] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - [1] => Array - ( - [var] => buffer2 - ) - - [2] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2 - ) - - ) - - ) - - ) - - ) - - ) - - [false] => Array - ( - [var] => buffer2 - ) - - ) - - ) - - [17] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [18] => Array - ( - [op] => print - [0] => Array - ( - [expr_cond] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - ) - - ) - - ) - - [true] => Array - ( - [expr_cond] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => strpos - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - ) - - [1] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - ) - - [false] => Array - ( - [exec] => str_replace - [args] => Array - ( - [0] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - [1] => Array - ( - [var] => buffer1 - ) - - [2] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => outer - ) - - ) - - ) - - ) - - ) - - ) - - [false] => Array - ( - [var] => buffer1 - ) - - ) - - ) - - [19] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [20] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [21] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [22] => Array - ( - [op] => end_if - ) - - [23] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/nested_block.tpl */ -function haanga_57c4ad33715ae7aa88250c99f9339224979afde7($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $buffer1 = ' -'; - $buffer2 = ' -this is inner1 -'; - $buffer1 .= (isset($blocks['inner1']) ? (strpos($blocks['inner1'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['inner1'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer2, $blocks['inner1'])) : $buffer2).' -'; - $buffer2 = ' -this is inner2 -'; - $buffer1 .= (isset($blocks['inner2']) ? (strpos($blocks['inner2'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['inner2'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer2, $blocks['inner2'])) : $buffer2).' -'; - echo (isset($blocks['outer']) ? (strpos($blocks['outer'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['outer'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['outer'])) : $buffer1).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/nested_block_second_parent.tpl.php b/lib/Haanga/tests/tmp/assert_templates/nested_block_second_parent.tpl.php deleted file mode 100644 index b1461b061e10c309892564fc02d6eac374e8bb17..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/nested_block_second_parent.tpl.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/nested_block_second_parent.tpl */ -function haanga_93071c9c441d1680a63883802200fe559306006e($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $buffer1 = ' - inner2\'s new value - '; - $buffer2 = ' - 2.1 - '; - $blocks['inner2_1'] = (isset($blocks['inner2_1']) ? (strpos($blocks['inner2_1'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['inner2_1'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer2, $blocks['inner2_1'])) : $buffer2); - $buffer1 .= $blocks['inner2_1'].' -'; - $blocks['inner2'] = (isset($blocks['inner2']) ? (strpos($blocks['inner2'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['inner2'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['inner2'])) : $buffer1); - echo Haanga::Load('assert_templates/nested_block.tpl', $vars, TRUE, $blocks); - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/nested_block_second_parent.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/nested_block_second_parent.tpl.php.dump deleted file mode 100644 index dc55286628f43cddea25eaa3c0c95af9fdbe7b72..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/nested_block_second_parent.tpl.php.dump +++ /dev/null @@ -1,550 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/nested_block_second_parent.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_93071c9c441d1680a63883802200fe559306006e - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [9] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - inner2's new value - - ) - - ) - - [10] => Array - ( - [op] => declare - [name] => buffer2 - [0] => Array - ( - [string] => - ) - - ) - - [11] => Array - ( - [op] => append_var - [name] => buffer2 - [0] => Array - ( - [string] => - 2.1 - - ) - - ) - - [12] => Array - ( - [op] => declare - [name] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2_1 - ) - - ) - - [0] => Array - ( - [expr_cond] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2_1 - ) - - ) - - ) - - ) - - ) - - [true] => Array - ( - [expr_cond] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => strpos - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2_1 - ) - - ) - - ) - - [1] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2_1 - ) - - ) - - ) - - [false] => Array - ( - [exec] => str_replace - [args] => Array - ( - [0] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - [1] => Array - ( - [var] => buffer2 - ) - - [2] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2_1 - ) - - ) - - ) - - ) - - ) - - ) - - [false] => Array - ( - [var] => buffer2 - ) - - ) - - ) - - [13] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2_1 - ) - - ) - - ) - - ) - - [14] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [15] => Array - ( - [op] => declare - [name] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2 - ) - - ) - - [0] => Array - ( - [expr_cond] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2 - ) - - ) - - ) - - ) - - ) - - [true] => Array - ( - [expr_cond] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => strpos - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2 - ) - - ) - - ) - - [1] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2 - ) - - ) - - ) - - [false] => Array - ( - [exec] => str_replace - [args] => Array - ( - [0] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - [1] => Array - ( - [var] => buffer1 - ) - - [2] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2 - ) - - ) - - ) - - ) - - ) - - ) - - [false] => Array - ( - [var] => buffer1 - ) - - ) - - ) - - [16] => Array - ( - [op] => print - [0] => Array - ( - [exec] => Haanga::Load - [args] => Array - ( - [0] => Array - ( - [string] => assert_templates/nested_block.tpl - ) - - [1] => Array - ( - [var] => vars - ) - - [2] => Array - ( - [expr] => 1 - ) - - [3] => Array - ( - [var] => blocks - ) - - ) - - ) - - ) - - [17] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [18] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [19] => Array - ( - [op] => end_if - ) - - [20] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/nested_block_second_parent.tpl */ -function haanga_93071c9c441d1680a63883802200fe559306006e($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $buffer1 = ' - inner2\'s new value - '; - $buffer2 = ' - 2.1 - '; - $blocks['inner2_1'] = (isset($blocks['inner2_1']) ? (strpos($blocks['inner2_1'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['inner2_1'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer2, $blocks['inner2_1'])) : $buffer2); - $buffer1 .= $blocks['inner2_1'].' -'; - $blocks['inner2'] = (isset($blocks['inner2']) ? (strpos($blocks['inner2'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['inner2'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['inner2'])) : $buffer1); - echo Haanga::Load('assert_templates/nested_block.tpl', $vars, TRUE, $blocks); - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/nested_block_second_parent_override.tpl.php b/lib/Haanga/tests/tmp/assert_templates/nested_block_second_parent_override.tpl.php deleted file mode 100644 index cc001f47c0092b8cab13712b9652d16a0a123815..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/nested_block_second_parent_override.tpl.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/nested_block_second_parent_override.tpl */ -function haanga_d905488f199a96b638d52d62c0fc424fd291ed39($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $buffer1 = ' - 2.1-overrided -'; - $blocks['inner2_1'] = (isset($blocks['inner2_1']) ? (strpos($blocks['inner2_1'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['inner2_1'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['inner2_1'])) : $buffer1); - echo Haanga::Load('assert_templates/nested_block_second_parent.tpl', $vars, TRUE, $blocks); - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/nested_block_second_parent_override.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/nested_block_second_parent_override.tpl.php.dump deleted file mode 100644 index e2319780c98f865a092e3c0591553f406e782363..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/nested_block_second_parent_override.tpl.php.dump +++ /dev/null @@ -1,352 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/nested_block_second_parent_override.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_d905488f199a96b638d52d62c0fc424fd291ed39 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [9] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - 2.1-overrided - - ) - - ) - - [10] => Array - ( - [op] => declare - [name] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2_1 - ) - - ) - - [0] => Array - ( - [expr_cond] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2_1 - ) - - ) - - ) - - ) - - ) - - [true] => Array - ( - [expr_cond] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => strpos - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2_1 - ) - - ) - - ) - - [1] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2_1 - ) - - ) - - ) - - [false] => Array - ( - [exec] => str_replace - [args] => Array - ( - [0] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - [1] => Array - ( - [var] => buffer1 - ) - - [2] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => inner2_1 - ) - - ) - - ) - - ) - - ) - - ) - - [false] => Array - ( - [var] => buffer1 - ) - - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [exec] => Haanga::Load - [args] => Array - ( - [0] => Array - ( - [string] => assert_templates/nested_block_second_parent.tpl - ) - - [1] => Array - ( - [var] => vars - ) - - [2] => Array - ( - [expr] => 1 - ) - - [3] => Array - ( - [var] => blocks - ) - - ) - - ) - - ) - - [12] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [13] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [14] => Array - ( - [op] => end_if - ) - - [15] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/nested_block_second_parent_override.tpl */ -function haanga_d905488f199a96b638d52d62c0fc424fd291ed39($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $buffer1 = ' - 2.1-overrided -'; - $blocks['inner2_1'] = (isset($blocks['inner2_1']) ? (strpos($blocks['inner2_1'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['inner2_1'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['inner2_1'])) : $buffer1); - echo Haanga::Load('assert_templates/nested_block_second_parent.tpl', $vars, TRUE, $blocks); - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/object.tpl.php b/lib/Haanga/tests/tmp/assert_templates/object.tpl.php deleted file mode 100644 index a5db9ebe503aa92d23afa301ae806012b3326e2c..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/object.tpl.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/object.tpl */ -function haanga_c1df77e2249dc4876d6380db8edd1ed30a7f89cd($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo htmlspecialchars($obj->name).' -'.htmlspecialchars($obj->obj['name']).' -'.htmlspecialchars($arr['obj']->name).' -'.htmlspecialchars($arr['obj']->obj['name']).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/object.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/object.tpl.php.dump deleted file mode 100644 index 28bf7d5e313d337bdb963c09bd6aa6191a162cd1..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/object.tpl.php.dump +++ /dev/null @@ -1,318 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/object.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_c1df77e2249dc4876d6380db8edd1ed30a7f89cd - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => obj - [1] => Array - ( - [object] => name - ) - - ) - - ) - - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => obj - [1] => Array - ( - [object] => obj - ) - - [2] => name - ) - - ) - - ) - - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [12] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => arr - [1] => obj - [2] => Array - ( - [object] => name - ) - - ) - - ) - - ) - - ) - - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => arr - [1] => obj - [2] => Array - ( - [object] => obj - ) - - [3] => name - ) - - ) - - ) - - ) - - ) - - [15] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [16] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [17] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [18] => Array - ( - [op] => end_if - ) - - [19] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/object.tpl */ -function haanga_c1df77e2249dc4876d6380db8edd1ed30a7f89cd($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo htmlspecialchars($obj->name).' -'.htmlspecialchars($obj->obj['name']).' -'.htmlspecialchars($arr['obj']->name).' -'.htmlspecialchars($arr['obj']->obj['name']).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/partial.tpl.php b/lib/Haanga/tests/tmp/assert_templates/partial.tpl.php deleted file mode 100644 index ef5a7d6a82b152f3dbda1f9009a59ab175a451c9..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/partial.tpl.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/partial.tpl */ -function haanga_1e7ad0daf3a6652932dc9adf0aecfb68ab0bfa2e($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo 'Partial part -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/partial.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/partial.tpl.php.dump deleted file mode 100644 index db14ba6a61228850e13eaf496d07a2219bc90975..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/partial.tpl.php.dump +++ /dev/null @@ -1,166 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/partial.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_1e7ad0daf3a6652932dc9adf0aecfb68ab0bfa2e - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [string] => Partial part - - ) - - ) - - [9] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [10] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [11] => Array - ( - [op] => end_if - ) - - [12] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/partial.tpl */ -function haanga_1e7ad0daf3a6652932dc9adf0aecfb68ab0bfa2e($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo 'Partial part -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/pluralize.tpl.php b/lib/Haanga/tests/tmp/assert_templates/pluralize.tpl.php deleted file mode 100644 index 6d1470735b7eaabca1ecac8e7953c1b94ad1fbc5..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/pluralize.tpl.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/pluralize.tpl */ -function haanga_8c184871ca921f028f7795f4ca92714bb3dce1c7($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo 'message'.($num1 <= 1 ? '' : 's').' -walrus'.($num1 <= 1 ? '' : 'es').' -cherr'.($num1 <= 1 ? 'y' : 'ies').' -message'.($num2 <= 1 ? '' : 's').' -walrus'.($num2 <= 1 ? '' : 'es').' -cherr'.($num2 <= 1 ? 'y' : 'ies').' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/pluralize.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/pluralize.tpl.php.dump deleted file mode 100644 index b18c7288b3a41da9e106fc33020cbe3c0019368c..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/pluralize.tpl.php.dump +++ /dev/null @@ -1,440 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/pluralize.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_8c184871ca921f028f7795f4ca92714bb3dce1c7 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [string] => message - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [expr_cond] => Array - ( - [op_expr] => <= - [0] => Array - ( - [var] => num1 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - [true] => Array - ( - [string] => - ) - - [false] => Array - ( - [string] => s - ) - - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [string] => -walrus - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [expr_cond] => Array - ( - [op_expr] => <= - [0] => Array - ( - [var] => num1 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - [true] => Array - ( - [string] => - ) - - [false] => Array - ( - [string] => es - ) - - ) - - ) - - [12] => Array - ( - [op] => print - [0] => Array - ( - [string] => -cherr - ) - - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [expr_cond] => Array - ( - [op_expr] => <= - [0] => Array - ( - [var] => num1 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - [true] => Array - ( - [string] => y - ) - - [false] => Array - ( - [string] => ies - ) - - ) - - ) - - [14] => Array - ( - [op] => print - [0] => Array - ( - [string] => -message - ) - - ) - - [15] => Array - ( - [op] => print - [0] => Array - ( - [expr_cond] => Array - ( - [op_expr] => <= - [0] => Array - ( - [var] => num2 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - [true] => Array - ( - [string] => - ) - - [false] => Array - ( - [string] => s - ) - - ) - - ) - - [16] => Array - ( - [op] => print - [0] => Array - ( - [string] => -walrus - ) - - ) - - [17] => Array - ( - [op] => print - [0] => Array - ( - [expr_cond] => Array - ( - [op_expr] => <= - [0] => Array - ( - [var] => num2 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - [true] => Array - ( - [string] => - ) - - [false] => Array - ( - [string] => es - ) - - ) - - ) - - [18] => Array - ( - [op] => print - [0] => Array - ( - [string] => -cherr - ) - - ) - - [19] => Array - ( - [op] => print - [0] => Array - ( - [expr_cond] => Array - ( - [op_expr] => <= - [0] => Array - ( - [var] => num2 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - [true] => Array - ( - [string] => y - ) - - [false] => Array - ( - [string] => ies - ) - - ) - - ) - - [20] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [21] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [22] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [23] => Array - ( - [op] => end_if - ) - - [24] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/pluralize.tpl */ -function haanga_8c184871ca921f028f7795f4ca92714bb3dce1c7($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo 'message'.($num1 <= 1 ? '' : 's').' -walrus'.($num1 <= 1 ? '' : 'es').' -cherr'.($num1 <= 1 ? 'y' : 'ies').' -message'.($num2 <= 1 ? '' : 's').' -walrus'.($num2 <= 1 ? '' : 'es').' -cherr'.($num2 <= 1 ? 'y' : 'ies').' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/regroup.tpl.php b/lib/Haanga/tests/tmp/assert_templates/regroup.tpl.php deleted file mode 100644 index 0a5a2b72dcc64d2125bcbf328efe6c351d871506..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/regroup.tpl.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php -/* Load filter dictsort definition */ -require_once('/home/crodas/projects/playground/haanga/lib/Haanga/Extension/Filter/Dictsort.php'); -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/regroup.tpl */ -function haanga_e3288a8c38d2925df1b81c50c72b7eee31f8c2f9($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo ' -'; - /* Temporary sorting */ - $sorted_users = Haanga_Extension_Filter_Dictsort::main($users, $regroup_by); - $temp_group = Array(); - foreach ($sorted_users as $item) { - $temp_group[$item['age']][] = $item; - } - /* Proper format */ - $sorted_users = Array(); - foreach ($temp_group as $group => $item) { - $sorted_users[] = Array('grouper' => $group, 'list' => $item); - } - /* Sorting done */ - echo ' -'; - $t_users = $users; - $field = Array(); - foreach ($t_users as $key => $item) { - $field[$key] = $item[$regroup_by]; - } - array_multisort($field, SORT_REGULAR, $t_users); - echo ' -'; - /* Temporary sorting */ - $temp_group = Array(); - foreach ($t_users as $item) { - $temp_group[$item['age']][] = $item; - } - /* Proper format */ - $sorted_users1 = Array(); - foreach ($temp_group as $group => $item) { - $sorted_users1[] = Array('grouper' => $group, 'list' => $item); - } - /* Sorting done */ - echo ' - -'; - if ($sorted_users != $sorted_users1) { - echo ' - Error -'; - } - echo ' - -'; - $forcounter1_1 = 1; - foreach ($sorted_users as $user) { - echo ' - '.htmlspecialchars($user['grouper']).' - '; - $forcounter1_2 = 1; - $psize_2 = count($user['list']); - $islast_2 = ($forcounter1_2 == $psize_2); - $isfirst_2 = TRUE; - $revcount_2 = $psize_2; - $revcount0_2 = ($psize_2 - 1); - foreach ($user['list'] as $u) { - echo ' - '.$forcounter1_2.'-'.$revcount_2.'-'.$revcount0_2.' ('.$forcounter1_1.'). '.htmlspecialchars(ucfirst($u['name'])).' ('; - if (empty($isfirst_2) === FALSE) { - echo 'first'; - } else { - if (empty($islast_2) === FALSE) { - echo 'last'; - } - } - echo ') - '; - $forcounter1_2 = ($forcounter1_2 + 1); - $islast_2 = ($forcounter1_2 == $psize_2); - $isfirst_2 = FALSE; - $revcount_2 = ($revcount_2 - 1); - $revcount0_2 = ($revcount0_2 - 1); - } - echo ' -'; - $forcounter1_1 = ($forcounter1_1 + 1); - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/regroup.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/regroup.tpl.php.dump deleted file mode 100644 index 0fa5e185874e7f6a0739f5c4429e2879c95e169a..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/regroup.tpl.php.dump +++ /dev/null @@ -1,1362 +0,0 @@ -Array -( - [0] => Array - ( - [op] => comment - [comment] => Load filter dictsort definition - ) - - [1] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => require_once - [args] => Array - ( - [0] => Array - ( - [string] => /home/crodas/projects/playground/haanga/lib/Haanga/Extension/Filter/Dictsort.php - ) - - ) - - ) - - ) - - [2] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [3] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/regroup.tpl - ) - - [4] => Array - ( - [op] => function - [name] => haanga_e3288a8c38d2925df1b81c50c72b7eee31f8c2f9 - ) - - [5] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [7] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [8] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [9] => Array - ( - [op] => end_if - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [11] => Array - ( - [op] => comment - [comment] => Temporary sorting - ) - - [12] => Array - ( - [op] => declare - [name] => sorted_users - [0] => Array - ( - [exec] => Haanga_Extension_Filter_Dictsort::main - [args] => Array - ( - [0] => Array - ( - [var] => users - ) - - [1] => Array - ( - [var] => regroup_by - ) - - ) - - ) - - ) - - [13] => Array - ( - [op] => declare - [name] => temp_group - [0] => Array - ( - [array] => Array - ( - ) - - ) - - ) - - [14] => Array - ( - [op] => foreach - [array] => sorted_users - [value] => item - ) - - [15] => Array - ( - [op] => declare - [name] => Array - ( - [0] => temp_group - [1] => Array - ( - [var] => Array - ( - [0] => item - [1] => Array - ( - [string] => age - ) - - ) - - ) - - [2] => Array - ( - ) - - ) - - [0] => Array - ( - [var] => item - ) - - ) - - [16] => Array - ( - [op] => end_foreach - ) - - [17] => Array - ( - [op] => comment - [comment] => Proper format - ) - - [18] => Array - ( - [op] => declare - [name] => sorted_users - [0] => Array - ( - [array] => Array - ( - ) - - ) - - ) - - [19] => Array - ( - [op] => foreach - [array] => temp_group - [value] => item - [key] => group - ) - - [20] => Array - ( - [op] => declare - [name] => Array - ( - [0] => sorted_users - [1] => Array - ( - ) - - ) - - [0] => Array - ( - [array] => Array - ( - [0] => Array - ( - [key] => Array - ( - [0] => Array - ( - [string] => grouper - ) - - [1] => Array - ( - [var] => group - ) - - ) - - ) - - [1] => Array - ( - [key] => Array - ( - [0] => Array - ( - [string] => list - ) - - [1] => Array - ( - [var] => item - ) - - ) - - ) - - ) - - ) - - ) - - [21] => Array - ( - [op] => end_foreach - ) - - [22] => Array - ( - [op] => comment - [comment] => Sorting done - ) - - [23] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [24] => Array - ( - [op] => declare - [name] => t_users - [0] => Array - ( - [var] => users - ) - - ) - - [25] => Array - ( - [op] => declare - [name] => field - [0] => Array - ( - [array] => Array - ( - ) - - ) - - ) - - [26] => Array - ( - [op] => foreach - [array] => t_users - [value] => item - [key] => key - ) - - [27] => Array - ( - [op] => declare - [name] => Array - ( - [0] => field - [1] => Array - ( - [var] => key - ) - - ) - - [0] => Array - ( - [var] => Array - ( - [0] => item - [1] => Array - ( - [var] => regroup_by - ) - - ) - - ) - - ) - - [28] => Array - ( - [op] => end_foreach - ) - - [29] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => array_multisort - [args] => Array - ( - [0] => Array - ( - [var] => field - ) - - [1] => Array - ( - [constant] => SORT_REGULAR - ) - - [2] => Array - ( - [var] => t_users - ) - - ) - - ) - - ) - - [30] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [31] => Array - ( - [op] => comment - [comment] => Temporary sorting - ) - - [32] => Array - ( - [op] => declare - [name] => temp_group - [0] => Array - ( - [array] => Array - ( - ) - - ) - - ) - - [33] => Array - ( - [op] => foreach - [array] => t_users - [value] => item - ) - - [34] => Array - ( - [op] => declare - [name] => Array - ( - [0] => temp_group - [1] => Array - ( - [var] => Array - ( - [0] => item - [1] => Array - ( - [string] => age - ) - - ) - - ) - - [2] => Array - ( - ) - - ) - - [0] => Array - ( - [var] => item - ) - - ) - - [35] => Array - ( - [op] => end_foreach - ) - - [36] => Array - ( - [op] => comment - [comment] => Proper format - ) - - [37] => Array - ( - [op] => declare - [name] => sorted_users1 - [0] => Array - ( - [array] => Array - ( - ) - - ) - - ) - - [38] => Array - ( - [op] => foreach - [array] => temp_group - [value] => item - [key] => group - ) - - [39] => Array - ( - [op] => declare - [name] => Array - ( - [0] => sorted_users1 - [1] => Array - ( - ) - - ) - - [0] => Array - ( - [array] => Array - ( - [0] => Array - ( - [key] => Array - ( - [0] => Array - ( - [string] => grouper - ) - - [1] => Array - ( - [var] => group - ) - - ) - - ) - - [1] => Array - ( - [key] => Array - ( - [0] => Array - ( - [string] => list - ) - - [1] => Array - ( - [var] => item - ) - - ) - - ) - - ) - - ) - - ) - - [40] => Array - ( - [op] => end_foreach - ) - - [41] => Array - ( - [op] => comment - [comment] => Sorting done - ) - - [42] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - - ) - - ) - - [43] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => != - [0] => Array - ( - [var] => sorted_users - ) - - [1] => Array - ( - [var] => sorted_users1 - ) - - ) - - ) - - [44] => Array - ( - [op] => print - [0] => Array - ( - [string] => - Error - - ) - - ) - - [45] => Array - ( - [op] => end_if - ) - - [46] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - - ) - - ) - - [47] => Array - ( - [op] => declare - [name] => forcounter1_1 - [0] => Array - ( - [number] => 1 - ) - - ) - - [48] => Array - ( - [op] => foreach - [array] => sorted_users - [value] => user - ) - - [49] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [50] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => user - [1] => grouper - ) - - ) - - ) - - ) - - ) - - [51] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [52] => Array - ( - [op] => declare - [name] => forcounter1_2 - [0] => Array - ( - [number] => 1 - ) - - ) - - [53] => Array - ( - [op] => declare - [name] => psize_2 - [0] => Array - ( - [exec] => count - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => user - [1] => list - ) - - ) - - ) - - ) - - ) - - [54] => Array - ( - [op] => declare - [name] => islast_2 - [0] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => forcounter1_2 - ) - - [1] => Array - ( - [var] => psize_2 - ) - - ) - - ) - - [55] => Array - ( - [op] => declare - [name] => isfirst_2 - [0] => Array - ( - [expr] => 1 - ) - - ) - - [56] => Array - ( - [op] => declare - [name] => revcount_2 - [0] => Array - ( - [var] => psize_2 - ) - - ) - - [57] => Array - ( - [op] => declare - [name] => revcount0_2 - [0] => Array - ( - [op_expr] => - - [0] => Array - ( - [var] => psize_2 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - ) - - [58] => Array - ( - [op] => foreach - [array] => Array - ( - [0] => user - [1] => list - ) - - [value] => u - ) - - [59] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [60] => Array - ( - [op] => print - [0] => Array - ( - [var] => forcounter1_2 - ) - - ) - - [61] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [62] => Array - ( - [op] => print - [0] => Array - ( - [var] => revcount_2 - ) - - ) - - [63] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [64] => Array - ( - [op] => print - [0] => Array - ( - [var] => revcount0_2 - ) - - ) - - [65] => Array - ( - [op] => print - [0] => Array - ( - [string] => ( - ) - - ) - - [66] => Array - ( - [op] => print - [0] => Array - ( - [var] => forcounter1_1 - ) - - ) - - [67] => Array - ( - [op] => print - [0] => Array - ( - [string] => ). - ) - - ) - - [68] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [exec] => ucfirst - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => u - [1] => name - ) - - ) - - ) - - ) - - ) - - ) - - ) - - [69] => Array - ( - [op] => print - [0] => Array - ( - [string] => ( - ) - - ) - - [70] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => isfirst_2 - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - ) - - [71] => Array - ( - [op] => print - [0] => Array - ( - [string] => first - ) - - ) - - [72] => Array - ( - [op] => else - ) - - [73] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => islast_2 - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - ) - - [74] => Array - ( - [op] => print - [0] => Array - ( - [string] => last - ) - - ) - - [75] => Array - ( - [op] => end_if - ) - - [76] => Array - ( - [op] => end_if - ) - - [77] => Array - ( - [op] => print - [0] => Array - ( - [string] => ) - - ) - - ) - - [78] => Array - ( - [op] => declare - [name] => forcounter1_2 - [0] => Array - ( - [op_expr] => + - [0] => Array - ( - [var] => forcounter1_2 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - ) - - [79] => Array - ( - [op] => declare - [name] => islast_2 - [0] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => forcounter1_2 - ) - - [1] => Array - ( - [var] => psize_2 - ) - - ) - - ) - - [80] => Array - ( - [op] => declare - [name] => isfirst_2 - [0] => Array - ( - [expr] => - ) - - ) - - [81] => Array - ( - [op] => declare - [name] => revcount_2 - [0] => Array - ( - [op_expr] => - - [0] => Array - ( - [var] => revcount_2 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - ) - - [82] => Array - ( - [op] => declare - [name] => revcount0_2 - [0] => Array - ( - [op_expr] => - - [0] => Array - ( - [var] => revcount0_2 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - ) - - [83] => Array - ( - [op] => end_foreach - ) - - [84] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [85] => Array - ( - [op] => declare - [name] => forcounter1_1 - [0] => Array - ( - [op_expr] => + - [0] => Array - ( - [var] => forcounter1_1 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - ) - - [86] => Array - ( - [op] => end_foreach - ) - - [87] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [88] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [89] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [90] => Array - ( - [op] => end_if - ) - - [91] => Array - ( - [op] => end_function - ) - - [php] => -/* Load filter dictsort definition */ -require_once('/home/crodas/projects/playground/haanga/lib/Haanga/Extension/Filter/Dictsort.php'); -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/regroup.tpl */ -function haanga_e3288a8c38d2925df1b81c50c72b7eee31f8c2f9($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo ' -'; - /* Temporary sorting */ - $sorted_users = Haanga_Extension_Filter_Dictsort::main($users, $regroup_by); - $temp_group = Array(); - foreach ($sorted_users as $item) { - $temp_group[$item['age']][] = $item; - } - /* Proper format */ - $sorted_users = Array(); - foreach ($temp_group as $group => $item) { - $sorted_users[] = Array('grouper' => $group, 'list' => $item); - } - /* Sorting done */ - echo ' -'; - $t_users = $users; - $field = Array(); - foreach ($t_users as $key => $item) { - $field[$key] = $item[$regroup_by]; - } - array_multisort($field, SORT_REGULAR, $t_users); - echo ' -'; - /* Temporary sorting */ - $temp_group = Array(); - foreach ($t_users as $item) { - $temp_group[$item['age']][] = $item; - } - /* Proper format */ - $sorted_users1 = Array(); - foreach ($temp_group as $group => $item) { - $sorted_users1[] = Array('grouper' => $group, 'list' => $item); - } - /* Sorting done */ - echo ' - -'; - if ($sorted_users != $sorted_users1) { - echo ' - Error -'; - } - echo ' - -'; - $forcounter1_1 = 1; - foreach ($sorted_users as $user) { - echo ' - '.htmlspecialchars($user['grouper']).' - '; - $forcounter1_2 = 1; - $psize_2 = count($user['list']); - $islast_2 = ($forcounter1_2 == $psize_2); - $isfirst_2 = TRUE; - $revcount_2 = $psize_2; - $revcount0_2 = ($psize_2 - 1); - foreach ($user['list'] as $u) { - echo ' - '.$forcounter1_2.'-'.$revcount_2.'-'.$revcount0_2.' ('.$forcounter1_1.'). '.htmlspecialchars(ucfirst($u['name'])).' ('; - if (empty($isfirst_2) === FALSE) { - echo 'first'; - } else { - if (empty($islast_2) === FALSE) { - echo 'last'; - } - } - echo ') - '; - $forcounter1_2 = ($forcounter1_2 + 1); - $islast_2 = ($forcounter1_2 == $psize_2); - $isfirst_2 = FALSE; - $revcount_2 = ($revcount_2 - 1); - $revcount0_2 = ($revcount0_2 - 1); - } - echo ' -'; - $forcounter1_1 = ($forcounter1_1 + 1); - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/set.tpl.php b/lib/Haanga/tests/tmp/assert_templates/set.tpl.php deleted file mode 100644 index 80fe8a03b52cb9359cb4bbbc5a89eb204532781a..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/set.tpl.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/set.tpl */ -function haanga_f5ad40d56c2438ea6bb3882d3b5e5ebf18352938($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $foo = (5 + 1); - $vars['foo'] = $foo; - echo ' -'; - $bar = 'testing'; - $vars['bar'] = $bar; - echo ' -'.htmlspecialchars($foo).' -'.Haanga::Load('assert_templates/sub_set.tpl', $vars, TRUE, $blocks).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/set.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/set.tpl.php.dump deleted file mode 100644 index 9462ac20cb858ba74f54a1d54032c24d998b866f..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/set.tpl.php.dump +++ /dev/null @@ -1,332 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/set.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_f5ad40d56c2438ea6bb3882d3b5e5ebf18352938 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => declare - [name] => foo - [0] => Array - ( - [op_expr] => + - [0] => Array - ( - [number] => 5 - ) - - [1] => Array - ( - [number] => 1 - ) - - ) - - ) - - [9] => Array - ( - [op] => declare - [name] => Array - ( - [0] => vars - [1] => Array - ( - [string] => foo - ) - - ) - - [0] => Array - ( - [var] => foo - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [11] => Array - ( - [op] => declare - [name] => bar - [0] => Array - ( - [string] => testing - ) - - ) - - [12] => Array - ( - [op] => declare - [name] => Array - ( - [0] => vars - [1] => Array - ( - [string] => bar - ) - - ) - - [0] => Array - ( - [var] => bar - ) - - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => foo - ) - - ) - - ) - - ) - - [15] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [16] => Array - ( - [op] => print - [0] => Array - ( - [exec] => Haanga::Load - [args] => Array - ( - [0] => Array - ( - [string] => assert_templates/sub_set.tpl - ) - - [1] => Array - ( - [var] => vars - ) - - [2] => Array - ( - [expr] => 1 - ) - - [3] => Array - ( - [var] => blocks - ) - - ) - - ) - - ) - - [17] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [18] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [19] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [20] => Array - ( - [op] => end_if - ) - - [21] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/set.tpl */ -function haanga_f5ad40d56c2438ea6bb3882d3b5e5ebf18352938($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $foo = (5 + 1); - $vars['foo'] = $foo; - echo ' -'; - $bar = 'testing'; - $vars['bar'] = $bar; - echo ' -'.htmlspecialchars($foo).' -'.Haanga::Load('assert_templates/sub_set.tpl', $vars, TRUE, $blocks).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/spaceless.tpl.php b/lib/Haanga/tests/tmp/assert_templates/spaceless.tpl.php deleted file mode 100644 index 9c46660226f4054d3e9d5adcbea609c87d063b5e..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/spaceless.tpl.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/spaceless.tpl */ -function haanga_51446bb05a294ee636668b4fd94a6dd706202215($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $buffer1 = ' -<p> - <a href="foo/"> Foo </a> - </p> '; - echo preg_replace(Array('/>[ \\t\\r\\n]+</sU', '/^[ \\t\\r\\n]+</sU', '/>[ \\t\\r\\n]+$/sU'), Array('><', '<', '>'), $buffer1).' -=========================== -'; - $buffer1 = ' -<b> - <pre> - Something cool - - </pre> - - - - - - - - -</b> '; - echo preg_replace(Array('/>[ \\t\\r\\n]+</sU', '/^[ \\t\\r\\n]+</sU', '/>[ \\t\\r\\n]+$/sU'), Array('><', '<', '>'), $buffer1).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/spaceless.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/spaceless.tpl.php.dump deleted file mode 100644 index dda458256fb862030b481cf6906d5dbd928484b6..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/spaceless.tpl.php.dump +++ /dev/null @@ -1,391 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/spaceless.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_51446bb05a294ee636668b4fd94a6dd706202215 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [9] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => -<p> - <a href="foo/"> Foo </a> - </p> - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [exec] => preg_replace - [args] => Array - ( - [0] => Array - ( - [array] => Array - ( - [0] => Array - ( - [string] => />[ \t\r\n]+</sU - ) - - [1] => Array - ( - [string] => /^[ \t\r\n]+</sU - ) - - [2] => Array - ( - [string] => />[ \t\r\n]+$/sU - ) - - ) - - ) - - [1] => Array - ( - [array] => Array - ( - [0] => Array - ( - [string] => >< - ) - - [1] => Array - ( - [string] => < - ) - - [2] => Array - ( - [string] => > - ) - - ) - - ) - - [2] => Array - ( - [var] => buffer1 - ) - - ) - - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => -=========================== - - ) - - ) - - [12] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [13] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => -<b> - <pre> - Something cool - - </pre> - - - - - - - - -</b> - ) - - ) - - [14] => Array - ( - [op] => print - [0] => Array - ( - [exec] => preg_replace - [args] => Array - ( - [0] => Array - ( - [array] => Array - ( - [0] => Array - ( - [string] => />[ \t\r\n]+</sU - ) - - [1] => Array - ( - [string] => /^[ \t\r\n]+</sU - ) - - [2] => Array - ( - [string] => />[ \t\r\n]+$/sU - ) - - ) - - ) - - [1] => Array - ( - [array] => Array - ( - [0] => Array - ( - [string] => >< - ) - - [1] => Array - ( - [string] => < - ) - - [2] => Array - ( - [string] => > - ) - - ) - - ) - - [2] => Array - ( - [var] => buffer1 - ) - - ) - - ) - - ) - - [15] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [16] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [17] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [18] => Array - ( - [op] => end_if - ) - - [19] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/spaceless.tpl */ -function haanga_51446bb05a294ee636668b4fd94a6dd706202215($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $buffer1 = ' -<p> - <a href="foo/"> Foo </a> - </p> '; - echo preg_replace(Array('/>[ \\t\\r\\n]+</sU', '/^[ \\t\\r\\n]+</sU', '/>[ \\t\\r\\n]+$/sU'), Array('><', '<', '>'), $buffer1).' -=========================== -'; - $buffer1 = ' -<b> - <pre> - Something cool - - </pre> - - - - - - - - -</b> '; - echo preg_replace(Array('/>[ \\t\\r\\n]+</sU', '/^[ \\t\\r\\n]+</sU', '/>[ \\t\\r\\n]+$/sU'), Array('><', '<', '>'), $buffer1).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/strip_whitespace.tpl.php b/lib/Haanga/tests/tmp/assert_templates/strip_whitespace.tpl.php deleted file mode 100644 index d793277ba49a23268aa16b6fd8344d2d9d281165..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/strip_whitespace.tpl.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/strip_whitespace.tpl */ -function haanga_d7c4d5b38d3a7e0818e446612beff5c975ed8985($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - if (empty($test_global) === FALSE) { - - foreach ($test_global as $i) { - echo ' '.htmlspecialchars($i).' '.htmlspecialchars($i).' '; - } - - } - echo ' <b> Texto laargo </b> <pre> -Este es un texto - -con - espacios - -</pre> Another text '; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/strip_whitespace.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/strip_whitespace.tpl.php.dump deleted file mode 100644 index 0a4088dc84154a83b9f37dc25b1ad81469f8c9a9..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/strip_whitespace.tpl.php.dump +++ /dev/null @@ -1,337 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/strip_whitespace.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_d7c4d5b38d3a7e0818e446612beff5c975ed8985 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => test_global - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - ) - - ) - - [10] => Array - ( - [op] => foreach - [array] => test_global - [value] => i - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - ) - - ) - - [12] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => i - ) - - ) - - ) - - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - ) - - ) - - [14] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => i - ) - - ) - - ) - - ) - - [15] => Array - ( - [op] => print - [0] => Array - ( - [string] => - ) - - ) - - [16] => Array - ( - [op] => end_foreach - ) - - [17] => Array - ( - [op] => print - [0] => Array - ( - [string] => - ) - - ) - - [18] => Array - ( - [op] => end_if - ) - - [19] => Array - ( - [op] => print - [0] => Array - ( - [string] => <b> Texto laargo </b> - ) - - ) - - [20] => Array - ( - [op] => print - [0] => Array - ( - [string] => <pre> -Este es un texto - -con - espacios - -</pre> - ) - - ) - - [21] => Array - ( - [op] => print - [0] => Array - ( - [string] => Another text - ) - - ) - - [22] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [23] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [24] => Array - ( - [op] => end_if - ) - - [25] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/strip_whitespace.tpl */ -function haanga_d7c4d5b38d3a7e0818e446612beff5c975ed8985($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - if (empty($test_global) === FALSE) { - - foreach ($test_global as $i) { - echo ' '.htmlspecialchars($i).' '.htmlspecialchars($i).' '; - } - - } - echo ' <b> Texto laargo </b> <pre> -Este es un texto - -con - espacios - -</pre> Another text '; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/sub_set.tpl.php b/lib/Haanga/tests/tmp/assert_templates/sub_set.tpl.php deleted file mode 100644 index 19950f3235b32b3460098b5600444ec1fc2fd860..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/sub_set.tpl.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/sub_set.tpl */ -function haanga_c0e0fadb893787a4c67d48dcc8457a9f7955fc06($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo htmlspecialchars($bar).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/sub_set.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/sub_set.tpl.php.dump deleted file mode 100644 index 04b072187861cc3c809018437f1c85755bb9f942..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/sub_set.tpl.php.dump +++ /dev/null @@ -1,185 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/sub_set.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_c0e0fadb893787a4c67d48dcc8457a9f7955fc06 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [var] => bar - ) - - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [11] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [12] => Array - ( - [op] => end_if - ) - - [13] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/sub_set.tpl */ -function haanga_c0e0fadb893787a4c67d48dcc8457a9f7955fc06($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo htmlspecialchars($bar).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/subtemplate.tpl.php b/lib/Haanga/tests/tmp/assert_templates/subtemplate.tpl.php deleted file mode 100644 index 41739b3dca0e1eb837d91214da13f4ec82152eac..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/subtemplate.tpl.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/subtemplate.tpl */ -function haanga_8012978a44e77332b744185d044350c7eb89603f($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $buffer1 = 'My Title - {{block.1b3231655cebb7a1f783eddf27d254ca}}'; - $blocks['title'] = (isset($blocks['title']) ? (strpos($blocks['title'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['title'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['title'])) : $buffer1); - $buffer1 = ' - {{block.1b3231655cebb7a1f783eddf27d254ca}} - - :-) -'; - $blocks['main.menu'] = (isset($blocks['main.menu']) ? (strpos($blocks['main.menu'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['main.menu'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['main.menu'])) : $buffer1); - echo Haanga::Load('assert_templates/base.tpl', $vars, TRUE, $blocks); - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/subtemplate.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/subtemplate.tpl.php.dump deleted file mode 100644 index 88becfc289dd0117400ca36f1a583eddc1ce2bf6..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/subtemplate.tpl.php.dump +++ /dev/null @@ -1,549 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/subtemplate.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_8012978a44e77332b744185d044350c7eb89603f - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [9] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => My Title - - ) - - ) - - [10] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - ) - - [11] => Array - ( - [op] => declare - [name] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => title - ) - - ) - - [0] => Array - ( - [expr_cond] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => title - ) - - ) - - ) - - ) - - ) - - [true] => Array - ( - [expr_cond] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => strpos - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => title - ) - - ) - - ) - - [1] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => title - ) - - ) - - ) - - [false] => Array - ( - [exec] => str_replace - [args] => Array - ( - [0] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - [1] => Array - ( - [var] => buffer1 - ) - - [2] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => title - ) - - ) - - ) - - ) - - ) - - ) - - [false] => Array - ( - [var] => buffer1 - ) - - ) - - ) - - [12] => Array - ( - [op] => declare - [name] => buffer1 - [0] => Array - ( - [string] => - ) - - ) - - [13] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - ) - - [15] => Array - ( - [op] => append_var - [name] => buffer1 - [0] => Array - ( - [string] => - - :-) - - ) - - ) - - [16] => Array - ( - [op] => declare - [name] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => main.menu - ) - - ) - - [0] => Array - ( - [expr_cond] => Array - ( - [exec] => isset - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => main.menu - ) - - ) - - ) - - ) - - ) - - [true] => Array - ( - [expr_cond] => Array - ( - [op_expr] => === - [0] => Array - ( - [exec] => strpos - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => main.menu - ) - - ) - - ) - - [1] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - ) - - ) - - [1] => Array - ( - [expr] => - ) - - ) - - [true] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => main.menu - ) - - ) - - ) - - [false] => Array - ( - [exec] => str_replace - [args] => Array - ( - [0] => Array - ( - [string] => {{block.1b3231655cebb7a1f783eddf27d254ca}} - ) - - [1] => Array - ( - [var] => buffer1 - ) - - [2] => Array - ( - [var] => Array - ( - [0] => blocks - [1] => Array - ( - [string] => main.menu - ) - - ) - - ) - - ) - - ) - - ) - - [false] => Array - ( - [var] => buffer1 - ) - - ) - - ) - - [17] => Array - ( - [op] => print - [0] => Array - ( - [exec] => Haanga::Load - [args] => Array - ( - [0] => Array - ( - [string] => assert_templates/base.tpl - ) - - [1] => Array - ( - [var] => vars - ) - - [2] => Array - ( - [expr] => 1 - ) - - [3] => Array - ( - [var] => blocks - ) - - ) - - ) - - ) - - [18] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [19] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [20] => Array - ( - [op] => end_if - ) - - [21] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/subtemplate.tpl */ -function haanga_8012978a44e77332b744185d044350c7eb89603f($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - $buffer1 = 'My Title - {{block.1b3231655cebb7a1f783eddf27d254ca}}'; - $blocks['title'] = (isset($blocks['title']) ? (strpos($blocks['title'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['title'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['title'])) : $buffer1); - $buffer1 = ' - {{block.1b3231655cebb7a1f783eddf27d254ca}} - - :-) -'; - $blocks['main.menu'] = (isset($blocks['main.menu']) ? (strpos($blocks['main.menu'], '{{block.1b3231655cebb7a1f783eddf27d254ca}}') === FALSE ? $blocks['main.menu'] : str_replace('{{block.1b3231655cebb7a1f783eddf27d254ca}}', $buffer1, $blocks['main.menu'])) : $buffer1); - echo Haanga::Load('assert_templates/base.tpl', $vars, TRUE, $blocks); - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/templatetag.tpl.php b/lib/Haanga/tests/tmp/assert_templates/templatetag.tpl.php deleted file mode 100644 index b90609ebdb433cb6bd8496e3ba26bf1e66866097..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/templatetag.tpl.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/templatetag.tpl */ -function haanga_e8adad36286908587f35889b124b818b834c1e4f($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo '{%foo%} -{%foo%} -{{foo}} -{foo} -{#foo#} -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/templatetag.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/templatetag.tpl.php.dump deleted file mode 100644 index 55de9592e5d533668e02742f730504803474db2c..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/templatetag.tpl.php.dump +++ /dev/null @@ -1,364 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/templatetag.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_e8adad36286908587f35889b124b818b834c1e4f - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [string] => {% - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => foo - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [string] => %} - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [12] => Array - ( - [op] => print - [0] => Array - ( - [string] => {% - ) - - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => foo - ) - - ) - - [14] => Array - ( - [op] => print - [0] => Array - ( - [string] => %} - ) - - ) - - [15] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [16] => Array - ( - [op] => print - [0] => Array - ( - [string] => {{ - ) - - ) - - [17] => Array - ( - [op] => print - [0] => Array - ( - [string] => foo - ) - - ) - - [18] => Array - ( - [op] => print - [0] => Array - ( - [string] => }} - ) - - ) - - [19] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [20] => Array - ( - [op] => print - [0] => Array - ( - [string] => { - ) - - ) - - [21] => Array - ( - [op] => print - [0] => Array - ( - [string] => foo - ) - - ) - - [22] => Array - ( - [op] => print - [0] => Array - ( - [string] => } - ) - - ) - - [23] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [24] => Array - ( - [op] => print - [0] => Array - ( - [string] => {# - ) - - ) - - [25] => Array - ( - [op] => print - [0] => Array - ( - [string] => foo - ) - - ) - - [26] => Array - ( - [op] => print - [0] => Array - ( - [string] => #} - ) - - ) - - [27] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [28] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [29] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [30] => Array - ( - [op] => end_if - ) - - [31] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/templatetag.tpl */ -function haanga_e8adad36286908587f35889b124b818b834c1e4f($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo '{%foo%} -{%foo%} -{{foo}} -{foo} -{#foo#} -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/title.tpl.php b/lib/Haanga/tests/tmp/assert_templates/title.tpl.php deleted file mode 100644 index b3086834e5e66327bca649b02f3422f59a03808f..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/title.tpl.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/title.tpl */ -function haanga_02538e36710a9b95d7e6c8d1e1bba6e65b566aa4($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo htmlspecialchars(ucwords(strtolower($title))).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/title.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/title.tpl.php.dump deleted file mode 100644 index b7c897173b4751799d257de855917ca7e5994a38..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/title.tpl.php.dump +++ /dev/null @@ -1,203 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/title.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_02538e36710a9b95d7e6c8d1e1bba6e65b566aa4 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [exec] => ucwords - [args] => Array - ( - [0] => Array - ( - [exec] => strtolower - [args] => Array - ( - [0] => Array - ( - [var] => title - ) - - ) - - ) - - ) - - ) - - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [11] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [12] => Array - ( - [op] => end_if - ) - - [13] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/title.tpl */ -function haanga_02538e36710a9b95d7e6c8d1e1bba6e65b566aa4($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo htmlspecialchars(ucwords(strtolower($title))).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/trans.tpl.php b/lib/Haanga/tests/tmp/assert_templates/trans.tpl.php deleted file mode 100644 index ddf3253f363b28817d54c22c971e2c68856030af..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/trans.tpl.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/trans.tpl */ -function haanga_8d35b55be0c9b118eda2226b6b520297156d8d6d($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo _('Translation').' -'.sprintf(_('Translation by %s'), 'cesar').' -'.htmlspecialchars(_($text)).' -'.htmlspecialchars(ucfirst(_($text))).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/trans.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/trans.tpl.php.dump deleted file mode 100644 index eeb8fad8908bd8db6690838dde56badff5875123..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/trans.tpl.php.dump +++ /dev/null @@ -1,319 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/trans.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_8d35b55be0c9b118eda2226b6b520297156d8d6d - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [exec] => _ - [args] => Array - ( - [0] => Array - ( - [string] => Translation - ) - - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [exec] => sprintf - [args] => Array - ( - [0] => Array - ( - [exec] => _ - [args] => Array - ( - [0] => Array - ( - [string] => Translation by %s - ) - - ) - - ) - - [1] => Array - ( - [string] => cesar - ) - - ) - - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [12] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [exec] => _ - [args] => Array - ( - [0] => Array - ( - [var] => text - ) - - ) - - ) - - ) - - ) - - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [exec] => ucfirst - [args] => Array - ( - [0] => Array - ( - [exec] => _ - [args] => Array - ( - [0] => Array - ( - [var] => text - ) - - ) - - ) - - ) - - ) - - ) - - ) - - ) - - [15] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [16] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [17] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [18] => Array - ( - [op] => end_if - ) - - [19] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/trans.tpl */ -function haanga_8d35b55be0c9b118eda2226b6b520297156d8d6d($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo _('Translation').' -'.sprintf(_('Translation by %s'), 'cesar').' -'.htmlspecialchars(_($text)).' -'.htmlspecialchars(ucfirst(_($text))).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/truncatewords.tpl.php b/lib/Haanga/tests/tmp/assert_templates/truncatewords.tpl.php deleted file mode 100644 index e6d9b305047c52c81c02d2e6df0decb042ce46df..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/truncatewords.tpl.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php -/* Load filter truncatewords definition */ -require_once('/home/crodas/projects/playground/haanga/lib/Haanga/Extension/Filter/Truncatewords.php'); -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/truncatewords.tpl */ -function haanga_33ff616729fa5b4a494db28dee3c3f04cecdd01d($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo htmlspecialchars(ucwords(strtolower(Haanga_Extension_Filter_Truncatewords::main($short_text, 2)))).' -'.htmlspecialchars(ucwords(strtolower(Haanga_Extension_Filter_Truncatewords::main($text, 2)))).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/truncatewords.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/truncatewords.tpl.php.dump deleted file mode 100644 index b704a81e4bdf9bb3533892357479e96db8bfda8d..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/truncatewords.tpl.php.dump +++ /dev/null @@ -1,307 +0,0 @@ -Array -( - [0] => Array - ( - [op] => comment - [comment] => Load filter truncatewords definition - ) - - [1] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => require_once - [args] => Array - ( - [0] => Array - ( - [string] => /home/crodas/projects/playground/haanga/lib/Haanga/Extension/Filter/Truncatewords.php - ) - - ) - - ) - - ) - - [2] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [3] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/truncatewords.tpl - ) - - [4] => Array - ( - [op] => function - [name] => haanga_33ff616729fa5b4a494db28dee3c3f04cecdd01d - ) - - [5] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [7] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [8] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [9] => Array - ( - [op] => end_if - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [exec] => ucwords - [args] => Array - ( - [0] => Array - ( - [exec] => strtolower - [args] => Array - ( - [0] => Array - ( - [exec] => Haanga_Extension_Filter_Truncatewords::main - [args] => Array - ( - [0] => Array - ( - [var] => short_text - ) - - [1] => Array - ( - [number] => 2 - ) - - ) - - ) - - ) - - ) - - ) - - ) - - ) - - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [12] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [exec] => ucwords - [args] => Array - ( - [0] => Array - ( - [exec] => strtolower - [args] => Array - ( - [0] => Array - ( - [exec] => Haanga_Extension_Filter_Truncatewords::main - [args] => Array - ( - [0] => Array - ( - [var] => text - ) - - [1] => Array - ( - [number] => 2 - ) - - ) - - ) - - ) - - ) - - ) - - ) - - ) - - ) - - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [15] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [16] => Array - ( - [op] => end_if - ) - - [17] => Array - ( - [op] => end_function - ) - - [php] => -/* Load filter truncatewords definition */ -require_once('/home/crodas/projects/playground/haanga/lib/Haanga/Extension/Filter/Truncatewords.php'); -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/truncatewords.tpl */ -function haanga_33ff616729fa5b4a494db28dee3c3f04cecdd01d($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo htmlspecialchars(ucwords(strtolower(Haanga_Extension_Filter_Truncatewords::main($short_text, 2)))).' -'.htmlspecialchars(ucwords(strtolower(Haanga_Extension_Filter_Truncatewords::main($text, 2)))).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/try_include.tpl.php b/lib/Haanga/tests/tmp/assert_templates/try_include.tpl.php deleted file mode 100644 index 530a4cf878cd81948863313d3a7e9cb2864f8c16..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/try_include.tpl.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/try_include.tpl */ -function haanga_2918f6e9aedbd5d32e8a5d091ed1985fcf7008e3($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo Haanga::Safe_Load('foobar-tpl.tpl', $vars, TRUE, Array()).' -'.Haanga::Safe_Load('assert_templates/partial.tpl', $vars, TRUE, Array()).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/try_include.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/try_include.tpl.php.dump deleted file mode 100644 index c28930541599b76bd5f7ca0f07f526f69c8efd72..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/try_include.tpl.php.dump +++ /dev/null @@ -1,252 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/try_include.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_2918f6e9aedbd5d32e8a5d091ed1985fcf7008e3 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => print - [0] => Array - ( - [exec] => Haanga::Safe_Load - [args] => Array - ( - [0] => Array - ( - [string] => foobar-tpl.tpl - ) - - [1] => Array - ( - [var] => vars - ) - - [2] => Array - ( - [expr] => 1 - ) - - [3] => Array - ( - [array] => Array - ( - ) - - ) - - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [exec] => Haanga::Safe_Load - [args] => Array - ( - [0] => Array - ( - [string] => assert_templates/partial.tpl - ) - - [1] => Array - ( - [var] => vars - ) - - [2] => Array - ( - [expr] => 1 - ) - - [3] => Array - ( - [array] => Array - ( - ) - - ) - - ) - - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [12] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [13] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [14] => Array - ( - [op] => end_if - ) - - [15] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/try_include.tpl */ -function haanga_2918f6e9aedbd5d32e8a5d091ed1985fcf7008e3($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - echo Haanga::Safe_Load('foobar-tpl.tpl', $vars, TRUE, Array()).' -'.Haanga::Safe_Load('assert_templates/partial.tpl', $vars, TRUE, Array()).' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/variable_existe.tpl.php b/lib/Haanga/tests/tmp/assert_templates/variable_existe.tpl.php deleted file mode 100644 index eac1edd7ebc39d66117a2206a4d39ca7193c3c4c..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/variable_existe.tpl.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/variable_existe.tpl */ -function haanga_d0e8258f9bf65ffe46eddfe8347bb2467fc069ea($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - if ((empty($var->exists) == TRUE ? '' : $var->exists)) { - echo ' Yes '; - } else { - echo ' No '; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/variable_existe.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/variable_existe.tpl.php.dump deleted file mode 100644 index d8fe7492827c9902fdd9019fa5cbaa17ffb86d7c..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/variable_existe.tpl.php.dump +++ /dev/null @@ -1,262 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/variable_existe.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_d0e8258f9bf65ffe46eddfe8347bb2467fc069ea - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => if - [expr] => Array - ( - [expr_cond] => Array - ( - [op_expr] => == - [0] => Array - ( - [exec] => empty - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => var - [1] => Array - ( - [object] => exists - ) - - ) - - ) - - ) - - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - [true] => Array - ( - [string] => - ) - - [false] => Array - ( - [var] => Array - ( - [0] => var - [1] => Array - ( - [object] => exists - ) - - ) - - ) - - ) - - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => Yes - ) - - ) - - [10] => Array - ( - [op] => else - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [string] => No - ) - - ) - - [12] => Array - ( - [op] => end_if - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [14] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [15] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [16] => Array - ( - [op] => end_if - ) - - [17] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/variable_existe.tpl */ -function haanga_d0e8258f9bf65ffe46eddfe8347bb2467fc069ea($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - if ((empty($var->exists) == TRUE ? '' : $var->exists)) { - echo ' Yes '; - } else { - echo ' No '; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/assert_templates/with.tpl.php b/lib/Haanga/tests/tmp/assert_templates/with.tpl.php deleted file mode 100644 index c0e98c4b3dc327ef08fdadc89d07b3a8149e0d59..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/with.tpl.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/with.tpl */ -function haanga_6b7e79ed219629bc512aa130b0742545436edf01($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - foreach ($users as $user) { - echo ' - - '.htmlspecialchars(strtoupper($user['name'])).' == '.htmlspecialchars(strtoupper($user['name'])).' - -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/lib/Haanga/tests/tmp/assert_templates/with.tpl.php.dump b/lib/Haanga/tests/tmp/assert_templates/with.tpl.php.dump deleted file mode 100644 index d959c447c2eba0fe972333e4ca31e2c45fe0b0dd..0000000000000000000000000000000000000000 --- a/lib/Haanga/tests/tmp/assert_templates/with.tpl.php.dump +++ /dev/null @@ -1,305 +0,0 @@ -Array -( - [0] => Array - ( - [op] => declare - [name] => HAANGA_VERSION - [0] => Array - ( - [string] => 1.0.4 - ) - - ) - - [1] => Array - ( - [op] => comment - [comment] => Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/with.tpl - ) - - [2] => Array - ( - [op] => function - [name] => haanga_6b7e79ed219629bc512aa130b0742545436edf01 - ) - - [3] => Array - ( - [op] => global - [vars] => Array - ( - [0] => test_global - [1] => global1 - ) - - ) - - [4] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => extract - [args] => Array - ( - [0] => Array - ( - [var] => vars - ) - - ) - - ) - - ) - - [5] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [6] => Array - ( - [op] => expr - [0] => Array - ( - [exec] => ob_start - [args] => Array - ( - ) - - ) - - ) - - [7] => Array - ( - [op] => end_if - ) - - [8] => Array - ( - [op] => foreach - [array] => users - [value] => user - ) - - [9] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [10] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [11] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [exec] => strtoupper - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => user - [1] => name - ) - - ) - - ) - - ) - - ) - - ) - - ) - - [12] => Array - ( - [op] => print - [0] => Array - ( - [string] => == - ) - - ) - - [13] => Array - ( - [op] => print - [0] => Array - ( - [exec] => htmlspecialchars - [args] => Array - ( - [0] => Array - ( - [exec] => strtoupper - [args] => Array - ( - [0] => Array - ( - [var] => Array - ( - [0] => user - [1] => name - ) - - ) - - ) - - ) - - ) - - ) - - ) - - [14] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [15] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [16] => Array - ( - [op] => end_foreach - ) - - [17] => Array - ( - [op] => print - [0] => Array - ( - [string] => - - ) - - ) - - [18] => Array - ( - [op] => if - [expr] => Array - ( - [op_expr] => == - [0] => Array - ( - [var] => return - ) - - [1] => Array - ( - [expr] => 1 - ) - - ) - - ) - - [19] => Array - ( - [op] => return - [0] => Array - ( - [exec] => ob_get_clean - [args] => Array - ( - ) - - ) - - ) - - [20] => Array - ( - [op] => end_if - ) - - [21] => Array - ( - [op] => end_function - ) - - [php] => -$HAANGA_VERSION = '1.0.4'; -/* Generated from /home/crodas/projects/playground/haanga/tests/assert_templates/with.tpl */ -function haanga_6b7e79ed219629bc512aa130b0742545436edf01($vars, $return=FALSE, $blocks=array()) -{ - global $test_global, $global1; - extract($vars); - if ($return == TRUE) { - ob_start(); - } - foreach ($users as $user) { - echo ' - - '.htmlspecialchars(strtoupper($user['name'])).' == '.htmlspecialchars(strtoupper($user['name'])).' - -'; - } - echo ' -'; - if ($return == TRUE) { - return ob_get_clean(); - } -} -) diff --git a/lib/Haanga/tests/tmp/err_templates/block.tpl.php b/lib/Haanga/tests/tmp/err_templates/block.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/block_nonparent.tpl.php b/lib/Haanga/tests/tmp/err_templates/block_nonparent.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/block_super.tpl.php b/lib/Haanga/tests/tmp/err_templates/block_super.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/block_super_filter.tpl.php b/lib/Haanga/tests/tmp/err_templates/block_super_filter.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/block_super_nonsubtemplate.tpl.php b/lib/Haanga/tests/tmp/err_templates/block_super_nonsubtemplate.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/dictsort.tpl.php b/lib/Haanga/tests/tmp/err_templates/dictsort.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/dictsort1.tpl.php b/lib/Haanga/tests/tmp/err_templates/dictsort1.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/dictsort2.tpl.php b/lib/Haanga/tests/tmp/err_templates/dictsort2.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/err_block.tpl.php b/lib/Haanga/tests/tmp/err_templates/err_block.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/err_block_nonparent.tpl.php b/lib/Haanga/tests/tmp/err_templates/err_block_nonparent.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/err_block_super.tpl.php b/lib/Haanga/tests/tmp/err_templates/err_block_super.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/err_block_super_filter.tpl.php b/lib/Haanga/tests/tmp/err_templates/err_block_super_filter.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/err_block_super_nonsubtemplate.tpl.php b/lib/Haanga/tests/tmp/err_templates/err_block_super_nonsubtemplate.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/err_dictsort.tpl.php b/lib/Haanga/tests/tmp/err_templates/err_dictsort.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/err_dictsort1.tpl.php b/lib/Haanga/tests/tmp/err_templates/err_dictsort1.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/err_dictsort2.tpl.php b/lib/Haanga/tests/tmp/err_templates/err_dictsort2.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/err_forloop.tpl.php b/lib/Haanga/tests/tmp/err_templates/err_forloop.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/err_forloop1.tpl.php b/lib/Haanga/tests/tmp/err_templates/err_forloop1.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/err_ifchanged.tpl.php b/lib/Haanga/tests/tmp/err_templates/err_ifchanged.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/err_invalid_blockname.tpl.php b/lib/Haanga/tests/tmp/err_templates/err_invalid_blockname.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/err_invalid_tryinclude.tpl.php b/lib/Haanga/tests/tmp/err_templates/err_invalid_tryinclude.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/err_load1.tpl.php b/lib/Haanga/tests/tmp/err_templates/err_load1.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/err_load2.tpl.php b/lib/Haanga/tests/tmp/err_templates/err_load2.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/err_loop_varname.tpl.php b/lib/Haanga/tests/tmp/err_templates/err_loop_varname.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/err_pluralize.tpl.php b/lib/Haanga/tests/tmp/err_templates/err_pluralize.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/err_reverse.tpl.php b/lib/Haanga/tests/tmp/err_templates/err_reverse.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/err_templatetag1.tpl.php b/lib/Haanga/tests/tmp/err_templates/err_templatetag1.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/err_templatetag2.tpl.php b/lib/Haanga/tests/tmp/err_templates/err_templatetag2.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/err_templatetag3.tpl.php b/lib/Haanga/tests/tmp/err_templates/err_templatetag3.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/err_title.tpl.php b/lib/Haanga/tests/tmp/err_templates/err_title.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/exec_notallowed.tpl.php b/lib/Haanga/tests/tmp/err_templates/exec_notallowed.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/forloop.tpl.php b/lib/Haanga/tests/tmp/err_templates/forloop.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/forloop1.tpl.php b/lib/Haanga/tests/tmp/err_templates/forloop1.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/ifchanged.tpl.php b/lib/Haanga/tests/tmp/err_templates/ifchanged.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/inline1.tpl.php b/lib/Haanga/tests/tmp/err_templates/inline1.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/inline2.tpl.php b/lib/Haanga/tests/tmp/err_templates/inline2.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/inline3.tpl.php b/lib/Haanga/tests/tmp/err_templates/inline3.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/inline4.tpl.php b/lib/Haanga/tests/tmp/err_templates/inline4.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/inline5.tpl.php b/lib/Haanga/tests/tmp/err_templates/inline5.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/invalid_blockname.tpl.php b/lib/Haanga/tests/tmp/err_templates/invalid_blockname.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/loop_varname.tpl.php b/lib/Haanga/tests/tmp/err_templates/loop_varname.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/pluralize.tpl.php b/lib/Haanga/tests/tmp/err_templates/pluralize.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/reverse.tpl.php b/lib/Haanga/tests/tmp/err_templates/reverse.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/templatetag1.tpl.php b/lib/Haanga/tests/tmp/err_templates/templatetag1.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/templatetag2.tpl.php b/lib/Haanga/tests/tmp/err_templates/templatetag2.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/templatetag3.tpl.php b/lib/Haanga/tests/tmp/err_templates/templatetag3.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/title.tpl.php b/lib/Haanga/tests/tmp/err_templates/title.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/tokenizer_1.tpl.php b/lib/Haanga/tests/tmp/err_templates/tokenizer_1.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/tokenizer_2.tpl.php b/lib/Haanga/tests/tmp/err_templates/tokenizer_2.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/tokenizer_3.tpl.php b/lib/Haanga/tests/tmp/err_templates/tokenizer_3.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/tokenizer_4.tpl.php b/lib/Haanga/tests/tmp/err_templates/tokenizer_4.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lib/Haanga/tests/tmp/err_templates/tokenizer_5.tpl.php b/lib/Haanga/tests/tmp/err_templates/tokenizer_5.tpl.php deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000