本文整理汇总了PHP中SibdietHelper::calculate方法的典型用法代码示例。如果您正苦于以下问题:PHP SibdietHelper::calculate方法的具体用法?PHP SibdietHelper::calculate怎么用?PHP SibdietHelper::calculate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SibdietHelper
的用法示例。
在下文中一共展示了SibdietHelper::calculate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a Error object.
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
$user = JFactory::getUser();
$this->item = $this->get('Item');
$this->print = $app->input->getBool('print');
$this->secretkey = $app->input->getString('secretkey');
$this->state = $this->get('State');
$this->user = $user;
$this->params = $this->state->get('params');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseWarning(500, implode("\n", $errors));
return false;
}
// Check the view access to the request print.
if ($user->get('guest')) {
if (!empty($this->secretkey) && $this->secretkey == $this->item->secretkey) {
// User requested diet print by secret key
} else {
JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
return;
}
}
// Convert body field to array.
$registry = new JRegistry();
$registry->loadString($this->item->body);
$this->item->body = $registry->toArray();
$this->item = (object) array_merge((array) $this->item, $this->item->body);
$this->item = SibdietHelper::calculate($this->item);
//Escape strings for HTML output
$this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
$this->_prepareDocument();
parent::display($tpl);
}