id="" name="enable_custom_post_titles_" />
">
false, 'message'=>$print ));
} elseif ( empty( $hours ) ) {
// error message
$validation[] = __('Please add time.', 'ataswp_lang');
// validation
$print = ATASWP_Admin_Core::displayAjaxFormsValidationResult($validation, $type='info');
echo json_encode(array('success'=>false, 'message'=>$print ));
} else {
$times = ''; // def
// create times array
$index = 0; // default
foreach($hours as $hour) {
if ( ! empty( $hours[$index] ) && ! empty( $minutes[$index] ) ) {
$time = $hours[$index] . ':' . $minutes[$index];
$times[] = $time;
}
$index++; // should be at the end of the loop
}
$data = array(
"post_id" => $post_id,
"scheduler_counter" => $scheduler_counter,
"scheduler_intervals" => $intervals, // array
"scheduler_start_date" => $start_date,
"scheduler_end_date" => $end_date,
"scheduler_times" => $times, // array
"enable_custom_post_titles" => $enable_custom_post_titles,
"custom_post_titles" => $custom_post_titles
);
/*
echo '';
print_r( $data );
echo '
';
exit;
*/
$intervals = json_encode($data['scheduler_intervals']); // json encode before save
$times = json_encode($data['scheduler_times']); // json encode before save
update_post_meta($post_id,'_ataswp_scheduler_counter', $scheduler_counter);
update_post_meta($post_id,'_ataswp_scheduler_intervals', $intervals);
update_post_meta($post_id,'_ataswp_scheduler_start_date', $data['scheduler_start_date']);
update_post_meta($post_id,'_ataswp_scheduler_end_date', $data['scheduler_end_date']);
update_post_meta($post_id,'_ataswp_scheduler_times', $times);
$data = json_encode($data); // json encode before send
// update custom post titles
do_action( 'ataswp_scheduler_update_post', $data ); // <- extensible
// success message
$validation[] = __('Settings has been updated.', 'ataswp_lang');
// validation
$print = ATASWP_Admin_Core::displayAjaxFormsValidationResult($validation, $type='success');
echo json_encode(array('success'=>true, 'message'=>$print ));
}
} else {
// error message
$validation[] = __('Form Validation failed!', 'ataswp_lang');
// validation
$print = ATASWP_Admin_Core::displayAjaxFormsValidationResult($validation, $type='error');
echo json_encode(array('success'=>false, 'message'=>$print ));
}
exit; // don't forget to exit!
}
}
?>