From 0845431e81fda6c1e6a5ae3de48bde203082f57c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Mon, 5 Mar 2018 14:03:30 +0100 Subject: [PATCH 01/10] Add support for Facebook video links --- assets/js/facebook-video.js | 14 ++++++++++++++ includes/sm-cmb-functions.php | 4 ++-- includes/sm-template-functions.php | 8 ++++++++ readme.txt | 3 +++ sermons.php | 2 ++ 5 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 assets/js/facebook-video.js diff --git a/assets/js/facebook-video.js b/assets/js/facebook-video.js new file mode 100644 index 0000000..f9ed6af --- /dev/null +++ b/assets/js/facebook-video.js @@ -0,0 +1,14 @@ +/* taken from https://developers.facebook.com/docs/plugins/embedded-video-player#wordpress */ + +window.fbAsyncInit = function() { + FB.init({ + xfbml : true, + version : 'v2.5' + }); +}; (function(d, s, id){ + var js, fjs = d.getElementsByTagName(s)[0]; + if (d.getElementById(id)) {return;} + js = d.createElement(s); js.id = id; + js.src = "https://connect.facebook.net/en_US/sdk.js"; + fjs.parentNode.insertBefore(js, fjs); +}(document, 'script', 'facebook-jssdk')); \ No newline at end of file diff --git a/includes/sm-cmb-functions.php b/includes/sm-cmb-functions.php index 3f95888..dc5f76d 100755 --- a/includes/sm-cmb-functions.php +++ b/includes/sm-cmb-functions.php @@ -147,13 +147,13 @@ function wpfc_sermon_metaboxes() { ) ); $cmb2->add_field( array( 'name' => esc_html__( 'Video Embed Code', 'sermon-manager-for-wordpress' ), - 'desc' => esc_html__( 'Paste your embed code for Vimeo, Youtube, or direct video file here', 'sermon-manager-for-wordpress' ), + 'desc' => esc_html__( 'Paste your embed code for Vimeo, Youtube, Facebook, or direct video file here', 'sermon-manager-for-wordpress' ), 'id' => 'sermon_video', 'type' => 'textarea_code' ) ); $cmb2->add_field( apply_filters( 'sm_cmb2_field_sermon_video_link', array( 'name' => esc_html__( 'Video Link', 'sermon-manager-for-wordpress' ), - 'desc' => esc_html__( 'Paste your link for Vimeo, Youtube, or direct video file here', 'sermon-manager-for-wordpress' ), + 'desc' => esc_html__( 'Paste your link for Vimeo, Youtube, Facebook, or direct video file here', 'sermon-manager-for-wordpress' ), 'id' => 'sermon_video_link', 'type' => 'text_url' ) ) diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index 23260ba..27b8909 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -269,6 +269,14 @@ function wpfc_render_video( $url = '' ) { return ''; } + if ( strpos( $url, 'facebook.' ) !== false ) { + wp_enqueue_script( 'wpfc-sm-fb-player' ); + + parse_str( parse_url( $url, PHP_URL_QUERY ), $query ); + + return '
'; + } + $player = \SermonManager::getOption( 'player' ) ?: 'plyr'; if ( $player === 'wordpress' ) { diff --git a/readme.txt b/readme.txt index ec46217..8ff14ab 100755 --- a/readme.txt +++ b/readme.txt @@ -102,6 +102,9 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man 2. Sermon Files ## Changelog ## +### 2.12.1 ### +* New: Add support for Facebook video links + ### 2.12.0 ### * New: Add all new views, much more improved * New: Add more options to sorting shortcode diff --git a/sermons.php b/sermons.php index 56d2540..593b3b9 100755 --- a/sermons.php +++ b/sermons.php @@ -540,6 +540,8 @@ public static function enqueue_scripts_styles() { } } + wp_register_script( 'wpfc-sm-fb-player', SM_URL . 'assets/js/facebook-video.js', array(), SM_VERSION ); + switch ( \SermonManager::getOption( 'player' ) ) { case 'mediaelement': wp_enqueue_script( 'wp-mediaelement' ); From eecbf6954e5a83689b90afa145ef1811ae4db216 Mon Sep 17 00:00:00 2001 From: Adrian Ionescu <9744973+adrianweb@users.noreply.github.com> Date: Mon, 5 Mar 2018 13:30:15 +0000 Subject: [PATCH 02/10] add meta prefixes --- includes/sm-template-functions.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index 27b8909..51a5424 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -522,17 +522,20 @@ function wpfc_sermon_excerpt_v2( $return = false ) { From 87652c7e165e9d32597bec365cc25295a5b62cc3 Mon Sep 17 00:00:00 2001 From: Adrian Ionescu <9744973+adrianweb@users.noreply.github.com> Date: Mon, 5 Mar 2018 13:35:15 +0000 Subject: [PATCH 03/10] fix audio player css class --- includes/sm-template-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index 51a5424..82e3472 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -440,7 +440,7 @@ function wpfc_sermon_single_v2( $return = false, $post = null ) { -
+
From e93f41f70a025467c0ab8e0200fb2d4297516fbc Mon Sep 17 00:00:00 2001 From: Adrian Ionescu <9744973+adrianweb@users.noreply.github.com> Date: Mon, 5 Mar 2018 13:40:35 +0000 Subject: [PATCH 04/10] add audio download button --- includes/sm-template-functions.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index 82e3472..b2b57ae 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -442,6 +442,7 @@ function wpfc_sermon_single_v2( $return = false, $post = null ) {
+
From 9dc06f7d010276d81d61ea3cea50112cc72af73a Mon Sep 17 00:00:00 2001 From: Adrian Ionescu <9744973+adrianweb@users.noreply.github.com> Date: Mon, 5 Mar 2018 13:45:59 +0000 Subject: [PATCH 05/10] audio download button css --- assets/css/sermon.css | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/assets/css/sermon.css b/assets/css/sermon.css index 986a878..11f6cb1 100755 --- a/assets/css/sermon.css +++ b/assets/css/sermon.css @@ -495,3 +495,32 @@ h3.wpfc_grid_title a { .wpfc-sermon-single-topics { margin-top: 24px; } + +/* Sermon Single - Audio */ +.wpfc-sermon-single-audio { + display: flex; + justify-content: center; +} +.wpfc-sermon-single-audio-download { + display: flex; + align-items: center; + justify-content: center; + flex: none; + background: white; + padding: 0 1.25rem; +} +.wpfc-sermon-player { + vertical-align: middle; +} +.plyr { + flex: 1; +} +.plyr + .wpfc-sermon-single-audio-download { + border: 1px solid #dbe3e8; +} +.mejs-audio + .wpfc-sermon-single-audio-download { + background: #222; +} +.wpfc-sermon-player + .wpfc-sermon-single-audio-download { + display: none; +} \ No newline at end of file From b94b974956863ba2fc048973ab09db1e7b717a39 Mon Sep 17 00:00:00 2001 From: Adrian Ionescu <9744973+adrianweb@users.noreply.github.com> Date: Mon, 5 Mar 2018 13:48:59 +0000 Subject: [PATCH 06/10] add svg download button --- includes/sm-template-functions.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index b2b57ae..bd9cc22 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -442,7 +442,12 @@ function wpfc_sermon_single_v2( $return = false, $post = null ) {
- + + + + + +
From d16f28ce32c481770cb1a3dc491369a6d018535d Mon Sep 17 00:00:00 2001 From: Adrian Ionescu <9744973+adrianweb@users.noreply.github.com> Date: Mon, 5 Mar 2018 14:13:22 +0000 Subject: [PATCH 07/10] truncate description --- includes/sm-template-functions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index bd9cc22..8ac9978 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -524,7 +524,8 @@ function wpfc_sermon_excerpt_v2( $return = false ) {
-
+ ID, 'sermon_description', true); ?> +