Skip to content

Commit

Permalink
Merge branch 'PFWMA-116' into release
Browse files Browse the repository at this point in the history
# Conflicts:
#	admin/class-paypal-for-woocommerce-multi-account-management-admin.php
#	admin/css/paypal-for-woocommerce-multi-account-management-admin.css
  • Loading branch information
deepakmaurya committed Jun 7, 2020
2 parents 1f653a5 + 9138f28 commit 466819c
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,9 @@ public function angelleye_multi_account_settings_fields() {
$global_automatic_rule_creation_testmode = get_option('global_automatic_rule_creation_testmode', '');
$angelleye_payment_load_balancer = get_option('angelleye_payment_load_balancer', '');
?>
<div class="angelleye_multi_account_global_setting">

<div id="angelleye_paypal_marketing_table">
<div class="angelleye_multi_account_global_setting">
<form method="post" id="mainform" action="" enctype="multipart/form-data">
<table class="form-table">
<tr class="angelleye_payment_load_balancer_tr">
Expand Down Expand Up @@ -644,7 +646,9 @@ public function angelleye_multi_account_settings_fields() {
</table>
</form>
</div>
</div>
<?php
$this->angelleye_pfwma_display_marketing_sidebar();
}

public function angelleye_multi_account_tooltip_box() {
Expand Down Expand Up @@ -746,6 +750,7 @@ public function angelleye_multi_account_list() {
)
);
?>
<div id="angelleye_paypal_marketing_table">
<br>
<h1 class="wp-heading-inline"><?php echo __('Accounts', ''); ?></h1>
<a href="<?php echo esc_url(admin_url('admin.php?page=wc-settings&tab=multi_account_management&section=add_edit_account')); ?>" class="page-title-action"><?php echo __('Add New', 'paypal-for-woocommerce-multi-account-management'); ?></a>
Expand All @@ -764,6 +769,8 @@ public function angelleye_multi_account_list() {
$table->display();
echo '</form>';
}
?> </div> <?php
$this->angelleye_pfwma_display_marketing_sidebar();
}

public function angelleye_save_multi_account_data() {
Expand Down Expand Up @@ -2343,4 +2350,18 @@ public function own_update_angelleye_multi_account() {
delete_transient( 'angelleye_multi_payflow_payment_load_balancer_synce_sandbox' );
}

public function angelleye_pfwma_display_marketing_sidebar() {
if (false === ( $html = get_transient('angelleye_dynamic_marketing_sidebar_html_pfwma') )) {
$response = wp_remote_get('https://8aystwpoqi.execute-api.us-east-2.amazonaws.com/AngellEyeDynamicSidebar?pluginId=18');
if (is_array($response) && !is_wp_error($response)) {
if (!empty($response['body'])) {
set_transient('angelleye_dynamic_marketing_sidebar_html_pfwma', $response['body'], 24 * HOUR_IN_SECONDS);
echo $response['body'];
}
}
} else {
echo $html;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ select.smart_forwarding_field {
text-overflow: ellipsis;
}

#angelleye_paypal_marketing_table table.fixed {
border-right: none;
}

@media screen and (max-width: 782px) {
.angelleye_multi_account_left {
max-width: 100% !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,8 @@ protected function pagination( $which ) {
$this->screen->render_screen_reader_content( 'heading_pagination' );
}

$output = '<span class="displaying-num">' . sprintf( _n( '%s item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . '</span>';
$output = '';
//$output = '<span class="displaying-num">' . sprintf( _n( '%s item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . '</span>';

$current = $this->get_pagenum();
$removable_query_args = wp_removable_query_args();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ private function load_dependencies() {
require_once plugin_dir_path(dirname(__FILE__)) . 'admin/class-paypal-for-woocommerce-multi-account-management-admin-paypal-payflow.php';
require_once plugin_dir_path(dirname(__FILE__)) . 'admin/class-paypal-for-woocommerce-multi-account-management-admin-express-checkout.php';
//require_once plugin_dir_path(dirname(__FILE__)) . 'admin/class-paypal-for-woocommerce-multi-account-management-admin-paypal-standard.php';
require_once plugin_dir_path(dirname(__FILE__)) . '/template/sidebar-process.php';

$this->loader = new Paypal_For_Woocommerce_Multi_Account_Management_Loader();
}
Expand Down
64 changes: 64 additions & 0 deletions template/sidebar-process.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

defined('ABSPATH') or die('Direct access not allowed');

add_action('wp_ajax_angelleye_marketing_sendy_subscription', 'own_angelleye_marketing_sendy_subscription');

if (!function_exists('own_angelleye_marketing_sendy_subscription')) {

function own_angelleye_marketing_sendy_subscription() {
global $wp;
if (!empty($_SERVER['HTTP_REFERER'])) {
$current_url = $_SERVER['HTTP_REFERER'];
} else {
$current_url = home_url(add_query_arg(array(), $wp->request));
}
$url = 'https://sendy.angelleye.com/subscribe';
$response = wp_remote_post($url, array(
'method' => 'POST',
'timeout' => 45,
'redirection' => 5,
'httpversion' => '1.0',
'blocking' => true,
'headers' => array(),
'body' => array('list' => 'pjFolYKqSdLe57i4uuUz0g',
'boolean' => 'true',
'email' => $_POST['email'],
'gdpr' => 'true',
'silent' => 'true',
'api_key' => 'qFcoVlU2uG3AMYabNTrC',
'referrer' => $current_url
),
'cookies' => array()
)
);
if (is_wp_error($response)) {
wp_send_json(wp_remote_retrieve_body($response));
} else {
$body = wp_remote_retrieve_body($response);
$apiResponse = strval($body);
switch ($apiResponse) {
case 'true':
case '1':
prepareResponse("true", 'Thank you for subscribing!');
case 'Already subscribed.':
prepareResponse("true", 'Already subscribed!');
default:
prepareResponse("false", $apiResponse);
}
}
}

}

if (!function_exists('prepareResponse')) {

function prepareResponse($status = false, $msg = 'Something went wrong!') {
$return = array(
'result' => $status,
'message' => $msg
);
wp_send_json($return);
}

}

0 comments on commit 466819c

Please sign in to comment.