p =& $plugin; if ( $this->p->debug->enabled ) { $this->p->debug->mark(); } /* * Filter priorities: * * 10 = Youtube Videos. * 20 = Vimeo Videos. * 30 = Wistia Videos. * 40 = Slideshare Presentations. * 60 = Facebook Videos. * 80 = Soundcloud Tracks. * 100 = WP Media Library Video Blocks. * 110 = WP Media Library Video Shortcodes. * 1000 = Gravatar Images. */ $this->p->util->add_plugin_filters( $this, array( 'video_details' => 3, ), $prio = 80 ); } 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' ], 'soundcloud' ) ) { // Optimize before preg_match(). if ( $this->p->debug->enabled ) { $this->p->debug->log( 'exiting early: "soundcloud" string not found in video URL' ); } return array(); } elseif ( ! preg_match( '/^(https:\/\/w\.soundcloud\.com\/player\/\?url='. 'https%3A\/\/api\.soundcloud\.com\/tracks\/[0-9]+).*$/', $args[ 'url' ], $match ) ) { if ( $this->p->debug->enabled ) { $this->p->debug->log( 'exiting early: soundcloud video URL pattern not found' ); } return array(); } if ( $this->p->debug->enabled ) { $this->p->debug->log( 'SoundCloud 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( 'SoundCloud', 'video service name', 'wpsso' ), $mod ); } return array(); } } }