Skip to content

Commit

Permalink
Merge branch 'release/2.9.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikola committed Dec 6, 2017
2 parents f8bcd2c + 53b3243 commit d19dd04
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 66 deletions.
4 changes: 4 additions & 0 deletions includes/admin/class-sm-admin-post-types.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ public function request_query( $vars ) {
break;
}
}

if ( isset( $vars['wpfc_service_type'] ) && trim( $vars['wpfc_service_type'] ) === '' ) {
unset( $vars['wpfc_service_type'] );
}
}

return $vars;
Expand Down
23 changes: 1 addition & 22 deletions includes/admin/class-sm-admin-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ class="<?php echo esc_attr( $value['class'] ); ?>"
case 'select' :
case 'multiselect' :
$option_value = self::get_option( $value['id'], $value['default'] );

?>
<tr valign="top">
<!--suppress XmlDefaultAttributeValue -->
Expand Down Expand Up @@ -397,7 +396,6 @@ class="<?php echo esc_attr( $value['class'] ); ?>"
</tr><?php
break;

// Checkbox input
// Checkbox input
case 'checkbox' :
$option_value = self::get_option( $value['id'], $value['default'] );
Expand Down Expand Up @@ -440,7 +438,7 @@ class="<?php echo esc_attr( $value['class'] ); ?>"
type="checkbox"
class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>"
value="1"
<?php checked( $option_value, 'yes' ); ?>
<?php checked( $option_value ); ?>
<?php echo implode( ' ', $custom_attributes ); ?>
/> <?php echo $description ?>
</label> <?php echo $tooltip_html; ?>
Expand Down Expand Up @@ -648,25 +646,6 @@ public static function get_option( $option_name, $default = '' ) {
// Single value
} else {
$option_value = get_option( 'sermonmanager_' . $option_name, null );

if ( $option_value !== null ) {
switch ( $option_name ) {
case 'itunes_sub_category':
$categories = array(
'0' => __( 'Sub Category', 'sermon-manager-for-wordpress' ),
'1' => __( 'Buddhism', 'sermon-manager-for-wordpress' ),
'2' => __( 'Christianity', 'sermon-manager-for-wordpress' ),
'3' => __( 'Hinduism', 'sermon-manager-for-wordpress' ),
'4' => __( 'Islam', 'sermon-manager-for-wordpress' ),
'5' => __( 'Judaism', 'sermon-manager-for-wordpress' ),
'6' => __( 'Other', 'sermon-manager-for-wordpress' ),
'7' => __( 'Spirituality', 'sermon-manager-for-wordpress' ),
);

$option_value = $categories[ $option_value ];
break;
}
}
}

