Skip to content

Commit

Permalink
Release 2.15.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikola Miljković committed Nov 7, 2018
2 parents f3e63ae + 97c7b26 commit fb52c74
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 27 deletions.
12 changes: 11 additions & 1 deletion includes/class-sm-shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,9 @@ function display_sermons( $atts = array() ) {

$query = new WP_Query( $query_args );

// Add query to the args.
$args['query'] = $query;

// Set image size. Deprecated.
add_filter( 'wpfc_sermon_excerpt_sermon_image_size', function () use ( $args ) {
return $args['image_size'];
Expand All @@ -943,7 +946,14 @@ function display_sermons( $atts = array() ) {
$query->the_post();
global $post;

echo apply_filters( 'sm_shortcode_sermons_single_output', '<div class="wpfc-sermon wpfc-sermon-shortcode">' . wpfc_sermon_excerpt_v2( true, $args ) . '</div>', $post );
// Allows preventing the call of wpfc_sermon_excerpt_v2().
if ( apply_filters( 'sm_shortcode_output_override', false ) ) {
$output = '';
} else {
$output = '<div class="wpfc-sermon wpfc-sermon-shortcode">' . wpfc_sermon_excerpt_v2( true, $args ) . '</div>';
}

echo apply_filters( 'sm_shortcode_sermons_single_output', $output, $post, $args );
}
?>
</div>
Expand Down
22 changes: 13 additions & 9 deletions includes/sm-template-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,16 @@ function wpfc_sermon_meta( $meta_key = '', $before = '', $after = '' ) {
/**
* Return single sermon meta key content from inside a loop.
*
* @param string $meta_key The meta key name.
* @param string $meta_key The meta key name.
* @param WP_Post|null $post The sermon post object.
*
* @return mixed|null The meta key content/null if it's blank.
*/
function get_wpfc_sermon_meta( $meta_key = '' ) {
global $post;
function get_wpfc_sermon_meta( $meta_key = '', $post = null ) {
if ( null === $post ) {
global $post;
}

$data = get_post_meta( $post->ID, $meta_key, true );
if ( '' !== $data ) {
return $data;
Expand Down Expand Up @@ -482,11 +486,9 @@ function wpfc_sermon_single_v2( $return = false, $post = null ) {
function wpfc_sermon_excerpt_v2( $return = false, $args = array() ) {
global $post;

if ( empty( $args ) ) {
$args = array(
'image_size' => 'post-thumbnail',
);
}
$args += array(
'image_size' => 'post-thumbnail',
);

// Get the partial.
$output = wpfc_get_partial( 'content-sermon-archive', $args );
Expand Down Expand Up @@ -618,8 +620,10 @@ function wpfc_get_term_dropdown( $taxonomy, $default = '' ) {
$terms = array_merge( $ordered_terms, $unordered_terms );
}

$current_slug = get_query_var( $taxonomy ) ?: ( isset( $_GET[ $taxonomy ] ) ? $_GET[ $taxonomy ] : '' );

foreach ( $terms as $term ) {
$html .= '<option value="' . $term->slug . '" ' . ( ( '' === $default ? get_query_var( $taxonomy ) === $term->slug : $term->slug === $default ) ? 'selected' : '' ) . '>' . $term->name . '</option>';
$html .= '<option value="' . $term->slug . '" ' . ( ( '' === $default ? $current_slug === $term->slug : $default === $term->slug ) ? 'selected' : '' ) . '>' . $term->name . '</option>';
}

return $html;
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: church, sermon, sermons, preaching, podcasting, manage, managing, podcasts
Requires at least: 4.7.0
Tested up to: 4.9
Requires PHP: 5.3
Stable tag: 2.15.6
Stable tag: 2.15.7
License: GPLv2
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -103,6 +103,10 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man
2. Sermon Files

## Changelog ##
### 2.15.7 ###
* Fix: PHP warning when archive output is used wrongly
* Fix: Podcast items may be sorted the wrong way

### 2.15.6 ###
* Change: Disable autocomplete for date preached, since it obstructed the view on mobile
* Fix: Comments not appearing on Divi
Expand Down
47 changes: 32 additions & 15 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: https://www.wpforchurch.com/products/sermon-manager-for-wordpress/
* Description: Add audio and video sermons, manage speakers, series, and more.
* Version: 2.15.6
* Version: 2.15.7
* Author: WP for Church
* Author URI: https://www.wpforchurch.com/
* Requires at least: 4.5
Expand Down Expand Up @@ -81,8 +81,10 @@ public function __construct() {

// Load translations.
add_action( 'after_setup_theme', array( $this, 'load_translations' ) );
// Enqueue scripts & styles.
// Register & enqueue scripts & styles.
add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts_styles' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts_styles' ) );
add_action( 'wp_footer', array( $this, 'register_scripts_styles' ) );
add_action( 'wp_footer', array( $this, 'enqueue_scripts_styles' ) );
// Append custom classes to individual sermons.
add_filter( 'post_class', array( $this, 'add_additional_sermon_classes' ), 10, 3 );
Expand Down Expand Up @@ -553,13 +555,6 @@ public static function enqueue_scripts_styles() {
return;
}

wp_register_script( 'wpfc-sm-fb-player', SM_URL . 'assets/vendor/js/facebook-video.js', array(), SM_VERSION );
wp_register_script( 'wpfc-sm-plyr', SM_URL . 'assets/vendor/js/plyr.polyfilled' . ( ( defined( 'WP_DEBUG' ) && WP_DEBUG === true ) ? '' : '.min' ) . '.js', array(), '3.4.3', \SermonManager::getOption( 'player_js_footer' ) );
wp_register_script( 'wpfc-sm-plyr-loader', SM_URL . 'assets/js/plyr' . ( ( defined( 'WP_DEBUG' ) && WP_DEBUG === true ) ? '' : '.min' ) . '.js', array( 'wpfc-sm-plyr' ), SM_VERSION );
wp_register_script( 'wpfc-sm-verse-script', SM_URL . 'assets/vendor/js/verse.js', array(), SM_VERSION );
wp_register_style( 'wpfc-sm-styles', SM_URL . 'assets/css/sermon.min.css', array(), SM_VERSION );
wp_register_style( 'wpfc-sm-plyr-css', SM_URL . 'assets/vendor/css/plyr.min.css', array(), '3.4.3' );

if ( ! ( defined( 'SM_ENQUEUE_SCRIPTS_STYLES' ) || 'wpfc_sermon' === get_post_type() || is_post_type_archive( 'wpfc_sermon' ) )
) {
return;
Expand All @@ -570,18 +565,14 @@ public static function enqueue_scripts_styles() {
wp_enqueue_style( 'dashicons' );

// Load theme-specific styling, if there's any.
if ( file_exists( SM_PATH . 'assets/css/theme-specific/' . get_option( 'template' ) . '.css' ) ) {
wp_enqueue_style( 'wpfc-sm-style-' . get_option( 'template' ), SM_URL . 'assets/css/theme-specific/' . get_option( 'template' ) . '.css', array( 'wpfc-sm-styles' ), SM_VERSION );
}
wp_enqueue_style( 'wpfc-sm-style-' . get_option( 'template' ) );

do_action( 'sm_enqueue_css' );
do_action( 'sm_enqueue_js' );
}

// Load top theme-specific styling, if there's any.
if ( file_exists( get_stylesheet_directory() . '/sermon.css' ) ) {
wp_enqueue_style( 'wpfc-sm-style-theme', get_stylesheet_directory_uri() . '/sermon.css', array( 'wpfc-sm-styles' ), SM_VERSION );
}
wp_enqueue_style( 'wpfc-sm-style-theme' );

switch ( \SermonManager::getOption( 'player' ) ) {
case 'mediaelement':
Expand Down Expand Up @@ -740,6 +731,32 @@ public static function maybe_print_cloudflare_plyr() {

define( 'SM_CLOUDFLARE_DONE', true );
}

/**
* Registers all of the scripts and styles, without enqueueing them.
*
* It will be removed in future in favor of Script_Manager class.
*
* @since 2.15.7
*/
public static function register_scripts_styles() {
wp_register_script( 'wpfc-sm-fb-player', SM_URL . 'assets/vendor/js/facebook-video.js', array(), SM_VERSION );
wp_register_script( 'wpfc-sm-plyr', SM_URL . 'assets/vendor/js/plyr.polyfilled' . ( ( defined( 'WP_DEBUG' ) && WP_DEBUG === true ) ? '' : '.min' ) . '.js', array(), '3.4.3', \SermonManager::getOption( 'player_js_footer' ) );
wp_register_script( 'wpfc-sm-plyr-loader', SM_URL . 'assets/js/plyr' . ( ( defined( 'WP_DEBUG' ) && WP_DEBUG === true ) ? '' : '.min' ) . '.js', array( 'wpfc-sm-plyr' ), SM_VERSION );
wp_register_script( 'wpfc-sm-verse-script', SM_URL . 'assets/vendor/js/verse.js', array(), SM_VERSION );
wp_register_style( 'wpfc-sm-styles', SM_URL . 'assets/css/sermon.min.css', array(), SM_VERSION );
wp_register_style( 'wpfc-sm-plyr-css', SM_URL . 'assets/vendor/css/plyr.min.css', array(), '3.4.3' );

// Register theme-specific styling, if there's any.
if ( file_exists( SM_PATH . 'assets/css/theme-specific/' . get_option( 'template' ) . '.css' ) ) {
wp_register_style( 'wpfc-sm-style-' . get_option( 'template' ), SM_URL . 'assets/css/theme-specific/' . get_option( 'template' ) . '.css', array( 'wpfc-sm-styles' ), SM_VERSION );
}

// Register top theme-specific styling, if there's any.
if ( file_exists( get_stylesheet_directory() . '/sermon.css' ) ) {
wp_register_style( 'wpfc-sm-style-theme', get_stylesheet_directory_uri() . '/sermon.css', array( 'wpfc-sm-styles' ), SM_VERSION );
}
}
}

// Initialize Sermon Manager.
Expand Down
8 changes: 7 additions & 1 deletion views/partials/content-sermon-archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@

global $post;

$args = ! empty( $GLOBALS['wpfc_partial_args'] ) ? $GLOBALS['wpfc_partial_args'] : array(
if ( empty( $GLOBALS['wpfc_partial_args'] ) ) {
$GLOBALS['wpfc_partial_args'] = array();
}

$GLOBALS['wpfc_partial_args'] += array(
'image_size' => 'post-thumbnail',
);

$args = $GLOBALS['wpfc_partial_args'];

?>
<?php if ( ! ( \SermonManager::getOption( 'theme_compatibility' ) || ( defined( 'WPFC_SM_SHORTCODE' ) && WPFC_SM_SHORTCODE === true ) ) ) : ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
Expand Down
1 change: 1 addition & 0 deletions views/partials/content-sermon-filtering.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
title="<?php echo $filter['title']; ?>"
id="<?php echo $filter['taxonomy']; ?>"
onchange="if(this.options[this.selectedIndex].value !== ''){return this.form.submit()}else{window.location = '<?php echo $action; ?>';}"
autocomplete="off"
<?php echo ! empty( $args[ $filter['taxonomy'] ] ) && 'disable' === $args['visibility'] ? 'disabled' : ''; ?>>
<option value=""><?php echo $filter['title']; ?></option>
<?php echo wpfc_get_term_dropdown( $filter['taxonomy'], ! empty( $args[ $filter['taxonomy'] ] ) ? $args[ $filter['taxonomy'] ] : '' ); ?>
Expand Down
1 change: 1 addition & 0 deletions views/wpfc-podcast-feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
'meta_value_num' => time(),
'meta_compare' => '<=',
'orderby' => 'meta_value_num',
'order' => 'DESC',
'paged' => isset( $_GET['paged'] ) ? intval( $_GET['paged'] ) : 1,
'meta_query' => array(
'relation' => 'AND',
Expand Down

0 comments on commit fb52c74

Please sign in to comment.