@@ -13,36 +13,36 @@ |
||
| 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 '_jwppp-video-url-%' AND post_id=%d |
| 28 | 28 | EOF; |
| 29 | 29 | |
| 30 | - $query = $wpdb->prepare( $query_template, $post_id ); |
|
| 31 | - var_dump( $wpdb->print_error() ); |
|
| 32 | - var_dump($query); |
|
| 33 | - $video_ids = $wpdb->get_col( $query ); |
|
| 34 | - if ( ! $video_ids ) { |
|
| 35 | - return $embedded_videos; |
|
| 36 | - } |
|
| 30 | + $query = $wpdb->prepare( $query_template, $post_id ); |
|
| 31 | + var_dump( $wpdb->print_error() ); |
|
| 32 | + var_dump($query); |
|
| 33 | + $video_ids = $wpdb->get_col( $query ); |
|
| 34 | + if ( ! $video_ids ) { |
|
| 35 | + return $embedded_videos; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | |
| 40 | - $jw_player_videos = array_map( function ( $video_id ) { |
|
| 41 | - return new Default_Embedded_Video( 'https://cdn.jwplayer.com/v2/media/' . $video_id ); |
|
| 42 | - }, $video_ids ); |
|
| 40 | + $jw_player_videos = array_map( function ( $video_id ) { |
|
| 41 | + return new Default_Embedded_Video( 'https://cdn.jwplayer.com/v2/media/' . $video_id ); |
|
| 42 | + }, $video_ids ); |
|
| 43 | 43 | |
| 44 | - return array_merge( $embedded_videos, $jw_player_videos ); |
|
| 45 | - } |
|
| 44 | + return array_merge( $embedded_videos, $jw_player_videos ); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | } |
| 49 | 49 | \ 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; |
@@ -27,21 +27,21 @@ discard block |
||
| 27 | 27 | SELECT meta_value FROM $post_meta_table_name WHERE meta_key LIKE '_jwppp-video-url-%' AND post_id=%d |
| 28 | 28 | EOF; |
| 29 | 29 | |
| 30 | - $query = $wpdb->prepare( $query_template, $post_id ); |
|
| 31 | - var_dump( $wpdb->print_error() ); |
|
| 30 | + $query = $wpdb->prepare($query_template, $post_id); |
|
| 31 | + var_dump($wpdb->print_error()); |
|
| 32 | 32 | var_dump($query); |
| 33 | - $video_ids = $wpdb->get_col( $query ); |
|
| 34 | - if ( ! $video_ids ) { |
|
| 33 | + $video_ids = $wpdb->get_col($query); |
|
| 34 | + if ( ! $video_ids) { |
|
| 35 | 35 | return $embedded_videos; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | |
| 40 | - $jw_player_videos = array_map( function ( $video_id ) { |
|
| 41 | - return new Default_Embedded_Video( 'https://cdn.jwplayer.com/v2/media/' . $video_id ); |
|
| 42 | - }, $video_ids ); |
|
| 40 | + $jw_player_videos = array_map(function($video_id) { |
|
| 41 | + return new Default_Embedded_Video('https://cdn.jwplayer.com/v2/media/'.$video_id); |
|
| 42 | + }, $video_ids); |
|
| 43 | 43 | |
| 44 | - return array_merge( $embedded_videos, $jw_player_videos ); |
|
| 44 | + return array_merge($embedded_videos, $jw_player_videos); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | |