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


PHP PageUtil::isHomepage方法代码示例

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


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

示例1: __construct

 /**
  * Constructor.
  *
  * @param Zikula_ServiceManager $serviceManager ServiceManager.
  * @param string                $moduleName     Module name ("zikula" for system plugins).
  * @param integer|null          $caching        Whether or not to cache (Zikula_View::CACHE_*) or use config variable (null).
  */
 public function __construct(Zikula_ServiceManager $serviceManager, $moduleName = '', $caching = null)
 {
     $this->serviceManager = $serviceManager;
     $this->eventManager = $this->serviceManager->get('event_dispatcher');
     $this->request = \ServiceUtil::get('request');
     // set the error reporting level
     $this->error_reporting = isset($GLOBALS['ZConfig']['Debug']['error_reporting']) ? $GLOBALS['ZConfig']['Debug']['error_reporting'] : E_ALL;
     $this->error_reporting &= ~E_USER_DEPRECATED;
     $this->allow_php_tag = true;
     // get variables from input
     $module = FormUtil::getPassedValue('module', null, 'GETPOST', FILTER_SANITIZE_STRING);
     $type = FormUtil::getPassedValue('type', 'user', 'GETPOST', FILTER_SANITIZE_STRING);
     $func = FormUtil::getPassedValue('func', 'main', 'GETPOST', FILTER_SANITIZE_STRING);
     // set vars based on the module structures
     $this->homepage = PageUtil::isHomepage();
     $this->type = strtolower(!$this->homepage ? $type : System::getVar('starttype'));
     $this->func = strtolower(!$this->homepage ? $func : System::getVar('startfunc'));
     // Initialize the module property with the name of
     // the topmost module. For Hooks, Blocks, API Functions and others
     // you need to set this property to the name of the respective module!
     $this->toplevelmodule = ModUtil::getName();
     if (!$moduleName) {
         $moduleName = $this->toplevelmodule;
     }
     $this->modinfo = ModUtil::getInfoFromName($moduleName);
     $this->module = array($moduleName => $this->modinfo);
     // initialise environment vars
     $this->language = ZLanguage::getLanguageCode();
     $this->baseurl = System::getBaseUrl();
     $this->baseuri = System::getBaseUri();
     // system info
     $this->themeinfo = ThemeUtil::getInfo(ThemeUtil::getIDFromName(UserUtil::getTheme()));
     $this->theme = $theme = $this->themeinfo['directory'];
     $themeBundle = ThemeUtil::getTheme($this->themeinfo['name']);
     //---- Plugins handling -----------------------------------------------
     // add plugin paths
     switch ($this->modinfo['type']) {
         case ModUtil::TYPE_MODULE:
             $mpluginPathNew = "modules/" . $this->modinfo['directory'] . "/Resources/views/plugins";
             $mpluginPath = "modules/" . $this->modinfo['directory'] . "/templates/plugins";
             break;
         case ModUtil::TYPE_SYSTEM:
             $mpluginPathNew = "system/" . $this->modinfo['directory'] . "/Resources/views/plugins";
             $mpluginPath = "system/" . $this->modinfo['directory'] . "/templates/plugins";
             break;
         default:
             $mpluginPathNew = "system/" . $this->modinfo['directory'] . "/Resources/views/plugins";
             $mpluginPath = "system/" . $this->modinfo['directory'] . "/templates/plugins";
     }
     // add standard plugin search path
     $this->plugins_dir = array();
     $this->addPluginDir('config/plugins');
     // Official override
     $this->addPluginDir('lib/legacy/viewplugins');
     // Core plugins
     $this->addPluginDir(isset($themeBundle) ? $themeBundle->getRelativePath() . '/plugins' : "themes/{$theme}/plugins");
     // Theme plugins
     $this->addPluginDir('plugins');
     // Smarty core plugins
     $this->addPluginDir($mpluginPathNew);
     // Plugins for current module
     $this->addPluginDir($mpluginPath);
     // Plugins for current module
     // check if the 'type' parameter in the URL is admin or adminplugin
     $legacyControllerType = FormUtil::getPassedValue('lct', 'user', 'GETPOST', FILTER_SANITIZE_STRING);
     if ($type === 'admin' || $type === 'adminplugin' || $legacyControllerType === 'admin') {
         // include plugins of the Admin module to the plugins_dir array
         if (!$this instanceof Zikula_View_Theme) {
             $this->addPluginDir('system/AdminModule/Resources/views/plugins');
         } else {
             $this->load_filter('output', 'admintitle');
         }
     }
     // theme plugins module overrides
     $themePluginsPath = isset($themeBundle) ? $themeBundle->getRelativePath() . '/modules/$moduleName/plugins' : "themes/{$theme}/templates/modules/{$moduleName}/plugins";
     $this->addPluginDir($themePluginsPath);
     //---- Cache handling -------------------------------------------------
     if ($caching && in_array((int) $caching, array(0, 1, 2))) {
         $this->caching = (int) $caching;
     } else {
         $this->caching = (int) ModUtil::getVar('ZikulaThemeModule', 'render_cache');
     }
     $this->compile_id = '';
     $this->cache_id = '';
     // template compilation
     $this->compile_dir = CacheUtil::getLocalDir('view_compiled');
     $this->compile_check = ModUtil::getVar('ZikulaThemeModule', 'render_compile_check');
     $this->force_compile = ModUtil::getVar('ZikulaThemeModule', 'render_force_compile');
     // template caching
     $this->cache_dir = CacheUtil::getLocalDir('view_cache');
     $this->cache_lifetime = ModUtil::getVar('ZikulaThemeModule', 'render_lifetime');
     $this->expose_template = ModUtil::getVar('ZikulaThemeModule', 'render_expose_template') == true ? true : false;
     // register resource type 'z' this defines the way templates are searched
//.........这里部分代码省略.........
开发者ID:Silwereth,项目名称:core,代码行数:101,代码来源:View.php

示例2: displayPosition

 /**
  * Display all blocks in a block position.
  *
  * @param string $side     Block position to render.
  * @param boolean $echo    Whether or not to echo output directly.
  * @param boolean $implode Whether or not to implode lines by \n.
  *
  * @return void|string The rendered output.
  */
 public static function displayPosition($side, $echo = true, $implode = true)
 {
     static $blockplacements = array();
     static $positions = array();
     static $modname;
     static $currentlang;
     static $func;
     static $type;
     static $customargs;
     if (!isset($side)) {
         return null;
     }
     // get the block position
     if (empty($positions)) {
         $positions = ModUtil::apiFunc('ZikulaBlocksModule', 'user', 'getallpositions');
     }
     if (!isset($positions[$side])) {
         return;
     }
     if (!isset($modname)) {
         if (PageUtil::isHomepage()) {
             $modname = '_homepage_';
         } else {
             $modname = ModUtil::getName();
         }
     }
     // get all block placements
     if (empty($blockplacements)) {
         $blockplacements = ModUtil::apiFunc('ZikulaBlocksModule', 'user', 'getallplacements');
     }
     // get variables from input
     if (!isset($func)) {
         $func = FormUtil::getPassedValue('func', 'main', 'GETPOST');
     }
     if (!isset($type)) {
         $type = FormUtil::getPassedValue('type', 'user', 'GETPOST');
     }
     if (!isset($customargs)) {
         $customargs = array();
         $filtervars = array('module', 'name', 'type', 'func', 'theme', 'csrftoken');
         foreach ($_GET as $var => $value) {
             if (is_array($value)) {
                 $arguments = explode('&', urldecode(http_build_query(array($var => $value))));
                 foreach ($arguments as $argument) {
                     $args = explode('=', $argument);
                     if (!in_array($args[0], $filtervars)) {
                         $customargs[] = DataUtil::formatForOS(strip_tags($args[0])) . '=' . DataUtil::formatForOS(strip_tags($args[1]));
                     }
                 }
             } else {
                 if (!in_array($var, $filtervars)) {
                     $customargs[] = DataUtil::formatForOS(strip_tags($var)) . '=' . DataUtil::formatForOS(strip_tags($value));
                 }
             }
         }
     }
     // current language
     if (!isset($currentlang)) {
         $currentlang = ZLanguage::getLanguageCode();
     }
     // loop around the blocks and display only the ones we need
     $blockoutput = array();
     foreach ($blockplacements as $blockplacement) {
         // don't display a block if it's not in this block position
         if ($blockplacement['pid'] != $positions[$side]['pid']) {
             continue;
         }
         // get the full block info
         $blockinfo = self::getBlockInfo($blockplacement['bid']);
         // dont display the block if it's not active or not in matching langauge
         if (!$blockinfo['active'] || !empty($blockinfo['language']) && $blockinfo['language'] != $currentlang) {
             continue;
         }
         // block filtering
         if (!empty($blockinfo['filter']) && is_array($blockinfo['filter']) && count($blockinfo['filter'])) {
             $showblock = false;
             // loop for each filter
             foreach ($blockinfo['filter'] as $filter) {
                 // filter must be an array of values
                 if (!is_array($filter)) {
                     continue;
                 }
                 $rule1 = $filter['module'] == $modname;
                 $rule2 = empty($filter['ftype']) ? true : $filter['ftype'] == $type;
                 $rule3 = empty($filter['fname']) ? true : $filter['fname'] == $func;
                 if (empty($filter['fargs'])) {
                     $rule4 = true;
                 } else {
                     $testargs = explode('&', $filter['fargs']);
                     foreach ($testargs as $test) {
                         $key = array_search($test, $customargs);
//.........这里部分代码省略.........
开发者ID:rmaiwald,项目名称:core,代码行数:101,代码来源:BlockUtil.php


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