Skip to content

Commit 97bade2

Browse files
author
Nikola Miljković
authored
Merge pull request #44 from WP-for-Church/dev
Release 2.4.2
2 parents d125ca8 + 8d88bfd commit 97bade2

6 files changed

Lines changed: 59 additions & 27 deletions

File tree

includes/CMB2/init.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@
4343
*/
4444

4545
/************************************************************************
46-
You should not edit the code below
47-
(or any code in the included files)
48-
or things might explode!
49-
*************************************************************************/
46+
* You should not edit the code below
47+
* (or any code in the included files)
48+
* or things might explode!
49+
*************************************************************************/
5050

5151
if ( ! class_exists( 'CMB2_Bootstrap_224_Trunk', false ) ) {
5252

5353
/**
5454
* Handles checking for and loading the newest version of CMB2
5555
*
56-
* @since 2.0.0
56+
* @since 2.0.0
5757
*
5858
* @category WordPress_Plugin
5959
* @package CMB2
@@ -65,6 +65,7 @@ class CMB2_Bootstrap_224_Trunk {
6565

6666
/**
6767
* Current version number
68+
*
6869
* @var string
6970
* @since 1.0.0
7071
*/
@@ -96,6 +97,7 @@ public static function initiate() {
9697
if ( null === self::$single_instance ) {
9798
self::$single_instance = new self();
9899
}
100+
99101
return self::$single_instance;
100102
}
101103

@@ -151,11 +153,14 @@ public function include_cmb() {
151153

152154
// Kick the whole thing off
153155
require_once 'bootstrap.php';
154-
cmb2_bootstrap();
156+
if ( function_exists( 'cmb2_bootstrap' ) ) {
157+
cmb2_bootstrap();
158+
}
155159
}
156160

157161
/**
158162
* Registers CMB2 text domain path
163+
*
159164
* @since 2.0.0
160165
*/
161166
public function l10ni18n() {

includes/fix-dates.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function render_warning() {
154154
?>
155155
<div class="notice notice-error is-dismissible">
156156
<p><strong>Important!</strong> Sermon Manager needs to check dates of old sermons.
157-
<a href="<?php echo admin_url( 'edit.php?post_type=wpfc_sermon&page=' . basename( SERMON_MANAGER_PATH ) . 'includes/options.php#sermon-options-dates-fix' ); ?>">Click
157+
<a href="<?php echo admin_url( 'edit.php?post_type=wpfc_sermon&page=' . basename( SERMON_MANAGER_PATH ) . '/includes/options.php#sermon-options-dates-fix' ); ?>">Click
158158
here</a> if you want to do it now.</p>
159159
</div>
160160
<?php

includes/options.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,6 @@ function wpfc_sermon_options_render_form() {
187187
border-bottom: 1px solid #efefef;
188188
}
189189
</style>
190-
<?php
191-
$sermon_version = \SermonManager::getOption( 'version' );
192-
193-
if ( version_compare( $sermon_version, '1.8', '<' ) ) {
194-
$Sermon_Manager_Upgrade = new Sermon_Manager_Upgrade();
195-
$Sermon_Manager_Upgrade->wpfc_sermon_update();
196-
} ?>
197190
<!-- Display Plugin Icon, Header, and Description -->
198191
<div class="sermon-option-tabs">
199192
<div class="icon32" id="icon-options-general"><br></div>
@@ -717,10 +710,10 @@ function wpfc_sermon_options_render_form() {
717710
<div class="main">
718711
<div class="actions">
719712
<a class="button-primary"
720-
href="<?php echo admin_url( 'edit.php?post_type=wpfc_sermon&page=' . basename( SERMON_MANAGER_PATH ) . 'includes/options.php' ) . '&fix_dates=check#sermon-options-dates-fix' ?>">Check
713+
href="<?php echo admin_url( 'edit.php?post_type=wpfc_sermon&page=' . basename( SERMON_MANAGER_PATH ) . '/includes/options.php' ) . '&fix_dates=check#sermon-options-dates-fix' ?>">Check
721714
dates for errors</a>
722715
<a class="button-primary <?php echo ! get_option( 'wpfc_sm_dates_checked', 0 ) || ( isset( $_GET['fix_dates'] ) && $_GET['fix_dates'] !== 'check' ) || get_option( 'wpfc_sm_dates_all_fixed', true ) ? 'disabled' : ''; ?>"
723-
href="<?php echo admin_url( 'edit.php?post_type=wpfc_sermon&page=' . basename( SERMON_MANAGER_PATH ) . 'includes/options.php' ) . '&fix_dates=fix#sermon-options-dates-fix' ?>">Fix
716+
href="<?php echo admin_url( 'edit.php?post_type=wpfc_sermon&page=' . basename( SERMON_MANAGER_PATH ) . '/includes/options.php' ) . '&fix_dates=fix#sermon-options-dates-fix' ?>">Fix
724717
All</a>
725718
<a class="button-secondary disabled" href="">Revert fix</a>
726719
</div>

includes/template-tags.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ function render_wpfc_sorting() {
143143
$html .= '" method="get">';
144144
$html .= '<select name="wpfc_preacher" id="wpfc_preacher" onchange="return this.form.submit()">';
145145
$html .= '<option value="">';
146-
$html .= 'Sort by ' . (\SermonManager::getOption('preacher_label') ?: 'Preacher');
146+
$html .= 'Sort by ' . ( \SermonManager::getOption( 'preacher_label' ) ?: 'Preacher' );
147147
$html .= '</option>';
148148
$html .= wpfc_get_term_dropdown( 'wpfc_preacher' );
149149
$html .= '</select>';
@@ -379,6 +379,11 @@ function wpfc_sermon_attachments() {
379379
$html .= '<p><strong>' . __( 'Download Files', 'sermon-manager' ) . '</strong>';
380380
if ( $attachments ) {
381381
foreach ( $attachments as $attachment ) {
382+
// skip audio, so we don't have double URLs
383+
if ( get_wpfc_sermon_meta( 'sermon_audio' ) === wp_get_attachment_url( $attachment->ID ) ) {
384+
continue;
385+
}
386+
382387
$html .= '<br/><a target="_blank" href="' . wp_get_attachment_url( $attachment->ID ) . '">';
383388
$html .= $attachment->post_title;
384389
}
@@ -626,7 +631,7 @@ function wpfc_sermon_time_filter( $the_time = 0, $d = '', $post = null ) {
626631
*/
627632
function wpfc_sermon_date_filter( $the_date = 0, $d = '', $post = null ) {
628633
// if the post is not set, try to get current one
629-
if ( $post === null ) {
634+
if ( ! is_single() && $post === null ) {
630635
$post = the_post();
631636
}
632637

readme.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Contributors: wpforchurch
33
Donate link: http://wpforchurch.com/
44
Tags: church, sermon, sermons, preaching, podcasting
55
Requires at least: 3.6
6-
Tested up to: 4.7.5
7-
Stable tag: 2.4.1
6+
Tested up to: 4.8.0
7+
Stable tag: 2.4.2
88

99
Add audio and video sermons, manage speakers, series, and more to your church website.
1010

@@ -83,6 +83,15 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man
8383
2. Sermon Files
8484

8585
== Changelog ==
86+
= 2.4.3 =
87+
* Fix Sermon Manager interfering with regular post dates under some circumstances
88+
* Fix fatal error when using UpdraftPlus
89+
* Fix fatal error for longtime Sermon Manager users (thank you <3)
90+
* Fix audio URL duplication in "Download Files" section
91+
* Fix date checking URL
92+
* Fix scripts and styles not loading when shortcode is used in ordinary posts
93+
* Fix new player styles not loading
94+
8695
= 2.4.1 =
8796
* Fix fatal error for podcasts
8897

sermons.php

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Plugin Name: Sermon Manager for WordPress
44
Plugin URI: http://www.wpforchurch.com/products/sermon-manager-for-wordpress/
55
Description: Add audio and video sermons, manage speakers, series, and more. Visit <a href="http://wpforchurch.com" target="_blank">Wordpress for Church</a> for tutorials and support.
6-
Version: 2.4.1
6+
Version: 2.4.2
77
Author: WP for Church
88
Contributors: wpforchurch, jprummer, jamzth
99
Author URI: http://www.wpforchurch.com/
@@ -73,10 +73,8 @@ private function includes() {
7373
*/
7474
$includes = array(
7575
'/includes/legacy-php.php', // Old PHP compatibility fixes
76-
'/includes/CMB2/init.php', // Metaboxes
7776
'/includes/types-taxonomies.php', // Post Types and Taxonomies
7877
'/includes/taxonomy-images/taxonomy-images.php', // Images for Custom Taxonomies
79-
'/includes/options.php', // Options Page
8078
'/includes/entry-views.php', // Entry Views Tracking
8179
'/includes/shortcodes.php', // Shortcodes
8280
'/includes/widgets.php', // Widgets
@@ -89,8 +87,10 @@ private function includes() {
8987
* Admin only includes
9088
*/
9189
$admin_includes = array(
92-
'/includes/admin-functions.php',
93-
'/includes/fix-dates.php',
90+
'/includes/admin-functions.php', // General Admin area functions
91+
'/includes/fix-dates.php', // Date fixing, explained in the script
92+
'/includes/CMB2/init.php', // Metaboxes
93+
'/includes/options.php', // Options Page
9494
);
9595

9696
// Load files
@@ -141,7 +141,27 @@ public static function load_translations() {
141141
*/
142142

143143
public static function enqueue_scripts_styles() {
144-
if ( 'wpfc_sermon' === get_post_type() ) {
144+
global $wp_query;
145+
146+
// we will check all the posts in the query if they have sermons shortcode
147+
$has_shortcode = false;
148+
if ( ! empty( $wp_query->posts ) ) {
149+
foreach ( $wp_query->posts as $post ) {
150+
if ( ! empty( $post->post_content ) ) {
151+
$has_shortcode = has_shortcode( $post->post_content, 'sermons' ) ||
152+
has_shortcode( $post->post_content, 'list_sermons' ) ||
153+
has_shortcode( $post->post_content, 'sermon_images' ) ||
154+
has_shortcode( $post->post_content, 'latest_series' ) ||
155+
has_shortcode( $post->post_content, 'sermon_sort_fields' );
156+
157+
if ( $has_shortcode === true ) {
158+
break;
159+
}
160+
}
161+
}
162+
}
163+
164+
if ( 'wpfc_sermon' === get_post_type() || $has_shortcode ) {
145165
if ( ! \SermonManager::getOption( 'bibly' ) ) {
146166
wp_enqueue_script( 'bibly-script', SERMON_MANAGER_URL . 'js/bibly.min.js', array(), SERMON_MANAGER_VERSION );
147167
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() {
158178
if ( ! \SermonManager::getOption( 'css' ) ) {
159179
wp_enqueue_style( 'sermon-styles', SERMON_MANAGER_URL . 'css/sermon.css', array(), SERMON_MANAGER_VERSION );
160180

161-
if ( \SermonManager::getOption( 'use_old_player' ) ) {
181+
if ( ! \SermonManager::getOption( 'use_old_player' ) ) {
162182
wp_enqueue_script( 'sermon-manager-plyr', SERMON_MANAGER_URL . 'js/plyr.js', array(), SERMON_MANAGER_VERSION );
163183
wp_enqueue_style( 'sermon-manager-plyr-css', SERMON_MANAGER_URL . 'css/plyr.css', array(), SERMON_MANAGER_VERSION );
164184
wp_add_inline_script( 'sermon-manager-plyr', 'window.onload=function(){plyr.setup(document.querySelectorAll(\'.wpfc-sermon-player\'));}' );

0 commit comments

Comments
 (0)