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


PHP EasyBlogHelper::getThemeInfo方法代码示例

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


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

示例1: loadThemeCss

 /**
  * Method to load the theme CSS file based on the config
  *
  * @param	String		Filename to be loaded
  * @param	Boolean		Is this a dashboard?
  */
 public static function loadThemeCss($file, $is_dashboard = false)
 {
     $document = JFactory::getDocument();
     $mainframe = JFactory::getApplication();
     $config = EasyBlogHelper::getConfig();
     $template = $mainframe->getTemplate();
     $bloggertheme = EasyBlogHelper::getBloggerTheme();
     $enableBloggerTheme = $config->get('layout_enablebloggertheme', true);
     $availableBloggerTheme = $config->get('layout_availablebloggertheme');
     if (!is_array($availableBloggerTheme)) {
         $availableBloggerTheme = explode('|', $config->get('layout_availablebloggertheme'));
     }
     if ($enableBloggerTheme && !empty($bloggertheme) && $bloggertheme != 'global' && in_array($bloggertheme, $availableBloggerTheme)) {
         $theme = $bloggertheme;
         JRequest::setVar('theme', $bloggertheme);
     } else {
         $theme = $config->get('layout_theme');
     }
     // @rule: Use Google fonts if necessary.
     $headingFont = $config->get('layout_googlefont');
     if ($headingFont != 'site') {
         // Replace the word Bold with :Bold
         $headingFont = JString::str_ireplace(' bold', ':bold', $headingFont);
         // Replace spaces with +
         $headingFont = JString::str_ireplace(' ', '+', $headingFont);
         $url = 'https://fonts.googleapis.com/css?family=' . $headingFont;
         $document->addStyleSheet($url);
     }
     $googlePlus = $config->get('main_googleone', 0);
     $socialFrontEnd = $config->get('main_googleone_frontpage', 0);
     if ($socialFrontEnd && $googlePlus) {
         $googlPlusUrl = 'https://apis.google.com/js/plusone.js';
         $document->addScript($googlPlusUrl);
     }
     $path = null;
     $direction = $document->direction;
     /**
      * for theme development purpose
      */
     $usethis = JRequest::getWord('theme');
     if (!empty($usethis)) {
         JRequest::setVar('theme', $usethis);
         $theme = $usethis;
     }
     // new in 1.1
     // load the file based on the theme's config.ini
     $themeConfig = EasyBlogHelper::getThemeInfo($theme);
     if (!$is_dashboard) {
         /**
          * Load blog theme file
          *
          * Priority level
          *
          * 1. /templates/<joomla_template>/html/com_easyblog/
          * 2. /components/com_easyblog/themes/<selected_theme>/
          * 3. /components/com_easyblog/themes/<parent_for_selected_theme>/
          * 4. /components/com_easyblog/themes/default/
          */
         $siteOverride = false;
         $overrideFile = JPATH_ROOT . '/templates/' . $template . '/html/com_easyblog/css/' . $file;
         if (JFile::exists($overrideFile)) {
             $path = rtrim(JURI::root(), '/') . '/templates/' . $template . '/html/com_easyblog/css/' . $file;
             $siteOverride = true;
         } elseif (JFile::exists(EBLOG_THEMES . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . $file)) {
             if ($themeConfig->get('parent_css')) {
                 $path = rtrim(JURI::root(), '/') . '/components/com_easyblog/themes/' . $themeConfig->get('parent') . '/css/' . $file;
                 $document->addStylesheet($path);
             }
             $path = rtrim(JURI::root(), '/') . '/components/com_easyblog/themes/' . $theme . '/css/' . $file;
         } else {
             $path = rtrim(JURI::root(), '/') . '/components/com_easyblog/themes/default/css/' . $file;
         }
         // Always load the system css if template override in use as we want to allow them to
         // reuse the styling as much as possible.
         if (!$siteOverride) {
             $document->addStylesheet(rtrim(JURI::root(), '/') . '/components/com_easyblog/themes/default/css/styles.css');
         }
         $document->addStylesheet($path);
     }
     /**
      * Load dashboard theme file
      *
      * Priority level
      *
      * 1. /templates/<joomla_template>/html/com_easyblog/dashboard/
      * 2. /components/com_easyblog/themes/<selected_theme>/dashboard/
      * 3. /components/com_easyblog/themes/dashboard/
      */
     if ($is_dashboard) {
         $dashboardTheme = JString::trim(JString::strtolower($config->get('layout_dashboard_theme')));
         $overridePath = JPATH_ROOT . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $template . DIRECTORY_SEPARATOR . 'html' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'dashboard' . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . $file;
         $themePath = JFile::exists(EBLOG_THEMES . DIRECTORY_SEPARATOR . 'dashboard' . DIRECTORY_SEPARATOR . $dashboardTheme . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . $file);
         // Always load the base css file.
         $document->addStyleSheet(rtrim(JURI::root(), '/') . '/components/com_easyblog/themes/dashboard/system/css/styles.css');
//.........这里部分代码省略.........
开发者ID:Tommar,项目名称:vino2,代码行数:101,代码来源:helper.php

示例2: fetch

 /**
  * Open, parse, and return the template file.
  *
  * @param $file		string	The template file name
  * @param $vars 	Array	An array of custom variables that needs to exist in the template
  */
 function fetch($file, $vars = array())
 {
     $notfound = false;
     jimport('joomla.filesystem.file');
     $mainframe = JFactory::getApplication();
     // Overrides. Browser can choose different template after load
     $override = JRequest::getWord('theme', '');
     $fileName = $file;
     if ($override) {
         $this->_theme = $override;
     }
     // load the file based on the theme's config.ini
     // @since 1.1.x
     $info = EasyBlogHelper::getThemeInfo($this->_theme);
     /**
      * Precedence in order.
      * 1. Template override
      * 2. Selected theme
      * 3. Parent theme
      * 4. Default system theme
      */
     if (!$this->dashboard) {
         $overridePath = JPATH_ROOT . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $mainframe->getTemplate() . DIRECTORY_SEPARATOR . 'html' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . $file;
         $selectedPath = EBLOG_THEMES . DIRECTORY_SEPARATOR . $this->_theme . DIRECTORY_SEPARATOR . $file;
         $parentPath = EBLOG_THEMES . DIRECTORY_SEPARATOR . $info->get('parent') . DIRECTORY_SEPARATOR . $file;
         $defaultPath = EBLOG_THEMES . DIRECTORY_SEPARATOR . 'default' . DIRECTORY_SEPARATOR . $file;
     } else {
         $overridePath = JPATH_ROOT . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $mainframe->getTemplate() . DIRECTORY_SEPARATOR . 'html' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'dashboard' . DIRECTORY_SEPARATOR . $file;
         $selectedPath = EBLOG_THEMES . DIRECTORY_SEPARATOR . 'dashboard' . DIRECTORY_SEPARATOR . $this->_theme . DIRECTORY_SEPARATOR . $file;
         $parentPath = EBLOG_THEMES . DIRECTORY_SEPARATOR . 'dashboard' . DIRECTORY_SEPARATOR . $info->get('parent') . DIRECTORY_SEPARATOR . $file;
         $defaultPath = EBLOG_THEMES . DIRECTORY_SEPARATOR . 'dashboard' . DIRECTORY_SEPARATOR . 'system' . DIRECTORY_SEPARATOR . $file;
     }
     // 1. Template overrides
     if (JFile::exists($overridePath)) {
         $file = $overridePath;
     } elseif (JFile::exists($selectedPath)) {
         $file = $selectedPath;
     } elseif (JFile::exists($parentPath)) {
         $file = $parentPath;
     } else {
         $file = $defaultPath;
     }
     if (!empty($vars)) {
         extract($vars);
     }
     if (isset($this->vars)) {
         extract($this->vars);
     }
     ob_start();
     if (!JFile::exists($file)) {
         echo JText::sprintf('Invalid template file <strong>%1s</strong>', $fileName);
         $notfound = true;
     } else {
         include $file;
     }
     $data = ob_get_contents();
     ob_end_clean();
     if ($notfound) {
         return false;
     }
     return $data;
 }
开发者ID:Tommar,项目名称:vino2,代码行数:68,代码来源:themes.php


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