@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * @deprecated |
247 | 247 | */ |
248 | 248 | function wpinv_get_payment_key( $invoice = 0 ) { |
249 | - $invoice = new WPInv_Invoice( $invoice ); |
|
249 | + $invoice = new WPInv_Invoice( $invoice ); |
|
250 | 250 | return $invoice->get_key(); |
251 | 251 | } |
252 | 252 | |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * @deprecated |
425 | 425 | */ |
426 | 426 | function wpinv_get_checkout_session() { |
427 | - return false; |
|
427 | + return false; |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | /** |
@@ -1273,5 +1273,5 @@ discard block |
||
1273 | 1273 | * @deprecated |
1274 | 1274 | */ |
1275 | 1275 | function wpinv_get_subscription( $invoice ) { |
1276 | - return wpinv_get_invoice_subscription( $invoice ); |
|
1276 | + return wpinv_get_invoice_subscription( $invoice ); |
|
1277 | 1277 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | if ( ! defined( 'ABSPATH' ) ) { |
9 | - exit; // Exit if accessed directly |
|
9 | + exit; // Exit if accessed directly |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | /** |
@@ -15,10 +15,10 @@ discard block |
||
15 | 15 | class GetPaid_Meta_Box_Invoice_Subscription { |
16 | 16 | |
17 | 17 | /** |
18 | - * Output the subscription metabox. |
|
19 | - * |
|
20 | - * @param WP_Post $post |
|
21 | - */ |
|
18 | + * Output the subscription metabox. |
|
19 | + * |
|
20 | + * @param WP_Post $post |
|
21 | + */ |
|
22 | 22 | public static function output( $post ) { |
23 | 23 | |
24 | 24 | // Fetch the invoice. |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
37 | - * Output the subscription invoices. |
|
38 | - * |
|
39 | - * @param WP_Post $post |
|
40 | - */ |
|
37 | + * Output the subscription invoices. |
|
38 | + * |
|
39 | + * @param WP_Post $post |
|
40 | + */ |
|
41 | 41 | public static function output_invoices( $post ) { |
42 | 42 | |
43 | 43 | // Fetch the invoice. |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
56 | - * Outputs related subscriptions. |
|
57 | - * |
|
58 | - * @param WP_Post $post |
|
59 | - */ |
|
56 | + * Outputs related subscriptions. |
|
57 | + * |
|
58 | + * @param WP_Post $post |
|
59 | + */ |
|
60 | 60 | public static function output_related( $post ) { |
61 | 61 | |
62 | 62 | // Fetch the invoice. |
@@ -239,7 +239,7 @@ |
||
239 | 239 | do_action( 'getpaid_checkout_invoice_exception', $invoice ); |
240 | 240 | } |
241 | 241 | |
242 | - // Do we have any errors? |
|
242 | + // Do we have any errors? |
|
243 | 243 | if ( wpinv_get_errors() ) { |
244 | 244 | $response['data'] = getpaid_get_errors_html( true, false ); |
245 | 245 | } else { |
@@ -16,165 +16,165 @@ |
||
16 | 16 | */ |
17 | 17 | class GetPaid_MaxMind_Geolocation { |
18 | 18 | |
19 | - /** |
|
20 | - * The service responsible for interacting with the MaxMind database. |
|
21 | - * |
|
22 | - * @var GetPaid_MaxMind_Database_Service |
|
23 | - */ |
|
24 | - private $database_service; |
|
25 | - |
|
26 | - /** |
|
27 | - * Initialize the integration. |
|
28 | - */ |
|
29 | - public function __construct() { |
|
30 | - |
|
31 | - /** |
|
32 | - * Supports overriding the database service to be used. |
|
33 | - * |
|
34 | - * @since 1.0.19 |
|
35 | - * @return mixed|null The geolocation database service. |
|
36 | - */ |
|
37 | - $this->database_service = apply_filters( 'getpaid_maxmind_geolocation_database_service', null ); |
|
38 | - if ( null === $this->database_service ) { |
|
39 | - $this->database_service = new GetPaid_MaxMind_Database_Service( $this->get_database_prefix() ); |
|
40 | - } |
|
41 | - |
|
42 | - // Bind to the scheduled updater action. |
|
43 | - add_action( 'getpaid_update_geoip_databases', array( $this, 'update_database' ) ); |
|
44 | - |
|
45 | - // Bind to the geolocation filter for MaxMind database lookups. |
|
46 | - add_filter( 'getpaid_get_geolocation', array( $this, 'get_geolocation' ), 10, 2 ); |
|
47 | - |
|
48 | - // Handle maxmind key updates. |
|
49 | - add_filter( 'wpinv_settings_sanitize_maxmind_license_key', array( $this, 'handle_key_updates' ) ); |
|
50 | - |
|
51 | - } |
|
52 | - |
|
53 | - /** |
|
54 | - * Get database service. |
|
55 | - * |
|
56 | - * @return GetPaid_MaxMind_Database_Service|null |
|
57 | - */ |
|
58 | - public function get_database_service() { |
|
59 | - return $this->database_service; |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * Checks to make sure that the license key is valid. |
|
64 | - * |
|
65 | - * @param string $license_key The new license key. |
|
66 | - * @return string |
|
67 | - */ |
|
68 | - public function handle_key_updates( $license_key ) { |
|
69 | - |
|
70 | - // Trim whitespaces and strip slashes. |
|
71 | - $license_key = trim( $license_key ); |
|
72 | - |
|
73 | - // Abort if the license key is empty or unchanged. |
|
74 | - if ( empty( $license_key ) ) { |
|
75 | - return $license_key; |
|
76 | - } |
|
77 | - |
|
78 | - // Abort if a database exists and the license key is unchaged. |
|
79 | - if ( file_exists( $this->database_service->get_database_path() && $license_key == wpinv_get_option( 'maxmind_license_key' ) ) ) { |
|
80 | - return $license_key; |
|
81 | - } |
|
82 | - |
|
83 | - // Check the license key by attempting to download the Geolocation database. |
|
84 | - $tmp_database_path = $this->database_service->download_database( $license_key ); |
|
85 | - if ( is_wp_error( $tmp_database_path ) ) { |
|
86 | - getpaid_admin()->show_error( $tmp_database_path->get_error_message() ); |
|
87 | - return $license_key; |
|
88 | - } |
|
89 | - |
|
90 | - $this->update_database( /** @scrutinizer ignore-type */ $tmp_database_path ); |
|
91 | - |
|
92 | - return $license_key; |
|
93 | - } |
|
94 | - |
|
95 | - /** |
|
96 | - * Updates the database used for geolocation queries. |
|
97 | - * |
|
98 | - * @param string $tmp_database_path Temporary database path. |
|
99 | - */ |
|
100 | - public function update_database( $tmp_database_path = null ) { |
|
101 | - |
|
102 | - // Allow us to easily interact with the filesystem. |
|
103 | - require_once ABSPATH . 'wp-admin/includes/file.php'; |
|
104 | - WP_Filesystem(); |
|
105 | - global $wp_filesystem; |
|
106 | - |
|
107 | - // Remove any existing archives to comply with the MaxMind TOS. |
|
108 | - $target_database_path = $this->database_service->get_database_path(); |
|
109 | - |
|
110 | - // If there's no database path, we can't store the database. |
|
111 | - if ( empty( $target_database_path ) ) { |
|
112 | - return; |
|
113 | - } |
|
114 | - |
|
115 | - if ( $wp_filesystem->exists( $target_database_path ) ) { |
|
116 | - $wp_filesystem->delete( $target_database_path ); |
|
117 | - } |
|
118 | - |
|
119 | - // We can't download a database if there's no license key configured. |
|
120 | - $license_key = wpinv_get_option( 'maxmind_license_key' ); |
|
121 | - if ( empty( $license_key ) ) { |
|
122 | - return; |
|
123 | - } |
|
124 | - |
|
125 | - if ( empty( $tmp_database_path ) ) { |
|
126 | - $tmp_database_path = $this->database_service->download_database( $license_key ); |
|
127 | - } |
|
128 | - |
|
129 | - if ( is_wp_error( $tmp_database_path ) ) { |
|
130 | - wpinv_error_log( $tmp_database_path->get_error_message() ); |
|
131 | - return; |
|
132 | - } |
|
133 | - |
|
134 | - // Move the new database into position. |
|
135 | - $wp_filesystem->move( $tmp_database_path, $target_database_path, true ); |
|
136 | - $wp_filesystem->delete( dirname( $tmp_database_path ) ); |
|
137 | - } |
|
138 | - |
|
139 | - /** |
|
140 | - * Performs a geolocation lookup against the MaxMind database for the given IP address. |
|
141 | - * |
|
142 | - * @param array $data Geolocation data. |
|
143 | - * @param string $ip_address The IP address to geolocate. |
|
144 | - * @return array Geolocation including country code, state, city and postcode based on an IP address. |
|
145 | - */ |
|
146 | - public function get_geolocation( $data, $ip_address ) { |
|
147 | - |
|
148 | - if ( ! empty( $data['country'] ) || empty( $ip_address ) ) { |
|
149 | - return $data; |
|
150 | - } |
|
151 | - |
|
152 | - $country_code = $this->database_service->get_iso_country_code_for_ip( $ip_address ); |
|
153 | - |
|
154 | - return array( |
|
155 | - 'country' => $country_code, |
|
156 | - 'state' => '', |
|
157 | - 'city' => '', |
|
158 | - 'postcode' => '', |
|
159 | - ); |
|
160 | - |
|
161 | - } |
|
162 | - |
|
163 | - /** |
|
164 | - * Fetches the prefix for the MaxMind database file. |
|
165 | - * |
|
166 | - * @return string |
|
167 | - */ |
|
168 | - private function get_database_prefix() { |
|
169 | - |
|
170 | - $prefix = get_option( 'wpinv_maxmind_database_prefix' ); |
|
171 | - |
|
172 | - if ( empty( $prefix ) ) { |
|
173 | - $prefix = md5( uniqid( 'wpinv' ) ); |
|
174 | - update_option( 'wpinv_maxmind_database_prefix', $prefix ); |
|
175 | - } |
|
176 | - |
|
177 | - return $prefix; |
|
178 | - } |
|
19 | + /** |
|
20 | + * The service responsible for interacting with the MaxMind database. |
|
21 | + * |
|
22 | + * @var GetPaid_MaxMind_Database_Service |
|
23 | + */ |
|
24 | + private $database_service; |
|
25 | + |
|
26 | + /** |
|
27 | + * Initialize the integration. |
|
28 | + */ |
|
29 | + public function __construct() { |
|
30 | + |
|
31 | + /** |
|
32 | + * Supports overriding the database service to be used. |
|
33 | + * |
|
34 | + * @since 1.0.19 |
|
35 | + * @return mixed|null The geolocation database service. |
|
36 | + */ |
|
37 | + $this->database_service = apply_filters( 'getpaid_maxmind_geolocation_database_service', null ); |
|
38 | + if ( null === $this->database_service ) { |
|
39 | + $this->database_service = new GetPaid_MaxMind_Database_Service( $this->get_database_prefix() ); |
|
40 | + } |
|
41 | + |
|
42 | + // Bind to the scheduled updater action. |
|
43 | + add_action( 'getpaid_update_geoip_databases', array( $this, 'update_database' ) ); |
|
44 | + |
|
45 | + // Bind to the geolocation filter for MaxMind database lookups. |
|
46 | + add_filter( 'getpaid_get_geolocation', array( $this, 'get_geolocation' ), 10, 2 ); |
|
47 | + |
|
48 | + // Handle maxmind key updates. |
|
49 | + add_filter( 'wpinv_settings_sanitize_maxmind_license_key', array( $this, 'handle_key_updates' ) ); |
|
50 | + |
|
51 | + } |
|
52 | + |
|
53 | + /** |
|
54 | + * Get database service. |
|
55 | + * |
|
56 | + * @return GetPaid_MaxMind_Database_Service|null |
|
57 | + */ |
|
58 | + public function get_database_service() { |
|
59 | + return $this->database_service; |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * Checks to make sure that the license key is valid. |
|
64 | + * |
|
65 | + * @param string $license_key The new license key. |
|
66 | + * @return string |
|
67 | + */ |
|
68 | + public function handle_key_updates( $license_key ) { |
|
69 | + |
|
70 | + // Trim whitespaces and strip slashes. |
|
71 | + $license_key = trim( $license_key ); |
|
72 | + |
|
73 | + // Abort if the license key is empty or unchanged. |
|
74 | + if ( empty( $license_key ) ) { |
|
75 | + return $license_key; |
|
76 | + } |
|
77 | + |
|
78 | + // Abort if a database exists and the license key is unchaged. |
|
79 | + if ( file_exists( $this->database_service->get_database_path() && $license_key == wpinv_get_option( 'maxmind_license_key' ) ) ) { |
|
80 | + return $license_key; |
|
81 | + } |
|
82 | + |
|
83 | + // Check the license key by attempting to download the Geolocation database. |
|
84 | + $tmp_database_path = $this->database_service->download_database( $license_key ); |
|
85 | + if ( is_wp_error( $tmp_database_path ) ) { |
|
86 | + getpaid_admin()->show_error( $tmp_database_path->get_error_message() ); |
|
87 | + return $license_key; |
|
88 | + } |
|
89 | + |
|
90 | + $this->update_database( /** @scrutinizer ignore-type */ $tmp_database_path ); |
|
91 | + |
|
92 | + return $license_key; |
|
93 | + } |
|
94 | + |
|
95 | + /** |
|
96 | + * Updates the database used for geolocation queries. |
|
97 | + * |
|
98 | + * @param string $tmp_database_path Temporary database path. |
|
99 | + */ |
|
100 | + public function update_database( $tmp_database_path = null ) { |
|
101 | + |
|
102 | + // Allow us to easily interact with the filesystem. |
|
103 | + require_once ABSPATH . 'wp-admin/includes/file.php'; |
|
104 | + WP_Filesystem(); |
|
105 | + global $wp_filesystem; |
|
106 | + |
|
107 | + // Remove any existing archives to comply with the MaxMind TOS. |
|
108 | + $target_database_path = $this->database_service->get_database_path(); |
|
109 | + |
|
110 | + // If there's no database path, we can't store the database. |
|
111 | + if ( empty( $target_database_path ) ) { |
|
112 | + return; |
|
113 | + } |
|
114 | + |
|
115 | + if ( $wp_filesystem->exists( $target_database_path ) ) { |
|
116 | + $wp_filesystem->delete( $target_database_path ); |
|
117 | + } |
|
118 | + |
|
119 | + // We can't download a database if there's no license key configured. |
|
120 | + $license_key = wpinv_get_option( 'maxmind_license_key' ); |
|
121 | + if ( empty( $license_key ) ) { |
|
122 | + return; |
|
123 | + } |
|
124 | + |
|
125 | + if ( empty( $tmp_database_path ) ) { |
|
126 | + $tmp_database_path = $this->database_service->download_database( $license_key ); |
|
127 | + } |
|
128 | + |
|
129 | + if ( is_wp_error( $tmp_database_path ) ) { |
|
130 | + wpinv_error_log( $tmp_database_path->get_error_message() ); |
|
131 | + return; |
|
132 | + } |
|
133 | + |
|
134 | + // Move the new database into position. |
|
135 | + $wp_filesystem->move( $tmp_database_path, $target_database_path, true ); |
|
136 | + $wp_filesystem->delete( dirname( $tmp_database_path ) ); |
|
137 | + } |
|
138 | + |
|
139 | + /** |
|
140 | + * Performs a geolocation lookup against the MaxMind database for the given IP address. |
|
141 | + * |
|
142 | + * @param array $data Geolocation data. |
|
143 | + * @param string $ip_address The IP address to geolocate. |
|
144 | + * @return array Geolocation including country code, state, city and postcode based on an IP address. |
|
145 | + */ |
|
146 | + public function get_geolocation( $data, $ip_address ) { |
|
147 | + |
|
148 | + if ( ! empty( $data['country'] ) || empty( $ip_address ) ) { |
|
149 | + return $data; |
|
150 | + } |
|
151 | + |
|
152 | + $country_code = $this->database_service->get_iso_country_code_for_ip( $ip_address ); |
|
153 | + |
|
154 | + return array( |
|
155 | + 'country' => $country_code, |
|
156 | + 'state' => '', |
|
157 | + 'city' => '', |
|
158 | + 'postcode' => '', |
|
159 | + ); |
|
160 | + |
|
161 | + } |
|
162 | + |
|
163 | + /** |
|
164 | + * Fetches the prefix for the MaxMind database file. |
|
165 | + * |
|
166 | + * @return string |
|
167 | + */ |
|
168 | + private function get_database_prefix() { |
|
169 | + |
|
170 | + $prefix = get_option( 'wpinv_maxmind_database_prefix' ); |
|
171 | + |
|
172 | + if ( empty( $prefix ) ) { |
|
173 | + $prefix = md5( uniqid( 'wpinv' ) ); |
|
174 | + update_option( 'wpinv_maxmind_database_prefix', $prefix ); |
|
175 | + } |
|
176 | + |
|
177 | + return $prefix; |
|
178 | + } |
|
179 | 179 | |
180 | 180 | } |
@@ -20,13 +20,13 @@ |
||
20 | 20 | <title><?php esc_html_e( 'GetPaid › Setup Wizard', 'invoicing' ); ?></title> |
21 | 21 | <?php |
22 | 22 | getpaid_admin()->enqeue_scripts(); |
23 | - wp_enqueue_style( 'font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array(), 'v5.13.0' ); |
|
24 | - wp_print_styles( 'select2' ); |
|
23 | + wp_enqueue_style( 'font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array(), 'v5.13.0' ); |
|
24 | + wp_print_styles( 'select2' ); |
|
25 | 25 | wp_print_scripts( 'select2' ); |
26 | - wp_print_scripts( 'wpinv-admin-script' ); |
|
26 | + wp_print_scripts( 'wpinv-admin-script' ); |
|
27 | 27 | do_action( 'admin_print_styles' ); |
28 | 28 | do_action( 'admin_head' ); |
29 | - ?> |
|
29 | + ?> |
|
30 | 30 | <style> |
31 | 31 | body, p{ |
32 | 32 | font-size: 16px; |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
11 | - exit; // Exit if accessed directly |
|
11 | + exit; // Exit if accessed directly |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | /** |
@@ -319,10 +319,10 @@ discard block |
||
319 | 319 | } |
320 | 320 | |
321 | 321 | /** |
322 | - * Output the metabox. |
|
323 | - * |
|
324 | - * @param WP_Post $post |
|
325 | - */ |
|
322 | + * Output the metabox. |
|
323 | + * |
|
324 | + * @param WP_Post $post |
|
325 | + */ |
|
326 | 326 | public static function output2( $post ) { |
327 | 327 | |
328 | 328 | // Prepare the invoice. |
@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | */ |
16 | 16 | |
17 | 17 | if ( ! defined( 'ABSPATH' ) ) { |
18 | - exit; |
|
18 | + exit; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | if ( ! class_exists( 'AyeCode_Deactivation_Survey' ) ) { |
22 | - // include the class if needed |
|
23 | - include_once( dirname( __FILE__ ) . "/wp-deactivation-survey.php" ); |
|
22 | + // include the class if needed |
|
23 | + include_once( dirname( __FILE__ ) . "/wp-deactivation-survey.php" ); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
@@ -36,6 +36,6 @@ discard block |
||
36 | 36 | //}); |
37 | 37 | |
38 | 38 | AyeCode_Deactivation_Survey::instance(array( |
39 | - 'slug' => 'ayecode-deactivation-survey-testing', |
|
40 | - 'version' => '1.0.0' |
|
39 | + 'slug' => 'ayecode-deactivation-survey-testing', |
|
40 | + 'version' => '1.0.0' |
|
41 | 41 | )); |
42 | 42 | \ No newline at end of file |
@@ -11,18 +11,18 @@ discard block |
||
11 | 11 | * @return mixed|void |
12 | 12 | */ |
13 | 13 | function sd_pagenow_exclude(){ |
14 | - return apply_filters( 'sd_pagenow_exclude', array( |
|
15 | - 'upload.php', |
|
16 | - 'edit-comments.php', |
|
17 | - 'edit-tags.php', |
|
18 | - 'index.php', |
|
19 | - 'media-new.php', |
|
20 | - 'options-discussion.php', |
|
21 | - 'options-writing.php', |
|
22 | - 'edit.php', |
|
23 | - 'themes.php', |
|
24 | - 'users.php', |
|
25 | - ) ); |
|
14 | + return apply_filters( 'sd_pagenow_exclude', array( |
|
15 | + 'upload.php', |
|
16 | + 'edit-comments.php', |
|
17 | + 'edit-tags.php', |
|
18 | + 'index.php', |
|
19 | + 'media-new.php', |
|
20 | + 'options-discussion.php', |
|
21 | + 'options-writing.php', |
|
22 | + 'edit.php', |
|
23 | + 'themes.php', |
|
24 | + 'users.php', |
|
25 | + ) ); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | |
@@ -34,5 +34,5 @@ discard block |
||
34 | 34 | * @return mixed|void |
35 | 35 | */ |
36 | 36 | function sd_widget_exclude(){ |
37 | - return apply_filters( 'sd_widget_exclude', array() ); |
|
37 | + return apply_filters( 'sd_widget_exclude', array() ); |
|
38 | 38 | } |
39 | 39 | \ No newline at end of file |
@@ -1,103 +1,103 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | if ( ! defined( 'ABSPATH' ) ) { |
4 | - exit; |
|
4 | + exit; |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | if ( ! class_exists( 'AyeCode_Deactivation_Survey' ) ) { |
8 | 8 | |
9 | - class AyeCode_Deactivation_Survey { |
|
9 | + class AyeCode_Deactivation_Survey { |
|
10 | 10 | |
11 | - /** |
|
12 | - * AyeCode_Deactivation_Survey instance. |
|
13 | - * |
|
14 | - * @access private |
|
15 | - * @since 1.0.0 |
|
16 | - * @var AyeCode_Deactivation_Survey There can be only one! |
|
17 | - */ |
|
18 | - private static $instance = null; |
|
11 | + /** |
|
12 | + * AyeCode_Deactivation_Survey instance. |
|
13 | + * |
|
14 | + * @access private |
|
15 | + * @since 1.0.0 |
|
16 | + * @var AyeCode_Deactivation_Survey There can be only one! |
|
17 | + */ |
|
18 | + private static $instance = null; |
|
19 | 19 | |
20 | - public static $plugins; |
|
20 | + public static $plugins; |
|
21 | 21 | |
22 | - public $version = "1.0.4"; |
|
22 | + public $version = "1.0.4"; |
|
23 | 23 | |
24 | - public static function instance( $plugin = array() ) { |
|
25 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_Deactivation_Survey ) ) { |
|
26 | - self::$instance = new AyeCode_Deactivation_Survey; |
|
27 | - self::$plugins = array(); |
|
24 | + public static function instance( $plugin = array() ) { |
|
25 | + if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_Deactivation_Survey ) ) { |
|
26 | + self::$instance = new AyeCode_Deactivation_Survey; |
|
27 | + self::$plugins = array(); |
|
28 | 28 | |
29 | - add_action( 'admin_enqueue_scripts', array( self::$instance, 'scripts' ) ); |
|
29 | + add_action( 'admin_enqueue_scripts', array( self::$instance, 'scripts' ) ); |
|
30 | 30 | |
31 | - do_action( 'ayecode_deactivation_survey_loaded' ); |
|
32 | - } |
|
31 | + do_action( 'ayecode_deactivation_survey_loaded' ); |
|
32 | + } |
|
33 | 33 | |
34 | - if(!empty($plugin)){ |
|
35 | - self::$plugins[] = (object)$plugin; |
|
36 | - } |
|
34 | + if(!empty($plugin)){ |
|
35 | + self::$plugins[] = (object)$plugin; |
|
36 | + } |
|
37 | 37 | |
38 | - return self::$instance; |
|
39 | - } |
|
38 | + return self::$instance; |
|
39 | + } |
|
40 | 40 | |
41 | - public function scripts() { |
|
42 | - global $pagenow; |
|
41 | + public function scripts() { |
|
42 | + global $pagenow; |
|
43 | 43 | |
44 | - // Bail if we are not on the plugins page |
|
45 | - if ( $pagenow != "plugins.php" ) { |
|
46 | - return; |
|
47 | - } |
|
44 | + // Bail if we are not on the plugins page |
|
45 | + if ( $pagenow != "plugins.php" ) { |
|
46 | + return; |
|
47 | + } |
|
48 | 48 | |
49 | - // Enqueue scripts |
|
50 | - add_thickbox(); |
|
51 | - wp_enqueue_script('ayecode-deactivation-survey', plugin_dir_url(__FILE__) . 'ayecode-ds.js'); |
|
49 | + // Enqueue scripts |
|
50 | + add_thickbox(); |
|
51 | + wp_enqueue_script('ayecode-deactivation-survey', plugin_dir_url(__FILE__) . 'ayecode-ds.js'); |
|
52 | 52 | |
53 | - /* |
|
53 | + /* |
|
54 | 54 | * Localized strings. Strings can be localised by plugins using this class. |
55 | 55 | * We deliberately don't add textdomains here so that double textdomain warning is not given in theme review. |
56 | 56 | */ |
57 | - wp_localize_script('ayecode-deactivation-survey', 'ayecodeds_deactivate_feedback_form_strings', array( |
|
58 | - 'quick_feedback' => 'Quick Feedback', |
|
59 | - 'foreword' => 'If you would be kind enough, please tell us why you\'re deactivating?', |
|
60 | - 'better_plugins_name' => 'Please tell us which plugin?', |
|
61 | - 'please_tell_us' => 'Please tell us the reason so we can improve the plugin', |
|
62 | - 'do_not_attach_email' => 'Do not send my e-mail address with this feedback', |
|
63 | - 'brief_description' => 'Please give us any feedback that could help us improve', |
|
64 | - 'cancel' => 'Cancel', |
|
65 | - 'skip_and_deactivate' => 'Skip & Deactivate', |
|
66 | - 'submit_and_deactivate' => 'Submit & Deactivate', |
|
67 | - 'please_wait' => 'Please wait', |
|
68 | - 'get_support' => 'Get Support', |
|
69 | - 'documentation' => 'Documentation', |
|
70 | - 'thank_you' => 'Thank you!', |
|
71 | - )); |
|
72 | - |
|
73 | - // Plugins |
|
74 | - $plugins = apply_filters('ayecode_deactivation_survey_plugins', self::$plugins); |
|
75 | - |
|
76 | - // Reasons |
|
77 | - $defaultReasons = array( |
|
78 | - 'suddenly-stopped-working' => 'The plugin suddenly stopped working', |
|
79 | - 'plugin-broke-site' => 'The plugin broke my site', |
|
80 | - 'plugin-setup-difficult' => 'Too difficult to setup', |
|
81 | - 'plugin-design-difficult' => 'Too difficult to get the design i want', |
|
82 | - 'no-longer-needed' => 'I don\'t need this plugin any more', |
|
83 | - 'found-better-plugin' => 'I found a better plugin', |
|
84 | - 'temporary-deactivation' => 'It\'s a temporary deactivation, I\'m troubleshooting', |
|
85 | - 'other' => 'Other', |
|
86 | - ); |
|
87 | - |
|
88 | - foreach($plugins as $plugin) |
|
89 | - { |
|
90 | - $plugin->reasons = apply_filters('ayecode_deactivation_survey_reasons', $defaultReasons, $plugin); |
|
91 | - $plugin->url = home_url(); |
|
92 | - $plugin->activated = 0; |
|
93 | - } |
|
94 | - |
|
95 | - // Send plugin data |
|
96 | - wp_localize_script('ayecode-deactivation-survey', 'ayecodeds_deactivate_feedback_form_plugins', $plugins); |
|
97 | - |
|
98 | - } |
|
57 | + wp_localize_script('ayecode-deactivation-survey', 'ayecodeds_deactivate_feedback_form_strings', array( |
|
58 | + 'quick_feedback' => 'Quick Feedback', |
|
59 | + 'foreword' => 'If you would be kind enough, please tell us why you\'re deactivating?', |
|
60 | + 'better_plugins_name' => 'Please tell us which plugin?', |
|
61 | + 'please_tell_us' => 'Please tell us the reason so we can improve the plugin', |
|
62 | + 'do_not_attach_email' => 'Do not send my e-mail address with this feedback', |
|
63 | + 'brief_description' => 'Please give us any feedback that could help us improve', |
|
64 | + 'cancel' => 'Cancel', |
|
65 | + 'skip_and_deactivate' => 'Skip & Deactivate', |
|
66 | + 'submit_and_deactivate' => 'Submit & Deactivate', |
|
67 | + 'please_wait' => 'Please wait', |
|
68 | + 'get_support' => 'Get Support', |
|
69 | + 'documentation' => 'Documentation', |
|
70 | + 'thank_you' => 'Thank you!', |
|
71 | + )); |
|
72 | + |
|
73 | + // Plugins |
|
74 | + $plugins = apply_filters('ayecode_deactivation_survey_plugins', self::$plugins); |
|
75 | + |
|
76 | + // Reasons |
|
77 | + $defaultReasons = array( |
|
78 | + 'suddenly-stopped-working' => 'The plugin suddenly stopped working', |
|
79 | + 'plugin-broke-site' => 'The plugin broke my site', |
|
80 | + 'plugin-setup-difficult' => 'Too difficult to setup', |
|
81 | + 'plugin-design-difficult' => 'Too difficult to get the design i want', |
|
82 | + 'no-longer-needed' => 'I don\'t need this plugin any more', |
|
83 | + 'found-better-plugin' => 'I found a better plugin', |
|
84 | + 'temporary-deactivation' => 'It\'s a temporary deactivation, I\'m troubleshooting', |
|
85 | + 'other' => 'Other', |
|
86 | + ); |
|
87 | + |
|
88 | + foreach($plugins as $plugin) |
|
89 | + { |
|
90 | + $plugin->reasons = apply_filters('ayecode_deactivation_survey_reasons', $defaultReasons, $plugin); |
|
91 | + $plugin->url = home_url(); |
|
92 | + $plugin->activated = 0; |
|
93 | + } |
|
94 | + |
|
95 | + // Send plugin data |
|
96 | + wp_localize_script('ayecode-deactivation-survey', 'ayecodeds_deactivate_feedback_form_plugins', $plugins); |
|
97 | + |
|
98 | + } |
|
99 | 99 | |
100 | 100 | |
101 | - } |
|
101 | + } |
|
102 | 102 | |
103 | 103 | } |
104 | 104 | \ No newline at end of file |