define('ABSPATH', $this->gEnv->getWordpressRootPath() . '/' );
define('TEMPLATEPATH', $this->gEnv->getTemplatesPath() . '/' . $curTemplate);
// define('STYLESHEETPATH', get_stylesheet_directory());
- define('TEMPLATE', $curTemplate); // for Magic3
+ require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/load.php');
require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/default-constants.php'); // デフォルト値取得
+ require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/plugin.php');
require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/functions.php');
-
+ require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/default-filters.php');
+ require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/l10n.php');
require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/class-wp-walker.php');
require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/class-wp-query.php');
- require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/class-walker-nav-menu.php');
-
- require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/general-template.php');
- require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/plugin.php');
+// require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/class-walker-nav-menu.php');
+// require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/class-wp-dependency.php');
+
+ require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/query.php');
+ require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/pluggable.php');
+ require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/post.php');
+// require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/user.php');
+ require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/widgets.php');
+ require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/kses.php');
+ require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/script-loader.php');
+ require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/theme.php');
require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/template.php');
- require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/l10n.php');
- require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/load.php');
- require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/option.php');
- require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/cache.php');
require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/link-template.php');
require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/post-template.php');
require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/author-template.php');
require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/nav-menu-template.php');
require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/nav-menu.php');
- require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/query.php');
- require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/pluggable.php');
- require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/post.php');
- require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/user.php');
- require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/theme.php');
+ require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/general-template.php');
+ require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/cache.php');
require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/formatting.php');
-// require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/shortcodes.php');
-
- require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/widgets.php');
- require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/kses.php');
+// require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/option.php');
require_once($this->gEnv->getWordpressRootPath() . '/wp-includes/pomo/translations.php');
-
+
// テンプレート内のファイルを読み込む
if ( file_exists(TEMPLATEPATH . '/functions.php')) include(TEMPLATEPATH . '/functions.php');
- wp_initial_constants();
+ // データ初期化
+ wp_initial_constants(); // デフォルト値取得
+ $GLOBALS['locale'] = $this->gEnv->getCurrentLanguage();
$GLOBALS['wp_query'] = new WP_Query();
} else if ($convType >= 1){ // Joomla!v1.5,v2.5テンプレートのとき
global $mainframe;
--- /dev/null
+<?php
+/**
+ * Dependencies API: _WP_Dependency class
+ *
+ * @since 4.7.0
+ *
+ * @package WordPress
+ * @subpackage Dependencies
+ */
+
+/**
+ * Class _WP_Dependency
+ *
+ * Helper class to register a handle and associated data.
+ *
+ * @access private
+ * @since 2.6.0
+ */
+class _WP_Dependency {
+ /**
+ * The handle name.
+ *
+ * @access public
+ * @since 2.6.0
+ * @var null
+ */
+ public $handle;
+
+ /**
+ * The handle source.
+ *
+ * @access public
+ * @since 2.6.0
+ * @var null
+ */
+ public $src;
+
+ /**
+ * An array of handle dependencies.
+ *
+ * @access public
+ * @since 2.6.0
+ * @var array
+ */
+ public $deps = array();
+
+ /**
+ * The handle version.
+ *
+ * Used for cache-busting.
+ *
+ * @access public
+ * @since 2.6.0
+ * @var bool|string
+ */
+ public $ver = false;
+
+ /**
+ * Additional arguments for the handle.
+ *
+ * @access public
+ * @since 2.6.0
+ * @var null
+ */
+ public $args = null; // Custom property, such as $in_footer or $media.
+
+ /**
+ * Extra data to supply to the handle.
+ *
+ * @access public
+ * @since 2.6.0
+ * @var array
+ */
+ public $extra = array();
+
+ /**
+ * Setup dependencies.
+ *
+ * @since 2.6.0
+ */
+ public function __construct() {
+ @list( $this->handle, $this->src, $this->deps, $this->ver, $this->args ) = func_get_args();
+ if ( ! is_array($this->deps) )
+ $this->deps = array();
+ }
+
+ /**
+ * Add handle data.
+ *
+ * @access public
+ * @since 2.6.0
+ *
+ * @param string $name The data key to add.
+ * @param mixed $data The data value to add.
+ * @return bool False if not scalar, true otherwise.
+ */
+ public function add_data( $name, $data ) {
+ if ( !is_scalar($name) )
+ return false;
+ $this->extra[$name] = $data;
+ return true;
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * Dependencies API: WP_Dependencies base class
+ *
+ * @since 2.6.0
+ *
+ * @package WordPress
+ * @subpackage Dependencies
+ */
+
+/**
+ * Core base class extended to register items.
+ *
+ * @package WordPress
+ * @since 2.6.0
+ * @uses _WP_Dependency
+ */
+class WP_Dependencies {
+ /**
+ * An array of registered handle objects.
+ *
+ * @access public
+ * @since 2.6.8
+ * @var array
+ */
+ public $registered = array();
+
+ /**
+ * An array of queued _WP_Dependency handle objects.
+ *
+ * @access public
+ * @since 2.6.8
+ * @var array
+ */
+ public $queue = array();
+
+ /**
+ * An array of _WP_Dependency handle objects to queue.
+ *
+ * @access public
+ * @since 2.6.0
+ * @var array
+ */
+ public $to_do = array();
+
+ /**
+ * An array of _WP_Dependency handle objects already queued.
+ *
+ * @access public
+ * @since 2.6.0
+ * @var array
+ */
+ public $done = array();
+
+ /**
+ * An array of additional arguments passed when a handle is registered.
+ *
+ * Arguments are appended to the item query string.
+ *
+ * @access public
+ * @since 2.6.0
+ * @var array
+ */
+ public $args = array();
+
+ /**
+ * An array of handle groups to enqueue.
+ *
+ * @access public
+ * @since 2.8.0
+ * @var array
+ */
+ public $groups = array();
+
+ /**
+ * A handle group to enqueue.
+ *
+ * @access public
+ * @since 2.8.0
+ * @deprecated 4.5.0
+ * @var int
+ */
+ public $group = 0;
+
+ /**
+ * Processes the items and dependencies.
+ *
+ * Processes the items passed to it or the queue, and their dependencies.
+ *
+ * @access public
+ * @since 2.6.0
+ * @since 2.8.0 Added the `$group` parameter.
+ *
+ * @param mixed $handles Optional. Items to be processed: Process queue (false), process item (string), process items (array of strings).
+ * @param mixed $group Group level: level (int), no groups (false).
+ * @return array Handles of items that have been processed.
+ */
+ public function do_items( $handles = false, $group = false ) {
+ /*
+ * If nothing is passed, print the queue. If a string is passed,
+ * print that item. If an array is passed, print those items.
+ */
+ $handles = false === $handles ? $this->queue : (array) $handles;
+ $this->all_deps( $handles );
+
+ foreach ( $this->to_do as $key => $handle ) {
+ if ( !in_array($handle, $this->done, true) && isset($this->registered[$handle]) ) {
+ /*
+ * Attempt to process the item. If successful,
+ * add the handle to the done array.
+ *
+ * Unset the item from the to_do array.
+ */
+ if ( $this->do_item( $handle, $group ) )
+ $this->done[] = $handle;
+
+ unset( $this->to_do[$key] );
+ }
+ }
+
+ return $this->done;
+ }
+
+ /**
+ * Processes a dependency.
+ *
+ * @access public
+ * @since 2.6.0
+ *
+ * @param string $handle Name of the item. Should be unique.
+ * @return bool True on success, false if not set.
+ */
+ public function do_item( $handle ) {
+ return isset($this->registered[$handle]);
+ }
+
+ /**
+ * Determines dependencies.
+ *
+ * Recursively builds an array of items to process taking
+ * dependencies into account. Does NOT catch infinite loops.
+ *
+ * @access public
+ * @since 2.1.0
+ * @since 2.6.0 Moved from `WP_Scripts`.
+ * @since 2.8.0 Added the `$group` parameter.
+ *
+ * @param mixed $handles Item handle and argument (string) or item handles and arguments (array of strings).
+ * @param bool $recursion Internal flag that function is calling itself.
+ * @param int|false $group Group level: (int) level, (false) no groups.
+ * @return bool True on success, false on failure.
+ */
+ public function all_deps( $handles, $recursion = false, $group = false ) {
+ if ( !$handles = (array) $handles )
+ return false;
+
+ foreach ( $handles as $handle ) {
+ $handle_parts = explode('?', $handle);
+ $handle = $handle_parts[0];
+ $queued = in_array($handle, $this->to_do, true);
+
+ if ( in_array($handle, $this->done, true) ) // Already done
+ continue;
+
+ $moved = $this->set_group( $handle, $recursion, $group );
+ $new_group = $this->groups[ $handle ];
+
+ if ( $queued && !$moved ) // already queued and in the right group
+ continue;
+
+ $keep_going = true;
+ if ( !isset($this->registered[$handle]) )
+ $keep_going = false; // Item doesn't exist.
+ elseif ( $this->registered[$handle]->deps && array_diff($this->registered[$handle]->deps, array_keys($this->registered)) )
+ $keep_going = false; // Item requires dependencies that don't exist.
+ elseif ( $this->registered[$handle]->deps && !$this->all_deps( $this->registered[$handle]->deps, true, $new_group ) )
+ $keep_going = false; // Item requires dependencies that don't exist.
+
+ if ( ! $keep_going ) { // Either item or its dependencies don't exist.
+ if ( $recursion )
+ return false; // Abort this branch.
+ else
+ continue; // We're at the top level. Move on to the next one.
+ }
+
+ if ( $queued ) // Already grabbed it and its dependencies.
+ continue;
+
+ if ( isset($handle_parts[1]) )
+ $this->args[$handle] = $handle_parts[1];
+
+ $this->to_do[] = $handle;
+ }
+
+ return true;
+ }
+
+ /**
+ * Register an item.
+ *
+ * Registers the item if no item of that name already exists.
+ *
+ * @access public
+ * @since 2.1.0
+ * @since 2.6.0 Moved from `WP_Scripts`.
+ *
+ * @param string $handle Name of the item. Should be unique.
+ * @param string $src Full URL of the item, or path of the item relative to the WordPress root directory.
+ * @param array $deps Optional. An array of registered item handles this item depends on. Default empty array.
+ * @param string|bool|null $ver Optional. String specifying item version number, if it has one, which is added to the URL
+ * as a query string for cache busting purposes. If version is set to false, a version
+ * number is automatically added equal to current installed WordPress version.
+ * If set to null, no version is added.
+ * @param mixed $args Optional. Custom property of the item. NOT the class property $args. Examples: $media, $in_footer.
+ * @return bool Whether the item has been registered. True on success, false on failure.
+ */
+ public function add( $handle, $src, $deps = array(), $ver = false, $args = null ) {
+ if ( isset($this->registered[$handle]) )
+ return false;
+ $this->registered[$handle] = new _WP_Dependency( $handle, $src, $deps, $ver, $args );
+ return true;
+ }
+
+ /**
+ * Add extra item data.
+ *
+ * Adds data to a registered item.
+ *
+ * @access public
+ * @since 2.6.0
+ *
+ * @param string $handle Name of the item. Should be unique.
+ * @param string $key The data key.
+ * @param mixed $value The data value.
+ * @return bool True on success, false on failure.
+ */
+ public function add_data( $handle, $key, $value ) {
+ if ( !isset( $this->registered[$handle] ) )
+ return false;
+
+ return $this->registered[$handle]->add_data( $key, $value );
+ }
+
+ /**
+ * Get extra item data.
+ *
+ * Gets data associated with a registered item.
+ *
+ * @access public
+ * @since 3.3.0
+ *
+ * @param string $handle Name of the item. Should be unique.
+ * @param string $key The data key.
+ * @return mixed Extra item data (string), false otherwise.
+ */
+ public function get_data( $handle, $key ) {
+ if ( !isset( $this->registered[$handle] ) )
+ return false;
+
+ if ( !isset( $this->registered[$handle]->extra[$key] ) )
+ return false;
+
+ return $this->registered[$handle]->extra[$key];
+ }
+
+ /**
+ * Un-register an item or items.
+ *
+ * @access public
+ * @since 2.1.0
+ * @since 2.6.0 Moved from `WP_Scripts`.
+ *
+ * @param mixed $handles Item handle and argument (string) or item handles and arguments (array of strings).
+ * @return void
+ */
+ public function remove( $handles ) {
+ foreach ( (array) $handles as $handle )
+ unset($this->registered[$handle]);
+ }
+
+ /**
+ * Queue an item or items.
+ *
+ * Decodes handles and arguments, then queues handles and stores
+ * arguments in the class property $args. For example in extending
+ * classes, $args is appended to the item url as a query string.
+ * Note $args is NOT the $args property of items in the $registered array.
+ *
+ * @access public
+ * @since 2.1.0
+ * @since 2.6.0 Moved from `WP_Scripts`.
+ *
+ * @param mixed $handles Item handle and argument (string) or item handles and arguments (array of strings).
+ */
+ public function enqueue( $handles ) {
+ foreach ( (array) $handles as $handle ) {
+ $handle = explode('?', $handle);
+ if ( !in_array($handle[0], $this->queue) && isset($this->registered[$handle[0]]) ) {
+ $this->queue[] = $handle[0];
+ if ( isset($handle[1]) )
+ $this->args[$handle[0]] = $handle[1];
+ }
+ }
+ }
+
+ /**
+ * Dequeue an item or items.
+ *
+ * Decodes handles and arguments, then dequeues handles
+ * and removes arguments from the class property $args.
+ *
+ * @access public
+ * @since 2.1.0
+ * @since 2.6.0 Moved from `WP_Scripts`.
+ *
+ * @param mixed $handles Item handle and argument (string) or item handles and arguments (array of strings).
+ */
+ public function dequeue( $handles ) {
+ foreach ( (array) $handles as $handle ) {
+ $handle = explode('?', $handle);
+ $key = array_search($handle[0], $this->queue);
+ if ( false !== $key ) {
+ unset($this->queue[$key]);
+ unset($this->args[$handle[0]]);
+ }
+ }
+ }
+
+ /**
+ * Recursively search the passed dependency tree for $handle
+ *
+ * @since 4.0.0
+ *
+ * @param array $queue An array of queued _WP_Dependency handle objects.
+ * @param string $handle Name of the item. Should be unique.
+ * @return bool Whether the handle is found after recursively searching the dependency tree.
+ */
+ protected function recurse_deps( $queue, $handle ) {
+ foreach ( $queue as $queued ) {
+ if ( ! isset( $this->registered[ $queued ] ) ) {
+ continue;
+ }
+
+ if ( in_array( $handle, $this->registered[ $queued ]->deps ) ) {
+ return true;
+ } elseif ( $this->recurse_deps( $this->registered[ $queued ]->deps, $handle ) ) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Query list for an item.
+ *
+ * @access public
+ * @since 2.1.0
+ * @since 2.6.0 Moved from `WP_Scripts`.
+ *
+ * @param string $handle Name of the item. Should be unique.
+ * @param string $list Property name of list array.
+ * @return bool|_WP_Dependency Found, or object Item data.
+ */
+ public function query( $handle, $list = 'registered' ) {
+ switch ( $list ) {
+ case 'registered' :
+ case 'scripts': // back compat
+ if ( isset( $this->registered[ $handle ] ) )
+ return $this->registered[ $handle ];
+ return false;
+
+ case 'enqueued' :
+ case 'queue' :
+ if ( in_array( $handle, $this->queue ) ) {
+ return true;
+ }
+ return $this->recurse_deps( $this->queue, $handle );
+
+ case 'to_do' :
+ case 'to_print': // back compat
+ return in_array( $handle, $this->to_do );
+
+ case 'done' :
+ case 'printed': // back compat
+ return in_array( $handle, $this->done );
+ }
+ return false;
+ }
+
+ /**
+ * Set item group, unless already in a lower group.
+ *
+ * @access public
+ * @since 2.8.0
+ *
+ * @param string $handle Name of the item. Should be unique.
+ * @param bool $recursion Internal flag that calling function was called recursively.
+ * @param mixed $group Group level.
+ * @return bool Not already in the group or a lower group
+ */
+ public function set_group( $handle, $recursion, $group ) {
+ $group = (int) $group;
+
+ if ( isset( $this->groups[ $handle ] ) && $this->groups[ $handle ] <= $group ) {
+ return false;
+ }
+
+ $this->groups[ $handle ] = $group;
+
+ return true;
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * Dependencies API: WP_Scripts class
+ *
+ * @since 2.6.0
+ *
+ * @package WordPress
+ * @subpackage Dependencies
+ */
+
+/**
+ * Core class used to register scripts.
+ *
+ * @package WordPress
+ * @uses WP_Dependencies
+ * @since 2.1.0
+ */
+class WP_Scripts extends WP_Dependencies {
+ /**
+ * Base URL for scripts.
+ *
+ * Full URL with trailing slash.
+ *
+ * @since 2.6.0
+ * @access public
+ * @var string
+ */
+ public $base_url;
+
+ /**
+ * URL of the content directory.
+ *
+ * @since 2.8.0
+ * @access public
+ * @var string
+ */
+ public $content_url;
+
+ /**
+ * Default version string for stylesheets.
+ *
+ * @since 2.6.0
+ * @access public
+ * @var string
+ */
+ public $default_version;
+
+ /**
+ * Holds handles of scripts which are enqueued in footer.
+ *
+ * @since 2.8.0
+ * @access public
+ * @var array
+ */
+ public $in_footer = array();
+
+ /**
+ * Holds a list of script handles which will be concatenated.
+ *
+ * @since 2.8.0
+ * @access public
+ * @var string
+ */
+ public $concat = '';
+
+ /**
+ * Holds a string which contains script handles and their version.
+ *
+ * @since 2.8.0
+ * @deprecated 3.4.0
+ * @access public
+ * @var string
+ */
+ public $concat_version = '';
+
+ /**
+ * Whether to perform concatenation.
+ *
+ * @since 2.8.0
+ * @access public
+ * @var bool
+ */
+ public $do_concat = false;
+
+ /**
+ * Holds HTML markup of scripts and additional data if concatenation
+ * is enabled.
+ *
+ * @since 2.8.0
+ * @access public
+ * @var string
+ */
+ public $print_html = '';
+
+ /**
+ * Holds inline code if concatenation is enabled.
+ *
+ * @since 2.8.0
+ * @access public
+ * @var string
+ */
+ public $print_code = '';
+
+ /**
+ * Holds a list of script handles which are not in the default directory
+ * if concatenation is enabled.
+ *
+ * Unused in core.
+ *
+ * @since 2.8.0
+ * @access public
+ * @var string
+ */
+ public $ext_handles = '';
+
+ /**
+ * Holds a string which contains handles and versions of scripts which
+ * are not in the default directory if concatenation is enabled.
+ *
+ * Unused in core.
+ *
+ * @since 2.8.0
+ * @access public
+ * @var string
+ */
+ public $ext_version = '';
+
+ /**
+ * List of default directories.
+ *
+ * @since 2.8.0
+ * @access public
+ * @var array
+ */
+ public $default_dirs;
+
+ /**
+ * Constructor.
+ *
+ * @since 2.6.0
+ * @access public
+ */
+ public function __construct() {
+ $this->init();
+ add_action( 'init', array( $this, 'init' ), 0 );
+ }
+
+ /**
+ * Initialize the class.
+ *
+ * @since 3.4.0
+ * @access public
+ */
+ public function init() {
+ /**
+ * Fires when the WP_Scripts instance is initialized.
+ *
+ * @since 2.6.0
+ *
+ * @param WP_Scripts &$this WP_Scripts instance, passed by reference.
+ */
+ do_action_ref_array( 'wp_default_scripts', array(&$this) );
+ }
+
+ /**
+ * Prints scripts.
+ *
+ * Prints the scripts passed to it or the print queue. Also prints all necessary dependencies.
+ *
+ * @since 2.1.0
+ * @since 2.8.0 Added the `$group` parameter.
+ * @access public
+ *
+ * @param mixed $handles Optional. Scripts to be printed. (void) prints queue, (string) prints
+ * that script, (array of strings) prints those scripts. Default false.
+ * @param int $group Optional. If scripts were queued in groups prints this group number.
+ * Default false.
+ * @return array Scripts that have been printed.
+ */
+ public function print_scripts( $handles = false, $group = false ) {
+ return $this->do_items( $handles, $group );
+ }
+
+ /**
+ * Prints extra scripts of a registered script.
+ *
+ * @since 2.1.0
+ * @since 2.8.0 Added the `$echo` parameter.
+ * @deprecated 3.3.0
+ * @access public
+ *
+ * @see print_extra_script()
+ *
+ * @param string $handle The script's registered handle.
+ * @param bool $echo Optional. Whether to echo the extra script instead of just returning it.
+ * Default true.
+ * @return bool|string|void Void if no data exists, extra scripts if `$echo` is true, true otherwise.
+ */
+ public function print_scripts_l10n( $handle, $echo = true ) {
+ _deprecated_function( __FUNCTION__, '3.3.0', 'print_extra_script()' );
+ return $this->print_extra_script( $handle, $echo );
+ }
+
+ /**
+ * Prints extra scripts of a registered script.
+ *
+ * @since 3.3.0
+ * @access public
+ *
+ * @param string $handle The script's registered handle.
+ * @param bool $echo Optional. Whether to echo the extra script instead of just returning it.
+ * Default true.
+ * @return bool|string|void Void if no data exists, extra scripts if `$echo` is true, true otherwise.
+ */
+ public function print_extra_script( $handle, $echo = true ) {
+ if ( !$output = $this->get_data( $handle, 'data' ) )
+ return;
+
+ if ( !$echo )
+ return $output;
+
+ echo "<script type='text/javascript'>\n"; // CDATA and type='text/javascript' is not needed for HTML 5
+ echo "/* <![CDATA[ */\n";
+ echo "$output\n";
+ echo "/* ]]> */\n";
+ echo "</script>\n";
+
+ return true;
+ }
+
+ /**
+ * Processes a script dependency.
+ *
+ * @since 2.6.0
+ * @since 2.8.0 Added the `$group` parameter.
+ * @access public
+ *
+ * @see WP_Dependencies::do_item()
+ *
+ * @param string $handle The script's registered handle.
+ * @param int|false $group Optional. Group level: (int) level, (false) no groups. Default false.
+ * @return bool True on success, false on failure.
+ */
+ public function do_item( $handle, $group = false ) {
+ if ( !parent::do_item($handle) )
+ return false;
+
+ if ( 0 === $group && $this->groups[$handle] > 0 ) {
+ $this->in_footer[] = $handle;
+ return false;
+ }
+
+ if ( false === $group && in_array($handle, $this->in_footer, true) )
+ $this->in_footer = array_diff( $this->in_footer, (array) $handle );
+
+ $obj = $this->registered[$handle];
+
+ if ( null === $obj->ver ) {
+ $ver = '';
+ } else {
+ $ver = $obj->ver ? $obj->ver : $this->default_version;
+ }
+
+ if ( isset($this->args[$handle]) )
+ $ver = $ver ? $ver . '&' . $this->args[$handle] : $this->args[$handle];
+
+ $src = $obj->src;
+ $cond_before = $cond_after = '';
+ $conditional = isset( $obj->extra['conditional'] ) ? $obj->extra['conditional'] : '';
+
+ if ( $conditional ) {
+ $cond_before = "<!--[if {$conditional}]>\n";
+ $cond_after = "<![endif]-->\n";
+ }
+
+ $before_handle = $this->print_inline_script( $handle, 'before', false );
+ $after_handle = $this->print_inline_script( $handle, 'after', false );
+
+ if ( $before_handle ) {
+ $before_handle = sprintf( "<script type='text/javascript'>\n%s\n</script>\n", $before_handle );
+ }
+
+ if ( $after_handle ) {
+ $after_handle = sprintf( "<script type='text/javascript'>\n%s\n</script>\n", $after_handle );
+ }
+
+ if ( $this->do_concat ) {
+ /**
+ * Filters the script loader source.
+ *
+ * @since 2.2.0
+ *
+ * @param string $src Script loader source path.
+ * @param string $handle Script handle.
+ */
+ $srce = apply_filters( 'script_loader_src', $src, $handle );
+
+ if ( $this->in_default_dir( $srce ) && ( $before_handle || $after_handle ) ) {
+ $this->do_concat = false;
+
+ // Have to print the so-far concatenated scripts right away to maintain the right order.
+ _print_scripts();
+ $this->reset();
+ } elseif ( $this->in_default_dir( $srce ) && ! $conditional ) {
+ $this->print_code .= $this->print_extra_script( $handle, false );
+ $this->concat .= "$handle,";
+ $this->concat_version .= "$handle$ver";
+ return true;
+ } else {
+ $this->ext_handles .= "$handle,";
+ $this->ext_version .= "$handle$ver";
+ }
+ }
+
+ $has_conditional_data = $conditional && $this->get_data( $handle, 'data' );
+
+ if ( $has_conditional_data ) {
+ echo $cond_before;
+ }
+
+ $this->print_extra_script( $handle );
+
+ if ( $has_conditional_data ) {
+ echo $cond_after;
+ }
+
+ // A single item may alias a set of items, by having dependencies, but no source.
+ if ( ! $obj->src ) {
+ return true;
+ }
+
+ if ( ! preg_match( '|^(https?:)?//|', $src ) && ! ( $this->content_url && 0 === strpos( $src, $this->content_url ) ) ) {
+ $src = $this->base_url . $src;
+ }
+
+ if ( ! empty( $ver ) )
+ $src = add_query_arg( 'ver', $ver, $src );
+
+ /** This filter is documented in wp-includes/class.wp-scripts.php */
+ $src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) );
+
+ if ( ! $src )
+ return true;
+
+ $tag = "{$cond_before}{$before_handle}<script type='text/javascript' src='$src'></script>\n{$after_handle}{$cond_after}";
+
+ /**
+ * Filters the HTML script tag of an enqueued script.
+ *
+ * @since 4.1.0
+ *
+ * @param string $tag The `<script>` tag for the enqueued script.
+ * @param string $handle The script's registered handle.
+ * @param string $src The script's source URL.
+ */
+ $tag = apply_filters( 'script_loader_tag', $tag, $handle, $src );
+
+ if ( $this->do_concat ) {
+ $this->print_html .= $tag;
+ } else {
+ echo $tag;
+ }
+
+ return true;
+ }
+
+ /**
+ * Adds extra code to a registered script.
+ *
+ * @since 4.5.0
+ * @access public
+ *
+ * @param string $handle Name of the script to add the inline script to. Must be lowercase.
+ * @param string $data String containing the javascript to be added.
+ * @param string $position Optional. Whether to add the inline script before the handle
+ * or after. Default 'after'.
+ * @return bool True on success, false on failure.
+ */
+ public function add_inline_script( $handle, $data, $position = 'after' ) {
+ if ( ! $data ) {
+ return false;
+ }
+
+ if ( 'after' !== $position ) {
+ $position = 'before';
+ }
+
+ $script = (array) $this->get_data( $handle, $position );
+ $script[] = $data;
+
+ return $this->add_data( $handle, $position, $script );
+ }
+
+ /**
+ * Prints inline scripts registered for a specific handle.
+ *
+ * @since 4.5.0
+ * @access public
+ *
+ * @param string $handle Name of the script to add the inline script to. Must be lowercase.
+ * @param string $position Optional. Whether to add the inline script before the handle
+ * or after. Default 'after'.
+ * @param bool $echo Optional. Whether to echo the script instead of just returning it.
+ * Default true.
+ * @return string|false Script on success, false otherwise.
+ */
+ public function print_inline_script( $handle, $position = 'after', $echo = true ) {
+ $output = $this->get_data( $handle, $position );
+
+ if ( empty( $output ) ) {
+ return false;
+ }
+
+ $output = trim( implode( "\n", $output ), "\n" );
+
+ if ( $echo ) {
+ printf( "<script type='text/javascript'>\n%s\n</script>\n", $output );
+ }
+
+ return $output;
+ }
+
+ /**
+ * Localizes a script, only if the script has already been added.
+ *
+ * @since 2.1.0
+ * @access public
+ *
+ * @param string $handle
+ * @param string $object_name
+ * @param array $l10n
+ * @return bool
+ */
+ public function localize( $handle, $object_name, $l10n ) {
+ if ( $handle === 'jquery' )
+ $handle = 'jquery-core';
+
+ if ( is_array($l10n) && isset($l10n['l10n_print_after']) ) { // back compat, preserve the code in 'l10n_print_after' if present
+ $after = $l10n['l10n_print_after'];
+ unset($l10n['l10n_print_after']);
+ }
+
+ foreach ( (array) $l10n as $key => $value ) {
+ if ( !is_scalar($value) )
+ continue;
+
+ $l10n[$key] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8');
+ }
+
+ $script = "var $object_name = " . wp_json_encode( $l10n ) . ';';
+
+ if ( !empty($after) )
+ $script .= "\n$after;";
+
+ $data = $this->get_data( $handle, 'data' );
+
+ if ( !empty( $data ) )
+ $script = "$data\n$script";
+
+ return $this->add_data( $handle, 'data', $script );
+ }
+
+ /**
+ * Sets handle group.
+ *
+ * @since 2.8.0
+ * @access public
+ *
+ * @see WP_Dependencies::set_group()
+ *
+ * @param string $handle Name of the item. Should be unique.
+ * @param bool $recursion Internal flag that calling function was called recursively.
+ * @param int|false $group Optional. Group level: (int) level, (false) no groups. Default false.
+ * @return bool Not already in the group or a lower group
+ */
+ public function set_group( $handle, $recursion, $group = false ) {
+ if ( isset( $this->registered[$handle]->args ) && $this->registered[$handle]->args === 1 )
+ $grp = 1;
+ else
+ $grp = (int) $this->get_data( $handle, 'group' );
+
+ if ( false !== $group && $grp > $group )
+ $grp = $group;
+
+ return parent::set_group( $handle, $recursion, $grp );
+ }
+
+ /**
+ * Determines script dependencies.
+ *
+ * @since 2.1.0
+ * @access public
+ *
+ * @see WP_Dependencies::all_deps()
+ *
+ * @param mixed $handles Item handle and argument (string) or item handles and arguments (array of strings).
+ * @param bool $recursion Internal flag that function is calling itself.
+ * @param int|false $group Optional. Group level: (int) level, (false) no groups. Default false.
+ * @return bool True on success, false on failure.
+ */
+ public function all_deps( $handles, $recursion = false, $group = false ) {
+ $r = parent::all_deps( $handles, $recursion, $group );
+ if ( ! $recursion ) {
+ /**
+ * Filters the list of script dependencies left to print.
+ *
+ * @since 2.3.0
+ *
+ * @param array $to_do An array of script dependencies.
+ */
+ $this->to_do = apply_filters( 'print_scripts_array', $this->to_do );
+ }
+ return $r;
+ }
+
+ /**
+ * Processes items and dependencies for the head group.
+ *
+ * @since 2.8.0
+ * @access public
+ *
+ * @see WP_Dependencies::do_items()
+ *
+ * @return array Handles of items that have been processed.
+ */
+ public function do_head_items() {
+ $this->do_items(false, 0);
+ return $this->done;
+ }
+
+ /**
+ * Processes items and dependencies for the footer group.
+ *
+ * @since 2.8.0
+ * @access public
+ *
+ * @see WP_Dependencies::do_items()
+ *
+ * @return array Handles of items that have been processed.
+ */
+ public function do_footer_items() {
+ $this->do_items(false, 1);
+ return $this->done;
+ }
+
+ /**
+ * Whether a handle's source is in a default directory.
+ *
+ * @since 2.8.0
+ * @access public
+ *
+ * @param string $src The source of the enqueued script.
+ * @return bool True if found, false if not.
+ */
+ public function in_default_dir( $src ) {
+ if ( ! $this->default_dirs ) {
+ return true;
+ }
+
+ if ( 0 === strpos( $src, '/' . WPINC . '/js/l10n' ) ) {
+ return false;
+ }
+
+ foreach ( (array) $this->default_dirs as $test ) {
+ if ( 0 === strpos( $src, $test ) ) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Resets class properties.
+ *
+ * @since 2.8.0
+ * @access public
+ */
+ public function reset() {
+ $this->do_concat = false;
+ $this->print_code = '';
+ $this->concat = '';
+ $this->concat_version = '';
+ $this->print_html = '';
+ $this->ext_version = '';
+ $this->ext_handles = '';
+ }
+}
--- /dev/null
+<?php
+/**
+ * Dependencies API: WP_Styles class
+ *
+ * @since 2.6.0
+ *
+ * @package WordPress
+ * @subpackage Dependencies
+ */
+
+/**
+ * Core class used to register styles.
+ *
+ * @package WordPress
+ * @uses WP_Dependencies
+ * @since 2.6.0
+ */
+class WP_Styles extends WP_Dependencies {
+ /**
+ * Base URL for styles.
+ *
+ * Full URL with trailing slash.
+ *
+ * @since 2.6.0
+ * @access public
+ * @var string
+ */
+ public $base_url;
+
+ /**
+ * URL of the content directory.
+ *
+ * @since 2.8.0
+ * @access public
+ * @var string
+ */
+ public $content_url;
+
+ /**
+ * Default version string for stylesheets.
+ *
+ * @since 2.6.0
+ * @access public
+ * @var string
+ */
+ public $default_version;
+
+ /**
+ * The current text direction.
+ *
+ * @since 2.6.0
+ * @access public
+ * @var string
+ */
+ public $text_direction = 'ltr';
+
+ /**
+ * Holds a list of style handles which will be concatenated.
+ *
+ * @since 2.8.0
+ * @access public
+ * @var string
+ */
+ public $concat = '';
+
+ /**
+ * Holds a string which contains style handles and their version.
+ *
+ * @since 2.8.0
+ * @deprecated 3.4.0
+ * @access public
+ * @var string
+ */
+ public $concat_version = '';
+
+ /**
+ * Whether to perform concatenation.
+ *
+ * @since 2.8.0
+ * @access public
+ * @var bool
+ */
+ public $do_concat = false;
+
+ /**
+ * Holds HTML markup of styles and additional data if concatenation
+ * is enabled.
+ *
+ * @since 2.8.0
+ * @access public
+ * @var string
+ */
+ public $print_html = '';
+
+ /**
+ * Holds inline styles if concatenation is enabled.
+ *
+ * @since 3.3.0
+ * @access public
+ * @var string
+ */
+ public $print_code = '';
+
+ /**
+ * List of default directories.
+ *
+ * @since 2.8.0
+ * @access public
+ * @var array
+ */
+ public $default_dirs;
+
+ /**
+ * Constructor.
+ *
+ * @since 2.6.0
+ * @access public
+ */
+ public function __construct() {
+ /**
+ * Fires when the WP_Styles instance is initialized.
+ *
+ * @since 2.6.0
+ *
+ * @param WP_Styles &$this WP_Styles instance, passed by reference.
+ */
+ do_action_ref_array( 'wp_default_styles', array(&$this) );
+ }
+
+ /**
+ * Processes a style dependency.
+ *
+ * @since 2.6.0
+ * @access public
+ *
+ * @see WP_Dependencies::do_item()
+ *
+ * @param string $handle The style's registered handle.
+ * @return bool True on success, false on failure.
+ */
+ public function do_item( $handle ) {
+ if ( !parent::do_item($handle) )
+ return false;
+
+ $obj = $this->registered[$handle];
+ if ( null === $obj->ver )
+ $ver = '';
+ else
+ $ver = $obj->ver ? $obj->ver : $this->default_version;
+
+ if ( isset($this->args[$handle]) )
+ $ver = $ver ? $ver . '&' . $this->args[$handle] : $this->args[$handle];
+
+ if ( $this->do_concat ) {
+ if ( $this->in_default_dir($obj->src) && !isset($obj->extra['conditional']) && !isset($obj->extra['alt']) ) {
+ $this->concat .= "$handle,";
+ $this->concat_version .= "$handle$ver";
+
+ $this->print_code .= $this->print_inline_style( $handle, false );
+
+ return true;
+ }
+ }
+
+ if ( isset($obj->args) )
+ $media = esc_attr( $obj->args );
+ else
+ $media = 'all';
+
+ // A single item may alias a set of items, by having dependencies, but no source.
+ if ( ! $obj->src ) {
+ if ( $inline_style = $this->print_inline_style( $handle, false ) ) {
+ $inline_style = sprintf( "<style id='%s-inline-css' type='text/css'>\n%s\n</style>\n", esc_attr( $handle ), $inline_style );
+ if ( $this->do_concat ) {
+ $this->print_html .= $inline_style;
+ } else {
+ echo $inline_style;
+ }
+ }
+ return true;
+ }
+
+ $href = $this->_css_href( $obj->src, $ver, $handle );
+ if ( ! $href ) {
+ return true;
+ }
+
+ $rel = isset($obj->extra['alt']) && $obj->extra['alt'] ? 'alternate stylesheet' : 'stylesheet';
+ $title = isset($obj->extra['title']) ? "title='" . esc_attr( $obj->extra['title'] ) . "'" : '';
+
+ /**
+ * Filters the HTML link tag of an enqueued style.
+ *
+ * @since 2.6.0
+ * @since 4.3.0 Introduced the `$href` parameter.
+ * @since 4.5.0 Introduced the `$media` parameter.
+ *
+ * @param string $html The link tag for the enqueued style.
+ * @param string $handle The style's registered handle.
+ * @param string $href The stylesheet's source URL.
+ * @param string $media The stylesheet's media attribute.
+ */
+ $tag = apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-css' $title href='$href' type='text/css' media='$media' />\n", $handle, $href, $media);
+ if ( 'rtl' === $this->text_direction && isset($obj->extra['rtl']) && $obj->extra['rtl'] ) {
+ if ( is_bool( $obj->extra['rtl'] ) || 'replace' === $obj->extra['rtl'] ) {
+ $suffix = isset( $obj->extra['suffix'] ) ? $obj->extra['suffix'] : '';
+ $rtl_href = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $this->_css_href( $obj->src , $ver, "$handle-rtl" ));
+ } else {
+ $rtl_href = $this->_css_href( $obj->extra['rtl'], $ver, "$handle-rtl" );
+ }
+
+ /** This filter is documented in wp-includes/class.wp-styles.php */
+ $rtl_tag = apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-rtl-css' $title href='$rtl_href' type='text/css' media='$media' />\n", $handle, $rtl_href, $media );
+
+ if ( $obj->extra['rtl'] === 'replace' ) {
+ $tag = $rtl_tag;
+ } else {
+ $tag .= $rtl_tag;
+ }
+ }
+
+ $conditional_pre = $conditional_post = '';
+ if ( isset( $obj->extra['conditional'] ) && $obj->extra['conditional'] ) {
+ $conditional_pre = "<!--[if {$obj->extra['conditional']}]>\n";
+ $conditional_post = "<![endif]-->\n";
+ }
+
+ if ( $this->do_concat ) {
+ $this->print_html .= $conditional_pre;
+ $this->print_html .= $tag;
+ if ( $inline_style = $this->print_inline_style( $handle, false ) ) {
+ $this->print_html .= sprintf( "<style id='%s-inline-css' type='text/css'>\n%s\n</style>\n", esc_attr( $handle ), $inline_style );
+ }
+ $this->print_html .= $conditional_post;
+ } else {
+ echo $conditional_pre;
+ echo $tag;
+ $this->print_inline_style( $handle );
+ echo $conditional_post;
+ }
+
+ return true;
+ }
+
+ /**
+ * Adds extra CSS styles to a registered stylesheet.
+ *
+ * @since 3.3.0
+ * @access public
+ *
+ * @param string $handle The style's registered handle.
+ * @param string $code String containing the CSS styles to be added.
+ * @return bool True on success, false on failure.
+ */
+ public function add_inline_style( $handle, $code ) {
+ if ( ! $code ) {
+ return false;
+ }
+
+ $after = $this->get_data( $handle, 'after' );
+ if ( ! $after ) {
+ $after = array();
+ }
+
+ $after[] = $code;
+
+ return $this->add_data( $handle, 'after', $after );
+ }
+
+ /**
+ * Prints extra CSS styles of a registered stylesheet.
+ *
+ * @since 3.3.0
+ * @access public
+ *
+ * @param string $handle The style's registered handle.
+ * @param bool $echo Optional. Whether to echo the inline style instead of just returning it.
+ * Default true.
+ * @return string|bool False if no data exists, inline styles if `$echo` is true, true otherwise.
+ */
+ public function print_inline_style( $handle, $echo = true ) {
+ $output = $this->get_data( $handle, 'after' );
+
+ if ( empty( $output ) ) {
+ return false;
+ }
+
+ $output = implode( "\n", $output );
+
+ if ( ! $echo ) {
+ return $output;
+ }
+
+ printf( "<style id='%s-inline-css' type='text/css'>\n%s\n</style>\n", esc_attr( $handle ), $output );
+
+ return true;
+ }
+
+ /**
+ * Determines style dependencies.
+ *
+ * @since 2.6.0
+ * @access public
+ *
+ * @see WP_Dependencies::all_deps()
+ *
+ * @param mixed $handles Item handle and argument (string) or item handles and arguments (array of strings).
+ * @param bool $recursion Internal flag that function is calling itself.
+ * @param int|false $group Group level: (int) level, (false) no groups.
+ * @return bool True on success, false on failure.
+ */
+ public function all_deps( $handles, $recursion = false, $group = false ) {
+ $r = parent::all_deps( $handles, $recursion, $group );
+ if ( ! $recursion ) {
+ /**
+ * Filters the array of enqueued styles before processing for output.
+ *
+ * @since 2.6.0
+ *
+ * @param array $to_do The list of enqueued styles about to be processed.
+ */
+ $this->to_do = apply_filters( 'print_styles_array', $this->to_do );
+ }
+ return $r;
+ }
+
+ /**
+ * Generates an enqueued style's fully-qualified URL.
+ *
+ * @since 2.6.0
+ * @access public
+ *
+ * @param string $src The source of the enqueued style.
+ * @param string $ver The version of the enqueued style.
+ * @param string $handle The style's registered handle.
+ * @return string Style's fully-qualified URL.
+ */
+ public function _css_href( $src, $ver, $handle ) {
+ if ( !is_bool($src) && !preg_match('|^(https?:)?//|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
+ $src = $this->base_url . $src;
+ }
+
+ if ( !empty($ver) )
+ $src = add_query_arg('ver', $ver, $src);
+
+ /**
+ * Filters an enqueued style's fully-qualified URL.
+ *
+ * @since 2.6.0
+ *
+ * @param string $src The source URL of the enqueued style.
+ * @param string $handle The style's registered handle.
+ */
+ $src = apply_filters( 'style_loader_src', $src, $handle );
+ return esc_url( $src );
+ }
+
+ /**
+ * Whether a handle's source is in a default directory.
+ *
+ * @since 2.8.0
+ * @access public
+ *
+ * @param string $src The source of the enqueued style.
+ * @return bool True if found, false if not.
+ */
+ public function in_default_dir( $src ) {
+ if ( ! $this->default_dirs )
+ return true;
+
+ foreach ( (array) $this->default_dirs as $test ) {
+ if ( 0 === strpos($src, $test) )
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Processes items and dependencies for the footer group.
+ *
+ * HTML 5 allows styles in the body, grab late enqueued items and output them in the footer.
+ *
+ * @since 3.3.0
+ * @access public
+ *
+ * @see WP_Dependencies::do_items()
+ *
+ * @return array Handles of items that have been processed.
+ */
+ public function do_footer_items() {
+ $this->do_items(false, 1);
+ return $this->done;
+ }
+
+ /**
+ * Resets class properties.
+ *
+ * @since 3.3.0
+ * @access public
+ */
+ public function reset() {
+ $this->do_concat = false;
+ $this->concat = '';
+ $this->concat_version = '';
+ $this->print_html = '';
+ }
+}
--- /dev/null
+<?php
+/**
+ * Sets up the default filters and actions for most
+ * of the WordPress hooks.
+ *
+ * If you need to remove a default hook, this file will
+ * give you the priority for which to use to remove the
+ * hook.
+ *
+ * Not all of the default hooks are found in default-filters.php
+ *
+ * @package WordPress
+ */
+
+// Strip, trim, kses, special chars for string saves
+foreach ( array( 'pre_term_name', 'pre_comment_author_name', 'pre_link_name', 'pre_link_target', 'pre_link_rel', 'pre_user_display_name', 'pre_user_first_name', 'pre_user_last_name', 'pre_user_nickname' ) as $filter ) {
+ add_filter( $filter, 'sanitize_text_field' );
+ add_filter( $filter, 'wp_filter_kses' );
+ add_filter( $filter, '_wp_specialchars', 30 );
+}
+
+// Strip, kses, special chars for string display
+foreach ( array( 'term_name', 'comment_author_name', 'link_name', 'link_target', 'link_rel', 'user_display_name', 'user_first_name', 'user_last_name', 'user_nickname' ) as $filter ) {
+ if ( is_admin() ) {
+ // These are expensive. Run only on admin pages for defense in depth.
+ add_filter( $filter, 'sanitize_text_field' );
+ add_filter( $filter, 'wp_kses_data' );
+ }
+ add_filter( $filter, '_wp_specialchars', 30 );
+}
+
+// Kses only for textarea saves
+foreach ( array( 'pre_term_description', 'pre_link_description', 'pre_link_notes', 'pre_user_description' ) as $filter ) {
+ add_filter( $filter, 'wp_filter_kses' );
+}
+
+// Kses only for textarea admin displays
+if ( is_admin() ) {
+ foreach ( array( 'term_description', 'link_description', 'link_notes', 'user_description' ) as $filter ) {
+ add_filter( $filter, 'wp_kses_data' );
+ }
+ add_filter( 'comment_text', 'wp_kses_post' );
+}
+
+// Email saves
+foreach ( array( 'pre_comment_author_email', 'pre_user_email' ) as $filter ) {
+ add_filter( $filter, 'trim' );
+ add_filter( $filter, 'sanitize_email' );
+ add_filter( $filter, 'wp_filter_kses' );
+}
+
+// Email admin display
+foreach ( array( 'comment_author_email', 'user_email' ) as $filter ) {
+ add_filter( $filter, 'sanitize_email' );
+ if ( is_admin() )
+ add_filter( $filter, 'wp_kses_data' );
+}
+
+// Save URL
+foreach ( array( 'pre_comment_author_url', 'pre_user_url', 'pre_link_url', 'pre_link_image',
+ 'pre_link_rss', 'pre_post_guid' ) as $filter ) {
+ add_filter( $filter, 'wp_strip_all_tags' );
+ add_filter( $filter, 'esc_url_raw' );
+ add_filter( $filter, 'wp_filter_kses' );
+}
+
+// Display URL
+foreach ( array( 'user_url', 'link_url', 'link_image', 'link_rss', 'comment_url', 'post_guid' ) as $filter ) {
+ if ( is_admin() )
+ add_filter( $filter, 'wp_strip_all_tags' );
+ add_filter( $filter, 'esc_url' );
+ if ( is_admin() )
+ add_filter( $filter, 'wp_kses_data' );
+}
+
+// Slugs
+add_filter( 'pre_term_slug', 'sanitize_title' );
+add_filter( 'wp_insert_post_data', '_wp_customize_changeset_filter_insert_post_data', 10, 2 );
+
+// Keys
+foreach ( array( 'pre_post_type', 'pre_post_status', 'pre_post_comment_status', 'pre_post_ping_status' ) as $filter ) {
+ add_filter( $filter, 'sanitize_key' );
+}
+
+// Mime types
+add_filter( 'pre_post_mime_type', 'sanitize_mime_type' );
+add_filter( 'post_mime_type', 'sanitize_mime_type' );
+
+// Meta
+add_filter( 'register_meta_args', '_wp_register_meta_args_whitelist', 10, 2 );
+
+// Places to balance tags on input
+foreach ( array( 'content_save_pre', 'excerpt_save_pre', 'comment_save_pre', 'pre_comment_content' ) as $filter ) {
+ add_filter( $filter, 'convert_invalid_entities' );
+ add_filter( $filter, 'balanceTags', 50 );
+}
+
+// Format strings for display.
+foreach ( array( 'comment_author', 'term_name', 'link_name', 'link_description', 'link_notes', 'bloginfo', 'wp_title', 'widget_title' ) as $filter ) {
+ add_filter( $filter, 'wptexturize' );
+ add_filter( $filter, 'convert_chars' );
+ add_filter( $filter, 'esc_html' );
+}
+
+// Format WordPress
+foreach ( array( 'the_content', 'the_title', 'wp_title' ) as $filter )
+ add_filter( $filter, 'capital_P_dangit', 11 );
+add_filter( 'comment_text', 'capital_P_dangit', 31 );
+
+// Format titles
+foreach ( array( 'single_post_title', 'single_cat_title', 'single_tag_title', 'single_month_title', 'nav_menu_attr_title', 'nav_menu_description' ) as $filter ) {
+ add_filter( $filter, 'wptexturize' );
+ add_filter( $filter, 'strip_tags' );
+}
+
+// Format text area for display.
+foreach ( array( 'term_description' ) as $filter ) {
+ add_filter( $filter, 'wptexturize' );
+ add_filter( $filter, 'convert_chars' );
+ add_filter( $filter, 'wpautop' );
+ add_filter( $filter, 'shortcode_unautop');
+}
+
+// Format for RSS
+add_filter( 'term_name_rss', 'convert_chars' );
+
+// Pre save hierarchy
+add_filter( 'wp_insert_post_parent', 'wp_check_post_hierarchy_for_loops', 10, 2 );
+add_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10, 3 );
+
+// Display filters
+add_filter( 'the_title', 'wptexturize' );
+add_filter( 'the_title', 'convert_chars' );
+add_filter( 'the_title', 'trim' );
+
+add_filter( 'the_content', 'wptexturize' );
+add_filter( 'the_content', 'convert_smilies', 20 );
+add_filter( 'the_content', 'wpautop' );
+add_filter( 'the_content', 'shortcode_unautop' );
+add_filter( 'the_content', 'prepend_attachment' );
+add_filter( 'the_content', 'wp_make_content_images_responsive' );
+
+add_filter( 'the_excerpt', 'wptexturize' );
+add_filter( 'the_excerpt', 'convert_smilies' );
+add_filter( 'the_excerpt', 'convert_chars' );
+add_filter( 'the_excerpt', 'wpautop' );
+add_filter( 'the_excerpt', 'shortcode_unautop');
+add_filter( 'get_the_excerpt', 'wp_trim_excerpt' );
+
+add_filter( 'the_post_thumbnail_caption', 'wptexturize' );
+add_filter( 'the_post_thumbnail_caption', 'convert_smilies' );
+add_filter( 'the_post_thumbnail_caption', 'convert_chars' );
+
+add_filter( 'comment_text', 'wptexturize' );
+add_filter( 'comment_text', 'convert_chars' );
+add_filter( 'comment_text', 'make_clickable', 9 );
+add_filter( 'comment_text', 'force_balance_tags', 25 );
+add_filter( 'comment_text', 'convert_smilies', 20 );
+add_filter( 'comment_text', 'wpautop', 30 );
+
+add_filter( 'comment_excerpt', 'convert_chars' );
+
+add_filter( 'list_cats', 'wptexturize' );
+
+add_filter( 'wp_sprintf', 'wp_sprintf_l', 10, 2 );
+
+add_filter( 'widget_text', 'balanceTags' );
+
+add_filter( 'date_i18n', 'wp_maybe_decline_date' );
+
+// RSS filters
+add_filter( 'the_title_rss', 'strip_tags' );
+add_filter( 'the_title_rss', 'ent2ncr', 8 );
+add_filter( 'the_title_rss', 'esc_html' );
+add_filter( 'the_content_rss', 'ent2ncr', 8 );
+add_filter( 'the_content_feed', 'wp_staticize_emoji' );
+add_filter( 'the_content_feed', '_oembed_filter_feed_content' );
+add_filter( 'the_excerpt_rss', 'convert_chars' );
+add_filter( 'the_excerpt_rss', 'ent2ncr', 8 );
+add_filter( 'comment_author_rss', 'ent2ncr', 8 );
+add_filter( 'comment_text_rss', 'ent2ncr', 8 );
+add_filter( 'comment_text_rss', 'esc_html' );
+add_filter( 'comment_text_rss', 'wp_staticize_emoji' );
+add_filter( 'bloginfo_rss', 'ent2ncr', 8 );
+add_filter( 'the_author', 'ent2ncr', 8 );
+add_filter( 'the_guid', 'esc_url' );
+
+// Email filters
+add_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
+
+// Mark site as no longer fresh
+foreach ( array( 'publish_post', 'publish_page', 'wp_ajax_save-widget', 'wp_ajax_widgets-order', 'customize_save_after' ) as $action ) {
+ add_action( $action, '_delete_option_fresh_site' );
+}
+
+// Misc filters
+add_filter( 'option_ping_sites', 'privacy_ping_filter' );
+add_filter( 'option_blog_charset', '_wp_specialchars' ); // IMPORTANT: This must not be wp_specialchars() or esc_html() or it'll cause an infinite loop
+add_filter( 'option_blog_charset', '_canonical_charset' );
+add_filter( 'option_home', '_config_wp_home' );
+add_filter( 'option_siteurl', '_config_wp_siteurl' );
+add_filter( 'tiny_mce_before_init', '_mce_set_direction' );
+add_filter( 'teeny_mce_before_init', '_mce_set_direction' );
+add_filter( 'pre_kses', 'wp_pre_kses_less_than' );
+add_filter( 'sanitize_title', 'sanitize_title_with_dashes', 10, 3 );
+add_action( 'check_comment_flood', 'check_comment_flood_db', 10, 4 );
+add_filter( 'comment_flood_filter', 'wp_throttle_comment_flood', 10, 3 );
+add_filter( 'pre_comment_content', 'wp_rel_nofollow', 15 );
+add_filter( 'comment_email', 'antispambot' );
+add_filter( 'option_tag_base', '_wp_filter_taxonomy_base' );
+add_filter( 'option_category_base', '_wp_filter_taxonomy_base' );
+add_filter( 'the_posts', '_close_comments_for_old_posts', 10, 2);
+add_filter( 'comments_open', '_close_comments_for_old_post', 10, 2 );
+add_filter( 'pings_open', '_close_comments_for_old_post', 10, 2 );
+add_filter( 'editable_slug', 'urldecode' );
+add_filter( 'editable_slug', 'esc_textarea' );
+add_filter( 'nav_menu_meta_box_object', '_wp_nav_menu_meta_box_object' );
+add_filter( 'pingback_ping_source_uri', 'pingback_ping_source_uri' );
+add_filter( 'xmlrpc_pingback_error', 'xmlrpc_pingback_error' );
+add_filter( 'title_save_pre', 'trim' );
+
+add_action( 'transition_comment_status', '_clear_modified_cache_on_transition_comment_status', 10, 2 );
+
+add_filter( 'http_request_host_is_external', 'allowed_http_request_hosts', 10, 2 );
+
+// REST API filters.
+add_action( 'xmlrpc_rsd_apis', 'rest_output_rsd' );
+add_action( 'wp_head', 'rest_output_link_wp_head', 10, 0 );
+add_action( 'template_redirect', 'rest_output_link_header', 11, 0 );
+add_action( 'auth_cookie_malformed', 'rest_cookie_collect_status' );
+add_action( 'auth_cookie_expired', 'rest_cookie_collect_status' );
+add_action( 'auth_cookie_bad_username', 'rest_cookie_collect_status' );
+add_action( 'auth_cookie_bad_hash', 'rest_cookie_collect_status' );
+add_action( 'auth_cookie_valid', 'rest_cookie_collect_status' );
+add_filter( 'rest_authentication_errors', 'rest_cookie_check_errors', 100 );
+
+// Actions
+add_action( 'wp_head', '_wp_render_title_tag', 1 );
+add_action( 'wp_head', 'wp_enqueue_scripts', 1 );
+add_action( 'wp_head', 'wp_resource_hints', 2 );
+add_action( 'wp_head', 'feed_links', 2 );
+add_action( 'wp_head', 'feed_links_extra', 3 );
+add_action( 'wp_head', 'rsd_link' );
+add_action( 'wp_head', 'wlwmanifest_link' );
+add_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
+add_action( 'wp_head', 'locale_stylesheet' );
+add_action( 'publish_future_post', 'check_and_publish_future_post', 10, 1 );
+add_action( 'wp_head', 'noindex', 1 );
+add_action( 'wp_head', 'print_emoji_detection_script', 7 );
+add_action( 'wp_head', 'wp_print_styles', 8 );
+add_action( 'wp_head', 'wp_print_head_scripts', 9 );
+add_action( 'wp_head', 'wp_generator' );
+add_action( 'wp_head', 'rel_canonical' );
+add_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
+add_action( 'wp_head', 'wp_custom_css_cb', 101 );
+add_action( 'wp_head', 'wp_site_icon', 99 );
+add_action( 'wp_footer', 'wp_print_footer_scripts', 20 );
+add_action( 'template_redirect', 'wp_shortlink_header', 11, 0 );
+add_action( 'wp_print_footer_scripts', '_wp_footer_scripts' );
+add_action( 'init', 'check_theme_switched', 99 );
+add_action( 'after_switch_theme', '_wp_sidebars_changed' );
+add_action( 'wp_print_styles', 'print_emoji_styles' );
+
+if ( isset( $_GET['replytocom'] ) )
+ add_action( 'wp_head', 'wp_no_robots' );
+
+// Login actions
+add_filter( 'login_head', 'wp_resource_hints', 8 );
+add_action( 'login_head', 'wp_print_head_scripts', 9 );
+add_action( 'login_head', 'print_admin_styles', 9 );
+add_action( 'login_head', 'wp_site_icon', 99 );
+add_action( 'login_footer', 'wp_print_footer_scripts', 20 );
+add_action( 'login_init', 'send_frame_options_header', 10, 0 );
+
+// Feed Generator Tags
+foreach ( array( 'rss2_head', 'commentsrss2_head', 'rss_head', 'rdf_header', 'atom_head', 'comments_atom_head', 'opml_head', 'app_head' ) as $action ) {
+ add_action( $action, 'the_generator' );
+}
+
+// Feed Site Icon
+add_action( 'atom_head', 'atom_site_icon' );
+add_action( 'rss2_head', 'rss2_site_icon' );
+
+
+// WP Cron
+if ( !defined( 'DOING_CRON' ) )
+ add_action( 'init', 'wp_cron' );
+
+// 2 Actions 2 Furious
+add_action( 'do_feed_rdf', 'do_feed_rdf', 10, 1 );
+add_action( 'do_feed_rss', 'do_feed_rss', 10, 1 );
+add_action( 'do_feed_rss2', 'do_feed_rss2', 10, 1 );
+add_action( 'do_feed_atom', 'do_feed_atom', 10, 1 );
+add_action( 'do_pings', 'do_all_pings', 10, 1 );
+add_action( 'do_robots', 'do_robots' );
+add_action( 'set_comment_cookies', 'wp_set_comment_cookies', 10, 2 );
+add_action( 'sanitize_comment_cookies', 'sanitize_comment_cookies' );
+add_action( 'admin_print_scripts', 'print_emoji_detection_script' );
+add_action( 'admin_print_scripts', 'print_head_scripts', 20 );
+add_action( 'admin_print_footer_scripts', '_wp_footer_scripts' );
+add_action( 'admin_print_styles', 'print_emoji_styles' );
+add_action( 'admin_print_styles', 'print_admin_styles', 20 );
+add_action( 'init', 'smilies_init', 5 );
+add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 );
+add_action( 'plugins_loaded', 'wp_maybe_load_embeds', 0 );
+add_action( 'shutdown', 'wp_ob_end_flush_all', 1 );
+// Create a revision whenever a post is updated.
+add_action( 'post_updated', 'wp_save_post_revision', 10, 1 );
+add_action( 'publish_post', '_publish_post_hook', 5, 1 );
+add_action( 'transition_post_status', '_transition_post_status', 5, 3 );
+add_action( 'transition_post_status', '_update_term_count_on_transition_post_status', 10, 3 );
+add_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce' );
+add_action( 'wp_scheduled_delete', 'wp_scheduled_delete' );
+add_action( 'wp_scheduled_auto_draft_delete', 'wp_delete_auto_drafts' );
+add_action( 'admin_init', 'send_frame_options_header', 10, 0 );
+add_action( 'importer_scheduled_cleanup', 'wp_delete_attachment' );
+add_action( 'upgrader_scheduled_cleanup', 'wp_delete_attachment' );
+add_action( 'welcome_panel', 'wp_welcome_panel' );
+
+// Navigation menu actions
+add_action( 'delete_post', '_wp_delete_post_menu_item' );
+add_action( 'delete_term', '_wp_delete_tax_menu_item', 10, 3 );
+add_action( 'transition_post_status', '_wp_auto_add_pages_to_menu', 10, 3 );
+
+// Post Thumbnail CSS class filtering
+add_action( 'begin_fetch_post_thumbnail_html', '_wp_post_thumbnail_class_filter_add' );
+add_action( 'end_fetch_post_thumbnail_html', '_wp_post_thumbnail_class_filter_remove' );
+
+// Redirect Old Slugs
+add_action( 'template_redirect', 'wp_old_slug_redirect' );
+add_action( 'post_updated', 'wp_check_for_changed_slugs', 12, 3 );
+add_action( 'attachment_updated', 'wp_check_for_changed_slugs', 12, 3 );
+
+// Nonce check for Post Previews
+add_action( 'init', '_show_post_preview' );
+
+// Output JS to reset window.name for previews
+add_action( 'wp_head', 'wp_post_preview_js', 1 );
+
+// Timezone
+add_filter( 'pre_option_gmt_offset','wp_timezone_override_offset' );
+
+// Admin Color Schemes
+add_action( 'admin_init', 'register_admin_color_schemes', 1);
+add_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );
+
+// If the upgrade hasn't run yet, assume link manager is used.
+add_filter( 'default_option_link_manager_enabled', '__return_true' );
+
+// This option no longer exists; tell plugins we always support auto-embedding.
+add_filter( 'default_option_embed_autourls', '__return_true' );
+
+// Default settings for heartbeat
+add_filter( 'heartbeat_settings', 'wp_heartbeat_settings' );
+
+// Check if the user is logged out
+add_action( 'admin_enqueue_scripts', 'wp_auth_check_load' );
+add_filter( 'heartbeat_send', 'wp_auth_check' );
+add_filter( 'heartbeat_nopriv_send', 'wp_auth_check' );
+
+// Default authentication filters
+add_filter( 'authenticate', 'wp_authenticate_username_password', 20, 3 );
+add_filter( 'authenticate', 'wp_authenticate_email_password', 20, 3 );
+add_filter( 'authenticate', 'wp_authenticate_spam_check', 99 );
+add_filter( 'determine_current_user', 'wp_validate_auth_cookie' );
+add_filter( 'determine_current_user', 'wp_validate_logged_in_cookie', 20 );
+
+// Split term updates.
+add_action( 'admin_init', '_wp_check_for_scheduled_split_terms' );
+add_action( 'split_shared_term', '_wp_check_split_default_terms', 10, 4 );
+add_action( 'split_shared_term', '_wp_check_split_terms_in_menus', 10, 4 );
+add_action( 'split_shared_term', '_wp_check_split_nav_menu_terms', 10, 4 );
+add_action( 'wp_split_shared_term_batch', '_wp_batch_split_terms' );
+
+// Email notifications.
+add_action( 'comment_post', 'wp_new_comment_notify_moderator' );
+add_action( 'comment_post', 'wp_new_comment_notify_postauthor' );
+add_action( 'after_password_reset', 'wp_password_change_notification' );
+add_action( 'register_new_user', 'wp_send_new_user_notifications' );
+add_action( 'edit_user_created_user', 'wp_send_new_user_notifications', 10, 2 );
+
+// REST API actions.
+add_action( 'init', 'rest_api_init' );
+add_action( 'rest_api_init', 'rest_api_default_filters', 10, 1 );
+add_action( 'rest_api_init', 'register_initial_settings', 10 );
+add_action( 'rest_api_init', 'create_initial_rest_routes', 99 );
+add_action( 'parse_request', 'rest_api_loaded' );
+
+/**
+ * Filters formerly mixed into wp-includes
+ */
+// Theme
+add_action( 'wp_loaded', '_custom_header_background_just_in_time' );
+add_action( 'wp_head', '_custom_logo_header_styles' );
+add_action( 'plugins_loaded', '_wp_customize_include' );
+add_action( 'transition_post_status', '_wp_customize_publish_changeset', 10, 3 );
+add_action( 'admin_enqueue_scripts', '_wp_customize_loader_settings' );
+add_action( 'delete_attachment', '_delete_attachment_theme_mod' );
+
+// Calendar widget cache
+add_action( 'save_post', 'delete_get_calendar_cache' );
+add_action( 'delete_post', 'delete_get_calendar_cache' );
+add_action( 'update_option_start_of_week', 'delete_get_calendar_cache' );
+add_action( 'update_option_gmt_offset', 'delete_get_calendar_cache' );
+
+// Author
+add_action( 'transition_post_status', '__clear_multi_author_cache' );
+
+// Post
+add_action( 'init', 'create_initial_post_types', 0 ); // highest priority
+add_action( 'admin_menu', '_add_post_type_submenus' );
+add_action( 'before_delete_post', '_reset_front_page_settings_for_post' );
+add_action( 'wp_trash_post', '_reset_front_page_settings_for_post' );
+add_action( 'change_locale', 'create_initial_post_types' );
+
+// Post Formats
+add_filter( 'request', '_post_format_request' );
+add_filter( 'term_link', '_post_format_link', 10, 3 );
+add_filter( 'get_post_format', '_post_format_get_term' );
+add_filter( 'get_terms', '_post_format_get_terms', 10, 3 );
+add_filter( 'wp_get_object_terms', '_post_format_wp_get_object_terms' );
+
+// KSES
+add_action( 'init', 'kses_init' );
+add_action( 'set_current_user', 'kses_init' );
+
+// Script Loader
+add_action( 'wp_default_scripts', 'wp_default_scripts' );
+add_action( 'wp_enqueue_scripts', 'wp_localize_jquery_ui_datepicker', 1000 );
+add_action( 'admin_enqueue_scripts', 'wp_localize_jquery_ui_datepicker', 1000 );
+add_filter( 'wp_print_scripts', 'wp_just_in_time_script_localization' );
+add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' );
+add_filter( 'customize_controls_print_styles', 'wp_resource_hints', 1 );
+
+add_action( 'wp_default_styles', 'wp_default_styles' );
+add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 );
+
+// Taxonomy
+add_action( 'init', 'create_initial_taxonomies', 0 ); // highest priority
+add_action( 'change_locale', 'create_initial_taxonomies' );
+
+// Canonical
+add_action( 'template_redirect', 'redirect_canonical' );
+add_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 );
+
+// Shortcodes
+add_filter( 'the_content', 'do_shortcode', 11 ); // AFTER wpautop()
+
+// Media
+add_action( 'wp_playlist_scripts', 'wp_playlist_scripts' );
+add_action( 'customize_controls_enqueue_scripts', 'wp_plupload_default_settings' );
+
+// Nav menu
+add_filter( 'nav_menu_item_id', '_nav_menu_item_id_use_once', 10, 2 );
+
+// Widgets
+add_action( 'init', 'wp_widgets_init', 1 );
+
+// Admin Bar
+// Don't remove. Wrong way to disable.
+add_action( 'template_redirect', '_wp_admin_bar_init', 0 );
+add_action( 'admin_init', '_wp_admin_bar_init' );
+add_action( 'before_signup_header', '_wp_admin_bar_init' );
+add_action( 'activate_header', '_wp_admin_bar_init' );
+add_action( 'wp_footer', 'wp_admin_bar_render', 1000 );
+add_action( 'in_admin_header', 'wp_admin_bar_render', 0 );
+
+// Former admin filters that can also be hooked on the front end
+add_action( 'media_buttons', 'media_buttons' );
+add_filter( 'image_send_to_editor', 'image_add_caption', 20, 8 );
+add_filter( 'media_send_to_editor', 'image_media_send_to_editor', 10, 3 );
+
+// Embeds
+add_action( 'rest_api_init', 'wp_oembed_register_route' );
+add_filter( 'rest_pre_serve_request', '_oembed_rest_pre_serve_request', 10, 4 );
+
+add_action( 'wp_head', 'wp_oembed_add_discovery_links' );
+add_action( 'wp_head', 'wp_oembed_add_host_js' );
+
+add_action( 'embed_head', 'enqueue_embed_scripts', 1 );
+add_action( 'embed_head', 'print_emoji_detection_script' );
+add_action( 'embed_head', 'print_embed_styles' );
+add_action( 'embed_head', 'wp_print_head_scripts', 20 );
+add_action( 'embed_head', 'wp_print_styles', 20 );
+add_action( 'embed_head', 'wp_no_robots' );
+add_action( 'embed_head', 'rel_canonical' );
+add_action( 'embed_head', 'locale_stylesheet', 30 );
+
+add_action( 'embed_content_meta', 'print_embed_comments_button' );
+add_action( 'embed_content_meta', 'print_embed_sharing_button' );
+
+add_action( 'embed_footer', 'print_embed_sharing_dialog' );
+add_action( 'embed_footer', 'print_embed_scripts' );
+add_action( 'embed_footer', 'wp_print_footer_scripts', 20 );
+
+add_filter( 'excerpt_more', 'wp_embed_excerpt_more', 20 );
+add_filter( 'the_excerpt_embed', 'wptexturize' );
+add_filter( 'the_excerpt_embed', 'convert_chars' );
+add_filter( 'the_excerpt_embed', 'wpautop' );
+add_filter( 'the_excerpt_embed', 'shortcode_unautop' );
+add_filter( 'the_excerpt_embed', 'wp_embed_excerpt_attachment' );
+
+add_filter( 'oembed_dataparse', 'wp_filter_oembed_result', 10, 3 );
+add_filter( 'oembed_response_data', 'get_oembed_response_data_rich', 10, 4 );
+add_filter( 'pre_oembed_result', 'wp_filter_pre_oembed_result', 10, 3 );
+
+unset( $filter, $action );
--- /dev/null
+<?php
+/**
+ * Dependencies API: Scripts functions
+ *
+ * @since 2.6.0
+ *
+ * @package WordPress
+ * @subpackage Dependencies
+ */
+
+/**
+ * Initialize $wp_scripts if it has not been set.
+ *
+ * @global WP_Scripts $wp_scripts
+ *
+ * @since 4.2.0
+ *
+ * @return WP_Scripts WP_Scripts instance.
+ */
+function wp_scripts() {
+ global $wp_scripts;
+ if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
+ $wp_scripts = new WP_Scripts();
+ }
+ return $wp_scripts;
+}
+
+/**
+ * Helper function to output a _doing_it_wrong message when applicable.
+ *
+ * @ignore
+ * @since 4.2.0
+ *
+ * @param string $function Function name.
+ */
+function _wp_scripts_maybe_doing_it_wrong( $function ) {
+ if ( did_action( 'init' ) || did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' ) || did_action( 'login_enqueue_scripts' ) ) {
+ return;
+ }
+
+ _doing_it_wrong( $function, sprintf(
+ /* translators: 1: wp_enqueue_scripts, 2: admin_enqueue_scripts, 3: login_enqueue_scripts */
+ __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
+ '<code>wp_enqueue_scripts</code>',
+ '<code>admin_enqueue_scripts</code>',
+ '<code>login_enqueue_scripts</code>'
+ ), '3.3.0' );
+}
+
+/**
+ * Prints scripts in document head that are in the $handles queue.
+ *
+ * Called by admin-header.php and {@see 'wp_head'} hook. Since it is called by wp_head on every page load,
+ * the function does not instantiate the WP_Scripts object unless script names are explicitly passed.
+ * Makes use of already-instantiated $wp_scripts global if present. Use provided {@see 'wp_print_scripts'}
+ * hook to register/enqueue new scripts.
+ *
+ * @see WP_Scripts::do_items()
+ * @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
+ *
+ * @since 2.1.0
+ *
+ * @param string|bool|array $handles Optional. Scripts to be printed. Default 'false'.
+ * @return array On success, a processed array of WP_Dependencies items; otherwise, an empty array.
+ */
+function wp_print_scripts( $handles = false ) {
+ /**
+ * Fires before scripts in the $handles queue are printed.
+ *
+ * @since 2.1.0
+ */
+ do_action( 'wp_print_scripts' );
+ if ( '' === $handles ) { // for wp_head
+ $handles = false;
+ }
+
+ _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+
+ global $wp_scripts;
+ if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
+ if ( ! $handles ) {
+ return array(); // No need to instantiate if nothing is there.
+ }
+ }
+
+ return wp_scripts()->do_items( $handles );
+}
+
+/**
+ * Adds extra code to a registered script.
+ *
+ * Code will only be added if the script in already in the queue.
+ * Accepts a string $data containing the Code. If two or more code blocks
+ * are added to the same script $handle, they will be printed in the order
+ * they were added, i.e. the latter added code can redeclare the previous.
+ *
+ * @since 4.5.0
+ *
+ * @see WP_Scripts::add_inline_script()
+ *
+ * @param string $handle Name of the script to add the inline script to.
+ * @param string $data String containing the javascript to be added.
+ * @param string $position Optional. Whether to add the inline script before the handle
+ * or after. Default 'after'.
+ * @return bool True on success, false on failure.
+ */
+function wp_add_inline_script( $handle, $data, $position = 'after' ) {
+ _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+
+ if ( false !== stripos( $data, '</script>' ) ) {
+ _doing_it_wrong( __FUNCTION__, sprintf(
+ /* translators: 1: <script>, 2: wp_add_inline_script() */
+ __( 'Do not pass %1$s tags to %2$s.' ),
+ '<code><script></code>',
+ '<code>wp_add_inline_script()</code>'
+ ), '4.5.0' );
+ $data = trim( preg_replace( '#<script[^>]*>(.*)</script>#is', '$1', $data ) );
+ }
+
+ return wp_scripts()->add_inline_script( $handle, $data, $position );
+}
+
+/**
+ * Register a new script.
+ *
+ * Registers a script to be enqueued later using the wp_enqueue_script() function.
+ *
+ * @see WP_Dependencies::add()
+ * @see WP_Dependencies::add_data()
+ *
+ * @since 2.1.0
+ * @since 4.3.0 A return value was added.
+ *
+ * @param string $handle Name of the script. Should be unique.
+ * @param string $src Full URL of the script, or path of the script relative to the WordPress root directory.
+ * @param array $deps Optional. An array of registered script handles this script depends on. Default empty array.
+ * @param string|bool|null $ver Optional. String specifying script version number, if it has one, which is added to the URL
+ * as a query string for cache busting purposes. If version is set to false, a version
+ * number is automatically added equal to current installed WordPress version.
+ * If set to null, no version is added.
+ * @param bool $in_footer Optional. Whether to enqueue the script before </body> instead of in the <head>.
+ * Default 'false'.
+ * @return bool Whether the script has been registered. True on success, false on failure.
+ */
+function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) {
+ $wp_scripts = wp_scripts();
+ _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+
+ $registered = $wp_scripts->add( $handle, $src, $deps, $ver );
+ if ( $in_footer ) {
+ $wp_scripts->add_data( $handle, 'group', 1 );
+ }
+
+ return $registered;
+}
+
+/**
+ * Localize a script.
+ *
+ * Works only if the script has already been added.
+ *
+ * Accepts an associative array $l10n and creates a JavaScript object:
+ *
+ * "$object_name" = {
+ * key: value,
+ * key: value,
+ * ...
+ * }
+ *
+ *
+ * @see WP_Dependencies::localize()
+ * @link https://core.trac.wordpress.org/ticket/11520
+ * @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
+ *
+ * @since 2.2.0
+ *
+ * @todo Documentation cleanup
+ *
+ * @param string $handle Script handle the data will be attached to.
+ * @param string $object_name Name for the JavaScript object. Passed directly, so it should be qualified JS variable.
+ * Example: '/[a-zA-Z0-9_]+/'.
+ * @param array $l10n The data itself. The data can be either a single or multi-dimensional array.
+ * @return bool True if the script was successfully localized, false otherwise.
+ */
+function wp_localize_script( $handle, $object_name, $l10n ) {
+ global $wp_scripts;
+ if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
+ _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+ return false;
+ }
+
+ return $wp_scripts->localize( $handle, $object_name, $l10n );
+}
+
+/**
+ * Remove a registered script.
+ *
+ * Note: there are intentional safeguards in place to prevent critical admin scripts,
+ * such as jQuery core, from being unregistered.
+ *
+ * @see WP_Dependencies::remove()
+ *
+ * @since 2.1.0
+ *
+ * @param string $handle Name of the script to be removed.
+ */
+function wp_deregister_script( $handle ) {
+ _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+
+ /**
+ * Do not allow accidental or negligent de-registering of critical scripts in the admin.
+ * Show minimal remorse if the correct hook is used.
+ */
+ $current_filter = current_filter();
+ if ( ( is_admin() && 'admin_enqueue_scripts' !== $current_filter ) ||
+ ( 'wp-login.php' === $GLOBALS['pagenow'] && 'login_enqueue_scripts' !== $current_filter )
+ ) {
+ $no = array(
+ 'jquery', 'jquery-core', 'jquery-migrate', 'jquery-ui-core', 'jquery-ui-accordion',
+ 'jquery-ui-autocomplete', 'jquery-ui-button', 'jquery-ui-datepicker', 'jquery-ui-dialog',
+ 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-menu', 'jquery-ui-mouse',
+ 'jquery-ui-position', 'jquery-ui-progressbar', 'jquery-ui-resizable', 'jquery-ui-selectable',
+ 'jquery-ui-slider', 'jquery-ui-sortable', 'jquery-ui-spinner', 'jquery-ui-tabs',
+ 'jquery-ui-tooltip', 'jquery-ui-widget', 'underscore', 'backbone',
+ );
+
+ if ( in_array( $handle, $no ) ) {
+ $message = sprintf(
+ /* translators: 1: script name, 2: wp_enqueue_scripts */
+ __( 'Do not deregister the %1$s script in the administration area. To target the front-end theme, use the %2$s hook.' ),
+ "<code>$handle</code>",
+ '<code>wp_enqueue_scripts</code>'
+ );
+ _doing_it_wrong( __FUNCTION__, $message, '3.6.0' );
+ return;
+ }
+ }
+
+ wp_scripts()->remove( $handle );
+}
+
+/**
+ * Enqueue a script.
+ *
+ * Registers the script if $src provided (does NOT overwrite), and enqueues it.
+ *
+ * @see WP_Dependencies::add()
+ * @see WP_Dependencies::add_data()
+ * @see WP_Dependencies::enqueue()
+ *
+ * @since 2.1.0
+ *
+ * @param string $handle Name of the script. Should be unique.
+ * @param string $src Full URL of the script, or path of the script relative to the WordPress root directory.
+ * Default empty.
+ * @param array $deps Optional. An array of registered script handles this script depends on. Default empty array.
+ * @param string|bool|null $ver Optional. String specifying script version number, if it has one, which is added to the URL
+ * as a query string for cache busting purposes. If version is set to false, a version
+ * number is automatically added equal to current installed WordPress version.
+ * If set to null, no version is added.
+ * @param bool $in_footer Optional. Whether to enqueue the script before </body> instead of in the <head>.
+ * Default 'false'.
+ */
+function wp_enqueue_script( $handle, $src = '', $deps = array(), $ver = false, $in_footer = false ) {
+ $wp_scripts = wp_scripts();
+
+ _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+
+
+ if ( $src || $in_footer ) {
+ $_handle = explode( '?', $handle );
+
+ if ( $src ) {
+ $wp_scripts->add( $_handle[0], $src, $deps, $ver );
+ }
+
+ if ( $in_footer ) {
+ $wp_scripts->add_data( $_handle[0], 'group', 1 );
+ }
+ }
+
+ $wp_scripts->enqueue( $handle );
+}
+
+/**
+ * Remove a previously enqueued script.
+ *
+ * @see WP_Dependencies::dequeue()
+ *
+ * @since 3.1.0
+ *
+ * @param string $handle Name of the script to be removed.
+ */
+function wp_dequeue_script( $handle ) {
+ _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+
+ wp_scripts()->dequeue( $handle );
+}
+
+/**
+ * Check whether a script has been added to the queue.
+ *
+ * @since 2.8.0
+ * @since 3.5.0 'enqueued' added as an alias of the 'queue' list.
+ *
+ * @param string $handle Name of the script.
+ * @param string $list Optional. Status of the script to check. Default 'enqueued'.
+ * Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'.
+ * @return bool Whether the script is queued.
+ */
+function wp_script_is( $handle, $list = 'enqueued' ) {
+ _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+
+ return (bool) wp_scripts()->query( $handle, $list );
+}
+
+/**
+ * Add metadata to a script.
+ *
+ * Works only if the script has already been added.
+ *
+ * Possible values for $key and $value:
+ * 'conditional' string Comments for IE 6, lte IE 7, etc.
+ *
+ * @since 4.2.0
+ *
+ * @see WP_Dependency::add_data()
+ *
+ * @param string $handle Name of the script.
+ * @param string $key Name of data point for which we're storing a value.
+ * @param mixed $value String containing the data to be added.
+ * @return bool True on success, false on failure.
+ */
+function wp_script_add_data( $handle, $key, $value ){
+ return wp_scripts()->add_data( $handle, $key, $value );
+}
--- /dev/null
+<?php
+/**
+ * Dependencies API: Styles functions
+ *
+ * @since 2.6.0
+ *
+ * @package WordPress
+ * @subpackage Dependencies
+ */
+
+/**
+ * Initialize $wp_styles if it has not been set.
+ *
+ * @global WP_Styles $wp_styles
+ *
+ * @since 4.2.0
+ *
+ * @return WP_Styles WP_Styles instance.
+ */
+function wp_styles() {
+ global $wp_styles;
+ if ( ! ( $wp_styles instanceof WP_Styles ) ) {
+ $wp_styles = new WP_Styles();
+ }
+ return $wp_styles;
+}
+
+/**
+ * Display styles that are in the $handles queue.
+ *
+ * Passing an empty array to $handles prints the queue,
+ * passing an array with one string prints that style,
+ * and passing an array of strings prints those styles.
+ *
+ * @global WP_Styles $wp_styles The WP_Styles object for printing styles.
+ *
+ * @since 2.6.0
+ *
+ * @param string|bool|array $handles Styles to be printed. Default 'false'.
+ * @return array On success, a processed array of WP_Dependencies items; otherwise, an empty array.
+ */
+function wp_print_styles( $handles = false ) {
+ if ( '' === $handles ) { // for wp_head
+ $handles = false;
+ }
+ /**
+ * Fires before styles in the $handles queue are printed.
+ *
+ * @since 2.6.0
+ */
+ if ( ! $handles ) {
+ do_action( 'wp_print_styles' );
+ }
+
+ _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+
+ global $wp_styles;
+ if ( ! ( $wp_styles instanceof WP_Styles ) ) {
+ if ( ! $handles ) {
+ return array(); // No need to instantiate if nothing is there.
+ }
+ }
+
+ return wp_styles()->do_items( $handles );
+}
+
+/**
+ * Add extra CSS styles to a registered stylesheet.
+ *
+ * Styles will only be added if the stylesheet in already in the queue.
+ * Accepts a string $data containing the CSS. If two or more CSS code blocks
+ * are added to the same stylesheet $handle, they will be printed in the order
+ * they were added, i.e. the latter added styles can redeclare the previous.
+ *
+ * @see WP_Styles::add_inline_style()
+ *
+ * @since 3.3.0
+ *
+ * @param string $handle Name of the stylesheet to add the extra styles to.
+ * @param string $data String containing the CSS styles to be added.
+ * @return bool True on success, false on failure.
+ */
+function wp_add_inline_style( $handle, $data ) {
+ _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+
+ if ( false !== stripos( $data, '</style>' ) ) {
+ _doing_it_wrong( __FUNCTION__, sprintf(
+ /* translators: 1: <style>, 2: wp_add_inline_style() */
+ __( 'Do not pass %1$s tags to %2$s.' ),
+ '<code><style></code>',
+ '<code>wp_add_inline_style()</code>'
+ ), '3.7.0' );
+ $data = trim( preg_replace( '#<style[^>]*>(.*)</style>#is', '$1', $data ) );
+ }
+
+ return wp_styles()->add_inline_style( $handle, $data );
+}
+
+/**
+ * Register a CSS stylesheet.
+ *
+ * @see WP_Dependencies::add()
+ * @link https://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types.
+ *
+ * @since 2.6.0
+ * @since 4.3.0 A return value was added.
+ *
+ * @param string $handle Name of the stylesheet. Should be unique.
+ * @param string $src Full URL of the stylesheet, or path of the stylesheet relative to the WordPress root directory.
+ * @param array $deps Optional. An array of registered stylesheet handles this stylesheet depends on. Default empty array.
+ * @param string|bool|null $ver Optional. String specifying stylesheet version number, if it has one, which is added to the URL
+ * as a query string for cache busting purposes. If version is set to false, a version
+ * number is automatically added equal to current installed WordPress version.
+ * If set to null, no version is added.
+ * @param string $media Optional. The media for which this stylesheet has been defined.
+ * Default 'all'. Accepts media types like 'all', 'print' and 'screen', or media queries like
+ * '(orientation: portrait)' and '(max-width: 640px)'.
+ * @return bool Whether the style has been registered. True on success, false on failure.
+ */
+function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
+ _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+
+ return wp_styles()->add( $handle, $src, $deps, $ver, $media );
+}
+
+/**
+ * Remove a registered stylesheet.
+ *
+ * @see WP_Dependencies::remove()
+ *
+ * @since 2.1.0
+ *
+ * @param string $handle Name of the stylesheet to be removed.
+ */
+function wp_deregister_style( $handle ) {
+ _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+
+ wp_styles()->remove( $handle );
+}
+
+/**
+ * Enqueue a CSS stylesheet.
+ *
+ * Registers the style if source provided (does NOT overwrite) and enqueues.
+ *
+ * @see WP_Dependencies::add()
+ * @see WP_Dependencies::enqueue()
+ * @link https://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types.
+ *
+ * @since 2.6.0
+ *
+ * @param string $handle Name of the stylesheet. Should be unique.
+ * @param string $src Full URL of the stylesheet, or path of the stylesheet relative to the WordPress root directory.
+ * Default empty.
+ * @param array $deps Optional. An array of registered stylesheet handles this stylesheet depends on. Default empty array.
+ * @param string|bool|null $ver Optional. String specifying stylesheet version number, if it has one, which is added to the URL
+ * as a query string for cache busting purposes. If version is set to false, a version
+ * number is automatically added equal to current installed WordPress version.
+ * If set to null, no version is added.
+ * @param string $media Optional. The media for which this stylesheet has been defined.
+ * Default 'all'. Accepts media types like 'all', 'print' and 'screen', or media queries like
+ * '(orientation: portrait)' and '(max-width: 640px)'.
+ */
+function wp_enqueue_style( $handle, $src = '', $deps = array(), $ver = false, $media = 'all' ) {
+ _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+
+ $wp_styles = wp_styles();
+
+ if ( $src ) {
+ $_handle = explode('?', $handle);
+ $wp_styles->add( $_handle[0], $src, $deps, $ver, $media );
+ }
+ $wp_styles->enqueue( $handle );
+}
+
+/**
+ * Remove a previously enqueued CSS stylesheet.
+ *
+ * @see WP_Dependencies::dequeue()
+ *
+ * @since 3.1.0
+ *
+ * @param string $handle Name of the stylesheet to be removed.
+ */
+function wp_dequeue_style( $handle ) {
+ _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+
+ wp_styles()->dequeue( $handle );
+}
+
+/**
+ * Check whether a CSS stylesheet has been added to the queue.
+ *
+ * @since 2.8.0
+ *
+ * @param string $handle Name of the stylesheet.
+ * @param string $list Optional. Status of the stylesheet to check. Default 'enqueued'.
+ * Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'.
+ * @return bool Whether style is queued.
+ */
+function wp_style_is( $handle, $list = 'enqueued' ) {
+ _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+
+ return (bool) wp_styles()->query( $handle, $list );
+}
+
+/**
+ * Add metadata to a CSS stylesheet.
+ *
+ * Works only if the stylesheet has already been added.
+ *
+ * Possible values for $key and $value:
+ * 'conditional' string Comments for IE 6, lte IE 7 etc.
+ * 'rtl' bool|string To declare an RTL stylesheet.
+ * 'suffix' string Optional suffix, used in combination with RTL.
+ * 'alt' bool For rel="alternate stylesheet".
+ * 'title' string For preferred/alternate stylesheets.
+ *
+ * @see WP_Dependency::add_data()
+ *
+ * @since 3.6.0
+ *
+ * @param string $handle Name of the stylesheet.
+ * @param string $key Name of data point for which we're storing a value.
+ * Accepts 'conditional', 'rtl' and 'suffix', 'alt' and 'title'.
+ * @param mixed $value String containing the CSS data to be added.
+ * @return bool True on success, false on failure.
+ */
+function wp_style_add_data( $handle, $key, $value ) {
+ return wp_styles()->add_data( $handle, $key, $value );
+}
--- /dev/null
+<?php
+/**
+ * These functions are needed to load WordPress.
+ *
+ * @package WordPress
+ */
+
+/**
+ * Return the HTTP protocol sent by the server.
+ *
+ * @since 4.4.0
+ *
+ * @return string The HTTP protocol. Default: HTTP/1.0.
+ */
+function wp_get_server_protocol() {
+ $protocol = $_SERVER['SERVER_PROTOCOL'];
+ if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) {
+ $protocol = 'HTTP/1.0';
+ }
+ return $protocol;
+}
+
+/**
+ * Turn register globals off.
+ *
+ * @since 2.1.0
+ * @access private
+ */
+function wp_unregister_GLOBALS() {
+ if ( !ini_get( 'register_globals' ) )
+ return;
+
+ if ( isset( $_REQUEST['GLOBALS'] ) )
+ die( 'GLOBALS overwrite attempt detected' );
+
+ // Variables that shouldn't be unset
+ $no_unset = array( 'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix' );
+
+ $input = array_merge( $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset( $_SESSION ) && is_array( $_SESSION ) ? $_SESSION : array() );
+ foreach ( $input as $k => $v )
+ if ( !in_array( $k, $no_unset ) && isset( $GLOBALS[$k] ) ) {
+ unset( $GLOBALS[$k] );
+ }
+}
+
+/**
+ * Fix `$_SERVER` variables for various setups.
+ *
+ * @since 3.0.0
+ * @access private
+ *
+ * @global string $PHP_SELF The filename of the currently executing script,
+ * relative to the document root.
+ */
+function wp_fix_server_vars() {
+ global $PHP_SELF;
+
+ $default_server_values = array(
+ 'SERVER_SOFTWARE' => '',
+ 'REQUEST_URI' => '',
+ );
+
+ $_SERVER = array_merge( $default_server_values, $_SERVER );
+
+ // Fix for IIS when running with PHP ISAPI
+ if ( empty( $_SERVER['REQUEST_URI'] ) || ( PHP_SAPI != 'cgi-fcgi' && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) {
+
+ // IIS Mod-Rewrite
+ if ( isset( $_SERVER['HTTP_X_ORIGINAL_URL'] ) ) {
+ $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
+ }
+ // IIS Isapi_Rewrite
+ elseif ( isset( $_SERVER['HTTP_X_REWRITE_URL'] ) ) {
+ $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
+ } else {
+ // Use ORIG_PATH_INFO if there is no PATH_INFO
+ if ( !isset( $_SERVER['PATH_INFO'] ) && isset( $_SERVER['ORIG_PATH_INFO'] ) )
+ $_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
+
+ // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice)
+ if ( isset( $_SERVER['PATH_INFO'] ) ) {
+ if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] )
+ $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
+ else
+ $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
+ }
+
+ // Append the query string if it exists and isn't null
+ if ( ! empty( $_SERVER['QUERY_STRING'] ) ) {
+ $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
+ }
+ }
+ }
+
+ // Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests
+ if ( isset( $_SERVER['SCRIPT_FILENAME'] ) && ( strpos( $_SERVER['SCRIPT_FILENAME'], 'php.cgi' ) == strlen( $_SERVER['SCRIPT_FILENAME'] ) - 7 ) )
+ $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
+
+ // Fix for Dreamhost and other PHP as CGI hosts
+ if ( strpos( $_SERVER['SCRIPT_NAME'], 'php.cgi' ) !== false )
+ unset( $_SERVER['PATH_INFO'] );
+
+ // Fix empty PHP_SELF
+ $PHP_SELF = $_SERVER['PHP_SELF'];
+ if ( empty( $PHP_SELF ) )
+ $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace( '/(\?.*)?$/', '', $_SERVER["REQUEST_URI"] );
+}
+
+/**
+ * Check for the required PHP version, and the MySQL extension or
+ * a database drop-in.
+ *
+ * Dies if requirements are not met.
+ *
+ * @since 3.0.0
+ * @access private
+ *
+ * @global string $required_php_version The required PHP version string.
+ * @global string $wp_version The WordPress version string.
+ */
+function wp_check_php_mysql_versions() {
+ global $required_php_version, $wp_version;
+ $php_version = phpversion();
+
+ if ( version_compare( $required_php_version, $php_version, '>' ) ) {
+ wp_load_translations_early();
+
+ $protocol = wp_get_server_protocol();
+ header( sprintf( '%s 500 Internal Server Error', $protocol ), true, 500 );
+ header( 'Content-Type: text/html; charset=utf-8' );
+ /* translators: 1: Current PHP version number, 2: WordPress version number, 3: Minimum required PHP version number */
+ die( sprintf( __( 'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.' ), $php_version, $wp_version, $required_php_version ) );
+ }
+
+ if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! extension_loaded( 'mysqlnd' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
+ wp_load_translations_early();
+
+ $protocol = wp_get_server_protocol();
+ header( sprintf( '%s 500 Internal Server Error', $protocol ), true, 500 );
+ header( 'Content-Type: text/html; charset=utf-8' );
+ die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ) );
+ }
+}
+
+/**
+ * Don't load all of WordPress when handling a favicon.ico request.
+ *
+ * Instead, send the headers for a zero-length favicon and bail.
+ *
+ * @since 3.0.0
+ */
+function wp_favicon_request() {
+ if ( '/favicon.ico' == $_SERVER['REQUEST_URI'] ) {
+ header('Content-Type: image/vnd.microsoft.icon');
+ exit;
+ }
+}
+
+/**
+ * Die with a maintenance message when conditions are met.
+ *
+ * Checks for a file in the WordPress root directory named ".maintenance".
+ * This file will contain the variable $upgrading, set to the time the file
+ * was created. If the file was created less than 10 minutes ago, WordPress
+ * enters maintenance mode and displays a message.
+ *
+ * The default message can be replaced by using a drop-in (maintenance.php in
+ * the wp-content directory).
+ *
+ * @since 3.0.0
+ * @access private
+ *
+ * @global int $upgrading the unix timestamp marking when upgrading WordPress began.
+ */
+function wp_maintenance() {
+ if ( ! file_exists( ABSPATH . '.maintenance' ) || wp_installing() )
+ return;
+
+ global $upgrading;
+
+ include( ABSPATH . '.maintenance' );
+ // If the $upgrading timestamp is older than 10 minutes, don't die.
+ if ( ( time() - $upgrading ) >= 600 )
+ return;
+
+ /**
+ * Filters whether to enable maintenance mode.
+ *
+ * This filter runs before it can be used by plugins. It is designed for
+ * non-web runtimes. If this filter returns true, maintenance mode will be
+ * active and the request will end. If false, the request will be allowed to
+ * continue processing even if maintenance mode should be active.
+ *
+ * @since 4.6.0
+ *
+ * @param bool $enable_checks Whether to enable maintenance mode. Default true.
+ * @param int $upgrading The timestamp set in the .maintenance file.
+ */
+ if ( ! apply_filters( 'enable_maintenance_mode', true, $upgrading ) ) {
+ return;
+ }
+
+ if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) {
+ require_once( WP_CONTENT_DIR . '/maintenance.php' );
+ die();
+ }
+
+ wp_load_translations_early();
+
+ $protocol = wp_get_server_protocol();
+ header( "$protocol 503 Service Unavailable", true, 503 );
+ header( 'Content-Type: text/html; charset=utf-8' );
+ header( 'Retry-After: 600' );
+?>
+ <!DOCTYPE html>
+ <html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title><?php _e( 'Maintenance' ); ?></title>
+
+ </head>
+ <body>
+ <h1><?php _e( 'Briefly unavailable for scheduled maintenance. Check back in a minute.' ); ?></h1>
+ </body>
+ </html>
+<?php
+ die();
+}
+
+/**
+ * Start the WordPress micro-timer.
+ *
+ * @since 0.71
+ * @access private
+ *
+ * @global float $timestart Unix timestamp set at the beginning of the page load.
+ * @see timer_stop()
+ *
+ * @return bool Always returns true.
+ */
+function timer_start() {
+ global $timestart;
+ $timestart = microtime( true );
+ return true;
+}
+
+/**
+ * Retrieve or display the time from the page start to when function is called.
+ *
+ * @since 0.71
+ *
+ * @global float $timestart Seconds from when timer_start() is called.
+ * @global float $timeend Seconds from when function is called.
+ *
+ * @param int|bool $display Whether to echo or return the results. Accepts 0|false for return,
+ * 1|true for echo. Default 0|false.
+ * @param int $precision The number of digits from the right of the decimal to display.
+ * Default 3.
+ * @return string The "second.microsecond" finished time calculation. The number is formatted
+ * for human consumption, both localized and rounded.
+ */
+function timer_stop( $display = 0, $precision = 3 ) {
+ global $timestart, $timeend;
+ $timeend = microtime( true );
+ $timetotal = $timeend - $timestart;
+ $r = ( function_exists( 'number_format_i18n' ) ) ? number_format_i18n( $timetotal, $precision ) : number_format( $timetotal, $precision );
+ if ( $display )
+ echo $r;
+ return $r;
+}
+
+/**
+ * Set PHP error reporting based on WordPress debug settings.
+ *
+ * Uses three constants: `WP_DEBUG`, `WP_DEBUG_DISPLAY`, and `WP_DEBUG_LOG`.
+ * All three can be defined in wp-config.php. By default, `WP_DEBUG` and
+ * `WP_DEBUG_LOG` are set to false, and `WP_DEBUG_DISPLAY` is set to true.
+ *
+ * When `WP_DEBUG` is true, all PHP notices are reported. WordPress will also
+ * display internal notices: when a deprecated WordPress function, function
+ * argument, or file is used. Deprecated code may be removed from a later
+ * version.
+ *
+ * It is strongly recommended that plugin and theme developers use `WP_DEBUG`
+ * in their development environments.
+ *
+ * `WP_DEBUG_DISPLAY` and `WP_DEBUG_LOG` perform no function unless `WP_DEBUG`
+ * is true.
+ *
+ * When `WP_DEBUG_DISPLAY` is true, WordPress will force errors to be displayed.
+ * `WP_DEBUG_DISPLAY` defaults to true. Defining it as null prevents WordPress
+ * from changing the global configuration setting. Defining `WP_DEBUG_DISPLAY`
+ * as false will force errors to be hidden.
+ *
+ * When `WP_DEBUG_LOG` is true, errors will be logged to debug.log in the content
+ * directory.
+ *
+ * Errors are never displayed for XML-RPC, REST, and Ajax requests.
+ *
+ * @since 3.0.0
+ * @access private
+ */
+function wp_debug_mode() {
+ /**
+ * Filters whether to allow the debug mode check to occur.
+ *
+ * This filter runs before it can be used by plugins. It is designed for
+ * non-web run-times. Returning false causes the `WP_DEBUG` and related
+ * constants to not be checked and the default php values for errors
+ * will be used unless you take care to update them yourself.
+ *
+ * @since 4.6.0
+ *
+ * @param bool $enable_debug_mode Whether to enable debug mode checks to occur. Default true.
+ */
+ if ( ! apply_filters( 'enable_wp_debug_mode_checks', true ) ){
+ return;
+ }
+
+ if ( WP_DEBUG ) {
+ error_reporting( E_ALL );
+
+ if ( WP_DEBUG_DISPLAY )
+ ini_set( 'display_errors', 1 );
+ elseif ( null !== WP_DEBUG_DISPLAY )
+ ini_set( 'display_errors', 0 );
+
+ if ( WP_DEBUG_LOG ) {
+ ini_set( 'log_errors', 1 );
+ ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' );
+ }
+ } else {
+ error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
+ }
+
+ if ( defined( 'XMLRPC_REQUEST' ) || defined( 'REST_REQUEST' ) || ( defined( 'WP_INSTALLING' ) && WP_INSTALLING ) || wp_doing_ajax() ) {
+ @ini_set( 'display_errors', 0 );
+ }
+}
+
+/**
+ * Set the location of the language directory.
+ *
+ * To set directory manually, define the `WP_LANG_DIR` constant
+ * in wp-config.php.
+ *
+ * If the language directory exists within `WP_CONTENT_DIR`, it
+ * is used. Otherwise the language directory is assumed to live
+ * in `WPINC`.
+ *
+ * @since 3.0.0
+ * @access private
+ */
+function wp_set_lang_dir() {
+ if ( !defined( 'WP_LANG_DIR' ) ) {
+ if ( file_exists( WP_CONTENT_DIR . '/languages' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) || !@is_dir(ABSPATH . WPINC . '/languages') ) {
+ /**
+ * Server path of the language directory.
+ *
+ * No leading slash, no trailing slash, full path, not relative to ABSPATH
+ *
+ * @since 2.1.0
+ */
+ define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' );
+ if ( !defined( 'LANGDIR' ) ) {
+ // Old static relative path maintained for limited backward compatibility - won't work in some cases.
+ define( 'LANGDIR', 'wp-content/languages' );
+ }
+ } else {
+ /**
+ * Server path of the language directory.
+ *
+ * No leading slash, no trailing slash, full path, not relative to `ABSPATH`.
+ *
+ * @since 2.1.0
+ */
+ define( 'WP_LANG_DIR', ABSPATH . WPINC . '/languages' );
+ if ( !defined( 'LANGDIR' ) ) {
+ // Old relative path maintained for backward compatibility.
+ define( 'LANGDIR', WPINC . '/languages' );
+ }
+ }
+ }
+}
+
+/**
+ * Load the database class file and instantiate the `$wpdb` global.
+ *
+ * @since 2.5.0
+ *
+ * @global wpdb $wpdb The WordPress database class.
+ */
+function require_wp_db() {
+ global $wpdb;
+
+ require_once( ABSPATH . WPINC . '/wp-db.php' );
+ if ( file_exists( WP_CONTENT_DIR . '/db.php' ) )
+ require_once( WP_CONTENT_DIR . '/db.php' );
+
+ if ( isset( $wpdb ) ) {
+ return;
+ }
+
+ $wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );
+}
+
+/**
+ * Set the database table prefix and the format specifiers for database
+ * table columns.
+ *
+ * Columns not listed here default to `%s`.
+ *
+ * @since 3.0.0
+ * @access private
+ *
+ * @global wpdb $wpdb The WordPress database class.
+ * @global string $table_prefix The database table prefix.
+ */
+function wp_set_wpdb_vars() {
+ global $wpdb, $table_prefix;
+ if ( !empty( $wpdb->error ) )
+ dead_db();
+
+ $wpdb->field_types = array( 'post_author' => '%d', 'post_parent' => '%d', 'menu_order' => '%d', 'term_id' => '%d', 'term_group' => '%d', 'term_taxonomy_id' => '%d',
+ 'parent' => '%d', 'count' => '%d','object_id' => '%d', 'term_order' => '%d', 'ID' => '%d', 'comment_ID' => '%d', 'comment_post_ID' => '%d', 'comment_parent' => '%d',
+ 'user_id' => '%d', 'link_id' => '%d', 'link_owner' => '%d', 'link_rating' => '%d', 'option_id' => '%d', 'blog_id' => '%d', 'meta_id' => '%d', 'post_id' => '%d',
+ 'user_status' => '%d', 'umeta_id' => '%d', 'comment_karma' => '%d', 'comment_count' => '%d',
+ // multisite:
+ 'active' => '%d', 'cat_id' => '%d', 'deleted' => '%d', 'lang_id' => '%d', 'mature' => '%d', 'public' => '%d', 'site_id' => '%d', 'spam' => '%d',
+ );
+
+ $prefix = $wpdb->set_prefix( $table_prefix );
+
+ if ( is_wp_error( $prefix ) ) {
+ wp_load_translations_early();
+ wp_die(
+ /* translators: 1: $table_prefix 2: wp-config.php */
+ sprintf( __( '<strong>ERROR</strong>: %1$s in %2$s can only contain numbers, letters, and underscores.' ),
+ '<code>$table_prefix</code>',
+ '<code>wp-config.php</code>'
+ )
+ );
+ }
+}
+
+/**
+ * Toggle `$_wp_using_ext_object_cache` on and off without directly
+ * touching global.
+ *
+ * @since 3.7.0
+ *
+ * @global bool $_wp_using_ext_object_cache
+ *
+ * @param bool $using Whether external object cache is being used.
+ * @return bool The current 'using' setting.
+ */
+function wp_using_ext_object_cache( $using = null ) {
+ global $_wp_using_ext_object_cache;
+ $current_using = $_wp_using_ext_object_cache;
+ if ( null !== $using )
+ $_wp_using_ext_object_cache = $using;
+ return $current_using;
+}
+
+/**
+ * Start the WordPress object cache.
+ *
+ * If an object-cache.php file exists in the wp-content directory,
+ * it uses that drop-in as an external object cache.
+ *
+ * @since 3.0.0
+ * @access private
+ */
+function wp_start_object_cache() {
+ global $wp_filter;
+
+ $first_init = false;
+ if ( ! function_exists( 'wp_cache_init' ) ) {
+ if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) {
+ require_once ( WP_CONTENT_DIR . '/object-cache.php' );
+ if ( function_exists( 'wp_cache_init' ) ) {
+ wp_using_ext_object_cache( true );
+ }
+
+ // Re-initialize any hooks added manually by object-cache.php
+ if ( $wp_filter ) {
+ $wp_filter = WP_Hook::build_preinitialized_hooks( $wp_filter );
+ }
+ }
+
+ $first_init = true;
+ } elseif ( ! wp_using_ext_object_cache() && file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) {
+ /*
+ * Sometimes advanced-cache.php can load object-cache.php before
+ * it is loaded here. This breaks the function_exists check above
+ * and can result in `$_wp_using_ext_object_cache` being set
+ * incorrectly. Double check if an external cache exists.
+ */
+ wp_using_ext_object_cache( true );
+ }
+
+ if ( ! wp_using_ext_object_cache() ) {
+ require_once ( ABSPATH . WPINC . '/cache.php' );
+ }
+
+ /*
+ * If cache supports reset, reset instead of init if already
+ * initialized. Reset signals to the cache that global IDs
+ * have changed and it may need to update keys and cleanup caches.
+ */
+ if ( ! $first_init && function_exists( 'wp_cache_switch_to_blog' ) ) {
+ wp_cache_switch_to_blog( get_current_blog_id() );
+ } elseif ( function_exists( 'wp_cache_init' ) ) {
+ wp_cache_init();
+ }
+
+ if ( function_exists( 'wp_cache_add_global_groups' ) ) {
+ wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'useremail', 'userslugs', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'site-details', 'rss', 'global-posts', 'blog-id-cache', 'networks', 'sites' ) );
+ wp_cache_add_non_persistent_groups( array( 'counts', 'plugins' ) );
+ }
+}
+
+/**
+ * Redirect to the installer if WordPress is not installed.
+ *
+ * Dies with an error message when Multisite is enabled.
+ *
+ * @since 3.0.0
+ * @access private
+ */
+function wp_not_installed() {
+ if ( is_multisite() ) {
+ if ( ! is_blog_installed() && ! wp_installing() ) {
+ nocache_headers();
+
+ wp_die( __( 'The site you have requested is not installed properly. Please contact the system administrator.' ) );
+ }
+ } elseif ( ! is_blog_installed() && ! wp_installing() ) {
+ nocache_headers();
+
+ require( ABSPATH . WPINC . '/kses.php' );
+ require( ABSPATH . WPINC . '/pluggable.php' );
+ require( ABSPATH . WPINC . '/formatting.php' );
+
+ $link = wp_guess_url() . '/wp-admin/install.php';
+
+ wp_redirect( $link );
+ die();
+ }
+}
+
+/**
+ * Retrieve an array of must-use plugin files.
+ *
+ * The default directory is wp-content/mu-plugins. To change the default
+ * directory manually, define `WPMU_PLUGIN_DIR` and `WPMU_PLUGIN_URL`
+ * in wp-config.php.
+ *
+ * @since 3.0.0
+ * @access private
+ *
+ * @return array Files to include.
+ */
+function wp_get_mu_plugins() {
+ $mu_plugins = array();
+ if ( !is_dir( WPMU_PLUGIN_DIR ) )
+ return $mu_plugins;
+ if ( ! $dh = opendir( WPMU_PLUGIN_DIR ) )
+ return $mu_plugins;
+ while ( ( $plugin = readdir( $dh ) ) !== false ) {
+ if ( substr( $plugin, -4 ) == '.php' )
+ $mu_plugins[] = WPMU_PLUGIN_DIR . '/' . $plugin;
+ }
+ closedir( $dh );
+ sort( $mu_plugins );
+
+ return $mu_plugins;
+}
+
+/**
+ * Retrieve an array of active and valid plugin files.
+ *
+ * While upgrading or installing WordPress, no plugins are returned.
+ *
+ * The default directory is wp-content/plugins. To change the default
+ * directory manually, define `WP_PLUGIN_DIR` and `WP_PLUGIN_URL`
+ * in wp-config.php.
+ *
+ * @since 3.0.0
+ * @access private
+ *
+ * @return array Files.
+ */
+function wp_get_active_and_valid_plugins() {
+ $plugins = array();
+ $active_plugins = (array) get_option( 'active_plugins', array() );
+
+ // Check for hacks file if the option is enabled
+ if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) ) {
+ _deprecated_file( 'my-hacks.php', '1.5.0' );
+ array_unshift( $plugins, ABSPATH . 'my-hacks.php' );
+ }
+
+ if ( empty( $active_plugins ) || wp_installing() )
+ return $plugins;
+
+ $network_plugins = is_multisite() ? wp_get_active_network_plugins() : false;
+
+ foreach ( $active_plugins as $plugin ) {
+ if ( ! validate_file( $plugin ) // $plugin must validate as file
+ && '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
+ && file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist
+ // not already included as a network plugin
+ && ( ! $network_plugins || ! in_array( WP_PLUGIN_DIR . '/' . $plugin, $network_plugins ) )
+ )
+ $plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
+ }
+ return $plugins;
+}
+
+/**
+ * Set internal encoding.
+ *
+ * In most cases the default internal encoding is latin1, which is
+ * of no use, since we want to use the `mb_` functions for `utf-8` strings.
+ *
+ * @since 3.0.0
+ * @access private
+ */
+function wp_set_internal_encoding() {
+ if ( function_exists( 'mb_internal_encoding' ) ) {
+ $charset = get_option( 'blog_charset' );
+ if ( ! $charset || ! @mb_internal_encoding( $charset ) )
+ mb_internal_encoding( 'UTF-8' );
+ }
+}
+
+/**
+ * Add magic quotes to `$_GET`, `$_POST`, `$_COOKIE`, and `$_SERVER`.
+ *
+ * Also forces `$_REQUEST` to be `$_GET + $_POST`. If `$_SERVER`,
+ * `$_COOKIE`, or `$_ENV` are needed, use those superglobals directly.
+ *
+ * @since 3.0.0
+ * @access private
+ */
+function wp_magic_quotes() {
+ // If already slashed, strip.
+ if ( get_magic_quotes_gpc() ) {
+ $_GET = stripslashes_deep( $_GET );
+ $_POST = stripslashes_deep( $_POST );
+ $_COOKIE = stripslashes_deep( $_COOKIE );
+ }
+
+ // Escape with wpdb.
+ $_GET = add_magic_quotes( $_GET );
+ $_POST = add_magic_quotes( $_POST );
+ $_COOKIE = add_magic_quotes( $_COOKIE );
+ $_SERVER = add_magic_quotes( $_SERVER );
+
+ // Force REQUEST to be GET + POST.
+ $_REQUEST = array_merge( $_GET, $_POST );
+}
+
+/**
+ * Runs just before PHP shuts down execution.
+ *
+ * @since 1.2.0
+ * @access private
+ */
+function shutdown_action_hook() {
+ /**
+ * Fires just before PHP shuts down execution.
+ *
+ * @since 1.2.0
+ */
+ do_action( 'shutdown' );
+
+ wp_cache_close();
+}
+
+/**
+ * Copy an object.
+ *
+ * @since 2.7.0
+ * @deprecated 3.2.0
+ *
+ * @param object $object The object to clone.
+ * @return object The cloned object.
+ */
+function wp_clone( $object ) {
+ // Use parens for clone to accommodate PHP 4. See #17880
+ return clone( $object );
+}
+
+/**
+ * Whether the current request is for an administrative interface page.
+ *
+ * Does not check if the user is an administrator; current_user_can()
+ * for checking roles and capabilities.
+ *
+ * @since 1.5.1
+ *
+ * @global WP_Screen $current_screen
+ *
+ * @return bool True if inside WordPress administration interface, false otherwise.
+ */
+function is_admin() {
+ if ( isset( $GLOBALS['current_screen'] ) )
+ return $GLOBALS['current_screen']->in_admin();
+ elseif ( defined( 'WP_ADMIN' ) )
+ return WP_ADMIN;
+
+ return false;
+}
+
+/**
+ * Whether the current request is for a site's admininstrative interface.
+ *
+ * e.g. `/wp-admin/`
+ *
+ * Does not check if the user is an administrator; current_user_can()
+ * for checking roles and capabilities.
+ *
+ * @since 3.1.0
+ *
+ * @global WP_Screen $current_screen
+ *
+ * @return bool True if inside WordPress blog administration pages.
+ */
+function is_blog_admin() {
+ if ( isset( $GLOBALS['current_screen'] ) )
+ return $GLOBALS['current_screen']->in_admin( 'site' );
+ elseif ( defined( 'WP_BLOG_ADMIN' ) )
+ return WP_BLOG_ADMIN;
+
+ return false;
+}
+
+/**
+ * Whether the current request is for the network administrative interface.
+ *
+ * e.g. `/wp-admin/network/`
+ *
+ * Does not check if the user is an administrator; current_user_can()
+ * for checking roles and capabilities.
+ *
+ * @since 3.1.0
+ *
+ * @global WP_Screen $current_screen
+ *
+ * @return bool True if inside WordPress network administration pages.
+ */
+function is_network_admin() {
+ if ( isset( $GLOBALS['current_screen'] ) )
+ return $GLOBALS['current_screen']->in_admin( 'network' );
+ elseif ( defined( 'WP_NETWORK_ADMIN' ) )
+ return WP_NETWORK_ADMIN;
+
+ return false;
+}
+
+/**
+ * Whether the current request is for a user admin screen.
+ *
+ * e.g. `/wp-admin/user/`
+ *
+ * Does not inform on whether the user is an admin! Use capability
+ * checks to tell if the user should be accessing a section or not
+ * current_user_can().
+ *
+ * @since 3.1.0
+ *
+ * @global WP_Screen $current_screen
+ *
+ * @return bool True if inside WordPress user administration pages.
+ */
+function is_user_admin() {
+ if ( isset( $GLOBALS['current_screen'] ) )
+ return $GLOBALS['current_screen']->in_admin( 'user' );
+ elseif ( defined( 'WP_USER_ADMIN' ) )
+ return WP_USER_ADMIN;
+
+ return false;
+}
+
+/**
+ * If Multisite is enabled.
+ *
+ * @since 3.0.0
+ *
+ * @return bool True if Multisite is enabled, false otherwise.
+ */
+function is_multisite() {
+ if ( defined( 'MULTISITE' ) )
+ return MULTISITE;
+
+ if ( defined( 'SUBDOMAIN_INSTALL' ) || defined( 'VHOST' ) || defined( 'SUNRISE' ) )
+ return true;
+
+ return false;
+}
+
+/**
+ * Retrieve the current site ID.
+ *
+ * @since 3.1.0
+ *
+ * @global int $blog_id
+ *
+ * @return int Site ID.
+ */
+function get_current_blog_id() {
+ global $blog_id;
+ return absint($blog_id);
+}
+
+/**
+ * Retrieves the current network ID.
+ *
+ * @since 4.6.0
+ *
+ * @return int The ID of the current network.
+ */
+function get_current_network_id() {
+ if ( ! is_multisite() ) {
+ return 1;
+ }
+
+ $current_network = get_network();
+
+ if ( ! isset( $current_network->id ) ) {
+ return get_main_network_id();
+ }
+
+ return absint( $current_network->id );
+}
+
+/**
+ * Attempt an early load of translations.
+ *
+ * Used for errors encountered during the initial loading process, before
+ * the locale has been properly detected and loaded.
+ *
+ * Designed for unusual load sequences (like setup-config.php) or for when
+ * the script will then terminate with an error, otherwise there is a risk
+ * that a file can be double-included.
+ *
+ * @since 3.4.0
+ * @access private
+ *
+ * @global WP_Locale $wp_locale The WordPress date and time locale object.
+ *
+ * @staticvar bool $loaded
+ */
+function wp_load_translations_early() {
+ global $wp_locale;
+
+ static $loaded = false;
+ if ( $loaded )
+ return;
+ $loaded = true;
+
+ if ( function_exists( 'did_action' ) && did_action( 'init' ) )
+ return;
+
+ // We need $wp_local_package
+ require ABSPATH . WPINC . '/version.php';
+
+ // Translation and localization
+ require_once ABSPATH . WPINC . '/pomo/mo.php';
+ require_once ABSPATH . WPINC . '/l10n.php';
+ require_once ABSPATH . WPINC . '/class-wp-locale.php';
+ require_once ABSPATH . WPINC . '/class-wp-locale-switcher.php';
+
+ // General libraries
+ require_once ABSPATH . WPINC . '/plugin.php';
+
+ $locales = $locations = array();
+
+ while ( true ) {
+ if ( defined( 'WPLANG' ) ) {
+ if ( '' == WPLANG )
+ break;
+ $locales[] = WPLANG;
+ }
+
+ if ( isset( $wp_local_package ) )
+ $locales[] = $wp_local_package;
+
+ if ( ! $locales )
+ break;
+
+ if ( defined( 'WP_LANG_DIR' ) && @is_dir( WP_LANG_DIR ) )
+ $locations[] = WP_LANG_DIR;
+
+ if ( defined( 'WP_CONTENT_DIR' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) )
+ $locations[] = WP_CONTENT_DIR . '/languages';
+
+ if ( @is_dir( ABSPATH . 'wp-content/languages' ) )
+ $locations[] = ABSPATH . 'wp-content/languages';
+
+ if ( @is_dir( ABSPATH . WPINC . '/languages' ) )
+ $locations[] = ABSPATH . WPINC . '/languages';
+
+ if ( ! $locations )
+ break;
+
+ $locations = array_unique( $locations );
+
+ foreach ( $locales as $locale ) {
+ foreach ( $locations as $location ) {
+ if ( file_exists( $location . '/' . $locale . '.mo' ) ) {
+ load_textdomain( 'default', $location . '/' . $locale . '.mo' );
+ if ( defined( 'WP_SETUP_CONFIG' ) && file_exists( $location . '/admin-' . $locale . '.mo' ) )
+ load_textdomain( 'default', $location . '/admin-' . $locale . '.mo' );
+ break 2;
+ }
+ }
+ }
+
+ break;
+ }
+
+ $wp_locale = new WP_Locale();
+}
+
+/**
+ * Check or set whether WordPress is in "installation" mode.
+ *
+ * If the `WP_INSTALLING` constant is defined during the bootstrap, `wp_installing()` will default to `true`.
+ *
+ * @since 4.4.0
+ *
+ * @staticvar bool $installing
+ *
+ * @param bool $is_installing Optional. True to set WP into Installing mode, false to turn Installing mode off.
+ * Omit this parameter if you only want to fetch the current status.
+ * @return bool True if WP is installing, otherwise false. When a `$is_installing` is passed, the function will
+ * report whether WP was in installing mode prior to the change to `$is_installing`.
+ */
+function wp_installing( $is_installing = null ) {
+ static $installing = null;
+
+ // Support for the `WP_INSTALLING` constant, defined before WP is loaded.
+ if ( is_null( $installing ) ) {
+ $installing = defined( 'WP_INSTALLING' ) && WP_INSTALLING;
+ }
+
+ if ( ! is_null( $is_installing ) ) {
+ $old_installing = $installing;
+ $installing = $is_installing;
+ return (bool) $old_installing;
+ }
+
+ return (bool) $installing;
+}
+
+/**
+ * Determines if SSL is used.
+ *
+ * @since 2.6.0
+ * @since 4.6.0 Moved from functions.php to load.php.
+ *
+ * @return bool True if SSL, otherwise false.
+ */
+function is_ssl() {
+ if ( isset( $_SERVER['HTTPS'] ) ) {
+ if ( 'on' == strtolower( $_SERVER['HTTPS'] ) ) {
+ return true;
+ }
+
+ if ( '1' == $_SERVER['HTTPS'] ) {
+ return true;
+ }
+ } elseif ( isset($_SERVER['SERVER_PORT'] ) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
+ return true;
+ }
+ return false;
+}
+
+/**
+ * Converts a shorthand byte value to an integer byte value.
+ *
+ * @since 2.3.0
+ * @since 4.6.0 Moved from media.php to load.php.
+ *
+ * @link https://secure.php.net/manual/en/function.ini-get.php
+ * @link https://secure.php.net/manual/en/faq.using.php#faq.using.shorthandbytes
+ *
+ * @param string $value A (PHP ini) byte value, either shorthand or ordinary.
+ * @return int An integer byte value.
+ */
+function wp_convert_hr_to_bytes( $value ) {
+ $value = strtolower( trim( $value ) );
+ $bytes = (int) $value;
+
+ if ( false !== strpos( $value, 'g' ) ) {
+ $bytes *= GB_IN_BYTES;
+ } elseif ( false !== strpos( $value, 'm' ) ) {
+ $bytes *= MB_IN_BYTES;
+ } elseif ( false !== strpos( $value, 'k' ) ) {
+ $bytes *= KB_IN_BYTES;
+ }
+
+ // Deal with large (float) values which run into the maximum integer size.
+ return min( $bytes, PHP_INT_MAX );
+}
+
+/**
+ * Determines whether a PHP ini value is changeable at runtime.
+ *
+ * @since 4.6.0
+ *
+ * @link https://secure.php.net/manual/en/function.ini-get-all.php
+ *
+ * @param string $setting The name of the ini setting to check.
+ * @return bool True if the value is changeable at runtime. False otherwise.
+ */
+function wp_is_ini_value_changeable( $setting ) {
+ static $ini_all;
+
+ if ( ! isset( $ini_all ) ) {
+ $ini_all = false;
+ // Sometimes `ini_get_all()` is disabled via the `disable_functions` option for "security purposes".
+ if ( function_exists( 'ini_get_all' ) ) {
+ $ini_all = ini_get_all();
+ }
+ }
+
+ // Bit operator to workaround https://bugs.php.net/bug.php?id=44936 which changes access level to 63 in PHP 5.2.6 - 5.2.17.
+ if ( isset( $ini_all[ $setting ]['access'] ) && ( INI_ALL === ( $ini_all[ $setting ]['access'] & 7 ) || INI_USER === ( $ini_all[ $setting ]['access'] & 7 ) ) ) {
+ return true;
+ }
+
+ // If we were unable to retrieve the details, fail gracefully to assume it's changeable.
+ if ( ! is_array( $ini_all ) ) {
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Determines whether the current request is a WordPress Ajax request.
+ *
+ * @since 4.7.0
+ *
+ * @return bool True if it's a WordPress Ajax request, false otherwise.
+ */
+function wp_doing_ajax() {
+ /**
+ * Filters whether the current request is a WordPress Ajax request.
+ *
+ * @since 4.7.0
+ *
+ * @param bool $wp_doing_ajax Whether the current request is a WordPress Ajax request.
+ */
+ return apply_filters( 'wp_doing_ajax', defined( 'DOING_AJAX' ) && DOING_AJAX );
+}
+
+/**
+ * Check whether variable is a WordPress Error.
+ *
+ * Returns true if $thing is an object of the WP_Error class.
+ *
+ * @since 2.1.0
+ *
+ * @param mixed $thing Check if unknown variable is a WP_Error object.
+ * @return bool True, if WP_Error. False, if not WP_Error.
+ */
+function is_wp_error( $thing ) {
+ return ( $thing instanceof WP_Error );
+}
--- /dev/null
+<?php
+/**
+ * WordPress scripts and styles default loader.
+ *
+ * Several constants are used to manage the loading, concatenating and compression of scripts and CSS:
+ * define('SCRIPT_DEBUG', true); loads the development (non-minified) versions of all scripts and CSS, and disables compression and concatenation,
+ * define('CONCATENATE_SCRIPTS', false); disables compression and concatenation of scripts and CSS,
+ * define('COMPRESS_SCRIPTS', false); disables compression of scripts,
+ * define('COMPRESS_CSS', false); disables compression of CSS,
+ * define('ENFORCE_GZIP', true); forces gzip for compression (default is deflate).
+ *
+ * The globals $concatenate_scripts, $compress_scripts and $compress_css can be set by plugins
+ * to temporarily override the above settings. Also a compression test is run once and the result is saved
+ * as option 'can_compress_scripts' (0/1). The test will run again if that option is deleted.
+ *
+ * @package WordPress
+ */
+
+/** WordPress Dependency Class */
+require( ABSPATH . WPINC . '/class-wp-dependency.php' );
+
+/** WordPress Dependencies Class */
+require( ABSPATH . WPINC . '/class.wp-dependencies.php' );
+
+/** WordPress Scripts Class */
+require( ABSPATH . WPINC . '/class.wp-scripts.php' );
+
+/** WordPress Scripts Functions */
+require( ABSPATH . WPINC . '/functions.wp-scripts.php' );
+
+/** WordPress Styles Class */
+require( ABSPATH . WPINC . '/class.wp-styles.php' );
+
+/** WordPress Styles Functions */
+require( ABSPATH . WPINC . '/functions.wp-styles.php' );
+
+/**
+ * Register all WordPress scripts.
+ *
+ * Localizes some of them.
+ * args order: `$scripts->add( 'handle', 'url', 'dependencies', 'query-string', 1 );`
+ * when last arg === 1 queues the script for the footer
+ *
+ * @since 2.6.0
+ *
+ * @param WP_Scripts $scripts WP_Scripts object.
+ */
+function wp_default_scripts( &$scripts ) {
+ include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
+
+ $develop_src = false !== strpos( $wp_version, '-src' );
+
+ if ( ! defined( 'SCRIPT_DEBUG' ) ) {
+ define( 'SCRIPT_DEBUG', $develop_src );
+ }
+
+ if ( ! $guessurl = site_url() ) {
+ $guessed_url = true;
+ $guessurl = wp_guess_url();
+ }
+
+ $scripts->base_url = $guessurl;
+ $scripts->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : '';
+ $scripts->default_version = get_bloginfo( 'version' );
+ $scripts->default_dirs = array('/wp-admin/js/', '/wp-includes/js/');
+
+ $suffix = SCRIPT_DEBUG ? '' : '.min';
+ $dev_suffix = $develop_src ? '' : '.min';
+
+ $scripts->add( 'utils', "/wp-includes/js/utils$suffix.js" );
+ did_action( 'init' ) && $scripts->localize( 'utils', 'userSettings', array(
+ 'url' => (string) SITECOOKIEPATH,
+ 'uid' => (string) get_current_user_id(),
+ 'time' => (string) time(),
+ 'secure' => (string) ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) ),
+ ) );
+
+ $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'common', 'commonL10n', array(
+ 'warnDelete' => __( "You are about to permanently delete these items.\n 'Cancel' to stop, 'OK' to delete." ),
+ 'dismiss' => __( 'Dismiss this notice.' ),
+ 'collapseMenu' => __( 'Collapse Main menu' ),
+ 'expandMenu' => __( 'Expand Main menu' ),
+ ) );
+
+ $scripts->add( 'wp-a11y', "/wp-includes/js/wp-a11y$suffix.js", array( 'jquery' ), false, 1 );
+
+ $scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", array(), '1.6.1', 1 );
+
+ $scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", array(), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'quicktags', 'quicktagsL10n', array(
+ 'closeAllOpenTags' => __( 'Close all open tags' ),
+ 'closeTags' => __( 'close tags' ),
+ 'enterURL' => __( 'Enter the URL' ),
+ 'enterImageURL' => __( 'Enter the URL of the image' ),
+ 'enterImageDescription' => __( 'Enter a description of the image' ),
+ 'textdirection' => __( 'text direction' ),
+ 'toggleTextdirection' => __( 'Toggle Editor Text Direction' ),
+ 'dfw' => __( 'Distraction-free writing mode' ),
+ 'strong' => __( 'Bold' ),
+ 'strongClose' => __( 'Close bold tag' ),
+ 'em' => __( 'Italic' ),
+ 'emClose' => __( 'Close italic tag' ),
+ 'link' => __( 'Insert link' ),
+ 'blockquote' => __( 'Blockquote' ),
+ 'blockquoteClose' => __( 'Close blockquote tag' ),
+ 'del' => __( 'Deleted text (strikethrough)' ),
+ 'delClose' => __( 'Close deleted text tag' ),
+ 'ins' => __( 'Inserted text' ),
+ 'insClose' => __( 'Close inserted text tag' ),
+ 'image' => __( 'Insert image' ),
+ 'ul' => __( 'Bulleted list' ),
+ 'ulClose' => __( 'Close bulleted list tag' ),
+ 'ol' => __( 'Numbered list' ),
+ 'olClose' => __( 'Close numbered list tag' ),
+ 'li' => __( 'List item' ),
+ 'liClose' => __( 'Close list item tag' ),
+ 'code' => __( 'Code' ),
+ 'codeClose' => __( 'Close code tag' ),
+ 'more' => __( 'Insert Read More tag' ),
+ ) );
+
+ $scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array('prototype'), '3517m' );
+
+ $scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array('utils','jquery'), false, 1 );
+
+ // Back-compat for old DFW. To-do: remove at the end of 2016.
+ $scripts->add( 'wp-fullscreen-stub', "/wp-admin/js/wp-fullscreen-stub$suffix.js", array(), false, 1 );
+
+ $scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array('jquery'), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'wp-ajax-response', 'wpAjax', array(
+ 'noPerm' => __('Sorry, you are not allowed to do that.'),
+ 'broken' => __('An unidentified error has occurred.')
+ ) );
+
+ $scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-widget', 'jquery-ui-position' ), '20111129a', 1 );
+ did_action( 'init' ) && $scripts->localize( 'wp-pointer', 'wpPointerL10n', array(
+ 'dismiss' => __('Dismiss'),
+ ) );
+
+ $scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('heartbeat'), false, 1 );
+
+ $scripts->add( 'heartbeat', "/wp-includes/js/heartbeat$suffix.js", array('jquery'), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'heartbeat', 'heartbeatSettings',
+ /**
+ * Filters the Heartbeat settings.
+ *
+ * @since 3.6.0
+ *
+ * @param array $settings Heartbeat settings array.
+ */
+ apply_filters( 'heartbeat_settings', array() )
+ );
+
+ $scripts->add( 'wp-auth-check', "/wp-includes/js/wp-auth-check$suffix.js", array('heartbeat'), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'wp-auth-check', 'authcheckL10n', array(
+ 'beforeunload' => __('Your session has expired. You can log in again from this page or go to the login page.'),
+
+ /**
+ * Filters the authentication check interval.
+ *
+ * @since 3.6.0
+ *
+ * @param int $interval The interval in which to check a user's authentication.
+ * Default 3 minutes in seconds, or 180.
+ */
+ 'interval' => apply_filters( 'wp_auth_check_interval', 3 * MINUTE_IN_SECONDS ),
+ ) );
+
+ $scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array( 'wp-ajax-response', 'jquery-color' ), false, 1 );
+
+ // WordPress no longer uses or bundles Prototype or script.aculo.us. These are now pulled from an external source.
+ $scripts->add( 'prototype', 'https://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js', array(), '1.7.1');
+ $scripts->add( 'scriptaculous-root', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js', array('prototype'), '1.9.0');
+ $scripts->add( 'scriptaculous-builder', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/builder.js', array('scriptaculous-root'), '1.9.0');
+ $scripts->add( 'scriptaculous-dragdrop', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.9.0');
+ $scripts->add( 'scriptaculous-effects', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/effects.js', array('scriptaculous-root'), '1.9.0');
+ $scripts->add( 'scriptaculous-slider', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/slider.js', array('scriptaculous-effects'), '1.9.0');
+ $scripts->add( 'scriptaculous-sound', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/sound.js', array( 'scriptaculous-root' ), '1.9.0' );
+ $scripts->add( 'scriptaculous-controls', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/controls.js', array('scriptaculous-root'), '1.9.0');
+ $scripts->add( 'scriptaculous', false, array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls') );
+
+ // not used in core, replaced by Jcrop.js
+ $scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop') );
+
+ // jQuery
+ $scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ), '1.12.4' );
+ $scripts->add( 'jquery-core', '/wp-includes/js/jquery/jquery.js', array(), '1.12.4' );
+ $scripts->add( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate$suffix.js", array(), '1.4.1' );
+
+ // full jQuery UI
+ $scripts->add( 'jquery-ui-core', "/wp-includes/js/jquery/ui/core$dev_suffix.js", array('jquery'), '1.11.4', 1 );
+ $scripts->add( 'jquery-effects-core', "/wp-includes/js/jquery/ui/effect$dev_suffix.js", array('jquery'), '1.11.4', 1 );
+
+ $scripts->add( 'jquery-effects-blind', "/wp-includes/js/jquery/ui/effect-blind$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
+ $scripts->add( 'jquery-effects-bounce', "/wp-includes/js/jquery/ui/effect-bounce$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
+ $scripts->add( 'jquery-effects-clip', "/wp-includes/js/jquery/ui/effect-clip$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
+ $scripts->add( 'jquery-effects-drop', "/wp-includes/js/jquery/ui/effect-drop$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
+ $scripts->add( 'jquery-effects-explode', "/wp-includes/js/jquery/ui/effect-explode$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
+ $scripts->add( 'jquery-effects-fade', "/wp-includes/js/jquery/ui/effect-fade$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
+ $scripts->add( 'jquery-effects-fold', "/wp-includes/js/jquery/ui/effect-fold$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
+ $scripts->add( 'jquery-effects-highlight', "/wp-includes/js/jquery/ui/effect-highlight$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
+ $scripts->add( 'jquery-effects-puff', "/wp-includes/js/jquery/ui/effect-puff$dev_suffix.js", array('jquery-effects-core', 'jquery-effects-scale'), '1.11.4', 1 );
+ $scripts->add( 'jquery-effects-pulsate', "/wp-includes/js/jquery/ui/effect-pulsate$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
+ $scripts->add( 'jquery-effects-scale', "/wp-includes/js/jquery/ui/effect-scale$dev_suffix.js", array('jquery-effects-core', 'jquery-effects-size'), '1.11.4', 1 );
+ $scripts->add( 'jquery-effects-shake', "/wp-includes/js/jquery/ui/effect-shake$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
+ $scripts->add( 'jquery-effects-size', "/wp-includes/js/jquery/ui/effect-size$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
+ $scripts->add( 'jquery-effects-slide', "/wp-includes/js/jquery/ui/effect-slide$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
+ $scripts->add( 'jquery-effects-transfer', "/wp-includes/js/jquery/ui/effect-transfer$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
+
+ $scripts->add( 'jquery-ui-accordion', "/wp-includes/js/jquery/ui/accordion$dev_suffix.js", array('jquery-ui-core', 'jquery-ui-widget'), '1.11.4', 1 );
+ $scripts->add( 'jquery-ui-autocomplete', "/wp-includes/js/jquery/ui/autocomplete$dev_suffix.js", array( 'jquery-ui-menu', 'wp-a11y' ), '1.11.4', 1 );
+ $scripts->add( 'jquery-ui-button', "/wp-includes/js/jquery/ui/button$dev_suffix.js", array('jquery-ui-core', 'jquery-ui-widget'), '1.11.4', 1 );
+ $scripts->add( 'jquery-ui-datepicker', "/wp-includes/js/jquery/ui/datepicker$dev_suffix.js", array('jquery-ui-core'), '1.11.4', 1 );
+ $scripts->add( 'jquery-ui-dialog', "/wp-includes/js/jquery/ui/dialog$dev_suffix.js", array('jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-button', 'jquery-ui-position'), '1.11.4', 1 );
+ $scripts->add( 'jquery-ui-draggable', "/wp-includes/js/jquery/ui/draggable$dev_suffix.js", array('jquery-ui-mouse'), '1.11.4', 1 );
+ $scripts->add( 'jquery-ui-droppable', "/wp-includes/js/jquery/ui/droppable$dev_suffix.js", array('jquery-ui-draggable'), '1.11.4', 1 );
+ $scripts->add( 'jquery-ui-menu', "/wp-includes/js/jquery/ui/menu$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position' ), '1.11.4', 1 );
+ $scripts->add( 'jquery-ui-mouse', "/wp-includes/js/jquery/ui/mouse$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 );
+ $scripts->add( 'jquery-ui-position', "/wp-includes/js/jquery/ui/position$dev_suffix.js", array('jquery'), '1.11.4', 1 );
+ $scripts->add( 'jquery-ui-progressbar', "/wp-includes/js/jquery/ui/progressbar$dev_suffix.js", array('jquery-ui-core', 'jquery-ui-widget'), '1.11.4', 1 );
+ $scripts->add( 'jquery-ui-resizable', "/wp-includes/js/jquery/ui/resizable$dev_suffix.js", array('jquery-ui-mouse'), '1.11.4', 1 );
+ $scripts->add( 'jquery-ui-selectable', "/wp-includes/js/jquery/ui/selectable$dev_suffix.js", array('jquery-ui-mouse'), '1.11.4', 1 );
+ $scripts->add( 'jquery-ui-selectmenu', "/wp-includes/js/jquery/ui/selectmenu$dev_suffix.js", array('jquery-ui-menu'), '1.11.4', 1 );
+ $scripts->add( 'jquery-ui-slider', "/wp-includes/js/jquery/ui/slider$dev_suffix.js", array('jquery-ui-mouse'), '1.11.4', 1 );
+ $scripts->add( 'jquery-ui-sortable', "/wp-includes/js/jquery/ui/sortable$dev_suffix.js", array('jquery-ui-mouse'), '1.11.4', 1 );
+ $scripts->add( 'jquery-ui-spinner', "/wp-includes/js/jquery/ui/spinner$dev_suffix.js", array( 'jquery-ui-button' ), '1.11.4', 1 );
+ $scripts->add( 'jquery-ui-tabs', "/wp-includes/js/jquery/ui/tabs$dev_suffix.js", array('jquery-ui-core', 'jquery-ui-widget'), '1.11.4', 1 );
+ $scripts->add( 'jquery-ui-tooltip', "/wp-includes/js/jquery/ui/tooltip$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position' ), '1.11.4', 1 );
+ $scripts->add( 'jquery-ui-widget', "/wp-includes/js/jquery/ui/widget$dev_suffix.js", array('jquery'), '1.11.4', 1 );
+
+ // Strings for 'jquery-ui-autocomplete' live region messages
+ did_action( 'init' ) && $scripts->localize( 'jquery-ui-autocomplete', 'uiAutocompleteL10n', array(
+ 'noResults' => __( 'No results found.' ),
+ /* translators: Number of results found when using jQuery UI Autocomplete */
+ 'oneResult' => __( '1 result found. Use up and down arrow keys to navigate.' ),
+ /* translators: %d: Number of results found when using jQuery UI Autocomplete */
+ 'manyResults' => __( '%d results found. Use up and down arrow keys to navigate.' ),
+ 'itemSelected' => __( 'Item selected.' ),
+ ) );
+
+ // deprecated, not used in core, most functionality is included in jQuery 1.3
+ $scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array('jquery'), '3.37.0', 1 );
+
+ // jQuery plugins
+ $scripts->add( 'jquery-color', "/wp-includes/js/jquery/jquery.color.min.js", array('jquery'), '2.1.1', 1 );
+ $scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20m', 1 );
+ $scripts->add( 'jquery-query', "/wp-includes/js/jquery/jquery.query.js", array('jquery'), '2.1.7', 1 );
+ $scripts->add( 'jquery-serialize-object', "/wp-includes/js/jquery/jquery.serialize-object.js", array('jquery'), '0.2', 1 );
+ $scripts->add( 'jquery-hotkeys', "/wp-includes/js/jquery/jquery.hotkeys$suffix.js", array('jquery'), '0.0.2m', 1 );
+ $scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array('jquery', 'jquery-hotkeys'), false, 1 );
+ $scripts->add( 'jquery-touch-punch', "/wp-includes/js/jquery/jquery.ui.touch-punch.js", array('jquery-ui-widget', 'jquery-ui-mouse'), '0.2.2', 1 );
+
+ // Not used any more, registered for backwards compatibility.
+ $scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array('jquery'), '1.1-20110113', 1 );
+
+ // Masonry v2 depended on jQuery. v3 does not. The older jquery-masonry handle is a shiv.
+ // It sets jQuery as a dependency, as the theme may have been implicitly loading it this way.
+ $scripts->add( 'imagesloaded', "/wp-includes/js/imagesloaded.min.js", array(), '3.2.0', 1 );
+ $scripts->add( 'masonry', "/wp-includes/js/masonry.min.js", array( 'imagesloaded' ), '3.3.2', 1 );
+ $scripts->add( 'jquery-masonry', "/wp-includes/js/jquery/jquery.masonry$dev_suffix.js", array( 'jquery', 'masonry' ), '3.1.2b', 1 );
+
+ $scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20121105', 1 );
+ did_action( 'init' ) && $scripts->localize( 'thickbox', 'thickboxL10n', array(
+ 'next' => __('Next >'),
+ 'prev' => __('< Prev'),
+ 'image' => __('Image'),
+ 'of' => __('of'),
+ 'close' => __('Close'),
+ 'noiframes' => __('This feature requires inline frames. You have iframes disabled or your browser does not support them.'),
+ 'loadingAnimation' => includes_url('js/thickbox/loadingAnimation.gif'),
+ ) );
+
+ $scripts->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop.min.js", array('jquery'), '0.9.12');
+
+ $scripts->add( 'swfobject', "/wp-includes/js/swfobject.js", array(), '2.2-20120417');
+
+ // error message for both plupload and swfupload
+ $uploader_l10n = array(
+ 'queue_limit_exceeded' => __('You have attempted to queue too many files.'),
+ 'file_exceeds_size_limit' => __('%s exceeds the maximum upload size for this site.'),
+ 'zero_byte_file' => __('This file is empty. Please try another.'),
+ 'invalid_filetype' => __('This file type is not allowed. Please try another.'),
+ 'not_an_image' => __('This file is not an image. Please try another.'),
+ 'image_memory_exceeded' => __('Memory exceeded. Please try another smaller file.'),
+ 'image_dimensions_exceeded' => __('This is larger than the maximum size. Please try another.'),
+ 'default_error' => __('An error occurred in the upload. Please try again later.'),
+ 'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'),
+ 'upload_limit_exceeded' => __('You may only upload 1 file.'),
+ 'http_error' => __('HTTP error.'),
+ 'upload_failed' => __('Upload failed.'),
+ /* translators: 1: Opening link tag, 2: Closing link tag */
+ 'big_upload_failed' => __('Please try uploading this file with the %1$sbrowser uploader%2$s.'),
+ 'big_upload_queued' => __('%s exceeds the maximum upload size for the multi-file uploader when used in your browser.'),
+ 'io_error' => __('IO error.'),
+ 'security_error' => __('Security error.'),
+ 'file_cancelled' => __('File canceled.'),
+ 'upload_stopped' => __('Upload stopped.'),
+ 'dismiss' => __('Dismiss'),
+ 'crunching' => __('Crunching…'),
+ 'deleted' => __('moved to the trash.'),
+ 'error_uploading' => __('“%s” has failed to upload.')
+ );
+
+ $scripts->add( 'plupload', '/wp-includes/js/plupload/plupload.full.min.js', array(), '2.1.8' );
+ // Back compat handles:
+ foreach ( array( 'all', 'html5', 'flash', 'silverlight', 'html4' ) as $handle ) {
+ $scripts->add( "plupload-$handle", false, array( 'plupload' ), '2.1.1' );
+ }
+
+ $scripts->add( 'plupload-handlers', "/wp-includes/js/plupload/handlers$suffix.js", array( 'plupload', 'jquery' ) );
+ did_action( 'init' ) && $scripts->localize( 'plupload-handlers', 'pluploadL10n', $uploader_l10n );
+
+ $scripts->add( 'wp-plupload', "/wp-includes/js/plupload/wp-plupload$suffix.js", array( 'plupload', 'jquery', 'json2', 'media-models' ), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'wp-plupload', 'pluploadL10n', $uploader_l10n );
+
+ // keep 'swfupload' for back-compat.
+ $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', array(), '2201-20110113');
+ $scripts->add( 'swfupload-swfobject', '/wp-includes/js/swfupload/plugins/swfupload.swfobject.js', array('swfupload', 'swfobject'), '2201a');
+ $scripts->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2201');
+ $scripts->add( 'swfupload-speed', '/wp-includes/js/swfupload/plugins/swfupload.speed.js', array('swfupload'), '2201');
+ $scripts->add( 'swfupload-all', false, array('swfupload', 'swfupload-swfobject', 'swfupload-queue'), '2201');
+ $scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload-all', 'jquery'), '2201-20110524');
+ did_action( 'init' ) && $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', $uploader_l10n );
+
+ $scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", array(), false, 1 );
+
+ $scripts->add( 'json2', "/wp-includes/js/json2$suffix.js", array(), '2015-05-03' );
+ did_action( 'init' ) && $scripts->add_data( 'json2', 'conditional', 'lt IE 8' );
+
+ $scripts->add( 'underscore', "/wp-includes/js/underscore$dev_suffix.js", array(), '1.8.3', 1 );
+ $scripts->add( 'backbone', "/wp-includes/js/backbone$dev_suffix.js", array( 'underscore','jquery' ), '1.2.3', 1 );
+
+ $scripts->add( 'wp-util', "/wp-includes/js/wp-util$suffix.js", array('underscore', 'jquery'), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'wp-util', '_wpUtilSettings', array(
+ 'ajax' => array(
+ 'url' => admin_url( 'admin-ajax.php', 'relative' ),
+ ),
+ ) );
+
+ $scripts->add( 'wp-backbone', "/wp-includes/js/wp-backbone$suffix.js", array('backbone', 'wp-util'), false, 1 );
+
+ $scripts->add( 'revisions', "/wp-admin/js/revisions$suffix.js", array( 'wp-backbone', 'jquery-ui-slider', 'hoverIntent' ), false, 1 );
+
+ $scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), false, 1 );
+
+ $scripts->add( 'mediaelement', "/wp-includes/js/mediaelement/mediaelement-and-player.min.js", array('jquery'), '2.22.0', 1 );
+ did_action( 'init' ) && $scripts->localize( 'mediaelement', 'mejsL10n', array(
+ 'language' => get_bloginfo( 'language' ),
+ 'strings' => array(
+ 'Close' => __( 'Close' ),
+ 'Fullscreen' => __( 'Fullscreen' ),
+ 'Turn off Fullscreen' => __( 'Turn off Fullscreen' ),
+ 'Go Fullscreen' => __( 'Go Fullscreen' ),
+ 'Download File' => __( 'Download File' ),
+ 'Download Video' => __( 'Download Video' ),
+ 'Play' => __( 'Play' ),
+ 'Pause' => __( 'Pause' ),
+ 'Captions/Subtitles' => __( 'Captions/Subtitles' ),
+ 'None' => __( 'None', 'no captions/subtitles' ),
+ 'Time Slider' => __( 'Time Slider' ),
+ /* translators: %1: number of seconds (30 by default) */
+ 'Skip back %1 seconds' => __( 'Skip back %1 seconds' ),
+ 'Video Player' => __( 'Video Player' ),
+ 'Audio Player' => __( 'Audio Player' ),
+ 'Volume Slider' => __( 'Volume Slider' ),
+ 'Mute Toggle' => __( 'Mute Toggle' ),
+ 'Unmute' => __( 'Unmute' ),
+ 'Mute' => __( 'Mute' ),
+ 'Use Up/Down Arrow keys to increase or decrease volume.' => __( 'Use Up/Down Arrow keys to increase or decrease volume.' ),
+ 'Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.' => __( 'Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.' ),
+ ),
+ ) );
+
+
+ $scripts->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.js", array('mediaelement'), false, 1 );
+ $mejs_settings = array(
+ 'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ),
+ );
+ did_action( 'init' ) && $scripts->localize( 'mediaelement', '_wpmejsSettings',
+ /**
+ * Filters the MediaElement configuration settings.
+ *
+ * @since 4.4.0
+ *
+ * @param array $mejs_settings MediaElement settings array.
+ */
+ apply_filters( 'mejs_settings', $mejs_settings )
+ );
+
+ $scripts->add( 'froogaloop', "/wp-includes/js/mediaelement/froogaloop.min.js", array(), '2.0' );
+ $scripts->add( 'wp-playlist', "/wp-includes/js/mediaelement/wp-playlist$suffix.js", array( 'wp-util', 'backbone', 'mediaelement' ), false, 1 );
+
+ $scripts->add( 'zxcvbn-async', "/wp-includes/js/zxcvbn-async$suffix.js", array(), '1.0' );
+ did_action( 'init' ) && $scripts->localize( 'zxcvbn-async', '_zxcvbnSettings', array(
+ 'src' => empty( $guessed_url ) ? includes_url( '/js/zxcvbn.min.js' ) : $scripts->base_url . '/wp-includes/js/zxcvbn.min.js',
+ ) );
+
+ $scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array( 'jquery', 'zxcvbn-async' ), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'password-strength-meter', 'pwsL10n', array(
+ 'unknown' => _x( 'Password strength unknown', 'password strength' ),
+ 'short' => _x( 'Very weak', 'password strength' ),
+ 'bad' => _x( 'Weak', 'password strength' ),
+ 'good' => _x( 'Medium', 'password strength' ),
+ 'strong' => _x( 'Strong', 'password strength' ),
+ 'mismatch' => _x( 'Mismatch', 'password mismatch' ),
+ ) );
+
+ $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter', 'wp-util' ), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'user-profile', 'userProfileL10n', array(
+ 'warn' => __( 'Your new password has not been saved.' ),
+ 'warnWeak' => __( 'Confirm use of weak password' ),
+ 'show' => __( 'Show' ),
+ 'hide' => __( 'Hide' ),
+ 'cancel' => __( 'Cancel' ),
+ 'ariaShow' => esc_attr__( 'Show password' ),
+ 'ariaHide' => esc_attr__( 'Hide password' ),
+ ) );
+
+ $scripts->add( 'language-chooser', "/wp-admin/js/language-chooser$suffix.js", array( 'jquery' ), false, 1 );
+
+ $scripts->add( 'user-suggest', "/wp-admin/js/user-suggest$suffix.js", array( 'jquery-ui-autocomplete' ), false, 1 );
+
+ $scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", array(), false, 1 );
+
+ $scripts->add( 'wplink', "/wp-includes/js/wplink$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'wplink', 'wpLinkL10n', array(
+ 'title' => __('Insert/edit link'),
+ 'update' => __('Update'),
+ 'save' => __('Add Link'),
+ 'noTitle' => __('(no title)'),
+ 'noMatchesFound' => __('No results found.'),
+ 'linkSelected' => __( 'Link selected.' ),
+ 'linkInserted' => __( 'Link inserted.' ),
+ ) );
+
+ $scripts->add( 'wpdialogs', "/wp-includes/js/wpdialog$suffix.js", array( 'jquery-ui-dialog' ), false, 1 );
+
+ $scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array(), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'word-count', 'wordCountL10n', array(
+ /*
+ * translators: If your word count is based on single characters (e.g. East Asian characters),
+ * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
+ * Do not translate into your own language.
+ */
+ 'type' => _x( 'words', 'Word count type. Do not translate!' ),
+ 'shortcodes' => ! empty( $GLOBALS['shortcode_tags'] ) ? array_keys( $GLOBALS['shortcode_tags'] ) : array()
+ ) );
+
+ $scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox', 'shortcode' ), false, 1 );
+
+ $scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), '1.8.1', 1 );
+
+ $scripts->add( 'customize-base', "/wp-includes/js/customize-base$suffix.js", array( 'jquery', 'json2', 'underscore' ), false, 1 );
+ $scripts->add( 'customize-loader', "/wp-includes/js/customize-loader$suffix.js", array( 'customize-base' ), false, 1 );
+ $scripts->add( 'customize-preview', "/wp-includes/js/customize-preview$suffix.js", array( 'wp-a11y', 'customize-base' ), false, 1 );
+ $scripts->add( 'customize-models', "/wp-includes/js/customize-models.js", array( 'underscore', 'backbone' ), false, 1 );
+ $scripts->add( 'customize-views', "/wp-includes/js/customize-views.js", array( 'jquery', 'underscore', 'imgareaselect', 'customize-models', 'media-editor', 'media-views' ), false, 1 );
+ $scripts->add( 'customize-controls', "/wp-admin/js/customize-controls$suffix.js", array( 'customize-base', 'wp-a11y', 'wp-util' ), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'customize-controls', '_wpCustomizeControlsL10n', array(
+ 'activate' => __( 'Save & Activate' ),
+ 'save' => __( 'Save & Publish' ),
+ 'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
+ 'saved' => __( 'Saved' ),
+ 'cancel' => __( 'Cancel' ),
+ 'close' => __( 'Close' ),
+ 'cheatin' => __( 'Cheatin’ uh?' ),
+ 'notAllowed' => __( 'Sorry, you are not allowed to customize this site.' ),
+ 'previewIframeTitle' => __( 'Site Preview' ),
+ 'loginIframeTitle' => __( 'Session expired' ),
+ 'collapseSidebar' => _x( 'Hide Controls', 'label for hide controls button without length constraints' ),
+ 'expandSidebar' => _x( 'Show Controls', 'label for hide controls button without length constraints' ),
+ 'untitledBlogName' => __( '(Untitled)' ),
+ // Used for overriding the file types allowed in plupload.
+ 'allowedFiles' => __( 'Allowed Files' ),
+ ) );
+ $scripts->add( 'customize-selective-refresh', "/wp-includes/js/customize-selective-refresh$suffix.js", array( 'jquery', 'wp-util', 'customize-preview' ), false, 1 );
+
+ $scripts->add( 'customize-widgets', "/wp-admin/js/customize-widgets$suffix.js", array( 'jquery', 'jquery-ui-sortable', 'jquery-ui-droppable', 'wp-backbone', 'customize-controls' ), false, 1 );
+ $scripts->add( 'customize-preview-widgets', "/wp-includes/js/customize-preview-widgets$suffix.js", array( 'jquery', 'wp-util', 'customize-preview', 'customize-selective-refresh' ), false, 1 );
+
+ $scripts->add( 'customize-nav-menus', "/wp-admin/js/customize-nav-menus$suffix.js", array( 'jquery', 'wp-backbone', 'customize-controls', 'accordion', 'nav-menu' ), false, 1 );
+ $scripts->add( 'customize-preview-nav-menus', "/wp-includes/js/customize-preview-nav-menus$suffix.js", array( 'jquery', 'wp-util', 'customize-preview', 'customize-selective-refresh' ), false, 1 );
+
+ $scripts->add( 'wp-custom-header', "/wp-includes/js/wp-custom-header$suffix.js", array( 'wp-a11y' ), false, 1 );
+
+ $scripts->add( 'accordion', "/wp-admin/js/accordion$suffix.js", array( 'jquery' ), false, 1 );
+
+ $scripts->add( 'shortcode', "/wp-includes/js/shortcode$suffix.js", array( 'underscore' ), false, 1 );
+ $scripts->add( 'media-models', "/wp-includes/js/media-models$suffix.js", array( 'wp-backbone' ), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'media-models', '_wpMediaModelsL10n', array(
+ 'settings' => array(
+ 'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ),
+ 'post' => array( 'id' => 0 ),
+ ),
+ ) );
+
+ $scripts->add( 'wp-embed', "/wp-includes/js/wp-embed$suffix.js" );
+
+ // To enqueue media-views or media-editor, call wp_enqueue_media().
+ // Both rely on numerous settings, styles, and templates to operate correctly.
+ $scripts->add( 'media-views', "/wp-includes/js/media-views$suffix.js", array( 'utils', 'media-models', 'wp-plupload', 'jquery-ui-sortable', 'wp-mediaelement' ), false, 1 );
+ $scripts->add( 'media-editor', "/wp-includes/js/media-editor$suffix.js", array( 'shortcode', 'media-views' ), false, 1 );
+ $scripts->add( 'media-audiovideo', "/wp-includes/js/media-audiovideo$suffix.js", array( 'media-editor' ), false, 1 );
+ $scripts->add( 'mce-view', "/wp-includes/js/mce-view$suffix.js", array( 'shortcode', 'jquery', 'media-views', 'media-audiovideo' ), false, 1 );
+
+ $scripts->add( 'wp-api', "/wp-includes/js/wp-api$suffix.js", array( 'jquery', 'backbone', 'underscore' ), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'wp-api', 'wpApiSettings', array(
+ 'root' => esc_url_raw( get_rest_url() ),
+ 'nonce' => ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' ),
+ 'versionString' => 'wp/v2/',
+ ) );
+
+ if ( is_admin() ) {
+ $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array( 'jquery', 'wp-ajax-response' ), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'admin-tags', 'tagsl10n', array(
+ 'noPerm' => __('Sorry, you are not allowed to do that.'),
+ 'broken' => __('An unidentified error has occurred.')
+ ));
+
+ $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'quicktags', 'jquery-query'), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
+ 'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
+ 'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']),
+ 'replyApprove' => __( 'Approve and Reply' ),
+ 'reply' => __( 'Reply' ),
+ 'warnQuickEdit' => __( "Are you sure you want to edit this comment?\nThe changes you made will be lost." ),
+ 'warnCommentChanges' => __( "Are you sure you want to do this?\nThe comment changes you made will be lost." ),
+ 'docTitleComments' => __( 'Comments' ),
+ /* translators: %s: comments count */
+ 'docTitleCommentsCount' => __( 'Comments (%s)' ),
+ ) );
+
+ $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array('jquery'), false, 1 );
+
+ $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'postbox', 'postBoxL10n', array(
+ 'postBoxEmptyString' => __( 'Drag boxes here' ),
+ ) );
+
+ $scripts->add( 'tags-box', "/wp-admin/js/tags-box$suffix.js", array( 'jquery', 'tags-suggest' ), false, 1 );
+
+ $scripts->add( 'tags-suggest', "/wp-admin/js/tags-suggest$suffix.js", array( 'jquery-ui-autocomplete', 'wp-a11y' ), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'tags-suggest', 'tagsSuggestL10n', array(
+ 'tagDelimiter' => _x( ',', 'tag delimiter' ),
+ 'removeTerm' => __( 'Remove term:' ),
+ 'termSelected' => __( 'Term selected.' ),
+ 'termAdded' => __( 'Term added.' ),
+ 'termRemoved' => __( 'Term removed.' ),
+ ) );
+
+ $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array( 'suggest', 'wp-lists', 'postbox', 'tags-box', 'underscore', 'word-count', 'wp-a11y' ), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'post', 'postL10n', array(
+ 'ok' => __('OK'),
+ 'cancel' => __('Cancel'),
+ 'publishOn' => __('Publish on:'),
+ 'publishOnFuture' => __('Schedule for:'),
+ 'publishOnPast' => __('Published on:'),
+ /* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
+ 'dateFormat' => __('%1$s %2$s, %3$s @ %4$s:%5$s'),
+ 'showcomm' => __('Show more comments'),
+ 'endcomm' => __('No more comments found.'),
+ 'publish' => __('Publish'),
+ 'schedule' => __('Schedule'),
+ 'update' => __('Update'),
+ 'savePending' => __('Save as Pending'),
+ 'saveDraft' => __('Save Draft'),
+ 'private' => __('Private'),
+ 'public' => __('Public'),
+ 'publicSticky' => __('Public, Sticky'),
+ 'password' => __('Password Protected'),
+ 'privatelyPublished' => __('Privately Published'),
+ 'published' => __('Published'),
+ 'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'),
+ 'savingText' => __('Saving Draft…'),
+ 'permalinkSaved' => __( 'Permalink saved' ),
+ ) );
+
+ $scripts->add( 'press-this', "/wp-admin/js/press-this$suffix.js", array( 'jquery', 'tags-box' ), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'press-this', 'pressThisL10n', array(
+ 'newPost' => __( 'Title' ),
+ 'serverError' => __( 'Connection lost or the server is busy. Please try again later.' ),
+ 'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
+ /* translators: %d: nth embed found in a post */
+ 'suggestedEmbedAlt' => __( 'Suggested embed #%d' ),
+ /* translators: %d: nth image found in a post */
+ 'suggestedImgAlt' => __( 'Suggested image #%d' ),
+ ) );
+
+ $scripts->add( 'editor-expand', "/wp-admin/js/editor-expand$suffix.js", array( 'jquery', 'underscore' ), false, 1 );
+
+ $scripts->add( 'link', "/wp-admin/js/link$suffix.js", array( 'wp-lists', 'postbox' ), false, 1 );
+
+ $scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array( 'jquery', 'postbox' ) );
+ $scripts->add_data( 'comment', 'group', 1 );
+ did_action( 'init' ) && $scripts->localize( 'comment', 'commentL10n', array(
+ 'submittedOn' => __( 'Submitted on:' ),
+ /* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
+ 'dateFormat' => __( '%1$s %2$s, %3$s @ %4$s:%5$s' )
+ ) );
+
+ $scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ) );
+
+ $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), false, 1 );
+
+ $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone', 'wp-a11y' ), false, 1 );
+
+ $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'tags-suggest', 'wp-a11y' ), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
+ 'error' => __( 'Error while saving the changes.' ),
+ 'ntdeltitle' => __( 'Remove From Bulk Edit' ),
+ 'notitle' => __( '(no title)' ),
+ 'comma' => trim( _x( ',', 'tag delimiter' ) ),
+ 'saved' => __( 'Changes saved.' ),
+ ) );
+
+ $scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(
+ 'error' => __( 'Error while saving the changes.' ),
+ 'saved' => __( 'Changes saved.' ),
+ ) );
+
+ $scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'jquery-ui-core', 'thickbox' ), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'plugin-install', 'plugininstallL10n', array(
+ 'plugin_information' => __( 'Plugin:' ),
+ 'plugin_modal_label' => __( 'Plugin details' ),
+ 'ays' => __('Are you sure you want to install this plugin?')
+ ) );
+
+ $scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'jquery', 'wp-util', 'wp-a11y' ), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'updates', '_wpUpdatesSettings', array(
+ 'ajax_nonce' => wp_create_nonce( 'updates' ),
+ 'l10n' => array(
+ /* translators: %s: Search string */
+ 'searchResults' => __( 'Search results for “%s”' ),
+ 'searchResultsLabel' => __( 'Search Results' ),
+ 'noPlugins' => __( 'You do not appear to have any plugins available at this time.' ),
+ 'noItemsSelected' => __( 'Please select at least one item to perform this action on.' ),
+ 'updating' => __( 'Updating...' ), // No ellipsis.
+ 'updated' => __( 'Updated!' ),
+ 'update' => __( 'Update' ),
+ 'updateNow' => __( 'Update Now' ),
+ /* translators: %s: Plugin name and version */
+ 'updateNowLabel' => __( 'Update %s now' ),
+ 'updateFailedShort' => __( 'Update Failed!' ),
+ /* translators: %s: Error string for a failed update */
+ 'updateFailed' => __( 'Update Failed: %s' ),
+ /* translators: %s: Plugin name and version */
+ 'updatingLabel' => __( 'Updating %s...' ), // No ellipsis.
+ /* translators: %s: Plugin name and version */
+ 'updatedLabel' => __( '%s updated!' ),
+ /* translators: %s: Plugin name and version */
+ 'updateFailedLabel' => __( '%s update failed' ),
+ /* translators: JavaScript accessible string */
+ 'updatingMsg' => __( 'Updating... please wait.' ), // No ellipsis.
+ /* translators: JavaScript accessible string */
+ 'updatedMsg' => __( 'Update completed successfully.' ),
+ /* translators: JavaScript accessible string */
+ 'updateCancel' => __( 'Update canceled.' ),
+ 'beforeunload' => __( 'Updates may not complete if you navigate away from this page.' ),
+ 'installNow' => __( 'Install Now' ),
+ /* translators: %s: Plugin name */
+ 'installNowLabel' => __( 'Install %s now' ),
+ 'installing' => __( 'Installing...' ),
+ 'installed' => __( 'Installed!' ),
+ 'installFailedShort' => __( 'Install Failed!' ),
+ /* translators: %s: Error string for a failed installation */
+ 'installFailed' => __( 'Installation failed: %s' ),
+ /* translators: %s: Plugin name and version */
+ 'pluginInstallingLabel' => _x( 'Installing %s...', 'plugin' ), // no ellipsis
+ /* translators: %s: Theme name and version */
+ 'themeInstallingLabel' => _x( 'Installing %s...', 'theme' ), // no ellipsis
+ /* translators: %s: Plugin name and version */
+ 'pluginInstalledLabel' => _x( '%s installed!', 'plugin' ),
+ /* translators: %s: Theme name and version */
+ 'themeInstalledLabel' => _x( '%s installed!', 'theme' ),
+ /* translators: %s: Plugin name and version */
+ 'pluginInstallFailedLabel' => _x( '%s installation failed', 'plugin' ),
+ /* translators: %s: Theme name and version */
+ 'themeInstallFailedLabel' => _x( '%s installation failed', 'theme' ),
+ 'installingMsg' => __( 'Installing... please wait.' ),
+ 'installedMsg' => __( 'Installation completed successfully.' ),
+ /* translators: %s: Activation URL */
+ 'importerInstalledMsg' => __( 'Importer installed successfully. <a href="%s">Run importer</a>' ),
+ /* translators: %s: Theme name */
+ 'aysDelete' => __( 'Are you sure you want to delete %s?' ),
+ /* translators: %s: Plugin name */
+ 'aysDeleteUninstall' => __( 'Are you sure you want to delete %s and its data?' ),
+ 'aysBulkDelete' => __( 'Are you sure you want to delete the selected plugins and their data?' ),
+ 'aysBulkDeleteThemes' => __( 'Caution: These themes may be active on other sites in the network. Are you sure you want to proceed?' ),
+ 'deleting' => __( 'Deleting...' ),
+ /* translators: %s: Error string for a failed deletion */
+ 'deleteFailed' => __( 'Deletion failed: %s' ),
+ 'deleted' => __( 'Deleted!' ),
+ 'livePreview' => __( 'Live Preview' ),
+ 'activatePlugin' => is_network_admin() ? __( 'Network Activate' ) : __( 'Activate' ),
+ 'activateTheme' => is_network_admin() ? __( 'Network Enable' ) : __( 'Activate' ),
+ /* translators: %s: Plugin name */
+ 'activatePluginLabel' => is_network_admin() ? _x( 'Network Activate %s', 'plugin' ) : _x( 'Activate %s', 'plugin' ),
+ /* translators: %s: Theme name */
+ 'activateThemeLabel' => is_network_admin() ? _x( 'Network Activate %s', 'theme' ) : _x( 'Activate %s', 'theme' ),
+ 'activateImporter' => __( 'Run Importer' ),
+ /* translators: %s: Importer name */
+ 'activateImporterLabel' => __( 'Run %s' ),
+ 'unknownError' => __( 'An unknown error occurred' ),
+ 'connectionError' => __( 'Connection lost or the server is busy. Please try again later.' ),
+ 'nonceError' => __( 'An error has occurred. Please reload the page and try again.' ),
+ 'pluginsFound' => __( 'Number of plugins found: %d' ),
+ 'noPluginsFound' => __( 'No plugins found. Try a different search.' ),
+ ),
+ ) );
+
+ $scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' );
+
+ $scripts->add( 'iris', '/wp-admin/js/iris.min.js', array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), '1.0.7', 1 );
+ $scripts->add( 'wp-color-picker', "/wp-admin/js/color-picker$suffix.js", array( 'iris' ), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'wp-color-picker', 'wpColorPickerL10n', array(
+ 'clear' => __( 'Clear' ),
+ 'defaultString' => __( 'Default' ),
+ 'pick' => __( 'Select Color' ),
+ 'current' => __( 'Current Color' ),
+ ) );
+
+ $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), false, 1 );
+
+ $scripts->add( 'list-revisions', "/wp-includes/js/wp-list-revisions$suffix.js" );
+
+ $scripts->add( 'media-grid', "/wp-includes/js/media-grid$suffix.js", array( 'media-editor' ), false, 1 );
+ $scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery' ), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'media', 'attachMediaBoxL10n', array(
+ 'error' => __( 'An error has occurred. Please reload the page and try again.' ),
+ ));
+
+ $scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array('jquery', 'json2', 'imgareaselect'), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'image-edit', 'imageEditL10n', array(
+ 'error' => __( 'Could not load the preview image. Please reload the page and try again.' )
+ ));
+
+ $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 );
+ did_action( 'init' ) && $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(
+ 'setThumbnail' => __( 'Use as featured image' ),
+ 'saving' => __( 'Saving...' ), // no ellipsis
+ 'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' ),
+ 'done' => __( 'Done' )
+ ) );
+
+ // Navigation Menus
+ $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'wp-lists', 'postbox', 'json2' ) );
+ did_action( 'init' ) && $scripts->localize( 'nav-menu', 'navMenuL10n', array(
+ 'noResultsFound' => __( 'No results found.' ),
+ 'warnDeleteMenu' => __( "You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete." ),
+ 'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
+ 'untitled' => _x( '(no label)', 'missing menu item navigation label' )
+ ) );
+
+ $scripts->add( 'custom-header', "/wp-admin/js/custom-header.js", array( 'jquery-masonry' ), false, 1 );
+ $scripts->add( 'custom-background', "/wp-admin/js/custom-background$suffix.js", array( 'wp-color-picker', 'media-views' ), false, 1 );
+ $scripts->add( 'media-gallery', "/wp-admin/js/media-gallery$suffix.js", array('jquery'), false, 1 );
+
+ $scripts->add( 'svg-painter', '/wp-admin/js/svg-painter.js', array( 'jquery' ), false, 1 );
+ }
+}
+
+/**
+ * Assign default styles to $styles object.
+ *
+ * Nothing is returned, because the $styles parameter is passed by reference.
+ * Meaning that whatever object is passed will be updated without having to
+ * reassign the variable that was passed back to the same value. This saves
+ * memory.
+ *
+ * Adding default styles is not the only task, it also assigns the base_url
+ * property, the default version, and text direction for the object.
+ *
+ * @since 2.6.0
+ *
+ * @param WP_Styles $styles
+ */
+function wp_default_styles( &$styles ) {
+ include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
+
+ if ( ! defined( 'SCRIPT_DEBUG' ) )
+ define( 'SCRIPT_DEBUG', false !== strpos( $wp_version, '-src' ) );
+
+ if ( ! $guessurl = site_url() )
+ $guessurl = wp_guess_url();
+
+ $styles->base_url = $guessurl;
+ $styles->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : '';
+ $styles->default_version = get_bloginfo( 'version' );
+ $styles->text_direction = function_exists( 'is_rtl' ) && is_rtl() ? 'rtl' : 'ltr';
+ $styles->default_dirs = array('/wp-admin/', '/wp-includes/css/');
+
+ // Open Sans is no longer used by core, but may be relied upon by themes and plugins.
+ $open_sans_font_url = '';
+
+ /* translators: If there are characters in your language that are not supported
+ * by Open Sans, translate this to 'off'. Do not translate into your own language.
+ */
+ if ( 'off' !== _x( 'on', 'Open Sans font: on or off' ) ) {
+ $subsets = 'latin,latin-ext';
+
+ /* translators: To add an additional Open Sans character subset specific to your language,
+ * translate this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language.
+ */
+ $subset = _x( 'no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)' );
+
+ if ( 'cyrillic' == $subset ) {
+ $subsets .= ',cyrillic,cyrillic-ext';
+ } elseif ( 'greek' == $subset ) {
+ $subsets .= ',greek,greek-ext';
+ } elseif ( 'vietnamese' == $subset ) {
+ $subsets .= ',vietnamese';
+ }
+
+ // Hotlink Open Sans, for now
+ $open_sans_font_url = "https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets";
+ }
+
+ // Register a stylesheet for the selected admin color scheme.
+ $styles->add( 'colors', true, array( 'wp-admin', 'buttons' ) );
+
+ $suffix = SCRIPT_DEBUG ? '' : '.min';
+
+ // Admin CSS
+ $styles->add( 'common', "/wp-admin/css/common$suffix.css" );
+ $styles->add( 'forms', "/wp-admin/css/forms$suffix.css" );
+ $styles->add( 'admin-menu', "/wp-admin/css/admin-menu$suffix.css" );
+ $styles->add( 'dashboard', "/wp-admin/css/dashboard$suffix.css" );
+ $styles->add( 'list-tables', "/wp-admin/css/list-tables$suffix.css" );
+ $styles->add( 'edit', "/wp-admin/css/edit$suffix.css" );
+ $styles->add( 'revisions', "/wp-admin/css/revisions$suffix.css" );
+ $styles->add( 'media', "/wp-admin/css/media$suffix.css" );
+ $styles->add( 'themes', "/wp-admin/css/themes$suffix.css" );
+ $styles->add( 'about', "/wp-admin/css/about$suffix.css" );
+ $styles->add( 'nav-menus', "/wp-admin/css/nav-menus$suffix.css" );
+ $styles->add( 'widgets', "/wp-admin/css/widgets$suffix.css" );
+ $styles->add( 'site-icon', "/wp-admin/css/site-icon$suffix.css" );
+ $styles->add( 'l10n', "/wp-admin/css/l10n$suffix.css" );
+
+ $styles->add( 'wp-admin', false, array( 'dashicons', 'common', 'forms', 'admin-menu', 'dashboard', 'list-tables', 'edit', 'revisions', 'media', 'themes', 'about', 'nav-menus', 'widgets', 'site-icon', 'l10n' ) );
+
+ $styles->add( 'login', "/wp-admin/css/login$suffix.css", array( 'dashicons', 'buttons', 'forms', 'l10n' ) );
+ $styles->add( 'install', "/wp-admin/css/install$suffix.css", array( 'buttons' ) );
+ $styles->add( 'wp-color-picker', "/wp-admin/css/color-picker$suffix.css" );
+ $styles->add( 'customize-controls', "/wp-admin/css/customize-controls$suffix.css", array( 'wp-admin', 'colors', 'ie', 'imgareaselect' ) );
+ $styles->add( 'customize-widgets', "/wp-admin/css/customize-widgets$suffix.css", array( 'wp-admin', 'colors' ) );
+ $styles->add( 'customize-nav-menus', "/wp-admin/css/customize-nav-menus$suffix.css", array( 'wp-admin', 'colors' ) );
+ $styles->add( 'press-this', "/wp-admin/css/press-this$suffix.css", array( 'buttons' ) );
+
+ $styles->add( 'ie', "/wp-admin/css/ie$suffix.css" );
+ $styles->add_data( 'ie', 'conditional', 'lte IE 7' );
+
+ // Common dependencies
+ $styles->add( 'buttons', "/wp-includes/css/buttons$suffix.css" );
+ $styles->add( 'dashicons', "/wp-includes/css/dashicons$suffix.css" );
+
+ // Includes CSS
+ $styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array( 'dashicons' ) );
+ $styles->add( 'wp-auth-check', "/wp-includes/css/wp-auth-check$suffix.css", array( 'dashicons' ) );
+ $styles->add( 'editor-buttons', "/wp-includes/css/editor$suffix.css", array( 'dashicons' ) );
+ $styles->add( 'media-views', "/wp-includes/css/media-views$suffix.css", array( 'buttons', 'dashicons', 'wp-mediaelement' ) );
+ $styles->add( 'wp-pointer', "/wp-includes/css/wp-pointer$suffix.css", array( 'dashicons' ) );
+ $styles->add( 'customize-preview', "/wp-includes/css/customize-preview$suffix.css", array( 'dashicons' ) );
+ $styles->add( 'wp-embed-template-ie', "/wp-includes/css/wp-embed-template-ie$suffix.css" );
+ $styles->add_data( 'wp-embed-template-ie', 'conditional', 'lte IE 8' );
+
+ // External libraries and friends
+ $styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8' );
+ $styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array( 'dashicons' ) );
+ $styles->add( 'mediaelement', "/wp-includes/js/mediaelement/mediaelementplayer.min.css", array(), '2.22.0' );
+ $styles->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.css", array( 'mediaelement' ) );
+ $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array( 'dashicons' ) );
+
+ // Deprecated CSS
+ $styles->add( 'deprecated-media', "/wp-admin/css/deprecated-media$suffix.css" );
+ $styles->add( 'farbtastic', "/wp-admin/css/farbtastic$suffix.css", array(), '1.3u1' );
+ $styles->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop.min.css", array(), '0.9.12' );
+ $styles->add( 'colors-fresh', false, array( 'wp-admin', 'buttons' ) ); // Old handle.
+ $styles->add( 'open-sans', $open_sans_font_url ); // No longer used in core as of 4.6
+
+ // RTL CSS
+ $rtl_styles = array(
+ // wp-admin
+ 'common', 'forms', 'admin-menu', 'dashboard', 'list-tables', 'edit', 'revisions', 'media', 'themes', 'about', 'nav-menus',
+ 'widgets', 'site-icon', 'l10n', 'install', 'wp-color-picker', 'customize-controls', 'customize-widgets', 'customize-nav-menus', 'customize-preview',
+ 'ie', 'login', 'press-this',
+ // wp-includes
+ 'buttons', 'admin-bar', 'wp-auth-check', 'editor-buttons', 'media-views', 'wp-pointer',
+ 'wp-jquery-ui-dialog',
+ // deprecated
+ 'deprecated-media', 'farbtastic',
+ );
+
+ foreach ( $rtl_styles as $rtl_style ) {
+ $styles->add_data( $rtl_style, 'rtl', 'replace' );
+ if ( $suffix ) {
+ $styles->add_data( $rtl_style, 'suffix', $suffix );
+ }
+ }
+}
+
+/**
+ * Reorder JavaScript scripts array to place prototype before jQuery.
+ *
+ * @since 2.3.1
+ *
+ * @param array $js_array JavaScript scripts array
+ * @return array Reordered array, if needed.
+ */
+function wp_prototype_before_jquery( $js_array ) {
+ if ( false === $prototype = array_search( 'prototype', $js_array, true ) )
+ return $js_array;
+
+ if ( false === $jquery = array_search( 'jquery', $js_array, true ) )
+ return $js_array;
+
+ if ( $prototype < $jquery )
+ return $js_array;
+
+ unset($js_array[$prototype]);
+
+ array_splice( $js_array, $jquery, 0, 'prototype' );
+
+ return $js_array;
+}
+
+/**
+ * Load localized data on print rather than initialization.
+ *
+ * These localizations require information that may not be loaded even by init.
+ *
+ * @since 2.5.0
+ */
+function wp_just_in_time_script_localization() {
+
+ wp_localize_script( 'autosave', 'autosaveL10n', array(
+ 'autosaveInterval' => AUTOSAVE_INTERVAL,
+ 'blog_id' => get_current_blog_id(),
+ ) );
+}
+
+/**
+ * Localizes the jQuery UI datepicker.
+ *
+ * @since 4.6.0
+ *
+ * @link http://api.jqueryui.com/datepicker/#options
+ *
+ * @global WP_Locale $wp_locale The WordPress date and time locale object.
+ */
+function wp_localize_jquery_ui_datepicker() {
+ global $wp_locale;
+
+ if ( ! wp_script_is( 'jquery-ui-datepicker', 'enqueued' ) ) {
+ return;
+ }
+
+ // Convert the PHP date format into jQuery UI's format.
+ $datepicker_date_format = str_replace(
+ array(
+ 'd', 'j', 'l', 'z', // Day.
+ 'F', 'M', 'n', 'm', // Month.
+ 'Y', 'y' // Year.
+ ),
+ array(
+ 'dd', 'd', 'DD', 'o',
+ 'MM', 'M', 'm', 'mm',
+ 'yy', 'y'
+ ),
+ get_option( 'date_format' )
+ );
+
+ $datepicker_defaults = wp_json_encode( array(
+ 'closeText' => __( 'Close' ),
+ 'currentText' => __( 'Today' ),
+ 'monthNames' => array_values( $wp_locale->month ),
+ 'monthNamesShort' => array_values( $wp_locale->month_abbrev ),
+ 'nextText' => __( 'Next' ),
+ 'prevText' => __( 'Previous' ),
+ 'dayNames' => array_values( $wp_locale->weekday ),
+ 'dayNamesShort' => array_values( $wp_locale->weekday_abbrev ),
+ 'dayNamesMin' => array_values( $wp_locale->weekday_initial ),
+ 'dateFormat' => $datepicker_date_format,
+ 'firstDay' => absint( get_option( 'start_of_week' ) ),
+ 'isRTL' => $wp_locale->is_rtl(),
+ ) );
+
+ wp_add_inline_script( 'jquery-ui-datepicker', "jQuery(document).ready(function(jQuery){jQuery.datepicker.setDefaults({$datepicker_defaults});});" );
+}
+
+/**
+ * Administration Screen CSS for changing the styles.
+ *
+ * If installing the 'wp-admin/' directory will be replaced with './'.
+ *
+ * The $_wp_admin_css_colors global manages the Administration Screens CSS
+ * stylesheet that is loaded. The option that is set is 'admin_color' and is the
+ * color and key for the array. The value for the color key is an object with
+ * a 'url' parameter that has the URL path to the CSS file.
+ *
+ * The query from $src parameter will be appended to the URL that is given from
+ * the $_wp_admin_css_colors array value URL.
+ *
+ * @since 2.6.0
+ * @global array $_wp_admin_css_colors
+ *
+ * @param string $src Source URL.
+ * @param string $handle Either 'colors' or 'colors-rtl'.
+ * @return string|false URL path to CSS stylesheet for Administration Screens.
+ */
+function wp_style_loader_src( $src, $handle ) {
+ global $_wp_admin_css_colors;
+
+ if ( wp_installing() )
+ return preg_replace( '#^wp-admin/#', './', $src );
+
+ if ( 'colors' == $handle ) {
+ $color = get_user_option('admin_color');
+
+ if ( empty($color) || !isset($_wp_admin_css_colors[$color]) )
+ $color = 'fresh';
+
+ $color = $_wp_admin_css_colors[$color];
+ $url = $color->url;
+
+ if ( ! $url ) {
+ return false;
+ }
+
+ $parsed = parse_url( $src );
+ if ( isset($parsed['query']) && $parsed['query'] ) {
+ wp_parse_str( $parsed['query'], $qv );
+ $url = add_query_arg( $qv, $url );
+ }
+
+ return $url;
+ }
+
+ return $src;
+}
+
+/**
+ * Prints the script queue in the HTML head on admin pages.
+ *
+ * Postpones the scripts that were queued for the footer.
+ * print_footer_scripts() is called in the footer to print these scripts.
+ *
+ * @since 2.8.0
+ *
+ * @see wp_print_scripts()
+ *
+ * @global bool $concatenate_scripts
+ *
+ * @return array
+ */
+function print_head_scripts() {
+ global $concatenate_scripts;
+
+ if ( ! did_action('wp_print_scripts') ) {
+ /** This action is documented in wp-includes/functions.wp-scripts.php */
+ do_action( 'wp_print_scripts' );
+ }
+
+ $wp_scripts = wp_scripts();
+
+ script_concat_settings();
+ $wp_scripts->do_concat = $concatenate_scripts;
+ $wp_scripts->do_head_items();
+
+ /**
+ * Filters whether to print the head scripts.
+ *
+ * @since 2.8.0
+ *
+ * @param bool $print Whether to print the head scripts. Default true.
+ */
+ if ( apply_filters( 'print_head_scripts', true ) ) {
+ _print_scripts();
+ }
+
+ $wp_scripts->reset();
+ return $wp_scripts->done;
+}
+
+/**
+ * Prints the scripts that were queued for the footer or too late for the HTML head.
+ *
+ * @since 2.8.0
+ *
+ * @global WP_Scripts $wp_scripts
+ * @global bool $concatenate_scripts
+ *
+ * @return array
+ */
+function print_footer_scripts() {
+ global $wp_scripts, $concatenate_scripts;
+
+ if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
+ return array(); // No need to run if not instantiated.
+ }
+ script_concat_settings();
+ $wp_scripts->do_concat = $concatenate_scripts;
+ $wp_scripts->do_footer_items();
+
+ /**
+ * Filters whether to print the footer scripts.
+ *
+ * @since 2.8.0
+ *
+ * @param bool $print Whether to print the footer scripts. Default true.
+ */
+ if ( apply_filters( 'print_footer_scripts', true ) ) {
+ _print_scripts();
+ }
+
+ $wp_scripts->reset();
+ return $wp_scripts->done;
+}
+
+/**
+ * Print scripts (internal use only)
+ *
+ * @ignore
+ *
+ * @global WP_Scripts $wp_scripts
+ * @global bool $compress_scripts
+ */
+function _print_scripts() {
+ global $wp_scripts, $compress_scripts;
+
+ $zip = $compress_scripts ? 1 : 0;
+ if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP )
+ $zip = 'gzip';
+
+ if ( $concat = trim( $wp_scripts->concat, ', ' ) ) {
+
+ if ( !empty($wp_scripts->print_code) ) {
+ echo "\n<script type='text/javascript'>\n";
+ echo "/* <![CDATA[ */\n"; // not needed in HTML 5
+ echo $wp_scripts->print_code;
+ echo "/* ]]> */\n";
+ echo "</script>\n";
+ }
+
+ $concat = str_split( $concat, 128 );
+ $concat = 'load%5B%5D=' . implode( '&load%5B%5D=', $concat );
+
+ $src = $wp_scripts->base_url . "/wp-admin/load-scripts.php?c={$zip}&" . $concat . '&ver=' . $wp_scripts->default_version;
+ echo "<script type='text/javascript' src='" . esc_attr($src) . "'></script>\n";
+ }
+
+ if ( !empty($wp_scripts->print_html) )
+ echo $wp_scripts->print_html;
+}
+
+/**
+ * Prints the script queue in the HTML head on the front end.
+ *
+ * Postpones the scripts that were queued for the footer.
+ * wp_print_footer_scripts() is called in the footer to print these scripts.
+ *
+ * @since 2.8.0
+ *
+ * @global WP_Scripts $wp_scripts
+ *
+ * @return array
+ */
+function wp_print_head_scripts() {
+ if ( ! did_action('wp_print_scripts') ) {
+ /** This action is documented in wp-includes/functions.wp-scripts.php */
+ do_action( 'wp_print_scripts' );
+ }
+
+ global $wp_scripts;
+
+ if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
+ return array(); // no need to run if nothing is queued
+ }
+ return print_head_scripts();
+}
+
+/**
+ * Private, for use in *_footer_scripts hooks
+ *
+ * @since 3.3.0
+ */
+function _wp_footer_scripts() {
+ print_late_styles();
+ print_footer_scripts();
+}
+
+/**
+ * Hooks to print the scripts and styles in the footer.
+ *
+ * @since 2.8.0
+ */
+function wp_print_footer_scripts() {
+ /**
+ * Fires when footer scripts are printed.
+ *
+ * @since 2.8.0
+ */
+ do_action( 'wp_print_footer_scripts' );
+}
+
+/**
+ * Wrapper for do_action('wp_enqueue_scripts')
+ *
+ * Allows plugins to queue scripts for the front end using wp_enqueue_script().
+ * Runs first in wp_head() where all is_home(), is_page(), etc. functions are available.
+ *
+ * @since 2.8.0
+ */
+function wp_enqueue_scripts() {
+ /**
+ * Fires when scripts and styles are enqueued.
+ *
+ * @since 2.8.0
+ */
+ do_action( 'wp_enqueue_scripts' );
+}
+
+/**
+ * Prints the styles queue in the HTML head on admin pages.
+ *
+ * @since 2.8.0
+ *
+ * @global bool $concatenate_scripts
+ *
+ * @return array
+ */
+function print_admin_styles() {
+ global $concatenate_scripts;
+
+ $wp_styles = wp_styles();
+
+ script_concat_settings();
+ $wp_styles->do_concat = $concatenate_scripts;
+ $wp_styles->do_items(false);
+
+ /**
+ * Filters whether to print the admin styles.
+ *
+ * @since 2.8.0
+ *
+ * @param bool $print Whether to print the admin styles. Default true.
+ */
+ if ( apply_filters( 'print_admin_styles', true ) ) {
+ _print_styles();
+ }
+
+ $wp_styles->reset();
+ return $wp_styles->done;
+}
+
+/**
+ * Prints the styles that were queued too late for the HTML head.
+ *
+ * @since 3.3.0
+ *
+ * @global WP_Styles $wp_styles
+ * @global bool $concatenate_scripts
+ *
+ * @return array|void
+ */
+function print_late_styles() {
+ global $wp_styles, $concatenate_scripts;
+
+ if ( ! ( $wp_styles instanceof WP_Styles ) ) {
+ return;
+ }
+
+ script_concat_settings();
+ $wp_styles->do_concat = $concatenate_scripts;
+ $wp_styles->do_footer_items();
+
+ /**
+ * Filters whether to print the styles queued too late for the HTML head.
+ *
+ * @since 3.3.0
+ *
+ * @param bool $print Whether to print the 'late' styles. Default true.
+ */
+ if ( apply_filters( 'print_late_styles', true ) ) {
+ _print_styles();
+ }
+
+ $wp_styles->reset();
+ return $wp_styles->done;
+}
+
+/**
+ * Print styles (internal use only)
+ *
+ * @ignore
+ * @since 3.3.0
+ *
+ * @global bool $compress_css
+ */
+function _print_styles() {
+ global $compress_css;
+
+ $wp_styles = wp_styles();
+
+ $zip = $compress_css ? 1 : 0;
+ if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP )
+ $zip = 'gzip';
+
+ if ( $concat = trim( $wp_styles->concat, ', ' ) ) {
+ $dir = $wp_styles->text_direction;
+ $ver = $wp_styles->default_version;
+
+ $concat = str_split( $concat, 128 );
+ $concat = 'load%5B%5D=' . implode( '&load%5B%5D=', $concat );
+
+ $href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}&" . $concat . '&ver=' . $ver;
+ echo "<link rel='stylesheet' href='" . esc_attr($href) . "' type='text/css' media='all' />\n";
+
+ if ( !empty($wp_styles->print_code) ) {
+ echo "<style type='text/css'>\n";
+ echo $wp_styles->print_code;
+ echo "\n</style>\n";
+ }
+ }
+
+ if ( !empty($wp_styles->print_html) )
+ echo $wp_styles->print_html;
+}
+
+/**
+ * Determine the concatenation and compression settings for scripts and styles.
+ *
+ * @since 2.8.0
+ *
+ * @global bool $concatenate_scripts
+ * @global bool $compress_scripts
+ * @global bool $compress_css
+ */
+function script_concat_settings() {
+ global $concatenate_scripts, $compress_scripts, $compress_css;
+
+ $compressed_output = ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') );
+
+ if ( ! isset($concatenate_scripts) ) {
+ $concatenate_scripts = defined('CONCATENATE_SCRIPTS') ? CONCATENATE_SCRIPTS : true;
+ if ( ( ! is_admin() && ! did_action( 'login_init' ) ) || ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) )
+ $concatenate_scripts = false;
+ }
+
+ if ( ! isset($compress_scripts) ) {
+ $compress_scripts = defined('COMPRESS_SCRIPTS') ? COMPRESS_SCRIPTS : true;
+ if ( $compress_scripts && ( ! get_site_option('can_compress_scripts') || $compressed_output ) )
+ $compress_scripts = false;
+ }
+
+ if ( ! isset($compress_css) ) {
+ $compress_css = defined('COMPRESS_CSS') ? COMPRESS_CSS : true;
+ if ( $compress_css && ( ! get_site_option('can_compress_scripts') || $compressed_output ) )
+ $compress_css = false;
+ }
+}
// return apply_filters( 'template_directory', $template_dir, $template, $theme_root );
global $gEnvManager;
- return $gEnvManager->getTemplatesPath() . '/' . TEMPLATE;
+ $path = $gEnvManager->getTemplatesPath() . '/' . $gEnvManager->getCurrentTemplateId();
+ return $path;
}
/**
* @return string Theme path.
*/
function get_theme_root( $stylesheet_or_template = false ) {
- global $wp_theme_directories;
+/* global $wp_theme_directories;
if ( $stylesheet_or_template && $theme_root = get_raw_theme_root( $stylesheet_or_template ) ) {
// Always prepend WP_CONTENT_DIR unless the root currently registered as a theme directory.
} else {
$theme_root = WP_CONTENT_DIR . '/themes';
}
-
+*/
/**
* Filters the absolute path to the themes directory.
*
*
* @param string $theme_root Absolute path to themes directory.
*/
- return apply_filters( 'theme_root', $theme_root );
+// return apply_filters( 'theme_root', $theme_root );
+ global $gEnvManager;
+ $path = $gEnvManager->getTemplatesPath();
+ return $path;
}
/**