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


PHP SSViewer::current_theme方法代码示例

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


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

示例1: __construct

 /**
  * Constructs the container and set up default services and properties
  */
 public function __construct()
 {
     parent::__construct();
     //Shared services
     $this['twig'] = $this->share(function ($c) {
         $envOptions = array_merge(array('cache' => $c['twig.compilation_cache']), $c['twig.environment_options']);
         $twig = new Twig_Environment($c['twig.loader'], $envOptions);
         if (isset($envOptions['debug']) && $envOptions['debug']) {
             $twig->addExtension(new Twig_Extension_Debug());
         }
         return $twig;
     });
     $this['twig.loader'] = $this->share(function ($c) {
         return new $c['twig.loader_class']($c['twig.template_paths']);
     });
     //Dynamic props
     $this['twig.compilation_cache'] = BASE_PATH . '/twig-cache';
     $this['twig.template_paths'] = THEMES_PATH . '/' . SSViewer::current_theme() . '/twig';
     //Default config
     foreach (self::$config as $key => $value) {
         $this[$key] = $value;
     }
     //Extensions
     if (is_array(self::$extensions)) {
         foreach (self::$extensions as $value) {
             $this->extend($value[0], $value[1]);
         }
     }
     //Shared
     if (is_array(self::$shared)) {
         foreach (self::$shared as $value) {
             $this[$value[0]] = $this->share($value[1]);
         }
     }
 }
开发者ID:helpfulrobot,项目名称:camspiers-silverstripe-twig,代码行数:38,代码来源:TwigContainer.php

示例2: init

 public function init()
 {
     parent::init();
     // We don't want this showing up in every ajax-response, it should always be present in a CMS-environment
     if (!Director::is_ajax()) {
         Requirements::javascriptTemplate("cms/javascript/tinymce.template.js", array("ContentCSS" => (SSViewer::current_theme() ? "themes/" . SSViewer::current_theme() : project()) . "/css/editor.css", "BaseURL" => Director::absoluteBaseURL(), "Lang" => i18n::get_tinymce_lang()));
     }
     Requirements::javascript('cms/javascript/CMSMain.js');
     Requirements::javascript('cms/javascript/CMSMain_left.js');
     Requirements::javascript('cms/javascript/CMSMain_right.js');
     Requirements::javascript('sapphire/javascript/UpdateURL.js');
     /**
      * HACK ALERT: Project-specific requirements
      * 
      * We need a better way of including all of the CSS that *might* be used by this application.
      * Perhaps the ajax responses can include some instructions to go get more CSS / JavaScript?
      */
     Requirements::css("survey/css/SurveyFilter.css");
     Requirements::javascript("survey/javascript/SurveyResponses.js");
     Requirements::javascript("survey/javascript/FormResponses.js");
     Requirements::javascript("parents/javascript/NotifyMembers.js");
     Requirements::css("tourism/css/SurveyCMSMain.css");
     Requirements::javascript("tourism/javascript/QuotasReport.js");
     Requirements::javascript("sapphire/javascript/ReportField.js");
     Requirements::javascript("ptraining/javascript/BookingList.js");
     Requirements::javascript("forum/javascript/ForumAccess.js");
     Requirements::javascript('gallery/javascript/GalleryPage_CMS.js');
 }
开发者ID:ramziammar,项目名称:websites,代码行数:28,代码来源:CMSMain.php

示例3: setUp

	function setUp() {
		parent::setUp();
		
		$this->alternateBasePath = $this->getCurrentAbsolutePath() . "/_fakewebroot";
		$this->alternateBaseSavePath = TEMP_FOLDER . '/i18nTextCollectorTest_webroot';
		FileSystem::makeFolder($this->alternateBaseSavePath);
		Director::setBaseFolder($this->alternateBasePath);

		// Push a template loader running from the fake webroot onto the stack.
		$templateManifest = new SS_TemplateManifest($this->alternateBasePath, false, true);
		$templateManifest->regenerate(false);
		SS_TemplateLoader::instance()->pushManifest($templateManifest);
		$this->_oldTheme = SSViewer::current_theme();
		SSViewer::set_theme('testtheme1');

		$this->originalLocale = i18n::get_locale();
		
		// Override default adapter to avoid cached translations between tests.
		// Emulates behaviour in i18n::get_translators()
		$this->origAdapter = i18n::get_translator('core');
		$adapter = new Zend_Translate(array(
			'adapter' => 'i18nRailsYamlAdapter',
			'locale' => i18n::default_locale(),
			'disableNotices' => true,
		));
		i18n::register_translator($adapter, 'core');
		$adapter->removeCache();
		i18n::include_by_locale('en');
	}
