Version Description
- Fixed: Minor bug
Download this release
Release Info
Developer | webdorado |
Plugin | Image Optimizer by 10web – Image Optimizer and Compression plugin |
Version | 1.0.12 |
Comparing to | |
See all releases |
Code changes from version 1.0.10 to 1.0.12
- io-wd.php +4 -2
- iowd-rest.php +1 -0
- iowd_class.php +1 -1
- readme.txt +4 -1
- wd/config.php +5 -1
- wd/includes/deactivate.php +172 -172
- wd/includes/subscribe.php +1 -1
- wd/start.php +1 -0
io-wd.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Image Optimizer WD
|
5 |
* Plugin URI: https://10web.io/services/image-optimizer/
|
6 |
* Description: Image Optimizer WordPress plugin enables you to resize, compress and optimize PNG, JPG, GIF files while maintaining image quality.
|
7 |
-
* Version: 1.0.
|
8 |
* Author: WebDorado
|
9 |
* Author URI: https://web-dorado.com/
|
10 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
@@ -26,6 +26,7 @@ define('IOWD_PREFIX', "iowd");
|
|
26 |
//define( 'IOWD_API_URL', "http://local.web-dorado.info/IO_api/v1/" );
|
27 |
define('IOWD_API_URL', "https://optimizer.10web.io/api/");
|
28 |
|
|
|
29 |
setlocale(LC_ALL, 'en_US.UTF-8');
|
30 |
if (version_compare(phpversion(), "5.4", '>')) {
|
31 |
$uri = $_SERVER['REQUEST_URI'];
|
@@ -61,7 +62,8 @@ if (version_compare(phpversion(), "5.4", '>')) {
|
|
61 |
|
62 |
$iowd_plugin_options = array(
|
63 |
"prefix" => IOWD_PREFIX,
|
64 |
-
"
|
|
|
65 |
"plugin_title" => "Image Optimizer WD",
|
66 |
"plugin_wordpress_slug" => "image-optimizer-wd",
|
67 |
"plugin_dir" => IOWD_DIR,
|
4 |
* Plugin Name: Image Optimizer WD
|
5 |
* Plugin URI: https://10web.io/services/image-optimizer/
|
6 |
* Description: Image Optimizer WordPress plugin enables you to resize, compress and optimize PNG, JPG, GIF files while maintaining image quality.
|
7 |
+
* Version: 1.0.12
|
8 |
* Author: WebDorado
|
9 |
* Author URI: https://web-dorado.com/
|
10 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
26 |
//define( 'IOWD_API_URL', "http://local.web-dorado.info/IO_api/v1/" );
|
27 |
define('IOWD_API_URL', "https://optimizer.10web.io/api/");
|
28 |
|
29 |
+
|
30 |
setlocale(LC_ALL, 'en_US.UTF-8');
|
31 |
if (version_compare(phpversion(), "5.4", '>')) {
|
32 |
$uri = $_SERVER['REQUEST_URI'];
|
62 |
|
63 |
$iowd_plugin_options = array(
|
64 |
"prefix" => IOWD_PREFIX,
|
65 |
+
"plugin_id" => 69,
|
66 |
+
"wd_plugin_id" => 181,
|
67 |
"plugin_title" => "Image Optimizer WD",
|
68 |
"plugin_wordpress_slug" => "image-optimizer-wd",
|
69 |
"plugin_dir" => IOWD_DIR,
|
iowd-rest.php
CHANGED
@@ -95,6 +95,7 @@ class IOWD_Rest extends WP_REST_Controller
|
|
95 |
if (empty($received_images) === true) {
|
96 |
delete_site_transient("iowd_received_images_" . $post_id);
|
97 |
$post_ids = get_transient("iowd_optimizing_post_ids");
|
|
|
98 |
if (($key = array_search($post_id, $post_ids)) !== false) {
|
99 |
unset($post_ids[$key]);
|
100 |
set_transient("iowd_optimizing_post_ids", $post_ids);
|
95 |
if (empty($received_images) === true) {
|
96 |
delete_site_transient("iowd_received_images_" . $post_id);
|
97 |
$post_ids = get_transient("iowd_optimizing_post_ids");
|
98 |
+
$post_ids = $post_ids ? $post_ids : array();
|
99 |
if (($key = array_search($post_id, $post_ids)) !== false) {
|
100 |
unset($post_ids[$key]);
|
101 |
set_transient("iowd_optimizing_post_ids", $post_ids);
|
iowd_class.php
CHANGED
@@ -8,7 +8,7 @@ class IOWD
|
|
8 |
{
|
9 |
|
10 |
protected static $instance = null;
|
11 |
-
private static $version = '1.0.
|
12 |
private static $page;
|
13 |
private $reg_autoloader = false;
|
14 |
private $options = array();
|
8 |
{
|
9 |
|
10 |
protected static $instance = null;
|
11 |
+
private static $version = '1.0.12';
|
12 |
private static $page;
|
13 |
private $reg_autoloader = false;
|
14 |
private $options = array();
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: : compress, image, images optimization, performance, photos, lossless, opt
|
|
4 |
Requires at least: 3.9
|
5 |
Tested up to: 4.9
|
6 |
Requires PHP: 5.5
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -38,6 +38,9 @@ Upgrade to [Paid version](https://10web.io/services/image-optimizer/) to add fea
|
|
38 |
|
39 |
== Changelog ==
|
40 |
|
|
|
|
|
|
|
41 |
= 1.0.10 =
|
42 |
* Changed: Check php version
|
43 |
|
4 |
Requires at least: 3.9
|
5 |
Tested up to: 4.9
|
6 |
Requires PHP: 5.5
|
7 |
+
Stable tag: 1.0.12
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
38 |
|
39 |
== Changelog ==
|
40 |
|
41 |
+
= 1.0.12 =
|
42 |
+
* Fixed: Minor bug
|
43 |
+
|
44 |
= 1.0.10 =
|
45 |
* Changed: Check php version
|
46 |
|
wd/config.php
CHANGED
@@ -8,7 +8,8 @@
|
|
8 |
|
9 |
public $prefix = null;
|
10 |
public $wd_plugin_id = null;
|
11 |
-
public $
|
|
|
12 |
public $plugin_wordpress_slug = null;
|
13 |
public $plugin_dir = null;
|
14 |
public $plugin_main_file = null;
|
@@ -44,6 +45,9 @@
|
|
44 |
if(isset( $options["wd_plugin_id"] )) {
|
45 |
$this->wd_plugin_id = $options["wd_plugin_id"];
|
46 |
}
|
|
|
|
|
|
|
47 |
if(isset( $options["plugin_title"] )) {
|
48 |
$this->plugin_title = $options["plugin_title"];
|
49 |
}
|
8 |
|
9 |
public $prefix = null;
|
10 |
public $wd_plugin_id = null;
|
11 |
+
public $plugin_id = null;
|
12 |
+
public $plugin_title = null;
|
13 |
public $plugin_wordpress_slug = null;
|
14 |
public $plugin_dir = null;
|
15 |
public $plugin_main_file = null;
|
45 |
if(isset( $options["wd_plugin_id"] )) {
|
46 |
$this->wd_plugin_id = $options["wd_plugin_id"];
|
47 |
}
|
48 |
+
if(isset( $options["plugin_id"] )) {
|
49 |
+
$this->plugin_id = $options["plugin_id"];
|
50 |
+
}
|
51 |
if(isset( $options["plugin_title"] )) {
|
52 |
$this->plugin_title = $options["plugin_title"];
|
53 |
}
|
wd/includes/deactivate.php
CHANGED
@@ -1,180 +1,180 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
3 => array(
|
42 |
-
'id' => self::REASON_PRO_EXPENSIVE,
|
43 |
-
'text' => __( 'Premium is expensive', $wd_options->prefix ),
|
44 |
-
),
|
45 |
-
4 => array(
|
46 |
-
'id' => self::REASON_UPGRADING_TO_PAID_VERSION,
|
47 |
-
'text' => __( 'Upgrading to paid version', $wd_options->prefix ),
|
48 |
-
),
|
49 |
-
5 => array(
|
50 |
-
'id' => self::REASON_TEMPORARY_DEACTIVATION,
|
51 |
-
'text' => __( 'Temporary deactivation', $wd_options->prefix ),
|
52 |
-
),
|
53 |
-
);
|
54 |
-
|
55 |
-
add_action( 'admin_footer', array( $this, 'add_deactivation_feedback_dialog_box' ) );
|
56 |
-
add_action( 'admin_init', array( $this, 'submit_and_deactivate' ) );
|
57 |
-
|
58 |
-
|
59 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'scripts' ) );
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
|
64 |
-
}
|
65 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
66 |
-
// Public Methods //
|
67 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
68 |
-
public function add_deactivation_feedback_dialog_box(){
|
69 |
-
$deactivate_reasons = $this->deactivate_reasons;
|
70 |
-
$wd_options = $this->config;
|
71 |
-
|
72 |
-
?>
|
73 |
-
<script>
|
74 |
-
jQuery(document).ready(function () {
|
75 |
-
wdReady("<?php echo $wd_options->prefix; ?>");
|
76 |
-
});
|
77 |
-
</script>
|
78 |
-
<?php
|
79 |
-
|
80 |
-
$deactivate_url =
|
81 |
-
add_query_arg(
|
82 |
-
array(
|
83 |
-
'action' => 'deactivate',
|
84 |
-
'plugin' => plugin_basename( $wd_options->plugin_main_file ),
|
85 |
-
'_wpnonce' => wp_create_nonce( 'deactivate-plugin_' . plugin_basename( $wd_options->plugin_main_file ) )
|
86 |
-
),
|
87 |
-
admin_url( 'plugins.php' )
|
88 |
-
);
|
89 |
-
|
90 |
-
require ( $wd_options->wd_dir_templates . '/display_deactivation_popup.php' );
|
91 |
-
}
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
public function scripts(){
|
96 |
-
$wd_options = $this->config;
|
97 |
-
wp_enqueue_style( 'wd-deactivate-popup', $wd_options->wd_url_css . '/deactivate_popup.css', array(), get_option($wd_options->prefix . "_version" ) );
|
98 |
-
wp_enqueue_script( 'wd-deactivate-popup', $wd_options->wd_url_js . '/deactivate_popup.js', array(), get_option($wd_options->prefix . "_version" ));
|
99 |
-
|
100 |
-
$admin_data = wp_get_current_user();
|
101 |
-
wp_localize_script( 'wd-deactivate-popup', $wd_options->prefix . 'WDDeactivateVars' , array(
|
102 |
-
"prefix" => $wd_options->prefix ,
|
103 |
-
"deactivate_class" => $wd_options->prefix . '_deactivate_link',
|
104 |
-
"email" => $admin_data->data->user_email,
|
105 |
-
"plugin_wd_url" => $wd_options->plugin_wd_url,
|
106 |
-
));
|
107 |
-
|
108 |
-
|
109 |
-
}
|
110 |
-
public function submit_and_deactivate(){
|
111 |
-
$wd_options = $this->config;
|
112 |
-
if( isset( $_POST[$wd_options->prefix . "_submit_and_deactivate"] ) ){
|
113 |
-
|
114 |
-
if( $_POST[$wd_options->prefix . "_submit_and_deactivate"] == 2 || $_POST[$wd_options->prefix . "_submit_and_deactivate"] == 3 ){
|
115 |
-
$api = new TenWebApi( $wd_options );
|
116 |
-
$hash = $api->get_hash();
|
117 |
-
if($hash != null){
|
118 |
-
$data = array();
|
119 |
-
|
120 |
-
$data["reason"] = isset($_POST[$wd_options->prefix . "_reasons"]) ? $_POST[$wd_options->prefix . "_reasons"] : "";
|
121 |
-
$data["site_url"] = site_url();
|
122 |
-
$data["plugin_id"] = 181;
|
123 |
-
|
124 |
-
$data["additional_details"] = isset($_POST[$wd_options->prefix . "_additional_details"]) ? $_POST[$wd_options->prefix . "_additional_details"] : "";
|
125 |
-
$admin_data = wp_get_current_user();
|
126 |
-
$data["email"] = isset($_POST[$wd_options->prefix . "_email"]) ? $_POST[$wd_options->prefix . "_email"] : $admin_data->data->user_email;
|
127 |
-
$user_first_name = get_user_meta( $admin_data->ID, "first_name", true );
|
128 |
-
$user_last_name = get_user_meta( $admin_data->ID, "last_name", true );
|
129 |
-
|
130 |
-
$data["name"] = $user_first_name || $user_last_name ? $user_first_name . " " . $user_last_name : $admin_data->data->user_login;
|
131 |
-
$data["hash"] = $hash;
|
132 |
-
|
133 |
-
$response = wp_remote_post( "https://api.web-dorado.com/deactivatereasons", array(
|
134 |
-
'method' => 'POST',
|
135 |
-
'timeout' => 45,
|
136 |
-
'redirection' => 5,
|
137 |
-
'httpversion' => '1.0',
|
138 |
-
'blocking' => true,
|
139 |
-
'headers' => array(),
|
140 |
-
'body' => json_encode($data),
|
141 |
-
'cookies' => array()
|
142 |
-
)
|
143 |
-
);
|
144 |
-
|
145 |
-
$response_body = (!is_wp_error($response) && isset( $response["body"] )) ? json_decode( $response["body"], true ) : null;
|
146 |
-
if( is_array( $response_body ) && $response_body["body"]["msg"] == "Access" ) {
|
147 |
-
|
148 |
-
}
|
149 |
-
}
|
150 |
-
}
|
151 |
-
if($_POST[$wd_options->prefix . "_submit_and_deactivate"] == 2 || $_POST[$wd_options->prefix . "_submit_and_deactivate"] == 1 ){
|
152 |
-
$deactivate_url =
|
153 |
-
add_query_arg(
|
154 |
-
array(
|
155 |
-
'action' => 'deactivate',
|
156 |
-
'plugin' => plugin_basename( $wd_options->plugin_main_file ),
|
157 |
-
'_wpnonce' => wp_create_nonce( 'deactivate-plugin_' . plugin_basename( $wd_options->plugin_main_file ) )
|
158 |
-
),
|
159 |
-
admin_url( 'plugins.php' )
|
160 |
-
);
|
161 |
-
echo '<script>window.location.href="' . $deactivate_url . '";</script>';
|
162 |
-
}
|
163 |
-
|
164 |
-
}
|
165 |
-
}
|
166 |
-
|
167 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
168 |
-
// Getters & Setters //
|
169 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
170 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
171 |
-
// Private Methods //
|
172 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
173 |
-
|
174 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
175 |
-
// Listeners //
|
176 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
177 |
|
178 |
}
|
179 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
|
1 |
<?php
|
2 |
+
if (!defined('ABSPATH')) {
|
3 |
+
exit;
|
4 |
+
}
|
5 |
+
|
6 |
+
class TenWebDeactivate
|
7 |
+
{
|
8 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
9 |
+
// Events //
|
10 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
11 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
12 |
+
// Constants //
|
13 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
14 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
15 |
+
// Variables //
|
16 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
17 |
+
public $deactivate_reasons = array();
|
18 |
+
public $config;
|
19 |
+
// Reason IDs
|
20 |
+
const REASON_PLUGIN_IS_HARD_TO_USE_TECHNICAL_PROBLEMS = "reason_plugin_is_hard_to_use_technical_problems";
|
21 |
+
const REASON_FREE_VERSION_IS_LIMITED = "reason_free_version_limited";
|
22 |
+
const REASON_PRO_EXPENSIVE = "reason_premium_expensive";
|
23 |
+
const REASON_UPGRADING_TO_PAID_VERSION = "reason_upgrading_to_paid_version";
|
24 |
+
const REASON_TEMPORARY_DEACTIVATION = "reason_temporary_deactivation";
|
25 |
+
|
26 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
27 |
+
// Constructor & Destructor //
|
28 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
29 |
+
public function __construct($config = array())
|
30 |
+
{
|
31 |
+
$this->config = $config;
|
32 |
+
$wd_options = $this->config;
|
33 |
+
|
34 |
+
$this->deactivate_reasons = array(
|
35 |
+
1 => array(
|
36 |
+
'id' => self::REASON_PLUGIN_IS_HARD_TO_USE_TECHNICAL_PROBLEMS,
|
37 |
+
'text' => __('Technical problems / hard to use', $wd_options->prefix),
|
38 |
+
),
|
39 |
+
2 => array(
|
40 |
+
'id' => self::REASON_FREE_VERSION_IS_LIMITED,
|
41 |
+
'text' => __('Free version is limited', $wd_options->prefix),
|
42 |
+
),
|
43 |
+
3 => array(
|
44 |
+
'id' => self::REASON_PRO_EXPENSIVE,
|
45 |
+
'text' => __('Premium is expensive', $wd_options->prefix),
|
46 |
+
),
|
47 |
+
4 => array(
|
48 |
+
'id' => self::REASON_UPGRADING_TO_PAID_VERSION,
|
49 |
+
'text' => __('Upgrading to paid version', $wd_options->prefix),
|
50 |
+
),
|
51 |
+
5 => array(
|
52 |
+
'id' => self::REASON_TEMPORARY_DEACTIVATION,
|
53 |
+
'text' => __('Temporary deactivation', $wd_options->prefix),
|
54 |
+
),
|
55 |
+
);
|
56 |
+
|
57 |
+
add_action('admin_footer', array($this, 'add_deactivation_feedback_dialog_box'));
|
58 |
+
add_action('admin_init', array($this, 'submit_and_deactivate'));
|
59 |
+
|
60 |
+
|
61 |
+
add_action('admin_enqueue_scripts', array($this, 'scripts'));
|
62 |
+
|
63 |
+
|
64 |
}
|
65 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
66 |
+
// Public Methods //
|
67 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
68 |
+
public function add_deactivation_feedback_dialog_box()
|
69 |
+
{
|
70 |
+
$deactivate_reasons = $this->deactivate_reasons;
|
71 |
+
$wd_options = $this->config;
|
72 |
|
73 |
+
?>
|
74 |
+
<script>
|
75 |
+
jQuery(document).ready(function () {
|
76 |
+
wdReady("<?php echo $wd_options->prefix; ?>");
|
77 |
+
});
|
78 |
+
</script>
|
79 |
+
<?php
|
80 |
+
|
81 |
+
$deactivate_url =
|
82 |
+
add_query_arg(
|
83 |
+
array(
|
84 |
+
'action' => 'deactivate',
|
85 |
+
'plugin' => plugin_basename($wd_options->plugin_main_file),
|
86 |
+
'_wpnonce' => wp_create_nonce('deactivate-plugin_' . plugin_basename($wd_options->plugin_main_file))
|
87 |
+
),
|
88 |
+
admin_url('plugins.php')
|
89 |
+
);
|
90 |
+
|
91 |
+
require($wd_options->wd_dir_templates . '/display_deactivation_popup.php');
|
92 |
+
}
|
93 |
+
|
94 |
+
|
95 |
+
public function scripts()
|
96 |
+
{
|
97 |
+
$wd_options = $this->config;
|
98 |
+
wp_enqueue_style('wd-deactivate-popup', $wd_options->wd_url_css . '/deactivate_popup.css', array(), get_option($wd_options->prefix . "_version"));
|
99 |
+
wp_enqueue_script('wd-deactivate-popup', $wd_options->wd_url_js . '/deactivate_popup.js', array(), get_option($wd_options->prefix . "_version"));
|
100 |
+
|
101 |
+
$admin_data = wp_get_current_user();
|
102 |
+
wp_localize_script('wd-deactivate-popup', $wd_options->prefix . 'WDDeactivateVars', array(
|
103 |
+
"prefix" => $wd_options->prefix,
|
104 |
+
"deactivate_class" => $wd_options->prefix . '_deactivate_link',
|
105 |
+
"email" => $admin_data->data->user_email,
|
106 |
+
"plugin_wd_url" => $wd_options->plugin_wd_url,
|
107 |
+
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
}
|
111 |
|
112 |
+
public function submit_and_deactivate()
|
113 |
+
{
|
114 |
+
$wd_options = $this->config;
|
115 |
+
if (isset($_POST[$wd_options->prefix . "_submit_and_deactivate"])) {
|
116 |
+
|
117 |
+
if ($_POST[$wd_options->prefix . "_submit_and_deactivate"] == 2 || $_POST[$wd_options->prefix . "_submit_and_deactivate"] == 3) {
|
118 |
+
//$api = new TenWebApi( $wd_options );
|
119 |
+
|
120 |
+
$data = array();
|
121 |
+
$data["reason"] = isset($_POST[$wd_options->prefix . "_reasons"]) ? $_POST[$wd_options->prefix . "_reasons"] : "";
|
122 |
+
$data["site_url"] = site_url();
|
123 |
+
$data["product_id"] = $wd_options->plugin_id;
|
124 |
+
|
125 |
+
$data["additional_details"] = isset($_POST[$wd_options->prefix . "_additional_details"]) ? $_POST[$wd_options->prefix . "_additional_details"] : "";
|
126 |
+
$admin_data = wp_get_current_user();
|
127 |
+
$data["email"] = isset($_POST[$wd_options->prefix . "_email"]) ? $_POST[$wd_options->prefix . "_email"] : $admin_data->data->user_email;
|
128 |
+
$user_first_name = get_user_meta($admin_data->ID, "first_name", true);
|
129 |
+
$user_last_name = get_user_meta($admin_data->ID, "last_name", true);
|
130 |
+
|
131 |
+
$data["name"] = $user_first_name || $user_last_name ? $user_first_name . " " . $user_last_name : $admin_data->data->user_login;
|
132 |
+
|
133 |
+
$response = wp_remote_post(TEN_WEB_DEACTIVATION_URL, array(
|
134 |
+
'method' => 'POST',
|
135 |
+
'timeout' => 45,
|
136 |
+
'redirection' => 5,
|
137 |
+
'httpversion' => '1.0',
|
138 |
+
'blocking' => true,
|
139 |
+
'headers' => array("Accept" => "application/x.10webcore.v1+json"),
|
140 |
+
'body' => $data,
|
141 |
+
'cookies' => array()
|
142 |
+
)
|
143 |
+
);
|
144 |
+
|
145 |
+
$response_body = (!is_wp_error($response) && isset($response["body"])) ? json_decode($response["body"], true) : null;
|
146 |
+
if (is_array($response_body) && $response_body["status"] == "ok") {
|
147 |
+
|
148 |
+
}
|
149 |
+
|
150 |
+
}
|
151 |
+
if ($_POST[$wd_options->prefix . "_submit_and_deactivate"] == 2 || $_POST[$wd_options->prefix . "_submit_and_deactivate"] == 1) {
|
152 |
+
$deactivate_url =
|
153 |
+
add_query_arg(
|
154 |
+
array(
|
155 |
+
'action' => 'deactivate',
|
156 |
+
'plugin' => plugin_basename($wd_options->plugin_main_file),
|
157 |
+
'_wpnonce' => wp_create_nonce('deactivate-plugin_' . plugin_basename($wd_options->plugin_main_file))
|
158 |
+
),
|
159 |
+
admin_url('plugins.php')
|
160 |
+
);
|
161 |
+
echo '<script>window.location.href="' . $deactivate_url . '";</script>';
|
162 |
+
}
|
163 |
+
|
164 |
+
}
|
165 |
+
}
|
166 |
+
|
167 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
168 |
+
// Getters & Setters //
|
169 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
170 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
171 |
+
// Private Methods //
|
172 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
173 |
+
|
174 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
175 |
+
// Listeners //
|
176 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
177 |
+
|
178 |
+
}
|
179 |
+
|
180 |
|
wd/includes/subscribe.php
CHANGED
@@ -79,7 +79,7 @@ class TenWebSubscribe
|
|
79 |
|
80 |
$data["email"] = $admin_data->data->user_email;
|
81 |
$data["wp_version"] = get_bloginfo('version');
|
82 |
-
$data["product_id"] = $wd_options->
|
83 |
$data["all_plugins"] = json_encode($all_plugins);
|
84 |
|
85 |
|
79 |
|
80 |
$data["email"] = $admin_data->data->user_email;
|
81 |
$data["wp_version"] = get_bloginfo('version');
|
82 |
+
$data["product_id"] = $wd_options->plugin_id;
|
83 |
$data["all_plugins"] = json_encode($all_plugins);
|
84 |
|
85 |
|
wd/start.php
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
}
|
5 |
define( 'TEN_WEB_API_PLUGIN_DATA_PATH', 'https://api.web-dorado.com/v2/_id_/plugindata' );
|
6 |
define( 'TEN_WEB_SUBSCRIBE_URL', 'https://core.10web.io/api/wp-subscribe' );
|
|
|
7 |
|
8 |
require_once dirname( __FILE__ ) . '/config.php';
|
9 |
|
4 |
}
|
5 |
define( 'TEN_WEB_API_PLUGIN_DATA_PATH', 'https://api.web-dorado.com/v2/_id_/plugindata' );
|
6 |
define( 'TEN_WEB_SUBSCRIBE_URL', 'https://core.10web.io/api/wp-subscribe' );
|
7 |
+
define( 'TEN_WEB_DEACTIVATION_URL', 'https://core.10web.io/api/deactivation_reasons' );
|
8 |
|
9 |
require_once dirname( __FILE__ ) . '/config.php';
|
10 |
|