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


PHP Theme::load方法代码示例

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


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

示例1: deleteTheme

 /**
  * Completely delete a theme from the system.
  * @param string $id Theme code/namespace
  * @return void
  */
 public function deleteTheme($theme)
 {
     if (!$theme) {
         return false;
     }
     if (is_string($theme)) {
         $theme = CmsTheme::load($theme);
     }
     if ($theme->isActiveTheme()) {
         throw new ApplicationException(trans('cms::lang.theme.delete_active_theme_failed'));
     }
     /*
      * Delete from file system
      */
     $themePath = $theme->getPath();
     if (File::isDirectory($themePath)) {
         File::deleteDirectory($themePath);
     }
     /*
      * Set uninstalled
      */
     if ($themeCode = $this->findByDirName($theme->getDirName())) {
         $this->setUninstalled($themeCode);
     }
 }
开发者ID:betes-curieuses-design,项目名称:ElieJosiePhotographie,代码行数:30,代码来源:ThemeManager.php

示例2: getFormFields

 /**
  * Returns all fields defined for this model, based on form field definitions.
  */
 public function getFormFields()
 {
     if (!($theme = CmsTheme::load($this->theme))) {
         throw new Exception(Lang::get('Unable to find theme with name :name', $this->theme));
     }
     return $theme->getConfigValue('form.fields', []) + $theme->getConfigValue('form.tabs.fields', []) + $theme->getConfigValue('form.secondaryTabs.fields', []);
 }
开发者ID:betes-curieuses-design,项目名称:ElieJosiePhotographie,代码行数:10,代码来源:ThemeData.php

示例3: init

 /**
  * Initialize.
  *
  * @return void
  * @throws \Krisawzm\DemoManager\Classes\DemoManagerException
  */
 protected function init()
 {
     $backendUser = BackendAuth::getUser();
     $baseTheme = $this->theme = Config::get('krisawzm.demomanager::base_theme', null);
     if ($backendUser) {
         if ($backendUser->login == Config::get('krisawzm.demomanager::admin.login', 'admin')) {
             $this->theme = $baseTheme;
         } else {
             $this->theme = $backendUser->login;
         }
     } else {
         if (UserCounter::instance()->limit()) {
             $action = Config::get('krisawzm.demomanager::limit_action', 'reset');
             if ($action == 'reset') {
                 DemoManager::instance()->resetEverything();
                 // @todo queue/async?
                 $this->theme = $this->newDemoUser()->login;
             } elseif ($action == 'maintenance') {
                 $theme = Theme::load($baseTheme);
                 Event::listen('cms.page.beforeDisplay', function ($controller, $url, $page) use($theme) {
                     return Page::loadCached($theme, 'maintenance');
                 });
             } elseif ($action == 'nothing') {
                 $this->theme = $baseTheme;
             } else {
                 throw new DemoManagerException('User limit is reached, but an invalid action is defined.');
             }
         } else {
             $this->theme = $this->newDemoUser()->login;
             // @todo Remember the username after signing out.
             //       Could prove useful as some plugins may
             //       have some different offline views.
         }
     }
 }
开发者ID:janusnic,项目名称:demomanager-plugin,代码行数:41,代码来源:DemoAuth.php

示例4: testHtmlContent

 public function testHtmlContent()
 {
     $theme = Theme::load('test');
     $content = Content::load($theme, 'html-content.htm');
     $this->assertEquals('<a href="#">Stephen Saucier</a> changed his profile picture &mdash; <small>7 hrs ago</small></div>', $content->markup);
     $this->assertEquals('<a href="#">Stephen Saucier</a> changed his profile picture &mdash; <small>7 hrs ago</small></div>', $content->parsedMarkup);
 }
开发者ID:mechiko,项目名称:staff-october,代码行数:7,代码来源:ContentTest.php

示例5: inTheme

 /**
  * Set the theme to a specific one.
  * @return self
  */
 public function inTheme($theme)
 {
     if (is_string($theme)) {
         $theme = Theme::load($theme);
     }
     $this->theme = $theme;
     return $this;
 }
开发者ID:GoldBest,项目名称:october,代码行数:12,代码来源:CmsObjectQuery.php

