Skip to content

Commit

Permalink
Release 2.11.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikola committed Feb 6, 2018
2 parents 9e82b6d + 7091b7f commit 1de3299
Show file tree
Hide file tree
Showing 6 changed files with 244 additions and 114 deletions.
26 changes: 25 additions & 1 deletion includes/admin/settings/class-sm-settings-debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,37 @@ public function get_settings() {
'id' => 'execute_unexecuted_functions',
'default' => 'no',
),
array(
'title' => '"post_content" creation',
'type' => 'select',
'options' => array(
1 => 'Enable',
11 => 'Enable and re-create all',
0 => 'Disable',
10 => 'Disable and flush existing'
),
'id' => 'post_content_enabled',
'default' => 1,
),
array(
'title' => '"post_excerpt" creation',
'type' => 'select',
'options' => array(
1 => 'Enable',
11 => 'Enable and re-create all',
0 => 'Disable',
10 => 'Disable and flush existing'
),
'id' => 'post_excerpt_enabled',
'default' => 1,
),
array(
'title' => __( 'Execute a specific update function' ),
'type' => 'select',
'id' => 'execute_specific_unexecuted_function',
'default' => '',
'options' => sm_debug_get_update_functions(),
'desc' => '<code>[AE]</code> - Already Executed; <code>[NE]</code> - Not Executed',
'desc' => '<code>[AE]</code> - Already Executed; <code>[NE]</code> - Not Executed',
),

array( 'type' => 'sectionend', 'id' => 'debug_settings' ),
Expand Down
20 changes: 19 additions & 1 deletion includes/class-sm-dates-wp.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,25 @@ public static function maybe_update_date( $post_ID, $post, $update ) {
if ( $update ) {
// compare sermon date and if user changed it update sermon date and disable auto update
if ( ! empty( $_POST['sermon_date'] ) ) {
$dt = DateTime::createFromFormat( SermonManager::getOption( 'date_format' ) ?: 'm/d/Y', $_POST['sermon_date'] );
switch ( \SermonManager::getOption( 'date_format' ) ) {
case '0':
$date_format = 'm/d/Y';
break;
case '1':
$date_format = 'd/m/Y';
break;
case '2':
$date_format = 'Y/m/d';
break;
case '3':
$date_format = 'Y/d/m';
break;
default:
$date_format = 'm/d/Y';
break;
}

$dt = DateTime::createFromFormat( $date_format, $_POST['sermon_date'] );
$dt_post = DateTime::createFromFormat( 'U', mysql2date( 'U', $post->post_date ) );

$time = array(
Expand Down
39 changes: 22 additions & 17 deletions includes/sm-cmb-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,28 +63,33 @@ function wpfc_sermon_metaboxes() {
// 'closed' => true, // Keep the metabox closed by default
) );

$date_format = 'm/d/Y';
if ( \SermonManager::getOption( 'date_format' ) !== '' ) {
switch ( \SermonManager::getOption( 'date_format' ) ) {
case '0':
$date_format = 'm/d/Y';
break;
case '1':
$date_format = 'd/m/Y';
break;
case '2':
$date_format = 'Y/m/d';
break;
case '3':
$date_format = 'Y/d/m';
break;
}
switch ( \SermonManager::getOption( 'date_format' ) ) {
case '0':
$date_format_label = 'mm/dd/YYYY';
$date_format = 'm/d/Y';
break;
case '1':
$date_format_label = 'dd/mm/YYYY';
$date_format = 'd/m/Y';
break;
case '2':
$date_format_label = 'YYYY/mm/dd';
$date_format = 'Y/m/d';
break;
case '3':
$date_format_label = 'YYYY/dd/mm';
$date_format = 'Y/d/m';
break;
default:
$date_format_label = 'mm/dd/YYYY';
$date_format = 'm/d/Y';
break;
}

$cmb->add_field( array(
'name' => esc_html__( 'Date Preached', 'sermon-manager-for-wordpress' ),
'desc' => esc_html__( '(optional)', 'sermon-manager-for-wordpress' ) . '<br>' . wp_sprintf( /* translators: %s date format, effectively <code>d/m/Y</code> or the like */
esc_html__( 'format: %s', 'sermon-manager-for-wordpress' ), $date_format ),
esc_html__( 'format: %s', 'sermon-manager-for-wordpress' ), $date_format_label ),
'id' => 'sermon_date',
'type' => 'text_date_timestamp',
'date_format' => $date_format,
Expand Down
6 changes: 4 additions & 2 deletions includes/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,9 @@ function wpfc_render_video( $url = '' ) {

$output = wp_video_shortcode( $attr );
} else {
$is_youtube = strpos( strtolower( $url ), 'youtube.com' );
$is_youtube_long = strpos( strtolower( $url ), 'youtube.com' );
$is_youtube_short = strpos( strtolower( $url ), 'youtu.be' );
$is_youtube = $is_youtube_long || $is_youtube_short;
$is_vimeo = strpos( strtolower( $url ), 'vimeo.com' );

if ( $is_youtube || $is_vimeo ) {
Expand Down Expand Up @@ -455,7 +457,7 @@ function wpfc_sermon_attachments() {
$html .= '</p>';
$html .= '</div>';

return $html;
return apply_filters( 'sm_attachments_html', $html );
}

// legacy function
Expand Down
11 changes: 9 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Contributors: wpforchurch, nikolam
Donate link: http://wpforchurch.com/
Tags: church, sermon, sermons, preaching, podcasting, manage, managing, podcasts, itunes
Requires at least: 4.5
Tested up to: 4.9.2
Tested up to: 4.9.3
Requires PHP: 5.3
Stable tag: 2.11.2
Stable tag: 2.11.3
License: GPLv2
License URI: https://www.gnu.org/licenses/gpl-2.0.html

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

## Changelog ##
### 2.11.3 ###
* Fix: Sermon date not being saved when date format is changed
* Fix: YouTube short URL was not being detected (thanks @macbookandrew)
* Fix: Excerpt saving as "1" when there's no sermon description
* Dev: Added more filters for output
* Dev: Added setting for disabling post_content and post_excerpt creation

### 2.11.2 ###
* Change: Remove accidentally added search form from PR #159
* Fix: Attachments not being downloaded when clicked on them
Expand Down
Loading

0 comments on commit 1de3299

Please sign in to comment.