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


PHP JApplication::isSite方法代码示例

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


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

示例1: onAfterInitialise

 /** This trigger function to help customize layout of some pages **/
 public function onAfterInitialise()
 {
     $config = JFactory::getConfig();
     $secret = $config->get('secret');
     $offline = $config->get('offline');
     $input = $this->_application->input;
     if ($this->_application->isSite() && $input->get->get('poweradmin', '0') == '1' && $input->get->get('jsnpa_key', '') == md5($secret) && $offline == '1') {
         $this->_online();
     }
     if (!$this->_application->isAdmin()) {
         return;
     }
     if ($this->_application->isAdmin() && $this->_user->id > 0 && $input->getVar('tmpl', '') != 'component' && $this->_params->get('enable_adminbar', true) == true) {
         $this->_sendCookies();
         $this->_target = JRequest::getBool('hidemainmenu') == true ? '_blank' : '_parent';
     }
     if ($this->_user->id > 0) {
         PowerAdminHistoryHelper::onAfterInitialise();
     }
     if ($input->getVar('format', '') == 'raw' || $input->getVar('format', '') == 'rss') {
         return;
     }
     $this->_helper = JSNPLGHelper::getInstance();
 }
开发者ID:networksoft,项目名称:declarafacil.com.co,代码行数:25,代码来源:jsnpoweradmin.php

示例2: moveScriptTags

 /**
  * Method to move all script tags from head section to the end of body section.
  *
  * @param   string  &$html  Generated response body.
  *
  * @return  void
  */
 private static function moveScriptTags(&$html)
 {
     // Get active component
     $option = self::$_app->input->getCmd('option');
     // First, check if current page is rendered by our products
     if (!in_array($option, JSNVersion::$products)) {
         return;
     }
     // Second, check if script movement is already done by our template framework
     if (defined('JSN_TPLFW_SCRIPTS_MOVEMENT_COMPLETED')) {
         return;
     }
     // Now, get configuration for our product
     $cfg = JSNConfigHelper::get($option);
     // Do not continue if script movement is disabled
     if (!$cfg->get('script_movement')) {
         return;
     }
     // Move all script tags to the end of body section
     if ((self::$_app->isSite() or in_array($option, JSNVersion::$products)) and $n = count($parts = preg_split('/>[\\s\\t\\r\\n]*<script/', $html))) {
         // Re-generated script tags
         $tags = array();
         // Inline script code block combination status
         $combine = array();
         $last = 'inline';
         // Re-generate HTML document
         $temp = $parts[0];
         for ($i = 1; $i < $n; $i++) {
             // Get script tag
             $script = substr($parts[$i], 0, strpos($parts[$i], '</script') + 8);
             // Remove script tag from its original position
             $parts[$i] = str_replace($script, '', $parts[$i]);
             // Leave script tag as is if it is placed inside conditional comments
             if (preg_match('/([\\r\\n][\\s\\t]*)<\\!--\\[if[^\\]]*IE[^\\]]*\\]/', $temp, $match) and strpos($temp, '<![endif]--') === false or isset($notClosed) and $notClosed) {
                 $temp .= '>' . (isset($match[1]) ? $match[1] : '') . '<script' . $script . $parts[$i];
                 // Look for the end of conditional comments
                 $notClosed = strpos($parts[$i], '<![endif]--') !== false ? false : true;
                 // Continue the loop
                 continue;
             }
             // Leave script code block as is if document.write function is used inside
             if (strpos($script, 'document.write') !== false) {
                 $temp .= ">\n<script" . $script . $parts[$i];
                 // Continue the loop
                 continue;
             }
             // Re-generate HTML document
             $temp .= $parts[$i];
             // Complete script tag
             $script = '<script' . $script . '>';
             if (strpos(preg_replace(array('/[\\s\\t\\r\\n]+/', '/[\\s\\t\\r\\n]+=[\\s\\t\\r\\n]+/'), array(' ', '='), $script), ' src=') === false) {
                 // Clean-up inline script block
                 $script = substr($script, strpos($script, '>') + 1, -9);
                 if ($last == 'inline') {
                     // Combine continuous script code block
                     $combine[] = $script;
                 } else {
                     $combine = array($script);
                     $last = 'inline';
                 }
             } else {
                 // Copy combined script code block
                 !count($combine) or $tags[] = '<script type="text/javascript">' . implode(";\n", $combine) . '</script>';
                 // Copy script tag
                 $tags[] = $script;
                 // Reset variables
                 $combine = array();
                 $last = '';
             }
         }
         // Copy remaining combined script code block
         !count($combine) or $tags[] = '<script type="text/javascript">' . implode(";\n", $combine) . '</script>';
         // Inject all re-generated script tags to the end of body section
         if (count($tags)) {
             $html = str_replace('</body>', implode("\n", $tags) . '</body>', $temp);
             // Define a constant to state that scripts movement is completed
             define('JSN_EXTFW_SCRIPTS_MOVEMENT_COMPLETED', 1);
         }
     }
 }
开发者ID:NallelyFlores89,项目名称:basvec,代码行数:87,代码来源:jsnframework.php


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