Skip to content

Commit

Permalink
Merge branch 'release/1.9.5.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
atwellpub committed Jan 3, 2019
2 parents e05c218 + 9613912 commit 70e4c5e
Show file tree
Hide file tree
Showing 12 changed files with 143 additions and 68 deletions.
66 changes: 28 additions & 38 deletions core/automation/automation.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ final class Inbound_Automation_Plugin {
public function __construct() {
self::define_constants();
self::includes();
self::load_hooks();
self::load_text_domain_init();
}

Expand All @@ -35,6 +36,10 @@ private static function define_constants() {
define( 'INBOUND_AUTOMATION_SLUG', plugin_basename( dirname(__FILE__) ) );
}

public static function load_hooks() {
add_action('plugins_loaded' , array(__CLASS__ , 'load_definitions'));
}

/**
* Include required plugin files
*/
Expand All @@ -52,27 +57,6 @@ private static function includes() {
include_once('classes/class.metaboxes.automation.php');
include_once('classes/class.automation.php');
include_once('classes/class.lead-profile.php');

include_once('definitions/trigger.inbound_store_lead_post.php');
include_once('definitions/trigger.wpleads_new_lead_insert.php');
include_once('definitions/trigger.wpleads_existing_lead_update.php');
include_once('definitions/trigger.inbound_double_optin_confirm.php');
//include_once('definitions/trigger.page_tracking_event.php');
include_once('definitions/trigger.user_register.php');
include_once('definitions/trigger.set_object_terms.php');
include_once('definitions/trigger.draft_to_publish.php');
include_once('definitions/trigger.inbound_track_link.php');
include_once('definitions/action.wait.php');
include_once('definitions/action.create_lead.php');
include_once('definitions/action.create_user.php');
include_once('definitions/action.send_email.php');
include_once('definitions/action.relay_data.php');
include_once('definitions/action.add_remove_list.php');
include_once('definitions/action.add_remove_tag.php');
include_once('definitions/action.kill_lead_tasks.php');
include_once('definitions/query.lead_data.php');
include_once('definitions/query.user_data.php');

BREAK;

case false :
Expand All @@ -83,27 +67,33 @@ private static function includes() {
include_once('classes/class.definitions.loader.php');
include_once('classes/class.metaboxes.automation.php');
include_once('classes/class.automation.php');

include_once('definitions/trigger.inbound_store_lead_post.php');
include_once('definitions/trigger.draft_to_publish.php');
include_once('definitions/trigger.inbound_double_optin_confirm.php');
include_once('definitions/trigger.user_register.php');
include_once('definitions/trigger.inbound_track_link.php');
include_once('definitions/action.wait.php');
include_once('definitions/action.create_user.php');
include_once('definitions/action.create_lead.php');
include_once('definitions/action.send_email.php');
include_once('definitions/action.relay_data.php');
include_once('definitions/action.add_remove_list.php');
include_once('definitions/action.add_remove_tag.php');
include_once('definitions/action.kill_lead_tasks.php');
include_once('definitions/query.lead_data.php');
include_once('definitions/query.user_data.php');

BREAK;
endswitch;
}

/**
* Loading definitions
*/
public static function load_definitions() {
include_once('definitions/trigger.inbound_store_lead_post.php');
include_once('definitions/trigger.wpleads_new_lead_insert.php');
include_once('definitions/trigger.wpleads_existing_lead_update.php');
include_once('definitions/trigger.inbound_double_optin_confirm.php');
include_once('definitions/trigger.draft_to_publish.php');
include_once('definitions/trigger.user_register.php');
include_once('definitions/trigger.inbound_track_link.php');
include_once('definitions/action.wait.php');
include_once('definitions/action.create_user.php');
include_once('definitions/action.create_lead.php');
include_once('definitions/action.send_email.php');
include_once('definitions/action.relay_data.php');
include_once('definitions/action.add_remove_list.php');
include_once('definitions/action.add_remove_tag.php');
include_once('definitions/action.kill_lead_tasks.php');
include_once('definitions/query.lead_data.php');
include_once('definitions/query.user_data.php');
}

/**
* Loads the correct .mo file for this plugin
*/
Expand Down
5 changes: 0 additions & 5 deletions core/automation/classes/class.definitions.loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ public static function init() {
return self::$instance;
}

//global $inbound_sid;
//error_log($inbound_sid);

/* create object */
self::$instance = new stdClass();

Expand Down Expand Up @@ -694,7 +691,5 @@ function inbound_automation_load_definitions() {
*/
add_action('init', 'inbound_automation_load_definitions', 1);

/* for debugging */
$GLOBALS['inbound_sid'] = rand(100, 200);
}

2 changes: 1 addition & 1 deletion core/landing-pages/assets/js/admin/admin.post-new.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jQuery(document).ready(function ($) {
jQuery("#lp_template_change a").removeClass("button-primary").addClass("button");

// New Sidebar
jQuery("#postbox-container-1").html("<div class='postbox'><center><h3>Download Additional Templates</h3><a target='_blank' href='http://www.inboundnow.com/market/?show=landing-pages'><img src='"+lp_post_new_ui.LANDINGPAGES_URLPATH+"assets/images/get-wordpress-templates.png'></a><a target='_blank' href='http://www.inboundnow.com/market/?show=landing-pages' class='button new-lp-button button-primary button-large'>Download Landing Page Templates</a></center></div><div class='postbox'><center><h3>Need Custom Template Design?</h3><a target='_blank' href='http://www.inboundnow.com/contact'><img src='"+lp_post_new_ui.LANDINGPAGES_URLPATH+"assets/images/get-custom-setup.png'></a><a target='_blank' href='http://docs.inboundnow.com/guide/default-wp-themes/' class='button new-lp-button button-primary button-large'>Get Custom Template Setup</a></center></div>");
jQuery("#postbox-container-1").html("<div class='postbox'><center><h3>Download Inbound PRO and join Inbound Now's membership plan for access to premium templates.</h3><a target='_blank' href='http://www.inboundnow.com/market/?show=landing-pages'><img src='"+lp_post_new_ui.LANDINGPAGES_URLPATH+"assets/images/get-wordpress-templates.png'></a><a target='_blank' href='http://www.inboundnow.com/market/?show=landing-pages' class='button new-lp-button button-primary button-large'>Download Landing Page Templates</a></center></div><div class='postbox'><center><h3>Need Custom Template Design?</h3><a target='_blank' href='http://www.inboundnow.com/contact'><img src='"+lp_post_new_ui.LANDINGPAGES_URLPATH+"assets/images/get-custom-setup.png'></a><a target='_blank' href='http://docs.inboundnow.com/guide/default-wp-themes/' class='button new-lp-button button-primary button-large'>Get Custom Template Setup</a></center></div>");

jQuery('.lp_select_template').click(function(){
jQuery(".mceIframeContainer iframe#content_ifr").css("height", "100%");
Expand Down
2 changes: 1 addition & 1 deletion core/landing-pages/classes/class.admin-notices.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static function get_more_templates_notice() {

?>
<div id="more-templates-button" style="display:none;">
<a target="_blank" href="https://www.inboundnow.com/marketplace/?show=landing-pages" class="button new-lp-button button-primary button-large"><?php _e( 'Download Additional Landing Page Templates' , 'inbound-pro' ); ?></a>
<a target="_blank" href="https://www.inboundnow.com/marketplace/?show=landing-pages" class="button new-lp-button button-primary button-large"><?php _e( 'Download Inbound PRO and join Inbound Now\'s membership plan for access to premium templates.' , 'inbound-pro' ); ?></a>
</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
Expand Down
13 changes: 2 additions & 11 deletions core/landing-pages/classes/class.welcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,6 @@ public function __construct() {
* @return void
*/
public function admin_menus() {
/* About Page */
add_dashboard_page(
__( 'Welcome to WordPress Landing Pages', 'landing-pages'),
__( 'Welcome to WordPress Landing Pages', 'landing-pages'),
$this->minimum_capability,
'lp-quick-start',
array( $this, 'quick_start_screen' )
);
/* About InboundNow Page */
add_dashboard_page(
__( 'About the Inbound Now Marketing Platform', 'landing-pages'),
Expand Down Expand Up @@ -79,7 +71,6 @@ public function admin_menus() {
* @return void
*/
public function admin_head() {
remove_submenu_page( 'index.php', 'lp-quick-start' );
remove_submenu_page( 'index.php', 'about-inboundnow' );
remove_submenu_page( 'index.php', 'inbound-developers' );

Expand Down Expand Up @@ -247,7 +238,7 @@ public function admin_head() {
*/
static function render_nav_menu() {
$current_view = $_GET['page'];
$page_array = array('lp-quick-start' => "Quick Start Guide",
$page_array = array(
'about-inboundnow' => "About the Platform",
'inbound-developers' => 'Developers & Designers'
);
Expand Down Expand Up @@ -625,7 +616,7 @@ public function welcome() {
return;
}

wp_safe_redirect( admin_url( 'index.php?page=lp-quick-start' ) ); exit;
wp_safe_redirect( admin_url( 'index.php?page=about-inboundnow' ) ); exit;
}
}

Expand Down
4 changes: 2 additions & 2 deletions core/landing-pages/landing-pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Landing Pages
Plugin URI: http://www.inboundnow.com/landing-pages/
Description: Landing page template framework with variant testing and lead capturing through cooperation with Inbound Now's Leads plugin. This is the stand alone version served through WordPress.org.
Version: 2.7.1
Version: 2.7.2
Author: Inbound Now
Author URI: https://www.inboundnow.com/?innercity=true
Text Domain: inbound-pro
Expand Down Expand Up @@ -42,7 +42,7 @@ public function __construct() {
*/
private static function load_constants() {

define('LANDINGPAGES_CURRENT_VERSION', '2.7.1' );
define('LANDINGPAGES_CURRENT_VERSION', '2.7.2' );
define('LANDINGPAGES_URLPATH', plugins_url( '/' , __FILE__ ) );
define('LANDINGPAGES_PATH', WP_PLUGIN_DIR.'/'.plugin_basename( dirname(__FILE__) ).'/' );
define('LANDINGPAGES_PLUGIN_SLUG', 'landing-pages' );
Expand Down
3 changes: 3 additions & 0 deletions core/mailer/classes/class.connector.sparkpost.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public static function create_webhook( $webhook_args ){
'timeout' => 45,
'redirection' => 5,
'httpversion' => '1.0',
'sslverify' => false,
'blocking' => true,
'headers' => array(
'Content-type' => 'application/json',
Expand Down Expand Up @@ -177,6 +178,7 @@ public static function send( $transmission_args ){
'timeout' => 45,
'redirection' => 5,
'httpversion' => '1.0',
'sslverify' => false,
'blocking' => true,
'headers' => array(
'Content-type' => 'application/json',
Expand Down Expand Up @@ -284,6 +286,7 @@ public static function delete_transmission( $transmission_id ) {
'redirection' => 5,
'httpversion' => '1.0',
'blocking' => true,
'sslverify' => false,
'headers' => array(
'Accecpt' => 'application/json',
'Authorization' => self::$apikey
Expand Down
75 changes: 71 additions & 4 deletions core/mailer/classes/class.metaboxes.inbound-email.php
Original file line number Diff line number Diff line change
Expand Up @@ -1384,15 +1384,20 @@ public static function render_settings($settings_key, $custom_fields, $post) {
/* get correct format - d/m/Y date formats will fatal */
$wordpress_date_time_format = get_option('date_format') .' G:i';

/* add date if does not exist */
$schedule_date = DateTime::createFromFormat(trim($wordpress_date_time_format) , trim($meta));

$corrected = self::correct_datetime_errors($schedule_date , $wordpress_date_time_format , $meta );

$meta = $corrected['meta'];
$schedule_date = $corrected['object'];


if (!$schedule_date) {
$schedule_date = new DateTime(date_i18n($wordpress_date_time_format));
}

$meta_current_date_corrected = date_i18n('Y-m-d G:i');
$meta_schedule_corrected = $schedule_date->format('Y/m/d G:i');
$meta_schedule_corrected = $schedule_date->format($wordpress_date_time_format);

} else {
$meta_current_date_corrected = "";
Expand Down Expand Up @@ -1548,6 +1553,67 @@ public static function render_job_select() {

}

/**
* @param $schedule_date
*/
public static function correct_datetime_errors( $schedule_date , $wordpress_date_time_format , $datetime ) {

$errors = DateTime::getLastErrors();

$corrected = array();
$corrected['meta'] = $datetime;
$corrected['object'] = $schedule_date;

/**
error_log($wordpress_date_time_format);
error_log($datetime);
error_log(print_r(DateTime::getLastErrors() , true));
/**/

if (!$errors['errors']) {
/* reformat Datetime Pattern if leading with F */
if ($wordpress_date_time_format[0] == "F") {

$new = new DateTime($schedule_date->format( "d/m/Y G:i"));
$corrected['meta'] = $schedule_date->format( "d/m/Y G:i");
$corrected['object'] = $new;
return $corrected;
}

/* reformat Datetime Pattern if leading with j */
if ($wordpress_date_time_format[0] == "j") {
$new = new DateTime($schedule_date->format( "m/d/Y G:i"));
$corrected['meta'] = $schedule_date->format( "d/m/Y G:i");
$corrected['object'] = $new;
return $corrected;
}

/* non problematic return as normal */
$corrected['meta'] = $datetime;
$corrected['object'] = $schedule_date;
return $corrected;
}

/* reformat Datetime Pattern if leading with F */
if ($wordpress_date_time_format[0] == "F") {
$wordpress_date_time_format = "m/d/Y G:i";
$schedule_date = DateTime::createFromFormat(trim($wordpress_date_time_format) , trim($datetime));
$corrected['meta'] = $schedule_date->format( "d/m/Y G:i");
$corrected['object'] = $schedule_date;
}

/* reformat Datetime Pattern if leading with j */
if ($wordpress_date_time_format[0] == "j") {
$wordpress_date_time_format = "m/d/Y G:i";
$schedule_date = DateTime::createFromFormat(trim($wordpress_date_time_format) , trim($datetime));
$corrected['meta'] = $schedule_date->format( "m/d/Y G:i");
$corrected['object'] = $schedule_date;
}

return $corrected;

}

/**
* Changes the default placeholder text of wp_title when cta is being created. With CTAs, wp_title is a descriptive title.
*
Expand Down Expand Up @@ -2158,13 +2224,14 @@ public static function print_settings_class_JS() {
variation_id: jQuery('#open_variation').val()
},
dataType: 'html',
timeout: 20000,
timeout: 120000,
success: function (response) {
alert(response);
jQuery('.confirm').click();
},
error: function (request, status, err) {
//alert(status);
alert(error);
jQuery('.confirm').click();
}
});

Expand Down
10 changes: 10 additions & 0 deletions core/mailer/classes/class.post-type.inbound-email.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,16 @@ public static function check_if_scheduled_emails_sent() {
/* get correct format - d/m/Y date formats will fatal */
$wordpress_date_time_format = get_option('date_format') .' G:i';

/* reformat Datetime Pattern if leading with F */
if ($wordpress_date_time_format[0] == "F") {
$wordpress_date_time_format = "m/d/Y" .' G:i';
}

/* reformat Datetime Pattern if leading with j */
if ($wordpress_date_time_format[0] == "j") {
$wordpress_date_time_format = "d/m/Y" .' G:i';
}

/* add date if does not exist */
if(!$settings['send_datetime']) {
$settings['send_datetime'] = date_i18n('m/d/Y G:i');
Expand Down
15 changes: 12 additions & 3 deletions core/mailer/classes/class.scheduling.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,16 @@ public static function get_timestamp() {
/* get correct format - d/m/Y date formats will fatal */
$wordpress_date_time_format = get_option('date_format') .' G:i';

/* reformat Datetime Pattern if leading with F */
if ($wordpress_date_time_format[0] == "F") {
$wordpress_date_time_format = "m/d/Y" .' G:i';
}

/* reformat Datetime Pattern if leading with j */
if ($wordpress_date_time_format[0] == "j") {
$wordpress_date_time_format = "d/m/Y" .' G:i';
}

/* add date if does not exist */
if(!$settings['send_datetime']) {
$settings['send_datetime'] = date_i18n('m/d/Y G:i');
Expand All @@ -177,15 +187,14 @@ public static function get_timestamp() {

date_default_timezone_set($timezone);

/*
/**
error_log($wordpress_date_time_format);
error_log($settings['send_datetime']);
error_log(print_r(DateTime::getLastErrors() , true));
*/
/**/
switch ($email_service) {
case "sparkpost":
$schedule_date = DateTime::createFromFormat(trim($wordpress_date_time_format) , trim($settings['send_datetime']));

$timestamp = $schedule_date->format('Y-m-d\\TG:i:s\\Z');

break;
Expand Down
10 changes: 10 additions & 0 deletions core/mailer/classes/class.statistics.sparkpost.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ public static function get_sparkpost_inbound_events( $email_id , $variation_id =
/* get correct format - d/m/Y date formats will fatal */
$wordpress_date_time_format = get_option('date_format') .' G:i';

/* reformat Datetime Pattern if leading with F */
if ($wordpress_date_time_format[0] == "F") {
$wordpress_date_time_format = "m/d/Y" .' G:i';
}

/* reformat Datetime Pattern if leading with j */
if ($wordpress_date_time_format[0] == "j") {
$wordpress_date_time_format = "d/m/Y" .' G:i';
}

/* add date if does not exist */
if(!$settings['send_datetime']) {
$settings['send_datetime'] = date_i18n('m/d/Y G:i');
Expand Down
Loading

0 comments on commit 70e4c5e

Please sign in to comment.