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


PHP WebModule::getAllModuleClasses方法代码示例

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


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

示例1: addNewModule

 protected function addNewModule($moduleData)
 {
     if (!isset($moduleData['title']) || empty($moduleData['title'])) {
         throw new KurogoConfigurationException("Choose a module title");
     }
     if (!isset($moduleData['config']) || !preg_match("/^[a-z0-9_-]+\$/i", $moduleData['config'])) {
         throw new KurogoConfigurationException("Choose a url. It must contain only letters and numbers");
     }
     $moduleClasses = WebModule::getAllModuleClasses();
     if (!isset($moduleData['id']) || !in_array($moduleData['id'], $moduleClasses)) {
         throw new KurogoConfigurationException("Choose a module type");
     }
     $modules = WebModule::getAllModules();
     if (in_array($moduleData['config'], $modules)) {
         throw new KurogoConfigurationException("Module " . $moduleData['config'] . " already exists");
     }
     $config = ModuleConfigFile::factory($moduleData['config'], 'module', ModuleConfigFile::OPTION_CREATE_WITH_DEFAULT);
     $valid_props = array('id', 'title', 'protected', 'secure', 'disabled', 'search');
     foreach ($valid_props as $key) {
         if (isset($moduleData[$key])) {
             $config->setVar('module', $key, $moduleData[$key], $changed);
         }
     }
     $config->saveFile();
 }
开发者ID:nncsang,项目名称:Kurogo,代码行数:25,代码来源:AdminAPIModule.php

示例2: initializeForPage

 protected function initializeForPage()
 {
     //make sure that only desktop/tablet devices can use the module
     $deviceClassifier = Kurogo::deviceClassifier();
     if ($this->page != 'index' && !($deviceClassifier->isComputer() || $deviceClassifier->isTablet())) {
         $this->redirectTo('index');
     }
     $navSections = $this->getNavSections();
     $section = '';
     $this->assign('navSections', $navSections);
     $this->addJQuery();
     $this->addJQueryUI();
     switch ($this->page) {
         case 'modules':
             $subNavSections = $this->getSubNavSections($this->page);
             $this->assign('subNavSections', $subNavSections);
             $defaultSubNavSection = key($subNavSections);
             $section = $this->getArg('section', $defaultSubNavSection);
             $moduleID = $this->getArg('module');
             if ($moduleID) {
                 $this->setTemplatePage('module');
                 try {
                     if ($module = WebModule::factory($moduleID)) {
                         $this->assign('moduleName', $module->getModuleName());
                         $this->assign('moduleID', $module->getConfigModule());
                         $this->assign('moduleIcon', $module->getOptionalModuleVar('icon', $module->getConfigModule(), 'module'));
                         $section = $moduleID;
                         $moduleSection = $this->getArg('section', 'general');
                         $this->assign('moduleSection', $moduleSection);
                     }
                 } catch (KurogoException $e) {
                     $this->redirectTo($this->page, array());
                 }
             } elseif ($section == $defaultSubNavSection) {
                 $moduleClasses = WebModule::getAllModuleClasses();
                 $this->assign('moduleClasses', $moduleClasses);
                 $this->setTemplatePage($section);
             } elseif ($section == 'homescreen') {
                 $this->setTemplatePage($section);
                 $modules = $this->getModules();
                 $this->assign('modules', $modules);
             } else {
                 $this->redirectTo($this->page, array());
             }
             break;
         case 'site':
             $subNavSections = $this->getSubNavSections($this->page);
             $this->assign('subNavSections', $subNavSections);
             $defaultSubNavSection = key($subNavSections);
             $section = $this->getArg('section', $defaultSubNavSection);
             if (!isset($subNavSections[$section])) {
                 $this->redirectTo($this->page, array());
             }
             break;
         case 'credits':
             $section = $this->getArg('section', 'credits');
             $subNavSections = array('credits' => array('id' => 'credits', 'title' => $this->getLocalizedString("ADMIN_CREDITS_CREDITS_TITLE"), 'url' => $this->buildURL($this->page, array('section' => 'credits'))), 'license' => array('id' => 'license', 'title' => $this->getLocalizedString("ADMIN_CREDITS_LICENSE_TITLE"), 'url' => $this->buildURL($this->page, array('section' => 'license'))));
             $this->assign('subNavSections', $subNavSections);
             if (isset($subNavSections[$section])) {
                 switch ($section) {
                     case 'license':
                         $licenseFile = ROOT_DIR . "/LICENSE";
                         if (is_file($licenseFile)) {
                             $this->assign('license', file_get_contents($licenseFile));
                         } else {
                             die($licenseFile);
                             throw new KurogoException("Unable to load LICENSE file, you may have a compromised Kurogo Installation");
                         }
                 }
                 $this->setTemplatePage($section);
             } else {
                 $this->redirectTo('section', array());
             }
             break;
         case 'index':
             //redirect desktop devices to the "default page"
             $deviceClassifier = Kurogo::deviceClassifier();
             if ($deviceClassifier->isComputer() || $deviceClassifier->isTablet()) {
                 $defaultSection = current($navSections);
                 $this->redirectTo($defaultSection['id'], array());
             }
             break;
         default:
             $this->redirectTo('index', array());
             break;
     }
     $this->assign('section', $section);
 }
开发者ID:sponto,项目名称:msbm-mobile,代码行数:88,代码来源:AdminWebModule.php


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