Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: script_loader_src

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
106           if ( $this->do_concat ) {
107                /**
108                 * Filter the script loader source.
109                 *
110                 * @since 2.2.0
111                 *
112                 * @param string $src    Script loader source path.
113                 * @param string $handle Script handle.
114                 */
115                $srce = apply_filters( 'script_loader_src', $src, $handle );
116                if ( $this->in_default_dir($srce) ) {
117                     $this->print_code .= $this->print_extra_script( $handle, false );
118                     $this->concat .= "$handle,";
119                     $this->concat_version .= "$handle$ver";
120                     return true;
121                } else {
122                     $this->ext_handles .= "$handle,";
123                     $this->ext_version .= "$handle$ver";
124                }
 
Line Code
127           $this->print_extra_script( $handle );
128           if ( !preg_match('|^(https?:)?//|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
129                $src = $this->base_url . $src;
130           }
131
132           if ( !empty($ver) )
133                $src = add_query_arg('ver', $ver, $src);
134
135           /** This filter is documented in wp-includes/class.wp-scripts.php */
136           $src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) );
137
138           if ( ! $src )
139                return true;
140
141           if ( $this->do_concat )
142                $this->print_html .= "<script type='text/javascript' src='$src'></script>\n";
143           else
144                echo "<script type='text/javascript' src='$src'></script>\n";
145