本文整理汇总了PHP中Breadcrumb::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Breadcrumb::create方法的具体用法?PHP Breadcrumb::create怎么用?PHP Breadcrumb::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Breadcrumb
的用法示例。
在下文中一共展示了Breadcrumb::create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: breadcrumb
/**
* breadcrumb function
* Create breadcrumb
* @return string
* @author joharijumali
**/
public static function breadcrumb()
{
$Menu = Admin_Menu::menuGenerator();
$butternbread = array();
foreach ($Menu as $floor => $packet) {
foreach ($packet->page->action as $key => $action) {
if ($packet->packet == Str::lower(URI::segment(1)) && $packet->controller->name == Str::lower(URI::segment(2)) && $action->name == Str::lower(URI::segment(3)) || URI::segment(3) == NULL && $action->name == $packet->controller->name && Str::lower(URI::segment(2)) == $packet->controller->name) {
$butternbread[Str::upper($packet->controller->alias)] = '#';
array_push($butternbread, Str::title($action->alias));
}
}
}
return Breadcrumb::create($butternbread);
}
示例2: beforeFilter
/**
* beforeFilter function called before filter
*
* @access public
* @return void
*/
public function beforeFilter()
{
$timezone = $this->SysParameter->findByParameterCode('system.timezone');
// default to UTC if no timezone is set
if (!(empty($timezone) || empty($timezone['SysParameter']['parameter_value']))) {
$timezone = $timezone['SysParameter']['parameter_value'];
// check that the timezone is valid
if (isset($this->validTZ[$timezone])) {
date_default_timezone_set($timezone);
} else {
$this->Session->setFlash(__('An invalid timezone is provided, please edit "system.timezone"', true));
}
}
$this->Auth->autoRedirect = false;
// backward compatible with original ipeer hash method
Security::setHash('md5');
Configure::write('Security.salt', '');
$locale = $this->SysParameter->findByParameterCode('display.locale');
// default to eng if no locale is set
if (!(empty($locale) || empty($locale['SysParameter']['parameter_value']))) {
$locale = $locale['SysParameter']['parameter_value'];
// TODO: check that the locale is valid
Configure::write('Config.language', $locale);
} else {
Configure::write('Config.language', 'eng');
}
// if we have a session transfered to us
if ($this->_hasSessionTransferData()) {
if ($this->_authenticateWithSessionTransferData()) {
if (method_exists($this, '_afterLogin')) {
$this->_afterLogin(false);
}
} else {
$this->Session->setFlash($this->Auth->loginError, $this->Auth->flashElement, array(), 'auth');
}
}
// store user in the singleton for global access
User::store($this->Auth->user());
$this->breadcrumb = Breadcrumb::create();
if ($this->Auth->isAuthorized()) {
// check if the user has permission to access the controller/action
$permission = array_filter(array('controllers', ucwords($this->params['plugin']), ucwords($this->params['controller']), $this->params['action']));
if (!User::hasPermission(join('/', $permission))) {
$this->Session->setFlash('Error: You do not have permission to access the page.');
$this->redirect('/home');
return;
}
$this->_checkSystemVersion();
}
// for setting up google analytics
$trackingId = $this->SysParameter->findByParameterCode('google_analytics.tracking_id');
$domain = $this->SysParameter->findByParameterCode('google_analytics.domain');
$customLogo = $this->SysParameter->findByParameterCode('banner.custom_logo');
$this->set('trackingId', $trackingId);
$this->set('domain', $domain);
$this->set('customLogo', $customLogo);
parent::beforeFilter();
}