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


PHP Theme::getActiveTheme方法代码示例

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


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

示例1: onRun

 public function onRun()
 {
     $theme = Theme::getActiveTheme();
     $page = Page::load($theme, $this->page->baseFileName);
     $this->page["hasBlog"] = false;
     if (!$page->hasComponent("blogPost")) {
         $this->seo_title = $this->page["seo_title"] = empty($this->page->meta_title) ? $this->page->title : $this->page->meta_title;
         $this->seo_description = $this->page["seo_description"] = $this->page->meta_description;
         $this->seo_keywords = $this->page["seo_keywords"] = $this->page->seo_keywords;
         $this->canonical_url = $this->page["canonical_url"] = $this->page->canonical_url;
         $this->redirect_url = $this->page["redirect_url"] = $this->page->redirect_url;
         $this->robot_follow = $this->page["robot_follow"] = $this->page->robot_follow;
         $this->robot_index = $this->page["robot_index"] = $this->page->robot_index;
         $settings = Settings::instance();
         if ($settings->enable_og_tags) {
             $this->ogTitle = empty($this->page->meta_title) ? $this->page->title : $this->page->meta_title;
             $this->ogDescription = $this->page->meta_description;
             $this->ogUrl = empty($this->page->canonical_url) ? Request::url() : $this->page->canonical_url;
             $this->ogSiteName = $settings->og_sitename;
             $this->ogFbAppId = $settings->og_fb_appid;
         }
     } else {
         $this->hasBlog = $this->page["hasBlog"] = true;
     }
 }
开发者ID:janusnic,项目名称:oc-seo-extension,代码行数:25,代码来源:CmsPage.php

示例2: getThemeDir

 protected function getThemeDir()
 {
     if (is_null(self::$theme)) {
         self::$theme = Theme::getActiveTheme();
     }
     return ltrim(Config::get('cms.themesPath'), '/') . '/' . self::$theme->getDirName();
 }
开发者ID:nsrosenqvist,项目名称:october-plugin_assetrevisions,代码行数:7,代码来源:Plugin.php

示例3: boot

 public function boot()
 {
     $this->manager = PluginManager::instance();
     // Get paths we need
     $theme = Theme::getActiveTheme();
     $themePath = $theme->getPath();
     $pluginPath = dirname(__FILE__);
     $providerPath = $themePath . '/Plugin.php';
     // Load your theme's Theme.php file as a service provider
     if (File::exists($providerPath)) {
         // Use reflection to find out info about Plugin.php
         $info = new Classes\ClassInfo($providerPath);
         if (ltrim($info->extends, '\\') == "NSRosenqvist\\ThemesPlus\\Classes\\ThemesPlusBase") {
             // Activate the theme plugin
             $plugin = $this->manager->loadPlugin($info->namespace, $themePath);
             $identifier = $this->manager->getIdentifier($plugin);
             $definitionsFile = $pluginPath . '/composer/definitions.php';
             $this->manager->registerPlugin($plugin);
             $this->manager->bootPlugin($plugin);
             // See if we need to generate a new composer psr-4 definitions file
             if (Settings::get('definitions_generated_for') != $identifier || !File::exists($definitionsFile)) {
                 File::put($definitionsFile, $this->makeDefinitionFile($info->namespace, $themePath));
                 Settings::set('definitions_generated_for', $identifier);
             }
             // Add theme to autoload through our definitions file
             ComposerManager::instance()->autoload($pluginPath);
         }
     }
     // dd(\Composer\Autoload\ClassLoader::findFile('MyCompany\\MyTheme\\Classes\\Radical'));
     // dd(ComposerManager::instance());
 }
开发者ID:nsrosenqvist,项目名称:october-plugin_themesplus,代码行数:31,代码来源:Plugin.php

