deprecated since version %2$s with no alternative available.' ), $hook, $version ) . $message ); else trigger_error( sprintf( __( '%1$s is deprecated since version %2$s! Use %3$s instead.' ), $hook, $version, $replacement ) . $message ); } endif; if ( !function_exists( 'do_action_deprecated' ) ) : /** * 运行过时的动作钩子 * * @since Beginning 4.0.2 * @since WordPress 4.6.0 * * @see _deprecated_hook() */ function do_action_deprecated( $tag, $args, $version, $replacement = false, $message = null ) { if ( !has_action( $tag ) ) return; _deprecated_hook( $tag, $version, $replacement, $message ); do_action_ref_array( $tag, $args ); } endif; if ( !function_exists( 'spl_autoload_register' ) ) : /** * SPL 队列 * * @var array */ global $_wp_spl_autoloaders; $_wp_spl_autoloaders = array(); /** * 自动加载 * * 为了兼容 PHP 5.2,利用自动加载来实现 SPL 系统,这里在调用不存在的类 * 时会自动循环已注册的回调函数来按需加载类文件。 * * @since Beginning 4.0.5 * @since WordPress 4.6.0 */ function __autoload( $classname ) { foreach ( $GLOBALS['_wp_spl_autoloaders'] as $autoloader ) { if ( !is_callable( $autoloader ) ) continue; call_user_func( $autoloader, $classname ); if ( class_exists( $classname, false ) ) return; } } /** * 注册回调函数到 SPL 队列 * * @since Beginning 4.0.5 * @since WordPress 4.6.0 * * @see __autoload() */ function spl_autoload_register( $autoload_function, $throw = true, $prepend = false ) { if ( $throw && !is_callable( $autoload_function ) ) throw new Exception( 'Function not callable' ); global $_wp_spl_autoloaders; if ( in_array( $autoload_function, $_wp_spl_autoloaders ) ) return; if ( $prepend ) array_unshift( $_wp_spl_autoloaders, $autoload_function ); else $_wp_spl_autoloaders[] = $autoload_function; } /** * 从 SPL 队列注销回调函数 * * @since Beginning 4.0.5 * @since WordPress 4.6.0 * * @see __autoload() * @see spl_autoload_register() */ function spl_autoload_unregister( $function ) { foreach ( $GLOBALS['_wp_spl_autoloaders'] as &$autoloader ) { if ( $autoloader !== $function ) continue; unset( $autoloader ); return true; } return false; } /** * 获取 SPL 队列的所有回调函数 * * @since Beginning 4.0.5 * @since WordPress 4.6.0 * * @see __autoload() * @see spl_autoload_register() */ function spl_autoload_functions() { return $GLOBALS['_wp_spl_autoloaders']; } endif; if ( !function_exists( 'get_user_locale' ) ) : /** * 获取用户语言 * * @since Beginning 4.0.5 * @since WordPress 4.7.0 */ function get_user_locale() { return get_locale(); } endif; // End of page.