Skip to content

Commit 1315495

Browse files
author
GITUSER
committed
Merge branch 'release/1.9.9.7'
2 parents 4671866 + 920abbb commit 1315495

10 files changed

+110
-172
lines changed

core/cta/classes/class.ajax.listeners.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public static function load_hooks() {
4141
add_action( 'wp_ajax_wp_wp_call_to_action_meta_save', array(__CLASS__, 'save_meta'));
4242

4343
/* Adds listener to serve next cta variation in line & update markers */
44-
add_action( 'wp_ajax_nopriv_cta_get_variation', array(__CLASS__, 'serve_varition'));
45-
add_action( 'wp_ajax_cta_get_variation', array(__CLASS__, 'serve_varition'));
44+
add_action( 'wp_ajax_nopriv_cta_get_variation', array(__CLASS__, 'serve_variation'));
45+
add_action( 'wp_ajax_cta_get_variation', array(__CLASS__, 'serve_variation'));
4646
}
4747

4848
/**
@@ -198,7 +198,7 @@ public static function save_meta() {
198198
/**
199199
* Get current variation for CTA
200200
*/
201-
public static function serve_varition() {
201+
public static function serve_variation() {
202202

203203
/* Make Sure the right GET param is attached to continue */
204204
if ( !isset($_REQUEST['cta_id']) || !is_numeric($_REQUEST['cta_id']) ) {

core/cta/classes/class.cta.render.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,7 @@ public static function delete_all_inbetween($beginning, $end, $string) {
10651065

10661066

10671067
/**
1068-
* Parse CSS and prepend the call to action / varition id
1068+
* Parse CSS and prepend the call to action / variation id
10691069
*/
10701070
public static function parse_css_template( $dynamic_css, $css_id_preface ) {
10711071
$dynamic_css = str_replace('{{', '[[', $dynamic_css);

core/mailer/classes/class.mailer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static function load_static_vars() {
5656
self::$table_name = $wpdb->prefix . "inbound_email_queue";
5757

5858
/* Get now timestamp */
59-
self::$timestamp = date_i18n('Y-m-d G:i');
59+
self::$timestamp = date_i18n('Y-m-d G:i:s');
6060

6161
/* Check if there is an error flag in db from previous processing run */
6262
self::$error_mode = Inbound_Options_API::get_option('inbound-email', 'errors-detected', false);

core/mailer/classes/class.metaboxes.inbound-email.php

Lines changed: 64 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,115 +1426,85 @@ public static function render_settings($settings_key, $custom_fields, $post) {
14261426
$tz = (isset($settings['timezone'])) ? $settings['timezone'] : $field['default_timezone_abbr'];
14271427

14281428
if (!isset($settings['send_datetime'])) {
1429-
$settings['send_datetime'] = date_i18n('Y/m/d G:i');
1429+
$settings['send_datetime'] = date_i18n('Y/m/d G:i:s');
14301430
}
14311431

14321432
/* add time if does not exist */
14331433
if(!strstr($settings['send_datetime'],':')) {
14341434
$settings['send_datetime'] = $settings['send_datetime'] . " 00:00";
14351435
}
14361436

1437-
$datepicker_style = (isset($inbound_settings['mailer']['datepicker-style'])) ? $inbound_settings['mailer']['datepicker-style'] : 'jquery-datepicker';
14381437

1439-
if ($datepicker_style == 'jquery-datepicker') {
1440-
/* get format corrected date */
1441-
if ($meta) {
1442-
/* get date time format as set by WordPress */
1438+
/* get format corrected date */
1439+
if ($meta) {
14431440

1444-
/* get correct format - d/m/Y date formats will fatal */
1445-
$wordpress_date_time_format = get_option('date_format') .' G:i';
1446-
1447-
$schedule_date = DateTime::createFromFormat(trim($wordpress_date_time_format) , trim($meta));
1441+
/* add time to timestamp if does not exist */
1442+
if (substr_count($meta,':') === 1 ) {
1443+
$meta = $meta .':00';
1444+
}
14481445

1449-
$corrected = self::correct_datetime_errors($schedule_date , $wordpress_date_time_format , $meta );
1446+
/* get correct format - d/m/Y date formats will fatal */
1447+
$wordpress_date_time_format = 'Y-m-d G:i:s';
1448+
$schedule_date = DateTime::createFromFormat(trim($wordpress_date_time_format) , trim($meta));
1449+
$errors = DateTime::getLastErrors();
14501450

1451-
$meta = $corrected['meta'];
1452-
$schedule_date = $corrected['object'];
1451+
if (!$errors['errors']) {
1452+
$meta_date = $schedule_date->format('Y-m-d');
1453+
$meta_time = $schedule_date->format('G:i:s');
1454+
$meta_current_date_corrected = date_i18n('Y/m/d G:i:s');
1455+
$meta_schedule_corrected = $schedule_date->format('Y/m/d G:i:s');
1456+
}
14531457

1454-
if (!$schedule_date) {
1455-
$schedule_date = new DateTime(date_i18n($wordpress_date_time_format));
1456-
}
1458+
} else {
14571459

1458-
$meta_current_date_corrected = date_i18n('Y/m/d G:i');
1459-
$meta_schedule_corrected = $schedule_date->format($wordpress_date_time_format);
1460+
$wordpress_date_time_format = 'Y-m-d G:i:s';
1461+
$schedule_date = DateTime::createFromFormat(trim($wordpress_date_time_format) , date_i18n($wordpress_date_time_format));
14601462

1461-
} else {
1462-
$meta_current_date_corrected = "";
1463-
$meta_schedule_corrected = "";
1463+
$meta_date = $schedule_date->format('Y-m-d');
1464+
$meta_time = $schedule_date->format('G:i:s');
1465+
$meta_current_date_corrected = "";
1466+
$meta_schedule_corrected = "";
1467+
}
1468+
echo '<div class="alternative-datepicker">
1469+
<input type="date" id="alternative-datepicker" value="' . $meta_date . '" >
1470+
<input type="hidden" name="' . $field_id . '" id="' . $field_id . '" value="' . $meta . '">
1471+
<input autocomplete="no" id="alternative-timepicker" type="text" class="time-picker " placeholder =" ' . __('Select Time', 'inbound-pro') . '" value="' . $meta_time . '"/>
1472+
<input type="hidden" id="inbound_current_datetime_formatted" value="' . $meta . '" class="new-date" value="" >
1473+
<input type="hidden" id="inbound_send_datetime_formatted" value="' . $meta_schedule_corrected . '" class="new-date" value="" >
1474+
</div>
1475+
';
1476+
echo '
1477+
<style>
1478+
.alternative-datepicker [type="date"] {
1479+
background:#fff url(https://cdn1.iconfinder.com/data/icons/cc_mono_icon_set/blacks/16x16/calendar_2.png) 97% 50% no-repeat ;
1480+
}
1481+
.alternative-datepicker [type="date"]::-webkit-inner-spin-button {
1482+
display: none;
1483+
}
1484+
.alternative-datepicker [type="date"]::-webkit-calendar-picker-indicator {
1485+
opacity: 0;
14641486
}
1465-
echo '<div class="jquery-date-picker inbound-datepicker" id="date-picking" data-field-type="text">
1466-
<span class="datepair" data-language="javascript">
1467-
<input autocomplete="no" type="text" id="date-picker-' . $settings_key . '" class="date start" placeholder="' . __('Select Date', 'inbound-pro') . '"/ ></span>
1468-
<input autocomplete="no" id="time-picker-' . $settings_key . '" type="text" class="time time-picker " placeholder =" ' . __('Select Time', 'inbound-pro') . '" />
1469-
<input type="hidden" name="' . $field_id . '" id="' . $field_id . '" value="' . $meta . '" class="new-date" value="" >
1470-
<input type="hidden" id="inbound_current_datetime_formatted" value="' . $meta_current_date_corrected . '" class="new-date" value="" >
1471-
<input type="hidden" id="inbound_send_datetime_formatted" value="' . $meta_schedule_corrected . '" class="new-date" value="" >
1472-
';
1473-
echo '</div>';
1474-
} else {
1475-
/* get format corrected date */
1476-
if ($meta) {
1477-
1478-
/* get correct format - d/m/Y date formats will fatal */
1479-
$wordpress_date_time_format = 'Y-m-d G:i';
1480-
$schedule_date = DateTime::createFromFormat(trim($wordpress_date_time_format) , trim($meta));
1481-
1482-
if (!DateTime::getLastErrors()) {
1483-
$meta_date = $schedule_date->format('Y-m-d');
1484-
$meta_time = $schedule_date->format('G:i');
1485-
$meta_current_date_corrected = date_i18n('Y/m/d G:i');
1486-
$meta_schedule_corrected = $schedule_date->format('Y/m/d G:i');
1487-
}
1488-
1489-
} else {
1490-
$wordpress_date_time_format = 'Y-m-d G:i';
1491-
$schedule_date = DateTime::createFromFormat(trim($wordpress_date_time_format) , date_i18n($wordpress_date_time_format));
14921487
1493-
$meta_date = $schedule_date->format('Y-m-d');
1494-
$meta_time = $schedule_date->format('G:i');
1495-
$meta_current_date_corrected = "";
1496-
$meta_schedule_corrected = "";
1488+
.alternative-datepicker input {
1489+
border: 1px solid #c4c4c4;
1490+
border-radius: 5px;
1491+
background-color: #fff;
1492+
padding: 3px 5px;
1493+
box-shadow: inset 0 3px 6px rgba(0,0,0,0.1);
1494+
width: 190px;
1495+
height:37px;
14971496
}
1498-
echo '<div class="alternative-datepicker">
1499-
<input type="date" id="alternative-datepicker" value="' . $meta_date . '" >
1500-
<input type="hidden" name="' . $field_id . '" id="' . $field_id . '" value="' . $meta . '">
1501-
<input autocomplete="no" id="alternative-timepicker" type="text" class="time-picker " placeholder =" ' . __('Select Time', 'inbound-pro') . '" value="' . $meta_time . '"/>
1502-
<input type="hidden" id="inbound_current_datetime_formatted" value="' . $meta . '" class="new-date" value="" >
1503-
<input type="hidden" id="inbound_send_datetime_formatted" value="' . $meta_schedule_corrected . '" class="new-date" value="" >
1504-
</div>
1505-
';
1506-
echo '
1507-
<style>
1508-
.alternative-datepicker [type="date"] {
1509-
background:#fff url(https://cdn1.iconfinder.com/data/icons/cc_mono_icon_set/blacks/16x16/calendar_2.png) 97% 50% no-repeat ;
1510-
}
1511-
.alternative-datepicker [type="date"]::-webkit-inner-spin-button {
1512-
display: none;
1513-
}
1514-
.alternative-datepicker [type="date"]::-webkit-calendar-picker-indicator {
1515-
opacity: 0;
1516-
}
1497+
</style>
1498+
<script>
1499+
jQuery("#alternative-datepicker,#alternative-timepicker").change(function() {
1500+
var date = jQuery("#alternative-datepicker").val();
1501+
var time = jQuery("#alternative-timepicker").val();
1502+
var new_datetime = date + " " + time ;
1503+
jQuery("#inbound_send_datetime").val(new_datetime)
1504+
})
1505+
1506+
</script>';
15171507

1518-
.alternative-datepicker input {
1519-
border: 1px solid #c4c4c4;
1520-
border-radius: 5px;
1521-
background-color: #fff;
1522-
padding: 3px 5px;
1523-
box-shadow: inset 0 3px 6px rgba(0,0,0,0.1);
1524-
width: 190px;
1525-
height:37px;
1526-
}
1527-
</style>
1528-
<script>
1529-
jQuery("#alternative-datepicker,#alternative-timepicker").change(function() {
1530-
var date = jQuery("#alternative-datepicker").val();
1531-
var time = jQuery("#alternative-timepicker").val();
1532-
var new_datetime = date + " " + time ;
1533-
jQuery("#inbound_send_datetime").val(new_datetime)
1534-
})
1535-
1536-
</script>';
1537-
}
15381508

15391509
/* show events */
15401510
$email_service = (isset($inbound_settings['mailer']['mail-service'])) ? $inbound_settings['mailer']['mail-service'] : 'wp_mail';
@@ -1706,15 +1676,15 @@ public static function correct_datetime_errors( $schedule_date , $wordpress_date
17061676
/* reformat Datetime Pattern if leading with F */
17071677
if ($wordpress_date_time_format[0] == "F") {
17081678

1709-
$new = new DateTime($schedule_date->format( "m/d/Y G:i"));
1710-
$corrected['meta'] = $schedule_date->format( "m/d/Y G:i");
1679+
$new = new DateTime($schedule_date->format( "m/d/Y G:i:s"));
1680+
$corrected['meta'] = $schedule_date->format( "m/d/Y G:i:s");
17111681
$corrected['object'] = $new;
17121682
return $corrected;
17131683
}
17141684

17151685
/* reformat Datetime Pattern if leading with j */
17161686
if ($wordpress_date_time_format[0] == "j") {
1717-
$new = new DateTime($schedule_date->format( "d/m/Y G:i"));
1687+
$new = new DateTime($schedule_date->format( "d/m/Y G:i:s"));
17181688
$corrected['meta'] = $schedule_date->format( "d/m/Y G:i");
17191689
$corrected['object'] = $new;
17201690
return $corrected;

core/mailer/classes/class.post-type.inbound-email.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,21 +374,21 @@ public static function check_if_scheduled_emails_sent() {
374374
}
375375

376376
/* get correct format - d/m/Y date formats will fatal */
377-
$wordpress_date_time_format = get_option('date_format') .' G:i';
377+
$wordpress_date_time_format = get_option('date_format') .' G:i:s';
378378

379379
/* reformat Datetime Pattern if leading with F */
380380
if ($wordpress_date_time_format[0] == "F") {
381-
$wordpress_date_time_format = "m/d/Y" .' G:i';
381+
$wordpress_date_time_format = "m/d/Y" .' G:i:s';
382382
}
383383

384384
/* reformat Datetime Pattern if leading with j */
385385
if ($wordpress_date_time_format[0] == "j") {
386-
$wordpress_date_time_format = "d/m/Y" .' G:i';
386+
$wordpress_date_time_format = "d/m/Y" .' G:i:s';
387387
}
388388

389389
/* add date if does not exist */
390390
if(!$settings['send_datetime']) {
391-
$settings['send_datetime'] = date_i18n('m/d/Y G:i');
391+
$settings['send_datetime'] = date_i18n('m/d/Y G:i:s');
392392
}
393393

394394
/* add time if does not exist */

0 commit comments

Comments
 (0)