]*? (id=[\'"]wistia_([^\'"<>]+)[\'"][^<>]* class=[\'"]wistia_embed[\'"]|' .
'class=[\'"]wistia_embed wistia_async_([^\'"<>]+)[^\'"]*[\'"])[^<>]*>/i', $content,
$all_matches, PREG_SET_ORDER ) ) {
if ( $this->p->debug->enabled ) {
$this->p->debug->log( count( $all_matches ) . ' x
wistia_embed video tag(s) found' );
}
foreach ( $all_matches as $media ) {
$video_url = 'http://fast.wistia.net/embed/iframe/' . ( empty( $media[ 2 ] ) ? $media[ 3 ] : $media[ 2 ] );
if ( $this->p->debug->enabled ) {
$this->p->debug->log( 'found video URL: ' . $video_url );
}
$videos[] = array( 'url' => $video_url );
}
} elseif ( $this->p->debug->enabled ) {
$this->p->debug->log( 'no
wistia_embed video tag(s) found' );
}
/*
* example:
*/
if ( preg_match_all( '/]*? href=[\'"]([^\'"]+)[\'"][^<>]* class=[\'"]wistia-popover\[([^\]]+)\][\'"][^<>]*>/i',
$content, $all_matches, PREG_SET_ORDER ) ) {
if ( $this->p->debug->enabled ) {
$this->p->debug->log( count( $all_matches ) . ' x wistia-popover video tag(s) found' );
}
foreach ( $all_matches as $media ) {
$video_url = $media[ 1 ];
if ( $this->p->debug->enabled ) {
$this->p->debug->log( 'found video URL: ' . $video_url );
}
$videos[] = array( 'url' => $video_url );
}
} elseif ( $this->p->debug->enabled ) {
$this->p->debug->log( 'no
wistia-popover video tag(s) found' );
}
return $videos;
}
public function filter_video_details( $mt_single_video, $args, $mod ) {
if ( $this->p->debug->enabled ) {
$this->p->debug->mark();
}
if ( ! empty( $args[ 'attach_id' ] ) ) {
if ( $this->p->debug->enabled ) {
$this->p->debug->log( 'exiting early: have attachment ID' );
}
return array();
} elseif ( false === strpos( $args[ 'url' ], 'wistia' ) ) { // Optimize before preg_match().
if ( false === strpos( $args[ 'url' ], 'wi.st' ) ) { // Optimize before preg_match().
if ( $this->p->debug->enabled ) {
$this->p->debug->log( 'exiting early: "wistia" or "wi.st" string not found in video URL' );
}
return array();
}
} elseif ( ! preg_match( '/^.*(wistia\.net|wistia\.com|wi\.st)\/([^\?\&\#<>]+).*$/i', $args[ 'url' ], $match ) ) {
if ( $this->p->debug->enabled ) {
$this->p->debug->log( 'exiting early: wistia video URL pattern not found' );
}
return array();
}
if ( $this->p->debug->enabled ) {
$this->p->debug->log( 'Wistia video URL found but no video API modules' );
}
if ( $this->p->notice->is_admin_pre_notices() ) {
$this->p->msgs->pro_feature_video_found_notice( _x( 'Wistia', 'video service name', 'wpsso' ), $mod );
}
return array();
}
}
}