当前位置: 首页>>代码示例>>PHP>>正文


PHP _print_scripts函数代码示例

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


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

示例1: print_footer_scripts

/**
 * Prints the scripts that were queued for the footer or too late for the HTML head.
 *
 * @since 2.8
 */
function print_footer_scripts()
{
    global $wp_scripts, $concatenate_scripts;
    if (!is_a($wp_scripts, '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();
    if (apply_filters('print_footer_scripts', true)) {
        _print_scripts();
    }
    $wp_scripts->reset();
    return $wp_scripts->done;
}
开发者ID:jawandsingh,项目名称:wordpress_with_sql_azure,代码行数:21,代码来源:script-loader.php

示例2: print_footer_scripts

/**
 * 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();
    /**
     * Filter 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;
}
开发者ID:vheidari,项目名称:WordPress,代码行数:33,代码来源:script-loader.php

示例3: do_item

 /**
  * 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.
//.........这里部分代码省略.........
开发者ID:Garth619,项目名称:Femi9,代码行数:101,代码来源:class.wp-scripts.php


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