开发者ID:redema,项目名称:sapphire,代码行数:29,代码来源:i18nTest.php

示例4: template_paths

 /**
  * looked-up the email template_paths.
  * if not set, will look up both theme folder and project folder
  * in both cases, email folder exsits or Email folder exists
  * return an array containing all folders pointing to the bunch of email templates
  *
  * @return array
  */
 public static function template_paths()
 {
     if (!isset(self::$template_paths)) {
         if (class_exists('SiteConfig') && ($config = SiteConfig::current_site_config()) && $config->Theme) {
             $theme = $config->Theme;
         } elseif (SSViewer::current_custom_theme()) {
             $theme = SSViewer::current_custom_theme();
         } elseif (SSViewer::current_theme()) {
             $theme = SSViewer::current_theme();
         } else {
             $theme = false;
         }
         if ($theme) {
             if (file_exists("../" . THEMES_DIR . "/" . $theme . "/templates/email")) {
                 self::$template_paths[] = THEMES_DIR . "/" . $theme . "/templates/email";
             }
             if (file_exists("../" . THEMES_DIR . "/" . $theme . "/templates/Email")) {
                 self::$template_paths[] = THEMES_DIR . "/" . $theme . "/templates/Email";
             }
         }
         $project = project();
         if (file_exists("../" . $project . '/templates/email')) {
             self::$template_paths[] = $project . '/templates/email';
         }
         if (file_exists("../" . $project . '/templates/Email')) {
             self::$template_paths[] = $project . '/templates/Email';
         }
     } else {
         if (is_string(self::$template_paths)) {
             self::$template_paths = array(self::$template_paths);
         }
     }
     return self::$template_paths;
 }
开发者ID:Zauberfisch,项目名称:silverstripe-newsletter,代码行数:42,代码来源:NewsletterAdmin.php

示例5: doPublish

 /**
  * When an error page is published, create a static HTML page with its
  * content, so the page can be shown even when SilverStripe is not
  * functioning correctly before publishing this page normally.
  * @param string|int $fromStage Place to copy from. Can be either a stage name or a version number.
  * @param string $toStage Place to copy to. Must be a stage name.
  * @param boolean $createNewVersion Set this to true to create a new version number.  By default, the existing version number will be copied over.
  */
 function doPublish()
 {
     parent::doPublish();
     // Run the page (reset the theme, it might've been disabled by LeftAndMain::init())
     $oldTheme = SSViewer::current_theme();
     SSViewer::set_theme(SSViewer::current_custom_theme());
     $response = Director::test(Director::makeRelative($this->Link()));
     SSViewer::set_theme($oldTheme);
     $errorContent = $response->getBody();
     // Make the base tag dynamic.
     // $errorContent = preg_replace('/<base[^>]+href="' . str_replace('/','\\/', Director::absoluteBaseURL()) . '"[^>]*>/i', '<base href="$BaseURL" />', $errorContent);
     // Check we have an assets base directory, creating if it we don't
     if (!file_exists(ASSETS_PATH)) {
         mkdir(ASSETS_PATH, 02775);
     }
     // if the page is published in a language other than default language,
     // write a specific language version of the HTML page
     $filePath = self::get_filepath_for_errorcode($this->ErrorCode, $this->Locale);
     if ($fh = fopen($filePath, "w")) {
         fwrite($fh, $errorContent);
         fclose($fh);
     } else {
         $fileErrorText = sprintf(_t("ErrorPage.ERRORFILEPROBLEM", "Error opening file \"%s\" for writing. Please check file permissions."), $errorFile);
         FormResponse::status_message($fileErrorText, 'bad');
         FormResponse::respond();
         return;
     }
 }
开发者ID:Raiser,项目名称:Praktikum,代码行数:36,代码来源:ErrorPage.php

示例6: setGlobalOptions

 /**
  * Set the global options for all pdfs
  * @param array $options A list with all possible options can be found here http://wkhtmltopdf.org/usage/wkhtmltopdf.txt
  */
 public function setGlobalOptions($options = null)
 {
     if (!$options) {
         $css = BASE_PATH . '/themes/' . SSViewer::current_theme() . '/css/pdf.css';
         $header = BASE_PATH . '/mysite/templates/Pdf/header.html';
         $footer = BASE_PATH . '/mysite/templates/Pdf/footer.html';
         $options = array('no-outline', 'enable-javascript', 'enable-smart-shrinking', 'encoding' => 'UTF-8', 'dpi' => 150, 'image-dpi' => 150, 'image-quality' => 100, 'user-style-sheet' => $css, 'orientation' => 'Portrait', 'page-height' => '297mm', 'page-width' => '210mm', 'page-size' => 'A4', 'margin-bottom' => 30, 'margin-left' => 10, 'margin-right' => 10, 'margin-top' => 30, 'header-html' => $header, 'footer-html' => $footer);
     }
     $this->globalOptions = $options;
 }