示例4: getMenuTypeInfo

 /**
  * Handler for the pages.menuitem.getTypeInfo event.
  * Returns a menu item type information. The type information is returned as array
  * with the following elements:
  * - references - a list of the item type reference options. The options are returned in the
  *   ["key"] => "title" format for options that don't have sub-options, and in the format
  *   ["key"] => ["title"=>"Option title", "items"=>[...]] for options that have sub-options. Optional,
  *   required only if the menu item type requires references.
  * - nesting - Boolean value indicating whether the item type supports nested items. Optional,
  *   false if omitted.
  * - dynamicItems - Boolean value indicating whether the item type could generate new menu items.
  *   Optional, false if omitted.
  * - cmsPages - a list of CMS pages (objects of the Cms\Classes\Page class), if the item type requires a CMS page reference to 
  *   resolve the item URL.
  * @param string $type Specifies the menu item type
  * @return array Returns an array
  */
 public static function getMenuTypeInfo($type)
 {
     $result = [];
     if ($type == 'blog-category') {
         $references = [];
         $categories = self::orderBy('name')->get();
         foreach ($categories as $category) {
             $references[$category->id] = $category->name;
         }
         $result = ['references' => $references, 'nesting' => false, 'dynamicItems' => false];
     }
     if ($type == 'all-blog-categories') {
         $result = ['dynamicItems' => true];
     }
     if ($result) {
         $theme = Theme::getActiveTheme();
         $pages = CmsPage::listInTheme($theme, true);
         $cmsPages = [];
         foreach ($pages as $page) {
             if (!$page->hasComponent('blogPosts')) {
                 continue;
             }
             $properties = $page->getComponentProperties('blogPosts');
             if (!isset($properties['categoryFilter']) || substr($properties['categoryFilter'], 0, 1) !== ':') {
                 continue;
             }
             $cmsPages[] = $page;
         }
         $result['cmsPages'] = $cmsPages;
     }
     return $result;
 }
开发者ID:janusnic,项目名称:OctoberCMS,代码行数:49,代码来源:Category.php

示例5: onRun

 public function onRun()
 {
     $url = Request::path();
     if (!strlen($url)) {
         $url = '/';
     }
     $router = new Router(Theme::getActiveTheme());
     $this->page = $this->page['page'] = $router->findByUrl($url);
     if ($this->page) {
         $this->seo_title = $this->page['seo_title'] = $this->page->getViewBag()->property('seo_title');
         $this->title = $this->page['title'] = $this->page->getViewBag()->property('title');
         $this->seo_description = $this->page['seo_description'] = $this->page->getViewBag()->property('seo_description');
         $this->seo_keywords = $this->page['seo_keywords'] = $this->page->getViewBag()->property('seo_keywords');
         $this->canonical_url = $this->page['canonical_url'] = $this->page->getViewBag()->property('canonical_url');
         $this->redirect_url = $this->page['redirect_url'] = $this->page->getViewBag()->property('redirect_url');
         $this->robot_index = $this->page['robot_index'] = $this->page->getViewBag()->property('robot_index');
         $this->robot_follow = $this->page['robot_follow'] = $this->page->getViewBag()->property('robot_follow');
         $settings = Settings::instance();
         if ($settings->enable_og_tags) {
             $this->ogTitle = empty($this->page->meta_title) ? $this->page->title : $this->page->meta_title;
             $this->ogDescription = $this->page->meta_description;
             $this->ogUrl = empty($this->page->canonical_url) ? Request::url() : $this->page->canonical_url;
             $this->ogSiteName = $settings->og_sitename;
             $this->ogFbAppId = $settings->og_fb_appid;
         }
     }
 }
开发者ID:janusnic,项目名称:oc-seo-extension,代码行数:27,代码来源:StaticPage.php

示例6: fire

 /**
  * Execute the console command.
  * @return void
  */
 public function fire()
 {
     $this->info('Initializing npm, bower and some boilerplates');
     // copiar templates
     $path_source = plugins_path('genius/elixir/assets/template/');
     $path_destination = base_path('/');
     $vars = ['{{theme}}' => Theme::getActiveTheme()->getDirName(), '{{project}}' => str_slug(BrandSettings::get('app_name'))];
     $fileSystem = new Filesystem();
     foreach ($fileSystem->allFiles($path_source) as $file) {
         if (!$fileSystem->isDirectory($path_destination . $file->getRelativePath())) {
             $fileSystem->makeDirectory($path_destination . $file->getRelativePath(), 0777, true);
         }
         $fileSystem->put($path_destination . $file->getRelativePathname(), str_replace(array_keys($vars), array_values($vars), $fileSystem->get($path_source . $file->getRelativePathname())));
     }
     $this->info('... initial setup is ok!');
     $this->info('Installing npm... this can take several minutes!');
     // instalar NPM
     system("cd '{$path_destination}' && npm install");
     $this->info('... node components is ok!');
     $this->info('Installing bower... this will no longer take as!');
     // instalar NPM
     system("cd '{$path_destination}' && bower install");
     $this->info('... bower components is ok!');
     $this->info('Now... edit the /gulpfile.js as you wish and edit your assets at/ resources directory... that\'s is!');
 }
