Skip to content

Commit

Permalink
Merge branch 'release/2.9.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikola committed Dec 12, 2017
2 parents b534d4f + 3446b82 commit ed1640e
Show file tree
Hide file tree
Showing 17 changed files with 79 additions and 18 deletions.
2 changes: 1 addition & 1 deletion includes/CMB2/includes/types/CMB2_Type_Checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct( CMB2_Types $types, $args = array(), $is_checked = n
$this->is_checked = $is_checked;
}

public function render() {
public function render( $args = array() ) {
$defaults = array(
'type' => 'checkbox',
'class' => 'cmb2-option cmb2-list',
Expand Down
2 changes: 1 addition & 1 deletion includes/CMB2/includes/types/CMB2_Type_Colorpicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct( CMB2_Types $types, $args = array(), $value = '' ) {
$this->value = $value ? $value : $this->value;
}

public function render() {
public function render( $args = array() ) {
$meta_value = $this->value ? $this->value : $this->field->escaped_value();

$hex_color = '(([a-fA-F0-9]){3}){1,2}$';
Expand Down
2 changes: 1 addition & 1 deletion includes/CMB2/includes/types/CMB2_Type_File.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class CMB2_Type_File extends CMB2_Type_File_Base {

public function render() {
public function render( $args = array() ) {
$field = $this->field;
$meta_value = $field->escaped_value();
$options = (array) $field->options();
Expand Down
2 changes: 1 addition & 1 deletion includes/CMB2/includes/types/CMB2_Type_File_List.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class CMB2_Type_File_List extends CMB2_Type_File_Base {

public function render() {
public function render( $args = array() ) {
$field = $this->field;

$meta_value = $field->escaped_value();
Expand Down
2 changes: 1 addition & 1 deletion includes/CMB2/includes/types/CMB2_Type_Oembed.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class CMB2_Type_Oembed extends CMB2_Type_Text {

public function render() {
public function render( $args = array() ) {
$field = $this->field;

$meta_value = trim( $field->escaped_value() );
Expand Down
2 changes: 1 addition & 1 deletion includes/CMB2/includes/types/CMB2_Type_Text_Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class CMB2_Type_Text_Date extends CMB2_Type_Picker_Base {

public function render() {
public function render( $args = array() ) {
$args = $this->parse_args( 'text_date', array(
'class' => 'cmb2-text-small cmb2-datepicker',
'value' => isset( $_GET['post'] ) ? ( get_post_meta( $_GET['post'], 'sermon_date_auto', true ) ? '' : $this->field->get_timestamp_format() ) : '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class CMB2_Type_Text_Datetime_Timestamp extends CMB2_Type_Picker_Base {

public function render() {
public function render( $args = array() ) {
$field = $this->field;

$args = wp_parse_args( $this->args, array(
Expand Down
2 changes: 1 addition & 1 deletion includes/CMB2/includes/types/CMB2_Type_Text_Time.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class CMB2_Type_Text_Time extends CMB2_Type_Text_Date {

public function render() {
public function render( $args = array() ) {
$this->args = $this->parse_picker_options( 'time', wp_parse_args( $this->args, array(
'class' => 'cmb2-timepicker text-time',
'value' => $this->field->get_timestamp_format( 'time_format' ),
Expand Down
2 changes: 1 addition & 1 deletion includes/CMB2/includes/types/CMB2_Type_Textarea_Code.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CMB2_Type_Textarea_Code extends CMB2_Type_Textarea {
*
* @return string Form textarea element
*/
public function render() {
public function render( $args = array() ) {
return $this->rendered(
sprintf( '<pre>%s', parent::render( array(
'class' => 'cmb2-textarea-code',
Expand Down
2 changes: 1 addition & 1 deletion includes/CMB2/includes/types/CMB2_Type_Wysiwyg.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CMB2_Type_Wysiwyg extends CMB2_Type_Textarea {
* @since 1.1.0
* @return string Form wysiwyg element
*/
public function render() {
public function render( $args = array() ) {
$field = $this->field;
$a = $this->parse_args( 'wysiwyg', array(
'id' => $this->_id(),
Expand Down
4 changes: 4 additions & 0 deletions includes/admin/import/class-sm-import-sb.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ private function _import_sermons() {
// set passage
update_post_meta( $id, 'bible_passages_start', $sermon->start );
update_post_meta( $id, 'bible_passages_end', $sermon->end );

// set date
update_post_meta( $id, 'sermon_date', strtotime( $sermon->datetime ) );
update_post_meta( $id, 'sermon_date_auto', '1' );
}

// update term counts
Expand Down
5 changes: 4 additions & 1 deletion includes/admin/import/class-sm-import-se.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,10 @@ private function _import_messages() {

// set sermon date
if ( ! empty( $message->date ) && $message->date !== '0000-00-00' ) {
update_post_meta( $id, 'sermon_date', $message->date );
update_post_meta( $id, 'sermon_date', strtotime( $message->date ) );
} else {
update_post_meta( $id, 'sermon_date', strtotime( $the_post->post_date ) );
update_post_meta( $id, 'sermon_date_auto', '1' );
}

// set audio length
Expand Down
7 changes: 5 additions & 2 deletions includes/class-sm-install.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ class SM_Install {
'2.9' => array(
'sm_update_29_fill_out_series_dates',
'sm_update_29_convert_settings',
)
),
'2.9.3' => array(
'sm_update_293_fix_import_dates',
),
);

/** @var object Background update class */
Expand All @@ -43,7 +46,7 @@ public static function init() {
* This check is done on all requests and runs if the versions do not match
*/
public static function check_version() {
if ( ! defined( 'IFRAME_REQUEST' ) && get_option( 'sm_version' ) !== SM_VERSION ) {
if ( ! defined( 'IFRAME_REQUEST' ) && ( ( isset( $GLOBALS['sm_force_update'] ) && $GLOBALS['sm_force_update'] === true ) || get_option( 'sm_version' ) !== SM_VERSION ) ) {
self::_install();
do_action( 'sm_updated' );
}
Expand Down
7 changes: 7 additions & 0 deletions includes/sm-update-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,10 @@ function sm_update_29_convert_settings() {
update_option( 'sermonmanager_' . $key, $value );
}
}

/**
* SB and SE import did not import dates correctly. This function imports them for those who did import
*/
function sm_update_293_fix_import_dates() {
sm_update_28_fill_out_empty_dates();
}
10 changes: 7 additions & 3 deletions includes/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,13 +450,17 @@ function wpfc_sermon_excerpt( $return = false ) {
<?php
sm_the_date( '', '<span class="sermon_date">', '</span> ' );
the_terms( $post->ID, 'wpfc_service_type', ' <span class="service_type">(', ' ', ')</span>' );
?></p>
<p><?php
?>
</p>
<p>
<?php
wpfc_sermon_meta( 'bible_passage', '<span class="bible_passage">' . __( 'Bible Text: ', 'sermon-manager-for-wordpress' ), '</span> | ' );
the_terms( $post->ID, 'wpfc_preacher', '<span class="preacher_name">', ', ', '</span>' );
the_terms( $post->ID, 'wpfc_sermon_series', '<p><span class="sermon_series">' . __( 'Series: ', 'sermon-manager-for-wordpress' ), ' ', '</span></p>' );
?>
</p>
<p>
<?php the_terms( $post->ID, 'wpfc_sermon_series', '<span class="sermon_series">' . __( 'Series: ', 'sermon-manager-for-wordpress' ), ' ', '</span>' ); ?>
</p>
</div>
<?php if ( \SermonManager::getOption( 'archive_player' ) ): ?>
<div class="wpfc_sermon cf">
Expand Down
8 changes: 7 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.2
Stable tag: 2.9.3
License: GPLv2
License URI: https://www.gnu.org/licenses/gpl-2.0.html

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

## Changelog ##
### 2.9.3 ###
* Fix: Sermons can be imported again after deleting
* Fix: Fatal error on PHP 7.2
* Fix: Imported sermons not being ordered by date
* Fix: Remove unnecessary paragraph nesting on archive pages

### 2.9.2 ###
* Fix: 404 page on some hosts after update
* Fix: Admin search bar not working
Expand Down
36 changes: 35 additions & 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.9.2
* Version: 2.9.3
* Author: WP for Church
* Author URI: https://www.wpforchurch.com/
* Requires at least: 4.5
Expand Down Expand Up @@ -69,6 +69,7 @@ public function __construct() {
// Include required items
$this->_includes();

register_activation_hook( __FILE__, array( $this, 'check_for_update_functions' ) );
// load translations
add_action( 'after_setup_theme', array( $this, 'load_translations' ) );
// enqueue scripts & styles
Expand Down Expand Up @@ -105,6 +106,26 @@ public function __construct() {

return $url;
}, 10, 2 );
// Allows reimport after sermon deletion
add_action( 'before_delete_post', function ( $id ) {
if ( $GLOBALS['post_type'] !== 'wpfc_sermon' ) {
return;
}

$sermons_se = get_option( '_sm_import_se_messages' );
$sermons_sb = get_option( '_sm_import_sb_messages' );

foreach ( array( $sermons_se, $sermons_sb ) as $offset0 => &$sermons_array ) {
foreach ( $sermons_array as $offset1 => $value ) {
if ( $value['new_id'] == $id ) {
unset( $sermons_array[ $offset1 ] );
update_option( $offset0 === 0 ? '_sm_import_se_messages' : '_sm_import_sb_messages', $sermons_array );

return;
}
}
}
} );


// temporary hook for importing until API is properly done
Expand Down Expand Up @@ -395,6 +416,19 @@ public function render_sermon_into_content( $post_ID, $post ) {
function php_notice_handler() {
update_option( 'dismissed-' . $_POST['type'], 1 );
}

/**
* Executes non-executed update functions on plugin activation
*
* Useful for development versions
*
* @since 2.9.3
*/
function check_for_update_functions() {
$GLOBALS['sm_force_update'] = true;

include_once 'includes/class-sm-install.php';
}
}

// Initialize Sermon Manager
Expand Down

0 comments on commit ed1640e

Please sign in to comment.