diff --git a/includes/CMB2/init.php b/includes/CMB2/init.php index 9dbdc5f..1b7d926 100755 --- a/includes/CMB2/init.php +++ b/includes/CMB2/init.php @@ -43,17 +43,17 @@ */ /************************************************************************ - You should not edit the code below - (or any code in the included files) - or things might explode! -*************************************************************************/ + * You should not edit the code below + * (or any code in the included files) + * or things might explode! + *************************************************************************/ if ( ! class_exists( 'CMB2_Bootstrap_224_Trunk', false ) ) { /** * Handles checking for and loading the newest version of CMB2 * - * @since 2.0.0 + * @since 2.0.0 * * @category WordPress_Plugin * @package CMB2 @@ -65,6 +65,7 @@ class CMB2_Bootstrap_224_Trunk { /** * Current version number + * * @var string * @since 1.0.0 */ @@ -96,6 +97,7 @@ public static function initiate() { if ( null === self::$single_instance ) { self::$single_instance = new self(); } + return self::$single_instance; } @@ -151,11 +153,14 @@ public function include_cmb() { // Kick the whole thing off require_once 'bootstrap.php'; - cmb2_bootstrap(); + if ( function_exists( 'cmb2_bootstrap' ) ) { + cmb2_bootstrap(); + } } /** * Registers CMB2 text domain path + * * @since 2.0.0 */ public function l10ni18n() { diff --git a/includes/fix-dates.php b/includes/fix-dates.php index cff4c6f..5399741 100644 --- a/includes/fix-dates.php +++ b/includes/fix-dates.php @@ -154,7 +154,7 @@ public function render_warning() { ?>

Important! Sermon Manager needs to check dates of old sermons. - Click + Click here if you want to do it now.

- wpfc_sermon_update(); - } ?>

@@ -717,10 +710,10 @@ function wpfc_sermon_options_render_form() {
diff --git a/includes/template-tags.php b/includes/template-tags.php index 6e4b845..35a6c21 100755 --- a/includes/template-tags.php +++ b/includes/template-tags.php @@ -143,7 +143,7 @@ function render_wpfc_sorting() { $html .= '" method="get">'; $html .= ''; @@ -379,6 +379,11 @@ function wpfc_sermon_attachments() { $html .= '

' . __( 'Download Files', 'sermon-manager' ) . ''; if ( $attachments ) { foreach ( $attachments as $attachment ) { + // skip audio, so we don't have double URLs + if ( get_wpfc_sermon_meta( 'sermon_audio' ) === wp_get_attachment_url( $attachment->ID ) ) { + continue; + } + $html .= '
'; $html .= $attachment->post_title; } @@ -626,7 +631,7 @@ function wpfc_sermon_time_filter( $the_time = 0, $d = '', $post = null ) { */ function wpfc_sermon_date_filter( $the_date = 0, $d = '', $post = null ) { // if the post is not set, try to get current one - if ( $post === null ) { + if ( ! is_single() && $post === null ) { $post = the_post(); } diff --git a/readme.txt b/readme.txt index 37c72e7..7ecdd17 100755 --- a/readme.txt +++ b/readme.txt @@ -3,8 +3,8 @@ Contributors: wpforchurch Donate link: http://wpforchurch.com/ Tags: church, sermon, sermons, preaching, podcasting Requires at least: 3.6 -Tested up to: 4.7.5 -Stable tag: 2.4.1 +Tested up to: 4.8.0 +Stable tag: 2.4.2 Add audio and video sermons, manage speakers, series, and more to your church website. @@ -83,6 +83,15 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man 2. Sermon Files == Changelog == += 2.4.3 = +* Fix Sermon Manager interfering with regular post dates under some circumstances +* Fix fatal error when using UpdraftPlus +* Fix fatal error for longtime Sermon Manager users (thank you <3) +* Fix audio URL duplication in "Download Files" section +* Fix date checking URL +* Fix scripts and styles not loading when shortcode is used in ordinary posts +* Fix new player styles not loading + = 2.4.1 = * Fix fatal error for podcasts diff --git a/sermons.php b/sermons.php index 8f06b12..9eccfc5 100755 --- a/sermons.php +++ b/sermons.php @@ -3,7 +3,7 @@ Plugin Name: Sermon Manager for WordPress Plugin URI: http://www.wpforchurch.com/products/sermon-manager-for-wordpress/ Description: Add audio and video sermons, manage speakers, series, and more. Visit Wordpress for Church for tutorials and support. -Version: 2.4.1 +Version: 2.4.2 Author: WP for Church Contributors: wpforchurch, jprummer, jamzth Author URI: http://www.wpforchurch.com/ @@ -73,10 +73,8 @@ private function includes() { */ $includes = array( '/includes/legacy-php.php', // Old PHP compatibility fixes - '/includes/CMB2/init.php', // Metaboxes '/includes/types-taxonomies.php', // Post Types and Taxonomies '/includes/taxonomy-images/taxonomy-images.php', // Images for Custom Taxonomies - '/includes/options.php', // Options Page '/includes/entry-views.php', // Entry Views Tracking '/includes/shortcodes.php', // Shortcodes '/includes/widgets.php', // Widgets @@ -89,8 +87,10 @@ private function includes() { * Admin only includes */ $admin_includes = array( - '/includes/admin-functions.php', - '/includes/fix-dates.php', + '/includes/admin-functions.php', // General Admin area functions + '/includes/fix-dates.php', // Date fixing, explained in the script + '/includes/CMB2/init.php', // Metaboxes + '/includes/options.php', // Options Page ); // Load files @@ -141,7 +141,27 @@ public static function load_translations() { */ public static function enqueue_scripts_styles() { - if ( 'wpfc_sermon' === get_post_type() ) { + global $wp_query; + + // we will check all the posts in the query if they have sermons shortcode + $has_shortcode = false; + if ( ! empty( $wp_query->posts ) ) { + foreach ( $wp_query->posts as $post ) { + if ( ! empty( $post->post_content ) ) { + $has_shortcode = has_shortcode( $post->post_content, 'sermons' ) || + has_shortcode( $post->post_content, 'list_sermons' ) || + has_shortcode( $post->post_content, 'sermon_images' ) || + has_shortcode( $post->post_content, 'latest_series' ) || + has_shortcode( $post->post_content, 'sermon_sort_fields' ); + + if ( $has_shortcode === true ) { + break; + } + } + } + } + + if ( 'wpfc_sermon' === get_post_type() || $has_shortcode ) { if ( ! \SermonManager::getOption( 'bibly' ) ) { wp_enqueue_script( 'bibly-script', SERMON_MANAGER_URL . 'js/bibly.min.js', array(), SERMON_MANAGER_VERSION ); wp_enqueue_style( 'bibly-style', SERMON_MANAGER_URL . 'css/bibly.min.css', array(), SERMON_MANAGER_VERSION ); @@ -158,7 +178,7 @@ public static function enqueue_scripts_styles() { if ( ! \SermonManager::getOption( 'css' ) ) { wp_enqueue_style( 'sermon-styles', SERMON_MANAGER_URL . 'css/sermon.css', array(), SERMON_MANAGER_VERSION ); - if ( \SermonManager::getOption( 'use_old_player' ) ) { + if ( ! \SermonManager::getOption( 'use_old_player' ) ) { wp_enqueue_script( 'sermon-manager-plyr', SERMON_MANAGER_URL . 'js/plyr.js', array(), SERMON_MANAGER_VERSION ); wp_enqueue_style( 'sermon-manager-plyr-css', SERMON_MANAGER_URL . 'css/plyr.css', array(), SERMON_MANAGER_VERSION ); wp_add_inline_script( 'sermon-manager-plyr', 'window.onload=function(){plyr.setup(document.querySelectorAll(\'.wpfc-sermon-player\'));}' );