Changeset 51154
- Timestamp:
- 06/15/2021 03:21:50 PM (3 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-block-pattern-categories-registry.php
r50532 r51154 39 39 public function register( $category_name, $category_properties ) { 40 40 if ( ! isset( $category_name ) || ! is_string( $category_name ) ) { 41 _doing_it_wrong( __METHOD__, __( 'Block pattern category name must be a string.' ), '5.5.0' ); 41 _doing_it_wrong( 42 __METHOD__, 43 __( 'Block pattern category name must be a string.' ), 44 '5.5.0' 45 ); 42 46 return false; 43 47 } … … 61 65 public function unregister( $category_name ) { 62 66 if ( ! $this->is_registered( $category_name ) ) { 63 /* translators: %s: Block pattern name. */ 64 $message = sprintf( __( 'Block pattern category "%s" not found.' ), $category_name ); 65 _doing_it_wrong( __METHOD__, $message, '5.5.0' ); 67 _doing_it_wrong( 68 __METHOD__, 69 /* translators: %s: Block pattern name. */ 70 sprintf( __( 'Block pattern category "%s" not found.' ), $category_name ), 71 '5.5.0' 72 ); 66 73 return false; 67 74 } -
trunk/src/wp-includes/class-wp-block-patterns-registry.php
r50532 r51154 42 42 public function register( $pattern_name, $pattern_properties ) { 43 43 if ( ! isset( $pattern_name ) || ! is_string( $pattern_name ) ) { 44 _doing_it_wrong( __METHOD__, __( 'Pattern name must be a string.' ), '5.5.0' ); 44 _doing_it_wrong( 45 __METHOD__, 46 __( 'Pattern name must be a string.' ), 47 '5.5.0' 48 ); 45 49 return false; 46 50 } 47 51 48 52 if ( ! isset( $pattern_properties['title'] ) || ! is_string( $pattern_properties['title'] ) ) { 49 _doing_it_wrong( __METHOD__, __( 'Pattern title must be a string.' ), '5.5.0' ); 53 _doing_it_wrong( 54 __METHOD__, 55 __( 'Pattern title must be a string.' ), 56 '5.5.0' 57 ); 50 58 return false; 51 59 } 52 60 53 61 if ( ! isset( $pattern_properties['content'] ) || ! is_string( $pattern_properties['content'] ) ) { 54 _doing_it_wrong( __METHOD__, __( 'Pattern content must be a string.' ), '5.5.0' ); 62 _doing_it_wrong( 63 __METHOD__, 64 __( 'Pattern content must be a string.' ), 65 '5.5.0' 66 ); 55 67 return false; 56 68 } … … 74 86 public function unregister( $pattern_name ) { 75 87 if ( ! $this->is_registered( $pattern_name ) ) { 76 /* translators: %s: Pattern name. */ 77 $message = sprintf( __( 'Pattern "%s" not found.' ), $pattern_name ); 78 _doing_it_wrong( __METHOD__, $message, '5.5.0' ); 88 _doing_it_wrong( 89 __METHOD__, 90 /* translators: %s: Pattern name. */ 91 sprintf( __( 'Pattern "%s" not found.' ), $pattern_name ), 92 '5.5.0' 93 ); 79 94 return false; 80 95 } -
trunk/src/wp-includes/class-wp-block-styles-registry.php
r50703 r51154 44 44 45 45 if ( ! isset( $block_name ) || ! is_string( $block_name ) ) { 46 $message = __( 'Block name must be a string.' ); 47 _doing_it_wrong( __METHOD__, $message, '5.3.0' ); 46 _doing_it_wrong( 47 __METHOD__, 48 __( 'Block name must be a string.' ), 49 '5.3.0' 50 ); 48 51 return false; 49 52 } 50 53 51 54 if ( ! isset( $style_properties['name'] ) || ! is_string( $style_properties['name'] ) ) { 52 $message = __( 'Block style name must be a string.' ); 53 _doing_it_wrong( __METHOD__, $message, '5.3.0' ); 55 _doing_it_wrong( 56 __METHOD__, 57 __( 'Block style name must be a string.' ), 58 '5.3.0' 59 ); 54 60 return false; 55 61 } … … 74 80 public function unregister( $block_name, $block_style_name ) { 75 81 if ( ! $this->is_registered( $block_name, $block_style_name ) ) { 76 /* translators: 1: Block name, 2: Block style name. */ 77 $message = sprintf( __( 'Block "%1$s" does not contain a style named "%2$s".' ), $block_name, $block_style_name ); 78 _doing_it_wrong( __METHOD__, $message, '5.3.0' ); 82 _doing_it_wrong( 83 __METHOD__, 84 /* translators: 1: Block name, 2: Block style name. */ 85 sprintf( __( 'Block "%1$s" does not contain a style named "%2$s".' ), $block_name, $block_style_name ), 86 '5.3.0' 87 ); 79 88 return false; 80 89 } -
trunk/src/wp-includes/class-wp-block-type-registry.php
r50419 r51154 53 53 54 54 if ( ! is_string( $name ) ) { 55 $message = __( 'Block type names must be strings.' ); 56 _doing_it_wrong( __METHOD__, $message, '5.0.0' ); 55 _doing_it_wrong( 56 __METHOD__, 57 __( 'Block type names must be strings.' ), 58 '5.0.0' 59 ); 57 60 return false; 58 61 } 59 62 60 63 if ( preg_match( '/[A-Z]+/', $name ) ) { 61 $message = __( 'Block type names must not contain uppercase characters.' ); 62 _doing_it_wrong( __METHOD__, $message, '5.0.0' ); 64 _doing_it_wrong( 65 __METHOD__, 66 __( 'Block type names must not contain uppercase characters.' ), 67 '5.0.0' 68 ); 63 69 return false; 64 70 } … … 66 72 $name_matcher = '/^[a-z0-9-]+\/[a-z0-9-]+$/'; 67 73 if ( ! preg_match( $name_matcher, $name ) ) { 68 $message = __( 'Block type names must contain a namespace prefix. Example: my-plugin/my-custom-block-type' ); 69 _doing_it_wrong( __METHOD__, $message, '5.0.0' ); 74 _doing_it_wrong( 75 __METHOD__, 76 __( 'Block type names must contain a namespace prefix. Example: my-plugin/my-custom-block-type' ), 77 '5.0.0' 78 ); 70 79 return false; 71 80 } 72 81 73 82 if ( $this->is_registered( $name ) ) { 74 /* translators: %s: Block name. */ 75 $message = sprintf( __( 'Block type "%s" is already registered.' ), $name ); 76 _doing_it_wrong( __METHOD__, $message, '5.0.0' ); 83 _doing_it_wrong( 84 __METHOD__, 85 /* translators: %s: Block name. */ 86 sprintf( __( 'Block type "%s" is already registered.' ), $name ), 87 '5.0.0' 88 ); 77 89 return false; 78 90 } … … 102 114 103 115 if ( ! $this->is_registered( $name ) ) { 104 /* translators: %s: Block name. */ 105 $message = sprintf( __( 'Block type "%s" is not registered.' ), $name ); 106 _doing_it_wrong( __METHOD__, $message, '5.0.0' ); 116 _doing_it_wrong( 117 __METHOD__, 118 /* translators: %s: Block name. */ 119 sprintf( __( 'Block type "%s" is not registered.' ), $name ), 120 '5.0.0' 121 ); 107 122 return false; 108 123 } -
trunk/src/wp-includes/class-wp-customize-manager.php
r49992 r51154 3908 3908 // Removing core components this way is _doing_it_wrong(). 3909 3909 if ( in_array( $id, $this->components, true ) ) { 3910 $message = sprintf( 3911 /* translators: 1: Panel ID, 2: Link to 'customize_loaded_components' filter reference. */ 3912 __( 'Removing %1$s manually will cause PHP warnings. Use the %2$s filter instead.' ), 3913 $id, 3910 _doing_it_wrong( 3911 __METHOD__, 3914 3912 sprintf( 3915 '<a href="%1$s">%2$s</a>', 3916 esc_url( 'https://developer.wordpress.org/reference/hooks/customize_loaded_components/' ), 3917 '<code>customize_loaded_components</code>' 3918 ) 3913 /* translators: 1: Panel ID, 2: Link to 'customize_loaded_components' filter reference. */ 3914 __( 'Removing %1$s manually will cause PHP warnings. Use the %2$s filter instead.' ), 3915 $id, 3916 sprintf( 3917 '<a href="%1$s">%2$s</a>', 3918 esc_url( 'https://developer.wordpress.org/reference/hooks/customize_loaded_components/' ), 3919 '<code>customize_loaded_components</code>' 3920 ) 3921 ), 3922 '4.5.0' 3919 3923 ); 3920 3921 _doing_it_wrong( __METHOD__, $message, '4.5.0' );3922 3924 } 3923 3925 unset( $this->panels[ $id ] ); -
trunk/src/wp-includes/functions.wp-scripts.php
r50393 r51154 305 305 306 306 if ( in_array( $handle, $not_allowed, true ) ) { 307 $message = sprintf( 308 /* translators: 1: Script name, 2: wp_enqueue_scripts */ 309 __( 'Do not deregister the %1$s script in the administration area. To target the front-end theme, use the %2$s hook.' ), 310 "<code>$handle</code>", 311 '<code>wp_enqueue_scripts</code>' 307 _doing_it_wrong( 308 __FUNCTION__, 309 sprintf( 310 /* translators: 1: Script name, 2: wp_enqueue_scripts */ 311 __( 'Do not deregister the %1$s script in the administration area. To target the front-end theme, use the %2$s hook.' ), 312 "<code>$handle</code>", 313 '<code>wp_enqueue_scripts</code>' 314 ), 315 '3.6.0' 312 316 ); 313 _doing_it_wrong( __FUNCTION__, $message, '3.6.0' );314 317 return; 315 318 } -
trunk/src/wp-includes/query.php
r49927 r51154 900 900 */ 901 901 function is_main_query() { 902 global $wp_query; 903 902 904 if ( 'pre_get_posts' === current_filter() ) { 903 $message = sprintf( 904 /* translators: 1: pre_get_posts, 2: WP_Query->is_main_query(), 3: is_main_query(), 4: Documentation URL. */ 905 __( 'In %1$s, use the %2$s method, not the %3$s function. See %4$s.' ), 906 '<code>pre_get_posts</code>', 907 '<code>WP_Query->is_main_query()</code>', 908 '<code>is_main_query()</code>', 909 __( 'https://developer.wordpress.org/reference/functions/is_main_query/' ) 905 _doing_it_wrong( 906 __FUNCTION__, 907 sprintf( 908 /* translators: 1: pre_get_posts, 2: WP_Query->is_main_query(), 3: is_main_query(), 4: Documentation URL. */ 909 __( 'In %1$s, use the %2$s method, not the %3$s function. See %4$s.' ), 910 '<code>pre_get_posts</code>', 911 '<code>WP_Query->is_main_query()</code>', 912 '<code>is_main_query()</code>', 913 __( 'https://developer.wordpress.org/reference/functions/is_main_query/' ) 914 ), 915 '3.7.0' 910 916 ); 911 _doing_it_wrong( __FUNCTION__, $message, '3.7.0' ); 912 } 913 914 global $wp_query; 917 } 918 915 919 return $wp_query->is_main_query(); 916 920 } -
trunk/src/wp-includes/shortcodes.php
r49963 r51154 65 65 66 66 if ( '' === trim( $tag ) ) { 67 $message = __( 'Invalid shortcode name: Empty name given.' ); 68 _doing_it_wrong( __FUNCTION__, $message, '4.4.0' ); 67 _doing_it_wrong( 68 __FUNCTION__, 69 __( 'Invalid shortcode name: Empty name given.' ), 70 '4.4.0' 71 ); 69 72 return; 70 73 } 71 74 72 75 if ( 0 !== preg_match( '@[<>&/\[\]\x00-\x20=]@', $tag ) ) { 73 /* translators: 1: Shortcode name, 2: Space-separated list of reserved characters. */ 74 $message = sprintf( __( 'Invalid shortcode name: %1$s. Do not use spaces or reserved characters: %2$s' ), $tag, '& / < > [ ] =' ); 75 _doing_it_wrong( __FUNCTION__, $message, '4.4.0' ); 76 _doing_it_wrong( 77 __FUNCTION__, 78 sprintf( 79 /* translators: 1: Shortcode name, 2: Space-separated list of reserved characters. */ 80 __( 'Invalid shortcode name: %1$s. Do not use spaces or reserved characters: %2$s' ), 81 $tag, 82 '& / < > [ ] =' 83 ), 84 '4.4.0' 85 ); 76 86 return; 77 87 } … … 315 325 316 326 if ( ! is_callable( $shortcode_tags[ $tag ] ) ) { 317 /* translators: %s: Shortcode tag. */ 318 $message = sprintf( __( 'Attempting to parse a shortcode without a valid callback: %s' ), $tag ); 319 _doing_it_wrong( __FUNCTION__, $message, '4.3.0' ); 327 _doing_it_wrong( 328 __FUNCTION__, 329 /* translators: %s: Shortcode tag. */ 330 sprintf( __( 'Attempting to parse a shortcode without a valid callback: %s' ), $tag ), 331 '4.3.0' 332 ); 320 333 return $m[0]; 321 334 }
Note: See TracChangeset
for help on using the changeset viewer.