当前位置: 首页>>代码示例>>PHP>>正文


PHP Html::behavior方法代码示例

本文整理汇总了PHP中Html::behavior方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::behavior方法的具体用法?PHP Html::behavior怎么用?PHP Html::behavior使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Html的用法示例。


在下文中一共展示了Html::behavior方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onAfterRoute

 /**
  * Hook for after routing application
  * 
  * @return  void
  */
 public function onAfterRoute()
 {
     if (!App::isAdmin() && !App::isSite()) {
         return;
     }
     $client = 'Site';
     if (App::isAdmin()) {
         $client = 'Admin';
         return;
     }
     // Check if active for this client (Site|Admin)
     if (!$this->params->get('activate' . $client) || Request::getVar('format') == 'pdf') {
         return;
     }
     Html::behavior('framework');
     if ($this->params->get('jqueryui')) {
         Html::behavior('framework', true);
     }
     if ($this->params->get('jqueryfb')) {
         Html::behavior('modal');
     }
     if ($this->params->get('noconflict' . $client)) {
         Document::addScript(Request::root(true) . '/core/assets/js/jquery.noconflict.js');
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:30,代码来源:jquery.php

示例2: display

 /**
  * Displays the view
  *
  * @param   string  $tpl  The name of the template file to parse
  * @return  void
  */
 public function display($tpl = null)
 {
     Html::behavior('framework');
     \Hubzero\Document\Assets::addComponentStylesheet('com_languages', 'overrider.css');
     \Hubzero\Document\Assets::addComponentScript('com_languages', 'overrider.js');
     //Document::addStyleSheet(Request::root().'media/overrider/css/overrider.css');
     //Document::addScript(Request::root().'media/overrider/js/overrider.js');
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->state = $this->get('State');
     // Check for errors
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors));
         return;
     }
     // Check whether the cache has to be refreshed
     $cached_time = User::getState('com_languages.overrides.cachedtime.' . $this->state->get('filter.client') . '.' . $this->state->get('filter.language'), 0);
     if (time() - $cached_time > 60 * 5) {
         $this->state->set('cache_expired', true);
     }
     // Add strings for translations in Javascript
     JText::script('COM_LANGUAGES_VIEW_OVERRIDE_NO_RESULTS');
     JText::script('COM_LANGUAGES_VIEW_OVERRIDE_REQUEST_ERROR');
     $this->addToolbar();
     parent::display($tpl);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:32,代码来源:view.html.php

