@@ -3,27 +3,27 @@ discard block |
||
3 | 3 | * Admin View: Page - Addons |
4 | 4 | * |
5 | 5 | */ |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if (!defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | add_ThickBox(); |
10 | 10 | ?> |
11 | 11 | <div class="wrap wpi_addons_wrap"> |
12 | - <h1><?php echo esc_html( get_admin_page_title() ); ?></h1> |
|
12 | + <h1><?php echo esc_html(get_admin_page_title()); ?></h1> |
|
13 | 13 | |
14 | - <?php if ( $tabs ) { ?> |
|
14 | + <?php if ($tabs) { ?> |
|
15 | 15 | <nav class="nav-tab-wrapper wpi-nav-tab-wrapper"> |
16 | 16 | <?php |
17 | - foreach ( $tabs as $name => $label ) { |
|
18 | - echo '<a href="' . esc_url( admin_url( 'admin.php?page=wpi-addons&tab=' . $name ) ) . '" class="nav-tab ' . ( $current_tab == $name ? 'nav-tab-active' : '' ) . '">' . esc_html( $label ) . '</a>'; |
|
17 | + foreach ($tabs as $name => $label) { |
|
18 | + echo '<a href="' . esc_url(admin_url('admin.php?page=wpi-addons&tab=' . $name)) . '" class="nav-tab ' . ($current_tab == $name ? 'nav-tab-active' : '') . '">' . esc_html($label) . '</a>'; |
|
19 | 19 | } |
20 | - do_action( 'wpi_addons_tabs' ); |
|
20 | + do_action('wpi_addons_tabs'); |
|
21 | 21 | ?> |
22 | 22 | </nav> |
23 | 23 | |
24 | 24 | <?php |
25 | 25 | |
26 | - if ( $current_tab == 'membership' ) { |
|
26 | + if ($current_tab == 'membership') { |
|
27 | 27 | |
28 | 28 | ?> |
29 | 29 | |
@@ -32,42 +32,42 @@ discard block |
||
32 | 32 | <!-- |
33 | 33 | <h2>With our WPInvoicing Membership you get access to all our products!</h2> |
34 | 34 | <p><a class="button button-primary" href="https://wpinvoicing.com/downloads/membership/">View Memberships</a></p>--> |
35 | - <?php if ( defined( 'WP_EASY_UPDATES_ACTIVE' ) ) { ?> |
|
36 | - <h2><?php esc_html_e( 'Have a membership key?', 'invoicing' ); ?></h2> |
|
35 | + <?php if (defined('WP_EASY_UPDATES_ACTIVE')) { ?> |
|
36 | + <h2><?php esc_html_e('Have a membership key?', 'invoicing'); ?></h2> |
|
37 | 37 | <p> |
38 | 38 | <?php |
39 | - $wpeu_admin = new External_Updates_Admin( 'wpinvoicing.com', '1' ); |
|
40 | - echo $wpeu_admin->render_licence_actions( 'wpinvoicing.com', 'membership', array( 95, 106, 108, 12351 ) ); |
|
39 | + $wpeu_admin = new External_Updates_Admin('wpinvoicing.com', '1'); |
|
40 | + echo $wpeu_admin->render_licence_actions('wpinvoicing.com', 'membership', array(95, 106, 108, 12351)); |
|
41 | 41 | ?> |
42 | 42 | </p> |
43 | 43 | <?php } ?> |
44 | 44 | |
45 | 45 | <div class="membership-cta-contet"> |
46 | 46 | <div class="main-cta"> |
47 | - <h2><?php esc_html_e( 'Membership benefits Include:', 'invoicing' ); ?></h2> |
|
47 | + <h2><?php esc_html_e('Membership benefits Include:', 'invoicing'); ?></h2> |
|
48 | 48 | <div class="feature-list"> |
49 | 49 | <ul> |
50 | 50 | <?php |
51 | 51 | $addon_obj = new WPInv_Admin_Addons(); |
52 | - if ( $addons = $addon_obj->get_section_data( 'addons' ) ) { |
|
53 | - foreach ( $addons as $addon ) { |
|
54 | - echo '<li><i class="far fa-check-circle fa-sm"></i> ' . esc_html( $addon->info->title ) . '</li>'; |
|
52 | + if ($addons = $addon_obj->get_section_data('addons')) { |
|
53 | + foreach ($addons as $addon) { |
|
54 | + echo '<li><i class="far fa-check-circle fa-sm"></i> ' . esc_html($addon->info->title) . '</li>'; |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | ?> |
58 | 58 | </ul> |
59 | 59 | |
60 | 60 | <div class="feature-cta"> |
61 | - <h3><?php esc_html_e( 'Membership Starts from', 'invoicing' ); ?></h3> |
|
61 | + <h3><?php esc_html_e('Membership Starts from', 'invoicing'); ?></h3> |
|
62 | 62 | <h4>$99</h4> |
63 | - <a href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php esc_attr_e( 'Buy Membership', 'invoicing' ); ?></a> |
|
63 | + <a href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php esc_attr_e('Buy Membership', 'invoicing'); ?></a> |
|
64 | 64 | </div> |
65 | - <h3><?php esc_html_e( 'Included Gateways:', 'invoicing' ); ?></h3> |
|
65 | + <h3><?php esc_html_e('Included Gateways:', 'invoicing'); ?></h3> |
|
66 | 66 | <ul> |
67 | 67 | <?php |
68 | - if ( $addons = $addon_obj->get_section_data( 'gateways' ) ) { |
|
69 | - foreach ( $addons as $addon ) { |
|
70 | - echo '<li><i class="far fa-check-circle fa-sm"></i> ' . esc_html( $addon->info->title ) . '</li>'; |
|
68 | + if ($addons = $addon_obj->get_section_data('gateways')) { |
|
69 | + foreach ($addons as $addon) { |
|
70 | + echo '<li><i class="far fa-check-circle fa-sm"></i> ' . esc_html($addon->info->title) . '</li>'; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | ?> |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | <div class="testimonial-content"> |
82 | 82 | <div class="t-image"> |
83 | 83 | <?php |
84 | - echo '<img src="' . esc_url( plugins_url( 'images/t-image2.png', dirname( __FILE__ ) ) ) . '" > '; |
|
84 | + echo '<img src="' . esc_url(plugins_url('images/t-image2.png', dirname(__FILE__))) . '" > '; |
|
85 | 85 | ?> |
86 | 86 | </div> |
87 | 87 | <div class="t-content"> |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | <div class="testimonial-content"> |
102 | 102 | <div class="t-image"> |
103 | 103 | <?php |
104 | - echo '<img src="' . esc_url( plugins_url( 'images/t-image1.png', dirname( __FILE__ ) ) ) . '" > '; |
|
104 | + echo '<img src="' . esc_url(plugins_url('images/t-image1.png', dirname(__FILE__))) . '" > '; |
|
105 | 105 | ?> |
106 | 106 | </div> |
107 | 107 | <div class="t-content"> |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | </div> |
118 | 118 | </div> |
119 | 119 | <div class="member-footer"> |
120 | - <a class="footer-btn" href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php esc_html_e( 'Buy Membership', 'invoicing' ); ?></a> |
|
121 | - <a class="footer-link" href="post-new.php?post_type=wpi_invoice"><?php esc_html_e( 'Create Invoice', 'invoicing' ); ?></a> |
|
120 | + <a class="footer-btn" href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php esc_html_e('Buy Membership', 'invoicing'); ?></a> |
|
121 | + <a class="footer-link" href="post-new.php?post_type=wpi_invoice"><?php esc_html_e('Create Invoice', 'invoicing'); ?></a> |
|
122 | 122 | </div> |
123 | 123 | </div> |
124 | 124 | |
@@ -129,55 +129,55 @@ discard block |
||
129 | 129 | } else { |
130 | 130 | $installed_plugins = get_plugins(); |
131 | 131 | $addon_obj = new WPInv_Admin_Addons(); |
132 | - if ( $addons = $addon_obj->get_section_data( $current_tab ) ) : |
|
132 | + if ($addons = $addon_obj->get_section_data($current_tab)) : |
|
133 | 133 | //print_r($addons); |
134 | 134 | ?> |
135 | 135 | <ul class="wpi-products"> |
136 | 136 | <?php |
137 | - foreach ( $addons as $addon ) : |
|
138 | - if ( 965 == $addon->info->id ) { |
|
139 | -continue;}// don't show quote add on |
|
137 | + foreach ($addons as $addon) : |
|
138 | + if (965 == $addon->info->id) { |
|
139 | +continue; }// don't show quote add on |
|
140 | 140 | ?> |
141 | 141 | <li class="wpi-product"> |
142 | 142 | <div class="wpi-product-title"> |
143 | 143 | <h3> |
144 | 144 | <?php |
145 | - if ( ! empty( $addon->info->excerpt ) ) { |
|
146 | - wpi_help_tip( $addon->info->excerpt, false, false, true ); |
|
145 | + if (!empty($addon->info->excerpt)) { |
|
146 | + wpi_help_tip($addon->info->excerpt, false, false, true); |
|
147 | 147 | } |
148 | - echo esc_html( $addon->info->title ); |
|
148 | + echo esc_html($addon->info->title); |
|
149 | 149 | ?> |
150 | 150 | </h3> |
151 | 151 | </div> |
152 | 152 | |
153 | 153 | <span class="wpi-product-image"> |
154 | - <?php if ( ! empty( $addon->info->thumbnail ) ) : ?> |
|
155 | - <img src="<?php echo esc_attr( $addon->info->thumbnail ); ?>"/> |
|
154 | + <?php if (!empty($addon->info->thumbnail)) : ?> |
|
155 | + <img src="<?php echo esc_attr($addon->info->thumbnail); ?>"/> |
|
156 | 156 | <?php |
157 | 157 | endif; |
158 | 158 | |
159 | - if ( 'stripe-payment-gateway' == $addon->info->slug ) { |
|
159 | + if ('stripe-payment-gateway' == $addon->info->slug) { |
|
160 | 160 | $addon->info->slug = 'getpaid-stripe-payments'; |
161 | 161 | $addon->info->link = 'https://wordpress.org/plugins/getpaid-stripe-payments/'; |
162 | 162 | } |
163 | 163 | |
164 | - if ( isset( $addon->info->link ) && substr( $addon->info->link, 0, 21 ) === 'https://wordpress.org' ) { |
|
165 | - echo '<a href="' . esc_url( admin_url( '/plugin-install.php?tab=plugin-information&plugin=' . $addon->info->slug ) ) . '&width=770&height=660&TB_iframe=true" class="thickbox" >'; |
|
166 | - echo '<span class="wpi-product-info">' . esc_html__( 'More info', 'invoicing' ) . '</span>'; |
|
164 | + if (isset($addon->info->link) && substr($addon->info->link, 0, 21) === 'https://wordpress.org') { |
|
165 | + echo '<a href="' . esc_url(admin_url('/plugin-install.php?tab=plugin-information&plugin=' . $addon->info->slug)) . '&width=770&height=660&TB_iframe=true" class="thickbox" >'; |
|
166 | + echo '<span class="wpi-product-info">' . esc_html__('More info', 'invoicing') . '</span>'; |
|
167 | 167 | echo '</a>'; |
168 | - } elseif ( isset( $addon->info->link ) && ( substr( $addon->info->link, 0, 23 ) === 'https://wpinvoicing.com' || substr( $addon->info->link, 0, 21 ) === 'https://wpgetpaid.com' ) ) { |
|
169 | - if ( defined( 'WP_EASY_UPDATES_ACTIVE' ) ) { |
|
170 | - $url = admin_url( '/plugin-install.php?tab=plugin-information&plugin=' . $addon->info->slug . '&width=770&height=660&item_id=' . $addon->info->id . '&update_url=https://wpgetpaid.com&TB_iframe=true' ); |
|
168 | + } elseif (isset($addon->info->link) && (substr($addon->info->link, 0, 23) === 'https://wpinvoicing.com' || substr($addon->info->link, 0, 21) === 'https://wpgetpaid.com')) { |
|
169 | + if (defined('WP_EASY_UPDATES_ACTIVE')) { |
|
170 | + $url = admin_url('/plugin-install.php?tab=plugin-information&plugin=' . $addon->info->slug . '&width=770&height=660&item_id=' . $addon->info->id . '&update_url=https://wpgetpaid.com&TB_iframe=true'); |
|
171 | 171 | } else { |
172 | 172 | // if installed show activation link |
173 | - if ( isset( $installed_plugins['wp-easy-updates/external-updates.php'] ) ) { |
|
173 | + if (isset($installed_plugins['wp-easy-updates/external-updates.php'])) { |
|
174 | 174 | $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-activation'; |
175 | 175 | } else { |
176 | 176 | $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-for-external'; |
177 | 177 | } |
178 | 178 | } |
179 | - echo '<a href="' . esc_url( $url ) . '" class="thickbox">'; |
|
180 | - echo '<span class="wpi-product-info">' . esc_html__( 'More info', 'invoicing' ) . '</span>'; |
|
179 | + echo '<a href="' . esc_url($url) . '" class="thickbox">'; |
|
180 | + echo '<span class="wpi-product-info">' . esc_html__('More info', 'invoicing') . '</span>'; |
|
181 | 181 | echo '</a>'; |
182 | 182 | } |
183 | 183 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | |
189 | 189 | <span class="wpi-product-button"> |
190 | 190 | <?php |
191 | - $addon_obj->output_button( $addon ); |
|
191 | + $addon_obj->output_button($addon); |
|
192 | 192 | ?> |
193 | 193 | </span> |
194 | 194 | |
@@ -202,21 +202,21 @@ discard block |
||
202 | 202 | |
203 | 203 | <div class="clearfix" ></div> |
204 | 204 | |
205 | - <?php if ( $current_tab == 'addons' ) { ?> |
|
206 | - <p><?php printf( esc_attr__( 'All of our Addons can be found on wpGetPaid.com here: %sInvoicing Addons%s', 'invoicing' ), '<a href="https://wpinvoicing.com/downloads/category/addons/">','</a>' ); ?></p> |
|
207 | - <?php } if ( $current_tab == 'gateways' ) { ?> |
|
208 | - <p><?php printf( esc_attr__( 'All of our Payment Gateways can be found on wpGetPaid.com here: %sGetPaid Payment Gateways %s', 'invoicing' ), '<a href="https://wpinvoicing.com/downloads/category/gateways/">','</a>' ); ?></p> |
|
205 | + <?php if ($current_tab == 'addons') { ?> |
|
206 | + <p><?php printf(esc_attr__('All of our Addons can be found on wpGetPaid.com here: %sInvoicing Addons%s', 'invoicing'), '<a href="https://wpinvoicing.com/downloads/category/addons/">', '</a>'); ?></p> |
|
207 | + <?php } if ($current_tab == 'gateways') { ?> |
|
208 | + <p><?php printf(esc_attr__('All of our Payment Gateways can be found on wpGetPaid.com here: %sGetPaid Payment Gateways %s', 'invoicing'), '<a href="https://wpinvoicing.com/downloads/category/gateways/">', '</a>'); ?></p> |
|
209 | 209 | <?php } ?> |
210 | 210 | |
211 | - <div id="wpi-wpeu-required-activation" style="display:none;"><span class="wpi-notification "><?php echo wp_kses_post( sprintf( __( "The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s'>activate</a> it now.", 'invoicing' ), wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=wp-easy-updates/external-updates.php' ), 'activate-plugin_wp-easy-updates/external-updates.php' ) ) ); ?></span></div> |
|
212 | - <div id="wpi-wpeu-required-for-external" style="display:none;"><span class="wpi-notification "><?php echo wp_kses_post( sprintf( __( "The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s' onclick='window.open(\"https://wpeasyupdates.com/wp-easy-updates.zip\", \"_blank\");' >download</a> and install it now.", 'invoicing' ), admin_url( 'plugin-install.php?tab=upload&wpeu-install=true' ) ) ); ?></span></div> |
|
211 | + <div id="wpi-wpeu-required-activation" style="display:none;"><span class="wpi-notification "><?php echo wp_kses_post(sprintf(__("The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s'>activate</a> it now.", 'invoicing'), wp_nonce_url(admin_url('plugins.php?action=activate&plugin=wp-easy-updates/external-updates.php'), 'activate-plugin_wp-easy-updates/external-updates.php'))); ?></span></div> |
|
212 | + <div id="wpi-wpeu-required-for-external" style="display:none;"><span class="wpi-notification "><?php echo wp_kses_post(sprintf(__("The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s' onclick='window.open(\"https://wpeasyupdates.com/wp-easy-updates.zip\", \"_blank\");' >download</a> and install it now.", 'invoicing'), admin_url('plugin-install.php?tab=upload&wpeu-install=true'))); ?></span></div> |
|
213 | 213 | <div id="wpeu-licence-popup" style="display:none;"> |
214 | 214 | <span class="wpi-notification noti-white"> |
215 | - <h3 class="wpeu-licence-title"><?php esc_html_e( 'Licence key', 'invoicing' ); ?></h3> |
|
216 | - <input class="wpeu-licence-key" type="text" placeholder="<?php esc_attr_e( 'Enter your licence key', 'invoicing' ); ?>"> <button class="button-primary wpeu-licence-popup-button" ><?php esc_html_e( 'Install', 'invoicing' ); ?></button> |
|
215 | + <h3 class="wpeu-licence-title"><?php esc_html_e('Licence key', 'invoicing'); ?></h3> |
|
216 | + <input class="wpeu-licence-key" type="text" placeholder="<?php esc_attr_e('Enter your licence key', 'invoicing'); ?>"> <button class="button-primary wpeu-licence-popup-button" ><?php esc_html_e('Install', 'invoicing'); ?></button> |
|
217 | 217 | <br> |
218 | 218 | <?php |
219 | - printf( esc_html__( '%1$sFind your licence key here%2$s OR %3$sBuy one here%4$s', 'invoicing' ), '<a href="https://wpinvoicing.com/your-account/" target="_blank">', '</a>', '<a class="wpeu-licence-link" href="https://wpinvoicing.com/downloads/category/addons/" target="_blank">', '</a>' ); |
|
219 | + printf(esc_html__('%1$sFind your licence key here%2$s OR %3$sBuy one here%4$s', 'invoicing'), '<a href="https://wpinvoicing.com/your-account/" target="_blank">', '</a>', '<a class="wpeu-licence-link" href="https://wpinvoicing.com/downloads/category/addons/" target="_blank">', '</a>'); |
|
220 | 220 | ?> |
221 | 221 | </span> |
222 | 222 | </div> |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | function aui_init_flatpickr(){ |
248 | 248 | if ( typeof jQuery.fn.flatpickr === "function" && !$aui_doing_init_flatpickr) { |
249 | 249 | $aui_doing_init_flatpickr = true; |
250 | - <?php if ( ! empty( $flatpickr_locale ) ) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; ?>);}catch(err){console.log(err.message);}<?php } ?> |
|
250 | + <?php if (!empty($flatpickr_locale)) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; ?>);}catch(err){console.log(err.message);}<?php } ?> |
|
251 | 251 | jQuery('input[data-aui-init="flatpickr"]:not(.flatpickr-input)').flatpickr(); |
252 | 252 | } |
253 | 253 | $aui_doing_init_flatpickr = false; |
@@ -994,7 +994,7 @@ discard block |
||
994 | 994 | |
995 | 995 | <?php |
996 | 996 | // FSE tweaks. |
997 | - if(!empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template'){ ?> |
|
997 | + if (!empty($_REQUEST['postType']) && $_REQUEST['postType'] == 'wp_template') { ?> |
|
998 | 998 | function aui_fse_set_data_scroll() { |
999 | 999 | console.log('init scroll'); |
1000 | 1000 | let Iframe = document.getElementsByClassName("edit-site-visual-editor__editor-canvas"); |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | * |
14 | 14 | * @return array|mixed|string|string[] |
15 | 15 | */ |
16 | -function aui_bs_convert_sd_output( $output, $instance = '', $args = '', $sd = '' ) { |
|
16 | +function aui_bs_convert_sd_output($output, $instance = '', $args = '', $sd = '') { |
|
17 | 17 | global $aui_bs5; |
18 | 18 | |
19 | - if ( $aui_bs5 ) { |
|
19 | + if ($aui_bs5) { |
|
20 | 20 | |
21 | 21 | $convert = array( |
22 | 22 | 'ml-' => 'ms-', |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | 'class="close"' => 'class="btn-close"', |
58 | 58 | '<span aria-hidden="true">×</span>' => '', |
59 | 59 | ); |
60 | - $output = str_replace( |
|
61 | - array_keys( $convert ), |
|
62 | - array_values( $convert ), |
|
60 | + $output = str_replace( |
|
61 | + array_keys($convert), |
|
62 | + array_values($convert), |
|
63 | 63 | $output |
64 | 64 | ); |
65 | 65 | } |
@@ -67,4 +67,4 @@ discard block |
||
67 | 67 | return $output; |
68 | 68 | } |
69 | 69 | |
70 | -add_filter( 'wp_super_duper_widget_output', 'aui_bs_convert_sd_output', 10, 4 ); //$output, $instance, $args, $this |
|
70 | +add_filter('wp_super_duper_widget_output', 'aui_bs_convert_sd_output', 10, 4); //$output, $instance, $args, $this |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
3 | +if (!defined('ABSPATH')) { |
|
4 | 4 | exit; // Exit if accessed directly |
5 | 5 | } |
6 | 6 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return string The rendered component. |
20 | 20 | */ |
21 | - public static function get($args = array()){ |
|
21 | + public static function get($args = array()) { |
|
22 | 22 | global $aui_bs5; |
23 | 23 | $defaults = array( |
24 | 24 | 'type' => 'info', |
@@ -34,47 +34,47 @@ discard block |
||
34 | 34 | /** |
35 | 35 | * Parse incoming $args into an array and merge it with $defaults |
36 | 36 | */ |
37 | - $args = wp_parse_args( $args, $defaults ); |
|
37 | + $args = wp_parse_args($args, $defaults); |
|
38 | 38 | $output = ''; |
39 | - if ( ! empty( $args['content'] ) ) { |
|
40 | - $type = sanitize_html_class( $args['type'] ); |
|
41 | - if($type=='error'){$type='danger';} |
|
42 | - $icon = !empty($args['icon']) ? "<i class='".esc_attr($args['icon'])."'></i>" : ''; |
|
39 | + if (!empty($args['content'])) { |
|
40 | + $type = sanitize_html_class($args['type']); |
|
41 | + if ($type == 'error') {$type = 'danger'; } |
|
42 | + $icon = !empty($args['icon']) ? "<i class='" . esc_attr($args['icon']) . "'></i>" : ''; |
|
43 | 43 | |
44 | 44 | // set default icon |
45 | - if(!$icon && $args['icon']!==false && $type){ |
|
46 | - if($type=='danger'){$icon = '<i class="fas fa-exclamation-circle"></i>';} |
|
47 | - elseif($type=='warning'){$icon = '<i class="fas fa-exclamation-triangle"></i>';} |
|
48 | - elseif($type=='success'){$icon = '<i class="fas fa-check-circle"></i>';} |
|
49 | - elseif($type=='info'){$icon = '<i class="fas fa-info-circle"></i>';} |
|
45 | + if (!$icon && $args['icon'] !== false && $type) { |
|
46 | + if ($type == 'danger') {$icon = '<i class="fas fa-exclamation-circle"></i>'; } |
|
47 | + elseif ($type == 'warning') {$icon = '<i class="fas fa-exclamation-triangle"></i>'; } |
|
48 | + elseif ($type == 'success') {$icon = '<i class="fas fa-check-circle"></i>'; } |
|
49 | + elseif ($type == 'info') {$icon = '<i class="fas fa-info-circle"></i>'; } |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | $data = ''; |
53 | 53 | $class = !empty($args['class']) ? esc_attr($args['class']) : ''; |
54 | - if($args['dismissible']){$class .= " alert-dismissible fade show";} |
|
54 | + if ($args['dismissible']) {$class .= " alert-dismissible fade show"; } |
|
55 | 55 | |
56 | 56 | // open |
57 | - $output .= '<div class="alert alert-' . $type . ' '.$class.'" role="alert" '.$data.'>'; |
|
57 | + $output .= '<div class="alert alert-' . $type . ' ' . $class . '" role="alert" ' . $data . '>'; |
|
58 | 58 | |
59 | 59 | // heading |
60 | - if ( ! empty( $args['heading'] ) ) { |
|
60 | + if (!empty($args['heading'])) { |
|
61 | 61 | $output .= '<h4 class="alert-heading">' . $args['heading'] . '</h4>'; |
62 | 62 | } |
63 | 63 | |
64 | 64 | // icon |
65 | - if ( ! empty( $icon) ) { |
|
66 | - $output .= $icon." "; |
|
65 | + if (!empty($icon)) { |
|
66 | + $output .= $icon . " "; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | // content |
70 | 70 | $output .= $args['content']; |
71 | 71 | |
72 | 72 | // dismissible |
73 | - if($args['dismissible']){ |
|
73 | + if ($args['dismissible']) { |
|
74 | 74 | |
75 | - if ( $aui_bs5 ) { |
|
75 | + if ($aui_bs5) { |
|
76 | 76 | $output .= '<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>'; |
77 | - }else{ |
|
77 | + } else { |
|
78 | 78 | $output .= '<button type="button" class="close" data-dismiss="alert" aria-label="Close">'; |
79 | 79 | $output .= '<span aria-hidden="true">×</span>'; |
80 | 80 | $output .= '</button>'; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | // footer |
85 | - if ( ! empty( $args['footer'] ) ) { |
|
85 | + if (!empty($args['footer'])) { |
|
86 | 86 | $output .= '<hr>'; |
87 | 87 | $output .= '<p class="mb-0">' . $args['footer'] . '</p>'; |
88 | 88 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
3 | +if (!defined('ABSPATH')) { |
|
4 | 4 | exit; // Exit if accessed directly |
5 | 5 | } |
6 | 6 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return string The rendered component. |
20 | 20 | */ |
21 | - public static function get( $args = array() ) { |
|
21 | + public static function get($args = array()) { |
|
22 | 22 | global $wp_query, $aui_bs5; |
23 | 23 | |
24 | 24 | $defaults = array( |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | 'mid_size' => 2, |
27 | 27 | 'prev_text' => '<i class="fas fa-chevron-left"></i>', |
28 | 28 | 'next_text' => '<i class="fas fa-chevron-right"></i>', |
29 | - 'screen_reader_text' => __( 'Posts navigation','aui' ), |
|
29 | + 'screen_reader_text' => __('Posts navigation', 'aui'), |
|
30 | 30 | 'before_paging' => '', |
31 | 31 | 'after_paging' => '', |
32 | 32 | 'type' => 'array', |
33 | - 'total' => isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1, |
|
33 | + 'total' => isset($wp_query->max_num_pages) ? $wp_query->max_num_pages : 1, |
|
34 | 34 | 'links' => array(), // an array of links if using custom links, this includes the a tag. |
35 | 35 | 'rounded_style' => false, |
36 | 36 | 'custom_next_text' => '', // Custom next page text |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * Parse incoming $args into an array and merge it with $defaults |
42 | 42 | */ |
43 | - $args = wp_parse_args( $args, $defaults ); |
|
43 | + $args = wp_parse_args($args, $defaults); |
|
44 | 44 | |
45 | 45 | $output = ''; |
46 | 46 | |
47 | 47 | // Don't print empty markup if there's only one page. |
48 | - if ( $args['total'] > 1 ) { |
|
48 | + if ($args['total'] > 1) { |
|
49 | 49 | // Set up paginated links. |
50 | - $links = !empty( $args['links'] ) ? $args['links'] : paginate_links( $args ); |
|
50 | + $links = !empty($args['links']) ? $args['links'] : paginate_links($args); |
|
51 | 51 | |
52 | 52 | $class = !empty($args['class']) ? $args['class'] : ''; |
53 | 53 | |
@@ -56,62 +56,62 @@ discard block |
||
56 | 56 | |
57 | 57 | // make the output bootstrap ready |
58 | 58 | $links_html = "<ul class='pagination m-0 p-0 $class'>"; |
59 | - if ( ! empty( $links ) ) { |
|
60 | - foreach ( $links as $link ) { |
|
59 | + if (!empty($links)) { |
|
60 | + foreach ($links as $link) { |
|
61 | 61 | $_link = $link; |
62 | 62 | |
63 | - if ( $aui_bs5 ) { |
|
63 | + if ($aui_bs5) { |
|
64 | 64 | $link_class = $args['rounded_style'] ? 'page-link badge rounded-pill border-0 mx-1 fs-base text-dark link-primary' : 'page-link'; |
65 | 65 | $link_class_active = $args['rounded_style'] ? ' current active fw-bold badge rounded-pill' : ' current active'; |
66 | 66 | $links_html .= "<li class='page-item mx-0'>"; |
67 | - $link = str_replace( array( "page-numbers", " current" ), array( $link_class, $link_class_active ), $link ); |
|
68 | - $link = str_replace( 'text-dark link-primary current', 'current', $link ); |
|
69 | - $links_html .= $link; |
|
67 | + $link = str_replace(array("page-numbers", " current"), array($link_class, $link_class_active), $link); |
|
68 | + $link = str_replace('text-dark link-primary current', 'current', $link); |
|
69 | + $links_html .= $link; |
|
70 | 70 | $links_html .= "</li>"; |
71 | 71 | } else { |
72 | - $active = strpos( $link, 'current' ) !== false ? 'active' : ''; |
|
72 | + $active = strpos($link, 'current') !== false ? 'active' : ''; |
|
73 | 73 | $links_html .= "<li class='page-item $active'>"; |
74 | - $links_html .= str_replace( "page-numbers", "page-link", $link ); |
|
74 | + $links_html .= str_replace("page-numbers", "page-link", $link); |
|
75 | 75 | $links_html .= "</li>"; |
76 | 76 | } |
77 | 77 | |
78 | - if ( strpos( $_link, 'next page-numbers' ) || strpos( $_link, 'prev page-numbers' ) ) { |
|
79 | - $link = str_replace( array( "page-numbers", " current" ), array( 'btn btn-outline-primary rounded' . ( $args['rounded_style'] ? '-pill' : '' ) . ' mx-1 fs-base text-dark link-primary', ' current active fw-bold badge rounded-pill' ), $_link ); |
|
80 | - $link = str_replace( 'text-dark link-primary current', 'current', $link ); |
|
78 | + if (strpos($_link, 'next page-numbers') || strpos($_link, 'prev page-numbers')) { |
|
79 | + $link = str_replace(array("page-numbers", " current"), array('btn btn-outline-primary rounded' . ($args['rounded_style'] ? '-pill' : '') . ' mx-1 fs-base text-dark link-primary', ' current active fw-bold badge rounded-pill'), $_link); |
|
80 | + $link = str_replace('text-dark link-primary current', 'current', $link); |
|
81 | 81 | |
82 | - if ( strpos( $_link, 'next page-numbers' ) && ! empty( $args['custom_next_text'] ) ) { |
|
83 | - $custom_next_link = str_replace( $args['next_text'], $args['custom_next_text'], $link ); |
|
84 | - } else if ( strpos( $_link, 'prev page-numbers' ) && ! empty( $args['custom_prev_text'] ) ) { |
|
85 | - $custom_prev_link = str_replace( $args['prev_text'], $args['custom_prev_text'], $link ); |
|
82 | + if (strpos($_link, 'next page-numbers') && !empty($args['custom_next_text'])) { |
|
83 | + $custom_next_link = str_replace($args['next_text'], $args['custom_next_text'], $link); |
|
84 | + } else if (strpos($_link, 'prev page-numbers') && !empty($args['custom_prev_text'])) { |
|
85 | + $custom_prev_link = str_replace($args['prev_text'], $args['custom_prev_text'], $link); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | } |
89 | 89 | } |
90 | 90 | $links_html .= "</ul>"; |
91 | 91 | |
92 | - if ( $links ) { |
|
92 | + if ($links) { |
|
93 | 93 | $output .= '<section class="px-0 py-2 w-100">'; |
94 | - $output .= _navigation_markup( $links_html, 'aui-pagination', $args['screen_reader_text'] ); |
|
94 | + $output .= _navigation_markup($links_html, 'aui-pagination', $args['screen_reader_text']); |
|
95 | 95 | $output .= '</section>'; |
96 | 96 | } |
97 | 97 | |
98 | - $output = str_replace( "screen-reader-text", "screen-reader-text sr-only", $output ); |
|
99 | - $output = str_replace( "nav-links", "aui-nav-links", $output ); |
|
98 | + $output = str_replace("screen-reader-text", "screen-reader-text sr-only", $output); |
|
99 | + $output = str_replace("nav-links", "aui-nav-links", $output); |
|
100 | 100 | } |
101 | 101 | |
102 | - if ( $output ) { |
|
103 | - if ( $custom_next_link || $custom_prev_link ) { |
|
104 | - $total = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1; |
|
105 | - $current = get_query_var( 'paged' ) ? (int) get_query_var( 'paged' ) : 1; |
|
102 | + if ($output) { |
|
103 | + if ($custom_next_link || $custom_prev_link) { |
|
104 | + $total = isset($wp_query->max_num_pages) ? $wp_query->max_num_pages : 1; |
|
105 | + $current = get_query_var('paged') ? (int) get_query_var('paged') : 1; |
|
106 | 106 | |
107 | 107 | $output = '<div class="row d-flex align-items-center justify-content-between"><div class="col text-start">' . $custom_prev_link . '</div><div class="col text-center d-none d-md-block">' . $output . '</div><div class="col text-center d-md-none">' . $current . '/' . $args['total'] . '</div><div class="col text-end">' . $custom_next_link . '</div></div>'; |
108 | 108 | } |
109 | 109 | |
110 | - if ( ! empty( $args['before_paging'] ) ) { |
|
110 | + if (!empty($args['before_paging'])) { |
|
111 | 111 | $output = $args['before_paging'] . $output; |
112 | 112 | } |
113 | 113 | |
114 | - if ( ! empty( $args['after_paging'] ) ) { |
|
114 | + if (!empty($args['after_paging'])) { |
|
115 | 115 | $output = $output . $args['after_paging']; |
116 | 116 | } |
117 | 117 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
3 | +if (!defined('ABSPATH')) { |
|
4 | 4 | exit; // Exit if accessed directly |
5 | 5 | } |
6 | 6 | |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @return string |
21 | 21 | */ |
22 | - public static function name( $text, $multiple = false ) { |
|
22 | + public static function name($text, $multiple = false) { |
|
23 | 23 | $output = ''; |
24 | 24 | |
25 | - if ( $text ) { |
|
26 | - $is_multiple = strpos( $text, '[' ) === false && $multiple ? '[]' : ''; |
|
27 | - $output = ' name="' . esc_attr( $text ) . $is_multiple . '" '; |
|
25 | + if ($text) { |
|
26 | + $is_multiple = strpos($text, '[') === false && $multiple ? '[]' : ''; |
|
27 | + $output = ' name="' . esc_attr($text) . $is_multiple . '" '; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | return $output; |
@@ -37,11 +37,11 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @return string The sanitized item. |
39 | 39 | */ |
40 | - public static function id( $text ) { |
|
40 | + public static function id($text) { |
|
41 | 41 | $output = ''; |
42 | 42 | |
43 | - if ( $text ) { |
|
44 | - $output = ' id="' . sanitize_html_class( $text ) . '" '; |
|
43 | + if ($text) { |
|
44 | + $output = ' id="' . sanitize_html_class($text) . '" '; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | return $output; |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return string The sanitized item. |
56 | 56 | */ |
57 | - public static function title( $text ) { |
|
57 | + public static function title($text) { |
|
58 | 58 | $output = ''; |
59 | 59 | |
60 | - if ( $text ) { |
|
61 | - $output = ' title="' . esc_attr( $text ) . '" '; |
|
60 | + if ($text) { |
|
61 | + $output = ' title="' . esc_attr($text) . '" '; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | return $output; |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @return string The sanitized item. |
73 | 73 | */ |
74 | - public static function value( $text ) { |
|
74 | + public static function value($text) { |
|
75 | 75 | $output = ''; |
76 | 76 | |
77 | - if ( $text !== null && $text !== false ) { |
|
78 | - $output = ' value="' . esc_attr( wp_unslash( $text ) ) . '" '; |
|
77 | + if ($text !== null && $text !== false) { |
|
78 | + $output = ' value="' . esc_attr(wp_unslash($text)) . '" '; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | return $output; |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return string The sanitized item. |
90 | 90 | */ |
91 | - public static function class_attr( $text ) { |
|
91 | + public static function class_attr($text) { |
|
92 | 92 | $output = ''; |
93 | 93 | |
94 | - if ( $text ) { |
|
95 | - $classes = self::esc_classes( $text ); |
|
96 | - if ( ! empty( $classes ) ) { |
|
94 | + if ($text) { |
|
95 | + $classes = self::esc_classes($text); |
|
96 | + if (!empty($classes)) { |
|
97 | 97 | $output = ' class="' . $classes . '" '; |
98 | 98 | } |
99 | 99 | } |
@@ -108,15 +108,15 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return string |
110 | 110 | */ |
111 | - public static function esc_classes( $text ) { |
|
111 | + public static function esc_classes($text) { |
|
112 | 112 | $output = ''; |
113 | 113 | |
114 | - if ( $text ) { |
|
115 | - $classes = explode( " ", $text ); |
|
116 | - $classes = array_map( "trim", $classes ); |
|
117 | - $classes = array_map( "sanitize_html_class", $classes ); |
|
118 | - if ( ! empty( $classes ) ) { |
|
119 | - $output = implode( " ", $classes ); |
|
114 | + if ($text) { |
|
115 | + $classes = explode(" ", $text); |
|
116 | + $classes = array_map("trim", $classes); |
|
117 | + $classes = array_map("sanitize_html_class", $classes); |
|
118 | + if (!empty($classes)) { |
|
119 | + $output = implode(" ", $classes); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
@@ -129,14 +129,14 @@ discard block |
||
129 | 129 | * |
130 | 130 | * @return string |
131 | 131 | */ |
132 | - public static function data_attributes( $args ) { |
|
132 | + public static function data_attributes($args) { |
|
133 | 133 | $output = ''; |
134 | 134 | |
135 | - if ( ! empty( $args ) ) { |
|
135 | + if (!empty($args)) { |
|
136 | 136 | |
137 | - foreach ( $args as $key => $val ) { |
|
138 | - if ( substr( $key, 0, 5 ) === "data-" ) { |
|
139 | - $output .= ' ' . sanitize_html_class( $key ) . '="' . esc_attr( $val ) . '" '; |
|
137 | + foreach ($args as $key => $val) { |
|
138 | + if (substr($key, 0, 5) === "data-") { |
|
139 | + $output .= ' ' . sanitize_html_class($key) . '="' . esc_attr($val) . '" '; |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | } |
@@ -149,14 +149,14 @@ discard block |
||
149 | 149 | * |
150 | 150 | * @return string |
151 | 151 | */ |
152 | - public static function aria_attributes( $args ) { |
|
152 | + public static function aria_attributes($args) { |
|
153 | 153 | $output = ''; |
154 | 154 | |
155 | - if ( ! empty( $args ) ) { |
|
155 | + if (!empty($args)) { |
|
156 | 156 | |
157 | - foreach ( $args as $key => $val ) { |
|
158 | - if ( substr( $key, 0, 5 ) === "aria-" ) { |
|
159 | - $output .= ' ' . sanitize_html_class( $key ) . '="' . esc_attr( $val ) . '" '; |
|
157 | + foreach ($args as $key => $val) { |
|
158 | + if (substr($key, 0, 5) === "aria-") { |
|
159 | + $output .= ' ' . sanitize_html_class($key) . '="' . esc_attr($val) . '" '; |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | } |
@@ -173,19 +173,19 @@ discard block |
||
173 | 173 | * |
174 | 174 | * @return string |
175 | 175 | */ |
176 | - public static function icon( $class, $space_after = false, $extra_attributes = array() ) { |
|
176 | + public static function icon($class, $space_after = false, $extra_attributes = array()) { |
|
177 | 177 | $output = ''; |
178 | 178 | |
179 | - if ( $class ) { |
|
180 | - $classes = self::esc_classes( $class ); |
|
181 | - if ( ! empty( $classes ) ) { |
|
179 | + if ($class) { |
|
180 | + $classes = self::esc_classes($class); |
|
181 | + if (!empty($classes)) { |
|
182 | 182 | $output = '<i class="' . $classes . '" '; |
183 | 183 | // extra attributes |
184 | - if ( ! empty( $extra_attributes ) ) { |
|
185 | - $output .= AUI_Component_Helper::extra_attributes( $extra_attributes ); |
|
184 | + if (!empty($extra_attributes)) { |
|
185 | + $output .= AUI_Component_Helper::extra_attributes($extra_attributes); |
|
186 | 186 | } |
187 | 187 | $output .= '></i>'; |
188 | - if ( $space_after ) { |
|
188 | + if ($space_after) { |
|
189 | 189 | $output .= " "; |
190 | 190 | } |
191 | 191 | } |
@@ -199,14 +199,14 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @return string |
201 | 201 | */ |
202 | - public static function extra_attributes( $args ) { |
|
202 | + public static function extra_attributes($args) { |
|
203 | 203 | $output = ''; |
204 | 204 | |
205 | - if ( ! empty( $args ) ) { |
|
205 | + if (!empty($args)) { |
|
206 | 206 | |
207 | - if ( is_array( $args ) ) { |
|
208 | - foreach ( $args as $key => $val ) { |
|
209 | - $output .= ' ' . sanitize_html_class( $key ) . '="' . esc_attr( $val ) . '" '; |
|
207 | + if (is_array($args)) { |
|
208 | + foreach ($args as $key => $val) { |
|
209 | + $output .= ' ' . sanitize_html_class($key) . '="' . esc_attr($val) . '" '; |
|
210 | 210 | } |
211 | 211 | } else { |
212 | 212 | $output .= ' ' . $args . ' '; |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | * |
223 | 223 | * @return string |
224 | 224 | */ |
225 | - public static function help_text( $text ) { |
|
225 | + public static function help_text($text) { |
|
226 | 226 | $output = ''; |
227 | 227 | |
228 | - if ( $text ) { |
|
229 | - $output .= '<small class="form-text text-muted d-block">' . wp_kses_post( $text ) . '</small>'; |
|
228 | + if ($text) { |
|
229 | + $output .= '<small class="form-text text-muted d-block">' . wp_kses_post($text) . '</small>'; |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | |
@@ -240,17 +240,17 @@ discard block |
||
240 | 240 | * |
241 | 241 | * @return string|void |
242 | 242 | */ |
243 | - public static function element_require( $input ) { |
|
243 | + public static function element_require($input) { |
|
244 | 244 | |
245 | - $input = str_replace( "'", '"', $input );// we only want double quotes |
|
245 | + $input = str_replace("'", '"', $input); // we only want double quotes |
|
246 | 246 | |
247 | - $output = esc_attr( str_replace( array( "[%", "%]", "%:checked]" ), array( |
|
247 | + $output = esc_attr(str_replace(array("[%", "%]", "%:checked]"), array( |
|
248 | 248 | "jQuery(form).find('[data-argument=\"", |
249 | 249 | "\"]').find('input,select,textarea').val()", |
250 | 250 | "\"]').find('input:checked').val()", |
251 | - ), $input ) ); |
|
251 | + ), $input)); |
|
252 | 252 | |
253 | - if ( $output ) { |
|
253 | + if ($output) { |
|
254 | 254 | $output = ' data-element-require="' . $output . '" '; |
255 | 255 | } |
256 | 256 | |
@@ -267,21 +267,21 @@ discard block |
||
267 | 267 | * |
268 | 268 | * @return mixed Stripped value. |
269 | 269 | */ |
270 | - public static function sanitize_html_field( $value, $input = array() ) { |
|
270 | + public static function sanitize_html_field($value, $input = array()) { |
|
271 | 271 | $original = $value; |
272 | 272 | |
273 | - if ( is_array( $value ) ) { |
|
274 | - foreach ( $value as $index => $item ) { |
|
275 | - $value[ $index ] = self::_sanitize_html_field( $value, $input ); |
|
273 | + if (is_array($value)) { |
|
274 | + foreach ($value as $index => $item) { |
|
275 | + $value[$index] = self::_sanitize_html_field($value, $input); |
|
276 | 276 | } |
277 | - } elseif ( is_object( $value ) ) { |
|
278 | - $object_vars = get_object_vars( $value ); |
|
277 | + } elseif (is_object($value)) { |
|
278 | + $object_vars = get_object_vars($value); |
|
279 | 279 | |
280 | - foreach ( $object_vars as $property_name => $property_value ) { |
|
281 | - $value->$property_name = self::_sanitize_html_field( $property_value, $input ); |
|
280 | + foreach ($object_vars as $property_name => $property_value) { |
|
281 | + $value->$property_name = self::_sanitize_html_field($property_value, $input); |
|
282 | 282 | } |
283 | 283 | } else { |
284 | - $value = self::_sanitize_html_field( $value, $input ); |
|
284 | + $value = self::_sanitize_html_field($value, $input); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | /** |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | * @param string|array $value Original content without filter. |
294 | 294 | * @param array $input Input Field. |
295 | 295 | */ |
296 | - return apply_filters( 'ayecode_ui_sanitize_html_field', $value, $original, $input ); |
|
296 | + return apply_filters('ayecode_ui_sanitize_html_field', $value, $original, $input); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | /** |
@@ -316,20 +316,20 @@ discard block |
||
316 | 316 | * |
317 | 317 | * @return string Filtered content with only allowed HTML elements. |
318 | 318 | */ |
319 | - public static function _sanitize_html_field( $value, $input = array() ) { |
|
320 | - if ( $value === '' ) { |
|
319 | + public static function _sanitize_html_field($value, $input = array()) { |
|
320 | + if ($value === '') { |
|
321 | 321 | return $value; |
322 | 322 | } |
323 | 323 | |
324 | - $allowed_html = self::kses_allowed_html( 'post', $input ); |
|
324 | + $allowed_html = self::kses_allowed_html('post', $input); |
|
325 | 325 | |
326 | - if ( ! is_array( $allowed_html ) ) { |
|
327 | - $allowed_html = wp_kses_allowed_html( 'post' ); |
|
326 | + if (!is_array($allowed_html)) { |
|
327 | + $allowed_html = wp_kses_allowed_html('post'); |
|
328 | 328 | } |
329 | 329 | |
330 | - $filtered = trim( wp_unslash( $value ) ); |
|
331 | - $filtered = wp_kses( $filtered, $allowed_html ); |
|
332 | - $filtered = balanceTags( $filtered ); // Balances tags |
|
330 | + $filtered = trim(wp_unslash($value)); |
|
331 | + $filtered = wp_kses($filtered, $allowed_html); |
|
332 | + $filtered = balanceTags($filtered); // Balances tags |
|
333 | 333 | |
334 | 334 | return $filtered; |
335 | 335 | } |
@@ -346,12 +346,12 @@ discard block |
||
346 | 346 | * |
347 | 347 | * @return array Array of allowed HTML tags and their allowed attributes. |
348 | 348 | */ |
349 | - public static function kses_allowed_html( $context = 'post', $input = array() ) { |
|
350 | - $allowed_html = wp_kses_allowed_html( $context ); |
|
349 | + public static function kses_allowed_html($context = 'post', $input = array()) { |
|
350 | + $allowed_html = wp_kses_allowed_html($context); |
|
351 | 351 | |
352 | - if ( is_array( $allowed_html ) ) { |
|
352 | + if (is_array($allowed_html)) { |
|
353 | 353 | // <iframe> |
354 | - if ( ! isset( $allowed_html['iframe'] ) && $context == 'post' ) { |
|
354 | + if (!isset($allowed_html['iframe']) && $context == 'post') { |
|
355 | 355 | $allowed_html['iframe'] = array( |
356 | 356 | 'class' => true, |
357 | 357 | 'id' => true, |
@@ -380,23 +380,23 @@ discard block |
||
380 | 380 | * @param @param string|array $context The context for which to retrieve tags. |
381 | 381 | * @param array $input Input field. |
382 | 382 | */ |
383 | - return apply_filters( 'ayecode_ui_kses_allowed_html', $allowed_html, $context, $input ); |
|
383 | + return apply_filters('ayecode_ui_kses_allowed_html', $allowed_html, $context, $input); |
|
384 | 384 | } |
385 | 385 | |
386 | - public static function get_column_class( $label_number = 2, $type = 'label' ) { |
|
386 | + public static function get_column_class($label_number = 2, $type = 'label') { |
|
387 | 387 | |
388 | 388 | $class = ''; |
389 | 389 | |
390 | 390 | // set default if empty |
391 | - if( $label_number === '' ){ |
|
391 | + if ($label_number === '') { |
|
392 | 392 | $label_number = 2; |
393 | 393 | } |
394 | 394 | |
395 | - if ( $label_number && $label_number < 12 && $label_number > 0 ) { |
|
396 | - if ( $type == 'label' ) { |
|
397 | - $class = 'col-sm-' . absint( $label_number ); |
|
398 | - } elseif ( $type == 'input' ) { |
|
399 | - $class = 'col-sm-' . ( 12 - absint( $label_number ) ); |
|
395 | + if ($label_number && $label_number < 12 && $label_number > 0) { |
|
396 | + if ($type == 'label') { |
|
397 | + $class = 'col-sm-' . absint($label_number); |
|
398 | + } elseif ($type == 'input') { |
|
399 | + $class = 'col-sm-' . (12 - absint($label_number)); |
|
400 | 400 | } |
401 | 401 | } |
402 | 402 | |
@@ -415,8 +415,8 @@ discard block |
||
415 | 415 | * @param string $str String to sanitize. |
416 | 416 | * @return string Sanitized string. |
417 | 417 | */ |
418 | - public static function sanitize_textarea_field( $str ) { |
|
419 | - $filtered = self::_sanitize_text_fields( $str, true ); |
|
418 | + public static function sanitize_textarea_field($str) { |
|
419 | + $filtered = self::_sanitize_text_fields($str, true); |
|
420 | 420 | |
421 | 421 | /** |
422 | 422 | * Filters a sanitized textarea field string. |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | * @param string $filtered The sanitized string. |
427 | 427 | * @param string $str The string prior to being sanitized. |
428 | 428 | */ |
429 | - return apply_filters( 'sanitize_textarea_field', $filtered, $str ); |
|
429 | + return apply_filters('sanitize_textarea_field', $filtered, $str); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | /** |
@@ -439,40 +439,40 @@ discard block |
||
439 | 439 | * @param bool $keep_newlines Optional. Whether to keep newlines. Default: false. |
440 | 440 | * @return string Sanitized string. |
441 | 441 | */ |
442 | - public static function _sanitize_text_fields( $str, $keep_newlines = false ) { |
|
443 | - if ( is_object( $str ) || is_array( $str ) ) { |
|
442 | + public static function _sanitize_text_fields($str, $keep_newlines = false) { |
|
443 | + if (is_object($str) || is_array($str)) { |
|
444 | 444 | return ''; |
445 | 445 | } |
446 | 446 | |
447 | 447 | $str = (string) $str; |
448 | 448 | |
449 | - $filtered = wp_check_invalid_utf8( $str ); |
|
449 | + $filtered = wp_check_invalid_utf8($str); |
|
450 | 450 | |
451 | - if ( strpos( $filtered, '<' ) !== false ) { |
|
452 | - $filtered = wp_pre_kses_less_than( $filtered ); |
|
451 | + if (strpos($filtered, '<') !== false) { |
|
452 | + $filtered = wp_pre_kses_less_than($filtered); |
|
453 | 453 | // This will strip extra whitespace for us. |
454 | - $filtered = wp_strip_all_tags( $filtered, false ); |
|
454 | + $filtered = wp_strip_all_tags($filtered, false); |
|
455 | 455 | |
456 | 456 | // Use HTML entities in a special case to make sure no later |
457 | 457 | // newline stripping stage could lead to a functional tag. |
458 | - $filtered = str_replace( "<\n", "<\n", $filtered ); |
|
458 | + $filtered = str_replace("<\n", "<\n", $filtered); |
|
459 | 459 | } |
460 | 460 | |
461 | - if ( ! $keep_newlines ) { |
|
462 | - $filtered = preg_replace( '/[\r\n\t ]+/', ' ', $filtered ); |
|
461 | + if (!$keep_newlines) { |
|
462 | + $filtered = preg_replace('/[\r\n\t ]+/', ' ', $filtered); |
|
463 | 463 | } |
464 | - $filtered = trim( $filtered ); |
|
464 | + $filtered = trim($filtered); |
|
465 | 465 | |
466 | 466 | $found = false; |
467 | - while ( preg_match( '`[^%](%[a-f0-9]{2})`i', $filtered, $match ) ) { |
|
468 | - $filtered = str_replace( $match[1], '', $filtered ); |
|
467 | + while (preg_match('`[^%](%[a-f0-9]{2})`i', $filtered, $match)) { |
|
468 | + $filtered = str_replace($match[1], '', $filtered); |
|
469 | 469 | $found = true; |
470 | 470 | } |
471 | - unset( $match ); |
|
471 | + unset($match); |
|
472 | 472 | |
473 | - if ( $found ) { |
|
473 | + if ($found) { |
|
474 | 474 | // Strip out the whitespace that may now exist after removing the octets. |
475 | - $filtered = trim( preg_replace( '` +`', ' ', $filtered ) ); |
|
475 | + $filtered = trim(preg_replace('` +`', ' ', $filtered)); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | return $filtered; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | */ |
16 | 16 | |
17 | 17 | // If this file is called directly, abort. |
18 | -if ( ! defined( 'WPINC' ) ) { |
|
18 | +if (!defined('WPINC')) { |
|
19 | 19 | die; |
20 | 20 | } |
21 | 21 | |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | public function __construct() { |
30 | 30 | |
31 | 31 | // load AUI |
32 | - require_once( dirname( __FILE__ ) . '/ayecode-ui-loader.php' ); |
|
32 | + require_once(dirname(__FILE__) . '/ayecode-ui-loader.php'); |
|
33 | 33 | |
34 | 34 | // Maybe show example page |
35 | - add_action( 'template_redirect', array( $this,'maybe_show_examples' ) ); |
|
35 | + add_action('template_redirect', array($this, 'maybe_show_examples')); |
|
36 | 36 | } |
37 | 37 | |
38 | - public function maybe_show_examples(){ |
|
39 | - if ( current_user_can( 'manage_options' ) && isset( $_REQUEST['preview-aui'] ) ) { |
|
38 | + public function maybe_show_examples() { |
|
39 | + if (current_user_can('manage_options') && isset($_REQUEST['preview-aui'])) { |
|
40 | 40 | echo "<head>"; |
41 | 41 | wp_head(); |
42 | 42 | echo "</head>"; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | - public function get_examples(){ |
|
51 | + public function get_examples() { |
|
52 | 52 | $output = ''; |
53 | 53 | |
54 | 54 | // open form |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | function aui_init_flatpickr(){ |
248 | 248 | if ( typeof jQuery.fn.flatpickr === "function" && !$aui_doing_init_flatpickr) { |
249 | 249 | $aui_doing_init_flatpickr = true; |
250 | - <?php if ( ! empty( $flatpickr_locale ) ) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; ?>);}catch(err){console.log(err.message);}<?php } ?> |
|
250 | + <?php if (!empty($flatpickr_locale)) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; ?>);}catch(err){console.log(err.message);}<?php } ?> |
|
251 | 251 | jQuery('input[data-aui-init="flatpickr"]:not(.flatpickr-input)').flatpickr(); |
252 | 252 | } |
253 | 253 | $aui_doing_init_flatpickr = false; |
@@ -994,7 +994,7 @@ discard block |
||
994 | 994 | |
995 | 995 | <?php |
996 | 996 | // FSE tweaks. |
997 | - if(!empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template'){ ?> |
|
997 | + if (!empty($_REQUEST['postType']) && $_REQUEST['postType'] == 'wp_template') { ?> |
|
998 | 998 | function aui_fse_set_data_scroll() { |
999 | 999 | console.log('init scroll'); |
1000 | 1000 | let Iframe = document.getElementsByClassName("edit-site-visual-editor__editor-canvas"); |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Post types Admin Class |
@@ -21,74 +21,74 @@ discard block |
||
21 | 21 | GetPaid_Metaboxes::init(); |
22 | 22 | |
23 | 23 | // Filter the post updated messages. |
24 | - add_filter( 'post_updated_messages', 'GetPaid_Post_Types_Admin::post_updated_messages' ); |
|
24 | + add_filter('post_updated_messages', 'GetPaid_Post_Types_Admin::post_updated_messages'); |
|
25 | 25 | |
26 | 26 | // Filter post actions. |
27 | - add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::post_row_actions', 10, 2 ); |
|
28 | - add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::filter_invoice_row_actions', 90, 2 ); |
|
27 | + add_filter('post_row_actions', 'GetPaid_Post_Types_Admin::post_row_actions', 10, 2); |
|
28 | + add_filter('post_row_actions', 'GetPaid_Post_Types_Admin::filter_invoice_row_actions', 90, 2); |
|
29 | 29 | |
30 | 30 | // Invoice table columns. |
31 | - add_filter( 'manage_wpi_invoice_posts_columns', array( __CLASS__, 'invoice_columns' ), 100 ); |
|
32 | - add_action( 'manage_wpi_invoice_posts_custom_column', array( __CLASS__, 'display_invoice_columns' ), 10, 2 ); |
|
33 | - add_filter( 'bulk_actions-edit-wpi_invoice', array( __CLASS__, 'invoice_bulk_actions' ) ); |
|
34 | - add_filter( 'handle_bulk_actions-edit-wpi_invoice', array( __CLASS__, 'handle_invoice_bulk_actions' ), 10, 3 ); |
|
31 | + add_filter('manage_wpi_invoice_posts_columns', array(__CLASS__, 'invoice_columns'), 100); |
|
32 | + add_action('manage_wpi_invoice_posts_custom_column', array(__CLASS__, 'display_invoice_columns'), 10, 2); |
|
33 | + add_filter('bulk_actions-edit-wpi_invoice', array(__CLASS__, 'invoice_bulk_actions')); |
|
34 | + add_filter('handle_bulk_actions-edit-wpi_invoice', array(__CLASS__, 'handle_invoice_bulk_actions'), 10, 3); |
|
35 | 35 | |
36 | 36 | // Items table columns. |
37 | - add_filter( 'manage_wpi_item_posts_columns', array( __CLASS__, 'item_columns' ), 100 ); |
|
38 | - add_filter( 'manage_edit-wpi_item_sortable_columns', array( __CLASS__, 'sortable_item_columns' ), 20 ); |
|
39 | - add_action( 'manage_wpi_item_posts_custom_column', array( __CLASS__, 'display_item_columns' ), 10, 2 ); |
|
40 | - add_action( 'restrict_manage_posts', array( __CLASS__, 'add_item_filters' ), 100 ); |
|
41 | - add_action( 'parse_query', array( __CLASS__, 'filter_item_query' ), 100 ); |
|
42 | - add_action( 'request', array( __CLASS__, 'reorder_items' ), 100 ); |
|
37 | + add_filter('manage_wpi_item_posts_columns', array(__CLASS__, 'item_columns'), 100); |
|
38 | + add_filter('manage_edit-wpi_item_sortable_columns', array(__CLASS__, 'sortable_item_columns'), 20); |
|
39 | + add_action('manage_wpi_item_posts_custom_column', array(__CLASS__, 'display_item_columns'), 10, 2); |
|
40 | + add_action('restrict_manage_posts', array(__CLASS__, 'add_item_filters'), 100); |
|
41 | + add_action('parse_query', array(__CLASS__, 'filter_item_query'), 100); |
|
42 | + add_action('request', array(__CLASS__, 'reorder_items'), 100); |
|
43 | 43 | |
44 | 44 | // Payment forms columns. |
45 | - add_filter( 'manage_wpi_payment_form_posts_columns', array( __CLASS__, 'payment_form_columns' ), 100 ); |
|
46 | - add_action( 'manage_wpi_payment_form_posts_custom_column', array( __CLASS__, 'display_payment_form_columns' ), 10, 2 ); |
|
47 | - add_filter( 'display_post_states', array( __CLASS__, 'filter_payment_form_state' ), 10, 2 ); |
|
45 | + add_filter('manage_wpi_payment_form_posts_columns', array(__CLASS__, 'payment_form_columns'), 100); |
|
46 | + add_action('manage_wpi_payment_form_posts_custom_column', array(__CLASS__, 'display_payment_form_columns'), 10, 2); |
|
47 | + add_filter('display_post_states', array(__CLASS__, 'filter_payment_form_state'), 10, 2); |
|
48 | 48 | |
49 | 49 | // Discount table columns. |
50 | - add_filter( 'manage_wpi_discount_posts_columns', array( __CLASS__, 'discount_columns' ), 100 ); |
|
51 | - add_filter( 'bulk_actions-edit-wpi_discount', '__return_empty_array', 100 ); |
|
50 | + add_filter('manage_wpi_discount_posts_columns', array(__CLASS__, 'discount_columns'), 100); |
|
51 | + add_filter('bulk_actions-edit-wpi_discount', '__return_empty_array', 100); |
|
52 | 52 | |
53 | 53 | // Deleting posts. |
54 | - add_action( 'delete_post', array( __CLASS__, 'delete_post' ) ); |
|
55 | - add_filter( 'display_post_states', array( __CLASS__, 'filter_discount_state' ), 10, 2 ); |
|
54 | + add_action('delete_post', array(__CLASS__, 'delete_post')); |
|
55 | + add_filter('display_post_states', array(__CLASS__, 'filter_discount_state'), 10, 2); |
|
56 | 56 | |
57 | - add_filter( 'display_post_states', array( __CLASS__, 'add_display_post_states' ), 10, 2 ); |
|
57 | + add_filter('display_post_states', array(__CLASS__, 'add_display_post_states'), 10, 2); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Post updated messages. |
62 | 62 | */ |
63 | - public static function post_updated_messages( $messages ) { |
|
63 | + public static function post_updated_messages($messages) { |
|
64 | 64 | global $post; |
65 | 65 | |
66 | 66 | $messages['wpi_discount'] = array( |
67 | 67 | 0 => '', |
68 | - 1 => __( 'Discount updated.', 'invoicing' ), |
|
69 | - 2 => __( 'Custom field updated.', 'invoicing' ), |
|
70 | - 3 => __( 'Custom field deleted.', 'invoicing' ), |
|
71 | - 4 => __( 'Discount updated.', 'invoicing' ), |
|
72 | - 5 => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Discount restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
73 | - 6 => __( 'Discount updated.', 'invoicing' ), |
|
74 | - 7 => __( 'Discount saved.', 'invoicing' ), |
|
75 | - 8 => __( 'Discount submitted.', 'invoicing' ), |
|
76 | - 9 => wp_sprintf( __( 'Discount scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ), |
|
77 | - 10 => __( 'Discount draft updated.', 'invoicing' ), |
|
68 | + 1 => __('Discount updated.', 'invoicing'), |
|
69 | + 2 => __('Custom field updated.', 'invoicing'), |
|
70 | + 3 => __('Custom field deleted.', 'invoicing'), |
|
71 | + 4 => __('Discount updated.', 'invoicing'), |
|
72 | + 5 => isset($_GET['revision']) ? wp_sprintf(__('Discount restored to revision from %s', 'invoicing'), wp_post_revision_title((int) $_GET['revision'], false)) : false, |
|
73 | + 6 => __('Discount updated.', 'invoicing'), |
|
74 | + 7 => __('Discount saved.', 'invoicing'), |
|
75 | + 8 => __('Discount submitted.', 'invoicing'), |
|
76 | + 9 => wp_sprintf(__('Discount scheduled for: <strong>%1$s</strong>.', 'invoicing'), date_i18n(__('M j, Y @ G:i', 'invoicing'), strtotime($post->post_date))), |
|
77 | + 10 => __('Discount draft updated.', 'invoicing'), |
|
78 | 78 | ); |
79 | 79 | |
80 | 80 | $messages['wpi_payment_form'] = array( |
81 | 81 | 0 => '', |
82 | - 1 => __( 'Payment Form updated.', 'invoicing' ), |
|
83 | - 2 => __( 'Custom field updated.', 'invoicing' ), |
|
84 | - 3 => __( 'Custom field deleted.', 'invoicing' ), |
|
85 | - 4 => __( 'Payment Form updated.', 'invoicing' ), |
|
86 | - 5 => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Payment Form restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
87 | - 6 => __( 'Payment Form updated.', 'invoicing' ), |
|
88 | - 7 => __( 'Payment Form saved.', 'invoicing' ), |
|
89 | - 8 => __( 'Payment Form submitted.', 'invoicing' ), |
|
90 | - 9 => wp_sprintf( __( 'Payment Form scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ), |
|
91 | - 10 => __( 'Payment Form draft updated.', 'invoicing' ), |
|
82 | + 1 => __('Payment Form updated.', 'invoicing'), |
|
83 | + 2 => __('Custom field updated.', 'invoicing'), |
|
84 | + 3 => __('Custom field deleted.', 'invoicing'), |
|
85 | + 4 => __('Payment Form updated.', 'invoicing'), |
|
86 | + 5 => isset($_GET['revision']) ? wp_sprintf(__('Payment Form restored to revision from %s', 'invoicing'), wp_post_revision_title((int) $_GET['revision'], false)) : false, |
|
87 | + 6 => __('Payment Form updated.', 'invoicing'), |
|
88 | + 7 => __('Payment Form saved.', 'invoicing'), |
|
89 | + 8 => __('Payment Form submitted.', 'invoicing'), |
|
90 | + 9 => wp_sprintf(__('Payment Form scheduled for: <strong>%1$s</strong>.', 'invoicing'), date_i18n(__('M j, Y @ G:i', 'invoicing'), strtotime($post->post_date))), |
|
91 | + 10 => __('Payment Form draft updated.', 'invoicing'), |
|
92 | 92 | ); |
93 | 93 | |
94 | 94 | return $messages; |
@@ -98,16 +98,16 @@ discard block |
||
98 | 98 | /** |
99 | 99 | * Post row actions. |
100 | 100 | */ |
101 | - public static function post_row_actions( $actions, $post ) { |
|
101 | + public static function post_row_actions($actions, $post) { |
|
102 | 102 | |
103 | - $post = get_post( $post ); |
|
103 | + $post = get_post($post); |
|
104 | 104 | |
105 | 105 | // We do not want to edit the default payment form. |
106 | - if ( 'wpi_payment_form' == $post->post_type ) { |
|
106 | + if ('wpi_payment_form' == $post->post_type) { |
|
107 | 107 | |
108 | - if ( wpinv_get_default_payment_form() === $post->ID ) { |
|
109 | - unset( $actions['trash'] ); |
|
110 | - unset( $actions['inline hide-if-no-js'] ); |
|
108 | + if (wpinv_get_default_payment_form() === $post->ID) { |
|
109 | + unset($actions['trash']); |
|
110 | + unset($actions['inline hide-if-no-js']); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | $actions['duplicate'] = sprintf( |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | 'getpaid-nonce' |
125 | 125 | ) |
126 | 126 | ), |
127 | - esc_html( __( 'Duplicate', 'invoicing' ) ) |
|
127 | + esc_html(__('Duplicate', 'invoicing')) |
|
128 | 128 | ); |
129 | 129 | |
130 | 130 | $actions['reset'] = sprintf( |
@@ -141,19 +141,19 @@ discard block |
||
141 | 141 | 'getpaid-nonce' |
142 | 142 | ) |
143 | 143 | ), |
144 | - esc_html( __( 'Reset Stats', 'invoicing' ) ) |
|
144 | + esc_html(__('Reset Stats', 'invoicing')) |
|
145 | 145 | ); |
146 | 146 | } |
147 | 147 | |
148 | 148 | // Link to item payment form. |
149 | - if ( 'wpi_item' == $post->post_type ) { |
|
149 | + if ('wpi_item' == $post->post_type) { |
|
150 | 150 | |
151 | - if ( in_array( get_post_meta( $post->ID, '_wpinv_type', true ), array( '', 'fee', 'custom' ), true ) ) { |
|
151 | + if (in_array(get_post_meta($post->ID, '_wpinv_type', true), array('', 'fee', 'custom'), true)) { |
|
152 | 152 | |
153 | 153 | $actions['buy'] = sprintf( |
154 | 154 | '<a href="%1$s">%2$s</a>', |
155 | - esc_url( getpaid_embed_url( false, $post->ID . '|0' ) ), |
|
156 | - esc_html( __( 'Buy', 'invoicing' ) ) |
|
155 | + esc_url(getpaid_embed_url(false, $post->ID . '|0')), |
|
156 | + esc_html(__('Buy', 'invoicing')) |
|
157 | 157 | ); |
158 | 158 | |
159 | 159 | } |
@@ -170,28 +170,28 @@ discard block |
||
170 | 170 | * @param WP_Post $post |
171 | 171 | * @return array $actions actions without edit option |
172 | 172 | */ |
173 | - public static function filter_invoice_row_actions( $actions, $post ) { |
|
173 | + public static function filter_invoice_row_actions($actions, $post) { |
|
174 | 174 | |
175 | - if ( getpaid_is_invoice_post_type( $post->post_type ) ) { |
|
175 | + if (getpaid_is_invoice_post_type($post->post_type)) { |
|
176 | 176 | |
177 | 177 | $actions = array(); |
178 | - $invoice = new WPInv_Invoice( $post ); |
|
178 | + $invoice = new WPInv_Invoice($post); |
|
179 | 179 | |
180 | 180 | $actions['edit'] = sprintf( |
181 | 181 | '<a href="%1$s">%2$s</a>', |
182 | - esc_url( get_edit_post_link( $invoice->get_id() ) ), |
|
183 | - esc_html( __( 'Edit', 'invoicing' ) ) |
|
182 | + esc_url(get_edit_post_link($invoice->get_id())), |
|
183 | + esc_html(__('Edit', 'invoicing')) |
|
184 | 184 | ); |
185 | 185 | |
186 | - if ( ! $invoice->is_draft() ) { |
|
186 | + if (!$invoice->is_draft()) { |
|
187 | 187 | |
188 | 188 | $actions['view'] = sprintf( |
189 | 189 | '<a href="%1$s">%2$s</a>', |
190 | - esc_url( $invoice->get_view_url() ), |
|
190 | + esc_url($invoice->get_view_url()), |
|
191 | 191 | sprintf( |
192 | 192 | // translators: %s is the invoice type |
193 | - esc_html__( 'View %s', 'invoicing' ), |
|
194 | - getpaid_get_post_type_label( $invoice->get_post_type(), false ) |
|
193 | + esc_html__('View %s', 'invoicing'), |
|
194 | + getpaid_get_post_type_label($invoice->get_post_type(), false) |
|
195 | 195 | ) |
196 | 196 | ); |
197 | 197 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | 'getpaid-nonce' |
210 | 210 | ) |
211 | 211 | ), |
212 | - esc_html( __( 'Send to Customer', 'invoicing' ) ) |
|
212 | + esc_html(__('Send to Customer', 'invoicing')) |
|
213 | 213 | ); |
214 | 214 | |
215 | 215 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | 'getpaid-nonce' |
229 | 229 | ) |
230 | 230 | ), |
231 | - esc_html( __( 'Duplicate', 'invoicing' ) ) |
|
231 | + esc_html(__('Duplicate', 'invoicing')) |
|
232 | 232 | ); |
233 | 233 | |
234 | 234 | } |
@@ -239,42 +239,42 @@ discard block |
||
239 | 239 | /** |
240 | 240 | * Returns an array of invoice table columns. |
241 | 241 | */ |
242 | - public static function invoice_columns( $columns ) { |
|
242 | + public static function invoice_columns($columns) { |
|
243 | 243 | |
244 | 244 | $columns = array( |
245 | 245 | 'cb' => $columns['cb'], |
246 | - 'number' => __( 'Invoice', 'invoicing' ), |
|
247 | - 'customer' => __( 'Customer', 'invoicing' ), |
|
248 | - 'invoice_date' => __( 'Created', 'invoicing' ), |
|
249 | - 'payment_date' => __( 'Completed', 'invoicing' ), |
|
250 | - 'amount' => __( 'Amount', 'invoicing' ), |
|
251 | - 'recurring' => __( 'Recurring', 'invoicing' ), |
|
252 | - 'status' => __( 'Status', 'invoicing' ), |
|
246 | + 'number' => __('Invoice', 'invoicing'), |
|
247 | + 'customer' => __('Customer', 'invoicing'), |
|
248 | + 'invoice_date' => __('Created', 'invoicing'), |
|
249 | + 'payment_date' => __('Completed', 'invoicing'), |
|
250 | + 'amount' => __('Amount', 'invoicing'), |
|
251 | + 'recurring' => __('Recurring', 'invoicing'), |
|
252 | + 'status' => __('Status', 'invoicing'), |
|
253 | 253 | ); |
254 | 254 | |
255 | - return apply_filters( 'wpi_invoice_table_columns', $columns ); |
|
255 | + return apply_filters('wpi_invoice_table_columns', $columns); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
259 | 259 | * Displays invoice table columns. |
260 | 260 | */ |
261 | - public static function display_invoice_columns( $column_name, $post_id ) { |
|
261 | + public static function display_invoice_columns($column_name, $post_id) { |
|
262 | 262 | |
263 | - $invoice = new WPInv_Invoice( $post_id ); |
|
263 | + $invoice = new WPInv_Invoice($post_id); |
|
264 | 264 | |
265 | - switch ( $column_name ) { |
|
265 | + switch ($column_name) { |
|
266 | 266 | |
267 | 267 | case 'invoice_date': |
268 | - $date_time = esc_attr( $invoice->get_created_date() ); |
|
269 | - $date = esc_html( getpaid_format_date_value( $date_time, '—', true ) ); |
|
270 | - echo wp_kses_post( "<span title='$date_time'>$date</span>" ); |
|
268 | + $date_time = esc_attr($invoice->get_created_date()); |
|
269 | + $date = esc_html(getpaid_format_date_value($date_time, '—', true)); |
|
270 | + echo wp_kses_post("<span title='$date_time'>$date</span>"); |
|
271 | 271 | break; |
272 | 272 | |
273 | 273 | case 'payment_date': |
274 | - if ( $invoice->is_paid() ) { |
|
275 | - $date_time = esc_attr( $invoice->get_completed_date() ); |
|
276 | - $date = esc_html( getpaid_format_date_value( $date_time, '—', true ) ); |
|
277 | - echo wp_kses_post( "<span title='$date_time'>$date</span>" ); |
|
274 | + if ($invoice->is_paid()) { |
|
275 | + $date_time = esc_attr($invoice->get_completed_date()); |
|
276 | + $date = esc_html(getpaid_format_date_value($date_time, '—', true)); |
|
277 | + echo wp_kses_post("<span title='$date_time'>$date</span>"); |
|
278 | 278 | } else { |
279 | 279 | echo '—'; |
280 | 280 | } |
@@ -283,61 +283,61 @@ discard block |
||
283 | 283 | |
284 | 284 | case 'amount': |
285 | 285 | $amount = $invoice->get_total(); |
286 | - $formated_amount = wp_kses_post( wpinv_price( $amount, $invoice->get_currency() ) ); |
|
286 | + $formated_amount = wp_kses_post(wpinv_price($amount, $invoice->get_currency())); |
|
287 | 287 | |
288 | - if ( $invoice->is_refunded() ) { |
|
289 | - $refunded_amount = wpinv_price( 0, $invoice->get_currency() ); |
|
290 | - echo wp_kses_post( "<del>$formated_amount</del> <ins>$refunded_amount</ins>" ); |
|
288 | + if ($invoice->is_refunded()) { |
|
289 | + $refunded_amount = wpinv_price(0, $invoice->get_currency()); |
|
290 | + echo wp_kses_post("<del>$formated_amount</del> <ins>$refunded_amount</ins>"); |
|
291 | 291 | } else { |
292 | 292 | |
293 | 293 | $discount = $invoice->get_total_discount(); |
294 | 294 | |
295 | - if ( ! empty( $discount ) ) { |
|
296 | - $new_amount = wpinv_price( $amount + $discount, $invoice->get_currency() ); |
|
297 | - echo wp_kses_post( "<del>$new_amount</del> <ins>$formated_amount</ins>" ); |
|
295 | + if (!empty($discount)) { |
|
296 | + $new_amount = wpinv_price($amount + $discount, $invoice->get_currency()); |
|
297 | + echo wp_kses_post("<del>$new_amount</del> <ins>$formated_amount</ins>"); |
|
298 | 298 | } else { |
299 | - echo wp_kses_post( $formated_amount ); |
|
299 | + echo wp_kses_post($formated_amount); |
|
300 | 300 | } |
301 | 301 | } |
302 | 302 | |
303 | 303 | break; |
304 | 304 | |
305 | 305 | case 'status': |
306 | - $status = esc_html( $invoice->get_status() ); |
|
307 | - $status_label = esc_html( $invoice->get_status_nicename() ); |
|
306 | + $status = esc_html($invoice->get_status()); |
|
307 | + $status_label = esc_html($invoice->get_status_nicename()); |
|
308 | 308 | |
309 | 309 | // If it is paid, show the gateway title. |
310 | - if ( $invoice->is_paid() ) { |
|
311 | - $gateway = esc_html( $invoice->get_gateway_title() ); |
|
312 | - $gateway = wp_sprintf( esc_attr__( 'Paid via %s', 'invoicing' ), esc_html( $gateway ) ); |
|
310 | + if ($invoice->is_paid()) { |
|
311 | + $gateway = esc_html($invoice->get_gateway_title()); |
|
312 | + $gateway = wp_sprintf(esc_attr__('Paid via %s', 'invoicing'), esc_html($gateway)); |
|
313 | 313 | |
314 | - echo wp_kses_post( "<mark class='wpi-help-tip getpaid-invoice-status $status' title='$gateway'><span>$status_label</span></mark>" ); |
|
314 | + echo wp_kses_post("<mark class='wpi-help-tip getpaid-invoice-status $status' title='$gateway'><span>$status_label</span></mark>"); |
|
315 | 315 | } else { |
316 | - echo wp_kses_post( "<mark class='getpaid-invoice-status $status'><span>$status_label</span></mark>" ); |
|
316 | + echo wp_kses_post("<mark class='getpaid-invoice-status $status'><span>$status_label</span></mark>"); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | // If it is not paid, display the overdue and view status. |
320 | - if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { |
|
320 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
321 | 321 | |
322 | 322 | // Invoice view status. |
323 | - if ( wpinv_is_invoice_viewed( $invoice->get_id() ) ) { |
|
324 | - echo ' <i class="fa fa-eye wpi-help-tip" title="' . esc_attr__( 'Viewed by Customer', 'invoicing' ) . '"></i>'; |
|
323 | + if (wpinv_is_invoice_viewed($invoice->get_id())) { |
|
324 | + echo ' <i class="fa fa-eye wpi-help-tip" title="' . esc_attr__('Viewed by Customer', 'invoicing') . '"></i>'; |
|
325 | 325 | } else { |
326 | - echo ' <i class="fa fa-eye-slash wpi-help-tip" title="' . esc_attr__( 'Not Viewed by Customer', 'invoicing' ) . '"></i>'; |
|
326 | + echo ' <i class="fa fa-eye-slash wpi-help-tip" title="' . esc_attr__('Not Viewed by Customer', 'invoicing') . '"></i>'; |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | // Display the overview status. |
330 | - if ( wpinv_get_option( 'overdue_active' ) ) { |
|
330 | + if (wpinv_get_option('overdue_active')) { |
|
331 | 331 | $due_date = $invoice->get_due_date(); |
332 | - $fomatted = getpaid_format_date( $due_date ); |
|
332 | + $fomatted = getpaid_format_date($due_date); |
|
333 | 333 | |
334 | - if ( ! empty( $fomatted ) ) { |
|
334 | + if (!empty($fomatted)) { |
|
335 | 335 | $date = wp_sprintf( |
336 | 336 | // translators: %s is the due date. |
337 | - __( 'Due %s', 'invoicing' ), |
|
337 | + __('Due %s', 'invoicing'), |
|
338 | 338 | $fomatted |
339 | 339 | ); |
340 | - echo wp_kses_post( "<p class='description' style='color: #888;' title='$due_date'>$fomatted</p>" ); |
|
340 | + echo wp_kses_post("<p class='description' style='color: #888;' title='$due_date'>$fomatted</p>"); |
|
341 | 341 | } |
342 | 342 | } |
343 | 343 | } |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | break; |
346 | 346 | |
347 | 347 | case 'recurring': |
348 | - if ( $invoice->is_recurring() ) { |
|
348 | + if ($invoice->is_recurring()) { |
|
349 | 349 | echo '<i class="fa fa-check" style="color:#43850a;"></i>'; |
350 | 350 | } else { |
351 | 351 | echo '<i class="fa fa-times" style="color:#616161;"></i>'; |
@@ -353,26 +353,26 @@ discard block |
||
353 | 353 | break; |
354 | 354 | |
355 | 355 | case 'number': |
356 | - $edit_link = esc_url( get_edit_post_link( $invoice->get_id() ) ); |
|
357 | - $invoice_number = esc_html( $invoice->get_number() ); |
|
358 | - $invoice_details = esc_attr__( 'View Invoice Details', 'invoicing' ); |
|
356 | + $edit_link = esc_url(get_edit_post_link($invoice->get_id())); |
|
357 | + $invoice_number = esc_html($invoice->get_number()); |
|
358 | + $invoice_details = esc_attr__('View Invoice Details', 'invoicing'); |
|
359 | 359 | |
360 | - echo wp_kses_post( "<a href='$edit_link' title='$invoice_details'><strong>$invoice_number</strong></a>" ); |
|
360 | + echo wp_kses_post("<a href='$edit_link' title='$invoice_details'><strong>$invoice_number</strong></a>"); |
|
361 | 361 | |
362 | - do_action( 'getpaid_admin_table_invoice_number_column', $invoice ); |
|
362 | + do_action('getpaid_admin_table_invoice_number_column', $invoice); |
|
363 | 363 | break; |
364 | 364 | |
365 | 365 | case 'customer': |
366 | 366 | $customer_name = $invoice->get_user_full_name(); |
367 | 367 | |
368 | - if ( empty( $customer_name ) ) { |
|
368 | + if (empty($customer_name)) { |
|
369 | 369 | $customer_name = $invoice->get_email(); |
370 | 370 | } |
371 | 371 | |
372 | - if ( ! empty( $customer_name ) ) { |
|
373 | - $customer_details = esc_attr__( 'View Customer Details', 'invoicing' ); |
|
374 | - $view_link = esc_url( add_query_arg( 'user_id', $invoice->get_user_id(), admin_url( 'user-edit.php' ) ) ); |
|
375 | - echo wp_kses_post( "<a href='$view_link' title='$customer_details'><span>$customer_name</span></a>" ); |
|
372 | + if (!empty($customer_name)) { |
|
373 | + $customer_details = esc_attr__('View Customer Details', 'invoicing'); |
|
374 | + $view_link = esc_url(add_query_arg('user_id', $invoice->get_user_id(), admin_url('user-edit.php'))); |
|
375 | + echo wp_kses_post("<a href='$view_link' title='$customer_details'><span>$customer_name</span></a>"); |
|
376 | 376 | } else { |
377 | 377 | echo '<div>—</div>'; |
378 | 378 | } |
@@ -386,19 +386,19 @@ discard block |
||
386 | 386 | /** |
387 | 387 | * Displays invoice bulk actions. |
388 | 388 | */ |
389 | - public static function invoice_bulk_actions( $actions ) { |
|
390 | - $actions['resend-invoice'] = __( 'Send to Customer', 'invoicing' ); |
|
389 | + public static function invoice_bulk_actions($actions) { |
|
390 | + $actions['resend-invoice'] = __('Send to Customer', 'invoicing'); |
|
391 | 391 | return $actions; |
392 | 392 | } |
393 | 393 | |
394 | 394 | /** |
395 | 395 | * Processes invoice bulk actions. |
396 | 396 | */ |
397 | - public static function handle_invoice_bulk_actions( $redirect_url, $action, $post_ids ) { |
|
397 | + public static function handle_invoice_bulk_actions($redirect_url, $action, $post_ids) { |
|
398 | 398 | |
399 | - if ( 'resend-invoice' === $action ) { |
|
400 | - foreach ( $post_ids as $post_id ) { |
|
401 | - getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $post_id ), true ); |
|
399 | + if ('resend-invoice' === $action) { |
|
400 | + foreach ($post_ids as $post_id) { |
|
401 | + getpaid()->get('invoice_emails')->user_invoice(new WPInv_Invoice($post_id), true); |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 | |
@@ -409,49 +409,49 @@ discard block |
||
409 | 409 | /** |
410 | 410 | * Returns an array of payment forms table columns. |
411 | 411 | */ |
412 | - public static function payment_form_columns( $columns ) { |
|
412 | + public static function payment_form_columns($columns) { |
|
413 | 413 | |
414 | 414 | $columns = array( |
415 | 415 | 'cb' => $columns['cb'], |
416 | - 'title' => __( 'Name', 'invoicing' ), |
|
417 | - 'shortcode' => __( 'Shortcode', 'invoicing' ), |
|
418 | - 'earnings' => __( 'Revenue', 'invoicing' ), |
|
419 | - 'refunds' => __( 'Refunded', 'invoicing' ), |
|
420 | - 'items' => __( 'Items', 'invoicing' ), |
|
421 | - 'date' => __( 'Date', 'invoicing' ), |
|
416 | + 'title' => __('Name', 'invoicing'), |
|
417 | + 'shortcode' => __('Shortcode', 'invoicing'), |
|
418 | + 'earnings' => __('Revenue', 'invoicing'), |
|
419 | + 'refunds' => __('Refunded', 'invoicing'), |
|
420 | + 'items' => __('Items', 'invoicing'), |
|
421 | + 'date' => __('Date', 'invoicing'), |
|
422 | 422 | ); |
423 | 423 | |
424 | - return apply_filters( 'wpi_payment_form_table_columns', $columns ); |
|
424 | + return apply_filters('wpi_payment_form_table_columns', $columns); |
|
425 | 425 | |
426 | 426 | } |
427 | 427 | |
428 | 428 | /** |
429 | 429 | * Displays payment form table columns. |
430 | 430 | */ |
431 | - public static function display_payment_form_columns( $column_name, $post_id ) { |
|
431 | + public static function display_payment_form_columns($column_name, $post_id) { |
|
432 | 432 | |
433 | 433 | // Retrieve the payment form. |
434 | - $form = new GetPaid_Payment_Form( $post_id ); |
|
434 | + $form = new GetPaid_Payment_Form($post_id); |
|
435 | 435 | |
436 | - switch ( $column_name ) { |
|
436 | + switch ($column_name) { |
|
437 | 437 | |
438 | 438 | case 'earnings': |
439 | - echo wp_kses_post( wpinv_price( $form->get_earned() ) ); |
|
439 | + echo wp_kses_post(wpinv_price($form->get_earned())); |
|
440 | 440 | break; |
441 | 441 | |
442 | 442 | case 'refunds': |
443 | - echo wp_kses_post( wpinv_price( $form->get_refunded() ) ); |
|
443 | + echo wp_kses_post(wpinv_price($form->get_refunded())); |
|
444 | 444 | break; |
445 | 445 | |
446 | 446 | case 'refunds': |
447 | - echo wp_kses_post( wpinv_price( $form->get_refunded() ) ); |
|
447 | + echo wp_kses_post(wpinv_price($form->get_refunded())); |
|
448 | 448 | break; |
449 | 449 | |
450 | 450 | case 'shortcode': |
451 | - if ( $form->is_default() ) { |
|
451 | + if ($form->is_default()) { |
|
452 | 452 | echo '—'; |
453 | 453 | } else { |
454 | - echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr( $form->get_id() ) . ']" style="width: 100%;" readonly/>'; |
|
454 | + echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr($form->get_id()) . ']" style="width: 100%;" readonly/>'; |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | break; |
@@ -459,28 +459,28 @@ discard block |
||
459 | 459 | case 'items': |
460 | 460 | $items = $form->get_items(); |
461 | 461 | |
462 | - if ( $form->is_default() || empty( $items ) ) { |
|
462 | + if ($form->is_default() || empty($items)) { |
|
463 | 463 | echo '—'; |
464 | 464 | return; |
465 | 465 | } |
466 | 466 | |
467 | 467 | $_items = array(); |
468 | 468 | |
469 | - foreach ( $items as $item ) { |
|
469 | + foreach ($items as $item) { |
|
470 | 470 | $url = $item->get_edit_url(); |
471 | 471 | |
472 | - if ( empty( $url ) ) { |
|
473 | - $_items[] = esc_html( $item->get_name() ); |
|
472 | + if (empty($url)) { |
|
473 | + $_items[] = esc_html($item->get_name()); |
|
474 | 474 | } else { |
475 | 475 | $_items[] = sprintf( |
476 | 476 | '<a href="%s">%s</a>', |
477 | - esc_url( $url ), |
|
478 | - esc_html( $item->get_name() ) |
|
477 | + esc_url($url), |
|
478 | + esc_html($item->get_name()) |
|
479 | 479 | ); |
480 | 480 | } |
481 | 481 | } |
482 | 482 | |
483 | - echo wp_kses_post( implode( '<br>', $_items ) ); |
|
483 | + echo wp_kses_post(implode('<br>', $_items)); |
|
484 | 484 | |
485 | 485 | break; |
486 | 486 | |
@@ -491,10 +491,10 @@ discard block |
||
491 | 491 | /** |
492 | 492 | * Filters post states. |
493 | 493 | */ |
494 | - public static function filter_payment_form_state( $post_states, $post ) { |
|
494 | + public static function filter_payment_form_state($post_states, $post) { |
|
495 | 495 | |
496 | - if ( 'wpi_payment_form' === $post->post_type && wpinv_get_default_payment_form() === $post->ID ) { |
|
497 | - $post_states['default_form'] = __( 'Default Payment Form', 'invoicing' ); |
|
496 | + if ('wpi_payment_form' === $post->post_type && wpinv_get_default_payment_form() === $post->ID) { |
|
497 | + $post_states['default_form'] = __('Default Payment Form', 'invoicing'); |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | return $post_states; |
@@ -504,35 +504,35 @@ discard block |
||
504 | 504 | /** |
505 | 505 | * Returns an array of coupon table columns. |
506 | 506 | */ |
507 | - public static function discount_columns( $columns ) { |
|
507 | + public static function discount_columns($columns) { |
|
508 | 508 | |
509 | 509 | $columns = array( |
510 | 510 | 'cb' => $columns['cb'], |
511 | - 'title' => __( 'Name', 'invoicing' ), |
|
512 | - 'code' => __( 'Code', 'invoicing' ), |
|
513 | - 'amount' => __( 'Amount', 'invoicing' ), |
|
514 | - 'usage' => __( 'Usage / Limit', 'invoicing' ), |
|
515 | - 'start_date' => __( 'Start Date', 'invoicing' ), |
|
516 | - 'expiry_date' => __( 'Expiry Date', 'invoicing' ), |
|
511 | + 'title' => __('Name', 'invoicing'), |
|
512 | + 'code' => __('Code', 'invoicing'), |
|
513 | + 'amount' => __('Amount', 'invoicing'), |
|
514 | + 'usage' => __('Usage / Limit', 'invoicing'), |
|
515 | + 'start_date' => __('Start Date', 'invoicing'), |
|
516 | + 'expiry_date' => __('Expiry Date', 'invoicing'), |
|
517 | 517 | ); |
518 | 518 | |
519 | - return apply_filters( 'wpi_discount_table_columns', $columns ); |
|
519 | + return apply_filters('wpi_discount_table_columns', $columns); |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | /** |
523 | 523 | * Filters post states. |
524 | 524 | */ |
525 | - public static function filter_discount_state( $post_states, $post ) { |
|
525 | + public static function filter_discount_state($post_states, $post) { |
|
526 | 526 | |
527 | - if ( 'wpi_discount' === $post->post_type ) { |
|
527 | + if ('wpi_discount' === $post->post_type) { |
|
528 | 528 | |
529 | - $discount = new WPInv_Discount( $post ); |
|
529 | + $discount = new WPInv_Discount($post); |
|
530 | 530 | |
531 | 531 | $status = $discount->is_expired() ? 'expired' : $discount->get_status(); |
532 | 532 | |
533 | - if ( 'publish' !== $status ) { |
|
533 | + if ('publish' !== $status) { |
|
534 | 534 | return array( |
535 | - 'discount_status' => wpinv_discount_status( $status ), |
|
535 | + 'discount_status' => wpinv_discount_status($status), |
|
536 | 536 | ); |
537 | 537 | } |
538 | 538 | |
@@ -547,30 +547,30 @@ discard block |
||
547 | 547 | /** |
548 | 548 | * Returns an array of items table columns. |
549 | 549 | */ |
550 | - public static function item_columns( $columns ) { |
|
550 | + public static function item_columns($columns) { |
|
551 | 551 | |
552 | 552 | $columns = array( |
553 | 553 | 'cb' => $columns['cb'], |
554 | - 'title' => __( 'Name', 'invoicing' ), |
|
555 | - 'price' => __( 'Price', 'invoicing' ), |
|
556 | - 'vat_rule' => __( 'Tax Rule', 'invoicing' ), |
|
557 | - 'vat_class' => __( 'Tax Class', 'invoicing' ), |
|
558 | - 'type' => __( 'Type', 'invoicing' ), |
|
559 | - 'shortcode' => __( 'Shortcode', 'invoicing' ), |
|
554 | + 'title' => __('Name', 'invoicing'), |
|
555 | + 'price' => __('Price', 'invoicing'), |
|
556 | + 'vat_rule' => __('Tax Rule', 'invoicing'), |
|
557 | + 'vat_class' => __('Tax Class', 'invoicing'), |
|
558 | + 'type' => __('Type', 'invoicing'), |
|
559 | + 'shortcode' => __('Shortcode', 'invoicing'), |
|
560 | 560 | ); |
561 | 561 | |
562 | - if ( ! wpinv_use_taxes() ) { |
|
563 | - unset( $columns['vat_rule'] ); |
|
564 | - unset( $columns['vat_class'] ); |
|
562 | + if (!wpinv_use_taxes()) { |
|
563 | + unset($columns['vat_rule']); |
|
564 | + unset($columns['vat_class']); |
|
565 | 565 | } |
566 | 566 | |
567 | - return apply_filters( 'wpi_item_table_columns', $columns ); |
|
567 | + return apply_filters('wpi_item_table_columns', $columns); |
|
568 | 568 | } |
569 | 569 | |
570 | 570 | /** |
571 | 571 | * Returns an array of sortable items table columns. |
572 | 572 | */ |
573 | - public static function sortable_item_columns( $columns ) { |
|
573 | + public static function sortable_item_columns($columns) { |
|
574 | 574 | |
575 | 575 | return array_merge( |
576 | 576 | $columns, |
@@ -587,45 +587,45 @@ discard block |
||
587 | 587 | /** |
588 | 588 | * Displays items table columns. |
589 | 589 | */ |
590 | - public static function display_item_columns( $column_name, $post_id ) { |
|
590 | + public static function display_item_columns($column_name, $post_id) { |
|
591 | 591 | |
592 | - $item = new WPInv_Item( $post_id ); |
|
592 | + $item = new WPInv_Item($post_id); |
|
593 | 593 | |
594 | - switch ( $column_name ) { |
|
594 | + switch ($column_name) { |
|
595 | 595 | |
596 | 596 | case 'price': |
597 | - if ( ! $item->is_recurring() ) { |
|
598 | - echo wp_kses_post( $item->get_the_price() ); |
|
597 | + if (!$item->is_recurring()) { |
|
598 | + echo wp_kses_post($item->get_the_price()); |
|
599 | 599 | break; |
600 | 600 | } |
601 | 601 | |
602 | 602 | $price = wp_sprintf( |
603 | - __( '%1$s / %2$s', 'invoicing' ), |
|
603 | + __('%1$s / %2$s', 'invoicing'), |
|
604 | 604 | $item->get_the_price(), |
605 | - getpaid_get_subscription_period_label( $item->get_recurring_period(), $item->get_recurring_interval(), '' ) |
|
605 | + getpaid_get_subscription_period_label($item->get_recurring_period(), $item->get_recurring_interval(), '') |
|
606 | 606 | ); |
607 | 607 | |
608 | - if ( $item->get_the_price() == $item->get_the_initial_price() ) { |
|
609 | - echo wp_kses_post( $price ); |
|
608 | + if ($item->get_the_price() == $item->get_the_initial_price()) { |
|
609 | + echo wp_kses_post($price); |
|
610 | 610 | break; |
611 | 611 | } |
612 | 612 | |
613 | - echo wp_kses_post( $item->get_the_initial_price() ); |
|
613 | + echo wp_kses_post($item->get_the_initial_price()); |
|
614 | 614 | |
615 | - echo '<span class="meta">' . wp_sprintf( esc_html__( 'then %s', 'invoicing' ), wp_kses_post( $price ) ) . '</span>'; |
|
615 | + echo '<span class="meta">' . wp_sprintf(esc_html__('then %s', 'invoicing'), wp_kses_post($price)) . '</span>'; |
|
616 | 616 | break; |
617 | 617 | |
618 | 618 | case 'vat_rule': |
619 | - echo wp_kses_post( getpaid_get_tax_rule_label( $item->get_vat_rule() ) ); |
|
619 | + echo wp_kses_post(getpaid_get_tax_rule_label($item->get_vat_rule())); |
|
620 | 620 | break; |
621 | 621 | |
622 | 622 | case 'vat_class': |
623 | - echo wp_kses_post( getpaid_get_tax_class_label( $item->get_vat_class() ) ); |
|
623 | + echo wp_kses_post(getpaid_get_tax_class_label($item->get_vat_class())); |
|
624 | 624 | break; |
625 | 625 | |
626 | 626 | case 'shortcode': |
627 | - if ( $item->is_type( array( '', 'fee', 'custom' ) ) ) { |
|
628 | - echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr( $item->get_id() ) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>'; |
|
627 | + if ($item->is_type(array('', 'fee', 'custom'))) { |
|
628 | + echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr($item->get_id()) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>'; |
|
629 | 629 | } else { |
630 | 630 | echo '—'; |
631 | 631 | } |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | break; |
634 | 634 | |
635 | 635 | case 'type': |
636 | - echo wp_kses_post( wpinv_item_type( $item->get_id() ) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>' ); |
|
636 | + echo wp_kses_post(wpinv_item_type($item->get_id()) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>'); |
|
637 | 637 | break; |
638 | 638 | |
639 | 639 | } |
@@ -643,21 +643,21 @@ discard block |
||
643 | 643 | /** |
644 | 644 | * Lets users filter items using taxes. |
645 | 645 | */ |
646 | - public static function add_item_filters( $post_type ) { |
|
646 | + public static function add_item_filters($post_type) { |
|
647 | 647 | |
648 | 648 | // Abort if we're not dealing with items. |
649 | - if ( 'wpi_item' !== $post_type ) { |
|
649 | + if ('wpi_item' !== $post_type) { |
|
650 | 650 | return; |
651 | 651 | } |
652 | 652 | |
653 | 653 | // Filter by vat rules. |
654 | - if ( wpinv_use_taxes() ) { |
|
654 | + if (wpinv_use_taxes()) { |
|
655 | 655 | |
656 | 656 | // Sanitize selected vat rule. |
657 | 657 | $vat_rule = ''; |
658 | 658 | $vat_rules = getpaid_get_tax_rules(); |
659 | - if ( isset( $_GET['vat_rule'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
660 | - $vat_rule = sanitize_text_field( $_GET['vat_rule'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
659 | + if (isset($_GET['vat_rule'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
660 | + $vat_rule = sanitize_text_field($_GET['vat_rule']); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
661 | 661 | } |
662 | 662 | |
663 | 663 | // Filter by VAT rule. |
@@ -665,13 +665,13 @@ discard block |
||
665 | 665 | array( |
666 | 666 | 'options' => array_merge( |
667 | 667 | array( |
668 | - '' => __( 'All Tax Rules', 'invoicing' ), |
|
668 | + '' => __('All Tax Rules', 'invoicing'), |
|
669 | 669 | ), |
670 | 670 | $vat_rules |
671 | 671 | ), |
672 | 672 | 'name' => 'vat_rule', |
673 | 673 | 'id' => 'vat_rule', |
674 | - 'selected' => in_array( $vat_rule, array_keys( $vat_rules ), true ) ? $vat_rule : '', |
|
674 | + 'selected' => in_array($vat_rule, array_keys($vat_rules), true) ? $vat_rule : '', |
|
675 | 675 | 'show_option_all' => false, |
676 | 676 | 'show_option_none' => false, |
677 | 677 | ) |
@@ -682,21 +682,21 @@ discard block |
||
682 | 682 | // Sanitize selected vat rule. |
683 | 683 | $vat_class = ''; |
684 | 684 | $vat_classes = getpaid_get_tax_classes(); |
685 | - if ( isset( $_GET['vat_class'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
686 | - $vat_class = sanitize_text_field( $_GET['vat_class'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
685 | + if (isset($_GET['vat_class'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
686 | + $vat_class = sanitize_text_field($_GET['vat_class']); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | wpinv_html_select( |
690 | 690 | array( |
691 | 691 | 'options' => array_merge( |
692 | 692 | array( |
693 | - '' => __( 'All Tax Classes', 'invoicing' ), |
|
693 | + '' => __('All Tax Classes', 'invoicing'), |
|
694 | 694 | ), |
695 | 695 | $vat_classes |
696 | 696 | ), |
697 | 697 | 'name' => 'vat_class', |
698 | 698 | 'id' => 'vat_class', |
699 | - 'selected' => in_array( $vat_class, array_keys( $vat_classes ), true ) ? $vat_class : '', |
|
699 | + 'selected' => in_array($vat_class, array_keys($vat_classes), true) ? $vat_class : '', |
|
700 | 700 | 'show_option_all' => false, |
701 | 701 | 'show_option_none' => false, |
702 | 702 | ) |
@@ -705,22 +705,22 @@ discard block |
||
705 | 705 | } |
706 | 706 | |
707 | 707 | // Filter by item type. |
708 | - $type = ''; |
|
709 | - if ( isset( $_GET['type'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
710 | - $type = sanitize_text_field( $_GET['type'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
708 | + $type = ''; |
|
709 | + if (isset($_GET['type'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
710 | + $type = sanitize_text_field($_GET['type']); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | wpinv_html_select( |
714 | 714 | array( |
715 | 715 | 'options' => array_merge( |
716 | 716 | array( |
717 | - '' => __( 'All item types', 'invoicing' ), |
|
717 | + '' => __('All item types', 'invoicing'), |
|
718 | 718 | ), |
719 | 719 | wpinv_get_item_types() |
720 | 720 | ), |
721 | 721 | 'name' => 'type', |
722 | 722 | 'id' => 'type', |
723 | - 'selected' => in_array( $type, wpinv_item_types(), true ) ? $type : '', |
|
723 | + 'selected' => in_array($type, wpinv_item_types(), true) ? $type : '', |
|
724 | 724 | 'show_option_all' => false, |
725 | 725 | 'show_option_none' => false, |
726 | 726 | ) |
@@ -731,45 +731,45 @@ discard block |
||
731 | 731 | /** |
732 | 732 | * Filters the item query. |
733 | 733 | */ |
734 | - public static function filter_item_query( $query ) { |
|
734 | + public static function filter_item_query($query) { |
|
735 | 735 | |
736 | 736 | // modify the query only if it admin and main query. |
737 | - if ( ! ( is_admin() && $query->is_main_query() ) ) { |
|
737 | + if (!(is_admin() && $query->is_main_query())) { |
|
738 | 738 | return $query; |
739 | 739 | } |
740 | 740 | |
741 | 741 | // we want to modify the query for our items. |
742 | - if ( empty( $query->query['post_type'] ) || 'wpi_item' !== $query->query['post_type'] ) { |
|
742 | + if (empty($query->query['post_type']) || 'wpi_item' !== $query->query['post_type']) { |
|
743 | 743 | return $query; |
744 | 744 | } |
745 | 745 | |
746 | - if ( empty( $query->query_vars['meta_query'] ) ) { |
|
746 | + if (empty($query->query_vars['meta_query'])) { |
|
747 | 747 | $query->query_vars['meta_query'] = array(); |
748 | 748 | } |
749 | 749 | |
750 | 750 | // Filter vat rule type |
751 | - if ( ! empty( $_GET['vat_rule'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
751 | + if (!empty($_GET['vat_rule'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
752 | 752 | $query->query_vars['meta_query'][] = array( |
753 | 753 | 'key' => '_wpinv_vat_rule', |
754 | - 'value' => sanitize_text_field( $_GET['vat_rule'] ), // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
754 | + 'value' => sanitize_text_field($_GET['vat_rule']), // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
755 | 755 | 'compare' => '=', |
756 | 756 | ); |
757 | 757 | } |
758 | 758 | |
759 | 759 | // Filter vat class |
760 | - if ( ! empty( $_GET['vat_class'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
760 | + if (!empty($_GET['vat_class'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
761 | 761 | $query->query_vars['meta_query'][] = array( |
762 | 762 | 'key' => '_wpinv_vat_class', |
763 | - 'value' => sanitize_text_field( $_GET['vat_class'] ), // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
763 | + 'value' => sanitize_text_field($_GET['vat_class']), // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
764 | 764 | 'compare' => '=', |
765 | 765 | ); |
766 | 766 | } |
767 | 767 | |
768 | 768 | // Filter item type |
769 | - if ( ! empty( $_GET['type'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
769 | + if (!empty($_GET['type'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
770 | 770 | $query->query_vars['meta_query'][] = array( |
771 | 771 | 'key' => '_wpinv_type', |
772 | - 'value' => sanitize_text_field( $_GET['type'] ), // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
772 | + 'value' => sanitize_text_field($_GET['type']), // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
773 | 773 | 'compare' => '=', |
774 | 774 | ); |
775 | 775 | } |
@@ -779,15 +779,15 @@ discard block |
||
779 | 779 | /** |
780 | 780 | * Reorders items. |
781 | 781 | */ |
782 | - public static function reorder_items( $vars ) { |
|
782 | + public static function reorder_items($vars) { |
|
783 | 783 | global $typenow; |
784 | 784 | |
785 | - if ( 'wpi_item' !== $typenow || empty( $vars['orderby'] ) ) { |
|
785 | + if ('wpi_item' !== $typenow || empty($vars['orderby'])) { |
|
786 | 786 | return $vars; |
787 | 787 | } |
788 | 788 | |
789 | 789 | // By item type. |
790 | - if ( 'type' === $vars['orderby'] ) { |
|
790 | + if ('type' === $vars['orderby']) { |
|
791 | 791 | return array_merge( |
792 | 792 | $vars, |
793 | 793 | array( |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | } |
799 | 799 | |
800 | 800 | // By vat class. |
801 | - if ( 'vat_class' === $vars['orderby'] ) { |
|
801 | + if ('vat_class' === $vars['orderby']) { |
|
802 | 802 | return array_merge( |
803 | 803 | $vars, |
804 | 804 | array( |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | } |
810 | 810 | |
811 | 811 | // By vat rule. |
812 | - if ( 'vat_rule' === $vars['orderby'] ) { |
|
812 | + if ('vat_rule' === $vars['orderby']) { |
|
813 | 813 | return array_merge( |
814 | 814 | $vars, |
815 | 815 | array( |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | } |
821 | 821 | |
822 | 822 | // By price. |
823 | - if ( 'price' === $vars['orderby'] ) { |
|
823 | + if ('price' === $vars['orderby']) { |
|
824 | 824 | return array_merge( |
825 | 825 | $vars, |
826 | 826 | array( |
@@ -837,27 +837,27 @@ discard block |
||
837 | 837 | /** |
838 | 838 | * Fired when deleting a post. |
839 | 839 | */ |
840 | - public static function delete_post( $post_id ) { |
|
840 | + public static function delete_post($post_id) { |
|
841 | 841 | |
842 | - switch ( get_post_type( $post_id ) ) { |
|
842 | + switch (get_post_type($post_id)) { |
|
843 | 843 | |
844 | 844 | case 'wpi_item': |
845 | - do_action( 'getpaid_before_delete_item', new WPInv_Item( $post_id ) ); |
|
845 | + do_action('getpaid_before_delete_item', new WPInv_Item($post_id)); |
|
846 | 846 | break; |
847 | 847 | |
848 | 848 | case 'wpi_payment_form': |
849 | - do_action( 'getpaid_before_delete_payment_form', new GetPaid_Payment_Form( $post_id ) ); |
|
849 | + do_action('getpaid_before_delete_payment_form', new GetPaid_Payment_Form($post_id)); |
|
850 | 850 | break; |
851 | 851 | |
852 | 852 | case 'wpi_discount': |
853 | - do_action( 'getpaid_before_delete_discount', new WPInv_Discount( $post_id ) ); |
|
853 | + do_action('getpaid_before_delete_discount', new WPInv_Discount($post_id)); |
|
854 | 854 | break; |
855 | 855 | |
856 | 856 | case 'wpi_invoice': |
857 | - $invoice = new WPInv_Invoice( $post_id ); |
|
858 | - do_action( 'getpaid_before_delete_invoice', $invoice ); |
|
859 | - $invoice->get_data_store()->delete_items( $invoice ); |
|
860 | - $invoice->get_data_store()->delete_special_fields( $invoice ); |
|
857 | + $invoice = new WPInv_Invoice($post_id); |
|
858 | + do_action('getpaid_before_delete_invoice', $invoice); |
|
859 | + $invoice->get_data_store()->delete_items($invoice); |
|
860 | + $invoice->get_data_store()->delete_special_fields($invoice); |
|
861 | 861 | break; |
862 | 862 | } |
863 | 863 | } |
@@ -870,28 +870,28 @@ discard block |
||
870 | 870 | * |
871 | 871 | * @return mixed |
872 | 872 | */ |
873 | - public static function add_display_post_states( $post_states, $post ) { |
|
873 | + public static function add_display_post_states($post_states, $post) { |
|
874 | 874 | |
875 | - if ( wpinv_get_option( 'success_page', 0 ) == $post->ID ) { |
|
876 | - $post_states['getpaid_success_page'] = __( 'GetPaid Receipt Page', 'invoicing' ); |
|
875 | + if (wpinv_get_option('success_page', 0) == $post->ID) { |
|
876 | + $post_states['getpaid_success_page'] = __('GetPaid Receipt Page', 'invoicing'); |
|
877 | 877 | } |
878 | 878 | |
879 | - foreach ( getpaid_get_invoice_post_types() as $post_type => $label ) { |
|
879 | + foreach (getpaid_get_invoice_post_types() as $post_type => $label) { |
|
880 | 880 | |
881 | - if ( wpinv_get_option( "{$post_type}_history_page", 0 ) == $post->ID ) { |
|
882 | - $post_states[ "getpaid_{$post_type}_history_page" ] = sprintf( |
|
883 | - __( 'GetPaid %s History Page', 'invoicing' ), |
|
881 | + if (wpinv_get_option("{$post_type}_history_page", 0) == $post->ID) { |
|
882 | + $post_states["getpaid_{$post_type}_history_page"] = sprintf( |
|
883 | + __('GetPaid %s History Page', 'invoicing'), |
|
884 | 884 | $label |
885 | 885 | ); |
886 | 886 | } |
887 | 887 | } |
888 | 888 | |
889 | - if ( wpinv_get_option( 'invoice_subscription_page', 0 ) == $post->ID ) { |
|
890 | - $post_states['getpaid_invoice_subscription_page'] = __( 'GetPaid Subscription Page', 'invoicing' ); |
|
889 | + if (wpinv_get_option('invoice_subscription_page', 0) == $post->ID) { |
|
890 | + $post_states['getpaid_invoice_subscription_page'] = __('GetPaid Subscription Page', 'invoicing'); |
|
891 | 891 | } |
892 | 892 | |
893 | - if ( wpinv_get_option( 'checkout_page', 0 ) == $post->ID ) { |
|
894 | - $post_states['getpaid_checkout_page'] = __( 'GetPaid Checkout Page', 'invoicing' ); |
|
893 | + if (wpinv_get_option('checkout_page', 0) == $post->ID) { |
|
894 | + $post_states['getpaid_checkout_page'] = __('GetPaid Checkout Page', 'invoicing'); |
|
895 | 895 | } |
896 | 896 | |
897 | 897 | return $post_states; |