本文整理汇总了PHP中Requirements::set_combined_files_folder方法的典型用法代码示例。如果您正苦于以下问题:PHP Requirements::set_combined_files_folder方法的具体用法?PHP Requirements::set_combined_files_folder怎么用?PHP Requirements::set_combined_files_folder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Requirements
的用法示例。
在下文中一共展示了Requirements::set_combined_files_folder方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
Requirements::set_backend(new BetterRequirements_Backend());
parent::init();
Requirements::set_combined_files_folder(project() . '/_combinedfiles');
Requirements::set_force_js_to_bottom(true);
$this->requireJS();
$this->requireCSS();
}
示例2: init
/**
* Blocks default silverstripe jquery, and loads all required JS and CSS.
*
* Note: moment.min.js breaks javascript minimisation so is excluded from the
* combine_files call.
*/
public function init()
{
parent::init();
Requirements::block(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::block(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
Requirements::combine_files('full-calendar.css', array('full-calendar/css/lib/font-awesome.css', 'full-calendar/css/lib/fullcalendar.css', 'full-calendar/css/lib/jquery.fancybox.css', 'full-calendar/css/style.css'));
Requirements::javascript('full-calendar/javascript/lib/moment.min.js');
Requirements::combine_files('full-calendar.js', array('full-calendar/javascript/lib/jquery.min.js', 'full-calendar/javascript/lib/fullcalendar.min.js', 'full-calendar/javascript/lib/jquery.fancybox.js', 'full-calendar/javascript/functions.js'));
Requirements::set_combined_files_folder(ASSETS_DIR . '/_combinedfiles/full-calendar');
}
示例3: onAfterInit
function onAfterInit()
{
$themeDir = SSViewer::get_theme_folder();
$scripts = array();
$styles = array();
$printStyles = array();
// Add the combined scripts.
if (method_exists($this->owner, 'getScriptOverrides')) {
Deprecation::notice('0.1.3', $this->owner->ClassName . '->getScriptOverrides() is deprecated. Use Requirements::javascript("file") instead');
$scripts = $this->owner->getScriptOverrides();
} else {
if (method_exists($this->owner, 'getScriptIncludes')) {
Deprecation::notice('0.1.3', $this->owner->ClassName . '->getScriptOverrides() is deprecated. Use Requirements::javascript("file") instead');
$scripts = array_unique(array_merge($scripts, $this->owner->getScriptIncludes()));
}
}
// Add the combined styles.
if (method_exists($this->owner, 'getStyleOverrides')) {
Deprecation::notice('0.1.3', $this->owner->ClassName . '->getStyleOverrides() is deprecated. Use Requirements::css("file") instead');
$styles = $this->owner->getStyleOverrides();
} else {
if (method_exists($this->owner, 'getStyleIncludes')) {
Deprecation::notice('0.1.3', $this->owner->ClassName . '->getStyleIncludes() is deprecated. Use Requirements::css("file") instead');
$styles = array_unique(array_merge($styles, $this->owner->getStyleIncludes()));
}
}
// Print styles
if (method_exists($this->owner, 'getPrintStyleOverrides')) {
Deprecation::notice('0.1.3', $this->owner->ClassName . '->getPrintStyleOverrides() is deprecated. Use Requirements::css("file","print") instead');
$printStyles = $this->owner->getPrintStyleOverrides();
} else {
if (method_exists($this->owner, 'getPrintStyleIncludes')) {
Deprecation::notice('0.1.3', $this->owner->ClassName . '->getPrintStyleIncludes() is deprecated. Use Requirements::css("file","print") instead');
$printStyles = array_unique(array_merge($printStyles, $this->owner->getPrintStyleIncludes()));
}
}
if (Director::isDev()) {
foreach ($scripts as $script) {
Requirements::javascript($script);
}
foreach ($styles as $style) {
Requirements::css($style);
}
foreach ($styles as $printStyle) {
Requirements::css($printStyle, 'print');
}
} else {
Requirements::combine_files('scripts.js', $scripts);
Requirements::combine_files('styles.css', $styles);
Requirements::combine_files('print.css', $printStyles, 'print');
}
// Extra folder to keep the relative paths consistent when combining.
Requirements::set_combined_files_folder($themeDir . '/combinedfiles');
}
开发者ID:helpfulrobot,项目名称:gdmedia-silverstripe-gdm-extensions,代码行数:54,代码来源:SSGuru_ContentController.php
示例4: 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");
}
示例5: init
public function init()
{
parent::init();
//Set a custom combined folder under themes so relative paths to images within CSS files don't break
Requirements::set_combined_files_folder($this->ThemeDir() . '/combined');
Requirements::set_force_js_to_bottom(true);
$requiredJS = array('thirdparty/jquery/dist/jquery.min.js', 'thirdparty/foundation-sites/dist/foundation.min.js', 'thirdparty/jquery-cycle2/build/jquery.cycle2.min.js', 'thirdparty/jquery-cycle2/build/plugin/jquery.cycle2.swipe.min.js', $this->ThemeDir() . '/js/app.js');
if (class_exists('GalleryItem')) {
$requiredJS[] = 'thirdparty/fancybox/source/jquery.fancybox.pack.js';
$requiredJS[] = 'thirdparty/fancybox/source/helpers/jquery.fancybox-media.js';
}
$requiredJS[] = $this->ThemeDir() . '/js/app.js';
// [1] use this is this is a custom build
Requirements::combine_files('app.js', $requiredJS);
// Requirements::customScript();
}
示例6: init
public function init()
{
parent::init();
//Set a custom combined folder under themes so relative paths to images within CSS files don't break
Requirements::set_combined_files_folder($this->ThemeDir() . '/combined');
Requirements::block(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::set_force_js_to_bottom(true);
// [1] use this is this is a custom build
Requirements::combine_files('app.js', array($this->ThemeDir() . '/js/jquery/dist/jquery.min.js', $this->ThemeDir() . '/foundation/js/foundation.min.js', $this->ThemeDir() . '/js/app.js'));
if (class_exists('HomeSlide') || class_exists('GalleryItem')) {
Requirements::javascript($this->ThemeDir() . '/js/cycle2/jquery.cycle2.min.js');
Requirements::javascript($this->ThemeDir() . '/js/cycle2/jquery.cycle2.swipe.min.js');
Requirements::javascript($this->ThemeDir() . '/js/fancybox/source/jquery.fancybox.pack.js');
Requirements::javascript($this->ThemeDir() . '/js/fancybox/source/helpers/jquery.fancybox-media.js');
}
// Requirements::customScript();
}
示例7: setupRequirements
public static function setupRequirements($cssArray = array(), $jsArray = array())
{
$siteConfig = SiteConfig::current_site_config();
// Don't combine files if in admin to prevent error on "login as someone else" screen
$inAdmin = is_subclass_of(Controller::curr(), "LeftAndMain");
// Setup requirements
if (isset(Page_Controller::$themeFolderAndSubfolder) && Page_Controller::$themeFolderAndSubfolder) {
self::$themeFolderAndSubfolder = Page_Controller::$themeFolderAndSubfolder;
} else {
$currentTheme = SSViewer::current_theme();
self::$themeFolderAndSubfolder = 'themes/' . $currentTheme;
}
//Set a custom combined folder under themes so relative paths to images within CSS and JavaScript files don't break
Requirements::set_combined_files_folder(self::$themeFolderAndSubfolder . '/combined');
// CSS array
if (count($cssArray)) {
foreach ($cssArray as $css) {
Requirements::css($css);
}
if (!$inAdmin) {
Requirements::combine_files("combined-" . $siteConfig->ID . ".css", $cssArray);
}
}
// Javascript array
if (count($jsArray)) {
foreach ($jsArray as $js) {
Requirements::javascript($js);
}
if (!$inAdmin) {
Requirements::combine_files("combined-" . $siteConfig->ID . ".js", $jsArray);
}
}
if (!$inAdmin) {
Requirements::process_combined_files();
}
// Google analytics
if (!Director::isDev()) {
if (isset($siteConfig->GoogleAnalyticsCode)) {
Requirements::insertHeadTags($siteConfig->GoogleAnalyticsCode);
}
}
// End Google analytics
}
示例8: init
public function init()
{
parent::init();
Requirements::set_combined_files_folder(project() . '/_combinedfiles');
Requirements::combine_files('main.js', array(THIRDPARTY_DIR . '/jquery/jquery.min.js', THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js', PROJECT_THIRDPARTY_DIR . '/magnific-popup/jquery.magnific-popup.min.js', project() . '/javascript/plugins.js', project() . '/javascript/timer.js', project() . '/javascript/main.js'));
// insert modernizr into <head> for html5shiv to work
Requirements::insertHeadTags(sprintf('<script src="%s"></script>', PROJECT_THIRDPARTY_DIR . '/modernizr/modernizr.min.js'));
// insert google analytics into <head> to also track visitors that cancle the pageload before it completed
//Requirements::insertHeadTags(sprintf(
// "<script>
// (function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
// function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
// e=o.createElement(i);r=o.getElementsByTagName(i)[0];
// e.src='//www.google-analytics.com/analytics.js';
// r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
// ga('create','%s');ga('send','pageview');
// </script>",
// 'UA-XXXXX-X'
//));
Requirements::combine_files('main.css', array(PROJECT_THIRDPARTY_DIR . '/normalize-css/normalize.css', PROJECT_THIRDPARTY_DIR . '/magnific-popup/magnific-popup.css', project() . '/css/screen.css', project() . '/css/typography.css', project() . '/css/form.css', project() . '/css/header.css', project() . '/css/footer.css', project() . '/css/layout.css', project() . '/css/legacy.css'));
Requirements::css(project() . '/css/print.css', 'print');
}
示例9: 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
示例10: onAfterInit
public function onAfterInit()
{
$dir = "themes/mysite";
Requirements::block(THIRDPARTY_DIR . "/jquery/jquery.js");
Requirements::set_combined_files_folder($dir . '/combined');
Requirements::css($dir . "/css/fonts.css");
$BaseCSS = array($dir . "/css/base.css", $dir . "/css/fontawesome/font-awesome.min.css", $dir . "/css/layout.css", $dir . "/css/typography.css");
Requirements::combine_files('Base.css', $BaseCSS);
$BaseJS = array($dir . "/javascript/jquery-1.9.1.min.js", $dir . "/javascript/scripts.js", $dir . "/javascript/dropdowns.js", $dir . "/javascript/responsive.js");
Requirements::combine_files('Base.js', $BaseJS);
if ($this->owner->ParsedPageCSS()) {
Requirements::combine_files($this->owner->ClassName . '.css', $this->owner->ParsedPageCSS());
}
if ($this->owner->ParsedPageJS()) {
Requirements::combine_files($this->owner->ClassName . '.js', $this->owner->ParsedPageJS());
}
if ($this->owner->CustomJS()) {
Requirements::customScript($this->owner->CustomJS());
}
if ($this->owner->ResponsiveCSS()) {
Requirements::combine_files('Responsive.css', $this->owner->ResponsiveCSS());
}
}