本文整理汇总了PHP中page_id_and_class函数的典型用法代码示例。如果您正苦于以下问题:PHP page_id_and_class函数的具体用法?PHP page_id_and_class怎么用?PHP page_id_and_class使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了page_id_and_class函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: url_get_path
function url_get_path()
{
global $CFG;
page_id_and_class($id, $class);
if ($id == PAGE_MY_MOODLE) {
return $CFG->wwwroot . '/my/index.php';
} elseif (defined('ADMIN_STICKYBLOCKS')) {
return $CFG->wwwroot . '/' . $CFG->admin . '/stickyblocks.php';
}
}
示例2: print_header
//.........这里部分代码省略.........
}
}
$meta = '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . "\n" . $meta . "\n";
if (!$usexml) {
@header('Content-Type: text/html; charset=utf-8');
}
@header('Content-Script-Type: text/javascript');
@header('Content-Style-Type: text/css');
//Accessibility: added the 'lang' attribute to $direction, used in theme <html> tag.
$direction = get_html_lang($dir = true);
if ($cache) {
// Allow caching on "back" (but not on normal clicks)
@header('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
@header('Pragma: no-cache');
@header('Expires: ');
} else {
// Do everything we can to always prevent clients and proxies caching
@header('Cache-Control: no-store, no-cache, must-revalidate');
@header('Cache-Control: post-check=0, pre-check=0', false);
@header('Pragma: no-cache');
@header('Expires: Mon, 20 Aug 1969 09:23:00 GMT');
@header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
$meta .= "\n<meta http-equiv=\"pragma\" content=\"no-cache\" />";
$meta .= "\n<meta http-equiv=\"expires\" content=\"0\" />";
}
@header('Accept-Ranges: none');
$currentlanguage = current_language();
if (empty($usexml)) {
$direction = ' xmlns="http://www.w3.org/1999/xhtml"' . $direction;
// See debug_header
} else {
$mathplayer = preg_match("/MathPlayer/i", $_SERVER['HTTP_USER_AGENT']);
if (!$mathplayer) {
header('Content-Type: application/xhtml+xml');
}
echo '<?xml version="1.0" ?>' . "\n";
if (!empty($CFG->xml_stylesheets)) {
$stylesheets = explode(';', $CFG->xml_stylesheets);
foreach ($stylesheets as $stylesheet) {
echo '<?xml-stylesheet type="text/xsl" href="' . $CFG->wwwroot . '/' . $stylesheet . '" ?>' . "\n";
}
}
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1';
if (!empty($CFG->xml_doctype_extra)) {
echo ' plus ' . $CFG->xml_doctype_extra;
}
echo '//' . strtoupper($currentlanguage) . '" "' . $CFG->xml_dtd . '">' . "\n";
$direction = " xmlns=\"http://www.w3.org/1999/xhtml\"\n xmlns:math=\"http://www.w3.org/1998/Math/MathML\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n {$direction}";
if ($mathplayer) {
$meta .= '<object id="mathplayer" classid="clsid:32F66A20-7614-11D4-BD11-00104BD3F987">' . "\n";
$meta .= '<!--comment required to prevent this becoming an empty tag-->' . "\n";
$meta .= '</object>' . "\n";
$meta .= '<?import namespace="math" implementation="#mathplayer" ?>' . "\n";
}
}
// Clean up the title
$title = format_string($title);
// fix for MDL-8582
$title = str_replace('"', '"', $title);
// Create class and id for this page
page_id_and_class($pageid, $pageclass);
$pageclass .= ' course-' . $COURSE->id;
if (!isloggedin()) {
$pageclass .= ' notloggedin';
}
if (!empty($USER->editing)) {
$pageclass .= ' editing';
}
if (!empty($CFG->blocksdrag)) {
$pageclass .= ' drag';
}
$pageclass .= ' dir-' . get_string('thisdirection');
$pageclass .= ' lang-' . $currentlanguage;
$bodytags .= ' class="' . $pageclass . '" id="' . $pageid . '"';
ob_start();
include $CFG->header;
$output = ob_get_contents();
ob_end_clean();
// container debugging info
$THEME->open_header_containers = open_containers();
// Skip to main content, see skip_main_destination().
if ($pageid == 'course-view' or $pageid == 'site-index' or $pageid == 'course-index') {
$skiplink = '<a class="skip" href="#maincontent">' . get_string('tocontent', 'access') . '</a>';
if (!preg_match('/(.*<div[^>]+id="page"[^>]*>)(.*)/s', $output, $matches)) {
preg_match('/(.*<body.*?>)(.*)/s', $output, $matches);
}
$output = $matches[1] . "\n" . $skiplink . $matches[2];
}
$output = force_strict_header($output);
if (!empty($CFG->messaging)) {
$output .= message_popup_window();
}
// Add in any extra JavaScript libraries that occurred during the header
$output .= require_js('', 2);
if ($return) {
return $output;
} else {
echo $output;
}
}
示例3: foreach
$feedback[9] = "'Message'";
$feedback[10] = "'Close this window'";
$js = '';
foreach ($feedback as $i => $str) {
$js .= 'FEEDBACK[' . $i . "] = {$str};\n";
}
$js = '<script type="text/javascript">' . "\n//<![CDATA[\n" . "FEEDBACK = new Array();\n" . $js . "//]]>\n</script>\n";
$hp->html = preg_replace('|</head>|i', "{$js}</head>", $hp->html, 1);
}
// insert hot-potatoes.js
$hp->insert_script(HOTPOT_JS);
// get Moodle pageid and pageclass
$pageid = '';
$pageclass = '';
if (function_exists('page_id_and_class')) {
page_id_and_class($pageid, $pageclass);
}
// extract first <head> tag
$head = '';
$pattern = '|<head([^>]*)>(.*?)</head>|is';
if (preg_match($pattern, $hp->html, $matches)) {
$head = $matches[2];
// remove <title>
$head = preg_replace('|<title[^>]*>(.*?)</title>|is', '', $head);
}
// extract <style> tags (and remove from $head)
$styles = '';
$pattern = '|<style([^>]*)>(.*?)</style>|is';
if (preg_match_all($pattern, $head, $matches)) {
$count = count($matches[0]);
for ($i = 0; $i < $count; $i++) {
示例4: construct
function construct()
{
page_id_and_class($this->body_id, $this->body_class);
}
示例5: print_header
//.........这里部分代码省略.........
$menu .= ' <font size="1">';
if (empty($count->accounts)) {
$menu .= get_string('failedloginattempts', '', $count);
} else {
$menu .= get_string('failedloginattemptsall', '', $count);
}
if (has_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
$menu .= ' (<a href="' . $CFG->wwwroot . '/course/report/log/index.php' . '?chooselog=1&id=1&modid=site_errors">' . get_string('logs') . '</a>)';
}
$menu .= '</font>';
}
}
}
}
$meta = '<meta http-equiv="content-type" content="text/html; charset=utf-8" />' . "\n" . $meta . "\n";
if (!$usexml) {
@header('Content-type: text/html; charset=utf-8');
}
//Accessibility: added the 'lang' attribute to $direction, used in theme <html> tag.
$direction = get_html_lang($dir = true);
if ($cache) {
// Allow caching on "back" (but not on normal clicks)
@header('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
@header('Pragma: no-cache');
@header('Expires: ');
} else {
// Do everything we can to always prevent clients and proxies caching
@header('Cache-Control: no-store, no-cache, must-revalidate');
@header('Cache-Control: post-check=0, pre-check=0', false);
@header('Pragma: no-cache');
@header('Expires: Mon, 20 Aug 1969 09:23:00 GMT');
@header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
$meta .= "\n<meta http-equiv=\"pragma\" content=\"no-cache\" />";
$meta .= "\n<meta http-equiv=\"expires\" content=\"0\" />";
}
@header('Accept-Ranges: none');
$currentlanguage = current_language();
if (empty($usexml)) {
$direction = ' xmlns="http://www.w3.org/1999/xhtml"' . $direction;
// See debug_header
} else {
$mathplayer = preg_match("/MathPlayer/i", $_SERVER['HTTP_USER_AGENT']);
if (!$mathplayer) {
header('Content-Type: application/xhtml+xml');
}
echo '<?xml version="1.0" ?>' . "\n";
if (!empty($CFG->xml_stylesheets)) {
$stylesheets = explode(';', $CFG->xml_stylesheets);
foreach ($stylesheets as $stylesheet) {
echo '<?xml-stylesheet type="text/xsl" href="' . $CFG->wwwroot . '/' . $stylesheet . '" ?>' . "\n";
}
}
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1';
if (!empty($CFG->xml_doctype_extra)) {
echo ' plus ' . $CFG->xml_doctype_extra;
}
echo '//' . strtoupper($currentlanguage) . '" "' . $CFG->xml_dtd . '">' . "\n";
$direction = " xmlns=\"http://www.w3.org/1999/xhtml\"\n xmlns:math=\"http://www.w3.org/1998/Math/MathML\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n {$direction}";
if ($mathplayer) {
$meta .= '<object id="mathplayer" classid="clsid:32F66A20-7614-11D4-BD11-00104BD3F987">' . "\n";
$meta .= '<!--comment required to prevent this becoming an empty tag-->' . "\n";
$meta .= '</object>' . "\n";
$meta .= '<?import namespace="math" implementation="#mathplayer" ?>' . "\n";
}
}
// Clean up the title
$title = format_string($title);
// fix for MDL-8582
$title = str_replace('"', '"', $title);
// Create class and id for this page
page_id_and_class($pageid, $pageclass);
$pageclass .= ' course-' . $COURSE->id;
if ($pageid != 'site-index' && $pageid != 'course-view' && strstr($pageid, 'admin') === FALSE) {
$pageclass .= ' nocoursepage';
}
if (!isloggedin()) {
$pageclass .= ' notloggedin';
}
if (!empty($USER->editing)) {
$pageclass .= ' editing';
}
if (!empty($CFG->blocksdrag)) {
$pageclass .= ' drag';
}
$pageclass .= ' lang-' . $currentlanguage;
$bodytags .= ' class="' . $pageclass . '" id="' . $pageid . '"';
ob_start();
include $CFG->header;
$output = ob_get_contents();
ob_end_clean();
$output = force_strict_header($output);
if (!empty($CFG->messaging)) {
$output .= message_popup_window();
}
if ($return) {
return $output;
} else {
echo $output;
}
}