Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/monara/public_html/test.athavaneng.com/themes.php on line 99

Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 226

Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 227

Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 228

Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 229

Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 230

Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 231
. namespace editor_tiny; /** * Tiny Editor. * * @package editor_tiny * @copyright 2021 Andrew Lyons * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class editor extends \texteditor { /** @var manager The Tiny Manager instace */ protected $manager; /** @var \stdClass|null The default configuration to use if none is provided */ protected static $defaultconfiguration = null; /** * Instantiate the new editor instance. */ public function __construct() { $this->manager = new manager(); } /** * Set the default configuration for the editor. * * @param manager $manager The editor manager */ public static function set_default_configuration(manager $manager): void { global $PAGE; if (self::is_default_configuration_set()) { return; } $context = $PAGE->context; $config = (object) [ 'css' => $PAGE->theme->editor_css_url()->out(false), 'context' => $context->id, 'plugins' => $manager->get_plugin_configuration($context, [], []), ]; $config = json_encode($config); $inlinejs = << { Tiny.configureDefaultEditor({$config}); M.util.js_complete('editor_tiny/editor:defaultConfiguration'); }); EOF; $PAGE->requires->js_amd_inline($inlinejs); self::$defaultconfiguration = $config; } /** * Fetch the current defautl configuration. * * @return \stdClass|null The default configuration or null if not set. */ public static function get_default_configuration(): ?\stdClass { return self::$defaultconfiguration; } /** * Reset the default configuration. */ public static function reset_default_configuration(): void { self::$defaultconfiguration = null; } /** * Check if the default configuration is set. * * @return bool True if the default configuration is set. */ public static function is_default_configuration_set(): bool { return !empty(self::$defaultconfiguration); } /** * Is the current browser supported by this editor? * * @return bool */ public function supported_by_browser() { return true; } /** * List of supported text field formats. * * @return array */ public function get_supported_formats() { return [ FORMAT_HTML => FORMAT_HTML, ]; } /** * Returns text format preferred by this editor. * * @return int */ public function get_preferred_format() { return FORMAT_HTML; } /** * Does this editor support picking from repositories? * * @return bool */ public function supports_repositories() { return true; } /** * Use this editor for given element. * * @param string $elementid * @param array $options * @param null $fpoptions */ public function use_editor($elementid, array $options = null, $fpoptions = null) { global $PAGE; // Ensure that the default configuration is set. self::set_default_configuration($this->manager); if ($fpoptions === null) { $fpoptions = []; } $context = $PAGE->context; if (isset($options['context']) && ($options['context'] instanceof \context)) { // A different context was provided. // Use that instead. $context = $options['context']; } // Generate the configuration for this editor. $siteconfig = get_config('editor_tiny'); $config = (object) [ // The URL to the CSS file for the editor. 'css' => $PAGE->theme->editor_css_url()->out(false), // The current context for this page or editor. 'context' => $context->id, // File picker options. 'filepicker' => $fpoptions, 'currentLanguage' => current_language(), 'branding' => property_exists($siteconfig, 'branding') ? !empty($siteconfig->branding) : true, // Language options. 'language' => [ 'currentlang' => current_language(), 'installed' => get_string_manager()->get_list_of_translations(true), 'available' => get_string_manager()->get_list_of_languages() ], // Plugin configuration. 'plugins' => $this->manager->get_plugin_configuration($context, $options, $fpoptions, $this), ]; foreach ($fpoptions as $fp) { // Guess the draftitemid for the editor. // Note: This is the best we can do at the moment. if (!empty($fp->itemid)) { $config->draftitemid = $fp->itemid; break; } } $configoptions = json_encode(convert_to_array($config)); // Note: This is not ideal but the editor does not have control over any HTML output. // The Editor API only allows you to run JavaScript. // In the future we will extend the editor API to allow it to generate the textarea, or attributes to use in the // textarea or its wrapper. // For now we cannot use the `js_call_amd()` API call because it warns if the parameters passed exceed a // relatively low character limit. $config = json_encode($config); $inlinejs = << { Tiny.setupForElementId({ elementId: "${elementid}", options: ${configoptions}, }); M.util.js_complete('editor_tiny/editor'); }); EOF; $PAGE->requires->js_amd_inline($inlinejs); } }