本文整理汇总了PHP中hexec函数的典型用法代码示例。如果您正苦于以下问题:PHP hexec函数的具体用法?PHP hexec怎么用?PHP hexec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hexec函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generator
static function generator($compiler, $args)
{
if (count($args) != 1) {
$compiler->Error("title filter only needs one parameter");
}
return hexec('ucwords', hexec('strtolower', $args[0]));
}
示例2: generator
static function generator($compiler, $args)
{
if (count($args) != 1) {
$compiler->Error("Reverse only needs one parameter");
}
return hexec('array_reverse', $args[0], TRUE);
}
示例3: generator
static function generator($compiler, $args)
{
if (Haanga_AST::is_str($args[0])) {
return hexec('strlen', $args[0]);
}
return hexpr_cond(hexec('is_array', $args[0]), hexec('count', $args[0]), hexec('strlen', $args[0]));
}
示例4: generator
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;
}
示例5: generator
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");
}
}
$exec = hexec($args[0]);
for ($i = 1; $i < count($args); $i++) {
$exec->param($args[$i]);
}
$exec->end();
if ($assign) {
$code->decl($assign, $exec);
} else {
$cmp->do_print($code, $exec);
}
return $code;
}
示例6: generator
public static function generator($compiler, $args)
{
if (count($args) == 1) {
$args[1] = "";
}
return hexec("implode", $args[1], $args[0]);
}
示例7: generator
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]);
}
示例8: generator
static function generator($compiler, $args)
{
if (count($args) != 1) {
$compiler->Error("Pop only needs two parameter");
}
return hexec('array_pop', $args[0]);
}
示例9: generator
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;
}
示例10: generator
static function generator($compiler, $args)
{
if (count($args) != 2) {
$compiler->Error("Explode only needs two parameter");
}
return hexec('explode', $args[1], $args[0]);
}
示例11: generator
static function generator($cmp, $args)
{
if (!isset($args[1])) {
$args[1] = 40;
/* truncate to 40 letters by default */
}
return hexec('txt_shorter', $args[0], $args[1]);
}
示例12: generator
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)));
}
示例13: generator
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;
}
示例14: generator
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;
}
示例15: generator
static function generator($cmp, $args, $assign = NULL)
{
/* ast */
$code = hcode();
/* llamar a la funcion */
$exec = hexec('sprintf', '%.4f', hexpr(hexec('microtime', TRUE), '-', hvar('globals', 'start_time')));
/* imprimir la funcion */
$cmp->do_print($code, $exec);
return $code;
}