From 58be44baede2d5951b376b1df80c845e1a8647a2 Mon Sep 17 00:00:00 2001
From: Nikola
Date: Thu, 7 Dec 2017 19:27:17 +0100
Subject: [PATCH 1/6] Fix import not importing dates
---
includes/admin/import/class-sm-import-sb.php | 4 ++++
includes/admin/import/class-sm-import-se.php | 5 ++++-
includes/class-sm-install.php | 5 ++++-
includes/sm-update-functions.php | 7 +++++++
readme.txt | 3 +++
5 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/includes/admin/import/class-sm-import-sb.php b/includes/admin/import/class-sm-import-sb.php
index 44b550a..99fd817 100644
--- a/includes/admin/import/class-sm-import-sb.php
+++ b/includes/admin/import/class-sm-import-sb.php
@@ -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
diff --git a/includes/admin/import/class-sm-import-se.php b/includes/admin/import/class-sm-import-se.php
index 67b50a2..851e721 100644
--- a/includes/admin/import/class-sm-import-se.php
+++ b/includes/admin/import/class-sm-import-se.php
@@ -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
diff --git a/includes/class-sm-install.php b/includes/class-sm-install.php
index 9e4701b..1939eb5 100644
--- a/includes/class-sm-install.php
+++ b/includes/class-sm-install.php
@@ -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 */
diff --git a/includes/sm-update-functions.php b/includes/sm-update-functions.php
index 1ea995e..7ef3e3e 100644
--- a/includes/sm-update-functions.php
+++ b/includes/sm-update-functions.php
@@ -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();
+}
diff --git a/readme.txt b/readme.txt
index 9a0923e..7574d97 100755
--- a/readme.txt
+++ b/readme.txt
@@ -100,6 +100,9 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man
2. Sermon Files
## Changelog ##
+### 2.9.3 ###
+* Fix: Imported sermons not ordered
+
### 2.9.2 ###
* Fix: 404 page on some hosts after update
* Fix: Admin search bar not working
From c4aa104bb13533f5eb228b7841e99737dbe6fbfd Mon Sep 17 00:00:00 2001
From: Nikola
Date: Thu, 7 Dec 2017 19:36:31 +0100
Subject: [PATCH 2/6] Execute update functions on development version install
---
includes/class-sm-install.php | 2 +-
sermons.php | 14 ++++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/includes/class-sm-install.php b/includes/class-sm-install.php
index 1939eb5..cd069e9 100644
--- a/includes/class-sm-install.php
+++ b/includes/class-sm-install.php
@@ -46,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' );
}
diff --git a/sermons.php b/sermons.php
index e48202e..ef3a926 100755
--- a/sermons.php
+++ b/sermons.php
@@ -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
@@ -395,6 +396,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
From c0b570d8ffc61576b04bd9bf1719565efe252a15 Mon Sep 17 00:00:00 2001
From: Nikola
Date: Thu, 7 Dec 2017 20:24:45 +0100
Subject: [PATCH 3/6] Allow importing of sermons after deleting them
---
readme.txt | 1 +
sermons.php | 36 ++++++++++++++++++++++++++++--------
2 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/readme.txt b/readme.txt
index 7574d97..9d7afdf 100755
--- a/readme.txt
+++ b/readme.txt
@@ -101,6 +101,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man
## Changelog ##
### 2.9.3 ###
+* Fix: Can't import sermons again after deleting them
* Fix: Imported sermons not ordered
### 2.9.2 ###
diff --git a/sermons.php b/sermons.php
index ef3a926..5140823 100755
--- a/sermons.php
+++ b/sermons.php
@@ -106,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
@@ -398,17 +418,17 @@ function php_notice_handler() {
}
/**
- * Executes non-executed update functions on plugin activation
- *
- * Useful for development versions
- *
+ * 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;
+ function check_for_update_functions() {
+ $GLOBALS['sm_force_update'] = true;
- include_once 'includes/class-sm-install.php';
- }
+ include_once 'includes/class-sm-install.php';
+ }
}
// Initialize Sermon Manager
From 6624c69abd5bc1dcf455fb0e196451d3cfda8ea0 Mon Sep 17 00:00:00 2001
From: Nikola
Date: Thu, 7 Dec 2017 21:14:32 +0100
Subject: [PATCH 4/6] Remove paragraph nesting
---
includes/template-tags.php | 10 +++++++---
readme.txt | 1 +
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/includes/template-tags.php b/includes/template-tags.php
index 680d3fc..9ff427a 100755
--- a/includes/template-tags.php
+++ b/includes/template-tags.php
@@ -450,13 +450,17 @@ function wpfc_sermon_excerpt( $return = false ) {
', ' ' );
the_terms( $post->ID, 'wpfc_service_type', ' (', ' ', ')' );
- ?>
-
+
+
+ ' . __( 'Bible Text: ', 'sermon-manager-for-wordpress' ), ' | ' );
the_terms( $post->ID, 'wpfc_preacher', '', ', ', '' );
- the_terms( $post->ID, 'wpfc_sermon_series', '
' . __( 'Series: ', 'sermon-manager-for-wordpress' ), ' ', '
' );
?>
+
+ ID, 'wpfc_sermon_series', '' . __( 'Series: ', 'sermon-manager-for-wordpress' ), ' ', '' ); ?>
+
diff --git a/readme.txt b/readme.txt
index 9d7afdf..dd26d8b 100755
--- a/readme.txt
+++ b/readme.txt
@@ -103,6 +103,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man
### 2.9.3 ###
* Fix: Can't import sermons again after deleting them
* Fix: Imported sermons not ordered
+* Fix: Remove paragraph nesting on archive pages
### 2.9.2 ###
* Fix: 404 page on some hosts after update
From 9199f7ab987ee07cd1773a125ebab65c911b2d91 Mon Sep 17 00:00:00 2001
From: Nikola
Date: Tue, 12 Dec 2017 08:55:43 +0100
Subject: [PATCH 5/6] Fix CMB fatal errors on latest PHP
---
includes/CMB2/includes/types/CMB2_Type_Checkbox.php | 2 +-
includes/CMB2/includes/types/CMB2_Type_Colorpicker.php | 2 +-
includes/CMB2/includes/types/CMB2_Type_File.php | 2 +-
includes/CMB2/includes/types/CMB2_Type_File_List.php | 2 +-
includes/CMB2/includes/types/CMB2_Type_Oembed.php | 2 +-
includes/CMB2/includes/types/CMB2_Type_Text_Date.php | 2 +-
.../includes/types/CMB2_Type_Text_Datetime_Timestamp.php | 2 +-
includes/CMB2/includes/types/CMB2_Type_Text_Time.php | 2 +-
includes/CMB2/includes/types/CMB2_Type_Textarea_Code.php | 2 +-
includes/CMB2/includes/types/CMB2_Type_Wysiwyg.php | 2 +-
readme.txt | 7 ++++---
11 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/includes/CMB2/includes/types/CMB2_Type_Checkbox.php b/includes/CMB2/includes/types/CMB2_Type_Checkbox.php
index 88cc295..97f2620 100755
--- a/includes/CMB2/includes/types/CMB2_Type_Checkbox.php
+++ b/includes/CMB2/includes/types/CMB2_Type_Checkbox.php
@@ -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',
diff --git a/includes/CMB2/includes/types/CMB2_Type_Colorpicker.php b/includes/CMB2/includes/types/CMB2_Type_Colorpicker.php
index 3806648..73029db 100755
--- a/includes/CMB2/includes/types/CMB2_Type_Colorpicker.php
+++ b/includes/CMB2/includes/types/CMB2_Type_Colorpicker.php
@@ -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}$';
diff --git a/includes/CMB2/includes/types/CMB2_Type_File.php b/includes/CMB2/includes/types/CMB2_Type_File.php
index a4da042..6578871 100755
--- a/includes/CMB2/includes/types/CMB2_Type_File.php
+++ b/includes/CMB2/includes/types/CMB2_Type_File.php
@@ -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();
diff --git a/includes/CMB2/includes/types/CMB2_Type_File_List.php b/includes/CMB2/includes/types/CMB2_Type_File_List.php
index c672ed8..6996e3a 100755
--- a/includes/CMB2/includes/types/CMB2_Type_File_List.php
+++ b/includes/CMB2/includes/types/CMB2_Type_File_List.php
@@ -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();
diff --git a/includes/CMB2/includes/types/CMB2_Type_Oembed.php b/includes/CMB2/includes/types/CMB2_Type_Oembed.php
index 12b61d5..54e008d 100755
--- a/includes/CMB2/includes/types/CMB2_Type_Oembed.php
+++ b/includes/CMB2/includes/types/CMB2_Type_Oembed.php
@@ -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() );
diff --git a/includes/CMB2/includes/types/CMB2_Type_Text_Date.php b/includes/CMB2/includes/types/CMB2_Type_Text_Date.php
index fb4697a..1ff0c3e 100755
--- a/includes/CMB2/includes/types/CMB2_Type_Text_Date.php
+++ b/includes/CMB2/includes/types/CMB2_Type_Text_Date.php
@@ -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() ) : '',
diff --git a/includes/CMB2/includes/types/CMB2_Type_Text_Datetime_Timestamp.php b/includes/CMB2/includes/types/CMB2_Type_Text_Datetime_Timestamp.php
index 8d63c60..9618e23 100755
--- a/includes/CMB2/includes/types/CMB2_Type_Text_Datetime_Timestamp.php
+++ b/includes/CMB2/includes/types/CMB2_Type_Text_Datetime_Timestamp.php
@@ -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(
diff --git a/includes/CMB2/includes/types/CMB2_Type_Text_Time.php b/includes/CMB2/includes/types/CMB2_Type_Text_Time.php
index c6e6bf8..a556974 100755
--- a/includes/CMB2/includes/types/CMB2_Type_Text_Time.php
+++ b/includes/CMB2/includes/types/CMB2_Type_Text_Time.php
@@ -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' ),
diff --git a/includes/CMB2/includes/types/CMB2_Type_Textarea_Code.php b/includes/CMB2/includes/types/CMB2_Type_Textarea_Code.php
index 4b464eb..a7b6cca 100755
--- a/includes/CMB2/includes/types/CMB2_Type_Textarea_Code.php
+++ b/includes/CMB2/includes/types/CMB2_Type_Textarea_Code.php
@@ -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( '%s', parent::render( array(
'class' => 'cmb2-textarea-code',
diff --git a/includes/CMB2/includes/types/CMB2_Type_Wysiwyg.php b/includes/CMB2/includes/types/CMB2_Type_Wysiwyg.php
index bb53824..2d183c4 100755
--- a/includes/CMB2/includes/types/CMB2_Type_Wysiwyg.php
+++ b/includes/CMB2/includes/types/CMB2_Type_Wysiwyg.php
@@ -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(),
diff --git a/readme.txt b/readme.txt
index dd26d8b..6b546a8 100755
--- a/readme.txt
+++ b/readme.txt
@@ -101,9 +101,10 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man
## Changelog ##
### 2.9.3 ###
-* Fix: Can't import sermons again after deleting them
-* Fix: Imported sermons not ordered
-* Fix: Remove paragraph nesting on archive pages
+* 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
From 3446b8234b518627f54cdcb7d0efbf831f5fdac0 Mon Sep 17 00:00:00 2001
From: Nikola
Date: Tue, 12 Dec 2017 09:10:36 +0100
Subject: [PATCH 6/6] Update versions
---
readme.txt | 2 +-
sermons.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/readme.txt b/readme.txt
index 6b546a8..697bb17 100755
--- a/readme.txt
+++ b/readme.txt
@@ -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
diff --git a/sermons.php b/sermons.php
index 5140823..f3e00bf 100755
--- a/sermons.php
+++ b/sermons.php
@@ -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