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


PHP waSystem::apps方法代码示例

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


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

示例1: getApps

 public function getApps($system = false)
 {
     if (self::$apps === null) {
         $locale = $this->getUser()->getLocale();
         $file = $this->config->getPath('cache', 'config/apps' . $locale);
         if (!file_exists($this->getConfig()->getPath('config', 'apps'))) {
             self::$apps = array();
             throw new waException('File wa-config/apps.php not found.', 600);
         }
         if (!file_exists($file) || filemtime($file) < filemtime($this->getConfig()->getPath('config', 'apps')) || waSystemConfig::isDebug()) {
             waFiles::create($this->getConfig()->getPath('cache') . '/config');
             $all_apps = (include $this->getConfig()->getPath('config', 'apps'));
             $all_apps['webasyst'] = true;
             self::$apps = array();
             foreach ($all_apps as $app => $enabled) {
                 if ($enabled) {
                     waLocale::loadByDomain($app, $locale);
                     $app_config = $this->getAppPath('lib/config/app.php', $app);
                     if (!file_exists($app_config)) {
                         if (false && SystemConfig::isDebug()) {
                             throw new waException("Config not found. Create config by path " . $app_config);
                         }
                         continue;
                     }
                     $app_info = (include $app_config);
                     $build_file = $app_config = $this->getAppPath('lib/config/build.php', $app);
                     if (file_exists($build_file)) {
                         $app_info['build'] = (include $build_file);
                     } else {
                         if (SystemConfig::isDebug()) {
                             $app_info['build'] = time();
                         } else {
                             $app_info['build'] = 0;
                         }
                     }
                     $app_info['id'] = $app;
                     $app_info['name'] = _wd($app, $app_info['name']);
                     if (isset($app_info['icon'])) {
                         if (is_array($app_info['icon'])) {
                             foreach ($app_info['icon'] as $size => $url) {
                                 $app_info['icon'][$size] = 'wa-apps/' . $app . '/' . $url;
                             }
                         } else {
                             $app_info['icon'] = array(48 => 'wa-apps/' . $app . '/' . $app_info['icon']);
                         }
                     } else {
                         $app_info['icon'] = array();
                     }
                     if (isset($app_info['img'])) {
                         $app_info['img'] = 'wa-apps/' . $app . '/' . $app_info['img'];
                     } else {
                         $app_info['img'] = isset($app_info['icon'][48]) ? $app_info['icon'][48] : 'wa-apps/' . $app . '/img/' . $app . ".png";
                     }
                     if (!isset($app_info['icon'][48])) {
                         $app_info['icon'][48] = $app_info['img'];
                     }
                     if (!isset($app_info['icon'][24])) {
                         $app_info['icon'][24] = $app_info['icon'][48];
                     }
                     if (!isset($app_info['icon'][16])) {
                         $app_info['icon'][16] = $app_info['icon'][24];
                     }
                     self::$apps[$app] = $app_info;
                 }
             }
             if (!file_exists($file) || filemtime($file) < filemtime($this->getConfig()->getPath('config', 'apps'))) {
                 waUtils::varExportToFile(self::$apps, $file);
             }
         } else {
             self::$apps = (include $file);
             waLocale::loadByDomain('webasyst', $locale);
         }
     }
     if ($system) {
         return self::$apps;
     } else {
         $apps = self::$apps;
         unset($apps['webasyst']);
         return $apps;
     }
 }
开发者ID:Favorskij,项目名称:webasyst-framework,代码行数:81,代码来源:waSystem.class.php


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