Changeset 53283 for trunk/src/wp-includes/class.wp-scripts.php
- Timestamp:
- 04/26/2022 02:54:37 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class.wp-scripts.php
r52937 r53283 191 191 * 192 192 * @since 2.1.0 193 * @since 2.8.0 Added the `$ echo` parameter.193 * @since 2.8.0 Added the `$display` parameter. 194 194 * @deprecated 3.3.0 195 195 * 196 196 * @see print_extra_script() 197 197 * 198 * @param string $handle The script's registered handle.199 * @param bool $ echo Optional. Whether to echothe extra script200 * instead of just returning it. Default true.201 * @return bool|string|void Void if no data exists, extra scripts if `$ echo` is true,198 * @param string $handle The script's registered handle. 199 * @param bool $display Optional. Whether to print the extra script 200 * instead of just returning it. Default true. 201 * @return bool|string|void Void if no data exists, extra scripts if `$display` is true, 202 202 * true otherwise. 203 203 */ 204 public function print_scripts_l10n( $handle, $ echo= true ) {204 public function print_scripts_l10n( $handle, $display = true ) { 205 205 _deprecated_function( __FUNCTION__, '3.3.0', 'WP_Scripts::print_extra_script()' ); 206 return $this->print_extra_script( $handle, $ echo);206 return $this->print_extra_script( $handle, $display ); 207 207 } 208 208 … … 212 212 * @since 3.3.0 213 213 * 214 * @param string $handle The script's registered handle.215 * @param bool $ echo Optional. Whether to echothe extra script216 * instead of just returning it. Default true.217 * @return bool|string|void Void if no data exists, extra scripts if `$ echo` is true,214 * @param string $handle The script's registered handle. 215 * @param bool $display Optional. Whether to print the extra script 216 * instead of just returning it. Default true. 217 * @return bool|string|void Void if no data exists, extra scripts if `$display` is true, 218 218 * true otherwise. 219 219 */ 220 public function print_extra_script( $handle, $ echo= true ) {220 public function print_extra_script( $handle, $display = true ) { 221 221 $output = $this->get_data( $handle, 'data' ); 222 222 if ( ! $output ) { … … 224 224 } 225 225 226 if ( ! $ echo) {226 if ( ! $display ) { 227 227 return $output; 228 228 } … … 445 445 * @param string $position Optional. Whether to add the inline script 446 446 * before the handle or after. Default 'after'. 447 * @param bool $ echo Optional. Whether to echothe script447 * @param bool $display Optional. Whether to print the script 448 448 * instead of just returning it. Default true. 449 449 * @return string|false Script on success, false otherwise. 450 450 */ 451 public function print_inline_script( $handle, $position = 'after', $ echo= true ) {451 public function print_inline_script( $handle, $position = 'after', $display = true ) { 452 452 $output = $this->get_data( $handle, $position ); 453 453 … … 458 458 $output = trim( implode( "\n", $output ), "\n" ); 459 459 460 if ( $ echo) {460 if ( $display ) { 461 461 printf( "<script%s id='%s-js-%s'>\n%s\n</script>\n", $this->type_attr, esc_attr( $handle ), esc_attr( $position ), $output ); 462 462 } … … 583 583 * @since 5.0.0 584 584 * 585 * @param string $handle Name of the script to add the inline script to.586 * Must be lowercase.587 * @param bool $ echo Optional. Whether to echothe script588 * instead of just returning it. Default true.585 * @param string $handle Name of the script to add the inline script to. 586 * Must be lowercase. 587 * @param bool $display Optional. Whether to print the script 588 * instead of just returning it. Default true. 589 589 * @return string|false Script on success, false otherwise. 590 590 */ 591 public function print_translations( $handle, $ echo= true ) {591 public function print_translations( $handle, $display = true ) { 592 592 if ( ! isset( $this->registered[ $handle ] ) || empty( $this->registered[ $handle ]->textdomain ) ) { 593 593 return false; … … 611 611 JS; 612 612 613 if ( $ echo) {613 if ( $display ) { 614 614 printf( "<script%s id='%s-js-translations'>\n%s\n</script>\n", $this->type_attr, esc_attr( $handle ), $output ); 615 615 }
Note: See TracChangeset
for help on using the changeset viewer.