示例3: getLabel

 /**
  * Method to get the field label markup.
  *
  * @return  string  The field label markup.
  *
  * @since   2.5.5
  */
 protected function getLabel()
 {
     // Initialise variables.
     $label = '';
     if ($this->hidden) {
         return $label;
     }
     // Get the label text from the XML element, defaulting to the element name.
     $text = $this->element['label'] ? (string) $this->element['label'] : (string) $this->element['name'];
     $text = $this->translateLabel ? Lang::txt($text) : $text;
     // Set required to true as this field is not displayed at all if not required.
     $this->required = true;
     // Add CSS and JS for the TOS field
     $css = "#jform_profile_tos {width: 18em; margin: 0 !important; padding: 0 2px !important;}\n\t\t\t\t#jform_profile_tos input {margin:0 5px 0 0 !important; width:10px !important;}\n\t\t\t\t#jform_profile_tos label {margin:0 15px 0 0 !important; width:auto;}\n\t\t\t\t";
     Document::addStyleDeclaration($css);
     Html::behavior('modal');
     // Build the class for the label.
     $class = !empty($this->description) ? 'hasTip' : '';
     $class = $class . ' required';
     $class = !empty($this->labelClass) ? $class . ' ' . $this->labelClass : $class;
     // Add the opening label tag and main attributes attributes.
     $label .= '<label id="' . $this->id . '-lbl" for="' . $this->id . '" class="' . $class . '"';
     // If a description is specified, use it to build a tooltip.
     if (!empty($this->description)) {
         $label .= ' title="' . htmlspecialchars(trim($text, ':') . '::' . ($this->translateDescription ? Lang::txt($this->description) : $this->description), ENT_COMPAT, 'UTF-8') . '"';
     }
     $tosarticle = $this->element['article'] ? (int) $this->element['article'] : 1;
     $link = '<a class="modal" title="" href="index.php?option=com_content&amp;view=article&amp;layout=modal&amp;id=' . $tosarticle . '&amp;tmpl=component" rel="{handler: \'iframe\', size: {x:800, y:500}}">' . $text . '</a>';
     // Add the label text and closing tag.
     $label .= '>' . $link . '<span class="star">&#160;*</span></label>';
     return $label;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:39,代码来源:tos.php

示例4: onDisplay

 /**
  * Display the button
  *
  * @return array A two element array of (imageName, textToInsert)
  */
 public function onDisplay($name)
 {
     $template = App::get('template')->template;
     $link = 'index.php?option=com_content&amp;view=article&amp;layout=pagebreak&amp;tmpl=component&amp;e_name=' . $name;
     Html::behavior('modal');
     $button = new \Hubzero\Base\Object();
     $button->set('modal', true);
     $button->set('link', $link);
     $button->set('text', Lang::txt('PLG_EDITORSXTD_PAGEBREAK_BUTTON_PAGEBREAK'));
     $button->set('name', 'pagebreak');
     $button->set('options', "{handler: 'iframe', size: {x: 400, y: 100}}");
     return $button;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:18,代码来源:pagebreak.php

示例5: getInput

 /**
  * Method to get the field input markup.
  *
  * @return	string	The field input markup.
  * @since	1.6
  */
 protected function getInput()
 {
     // Load the javascript
     Html::behavior('framework');
     Html::behavior('modal', 'input.modal');
     // Build the script.
     $script = array();
     $script[] = '	function jSelectChart_' . $this->id . '(id, name, object) {';
     $script[] = '		$("#' . $this->id . '_id").val(id);';
     $script[] = '		$("#' . $this->id . '_name").val(name);';
     $script[] = '		$.fancybox.close();';
     $script[] = '	}';
     // Add the script to the document head.
     Document::addScriptDeclaration(implode("\n", $script));
     // Build the script.
     $script = array();
     $script[] = '	jQuery(document).ready(function($){';
     $script[] = '		var div = $("<div>").css("display", "none").prependTo($("#menu-types"));';
     $script[] = '		$("#menu-types").append(div);';
     $script[] = '	});';
     // Add the script to the document head.
     Document::addScriptDeclaration(implode("\n", $script));
     // Get the title of the linked chart
     $db = App::get('db');
     $db->setQuery('SELECT name' . ' FROM #__newsfeeds' . ' WHERE id = ' . (int) $this->value);
     $title = $db->loadResult();
     if ($error = $db->getErrorMsg()) {
         throw new Exception($error, 500);
     }
     if (empty($title)) {
         $title = Lang::txt('COM_NEWSFEEDS_SELECT_A_FEED');
     }
     $link = 'index.php?option=com_newsfeeds&amp;view=newsfeeds&amp;layout=modal&amp;tmpl=component&amp;function=jSelectChart_' . $this->id;
     Html::behavior('modal', 'a.modal');
     $html = "\n" . '<div class="fltlft"><input type="text" id="' . $this->id . '_name" value="' . htmlspecialchars($title, ENT_QUOTES, 'UTF-8') . '" disabled="disabled" /></div>';
     $html .= '<div class="button2-left"><div class="blank"><a class="modal" title="' . Lang::txt('COM_NEWSFEEDS_CHANGE_FEED_BUTTON') . '"  href="' . $link . '" rel="{handler: \'iframe\', size: {x: 800, y: 450}}">' . Lang::txt('COM_NEWSFEEDS_CHANGE_FEED_BUTTON') . '</a></div></div>' . "\n";
     // The active newsfeed id field.
     if (0 == (int) $this->value) {
         $value = '';
     } else {
         $value = (int) $this->value;
     }
     // class='required' for client side validation
     $class = '';
     if ($this->required) {
         $class = ' class="required modal-value"';
     }
     $html .= '<input type="hidden" id="' . $this->id . '_id"' . $class . ' name="' . $this->name . '" value="' . $value . '" />';
     return $html;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:56,代码来源:newsfeeds.php

示例6: getInput

 /**
  * Method to get the field input markup.
  *
  * @return	string	The field input markup.
  * @since	1.6
  */
 protected function getInput()
 {
     // Load the modal behavior script.
     Html::behavior('modal', 'a.modal');
     // Build the script.
     $script = array();
     $script[] = '	function jSelectArticle_' . $this->id . '(id, title, catid, object) {';
     $script[] = '		$("#' . $this->id . '_id").val(id);';
     $script[] = '		$("#' . $this->id . '_name").val(title);';
     $script[] = '		$.fancybox.close();';
     $script[] = '	}';
     // Add the script to the document head.
     Document::addScriptDeclaration(implode("\n", $script));
     // Setup variables for display.
     $html = array();
     $link = 'index.php?option=com_content&amp;view=articles&amp;layout=modal&amp;tmpl=component&amp;function=jSelectArticle_' . $this->id;
     $db = App::get('db');
     $db->setQuery('SELECT title' . ' FROM #__content' . ' WHERE id = ' . (int) $this->value);
     $title = $db->loadResult();
     if ($error = $db->getErrorMsg()) {
         throw new Exception($error, 500);
     }
     if (empty($title)) {
         $title = Lang::txt('COM_CONTENT_SELECT_AN_ARTICLE');
     }
     $title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
     // The current user display field.
     $html[] = '<div class="input-modal">';
     $html[] = '  <span class="input-cell">';
     $html[] = '    <input type="text" id="' . $this->id . '_name" value="' . $title . '" disabled="disabled" size="35" />';
     $html[] = '  </span>';
     // The user select button.
     $html[] = '  <span class="input-cell">';
     $html[] = '    <a class="modal button" title="' . Lang::txt('COM_CONTENT_CHANGE_ARTICLE') . '"  href="' . $link . '&amp;' . JSession::getFormToken() . '=1" rel="{handler: \'iframe\', size: {x: 800, y: 450}}">' . Lang::txt('COM_CONTENT_CHANGE_ARTICLE_BUTTON') . '</a>';
     $html[] = '  </span>';
     $html[] = '</div>';
     // The active article id field.
     if (0 == (int) $this->value) {
         $value = '';
     } else {
         $value = (int) $this->value;
     }
     // class='required' for client side validation
     $class = '';
     if ($this->required) {
         $class = ' class="required modal-value"';
     }
     $html[] = '<input type="hidden" id="' . $this->id . '_id"' . $class . ' name="' . $this->name . '" value="' . $value . '" />';
     return implode("\n", $html);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:56,代码来源:article.php

示例7: display

 function display($tpl = null)
 {
     Html::behavior('framework', true);
     \Hubzero\Document\Assets::addComponentScript('com_media', 'popup-imagemanager.js');
     \Hubzero\Document\Assets::addComponentStylesheet('com_media', 'popup-imagemanager.css');
     // Display form for FTP credentials?
     // Don't set them here, as there are other functions called before this one if there is any file write operation
     $ftp = !JClientHelper::hasCredentials('ftp');
     $this->session = App::get('session');
     $this->config = Component::params('com_media');
     $this->state = $this->get('state');
     $this->folderList = $this->get('folderList');
     $this->require_ftp = $ftp;
     parent::display($tpl);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:15,代码来源:view.html.php

示例8: edit

 /**
  * Display an edit icon for the article.
  *
  * This icon will not display in a popup window, nor if the article is trashed.
  * Edit access checks must be performed in the calling code.
  *
  * @param	object	$article	The article in question.
  * @param	object	$params		The article parameters
  * @param	array	$attribs	Not used??
  *
  * @return	string	The HTML for the article edit icon.
  * @since	1.6
  */
 static function edit($article, $params, $attribs = array())
 {
     // Initialise variables.
     $userId = User::get('id');
     // Ignore if in a popup window.
     if ($params && $params->get('popup')) {
         return;
     }
     // Ignore if the state is negative (trashed).
     if ($article->state < 0) {
         return;
     }
     Html::behavior('tooltip');
     // Show checked_out icon if the article is checked out by a different user
     if (property_exists($article, 'checked_out') && property_exists($article, 'checked_out_time') && $article->checked_out > 0 && $article->checked_out != User::get('id')) {
         $checkoutUser = User::getInstance($article->checked_out);
         $button = Html::asset('image', 'checked_out.png', NULL, NULL, true);
         $date = Date::of($article->checked_out_time)->toLocal();
         $tooltip = Lang::txt('JLIB_HTML_CHECKED_OUT') . ' :: ' . Lang::txt('COM_CONTENT_CHECKED_OUT_BY', $checkoutUser->name) . ' <br /> ' . $date;
         return '<span class="hasTip" title="' . htmlspecialchars($tooltip, ENT_COMPAT, 'UTF-8') . '">' . $button . '</span>';
     }
     $url = 'index.php?option=com_content&task=article.edit&a_id=' . $article->id . '&return=' . base64_encode(urlencode(Request::current(true)));
     $icon = $article->state ? 'edit.png' : 'edit_unpublished.png';
     if (strtotime($article->publish_up) > strtotime(Date::of('now'))) {
         $icon = 'edit_unpublished.png';
     }
     $text = Lang::txt('JGLOBAL_EDIT');
     //Html::asset('image', $icon, Lang::txt('JGLOBAL_EDIT'), NULL, true);
     if ($article->state == 0) {
         $overlib = Lang::txt('JUNPUBLISHED');
     } else {
         $overlib = Lang::txt('JPUBLISHED');
     }
     $date = Date::of($article->created)->toLocal();
     $author = $article->created_by_alias ? $article->created_by_alias : $article->author;
     $overlib .= '&lt;br /&gt;';
     $overlib .= $date;
     $overlib .= '&lt;br /&gt;';
     $overlib .= Lang::txt('COM_CONTENT_WRITTEN_BY', htmlspecialchars($author, ENT_COMPAT, 'UTF-8'));
     $button = '<a href="' . Route::url($url) . '">' . $text . '</a>';
     $output = '<span class="hasTip" title="' . Lang::txt('COM_CONTENT_EDIT_ITEM') . ' :: ' . $overlib . '">' . $button . '</span>';
     return $output;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:56,代码来源:icon.php

示例9: fetchElement

 function fetchElement($name, $value, &$node, $control_name)
 {
     $template = App::get('template')->template;
     $fieldName = $control_name . '[' . $name . ']';
     $article = JTable::getInstance('content');
     if ($value) {
         $article->load($value);
     } else {
         $article->title = Lang::txt('COM_CONTENT_SELECT_AN_ARTICLE');
     }
     $js = "\n\t\tfunction jSelectArticle_" . $name . "(id, title, catid, object) {\n\t\t\tdocument.getElementById(object + '_id').value = id;\n\t\t\tdocument.getElementById(object + '_name').value = title;\n\t\t\tSqueezeBox.close();\n\t\t}";
     Document::addScriptDeclaration($js);
     $link = 'index.php?option=com_content&amp;task=element&amp;tmpl=component&amp;function=jSelectArticle_' . $name;
     Html::behavior('modal', 'a.modal');
     $html = "\n" . '<div class="fltlft"><input type="text" id="' . $name . '_name" value="' . htmlspecialchars($article->title, ENT_QUOTES, 'UTF-8') . '" disabled="disabled" /></div>';
     //$html .= "\n &#160; <input class=\"inputbox modal-button\" type=\"button\" value=\"".Lang::txt('JSELECT')."\" />";
     $html .= '<div class="button2-left"><div class="blank"><a class="modal" title="' . Lang::txt('COM_CONTENT_SELECT_AN_ARTICLE') . '"  href="' . $link . '" rel="{handler: \'iframe\', size: {x: 650, y: 375}}">' . Lang::txt('JSELECT') . '</a></div></div>' . "\n";
     $html .= "\n" . '<input type="hidden" id="' . $name . '_id" name="' . $fieldName . '" value="' . (int) $value . '" />';
     return $html;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:20,代码来源:article.php

示例10: onDisplay

 /**
  * Display the button
  *
  * @return array A four element array of (article_id, article_title, category_id, object)
  */
 public function onDisplay($name)
 {
     // Javascript to insert the link
     // View element calls jSelectArticle when an article is clicked
     // jSelectArticle creates the link tag, sends it to the editor,
     // and closes the select frame.
     $js = "\n\t\tfunction jSelectArticle(id, title, catid, object, link, lang) {\n\t\t\tvar hreflang = '';\n\t\t\tif (lang !== '') {\n\t\t\t\tvar hreflang = ' hreflang = \"' + lang + '\"';\n\t\t\t}\n\t\t\tvar tag = '<a' + hreflang + ' href=\"' + link + '\">' + title + '</a>';\n\t\t\tjInsertEditorText(tag, '" . $name . "');\n\t\t\t\$.fancybox.close();\n\t\t}";
     Document::addScriptDeclaration($js);
     Html::behavior('modal');
     // Use the built-in element view to select the article.
     // Currently uses blank class.
     $link = 'index.php?option=com_content&amp;view=articles&amp;layout=modal&amp;tmpl=component&amp;' . Session::getFormToken() . '=1';
     $button = new \Hubzero\Base\Object();
     $button->set('modal', true);
     $button->set('link', $link);
     $button->set('text', Lang::txt('PLG_ARTICLE_BUTTON_ARTICLE'));
     $button->set('name', 'article');
     $button->set('options', "{handler: 'iframe', size: {x: 770, y: 400}}");
     return $button;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:25,代码来源:article.php

示例11: onDisplay

 /**
  * Display the button
  *
  * @param   string   $name
  * @param   string   $asset
  * @param   integer  $author
  * @return  array    A two element array of (imageName, textToInsert)
  */
 public function onDisplay($name, $asset, $author)
 {
     $params = Component::params('com_media');
     $extension = Request::getCmd('option');
     if ($asset == '') {
         $asset = $extension;
     }
     if (User::authorise('core.edit', $asset) || User::authorise('core.create', $asset) || count(User::getAuthorisedCategories($asset, 'core.create')) > 0 || User::authorise('core.edit.own', $asset) && $author == User::get('id') || count(User::getAuthorisedCategories($extension, 'core.edit')) > 0 || count(User::getAuthorisedCategories($extension, 'core.edit.own')) > 0 && $author == User::get('id')) {
         $link = 'index.php?option=com_media&amp;view=images&amp;tmpl=component&amp;e_name=' . $name . '&amp;asset=' . $asset . '&amp;author=' . $author;
         Html::behavior('modal');
         $button = new \Hubzero\Base\Object();
         $button->set('modal', true);
         $button->set('link', $link);
         $button->set('text', Lang::txt('PLG_IMAGE_BUTTON_IMAGE'));
         $button->set('name', 'image');
         $button->set('options', "{handler: 'iframe', size: {x: 800, y: 500}}");
         return $button;
     }
     return false;
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:28,代码来源:image.php

示例12: getInput

 /**
  * Method to get the field input markup.
  *
  * @return	string	The field input markup.
  * @since	1.6
  */
 protected function getInput()
 {
     // Get the client id.
     $clientId = $this->element['client_id'];
     if (!isset($clientId)) {
         $clientName = $this->element['client'];
         if (isset($clientName)) {
             $client = JApplicationHelper::getClientInfo($clientName, true);
             $clientId = $client->id;
         }
     }
     if (!isset($clientId) && $this->form instanceof JForm) {
         $clientId = $this->form->getValue('client_id');
     }
     $clientId = (int) $clientId;
     // Load the modal behavior script.
     Html::behavior('modal', 'a.modal');
     // Build the script.
     $script = array();
     $script[] = '	function jSelectPosition_' . $this->id . '(name) {';
     $script[] = '		$("#' . $this->id . '").val(name);';
     $script[] = '		$.fancybox.close();';
     $script[] = '	}';
     // Add the script to the document head.
     Document::addScriptDeclaration(implode("\n", $script));
     // Setup variables for display.
     $html = array();
     $link = 'index.php?option=com_modules&amp;view=positions&amp;layout=modal&amp;tmpl=component&amp;function=jSelectPosition_' . $this->id . '&amp;client_id=' . $clientId;
     // The current user display field.
     //$html[] = '<div class="fltlft">';
     $html[] = '<div class="input-modal">';
     $html[] = '<span class="input-cell">';
     $html[] = parent::getInput();
     $html[] = '</span>';
     // The user select button.
     $html[] = '<span class="input-cell">';
     $html[] = '<a class="button modal" title="' . Lang::txt('COM_MODULES_CHANGE_POSITION_TITLE') . '"  href="' . $link . '" rel="{handler: \'iframe\', size: {x: 800, y: 450}}">' . Lang::txt('COM_MODULES_CHANGE_POSITION_BUTTON') . '</a>';
     $html[] = '</span>';
     $html[] = '</div>';
     return implode("\n", $html);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:47,代码来源:moduleposition.php

示例13: getInput

 /**
  * Method to get the field input markup.
  *
  * @return	string	The field input markup.
  * @since	1.6
  */
 protected function getInput()
 {
     // Initialise variables.
     $html = array();
     $recordId = (int) $this->form->getValue('id');
     $size = ($v = $this->element['size']) ? ' size="' . $v . '"' : '';
     $class = ($v = $this->element['class']) ? ' class="' . $v . '"' : 'class="text_area"';
     // Get a reverse lookup of the base link URL to Title
     $model = JModelLegacy::getInstance('menutypes', 'menusModel');
     $rlu = $model->getReverseLookup();
     switch ($this->value) {
         case 'url':
             $value = Lang::txt('COM_MENUS_TYPE_EXTERNAL_URL');
             break;
         case 'alias':
             $value = Lang::txt('COM_MENUS_TYPE_ALIAS');
             break;
         case 'separator':
             $value = Lang::txt('COM_MENUS_TYPE_SEPARATOR');
             break;
         default:
             $link = $this->form->getValue('link');
             // Clean the link back to the option, view and layout
             $value = Lang::txt(\Hubzero\Utility\Arr::getValue($rlu, MenusHelper::getLinkKey($link)));
             break;
     }
     // Load the javascript and css
     Html::behavior('framework');
     Html::behavior('modal');
     Document::addScriptDeclaration("\n\t\t\tjQuery(document).ready(function(\$){\n\t\t\t\t\$('input.modal').fancybox({\n\t\t\t\t\tarrows: false,\n\t\t\t\t\ttype: 'iframe',\n\t\t\t\t\tautoSize: false,\n\t\t\t\t\tfitToView: false,\n\t\t\t\t\twidth: 600,\n\t\t\t\t\theight: 450,\n\t\t\t\t\thref: '" . Route::url('index.php?option=com_menus&view=menutypes&tmpl=component&recordId=' . $recordId, false) . "'\n\t\t\t\t});\n\t\t\t});\n\t\t");
     $html[] = '<div class="input-modal">';
     $html[] = '<span class="input-cell">';
     $html[] = '<input type="text" id="' . $this->id . '" readonly="readonly" disabled="disabled" value="' . $value . '"' . $size . $class . ' />';
     $html[] = '</span><span class="input-cell">';
     $html[] = '<input type="button" class="modal" value="' . Lang::txt('JSELECT') . '" />';
     $html[] = '<input type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" />';
     $html[] = '</span>';
     $html[] = '</div>';
     return implode("\n", $html);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:46,代码来源:menutype.php

示例14: display

 /**
  * Method to display a view.
  *
  * @param	boolean			If true, the view output will be cached
  * @param	array			An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return	JController		This object to support chaining.
  * @since	1.5
  */
 public function display($cachable = false, $urlparams = false)
 {
     $cachable = true;
     Html::behavior('caption');
     // Set the default view name and format from the Request.
     // Note we are using a_id to avoid collisions with the router and the return page.
     // Frontend is a bit messier than the backend.
     $id = Request::getInt('a_id');
     $vName = Request::getCmd('view', 'categories');
     Request::setVar('view', $vName);
     if (User::get('id') || $_SERVER['REQUEST_METHOD'] == 'POST' && ($vName == 'category' && Request::getCmd('layout') != 'blog' || $vName == 'archive')) {
         $cachable = false;
     }
     $safeurlparams = array('catid' => 'INT', 'id' => 'INT', 'cid' => 'ARRAY', 'year' => 'INT', 'month' => 'INT', 'limit' => 'UINT', 'limitstart' => 'UINT', 'showall' => 'INT', 'return' => 'BASE64', 'filter' => 'STRING', 'filter_order' => 'CMD', 'filter_order_Dir' => 'CMD', 'filter-search' => 'STRING', 'print' => 'BOOLEAN', 'lang' => 'CMD', 'Itemid' => 'INT');
     // Check for edit form.
     if ($vName == 'form' && !$this->checkEditId('com_content.edit.article', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         return App::abort(403, Lang::txt('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
     }
     parent::display($cachable, $safeurlparams);
     return $this;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:31,代码来源:controller.php

示例15: onAfterDispatch

 /**
  * Method to catch the onAfterDispatch event.
  *
  * This is where we setup the click-through content highlighting for.
  * The highlighting is done with JavaScript so we just
  * need to check a few parameters and the JHtml behavior will do the rest.
  *
  * @return  boolean  True on success
  *
  * @since   2.5
  */
 public function onAfterDispatch()
 {
     // Check that we are in the site application.
     if (!App::isSite()) {
         return true;
     }
     // Set the variables
     $extension = Request::getCmd('option', '');
     // Check if the highlighter is enabled.
     if (!Component::params($extension)->get('highlight_terms', 1)) {
         return true;
     }
     // Check if the highlighter should be activated in this environment.
     if (Document::getType() !== 'html' || Request::getCmd('tmpl', '') === 'component') {
         return true;
     }
     // Get the terms to highlight from the request.
     $terms = Request::getVar('highlight', null, 'base64');
     $terms = $terms ? json_decode(base64_decode($terms)) : null;
     // Check the terms.
     if (empty($terms)) {
         return true;
     }
     // Clean the terms array
     $filter = JFilterInput::getInstance();
     $cleanTerms = array();
     foreach ($terms as $term) {
         $cleanTerms[] = htmlspecialchars($filter->clean($term, 'string'));
     }
     // Activate the highlighter.
     Html::behavior('highlighter', $cleanTerms);
     // Adjust the component buffer.
     $buf = Document::getBuffer('component');
     $buf = '<br id="highlighter-start" />' . $buf . '<br id="highlighter-end" />';
     Document::setBuffer($buf, 'component');
     return true;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:48,代码来源:highlight.php


注:本文中的Html::behavior方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。