當前位置: 首頁>>代碼示例>>PHP>>正文


PHP View\Helper類代碼示例

本文整理匯總了PHP中Cake\View\Helper的典型用法代碼示例。如果您正苦於以下問題:PHP Helper類的具體用法?PHP Helper怎麽用?PHP Helper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Helper類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * Class Constructor
  *
  * Merges defaults with
  * - Configure::read(Meta)
  * - Helper options
  * - viewVars _meta
  * in that order (the latter trumps)
  *
  * @param array $options
  */
 public function __construct(View $View, $options = [])
 {
     parent::__construct($View, $options);
     $configureMeta = (array) Configure::read('Meta');
     if (Configure::read('Meta.robots') && is_array(Configure::read('Meta.robots'))) {
         $configureMeta['robots'] = Hash::merge($this->meta['robots'], Configure::read('Meta.robots'));
     }
     $this->meta = $configureMeta + $this->meta;
     if (!empty($options['robots']) && is_array($options['robots'])) {
         $options['robots'] = Hash::merge($this->meta['robots'], $options['robots']);
     }
     $this->meta = $options + $this->meta;
     if (!empty($this->_View->viewVars['_meta'])) {
         $viewVarsMeta = (array) $this->_View->viewVars['_meta'];
         if (!empty($viewVarsMeta['robots']) && is_array($viewVarsMeta['robots'])) {
             $viewVarsMeta['robots'] = Hash::merge($this->meta['robots'], $viewVarsMeta['robots']);
         }
         $this->meta = $viewVarsMeta + $this->meta;
     }
     if ($this->meta['charset'] === null) {
         // By default include this
         $this->meta['charset'] = true;
     }
     if ($this->meta['icon'] === null) {
         // By default include this
         $this->meta['icon'] = true;
     }
     if ($this->meta['title'] === null) {
         $this->meta['title'] = __(Inflector::humanize(Inflector::underscore($this->request->params['controller']))) . ' - ' . __(Inflector::humanize(Inflector::underscore($this->request->params['action'])));
     }
 }
開發者ID:dereuromark,項目名稱:cakephp-meta,代碼行數:42,代碼來源:MetaHelper.php

示例2: __construct

 /**
  * Construct, optionally with GeshiHelper for code highlighting
  * 
  * @param \Cake\View\View $View
  * @param array $config
  */
 public function __construct(View $View, array $config = array())
 {
     $config += $this->defaultConfig;
     $this->helpers += (array) $config['helpers'];
     parent::__construct($View, $config);
     if (!is_object($this->Geshi)) {
         $this->Geshi = FALSE;
     }
 }
開發者ID:OrigamiStructures,項目名稱:Cake3xMarkdown,代碼行數:15,代碼來源:CakeMarkdownHelper.php

示例3: __construct

 /**
  * Set the operating conditions for reursive operation
  * 
  * $config keys:
  *		0 - the CrudHelper object
  *		filter_property - the property name in child entities that will be tested
  *		filter_match - the property name in the parent entity that will used in testing
  *		list_type - UL or OL. Defaults to UL if not spec'd
  * 
  * The filter iterator gets configured to match some property in the iterator data set 
  * to some property value in the current <LI>s entity
  * 
  * @param View $View
  * @param array $config
  */
 public function __construct(View $View, array $config = array())
 {
     $config += ['list_type' => 'ul'];
     parent::__construct($View, $config);
     $this->Crud = $config[0];
     $this->filter_property = $config['filter_property'];
     $this->filter_match = $config['filter_match'];
     $this->list_wrapper = (object) ['open' => "<{$config['list_type']}>", 'close' => "</{$config['list_type']}>"];
     $this->depth = 0;
 }
開發者ID:OrigamiStructures,項目名稱:CrudViews,代碼行數:25,代碼來源:ListHelper.php

示例4: url

 function url($url = null, $full = false)
 {
     if (!isset($url['language']) && isset($this->params['language'])) {
         $url['language'] = $this->params['language'];
     }
     return parent::url($url, $full);
 }
開發者ID:TranBinhLuan,項目名稱:junzeron,代碼行數:7,代碼來源:AppHelper.php

示例5: __construct

 /**
  * __construct callback
  *
  * @param \Cake\View\View $View : View
  * @param array $config : Config
  * @throws Cake\Error\NotFoundException
  */
 public function __construct(\Cake\View\View $View, array $config = [])
 {
     parent::__construct($View, $config);
     if (!$this->_isSupportedFramework($fw = $this->config('assets.framework'))) {
         throw new NotFoundException(sprintf(__d('bootstrap', 'Configured JavaScript framework "{0}" is not supported. Only "{1}" are valid options.', $fw, implode(', ', $this->_authorizedJsLibs))));
     }
 }
開發者ID:cake17,項目名稱:cakephp-bootstrap,代碼行數:14,代碼來源:BsSliderHelper.php

示例6: __call

 public function __call($tag, $args)
 {
     if (strpos($tag, 'set') !== 0) {
         return parent::__call($tag, $args);
     }
     $tag = strtolower(substr($tag, 3));
     switch ($tag) {
         case 'card':
         case 'title':
         case 'description':
         case 'data1':
         case 'label1':
         case 'data2':
         case 'label2':
             return $this->addTag($tag, array_shift($args));
         case 'site':
         case 'creator':
         case 'image':
         case 'player':
             if (count($args) < 2) {
                 $args[] = [];
             }
             list($value, $options) = $args;
             return $this->addTag($tag, $value, $options);
         default:
             return parent::__call($tag, $args);
     }
 }
