Passed
Push — master ( c16653...06c25c )
by Brian
04:36
created
vendor/ayecode/wp-ayecode-ui/includes/class-aui.php 1 patch
Indentation   +202 added lines, -202 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,206 +11,206 @@  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.24';
28
-
29
-	/**
30
-	 * There can be only one.
31
-	 *
32
-	 * @since 1.0.0
33
-	 * @return AUI|null
34
-	 */
35
-	public static function instance() {
36
-		if ( self::$instance == null ) {
37
-			self::$instance = new AUI();
38
-		}
39
-
40
-		return self::$instance;
41
-	}
42
-
43
-	/**
44
-	 * AUI constructor.
45
-	 *
46
-	 * @since 1.0.0
47
-	 */
48
-	private function __construct() {
49
-		if ( function_exists( "__autoload" ) ) {
50
-			spl_autoload_register( "__autoload" );
51
-		}
52
-		spl_autoload_register( array( $this, 'autoload' ) );
53
-	}
54
-
55
-	/**
56
-	 * Autoload any components on the fly.
57
-	 *
58
-	 * @since 1.0.0
59
-	 *
60
-	 * @param $classname
61
-	 */
62
-	private function autoload( $classname ) {
63
-		$class     = str_replace( '_', '-', strtolower( $classname ) );
64
-		$file_path = trailingslashit( dirname( __FILE__ ) ) . "components/class-" . $class . '.php';
65
-		if ( $file_path && is_readable( $file_path ) ) {
66
-			include_once( $file_path );
67
-		}
68
-	}
69
-
70
-	public function render( $items = array() ) {
71
-		$output = '';
72
-
73
-		if ( ! empty( $items ) ) {
74
-			foreach ( $items as $args ) {
75
-				$render = isset( $args['render'] ) ? $args['render'] : '';
76
-				if ( $render && method_exists( __CLASS__, $render ) ) {
77
-					$output .= $this->$render( $args );
78
-				}
79
-			}
80
-		}
81
-
82
-		return $output;
83
-	}
84
-
85
-	/**
86
-	 * Render and return a bootstrap alert component.
87
-	 *
88
-	 * @since 1.0.0
89
-	 *
90
-	 * @param array $args
91
-	 *
92
-	 * @return string The rendered component.
93
-	 */
94
-	public function alert( $args = array() ) {
95
-		return AUI_Component_Alert::get( $args );
96
-	}
97
-
98
-	/**
99
-	 * Render and return a bootstrap input component.
100
-	 *
101
-	 * @since 1.0.0
102
-	 *
103
-	 * @param array $args
104
-	 *
105
-	 * @return string The rendered component.
106
-	 */
107
-	public function input( $args = array() ) {
108
-		return AUI_Component_Input::input( $args );
109
-	}
110
-
111
-	/**
112
-	 * Render and return a bootstrap textarea component.
113
-	 *
114
-	 * @since 1.0.0
115
-	 *
116
-	 * @param array $args
117
-	 *
118
-	 * @return string The rendered component.
119
-	 */
120
-	public function textarea( $args = array() ) {
121
-		return AUI_Component_Input::textarea( $args );
122
-	}
123
-
124
-	/**
125
-	 * Render and return a bootstrap button component.
126
-	 *
127
-	 * @since 1.0.0
128
-	 *
129
-	 * @param array $args
130
-	 *
131
-	 * @return string The rendered component.
132
-	 */
133
-	public function button( $args = array() ) {
134
-		return AUI_Component_Button::get( $args );
135
-	}
136
-
137
-	/**
138
-	 * Render and return a bootstrap button component.
139
-	 *
140
-	 * @since 1.0.0
141
-	 *
142
-	 * @param array $args
143
-	 *
144
-	 * @return string The rendered component.
145
-	 */
146
-	public function badge( $args = array() ) {
147
-		$defaults = array(
148
-			'class' => 'badge badge-primary align-middle',
149
-		);
150
-
151
-		// maybe set type
152
-		if ( empty( $args['href'] ) ) {
153
-			$defaults['type'] = 'badge';
154
-		}
155
-
156
-		/**
157
-		 * Parse incoming $args into an array and merge it with $defaults
158
-		 */
159
-		$args = wp_parse_args( $args, $defaults );
160
-
161
-		return AUI_Component_Button::get( $args );
162
-	}
163
-
164
-	/**
165
-	 * Render and return a bootstrap dropdown component.
166
-	 *
167
-	 * @since 1.0.0
168
-	 *
169
-	 * @param array $args
170
-	 *
171
-	 * @return string The rendered component.
172
-	 */
173
-	public function dropdown( $args = array() ) {
174
-		return AUI_Component_Dropdown::get( $args );
175
-	}
176
-
177
-	/**
178
-	 * Render and return a bootstrap select component.
179
-	 *
180
-	 * @since 1.0.0
181
-	 *
182
-	 * @param array $args
183
-	 *
184
-	 * @return string The rendered component.
185
-	 */
186
-	public function select( $args = array() ) {
187
-		return AUI_Component_Input::select( $args );
188
-	}
189
-
190
-	/**
191
-	 * Render and return a bootstrap radio component.
192
-	 *
193
-	 * @since 1.0.0
194
-	 *
195
-	 * @param array $args
196
-	 *
197
-	 * @return string The rendered component.
198
-	 */
199
-	public function radio( $args = array() ) {
200
-		return AUI_Component_Input::radio( $args );
201
-	}
202
-
203
-	/**
204
-	 * Render and return a bootstrap pagination component.
205
-	 *
206
-	 * @since 1.0.0
207
-	 *
208
-	 * @param array $args
209
-	 *
210
-	 * @return string The rendered component.
211
-	 */
212
-	public function pagination( $args = array() ) {
213
-		return AUI_Component_Pagination::get( $args );
214
-	}
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.24';
28
+
29
+    /**
30
+     * There can be only one.
31
+     *
32
+     * @since 1.0.0
33
+     * @return AUI|null
34
+     */
35
+    public static function instance() {
36
+        if ( self::$instance == null ) {
37
+            self::$instance = new AUI();
38
+        }
39
+
40
+        return self::$instance;
41
+    }
42
+
43
+    /**
44
+     * AUI constructor.
45
+     *
46
+     * @since 1.0.0
47
+     */
48
+    private function __construct() {
49
+        if ( function_exists( "__autoload" ) ) {
50
+            spl_autoload_register( "__autoload" );
51
+        }
52
+        spl_autoload_register( array( $this, 'autoload' ) );
53
+    }
54
+
55
+    /**
56
+     * Autoload any components on the fly.
57
+     *
58
+     * @since 1.0.0
59
+     *
60
+     * @param $classname
61
+     */
62
+    private function autoload( $classname ) {
63
+        $class     = str_replace( '_', '-', strtolower( $classname ) );
64
+        $file_path = trailingslashit( dirname( __FILE__ ) ) . "components/class-" . $class . '.php';
65
+        if ( $file_path && is_readable( $file_path ) ) {
66
+            include_once( $file_path );
67
+        }
68
+    }
69
+
70
+    public function render( $items = array() ) {
71
+        $output = '';
72
+
73
+        if ( ! empty( $items ) ) {
74
+            foreach ( $items as $args ) {
75
+                $render = isset( $args['render'] ) ? $args['render'] : '';
76
+                if ( $render && method_exists( __CLASS__, $render ) ) {
77
+                    $output .= $this->$render( $args );
78
+                }
79
+            }
80
+        }
81
+
82
+        return $output;
83
+    }
84
+
85
+    /**
86
+     * Render and return a bootstrap alert component.
87
+     *
88
+     * @since 1.0.0
89
+     *
90
+     * @param array $args
91
+     *
92
+     * @return string The rendered component.
93
+     */
94
+    public function alert( $args = array() ) {
95
+        return AUI_Component_Alert::get( $args );
96
+    }
97
+
98
+    /**
99
+     * Render and return a bootstrap input component.
100
+     *
101
+     * @since 1.0.0
102
+     *
103
+     * @param array $args
104
+     *
105
+     * @return string The rendered component.
106
+     */
107
+    public function input( $args = array() ) {
108
+        return AUI_Component_Input::input( $args );
109
+    }
110
+
111
+    /**
112
+     * Render and return a bootstrap textarea component.
113
+     *
114
+     * @since 1.0.0
115
+     *
116
+     * @param array $args
117
+     *
118
+     * @return string The rendered component.
119
+     */
120
+    public function textarea( $args = array() ) {
121
+        return AUI_Component_Input::textarea( $args );
122
+    }
123
+
124
+    /**
125
+     * Render and return a bootstrap button component.
126
+     *
127
+     * @since 1.0.0
128
+     *
129
+     * @param array $args
130
+     *
131
+     * @return string The rendered component.
132
+     */
133
+    public function button( $args = array() ) {
134
+        return AUI_Component_Button::get( $args );
135
+    }
136
+
137
+    /**
138
+     * Render and return a bootstrap button component.
139
+     *
140
+     * @since 1.0.0
141
+     *
142
+     * @param array $args
143
+     *
144
+     * @return string The rendered component.
145
+     */
146
+    public function badge( $args = array() ) {
147
+        $defaults = array(
148
+            'class' => 'badge badge-primary align-middle',
149
+        );
150
+
151
+        // maybe set type
152
+        if ( empty( $args['href'] ) ) {
153
+            $defaults['type'] = 'badge';
154
+        }
155
+
156
+        /**
157
+         * Parse incoming $args into an array and merge it with $defaults
158
+         */
159
+        $args = wp_parse_args( $args, $defaults );
160
+
161
+        return AUI_Component_Button::get( $args );
162
+    }
163
+
164
+    /**
165
+     * Render and return a bootstrap dropdown component.
166
+     *
167
+     * @since 1.0.0
168
+     *
169
+     * @param array $args
170
+     *
171
+     * @return string The rendered component.
172
+     */
173
+    public function dropdown( $args = array() ) {
174
+        return AUI_Component_Dropdown::get( $args );
175
+    }
176
+
177
+    /**
178
+     * Render and return a bootstrap select component.
179
+     *
180
+     * @since 1.0.0
181
+     *
182
+     * @param array $args
183
+     *
184
+     * @return string The rendered component.
185
+     */
186
+    public function select( $args = array() ) {
187
+        return AUI_Component_Input::select( $args );
188
+    }
189
+
190
+    /**
191
+     * Render and return a bootstrap radio component.
192
+     *
193
+     * @since 1.0.0
194
+     *
195
+     * @param array $args
196
+     *
197
+     * @return string The rendered component.
198
+     */
199
+    public function radio( $args = array() ) {
200
+        return AUI_Component_Input::radio( $args );
201
+    }
202
+
203
+    /**
204
+     * Render and return a bootstrap pagination component.
205
+     *
206
+     * @since 1.0.0
207
+     *
208
+     * @param array $args
209
+     *
210
+     * @return string The rendered component.
211
+     */
212
+    public function pagination( $args = array() ) {
213
+        return AUI_Component_Pagination::get( $args );
214
+    }
215 215
 
216 216
 }
217 217
\ 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.24";
19
-	if(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.24";
19
+    if(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.24";
19
-	if(version_compare($this_version , $ayecode_ui_version, '>')){
20
-		$ayecode_ui_version = $this_version ;
21
-		$ayecode_ui_file_key = wp_hash( __FILE__ );
19
+	if (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.