Skip to content

Commit

Permalink
Merge pull request #44 from WP-for-Church/dev
Browse files Browse the repository at this point in the history
Release 2.4.2
  • Loading branch information
Nikola Miljković authored Jun 10, 2017
2 parents d125ca8 + 8d88bfd commit 97bade2
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 27 deletions.
17 changes: 11 additions & 6 deletions includes/CMB2/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -65,6 +65,7 @@ class CMB2_Bootstrap_224_Trunk {

/**
* Current version number
*
* @var string
* @since 1.0.0
*/
Expand Down Expand Up @@ -96,6 +97,7 @@ public static function initiate() {
if ( null === self::$single_instance ) {
self::$single_instance = new self();
}

return self::$single_instance;
}

Expand Down Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion includes/fix-dates.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function render_warning() {
?>
<div class="notice notice-error is-dismissible">
<p><strong>Important!</strong> Sermon Manager needs to check dates of old sermons.
<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
<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
here</a> if you want to do it now.</p>
</div>
<?php
Expand Down
11 changes: 2 additions & 9 deletions includes/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,6 @@ function wpfc_sermon_options_render_form() {
border-bottom: 1px solid #efefef;
}
</style>
<?php
$sermon_version = \SermonManager::getOption( 'version' );

if ( version_compare( $sermon_version, '1.8', '<' ) ) {
$Sermon_Manager_Upgrade = new Sermon_Manager_Upgrade();
$Sermon_Manager_Upgrade->wpfc_sermon_update();
} ?>
<!-- Display Plugin Icon, Header, and Description -->
<div class="sermon-option-tabs">
<div class="icon32" id="icon-options-general"><br></div>
Expand Down Expand Up @@ -717,10 +710,10 @@ function wpfc_sermon_options_render_form() {
<div class="main">
<div class="actions">
<a class="button-primary"
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
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
dates for errors</a>
<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' : ''; ?>"
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
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
All</a>
<a class="button-secondary disabled" href="">Revert fix</a>
</div>
Expand Down
9 changes: 7 additions & 2 deletions includes/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function render_wpfc_sorting() {
$html .= '" method="get">';
$html .= '<select name="wpfc_preacher" id="wpfc_preacher" onchange="return this.form.submit()">';
$html .= '<option value="">';
$html .= 'Sort by ' . (\SermonManager::getOption('preacher_label') ?: 'Preacher');
$html .= 'Sort by ' . ( \SermonManager::getOption( 'preacher_label' ) ?: 'Preacher' );
$html .= '</option>';
$html .= wpfc_get_term_dropdown( 'wpfc_preacher' );
$html .= '</select>';
Expand Down Expand Up @@ -379,6 +379,11 @@ function wpfc_sermon_attachments() {
$html .= '<p><strong>' . __( 'Download Files', 'sermon-manager' ) . '</strong>';
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 .= '<br/><a target="_blank" href="' . wp_get_attachment_url( $attachment->ID ) . '">';
$html .= $attachment->post_title;
}
Expand Down Expand Up @@ -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();
}

Expand Down
13 changes: 11 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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

Expand Down
34 changes: 27 additions & 7 deletions sermons.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href="http://wpforchurch.com" target="_blank">Wordpress for Church</a> 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/
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 );
Expand All @@ -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\'));}' );
Expand Down

0 comments on commit 97bade2

Please sign in to comment.