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


PHP Gdn_Controller::addDefinition方法代碼示例

本文整理匯總了PHP中Gdn_Controller::addDefinition方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gdn_Controller::addDefinition方法的具體用法?PHP Gdn_Controller::addDefinition怎麽用?PHP Gdn_Controller::addDefinition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Gdn_Controller的用法示例。


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

示例1: base_render_before

 /**
  * Add Timeago to all controllers
  *
  * @since  2.0.0
  * @access public
  * @param  Gdn_Controller $sender
  */
 public function base_render_before($sender)
 {
     // Plugin definitions for use in Javascript
     $definitions = array('locale' => array('prefixAgo' => t('timeago.prefixAgo', null), 'prefixFromNow' => t('timeago.prefixFromNow', null), 'suffixAgo' => t('timeago.suffixAgo', 'ago'), 'suffixFromNow' => t('timeago.suffixFromNow', 'from now'), 'seconds' => t('timeago.seconds', 'less than a minute'), 'minute' => t('timeago.minute', 'about a minute'), 'minutes' => t('timeago.minutes', '%d minutes'), 'hour' => t('timeago.hour', 'about an hour'), 'hours' => t('timeago.hours', 'about %d hours'), 'day' => t('timeago.day', 'a day'), 'days' => t('timeago.days', '%d days'), 'month' => t('timeago.month', 'about a month'), 'months' => t('timeago.months', '%d months'), 'year' => t('timeago.year', 'about a year'), 'years' => t('timeago.years', '%d years'), 'wordSeparator' => t('timeago.wordSeparator', ' '), 'numbers' => array()));
     $sender->addDefinition('Timeago', json_encode($definitions));
     // Add required assets
     $sender->addJsFile('timeago.min.js', 'plugins/timeago');
 }
開發者ID:Nordic-T,項目名稱:vanilla-plugins,代碼行數:15,代碼來源:class.timeago.plugin.php

示例2: attachButtonBarResources

 /**
  * Insert buttonbar resources
  *
  * This method is abstracted because it is invoked by multiple controllers.
  *
  * @param Gdn_Controller $Sender
  */
 protected function attachButtonBarResources($Sender, $Formatter)
 {
     if (!in_array($Formatter, $this->Formats)) {
         return;
     }
     $Sender->addJsFile('buttonbar.js', 'plugins/ButtonBar');
     $Sender->addJsFile('jquery.hotkeys.js', 'plugins/ButtonBar');
     $Sender->addDefinition('ButtonBarLinkUrl', t('ButtonBar.LinkUrlText', 'Enter your URL:'));
     $Sender->addDefinition('ButtonBarImageUrl', t('ButtonBar.ImageUrlText', 'Enter image URL:'));
     $Sender->addDefinition('ButtonBarBBCodeHelpText', t('ButtonBar.BBCodeHelp', 'You can use <b><a href="http://en.wikipedia.org/wiki/BBCode" target="_new">BBCode</a></b> in your post.'));
     $Sender->addDefinition('ButtonBarHtmlHelpText', t('ButtonBar.HtmlHelp', 'You can use <b><a href="http://htmlguide.drgrog.com/cheatsheet.php" target="_new">Simple Html</a></b> in your post.'));
     $Sender->addDefinition('ButtonBarMarkdownHelpText', t('ButtonBar.MarkdownHelp', 'You can use <b><a href="http://en.wikipedia.org/wiki/Markdown" target="_new">Markdown</a></b> in your post.'));
     $Sender->addDefinition('InputFormat', $Formatter);
 }
開發者ID:adlerj,項目名稱:vanilla,代碼行數:21,代碼來源:class.buttonbar.plugin.php

示例3: addPasswordStrength

 /**
  * Set password strength meter on a form.
  *
  * @param Gdn_Controller $Controller The controller to add the password strength information to.
  */
 public function addPasswordStrength($Controller)
 {
     $Controller->addJsFile('password.js');
     $Controller->addDefinition('MinPassLength', c('Garden.Registration.MinPasswordLength'));
     $Controller->addDefinition('PasswordTranslations', implode(',', [t('Password Too Short', 'Too Short'), t('Password Contains Username', 'Contains Username'), t('Password Very Weak', 'Very Weak'), t('Password Weak', 'Weak'), t('Password Ok', 'OK'), t('Password Good', 'Good'), t('Password Strong', 'Strong')]));
 }
開發者ID:vanilla,項目名稱:vanilla,代碼行數:11,代碼來源:class.usermodel.php

示例4: base_render_before

 /**
  * Adds 'Discussion' item to menu.
  *
  * 'base_render_before' will trigger before every pageload across apps.
  * If you abuse this hook, Tim will throw a Coke can at your head.
  *
  * @since 2.0.0
  * @package Vanilla
  *
  * @param Gdn_Controller $sender The sending controller object.
  */
 public function base_render_before($sender)
 {
     if ($sender->Menu) {
         $sender->Menu->addLink('Discussions', t('Discussions'), '/discussions', false, ['Standard' => true]);
     }
     if (!inSection('Dashboard')) {
         // Spoilers assets
         $sender->addJsFile('spoilers.js', 'vanilla');
         $sender->addCssFile('spoilers.css', 'vanilla');
         $sender->addDefinition('Spoiler', t('Spoiler'));
         $sender->addDefinition('show', t('show'));
         $sender->addDefinition('hide', t('hide'));
     }
     // Add user's viewable roles to gdn.meta if user is logged in.
     if (!$sender->addDefinition('Roles')) {
         if (Gdn::session()->isValid()) {
             $roleModel = new RoleModel();
             Gdn::controller()->addDefinition("Roles", $roleModel->getPublicUserRoles(Gdn::session()->UserID, "Name"));
         }
     }
 }
開發者ID:vanilla,項目名稱:vanilla,代碼行數:32,代碼來源:class.hooks.php


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