• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP WP_Scripts类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中WP_Scripts的典型用法代码示例。如果您正苦于以下问题:PHP WP_Scripts类的具体用法?PHP WP_Scripts怎么用?PHP WP_Scripts使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了WP_Scripts类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: register_scripts

 /**
  * Register scripts.
  *
  * @param \WP_Scripts $wp_scripts Instance of \WP_Scripts.
  * @action wp_default_scripts
  */
 function register_scripts(\WP_Scripts $wp_scripts)
 {
     $src = $this->dir_url . 'js/customize-concurrency.js';
     $deps = array('heartbeat', 'customize-widgets', 'underscore');
     $wp_scripts->add($this->slug, $src, $deps);
     $wp_scripts->add_data($this->slug, 'group', 1);
     // 1 = in_footer.
 }
开发者ID:xwp,项目名称:wp-customize-concurrency,代码行数:14,代码来源:class-plugin.php


示例2: do_scripts

 static function do_scripts($handles)
 {
     global $wp_scripts;
     if (!is_a($wp_scripts, 'WP_Scripts')) {
         $wp_scripts = new WP_Scripts();
     }
     $wp_scripts->do_items((array) $handles);
 }
开发者ID:rarescosma,项目名称:wp-ric,代码行数:8,代码来源:Util.php


示例3: wp_script_is

 function wp_script_is($handle, $list = 'queue')
 {
     global $wp_scripts;
     if (!is_a($wp_scripts, 'WP_Scripts')) {
         $wp_scripts = new WP_Scripts();
     }
     $query = $wp_scripts->query($handle, $list);
     if (is_object($query)) {
         return true;
     }
     return $query;
 }
开发者ID:AgilData,项目名称:WordPress-Skeleton,代码行数:12,代码来源:_compat.php


示例4: wp_enqueue_script

/**
 * Equeues script
 *
 * Registers the script if src provided (does NOT overwrite) and enqueues.
 *
 * @see WP_Script::add(), WP_Script::enqueue()
*/
function wp_enqueue_script($handle, $src = false, $deps = array(), $ver = false)
{
    global $wp_scripts;
    if (!is_a($wp_scripts, 'WP_Scripts')) {
        $wp_scripts = new WP_Scripts();
    }
    if ($src) {
        $_handle = explode('?', $handle);
        $wp_scripts->add($_handle[0], $src, $deps, $ver);
    }
    $wp_scripts->enqueue($handle);
}
开发者ID:nurpax,项目名称:saastafi,代码行数:19,代码来源:functions.wp-scripts.php


示例5: register_scripts

 /**
  * Register scripts.
  *
  * @action wp_default_scripts, 11
  *
  * @param \WP_Scripts $wp_scripts Instance of \WP_Scripts.
  */
 public function register_scripts(\WP_Scripts $wp_scripts)
 {
     $min = SCRIPT_DEBUG ? '' : '.min';
     $handle = 'customize-snapshots';
     $src = $this->dir_url . 'js/customize-snapshots' . $min . '.js';
     $deps = array('jquery', 'jquery-ui-dialog', 'wp-util', 'customize-controls');
     $wp_scripts->add($handle, $src, $deps);
     $handle = 'customize-snapshots-preview';
     $src = $this->dir_url . 'js/customize-snapshots-preview' . $min . '.js';
     $deps = array('customize-preview');
     $wp_scripts->add($handle, $src, $deps);
     $handle = 'customize-snapshots-frontend';
     $src = $this->dir_url . 'js/customize-snapshots-frontend' . $min . '.js';
     $deps = array('jquery', 'underscore');
     $wp_scripts->add($handle, $src, $deps);
 }
开发者ID:xwp,项目名称:wp-customize-snapshots,代码行数:23,代码来源:class-plugin.php


示例6: array

 /**
  * @param WP_Scripts $wp_scripts
  * @action wp_default_scripts
  */
 function register_scripts($wp_scripts)
 {
     $handle = 'customize-partial-refresh-base';
     $src = $this->get_dir_url('js/customize-partial-refresh-base.js');
     $deps = array('customize-base');
     $wp_scripts->add($handle, $src, $deps, $this->get_version());
     $this->script_handles['base'] = $handle;
     $handle = 'customize-partial-refresh-widgets-preview';
     $src = $this->get_dir_url('js/customize-partial-refresh-widgets-preview.js');
     $deps = array('jquery', 'wp-util', 'customize-preview', 'customize-preview-widgets', $this->script_handles['base']);
     $in_footer = true;
     $wp_scripts->add($handle, $src, $deps, $this->get_version(), $in_footer);
     $this->script_handles['widgets-preview'] = $handle;
     $handle = 'customize-partial-refresh-widgets-pane';
     $src = $this->get_dir_url('js/customize-partial-refresh-widgets-pane.js');
     $deps = array('jquery', 'wp-util', 'customize-controls', 'customize-widgets', $this->script_handles['base']);
     $in_footer = true;
     $wp_scripts->add($handle, $src, $deps, $this->get_version(), $in_footer);
     $this->script_handles['widgets-pane'] = $handle;
 }
开发者ID:AshiqKiron,项目名称:wp-customize-partial-refresh,代码行数:24,代码来源:class-wp-customize-partial-refresh-plugin.php


示例7: gp_scripts_default

/**
 * Register the GlotPress scripts
 *
 * @param WP_Scripts $scripts
 */
function gp_scripts_default(&$scripts)
{
    $url = gp_plugin_url('assets/js');
    $scripts->add('tablesorter', $url . '/jquery.tablesorter.min.js', array('jquery'), '1.10.4');
    $scripts->add('gp-common', $url . '/common.js', array('jquery'), '20150430');
    $scripts->add('gp-editor', $url . '/editor.js', array('gp-common', 'jquery-ui-tooltip'), '20160329');
    $scripts->add('gp-glossary', $url . '/glossary.js', array('gp-common'), '20160329');
    $scripts->add('gp-translations-page', $url . '/translations-page.js', array('gp-common'), '20150430');
    $scripts->add('mass-create-sets-page', $url . '/mass-create-sets-page.js', array('gp-common'), '20150430');
}
开发者ID:ramiy,项目名称:GlotPress-WP,代码行数:15,代码来源:assets-loader.php


示例8: __construct

 public function __construct($scripts = '')
 {
     $this->old_scripts = empty($scripts) || !$scripts instanceof WP_Scripts ? new WP_Scripts() : $scripts;
     // Unset all the object properties except our private copy of the
     // scripts object. We have to unset everything so that the overload
     // methods talk to $this->old_scripts->whatever instead of $this->whatever.
     foreach (array_keys(get_object_vars($this)) as $key) {
         if ('old_scripts' === $key) {
             continue;
         }
         unset($this->{$key});
     }
     parent::__construct();
 }
开发者ID:rclilly,项目名称:wp-enqueue-masher,代码行数:14,代码来源:class-wp-js-concat.php


示例9: test_jquery_in_footer

 /**
  * Test placing of jQuery in footer.
  *
  * @ticket 25247
  */
 function test_jquery_in_footer()
 {
     $scripts = new WP_Scripts();
     $scripts->add('jquery', false, array('jquery-core', 'jquery-migrate'));
     $scripts->add('jquery-core', '/jquery.js', array());
     $scripts->add('jquery-migrate', '/jquery-migrate.js', array());
     $scripts->enqueue('jquery');
     $jquery = $scripts->query('jquery');
     $jquery->add_data('group', 1);
     foreach ($jquery->deps as $dep) {
         $scripts->add_data($dep, 'group', 1);
     }
     $this->expectOutputRegex('/^(?:<script[^>]+><\\/script>\\n){2}$/');
     $scripts->do_items(false, 0);
     $this->assertNotContains('jquery', $scripts->done);
     $this->assertNotContains('jquery-core', $scripts->done, 'jquery-core should be in footer but is in head');
     $this->assertNotContains('jquery-migrate', $scripts->done, 'jquery-migrate should be in footer but is in head');
     $scripts->do_items(false, 1);
     $this->assertContains('jquery', $scripts->done);
     $this->assertContains('jquery-core', $scripts->done, 'jquery-core in footer');
     $this->assertContains('jquery-migrate', $scripts->done, 'jquery-migrate in footer');
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:27,代码来源:jquery.php


示例10: print_head_scripts

/**
 * 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()
 */
function print_head_scripts()
{
    global $wp_scripts, $concatenate_scripts;
    if (!did_action('wp_print_scripts')) {
        /** This action is documented in wp-includes/functions.wp-scripts.php */
        do_action('wp_print_scripts');
    }
    if (!is_a($wp_scripts, 'WP_Scripts')) {
        $wp_scripts = new WP_Scripts();
    }
    script_concat_settings();
    $wp_scripts->do_concat = $concatenate_scripts;
    $wp_scripts->do_head_items();
    /**
     * Filter 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;
}
开发者ID:hachi4,项目名称:WordPress,代码行数:36,代码来源:script-loader.php


示例11: wp_script_is

/**
 * Check whether script has been added to WordPress Scripts.
 *
 * By default, checks if the script has been enqueued. You can also
 * pass 'registered' to $list, to see if the script is registered,
 * and you can check processing statuses with 'to_do' and 'done'.
 *
 * @since WP unknown; BP unknown
 *
 * @param string $handle Name of the script.
 * @param string $list Optional. Defaults to 'enqueued'. Values are
 * 	'registered', 'enqueued' (or 'queue'), 'to_do', and 'done'.
 * @return bool Whether script is in the list.
 */
function wp_script_is($handle, $list = 'enqueued')
{
    global $wp_scripts;
    if (!is_a($wp_scripts, 'WP_Scripts')) {
        if (!did_action('init')) {
            _doing_it_wrong(__FUNCTION__, sprintf(__('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>init</code>'), '3.3');
        }
        $wp_scripts = new WP_Scripts();
    }
    return (bool) $wp_scripts->query($handle, $list);
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:25,代码来源:functions.wp-scripts.php


示例12: add_data

 /**
  * Adds script data to registered components.
  *
  * @note This method implements the ability to add additional inline data to specific scripts.
  *    As of v3.4, WordPress® is still lacking functions to interact w/ this feature.
  *    Therefore, we'll need to access `$wp_scripts` directly.
  *
  * @param string|array $components A string, or an array of specific components that need `$data` (i.e. inline JavaScript code).
  *
  * @param string       $data The data (i.e. inline JavaScript code) that is needed by `$components`.
  *
  * @throws exception If invalid types are passed through arguments list.
  */
 public function add_data($components, $data)
 {
     $this->check_arg_types(array('string', 'array'), 'string', func_get_args());
     $components = (array) $components;
     // Force array value.
     global $wp_scripts;
     // Global object reference.
     if (!$wp_scripts instanceof \WP_Scripts) {
         $wp_scripts = new \WP_Scripts();
     }
     foreach ($components = array_unique($components) as $_handle) {
         if ($this->©string->is_not_empty($_handle) && wp_script_is($_handle, 'registered')) {
             $existing_data = $wp_scripts->get_data($_handle, 'data');
             $wp_scripts->add_data($_handle, 'data', trim($existing_data . "\n" . $data));
         }
     }
 }
开发者ID:panvagenas,项目名称:x-related-posts,代码行数:30,代码来源:scripts.php


示例13: filter_wp_default_scripts

/**
 * Filter wp_default_scripts
 *
 * Removes an extra jQuery Script
 *
 * @since 5.0.0
 *
 * @param \WP_Scripts $scripts The Default WordPress scripts.
 *
 * @return void
 */
function filter_wp_default_scripts($scripts)
{
    if (!is_admin()) {
        $scripts->remove('jquery');
        $scripts->add('jquery', false, array('jquery-core'), '1.12.3');
    }
}
开发者ID:ChrisWiegman,项目名称:chriswiegman-theme,代码行数:18,代码来源:core.php


示例14: register_ui_scripts

 /**
  * Register additional jQuery UI scripts
  *
  * Never call this manually unless you really know what you are doing!
  *
  * @internal
  */
 public function register_ui_scripts()
 {
     global $wp_scripts;
     if (!$wp_scripts instanceof WP_Scripts) {
         $wp_scripts = new WP_Scripts();
     }
     $deps_c = array('jquery-ui-core');
     $deps_cw = array_merge($deps_c, array('jquery-ui-widget'));
     $deps_cwm = array_merge($deps_cw, array('jquery-ui-mouse'));
     $deps_cwp = array_merge($deps_cw, array('jquery-ui-position'));
     $jui = array('jquery-ui-accordion' => array('src' => 'jquery.ui.accordion.min.js', 'deps' => $deps_cw), 'jquery-ui-autocomplete' => array('src' => 'jquery.ui.autocomplete.min.js', 'deps' => $deps_cwp), 'jquery-ui-datepicker' => array('src' => 'jquery.ui.datepicker.min.js', 'deps' => $deps_c), 'jquery-ui-progressbar' => array('src' => 'jquery.ui.progressbar.min.js', 'deps' => $deps_cw), 'jquery-ui-slider' => array('src' => 'jquery.ui.slider.min.js', 'deps' => $deps_cwm));
     // register more scripts
     foreach ($jui as $handle => $cfg) {
         // make sure not registered already
         if (!$wp_scripts->query($handle)) {
             // register it
             $wp_scripts->add($handle, ICE_JS_URL . '/' . $cfg['src'], $cfg['deps'], '1.8.12');
             // put in footer group
             $wp_scripts->add_data($handle, 'group', 1);
         }
     }
 }
开发者ID:nathan929,项目名称:infinity,代码行数:29,代码来源:enqueue.php


示例15: register_scripts

 /**
  * Register scripts.
  *
  * @param \WP_Scripts $wp_scripts Instance of \WP_Scripts.
  * @action wp_default_scripts
  */
 public function register_scripts(\WP_Scripts $wp_scripts)
 {
     $handle = 'customize-rest-resources-namespace';
     $src = $this->dir_url . 'js/namespace.js';
     $deps = array();
     $wp_scripts->add($handle, $src, $deps, $this->version);
     $handle = 'customize-rest-resources-manager';
     $src = $this->dir_url . 'js/rest-resources-manager.js';
     $deps = array('customize-rest-resources-namespace', 'wp-api', 'backbone');
     $wp_scripts->add($handle, $src, $deps, $this->version);
     $handle = 'customize-rest-resources-pane-manager';
     $src = $this->dir_url . 'js/rest-resources-pane-manager.js';
     $deps = array('customize-rest-resources-namespace', 'customize-rest-resources-manager', 'customize-controls', 'customize-rest-resources-section', 'customize-rest-resource-control');
     $wp_scripts->add($handle, $src, $deps, $this->version);
     $handle = 'customize-rest-resources-preview-manager';
     $src = $this->dir_url . 'js/rest-resources-preview-manager.js';
     $deps = array('customize-rest-resources-namespace', 'customize-rest-resources-manager', 'customize-preview');
     $wp_scripts->add($handle, $src, $deps, $this->version);
     $handle = 'customize-rest-resources-section';
     $src = $this->dir_url . 'js/rest-resources-section.js';
     $deps = array('customize-rest-resources-namespace', 'customize-controls');
     $wp_scripts->add($handle, $src, $deps, $this->version);
     $handle = 'customize-rest-resource-control';
     $src = $this->dir_url . 'js/rest-resource-control.js';
     $deps = array('customize-rest-resources-namespace', 'customize-controls');
     $wp_scripts->add($handle, $src, $deps, $this->version);
 }
开发者ID:chandra-patel,项目名称:wp-customize-rest-resources,代码行数:33,代码来源:class-plugin.php


示例16: wp_default_scripts

/**
 * 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.' ),
	) );

	$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'),
//.........这里部分代码省略.........
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:101,代码来源:script-loader.php


示例17: dequeue_script

function dequeue_script($handle)
{
    global $wp_scripts;
    if (!class_exists('WP_Scripts')) {
        return false;
    }
    if (!is_a($wp_scripts, 'WP_Scripts')) {
        $wp_scripts = new WP_Scripts();
    }
    $wp_scripts->dequeue($handle);
}
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:11,代码来源:regist_ajax_libs.php


示例18: poll

 public static function poll()
 {
     // This is a super lightweight API to get posts and comments from WP
     // It's intended for use with o2
     // @todo Allow requesting a specific post or comment, and a post with all comments
     // Need to sort things because they're queried separately
     function o2_date_sort($a, $b)
     {
         if ($a->unixtime == $b->unixtime) {
             return 0;
         }
         return $a->unixtime > $b->unixtime ? -1 : 1;
     }
     $ok_to_serve_data = true;
     $ok_to_serve_data = apply_filters('o2_read_api_ok_to_serve_data', $ok_to_serve_data);
     $data = array();
     if ($ok_to_serve_data) {
         $posts = self::get_posts();
         $comments = self::get_comments();
         // Clean up posts and comments
         $data = array();
         if (count($posts)) {
             foreach ($posts as $post) {
                 $data[] = o2_Fragment::get_fragment($post);
             }
         }
         if (count($comments)) {
             foreach ($comments as $comment) {
                 $data[] = o2_Fragment::get_fragment($comment);
             }
         }
         // Shuffle up and deal
         usort($data, 'o2_date_sort');
     }
     // Let the client know if the user is logged in or not
     $is_logged_in = is_user_logged_in();
     // Generate an updated nonce (they expire after all, and our "app" may be open for a long time)
     $new_nonce = wp_create_nonce('o2_nonce');
     if ($is_logged_in) {
         // @todo change to another way, and one that is less costly - see also below
         // $current_user_id = get_current_user_id();
         // update_user_meta( $current_user_id, 'o2_last_poll_gmt', time() );
     }
     $response = array("data" => $data, "newNonce" => $new_nonce, "loggedIn" => $is_logged_in);
     // Check for unloaded scripts and styles if there are polled posts
     if (!empty($data)) {
         // Attach scripts
         if (isset($_REQUEST['scripts'])) {
             // Parse and sanitize the script handles already output
             if (!is_array($_REQUEST['scripts'])) {
                 $_REQUEST['scripts'] = explode(',', $_REQUEST['scripts']);
             }
             $initial_scripts = is_array($_REQUEST['scripts']) ? array_map('sanitize_text_field', $_REQUEST['scripts']) : null;
             if (is_array($initial_scripts)) {
                 global $wp_scripts;
                 if (!$wp_scripts instanceof WP_Scripts) {
                     $wp_scripts = new WP_Scripts();
                 }
                 // Identify new scripts needed by the polled posts
                 $polled_scripts = array_diff($wp_scripts->done, $initial_scripts);
                 // If new scripts are needed, extract relevant data from $wp_scripts
                 if (!empty($polled_scripts)) {
                     $response['scripts'] = array();
                     foreach ($polled_scripts as $handle) {
                         // Abort if the handle doesn't match a registered script
                         if (!isset($wp_scripts->registered[$handle])) {
                             continue;
                         }
                         // Provide basic script data
                         $script_data = array('handle' => $handle, 'footer' => is_array($wp_scripts->in_footer) && in_array($handle, $wp_scripts->in_footer), 'extra_data' => $wp_scripts->print_extra_script($handle, false));
                         // Base source
                         $src = $wp_scripts->registered[$handle]->src;
                         // Take base_url into account
                         if (strpos($src, '//') === 0) {
                             $src = is_ssl() ? 'https:' . $src : 'http:' . $src;
                         }
                         // Deal with root-relative URLs
                         if (strpos($src, '/') === 0) {
                             $src = $wp_scripts->base_url . $src;
                         }
                         if (strpos($src, 'http') !== 0) {
                             $src = $wp_scripts->base_url . $src;
                         }
                         // Version and additional arguments
                         if (null === $wp_scripts->registered[$handle]->ver) {
                             $ver = '';
                         } else {
                             $ver = $wp_scripts->registered[$handle]->ver ? $wp_scripts->registered[$handle]->ver : $wp_scripts->default_version;
                         }
                         if (isset($wp_scripts->args[$handle])) {
                             $ver = $ver ? $ver . '&amp;' . $wp_scripts->args[$handle] : $wp_scripts->args[$handle];
                         }
                         // Full script source with version info
                         $script_data['src'] = add_query_arg('ver', $ver, $src);
                         // Add script to data that will be returned to o2
                         array_push($response['scripts'], $script_data);
                     }
                 }
             }
         }
//.........这里部分代码省略.........
开发者ID:BE-Webdesign,项目名称:o2,代码行数:101,代码来源:read-api.php


示例19: print_head_scripts

/**
 * 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
 * @see wp_print_scripts()
 */
function print_head_scripts()
{
    global $wp_scripts, $concatenate_scripts;
    if (!did_action('wp_print_scripts')) {
        do_action('wp_print_scripts');
    }
    if (!is_a($wp_scripts, 'WP_Scripts')) {
        $wp_scripts = new WP_Scripts();
    }
    script_concat_settings();
    $wp_scripts->do_concat = $concatenate_scripts;
    $wp_scripts->do_head_items();
    if (apply_filters('print_head_scripts', true)) {
        _print_scripts();
    }
    $wp_scripts->reset();
    return $wp_scripts->done;
}
开发者ID:jawandsingh,项目名称:wordpress_with_sql_azure,代码行数:27,代码来源:script-loader.php


示例20: wp_dequeue_script

 function wp_dequeue_script($handle)
 {
     global $wp_scripts;
     if (!is_a($wp_scripts, 'WP_Scripts')) {
         $wp_scripts = new WP_Scripts();
     }
     $wp_scripts->dequeue($handle);
 }
开发者ID:kidaa30,项目名称:Constant-Contact-WordPress-Plugin,代码行数:8,代码来源:form-designer.php



注:本文中的WP_Scripts类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP WP_Session_Tokens类代码示例发布时间:2022-05-23
下一篇:
PHP WP_Screen类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap