Plugin Directory

Changeset 1372234


Ignore:
Timestamp:
03/16/2016 11:40:23 AM (10 years ago)
Author:
mobileappbuilder
Message:

(SE-20210) Brightcove player video not showing up in news items

Location:
mobile-app-api/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • mobile-app-api/trunk/library/shoutem-sanitizer.php

    r1208389 r1372234  
    7878        $filtered_html = preg_replace($all_tags, "filter_tag('\\1','\\2','\\3','\\4')",$filtered_html);
    7979    }
     80
     81    // strip any leading br tags or whitespace
     82    $filtered_html = preg_replace('{^(<br(\s*/)?>|&nbsp;|\s)+}i', '', $filtered_html);
     83    // strip any empty paragraphs
     84    $filtered_html = preg_replace('{<p>\s*<\/p>}i', '', $filtered_html);
     85
    8086    $filtered_html = preg_replace($all_tags, "filter_attr('\\1','\\2','\\3','\\4')",$filtered_html);
    8187    $filtered_html = preg_replace($all_tags, "rename_tag_post('\\1','\\2','\\3','\\4')",$filtered_html);
     
    8389    $filtered_html = preg_replace("/<\s*([^>\s]+)([^>]*)xmlns=\"v1\"([^>]*?)\s*\/>/i", "<$1$2xmlns=\"urn:xmlns:shoutem-com:cms:v1\"$3></$1>", $filtered_html);
    8490    $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);
    8693}
    8794
     
    187194
    188195function get_brightcove_video_id($src) {
     196    $src=html_entity_decode($src);
    189197    parse_str($src, $params);
    190198    $key = '@videoPlayer';
  • mobile-app-api/trunk/model/class-shoutem-brightcoveembed-dao.php

    r1207752 r1372234  
    33 * This class is designed to work with Brightcove embed markup wrapped in our own shortcode
    44 */
     5
     6require_once "dao-util.php";
     7
    58class ShoutemBrightcoveEmbedDao extends ShoutemDao {
    69   
     
    139142        $embed_node->removeAttribute('flashvars');
    140143        $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);
    143146    }
    144147
  • mobile-app-api/trunk/model/class-shoutem-posts-dao.php

    r1247838 r1372234  
    2020*/
    2121
     22require_once "dao-util.php";
     23
    2224class ShoutemPostsDao extends ShoutemDao {
    2325
    2426    public function __construct() {
    2527        parent::__construct();
     28
     29
    2630
    2731        remove_filter('shoutem_shortcode_wrapper', 'shoutem_shortcode_wrapper_filter', 10);
     
    199203        ));
    200204
     205        remove_filter( 'the_content', 'wpautop' );
    201206        $body = apply_filters('the_content', do_shortcode($remaped_post['body']));
    202207        if ($include_raw_post) {
     
    362367
    363368function 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);
    365370    if (function_exists('mb_decode_numericentity')) {
    366371        $html = mb_decode_numericentity($html, array (0x80, 0xffff, 0, 0xffff), 'UTF-8');
  • mobile-app-api/trunk/model/class-shoutem-smg-dao.php

    r1203001 r1372234  
    33 * This class is designed to work with SMG gallery output (USA Today specific) wrapped in our own shortcode
    44 */
     5
     6require_once "dao-util.php";
     7
    58class ShoutemSMGDao extends ShoutemDao {
    69   
     
    8891        $replacement_fragment->appendXML($replacement);
    8992        $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);
    9194    }
    9295
  • mobile-app-api/trunk/model/dao-util.php

    r1165018 r1372234  
    5353    $paginated_data['paging'] = $pagination_meta;
    5454    return $paginated_data;
    55    
     55}
     56
     57function 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());
    5664}
    5765
Note: See TracChangeset for help on using the changeset viewer.