本文整理汇总了PHP中hexec函数的典型用法代码示例。如果您正苦于以下问题:PHP hexec函数的具体用法?PHP hexec怎么用?PHP hexec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hexec函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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]));
}
开发者ID:GallardoAlba,项目名称:Meneame,代码行数:7,代码来源:Title.php
示例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);
}
开发者ID:GallardoAlba,项目名称:Meneame,代码行数:7,代码来源:Reverse.php
示例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]));
}
开发者ID:rolando-archive,项目名称:haanga-benchs,代码行数:7,代码来源:Length.php
示例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;
}
开发者ID:narock,项目名称:lodspeakr,代码行数:29,代码来源:Length.php
示例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;
}
开发者ID:rolando-archive,项目名称:haanga-benchs,代码行数:27,代码来源:Exec.php
示例6: generator
public static function generator($compiler, $args)
{
if (count($args) == 1) {
$args[1] = "";
}
return hexec("implode", $args[1], $args[0]);
}
开发者ID:GallardoAlba,项目名称:Meneame,代码行数:7,代码来源:Join.php
示例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]);
}
开发者ID:crodas,项目名称:haanga,代码行数:7,代码来源:Explode.php
示例8: generator
static function generator($compiler, $args)
{
if (count($args) != 1) {
$compiler->Error("Pop only needs two parameter");
}
return hexec('array_pop', $args[0]);
}
开发者ID:narock,项目名称:lodspeakr,代码行数:7,代码来源:Pop.php
示例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;
}
开发者ID:emildev35,项目名称:processmaker,代码行数:30,代码来源:meneame_pagination.php
示例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]);
}
开发者ID:narock,项目名称:lodspeakr,代码行数:7,代码来源:Explode.php
示例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]);
}
开发者ID:manelio,项目名称:woolr,代码行数:8,代码来源:haanga_mnm.php
示例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)));
}
开发者ID:narock,项目名称:lodspeakr,代码行数:10,代码来源:Alert.php
示例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;
}
开发者ID:emildev35,项目名称:processmaker,代码行数:10,代码来源:Tryinclude.php
示例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;
}
开发者ID:GallardoAlba,项目名称:Meneame,代码行数:10,代码来源:Slugify.php
示例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;
}
开发者ID:scalia,项目名称:Vevui,代码行数:10,代码来源:haanga.php
示例16: generator
public static function generator($compiler, $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);
}
开发者ID:rolando-archive,项目名称:haanga-benchs,代码行数:11,代码来源:Substr.php
示例17: generator
/**
* 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;
}
开发者ID:GallardoAlba,项目名称:Meneame,代码行数:17,代码来源:Firstof.php
示例18: generator
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;
}
开发者ID:GallardoAlba,项目名称:Meneame,代码行数:19,代码来源:Trans.php
示例19: generator
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;
}
开发者ID:GallardoAlba,项目名称:Meneame,代码行数:41,代码来源:Cycle.php
示例20: 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");
}
}
// 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;
}
开发者ID:emildev35,项目名称:processmaker,代码行数:37,代码来源:Exec.php
注:本文中的hexec函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论