Changeset 40673
- Timestamp:
- 05/15/2017 10:35:41 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/widgets/class-wp-widget-text.php
r40631 r40673 68 68 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); 69 69 70 $ widget_text = ! empty( $instance['text'] ) ? $instance['text'] : '';70 $text = ! empty( $instance['text'] ) ? $instance['text'] : ''; 71 71 72 72 /** … … 76 76 * @since 4.4.0 Added the `$this` parameter. 77 77 * 78 * @param string $ widget_textThe widget content.79 * @param array $instance 80 * @param WP_Widget_Text $this 78 * @param string $text The widget content. 79 * @param array $instance Array of settings for the current widget. 80 * @param WP_Widget_Text $this Current Text widget instance. 81 81 */ 82 $text = apply_filters( 'widget_text', $ widget_text, $instance, $this );82 $text = apply_filters( 'widget_text', $text, $instance, $this ); 83 83 84 84 if ( isset( $instance['filter'] ) ) { … … 92 92 * @since 4.8.0 93 93 * 94 * @param string $ widget_textThe widget content.95 * @param array $instance 96 * @param WP_Widget_Text $this 94 * @param string $text The widget content. 95 * @param array $instance Array of settings for the current widget. 96 * @param WP_Widget_Text $this Current Text widget instance. 97 97 */ 98 $text = apply_filters( 'widget_text_content', $ widget_text, $instance, $this );98 $text = apply_filters( 'widget_text_content', $text, $instance, $this ); 99 99 100 100 } elseif ( $instance['filter'] ) { -
trunk/tests/phpunit/tests/widgets/text-widget.php
r40640 r40673 75 75 ); 76 76 77 add_filter( 'widget_text_content', array( $this, 'filter_widget_text_content' ), 10, 3 );78 add_filter( 'widget_text', array( $this, 'filter_widget_text' ), 10, 3 );77 add_filter( 'widget_text_content', array( $this, 'filter_widget_text_content' ), 5, 3 ); 78 add_filter( 'widget_text', array( $this, 'filter_widget_text' ), 5, 3 ); 79 79 80 80 // Test with filter=false. … … 86 86 $this->assertEmpty( $this->widget_text_content_args ); 87 87 $this->assertNotEmpty( $this->widget_text_args ); 88 $this->assertContains( '[filter:widget_text]', $output ); 89 $this->assertNotContains( '[filter:widget_text_content]', $output ); 88 90 89 91 // Test with filter=true. … … 99 101 $this->assertEquals( $widget, $this->widget_text_args[2] ); 100 102 $this->assertEmpty( $this->widget_text_content_args ); 103 $this->assertContains( '[filter:widget_text]', $output ); 104 $this->assertNotContains( '[filter:widget_text_content]', $output ); 101 105 102 106 // Test with filter=content, the upgraded widget. … … 112 116 $this->assertEquals( $widget, $this->widget_text_args[2] ); 113 117 $this->assertCount( 3, $this->widget_text_content_args ); 114 $this->assertEquals( wpautop( $instance['text'] ), $this->widget_text_content_args[0] );118 $this->assertEquals( $instance['text'] . '[filter:widget_text]', $this->widget_text_content_args[0] ); 115 119 $this->assertEquals( $instance, $this->widget_text_content_args[1] ); 116 120 $this->assertEquals( $widget, $this->widget_text_content_args[2] ); 121 $this->assertContains( wpautop( $instance['text'] . '[filter:widget_text][filter:widget_text_content]' ), $output ); 117 122 } 118 123 … … 128 133 $this->widget_text_args = func_get_args(); 129 134 135 $widget_text .= '[filter:widget_text]'; 130 136 return $widget_text; 131 137 } … … 142 148 $this->widget_text_content_args = func_get_args(); 143 149 150 $widget_text .= '[filter:widget_text_content]'; 144 151 return $widget_text; 145 152 }
Note: See TracChangeset
for help on using the changeset viewer.