示例6: generateSitemap

 public function generateSitemap()
 {
     if (!$this->items) {
         return;
     }
     $currentUrl = Request::path();
     $theme = Theme::load($this->theme);
     /*
      * Cycle each page and add its URL
      */
     foreach ($this->items as $item) {
         /*
          * Explicit URL
          */
         if ($item->type == 'url') {
             $this->addItemToSet($item, URL::to($item->url));
         } else {
             $apiResult = Event::fire('pages.menuitem.resolveItem', [$item->type, $item, $currentUrl, $theme]);
             if (!is_array($apiResult)) {
                 continue;
             }
             foreach ($apiResult as $itemInfo) {
                 if (!is_array($itemInfo)) {
                     continue;
                 }
                 /*
                  * Single item
                  */
                 if (isset($itemInfo['url'])) {
                     $this->addItemToSet($item, $itemInfo['url'], array_get($itemInfo, 'mtime'));
                 }
                 /*
                  * Multiple items
                  */
                 if (isset($itemInfo['items'])) {
                     $parentItem = $item;
                     $itemIterator = function ($items) use(&$itemIterator, $parentItem) {
                         foreach ($items as $item) {
                             if (isset($item['url'])) {
                                 $this->addItemToSet($parentItem, $item['url'], array_get($item, 'mtime'));
                             }
                             if (isset($item['items'])) {
                                 $itemIterator($item['items']);
                             }
                         }
                     };
                     $itemIterator($itemInfo['items']);
                 }
             }
         }
     }
     $urlSet = $this->makeUrlSet();
     $xml = $this->makeXmlObject();
     $xml->appendChild($urlSet);
     return $xml->saveXML();
 }
开发者ID:janusnic,项目名称:OctoberCMS,代码行数:56,代码来源:Definition.php

示例7: spoofPageCode

 private function spoofPageCode()
 {
     // Spoof all the objects we need to make a page object
     $theme = Theme::load('test');
     $page = Page::load($theme, 'index.htm');
     $layout = Layout::load($theme, 'content.htm');
     $controller = new Controller($theme);
     $parser = new CodeParser($page);
     $pageObj = $parser->source($page, $layout, $controller);
     return $pageObj;
 }
开发者ID:mechiko,项目名称:staff-october,代码行数:11,代码来源:ComponentManagerTest.php

示例8: testListPages

 public function testListPages()
 {
     $theme = Theme::load('test');
     $pages = $theme->listPages();
     $this->assertInternalType('array', $pages);
     $expectedPageNum = $this->countThemePages(base_path() . '/tests/fixtures/themes/test/pages');
     $this->assertEquals($expectedPageNum, count($pages));
     $this->assertInstanceOf('\\Cms\\Classes\\Page', $pages[0]);
     $this->assertNotEmpty($pages[0]->url);
     $this->assertInstanceOf('\\Cms\\Classes\\Page', $pages[1]);
     $this->assertNotEmpty($pages[1]->url);
 }
开发者ID:mechiko,项目名称:staff-october,代码行数:12,代码来源:ThemeTest.php

示例9: testCmsExceptionPhp

 public function testCmsExceptionPhp()
 {
     $theme = Theme::load('test');
     $router = new Router($theme);
     $page = $router->findByUrl('/throw-php');
     $foreignException = new \Symfony\Component\Debug\Exception\FatalErrorException('This is a general error', 100, 1, 'test.php', 20);
     $this->setProtectedProperty($foreignException, 'file', "/modules/cms/classes/CodeParser.php(165) : eval()'d code line 7");
     $exception = new CmsException($page, 300);
     $exception->setMask($foreignException);
     $this->assertEquals($page->getFilePath(), $exception->getFile());
     $this->assertEquals('PHP Content', $exception->getErrorType());
     $this->assertEquals('This is a general error', $exception->getMessage());
 }
开发者ID:nerijunior,项目名称:october,代码行数:13,代码来源:CmsExceptionTest.php

示例10: formExtendFields

 /**
  * Add form fields defined in theme.yaml
  */
 protected function formExtendFields($form)
 {
     $model = $form->model;
     if (!($theme = CmsTheme::load($model->theme))) {
         throw new Exception(Lang::get('Unable to find theme with name :name', $this->theme));
     }
     if ($fields = $theme->getConfigValue('form.fields')) {
         $form->addFields($fields);
     }
     if ($fields = $theme->getConfigValue('form.tabs.fields')) {
         $form->addTabFields($fields);
     }
     if ($fields = $theme->getConfigValue('form.secondaryTabs.fields')) {
         $form->addSecondaryTabFields($fields);
     }
 }
