本文整理汇总了PHP中H2o::addTag方法的典型用法代码示例。如果您正苦于以下问题:PHP H2o::addTag方法的具体用法?PHP H2o::addTag怎么用?PHP H2o::addTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类H2o
的用法示例。
在下文中一共展示了H2o::addTag方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: H2o_Error
$this->enable = false;
} else {
throw new H2o_Error("Invalid syntax : autoescape on|off ");
}
}
function render($context, $stream)
{
$context->autoescape = $this->enable;
}
}
class Csrf_token_Tag extends H2o_Node
{
function render($context, $stream)
{
$token = "";
if (isset($_COOKIE["csrftoken"])) {
$token = $_COOKIE["csrftoken"];
} else {
global $SECRET_KEY;
if (defined('SECRET_KEY')) {
$token = md5(mt_rand() . SECRET_KEY);
} else {
$token = md5(mt_rand());
}
}
setcookie("csrftoken", $token, time() + 60 * 60 * 24 * 365, "/");
$stream->write("<div style='display:none'><input type=\"hidden\" value=\"{$token}\" name=\"csrfmiddlewaretoken\" /></div>");
}
}
H2o::addTag(array('block', 'extends', 'include', 'if', 'ifchanged', 'for', 'with', 'cycle', 'load', 'debug', 'now', 'autoescape', 'csrf_token'));
示例2: array
<li style="display: none"></li>
%s
</ul>
</div>
</div>
</div>
</div>
<div class="switchDown"> </div>
</div>
</li>';
$sites = Doctrine_Query::create()->from('Site s')->execute();
$sitesArr = array();
$selectedsiteName = '';
$siteId = SITE_ID;
foreach ($sites as $value) {
$sitesArr[] = sprintf('<li><a href="?site=%d">%s</a></li>', $value->id, $value->name);
if ($siteId == $value->id) {
$selectedsiteName = $value->name;
}
}
$stream->write(sprintf($html, $selectedsiteName, implode('', $sitesArr)));
}
}
H2o::addTag(array('result_list'));
H2o::addTag(array('get_admin_menu'));
H2o::addTag(array('get_admin_submenu'));
H2o::addTag(array('admin_list_filter'));
H2o::addTag(array('admin_list_search'));
H2o::addTag(array('admin_actions'));
H2o::addTag(array('account_switcher'));
示例3: render
$this->argument = $argstring;
}
function render($context, $stream)
{
if ($this->argument) {
$object = $context->resolve(symbol($this->argument));
} else {
$object = $context->scopes[0];
}
$output = "<pre>" . print_r($object, true) . "</pre>";
$stream->write($output);
}
}
class Now_Tag extends H2o_Node
{
function __construct($argstring, $parser, $pos = 0)
{
$this->format = $argstring;
if (!$this->format) {
$this->format = "D M j G:i:s T Y";
}
}
function render($contxt, $stream)
{
sleep(1);
$time = date($this->format);
$stream->write($time);
}
}
H2o::addTag(array('block', 'extends', 'include', 'if', 'for', 'with', 'cycle', 'load', 'debug', 'now'));