Ticket #21547: script_changes.diff
File script_changes.diff, 2.5 KB (added by , 12 years ago) |
---|
-
wp-includes/functions.wp-scripts.php
97 97 } 98 98 99 99 /** 100 * Wrapper for $wp_scripts->delocalize() 101 * 102 * Used to strip away all localization from a script. Reverses the action of all previous calls to wp_localize_script with the given handle. 103 * 104 * @param string $handle The script handle that was registered or used in script-loader 105 * @return bool Whether the localization was removed successfully. 106 */ 107 function wp_delocalize_script( $handle ) { 108 global $wp_scripts; 109 if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) { 110 if ( ! did_action( 'init' ) ) 111 _doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ), 112 '<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>init</code>' ), '3.3' ); 113 114 return false; 115 } 116 117 return $wp_scripts->delocalize( $handle ); 118 } 119 120 /** 100 121 * Remove a registered script. 101 122 * 102 123 * @since r16 -
wp-includes/class.wp-dependencies.php
169 169 return $this->registered[$handle]->extra[$key]; 170 170 } 171 171 172 function remove_data( $handle, $key ) { 173 if ( !isset( $this->registered[$handle] ) ) 174 return false; 175 176 if ( !isset( $this->registered[$handle]->extra[$key] ) ) 177 return false; 178 179 return $this->registered[$handle]->remove_data( $key ); 180 } 181 172 182 function remove( $handles ) { 173 183 foreach ( (array) $handles as $handle ) 174 184 unset($this->registered[$handle]); … … 255 265 $this->extra[$name] = $data; 256 266 return true; 257 267 } 268 269 function remove_data( $name ) { 270 if ( !is_scalar($name) ) 271 return false; 272 unset($this->extra[$name]); 273 return true; 274 } 258 275 } -
wp-includes/class.wp-scripts.php
158 158 return $this->add_data( $handle, 'data', $script ); 159 159 } 160 160 161 function delocalize( $handle ) { 162 return $this->remove_data( $handle, 'data' ); 163 } 164 161 165 function set_group( $handle, $recursion, $group = false ) { 162 166 163 167 if ( $this->registered[$handle]->args === 1 )