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
95           else
96                $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
97
98           if ( isset($this->args[$handle]) )
99                $ver = $ver ? $ver . '&' . $this->args[$handle] : $this->args[$handle];
100
101           $src = $this->registered[$handle]->src;
102
103           if ( $this->do_concat ) {
104                $srce = apply_filters( 'script_loader_src', $src, $handle );
105                if ( $this->in_default_dir($srce) ) {
106                     $this->print_code .= $this->print_scripts_l10n( $handle, false );
107                     $this->concat .= "$handle,";
108                     $this->concat_version .= "$handle$ver";
109                     return true;
110                } else {
111                     $this->ext_handles .= "$handle,";
112                     $this->ext_version .= "$handle$ver";
113                }
114           }
115
116           $this->print_scripts_l10n( $handle );
117           if ( !preg_match('|^https?://|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
118                $src = $this->base_url . $src;
119           }
120
121           if ( !empty($ver) )
122                $src = add_query_arg('ver', $ver, $src);
123           $src = esc_url(apply_filters( 'script_loader_src', $src, $handle ));
124
125           if ( $this->do_concat )
126                $this->print_html .= "<script type='text/javascript' src='$src'></script>\n";
127           else
128                echo "<script type='text/javascript' src='$src'></script>\n";
129
130           return true;
131      }
132