- Timestamp:
- 10/05/2023 10:40:48 PM (16 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/html-api/class-wp-html-processor.php
r56702 r56790 40 40 * Example: 41 41 * 42 * $processor = WP_HTML_Processor::create Fragment( $html );42 * $processor = WP_HTML_Processor::create_fragment( $html ); 43 43 * if ( $processor->next_tag( array( 'breadcrumbs' => array( 'DIV', 'FIGURE', 'IMG' ) ) ) ) { 44 44 * $processor->add_class( 'responsive-image' ); … … 59 59 * when parsed, the return value from `get_breadcrumbs()` will always 60 60 * contain any implicit outermost elements. For example, when parsing 61 * with `create Fragment()` in the `BODY` context (the default), any61 * with `create_fragment()` in the `BODY` context (the default), any 62 62 * tag in the given HTML document will contain `array( 'HTML', 'BODY', … )` 63 63 * in its breadcrumbs. … … 240 240 * @return WP_HTML_Processor|null The created processor if successful, otherwise null. 241 241 */ 242 public static function create Fragment( $html, $context = '<body>', $encoding = 'UTF-8' ) {242 public static function create_fragment( $html, $context = '<body>', $encoding = 'UTF-8' ) { 243 243 if ( '<body>' !== $context || 'UTF-8' !== $encoding ) { 244 244 return null; … … 281 281 * @since 6.4.0 282 282 * 283 * @see WP_HTML_Processor::create Fragment()283 * @see WP_HTML_Processor::create_fragment() 284 284 * 285 285 * @param string $html HTML to process. … … 293 293 __METHOD__, 294 294 sprintf( 295 /* translators: %s: WP_HTML_Processor::create Fragment. */295 /* translators: %s: WP_HTML_Processor::create_fragment(). */ 296 296 __( 'Call %s to create an HTML Processor instead of calling the constructor directly.' ), 297 '<code>WP_HTML_Processor::create Fragment</code>'297 '<code>WP_HTML_Processor::create_fragment()</code>' 298 298 ), 299 299 '6.4.0' … … 325 325 * Example 326 326 * 327 * $processor = WP_HTML_Processor::create Fragment( '<template><strong><button><em><p><em>' );327 * $processor = WP_HTML_Processor::create_fragment( '<template><strong><button><em><p><em>' ); 328 328 * false === $processor->next_tag(); 329 329 * WP_HTML_Processor::ERROR_UNSUPPORTED === $processor->get_last_error(); … … 429 429 * Example: 430 430 * 431 * $processor = WP_HTML_Processor::create Fragment( '<div><span><figure><img></figure></span></div>' );431 * $processor = WP_HTML_Processor::create_fragment( '<div><span><figure><img></figure></span></div>' ); 432 432 * $processor->next_tag( 'img' ); 433 433 * true === $processor->matches_breadcrumbs( array( 'figure', 'img' ) ); … … 558 558 * Example 559 559 * 560 * $processor = WP_HTML_Processor::create Fragment( '<p><strong><em><img></em></strong></p>' );560 * $processor = WP_HTML_Processor::create_fragment( '<p><strong><em><img></em></strong></p>' ); 561 561 * $processor->next_tag( 'IMG' ); 562 562 * $processor->get_breadcrumbs() === array( 'HTML', 'BODY', 'P', 'STRONG', 'EM', 'IMG' ); … … 1440 1440 * @access private 1441 1441 */ 1442 const CONSTRUCTOR_UNLOCK_CODE = 'Use WP_HTML_Processor::create Fragmentinstead of calling the class constructor directly.';1442 const CONSTRUCTOR_UNLOCK_CODE = 'Use WP_HTML_Processor::create_fragment() instead of calling the class constructor directly.'; 1443 1443 }
Note: See TracChangeset
for help on using the changeset viewer.