開發者ID:antevertonlima,項目名稱:social-meta,代碼行數:28,代碼來源:CardHelper.php

示例7: __construct

 /**
  * Constructor. Overridden to merge passed args with URL options.
  *
  * @param \Cake\View\View $View The View this helper is being attached to.
  * @param array $config Configuration settings for the helper.
  */
 public function __construct(View $View, array $config = [])
 {
     parent::__construct($View, $config);
     $query = $this->request->query;
     unset($query['page'], $query['limit'], $query['sort'], $query['direction']);
     $this->config('options.url', array_merge($this->request->params['pass'], ['?' => $query]));
 }
開發者ID:rlugojr,項目名稱:cakephp,代碼行數:13,代碼來源:PaginatorHelper.php

示例8: __construct

 public function __construct(View $view, $config = [])
 {
     parent::__construct($view, $config);
     $this->_configs = $this->config();
     $this->appId = $this->_configs['app_id'];
     $this->redirectUrl = $this->_configs['redirect_url'];
     $this->appScope = $this->_configs['app_scope'];
 }
開發者ID:nanexcool,項目名稱:AKKA-CakePHP-Facebook-Plugin,代碼行數:8,代碼來源:FacebookHelper.php

示例9: __construct

 /**
  * Constructor
  *
  * @param \Cake\View\View $View The View this helper is being attached to.
  * @param array $config Configuration settings for the helper.
  */
 public function __construct(View $View, array $config = [])
 {
     $defaults = (array) Configure::read('Highlighter');
     parent::__construct($View, $config + $defaults);
     if ($this->_config['debug'] === null) {
         $this->_config['debug'] = Configure::read('debug');
     }
 }
開發者ID:dereuromark,項目名稱:cakephp-markup,代碼行數:14,代碼來源:HighlighterHelper.php

示例10: __construct

 /**
  * Constructor
  * @param View $View
  * @param unknown $settings
  */
 public function __construct(View $View, array $config = [])
 {
     // call parent constructor
     parent::__construct($View, $config);
     // calculate file system route
     $this->_config['css']['route'] = rtrim(WWW_ROOT, DS) . str_replace('/', DS, $this->_config['css']['path']);
     $this->_config['js']['route'] = rtrim(WWW_ROOT, DS) . str_replace('/', DS, $this->_config['js']['path']);
 }
開發者ID:unimatrix,項目名稱:cakephp-utility,代碼行數:13,代碼來源:MinifyHelper.php

示例11: __construct

 /**
  * Constructor - finds and parses the ini file the plugin uses.
  *
  * @param \Cake\View\View $view The view instance to use.
  * @param array $settings The settings for the helper.
  * @return void
  */
 public function __construct(View $view, $settings = [])
 {
     parent::__construct($view, $settings);
     if (empty($settings['noconfig'])) {
         $configFinder = new ConfigFinder();
         $this->assetConfig($configFinder->loadAll());
     }
 }
開發者ID:clthck,項目名稱:asset-compress-improved,代碼行數:15,代碼來源:AssetCompressHelper.php

示例12: __construct

 /**
  * Construct method.
  *
  * @param \Cake\View\View $view The view that was fired.
  * @param array $config The config passed to the class.
  */
 public function __construct(View $view, $config = [])
 {
     parent::__construct($view, $config);
     $collection = new ComponentRegistry();
     $this->Acl = new AclComponent($collection);
     $this->Authorize = new ActionsAuthorize($collection);
     $this->Authorize->config(['actionPath' => 'app/', 'userModel' => 'Users']);
 }
開發者ID:edukondaluetg,項目名稱:Xeta,代碼行數:14,代碼來源:AclHelper.php

示例13: __construct

 public function __construct(View $View, array $config = [])
 {
     $defaults = (array) Configure::read('Format') + $this->_defaults;
     $config += $defaults;
     $config['fontIcons'] = (array) $config['fontIcons'] + $this->_defaultIcons;
     $this->template = new StringTemplate($config['templates']);
     parent::__construct($View, $config);
 }
開發者ID:ayman-alkom,項目名稱:cakephp-tools,代碼行數:8,代碼來源:FormatHelper.php

示例14: __construct

 /**
  * Initializes Lessc and cleans less and css paths
  *
  * {@inheritdoc}
  */
 public function __construct(View $View, array $config = [])
 {
     parent::__construct($View, $config);
     // Initialize oyejorge/less.php parser
     require_once ROOT . DS . 'vendor' . DS . 'oyejorge' . DS . 'less.php' . DS . 'lib' . DS . 'Less' . DS . 'Autoloader.php';
     \Less_Autoloader::register();
     $this->css_path = WWW_ROOT . trim($this->css_path, '/');
 }
開發者ID:eddiePower,項目名稱:cakephp,代碼行數:13,代碼來源:LessHelper.php

示例15: __construct

 /**
  * Construct method.
  *
  * @param \Cake\View\View $view The view that was fired.
  * @param array $config The config passed to the class.
  */
 public function __construct(View $view, $config = [])
 {
     parent::__construct($view, $config);
     $collection = new ComponentRegistry();
     $this->Acl = new AclComponent($collection);
     $this->Authorize = new ActionsAuthorize($collection);
     $this->Authorize->config($this->config());
 }
開發者ID:Xety,項目名稱:Xeta,代碼行數:14,代碼來源:AclHelper.php


注:本文中的Cake\View\Helper類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。