if ( is_array( $option_value ) ) {
Expand Down
7 changes: 6 additions & 1 deletion includes/class-sm-install.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,14 @@ private static function _install() {
// Update version just in case
self::update_db_version();

// Flush rules after install
// Flush 1
do_action( 'sm_flush_rewrite_rules' );

// Flush 2
add_action( 'init', function () {
do_action( 'sm_flush_rewrite_rules' );
} );

/*
* Deletes all expired transients. The multi-table delete syntax is used
* to delete the transient record from table a, and the corresponding
Expand Down
15 changes: 14 additions & 1 deletion includes/podcast-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ function wpfc_podcast_add_namespace() {
*/
function wpfc_podcast_add_head() {
remove_filter( 'the_content', 'add_wpfc_sermon_content' );

$categories = array(
'0' => '',
'1' => 'Buddhism',
'2' => 'Christianity',
'3' => 'Hinduism',
'4' => 'Islam',
'5' => 'Judaism',
'6' => 'Other',
'7' => 'Spirituality',
);

?>
<copyright><?php echo html_entity_decode( esc_html( \SermonManager::getOption( 'copyright' ) ), ENT_COMPAT, 'UTF-8' ) ?></copyright>
<itunes:subtitle><?php echo esc_html( \SermonManager::getOption( 'itunes_subtitle' ) ) ?></itunes:subtitle>
Expand All @@ -117,7 +129,8 @@ function wpfc_podcast_add_head() {
<itunes:image href="<?php echo esc_url( \SermonManager::getOption( 'itunes_cover_image' ) ) ?>"/>
<?php endif; ?>
<itunes:category text="Religion &amp; Spirituality">
<itunes:category text="<?php echo esc_attr( \SermonManager::getOption( 'itunes_sub_category' ) ) ?>"/>
<itunes:category
text="<?php echo esc_attr( $categories[ \SermonManager::getOption( 'itunes_sub_category' ) ] ) ?>"/>
</itunes:category>
<?php
}
Expand Down
32 changes: 21 additions & 11 deletions includes/shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ public function displaySermonsList( $atts ) {
}

// unquote
foreach ( $atts as &$att ) {
$att = $this->_unquote( $att );
if ( is_array( $atts ) || is_object( $atts ) ) {
foreach ( $atts as &$att ) {
$att = $this->_unquote( $att );
}
}

// default options
Expand Down Expand Up @@ -319,8 +321,10 @@ public function displayImages( $atts = array() ) {
}

// unquote
foreach ( $atts as &$att ) {
$att = $this->_unquote( $att );
if ( is_array( $atts ) || is_object( $atts ) ) {
foreach ( $atts as &$att ) {
$att = $this->_unquote( $att );
}
}

// default args
Expand Down Expand Up @@ -417,8 +421,10 @@ function displayLatestSeriesImage( $atts = array() ) {
}

// unquote
foreach ( $atts as &$att ) {
$att = $this->_unquote( $att );
if ( is_array( $atts ) || is_object( $atts ) ) {
foreach ( $atts as &$att ) {
$att = $this->_unquote( $att );
}
}

// default options
Expand Down Expand Up @@ -626,8 +632,10 @@ public function displaySermonSorting( $atts = array() ) {
}

// unquote
foreach ( $atts as &$att ) {
$att = $this->_unquote( $att );
if ( is_array( $atts ) || is_object( $atts ) ) {
foreach ( $atts as &$att ) {
$att = $this->_unquote( $att );
}
}

// default shortcode options
Expand Down Expand Up @@ -676,8 +684,10 @@ function displaySermons( $atts = array() ) {
}

// unquote
foreach ( $atts as &$att ) {
$att = $this->_unquote( $att );
if ( is_array( $atts ) || is_object( $atts ) ) {
foreach ( $atts as &$att ) {
$att = $this->_unquote( $att );
}
}

// default options
Expand Down Expand Up @@ -769,7 +779,7 @@ function displaySermons( $atts = array() ) {
$args['orderby'] = 'date';
}

if ( $args['orderby'] === 'date' ){
if ( $args['orderby'] === 'date' ) {
$args['orderby'] = 'meta_value_num';
}

Expand Down
9 changes: 8 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.5
Tested up to: 4.9.1
Requires PHP: 5.3
Stable tag: 2.9.1
Stable tag: 2.9.2
License: GPLv2
License URI: https://www.gnu.org/licenses/gpl-2.0.html

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

## Changelog ##
### 2.9.2 ###
* Fix: 404 page on some hosts after update
* Fix: Admin search bar not working
* Fix: Checkboxes not working on settings page
* Fix: Shortcode producing a warning
* Fix: Sub-Category not saving in podcast settings

### 2.9.1 ###
* Fix: Remote Sermon Browser URLs mistakenly being imported as local URLs

Expand Down
31 changes: 1 addition & 30 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.9.1
* Version: 2.9.2
* Author: WP for Church
* Author URI: https://www.wpforchurch.com/
* Requires at least: 4.5
Expand Down Expand Up @@ -69,9 +69,6 @@ public function __construct() {
// Include required items
$this->_includes();

// Add defaults on activation
register_activation_hook( __FILE__, array( $this, 'set_default_options' ) );

// load translations
add_action( 'after_setup_theme', array( $this, 'load_translations' ) );
// enqueue scripts & styles
Expand Down Expand Up @@ -352,32 +349,6 @@ public static function add_image_sizes() {
}
}

/**
* Checks if the plugin options have been set, and if they haven't, sets defaults.
*
* @return void
*/
public static function set_default_options() {
if ( ! is_array( get_option( 'wpfc_options' ) ) ) {
delete_option( 'wpfc_options' ); // just in case
$arr = array(
'bibly' => '0',
'bibly_version' => 'KJV',
'archive_slug' => 'sermons',
'archive_title' => 'Sermons',
'common_base_slug' => '0'
);

update_option( 'wpfc_options', $arr );
}

// Enable error recovery on plugin re-activation
update_option( '_sm_recovery_do_not_catch', 0 );

// Flush rewrite cache
flush_rewrite_rules( true );
}

/**
* Renders the notice when the user is not using correct PHP version
*/
Expand Down

0 comments on commit d19dd04

Please sign in to comment.