__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core\output;
use coding_exception;
/**
* This class solves the problem of how to initialise $OUTPUT.
*
* The problem is caused be two factors
* <ol>
* <li>On the one hand, we cannot be sure when output will start. In particular,
* an error, which needs to be displayed, could be thrown at any time.</li>
* <li>On the other hand, we cannot be sure when we will have all the information
* necessary to correctly initialise $OUTPUT. $OUTPUT depends on the theme, which
* (potentially) depends on the current course, course categories, and logged in user.
* It also depends on whether the current page requires HTTPS.</li>
* </ol>
*
* So, it is hard to find a single natural place during Moodle script execution,
* which we can guarantee is the right time to initialise $OUTPUT. Instead we
* adopt the following strategy
* <ol>
* <li>We will initialise $OUTPUT the first time it is used.</li>
* <li>If, after $OUTPUT has been initialised, the script tries to change something
* that $OUTPUT depends on, we throw an exception making it clear that the script
* did something wrong.
* </ol>
*
* The only problem with that is, how do we initialise $OUTPUT on first use if,
* it is going to be used like $OUTPUT->somthing(...)? Well that is where this
* class comes in. Initially, we set up $OUTPUT = new bootstrap_renderer(). Then,
* when any method is called on that object, we initialise $OUTPUT, and pass the call on.
*
* Note that this class is used before lib/outputlib.php has been loaded, so we
* must be careful referring to classes/functions from there, they may not be
* defined yet, and we must avoid fatal errors.
*
* @package core
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since Moodle 2.0
*/
class bootstrap_renderer {
/**
* Handles re-entrancy. Without this, errors or debugging output that occur
* during the initialisation of $OUTPUT, cause infinite recursion.
*
* @var bool
*/
protected $initialising = false;
/**
* Whether output has started yet.
*
* @return bool true if the header has been printed.
*/
public function has_started() {
return false;
}
/**
* Constructor - to be used by core code only.
*
* @param string $method The method to call
* @param array $arguments Arguments to pass to the method being called
* @return string
*/
public function __call($method, $arguments) {
// phpcs:disable moodle.PHP.ForbiddenGlobalUse.BadGlobal
global $OUTPUT, $PAGE;
$recursing = false;
if ($method == 'notification') {
// Catch infinite recursion caused by debugging output during print_header.
// phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection
$backtrace = debug_backtrace();
array_shift($backtrace);
array_shift($backtrace);
$recursing = is_early_init($backtrace);
}
$earlymethods = [
'fatal_error' => 'early_error',
'notification' => 'early_notification',
];
// If lib/outputlib.php has been loaded, call it.
if (!empty($PAGE) && !$recursing) {
if (array_key_exists($method, $earlymethods)) {
// Prevent PAGE->context warnings - exceptions might appear before we set any context.
$PAGE->set_context(null);
}
$PAGE->initialise_theme_and_output();
return call_user_func_array([$OUTPUT, $method], $arguments);
}
$this->initialising = true;
// Too soon to initialise $OUTPUT, provide a couple of key methods.
if (array_key_exists($method, $earlymethods)) {
return call_user_func_array([self::class, $earlymethods[$method]], $arguments);
}
throw new coding_exception('Attempt to start output before enough information is known to initialise the theme.');
}
/**
* Returns nicely formatted error message in a div box.
*
* @param string $message error message
* @param ?string $moreinfourl (ignored in early errors)
* @param ?string $link (ignored in early errors)
* @param ?array $backtrace
* @param ?string $debuginfo
* @return string
*/
public static function early_error_content($message, $moreinfourl, $link, $backtrace, $debuginfo = null) {
global $CFG;
$content = "<div class='alert-danger'>$message</div>";
// Check whether debug is set.
$debug = (!empty($CFG->debug) && $CFG->debug >= DEBUG_DEVELOPER);
// Also check we have it set in the config file. This occurs if the method to read the config table from the
// database fails, reading from the config table is the first database interaction we have.
$debug = $debug || (!empty($CFG->config_php_settings['debug']) && $CFG->config_php_settings['debug'] >= DEBUG_DEVELOPER );
if ($debug) {
if (!empty($debuginfo)) {
// Remove all nasty JS.
if (function_exists('s')) { // Function may be not available for some early errors.
$debuginfo = s($debuginfo);
} else {
// Because weblib is not available for these early errors, we
// just duplicate s() code here to be safe.
$debuginfo = preg_replace(
'/&#(\d+|x[0-9a-f]+);/i',
'&#$1;',
htmlspecialchars($debuginfo, ENT_QUOTES | ENT_HTML401 | ENT_SUBSTITUTE)
);
}
$debuginfo = str_replace("\n", '<br />', $debuginfo); // Keep newlines.
$content .= '<div class="notifytiny">Debug info: ' . $debuginfo . '</div>';
}
if (!empty($backtrace)) {
$content .= '<div class="notifytiny">Stack trace: ' . format_backtrace($backtrace, false) . '</div>';
}
}
return $content;
}
/**
* This function should only be called by this class, or from exception handlers
*
* @param string $message error message
* @param string $moreinfourl (ignored in early errors)
* @param string $link (ignored in early errors)
* @param array $backtrace
* @param string $debuginfo extra information for developers
* @return ?string
*/
public static function early_error($message, $moreinfourl, $link, $backtrace, $debuginfo = null, $errorcode = null) {
global $CFG;
if (CLI_SCRIPT) {
echo "!!! $message !!!\n";
if (!empty($CFG->debug) && $CFG->debug >= DEBUG_DEVELOPER) {
if (!empty($debuginfo)) {
echo "\nDebug info: $debuginfo";
}
if (!empty($backtrace)) {
echo "\nStack trace: " . format_backtrace($backtrace, true);
}
}
return;
} else if (AJAX_SCRIPT) {
$error = (object) [
'error' => $message,
'stacktrace' => null,
'debuginfo' => null,
'errorcode' => $errorcode,
];
if (!empty($CFG->debug) && $CFG->debug >= DEBUG_DEVELOPER) {
if (!empty($debuginfo)) {
$error->debuginfo = $debuginfo;
}
if (!empty($backtrace)) {
$error->stacktrace = format_backtrace($backtrace, true);
}
}
@header('Content-Type: application/json; charset=utf-8');
echo json_encode($error);
return;
}
// In the name of protocol correctness, monitoring and performance
// profiling, set the appropriate error headers for machine consumption.
$protocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0');
@header($protocol . ' 500 Internal Server Error');
// Better disable any caching.
@header('Content-Type: text/html; charset=utf-8');
@header('X-UA-Compatible: IE=edge');
@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');
if (function_exists('get_string')) {
$strerror = get_string('error');
} else {
$strerror = 'Error';
}
$content = self::early_error_content($message, $moreinfourl, $link, $backtrace, $debuginfo);
return self::plain_page($strerror, $content);
}
/**
* Early notification message
*
* @param string $message
* @param string $classes usually notifyproblem or notifysuccess
* @return string
*/
public static function early_notification($message, $classes = 'notifyproblem') {
return '<div class="' . $classes . '">' . $message . '</div>';
}
/**
* Page should redirect message.
*
* @param string $encodedurl redirect url
* @return string
*/
public static function plain_redirect_message($encodedurl) {
$message = '<div style="margin-top: 3em; margin-left:auto; margin-right:auto; text-align:center;">';
$message .= get_string('pageshouldredirect') . '<br /><a href="';
$message .= $encodedurl . '">' . get_string('continue') . '</a></div>';
return self::plain_page(get_string('redirect'), $message);
}
/**
* Early redirection page, used before full init of $PAGE global.
*
* @param string $encodedurl redirect url
* @param string $message redirect message
* @param int $delay time in seconds
* @return string redirect page
*/
public static function early_redirect_message($encodedurl, $message, $delay) {
$meta = '<meta http-equiv="refresh" content="' . $delay . '; url=' . $encodedurl . '" />';
$content = self::early_error_content($message, null, null, null);
$content .= self::plain_redirect_message($encodedurl);
return self::plain_page(get_string('redirect'), $content, $meta);
}
/**
* Output basic html page.
*
* @param string $title page title
* @param string $content page content
* @param string $meta meta tag
* @return string html page
*/
public static function plain_page($title, $content, $meta = '') {
global $CFG;
if (function_exists('get_string') && function_exists('get_html_lang')) {
$htmllang = get_html_lang();
} else {
$htmllang = '';
}
$footer = '';
if (function_exists('get_performance_info')) { // Function may be not available for some early errors.
if (MDL_PERF_TEST) {
$perfinfo = get_performance_info();
$footer = '<footer>' . $perfinfo['html'] . '</footer>';
}
}
ob_start();
include($CFG->dirroot . '/error/plainpage.php');
$html = ob_get_contents();
ob_end_clean();
return $html;
}
}
// Alias this class to the old name.
// This file will be autoloaded by the legacyclasses autoload system.
// In future all uses of this class will be corrected and the legacy references will be removed.
class_alias(bootstrap_renderer::class, \bootstrap_renderer::class);
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| action_menu | Folder | 0777 |
|
|
| actions | Folder | 0777 |
|
|
| dynamic_tabs | Folder | 0777 |
|
|
| local | Folder | 0777 |
|
|
| progress_trace | Folder | 0777 |
|
|
| renderer_factory | Folder | 0777 |
|
|
| requirements | Folder | 0777 |
|
|
| action_link.php | File | 4.86 KB | 0777 |
|
| action_menu.php | File | 23.57 KB | 0777 |
|
| activity_header.php | File | 8.63 KB | 0777 |
|
| bootstrap_renderer.php | File | 12.05 KB | 0777 |
|
| checkbox_toggleall.php | File | 4.93 KB | 0777 |
|
| choicelist.php | File | 9.42 KB | 0777 |
|
| chooser.php | File | 3.78 KB | 0777 |
|
| chooser_item.php | File | 3.12 KB | 0777 |
|
| chooser_section.php | File | 2.25 KB | 0777 |
|
| comboboxsearch.php | File | 6.74 KB | 0777 |
|
| context_header.php | File | 6.01 KB | 0777 |
|
| core_renderer.php | File | 194.2 KB | 0777 |
|
| core_renderer_ajax.php | File | 5.7 KB | 0777 |
|
| core_renderer_cli.php | File | 9.34 KB | 0777 |
|
| core_renderer_maintenance.php | File | 7.86 KB | 0777 |
|
| custom_menu.php | File | 7.03 KB | 0777 |
|
| custom_menu_item.php | File | 7.88 KB | 0777 |
|
| datafilter.php | File | 3.45 KB | 0777 |
|
| dynamic_tabs.php | File | 2.26 KB | 0777 |
|
| external.php | File | 8.11 KB | 0777 |
|
| file_picker.php | File | 3.65 KB | 0777 |
|
| help_icon.php | File | 4.37 KB | 0777 |
|
| html_writer.php | File | 34.28 KB | 0777 |
|
| icon_system.php | File | 5.25 KB | 0777 |
|
| icon_system_font.php | File | 1.53 KB | 0777 |
|
| icon_system_fontawesome.php | File | 26.92 KB | 0777 |
|
| icon_system_standard.php | File | 1.28 KB | 0777 |
|
| image_icon.php | File | 1.27 KB | 0777 |
|
| initials_bar.php | File | 4.94 KB | 0777 |
|
| inplace_editable.php | File | 9.84 KB | 0777 |
|
| js_writer.php | File | 5.42 KB | 0777 |
|
| language_menu.php | File | 5.67 KB | 0777 |
|
| mustache_clean_string_helper.php | File | 2.17 KB | 0777 |
|
| mustache_engine.php | File | 2.62 KB | 0777 |
|
| mustache_filesystem_loader.php | File | 2.35 KB | 0777 |
|
| mustache_helper_collection.php | File | 6.96 KB | 0777 |
|
| mustache_javascript_helper.php | File | 1.9 KB | 0777 |
|
| mustache_pix_helper.php | File | 2.45 KB | 0777 |
|
| mustache_quote_helper.php | File | 1.87 KB | 0777 |
|
| mustache_shorten_text_helper.php | File | 1.76 KB | 0777 |
|
| mustache_string_helper.php | File | 2.31 KB | 0777 |
|
| mustache_template_finder.php | File | 4.12 KB | 0777 |
|
| mustache_template_source_loader.php | File | 14.9 KB | 0777 |
|
| mustache_uniqid_helper.php | File | 1.56 KB | 0777 |
|
| mustache_user_date_helper.php | File | 1.83 KB | 0777 |
|
| named_templatable.php | File | 1.23 KB | 0777 |
|
| notification.php | File | 6.41 KB | 0777 |
|
| paging_bar.php | File | 8.97 KB | 0777 |
|
| participants_action_bar.php | File | 8.83 KB | 0777 |
|
| pix_emoticon.php | File | 1.71 KB | 0777 |
|
| pix_icon.php | File | 4.89 KB | 0777 |
|
| pix_icon_font.php | File | 2.9 KB | 0777 |
|
| pix_icon_fontawesome.php | File | 1.21 KB | 0777 |
|
| plugin_renderer_base.php | File | 5.86 KB | 0777 |
|
| preferences_group.php | File | 1.62 KB | 0777 |
|
| preferences_groups.php | File | 1.47 KB | 0777 |
|
| progress_bar.php | File | 8.54 KB | 0777 |
|
| progress_trace.php | File | 1.68 KB | 0777 |
|
| renderable.php | File | 1.24 KB | 0777 |
|
| renderer_base.php | File | 16.75 KB | 0777 |
|
| routed_error_handler.php | File | 1.69 KB | 0777 |
|
| select_menu.php | File | 6.68 KB | 0777 |
|
| single_button.php | File | 7.88 KB | 0777 |
|
| single_select.php | File | 9.43 KB | 0777 |
|
| sticky_footer.php | File | 4.5 KB | 0777 |
|
| stored_progress_bar.php | File | 10.39 KB | 0777 |
|
| tabobject.php | File | 5.11 KB | 0777 |
|
| tabtree.php | File | 3.37 KB | 0777 |
|
| templatable.php | File | 1.75 KB | 0777 |
|
| theme_config.php | File | 84.2 KB | 0777 |
|
| theme_usage.php | File | 4.32 KB | 0777 |
|
| url_rewriter.php | File | 1.6 KB | 0777 |
|
| url_select.php | File | 9.63 KB | 0777 |
|
| user_picture.php | File | 13.98 KB | 0777 |
|
| xhtml_container_stack.php | File | 5.79 KB | 0777 |
|