本文整理汇总了PHP中style_sheet_setup函数的典型用法代码示例。如果您正苦于以下问题:PHP style_sheet_setup函数的具体用法?PHP style_sheet_setup怎么用?PHP style_sheet_setup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了style_sheet_setup函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: basename
<?php
/* $Id: styles.php,v 1.8 2006/04/07 15:07:54 moodler Exp $ */
/// Every theme should contain a copy of this script. It lets us
/// set up variables and so on before we include the raw CSS files.
/// The output of this script should be a completely standard CSS file.
/// THERE SHOULD BE NO NEED TO MODIFY THIS FILE!! USE CONFIG.PHP INSTEAD.
$lifetime = 600;
// Seconds to cache this stylesheet
$nomoodlecookie = true;
// Cookies prevent caching, so don't use them
require_once "../../config.php";
// Load up the Moodle libraries
$themename = basename(dirname(__FILE__));
// Name of the folder we are in
$forceconfig = optional_param('forceconfig', '', PARAM_FILE);
// Get config from this theme
style_sheet_setup(time(), $lifetime, $themename, $forceconfig);
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:18,代码来源:styles.php
示例2: header
* string or suiable error code. If not, it redirects the user back to
* where they came from. (2)
*
* @package blocks-accessibility (3)
* @copyright 2009 Mark Johnson (4)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later (5)
*/
require_once '../../config.php';
require_once $CFG->dirroot . '/blocks/accessibility/lib.php';
header('Cache-Control: no-cache');
if (!isset($USER->defaultfontsize)) {
ob_start();
// Buffer the output so we're not really creating a stylesheet.
style_sheet_setup(time(), 0, 'standard');
// Generate the stylesheets for the base and current themes
style_sheet_setup(time(), 0, $CFG->theme);
$styles = ob_get_contents();
// Get the generated sheets from the buffer
ob_end_clean();
$size = array();
if (preg_match('/body\\s?\\{[^\\}]*font[^:]*:([\\d]{1,3})(px|%)[^\\}]*}/', $styles, $size) > 0) {
// If there's a value in the stylesheet for the font size in pixels or percent
$defaultsize = $size[1];
// use it
} else {
$defaultsize = 100;
// Otherwise, use 100 as a sensible default
}
if ($size[2] == '%' || $defaultsize == 100) {
$USER->defaultfontsize = get_size($defaultsize);
} else {
开发者ID:henriquecrang,项目名称:e-UNI,代码行数:31,代码来源:changesize.php
示例3: optional_param
<?php
/* $Id: docstyles.php,v 1.1 2009/12/21 00:54:52 michaelpenne Exp $ */
/// We use PHP so we can do value substitutions into the styles
$nomoodlecookie = true;
require_once "../../config.php";
$themename = optional_param('themename', NULL, PARAM_SAFEDIR);
$themeurl = style_sheet_setup(filemtime("styles.php"), 300, $themename);
///
/// You can hardcode colours in this file if you
/// don't care about this.
?>
body {
background-color:#FFFFFF;
}
p, a {
font-size:small;
}
h1, h2, h3 {
padding-left:0px;
background-color:transparent;
color:#000000;
}
h1 {
font-size:1.7em;
margin:0.5em 0 0;
}
h2 {
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:docstyles.php
示例4: page_theme_process_styles
/**
* Collects all styles that would be included in calls to styles.php
* from the various themes (standard, parent, current, etc).
*
* @return void
**/
function page_theme_process_styles($lifetime = 300, $forceconfig = '', $lang = '')
{
global $CFG, $THEME;
if (!empty($forceconfig)) {
$current = $forceconfig;
} else {
$current = current_theme();
}
// Determine if we need to Refresh the client cached stylesheet
$headers = apache_request_headers();
$lastmodified = filemtime($CFG->themedir . '/.');
// themes change means styles are modified
$timestamp = time();
$ETag = '' . ($timestamp - $timestamp % 3600);
// Rounded to the hour
if (isset($headers['If-None-Match']) and isset($headers['If-Modified-Since']) and strpos($headers['If-None-Match'], "{$ETag}") and gmdate("D, d M Y H:i:s", $lastmodified) == $headers['If-Modified-Since']) {
// Send Not Modified headers with the same info as in style_sheet_setup
header('HTTP/1.1 304 Not Modified');
header('Last-Modified: ' . gmdate("D, d M Y H:i:s", $lastmodified) . ' GMT');
header('Expires: ' . gmdate("D, d M Y H:i:s", time() + $lifetime) . ' GMT');
header('Cache-Control: max-age=' . $lifetime);
header('Pragma: ');
header('Content-type: text/css');
// Correct MIME type
header('ETag: "' . $ETag . '"');
exit;
} else {
// Refresh the contents
/// Process Style Sheets --------------------------------------------------
ob_start();
style_sheet_setup(time(), $lifetime, 'standard', $forceconfig, $lang);
$standard = ob_get_contents();
ob_end_clean();
// Replace relative strings in standard
$css = page_theme_fix_relative_urls($standard, 'standard');
theme_setup($current);
$css .= "/**************************************\n";
$css .= " * THEME NAME: {$current} and parents *\n";
$css .= " **************************************/\n\n";
$parentsheets = page_theme_get_parent_styles($current);
foreach ($parentsheets as $themename => $styles) {
if ($themename == 'page') {
$fixurls = false;
} else {
$fixurls = true;
}
$css .= page_theme_combine_css($styles, $themename, $fixurls);
}
$css .= page_theme_combine_css($THEME->sheets, $current, $current != 'page');
/// END Process Style Sheets ----------------------------------------------
// Append Necessary Headers for proper caching
header('Content-length: ' . strlen($css));
header('Last-Modified: ' . gmdate("D, d M Y H:i:s", $lastmodified));
header('ETag: "' . $ETag . '"');
echo $css;
// Now that header information is done send contents
}
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:64,代码来源:lib.php
注:本文中的style_sheet_setup函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论