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


PHP ThemeUtil::getVar方法代码示例

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


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

示例1: smarty_function_themegetvar

/**
 * Plugin to get a variable from the theme
 *
 * This function returns the corresponding value set on the theme
 *
 * Available parameters:
 *   - name:    Name of the variable
 *   - default: If set, the default value to return if the variable is not set
 *   - assign:  If set, the results are assigned to the corresponding variable instead of printed out
 *
 * Example
 * {themegetvar name='themepath'}
 * {themegetvar name='scriptpath' assign='scriptpath'}
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return string The colour definition.
 */
function smarty_function_themegetvar($params, Zikula_View $view)
{
    $assign = isset($params['assign']) ? $params['assign'] : null;
    $default = isset($params['default']) ? $params['default'] : null;
    $name = isset($params['name']) ? $params['name'] : null;
    if (!$name) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('themegetvar', 'name')));
        return false;
    }
    $result = ThemeUtil::getVar($name, $default);
    if ($assign) {
        $view->assign($assign, $result);
    } else {
        return $result;
    }
}
开发者ID:Silwereth,项目名称:core,代码行数:35,代码来源:function.themegetvar.php

示例2: addBootstrapCss

 private function addBootstrapCss($basePath)
 {
     $overrideBootstrapPath = '';
     if (!\System::isInstalling()) {
         $overrideBootstrapPath = \ThemeUtil::getVar('bootstrapPath', '');
         // allows for theme override of bootstrap css path
     }
     if (empty($overrideBootstrapPath)) {
         $bootstrapFontAwesomePath = $this->params['zikula.stylesheet.bootstrap-font-awesome.path'];
         $this->cssAssetBag->add(["{$basePath}/{$bootstrapFontAwesomePath}" => 0]);
     }
     if (!empty($overrideBootstrapPath)) {
         $fontAwesomePath = $this->params['zikula.stylesheet.fontawesome.min.path'];
         $this->cssAssetBag->add(["{$basePath}/{$overrideBootstrapPath}" => 0, "{$basePath}/{$fontAwesomePath}" => 1]);
     }
 }
开发者ID:Silwereth,项目名称:core,代码行数:16,代码来源:DefaultPageAssetSetterListener.php

示例3: prepareStylesheets

 /**
  * Procedure for managinig stylesheets.
  *
  * @param array   $stylesheets List of demanded stylesheets.
  * @param array   $themeinfo   array of info on current theme
  * @param boolean $isAdminController
  *
  * @return array List of stylesheets
  */
 public static function prepareStylesheets($stylesheets, $themeinfo = array(), $isAdminController = false)
 {
     if (ThemeUtil::getVar('noCoreCss', false)) {
         $initStyle = null;
     } else {
         $initStyle = array('style/core.css');
     }
     // Add generic stylesheet as the first stylesheet.
     $event = new \Zikula\Core\Event\GenericEvent('stylesheet', array(), $initStyle);
     $coreStyle = EventUtil::getManager()->dispatch('pageutil.addvar_filter', $event)->getData();
     if (!is_array($stylesheets)) {
         $stylesheets = array();
     }
     // Add legacy stylesheet
     if (System::isLegacyMode('1.4.0')) {
         array_unshift($stylesheets, 'style/legacy.css');
     }
     // Add core stylesheet
     array_unshift($stylesheets, $coreStyle[0]);
     // is theme a 1.4.0 type bundle?
     $theme = null;
     if (!empty($themeinfo)) {
         $theme = ThemeUtil::getTheme($themeinfo['name']);
     }
     // Add bootstrap stylesheet only for 1.4.x type themes or if an admin controller is in use
     if (isset($theme) || $isAdminController) {
         $overrideBootstrapPath = ThemeUtil::getVar('bootstrapPath', '');
         // allows for theme override of bootstrap css path
         if (empty($overrideBootstrapPath)) {
             $bootstrapFontAwesomePath = ServiceUtil::getManager()->getParameter('zikula.stylesheet.bootstrap-font-awesome.path');
             array_unshift($stylesheets, $bootstrapFontAwesomePath);
         }
         // Add font-awesome
         if (!empty($overrideBootstrapPath)) {
             $fontAwesomePath = ServiceUtil::getManager()->getParameter('zikula.stylesheet.fontawesome.min.path');
             array_unshift($stylesheets, $fontAwesomePath);
         }
         $stylesheets = array_unique(array_values($stylesheets));
     }
     $iehack = '<!--[if IE]><link rel="stylesheet" type="text/css" href="style/core_iehacks.css" media="print,projection,screen" /><![endif]-->';
     PageUtil::addVar('header', $iehack);
     return $stylesheets;
 }
开发者ID:Silwereth,项目名称:core,代码行数:52,代码来源:JCSSUtil.php

示例4: removeZikulaViewVars

 /**
  * Remoes all problematic template vars assigned by Zikula_View.
  *
  * @param array $vars Variables.
  *
  * @return array
  */
 protected function removeZikulaViewVars($vars)
 {
     unset($vars['zikula_view']);
     // results in endless loop
     $themeVars = array_keys(\ThemeUtil::getVar());
     foreach ($themeVars as $var) {
         unset($vars[$var]);
     }
     return $vars;
 }
开发者ID:planetenkiller,项目名称:core,代码行数:17,代码来源:View.php

示例5: pnThemeGetVar

/**
 * return a theme variable
 *
 * @return mixed theme variable value
 */
function pnThemeGetVar($name = null, $default = null)
{
    LogUtil::log(__f('Warning! Function %1$s is deprecated. Please use %2$s instead.', array('pnThemeGetVar()', 'ThemeUtil::getVar()')), E_USER_DEPRECATED);

    return ThemeUtil::getVar($name, $default);
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例6: prepareStylesheets

 /**
  * Procedure for managinig stylesheets.
  *
  * @param array $stylesheets List of demanded stylesheets.
  *
  * @return array List of stylesheets
  */
 public static function prepareStylesheets($stylesheets)
 {
     if (ThemeUtil::getVar('noCoreCss', false)) {
         $initStyle = null;
     } else {
         $initStyle = array('style/core.css');
     }
     // Add generic stylesheet as the first stylesheet.
     $event = new Zikula_Event('pageutil.addvar_filter', 'stylesheet', array(), $initStyle);
     $coreStyle = EventUtil::getManager()->notify($event)->getData();
     if (is_array($stylesheets)) {
         array_unshift($stylesheets, $coreStyle[0]);
     } else {
         $stylesheets = array($coreStyle[0]);
     }
     $stylesheets = array_unique(array_values($stylesheets));
     $iehack = '<!--[if IE]><link rel="stylesheet" type="text/css" href="style/core_iehacks.css" media="print,projection,screen" /><![endif]-->';
     PageUtil::addVar('header', $iehack);
     return $stylesheets;
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:27,代码来源:JCSSUtil.php


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