Skip to content
Snippets Groups Projects
Commit fb781c22 authored by alangrafu's avatar alangrafu Committed by GIT_AUTHOR_NAME
Browse files

Merge branch 'development'

parents 8867f057 ec7d4879
No related branches found
No related tags found
No related merge requests found
Showing
with 1567 additions and 1474 deletions
......@@ -40,8 +40,13 @@ class SpecialFunction extends AbstractSpecialFunction{
try{
$viewFile = $conf['special']['uri'].".".$f.$conf['view']['extension'].".".$extension;
$modelFile = $conf['special']['uri'].".".$f.$conf['model']['extension'].".".$extension;
if(!(is_dir($conf['model']['directory'].$modelFile) || is_file($conf['model']['directory'].$modelFile)) || !is_file($conf['view']['directory'].$viewFile)){
throw new Exception('<h1>Method does not exist!</h1><br/>This means that <tt>'.$conf['model']['directory'].$modelFile.'</tt> or <tt>'.$conf['view']['directory'].$viewFile."</tt> (or both) don't exist.<br/>Please refer to this tutorial to create one.<br/>");
if(!(is_dir($conf['model']['directory'].$modelFile) || is_file($conf['model']['directory'].$modelFile))){
$msg = '<h1>Method does not exist!</h1><br/>This means that <tt>'.$conf['model']['directory'].$modelFile."</tt> doesn't exist.<br/>Please refer to this tutorial to create one.<br/>";
throw new Exception($msg);
}
if(!is_file($conf['view']['directory'].$viewFile)){
$msg='<h1>Method does not exist!</h1><br/>This means that <tt>'.$conf['view']['directory'].$viewFile."</tt> doesn't exist.<br/>Please refer to this tutorial to create one.<br/>";
throw new Exception($msg);
}
$endpoints = $context['endpoints'];
array_pop($params);
......@@ -74,7 +79,7 @@ class SpecialFunction extends AbstractSpecialFunction{
$base['model']['directory'] = $conf['model']['directory'];
$base['view']['directory'] = $conf['view']['directory'];
$base['ns'] = $conf['ns'];
$base['sparqlendpoint'] = $conf['endpoint'];
$base['endpoint'] = $conf['endpoint'];
$base['type'] = $modelFile;
$base['header'] = $prefixHeader;
$base['args'] = $args;
......
Copyright (c) 2010, César D. Rodas <crodas@php.net> and Menéame Comunicacions S.L.
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
......
This diff is collapsed.
......@@ -74,7 +74,7 @@
foreach ($this->yy_get_expected_tokens($yymajor) as $token) {
$expect[] = self::$yyTokenName[$token];
}
$this->Error('Unexpected ' . $this->tokenName($yymajor) . '(' . $TOKEN. '), expected one of: ' . implode(',', $expect));
$this->Error('Unexpected ' . $this->tokenName($yymajor) . '(' . $TOKEN. ')');
}
......@@ -379,21 +379,25 @@ expr(A) ::= fvar_or_string(B). { A = B; }
/* Variable name */
varname(A) ::= varpart(B). { A = current($this->compiler->generate_variable_name(B, false)); }
varpart(A) ::= varname(B) T_OBJ|T_DOT T_ALPHA|T_CUSTOM_TAG|T_CUSTOM_BLOCK(C). {
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) ::= varname(B) T_CLASS T_ALPHA|T_CUSTOM_TAG|T_CUSTOM_BLOCK(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) ::= varname(B) T_BRACKETS_OPEN var_or_string(C) T_BRACKETS_CLOSE. {
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) ::= T_ALPHA(B). { A = B; }
varpart(A) ::= varpart_single(B). { A = B; }
/* T_BLOCK|T_CUSTOM|T_CUSTOM_BLOCK are also T_ALPHA */
varpart(A) ::= T_BLOCK|T_CUSTOM_TAG|T_CUSTOM_BLOCK(B). { A = B; }
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); }
......
......@@ -560,7 +560,7 @@ class Haanga_Compiler_Tokenizer
/* destroy the parser */
try {
$parser->doParse(0,0);
} catch (Exception $e) {}
} catch (Exception $y) {}
throw $e; /* re-throw exception */
}
......
<?php
class Haanga_Extension_Filter_IsArray
{
public $php_alias = "is_array";
public $is_safe = TRUE; /* boolean if safe */
}
......@@ -7,7 +7,6 @@ class Haanga_Extension_Filter_Length
{
$count = hexec('count', $args[0]);
$strlen = hexec('strlen', $args[0]);
$props = hexec('count', hexec('array_keys', hexec('get_object_vars', $args[0])));
$guess = hexpr_cond(hexec('is_array', $args[0]), hexec('count', $args[0]),
hexec('strlen', $args[0]));
......@@ -19,8 +18,6 @@ class Haanga_Extension_Filter_Length
return $count;
} else if (is_string($value)) {
return $strlen;
} else if (is_object($value)) {
return $props;
} else {
return $guess;
}
......
<?php
class Haanga_Extension_Filter_Null
{
public $php_alias = 'is_null';
}
......@@ -2,7 +2,7 @@
class Haanga_Extension_Filter_Substr
{
public static function generator($compiler, $args)
public static function generator($cmp, $args)
{
if (count($args) != 2) {
$cmp->Error("substr parameter must have one param");
......
<?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;
}
}
......@@ -37,6 +37,9 @@ class Haanga_Extension_Tag_Exec
$exec->end();
if ($assign) {
$code->decl($assign, $exec);
// make it global
$code->decl(hvar('vars', $assign), hvar($assign));
} else {
$cmp->do_print($code, $exec);
}
......
......@@ -331,7 +331,7 @@ class Haanga_Generator_PHP
{
$op['array'] = $this->php_get_varname($op['array']);
$op['value'] = $this->php_get_varname($op['value']);
$code = "foreach ({$op['array']} as ";
$code = "foreach ((array) {$op['array']} as ";
if (!isset($op['key'])) {
$code .= " {$op['value']}";
} else {
......
5
<?php
$data = array(
'endsomething' => array('endbar' => 5),
);
{{ endsomething.endbar }}
{{ foo }}
<?php echo php_uname();?>
<?php echo php_uname();?>
{% exec php_uname %}
{% exec php_uname as foo %}
{% include "assert_templates/exec-inc.tpl" %}
hola
<?php
$data = array(
'self' => array(
'status' => true,
'tiene_negativos' => true,
'nsfw' => false,
)
);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment