@@ -7,7 +7,7 @@ |
||
7 | 7 | * @package Invoicing/data |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | return array( |
13 | 13 | 'BD' => '+880', |
@@ -9,7 +9,7 @@ |
||
9 | 9 | * @version 1.0.14 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) || exit; |
|
12 | +defined('ABSPATH') || exit; |
|
13 | 13 | |
14 | 14 | return array( |
15 | 15 | 'US' => __('United States', 'invoicing'), |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
3 | +if (!defined('ABSPATH')) { |
|
4 | 4 | exit; |
5 | 5 | } |
6 | 6 | |
7 | -if ( ! class_exists( "AyeCode_Connect_Helper" ) ) { |
|
7 | +if (!class_exists("AyeCode_Connect_Helper")) { |
|
8 | 8 | /** |
9 | 9 | * Allow the quick setup and connection of our AyeCode Connect plugin. |
10 | 10 | * |
@@ -29,41 +29,41 @@ discard block |
||
29 | 29 | * @param array $strings |
30 | 30 | * @param array $pages |
31 | 31 | */ |
32 | - public function __construct( $strings = array(), $pages = array() ) { |
|
32 | + public function __construct($strings = array(), $pages = array()) { |
|
33 | 33 | |
34 | 34 | // Only fire if not localhost and the current user has the right permissions. |
35 | - if ( ! $this->is_localhost() && current_user_can( 'manage_options' ) ) { |
|
35 | + if (!$this->is_localhost() && current_user_can('manage_options')) { |
|
36 | 36 | |
37 | 37 | |
38 | 38 | // set default strings |
39 | 39 | $default_strings = array( |
40 | - 'connect_title' => __( "Thanks for choosing an AyeCode Product!" ), |
|
41 | - 'connect_external' => __( "Please confirm you wish to connect your site?" ), |
|
42 | - 'connect' => sprintf( __( "<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s" ), "<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>", "</a>" ), |
|
43 | - 'connect_button' => __( "Connect Site" ), |
|
44 | - 'connecting_button' => __( "Connecting..." ), |
|
45 | - 'error_localhost' => __( "This service will only work with a live domain, not a localhost." ), |
|
46 | - 'error' => __( "Something went wrong, please refresh and try again." ), |
|
40 | + 'connect_title' => __("Thanks for choosing an AyeCode Product!"), |
|
41 | + 'connect_external' => __("Please confirm you wish to connect your site?"), |
|
42 | + 'connect' => sprintf(__("<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s"), "<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>", "</a>"), |
|
43 | + 'connect_button' => __("Connect Site"), |
|
44 | + 'connecting_button' => __("Connecting..."), |
|
45 | + 'error_localhost' => __("This service will only work with a live domain, not a localhost."), |
|
46 | + 'error' => __("Something went wrong, please refresh and try again."), |
|
47 | 47 | ); |
48 | - $this->strings = array_merge( $default_strings, $strings ); |
|
48 | + $this->strings = array_merge($default_strings, $strings); |
|
49 | 49 | |
50 | 50 | |
51 | 51 | // set default pages |
52 | 52 | $default_pages = array(); |
53 | - $this->pages = array_merge( $default_pages, $pages ); |
|
53 | + $this->pages = array_merge($default_pages, $pages); |
|
54 | 54 | |
55 | 55 | // maybe show connect site notice |
56 | - add_action( 'admin_notices', array( $this, 'ayecode_connect_install_notice' ) ); |
|
56 | + add_action('admin_notices', array($this, 'ayecode_connect_install_notice')); |
|
57 | 57 | |
58 | 58 | // add ajax action if not already added |
59 | - if ( ! has_action( 'wp_ajax_ayecode_connect_helper' ) ) { |
|
60 | - add_action( 'wp_ajax_ayecode_connect_helper', array( $this, 'ayecode_connect_install' ) ); |
|
59 | + if (!has_action('wp_ajax_ayecode_connect_helper')) { |
|
60 | + add_action('wp_ajax_ayecode_connect_helper', array($this, 'ayecode_connect_install')); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | 64 | // add ajax action if not already added |
65 | - if ( ! has_action( 'wp_ajax_nopriv_ayecode_connect_helper_installed' ) ) { |
|
66 | - add_action( 'wp_ajax_nopriv_ayecode_connect_helper_installed', array( $this, 'ayecode_connect_helper_installed' ) ); |
|
65 | + if (!has_action('wp_ajax_nopriv_ayecode_connect_helper_installed')) { |
|
66 | + add_action('wp_ajax_nopriv_ayecode_connect_helper_installed', array($this, 'ayecode_connect_helper_installed')); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | } |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | /** |
72 | 72 | * Give a way to check we can connect via a external redirect. |
73 | 73 | */ |
74 | - public function ayecode_connect_helper_installed(){ |
|
74 | + public function ayecode_connect_helper_installed() { |
|
75 | 75 | $active = array( |
76 | - 'gd' => defined('GEODIRECTORY_VERSION') && version_compare(GEODIRECTORY_VERSION,'2.0.0.79','>') ? 1 : 0, |
|
77 | - 'uwp' => defined('USERSWP_VERSION') && version_compare(USERSWP_VERSION,'1.2.1.5','>') ? 1 : 0, |
|
78 | - 'wpi' => defined('WPINV_VERSION') && version_compare(WPINV_VERSION,'1.0.14','>') ? 1 : 0, |
|
76 | + 'gd' => defined('GEODIRECTORY_VERSION') && version_compare(GEODIRECTORY_VERSION, '2.0.0.79', '>') ? 1 : 0, |
|
77 | + 'uwp' => defined('USERSWP_VERSION') && version_compare(USERSWP_VERSION, '1.2.1.5', '>') ? 1 : 0, |
|
78 | + 'wpi' => defined('WPINV_VERSION') && version_compare(WPINV_VERSION, '1.0.14', '>') ? 1 : 0, |
|
79 | 79 | ); |
80 | - wp_send_json_success( $active ); |
|
80 | + wp_send_json_success($active); |
|
81 | 81 | wp_die(); |
82 | 82 | } |
83 | 83 | |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return string |
90 | 90 | */ |
91 | - private function format_plugin_slug( $key ) { |
|
92 | - $slug = explode( '/', $key ); |
|
93 | - $slug = explode( '.', end( $slug ) ); |
|
91 | + private function format_plugin_slug($key) { |
|
92 | + $slug = explode('/', $key); |
|
93 | + $slug = explode('.', end($slug)); |
|
94 | 94 | |
95 | 95 | return $slug[0]; |
96 | 96 | } |
@@ -101,45 +101,45 @@ discard block |
||
101 | 101 | public function ayecode_connect_install() { |
102 | 102 | |
103 | 103 | // bail if localhost |
104 | - if ( $this->is_localhost() ) { |
|
105 | - wp_send_json_error( $this->strings['error_localhost'] ); |
|
104 | + if ($this->is_localhost()) { |
|
105 | + wp_send_json_error($this->strings['error_localhost']); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | // Explicitly clear the event. |
109 | - wp_clear_scheduled_hook( 'geodir_plugin_background_installer', func_get_args() ); |
|
109 | + wp_clear_scheduled_hook('geodir_plugin_background_installer', func_get_args()); |
|
110 | 110 | |
111 | 111 | $success = true; |
112 | 112 | $plugin_slug = "ayecode-connect"; |
113 | - if ( ! empty( $plugin_slug ) ) { |
|
114 | - require_once( ABSPATH . 'wp-admin/includes/file.php' ); |
|
115 | - require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); |
|
116 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
|
117 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
113 | + if (!empty($plugin_slug)) { |
|
114 | + require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
115 | + require_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); |
|
116 | + require_once(ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'); |
|
117 | + require_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
118 | 118 | |
119 | 119 | WP_Filesystem(); |
120 | 120 | |
121 | 121 | $skin = new Automatic_Upgrader_Skin; |
122 | - $upgrader = new WP_Upgrader( $skin ); |
|
123 | - $installed_plugins = array_map( array( $this, 'format_plugin_slug' ), array_keys( get_plugins() ) ); |
|
122 | + $upgrader = new WP_Upgrader($skin); |
|
123 | + $installed_plugins = array_map(array($this, 'format_plugin_slug'), array_keys(get_plugins())); |
|
124 | 124 | $plugin_slug = $plugin_slug; |
125 | 125 | $plugin = $plugin_slug . '/' . $plugin_slug . '.php'; |
126 | 126 | $installed = false; |
127 | 127 | $activate = false; |
128 | 128 | |
129 | 129 | // See if the plugin is installed already |
130 | - if ( in_array( $plugin_slug, $installed_plugins ) ) { |
|
130 | + if (in_array($plugin_slug, $installed_plugins)) { |
|
131 | 131 | $installed = true; |
132 | - $activate = ! is_plugin_active( $plugin ); |
|
132 | + $activate = !is_plugin_active($plugin); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | // Install this thing! |
136 | - if ( ! $installed ) { |
|
136 | + if (!$installed) { |
|
137 | 137 | |
138 | 138 | // Suppress feedback |
139 | 139 | ob_start(); |
140 | 140 | |
141 | 141 | try { |
142 | - $plugin_information = plugins_api( 'plugin_information', array( |
|
142 | + $plugin_information = plugins_api('plugin_information', array( |
|
143 | 143 | 'slug' => $plugin_slug, |
144 | 144 | 'fields' => array( |
145 | 145 | 'short_description' => false, |
@@ -156,26 +156,26 @@ discard block |
||
156 | 156 | 'author_profile' => false, |
157 | 157 | 'author' => false, |
158 | 158 | ), |
159 | - ) ); |
|
159 | + )); |
|
160 | 160 | |
161 | - if ( is_wp_error( $plugin_information ) ) { |
|
162 | - throw new Exception( $plugin_information->get_error_message() ); |
|
161 | + if (is_wp_error($plugin_information)) { |
|
162 | + throw new Exception($plugin_information->get_error_message()); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | $package = $plugin_information->download_link; |
166 | - $download = $upgrader->download_package( $package ); |
|
166 | + $download = $upgrader->download_package($package); |
|
167 | 167 | |
168 | - if ( is_wp_error( $download ) ) { |
|
169 | - throw new Exception( $download->get_error_message() ); |
|
168 | + if (is_wp_error($download)) { |
|
169 | + throw new Exception($download->get_error_message()); |
|
170 | 170 | } |
171 | 171 | |
172 | - $working_dir = $upgrader->unpack_package( $download, true ); |
|
172 | + $working_dir = $upgrader->unpack_package($download, true); |
|
173 | 173 | |
174 | - if ( is_wp_error( $working_dir ) ) { |
|
175 | - throw new Exception( $working_dir->get_error_message() ); |
|
174 | + if (is_wp_error($working_dir)) { |
|
175 | + throw new Exception($working_dir->get_error_message()); |
|
176 | 176 | } |
177 | 177 | |
178 | - $result = $upgrader->install_package( array( |
|
178 | + $result = $upgrader->install_package(array( |
|
179 | 179 | 'source' => $working_dir, |
180 | 180 | 'destination' => WP_PLUGIN_DIR, |
181 | 181 | 'clear_destination' => false, |
@@ -185,15 +185,15 @@ discard block |
||
185 | 185 | 'type' => 'plugin', |
186 | 186 | 'action' => 'install', |
187 | 187 | ), |
188 | - ) ); |
|
188 | + )); |
|
189 | 189 | |
190 | - if ( is_wp_error( $result ) ) { |
|
191 | - throw new Exception( $result->get_error_message() ); |
|
190 | + if (is_wp_error($result)) { |
|
191 | + throw new Exception($result->get_error_message()); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | $activate = true; |
195 | 195 | |
196 | - } catch ( Exception $e ) { |
|
196 | + } catch (Exception $e) { |
|
197 | 197 | $success = false; |
198 | 198 | } |
199 | 199 | |
@@ -204,30 +204,30 @@ discard block |
||
204 | 204 | wp_clean_plugins_cache(); |
205 | 205 | |
206 | 206 | // Activate this thing |
207 | - if ( $activate ) { |
|
207 | + if ($activate) { |
|
208 | 208 | try { |
209 | - $result = activate_plugin( $plugin ); |
|
209 | + $result = activate_plugin($plugin); |
|
210 | 210 | |
211 | - if ( is_wp_error( $result ) ) { |
|
211 | + if (is_wp_error($result)) { |
|
212 | 212 | $success = false; |
213 | 213 | } else { |
214 | 214 | $success = true; |
215 | 215 | } |
216 | - } catch ( Exception $e ) { |
|
216 | + } catch (Exception $e) { |
|
217 | 217 | $success = false; |
218 | 218 | } |
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
222 | - if ( $success && function_exists( 'ayecode_connect_args' ) ) { |
|
223 | - ayecode_connect();// init |
|
222 | + if ($success && function_exists('ayecode_connect_args')) { |
|
223 | + ayecode_connect(); // init |
|
224 | 224 | $args = ayecode_connect_args(); |
225 | - $client = new AyeCode_Connect( $args ); |
|
226 | - $redirect_to = ! empty( $_POST['redirect_to'] ) ? esc_url_raw( $_POST['redirect_to'] ) : ''; |
|
227 | - $redirect = $client->build_connect_url( $redirect_to ); |
|
228 | - wp_send_json_success( array( 'connect_url' => $redirect ) ); |
|
225 | + $client = new AyeCode_Connect($args); |
|
226 | + $redirect_to = !empty($_POST['redirect_to']) ? esc_url_raw($_POST['redirect_to']) : ''; |
|
227 | + $redirect = $client->build_connect_url($redirect_to); |
|
228 | + wp_send_json_success(array('connect_url' => $redirect)); |
|
229 | 229 | } else { |
230 | - wp_send_json_error( $this->strings['error_localhost'] ); |
|
230 | + wp_send_json_error($this->strings['error_localhost']); |
|
231 | 231 | } |
232 | 232 | wp_die(); |
233 | 233 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | public function is_localhost() { |
241 | 241 | $localhost = false; |
242 | 242 | |
243 | - $host = isset( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : ''; |
|
243 | + $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ''; |
|
244 | 244 | $localhost_domains = array( |
245 | 245 | 'localhost', |
246 | 246 | 'localhost.localdomain', |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | '::1' |
249 | 249 | ); |
250 | 250 | |
251 | - if ( in_array( $host, $localhost_domains ) ) { |
|
251 | + if (in_array($host, $localhost_domains)) { |
|
252 | 252 | $localhost = true; |
253 | 253 | } |
254 | 254 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * Show notice to connect site. |
260 | 260 | */ |
261 | 261 | public function ayecode_connect_install_notice() { |
262 | - if ( $this->maybe_show() ) { |
|
262 | + if ($this->maybe_show()) { |
|
263 | 263 | $connect_title_string = $this->strings['connect_title']; |
264 | 264 | $connect_external_string = $this->strings['connect_external']; |
265 | 265 | $connect_string = $this->strings['connect']; |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | </svg> |
302 | 302 | </span> |
303 | 303 | <span class="acch-float-left acch-text"> |
304 | - <h3 class="acch-title"><?php echo esc_attr( $connect_title_string ); ?></h3> |
|
304 | + <h3 class="acch-title"><?php echo esc_attr($connect_title_string); ?></h3> |
|
305 | 305 | <p> |
306 | 306 | <?php |
307 | 307 | echo $connect_string; |
@@ -312,14 +312,14 @@ discard block |
||
312 | 312 | <span class="acch-float-left acch-button"> |
313 | 313 | <button onclick="ayecode_connect_helper(this);" id="gd-connect-site" |
314 | 314 | class="button button-primary" |
315 | - data-connecting="<?php echo esc_attr( $connecting_button_string ); ?>"><?php echo esc_attr( $connect_button_string ) ?></button> |
|
315 | + data-connecting="<?php echo esc_attr($connecting_button_string); ?>"><?php echo esc_attr($connect_button_string) ?></button> |
|
316 | 316 | </span> |
317 | 317 | |
318 | 318 | </div> |
319 | 319 | |
320 | 320 | <?php |
321 | 321 | // only include the popup HTML if needed. |
322 | - if ( ! empty( $_REQUEST['external-connect-request'] ) ) { |
|
322 | + if (!empty($_REQUEST['external-connect-request'])) { |
|
323 | 323 | ?> |
324 | 324 | <div id="ayecode-connect-helper-external-confirm" style="display:none;"> |
325 | 325 | <div class="noticex notice-info acch-notice" style="border: none;"> |
@@ -357,13 +357,13 @@ discard block |
||
357 | 357 | </svg> |
358 | 358 | </span> |
359 | 359 | <span class="acch-float-left acch-text"> |
360 | - <h3 class="acch-title"><?php echo esc_attr( $connect_external_string ); ?></h3> |
|
360 | + <h3 class="acch-title"><?php echo esc_attr($connect_external_string); ?></h3> |
|
361 | 361 | </span> |
362 | 362 | |
363 | 363 | <span class="acch-float-left acch-button"> |
364 | 364 | <button onclick="ayecode_connect_helper(this);" id="gd-connect-site" |
365 | 365 | class="button button-primary" |
366 | - data-connecting="<?php echo esc_attr( $connecting_button_string ); ?>"><?php echo esc_attr( $connect_button_string ) ?></button> |
|
366 | + data-connecting="<?php echo esc_attr($connecting_button_string); ?>"><?php echo esc_attr($connect_button_string) ?></button> |
|
367 | 367 | </span> |
368 | 368 | |
369 | 369 | </div> |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | public function script() { |
383 | 383 | |
384 | 384 | // add thickbox if external request is requested |
385 | - if ( ! empty( $_REQUEST['external-connect-request'] ) ) { |
|
385 | + if (!empty($_REQUEST['external-connect-request'])) { |
|
386 | 386 | add_thickbox(); |
387 | 387 | } |
388 | 388 | ?> |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | url: ajaxurl, |
435 | 435 | data: { |
436 | 436 | action: 'ayecode_connect_helper', |
437 | - security: '<?php echo wp_create_nonce( 'ayecode-connect-helper' );?>', |
|
437 | + security: '<?php echo wp_create_nonce('ayecode-connect-helper'); ?>', |
|
438 | 438 | redirect_to: $current_url |
439 | 439 | }, |
440 | 440 | beforeSend: function () { |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | |
456 | 456 | <?php |
457 | 457 | // add thickbox if external request is requested |
458 | - if(! empty( $_REQUEST['external-connect-request'] )) { |
|
458 | + if (!empty($_REQUEST['external-connect-request'])) { |
|
459 | 459 | ?> |
460 | 460 | jQuery(function () { |
461 | 461 | setTimeout(function () { |
@@ -479,10 +479,10 @@ discard block |
||
479 | 479 | $show = false; |
480 | 480 | |
481 | 481 | // check if on a page set to show |
482 | - if ( isset( $_REQUEST['page'] ) && in_array( $_REQUEST['page'], $this->pages ) ) { |
|
482 | + if (isset($_REQUEST['page']) && in_array($_REQUEST['page'], $this->pages)) { |
|
483 | 483 | |
484 | 484 | // check if not active and connected |
485 | - if ( ! defined( 'AYECODE_CONNECT_VERSION' ) || ! get_option( 'ayecode_connect_blog_token' ) ) { |
|
485 | + if (!defined('AYECODE_CONNECT_VERSION') || !get_option('ayecode_connect_blog_token')) { |
|
486 | 486 | $show = true; |
487 | 487 | } |
488 | 488 |
@@ -8,7 +8,7 @@ |
||
8 | 8 | * @version 1.0.19 |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | 13 | return array( |
14 | 14 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if (!defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -22,15 +22,15 @@ discard block |
||
22 | 22 | 'block-keywords'=> "['invoicing','history']", |
23 | 23 | 'class_name' => __CLASS__, |
24 | 24 | 'base_id' => 'wpinv_messages', |
25 | - 'name' => __('GetPaid > Invoice Messages','invoicing'), |
|
25 | + 'name' => __('GetPaid > Invoice Messages', 'invoicing'), |
|
26 | 26 | 'widget_ops' => array( |
27 | 27 | 'classname' => 'wpinv-messages-class wpi-g', |
28 | - 'description' => esc_html__('Displays invoice error and warning messages on checkout page.','invoicing'), |
|
28 | + 'description' => esc_html__('Displays invoice error and warning messages on checkout page.', 'invoicing'), |
|
29 | 29 | ), |
30 | 30 | 'arguments' => array( |
31 | 31 | 'title' => array( |
32 | - 'title' => __( 'Widget title', 'invoicing' ), |
|
33 | - 'desc' => __( 'Enter widget title.', 'invoicing' ), |
|
32 | + 'title' => __('Widget title', 'invoicing'), |
|
33 | + 'desc' => __('Enter widget title.', 'invoicing'), |
|
34 | 34 | 'type' => 'text', |
35 | 35 | 'desc_tip' => true, |
36 | 36 | 'default' => '', |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | ); |
42 | 42 | |
43 | 43 | |
44 | - parent::__construct( $options ); |
|
44 | + parent::__construct($options); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @return mixed|string|bool |
55 | 55 | */ |
56 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
56 | + public function output($args = array(), $widget_args = array(), $content = '') { |
|
57 | 57 | |
58 | 58 | ob_start(); |
59 | 59 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if (!defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -23,40 +23,40 @@ discard block |
||
23 | 23 | 'block-keywords'=> "['invoicing','buy', 'buy item']", |
24 | 24 | 'class_name' => __CLASS__, |
25 | 25 | 'base_id' => 'wpinv_buy', |
26 | - 'name' => __('Get Paid > Buy Item Button (Deprecated)','invoicing'), |
|
26 | + 'name' => __('Get Paid > Buy Item Button (Deprecated)', 'invoicing'), |
|
27 | 27 | 'widget_ops' => array( |
28 | 28 | 'classname' => 'wpinv-buy-item-class wpi-g', |
29 | - 'description' => esc_html__('This widget is deprecated. Use the GetPaid widget instead.','invoicing'), |
|
29 | + 'description' => esc_html__('This widget is deprecated. Use the GetPaid widget instead.', 'invoicing'), |
|
30 | 30 | ), |
31 | 31 | 'arguments' => array( |
32 | 32 | 'title' => array( |
33 | - 'title' => __( 'Widget title', 'invoicing' ), |
|
34 | - 'desc' => __( 'Enter widget title.', 'invoicing' ), |
|
33 | + 'title' => __('Widget title', 'invoicing'), |
|
34 | + 'desc' => __('Enter widget title.', 'invoicing'), |
|
35 | 35 | 'type' => 'text', |
36 | 36 | 'desc_tip' => true, |
37 | 37 | 'default' => '', |
38 | 38 | 'advanced' => false |
39 | 39 | ), |
40 | 40 | 'items' => array( |
41 | - 'title' => __( 'Items to buy', 'invoicing' ), |
|
42 | - 'desc' => __( 'Enter comma separated list of invoicing item id and quantity (item_id|quantity). Ex. 101|2 ', 'invoicing' ), |
|
41 | + 'title' => __('Items to buy', 'invoicing'), |
|
42 | + 'desc' => __('Enter comma separated list of invoicing item id and quantity (item_id|quantity). Ex. 101|2 ', 'invoicing'), |
|
43 | 43 | 'type' => 'text', |
44 | 44 | 'desc_tip' => true, |
45 | 45 | 'default' => '', |
46 | - 'placeholder' => __('Items to buy','invoicing'), |
|
46 | + 'placeholder' => __('Items to buy', 'invoicing'), |
|
47 | 47 | 'advanced' => false |
48 | 48 | ), |
49 | 49 | 'label' => array( |
50 | - 'title' => __( 'Button Label', 'invoicing' ), |
|
51 | - 'desc' => __( 'Enter button label. Default "Buy Now".', 'invoicing' ), |
|
50 | + 'title' => __('Button Label', 'invoicing'), |
|
51 | + 'desc' => __('Enter button label. Default "Buy Now".', 'invoicing'), |
|
52 | 52 | 'type' => 'text', |
53 | 53 | 'desc_tip' => true, |
54 | - 'default' => __( 'Buy Now', 'invoicing' ), |
|
54 | + 'default' => __('Buy Now', 'invoicing'), |
|
55 | 55 | 'advanced' => false |
56 | 56 | ), |
57 | 57 | 'post_id' => array( |
58 | - 'title' => __( 'Post ID', 'invoicing' ), |
|
59 | - 'desc' => __( 'Enter related post ID. This is for 3rd party add ons and not mandatory field.', 'invoicing' ), |
|
58 | + 'title' => __('Post ID', 'invoicing'), |
|
59 | + 'desc' => __('Enter related post ID. This is for 3rd party add ons and not mandatory field.', 'invoicing'), |
|
60 | 60 | 'type' => 'number', |
61 | 61 | 'desc_tip' => true, |
62 | 62 | 'default' => '', |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | ); |
68 | 68 | |
69 | 69 | |
70 | - parent::__construct( $options ); |
|
70 | + parent::__construct($options); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -79,31 +79,31 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @return string |
81 | 81 | */ |
82 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
82 | + public function output($args = array(), $widget_args = array(), $content = '') { |
|
83 | 83 | |
84 | 84 | $defaults = array( |
85 | 85 | 'items' => '', // should be used like: item_id|quantity,item_id|quantity,item_id|quantity |
86 | - 'label' => __( 'Buy Now', 'invoicing' ), // the button title |
|
86 | + 'label' => __('Buy Now', 'invoicing'), // the button title |
|
87 | 87 | 'post_id' => '', // any related post_id |
88 | 88 | ); |
89 | 89 | |
90 | 90 | /** |
91 | 91 | * Parse incoming $args into an array and merge it with $defaults |
92 | 92 | */ |
93 | - $args = wp_parse_args( $args, $defaults ); |
|
93 | + $args = wp_parse_args($args, $defaults); |
|
94 | 94 | |
95 | 95 | $html = '<div class="wpi-buy-button-wrapper wpi-g">'; |
96 | 96 | |
97 | - if ( empty( $args['items'] ) ) { |
|
98 | - $html .= __( 'No items selected', 'invoicing' ); |
|
97 | + if (empty($args['items'])) { |
|
98 | + $html .= __('No items selected', 'invoicing'); |
|
99 | 99 | } else { |
100 | - $post_id = isset( $args['post_id'] ) && is_numeric( $args['post_id'] ) ? sanitize_text_field( $args['post_id'] ) : 0; |
|
101 | - $label = isset( $args['label'] ) ? sanitize_text_field( $args['label'] ) : __( 'Buy Now', 'invoicing' ); |
|
102 | - $items = esc_attr( $args['items'] ); |
|
100 | + $post_id = isset($args['post_id']) && is_numeric($args['post_id']) ? sanitize_text_field($args['post_id']) : 0; |
|
101 | + $label = isset($args['label']) ? sanitize_text_field($args['label']) : __('Buy Now', 'invoicing'); |
|
102 | + $items = esc_attr($args['items']); |
|
103 | 103 | $html .= "<button class='button button-primary wpi-buy-button' type='button' onclick=\"wpi_buy(this, '$items','$post_id');\">$label</button>"; |
104 | 104 | } |
105 | 105 | |
106 | - $html .= wp_nonce_field( 'wpinv_buy_items', 'wpinv_buy_nonce', true, false ); |
|
106 | + $html .= wp_nonce_field('wpinv_buy_items', 'wpinv_buy_nonce', true, false); |
|
107 | 107 | $html .= '</div>'; |
108 | 108 | |
109 | 109 | return $html; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if (!defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | 'block-keywords'=> "['invoicing','checkout']", |
24 | 24 | 'class_name' => __CLASS__, |
25 | 25 | 'base_id' => 'wpinv_checkout', |
26 | - 'name' => __('GetPaid > Checkout','invoicing'), |
|
26 | + 'name' => __('GetPaid > Checkout', 'invoicing'), |
|
27 | 27 | 'widget_ops' => array( |
28 | 28 | 'classname' => 'getpaid-checkout bsui', |
29 | - 'description' => esc_html__('Displays a checkout form.','invoicing'), |
|
29 | + 'description' => esc_html__('Displays a checkout form.', 'invoicing'), |
|
30 | 30 | ), |
31 | 31 | 'arguments' => array( |
32 | 32 | 'title' => array( |
33 | - 'title' => __( 'Widget title', 'invoicing' ), |
|
34 | - 'desc' => __( 'Enter widget title.', 'invoicing' ), |
|
33 | + 'title' => __('Widget title', 'invoicing'), |
|
34 | + 'desc' => __('Enter widget title.', 'invoicing'), |
|
35 | 35 | 'type' => 'text', |
36 | 36 | 'desc_tip' => true, |
37 | 37 | 'default' => '', |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | ); |
43 | 43 | |
44 | 44 | |
45 | - parent::__construct( $options ); |
|
45 | + parent::__construct($options); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return mixed|string|bool |
56 | 56 | */ |
57 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
57 | + public function output($args = array(), $widget_args = array(), $content = '') { |
|
58 | 58 | return wpinv_checkout_form(); |
59 | 59 | } |
60 | 60 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | 'block-output' => array( // the block visual output elements as an array |
24 | 24 | array( |
25 | 25 | 'element' => 'p', |
26 | - 'title' => __( 'Placeholder', 'hello-world' ), |
|
26 | + 'title' => __('Placeholder', 'hello-world'), |
|
27 | 27 | 'class' => '[%className%]', |
28 | 28 | 'content' => 'Hello: [%after_text%]' // block properties can be added by wrapping them in [%name%] |
29 | 29 | ) |
@@ -33,20 +33,20 @@ discard block |
||
33 | 33 | // The calling class name |
34 | 34 | 'base_id' => 'hello_world', |
35 | 35 | // this is used as the widget id and the shortcode id. |
36 | - 'name' => __( 'Hello World', 'hello-world' ), |
|
36 | + 'name' => __('Hello World', 'hello-world'), |
|
37 | 37 | // the name of the widget/block |
38 | 38 | 'widget_ops' => array( |
39 | 39 | 'classname' => 'hello-world-class', |
40 | 40 | // widget class |
41 | - 'description' => esc_html__( 'This is an example that will take a text parameter and output it after `Hello:`.', 'hello-world' ), |
|
41 | + 'description' => esc_html__('This is an example that will take a text parameter and output it after `Hello:`.', 'hello-world'), |
|
42 | 42 | // widget description |
43 | 43 | ), |
44 | 44 | 'no_wrap' => true, // This will prevent the widget being wrapped in the containing widget class div. |
45 | 45 | 'arguments' => array( // these are the arguments that will be used in the widget, shortcode and block settings. |
46 | 46 | 'after_text' => array( // this is the input name='' |
47 | - 'title' => __( 'Text after hello:', 'hello-world' ), |
|
47 | + 'title' => __('Text after hello:', 'hello-world'), |
|
48 | 48 | // input title |
49 | - 'desc' => __( 'This is the text that will appear after `Hello:`.', 'hello-world' ), |
|
49 | + 'desc' => __('This is the text that will appear after `Hello:`.', 'hello-world'), |
|
50 | 50 | // input description |
51 | 51 | 'type' => 'text', |
52 | 52 | // the type of input, test, select, checkbox etc. |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | ) |
63 | 63 | ); |
64 | 64 | |
65 | - parent::__construct( $options ); |
|
65 | + parent::__construct($options); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -75,18 +75,18 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @return string |
77 | 77 | */ |
78 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
78 | + public function output($args = array(), $widget_args = array(), $content = '') { |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * @var string $after_text |
82 | 82 | * @var string $another_input This is added by filter below. |
83 | 83 | */ |
84 | - extract( $args, EXTR_SKIP ); |
|
84 | + extract($args, EXTR_SKIP); |
|
85 | 85 | |
86 | 86 | /* |
87 | 87 | * This value is added by filter so might not exist if filter is removed so we check. |
88 | 88 | */ |
89 | - if ( ! isset( $another_input ) ) { |
|
89 | + if (!isset($another_input)) { |
|
90 | 90 | $another_input = ''; |
91 | 91 | } |
92 | 92 | |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | // register it. |
100 | -add_action( 'widgets_init', function () { |
|
101 | - register_widget( 'SD_Hello_World' ); |
|
100 | +add_action('widgets_init', function() { |
|
101 | + register_widget('SD_Hello_World'); |
|
102 | 102 | } ); |
103 | 103 | |
104 | 104 | |
@@ -109,15 +109,15 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @return mixed |
111 | 111 | */ |
112 | -function _my_extra_arguments( $options ) { |
|
112 | +function _my_extra_arguments($options) { |
|
113 | 113 | |
114 | 114 | /* |
115 | 115 | * Add a new input option. |
116 | 116 | */ |
117 | 117 | $options['arguments']['another_input'] = array( |
118 | 118 | 'name' => 'another_input', // this is the input name='' |
119 | - 'title' => __( 'Another input:', 'hello-world' ), // input title |
|
120 | - 'desc' => __( 'This is an input added via filter.', 'hello-world' ), // input description |
|
119 | + 'title' => __('Another input:', 'hello-world'), // input title |
|
120 | + 'desc' => __('This is an input added via filter.', 'hello-world'), // input description |
|
121 | 121 | 'type' => 'text', // the type of input, test, select, checkbox etc. |
122 | 122 | 'placeholder' => 'Placeholder text', // the input placeholder text. |
123 | 123 | 'desc_tip' => true, // if the input should show the widget description text as a tooltip. |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | /* |
129 | 129 | * Output the new option in the block output also. |
130 | 130 | */ |
131 | - $options['block-output']['element::p']['content'] = $options['block-output']['element::p']['content'] . " [%another_input%]";; |
|
131 | + $options['block-output']['element::p']['content'] = $options['block-output']['element::p']['content'] . " [%another_input%]"; ; |
|
132 | 132 | |
133 | 133 | return $options; |
134 | 134 | } |
@@ -14,21 +14,21 @@ |
||
14 | 14 | * Tested up to: 5.3 |
15 | 15 | */ |
16 | 16 | |
17 | -if ( ! defined( 'ABSPATH' ) ) { |
|
17 | +if (!defined('ABSPATH')) { |
|
18 | 18 | exit; |
19 | 19 | } |
20 | 20 | |
21 | -if ( ! class_exists( 'WP_Super_Duper' ) ) { |
|
21 | +if (!class_exists('WP_Super_Duper')) { |
|
22 | 22 | // include the class if needed |
23 | - include_once( dirname( __FILE__ ) . "/wp-super-duper.php" ); |
|
23 | + include_once(dirname(__FILE__) . "/wp-super-duper.php"); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /* |
27 | 27 | * Hello world example. |
28 | 28 | */ |
29 | -include_once( dirname( __FILE__ ) . "/hello-world.php" ); |
|
29 | +include_once(dirname(__FILE__) . "/hello-world.php"); |
|
30 | 30 | |
31 | 31 | /* |
32 | 32 | * Map example. |
33 | 33 | */ |
34 | -include_once( dirname( __FILE__ ) . "/map.php" ); |
|
34 | +include_once(dirname(__FILE__) . "/map.php"); |