Passed
Push — master ( 3127f7...8c7816 )
by Brian
05:09
created
includes/admin/meta-boxes/class-mb-payment-form.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // MUST have WordPress.
3
-if ( ! defined( 'WPINC' ) ) {
3
+if (!defined('WPINC')) {
4 4
     exit;
5 5
 }
6 6
 
@@ -11,23 +11,23 @@  discard block
 block discarded – undo
11 11
      *
12 12
      * @param WP_Post $post
13 13
      */
14
-    public static function output_details( $post ) {
15
-        $details = get_post_meta( $post->ID, 'payment_form_data', true );
14
+    public static function output_details($post) {
15
+        $details = get_post_meta($post->ID, 'payment_form_data', true);
16 16
 
17
-        if ( ! is_array( $details ) ) {
17
+        if (!is_array($details)) {
18 18
             return;
19 19
         }
20 20
 
21 21
         echo '<div class="bsui"> <div class="form-row">';
22 22
 
23
-        foreach ( $details as $key => $value ) {
24
-            $key = esc_html( $key );
23
+        foreach ($details as $key => $value) {
24
+            $key = esc_html($key);
25 25
 
26
-            if ( is_array( $value ) ) {
27
-                $value = implode( ',', $value );
26
+            if (is_array($value)) {
27
+                $value = implode(',', $value);
28 28
             }
29 29
 
30
-            echo wp_kses_post( "<div class='col-12'><strong>$key:</strong></div><div class='col-12 form-group'>$value</div>" );
30
+            echo wp_kses_post("<div class='col-12'><strong>$key:</strong></div><div class='col-12 form-group'>$value</div>");
31 31
         }
32 32
 
33 33
         echo '</div></div>';
@@ -39,18 +39,18 @@  discard block
 block discarded – undo
39 39
      *
40 40
      * @param WP_Post $post
41 41
      */
42
-    public static function output_shortcode( $post ) {
42
+    public static function output_shortcode($post) {
43 43
 
44
-        if ( ! is_numeric( $post ) ) {
44
+        if (!is_numeric($post)) {
45 45
             $post = $post->ID;
46 46
         }
47 47
 
48
-        if ( $post == wpinv_get_default_payment_form() ) {
48
+        if ($post == wpinv_get_default_payment_form()) {
49 49
             echo '&mdash;';
50 50
             return;
51 51
         }
52 52
 
53
-        echo "<input type='text' style='min-width: 220px;' value='[getpaid form=" . absint( $post ) . "]' disabled>";
53
+        echo "<input type='text' style='min-width: 220px;' value='[getpaid form=" . absint($post) . "]' disabled>";
54 54
 
55 55
     }
56 56
 
Please login to merge, or discard this patch.
templates/payment-forms-admin/edit/email.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,49 +7,49 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
14 14
 <div class='form-group'>
15 15
     <label class="d-block">
16
-        <span><?php esc_html_e( 'Field Label', 'invoicing' ); ?></span>
16
+        <span><?php esc_html_e('Field Label', 'invoicing'); ?></span>
17 17
         <input v-model='active_form_element.label' class='form-control' type="text"/>
18 18
     </label>
19 19
 </div>
20 20
 
21 21
 <div class='form-group'>
22 22
     <label class="d-block">
23
-        <span><?php esc_html_e( 'Placeholder text', 'invoicing' ); ?></span>
23
+        <span><?php esc_html_e('Placeholder text', 'invoicing'); ?></span>
24 24
         <input v-model='active_form_element.placeholder' class='form-control' type="text"/>
25 25
     </label>
26 26
 </div>
27 27
 
28 28
 <div class='form-group'>
29 29
     <label class="d-block">
30
-        <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span>
31
-        <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
32
-        <small class="form-text text-muted"><?php esc_html_e( 'HTML is allowed', 'invoicing' ); ?></small>
30
+        <span><?php esc_html_e('Help Text', 'invoicing'); ?></span>
31
+        <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
32
+        <small class="form-text text-muted"><?php esc_html_e('HTML is allowed', 'invoicing'); ?></small>
33 33
     </label>
34 34
 </div>
35 35
 
36 36
 <div class='form-group form-check'>
37 37
     <input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' />
38
-    <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label>
38
+    <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label>
39 39
 </div>
40 40
 
41 41
 <div class='form-group form-check'>
42 42
     <input :id="active_form_element.id + '_add_meta'" v-model='active_form_element.add_meta' type='checkbox' class='form-check-input' />
43
-    <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e( 'Show this field in receipts and emails?', 'invoicing' ); ?></label>
43
+    <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e('Show this field in receipts and emails?', 'invoicing'); ?></label>
44 44
 </div>
45 45
 
46 46
 <hr class='featurette-divider mt-4'>
47 47
 
48 48
 <div class='form-group'>
49 49
     <label class="d-block">
50
-        <span><?php esc_html_e( 'Email Merge Tag', 'invoicing' ); ?></span>
50
+        <span><?php esc_html_e('Email Merge Tag', 'invoicing'); ?></span>
51 51
         <input :value='active_form_element.label | formatMergeTag' class='form-control bg-white' type="text" readonly onclick="this.select()" />
52
-        <span class="form-text text-muted"><?php esc_html_e( 'You can use this merge tag in notification emails', 'invoicing' ); ?></span>
52
+        <span class="form-text text-muted"><?php esc_html_e('You can use this merge tag in notification emails', 'invoicing'); ?></span>
53 53
     </label>
54 54
 </div>
55 55
 
Please login to merge, or discard this patch.
templates/payment-forms-admin/edit/text.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,49 +7,49 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
14 14
 <div class='form-group'>
15 15
     <label class="d-block">
16
-        <span><?php esc_html_e( 'Field Label', 'invoicing' ); ?></span>
16
+        <span><?php esc_html_e('Field Label', 'invoicing'); ?></span>
17 17
         <input v-model='active_form_element.label' class='form-control' type="text"/>
18 18
     </label>
19 19
 </div>
20 20
 
21 21
 <div class='form-group'>
22 22
     <label class="d-block">
23
-        <span><?php esc_html_e( 'Placeholder text', 'invoicing' ); ?></span>
23
+        <span><?php esc_html_e('Placeholder text', 'invoicing'); ?></span>
24 24
         <input v-model='active_form_element.placeholder' class='form-control' type="text"/>
25 25
     </label>
26 26
 </div>
27 27
 
28 28
 <div class='form-group'>
29 29
     <label class="d-block">
30
-        <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span>
31
-        <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
32
-        <small class="form-text text-muted"><?php esc_html_e( 'HTML is allowed', 'invoicing' ); ?></small>
30
+        <span><?php esc_html_e('Help Text', 'invoicing'); ?></span>
31
+        <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
32
+        <small class="form-text text-muted"><?php esc_html_e('HTML is allowed', 'invoicing'); ?></small>
33 33
     </label>
34 34
 </div>
35 35
 
36 36
 <div class='form-group form-check'>
37 37
     <input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' />
38
-    <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label>
38
+    <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label>
39 39
 </div>
40 40
 
41 41
 <div class='form-group form-check'>
42 42
     <input :id="active_form_element.id + '_add_meta'" v-model='active_form_element.add_meta' type='checkbox' class='form-check-input' />
43
-    <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e( 'Show this field in receipts and emails?', 'invoicing' ); ?></label>
43
+    <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e('Show this field in receipts and emails?', 'invoicing'); ?></label>
44 44
 </div>
45 45
 
46 46
 <hr class='featurette-divider mt-4'>
47 47
 
48 48
 <div class='form-group'>
49 49
     <label class="d-block">
50
-        <span><?php esc_html_e( 'Email Merge Tag', 'invoicing' ); ?></span>
50
+        <span><?php esc_html_e('Email Merge Tag', 'invoicing'); ?></span>
51 51
         <input :value='active_form_element.label | formatMergeTag' class='form-control bg-white' type="text" readonly onclick="this.select()" />
52
-        <span class="form-text text-muted"><?php esc_html_e( 'You can use this merge tag in notification emails', 'invoicing' ); ?></span>
52
+        <span class="form-text text-muted"><?php esc_html_e('You can use this merge tag in notification emails', 'invoicing'); ?></span>
53 53
     </label>
54 54
 </div>
55 55
 
Please login to merge, or discard this patch.
templates/payment-forms-admin/edit/number.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,49 +7,49 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
14 14
 <div class='form-group'>
15 15
     <label class="d-block">
16
-        <span><?php esc_html_e( 'Field Label', 'invoicing' ); ?></span>
16
+        <span><?php esc_html_e('Field Label', 'invoicing'); ?></span>
17 17
         <input v-model='active_form_element.label' class='form-control' type="text"/>
18 18
     </label>
19 19
 </div>
20 20
 
21 21
 <div class='form-group'>
22 22
     <label class="d-block">
23
-        <span><?php esc_html_e( 'Placeholder text', 'invoicing' ); ?></span>
23
+        <span><?php esc_html_e('Placeholder text', 'invoicing'); ?></span>
24 24
         <input v-model='active_form_element.placeholder' class='form-control' type="text"/>
25 25
     </label>
26 26
 </div>
27 27
 
28 28
 <div class='form-group'>
29 29
     <label class="d-block">
30
-        <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span>
31
-        <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
32
-        <small class="form-text text-muted"><?php esc_html_e( 'HTML is allowed', 'invoicing' ); ?></small>
30
+        <span><?php esc_html_e('Help Text', 'invoicing'); ?></span>
31
+        <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
32
+        <small class="form-text text-muted"><?php esc_html_e('HTML is allowed', 'invoicing'); ?></small>
33 33
     </label>
34 34
 </div>
35 35
 
36 36
 <div class='form-group form-check'>
37 37
     <input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' />
38
-    <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label>
38
+    <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label>
39 39
 </div>
40 40
 
41 41
 <div class='form-group form-check'>
42 42
     <input :id="active_form_element.id + '_add_meta'" v-model='active_form_element.add_meta' type='checkbox' class='form-check-input' />
43
-    <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e( 'Show this field in receipts and emails?', 'invoicing' ); ?></label>
43
+    <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e('Show this field in receipts and emails?', 'invoicing'); ?></label>
44 44
 </div>
45 45
 
46 46
 <hr class='featurette-divider mt-4'>
47 47
 
48 48
 <div class='form-group'>
49 49
     <label class="d-block">
50
-        <span><?php esc_html_e( 'Email Merge Tag', 'invoicing' ); ?></span>
50
+        <span><?php esc_html_e('Email Merge Tag', 'invoicing'); ?></span>
51 51
         <input :value='active_form_element.label | formatMergeTag' class='form-control bg-white' type="text" readonly onclick="this.select()" />
52
-        <span class="form-text text-muted"><?php esc_html_e( 'You can use this merge tag in notification emails', 'invoicing' ); ?></span>
52
+        <span class="form-text text-muted"><?php esc_html_e('You can use this merge tag in notification emails', 'invoicing'); ?></span>
53 53
     </label>
54 54
 </div>
55 55
 
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/includes/class-aui.php 3 patches
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
 	exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @return AUI|null
36 36
 	 */
37 37
 	public static function instance() {
38
-		if ( self::$instance == null ) {
38
+		if (self::$instance == null) {
39 39
 			self::$instance = new AUI();
40 40
 		}
41 41
 
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 	 * @since 1.0.0
49 49
 	 */
50 50
 	private function __construct() {
51
-		if ( function_exists( "__autoload" ) ) {
52
-			spl_autoload_register( "__autoload" );
51
+		if (function_exists("__autoload")) {
52
+			spl_autoload_register("__autoload");
53 53
 		}
54
-		spl_autoload_register( array( $this, 'autoload' ) );
54
+		spl_autoload_register(array($this, 'autoload'));
55 55
 
56 56
 		// load options
57 57
 		self::$options = get_option('aui_options');
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @param $classname
66 66
 	 */
67
-	private function autoload( $classname ) {
68
-		$class     = str_replace( '_', '-', strtolower( $classname ) );
69
-		$file_path = trailingslashit( dirname( __FILE__ ) ) . "components/class-" . $class . '.php';
70
-		if ( $file_path && is_readable( $file_path ) ) {
71
-			include_once( $file_path );
67
+	private function autoload($classname) {
68
+		$class     = str_replace('_', '-', strtolower($classname));
69
+		$file_path = trailingslashit(dirname(__FILE__)) . "components/class-" . $class . '.php';
70
+		if ($file_path && is_readable($file_path)) {
71
+			include_once($file_path);
72 72
 		}
73 73
 	}
74 74
 
@@ -79,34 +79,34 @@  discard block
 block discarded – undo
79 79
 	 *
80 80
 	 * @return string|void
81 81
 	 */
82
-	public function get_option( $option ){
82
+	public function get_option($option) {
83 83
 		$result = isset(self::$options[$option]) ? esc_attr(self::$options[$option]) : '';
84 84
 
85
-		if ( ! $result && $option) {
86
-			if( $option == 'color_primary' ){
85
+		if (!$result && $option) {
86
+			if ($option == 'color_primary') {
87 87
 				$result = AUI_PRIMARY_COLOR;
88
-			}elseif( $option == 'color_secondary' ){
88
+			}elseif ($option == 'color_secondary') {
89 89
 				$result = AUI_SECONDARY_COLOR;
90 90
 			}
91 91
 		}
92 92
 		return $result;
93 93
 	}
94 94
 
95
-	public function render( $items = array(), $echo = false ) {
95
+	public function render($items = array(), $echo = false) {
96 96
 		$output = '';
97 97
 
98
-		if ( ! empty( $items ) ) {
99
-			foreach ( $items as $args ) {
100
-				$render = isset( $args['render'] ) ? $args['render'] : '';
101
-				if ( $render && method_exists( __CLASS__, $render ) ) {
102
-					$output .= $this->$render( $args );
98
+		if (!empty($items)) {
99
+			foreach ($items as $args) {
100
+				$render = isset($args['render']) ? $args['render'] : '';
101
+				if ($render && method_exists(__CLASS__, $render)) {
102
+					$output .= $this->$render($args);
103 103
 				}
104 104
 			}
105 105
 		}
106 106
 
107
-		if ( $echo ) {
107
+		if ($echo) {
108 108
 			echo $output;
109
-		}else{
109
+		} else {
110 110
 			return $output;
111 111
 		}
112 112
 
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
 	 *
123 123
 	 * @return string The rendered component.
124 124
 	 */
125
-	public function alert( $args = array(), $echo = false ) {
126
-		$output = AUI_Component_Alert::get( $args );
125
+	public function alert($args = array(), $echo = false) {
126
+		$output = AUI_Component_Alert::get($args);
127 127
 
128
-		if ( $echo ) {
128
+		if ($echo) {
129 129
 			echo $output;
130
-		}else{
130
+		} else {
131 131
 			return $output;
132 132
 		}
133 133
 	}
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
 	 *
143 143
 	 * @return string The rendered component.
144 144
 	 */
145
-	public function input( $args = array(), $echo = false ) {
146
-		$output = AUI_Component_Input::input( $args );
145
+	public function input($args = array(), $echo = false) {
146
+		$output = AUI_Component_Input::input($args);
147 147
 
148
-		if ( $echo ) {
148
+		if ($echo) {
149 149
 			echo $output;
150
-		}else{
150
+		} else {
151 151
 			return $output;
152 152
 		}
153 153
 	}
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
 	 *
163 163
 	 * @return string The rendered component.
164 164
 	 */
165
-	public function textarea( $args = array(), $echo = false ) {
166
-		$output = AUI_Component_Input::textarea( $args );
165
+	public function textarea($args = array(), $echo = false) {
166
+		$output = AUI_Component_Input::textarea($args);
167 167
 
168
-		if ( $echo ) {
168
+		if ($echo) {
169 169
 			echo $output;
170
-		}else{
170
+		} else {
171 171
 			return $output;
172 172
 		}
173 173
 	}
@@ -182,12 +182,12 @@  discard block
 block discarded – undo
182 182
 	 *
183 183
 	 * @return string The rendered component.
184 184
 	 */
185
-	public function button( $args = array(), $echo = false ) {
186
-		$output = AUI_Component_Button::get( $args );
185
+	public function button($args = array(), $echo = false) {
186
+		$output = AUI_Component_Button::get($args);
187 187
 
188
-		if ( $echo ) {
188
+		if ($echo) {
189 189
 			echo $output;
190
-		}else{
190
+		} else {
191 191
 			return $output;
192 192
 		}
193 193
 	}
@@ -202,26 +202,26 @@  discard block
 block discarded – undo
202 202
 	 *
203 203
 	 * @return string The rendered component.
204 204
 	 */
205
-	public function badge( $args = array(), $echo = false ) {
205
+	public function badge($args = array(), $echo = false) {
206 206
 		$defaults = array(
207 207
 			'class' => 'badge badge-primary align-middle',
208 208
 		);
209 209
 
210 210
 		// maybe set type.
211
-		if ( empty( $args['href'] ) ) {
211
+		if (empty($args['href'])) {
212 212
 			$defaults['type'] = 'badge';
213 213
 		}
214 214
 
215 215
 		/**
216 216
 		 * Parse incoming $args into an array and merge it with $defaults
217 217
 		 */
218
-		$args = wp_parse_args( $args, $defaults );
218
+		$args = wp_parse_args($args, $defaults);
219 219
 
220
-		$output = AUI_Component_Button::get( $args );
220
+		$output = AUI_Component_Button::get($args);
221 221
 
222
-		if ( $echo ) {
222
+		if ($echo) {
223 223
 			echo $output;
224
-		}else{
224
+		} else {
225 225
 			return $output;
226 226
 		}
227 227
 	}
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
 	 *
237 237
 	 * @return string The rendered component.
238 238
 	 */
239
-	public function dropdown( $args = array(), $echo = false ) {
240
-		$output = AUI_Component_Dropdown::get( $args );
239
+	public function dropdown($args = array(), $echo = false) {
240
+		$output = AUI_Component_Dropdown::get($args);
241 241
 
242
-		if ( $echo ) {
242
+		if ($echo) {
243 243
 			echo $output;
244
-		}else{
244
+		} else {
245 245
 			return $output;
246 246
 		}
247 247
 	}
@@ -256,12 +256,12 @@  discard block
 block discarded – undo
256 256
 	 *
257 257
 	 * @return string The rendered component.
258 258
 	 */
259
-	public function select( $args = array(), $echo = false ) {
260
-		$output = AUI_Component_Input::select( $args );
259
+	public function select($args = array(), $echo = false) {
260
+		$output = AUI_Component_Input::select($args);
261 261
 
262
-		if ( $echo ) {
262
+		if ($echo) {
263 263
 			echo $output;
264
-		}else{
264
+		} else {
265 265
 			return $output;
266 266
 		}
267 267
 	}
@@ -276,12 +276,12 @@  discard block
 block discarded – undo
276 276
 	 *
277 277
 	 * @return string The rendered component.
278 278
 	 */
279
-	public function radio( $args = array(), $echo = false ) {
280
-		$output = AUI_Component_Input::radio( $args );
279
+	public function radio($args = array(), $echo = false) {
280
+		$output = AUI_Component_Input::radio($args);
281 281
 
282
-		if ( $echo ) {
282
+		if ($echo) {
283 283
 			echo $output;
284
-		}else{
284
+		} else {
285 285
 			return $output;
286 286
 		}
287 287
 	}
@@ -296,12 +296,12 @@  discard block
 block discarded – undo
296 296
 	 *
297 297
 	 * @return string The rendered component.
298 298
 	 */
299
-	public function pagination( $args = array(), $echo = false ) {
300
-		$output = AUI_Component_Pagination::get( $args );
299
+	public function pagination($args = array(), $echo = false) {
300
+		$output = AUI_Component_Pagination::get($args);
301 301
 
302
-		if ( $echo ) {
302
+		if ($echo) {
303 303
 			echo $output;
304
-		}else{
304
+		} else {
305 305
 			return $output;
306 306
 		}
307 307
 	}
Please login to merge, or discard this patch.
Braces   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		if ( ! $result && $option) {
86 86
 			if( $option == 'color_primary' ){
87 87
 				$result = AUI_PRIMARY_COLOR;
88
-			}elseif( $option == 'color_secondary' ){
88
+			} elseif( $option == 'color_secondary' ){
89 89
 				$result = AUI_SECONDARY_COLOR;
90 90
 			}
91 91
 		}
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 
107 107
 		if ( $echo ) {
108 108
 			echo $output;
109
-		}else{
109
+		} else{
110 110
 			return $output;
111 111
 		}
112 112
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 
128 128
 		if ( $echo ) {
129 129
 			echo $output;
130
-		}else{
130
+		} else{
131 131
 			return $output;
132 132
 		}
133 133
 	}
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 
148 148
 		if ( $echo ) {
149 149
 			echo $output;
150
-		}else{
150
+		} else{
151 151
 			return $output;
152 152
 		}
153 153
 	}
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 
168 168
 		if ( $echo ) {
169 169
 			echo $output;
170
-		}else{
170
+		} else{
171 171
 			return $output;
172 172
 		}
173 173
 	}
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 
188 188
 		if ( $echo ) {
189 189
 			echo $output;
190
-		}else{
190
+		} else{
191 191
 			return $output;
192 192
 		}
193 193
 	}
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 
222 222
 		if ( $echo ) {
223 223
 			echo $output;
224
-		}else{
224
+		} else{
225 225
 			return $output;
226 226
 		}
227 227
 	}
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
 		if ( $echo ) {
243 243
 			echo $output;
244
-		}else{
244
+		} else{
245 245
 			return $output;
246 246
 		}
247 247
 	}
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 
262 262
 		if ( $echo ) {
263 263
 			echo $output;
264
-		}else{
264
+		} else{
265 265
 			return $output;
266 266
 		}
267 267
 	}
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 
282 282
 		if ( $echo ) {
283 283
 			echo $output;
284
-		}else{
284
+		} else{
285 285
 			return $output;
286 286
 		}
287 287
 	}
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 
302 302
 		if ( $echo ) {
303 303
 			echo $output;
304
-		}else{
304
+		} else{
305 305
 			return $output;
306 306
 		}
307 307
 	}
Please login to merge, or discard this patch.
Indentation   +295 added lines, -295 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if ( ! defined( 'ABSPATH' ) ) {
4
-	exit; // Exit if accessed directly
4
+    exit; // Exit if accessed directly
5 5
 }
6 6
 
7 7
 /**
@@ -11,299 +11,299 @@  discard block
 block discarded – undo
11 11
  */
12 12
 class AUI {
13 13
 
14
-	/**
15
-	 * Holds the class instance.
16
-	 *
17
-	 * @since 1.0.0
18
-	 * @var null
19
-	 */
20
-	private static $instance = null;
21
-
22
-	/**
23
-	 * Holds the current AUI version number.
24
-	 *
25
-	 * @var string $ver The current version number.
26
-	 */
27
-	public static $ver = '0.1.70';
28
-
29
-	public static $options = null;
30
-
31
-	/**
32
-	 * There can be only one.
33
-	 *
34
-	 * @since 1.0.0
35
-	 * @return AUI|null
36
-	 */
37
-	public static function instance() {
38
-		if ( self::$instance == null ) {
39
-			self::$instance = new AUI();
40
-		}
41
-
42
-		return self::$instance;
43
-	}
44
-
45
-	/**
46
-	 * AUI constructor.
47
-	 *
48
-	 * @since 1.0.0
49
-	 */
50
-	private function __construct() {
51
-		if ( function_exists( "__autoload" ) ) {
52
-			spl_autoload_register( "__autoload" );
53
-		}
54
-		spl_autoload_register( array( $this, 'autoload' ) );
55
-
56
-		// load options
57
-		self::$options = get_option('aui_options');
58
-	}
59
-
60
-	/**
61
-	 * Autoload any components on the fly.
62
-	 *
63
-	 * @since 1.0.0
64
-	 *
65
-	 * @param $classname
66
-	 */
67
-	private function autoload( $classname ) {
68
-		$class     = str_replace( '_', '-', strtolower( $classname ) );
69
-		$file_path = trailingslashit( dirname( __FILE__ ) ) . "components/class-" . $class . '.php';
70
-		if ( $file_path && is_readable( $file_path ) ) {
71
-			include_once( $file_path );
72
-		}
73
-	}
74
-
75
-	/**
76
-	 * Get the AUI options.
77
-	 *
78
-	 * @param $option
79
-	 *
80
-	 * @return string|void
81
-	 */
82
-	public function get_option( $option ){
83
-		$result = isset(self::$options[$option]) ? esc_attr(self::$options[$option]) : '';
84
-
85
-		if ( ! $result && $option) {
86
-			if( $option == 'color_primary' ){
87
-				$result = AUI_PRIMARY_COLOR;
88
-			}elseif( $option == 'color_secondary' ){
89
-				$result = AUI_SECONDARY_COLOR;
90
-			}
91
-		}
92
-		return $result;
93
-	}
94
-
95
-	public function render( $items = array(), $echo = false ) {
96
-		$output = '';
97
-
98
-		if ( ! empty( $items ) ) {
99
-			foreach ( $items as $args ) {
100
-				$render = isset( $args['render'] ) ? $args['render'] : '';
101
-				if ( $render && method_exists( __CLASS__, $render ) ) {
102
-					$output .= $this->$render( $args );
103
-				}
104
-			}
105
-		}
106
-
107
-		if ( $echo ) {
108
-			echo $output;
109
-		}else{
110
-			return $output;
111
-		}
112
-
113
-	}
114
-
115
-	/**
116
-	 * Render and return a bootstrap alert component.
117
-	 *
118
-	 * @since 1.0.0
119
-	 *
120
-	 * @param array $args The function arguments.
121
-	 * @param bool  $echo If we should return or echo.
122
-	 *
123
-	 * @return string The rendered component.
124
-	 */
125
-	public function alert( $args = array(), $echo = false ) {
126
-		$output = AUI_Component_Alert::get( $args );
127
-
128
-		if ( $echo ) {
129
-			echo $output;
130
-		}else{
131
-			return $output;
132
-		}
133
-	}
134
-
135
-	/**
136
-	 * Render and return a bootstrap input component.
137
-	 *
138
-	 * @since 1.0.0
139
-	 *
140
-	 * @param array $args The function arguments.
141
-	 * @param bool  $echo If we should return or echo.
142
-	 *
143
-	 * @return string The rendered component.
144
-	 */
145
-	public function input( $args = array(), $echo = false ) {
146
-		$output = AUI_Component_Input::input( $args );
147
-
148
-		if ( $echo ) {
149
-			echo $output;
150
-		}else{
151
-			return $output;
152
-		}
153
-	}
154
-
155
-	/**
156
-	 * Render and return a bootstrap textarea component.
157
-	 *
158
-	 * @since 1.0.0
159
-	 *
160
-	 * @param array $args The function arguments.
161
-	 * @param bool  $echo If we should return or echo.
162
-	 *
163
-	 * @return string The rendered component.
164
-	 */
165
-	public function textarea( $args = array(), $echo = false ) {
166
-		$output = AUI_Component_Input::textarea( $args );
167
-
168
-		if ( $echo ) {
169
-			echo $output;
170
-		}else{
171
-			return $output;
172
-		}
173
-	}
174
-
175
-	/**
176
-	 * Render and return a bootstrap button component.
177
-	 *
178
-	 * @since 1.0.0
179
-	 *
180
-	 * @param array $args The function arguments.
181
-	 * @param bool  $echo If we should return or echo.
182
-	 *
183
-	 * @return string The rendered component.
184
-	 */
185
-	public function button( $args = array(), $echo = false ) {
186
-		$output = AUI_Component_Button::get( $args );
187
-
188
-		if ( $echo ) {
189
-			echo $output;
190
-		}else{
191
-			return $output;
192
-		}
193
-	}
194
-
195
-	/**
196
-	 * Render and return a bootstrap button component.
197
-	 *
198
-	 * @since 1.0.0
199
-	 *
200
-	 * @param array $args The function arguments.
201
-	 * @param bool  $echo If we should return or echo.
202
-	 *
203
-	 * @return string The rendered component.
204
-	 */
205
-	public function badge( $args = array(), $echo = false ) {
206
-		$defaults = array(
207
-			'class' => 'badge badge-primary align-middle',
208
-		);
209
-
210
-		// maybe set type.
211
-		if ( empty( $args['href'] ) ) {
212
-			$defaults['type'] = 'badge';
213
-		}
214
-
215
-		/**
216
-		 * Parse incoming $args into an array and merge it with $defaults
217
-		 */
218
-		$args = wp_parse_args( $args, $defaults );
219
-
220
-		$output = AUI_Component_Button::get( $args );
221
-
222
-		if ( $echo ) {
223
-			echo $output;
224
-		}else{
225
-			return $output;
226
-		}
227
-	}
228
-
229
-	/**
230
-	 * Render and return a bootstrap dropdown component.
231
-	 *
232
-	 * @since 1.0.0
233
-	 *
234
-	 * @param array $args The function arguments.
235
-	 * @param bool  $echo If we should return or echo.
236
-	 *
237
-	 * @return string The rendered component.
238
-	 */
239
-	public function dropdown( $args = array(), $echo = false ) {
240
-		$output = AUI_Component_Dropdown::get( $args );
241
-
242
-		if ( $echo ) {
243
-			echo $output;
244
-		}else{
245
-			return $output;
246
-		}
247
-	}
248
-
249
-	/**
250
-	 * Render and return a bootstrap select component.
251
-	 *
252
-	 * @since 1.0.0
253
-	 *
254
-	 * @param array $args The function arguments.
255
-	 * @param bool  $echo If we should return or echo.
256
-	 *
257
-	 * @return string The rendered component.
258
-	 */
259
-	public function select( $args = array(), $echo = false ) {
260
-		$output = AUI_Component_Input::select( $args );
261
-
262
-		if ( $echo ) {
263
-			echo $output;
264
-		}else{
265
-			return $output;
266
-		}
267
-	}
268
-
269
-	/**
270
-	 * Render and return a bootstrap radio component.
271
-	 *
272
-	 * @since 1.0.0
273
-	 *
274
-	 * @param array $args The function arguments.
275
-	 * @param bool  $echo If we should return or echo.
276
-	 *
277
-	 * @return string The rendered component.
278
-	 */
279
-	public function radio( $args = array(), $echo = false ) {
280
-		$output = AUI_Component_Input::radio( $args );
281
-
282
-		if ( $echo ) {
283
-			echo $output;
284
-		}else{
285
-			return $output;
286
-		}
287
-	}
288
-
289
-	/**
290
-	 * Render and return a bootstrap pagination component.
291
-	 *
292
-	 * @since 1.0.0
293
-	 *
294
-	 * @param array $args The function arguments.
295
-	 * @param bool  $echo If we should return or echo.
296
-	 *
297
-	 * @return string The rendered component.
298
-	 */
299
-	public function pagination( $args = array(), $echo = false ) {
300
-		$output = AUI_Component_Pagination::get( $args );
301
-
302
-		if ( $echo ) {
303
-			echo $output;
304
-		}else{
305
-			return $output;
306
-		}
307
-	}
14
+    /**
15
+     * Holds the class instance.
16
+     *
17
+     * @since 1.0.0
18
+     * @var null
19
+     */
20
+    private static $instance = null;
21
+
22
+    /**
23
+     * Holds the current AUI version number.
24
+     *
25
+     * @var string $ver The current version number.
26
+     */
27
+    public static $ver = '0.1.70';
28
+
29
+    public static $options = null;
30
+
31
+    /**
32
+     * There can be only one.
33
+     *
34
+     * @since 1.0.0
35
+     * @return AUI|null
36
+     */
37
+    public static function instance() {
38
+        if ( self::$instance == null ) {
39
+            self::$instance = new AUI();
40
+        }
41
+
42
+        return self::$instance;
43
+    }
44
+
45
+    /**
46
+     * AUI constructor.
47
+     *
48
+     * @since 1.0.0
49
+     */
50
+    private function __construct() {
51
+        if ( function_exists( "__autoload" ) ) {
52
+            spl_autoload_register( "__autoload" );
53
+        }
54
+        spl_autoload_register( array( $this, 'autoload' ) );
55
+
56
+        // load options
57
+        self::$options = get_option('aui_options');
58
+    }
59
+
60
+    /**
61
+     * Autoload any components on the fly.
62
+     *
63
+     * @since 1.0.0
64
+     *
65
+     * @param $classname
66
+     */
67
+    private function autoload( $classname ) {
68
+        $class     = str_replace( '_', '-', strtolower( $classname ) );
69
+        $file_path = trailingslashit( dirname( __FILE__ ) ) . "components/class-" . $class . '.php';
70
+        if ( $file_path && is_readable( $file_path ) ) {
71
+            include_once( $file_path );
72
+        }
73
+    }
74
+
75
+    /**
76
+     * Get the AUI options.
77
+     *
78
+     * @param $option
79
+     *
80
+     * @return string|void
81
+     */
82
+    public function get_option( $option ){
83
+        $result = isset(self::$options[$option]) ? esc_attr(self::$options[$option]) : '';
84
+
85
+        if ( ! $result && $option) {
86
+            if( $option == 'color_primary' ){
87
+                $result = AUI_PRIMARY_COLOR;
88
+            }elseif( $option == 'color_secondary' ){
89
+                $result = AUI_SECONDARY_COLOR;
90
+            }
91
+        }
92
+        return $result;
93
+    }
94
+
95
+    public function render( $items = array(), $echo = false ) {
96
+        $output = '';
97
+
98
+        if ( ! empty( $items ) ) {
99
+            foreach ( $items as $args ) {
100
+                $render = isset( $args['render'] ) ? $args['render'] : '';
101
+                if ( $render && method_exists( __CLASS__, $render ) ) {
102
+                    $output .= $this->$render( $args );
103
+                }
104
+            }
105
+        }
106
+
107
+        if ( $echo ) {
108
+            echo $output;
109
+        }else{
110
+            return $output;
111
+        }
112
+
113
+    }
114
+
115
+    /**
116
+     * Render and return a bootstrap alert component.
117
+     *
118
+     * @since 1.0.0
119
+     *
120
+     * @param array $args The function arguments.
121
+     * @param bool  $echo If we should return or echo.
122
+     *
123
+     * @return string The rendered component.
124
+     */
125
+    public function alert( $args = array(), $echo = false ) {
126
+        $output = AUI_Component_Alert::get( $args );
127
+
128
+        if ( $echo ) {
129
+            echo $output;
130
+        }else{
131
+            return $output;
132
+        }
133
+    }
134
+
135
+    /**
136
+     * Render and return a bootstrap input component.
137
+     *
138
+     * @since 1.0.0
139
+     *
140
+     * @param array $args The function arguments.
141
+     * @param bool  $echo If we should return or echo.
142
+     *
143
+     * @return string The rendered component.
144
+     */
145
+    public function input( $args = array(), $echo = false ) {
146
+        $output = AUI_Component_Input::input( $args );
147
+
148
+        if ( $echo ) {
149
+            echo $output;
150
+        }else{
151
+            return $output;
152
+        }
153
+    }
154
+
155
+    /**
156
+     * Render and return a bootstrap textarea component.
157
+     *
158
+     * @since 1.0.0
159
+     *
160
+     * @param array $args The function arguments.
161
+     * @param bool  $echo If we should return or echo.
162
+     *
163
+     * @return string The rendered component.
164
+     */
165
+    public function textarea( $args = array(), $echo = false ) {
166
+        $output = AUI_Component_Input::textarea( $args );
167
+
168
+        if ( $echo ) {
169
+            echo $output;
170
+        }else{
171
+            return $output;
172
+        }
173
+    }
174
+
175
+    /**
176
+     * Render and return a bootstrap button component.
177
+     *
178
+     * @since 1.0.0
179
+     *
180
+     * @param array $args The function arguments.
181
+     * @param bool  $echo If we should return or echo.
182
+     *
183
+     * @return string The rendered component.
184
+     */
185
+    public function button( $args = array(), $echo = false ) {
186
+        $output = AUI_Component_Button::get( $args );
187
+
188
+        if ( $echo ) {
189
+            echo $output;
190
+        }else{
191
+            return $output;
192
+        }
193
+    }
194
+
195
+    /**
196
+     * Render and return a bootstrap button component.
197
+     *
198
+     * @since 1.0.0
199
+     *
200
+     * @param array $args The function arguments.
201
+     * @param bool  $echo If we should return or echo.
202
+     *
203
+     * @return string The rendered component.
204
+     */
205
+    public function badge( $args = array(), $echo = false ) {
206
+        $defaults = array(
207
+            'class' => 'badge badge-primary align-middle',
208
+        );
209
+
210
+        // maybe set type.
211
+        if ( empty( $args['href'] ) ) {
212
+            $defaults['type'] = 'badge';
213
+        }
214
+
215
+        /**
216
+         * Parse incoming $args into an array and merge it with $defaults
217
+         */
218
+        $args = wp_parse_args( $args, $defaults );
219
+
220
+        $output = AUI_Component_Button::get( $args );
221
+
222
+        if ( $echo ) {
223
+            echo $output;
224
+        }else{
225
+            return $output;
226
+        }
227
+    }
228
+
229
+    /**
230
+     * Render and return a bootstrap dropdown component.
231
+     *
232
+     * @since 1.0.0
233
+     *
234
+     * @param array $args The function arguments.
235
+     * @param bool  $echo If we should return or echo.
236
+     *
237
+     * @return string The rendered component.
238
+     */
239
+    public function dropdown( $args = array(), $echo = false ) {
240
+        $output = AUI_Component_Dropdown::get( $args );
241
+
242
+        if ( $echo ) {
243
+            echo $output;
244
+        }else{
245
+            return $output;
246
+        }
247
+    }
248
+
249
+    /**
250
+     * Render and return a bootstrap select component.
251
+     *
252
+     * @since 1.0.0
253
+     *
254
+     * @param array $args The function arguments.
255
+     * @param bool  $echo If we should return or echo.
256
+     *
257
+     * @return string The rendered component.
258
+     */
259
+    public function select( $args = array(), $echo = false ) {
260
+        $output = AUI_Component_Input::select( $args );
261
+
262
+        if ( $echo ) {
263
+            echo $output;
264
+        }else{
265
+            return $output;
266
+        }
267
+    }
268
+
269
+    /**
270
+     * Render and return a bootstrap radio component.
271
+     *
272
+     * @since 1.0.0
273
+     *
274
+     * @param array $args The function arguments.
275
+     * @param bool  $echo If we should return or echo.
276
+     *
277
+     * @return string The rendered component.
278
+     */
279
+    public function radio( $args = array(), $echo = false ) {
280
+        $output = AUI_Component_Input::radio( $args );
281
+
282
+        if ( $echo ) {
283
+            echo $output;
284
+        }else{
285
+            return $output;
286
+        }
287
+    }
288
+
289
+    /**
290
+     * Render and return a bootstrap pagination component.
291
+     *
292
+     * @since 1.0.0
293
+     *
294
+     * @param array $args The function arguments.
295
+     * @param bool  $echo If we should return or echo.
296
+     *
297
+     * @return string The rendered component.
298
+     */
299
+    public function pagination( $args = array(), $echo = false ) {
300
+        $output = AUI_Component_Pagination::get( $args );
301
+
302
+        if ( $echo ) {
303
+            echo $output;
304
+        }else{
305
+            return $output;
306
+        }
307
+    }
308 308
 
309 309
 }
310 310
\ No newline at end of file
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -7,40 +7,40 @@
 block discarded – undo
7 7
  * Bail if we are not in WP.
8 8
  */
9 9
 if ( ! defined( 'ABSPATH' ) ) {
10
-	exit;
10
+    exit;
11 11
 }
12 12
 
13 13
 /**
14 14
  * Set the version only if its the current newest while loading.
15 15
  */
16 16
 add_action('after_setup_theme', function () {
17
-	global $ayecode_ui_version,$ayecode_ui_file_key;
18
-	$this_version = "0.1.70";
19
-	if(empty($ayecode_ui_version) || version_compare($this_version , $ayecode_ui_version, '>')){
20
-		$ayecode_ui_version = $this_version ;
21
-		$ayecode_ui_file_key = wp_hash( __FILE__ );
22
-	}
17
+    global $ayecode_ui_version,$ayecode_ui_file_key;
18
+    $this_version = "0.1.70";
19
+    if(empty($ayecode_ui_version) || version_compare($this_version , $ayecode_ui_version, '>')){
20
+        $ayecode_ui_version = $this_version ;
21
+        $ayecode_ui_file_key = wp_hash( __FILE__ );
22
+    }
23 23
 },0);
24 24
 
25 25
 /**
26 26
  * Load this version of WP Bootstrap Settings only if the file hash is the current one.
27 27
  */
28 28
 add_action('after_setup_theme', function () {
29
-	global $ayecode_ui_file_key;
30
-	if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){
31
-		include_once( dirname( __FILE__ ) . '/includes/class-aui.php' );
32
-		include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' );
33
-	}
29
+    global $ayecode_ui_file_key;
30
+    if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){
31
+        include_once( dirname( __FILE__ ) . '/includes/class-aui.php' );
32
+        include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' );
33
+    }
34 34
 },1);
35 35
 
36 36
 /**
37 37
  * Add the function that calls the class.
38 38
  */
39 39
 if(!function_exists('aui')){
40
-	function aui(){
41
-		if(!class_exists("AUI",false)){
42
-			return false;
43
-		}
44
-		return AUI::instance();
45
-	}
40
+    function aui(){
41
+        if(!class_exists("AUI",false)){
42
+            return false;
43
+        }
44
+        return AUI::instance();
45
+    }
46 46
 }
47 47
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -6,39 +6,39 @@
 block discarded – undo
6 6
 /**
7 7
  * Bail if we are not in WP.
8 8
  */
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if (!defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
13 13
 /**
14 14
  * Set the version only if its the current newest while loading.
15 15
  */
16
-add_action('after_setup_theme', function () {
17
-	global $ayecode_ui_version,$ayecode_ui_file_key;
16
+add_action('after_setup_theme', function() {
17
+	global $ayecode_ui_version, $ayecode_ui_file_key;
18 18
 	$this_version = "0.1.70";
19
-	if(empty($ayecode_ui_version) || version_compare($this_version , $ayecode_ui_version, '>')){
20
-		$ayecode_ui_version = $this_version ;
21
-		$ayecode_ui_file_key = wp_hash( __FILE__ );
19
+	if (empty($ayecode_ui_version) || version_compare($this_version, $ayecode_ui_version, '>')) {
20
+		$ayecode_ui_version = $this_version;
21
+		$ayecode_ui_file_key = wp_hash(__FILE__);
22 22
 	}
23 23
 },0);
24 24
 
25 25
 /**
26 26
  * Load this version of WP Bootstrap Settings only if the file hash is the current one.
27 27
  */
28
-add_action('after_setup_theme', function () {
28
+add_action('after_setup_theme', function() {
29 29
 	global $ayecode_ui_file_key;
30
-	if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){
31
-		include_once( dirname( __FILE__ ) . '/includes/class-aui.php' );
32
-		include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' );
30
+	if ($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash(__FILE__)) {
31
+		include_once(dirname(__FILE__) . '/includes/class-aui.php');
32
+		include_once(dirname(__FILE__) . '/includes/ayecode-ui-settings.php');
33 33
 	}
34 34
 },1);
35 35
 
36 36
 /**
37 37
  * Add the function that calls the class.
38 38
  */
39
-if(!function_exists('aui')){
40
-	function aui(){
41
-		if(!class_exists("AUI",false)){
39
+if (!function_exists('aui')) {
40
+	function aui() {
41
+		if (!class_exists("AUI", false)) {
42 42
 			return false;
43 43
 		}
44 44
 		return AUI::instance();
Please login to merge, or discard this patch.
widgets/subscriptions.php 2 patches
Indentation   +344 added lines, -344 removed lines patch added patch discarded remove patch
@@ -14,143 +14,143 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class WPInv_Subscriptions_Widget extends WP_Super_Duper {
16 16
 
17
-	/**
18
-	 * Register the widget with WordPress.
19
-	 *
20
-	 */
21
-	public function __construct() {
22
-
23
-		$options = array(
24
-			'textdomain'     => 'invoicing',
25
-			'block-icon'     => 'controls-repeat',
26
-			'block-category' => 'widgets',
27
-			'block-keywords' => "['invoicing','subscriptions', 'getpaid']",
28
-			'class_name'     => __CLASS__,
29
-			'base_id'        => 'wpinv_subscriptions',
30
-			'name'           => __( 'GetPaid > Subscriptions', 'invoicing' ),
31
-			'widget_ops'     => array(
32
-				'classname'   => 'getpaid-subscriptions bsui',
33
-				'description' => esc_html__( "Displays the current user's subscriptions.", 'invoicing' ),
34
-			),
35
-			'arguments'      => array(
36
-				'title' => array(
37
-					'title'    => __( 'Widget title', 'invoicing' ),
38
-					'desc'     => __( 'Enter widget title.', 'invoicing' ),
39
-					'type'     => 'text',
40
-					'desc_tip' => true,
41
-					'default'  => '',
42
-					'advanced' => false,
43
-				),
44
-			),
45
-
46
-		);
47
-
48
-		parent::__construct( $options );
49
-	}
50
-
51
-	/**
52
-	 * Retrieves current user's subscriptions.
53
-	 *
54
-	 * @return GetPaid_Subscriptions_Query
55
-	 */
56
-	public function get_subscriptions() {
57
-
58
-		// Prepare license args.
59
-		$args  = array(
60
-			'customer_in' => get_current_user_id(),
61
-			'paged'       => ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1,
62
-		);
63
-
64
-		return new GetPaid_Subscriptions_Query( $args );
65
-
66
-	}
67
-
68
-	/**
69
-	 * The Super block output function.
70
-	 *
71
-	 * @param array $args
72
-	 * @param array $widget_args
73
-	 * @param string $content
74
-	 *
75
-	 * @return mixed|string|bool
76
-	 */
77
-	public function output( $args = array(), $widget_args = array(), $content = '' ) {
78
-
79
-		// Ensure that the user is logged in.
80
-		if ( ! is_user_logged_in() ) {
81
-
82
-			return aui()->alert(
83
-				array(
84
-					'content' => wp_kses_post( __( 'You need to log-in or create an account to view this section.', 'invoicing' ) ),
85
-					'type'    => 'error',
86
-				)
87
-			);
88
-
89
-		}
90
-
91
-		// Are we displaying a single subscription?
92
-		if ( isset( $_GET['subscription'] ) ) {
93
-			return $this->display_single_subscription( intval( $_GET['subscription'] ) );
94
-		}
95
-
96
-		// Retrieve the user's subscriptions.
97
-		$subscriptions = $this->get_subscriptions();
98
-
99
-		// Start the output buffer.
100
-		ob_start();
101
-
102
-		// Backwards compatibility.
103
-		do_action( 'wpinv_before_user_subscriptions' );
104
-
105
-		// Display errors and notices.
106
-		wpinv_print_errors();
107
-
108
-		do_action( 'getpaid_license_manager_before_subscriptions', $subscriptions );
109
-
110
-		// Print the table header.
111
-		$this->print_table_header();
112
-
113
-		// Print table body.
114
-		$this->print_table_body( $subscriptions->get_results() );
115
-
116
-		// Print table footer.
117
-		$this->print_table_footer();
118
-
119
-		// Print the navigation.
120
-		$this->print_navigation( $subscriptions->get_total() );
121
-
122
-		// Backwards compatibility.
123
-		do_action( 'wpinv_after_user_subscriptions' );
124
-
125
-		// Return the output.
126
-		return ob_get_clean();
127
-
128
-	}
129
-
130
-	/**
131
-	 * Retrieves the subscription columns.
132
-	 *
133
-	 * @return array
134
-	 */
135
-	public function get_subscriptions_table_columns() {
17
+    /**
18
+     * Register the widget with WordPress.
19
+     *
20
+     */
21
+    public function __construct() {
22
+
23
+        $options = array(
24
+            'textdomain'     => 'invoicing',
25
+            'block-icon'     => 'controls-repeat',
26
+            'block-category' => 'widgets',
27
+            'block-keywords' => "['invoicing','subscriptions', 'getpaid']",
28
+            'class_name'     => __CLASS__,
29
+            'base_id'        => 'wpinv_subscriptions',
30
+            'name'           => __( 'GetPaid > Subscriptions', 'invoicing' ),
31
+            'widget_ops'     => array(
32
+                'classname'   => 'getpaid-subscriptions bsui',
33
+                'description' => esc_html__( "Displays the current user's subscriptions.", 'invoicing' ),
34
+            ),
35
+            'arguments'      => array(
36
+                'title' => array(
37
+                    'title'    => __( 'Widget title', 'invoicing' ),
38
+                    'desc'     => __( 'Enter widget title.', 'invoicing' ),
39
+                    'type'     => 'text',
40
+                    'desc_tip' => true,
41
+                    'default'  => '',
42
+                    'advanced' => false,
43
+                ),
44
+            ),
45
+
46
+        );
47
+
48
+        parent::__construct( $options );
49
+    }
50
+
51
+    /**
52
+     * Retrieves current user's subscriptions.
53
+     *
54
+     * @return GetPaid_Subscriptions_Query
55
+     */
56
+    public function get_subscriptions() {
57
+
58
+        // Prepare license args.
59
+        $args  = array(
60
+            'customer_in' => get_current_user_id(),
61
+            'paged'       => ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1,
62
+        );
63
+
64
+        return new GetPaid_Subscriptions_Query( $args );
65
+
66
+    }
67
+
68
+    /**
69
+     * The Super block output function.
70
+     *
71
+     * @param array $args
72
+     * @param array $widget_args
73
+     * @param string $content
74
+     *
75
+     * @return mixed|string|bool
76
+     */
77
+    public function output( $args = array(), $widget_args = array(), $content = '' ) {
78
+
79
+        // Ensure that the user is logged in.
80
+        if ( ! is_user_logged_in() ) {
81
+
82
+            return aui()->alert(
83
+                array(
84
+                    'content' => wp_kses_post( __( 'You need to log-in or create an account to view this section.', 'invoicing' ) ),
85
+                    'type'    => 'error',
86
+                )
87
+            );
88
+
89
+        }
90
+
91
+        // Are we displaying a single subscription?
92
+        if ( isset( $_GET['subscription'] ) ) {
93
+            return $this->display_single_subscription( intval( $_GET['subscription'] ) );
94
+        }
95
+
96
+        // Retrieve the user's subscriptions.
97
+        $subscriptions = $this->get_subscriptions();
98
+
99
+        // Start the output buffer.
100
+        ob_start();
101
+
102
+        // Backwards compatibility.
103
+        do_action( 'wpinv_before_user_subscriptions' );
104
+
105
+        // Display errors and notices.
106
+        wpinv_print_errors();
107
+
108
+        do_action( 'getpaid_license_manager_before_subscriptions', $subscriptions );
109
+
110
+        // Print the table header.
111
+        $this->print_table_header();
112
+
113
+        // Print table body.
114
+        $this->print_table_body( $subscriptions->get_results() );
115
+
116
+        // Print table footer.
117
+        $this->print_table_footer();
118
+
119
+        // Print the navigation.
120
+        $this->print_navigation( $subscriptions->get_total() );
121
+
122
+        // Backwards compatibility.
123
+        do_action( 'wpinv_after_user_subscriptions' );
124
+
125
+        // Return the output.
126
+        return ob_get_clean();
127
+
128
+    }
129
+
130
+    /**
131
+     * Retrieves the subscription columns.
132
+     *
133
+     * @return array
134
+     */
135
+    public function get_subscriptions_table_columns() {
136 136
 
137
-		$columns = array(
138
-			'subscription' => __( 'Subscription', 'invoicing' ),
139
-			'amount'       => __( 'Amount', 'invoicing' ),
140
-			'renewal-date' => __( 'Next payment', 'invoicing' ),
141
-			'status'       => __( 'Status', 'invoicing' ),
142
-		);
137
+        $columns = array(
138
+            'subscription' => __( 'Subscription', 'invoicing' ),
139
+            'amount'       => __( 'Amount', 'invoicing' ),
140
+            'renewal-date' => __( 'Next payment', 'invoicing' ),
141
+            'status'       => __( 'Status', 'invoicing' ),
142
+        );
143 143
 
144
-		return apply_filters( 'getpaid_frontend_subscriptions_table_columns', $columns );
145
-	}
144
+        return apply_filters( 'getpaid_frontend_subscriptions_table_columns', $columns );
145
+    }
146 146
 
147
-	/**
148
-	 * Displays the table header.
149
-	 *
150
-	 */
151
-	public function print_table_header() {
147
+    /**
148
+     * Displays the table header.
149
+     *
150
+     */
151
+    public function print_table_header() {
152 152
 
153
-		?>
153
+        ?>
154 154
 
155 155
 			<table class="table table-bordered table-striped">
156 156
 
@@ -166,122 +166,122 @@  discard block
 block discarded – undo
166 166
 
167 167
 		<?php
168 168
 
169
-	}
169
+    }
170 170
 
171
-	/**
172
-	 * Displays the table body.
173
-	 *
174
-	 * @param WPInv_Subscription[] $subscriptions
175
-	 */
176
-	public function print_table_body( $subscriptions ) {
171
+    /**
172
+     * Displays the table body.
173
+     *
174
+     * @param WPInv_Subscription[] $subscriptions
175
+     */
176
+    public function print_table_body( $subscriptions ) {
177 177
 
178
-		if ( empty( $subscriptions ) ) {
179
-			$this->print_table_body_no_subscriptions();
180
-		} else {
181
-			$this->print_table_body_subscriptions( $subscriptions );
182
-		}
178
+        if ( empty( $subscriptions ) ) {
179
+            $this->print_table_body_no_subscriptions();
180
+        } else {
181
+            $this->print_table_body_subscriptions( $subscriptions );
182
+        }
183 183
 
184
-	}
184
+    }
185 185
 
186
-	/**
187
-	 * Displays the table body if no subscriptions were found.
188
-	 *
189
-	 */
190
-	public function print_table_body_no_subscriptions() {
186
+    /**
187
+     * Displays the table body if no subscriptions were found.
188
+     *
189
+     */
190
+    public function print_table_body_no_subscriptions() {
191 191
 
192
-		?>
192
+        ?>
193 193
 		<tbody>
194 194
 
195 195
 			<tr>
196 196
 				<td colspan="<?php echo count( $this->get_subscriptions_table_columns() ); ?>">
197 197
 
198 198
 					<?php
199
-						aui()->alert(
200
-							array(
201
-								'content' => wp_kses_post( __( 'No subscriptions found.', 'invoicing' ) ),
202
-								'type'    => 'warning',
203
-							),
199
+                        aui()->alert(
200
+                            array(
201
+                                'content' => wp_kses_post( __( 'No subscriptions found.', 'invoicing' ) ),
202
+                                'type'    => 'warning',
203
+                            ),
204 204
                             true
205
-						);
206
-					?>
205
+                        );
206
+                    ?>
207 207
 
208 208
 				</td>
209 209
 			</tr>
210 210
 
211 211
 		</tbody>
212 212
 		<?php
213
-	}
213
+    }
214 214
 
215
-	/**
216
-	 * Displays the table body if subscriptions were found.
217
-	 *
218
-	 * @param WPInv_Subscription[] $subscriptions
219
-	 */
220
-	public function print_table_body_subscriptions( $subscriptions ) {
215
+    /**
216
+     * Displays the table body if subscriptions were found.
217
+     *
218
+     * @param WPInv_Subscription[] $subscriptions
219
+     */
220
+    public function print_table_body_subscriptions( $subscriptions ) {
221 221
 
222
-		?>
222
+        ?>
223 223
 		<tbody>
224 224
 
225 225
 			<?php foreach ( $subscriptions as $subscription ) : ?>
226 226
 				<tr class="getpaid-subscriptions-table-row subscription-<?php echo (int) $subscription->get_id(); ?>">
227 227
 					<?php
228
-						wpinv_get_template(
229
-							'subscriptions/subscriptions-table-row.php',
230
-							array(
231
-								'subscription' => $subscription,
232
-								'widget'       => $this,
233
-							)
234
-						);
235
-					?>
228
+                        wpinv_get_template(
229
+                            'subscriptions/subscriptions-table-row.php',
230
+                            array(
231
+                                'subscription' => $subscription,
232
+                                'widget'       => $this,
233
+                            )
234
+                        );
235
+                    ?>
236 236
 				</tr>
237 237
 			<?php endforeach; ?>
238 238
 
239 239
 		</tbody>
240 240
 		<?php
241
-	}
242
-
243
-	/**
244
-	 * Adds row actions to a column
245
-	 *
246
-	 * @param string $content column content
247
-	 * @param WPInv_Subscription $subscription
248
-	 * @since       1.0.0
249
-	 * @return      string
250
-	 */
251
-	public function add_row_actions( $content, $subscription ) {
252
-
253
-		// Prepare row actions.
254
-		$actions = array();
255
-
256
-		// View subscription action.
257
-		$view_url        = getpaid_get_tab_url( 'gp-subscriptions', get_permalink( (int) wpinv_get_option( 'invoice_subscription_page' ) ) );
258
-		$view_url        = esc_url( add_query_arg( 'subscription', (int) $subscription->get_id(), $view_url ) );
259
-		$actions['view'] = "<a href='$view_url' class='text-decoration-none'>" . __( 'Manage Subscription', 'invoicing' ) . '</a>';
260
-
261
-		// Filter the actions.
262
-		$actions = apply_filters( 'getpaid_subscriptions_table_subscription_actions', $actions, $subscription );
263
-
264
-		$sanitized  = array();
265
-		foreach ( $actions as $key => $action ) {
266
-			$key         = sanitize_html_class( $key );
267
-			$action      = wp_kses_post( $action );
268
-			$sanitized[] = "<span class='$key'>$action</span>";
269
-		}
270
-
271
-		$row_actions  = "<small class='form-text getpaid-subscription-item-actions'>";
272
-		$row_actions .= implode( ' | ', $sanitized );
273
-		$row_actions .= '</small>';
274
-
275
-		return $content . $row_actions;
276
-	}
277
-
278
-	/**
279
-	 * Displays the table footer.
280
-	 *
281
-	 */
282
-	public function print_table_footer() {
283
-
284
-		?>
241
+    }
242
+
243
+    /**
244
+     * Adds row actions to a column
245
+     *
246
+     * @param string $content column content
247
+     * @param WPInv_Subscription $subscription
248
+     * @since       1.0.0
249
+     * @return      string
250
+     */
251
+    public function add_row_actions( $content, $subscription ) {
252
+
253
+        // Prepare row actions.
254
+        $actions = array();
255
+
256
+        // View subscription action.
257
+        $view_url        = getpaid_get_tab_url( 'gp-subscriptions', get_permalink( (int) wpinv_get_option( 'invoice_subscription_page' ) ) );
258
+        $view_url        = esc_url( add_query_arg( 'subscription', (int) $subscription->get_id(), $view_url ) );
259
+        $actions['view'] = "<a href='$view_url' class='text-decoration-none'>" . __( 'Manage Subscription', 'invoicing' ) . '</a>';
260
+
261
+        // Filter the actions.
262
+        $actions = apply_filters( 'getpaid_subscriptions_table_subscription_actions', $actions, $subscription );
263
+
264
+        $sanitized  = array();
265
+        foreach ( $actions as $key => $action ) {
266
+            $key         = sanitize_html_class( $key );
267
+            $action      = wp_kses_post( $action );
268
+            $sanitized[] = "<span class='$key'>$action</span>";
269
+        }
270
+
271
+        $row_actions  = "<small class='form-text getpaid-subscription-item-actions'>";
272
+        $row_actions .= implode( ' | ', $sanitized );
273
+        $row_actions .= '</small>';
274
+
275
+        return $content . $row_actions;
276
+    }
277
+
278
+    /**
279
+     * Displays the table footer.
280
+     *
281
+     */
282
+    public function print_table_footer() {
283
+
284
+        ?>
285 285
 
286 286
 				<tfoot>
287 287
 					<tr>
@@ -296,144 +296,144 @@  discard block
 block discarded – undo
296 296
 			</table>
297 297
 		<?php
298 298
 
299
-	}
299
+    }
300 300
 
301
-	/**
302
-	 * Displays the navigation.
303
-	 *
304
-	 * @param int $total
305
-	 */
306
-	public function print_navigation( $total ) {
301
+    /**
302
+     * Displays the navigation.
303
+     *
304
+     * @param int $total
305
+     */
306
+    public function print_navigation( $total ) {
307 307
 
308
-		if ( $total < 1 ) {
308
+        if ( $total < 1 ) {
309 309
 
310
-			// Out-of-bounds, run the query again without LIMIT for total count.
311
-			$args  = array(
312
-				'customer_in' => get_current_user_id(),
313
-				'fields'      => 'id',
314
-			);
310
+            // Out-of-bounds, run the query again without LIMIT for total count.
311
+            $args  = array(
312
+                'customer_in' => get_current_user_id(),
313
+                'fields'      => 'id',
314
+            );
315 315
 
316
-			$count_query = new GetPaid_Subscriptions_Query( $args );
317
-			$total       = $count_query->get_total();
318
-		}
316
+            $count_query = new GetPaid_Subscriptions_Query( $args );
317
+            $total       = $count_query->get_total();
318
+        }
319 319
 
320
-		// Abort if we do not have pages.
321
-		if ( 2 > $total ) {
322
-			return;
323
-		}
320
+        // Abort if we do not have pages.
321
+        if ( 2 > $total ) {
322
+            return;
323
+        }
324 324
 
325
-		?>
325
+        ?>
326 326
 
327 327
 		<div class="getpaid-subscriptions-pagination">
328 328
 			<?php
329
-				$big = 999999;
330
-
331
-				echo wp_kses_post(
332
-					getpaid_paginate_links(
333
-						array(
334
-							'base'   => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
335
-							'format' => '?paged=%#%',
336
-							'total'  => (int) ceil( $total / 10 ),
337
-						)
338
-					)
339
-				);
340
-			?>
329
+                $big = 999999;
330
+
331
+                echo wp_kses_post(
332
+                    getpaid_paginate_links(
333
+                        array(
334
+                            'base'   => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
335
+                            'format' => '?paged=%#%',
336
+                            'total'  => (int) ceil( $total / 10 ),
337
+                        )
338
+                    )
339
+                );
340
+            ?>
341 341
 		</div>
342 342
 
343 343
 		<?php
344
-	}
345
-
346
-	/**
347
-	 * Returns a single subscription's columns.
348
-	 *
349
-	 * @param WPInv_Subscription $subscription
350
-	 *
351
-	 * @return array
352
-	 */
353
-	public function get_single_subscription_columns( $subscription ) {
354
-
355
-		// Prepare subscription detail columns.
356
-		$subscription_group = getpaid_get_invoice_subscription_group( $subscription->get_parent_invoice_id(), $subscription->get_id() );
357
-		$items_count        = empty( $subscription_group ) ? 1 : count( $subscription_group['items'] );
358
-		$fields             = apply_filters(
359
-			'getpaid_single_subscription_details_fields',
360
-			array(
361
-				'status'           => __( 'Status', 'invoicing' ),
362
-				'initial_amount'   => __( 'Initial amount', 'invoicing' ),
363
-				'recurring_amount' => __( 'Recurring amount', 'invoicing' ),
364
-				'start_date'       => __( 'Start date', 'invoicing' ),
365
-				'expiry_date'      => __( 'Next payment', 'invoicing' ),
366
-				'payments'         => __( 'Payments', 'invoicing' ),
367
-				'item'             => _n( 'Item', 'Items', $items_count, 'invoicing' ),
368
-			),
369
-			$subscription
370
-		);
371
-
372
-		if ( isset( $fields['expiry_date'] ) ) {
373
-
374
-			if ( ! $subscription->is_active() || $subscription->is_last_renewal() ) {
375
-				$fields['expiry_date'] = __( 'End date', 'invoicing' );
376
-			}
377
-
378
-			if ( 'pending' == $subscription->get_status() ) {
379
-				unset( $fields['expiry_date'] );
380
-			}
344
+    }
345
+
346
+    /**
347
+     * Returns a single subscription's columns.
348
+     *
349
+     * @param WPInv_Subscription $subscription
350
+     *
351
+     * @return array
352
+     */
353
+    public function get_single_subscription_columns( $subscription ) {
354
+
355
+        // Prepare subscription detail columns.
356
+        $subscription_group = getpaid_get_invoice_subscription_group( $subscription->get_parent_invoice_id(), $subscription->get_id() );
357
+        $items_count        = empty( $subscription_group ) ? 1 : count( $subscription_group['items'] );
358
+        $fields             = apply_filters(
359
+            'getpaid_single_subscription_details_fields',
360
+            array(
361
+                'status'           => __( 'Status', 'invoicing' ),
362
+                'initial_amount'   => __( 'Initial amount', 'invoicing' ),
363
+                'recurring_amount' => __( 'Recurring amount', 'invoicing' ),
364
+                'start_date'       => __( 'Start date', 'invoicing' ),
365
+                'expiry_date'      => __( 'Next payment', 'invoicing' ),
366
+                'payments'         => __( 'Payments', 'invoicing' ),
367
+                'item'             => _n( 'Item', 'Items', $items_count, 'invoicing' ),
368
+            ),
369
+            $subscription
370
+        );
371
+
372
+        if ( isset( $fields['expiry_date'] ) ) {
373
+
374
+            if ( ! $subscription->is_active() || $subscription->is_last_renewal() ) {
375
+                $fields['expiry_date'] = __( 'End date', 'invoicing' );
376
+            }
377
+
378
+            if ( 'pending' == $subscription->get_status() ) {
379
+                unset( $fields['expiry_date'] );
380
+            }
381 381
 }
382 382
 
383
-		if ( isset( $fields['start_date'] ) && 'pending' == $subscription->get_status() ) {
384
-			unset( $fields['start_date'] );
385
-		}
386
-
387
-		if ( $subscription->get_initial_amount() == $subscription->get_recurring_amount() ) {
388
-			unset( $fields['initial_amount'] );
389
-		}
390
-
391
-		return $fields;
392
-	}
393
-
394
-	/**
395
-	 * Displays a single subscription.
396
-	 *
397
-	 * @param string $subscription
398
-	 *
399
-	 * @return string
400
-	 */
401
-	public function display_single_subscription( $subscription ) {
402
-
403
-		// Fetch the subscription.
404
-		$subscription = new WPInv_Subscription( (int) $subscription );
405
-
406
-		if ( ! $subscription->exists() ) {
407
-
408
-			return aui()->alert(
409
-				array(
410
-					'content' => wp_kses_post( __( 'Subscription not found.', 'invoicing' ) ),
411
-					'type'    => 'error',
412
-				)
413
-			);
414
-
415
-		}
416
-
417
-		// Ensure that the user owns this subscription key.
418
-		if ( get_current_user_id() != $subscription->get_customer_id() && ! wpinv_current_user_can_manage_invoicing() ) {
419
-
420
-			return aui()->alert(
421
-				array(
422
-					'content' => wp_kses_post( __( 'You do not have permission to view this subscription. Ensure that you are logged in to the account that owns the subscription.', 'invoicing' ) ),
423
-					'type'    => 'error',
424
-				)
425
-			);
426
-
427
-		}
428
-
429
-		return wpinv_get_template_html(
430
-			'subscriptions/subscription-details.php',
431
-			array(
432
-				'subscription' => $subscription,
433
-				'widget'       => $this,
434
-			)
435
-		);
436
-
437
-	}
383
+        if ( isset( $fields['start_date'] ) && 'pending' == $subscription->get_status() ) {
384
+            unset( $fields['start_date'] );
385
+        }
386
+
387
+        if ( $subscription->get_initial_amount() == $subscription->get_recurring_amount() ) {
388
+            unset( $fields['initial_amount'] );
389
+        }
390
+
391
+        return $fields;
392
+    }
393
+
394
+    /**
395
+     * Displays a single subscription.
396
+     *
397
+     * @param string $subscription
398
+     *
399
+     * @return string
400
+     */
401
+    public function display_single_subscription( $subscription ) {
402
+
403
+        // Fetch the subscription.
404
+        $subscription = new WPInv_Subscription( (int) $subscription );
405
+
406
+        if ( ! $subscription->exists() ) {
407
+
408
+            return aui()->alert(
409
+                array(
410
+                    'content' => wp_kses_post( __( 'Subscription not found.', 'invoicing' ) ),
411
+                    'type'    => 'error',
412
+                )
413
+            );
414
+
415
+        }
416
+
417
+        // Ensure that the user owns this subscription key.
418
+        if ( get_current_user_id() != $subscription->get_customer_id() && ! wpinv_current_user_can_manage_invoicing() ) {
419
+
420
+            return aui()->alert(
421
+                array(
422
+                    'content' => wp_kses_post( __( 'You do not have permission to view this subscription. Ensure that you are logged in to the account that owns the subscription.', 'invoicing' ) ),
423
+                    'type'    => 'error',
424
+                )
425
+            );
426
+
427
+        }
428
+
429
+        return wpinv_get_template_html(
430
+            'subscriptions/subscription-details.php',
431
+            array(
432
+                'subscription' => $subscription,
433
+                'widget'       => $this,
434
+            )
435
+        );
436
+
437
+    }
438 438
 
439 439
 }
Please login to merge, or discard this patch.
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * @version 1.0.0
6 6
  */
7 7
 
8
-defined( 'ABSPATH' ) || exit;
8
+defined('ABSPATH') || exit;
9 9
 
10 10
 /**
11 11
  * Contains the subscriptions widget.
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
 			'block-keywords' => "['invoicing','subscriptions', 'getpaid']",
28 28
 			'class_name'     => __CLASS__,
29 29
 			'base_id'        => 'wpinv_subscriptions',
30
-			'name'           => __( 'GetPaid > Subscriptions', 'invoicing' ),
30
+			'name'           => __('GetPaid > Subscriptions', 'invoicing'),
31 31
 			'widget_ops'     => array(
32 32
 				'classname'   => 'getpaid-subscriptions bsui',
33
-				'description' => esc_html__( "Displays the current user's subscriptions.", 'invoicing' ),
33
+				'description' => esc_html__("Displays the current user's subscriptions.", 'invoicing'),
34 34
 			),
35 35
 			'arguments'      => array(
36 36
 				'title' => array(
37
-					'title'    => __( 'Widget title', 'invoicing' ),
38
-					'desc'     => __( 'Enter widget title.', 'invoicing' ),
37
+					'title'    => __('Widget title', 'invoicing'),
38
+					'desc'     => __('Enter widget title.', 'invoicing'),
39 39
 					'type'     => 'text',
40 40
 					'desc_tip' => true,
41 41
 					'default'  => '',
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 		);
47 47
 
48
-		parent::__construct( $options );
48
+		parent::__construct($options);
49 49
 	}
50 50
 
51 51
 	/**
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
 	public function get_subscriptions() {
57 57
 
58 58
 		// Prepare license args.
59
-		$args  = array(
59
+		$args = array(
60 60
 			'customer_in' => get_current_user_id(),
61
-			'paged'       => ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1,
61
+			'paged'       => (get_query_var('paged')) ? absint(get_query_var('paged')) : 1,
62 62
 		);
63 63
 
64
-		return new GetPaid_Subscriptions_Query( $args );
64
+		return new GetPaid_Subscriptions_Query($args);
65 65
 
66 66
 	}
67 67
 
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @return mixed|string|bool
76 76
 	 */
77
-	public function output( $args = array(), $widget_args = array(), $content = '' ) {
77
+	public function output($args = array(), $widget_args = array(), $content = '') {
78 78
 
79 79
 		// Ensure that the user is logged in.
80
-		if ( ! is_user_logged_in() ) {
80
+		if (!is_user_logged_in()) {
81 81
 
82 82
 			return aui()->alert(
83 83
 				array(
84
-					'content' => wp_kses_post( __( 'You need to log-in or create an account to view this section.', 'invoicing' ) ),
84
+					'content' => wp_kses_post(__('You need to log-in or create an account to view this section.', 'invoicing')),
85 85
 					'type'    => 'error',
86 86
 				)
87 87
 			);
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 		}
90 90
 
91 91
 		// Are we displaying a single subscription?
92
-		if ( isset( $_GET['subscription'] ) ) {
93
-			return $this->display_single_subscription( intval( $_GET['subscription'] ) );
92
+		if (isset($_GET['subscription'])) {
93
+			return $this->display_single_subscription(intval($_GET['subscription']));
94 94
 		}
95 95
 
96 96
 		// Retrieve the user's subscriptions.
@@ -100,27 +100,27 @@  discard block
 block discarded – undo
100 100
 		ob_start();
101 101
 
102 102
 		// Backwards compatibility.
103
-		do_action( 'wpinv_before_user_subscriptions' );
103
+		do_action('wpinv_before_user_subscriptions');
104 104
 
105 105
 		// Display errors and notices.
106 106
 		wpinv_print_errors();
107 107
 
108
-		do_action( 'getpaid_license_manager_before_subscriptions', $subscriptions );
108
+		do_action('getpaid_license_manager_before_subscriptions', $subscriptions);
109 109
 
110 110
 		// Print the table header.
111 111
 		$this->print_table_header();
112 112
 
113 113
 		// Print table body.
114
-		$this->print_table_body( $subscriptions->get_results() );
114
+		$this->print_table_body($subscriptions->get_results());
115 115
 
116 116
 		// Print table footer.
117 117
 		$this->print_table_footer();
118 118
 
119 119
 		// Print the navigation.
120
-		$this->print_navigation( $subscriptions->get_total() );
120
+		$this->print_navigation($subscriptions->get_total());
121 121
 
122 122
 		// Backwards compatibility.
123
-		do_action( 'wpinv_after_user_subscriptions' );
123
+		do_action('wpinv_after_user_subscriptions');
124 124
 
125 125
 		// Return the output.
126 126
 		return ob_get_clean();
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
 	public function get_subscriptions_table_columns() {
136 136
 
137 137
 		$columns = array(
138
-			'subscription' => __( 'Subscription', 'invoicing' ),
139
-			'amount'       => __( 'Amount', 'invoicing' ),
140
-			'renewal-date' => __( 'Next payment', 'invoicing' ),
141
-			'status'       => __( 'Status', 'invoicing' ),
138
+			'subscription' => __('Subscription', 'invoicing'),
139
+			'amount'       => __('Amount', 'invoicing'),
140
+			'renewal-date' => __('Next payment', 'invoicing'),
141
+			'status'       => __('Status', 'invoicing'),
142 142
 		);
143 143
 
144
-		return apply_filters( 'getpaid_frontend_subscriptions_table_columns', $columns );
144
+		return apply_filters('getpaid_frontend_subscriptions_table_columns', $columns);
145 145
 	}
146 146
 
147 147
 	/**
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 
157 157
 				<thead>
158 158
 					<tr>
159
-						<?php foreach ( $this->get_subscriptions_table_columns() as $key => $label ) : ?>
160
-							<th scope="col" class="font-weight-bold getpaid-subscriptions-table-<?php echo esc_attr( $key ); ?>">
161
-								<?php echo esc_html( $label ); ?>
159
+						<?php foreach ($this->get_subscriptions_table_columns() as $key => $label) : ?>
160
+							<th scope="col" class="font-weight-bold getpaid-subscriptions-table-<?php echo esc_attr($key); ?>">
161
+								<?php echo esc_html($label); ?>
162 162
 							</th>
163 163
 						<?php endforeach; ?>
164 164
 					</tr>
@@ -173,12 +173,12 @@  discard block
 block discarded – undo
173 173
 	 *
174 174
 	 * @param WPInv_Subscription[] $subscriptions
175 175
 	 */
176
-	public function print_table_body( $subscriptions ) {
176
+	public function print_table_body($subscriptions) {
177 177
 
178
-		if ( empty( $subscriptions ) ) {
178
+		if (empty($subscriptions)) {
179 179
 			$this->print_table_body_no_subscriptions();
180 180
 		} else {
181
-			$this->print_table_body_subscriptions( $subscriptions );
181
+			$this->print_table_body_subscriptions($subscriptions);
182 182
 		}
183 183
 
184 184
 	}
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
 		<tbody>
194 194
 
195 195
 			<tr>
196
-				<td colspan="<?php echo count( $this->get_subscriptions_table_columns() ); ?>">
196
+				<td colspan="<?php echo count($this->get_subscriptions_table_columns()); ?>">
197 197
 
198 198
 					<?php
199 199
 						aui()->alert(
200 200
 							array(
201
-								'content' => wp_kses_post( __( 'No subscriptions found.', 'invoicing' ) ),
201
+								'content' => wp_kses_post(__('No subscriptions found.', 'invoicing')),
202 202
 								'type'    => 'warning',
203 203
 							),
204 204
                             true
@@ -217,12 +217,12 @@  discard block
 block discarded – undo
217 217
 	 *
218 218
 	 * @param WPInv_Subscription[] $subscriptions
219 219
 	 */
220
-	public function print_table_body_subscriptions( $subscriptions ) {
220
+	public function print_table_body_subscriptions($subscriptions) {
221 221
 
222 222
 		?>
223 223
 		<tbody>
224 224
 
225
-			<?php foreach ( $subscriptions as $subscription ) : ?>
225
+			<?php foreach ($subscriptions as $subscription) : ?>
226 226
 				<tr class="getpaid-subscriptions-table-row subscription-<?php echo (int) $subscription->get_id(); ?>">
227 227
 					<?php
228 228
 						wpinv_get_template(
@@ -248,28 +248,28 @@  discard block
 block discarded – undo
248 248
 	 * @since       1.0.0
249 249
 	 * @return      string
250 250
 	 */
251
-	public function add_row_actions( $content, $subscription ) {
251
+	public function add_row_actions($content, $subscription) {
252 252
 
253 253
 		// Prepare row actions.
254 254
 		$actions = array();
255 255
 
256 256
 		// View subscription action.
257
-		$view_url        = getpaid_get_tab_url( 'gp-subscriptions', get_permalink( (int) wpinv_get_option( 'invoice_subscription_page' ) ) );
258
-		$view_url        = esc_url( add_query_arg( 'subscription', (int) $subscription->get_id(), $view_url ) );
259
-		$actions['view'] = "<a href='$view_url' class='text-decoration-none'>" . __( 'Manage Subscription', 'invoicing' ) . '</a>';
257
+		$view_url        = getpaid_get_tab_url('gp-subscriptions', get_permalink((int) wpinv_get_option('invoice_subscription_page')));
258
+		$view_url        = esc_url(add_query_arg('subscription', (int) $subscription->get_id(), $view_url));
259
+		$actions['view'] = "<a href='$view_url' class='text-decoration-none'>" . __('Manage Subscription', 'invoicing') . '</a>';
260 260
 
261 261
 		// Filter the actions.
262
-		$actions = apply_filters( 'getpaid_subscriptions_table_subscription_actions', $actions, $subscription );
262
+		$actions = apply_filters('getpaid_subscriptions_table_subscription_actions', $actions, $subscription);
263 263
 
264
-		$sanitized  = array();
265
-		foreach ( $actions as $key => $action ) {
266
-			$key         = sanitize_html_class( $key );
267
-			$action      = wp_kses_post( $action );
264
+		$sanitized = array();
265
+		foreach ($actions as $key => $action) {
266
+			$key         = sanitize_html_class($key);
267
+			$action      = wp_kses_post($action);
268 268
 			$sanitized[] = "<span class='$key'>$action</span>";
269 269
 		}
270 270
 
271 271
 		$row_actions  = "<small class='form-text getpaid-subscription-item-actions'>";
272
-		$row_actions .= implode( ' | ', $sanitized );
272
+		$row_actions .= implode(' | ', $sanitized);
273 273
 		$row_actions .= '</small>';
274 274
 
275 275
 		return $content . $row_actions;
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
 
286 286
 				<tfoot>
287 287
 					<tr>
288
-						<?php foreach ( $this->get_subscriptions_table_columns() as $key => $label ) : ?>
289
-							<th class="font-weight-bold getpaid-subscriptions-<?php echo esc_attr( $key ); ?>">
290
-								<?php echo esc_html( $label ); ?>
288
+						<?php foreach ($this->get_subscriptions_table_columns() as $key => $label) : ?>
289
+							<th class="font-weight-bold getpaid-subscriptions-<?php echo esc_attr($key); ?>">
290
+								<?php echo esc_html($label); ?>
291 291
 							</th>
292 292
 						<?php endforeach; ?>
293 293
 					</tr>
@@ -303,22 +303,22 @@  discard block
 block discarded – undo
303 303
 	 *
304 304
 	 * @param int $total
305 305
 	 */
306
-	public function print_navigation( $total ) {
306
+	public function print_navigation($total) {
307 307
 
308
-		if ( $total < 1 ) {
308
+		if ($total < 1) {
309 309
 
310 310
 			// Out-of-bounds, run the query again without LIMIT for total count.
311
-			$args  = array(
311
+			$args = array(
312 312
 				'customer_in' => get_current_user_id(),
313 313
 				'fields'      => 'id',
314 314
 			);
315 315
 
316
-			$count_query = new GetPaid_Subscriptions_Query( $args );
316
+			$count_query = new GetPaid_Subscriptions_Query($args);
317 317
 			$total       = $count_query->get_total();
318 318
 		}
319 319
 
320 320
 		// Abort if we do not have pages.
321
-		if ( 2 > $total ) {
321
+		if (2 > $total) {
322 322
 			return;
323 323
 		}
324 324
 
@@ -331,9 +331,9 @@  discard block
 block discarded – undo
331 331
 				echo wp_kses_post(
332 332
 					getpaid_paginate_links(
333 333
 						array(
334
-							'base'   => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
334
+							'base'   => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
335 335
 							'format' => '?paged=%#%',
336
-							'total'  => (int) ceil( $total / 10 ),
336
+							'total'  => (int) ceil($total / 10),
337 337
 						)
338 338
 					)
339 339
 				);
@@ -350,42 +350,42 @@  discard block
 block discarded – undo
350 350
 	 *
351 351
 	 * @return array
352 352
 	 */
353
-	public function get_single_subscription_columns( $subscription ) {
353
+	public function get_single_subscription_columns($subscription) {
354 354
 
355 355
 		// Prepare subscription detail columns.
356
-		$subscription_group = getpaid_get_invoice_subscription_group( $subscription->get_parent_invoice_id(), $subscription->get_id() );
357
-		$items_count        = empty( $subscription_group ) ? 1 : count( $subscription_group['items'] );
356
+		$subscription_group = getpaid_get_invoice_subscription_group($subscription->get_parent_invoice_id(), $subscription->get_id());
357
+		$items_count        = empty($subscription_group) ? 1 : count($subscription_group['items']);
358 358
 		$fields             = apply_filters(
359 359
 			'getpaid_single_subscription_details_fields',
360 360
 			array(
361
-				'status'           => __( 'Status', 'invoicing' ),
362
-				'initial_amount'   => __( 'Initial amount', 'invoicing' ),
363
-				'recurring_amount' => __( 'Recurring amount', 'invoicing' ),
364
-				'start_date'       => __( 'Start date', 'invoicing' ),
365
-				'expiry_date'      => __( 'Next payment', 'invoicing' ),
366
-				'payments'         => __( 'Payments', 'invoicing' ),
367
-				'item'             => _n( 'Item', 'Items', $items_count, 'invoicing' ),
361
+				'status'           => __('Status', 'invoicing'),
362
+				'initial_amount'   => __('Initial amount', 'invoicing'),
363
+				'recurring_amount' => __('Recurring amount', 'invoicing'),
364
+				'start_date'       => __('Start date', 'invoicing'),
365
+				'expiry_date'      => __('Next payment', 'invoicing'),
366
+				'payments'         => __('Payments', 'invoicing'),
367
+				'item'             => _n('Item', 'Items', $items_count, 'invoicing'),
368 368
 			),
369 369
 			$subscription
370 370
 		);
371 371
 
372
-		if ( isset( $fields['expiry_date'] ) ) {
372
+		if (isset($fields['expiry_date'])) {
373 373
 
374
-			if ( ! $subscription->is_active() || $subscription->is_last_renewal() ) {
375
-				$fields['expiry_date'] = __( 'End date', 'invoicing' );
374
+			if (!$subscription->is_active() || $subscription->is_last_renewal()) {
375
+				$fields['expiry_date'] = __('End date', 'invoicing');
376 376
 			}
377 377
 
378
-			if ( 'pending' == $subscription->get_status() ) {
379
-				unset( $fields['expiry_date'] );
378
+			if ('pending' == $subscription->get_status()) {
379
+				unset($fields['expiry_date']);
380 380
 			}
381 381
 }
382 382
 
383
-		if ( isset( $fields['start_date'] ) && 'pending' == $subscription->get_status() ) {
384
-			unset( $fields['start_date'] );
383
+		if (isset($fields['start_date']) && 'pending' == $subscription->get_status()) {
384
+			unset($fields['start_date']);
385 385
 		}
386 386
 
387
-		if ( $subscription->get_initial_amount() == $subscription->get_recurring_amount() ) {
388
-			unset( $fields['initial_amount'] );
387
+		if ($subscription->get_initial_amount() == $subscription->get_recurring_amount()) {
388
+			unset($fields['initial_amount']);
389 389
 		}
390 390
 
391 391
 		return $fields;
@@ -398,16 +398,16 @@  discard block
 block discarded – undo
398 398
 	 *
399 399
 	 * @return string
400 400
 	 */
401
-	public function display_single_subscription( $subscription ) {
401
+	public function display_single_subscription($subscription) {
402 402
 
403 403
 		// Fetch the subscription.
404
-		$subscription = new WPInv_Subscription( (int) $subscription );
404
+		$subscription = new WPInv_Subscription((int) $subscription);
405 405
 
406
-		if ( ! $subscription->exists() ) {
406
+		if (!$subscription->exists()) {
407 407
 
408 408
 			return aui()->alert(
409 409
 				array(
410
-					'content' => wp_kses_post( __( 'Subscription not found.', 'invoicing' ) ),
410
+					'content' => wp_kses_post(__('Subscription not found.', 'invoicing')),
411 411
 					'type'    => 'error',
412 412
 				)
413 413
 			);
@@ -415,11 +415,11 @@  discard block
 block discarded – undo
415 415
 		}
416 416
 
417 417
 		// Ensure that the user owns this subscription key.
418
-		if ( get_current_user_id() != $subscription->get_customer_id() && ! wpinv_current_user_can_manage_invoicing() ) {
418
+		if (get_current_user_id() != $subscription->get_customer_id() && !wpinv_current_user_can_manage_invoicing()) {
419 419
 
420 420
 			return aui()->alert(
421 421
 				array(
422
-					'content' => wp_kses_post( __( 'You do not have permission to view this subscription. Ensure that you are logged in to the account that owns the subscription.', 'invoicing' ) ),
422
+					'content' => wp_kses_post(__('You do not have permission to view this subscription. Ensure that you are logged in to the account that owns the subscription.', 'invoicing')),
423 423
 					'type'    => 'error',
424 424
 				)
425 425
 			);
Please login to merge, or discard this patch.
templates/payment-forms-admin/previews/gateway_select.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 aui()->alert(
13 13
     array(
14
-        'content' => esc_html__( 'The gateway select box will appear here', 'invoicing' ),
14
+        'content' => esc_html__('The gateway select box will appear here', 'invoicing'),
15 15
         'type'    => 'info',
16 16
     ),
17 17
     true
Please login to merge, or discard this patch.
templates/payment-forms-admin/previews/total_payable.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 aui()->alert(
13 13
     array(
14
-        'content' => esc_html__( 'The total payable amount will appear here', 'invoicing' ),
14
+        'content' => esc_html__('The total payable amount will appear here', 'invoicing'),
15 15
         'type'    => 'info',
16 16
     ),
17 17
     true
Please login to merge, or discard this patch.