@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if (!defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -23,40 +23,40 @@ discard block |
||
23 | 23 | 'block-keywords'=> "['invoicing','buy', 'buy item']", |
24 | 24 | 'class_name' => __CLASS__, |
25 | 25 | 'base_id' => 'wpinv_buy', |
26 | - 'name' => __('Get Paid > Buy Item Button (Deprecated)','invoicing'), |
|
26 | + 'name' => __('Get Paid > Buy Item Button (Deprecated)', 'invoicing'), |
|
27 | 27 | 'widget_ops' => array( |
28 | 28 | 'classname' => 'wpinv-buy-item-class wpi-g', |
29 | - 'description' => esc_html__('This widget is deprecated. Use the GetPaid widget instead.','invoicing'), |
|
29 | + 'description' => esc_html__('This widget is deprecated. Use the GetPaid widget instead.', 'invoicing'), |
|
30 | 30 | ), |
31 | 31 | 'arguments' => array( |
32 | 32 | 'title' => array( |
33 | - 'title' => __( 'Widget title', 'invoicing' ), |
|
34 | - 'desc' => __( 'Enter widget title.', 'invoicing' ), |
|
33 | + 'title' => __('Widget title', 'invoicing'), |
|
34 | + 'desc' => __('Enter widget title.', 'invoicing'), |
|
35 | 35 | 'type' => 'text', |
36 | 36 | 'desc_tip' => true, |
37 | 37 | 'default' => '', |
38 | 38 | 'advanced' => false |
39 | 39 | ), |
40 | 40 | 'items' => array( |
41 | - 'title' => __( 'Items to buy', 'invoicing' ), |
|
42 | - 'desc' => __( 'Enter comma separated list of invoicing item id and quantity (item_id|quantity). Ex. 101|2 ', 'invoicing' ), |
|
41 | + 'title' => __('Items to buy', 'invoicing'), |
|
42 | + 'desc' => __('Enter comma separated list of invoicing item id and quantity (item_id|quantity). Ex. 101|2 ', 'invoicing'), |
|
43 | 43 | 'type' => 'text', |
44 | 44 | 'desc_tip' => true, |
45 | 45 | 'default' => '', |
46 | - 'placeholder' => __('Items to buy','invoicing'), |
|
46 | + 'placeholder' => __('Items to buy', 'invoicing'), |
|
47 | 47 | 'advanced' => false |
48 | 48 | ), |
49 | 49 | 'label' => array( |
50 | - 'title' => __( 'Button Label', 'invoicing' ), |
|
51 | - 'desc' => __( 'Enter button label. Default "Buy Now".', 'invoicing' ), |
|
50 | + 'title' => __('Button Label', 'invoicing'), |
|
51 | + 'desc' => __('Enter button label. Default "Buy Now".', 'invoicing'), |
|
52 | 52 | 'type' => 'text', |
53 | 53 | 'desc_tip' => true, |
54 | - 'default' => __( 'Buy Now', 'invoicing' ), |
|
54 | + 'default' => __('Buy Now', 'invoicing'), |
|
55 | 55 | 'advanced' => false |
56 | 56 | ), |
57 | 57 | 'post_id' => array( |
58 | - 'title' => __( 'Post ID', 'invoicing' ), |
|
59 | - 'desc' => __( 'Enter related post ID. This is for 3rd party add ons and not mandatory field.', 'invoicing' ), |
|
58 | + 'title' => __('Post ID', 'invoicing'), |
|
59 | + 'desc' => __('Enter related post ID. This is for 3rd party add ons and not mandatory field.', 'invoicing'), |
|
60 | 60 | 'type' => 'number', |
61 | 61 | 'desc_tip' => true, |
62 | 62 | 'default' => '', |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | ); |
68 | 68 | |
69 | 69 | |
70 | - parent::__construct( $options ); |
|
70 | + parent::__construct($options); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -79,31 +79,31 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @return string |
81 | 81 | */ |
82 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
82 | + public function output($args = array(), $widget_args = array(), $content = '') { |
|
83 | 83 | |
84 | 84 | $defaults = array( |
85 | 85 | 'items' => '', // should be used like: item_id|quantity,item_id|quantity,item_id|quantity |
86 | - 'label' => __( 'Buy Now', 'invoicing' ), // the button title |
|
86 | + 'label' => __('Buy Now', 'invoicing'), // the button title |
|
87 | 87 | 'post_id' => '', // any related post_id |
88 | 88 | ); |
89 | 89 | |
90 | 90 | /** |
91 | 91 | * Parse incoming $args into an array and merge it with $defaults |
92 | 92 | */ |
93 | - $args = wp_parse_args( $args, $defaults ); |
|
93 | + $args = wp_parse_args($args, $defaults); |
|
94 | 94 | |
95 | 95 | $html = '<div class="wpi-buy-button-wrapper wpi-g">'; |
96 | 96 | |
97 | - if ( empty( $args['items'] ) ) { |
|
98 | - $html .= __( 'No items selected', 'invoicing' ); |
|
97 | + if (empty($args['items'])) { |
|
98 | + $html .= __('No items selected', 'invoicing'); |
|
99 | 99 | } else { |
100 | - $post_id = isset( $args['post_id'] ) && is_numeric( $args['post_id'] ) ? sanitize_text_field( $args['post_id'] ) : 0; |
|
101 | - $label = isset( $args['label'] ) ? sanitize_text_field( $args['label'] ) : __( 'Buy Now', 'invoicing' ); |
|
102 | - $items = esc_attr( $args['items'] ); |
|
100 | + $post_id = isset($args['post_id']) && is_numeric($args['post_id']) ? sanitize_text_field($args['post_id']) : 0; |
|
101 | + $label = isset($args['label']) ? sanitize_text_field($args['label']) : __('Buy Now', 'invoicing'); |
|
102 | + $items = esc_attr($args['items']); |
|
103 | 103 | $html .= "<button class='button button-primary wpi-buy-button' type='button' onclick=\"wpi_buy(this, '$items','$post_id');\">$label</button>"; |
104 | 104 | } |
105 | 105 | |
106 | - $html .= wp_nonce_field( 'wpinv_buy_items', 'wpinv_buy_nonce', true, false ); |
|
106 | + $html .= wp_nonce_field('wpinv_buy_items', 'wpinv_buy_nonce', true, false); |
|
107 | 107 | $html .= '</div>'; |
108 | 108 | |
109 | 109 | return $html; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if (!defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | 'block-keywords'=> "['invoicing','checkout']", |
24 | 24 | 'class_name' => __CLASS__, |
25 | 25 | 'base_id' => 'wpinv_checkout', |
26 | - 'name' => __('GetPaid > Checkout','invoicing'), |
|
26 | + 'name' => __('GetPaid > Checkout', 'invoicing'), |
|
27 | 27 | 'widget_ops' => array( |
28 | 28 | 'classname' => 'getpaid-checkout bsui', |
29 | - 'description' => esc_html__('Displays a checkout form.','invoicing'), |
|
29 | + 'description' => esc_html__('Displays a checkout form.', 'invoicing'), |
|
30 | 30 | ), |
31 | 31 | 'arguments' => array( |
32 | 32 | 'title' => array( |
33 | - 'title' => __( 'Widget title', 'invoicing' ), |
|
34 | - 'desc' => __( 'Enter widget title.', 'invoicing' ), |
|
33 | + 'title' => __('Widget title', 'invoicing'), |
|
34 | + 'desc' => __('Enter widget title.', 'invoicing'), |
|
35 | 35 | 'type' => 'text', |
36 | 36 | 'desc_tip' => true, |
37 | 37 | 'default' => '', |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | ); |
43 | 43 | |
44 | 44 | |
45 | - parent::__construct( $options ); |
|
45 | + parent::__construct($options); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return mixed|string|bool |
56 | 56 | */ |
57 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
57 | + public function output($args = array(), $widget_args = array(), $content = '') { |
|
58 | 58 | return wpinv_checkout_form(); |
59 | 59 | } |
60 | 60 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | 'block-output' => array( // the block visual output elements as an array |
24 | 24 | array( |
25 | 25 | 'element' => 'p', |
26 | - 'title' => __( 'Placeholder', 'hello-world' ), |
|
26 | + 'title' => __('Placeholder', 'hello-world'), |
|
27 | 27 | 'class' => '[%className%]', |
28 | 28 | 'content' => 'Hello: [%after_text%]' // block properties can be added by wrapping them in [%name%] |
29 | 29 | ) |
@@ -33,20 +33,20 @@ discard block |
||
33 | 33 | // The calling class name |
34 | 34 | 'base_id' => 'hello_world', |
35 | 35 | // this is used as the widget id and the shortcode id. |
36 | - 'name' => __( 'Hello World', 'hello-world' ), |
|
36 | + 'name' => __('Hello World', 'hello-world'), |
|
37 | 37 | // the name of the widget/block |
38 | 38 | 'widget_ops' => array( |
39 | 39 | 'classname' => 'hello-world-class', |
40 | 40 | // widget class |
41 | - 'description' => esc_html__( 'This is an example that will take a text parameter and output it after `Hello:`.', 'hello-world' ), |
|
41 | + 'description' => esc_html__('This is an example that will take a text parameter and output it after `Hello:`.', 'hello-world'), |
|
42 | 42 | // widget description |
43 | 43 | ), |
44 | 44 | 'no_wrap' => true, // This will prevent the widget being wrapped in the containing widget class div. |
45 | 45 | 'arguments' => array( // these are the arguments that will be used in the widget, shortcode and block settings. |
46 | 46 | 'after_text' => array( // this is the input name='' |
47 | - 'title' => __( 'Text after hello:', 'hello-world' ), |
|
47 | + 'title' => __('Text after hello:', 'hello-world'), |
|
48 | 48 | // input title |
49 | - 'desc' => __( 'This is the text that will appear after `Hello:`.', 'hello-world' ), |
|
49 | + 'desc' => __('This is the text that will appear after `Hello:`.', 'hello-world'), |
|
50 | 50 | // input description |
51 | 51 | 'type' => 'text', |
52 | 52 | // the type of input, test, select, checkbox etc. |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | ) |
63 | 63 | ); |
64 | 64 | |
65 | - parent::__construct( $options ); |
|
65 | + parent::__construct($options); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -75,18 +75,18 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @return string |
77 | 77 | */ |
78 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
78 | + public function output($args = array(), $widget_args = array(), $content = '') { |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * @var string $after_text |
82 | 82 | * @var string $another_input This is added by filter below. |
83 | 83 | */ |
84 | - extract( $args, EXTR_SKIP ); |
|
84 | + extract($args, EXTR_SKIP); |
|
85 | 85 | |
86 | 86 | /* |
87 | 87 | * This value is added by filter so might not exist if filter is removed so we check. |
88 | 88 | */ |
89 | - if ( ! isset( $another_input ) ) { |
|
89 | + if (!isset($another_input)) { |
|
90 | 90 | $another_input = ''; |
91 | 91 | } |
92 | 92 | |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | // register it. |
100 | -add_action( 'widgets_init', function () { |
|
101 | - register_widget( 'SD_Hello_World' ); |
|
100 | +add_action('widgets_init', function() { |
|
101 | + register_widget('SD_Hello_World'); |
|
102 | 102 | } ); |
103 | 103 | |
104 | 104 | |
@@ -109,15 +109,15 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @return mixed |
111 | 111 | */ |
112 | -function _my_extra_arguments( $options ) { |
|
112 | +function _my_extra_arguments($options) { |
|
113 | 113 | |
114 | 114 | /* |
115 | 115 | * Add a new input option. |
116 | 116 | */ |
117 | 117 | $options['arguments']['another_input'] = array( |
118 | 118 | 'name' => 'another_input', // this is the input name='' |
119 | - 'title' => __( 'Another input:', 'hello-world' ), // input title |
|
120 | - 'desc' => __( 'This is an input added via filter.', 'hello-world' ), // input description |
|
119 | + 'title' => __('Another input:', 'hello-world'), // input title |
|
120 | + 'desc' => __('This is an input added via filter.', 'hello-world'), // input description |
|
121 | 121 | 'type' => 'text', // the type of input, test, select, checkbox etc. |
122 | 122 | 'placeholder' => 'Placeholder text', // the input placeholder text. |
123 | 123 | 'desc_tip' => true, // if the input should show the widget description text as a tooltip. |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | /* |
129 | 129 | * Output the new option in the block output also. |
130 | 130 | */ |
131 | - $options['block-output']['element::p']['content'] = $options['block-output']['element::p']['content'] . " [%another_input%]";; |
|
131 | + $options['block-output']['element::p']['content'] = $options['block-output']['element::p']['content'] . " [%another_input%]"; ; |
|
132 | 132 | |
133 | 133 | return $options; |
134 | 134 | } |
@@ -14,21 +14,21 @@ |
||
14 | 14 | * Tested up to: 5.3 |
15 | 15 | */ |
16 | 16 | |
17 | -if ( ! defined( 'ABSPATH' ) ) { |
|
17 | +if (!defined('ABSPATH')) { |
|
18 | 18 | exit; |
19 | 19 | } |
20 | 20 | |
21 | -if ( ! class_exists( 'WP_Super_Duper' ) ) { |
|
21 | +if (!class_exists('WP_Super_Duper')) { |
|
22 | 22 | // include the class if needed |
23 | - include_once( dirname( __FILE__ ) . "/wp-super-duper.php" ); |
|
23 | + include_once(dirname(__FILE__) . "/wp-super-duper.php"); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /* |
27 | 27 | * Hello world example. |
28 | 28 | */ |
29 | -include_once( dirname( __FILE__ ) . "/hello-world.php" ); |
|
29 | +include_once(dirname(__FILE__) . "/hello-world.php"); |
|
30 | 30 | |
31 | 31 | /* |
32 | 32 | * Map example. |
33 | 33 | */ |
34 | -include_once( dirname( __FILE__ ) . "/map.php" ); |
|
34 | +include_once(dirname(__FILE__) . "/map.php"); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | public function getLocations() |
36 | 36 | { |
37 | 37 | if ($this->matchesCakeVersion('>=', '3.0.0')) { |
38 | - $this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/'; |
|
38 | + $this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/'; |
|
39 | 39 | } |
40 | 40 | return $this->locations; |
41 | 41 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | $repositoryManager = $this->composer->getRepositoryManager(); |
61 | - if (! $repositoryManager) { |
|
61 | + if (!$repositoryManager) { |
|
62 | 62 | return false; |
63 | 63 | } |
64 | 64 |
@@ -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 | $defaults = array( |
23 | 23 | 'type' => 'info', |
24 | 24 | 'class' => '', |
@@ -33,50 +33,50 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * Parse incoming $args into an array and merge it with $defaults |
35 | 35 | */ |
36 | - $args = wp_parse_args( $args, $defaults ); |
|
36 | + $args = wp_parse_args($args, $defaults); |
|
37 | 37 | $output = ''; |
38 | - if ( ! empty( $args['content'] ) ) { |
|
39 | - $type = sanitize_html_class( $args['type'] ); |
|
40 | - if($type=='error'){$type='danger';} |
|
41 | - $icon = !empty($args['icon']) ? "<i class='".esc_attr($args['icon'])."'></i>" : ''; |
|
38 | + if (!empty($args['content'])) { |
|
39 | + $type = sanitize_html_class($args['type']); |
|
40 | + if ($type == 'error') {$type = 'danger'; } |
|
41 | + $icon = !empty($args['icon']) ? "<i class='" . esc_attr($args['icon']) . "'></i>" : ''; |
|
42 | 42 | |
43 | 43 | // set default icon |
44 | - if(!$icon && $args['icon']!==false && $type){ |
|
45 | - if($type=='danger'){$icon = '<i class="fas fa-exclamation-circle"></i>';} |
|
46 | - elseif($type=='warning'){$icon = '<i class="fas fa-exclamation-triangle"></i>';} |
|
47 | - elseif($type=='success'){$icon = '<i class="fas fa-check-circle"></i>';} |
|
48 | - elseif($type=='info'){$icon = '<i class="fas fa-info-circle"></i>';} |
|
44 | + if (!$icon && $args['icon'] !== false && $type) { |
|
45 | + if ($type == 'danger') {$icon = '<i class="fas fa-exclamation-circle"></i>'; } |
|
46 | + elseif ($type == 'warning') {$icon = '<i class="fas fa-exclamation-triangle"></i>'; } |
|
47 | + elseif ($type == 'success') {$icon = '<i class="fas fa-check-circle"></i>'; } |
|
48 | + elseif ($type == 'info') {$icon = '<i class="fas fa-info-circle"></i>'; } |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | $data = ''; |
52 | 52 | $class = !empty($args['class']) ? esc_attr($args['class']) : ''; |
53 | - if($args['dismissible']){$class .= " alert-dismissible fade show";} |
|
53 | + if ($args['dismissible']) {$class .= " alert-dismissible fade show"; } |
|
54 | 54 | |
55 | 55 | // open |
56 | - $output .= '<div class="alert alert-' . $type . ' '.$class.'" role="alert" '.$data.'>'; |
|
56 | + $output .= '<div class="alert alert-' . $type . ' ' . $class . '" role="alert" ' . $data . '>'; |
|
57 | 57 | |
58 | 58 | // heading |
59 | - if ( ! empty( $args['heading'] ) ) { |
|
59 | + if (!empty($args['heading'])) { |
|
60 | 60 | $output .= '<h4 class="alert-heading">' . $args['heading'] . '</h4>'; |
61 | 61 | } |
62 | 62 | |
63 | 63 | // icon |
64 | - if ( ! empty( $icon) ) { |
|
65 | - $output .= $icon." "; |
|
64 | + if (!empty($icon)) { |
|
65 | + $output .= $icon . " "; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // content |
69 | 69 | $output .= $args['content']; |
70 | 70 | |
71 | 71 | // dismissible |
72 | - if($args['dismissible']){ |
|
72 | + if ($args['dismissible']) { |
|
73 | 73 | $output .= '<button type="button" class="close" data-dismiss="alert" aria-label="Close">'; |
74 | 74 | $output .= '<span aria-hidden="true">×</span>'; |
75 | 75 | $output .= '</button>'; |
76 | 76 | } |
77 | 77 | |
78 | 78 | // footer |
79 | - if ( ! empty( $args['footer'] ) ) { |
|
79 | + if (!empty($args['footer'])) { |
|
80 | 80 | $output .= '<hr>'; |
81 | 81 | $output .= '<p class="mb-0">' . $args['footer'] . '</p>'; |
82 | 82 | } |
@@ -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 | $defaults = array( |
23 | 23 | 'type' => 'button', |
24 | 24 | 'href' => '#', |
@@ -43,20 +43,20 @@ discard block |
||
43 | 43 | /** |
44 | 44 | * Parse incoming $args into an array and merge it with $defaults |
45 | 45 | */ |
46 | - $args = wp_parse_args( $args, $defaults ); |
|
46 | + $args = wp_parse_args($args, $defaults); |
|
47 | 47 | $output = ''; |
48 | - if ( ! empty( $args['type'] ) ) { |
|
48 | + if (!empty($args['type'])) { |
|
49 | 49 | // wrapper open |
50 | - $output .= '<div class="dropdown '.AUI_Component_Helper::esc_classes($args['wrapper_class']).'">'; |
|
50 | + $output .= '<div class="dropdown ' . AUI_Component_Helper::esc_classes($args['wrapper_class']) . '">'; |
|
51 | 51 | |
52 | 52 | // button part |
53 | 53 | $output .= aui()->button($args); |
54 | 54 | |
55 | 55 | // dropdown-menu |
56 | - if(!empty($args['dropdown_menu'])){ |
|
56 | + if (!empty($args['dropdown_menu'])) { |
|
57 | 57 | $output .= $args['dropdown_menu']; |
58 | - }elseif(!empty($args['dropdown_items'])){ |
|
59 | - $output .= '<div class="dropdown-menu '.AUI_Component_Helper::esc_classes($args['dropdown_menu_class']).'" aria-labelledby="'.sanitize_html_class($args['id']).'">'; |
|
58 | + }elseif (!empty($args['dropdown_items'])) { |
|
59 | + $output .= '<div class="dropdown-menu ' . AUI_Component_Helper::esc_classes($args['dropdown_menu_class']) . '" aria-labelledby="' . sanitize_html_class($args['id']) . '">'; |
|
60 | 60 | $output .= aui()->render($args['dropdown_items']); |
61 | 61 | $output .= '</div>'; |
62 | 62 | } |
@@ -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>"; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
50 | - public function get_examples(){ |
|
50 | + public function get_examples() { |
|
51 | 51 | $output = ''; |
52 | 52 | |
53 | 53 |
@@ -5,10 +5,10 @@ discard block |
||
5 | 5 | */ |
6 | 6 | |
7 | 7 | // Exit if accessed directly |
8 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
8 | +if (!defined('ABSPATH')) exit; |
|
9 | 9 | |
10 | 10 | // Load WP_List_Table if not loaded |
11 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
11 | +if (!class_exists('WP_List_Table')) { |
|
12 | 12 | require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
13 | 13 | } |
14 | 14 | |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | public function __construct() { |
37 | 37 | |
38 | 38 | // Set parent defaults |
39 | - parent::__construct( array( |
|
39 | + parent::__construct(array( |
|
40 | 40 | 'singular' => 'id', |
41 | 41 | 'plural' => 'ids', |
42 | 42 | 'ajax' => false, |
43 | - ) ); |
|
43 | + )); |
|
44 | 44 | |
45 | 45 | } |
46 | 46 | |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return string Column Name |
68 | 68 | */ |
69 | - public function column_default( $item, $column_name ) { |
|
70 | - $value = sanitize_text_field( get_user_meta( $item->ID, '_wpinv_' . $column_name, true ) ); |
|
71 | - return apply_filters( 'wpinv_customers_table_column' . $column_name, $value, $item ); |
|
69 | + public function column_default($item, $column_name) { |
|
70 | + $value = sanitize_text_field(get_user_meta($item->ID, '_wpinv_' . $column_name, true)); |
|
71 | + return apply_filters('wpinv_customers_table_column' . $column_name, $value, $item); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return string Column Name |
82 | 82 | */ |
83 | - public function column_country( $user ) { |
|
84 | - $country = wpinv_sanitize_country( $user->_wpinv_country ); |
|
85 | - if ( $country ) { |
|
86 | - $country = wpinv_country_name( $country ); |
|
83 | + public function column_country($user) { |
|
84 | + $country = wpinv_sanitize_country($user->_wpinv_country); |
|
85 | + if ($country) { |
|
86 | + $country = wpinv_country_name($country); |
|
87 | 87 | } |
88 | - return sanitize_text_field( $country ); |
|
88 | + return sanitize_text_field($country); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -97,14 +97,14 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @return string Column Name |
99 | 99 | */ |
100 | - public function column_state( $user ) { |
|
101 | - $country = wpinv_sanitize_country( $user->_wpinv_country ); |
|
100 | + public function column_state($user) { |
|
101 | + $country = wpinv_sanitize_country($user->_wpinv_country); |
|
102 | 102 | $state = $user->_wpinv_state; |
103 | - if ( $state ) { |
|
104 | - $state = wpinv_state_name( $state, $country ); |
|
103 | + if ($state) { |
|
104 | + $state = wpinv_state_name($state, $country); |
|
105 | 105 | } |
106 | 106 | |
107 | - return sanitize_text_field( $state ); |
|
107 | + return sanitize_text_field($state); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -113,15 +113,15 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @param int $item The user id. |
115 | 115 | */ |
116 | - public function single_row( $item ) { |
|
117 | - $item = get_user_by( 'id', $item ); |
|
116 | + public function single_row($item) { |
|
117 | + $item = get_user_by('id', $item); |
|
118 | 118 | |
119 | - if ( empty( $item ) ) { |
|
119 | + if (empty($item)) { |
|
120 | 120 | return; |
121 | 121 | } |
122 | 122 | |
123 | 123 | echo '<tr>'; |
124 | - $this->single_row_columns( $item ); |
|
124 | + $this->single_row_columns($item); |
|
125 | 125 | echo '</tr>'; |
126 | 126 | } |
127 | 127 | |
@@ -131,30 +131,30 @@ discard block |
||
131 | 131 | * @param WP_User $customer customer. |
132 | 132 | * @return string |
133 | 133 | */ |
134 | - public function column_name( $customer ) { |
|
134 | + public function column_name($customer) { |
|
135 | 135 | |
136 | 136 | // Customer view URL. |
137 | - $view_url = esc_url( add_query_arg( 'user_id', $customer->ID, admin_url( 'user-edit.php' ) ) ); |
|
137 | + $view_url = esc_url(add_query_arg('user_id', $customer->ID, admin_url('user-edit.php'))); |
|
138 | 138 | $row_actions = $this->row_actions( |
139 | 139 | array( |
140 | - 'view' => '<a href="' . $view_url . '#getpaid-fieldset-billing">' . __( 'Edit Details', 'invoicing' ) . '</a>', |
|
140 | + 'view' => '<a href="' . $view_url . '#getpaid-fieldset-billing">' . __('Edit Details', 'invoicing') . '</a>', |
|
141 | 141 | ) |
142 | 142 | ); |
143 | 143 | |
144 | 144 | // Get user's address. |
145 | - $address = wpinv_get_user_address( $customer->ID ); |
|
145 | + $address = wpinv_get_user_address($customer->ID); |
|
146 | 146 | |
147 | 147 | // Customer email address. |
148 | - $email = sanitize_email( $customer->user_email ); |
|
148 | + $email = sanitize_email($customer->user_email); |
|
149 | 149 | |
150 | 150 | // Customer's avatar. |
151 | - $avatar = esc_url( get_avatar_url( $email ) ); |
|
151 | + $avatar = esc_url(get_avatar_url($email)); |
|
152 | 152 | $avatar = "<img src='$avatar' height='32' width='32'/>"; |
153 | 153 | |
154 | 154 | // Customer's name. |
155 | - $name = sanitize_text_field( "{$address['first_name']} {$address['last_name']}" ); |
|
155 | + $name = sanitize_text_field("{$address['first_name']} {$address['last_name']}"); |
|
156 | 156 | |
157 | - if ( ! empty( $name ) ) { |
|
157 | + if (!empty($name)) { |
|
158 | 158 | $name = "<div style='overflow: hidden;height: 18px;'>$name</div>"; |
159 | 159 | } |
160 | 160 | |
@@ -173,16 +173,16 @@ discard block |
||
173 | 173 | public function get_columns() { |
174 | 174 | |
175 | 175 | $columns = array( |
176 | - 'name' => __( 'Name', 'invoicing' ), |
|
177 | - 'country' => __( 'Country', 'invoicing' ), |
|
178 | - 'state' => __( 'State', 'invoicing' ), |
|
179 | - 'city' => __( 'City', 'invoicing' ), |
|
180 | - 'zip' => __( 'ZIP', 'invoicing' ), |
|
181 | - 'address' => __( 'Address', 'invoicing' ), |
|
182 | - 'phone' => __( 'Phone', 'invoicing' ), |
|
183 | - 'company' => __( 'Company', 'invoicing' ), |
|
176 | + 'name' => __('Name', 'invoicing'), |
|
177 | + 'country' => __('Country', 'invoicing'), |
|
178 | + 'state' => __('State', 'invoicing'), |
|
179 | + 'city' => __('City', 'invoicing'), |
|
180 | + 'zip' => __('ZIP', 'invoicing'), |
|
181 | + 'address' => __('Address', 'invoicing'), |
|
182 | + 'phone' => __('Phone', 'invoicing'), |
|
183 | + 'company' => __('Company', 'invoicing'), |
|
184 | 184 | ); |
185 | - return apply_filters( 'wpinv_customers_table_columns', $columns ); |
|
185 | + return apply_filters('wpinv_customers_table_columns', $columns); |
|
186 | 186 | |
187 | 187 | } |
188 | 188 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * @return int Current page number |
194 | 194 | */ |
195 | 195 | public function get_paged() { |
196 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
196 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | /** |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @since 1.0.19 |
203 | 203 | * @return void |
204 | 204 | */ |
205 | - public function bulk_actions( $which = '' ) { |
|
205 | + public function bulk_actions($which = '') { |
|
206 | 206 | return array(); |
207 | 207 | } |
208 | 208 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | ); |
224 | 224 | |
225 | 225 | $this->items = $customers; |
226 | - $this->total = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( DISTINCT( post_author ) ) FROM $wpdb->posts WHERE post_type=%s", 'wpi_invoice' ) ); |
|
226 | + $this->total = (int) $wpdb->get_var($wpdb->prepare("SELECT COUNT( DISTINCT( post_author ) ) FROM $wpdb->posts WHERE post_type=%s", 'wpi_invoice')); |
|
227 | 227 | |
228 | 228 | } |
229 | 229 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $columns = $this->get_columns(); |
238 | 238 | $hidden = array(); // No hidden columns |
239 | 239 | $sortable = $this->get_sortable_columns(); |
240 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
240 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
241 | 241 | $this->prepare_query(); |
242 | 242 | } |
243 | 243 | } |