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


PHP Gdn::ThemeManager方法代码示例

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


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

示例1: Theme

 function Theme()
 {
     return Gdn::ThemeManager()->CurrentTheme();
 }
开发者ID:remobjects,项目名称:Garden,代码行数:4,代码来源:functions.general.php

示例2: TestPlugin

 /**
  * Test to see if a plugin throws fatal errors.
  */
 public function TestPlugin($PluginName, &$Validation, $Setup = FALSE)
 {
     // Make sure that the plugin's requirements are met
     // Required Plugins
     $PluginInfo = $this->GetPluginInfo($PluginName);
     $RequiredPlugins = GetValue('RequiredPlugins', $PluginInfo, FALSE);
     CheckRequirements($PluginName, $RequiredPlugins, $this->EnabledPlugins(), 'plugin');
     // Required Themes
     $EnabledThemes = Gdn::ThemeManager()->EnabledThemeInfo();
     $RequiredThemes = ArrayValue('RequiredTheme', $PluginInfo, FALSE);
     CheckRequirements($PluginName, $RequiredThemes, $EnabledThemes, 'theme');
     // Required Applications
     $EnabledApplications = Gdn::ApplicationManager()->EnabledApplications();
     $RequiredApplications = ArrayValue('RequiredApplications', $PluginInfo, FALSE);
     CheckRequirements($PluginName, $RequiredApplications, $EnabledApplications, 'application');
     // Include the plugin, instantiate it, and call its setup method
     $PluginClassName = ArrayValue('ClassName', $PluginInfo, FALSE);
     $PluginFolder = ArrayValue('Folder', $PluginInfo, FALSE);
     if ($PluginFolder == '') {
         throw new Exception(T('The plugin folder was not properly defined.'));
     }
     $this->_PluginHook($PluginName, self::ACTION_ENABLE, $Setup);
     // If setup succeeded, register any specified permissions
     $PermissionName = GetValue('RegisterPermissions', $PluginInfo, FALSE);
     if ($PermissionName != FALSE) {
         $PermissionModel = Gdn::PermissionModel();
         $PermissionModel->Define($PermissionName);
     }
     return TRUE;
 }
开发者ID:elpum,项目名称:TgaForumBundle,代码行数:33,代码来源:class.pluginmanager.php

示例3: SmartAsset

 /**
  * Takes the path to an asset (image, js file, css file, etc) and prepends the webroot.
  */
 function SmartAsset($Destination = '', $WithDomain = FALSE, $AddVersion = FALSE)
 {
     $Destination = str_replace('\\', '/', $Destination);
     if (substr($Destination, 0, 7) == 'http://' || substr($Destination, 0, 8) == 'https://') {
         $Result = $Destination;
     } else {
         $Parts = array(Gdn_Url::WebRoot($WithDomain), $Destination);
         if (!$WithDomain) {
             array_unshift($Parts, '/');
         }
         $Result = CombinePaths($Parts, '/');
     }
     if ($AddVersion) {
         if (strpos($Result, '?') === FALSE) {
             $Result .= '?';
         } else {
             $Result .= '&';
         }
         // Figure out which version to put after the asset.
         $Version = APPLICATION_VERSION;
         if (preg_match('`^/([^/]+)/([^/]+)/`', $Destination, $Matches)) {
             $Type = $Matches[1];
             $Key = $Matches[2];
             static $ThemeVersion = NULL;
             switch ($Type) {
                 case 'plugins':
                     $PluginInfo = Gdn::PluginManager()->GetPluginInfo($Key);
                     $Version = GetValue('Version', $PluginInfo, $Version);
                     break;
                 case 'themes':
                     if ($ThemeVersion === NULL) {
                         $ThemeInfo = Gdn::ThemeManager()->GetThemeInfo(Theme());
                         if ($ThemeInfo !== FALSE) {
                             $ThemeVersion = GetValue('Version', $ThemeInfo, $Version);
                         } else {
                             $ThemeVersion = $Version;
                         }
                     }
                     $Version = $ThemeVersion;
                     break;
             }
         }
         $Result .= 'v=' . urlencode($Version);
     }
     return $Result;
 }
