@@ 148-162 (lines=15) @@ | ||
145 | * @param string $str Input string. |
|
146 | * @return string Plain text string. |
|
147 | */ |
|
148 | protected function get_plain_text( $str ) { |
|
149 | // Trim string and return if empty. |
|
150 | $str = trim( (string) $str ); |
|
151 | if ( empty( $str ) ) { |
|
152 | return ''; |
|
153 | } |
|
154 | ||
155 | // Make sure there are no tags. |
|
156 | $str = wp_strip_all_tags( $str ); |
|
157 | ||
158 | // Replace all entities with their characters, including all types of quotes. |
|
159 | $str = html_entity_decode( $str, ENT_QUOTES ); |
|
160 | ||
161 | return $str; |
|
162 | } |
|
163 | ||
164 | /** |
|
165 | * Formats strings as safe HTML. |
|
@@ 170-184 (lines=15) @@ | ||
167 | * @param string $str Input string. |
|
168 | * @return string HTML text string. |
|
169 | */ |
|
170 | protected function get_rich_text( $str ) { |
|
171 | // Trim string and return if empty. |
|
172 | $str = trim( (string) $str ); |
|
173 | if ( empty( $str ) ) { |
|
174 | return ''; |
|
175 | } |
|
176 | ||
177 | // Make sure HTML is safe. |
|
178 | $str = wp_kses_post( $str ); |
|
179 | ||
180 | // Replace all entities with their characters, including all types of quotes. |
|
181 | $str = html_entity_decode( $str, ENT_QUOTES ); |
|
182 | ||
183 | return $str; |
|
184 | } |
|
185 | ||
186 | /** |
|
187 | * Loads an RSS feed using `fetch_feed`. |