Changeset 4559 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin.php
- Timestamp:
- 12/19/2016 07:00:06 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin.php
r4505 r4559 112 112 } 113 113 $result['sections']['reviews'] = $this->get_plugin_reviews_markup( $post->post_name ); 114 if ( !empty( $result['sections']['faq'] ) ) { 115 $result['sections']['enhanced_faq'] = $result['sections']['faq']; 116 $result['sections']['faq'] = $this->get_simplified_faq_markup( $result['sections']['enhanced_faq'] ); 117 } 118 114 119 $result['description'] = $result['sections']['description']; 115 120 … … 271 276 } 272 277 278 /** 279 * Return a 'simplified' markup for the FAQ screen. 280 * WordPress only supports a whitelisted selection of tags, `<dl>` is not one of them. 281 * 282 * @see https://core.trac.wordpress.org/browser/tags/4.7/src/wp-admin/includes/plugin-install.php#L478 283 * @param string $markup The existing Markup. 284 * @return string Them markup with `<dt>` replaced with `<h4>` and `<dd>` with `<p>`. 285 */ 286 protected function get_simplified_faq_markup( $markup ) { 287 $markup = str_replace( 288 array( '<dl>', '</dl>', '<dt>', '</dt>', '<dd>', '</dd>' ), 289 array( '', '', '<h4>', '</h4>', '<p>', '</p>' ), 290 $markup 291 ); 292 293 return $markup; 294 } 295 273 296 } 274 297
Note: See TracChangeset
for help on using the changeset viewer.