开发者ID:ru4,项目名称:arabbnota,代码行数:49,代码来源:functions.general.php

示例4: PreviewTheme

 /**
  * Show a preview of a theme.
  *
  * @since 2.0.0
  * @access public
  * @param string $ThemeName Unique ID.
  */
 public function PreviewTheme($ThemeName = '')
 {
     $this->Permission('Garden.Settings.Manage');
     $ThemeInfo = Gdn::ThemeManager()->GetThemeInfo($ThemeName);
     $PreviewThemeName = $ThemeName;
     $PreviewThemeFolder = GetValue('Folder', $ThemeInfo);
     // If we failed to get the requested theme, cancel preview
     if ($ThemeInfo === FALSE) {
         $PreviewThemeName = '';
         $PreviewThemeFolder = '';
     }
     Gdn::Session()->SetPreference(array('PreviewThemeName' => $PreviewThemeName, 'PreviewThemeFolder' => $PreviewThemeFolder));
     Redirect('/');
 }
开发者ID:elpum,项目名称:TgaForumBundle,代码行数:21,代码来源:class.settingscontroller.php

示例5: mobileThemes

 /**
  * Mobile Themes management screen.
  *
  * @since 2.2.10.3
  * @access public
  * @param string $ThemeName Unique ID.
  * @param string $TransientKey Security token.
  */
 public function mobileThemes($ThemeName = '', $TransientKey = '')
 {
     $IsMobile = true;
     $this->addJsFile('addons.js');
     $this->addJsFile('addons.js');
     $this->setData('Title', t('Mobile Themes'));
     $this->permission('Garden.Settings.Manage');
     $this->addSideMenu('dashboard/settings/mobilethemes');
     // Get currently enabled theme.
     $EnabledThemeName = Gdn::ThemeManager()->MobileTheme();
     $ThemeInfo = Gdn::themeManager()->getThemeInfo($EnabledThemeName);
     $this->setData('EnabledThemeInfo', $ThemeInfo);
     $this->setData('EnabledThemeFolder', val('Folder', $ThemeInfo));
     $this->setData('EnabledTheme', $ThemeInfo);
     $this->setData('EnabledThemeName', val('Name', $ThemeInfo, val('Index', $ThemeInfo)));
     // Get all themes.
     $Themes = Gdn::themeManager()->availableThemes();
     // Filter themes.
     foreach ($Themes as $ThemeKey => $ThemeData) {
         // Only show mobile themes.
         if (empty($ThemeData['IsMobile'])) {
             unset($Themes[$ThemeKey]);
         }
         // Remove themes that are archived
         if (!empty($ThemeData['Archived'])) {
             unset($Themes[$ThemeKey]);
         }
     }
     uasort($Themes, array('SettingsController', '_NameSort'));
     $this->setData('AvailableThemes', $Themes);
     // Process self-post.
     if ($ThemeName != '' && Gdn::session()->validateTransientKey($TransientKey)) {
         try {
             $ThemeInfo = Gdn::themeManager()->getThemeInfo($ThemeName);
             if ($ThemeInfo === false) {
                 throw new Exception(sprintf(t("Could not find a theme identified by '%s'"), $ThemeName));
             }
             Gdn::session()->setPreference(array('PreviewThemeName' => '', 'PreviewThemeFolder' => ''));
             // Clear out the preview
             Gdn::themeManager()->enableTheme($ThemeName, $IsMobile);
             $this->EventArguments['ThemeName'] = $ThemeName;
             $this->EventArguments['ThemeInfo'] = $ThemeInfo;
             $this->fireEvent('AfterEnableTheme');
         } catch (Exception $Ex) {
             $this->Form->addError($Ex);
         }
         $AsyncRequest = $this->deliveryType() === DELIVERY_TYPE_VIEW ? true : false;
         if ($this->Form->errorCount() == 0) {
             if ($AsyncRequest) {
                 echo 'Success';
                 $this->render('Blank', 'Utility', 'Dashboard');
                 exit;
             } else {
                 redirect('/settings/mobilethemes');
             }
         } else {
             if ($AsyncRequest) {
                 echo $this->Form->errorString();
                 $this->render('Blank', 'Utility', 'Dashboard');
                 exit;
             }
         }
     }
     $this->render();
 }