开发者ID:helpfulrobot,项目名称:creativesynergy-silverstripe-wkhtmltopdf,代码行数:14,代码来源:SS_PDF.php

示例7: getIcon

 /**
  * Return the relative URL of an icon for the file type,
  * based on the {@link appCategory()} value.
  * Images are searched for in "sapphire/images/app_icons/".
  *
  * @return String
  */
 public function getIcon($file)
 {
     $ext = $this->getExt($file);
     if (!Director::fileExists("themes/" . SSViewer::current_theme() . "/images/icons/file_extension_{$ext}.png")) {
         $ext = $this->appCategory($file);
     }
     if (!Director::fileExists("themes/" . SSViewer::current_theme() . "/images/icons/file_extension_{$ext}.png")) {
         $ext = "generic";
     }
     return "themes/" . SSViewer::current_theme() . "/images/icons/file_extension_{$ext}.png";
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:18,代码来源:Iconifier.php

示例8: findThemes

 /**
  * Determines the theme names that should be considered
  * @return array List of theme names to use 
  */
 protected function findThemes()
 {
     $themes = array($currentTheme = SSViewer::current_theme());
     if (self::$include_subthemes) {
         foreach (scandir(THEMES_PATH) as $theme) {
             if (preg_match("/^{$currentTheme}_.+\$/i", $theme)) {
                 $themes[] = $theme;
             }
         }
     }
     return $themes;
 }
开发者ID:helpfulrobot,项目名称:tractorcow-silverstripe-lessphp,代码行数:16,代码来源:LessPhp.php

示例9: ThemeDir

 /**
  * Returns a relative path to current theme directory.
  * 
  * @return mixed
  */
 public function ThemeDir()
 {
     if ($theme = SSViewer::current_theme()) {
         return THEMES_DIR . "/{$theme}";
     } elseif ($theme = SSViewer::current_custom_theme()) {
         return THEMES_DIR . "/{$theme}";
     } elseif ($theme = SiteConfig::current_site_config()->Theme) {
         return THEMES_DIR . "/{$theme}";
     } else {
         throw new Exception("cannot detect theme");
     }
 }
开发者ID:arillo,项目名称:silverstripe-cleanutilities,代码行数:17,代码来源:ThemeDataExtension.php

示例10: get_css_folder

 public static function get_css_folder()
 {
     if (Config::inst()->get("TypographyTestPage", "css_folder")) {
         $folder = Config::inst()->get("TypographyTestPage", "css_folder");
     } else {
         $folder = "themes/" . SSViewer::current_theme() . "/css/";
     }
     $fullFolder = Director::baseFolder() . '/' . $folder;
     if (!file_exists($fullFolder)) {
         user_error("could not find the default CSS folder {$fullFolder}");
         $folder = '';
     }
     return $folder;
 }
开发者ID:helpfulrobot,项目名称:xplore-typography,代码行数:14,代码来源:TypographyTestPage.php

示例11: setUp

 function setUp()
 {
     parent::setUp();
     $this->mainSession = new TestSession();
     // Disable theme, if necessary
     if ($this->stat('disable_themes')) {
         $this->originalTheme = SSViewer::current_theme();
         SSViewer::set_theme(null);
     }
     // Switch to draft site, if necessary
     if ($this->stat('use_draft_site')) {
         $this->useDraftSite();
     }
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:14,代码来源:FunctionalTest.php

示例12: doExport

 public function doExport($data, $form)
 {
     $data = $form->getData();
     $links = array();
     $siteTitle = SiteConfig::current_site_config()->Title;
     // If the queued jobs module is installed, then queue up an export
     // job rather than performing the export.
     if (class_exists('QueuedJobService')) {
         $job = new SiteExportJob($form->getRecord());
         $job->theme = $data['ExportSiteTheme'];
         $job->baseUrl = $data['ExportSiteBaseUrl'];
         $job->baseUrlType = $data['ExportSiteBaseUrlType'];
         $job->email = $data['ExportSiteCompleteEmail'];
         singleton('QueuedJobService')->queueJob($job);
         return new SS_HTTPResponse($form->dataFieldByName('SiteExports')->FieldHolder(), 200, 'The site export job has been queued.');
     }
     // First generate a temp directory to store the export content in.
     $temp = TEMP_FOLDER;
     $temp .= sprintf('/siteexport_%s', date('Y-m-d-His'));
     mkdir($temp);
     $exporter = new SiteExporter();
     $exporter->root = $form->getRecord();
     $exporter->theme = $data['ExportSiteTheme'];
     $exporter->baseUrl = $data['ExportSiteBaseUrl'];
     $exporter->makeRelative = $data['ExportSiteBaseUrlType'] == 'rewrite';
     $exporter->exportTo($temp);
     // Then place the exported content into an archive, stored in the assets
     // root, and create a site export for it.
     $filename = preg_replace('/[^a-zA-Z0-9-.+]/', '-', sprintf('%s-%s.zip', $siteTitle, date('c')));
     $dir = Folder::findOrMake(self::EXPORTS_DIR);
     $dirname = ASSETS_PATH . '/' . self::EXPORTS_DIR;
     $pathname = "{$dirname}/{$filename}";
     SiteExportUtils::zip_directory($temp, "{$dirname}/{$filename}");
     Filesystem::removeFolder($temp);
     $file = new File();
     $file->ParentID = $dir->ID;
     $file->Title = $siteTitle . ' ' . date('c');
     $file->Filename = $dir->Filename . $filename;
     $file->write();
     $export = new SiteExport();
     $export->ParentClass = $form->getRecord()->class;
     $export->ParentID = $form->getRecord()->ID;
     $export->Theme = SSViewer::current_theme();
     $export->BaseUrlType = ucfirst($data['ExportSiteBaseUrlType']);
     $export->BaseUrl = $data['ExportSiteBaseUrl'];
     $export->ArchiveID = $file->ID;
     $export->write();
     return new SS_HTTPResponse($form->dataFieldByName('SiteExports')->FieldHolder(), 200, 'The site export has been generated.');
 }
开发者ID:rodneyway,项目名称:silverstripe-siteexporter,代码行数:49,代码来源:SiteExportExtension.php

示例13: requireDefaultRecords

 function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     // If css file does not exist on current theme, copy from module
     $copyfrom = BASE_PATH . "/" . CONTENTBLOCKS_MODULE_DIR . "/css/block.css";
     $theme = SSViewer::current_theme();
     $copyto = BASE_PATH . "/themes/" . $theme . "/css/block.css";
     if (!file_exists($copyto)) {
         if (file_exists($copyfrom)) {
             copy($copyfrom, $copyto);
             echo '<li style="green: green">block.css copied to: ' . $copyto . '</li>';
         } else {
             echo '<li style="red">The default css file was not found: ' . $copyfrom . '</li>';
         }
     }
 }
开发者ID:Design-Collective,项目名称:Silverstripe-Content-Blocks,代码行数:16,代码来源:ContentBlocksModule.php

示例14: requireDefaultRecords

 function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     // Run on dev buld
     // If templates does not exist on current theme, copy from module
     $theme = SSViewer::current_theme();
     $copyto = "../themes/" . $theme . "/templates/" . CONTENTBLOCKS_TEMPLATE_DIR . "/";
     if (!file_exists($copyto)) {
         $copyfrom = BASE_PATH . "/" . CONTENTBLOCKS_MODULE_DIR . "/templates/" . CONTENTBLOCKS_TEMPLATE_DIR . "/";
         if (file_exists($copyfrom)) {
             $this->recurse_copy($copyfrom, $copyto);
             echo '<li style="color: green">BlockTemplates copied to: ' . $copyto . '</li>';
         } else {
             echo "The default template archive was not found: " . $copyfrom;
         }
     }
 }
开发者ID:sb-relaxt-at,项目名称:Silverstripe-Content-Blocks,代码行数:17,代码来源:Block.php

示例15: testCurrentTheme

 /**
  * Tests for {@link SSViewer::current_theme()} for different behaviour
  * of user defined themes via {@link SiteConfig} and default theme
  * when no user themes are defined.
  */
 function testCurrentTheme()
 {
     $config = SiteConfig::current_site_config();
     $oldTheme = $config->Theme;
     $config->Theme = '';
     $config->write();
     SSViewer::set_theme('mytheme');
     $this->assertEquals('mytheme', SSViewer::current_theme(), 'Current theme is the default - user has not defined one');
     $config->Theme = 'myusertheme';
     $config->write();
     // Pretent to load the page
     $c = new ContentController();
     $c->init();
     $this->assertEquals('myusertheme', SSViewer::current_theme(), 'Current theme is a user defined one');
     // Set the theme back to the original
     $config->Theme = $oldTheme;
     $config->write();
 }
开发者ID:NARKOZ,项目名称:silverstripe-doc-restructuring,代码行数:23,代码来源:SSViewerTest.php


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