Skip to content

Commit

Permalink
Release 2.15.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikola Miljković committed Oct 18, 2018
2 parents 858bfd5 + f0eaafe commit f3e63ae
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 63 deletions.
80 changes: 39 additions & 41 deletions includes/admin/class-sm-admin-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,37 +203,30 @@ public static function output_fields( $options ) {
if ( ! isset( $value['type'] ) ) {
continue;
}
if ( ! isset( $value['id'] ) ) {
$value['id'] = '';
}
if ( ! isset( $value['title'] ) ) {
$value['title'] = isset( $value['name'] ) ? $value['name'] : '';
}
if ( ! isset( $value['class'] ) ) {
$value['class'] = '';
}
if ( ! isset( $value['css'] ) ) {
$value['css'] = '';
}
if ( ! isset( $value['default'] ) ) {
$value['default'] = '';
}
if ( ! isset( $value['desc'] ) ) {
$value['desc'] = '';
}
if ( ! isset( $value['desc_tip'] ) ) {
$value['desc_tip'] = false;
}
if ( ! isset( $value['placeholder'] ) ) {
$value['placeholder'] = '';
}

// Fill out data that is not set.
$value += array(
'id' => '',
'title' => isset( $value['name'] ) ? $value['name'] : '',
'class' => '',
'css' => '',
'default' => '',
'desc' => '',
'desc_tip' => '',
'placeholder' => '',
'size' => '',
);

// Custom attribute handling.
$custom_attributes = array();

if ( ! empty( $value['custom_attributes'] ) && is_array( $value['custom_attributes'] ) ) {
foreach ( $value['custom_attributes'] as $attribute => $attribute_value ) {
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
if ( ! empty( $value['custom_attributes'] ) ) {
if ( is_array( $value['custom_attributes'] ) ) {
foreach ( $value['custom_attributes'] as $attribute => $attribute_value ) {
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
}
} elseif ( is_string( $value['custom_attributes'] ) ) {
$custom_attributes[] = $value['custom_attributes'];
}
}

Expand All @@ -254,7 +247,10 @@ public static function output_fields( $options ) {
}
}

// Switch based on type.
// Get the value.
$option_value = self::get_option( $value['id'], $value['default'] );

// Output the field based on type.
switch ( $value['type'] ) {
// Section Titles.
case 'title':
Expand Down Expand Up @@ -288,8 +284,6 @@ public static function output_fields( $options ) {
case 'password':
if ( substr( $value['id'], 0, 2 ) === '__' && strlen( $value['id'] ) > 2 ) {
$option_value = $value['value'];
} else {
$option_value = self::get_option( $value['id'], $value['default'] );
}

?>
Expand All @@ -307,6 +301,7 @@ public static function output_fields( $options ) {
value="<?php echo esc_attr( $option_value ); ?>"
class="<?php echo esc_attr( $value['class'] ); ?>"
placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>"
size="<?php echo esc_attr( $value['size'] ); ?>"
<?php echo implode( ' ', $custom_attributes ); ?>
/> <?php echo $description; ?>
</td>
Expand All @@ -316,8 +311,6 @@ class="<?php echo esc_attr( $value['class'] ); ?>"

// Color picker.
case 'color':
$option_value = self::get_option( $value['id'], $value['default'] );

?>
<tr valign="top">
<th scope="row" class="titledesc">
Expand Down Expand Up @@ -347,8 +340,6 @@ class="<?php echo esc_attr( $value['class'] ); ?>colorpick"

// Textarea.
case 'textarea':
$option_value = self::get_option( $value['id'], $value['default'] );

?>
<tr valign="top">
<th scope="row" class="titledesc">
Expand All @@ -374,7 +365,6 @@ class="<?php echo esc_attr( $value['class'] ); ?>"
// Select boxes.
case 'select':
case 'multiselect':
$option_value = self::get_option( $value['id'], $value['default'] );
?>
<tr valign="top">
<th scope="row" class="titledesc">
Expand Down Expand Up @@ -415,8 +405,6 @@ class="<?php echo esc_attr( $value['class'] ); ?>"

// Radio inputs.
case 'radio':
$option_value = self::get_option( $value['id'], $value['default'] );

?>
<tr valign="top">
<th scope="row" class="titledesc">
Expand Down Expand Up @@ -455,7 +443,7 @@ class="<?php echo esc_attr( $value['class'] ); ?>"

// Checkbox input.
case 'checkbox':
$option_value = is_bool( self::get_option( $value['id'], $value['default'] ) ) ? ( self::get_option( $value['id'], $value['default'] ) ? 'yes' : 'no' ) : self::get_option( $value['id'], $value['default'] );
$option_value = is_bool( $option_value ) ? ( $option_value ? 'yes' : 'no' ) : $option_value;

$visbility_class = array();
if ( ! isset( $value['hide_if_checked'] ) ) {
Expand Down Expand Up @@ -508,8 +496,6 @@ class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?

// Image upload select.
case 'image':
$option_value = self::get_option( $value['id'], $value['default'] );

?>
<tr valign="top">
<!--suppress XmlDefaultAttributeValue -->
Expand Down Expand Up @@ -586,7 +572,19 @@ class="upload_image_button"
break;
// Default: run an action.
default:
do_action( 'sm_admin_field_' . $value['type'], $value );
/**
* Allows to add additional settings type.
*
* @param array $value The option data.
* @param mixed $option_value The option value.
* @param string $description The option description HTML.
* @param string $tooltip_html The option tooltip HTML.
* @param array $custom_attributes The custom attributes.
*
* @since 2.9 - Added.
* @since 2.15.6 - Added additional options, beside `$value`.
*/
do_action( 'sm_admin_field_' . $value['type'], $value, $option_value, $description, $tooltip_html, $custom_attributes );
break;
}
}
Expand Down
11 changes: 6 additions & 5 deletions includes/admin/sm-cmb-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ function wpfc_sermon_metaboxes() {
'show_names' => true, // Show field names on the left.
) );
$sermon_details_meta->add_field( array(
'name' => esc_html__( 'Date Preached', 'sermon-manager-for-wordpress' ),
'name' => esc_html__( 'Date Preached', 'sermon-manager-for-wordpress' ),
// translators: %s date format, effectively <code>d/m/Y</code> or the like.
'desc' => esc_html__( '(optional)', 'sermon-manager-for-wordpress' ) . '<br>' . wp_sprintf( esc_html__( 'format: %s', 'sermon-manager-for-wordpress' ), $date_format_label ),
'id' => 'sermon_date',
'type' => 'text_date_timestamp',
'date_format' => $date_format,
'desc' => esc_html__( '(optional)', 'sermon-manager-for-wordpress' ) . '<br>' . wp_sprintf( esc_html__( 'format: %s', 'sermon-manager-for-wordpress' ), $date_format_label ),
'id' => 'sermon_date',
'type' => 'text_date_timestamp',
'date_format' => $date_format,
'autocomplete' => 'off',
) );
$sermon_details_meta->add_field( array(
'name' => esc_html__( 'Service Type', 'sermon-manager-for-wordpress' ),
Expand Down
4 changes: 2 additions & 2 deletions includes/class-sm-roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public static function init() {
$role->add_cap( 'read_private_wpfc_sermons' );
// Manage categories & tags.
$role->add_cap( 'manage_wpfc_categories' );
// Add additional roles for administrator
// Add additional roles for administrator.
if ( 'administrator' === $role_name ) {
// Access to Sermon Manager Settings.
$role->add_cap( 'manage_wpfc_sm_settings' );
}
// Add additional roles for administrator and editor
// Add additional roles for administrator and editor.
if ( 'author' !== $role_name ) {
$role->add_cap( 'edit_others_wpfc_sermons' );
$role->add_cap( 'delete_others_wpfc_sermons' );
Expand Down
27 changes: 17 additions & 10 deletions includes/class-sm-shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ public function display_podcasts_list( $atts ) {
'exclude' => null,
);

// Init var.
$services = array();

// Join default and user options.
$args = shortcode_atts( $args, $atts, 'list_podcasts' );

Expand Down Expand Up @@ -457,7 +460,7 @@ public function display_images( $atts = array() ) {
}

// Get images.
$terms = apply_filters( 'sermon-images-get-terms', '', array(
$terms = apply_filters( 'sermon-images-get-terms', '', array( // phpcs:ignore
'taxonomy' => $args['display'],
'term_args' => array(
'order' => $args['order'],
Expand Down Expand Up @@ -930,16 +933,20 @@ function display_sermons( $atts = array() ) {
if ( SM_OB_ENABLED ) {
ob_start(); ?>
<div id="wpfc-sermons-shortcode">
<?php
if ( ! $args['hide_filters'] ) :
echo SM_Shortcodes::display_sermon_sorting( $atts );
endif;
while ( $query->have_posts() ) :
$query->the_post();
global $post;
<div id="wpfc-sermons-container">
<?php
if ( ! $args['hide_filters'] ) :
echo SM_Shortcodes::display_sermon_sorting( $atts );
endif;

while ( $query->have_posts() ) {
$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 );
}
?>
<?php echo apply_filters( 'sm_shortcode_sermons_single_output', '<div class="wpfc-sermon wpfc-sermon-shortcode">' . wpfc_sermon_excerpt_v2( true, $args ) . '</div>', $post ); ?>
<?php endwhile; ?>
</div>

<?php wp_reset_postdata(); ?>

Expand Down
2 changes: 1 addition & 1 deletion includes/sm-core-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ function get_sermon_image_url( $fallback = true, $image_size = 'post-thumbnail',
* @since 2.13.0
* @since 2.15.2 - Added missing $image_size argument, and re-labelled $image to correct description.
*/
return apply_filters( 'get_sermon_image_url_image_size', $image, $fallback, $series_image_primary, $post, $image_size );
return apply_filters( 'get_sermon_image_url', $image, $fallback, $series_image_primary, $post, $image_size );
}

/**
Expand Down
1 change: 1 addition & 0 deletions includes/vendor/CMB2/includes/types/CMB2_Type_Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function render( $args = array() ) {
'value' => $this->field->escaped_value(),
'desc' => $this->_desc( true ),
'js_dependencies' => array(),
'autocomplete' => 'off',
), $args );

if ( ! empty( $a['js_dependencies'] ) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function render( $args = array() ) {
'placeholder' => isset( $_GET['post'] ) ? get_post_meta( $_GET['post'], 'sermon_date_auto', true) ? 'Same as Published' : '' : '',
'desc' => $this->_desc(),
'js_dependencies' => array( 'jquery-ui-core', 'jquery-ui-datepicker' ),
'autocomplete' => 'off',
) );

if ( false === strpos( $args['class'], 'timepicker' ) ) {
Expand Down
7 changes: 6 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.5
Stable tag: 2.15.6
License: GPLv2
License URI: https://www.gnu.org/licenses/gpl-2.0.html

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

## Changelog ##
### 2.15.6 ###
* Change: Disable autocomplete for date preached, since it obstructed the view on mobile
* Fix: Comments not appearing on Divi
* Fix: All podcast images are invalid

### 2.15.5 ###
* Change: Disable check for PHP output buffering

Expand Down
2 changes: 1 addition & 1 deletion 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.5
* Version: 2.15.6
* Author: WP for Church
* Author URI: https://www.wpforchurch.com/
* Requires at least: 4.5
Expand Down
8 changes: 7 additions & 1 deletion views/partials/content-sermon-single.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,14 @@
<?php endif; ?>
<?php endif; ?>
</div>
<?php
if ( 'Divi' === get_option( 'template' ) && function_exists( 'et_get_option' ) ) {
if ( ( comments_open() || get_comments_number() ) && 'on' == et_get_option( 'divi_show_postcomments', 'on' ) ) {
comments_template( '', true );
}
}
?>
</div>
<?php if ( ! \SermonManager::getOption( 'theme_compatibility' ) ) : ?>
</article>
<?php endif; ?>

2 changes: 1 addition & 1 deletion views/wpfc-podcast-feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
$series = strip_tags( get_the_term_list( $post->ID, 'wpfc_sermon_series', '', ', ', '' ) );
$topics = strip_tags( get_the_term_list( $post->ID, 'wpfc_sermon_topics', '', ', ', '' ) );
$post_image = get_sermon_image_url( SermonManager::getOption( 'podcast_sermon_image_series' ) );
$post_image = str_ireplace( 'https://', 'http://', ! empty( $post_image['0'] ) ? $post_image['0'] : '' );
$post_image = str_ireplace( 'https://', 'http://', ! empty( $post_image ) ? $post_image : '' );
$audio_duration = get_post_meta( $post->ID, '_wpfc_sermon_duration', true ) ?: '0:00';
$audio_file_size = get_post_meta( $post->ID, '_wpfc_sermon_size', 'true' ) ?: 0;
$description = strip_shortcodes( get_post_meta( $post->ID, 'sermon_description', true ) );
Expand Down

0 comments on commit f3e63ae

Please sign in to comment.