开发者ID:mcnasby,项目名称:datto-vanilla,代码行数:73,代码来源:class.settingscontroller.php

示例6: ETag

 /** Generate an e-tag for the application from the versions of all of its enabled applications/plugins. **/
 public static function ETag()
 {
     $Data = array();
     $Data['vanilla-core-' . APPLICATION_VERSION] = TRUE;
     $Plugins = Gdn::PluginManager()->EnabledPlugins();
     foreach ($Plugins as $Info) {
         $Data[strtolower("{$Info['Index']}-plugin-{$Info['Version']}")] = TRUE;
     }
     //      echo(Gdn_Upload::FormatFileSize(strlen(serialize($Plugins))));
     //      decho($Plugins);
     $Applications = Gdn::ApplicationManager()->EnabledApplications();
     foreach ($Applications as $Info) {
         $Data[strtolower("{$Info['Index']}-app-{$Info['Version']}")] = TRUE;
     }
     // Add the desktop theme version.
     $Info = Gdn::ThemeManager()->GetThemeInfo(Gdn::ThemeManager()->DesktopTheme());
     if (!empty($Info)) {
         $Version = GetValue('Version', $Info, 'v0');
         $Data[strtolower("{$Info['Index']}-theme-{$Version}")] = TRUE;
         if (Gdn::Controller()->Theme && Gdn::Controller()->ThemeOptions) {
             $Filenames = GetValueR('Styles.Value', Gdn::Controller()->ThemeOptions);
             $Data[$Filenames] = TRUE;
         }
     }
     // Add the mobile theme version.
     $Info = Gdn::ThemeManager()->GetThemeInfo(Gdn::ThemeManager()->MobileTheme());
     if (!empty($Info)) {
         $Version = GetValue('Version', $Info, 'v0');
         $Data[strtolower("{$Info['Index']}-theme-{$Version}")] = TRUE;
     }
     Gdn::PluginManager()->EventArguments['ETagData'] =& $Data;
     $Suffix = '';
     Gdn::PluginManager()->EventArguments['Suffix'] =& $Suffix;
     Gdn::PluginManager()->FireAs('AssetModel')->FireEvent('GenerateETag');
     unset(Gdn::PluginManager()->EventArguments['ETagData']);
     ksort($Data);
     $Result = substr(md5(implode(',', array_keys($Data))), 0, 8) . $Suffix;
     //      decho($Data);
     //      die();
     return $Result;
 }
开发者ID:3marproof,项目名称:vanilla,代码行数:42,代码来源:class.assetmodel.php

