$action_name = $func; } /** * Figures out whether a given action is currently registered. * Only guaranteed to be accurate in inside an existing action function * @package core * @param string $action_name The name of the action to search for * @return bool Whether an action with the specified name exists. */ function has_action($action_name) { global $actions; return !empty($actions->$action_name); } /* * ███████ █████ ██ ██ ██ ███ ██ ██████ * ██ ██ ██ ██ ██ ██ ████ ██ ██ * ███████ ███████ ██ ██ ██ ██ ██ ██ ██ ███ * ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ * ███████ ██ ██ ████ ██ ██ ████ ██████ */ $save_preprocessors = []; /** * Register a new proprocessor that will be executed just before * an edit is saved. * @package core * @param callable $func The function to register. */ function register_save_preprocessor($func) { global $save_preprocessors; $save_preprocessors[] = $func; } /* * ██ ██ ███████ ██ ██████ * ██ ██ ██ ██ ██ ██ * ███████ █████ ██ ██████ * ██ ██ ██ ██ ██ * ██ ██ ███████ ███████ ██ */ $help_sections = []; /** * Adds a new help section to the help page. * @package core * @param string $index The string to index the new section under. * @param string $title The title to display above the section. * @param string $content The content to display. */ function add_help_section($index, $title, $content) { global $help_sections; $help_sections[$index] = [ "title" => $title, "content" => $content ]; } if(!empty($settings->enable_math_rendering)) add_help_section("22-mathematical-mxpressions", "Mathematical Expressions", "
$settings->sitename supports rendering of mathematical expressions. Mathematical expressions can be included practically anywhere in your page. Expressions should be written in LaTeX and enclosed in dollar signs like this: $x^2$
.
Note that expression parsing is done on the viewer's computer with javascript (specifically MathJax) and not by $settings->sitename directly (also called client side rendering).
"); /* * ███████ ████████ █████ ████████ ███████ * ██ ██ ██ ██ ██ ██ * ███████ ██ ███████ ██ ███████ * ██ ██ ██ ██ ██ ██ * ███████ ██ ██ ██ ██ ███████ */ /** An array of the currently registerd statistic calculators. Not guaranteed to be populated until the requested action function is called. */ $statistic_calculators = []; /** * Registers a statistic calculator against the system. * @package core * @param array $stat_data The statistic object to register. */ function statistic_add($stat_data) { global $statistic_calculators; $statistic_calculators[$stat_data["id"]] = $stat_data; } /** * Checks whether a specified statistic has been registered. * @package core * @param string $stat_id The id of the statistic to check the existence of. * @return bool Whether the specified statistic has been registered. */ function has_statistic($stat_id) { global $statistic_calculators; return !empty($statistic_calculators[$stat_id]); }