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


PHP cmsFramework::isAdmin方法代码示例

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


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

示例1: addPagination

 function addPagination($page, $limit)
 {
     if (cmsFramework::isAdmin()) {
         $url = rtrim($this->base_url, '/') . ($page > 1 ? '/' . 'page' . _PARAM_CHAR . $page . '/limit' . _PARAM_CHAR . $limit . '/' : '');
     } else {
         $order = Sanitize::getString($this->params, 'order');
         $default_limit = Sanitize::getInt($this->params, 'default_limit');
         $url_params = $this->passedArgs;
         unset($url_params['page'], $url_params['Itemid'], $url_params['option'], $url_params['view']);
         if ($page == 1 && $this->limit == $default_limit && ($order == '' || $order == Sanitize::getString($this->params, 'default_order')) && empty($url_params)) {
             preg_match('/^index.php\\?option=com_jreviews&Itemid=[0-9]+/i', $this->base_url, $matches);
             $url = $matches[0];
         } else {
             $url = $this->base_url;
             $page > 1 and $url = rtrim($url, '/') . '/' . 'page' . _PARAM_CHAR . $page . '/';
             if ($this->limit != $default_limit) {
                 $url = rtrim($url, '/') . '/limit' . _PARAM_CHAR . $limit . '/';
             }
         }
         // Remove menu segment from url if page 1 and it' a menu
         if ($page == 1 && preg_match('/^(index.php\\?option=com_jreviews&Itemid=[0-9]+)(&url=menu\\/)$/i', $url, $matches)) {
             $url = $matches[1];
         }
         $url = cmsFramework::route($url);
     }
     return $url;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:27,代码来源:paginator.php

示例2: addPagination

 function addPagination($page, $limit)
 {
     if (cmsFramework::isAdmin()) {
         $url = rtrim($this->base_url, '/') . ($page > 1 ? '/' . 'page' . _PARAM_CHAR . $page . '/limit' . _PARAM_CHAR . $limit . '/' : '');
     } else {
         $url = cmsFramework::route(rtrim($this->base_url, '/') . ($page > 1 ? '/' . 'page' . _PARAM_CHAR . $page . '/limit' . _PARAM_CHAR . $limit . '/' : ''));
     }
     $page == 1 and !strstr($url, 'order') and $url = str_replace('&url=menu', '', $url);
     return $url;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:10,代码来源:paginator.php

示例3: route

 function route($link, $xhtml = true, $ssl = null)
 {
     if (false === strpos($link, 'index.php') && false === strpos($link, 'index2.php')) {
         $link = 'index.php?' . $link;
     }
     // Check core sef
     $sef = cmsFramework::getConfig('sef');
     $sef_rewrite = cmsFramework::getConfig('sef_rewrite');
     if (false === strpos($link, 'option=com_jreviews') && !$sef) {
         $url = cmsFramework::isAdmin() ? cmsFramework::siteRoute($link, $xhtml, $ssl) : JRoute::_($link, $xhtml, $ssl);
         if (false === strpos($url, 'http')) {
             $parsedUrl = parse_url(WWW_ROOT);
             $port = isset($parsedUrl['port']) && $parsedUrl['port'] != '' ? ':' . $parsedUrl['port'] : '';
             $url = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . $port . $url;
         }
         return $url;
     } elseif (false === strpos($link, 'option=com_jreviews')) {
         $url = cmsFramework::isAdmin() ? cmsFramework::siteRoute($link, $xhtml, $ssl) : JRoute::_($link, $xhtml, $ssl);
         return $url;
     }
     // Fixes component menu urls with pagination and ordering parameters when core sef is enabled.
     $link = str_replace('//', '/', $link);
     if ($sef) {
         if (substr($link, 0, 10) === 'index.php') {
             $link = str_replace('/', '%2F', $link);
         }
         // Core sef doesn't know how to deal with colons, so we convert them to something else and then replace them again.
         $link = str_replace(_PARAM_CHAR, '*@*', $link);
         $sefUrl = cmsFramework::isAdmin() ? cmsFramework::siteRoute($link, $xhtml, $ssl) : JRoute::_($link, $xhtml, $ssl);
         $sefUrl = str_replace('%2A%40%2A', _PARAM_CHAR, $sefUrl);
         $sefUrl = str_replace('*@*', _PARAM_CHAR, $sefUrl);
         // For non sef links
         $link = $sefUrl;
     }
     if (false !== strpos($link, 'http')) {
         return $link;
     } else {
         $parsedUrl = parse_url(WWW_ROOT);
         $port = isset($parsedUrl['port']) && $parsedUrl['port'] != '' ? ':' . $parsedUrl['port'] : '';
         $www_root = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . $port . ($sef ? _DS : $parsedUrl['path']);
         return $www_root . ltrim($link, _DS);
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:43,代码来源:joomla15.php

示例4: _postVote

 function _postVote()
 {
     # Check if FB integration for reviews is enabled
     $facebook_integration = Sanitize::getBool($this->Config, 'facebook_enable') && Sanitize::getBool($this->Config, 'facebook_reviews');
     if (!$facebook_integration) {
         return;
     }
     $review_id = Sanitize::getInt($this->params, 'id');
     # First check - review id
     if (!$review_id) {
         return;
     }
     # Stop form data tampering
     $formToken = cmsFramework::getCustomToken($review_id);
     if (!cmsFramework::isAdmin() && !$this->__validateToken($formToken)) {
         return s2Messages::accessDenied();
     }
     $facebook = $this->_getFBClass();
     # Second check - FB session
     if ($fbsession = $facebook->getSession()) {
         try {
             //get user id
             $uid = $facebook->getUser();
             $user = $facebook->api('/me');
             $fql = "SELECT publish_stream FROM permissions WHERE uid = " . $uid;
             $param = array('method' => 'fql.query', 'query' => $fql, 'callback' => '');
             $fqlResult = $facebook->api($param);
             if (!$fqlResult[0]['publish_stream']) {
                 return false;
             } else {
                 $review = $this->Review->findRow(array('conditions' => array('Review.id = ' . $review_id)), array());
                 $this->Everywhere->loadListingModel($this, $review['Review']['extension']);
                 $listing = $this->Listing->findRow(array('conditions' => array('Listing.' . $this->Listing->realKey . ' = ' . $review['Review']['listing_id'])), array('afterFind'));
                 $listing_url = $this->makeUrl($listing['Listing']['url']);
                 $review['Review']['comments'] = strip_tags($review['Review']['comments']);
                 if ($this->Config->facebook_posts_trim >= 0) {
                     App::import('Helper', 'text', 'jreviews');
                     $Text = ClassRegistry::getClass('TextHelper');
                     $review['Review']['comments'] = $Text->truncateWords($review['Review']['comments'], $this->Config->facebook_posts_trim);
                 }
                 # Publish stream permission granted so we can post on the user's wall!
                 # Begin building the stream $fbArray
                 $fbArray = array();
                 $fbArray['method'] = 'stream.publish';
                 $fbArray['message'] = sprintf($this->activities['vote helpful'], $listing['Listing']['title']);
                 $fbArray['attachment'] = array('name' => $listing['Listing']['title'], 'href' => $listing_url, 'description' => $review['Review']['comments']);
                 $fbArray['attachment']['properties'][__t("Website", true)] = array('text' => cmsFramework::getConfig('sitename'), 'href' => WWW_ROOT);
                 $review['Rating']['average_rating'] > 0 and $fbArray['attachment']['properties'][__t("Rating", true)] = sprintf(__t("%s stars", true), round($review['Rating']['average_rating'], 1));
                 isset($listing['Listing']['images'][0]) and $fbArray['attachment']['media'] = array(array('type' => 'image', 'src' => WWW_ROOT . _JR_WWW_IMAGES . $listing['Listing']['images'][0]['path'], 'href' => $listing_url));
                 $fbArray['attachment'] = json_encode($fbArray['attachment']);
                 $fbArray['action_links'] = json_encode(array(array('text' => __t("Read review", true), 'href' => $listing_url)));
                 $fbArray['comments_xid'] = $listing['Listing']['listing_id'];
                 if ($this->Config->facebook_optout) {
                     return "FB.ui(" . json_encode($fbArray) . ")";
                 }
                 $fb_update = $facebook->api($fbArray);
                 return true;
             }
         } catch (Exception $o) {
             // Error reading permissions
             return false;
         }
     }
     return false;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:65,代码来源:facebook_controller.php

示例5: route

 function route($link, $xhtml = true, $ssl = null)
 {
     $menu_alias = '';
     if (false === strpos($link, 'index.php') && false === strpos($link, 'index2.php')) {
         $link = 'index.php?' . $link;
     }
     // Check core sef
     $sef = cmsFramework::getConfig('sef');
     $sef_rewrite = cmsFramework::getConfig('sef_rewrite');
     if (false === strpos($link, 'option=com_jreviews') && !$sef) {
         $url = cmsFramework::isAdmin() ? cmsFramework::siteRoute($link, $xhtml, $ssl) : JRoute::_($link, $xhtml, $ssl);
         if (false === strpos($url, 'http')) {
             $parsedUrl = parse_url(WWW_ROOT);
             $port = isset($parsedUrl['port']) && $parsedUrl['port'] != '' ? ':' . $parsedUrl['port'] : '';
             $url = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . $port . $url;
         }
         return $url;
     } elseif (false === strpos($link, 'option=com_jreviews')) {
         $url = cmsFramework::isAdmin() ? cmsFramework::siteRoute($link, $xhtml, $ssl) : JRoute::_($link, $xhtml, $ssl);
         return $url;
     }
     // Fixes component menu urls with pagination and ordering parameters when core sef is enabled.
     $link = str_replace('//', '/', $link);
     if ($sef) {
         $mod_rewrite = cmsFramework::getConfig('sef_rewrite');
         // Mod Rewrite is not enabled
         if (!$mod_rewrite) {
             preg_match('/Itemid=([0-9]+)/', $link, $matches);
             if (isset($matches[1]) && is_numeric($matches[1])) {
                 $link2 = 'index.php?option=com_jreviews&Itemid=' . $matches[1];
                 $menu_alias = cmsFramework::isAdmin() ? cmsFramework::siteRoute($link2, $xhtml, $ssl) : JRoute::_($link2, $xhtml, $ssl);
                 strstr($menu_alias, 'index.php') and $menu_alias = str_replace('.html', '/', substr($menu_alias, strpos($menu_alias, 'index.php' . _DS) + 10));
                 $menu_alias .= '/';
                 $menu_alias = '/' . ltrim(array_shift(explode('?', $menu_alias)), '/');
             }
         }
         // Core sef doesn't know how to deal with colons, so we convert them to something else and then replace them again.
         $link = $nonsef_link = str_replace(_PARAM_CHAR, '*@*', $link);
         $sefUrl = cmsFramework::isAdmin() ? cmsFramework::siteRoute($link, $xhtml, $ssl) : JRoute::_($link, $xhtml, $ssl);
         $sefUrl = str_replace('%2A%40%2A', _PARAM_CHAR, $sefUrl);
         $sefUrl = str_replace('*@*', _PARAM_CHAR, $sefUrl);
         // For non sef links
         if (!class_exists('shRouter')) {
             // Get rid of duplicate menu alias segments added by the JRoute function
             if (strstr($sefUrl, 'order:') || strstr($sefUrl, 'page:') || strstr($sefUrl, 'limit:')) {
                 $sefUrl = str_replace(array('/format:html/', '.html'), '/', $sefUrl);
             }
             // Get rid of duplicate menu alias segments added by the JRoute function
             if ($menu_alias != '' && $menu_alias != '/' && !$mod_rewrite) {
                 $sefUrl = str_replace($menu_alias, '--menuAlias--', $sefUrl, $count);
                 $sefUrl = str_replace(str_repeat('--menuAlias--', $count), $menu_alias, $sefUrl);
             }
         }
         $link = $sefUrl;
         // If it's not a JReviews menu url remove the suffix
         $nonsef_link = str_replace('&', '&', $nonsef_link);
         if (substr($nonsef_link, -5) == '.thtml' && !preg_match('/^index.php\\?option=com_jreviews&Itemid=([0-9]+)$/i', $nonsef_link)) {
             $link = str_replace('.html', '', $sefUrl);
         }
     }
     if (false !== strpos($link, 'http')) {
         return $link;
     } else {
         $parsedUrl = parse_url(WWW_ROOT);
         $port = isset($parsedUrl['port']) && $parsedUrl['port'] != '' ? ':' . $parsedUrl['port'] : '';
         $www_root = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . $port . ($sef ? _DS : $parsedUrl['path']);
         return $www_root . ltrim($link, _DS);
     }
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:69,代码来源:joomla15.php


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