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


PHP cmsFramework::meta方法代码示例

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


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

示例1: beforeFilter


//.........这里部分代码省略.........
     } else {
         $module_limit = 5;
     }
     $this->module_limit = Sanitize::getInt($this->data, 'module_limit', $module_limit);
     $this->module_page = Sanitize::getInt($this->data, 'module_page', 1);
     $this->module_page = $this->module_page === 0 ? 1 : $this->module_page;
     $this->module_offset = (int) ($this->module_page - 1) * $this->module_limit;
     if ($this->module_offset < 0) {
         $this->module_offset = 0;
     }
     $this->page = $this->page === 0 ? 1 : $this->page;
     $this->offset = (int) ($this->page - 1) * $this->limit;
     if ($this->offset < 0) {
         $this->offset = 0;
     }
     # Required further below for Community Model init
     if (!isset($this->Menu)) {
         App::import('Model', 'menu', 'jreviews');
         $this->Menu = ClassRegistry::getClass('MenuModel');
     }
     if (!$this->ajaxRequest) {
         if (!($menu_id = Configure::read('_public_menu_id'))) {
             # Find and set one public Itemid to use for Ajax requests
             $menu_id = '';
             $menu_id = $this->Menu->get('jreviews_public');
             $menu_id = $menu_id != '' ? $menu_id : 99999;
             Configure::write('_public_menu_id', $menu_id);
         }
         if (!($search_itemid = Configure::read('_search_itemid'))) {
             // Set search menu Itemid used in several of the controllers
             $option = Sanitize::getString($this->params, 'option');
             $auto_itemid = Sanitize::getBool($this->Config, 'search_itemid', false);
             $hc_itemid = Sanitize::getInt($this->Config, 'search_itemid_hc', '');
             $search_menuid = $this->Menu->get('jr_advsearch');
             $search_itemid = '';
             switch ($option) {
                 case 'com_jreviews':
                     // page Itemid is enabled
                     if (!$auto_itemid && $hc_itemid > 0) {
                         $search_itemid = $hc_itemid;
                     } elseif (!$auto_itemid & $search_menuid > 0) {
                         $search_itemid = $search_menuid;
                     }
                     break;
                 default:
                     // Non-JReviews pages - can't use current page Itemid
                     if ($hc_itemid > 0) {
                         $search_itemid = $hc_itemid;
                     } else {
                         $search_itemid = $search_menuid;
                     }
                     break;
             }
             $search_itemid == '' and $option == 'com_jreviews' and $search_itemid = Sanitize::getString($this->params, 'Itemid');
             Configure::write('_search_itemid', $search_itemid);
         }
         $this->set(array('search_itemid' => $search_itemid, 'public_menu_id' => $menu_id));
     }
     if (!defined('MVC_GLOBAL_JS_VARS') && !$this->ajaxRequest && $this->action != '_save') {
         # Add global javascript variables
         $this->assets['head-top'][] = '<script type="text/javascript">
         /* <![CDATA[ */
         var s2AjaxUri = "' . getAjaxUri() . '",
             jrLanguage = new Array(),
             jrVars = new Array(),
             datePickerImage = "' . $this->viewImages . 'calendar.gif",
             jrPublicMenu = ' . $menu_id . ';
         jrLanguage["cancel"] = "' . __t("Cancel", true) . '";
         jrLanguage["submit"] = "' . __t("Submit", true) . '";
         jrLanguage["clearDate"] = "' . __t("Clear", true) . '";
         jrLanguage["field.select"] = "' . __t("-- Select --", true) . '";
         jrLanguage["field.select_field"] = "' . __t("-- Select %s --", true) . '";
         jrLanguage["field.no_results"] = "' . __t("No results found, try a different spelling.", true) . '";
         jrLanguage["field.ui_help"] = "' . __t("Start typing for suggestions", true) . '";
         jrLanguage["field.ui_add"] = "' . __t("Add", true) . '";
         jrLanguage["compare.heading"] = "' . __t("Compare", true) . '";
         jrLanguage["compare.compare_all"] = "' . __t("Compare All", true) . '";
         jrLanguage["compare.remove_all"] = "' . __t("Remove All", true) . '";
         jrLanguage["compare.select_more"] = "' . __t("You need to select more than one listing for comparison.", true) . '";
         jrLanguage["compare.select_max"] = "' . __t("You selected maximum number of listings for comparison.", true) . '";
         jrVars["locale"] = "' . cmsFramework::getLocale() . '";
         /* ]]> */
         </script>';
         if ($item_id = Sanitize::getInt($this->params, 'Itemid')) {
             $menu = $this->Menu->getMenuParams($item_id);
             $meta_desc = Sanitize::getString($menu, 'menu-meta_description');
             $meta_keys = Sanitize::getString($menu, 'menu-meta_keywords');
             $meta_desc != '' and cmsFramework::meta('description', $meta_desc);
             $meta_keys != '' and cmsFramework::meta('keywords', $meta_keys);
         }
         define('MVC_GLOBAL_JS_VARS', 1);
     }
     # Dynamic Community integration loading
     $community_extension = Configure::read('Community.extension');
     $community_extension = $community_extension != '' ? $community_extension : 'community_builder';
     App::import('Model', $community_extension, 'jreviews');
     $this->Community = new CommunityModel();
     # Init plugin system
     $this->_initPlugins();
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:101,代码来源:my_controller.php

示例2: onBeforeDisplayContent

 function onBeforeDisplayContent(&$article, &$params)
 {
     if (!class_exists('cmsFramework') || !class_exists('Sanitize')) {
         return;
     }
     // Make sure this is a Joomla article page
     $option = Sanitize::getString($_REQUEST, 'option', '');
     $view = Sanitize::getString($_REQUEST, 'view', '');
     $layout = Sanitize::getString($_REQUEST, 'layout', '');
     $id = Sanitize::getInt($_REQUEST, 'id');
     if (!($option == 'com_content' && $view == 'article' && $id)) {
         return;
     }
     /**
      * Retrieve $listing array from memory 
      */
     $Config = Configure::read('JreviewsSystem.Config');
     $title = trim(Sanitize::getString($Config, 'type_metatitle'));
     $this->cms_version >= 1.6 and $params->set('page_title', $article->title);
     // Fixes J16 bug that uses cat menu title as page title
     $keywords = trim(Sanitize::getString($Config, 'type_metakey'));
     $description = trim(Sanitize::getString($Config, 'type_metadesc'));
     $listing = classRegistry::getObject('listing', 'jreviewsplugin');
     // Has all the data that's also available in the detail.thtml theme file so you can create any sort of conditionals with it
     $crumbs = classRegistry::getObject('crumbs', 'jreviewsplugin');
     if ($title != '' || $keywords != '' || $description != '') {
         if ($listing && is_array($listing)) {
             // Get and process all tags
             $tags = plgContentJreviews::extractTags($title . $keywords . $description);
             $tags_array = array();
             foreach ($tags as $tag) {
                 switch ($tag) {
                     case 'title':
                         $tags_array['{title}'] = Sanitize::stripAll($listing['Listing'], 'title');
                         break;
                     case 'section':
                         $tags_array['{section}'] = Sanitize::stripAll($listing['Section'], 'title');
                         break;
                     case 'category':
                         $tags_array['{category}'] = Sanitize::stripAll($listing['Category'], 'title');
                         break;
                     case 'metakey':
                         $tags_array['{metakey}'] = Sanitize::stripAll($listing['Listing'], 'metakey');
                         break;
                     case 'metadesc':
                         $tags_array['{metadesc}'] = Sanitize::stripAll($listing['Listing'], 'metadesc');
                         break;
                     case 'summary':
                         $tags_array['{summary}'] = Sanitize::htmlClean(Sanitize::stripAll($listing['Listing'], 'summary'));
                         break;
                     case 'description':
                         $tags_array['{description}'] = Sanitize::htmlClean(Sanitize::stripAll($listing['Listing'], 'description'));
                         break;
                     default:
                         if (substr($tag, 0, 3) == 'jr_' && isset($listing['Field']['pairs'][$tag])) {
                             $fields = $listing['Field']['pairs'];
                             $tags_array['{' . $tag . '}'] = isset($fields[$tag]['text']) ? html_entity_decode(implode(", ", $fields[$tag]['text']), ENT_QUOTES, 'utf-8') : '';
                         }
                         break;
                 }
             }
             # Process title
             $title != '' and $title = str_replace('&amp;', '&', str_replace(array_keys($tags_array), $tags_array, $title)) and cmsFramework::meta('title', $title);
             $title != '' and $this->cms_version >= 1.6 and $params->set('page_title', $title);
             # Process description
             $description != '' and $description = str_replace('&amp;', '&', str_replace(array_keys($tags_array), $tags_array, $description)) and cmsFramework::meta('description', $description);
             $description != '' and $this->cms_version >= 1.6 and $article->metadesc = htmlspecialchars($description, ENT_QUOTES, 'utf-8');
             # Process keywords
             $keywords != '' and $keywords = mb_strtolower(str_replace('&amp;', '&', str_replace(array_keys($tags_array), $tags_array, $keywords)), 'utf-8') and cmsFramework::meta('keywords', $keywords);
             $keywords != '' and $this->cms_version >= 1.6 and $article->metakey = htmlspecialchars($keywords, ENT_QUOTES, 'utf-8');
         }
     } elseif (isset($article->parameters) && $article->parameters->get('show_page_title') && $article->parameters->get('num_leading_articles') == '' && $article->parameters->get('filter_type') == '') {
         $title = $article->parameters->get('page_title');
         $title != '' and $params->set('page_title', $title);
     }
     if ($crumbs && !empty($crumbs)) {
         cmsFramework::setPathway($crumbs);
     }
     $this->facebookOpenGraph($listing, compact('title', 'keywords', 'description'));
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:80,代码来源:jreviews.php

示例3: onBeforeDisplayContent

 function onBeforeDisplayContent(&$article, &$params)
 {
     if (!class_exists('cmsFramework')) {
         return;
     }
     // Make sure this is a Joomla article page
     $option = Sanitize::getString($_REQUEST, 'option', '');
     $view = Sanitize::getString($_REQUEST, 'view', '');
     $layout = Sanitize::getString($_REQUEST, 'layout', '');
     $id = Sanitize::getInt($_REQUEST, 'id');
     if (!($option == 'com_content' && $view == 'article' && $id)) {
         return;
     }
     /**
      * Retrieve $listing array from memory 
      */
     $_this =& cmsFramework::getInstance();
     $Config = Configure::read('JreviewsSystem.Config');
     $title = trim(Sanitize::getString($Config, 'type_metatitle'));
     $keywords = trim(Sanitize::getString($Config, 'type_metakey'));
     $description = trim(Sanitize::getString($Config, 'type_metadesc'));
     $listing =& $_this->listing;
     // Has all the data that's also available in the detail.thtml theme file so you can create any sort of conditionals with it
     if ($title != '' || $keywords != '' || $description != '') {
         if (isset($_this->listing) && is_array($_this->listing)) {
             // Instantiate the CustomFields helper class
             $CustomFields =& RegisterClass::getInstance('CustomFieldsHelper');
             // Get and process all tags
             $tags = plgContentJreviews::extractTags($title . $keywords . $description);
             $tags_array = array();
             foreach ($tags as $tag) {
                 switch ($tag) {
                     case 'title':
                         $tags_array['{title}'] = Sanitize::stripAll($listing['Listing'], 'title');
                         break;
                     case 'section':
                         $tags_array['{section}'] = Sanitize::stripAll($listing['Section'], 'title');
                         break;
                     case 'category':
                         $tags_array['{category}'] = Sanitize::stripAll($listing['Category'], 'title');
                         break;
                     case 'metakey':
                         $tags_array['{metakey}'] = Sanitize::stripAll($listing['Listing'], 'metakey');
                         break;
                     case 'metadesc':
                         $tags_array['{metadesc}'] = Sanitize::stripAll($listing['Listing'], 'metadesc');
                         break;
                     default:
                         if (substr($tag, 0, 3) == 'jr_') {
                             $field = $CustomFields->fieldText($tag, $listing, false, false, ',');
                             $tags_array['{' . $tag . '}'] = !empty($field) ? $field : '';
                         }
                         break;
                 }
             }
             # Process title
             $title != '' and $title = str_replace(array_keys($tags_array), $tags_array, $title) and cmsFramework::meta('title', $title);
             # Process description
             $description != '' and $description = str_replace(array_keys($tags_array), $tags_array, $description) and cmsFramework::meta('description', $description);
             # Process keywords
             $keywords != '' and $keywords = str_replace(array_keys($tags_array), $tags_array, $keywords) and cmsFramework::meta('keywords', $keywords);
         }
     } elseif (isset($article->parameters) && $article->parameters->get('show_page_title') && $article->parameters->get('num_leading_articles') == '' && $article->parameters->get('filter_type') == '') {
         $title = $article->parameters->get('page_title');
         $title != '' and cmsFramework::meta('title', $title);
     }
     if (isset($_this->crumbs) && !empty($_this->crumbs)) {
         cmsFramework::setPathway($_this->crumbs);
     }
     unset($_this);
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:71,代码来源:jreviews.php

示例4: beforeFilter

 function beforeFilter()
 {
     # These should be called in each controller where they are required instead of globally
     $this->_db = cmsFramework::getDB();
     $this->_user = cmsFramework::getUser();
     # Init Access
     if (isset($this->Access)) {
         $this->Access->init($this->Config);
     }
     App::import('Component', 'theming', 'jreviews');
     $this->Theming = ClassRegistry::getClass('ThemingComponent');
     $this->Theming->startup($this);
     # Set pagination vars
     // First check url, then menu parameter. Otherwise the limit list in pagination doesn't respond b/c menu params always wins
     $this->limit = Sanitize::getInt($this->params, 'limit', Sanitize::getInt($this->data, 'limit_special', Sanitize::getInt($this->data, 'limit')));
     //		$this->passedArgs['limit'] = $this->limit;
     $this->page = Sanitize::getInt($this->data, 'page', Sanitize::getInt($this->params, 'page', 1));
     if (!$this->limit) {
         if (Sanitize::getVar($this->params, 'action') == 'myreviews') {
             $this->limit = Sanitize::getInt($this->params, 'limit', $this->Config->user_limit);
         } else {
             $this->limit = Sanitize::getInt($this->params, 'limit', $this->Config->list_limit);
         }
     }
     // Set a hard code limit to prevent abuse
     $this->limit = max(min($this->limit, 50), 1);
     // Need to normalize the limit var for modules
     if (isset($this->params['module'])) {
         $module_limit = Sanitize::getInt($this->params['module'], 'module_limit', 5);
     } else {
         $module_limit = 5;
     }
     $this->module_limit = Sanitize::getInt($this->data, 'module_limit', $module_limit);
     $this->module_page = Sanitize::getInt($this->data, 'module_page', 1);
     $this->module_page = $this->module_page === 0 ? 1 : $this->module_page;
     $this->module_offset = (int) ($this->module_page - 1) * $this->module_limit;
     if ($this->module_offset < 0) {
         $this->module_offset = 0;
     }
     $this->page = $this->page === 0 ? 1 : $this->page;
     $this->offset = (int) ($this->page - 1) * $this->limit;
     if ($this->offset < 0) {
         $this->offset = 0;
     }
     # Required further below for Community Model init
     if (!isset($this->Menu)) {
         App::import('Model', 'menu', 'jreviews');
         $this->Menu = ClassRegistry::getClass('MenuModel');
     }
     if (!defined('MVC_GLOBAL_JS_VARS') && !$this->ajaxRequest && $this->action != '_save') {
         # Find and set one public Itemid to use for Ajax requests
         $menu_id = '';
         $menu_id = $this->Menu->get('jreviews_public');
         $menu_id = $menu_id != '' ? $menu_id : 99999;
         $this->set('public_menu_id', $menu_id);
         # Add global javascript variables
         $this->assets['head-top'][] = '<script type="text/javascript">
         /* <![CDATA[ */
         var s2AjaxUri = "' . getAjaxUri() . '",
             jrLanguage = new Array(),
             jrVars = new Array(),
             datePickerImage = "' . $this->viewImages . 'calendar.gif",
             jrPublicMenu = ' . $menu_id . ';
         jrLanguage["cancel"] = "' . __t("Cancel", true) . '";
         jrLanguage["submit"] = "' . __t("Submit", true) . '";
         jrLanguage["field.select"] = "' . __t("-- Select --", true) . '";
         jrLanguage["field.select_field"] = "' . __t("-- Select %s --", true) . '";
         jrLanguage["field.no_results"] = "' . __t("No results found, try a different spelling.", true) . '";
         jrLanguage["field.ui_help"] = "' . __t("Start typing for suggestions", true) . '";
         jrLanguage["field.ui_add"] = "' . __t("Add", true) . '";
         jrLanguage["compare.heading"] = "' . __t("Compare", true) . '";
         jrLanguage["compare.compare_all"] = "' . __t("Compare All", true) . '";
         jrLanguage["compare.remove_all"] = "' . __t("Remove All", true) . '";
         jrLanguage["compare.select_more"] = "' . __t("You need to select more than one listing for comparison.", true) . '";
         jrLanguage["compare.select_max"] = "' . __t("You selected maximum number of listings for comparison.", true) . '";
         jrLanguage["geomaps.no_streeview"] = "' . __t("Street view not available for this address.", true) . '";
         jrLanguage["geomaps.cannot_geocode"] = "' . __t("Address could not be geocoded. Modify the address and click on the Geocode Address button to try again.", true) . '";
         jrLanguage["geomaps.drag_marker"] = "' . __t("Drag the marker to fine-tune the geographic location on the map.", true) . '";
         jrLanguage["geomaps.directions_bad_address"] = "' . __t("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.", true) . '";
         jrLanguage["geomaps.directions_request_error"] = "' . __t("The was an error processing the request.", true) . '";
         jrVars["locale"] = "' . cmsFramework::getLocale() . '";
         /* ]]> */
         </script>';
         if ($item_id = Sanitize::getInt($this->params, 'Itemid')) {
             $menu = $this->Menu->getMenuParams($item_id);
             $meta_desc = Sanitize::getString($menu, 'menu-meta_description');
             $meta_keys = Sanitize::getString($menu, 'menu-meta_keywords');
             $meta_desc != '' and cmsFramework::meta('description', $meta_desc);
             $meta_keys != '' and cmsFramework::meta('keywords', $meta_keys);
         }
         define('MVC_GLOBAL_JS_VARS', 1);
     }
     # Dynamic Community integration loading
     $community_extension = Configure::read('Community.extension');
     $community_extension = $community_extension != '' ? $community_extension : 'community_builder';
     App::import('Model', $community_extension, 'jreviews');
     $this->Community = new CommunityModel();
     # Init plugin system
     $this->_initPlugins();
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:100,代码来源:my_controller.php


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