Changeset 1372234
- Timestamp:
- 03/16/2016 11:40:23 AM (10 years ago)
- Location:
- mobile-app-api/trunk
- Files:
-
- 5 edited
-
library/shoutem-sanitizer.php (modified) (3 diffs)
-
model/class-shoutem-brightcoveembed-dao.php (modified) (2 diffs)
-
model/class-shoutem-posts-dao.php (modified) (3 diffs)
-
model/class-shoutem-smg-dao.php (modified) (2 diffs)
-
model/dao-util.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
mobile-app-api/trunk/library/shoutem-sanitizer.php
r1208389 r1372234 78 78 $filtered_html = preg_replace($all_tags, "filter_tag('\\1','\\2','\\3','\\4')",$filtered_html); 79 79 } 80 81 // strip any leading br tags or whitespace 82 $filtered_html = preg_replace('{^(<br(\s*/)?>| |\s)+}i', '', $filtered_html); 83 // strip any empty paragraphs 84 $filtered_html = preg_replace('{<p>\s*<\/p>}i', '', $filtered_html); 85 80 86 $filtered_html = preg_replace($all_tags, "filter_attr('\\1','\\2','\\3','\\4')",$filtered_html); 81 87 $filtered_html = preg_replace($all_tags, "rename_tag_post('\\1','\\2','\\3','\\4')",$filtered_html); … … 83 89 $filtered_html = preg_replace("/<\s*([^>\s]+)([^>]*)xmlns=\"v1\"([^>]*?)\s*\/>/i", "<$1$2xmlns=\"urn:xmlns:shoutem-com:cms:v1\"$3></$1>", $filtered_html); 84 90 $filtered_html = preg_replace("/xmlns=\"v1\"/i","xmlns=\"urn:xmlns:shoutem-com:cms:v1\"",$filtered_html); 85 return $filtered_html; 91 92 return trim($filtered_html); 86 93 } 87 94 … … 187 194 188 195 function get_brightcove_video_id($src) { 196 $src=html_entity_decode($src); 189 197 parse_str($src, $params); 190 198 $key = '@videoPlayer'; -
mobile-app-api/trunk/model/class-shoutem-brightcoveembed-dao.php
r1207752 r1372234 3 3 * This class is designed to work with Brightcove embed markup wrapped in our own shortcode 4 4 */ 5 6 require_once "dao-util.php"; 7 5 8 class ShoutemBrightcoveEmbedDao extends ShoutemDao { 6 9 … … 139 142 $embed_node->removeAttribute('flashvars'); 140 143 $embed_node->setAttribute('src', $src); 141 142 return substr( $dom->saveXML($dom->getElementsByTagName('body')->item(0)), 6, -7);144 145 return substr(dao_util_save_html_node($dom->getElementsByTagName('body')->item(0)), 6, -7); 143 146 } 144 147 -
mobile-app-api/trunk/model/class-shoutem-posts-dao.php
r1247838 r1372234 20 20 */ 21 21 22 require_once "dao-util.php"; 23 22 24 class ShoutemPostsDao extends ShoutemDao { 23 25 24 26 public function __construct() { 25 27 parent::__construct(); 28 29 26 30 27 31 remove_filter('shoutem_shortcode_wrapper', 'shoutem_shortcode_wrapper_filter', 10); … … 199 203 )); 200 204 205 remove_filter( 'the_content', 'wpautop' ); 201 206 $body = apply_filters('the_content', do_shortcode($remaped_post['body'])); 202 207 if ($include_raw_post) { … … 362 367 363 368 function shoutem_html_save($dom) { 364 $html = substr( $dom->saveXML($dom->getElementsByTagName('body')->item(0)), 6, -7);369 $html = substr(dao_util_save_html_node($dom->getElementsByTagName('body')->item(0)), 6, -7); 365 370 if (function_exists('mb_decode_numericentity')) { 366 371 $html = mb_decode_numericentity($html, array (0x80, 0xffff, 0, 0xffff), 'UTF-8'); -
mobile-app-api/trunk/model/class-shoutem-smg-dao.php
r1203001 r1372234 3 3 * This class is designed to work with SMG gallery output (USA Today specific) wrapped in our own shortcode 4 4 */ 5 6 require_once "dao-util.php"; 7 5 8 class ShoutemSMGDao extends ShoutemDao { 6 9 … … 88 91 $replacement_fragment->appendXML($replacement); 89 92 $gallery_node->parentNode->replaceChild($replacement_fragment, $gallery_node); 90 return substr( $dom->saveXML($dom->getElementsByTagName('body')->item(0)), 6, -7);93 return substr(dao_util_save_html_node($dom->getElementsByTagName('body')->item(0)), 6, -7); 91 94 } 92 95 -
mobile-app-api/trunk/model/dao-util.php
r1165018 r1372234 53 53 $paginated_data['paging'] = $pagination_meta; 54 54 return $paginated_data; 55 55 } 56 57 function dao_util_save_html_node($node) { 58 $fragment_doc = new DomDocument(); 59 $fragment = $fragment_doc->createDocumentFragment(); 60 $fragment_node = $fragment_doc->importNode($node, true); 61 $fragment->appendChild($fragment_node); 62 $fragment_doc->appendChild($fragment); 63 return trim($fragment_doc->saveHTML()); 56 64 } 57 65
Note: See TracChangeset
for help on using the changeset viewer.