Skip to content

Commit

Permalink
Merge pull request #1386 from insideout10/hotfix/add-post-type-filter…
Browse files Browse the repository at this point in the history
…-videoobject

Add filters for external plugins
  • Loading branch information
akshayraje authored Jun 1, 2021
2 parents 92ea44d + 2b1f9cc commit 5d5709d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,20 @@ public function __construct( $state_storage_key ) {
}

public function next() {
$this->log->debug("Received video data source index as " . $this->get_state()->index);
$this->log->debug("Count set to " . $this->get_batch_size() );
$this->log->debug( "Received video data source index as " . $this->get_state()->index );
$this->log->debug( "Count set to " . $this->get_batch_size() );

return get_posts( array(
'fields' => 'ids',
'post_status' => 'any',
'numberposts' => $this->get_batch_size(),
'offset' => $this->get_state()->index,
/**
* @since 3.31.4
* Filter name : wl_videoobject_procedure_post_types
* @return array<string> An array of supported post types for the video import procedure.
*/
'post_type' => apply_filters( 'wl_videoobject_procedure_post_types', array( 'post' ) )
) );
}

Expand All @@ -32,6 +39,12 @@ public function count() {
'fields' => 'ids',
'numberposts' => - 1,
'post_status' => 'any',
/**
* @since 3.31.4
* Filter name : wl_videoobject_procedure_post_types
* @return array<string> An array of supported post types for the video import procedure.
*/
'post_type' => apply_filters( 'wl_videoobject_procedure_post_types', array( 'post' ) )
) ) );

}
Expand Down
10 changes: 10 additions & 0 deletions src/wordlift/videoobject/class-video-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ public function process_video_urls( \WP_Post $post, $post_id ) {

$embedded_videos = $parser->get_videos( $post_id );

/**
* Filters the embedded videos on post contet, custom plugins can add their video urls
* by constructing \Default_Embedded_Video or implement Embedded_Video class
* @since 3.31.4
* Filter name : wl_videoobject_embedded_videos
* @param $embedded_videos array<Embedded_Video>
* @return array<Embedded_Video>
*/
$embedded_videos = apply_filters('wl_videoobject_embedded_videos', $embedded_videos);

$storage = Video_Storage_Factory::get_storage();

// Before sending api requests we need to check if there are any videos in
Expand Down

0 comments on commit 5d5709d

Please sign in to comment.