本文整理汇总了PHP中theme_get_revision函数的典型用法代码示例。如果您正苦于以下问题:PHP theme_get_revision函数的具体用法?PHP theme_get_revision怎么用?PHP theme_get_revision使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了theme_get_revision函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_csswww
public function get_csswww()
{
global $CFG;
if (!$this->theme_essential_lte_ie9()) {
if (right_to_left()) {
$moodlecss = 'essential-rtl.css';
} else {
$moodlecss = 'essential.css';
}
$syscontext = context_system::instance();
$itemid = theme_get_revision();
$url = moodle_url::make_file_url("{$CFG->wwwroot}/pluginfile.php", "/{$syscontext->id}/theme_essential/style/{$itemid}/{$moodlecss}");
$url = preg_replace('|^https?://|i', '//', $url->out(false));
return '<link rel="stylesheet" href="' . $url . '">';
} else {
if (right_to_left()) {
$moodlecssone = 'essential-rtl_ie9-blessed1.css';
$moodlecsstwo = 'essential-rtl_ie9.css';
} else {
$moodlecssone = 'essential_ie9-blessed1.css';
$moodlecsstwo = 'essential_ie9.css';
}
$syscontext = context_system::instance();
$itemid = theme_get_revision();
$urlone = moodle_url::make_file_url("{$CFG->wwwroot}/pluginfile.php", "/{$syscontext->id}/theme_essential/style/{$itemid}/{$moodlecssone}");
$urlone = preg_replace('|^https?://|i', '//', $urlone->out(false));
$urltwo = moodle_url::make_file_url("{$CFG->wwwroot}/pluginfile.php", "/{$syscontext->id}/theme_essential/style/{$itemid}/{$moodlecsstwo}");
$urltwo = preg_replace('|^https?://|i', '//', $urltwo->out(false));
return '<link rel="stylesheet" href="' . $urlone . '"><link rel="stylesheet" href="' . $urltwo . '">';
}
}
开发者ID:blionut,项目名称:elearning,代码行数:31,代码来源:core_renderer_maintenance.php
示例2: get_mustache
/**
* Return an instance of the mustache class.
*
* @since 2.9
* @return Mustache_Engine
*/
protected function get_mustache()
{
global $CFG;
if ($this->mustache === null) {
require_once $CFG->dirroot . '/lib/mustache/src/Mustache/Autoloader.php';
Mustache_Autoloader::register();
$themename = $this->page->theme->name;
$themerev = theme_get_revision();
$cachedir = make_localcache_directory("mustache/{$themerev}/{$themename}");
$loader = new \core\output\mustache_filesystem_loader();
$stringhelper = new \core\output\mustache_string_helper();
$jshelper = new \core\output\mustache_javascript_helper($this->page->requires);
$pixhelper = new \core\output\mustache_pix_helper($this);
// We only expose the variables that are exposed to JS templates.
$safeconfig = $this->page->requires->get_config_for_javascript($this->page, $this);
$helpers = array('config' => $safeconfig, 'str' => array($stringhelper, 'str'), 'js' => array($jshelper, 'help'), 'pix' => array($pixhelper, 'pix'));
$this->mustache = new Mustache_Engine(array('cache' => $cachedir, 'escape' => 's', 'loader' => $loader, 'helpers' => $helpers, 'pragmas' => [Mustache_Engine::PRAGMA_BLOCKS]));
}
return $this->mustache;
}
开发者ID:alanaipe2015,项目名称:moodle,代码行数:26,代码来源:outputrenderers.php
示例3: get_csswww
static public function get_csswww() {
global $CFG;
if (!self::lte_ie9()) {
if (\right_to_left()) {
$moodlecss = 'essential-rtl.css';
} else {
$moodlecss = 'essential.css';
}
$syscontext = \context_system::instance();
$itemid = \theme_get_revision();
$url = \moodle_url::make_file_url("$CFG->wwwroot/pluginfile.php",
"/$syscontext->id/theme_essential/style/$itemid/$moodlecss");
$url = preg_replace('|^https?://|i', '//', $url->out(false));
return '<link rel="stylesheet" href="' . $url . '">';
} else {
if (\right_to_left()) {
$moodlecssone = 'essential-rtl_ie9-blessed1.css';
$moodlecsstwo = 'essential-rtl_ie9.css';
} else {
$moodlecssone = 'essential_ie9-blessed1.css';
$moodlecsstwo = 'essential_ie9.css';
}
$syscontext = \context_system::instance();
$itemid = \theme_get_revision();
$urlone = \moodle_url::make_file_url("$CFG->wwwroot/pluginfile.php",
"/$syscontext->id/theme_essential/style/$itemid/$moodlecssone");
$urlone = preg_replace('|^https?://|i', '//', $urlone->out(false));
$urltwo = \moodle_url::make_file_url("$CFG->wwwroot/pluginfile.php",
"/$syscontext->id/theme_essential/style/$itemid/$moodlecsstwo");
$urltwo = preg_replace('|^https?://|i', '//', $urltwo->out(false));
return '<link rel="stylesheet" href="'.$urlone . '"><link rel="stylesheet" href="'.$urltwo.'">';
}
}
开发者ID:syedhameed,项目名称:sc,代码行数:36,代码来源:toolbox.php
示例4: core_admin_pluginfile
/**
* File serving.
*
* @param stdClass $course The course object.
* @param stdClass $cm The cm object.
* @param context $context The context object.
* @param string $filearea The file area.
* @param array $args List of arguments.
* @param bool $forcedownload Whether or not to force the download of the file.
* @param array $options Array of options.
* @return void|false
*/
function core_admin_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array())
{
global $CFG;
if (in_array($filearea, ['logo', 'logocompact'])) {
$size = array_shift($args);
// The path hides the size.
$itemid = clean_param(array_shift($args), PARAM_INT);
$filename = clean_param(array_shift($args), PARAM_FILE);
$themerev = theme_get_revision();
if ($themerev <= 0) {
// Normalise to 0 as -1 doesn't place well with paths.
$themerev = 0;
}
// Extract the requested width and height.
$maxwidth = 0;
$maxheight = 0;
if (preg_match('/^\\d+x\\d+$/', $size)) {
list($maxwidth, $maxheight) = explode('x', $size);
$maxwidth = clean_param($maxwidth, PARAM_INT);
$maxheight = clean_param($maxheight, PARAM_INT);
}
$lifetime = 0;
if ($itemid > 0 && $themerev == $itemid) {
// The itemid is $CFG->themerev, when 0 or less no caching. Also no caching when they don't match.
$lifetime = DAYSECS * 60;
}
// Anyone, including guests and non-logged in users, can view the logos.
$options = ['cacheability' => 'public'];
// Check if we've got a cached file to return. When lifetime is 0 then we don't want to cached one.
$candidate = $CFG->localcachedir . "/core_admin/{$themerev}/{$filearea}/{$maxwidth}x{$maxheight}/{$filename}";
if (file_exists($candidate) && $lifetime > 0) {
send_file($candidate, $filename, $lifetime, 0, false, false, '', false, $options);
}
// Find the original file.
$fs = get_file_storage();
$filepath = "/{$context->id}/core_admin/{$filearea}/0/{$filename}";
if (!($file = $fs->get_file_by_hash(sha1($filepath)))) {
send_file_not_found();
}
// No need for resizing, but if the file should be cached we save it so we can serve it fast next time.
if (empty($maxwidth) && empty($maxheight)) {
if ($lifetime) {
file_safe_save_content($file->get_content(), $candidate);
}
send_stored_file($file, $lifetime, 0, false, $options);
}
// Proceed with the resizing.
$filedata = $file->resize_image($maxwidth, $maxheight);
if (!$filedata) {
send_file_not_found();
}
// If we don't want to cached the file, serve now and quit.
if (!$lifetime) {
send_content_uncached($filedata, $filename);
}
// Save, serve and quit.
file_safe_save_content($filedata, $candidate);
send_file($candidate, $filename, $lifetime, 0, false, false, '', false, $options);
}
send_file_not_found();
}
开发者ID:evltuma,项目名称:moodle,代码行数:73,代码来源:lib.php
示例5: init_requirements_data
/**
* Initialise with the bits of JavaScript that every Moodle page should have.
*
* @param moodle_page $page
* @param core_renderer $renderer
*/
protected function init_requirements_data(moodle_page $page, core_renderer $renderer)
{
global $CFG;
// JavaScript should always work with $CFG->httpswwwroot rather than $CFG->wwwroot.
// Otherwise, in some situations, users will get warnings about insecure content
// on secure pages from their web browser.
$this->M_cfg = array('wwwroot' => $CFG->httpswwwroot, 'sesskey' => sesskey(), 'loadingicon' => $renderer->pix_url('i/loading_small', 'moodle')->out(false), 'themerev' => theme_get_revision(), 'slasharguments' => (int) (!empty($CFG->slasharguments)), 'theme' => $page->theme->name, 'jsrev' => (empty($CFG->cachejs) or empty($CFG->jsrev)) ? -1 : $CFG->jsrev, 'svgicons' => $page->theme->use_svg_icons());
if (debugging('', DEBUG_DEVELOPER)) {
$this->M_cfg['developerdebug'] = true;
}
if (defined('BEHAT_SITE_RUNNING')) {
$this->M_cfg['behatsiterunning'] = true;
}
// Accessibility stuff.
$this->skip_link_to('maincontent', get_string('tocontent', 'access'));
// Add strings used on many pages.
$this->string_for_js('confirmation', 'admin');
$this->string_for_js('cancel', 'moodle');
$this->string_for_js('yes', 'moodle');
// Alter links in top frame to break out of frames.
if ($page->pagelayout === 'frametop') {
$this->js_init_call('M.util.init_frametop');
}
// Include block drag/drop if editing is on
if ($page->user_is_editing()) {
$params = array('courseid' => $page->course->id, 'pagetype' => $page->pagetype, 'pagelayout' => $page->pagelayout, 'subpage' => $page->subpage, 'regions' => $page->blocks->get_regions(), 'contextid' => $page->context->id);
if (!empty($page->cm->id)) {
$params['cmid'] = $page->cm->id;
}
$page->requires->yui_module('moodle-core-blocks', 'M.core_blocks.init_dragdrop', array($params), null, true);
}
}
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:38,代码来源:outputrequirementslib.php
示例6: init_requirements_data
/**
* Initialise with the bits of JavaScript that every Moodle page should have.
*
* @param moodle_page $page
* @param core_renderer $output
*/
protected function init_requirements_data(moodle_page $page, core_renderer $renderer)
{
global $CFG;
// JavaScript should always work with $CFG->httpswwwroot rather than $CFG->wwwroot.
// Otherwise, in some situations, users will get warnings about insecure content
// on secure pages from their web browser.
$this->M_cfg = array('wwwroot' => $CFG->httpswwwroot, 'sesskey' => sesskey(), 'loadingicon' => $renderer->pix_url('i/loading_small', 'moodle')->out(false), 'themerev' => theme_get_revision(), 'theme' => $page->theme->name, 'jsrev' => (empty($CFG->cachejs) or empty($CFG->jsrev)) ? -1 : $CFG->jsrev);
if (debugging('', DEBUG_DEVELOPER)) {
$this->M_cfg['developerdebug'] = true;
$this->yui2_lib('logger');
}
// accessibility stuff
$this->skip_link_to('maincontent', get_string('tocontent', 'access'));
// to be removed soon
$this->yui2_lib('dom');
// at least javascript-static.js needs to be migrated to YUI3
$this->string_for_js('confirmation', 'admin');
$this->string_for_js('cancel', 'moodle');
$this->string_for_js('yes', 'moodle');
if ($page->pagelayout === 'frametop') {
$this->js_init_call('M.util.init_frametop');
}
}
开发者ID:richheath,项目名称:moodle,代码行数:29,代码来源:outputrequirementslib.php
示例7: get_compact_logo_url
/**
* Return the site's compact logo URL, if any.
*
* @param int $maxwidth The maximum width, or null when the maximum width does not matter.
* @param int $maxheight The maximum height, or null when the maximum height does not matter.
* @return moodle_url|false
*/
public function get_compact_logo_url($maxwidth = 100, $maxheight = 100)
{
global $CFG;
$logo = get_config('core_admin', 'logocompact');
if (empty($logo)) {
return false;
}
// Hide the requested size in the file path.
$filepath = (int) $maxwidth . 'x' . (int) $maxheight . '/';
// Use $CFG->themerev to prevent browser caching when the file changes.
return moodle_url::make_pluginfile_url(context_system::instance()->id, 'core_admin', 'logocompact', $filepath, theme_get_revision(), $logo);
}
开发者ID:dg711,项目名称:moodle,代码行数:19,代码来源:outputrenderers.php
示例8: get_config_for_javascript
/**
* Return the safe config values that get set for javascript in "M.cfg".
*
* @since 2.9
* @return array List of safe config values that are available to javascript.
*/
public function get_config_for_javascript(moodle_page $page, renderer_base $renderer)
{
global $CFG;
if (empty($this->M_cfg)) {
// JavaScript should always work with $CFG->httpswwwroot rather than $CFG->wwwroot.
// Otherwise, in some situations, users will get warnings about insecure content
// on secure pages from their web browser.
$this->M_cfg = array('wwwroot' => $CFG->httpswwwroot, 'sesskey' => sesskey(), 'loadingicon' => $renderer->pix_url('i/loading_small', 'moodle')->out(false), 'themerev' => theme_get_revision(), 'slasharguments' => (int) (!empty($CFG->slasharguments)), 'theme' => $page->theme->name, 'jsrev' => $this->get_jsrev(), 'admin' => $CFG->admin, 'svgicons' => $page->theme->use_svg_icons());
if ($CFG->debugdeveloper) {
$this->M_cfg['developerdebug'] = true;
}
if (defined('BEHAT_SITE_RUNNING')) {
$this->M_cfg['behatsiterunning'] = true;
}
}
return $this->M_cfg;
}
开发者ID:rsturley,项目名称:moodle,代码行数:23,代码来源:outputrequirementslib.php
示例9: setting_file_url
/**
* Returns URL to the stored file via pluginfile.php.
*
* Note the theme must also implement pluginfile.php handler,
* theme revision is used instead of the itemid.
*
* @param string $setting
* @param string $filearea
* @return string protocol relative URL or null if not present
*/
public function setting_file_url($setting, $filearea)
{
global $CFG;
if (empty($this->settings->{$setting})) {
return null;
}
$component = 'theme_' . $this->name;
$itemid = theme_get_revision();
$filepath = $this->settings->{$setting};
$syscontext = context_system::instance();
$url = moodle_url::make_file_url("{$CFG->wwwroot}/pluginfile.php", "/{$syscontext->id}/{$component}/{$filearea}/{$itemid}" . $filepath);
// Now this is tricky because the we can not hardcode http or https here, lets use the relative link.
// Note: unfortunately moodle_url does not support //urls yet.
$url = preg_replace('|^https?://|i', '//', $url->out(false));
return $url;
}
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:26,代码来源:outputlib.php
示例10: js_send_unmodified
if ($rev > 0 and file_exists($candidate)) {
if (!empty($_SERVER['HTTP_IF_NONE_MATCH']) || !empty($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
// we do not actually need to verify the etag value because our files
// never change in cache because we increment the rev parameter
js_send_unmodified(filemtime($candidate), $etag);
}
js_send_cached($candidate, $etag);
}
//=================================================================================
// ok, now we need to start normal moodle script, we need to load all libs and $DB
define('ABORT_AFTER_CONFIG_CANCEL', true);
define('NO_MOODLE_COOKIES', true);
// Session not used here
define('NO_UPGRADE_CHECK', true);
// Ignore upgrade check
require "{$CFG->dirroot}/lib/setup.php";
$theme = theme_config::load($themename);
$themerev = theme_get_revision();
if ($themerev <= 0 or $rev != $themerev) {
// Do not send caching headers if they do not request current revision,
// we do not want to pollute browser caches with outdated JS.
js_send_uncached($theme->javascript_content($type));
}
make_localcache_directory('theme', false);
js_write_cache_file_content($candidate, core_minify::js_files($theme->javascript_files($type)));
// Verify nothing failed in cache file creation.
clearstatcache();
if (file_exists($candidate)) {
js_send_cached($candidate, $etag);
}
js_send_uncached($theme->javascript_content($type));
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:javascript.php
示例11: init_requirements_data
/**
* Initialise with the bits of JavaScript that every Moodle page should have.
*
* @param moodle_page $page
* @param core_renderer $renderer
*/
protected function init_requirements_data(moodle_page $page, core_renderer $renderer)
{
global $CFG;
// JavaScript should always work with $CFG->httpswwwroot rather than $CFG->wwwroot.
// Otherwise, in some situations, users will get warnings about insecure content
// on secure pages from their web browser.
$this->M_cfg = array('wwwroot' => $CFG->httpswwwroot, 'sesskey' => sesskey(), 'loadingicon' => $renderer->pix_url('i/loading_small', 'moodle')->out(false), 'themerev' => theme_get_revision(), 'slasharguments' => (int) (!empty($CFG->slasharguments)), 'theme' => $page->theme->name, 'jsrev' => (empty($CFG->cachejs) or empty($CFG->jsrev)) ? -1 : $CFG->jsrev);
if (debugging('', DEBUG_DEVELOPER)) {
$this->M_cfg['developerdebug'] = true;
}
// Accessibility stuff.
$this->skip_link_to('maincontent', get_string('tocontent', 'access'));
// Add strings used on many pages.
$this->string_for_js('confirmation', 'admin');
$this->string_for_js('cancel', 'moodle');
$this->string_for_js('yes', 'moodle');
// Alter links in top frame to break out of frames.
if ($page->pagelayout === 'frametop') {
$this->js_init_call('M.util.init_frametop');
}
}
开发者ID:JP-Git,项目名称:moodle,代码行数:27,代码来源:outputrequirementslib.php
示例12: pix_url
/**
* Return the URL for an image
*
* @param string $imagename the name of the icon.
* @param string $component specification of one plugin like in get_string()
* @return moodle_url
*/
public function pix_url($imagename, $component)
{
global $CFG;
$params = array('theme' => $this->name);
if (empty($component) or $component === 'moodle' or $component === 'core') {
$params['component'] = 'core';
} else {
$params['component'] = $component;
}
$rev = theme_get_revision();
if ($rev != -1) {
$params['rev'] = $rev;
}
$params['image'] = $imagename;
if (!empty($CFG->slasharguments) and $rev > 0) {
$url = new moodle_url("{$CFG->httpswwwroot}/theme/image.php");
$url->set_slashargument('/' . $params['theme'] . '/' . $params['component'] . '/' . $params['rev'] . '/' . $params['image'], 'noparam', true);
} else {
$url = new moodle_url("{$CFG->httpswwwroot}/theme/image.php", $params);
}
return $url;
}
开发者ID:nicusX,项目名称:moodle,代码行数:29,代码来源:outputlib.php
示例13: pix_url
/**
* Return the URL for an image
*
* @param string $imagename the name of the icon.
* @param string $component specification of one plugin like in get_string()
* @return moodle_url
*/
public function pix_url($imagename, $component)
{
global $CFG;
$params = array('theme' => $this->name);
$svg = $this->use_svg_icons();
if (empty($component) or $component === 'moodle' or $component === 'core') {
$params['component'] = 'core';
} else {
$params['component'] = $component;
}
$rev = theme_get_revision();
if ($rev != -1) {
$params['rev'] = $rev;
}
$params['image'] = $imagename;
$url = new moodle_url("{$CFG->httpswwwroot}/theme/image.php");
if (!empty($CFG->slasharguments) and $rev > 0) {
$path = '/' . $params['theme'] . '/' . $params['component'] . '/' . $params['rev'] . '/' . $params['image'];
if (!$svg) {
// We add a simple /_s to the start of the path.
// The underscore is used to ensure that it isn't a valid theme name.
$path = '/_s' . $path;
}
$url->set_slashargument($path, 'noparam', true);
} else {
if (!$svg) {
// We add an SVG param so that we know not to serve SVG images.
// We do this because all modern browsers support SVG and this param will one day be removed.
$params['svg'] = '0';
}
$url->params($params);
}
return $url;
}
开发者ID:Burick,项目名称:moodle,代码行数:41,代码来源:outputlib.php
示例14: get_mustache
/**
* Return an instance of the mustache class.
*
* @since 2.9
* @return Mustache_Engine
*/
protected function get_mustache()
{
global $CFG;
if ($this->mustache === null) {
require_once $CFG->dirroot . '/lib/mustache/src/Mustache/Autoloader.php';
Mustache_Autoloader::register();
$themename = $this->page->theme->name;
$themerev = theme_get_revision();
$target = $this->target;
$cachedir = make_localcache_directory("mustache/{$themerev}/{$themename}/{$target}");
$loaderoptions = array();
// Where are all the places we should look for templates?
$suffix = $this->component;
if ($this->subtype !== null) {
$suffix .= '_' . $this->subtype;
}
// Start with an empty list.
$loader = new Mustache_Loader_CascadingLoader(array());
$loaderdir = $CFG->dirroot . '/theme/' . $themename . '/templates/' . $suffix;
if (is_dir($loaderdir)) {
$loader->addLoader(new \core\output\mustache_filesystem_loader($loaderdir, $loaderoptions));
}
// Search each of the parent themes second.
foreach ($this->page->theme->parents as $parent) {
$loaderdir = $CFG->dirroot . '/theme/' . $parent . '/templates/' . $suffix;
if (is_dir($loaderdir)) {
$loader->addLoader(new \core\output\mustache_filesystem_loader($loaderdir, $loaderoptions));
}
}
// Look in a components templates dir for a base implementation.
$compdirectory = core_component::get_component_directory($suffix);
if ($compdirectory) {
$loaderdir = $compdirectory . '/templates';
if (is_dir($loaderdir)) {
$loader->addLoader(new \core\output\mustache_filesystem_loader($loaderdir, $loaderoptions));
}
}
// Look in the core templates dir as a final fallback.
$compdirectory = $CFG->libdir;
if ($compdirectory) {
$loaderdir = $compdirectory . '/templates';
if (is_dir($loaderdir)) {
$loader->addLoader(new \core\output\mustache_filesystem_loader($loaderdir, $loaderoptions));
}
}
$stringhelper = new \core\output\mustache_string_helper();
$jshelper = new \core\output\mustache_javascript_helper($this->page->requires);
$pixhelper = new \core\output\mustache_pix_helper($this);
// We only expose the variables that are exposed to JS templates.
$safeconfig = $this->page->requires->get_config_for_javascript($this->page, $this);
$helpers = array('config' => $safeconfig, 'str' => array($stringhelper, 'str'), 'js' => array($jshelper, 'help'), 'pix' => array($pixhelper, 'pix'));
$this->mustache = new Mustache_Engine(array('cache' => $cachedir, 'escape' => 's', 'loader' => $loader, 'helpers' => $helpers));
}
return $this->mustache;
}
开发者ID:Hirenvaghasiya,项目名称:moodle,代码行数:61,代码来源:outputrenderers.php
注:本文中的theme_get_revision函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论