wp/wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
   190 	/**
   190 	/**
   191 	 * Checks whether a given request has permission to read remote URLs.
   191 	 * Checks whether a given request has permission to read remote URLs.
   192 	 *
   192 	 *
   193 	 * @since 5.9.0
   193 	 * @since 5.9.0
   194 	 *
   194 	 *
   195 	 * @return WP_Error|bool True if the request has permission, else WP_Error.
   195 	 * @return true|WP_Error True if the request has permission, else WP_Error.
   196 	 */
   196 	 */
   197 	public function permissions_check() {
   197 	public function permissions_check() {
   198 		if ( current_user_can( 'edit_posts' ) ) {
   198 		if ( current_user_can( 'edit_posts' ) ) {
   199 			return true;
   199 			return true;
   200 		}
   200 		}
   345 	 * Parses the meta description from the provided HTML.
   345 	 * Parses the meta description from the provided HTML.
   346 	 *
   346 	 *
   347 	 * @since 5.9.0
   347 	 * @since 5.9.0
   348 	 *
   348 	 *
   349 	 * @param array $meta_elements {
   349 	 * @param array $meta_elements {
   350 	 *     A multi-dimensional indexed array on success, else empty array.
   350 	 *     A multidimensional indexed array on success, else empty array.
   351 	 *
   351 	 *
   352 	 *     @type string[] $0 Meta elements with a content attribute.
   352 	 *     @type string[] $0 Meta elements with a content attribute.
   353 	 *     @type string[] $1 Content attribute's opening quotation mark.
   353 	 *     @type string[] $1 Content attribute's opening quotation mark.
   354 	 *     @type string[] $2 Content attribute's value for each meta element.
   354 	 *     @type string[] $2 Content attribute's value for each meta element.
   355 	 * }
   355 	 * }
   381 	 * See: https://ogp.me/.
   381 	 * See: https://ogp.me/.
   382 	 *
   382 	 *
   383 	 * @since 5.9.0
   383 	 * @since 5.9.0
   384 	 *
   384 	 *
   385 	 * @param array  $meta_elements {
   385 	 * @param array  $meta_elements {
   386 	 *     A multi-dimensional indexed array on success, else empty array.
   386 	 *     A multidimensional indexed array on success, else empty array.
   387 	 *
   387 	 *
   388 	 *     @type string[] $0 Meta elements with a content attribute.
   388 	 *     @type string[] $0 Meta elements with a content attribute.
   389 	 *     @type string[] $1 Content attribute's opening quotation mark.
   389 	 *     @type string[] $1 Content attribute's opening quotation mark.
   390 	 *     @type string[] $2 Content attribute's value for each meta element.
   390 	 *     @type string[] $2 Content attribute's value for each meta element.
   391 	 * }
   391 	 * }
   523 	 *
   523 	 *
   524 	 * @since 5.9.0
   524 	 * @since 5.9.0
   525 	 *
   525 	 *
   526 	 * @param string $html The string of HTML to be parsed.
   526 	 * @param string $html The string of HTML to be parsed.
   527 	 * @return array {
   527 	 * @return array {
   528 	 *     A multi-dimensional indexed array on success, else empty array.
   528 	 *     A multidimensional indexed array on success, else empty array.
   529 	 *
   529 	 *
   530 	 *     @type string[] $0 Meta elements with a content attribute.
   530 	 *     @type string[] $0 Meta elements with a content attribute.
   531 	 *     @type string[] $1 Content attribute's opening quotation mark.
   531 	 *     @type string[] $1 Content attribute's opening quotation mark.
   532 	 *     @type string[] $2 Content attribute's value for each meta element.
   532 	 *     @type string[] $2 Content attribute's value for each meta element.
   533 	 * }
   533 	 * }
   586 				*/
   586 				*/
   587 				'\/?>#' .
   587 				'\/?>#' .
   588 
   588 
   589 				/*
   589 				/*
   590 				* These are the options:
   590 				* These are the options:
   591 				* - i : case insensitive
   591 				* - i : case-insensitive
   592 				* - s : allows newline characters for the . match (needed for multiline elements)
   592 				* - s : allows newline characters for the . match (needed for multiline elements)
   593 				* - U means non-greedy matching
   593 				* - U means non-greedy matching
   594 				*/
   594 				*/
   595 				'isU';
   595 				'isU';
   596 
   596 
   635 				 */
   635 				 */
   636 				$attr . '=([\"\']??)\s*' . $attr_value . '\s*\1' .
   636 				$attr . '=([\"\']??)\s*' . $attr_value . '\s*\1' .
   637 
   637 
   638 				/*
   638 				/*
   639 				 * These are the options:
   639 				 * These are the options:
   640 				 * - i : case insensitive
   640 				 * - i : case-insensitive
   641 				 * - s : allows newline characters for the . match (needed for multiline elements)
   641 				 * - s : allows newline characters for the . match (needed for multiline elements)
   642 				 * - U means non-greedy matching
   642 				 * - U means non-greedy matching
   643 				 */
   643 				 */
   644 				'#isU';
   644 				'#isU';
   645 
   645