本文整理汇总了PHP中SSViewer::get_theme_folder方法的典型用法代码示例。如果您正苦于以下问题:PHP SSViewer::get_theme_folder方法的具体用法?PHP SSViewer::get_theme_folder怎么用?PHP SSViewer::get_theme_folder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SSViewer
的用法示例。
在下文中一共展示了SSViewer::get_theme_folder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
parent::init();
$themeDir = SSViewer::get_theme_folder();
Requirements::javascript('framework/thirdparty/jquery/jquery.js');
if (Locator::getLocations()) {
Requirements::javascript('http://maps.google.com/maps/api/js?sensor=false');
Requirements::javascript('locator/thirdparty/handlebars/handlebars-v1.3.0.js');
Requirements::javascript('locator/thirdparty/jquery-store-locator/js/jquery.storelocator.js');
}
Requirements::css('locator/css/map.css');
$featured = Locator::getLocations(array('Featured' => 1))->count() > 0 ? 'featuredLocations: true' : 'featuredLocations: false';
// map config based on user input in Settings tab
// AutoGeocode or Full Map
$load = $this->data()->AutoGeocode ? 'autoGeocode: true, fullMapStart: false,' : 'autoGeocode: false, fullMapStart: true, storeLimit: 1000, maxDistance: true,';
$base = Director::baseFolder();
$themePath = $base . '/' . $themeDir;
$listTemplatePath = file_exists($themePath . '/templates/location-list-description.html') ? $themeDir . '/templates/location-list-description.html' : 'locator/templates/location-list-description.html';
$infowindowTemplatePath = file_exists($themePath . '/templates/infowindow-description.html') ? $themeDir . '/templates/infowindow-description.html' : 'locator/templates/infowindow-description.html';
// in page or modal
$modal = $this->data()->ModalWindow ? 'modalWindow: true' : 'modalWindow: false';
$kilometer = $this->data()->Unit == 'km' ? 'lengthUnit: "km"' : 'lengthUnit: "m"';
$link = $this->Link() . 'xml.xml';
// init map
if (Locator::getLocations()) {
Requirements::customScript("\n \$(function(\$) {\n \$('#map-container').storeLocator({\n " . $load . "\n dataLocation: '" . $link . "',\n listTemplatePath: '" . $listTemplatePath . "',\n infowindowTemplatePath: '" . $infowindowTemplatePath . "',\n originMarker: true,\n " . $modal . ',
' . $featured . ",\n slideMap: false,\n zoomLevel: 0,\n distanceAlert: 120,\n formID: 'Form_LocationSearch',\n inputID: 'Form_LocationSearch_address',\n categoryID: 'Form_LocationSearch_category',\n distanceAlert: -1,\n " . $kilometer . '
});
});
');
}
}
示例2: getCompiledPath
/**
* Returns the path for the compiled CSS file. Falls back on
* the theme_dir/css if {@link self::$compiled_path} is undefined.
*
* @return string
*/
public function getCompiledPath()
{
$new_file = basename($this->uncompiledFile, ".less") . ".css";
if (!$this->config()->compiled_path) {
return SSViewer::get_theme_folder() . "/css/" . $new_file;
}
return $this->config()->compiled_path . "/" . $new_file;
}
示例3: init
public function init()
{
parent::init();
Requirements::clear();
$themeDir = SSViewer::get_theme_folder();
Requirements::css("{$themeDir}/css/dp_calendar.css");
Requirements::combine_files('combined.css', array("{$themeDir}/css/reset.css", "{$themeDir}/css/layout.css", "{$themeDir}/css/typography.css", "{$themeDir}/css/form.css", "{$themeDir}/css/flexslider.css"));
Requirements::javascript('http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
Requirements::combine_files('combined.js', array("{$themeDir}/javascript/lib/jquery.ui.core.js", "{$themeDir}/javascript/lib/jquery.ui.position.js", "{$themeDir}/javascript/lib/jquery.ui.datepicker.js", "{$themeDir}/javascript/lib/jquery.flexslider.js", "{$themeDir}/javascript/lib/date.js", "{$themeDir}/javascript/lib/jquery.dp_calendar.js", "{$themeDir}/javascript/script.js"));
Requirements::set_combined_files_folder("{$themeDir}/_combined");
}
示例4: getFolderList
protected function getFolderList($ext)
{
$subFolders = array();
if (strrpos($ext, "css", -strlen($ext)) !== false) {
$subFolders[] = "css";
} else {
if (strrpos($ext, "js", -strlen($ext)) !== false) {
$subFolders[] = "javascript";
$subFolders[] = "js";
}
}
$baseFolders = array(SSViewer::get_theme_folder(), project());
$result = array();
foreach ($baseFolders as $baseFolder) {
foreach ($subFolders as $subFolder) {
$result[] = $baseFolder . '/' . $subFolder;
}
}
return $result;
}
开发者ID:helpfulrobot,项目名称:gdmedia-silverstripe-gdm-extensions,代码行数:20,代码来源:SSGuru_Requirements_Backend.php
示例5: onAfterInit
function onAfterInit()
{
$themeDir = SSViewer::get_theme_folder();
// Add the combined scripts.
if (method_exists($this->owner, 'getScriptOverrides')) {
$scripts = $this->owner->getScriptOverrides();
} else {
$scripts = array("{$themeDir}/js/lib/jquery.js", "{$themeDir}/js/lib/jquery-ui-1.8.21.custom.js", 'themes/module_bootstrap/js/bootstrap-transition.js', 'themes/module_bootstrap/js/bootstrap-scrollspy.js', 'themes/module_bootstrap/js/bootstrap-collapse.js', 'themes/module_bootstrap/js/bootstrap-carousel.js', "{$themeDir}/js/general.js", "{$themeDir}/js/express.js", "{$themeDir}/js/forms.js");
if (method_exists($this->owner, 'getScriptIncludes')) {
$scripts = array_merge($scripts, $this->owner->getScriptIncludes());
}
}
Requirements::combine_files('scripts.js', $scripts);
// Add the combined styles.
if (method_exists($this->owner, 'getStyleOverrides')) {
$styles = $this->owner->getStyleOverrides();
} else {
$styles = array("{$themeDir}/css/layout.css", "{$themeDir}/css/typography.css");
if (method_exists($this->owner, 'getStyleIncludes')) {
$styles = array_merge($styles, $this->owner->getStyleIncludes());
}
}
Requirements::combine_files('styles.css', $styles);
// Print styles
if (method_exists($this->owner, 'getPrintStyleOverrides')) {
$printStyles = $this->owner->getPrintStyleOverrides();
} else {
$printStyles = array("{$themeDir}/css/print.css");
if (method_exists($this->owner, 'getPrintStyleIncludes')) {
$printStyles = array_merge($printStyles, $this->owner->getPrintStyleIncludes());
}
}
foreach ($printStyles as $printStyle) {
Requirements::css($printStyle, 'print');
}
// Extra folder to keep the relative paths consistent when combining.
Requirements::set_combined_files_folder(ASSETS_DIR . '/_compiled/p');
}
开发者ID:helpfulrobot,项目名称:gdmedia-silverstripe-gdm-express,代码行数:38,代码来源:ExpressSiteTree_Controller.php
示例6: themedCSS
/**
* @see Requirements::themedCSS()
*/
public function themedCSS($name, $module = null, $media = null) {
$theme = SSViewer::current_theme();
$path = SSViewer::get_theme_folder() . "/css/$name.css";
if (file_exists(BASE_PATH . '/' . $path)) {
$this->css($path, $media);
return;
}
if ($module) {
$this->css("$module/css/$name.css");
}
}
示例7: themedCSS
/**
* Registers the given themeable stylesheet as required.
*
* A CSS file in the current theme path name 'themename/css/$name.css' is first searched for,
* and it that doesn't exist and the module parameter is set then a CSS file with that name in
* the module is used.
*
* @param string $name The name of the file - eg '/css/File.css' would have the name 'File'
* @param string $module The module to fall back to if the css file does not exist in the
* current theme.
* @param string $media Comma-separated list of media types to use in the link tag
* (e.g. 'screen,projector')
*/
public function themedCSS($name, $module = null, $media = null)
{
$theme = SSViewer::get_theme_folder();
$project = project();
$absbase = BASE_PATH . DIRECTORY_SEPARATOR;
$abstheme = $absbase . $theme;
$absproject = $absbase . $project;
$css = "/css/{$name}.css";
if (file_exists($absproject . $css)) {
$this->css($project . $css, $media);
} elseif ($module && file_exists($abstheme . '_' . $module . $css)) {
$this->css($theme . '_' . $module . $css, $media);
} elseif (file_exists($abstheme . $css)) {
$this->css($theme . $css, $media);
} elseif ($module) {
$this->css($module . $css, $media);
}
}
示例8: init
public function init()
{
parent::init();
Requirements::javascript(implode(DIRECTORY_SEPARATOR, array(SSViewer::get_theme_folder(), 'dist/bundle.js')));
}
示例9: init_template_paths
/**
* Sets up the default template paths
*/
protected static function init_template_paths()
{
global $project;
self::$template_path = array();
self::$template_path[] = BASE_PATH . '/' . SSViewer::get_theme_folder() . '/templates/php';
self::$template_path[] = BASE_PATH . '/' . $project . '/templates/php';
}
示例10: iconTags
protected function iconTags($baseURL = "", $hasBaseFolderFavicon = false)
{
$favicon = null;
if (!$baseURL) {
$baseURL = Director::absoluteBaseURL();
}
$cacheKey = 'metatags_ExtendedMetaTags_iconsTags_' . preg_replace("/[^A-Za-z0-9]/", '', $baseURL);
$baseURL = rtrim($baseURL, "/");
$cache = SS_Cache::factory($cacheKey);
$html = $cache->load($cacheKey);
if (!$html) {
$html = '';
$sizes = array("16", "32", "57", "72", "76", "96", "114", "120", "128", "144", "152", "180", "192", "310");
foreach ($sizes as $size) {
$themeFolder = SSViewer::get_theme_folder();
$file = "/" . $themeFolder . '/icons/' . 'icon-' . $size . 'x' . $size . '.png';
if (file_exists(Director::baseFolder() . $file)) {
$html .= '
<link rel="icon" type="image/png" sizes="' . $size . 'x' . $size . '" href="' . $baseURL . $file . '" />
<link rel="apple-touch-icon" type="image/png" sizes="' . $size . 'x' . $size . '" href="' . $baseURL . $file . '" />';
} elseif ($this->owner->getSiteConfig()->FaviconID) {
if ($favicon = $this->owner->getSiteConfig()->Favicon()) {
if ($favicon->exists() && $favicon instanceof Image) {
$generatedImage = $favicon->setWidth($size);
if ($generatedImage) {
$html .= '
<link rel="icon" type="image/png" sizes="' . $size . 'x' . $size . '" href="' . $baseURL . $generatedImage->Link() . '" />
<link rel="apple-touch-icon" type="image/png" sizes="' . $size . 'x' . $size . '" href="' . $baseURL . $generatedImage->Link() . '" />';
} else {
$favicon = null;
}
} else {
$favicon = null;
}
}
}
}
if ($hasBaseFolderFavicon) {
//do nothing
} else {
$faviconLink = "";
$themeFolder = SSViewer::get_theme_folder();
$faviconLocation = "/" . $themeFolder . '/icons/favicon.ico';
if (file_exists(Director::baseFolder() . $faviconLocation)) {
$faviconLink = $baseURL . $faviconLocation;
} elseif ($favicon) {
$generatedImage = $favicon->setWidth(16);
$faviconLink = $baseURL . $generatedImage->Link();
}
if ($faviconLink) {
$html .= '
<link rel="SHORTCUT ICON" href="' . $faviconLink . '" />';
}
}
$cache->save($html, $cacheKey);
}
return $html;
}
示例11: themedCSS
/**
* @see Requirements::themedCSS()
*/
public function themedCSS($name, $module = null, $media = null)
{
$path = SSViewer::get_theme_folder();
$abspath = BASE_PATH . DIRECTORY_SEPARATOR . $path;
$css = "/css/{$name}.css";
if ($module && file_exists($abspath . '_' . $module . $css)) {
$this->css($path . '_' . $module . $css, $media);
} else {
if (file_exists($abspath . $css)) {
$this->css($path . $css, $media);
} else {
if ($module) {
$this->css($module . $css);
}
}
}
}
示例12: LessCompiler
<?php
Requirements::set_backend(new LessCompiler());
/* Add default ThemeDir variable */
LessCompiler::addVariable('ThemeDir', '"' . Director::baseURL() . SSViewer::get_theme_folder() . '"');
/* Set default cache directory */
LessCompiler::setCacheDir(TEMP_FOLDER . '/less-cache');
/* Set default cache method */
LessCompiler::setCacheMethod('serialize');
示例13: getEditorCSS
/**
* Get location of all editor.css files
*
* @return array
*/
protected function getEditorCSS()
{
$editor = array();
$editor[] = Controller::join_links(Director::absoluteBaseURL(), FRAMEWORK_ADMIN_DIR . '/css/editor.css');
if ($theme = SSViewer::get_theme_folder()) {
$editorDir = $theme . '/css/editor.css';
if (file_exists(BASE_PATH . '/' . $editorDir)) {
$editor[] = Controller::join_links(Director::absoluteBaseURL(), $editorDir);
}
}
return $editor;
}
示例14: onBeforeInit
public function onBeforeInit()
{
$this->owner->theme_dir = SSViewer::get_theme_folder();
}
示例15: getTemplateData
/**
* Get compiled template data to render a string with
*
* @param DataObject $context
* @param Member $user
* @param array $extraData
* @return ArrayData
*/
public function getTemplateData($context, $user = null, $extraData = array())
{
// useful global data
$data = array('ThemeDir' => SSViewer::get_theme_folder(), 'SiteConfig' => SiteConfig::current_site_config());
// the context object, keyed by it's class name
$data[$context->ClassName] = $context;
// data as defined by the context object
$contextData = $context->getNotificationTemplateData();
if (is_array($contextData)) {
$data = array_merge($data, $contextData);
}
// the member the notification is being sent to
$data['Member'] = $user;
// extra data
$data = array_merge($data, $extraData);
return ArrayData::create($data);
}