@@ -13,31 +13,31 @@ |
||
| 13 | 13 | |
| 14 | 14 | class Jw_Player_Capture { |
| 15 | 15 | |
| 16 | - public function init() { |
|
| 17 | - add_filter( 'wl_videoobject_embedded_videos', array( $this, 'wl_videoobject_embedded_videos' ), 10, 2 ); |
|
| 18 | - } |
|
| 16 | + public function init() { |
|
| 17 | + add_filter( 'wl_videoobject_embedded_videos', array( $this, 'wl_videoobject_embedded_videos' ), 10, 2 ); |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | 20 | |
| 21 | - public function wl_videoobject_embedded_videos( $embedded_videos, $post_id ) { |
|
| 22 | - // we cant reliably determine count for external plugin without |
|
| 23 | - // this method. |
|
| 24 | - global $wpdb; |
|
| 25 | - $post_meta_table_name = $wpdb->postmeta; |
|
| 26 | - $query_template = <<<EOF |
|
| 21 | + public function wl_videoobject_embedded_videos( $embedded_videos, $post_id ) { |
|
| 22 | + // we cant reliably determine count for external plugin without |
|
| 23 | + // this method. |
|
| 24 | + global $wpdb; |
|
| 25 | + $post_meta_table_name = $wpdb->postmeta; |
|
| 26 | + $query_template = <<<EOF |
|
| 27 | 27 | SELECT meta_value FROM $post_meta_table_name WHERE meta_key LIKE %s AND post_id=%d |
| 28 | 28 | EOF; |
| 29 | - $query = $wpdb->prepare( $query_template, '_jwppp-video-url-%', $post_id ); |
|
| 30 | - $video_ids = $wpdb->get_col( $query ); |
|
| 31 | - if ( ! $video_ids ) { |
|
| 32 | - return $embedded_videos; |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - $jw_player_videos = array_map( function ( $video_id ) { |
|
| 36 | - return new Default_Embedded_Video( 'https://cdn.jwplayer.com/v2/media/' . $video_id ); |
|
| 37 | - }, $video_ids ); |
|
| 38 | - |
|
| 39 | - return array_merge( $embedded_videos, $jw_player_videos ); |
|
| 40 | - } |
|
| 29 | + $query = $wpdb->prepare( $query_template, '_jwppp-video-url-%', $post_id ); |
|
| 30 | + $video_ids = $wpdb->get_col( $query ); |
|
| 31 | + if ( ! $video_ids ) { |
|
| 32 | + return $embedded_videos; |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + $jw_player_videos = array_map( function ( $video_id ) { |
|
| 36 | + return new Default_Embedded_Video( 'https://cdn.jwplayer.com/v2/media/' . $video_id ); |
|
| 37 | + }, $video_ids ); |
|
| 38 | + |
|
| 39 | + return array_merge( $embedded_videos, $jw_player_videos ); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | } |
| 44 | 44 | \ No newline at end of file |
@@ -14,11 +14,11 @@ discard block |
||
| 14 | 14 | class Jw_Player_Capture { |
| 15 | 15 | |
| 16 | 16 | public function init() { |
| 17 | - add_filter( 'wl_videoobject_embedded_videos', array( $this, 'wl_videoobject_embedded_videos' ), 10, 2 ); |
|
| 17 | + add_filter('wl_videoobject_embedded_videos', array($this, 'wl_videoobject_embedded_videos'), 10, 2); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | |
| 21 | - public function wl_videoobject_embedded_videos( $embedded_videos, $post_id ) { |
|
| 21 | + public function wl_videoobject_embedded_videos($embedded_videos, $post_id) { |
|
| 22 | 22 | // we cant reliably determine count for external plugin without |
| 23 | 23 | // this method. |
| 24 | 24 | global $wpdb; |
@@ -26,17 +26,17 @@ discard block |
||
| 26 | 26 | $query_template = <<<EOF |
| 27 | 27 | SELECT meta_value FROM $post_meta_table_name WHERE meta_key LIKE %s AND post_id=%d |
| 28 | 28 | EOF; |
| 29 | - $query = $wpdb->prepare( $query_template, '_jwppp-video-url-%', $post_id ); |
|
| 30 | - $video_ids = $wpdb->get_col( $query ); |
|
| 31 | - if ( ! $video_ids ) { |
|
| 29 | + $query = $wpdb->prepare($query_template, '_jwppp-video-url-%', $post_id); |
|
| 30 | + $video_ids = $wpdb->get_col($query); |
|
| 31 | + if ( ! $video_ids) { |
|
| 32 | 32 | return $embedded_videos; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - $jw_player_videos = array_map( function ( $video_id ) { |
|
| 36 | - return new Default_Embedded_Video( 'https://cdn.jwplayer.com/v2/media/' . $video_id ); |
|
| 37 | - }, $video_ids ); |
|
| 35 | + $jw_player_videos = array_map(function($video_id) { |
|
| 36 | + return new Default_Embedded_Video('https://cdn.jwplayer.com/v2/media/'.$video_id); |
|
| 37 | + }, $video_ids); |
|
| 38 | 38 | |
| 39 | - return array_merge( $embedded_videos, $jw_player_videos ); |
|
| 39 | + return array_merge($embedded_videos, $jw_player_videos); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |