X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/5aa86a9053fb0fa15846bb60aac2fb8fdfff524a..6c8f14c09105d0afa4c1574215c59b5021040e76:/wp-includes/class.wp-scripts.php diff --git a/wp-includes/class.wp-scripts.php b/wp-includes/class.wp-scripts.php index 41f6019e..f75929b4 100644 --- a/wp-includes/class.wp-scripts.php +++ b/wp-includes/class.wp-scripts.php @@ -31,15 +31,20 @@ class WP_Scripts extends WP_Dependencies { var $default_dirs; function __construct() { + $this->init(); + add_action( 'init', array( $this, 'init' ), 0 ); + } + + function init() { do_action_ref_array( 'wp_default_scripts', array(&$this) ); } /** * Prints scripts * - * Prints the scripts passed to it or the print queue. Also prints all necessary dependencies. + * Prints the scripts passed to it or the print queue. Also prints all necessary dependencies. * - * @param mixed $handles (optional) Scripts to be printed. (void) prints queue, (string) prints that script, (array of strings) prints those scripts. + * @param mixed $handles (optional) Scripts to be printed. (void) prints queue, (string) prints that script, (array of strings) prints those scripts. * @param int $group (optional) If scripts were queued in groups prints this group number. * @return array Scripts that have been printed */ @@ -105,7 +110,7 @@ class WP_Scripts extends WP_Dependencies { } $this->print_extra_script( $handle ); - if ( !preg_match('|^https?://|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) { + if ( !preg_match('|^(https?:)?//|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) { $src = $this->base_url . $src; } @@ -143,12 +148,12 @@ class WP_Scripts extends WP_Dependencies { $script = "var $object_name = " . json_encode($l10n) . ';'; if ( !empty($after) ) - $script .= "\n$after"; + $script .= "\n$after;"; $data = $this->get_data( $handle, 'data' ); if ( !empty( $data ) ) - $script = "$data;\n$script"; + $script = "$data\n$script"; return $this->add_data( $handle, 'data', $script ); }