本文整理汇总了PHP中Dwoo_Compiler::getCurrentBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP Dwoo_Compiler::getCurrentBlock方法的具体用法?PHP Dwoo_Compiler::getCurrentBlock怎么用?PHP Dwoo_Compiler::getCurrentBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dwoo_Compiler
的用法示例。
在下文中一共展示了Dwoo_Compiler::getCurrentBlock方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcessing
public static function preProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $type)
{
$params = $compiler->getCompiledParams($params);
$parsedParams = array();
if (!isset($params['*'])) {
$params['*'] = array();
}
foreach ($params['*'] as $param => $defValue) {
if (is_numeric($param)) {
$param = $defValue;
$defValue = null;
}
$param = trim($param, '\'"');
if (!preg_match('#^[a-z0-9_]+$#i', $param)) {
throw new Dwoo_Compilation_Exception($compiler, 'Function : parameter names must contain only A-Z, 0-9 or _');
}
$parsedParams[$param] = $defValue;
}
$params['name'] = substr($params['name'], 1, -1);
$params['*'] = $parsedParams;
$params['uuid'] = uniqid();
$compiler->addTemplatePlugin($params['name'], $parsedParams, $params['uuid']);
$currentBlock =& $compiler->getCurrentBlock();
$currentBlock['params'] = $params;
return '';
}
示例2: preProcessing
public static function preProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $type)
{
// get block params and save the current template pointer to use it in the postProcessing method
$currentBlock =& $compiler->getCurrentBlock();
$currentBlock['params']['tplPointer'] = $compiler->getPointer();
return '';
}
示例3: preProcessing
public static function preProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $type)
{
$params = $compiler->getCompiledParams($params);
$func = $params['__funcname'];
$pluginType = $params['__functype'];
$params = $params['*'];
if ($pluginType & Dwoo_Core::CUSTOM_PLUGIN) {
$customPlugins = $compiler->getDwoo()->getCustomPlugins();
$callback = $customPlugins[$func]['callback'];
if (is_array($callback)) {
if (is_object($callback[0])) {
$callback = '$this->customPlugins[\'' . $func . '\'][0]->' . $callback[1] . '(';
} else {
$callback = '' . $callback[0] . '::' . $callback[1] . '(';
}
} else {
$callback = $callback . '(';
}
} else {
$callback = 'smarty_block_' . $func . '(';
}
$paramsOut = '';
foreach ($params as $i => $p) {
$paramsOut .= var_export($i, true) . ' => ' . $p . ',';
}
$curBlock =& $compiler->getCurrentBlock();
$curBlock['params']['postOut'] = Dwoo_Compiler::PHP_OPEN . ' $_block_content = ob_get_clean(); $_block_repeat=false; echo ' . $callback . '$_tag_stack[count($_tag_stack)-1], $_block_content, $this, $_block_repeat); } array_pop($_tag_stack);' . Dwoo_Compiler::PHP_CLOSE;
return Dwoo_Compiler::PHP_OPEN . $prepend . ' if (!isset($_tag_stack)){ $_tag_stack = array(); } $_tag_stack[] = array(' . $paramsOut . '); $_block_repeat=true; ' . $callback . '$_tag_stack[count($_tag_stack)-1], null, $this, $_block_repeat); while ($_block_repeat) { ob_start();' . Dwoo_Compiler::PHP_CLOSE;
}
示例4: postProcessing
public static function postProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $content)
{
if (!isset($params['initialized'])) {
return '';
}
$block =& $compiler->getCurrentBlock();
$block['params']['hasElse'] = Dwoo_Compiler::PHP_OPEN . "else {\n" . Dwoo_Compiler::PHP_CLOSE . $content . Dwoo_Compiler::PHP_OPEN . "\n}" . Dwoo_Compiler::PHP_CLOSE;
return '';
}
示例5: preProcessing
public static function preProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $type)
{
$preContent = '';
while (true) {
$preContent .= $compiler->removeTopBlock();
$block =& $compiler->getCurrentBlock();
$interfaces = class_implements($block['class'], false);
if (in_array('Dwoo_IElseable', $interfaces) !== false) {
break;
}
}
$params['initialized'] = true;
$compiler->injectBlock($type, $params);
return $preContent;
}