wp/wp-includes/widgets/class-wp-widget-rss.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
    20 	 * Sets up a new RSS widget instance.
    20 	 * Sets up a new RSS widget instance.
    21 	 *
    21 	 *
    22 	 * @since 2.8.0
    22 	 * @since 2.8.0
    23 	 */
    23 	 */
    24 	public function __construct() {
    24 	public function __construct() {
    25 		$widget_ops  = array(
    25 		$widget_ops = array(
    26 			'description'                 => __( 'Entries from any RSS or Atom feed.' ),
    26 			'description'                 => __( 'Entries from any RSS or Atom feed.' ),
    27 			'customize_selective_refresh' => true,
    27 			'customize_selective_refresh' => true,
       
    28 			'show_instance_in_rest'       => true,
       
    29 
    28 		);
    30 		);
    29 		$control_ops = array(
    31 		$control_ops = array(
    30 			'width'  => 400,
    32 			'width'  => 400,
    31 			'height' => 200,
    33 			'height' => 200,
    32 		);
    34 		);
    46 		if ( isset( $instance['error'] ) && $instance['error'] ) {
    48 		if ( isset( $instance['error'] ) && $instance['error'] ) {
    47 			return;
    49 			return;
    48 		}
    50 		}
    49 
    51 
    50 		$url = ! empty( $instance['url'] ) ? $instance['url'] : '';
    52 		$url = ! empty( $instance['url'] ) ? $instance['url'] : '';
    51 		while ( stristr( $url, 'http' ) !== $url ) {
    53 		while ( ! empty( $url ) && stristr( $url, 'http' ) !== $url ) {
    52 			$url = substr( $url, 1 );
    54 			$url = substr( $url, 1 );
    53 		}
    55 		}
    54 
    56 
    55 		if ( empty( $url ) ) {
    57 		if ( empty( $url ) ) {
    56 			return;
    58 			return;
    70 			$desc = esc_attr( strip_tags( html_entity_decode( $rss->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) ) ) );
    72 			$desc = esc_attr( strip_tags( html_entity_decode( $rss->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) ) ) );
    71 			if ( empty( $title ) ) {
    73 			if ( empty( $title ) ) {
    72 				$title = strip_tags( $rss->get_title() );
    74 				$title = strip_tags( $rss->get_title() );
    73 			}
    75 			}
    74 			$link = strip_tags( $rss->get_permalink() );
    76 			$link = strip_tags( $rss->get_permalink() );
    75 			while ( stristr( $link, 'http' ) !== $link ) {
    77 			while ( ! empty( $link ) && stristr( $link, 'http' ) !== $link ) {
    76 				$link = substr( $link, 1 );
    78 				$link = substr( $link, 1 );
    77 			}
    79 			}
    78 		}
    80 		}
    79 
    81 
    80 		if ( empty( $title ) ) {
    82 		if ( empty( $title ) ) {