开发者ID:janusnic,项目名称:OctoberCMS,代码行数:19,代码来源:Themes.php

示例11: fire

 /**
  * Execute the console command.
  * @return void
  */
 public function fire()
 {
     if (!$this->confirmToProceed('Do you really want to change the active theme?')) {
         return;
     }
     $newThemeName = $this->argument('name');
     $newTheme = Theme::load($newThemeName);
     if (!$newTheme->exists($newThemeName)) {
         return $this->error(sprintf('The theme %s does not exist.', $newThemeName));
     }
     if ($newTheme->isActiveTheme()) {
         return $this->error(sprintf('%s is already the active theme.', $newTheme->getId()));
     }
     $activeTheme = Theme::getActiveTheme();
     $from = $activeTheme ? $activeTheme->getId() : 'nothing';
     $this->info(sprintf('Switching theme from %s to %s', $from, $newTheme->getId()));
     Theme::setActiveTheme($newThemeName);
 }
开发者ID:GoldBest,项目名称:october,代码行数:22,代码来源:ThemeUse.php

示例12: update

 /**
  * Update action. Add the theme object to the page vars.
  */
 public function update($recordId = null, $context = null)
 {
     $this->bodyClass = 'compact-container';
     try {
         if (!($editTheme = Theme::getEditTheme())) {
             throw new ApplicationException('Unable to find the active theme.');
         }
         $result = $this->asExtension('FormController')->update($recordId, $context);
         $model = $this->formGetModel();
         $theme = Theme::load($model->theme);
         /*
          * Not editing the active sitemap definition
          */
         if ($editTheme->getDirName() != $theme->getDirName()) {
             return $this->redirectToThemeSitemap($editTheme);
         }
         $this->vars['theme'] = $theme;
         $this->vars['themeName'] = $theme->getConfigValue('name', $theme->getDirName());
         $this->vars['sitemapUrl'] = URL::to('/sitemap.xml');
         return $result;
     } catch (Exception $ex) {
         $this->handleError($ex);
     }
 }
开发者ID:mechiko,项目名称:staff-october,代码行数:27,代码来源:Definitions.php

示例13: testGetViewBagEmpty

 public function testGetViewBagEmpty()
 {
     $theme = Theme::load('test');
     $obj = TestParsedCmsCompoundObject::load($theme, 'compound.htm');
     $viewBag = $obj->getViewBag();
     $this->assertInstanceOf('Cms\\Classes\\ViewBag', $viewBag);
     $properties = $viewBag->getProperties();
     $this->assertEmpty($properties);
     $this->assertEquals($obj->viewBag, $properties);
 }
开发者ID:nerijunior,项目名称:october,代码行数:10,代码来源:CmsCompoundObjectTest.php

示例14: testSaveNewDir

 public function testSaveNewDir()
 {
     $theme = Theme::load('apitest');
     $destFilePath = $theme->getPath() . '/testobjects/testsubdir/mytestobj.htm';
     if (file_exists($destFilePath)) {
         unlink($destFilePath);
     }
     $destDirPath = dirname($destFilePath);
     if (file_exists($destDirPath) && is_dir($destDirPath)) {
         rmdir($destDirPath);
     }
     $this->assertFileNotExists($destFilePath);
     $this->assertFileNotExists($destDirPath);
     $testContents = 'mytestcontent';
     $obj = new TestCmsObject($theme);
     $obj->fill(['fileName' => 'testsubdir/mytestobj.htm', 'content' => $testContents]);
     $obj->save();
     $this->assertFileExists($destFilePath);
     $this->assertEquals($testContents, file_get_contents($destFilePath));
 }
开发者ID:mechiko,项目名称:staff-october,代码行数:20,代码来源:CmsObjectTest.php

示例15: getFormFields

 /**
  * Returns all fields defined for this model, based on form field definitions.
  * @return array
  */
 public function getFormFields()
 {
     if (!($theme = CmsTheme::load($this->theme))) {
         throw new Exception(Lang::get('Unable to find theme with name :name', $this->theme));
     }
     $config = $theme->getConfigArray('form');
     return array_get($config, 'fields', []) + array_get($config, 'tabs.fields', []) + array_get($config, 'secondaryTabs.fields', []);
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:12,代码来源:ThemeData.php


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