-
Notifications
You must be signed in to change notification settings - Fork 139
Allow private VideoPress videos to play when the URL is pasted on the Video Embed URL. #2566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
005017a
added provider script support function
actuallyakash 8e48c03
added changelog
actuallyakash 6b0512d
Merge branch 'dev' into videopress-issue
brianhogg 337e1b5
Merge branch 'dev' into videopress-issue
brianhogg e6f2df1
Merge branch 'dev' into videopress-issue
ideadude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| significance: patch | ||
| type: fixed | ||
| links: | ||
| - "#2533" | ||
| entry: Allow private VideoPress videos to play when the URL is pasted on Video | ||
| Embed URL. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ | |
| * @package LifterLMS/Abstracts/Classes | ||
| * | ||
| * @since 3.0.0 | ||
| * @version 6.5.0 | ||
| * @version [version] | ||
| */ | ||
|
|
||
| defined( 'ABSPATH' ) || exit; | ||
|
|
@@ -831,10 +831,11 @@ protected function get_creation_args( $args = null ) { | |
| } | ||
|
|
||
| /** | ||
| * Get media embeds | ||
| * Get media embeds. | ||
| * | ||
| * @since 3.17.0 | ||
| * @since 3.17.5 Unknown. | ||
| * @since [version] Added function to get provider support. | ||
| * | ||
| * @param string $type Optional. Embed type [video|audio]. Default is 'video'. | ||
| * @param string $prop Optional. Postmeta property name. Default is empty string. | ||
|
|
@@ -849,6 +850,8 @@ protected function get_embed( $type = 'video', $prop = '' ) { | |
| $url = $this->get( $prop ); | ||
| if ( $url ) { | ||
|
|
||
| $this->get_provider_support( $url ); | ||
|
|
||
| $ret = wp_oembed_get( $url ); | ||
|
|
||
| if ( ! $ret ) { | ||
|
|
@@ -1678,6 +1681,32 @@ public function toArray() { | |
| return apply_filters( "llms_{$this->model_post_type}_to_array", $arr, $this ); | ||
| } | ||
|
|
||
| /** | ||
| * Enqueues provider scripts for the URL. | ||
| * | ||
| * @since [version] | ||
| * | ||
| * @param string $url URL to check. | ||
| * @return null If no provider is found. | ||
| */ | ||
| public function get_provider_support( $url ) { | ||
|
|
||
| $host = wp_parse_url( $url, PHP_URL_HOST ); | ||
|
|
||
| // VideoPress Provider. | ||
| if ( is_plugin_active( 'jetpack-videopress/jetpack-videopress.php' ) ) { | ||
| if ( strpos( $host, 'videopress.com' ) !== false || strpos( $host, 'video.wordpress.com' ) !== false ) { | ||
| wp_enqueue_script( 'videopress-token-bridge', plugins_url() . '/jetpack-videopress/jetpack_vendor/automattic/jetpack-videopress/src/../build/lib/token-bridge.js', array(), llms()->version, true ); | ||
|
|
||
| wp_localize_script( 'videopress-token-bridge', 'videopressAjax', array() ); | ||
| } | ||
| } | ||
|
|
||
| return null; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't need to return null here, could just return nothing. |
||
| } | ||
|
|
||
|
|
||
|
|
||
| /** | ||
| * Called before data is sorted and returned by $this->toArray() | ||
| * | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not exactly sure why we need to specify the complete URL here, but it works!