开发者ID:estudiogenius,项目名称:oc-genius-elixir,代码行数:29,代码来源:ElixirInit.php

示例7: getMenuTypeInfo

 /**
  * Handler for the pages.menuitem.getTypeInfo event.
  * Returns a menu item type information. The type information is returned as array
  * with the following elements:
  * - references - a list of the item type reference options. The options are returned in the
  *   ["key"] => "title" format for options that don't have sub-options, and in the format
  *   ["key"] => ["title"=>"Option title", "items"=>[...]] for options that have sub-options. Optional,
  *   required only if the menu item type requires references.
  * - nesting - Boolean value indicating whether the item type supports nested items. Optional,
  *   false if omitted.
  * - dynamicItems - Boolean value indicating whether the item type could generate new menu items.
  *   Optional, false if omitted.
  * - cmsPages - a list of CMS pages (objects of the Cms\Classes\Page class), if the item type requires a CMS page reference to 
  *   resolve the item URL.
  * @param string $type Specifies the menu item type
  * @return array Returns an array
  */
 public static function getMenuTypeInfo($type)
 {
     $result = [];
     if ($type == 'blog-category') {
         $result = ['references' => self::listSubCategoryOptions(), 'nesting' => true, 'dynamicItems' => true];
     }
     if ($type == 'all-blog-categories') {
         $result = ['dynamicItems' => true];
     }
     if ($result) {
         $theme = Theme::getActiveTheme();
         $pages = CmsPage::listInTheme($theme, true);
         $cmsPages = [];
         foreach ($pages as $page) {
             if (!$page->hasComponent('blogPosts')) {
                 continue;
             }
             /*
              * Component must use a category filter with a routing parameter
              * eg: categoryFilter = "{{ :somevalue }}"
              */
             $properties = $page->getComponentProperties('blogPosts');
             if (!isset($properties['categoryFilter']) || !preg_match('/{{\\s*:/', $properties['categoryFilter'])) {
                 continue;
             }
             $cmsPages[] = $page;
         }
         $result['cmsPages'] = $cmsPages;
     }
     return $result;
 }
开发者ID:rainlab,项目名称:blog-plugin,代码行数:48,代码来源:Category.php

示例8: init

 /**
  * Initialize this singleton.
  */
 protected function init()
 {
     $this->theme = Theme::getActiveTheme();
     if (!$this->theme) {
         throw new CmsException(Lang::get('cms::lang.theme.active.not_found'));
     }
 }
开发者ID:rainlab,项目名称:pages-plugin,代码行数:10,代码来源:Controller.php

示例9: onRun

 public function onRun()
 {
     $url = $this->getRouter()->getUrl();
     if (!strlen($url)) {
         $url = '/';
     }
     $theme = Theme::getActiveTheme();
     $router = new Router($theme);
     $page = $router->findByUrl($url);
     if ($page) {
         $tree = StaticPageClass::buildMenuTree($theme);
         $code = $startCode = $page->getBaseFileName();
         $breadcrumbs = [];
         while ($code) {
             if (!isset($tree[$code])) {
                 continue;
             }
             $pageInfo = $tree[$code];
             if ($pageInfo['navigation_hidden']) {
                 $code = $pageInfo['parent'];
                 continue;
             }
             $reference = new MenuItemReference();
             $reference->title = $pageInfo['title'];
             $reference->url = URL::to($pageInfo['url']);
             $reference->isActive = $code == $startCode;
             $breadcrumbs[] = $reference;
             $code = $pageInfo['parent'];
         }
         $breadcrumbs = array_reverse($breadcrumbs);
         $this->breadcrumbs = $this->page['breadcrumbs'] = $breadcrumbs;
     }
 }
开发者ID:ardani,项目名称:stikes-cms,代码行数:33,代码来源:StaticBreadcrumbs.php

示例10: loadData

 protected function loadData()
 {
     if (!($theme = Theme::getActiveTheme())) {
         throw new ApplicationException(Lang::get('cms::lang.theme.not_found_name', ['name' => Theme::getActiveThemeCode()]));
     }
     $this->vars['theme'] = $theme;
     $this->vars['inMaintenance'] = MaintenanceSetting::get('is_enabled');
 }
开发者ID:nerijunior,项目名称:october,代码行数:8,代码来源:ActiveTheme.php

示例11: testApiTheme

 public function testApiTheme()
 {
     Event::flush('cms.activeTheme');
     Event::listen('cms.activeTheme', function () {
         return 'apitest';
     });
     $activeTheme = Theme::getActiveTheme();
     $this->assertNotNull($activeTheme);
     $this->assertEquals('apitest', $activeTheme->getDirName());
 }
开发者ID:360weboy,项目名称:october,代码行数:10,代码来源:ThemeTest.php

示例12: getMenuTypeInfo

 /**
  *
  * Returns an array of info about menu item type
  *
  * @param string $type item name
  * @return array
  */
 public static function getMenuTypeInfo($type)
 {
     $result = [];
     if ($type != 'all-archive-years') {
         return $result;
     }
     $result['dynamicItems'] = true;
     $theme = Theme::getActiveTheme();
     $result['cmsPages'] = CmsPage::listInTheme($theme, true);
     return $result;
 }
开发者ID:graker,项目名称:blogarchive,代码行数:18,代码来源:SitemapProvider.php

示例13: processLinks

 /**
  * Checks for broken links in selected database fields and/or all CMS files
  * @return void
  */
 public static function processLinks()
 {
     # Let's start by truncating the BrokenLinks table
     BrokenLink::truncate();
     $brokenLinks = [];
     $settings = Settings::instance();
     foreach ($settings->modelators as $el) {
         list($modelName, $field) = explode('::', $el['modelator']);
         $models = $modelName::whereNotNull($field)->get();
         foreach ($models as $model) {
             $urls = Helper::scanForUrls($model->{$field});
             $modelParts = explode('\\', $modelName);
             foreach ($urls as $url) {
                 $status = BrokenLink::isBrokenLink($url);
                 if ($status) {
                     $brokenLinks[] = ['status' => $status, 'plugin' => $modelParts[1] . '.' . $modelParts[2], 'model' => array_pop($modelParts), 'model_id' => $model->id, 'field' => $field, 'url' => $model->{$field}];
                 }
             }
         }
     }
     /**
      * Go process the current theme
      */
     $theme = Theme::getActiveTheme();
     $theme->getPath();
     /**
      * Should we process theme pages?
      */
     if ($settings['checkCMS'] == '1') {
         foreach (File::directories($theme->getPath()) as $themeSubDir) {
             # Skip the assets folder
             if (basename($themeSubDir) == 'assets') {
                 continue;
             }
             foreach (File::allFiles($themeSubDir) as $filePath) {
                 $urls = Helper::scanForUrls(file_get_contents($filePath));
                 foreach ($urls as $url) {
                     $status = BrokenLink::isBrokenLink($url);
                     if ($status) {
                         $brokenLinks[] = ['status' => $status, 'plugin' => 'CMS', 'model' => str_replace($theme->getPath() . DIRECTORY_SEPARATOR, '', $filePath), 'url' => $url];
                     }
                 }
             }
         }
     }
     /**
      * Lets seed the BrokenLink table with any and all found links.
      */
     foreach ($brokenLinks as $brokenLink) {
         BrokenLink::create($brokenLink);
     }
     return count($brokenLinks);
 }
开发者ID:fuunnx,项目名称:loveandzucchini,代码行数:57,代码来源:BrokenLink.php

示例14: onRun

 public function onRun()
 {
     $url = Request::path();
     if (!strlen($url)) {
         $url = '/';
     }
     $router = new Router(Theme::getActiveTheme());
     $this->pageObject = $this->page['page'] = $router->findByUrl($url);
     if ($this->pageObject) {
         $this->title = $this->page['title'] = $this->pageObject->getViewBag()->property('title');
         $this->extraData = $this->page['extraData'] = $this->defineExtraData();
     }
 }
开发者ID:negativa,项目名称:pages-plugin,代码行数:13,代码来源:StaticPage.php

示例15: onRun

 public function onRun()
 {
     $url = $this->getRouter()->getUrl();
     if (!strlen($url)) {
         $url = '/';
     }
     $router = new Router(Theme::getActiveTheme());
     $this->pageObject = $this->page['page'] = $router->findByUrl($url);
     if ($this->pageObject) {
         $this->title = $this->page['title'] = array_get($this->pageObject->viewBag, 'title');
         $this->extraData = $this->page['extraData'] = $this->defineExtraData();
     }
 }
开发者ID:ardani,项目名称:stikes-cms,代码行数:13,代码来源:StaticPage.php


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