示例7: cssPath

 /**
  * Lookup the path to a CSS file and return its info array
  *
  * @param string $filename name/relative path to css file
  * @param string $folder optional. app or plugin folder to search
  * @param string $themeType mobile or desktop
  * @return array|bool
  */
 public static function cssPath($filename, $folder = '', $themeType = '')
 {
     if (!$themeType) {
         $themeType = isMobile() ? 'mobile' : 'desktop';
     }
     // 1. Check for a url.
     if (isUrl($filename)) {
         return [$filename, $filename];
     }
     $paths = [];
     // 2. Check for a full path.
     if (strpos($filename, '/') === 0) {
         $filename = ltrim($filename, '/');
         // Direct path was given
         $filename = "/{$filename}";
         $path = PATH_ROOT . $filename;
         if (file_exists($path)) {
             deprecated(htmlspecialchars($path) . ": AssetModel::CssPath() with direct paths");
             return [$path, $filename];
         }
         return false;
     }
     // 3. Check the theme.
     $theme = Gdn::ThemeManager()->ThemeFromType($themeType);
     if ($theme) {
         $path = "/{$theme}/design/{$filename}";
         $paths[] = [PATH_THEMES . $path, "/themes{$path}"];
     }
     // 4. Static, Plugin, or App relative file
     if ($folder) {
         if (in_array($folder, ['resources', 'static'])) {
             $path = "/resources/design/{$filename}";
             $paths[] = [PATH_ROOT . $path, $path];
             // A plugin-relative path was given
         } elseif (stringBeginsWith($folder, 'plugins/')) {
             $folder = substr($folder, strlen('plugins/'));
             $path = "/{$folder}/design/{$filename}";
             $paths[] = [PATH_PLUGINS . $path, "/plugins{$path}"];
             // Allow direct-to-file links for plugins
             $paths[] = [PATH_PLUGINS . "/{$folder}/{$filename}", "/plugins/{$folder}/{$filename}", true];
             // deprecated
             // An app-relative path was given
         } else {
             $path = "/{$folder}/design/{$filename}";
             $paths[] = [PATH_APPLICATIONS . $path, "/applications{$path}"];
         }
     }
     // 5. Check the default application.
     if ($folder != 'dashboard') {
         $paths[] = [PATH_APPLICATIONS . "/dashboard/design/{$filename}", "/applications/dashboard/design/{$filename}", true];
         // deprecated
     }
     foreach ($paths as $info) {
         if (file_exists($info[0])) {
             if (!empty($info[2])) {
                 // This path is deprecated.
                 unset($info[2]);
                 deprecated("The css file '{$filename}' in folder '{$folder}'");
             }
             return $info;
         }
     }
     if (!(stringEndsWith($filename, 'custom.css') || stringEndsWith($filename, 'customadmin.css'))) {
         trace("Could not find file '{$filename}' in folder '{$folder}'.");
     }
     return false;
 }
开发者ID:sitexa,项目名称:vanilla,代码行数:75,代码来源:class.assetmodel.php

示例8: foreach

foreach (Gdn::ApplicationManager()->EnabledApplicationFolders() as $ApplicationName => $ApplicationFolder) {
    // Include the application's bootstrap.
    $Gdn_Path = PATH_APPLICATIONS . "/{$ApplicationFolder}/settings/bootstrap.php";
    if (file_exists($Gdn_Path)) {
        include_once $Gdn_Path;
    }
    // Include the application's hooks.
    $Hooks_Path = PATH_APPLICATIONS . "/{$ApplicationFolder}/settings/class.hooks.php";
    if (file_exists($Hooks_Path)) {
        include_once $Hooks_Path;
    }
}
unset($Gdn_Path);
unset($Hooks_Path);
// Themes startup
Gdn::ThemeManager()->Start();
Gdn_Autoloader::Attach(Gdn_Autoloader::CONTEXT_THEME);
// Plugins startup
Gdn::PluginManager()->Start();
Gdn_Autoloader::Attach(Gdn_Autoloader::CONTEXT_PLUGIN);
/**
 * Locales
 *
 * Install any custom locales provided by applications and plugins, and set up
 * the locale management system.
 */
// Load the Garden locale system
$Gdn_Locale = new Gdn_Locale(C('Garden.Locale', 'en-CA'), Gdn::ApplicationManager()->EnabledApplicationFolders(), Gdn::PluginManager()->EnabledPluginFolders());
Gdn::FactoryInstall(Gdn::AliasLocale, 'Gdn_Locale', NULL, Gdn::FactorySingleton, $Gdn_Locale);
unset($Gdn_Locale);
require_once PATH_LIBRARY_CORE . '/functions.validation.php';
开发者ID:3marproof,项目名称:vanilla,代码行数:31,代码来源:bootstrap.php


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