Completed
Push — master ( bc6754...ed64c2 )
by
unknown
07:19
created
app/classes/comment.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
 	 *
82 82
 	 * @param \WP_Comment $item
83 83
 	 */
84
-	public function __construct( $item ) {
84
+	public function __construct($item) {
85 85
 
86
-		if ( is_a( $item, '\WP_Comment' ) ) {
86
+		if (is_a($item, '\WP_Comment')) {
87 87
 
88
-			$this->import( $item );
88
+			$this->import($item);
89 89
 
90 90
 		}
91 91
 
@@ -98,15 +98,15 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	public function author() {
100 100
 
101
-		if ( $this->user_id ) {
101
+		if ($this->user_id) {
102 102
 
103
-			return new Models\User( $this->user_id );
103
+			return new Models\User($this->user_id);
104 104
 
105 105
 		} else {
106 106
 
107
-			$author = new Models\User( 0 );
107
+			$author = new Models\User(0);
108 108
 
109
-			if ( isset( $this->comment_author ) && $this->comment_author ) {
109
+			if (isset($this->comment_author) && $this->comment_author) {
110 110
 
111 111
 				$author->name = $this->comment_author;
112 112
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 * @return string
124 124
 	 */
125 125
 	public function content() {
126
-		return apply_filters( 'get_comment_text ', $this->comment_content );
126
+		return apply_filters('get_comment_text ', $this->comment_content);
127 127
 	}
128 128
 
129 129
 	/**
@@ -141,11 +141,11 @@  discard block
 block discarded – undo
141 141
 	 * @param  string $date_format
142 142
 	 * @return string
143 143
 	 */
144
-	public function date( $date_format = '' ) {
145
-		$df = $date_format ? $date_format : get_option( 'date_format' );
146
-		$the_date = (string) mysql2date( $df, $this->comment_date );
144
+	public function date($date_format = '') {
145
+		$df = $date_format ? $date_format : get_option('date_format');
146
+		$the_date = (string) mysql2date($df, $this->comment_date);
147 147
 
148
-		return apply_filters( 'get_comment_date ', $the_date, $df );
148
+		return apply_filters('get_comment_date ', $the_date, $df);
149 149
 	}
150 150
 
151 151
 	/**
@@ -164,26 +164,26 @@  discard block
 block discarded – undo
164 164
 	 * @param  string $default
165 165
 	 * @return string
166 166
 	 */
167
-	public function avatar( $size = 92, $default = '' ) {
167
+	public function avatar($size = 92, $default = '') {
168 168
 
169
-		if ( ! get_option( 'show_avatars' ) ) {
169
+		if (!get_option('show_avatars')) {
170 170
 			return false;
171 171
 		}
172 172
 
173
-		if ( ! is_numeric( $size ) ) { $size = '92'; }
173
+		if (!is_numeric($size)) { $size = '92'; }
174 174
 
175 175
 		$email = $this->get_avatar_email();
176 176
 		$email_hash = '';
177 177
 
178
-		if ( ! empty( $email ) ) {
179
-			$email_hash = md5( strtolower( trim( $email ) ) );
178
+		if (!empty($email)) {
179
+			$email_hash = md5(strtolower(trim($email)));
180 180
 		}
181 181
 
182
-		$host = $this->get_avatar_host( $email_hash );
183
-		$default = $this->get_default_avatar( $default, $email, $size, $host );
182
+		$host = $this->get_avatar_host($email_hash);
183
+		$default = $this->get_default_avatar($default, $email, $size, $host);
184 184
 
185
-		if ( ! empty( $email ) ) {
186
-			$avatar = $this->get_avatar_url( $default, $host, $email_hash, $size );
185
+		if (!empty($email)) {
186
+			$avatar = $this->get_avatar_url($default, $host, $email_hash, $size);
187 187
 		} else {
188 188
 			$avatar = $default;
189 189
 		}
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	protected function get_avatar_email() {
201 201
 
202 202
 		$id = (int) $this->user_id;
203
-		$user = get_userdata( $id );
203
+		$user = get_userdata($id);
204 204
 
205
-		if ( $user ) {
205
+		if ($user) {
206 206
 			$email = $user->user_email;
207 207
 		} else {
208 208
 			$email = $this->comment_author_email;
@@ -221,32 +221,32 @@  discard block
 block discarded – undo
221 221
 	 * @param  string $host
222 222
 	 * @return string
223 223
 	 */
224
-	protected function get_default_avatar( $default, $email, $size, $host ) {
224
+	protected function get_default_avatar($default, $email, $size, $host) {
225 225
 
226
-		if ( '/' === substr( $default, 0, 1 ) ) {
227
-			$default = home_url() . $default;
226
+		if ('/' === substr($default, 0, 1)) {
227
+			$default = home_url().$default;
228 228
 		}
229 229
 
230
-		if ( empty( $default ) ) {
231
-			$avatar_default = get_option( 'avatar_default' );
232
-			if ( empty( $avatar_default ) ) {
230
+		if (empty($default)) {
231
+			$avatar_default = get_option('avatar_default');
232
+			if (empty($avatar_default)) {
233 233
 				$default = 'mystery';
234 234
 			} else {
235 235
 				$default = $avatar_default;
236 236
 			}
237 237
 		}
238 238
 
239
-		if ( 'mystery' === $default ) {
240
-			$default = $host . '/avatar/ad516503a11cd5ca435acc9bb6523536?s=' . $size;
239
+		if ('mystery' === $default) {
240
+			$default = $host.'/avatar/ad516503a11cd5ca435acc9bb6523536?s='.$size;
241 241
 			// ad516503a11cd5ca435acc9bb6523536 == md5('[email protected]')
242
-		} else if ( 'blank' === $default ) {
243
-			$default = $email ? 'blank' : includes_url( 'images/blank.gif' );
244
-		} else if ( ! empty( $email ) && 'gravatar_default' === $default ) {
242
+		} else if ('blank' === $default) {
243
+			$default = $email ? 'blank' : includes_url('images/blank.gif');
244
+		} else if (!empty($email) && 'gravatar_default' === $default) {
245 245
 			$default = '';
246
-		} else if ( 'gravatar_default' === $default ) {
247
-			$default = $host . '/avatar/?s=' . $size;
248
-		} else if ( empty( $email ) && ! strstr( $default, 'http://' ) ) {
249
-			$default = $host . '/avatar/?d=' . $default . '&s=' . $size;
246
+		} else if ('gravatar_default' === $default) {
247
+			$default = $host.'/avatar/?s='.$size;
248
+		} else if (empty($email) && !strstr($default, 'http://')) {
249
+			$default = $host.'/avatar/?d='.$default.'&s='.$size;
250 250
 		}
251 251
 
252 252
 		return $default;
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
 	 * @param  string $email_hash
260 260
 	 * @return string
261 261
 	 */
262
-	protected function get_avatar_host( $email_hash ) {
262
+	protected function get_avatar_host($email_hash) {
263 263
 
264
-		if ( is_ssl() ) {
264
+		if (is_ssl()) {
265 265
 			$host = 'https://secure.gravatar.com';
266 266
 		} else {
267
-			if ( ! empty( $email_hash ) ) {
268
-				$host = sprintf( 'http://%d.gravatar.com', (hexdec( $email_hash[0] ) % 2) );
267
+			if (!empty($email_hash)) {
268
+				$host = sprintf('http://%d.gravatar.com', (hexdec($email_hash[0]) % 2));
269 269
 			} else {
270 270
 				$host = 'http://0.gravatar.com';
271 271
 			}
@@ -284,16 +284,16 @@  discard block
 block discarded – undo
284 284
 	 * @param  int $size
285 285
 	 * @return string
286 286
 	 */
287
-	protected function get_avatar_url( $default, $host, $email_hash, $size ) {
287
+	protected function get_avatar_url($default, $host, $email_hash, $size) {
288 288
 
289
-		$_return = $host . '/avatar/' . $email_hash . '?s=' . $size . '&d=' . urlencode( $default );
290
-		$rating = get_option( 'avatar_rating' );
289
+		$_return = $host.'/avatar/'.$email_hash.'?s='.$size.'&d='.urlencode($default);
290
+		$rating = get_option('avatar_rating');
291 291
 
292
-		if ( ! empty( $rating ) ) {
293
-			$_return .= '&r=' . $rating;
292
+		if (!empty($rating)) {
293
+			$_return .= '&r='.$rating;
294 294
 		}
295 295
 
296
-		return str_replace( '&', '&', esc_url( $_return ) );
296
+		return str_replace('&', '&', esc_url($_return));
297 297
 
298 298
 	}
299 299
 
@@ -302,12 +302,12 @@  discard block
 block discarded – undo
302 302
 	 *
303 303
 	 * @param Comment $comment
304 304
 	 */
305
-	public function add_child( $comment ) {
305
+	public function add_child($comment) {
306 306
 
307 307
 		$this->children[] = $comment;
308 308
 		$item->level = $this->level + 1;
309 309
 
310
-		if ( $item->children ) {
310
+		if ($item->children) {
311 311
 			$this->update_child_levels();
312 312
 		}
313 313
 
@@ -321,9 +321,9 @@  discard block
 block discarded – undo
321 321
 	 */
322 322
 	protected function update_child_levels() {
323 323
 
324
-		if ( is_array( $this->children ) ) {
324
+		if (is_array($this->children)) {
325 325
 
326
-			foreach ( $this->children as $child ) {
326
+			foreach ($this->children as $child) {
327 327
 				$child->level = $this->level + 1;
328 328
 				$child->update_child_levels();
329 329
 			}
Please login to merge, or discard this patch.
app/classes/query_helper.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -9,23 +9,23 @@  discard block
 block discarded – undo
9 9
 	 * @param  array|boolean $args
10 10
 	 * @return object        WP_Query
11 11
 	 */
12
-	public static function find_query( $args = false ) {
12
+	public static function find_query($args = false) {
13 13
 
14 14
 		$default_args = array();
15 15
 
16
-		if ( ! $args ) {
16
+		if (!$args) {
17 17
 
18 18
 			return self::get_current_query();
19 19
 
20
-		} elseif ( is_array( $args ) ) {
20
+		} elseif (is_array($args)) {
21 21
 
22
-			$args = array_merge( $default_args, $args );
22
+			$args = array_merge($default_args, $args);
23 23
 
24
-			return new \WP_Query( $args );
24
+			return new \WP_Query($args);
25 25
 
26 26
 		} else {
27 27
 
28
-			return new \WP_Query( $default_args );
28
+			return new \WP_Query($default_args);
29 29
 
30 30
 		}
31 31
 	}
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 
40 40
 		global $wp_query;
41 41
 
42
-		$query =& $wp_query;
42
+		$query = & $wp_query;
43 43
 
44
-		$query = self::handle_maybe_custom_posts_page( $query );
44
+		$query = self::handle_maybe_custom_posts_page($query);
45 45
 
46 46
 		return $query;
47 47
 
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
 	 * @param  object $query WP_Query
54 54
 	 * @return object        WP_Query
55 55
 	 */
56
-	private static function handle_maybe_custom_posts_page( $query ) {
56
+	private static function handle_maybe_custom_posts_page($query) {
57 57
 
58
-		if ( $custom_posts_page = get_option( 'page_for_posts' ) ) {
58
+		if ($custom_posts_page = get_option('page_for_posts')) {
59 59
 
60
-			if ( isset( $query->query['p'] ) && absint( $query->query['p'] ) === absint( $custom_posts_page ) ) {
60
+			if (isset($query->query['p']) && absint($query->query['p']) === absint($custom_posts_page)) {
61 61
 
62
-				return new \WP_Query( array( 'post_type' => 'post' ) );
62
+				return new \WP_Query(array('post_type' => 'post'));
63 63
 
64 64
 			}
65 65
 		}
Please login to merge, or discard this patch.
app/classes/menu.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -24,25 +24,25 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @param string $arg it can be menu id, slug or full name
26 26
 	 */
27
-	public function __construct( $arg = null ) {
27
+	public function __construct($arg = null) {
28 28
 
29
-		if ( is_numeric( $arg ) && 0 !== absint( $arg ) ) {
29
+		if (is_numeric($arg) && 0 !== absint($arg)) {
30 30
 
31
-			$menu_id = $this->check_menu_id( $arg );
31
+			$menu_id = $this->check_menu_id($arg);
32 32
 
33
-		} elseif ( is_string( $arg ) ) {
33
+		} elseif (is_string($arg)) {
34 34
 
35
-			$menu_id = $this->get_menu_id_by_name( $arg );
35
+			$menu_id = $this->get_menu_id_by_name($arg);
36 36
 
37 37
 		}
38 38
 
39
-		if ( ! isset( $menu_id ) ) {
39
+		if (!isset($menu_id)) {
40 40
 
41 41
 			$menu_id = $this->get_first_menu_id();
42 42
 
43 43
 		}
44 44
 
45
-		if ( $menu_id ) {
45
+		if ($menu_id) {
46 46
 
47 47
 			$this->ID = $menu_id;
48 48
 
@@ -61,22 +61,22 @@  discard block
 block discarded – undo
61 61
 
62 62
 		$_return = array();
63 63
 
64
-		$items = wp_get_nav_menu_items( $this->ID );
64
+		$items = wp_get_nav_menu_items($this->ID);
65 65
 
66
-		foreach ( $items as $item ) {
66
+		foreach ($items as $item) {
67 67
 
68
-			$_return[ $item->ID ] = new Menu_Item( $item );
68
+			$_return[$item->ID] = new Menu_Item($item);
69 69
 		}
70 70
 
71 71
 		// Apply nesting
72 72
 
73
-		foreach ( $_return as $item_id => $item ) {
73
+		foreach ($_return as $item_id => $item) {
74 74
 
75
-			if ( isset( $item->menu_item_parent ) && $item->menu_item_parent && isset( $_return[ $item->menu_item_parent ] ) ) {
75
+			if (isset($item->menu_item_parent) && $item->menu_item_parent && isset($_return[$item->menu_item_parent])) {
76 76
 
77
-				$_return[ $item->menu_item_parent ]->add_child( $item );
77
+				$_return[$item->menu_item_parent]->add_child($item);
78 78
 
79
-				unset( $_return[ $item_id ] );
79
+				unset($_return[$item_id]);
80 80
 
81 81
 			}
82 82
 		}
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	protected function get_first_menu_id() {
94 94
 
95
-		$menus = get_terms( 'nav_menu', array( 'hide_empty' => true ) );
95
+		$menus = get_terms('nav_menu', array('hide_empty' => true));
96 96
 
97
-		if ( is_array( $menus ) && count( $menus ) ) {
97
+		if (is_array($menus) && count($menus)) {
98 98
 
99
-			if ( isset( $menus[0]->term_id ) ) {
99
+			if (isset($menus[0]->term_id)) {
100 100
 
101 101
 				return $menus[0]->term_id;
102 102
 
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
 	 * @param  int $menu_id
114 114
 	 * @return int|boolean
115 115
 	 */
116
-	protected function check_menu_id( $menu_id ) {
116
+	protected function check_menu_id($menu_id) {
117 117
 
118
-		$menus = get_terms( 'nav_menu', array( 'hide_empty' => true ) );
118
+		$menus = get_terms('nav_menu', array('hide_empty' => true));
119 119
 
120
-		if ( is_array( $menus ) && count( $menus ) ) {
120
+		if (is_array($menus) && count($menus)) {
121 121
 
122
-			foreach ( $menus as $menu ) {
122
+			foreach ($menus as $menu) {
123 123
 
124
-				if ( absint( $menu->term_id ) === absint( $menu_id ) ) {
124
+				if (absint($menu->term_id) === absint($menu_id)) {
125 125
 
126 126
 					return $menu_id;
127 127
 
@@ -139,17 +139,17 @@  discard block
 block discarded – undo
139 139
 	 * @param  string $slug
140 140
 	 * @return int
141 141
 	 */
142
-	protected function get_menu_id_by_name( $slug = null ) {
142
+	protected function get_menu_id_by_name($slug = null) {
143 143
 
144
-		if ( $slug && is_string( $slug ) ) {
144
+		if ($slug && is_string($slug)) {
145 145
 
146
-			$menu_id = get_term_by( 'slug', $slug, 'nav_menu' );
146
+			$menu_id = get_term_by('slug', $slug, 'nav_menu');
147 147
 
148
-			if ( $menu_id ) { return $menu_id; }
148
+			if ($menu_id) { return $menu_id; }
149 149
 
150
-			$menu_id = get_term_by( 'name', $slug, 'nav_menu' );
150
+			$menu_id = get_term_by('name', $slug, 'nav_menu');
151 151
 
152
-			if ( $menu_id ) { return $menu_id; }
152
+			if ($menu_id) { return $menu_id; }
153 153
 		}
154 154
 
155 155
 		return false;
Please login to merge, or discard this patch.
app/classes/classy.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public static function get_instance() {
34 34
 
35
-		if ( null === self::$single_instance ) {
35
+		if (null === self::$single_instance) {
36 36
 
37 37
 			self::$single_instance = new self();
38 38
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
 		$this->init_config();
60 60
 
61
-		add_filter( 'theme_page_templates', array( $this, 'filter_templates' ) );
61
+		add_filter('theme_page_templates', array($this, 'filter_templates'));
62 62
 	}
63 63
 
64 64
 	/**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 * Load template functions.
73 73
 	 */
74 74
 	private function load_template_function() {
75
-		require_once( CLASSY_THEME_PATH . 'app/functions/template-functions.php' );
75
+		require_once(CLASSY_THEME_PATH.'app/functions/template-functions.php');
76 76
 	}
77 77
 
78 78
 	/**
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
 
86 86
 		$theme = wp_get_theme();
87 87
 
88
-		define( 'CLASSY_THEME', $theme->template );
89
-		define( 'CLASSY_THEME_NAME', $theme->get( 'Name' ) );
90
-		define( 'CLASSY_THEME_PATH', get_template_directory() . '/' );
91
-		define( 'CLASSY_THEME_DIR', get_template_directory_uri() . '/' );
92
-		define( 'CLASSY_THEME_VERSION', $theme->get( 'Version' ) );
93
-		define( 'CLASSY_THEME_FRAMEWORK_PATH', CLASSY_THEME_PATH . 'app/' );
94
-		define( 'CLASSY_THEME_FRAMEWORK_DIR', CLASSY_THEME_DIR . 'app/' );
88
+		define('CLASSY_THEME', $theme->template);
89
+		define('CLASSY_THEME_NAME', $theme->get('Name'));
90
+		define('CLASSY_THEME_PATH', get_template_directory().'/');
91
+		define('CLASSY_THEME_DIR', get_template_directory_uri().'/');
92
+		define('CLASSY_THEME_VERSION', $theme->get('Version'));
93
+		define('CLASSY_THEME_FRAMEWORK_PATH', CLASSY_THEME_PATH.'app/');
94
+		define('CLASSY_THEME_FRAMEWORK_DIR', CLASSY_THEME_DIR.'app/');
95 95
 
96 96
 	}
97 97
 
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @return array
111 111
 	 */
112
-	public function filter_templates( $page_templates = array() ) {
112
+	public function filter_templates($page_templates = array()) {
113 113
 
114 114
 		$custom_templates = View::get_page_templates_list();
115 115
 
116
-		return array_merge( $page_templates, $custom_templates );
116
+		return array_merge($page_templates, $custom_templates);
117 117
 
118 118
 	}
119 119
 
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @return mixed|bool Return false if variable not found.
126 126
 	 */
127
-	public static function get_config_var( $name ) {
127
+	public static function get_config_var($name) {
128 128
 
129 129
 		$vars = Config::get_vars();
130 130
 
131
-		return ( isset( $vars[ $name ] ) ) ? $vars[ $name ] : false;
131
+		return (isset($vars[$name])) ? $vars[$name] : false;
132 132
 
133 133
 	}
134 134
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	public static function textdomain() {
141 141
 
142
-		$textdomain = Classy::get_config_var( 'textdomain' );
142
+		$textdomain = Classy::get_config_var('textdomain');
143 143
 
144 144
 		return $textdomain ? $textdomain : CLASSY_THEME;
145 145
 
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
 	 * @param  array|null  $data Additional params.
155 155
 	 * @return void
156 156
 	 */
157
-	public static function render( $view = null, $data = null ) {
157
+	public static function render($view = null, $data = null) {
158 158
 
159
-		$views = CLASSY_THEME_PATH . View::$folder;
160
-		$cache = WP_CONTENT_DIR . '/viewcache';
159
+		$views = CLASSY_THEME_PATH.View::$folder;
160
+		$cache = WP_CONTENT_DIR.'/viewcache';
161 161
 		$common_scope = Scope::get_common_scope();
162 162
 
163
-		if ( null !== $view && is_string( $view ) ) {
163
+		if (null !== $view && is_string($view)) {
164 164
 
165
-			if ( $data && is_array( $data ) ) {
165
+			if ($data && is_array($data)) {
166 166
 
167
-				$scope = array_merge( $common_scope, $data );
167
+				$scope = array_merge($common_scope, $data);
168 168
 
169 169
 			} else {
170 170
 
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
 
180 180
 		}
181 181
 
182
-		$renderer = new BladeRenderer( $views, array( 'cache_path' => $cache ) );
182
+		$renderer = new BladeRenderer($views, array('cache_path' => $cache));
183 183
 
184
-		echo $renderer->render( $view, $scope ); // XSS: xss ok.
184
+		echo $renderer->render($view, $scope); // XSS: xss ok.
185 185
 
186 186
 	}
187 187
 
@@ -206,27 +206,27 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @return array
208 208
 	 */
209
-	public static function get_posts( $args = false, $return = '\Classy\Models\Post' ) {
209
+	public static function get_posts($args = false, $return = '\Classy\Models\Post') {
210 210
 
211 211
 		$_return = array();
212 212
 
213
-		$query = Query_Helper::find_query( $args );
213
+		$query = Query_Helper::find_query($args);
214 214
 
215
-		if ( isset( $query->posts ) ) {
215
+		if (isset($query->posts)) {
216 216
 
217
-			foreach ( $query->posts as $post ) {
217
+			foreach ($query->posts as $post) {
218 218
 
219
-				if ( 'id' === $return ) {
219
+				if ('id' === $return) {
220 220
 
221 221
 					$_return[] = $post->id;
222 222
 
223
-				} elseif ( 'object' === $return ) {
223
+				} elseif ('object' === $return) {
224 224
 
225 225
 					$_return[] = $post;
226 226
 
227
-				} elseif ( class_exists( $return ) ) {
227
+				} elseif (class_exists($return)) {
228 228
 
229
-					$_return[] = new $return( $post );
229
+					$_return[] = new $return($post);
230 230
 
231 231
 				}
232 232
 			}
@@ -244,11 +244,11 @@  discard block
 block discarded – undo
244 244
 	 *
245 245
 	 * @return mixed
246 246
 	 */
247
-	public static function get_post( $args = false, $return_type = '\Classy\Models\Post' ) {
247
+	public static function get_post($args = false, $return_type = '\Classy\Models\Post') {
248 248
 
249
-		$posts = self::get_posts( $args, $return_type );
249
+		$posts = self::get_posts($args, $return_type);
250 250
 
251
-		if ( $post = reset( $posts ) ) {
251
+		if ($post = reset($posts)) {
252 252
 			return $post;
253 253
 		}
254 254
 
@@ -261,62 +261,62 @@  discard block
 block discarded – undo
261 261
 	 *
262 262
 	 * @return array mixed
263 263
 	 */
264
-	public static function get_pagination( $prefs = array() ) {
264
+	public static function get_pagination($prefs = array()) {
265 265
 
266 266
 		global $wp_query;
267 267
 		global $paged;
268 268
 		global $wp_rewrite;
269 269
 
270 270
 		$args = array();
271
-		$args['total'] = ceil( $wp_query->found_posts / $wp_query->query_vars['posts_per_page'] );
271
+		$args['total'] = ceil($wp_query->found_posts / $wp_query->query_vars['posts_per_page']);
272 272
 
273
-		if ( $wp_rewrite->using_permalinks() ) {
273
+		if ($wp_rewrite->using_permalinks()) {
274 274
 
275
-			$url = explode( '?', get_pagenum_link( 0 ) );
275
+			$url = explode('?', get_pagenum_link(0));
276 276
 
277
-			if ( isset( $url[1] ) ) {
278
-				parse_str( $url[1], $query );
277
+			if (isset($url[1])) {
278
+				parse_str($url[1], $query);
279 279
 				$args['add_args'] = $query;
280 280
 			}
281 281
 
282 282
 			$args['format'] = 'page/%#%';
283
-			$args['base'] = trailingslashit( $url[0] ).'%_%';
283
+			$args['base'] = trailingslashit($url[0]).'%_%';
284 284
 
285 285
 		} else {
286 286
 			$big = 999999999;
287
-			$args['base'] = str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) );
287
+			$args['base'] = str_replace($big, '%#%', esc_url(get_pagenum_link($big)));
288 288
 		}
289 289
 
290 290
 		$args['type'] = 'array';
291
-		$args['current'] = max( 1, get_query_var( 'paged' ) );
292
-		$args['mid_size'] = max( 9 - $args['current'], 3 );
291
+		$args['current'] = max(1, get_query_var('paged'));
292
+		$args['mid_size'] = max(9 - $args['current'], 3);
293 293
 		$args['prev_next'] = false;
294 294
 
295
-		if ( is_int( $prefs ) ) {
295
+		if (is_int($prefs)) {
296 296
 			$args['mid_size'] = $prefs - 2;
297 297
 		} else {
298
-			$args = array_merge( $args, $prefs );
298
+			$args = array_merge($args, $prefs);
299 299
 		}
300 300
 
301 301
 		$data = array();
302
-		$data['pages'] = Helper::paginate_links( $args );
303
-		$next = get_next_posts_page_link( $args['total'] );
302
+		$data['pages'] = Helper::paginate_links($args);
303
+		$next = get_next_posts_page_link($args['total']);
304 304
 
305
-		if ( $next ) {
306
-			$data['next'] = array( 'link' => untrailingslashit( $next ), 'class' => 'page-numbers next' );
305
+		if ($next) {
306
+			$data['next'] = array('link' => untrailingslashit($next), 'class' => 'page-numbers next');
307 307
 		}
308 308
 
309
-		$prev = previous_posts( false );
309
+		$prev = previous_posts(false);
310 310
 
311
-		if ( $prev ) {
312
-			$data['prev'] = array( 'link' => untrailingslashit( $prev ), 'class' => 'page-numbers prev' );
311
+		if ($prev) {
312
+			$data['prev'] = array('link' => untrailingslashit($prev), 'class' => 'page-numbers prev');
313 313
 		}
314 314
 
315
-		if ( $paged < 2 ) {
315
+		if ($paged < 2) {
316 316
 			$data['prev'] = null;
317 317
 		}
318 318
 
319
-		return Helper::array_to_object( $data );
319
+		return Helper::array_to_object($data);
320 320
 
321 321
 	}
322 322
 }
Please login to merge, or discard this patch.
app/classes/hierarchy.php 1 patch
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -20,39 +20,39 @@  discard block
 block discarded – undo
20 20
 	 */
21 21
 	protected static function check_request() {
22 22
 
23
-		if ( is_404() ) : return '404';
23
+		if (is_404()) : return '404';
24 24
 
25
-		elseif ( is_search() ) : return 'search';
25
+		elseif (is_search()) : return 'search';
26 26
 
27
-		elseif ( is_front_page() ) : return 'front-page';
27
+		elseif (is_front_page()) : return 'front-page';
28 28
 
29
-		elseif ( is_home() ) : return 'home';
29
+		elseif (is_home()) : return 'home';
30 30
 
31
-		elseif ( is_post_type_archive() ) : return 'post_type_archive';
31
+		elseif (is_post_type_archive()) : return 'post_type_archive';
32 32
 
33
-		elseif ( is_tax() ) : return 'taxonomy';
33
+		elseif (is_tax()) : return 'taxonomy';
34 34
 
35
-		elseif ( is_attachment() ) : return 'attachment';
35
+		elseif (is_attachment()) : return 'attachment';
36 36
 
37
-		elseif ( is_single() ) : return 'single';
37
+		elseif (is_single()) : return 'single';
38 38
 
39
-		elseif ( self::is_classy_template() ) : return 'classy-template';
39
+		elseif (self::is_classy_template()) : return 'classy-template';
40 40
 
41
-		elseif ( is_page() ) : return 'page';
41
+		elseif (is_page()) : return 'page';
42 42
 
43
-		elseif ( is_singular() ) : return 'singular';
43
+		elseif (is_singular()) : return 'singular';
44 44
 
45
-		elseif ( is_category() ) : return 'category';
45
+		elseif (is_category()) : return 'category';
46 46
 
47
-		elseif ( is_tag() ) : return 'tag';
47
+		elseif (is_tag()) : return 'tag';
48 48
 
49
-		elseif ( is_author() ) : return 'author';
49
+		elseif (is_author()) : return 'author';
50 50
 
51
-		elseif ( is_date() ) : return 'date';
51
+		elseif (is_date()) : return 'date';
52 52
 
53
-		elseif ( is_archive() ) : return 'archive';
53
+		elseif (is_archive()) : return 'archive';
54 54
 
55
-		elseif ( is_paged() ) : return 'paged';
55
+		elseif (is_paged()) : return 'paged';
56 56
 
57 57
 		else :
58 58
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public static function get_current_request() {
71 71
 
72
-		if ( null === self::$current_request ) {
72
+		if (null === self::$current_request) {
73 73
 
74 74
 			self::$current_request = self::check_request();
75 75
 
@@ -87,21 +87,21 @@  discard block
 block discarded – undo
87 87
 	 * @param  string $view path to view ex: "post/archive"
88 88
 	 * @return string           full fule path
89 89
 	 */
90
-	public static function get_file_path( $type = 'view', $view ) {
90
+	public static function get_file_path($type = 'view', $view) {
91 91
 
92
-		$view = str_replace( '.', '/', $view );
92
+		$view = str_replace('.', '/', $view);
93 93
 
94
-		if ( 'view' === $type ) {
94
+		if ('view' === $type) {
95 95
 
96 96
 			$folder = ClassyView::$folder;
97 97
 
98
-			return CLASSY_THEME_PATH . $folder . '/' . $view . '.blade.php';
98
+			return CLASSY_THEME_PATH.$folder.'/'.$view.'.blade.php';
99 99
 
100
-		} elseif ( 'scope' === $type ) {
100
+		} elseif ('scope' === $type) {
101 101
 
102 102
 			$folder = ClassyScope::$folder;
103 103
 
104
-			return CLASSY_THEME_PATH . $folder . '/' . $view . '.php';
104
+			return CLASSY_THEME_PATH.$folder.'/'.$view.'.php';
105 105
 
106 106
 		}
107 107
 
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
 	 * @param  string $file in blade path format, ex: layout|header
116 116
 	 * @return boolean true|false
117 117
 	 */
118
-	public static function file_exists( $type = 'view', $file ) {
118
+	public static function file_exists($type = 'view', $file) {
119 119
 
120
-		$file = str_replace( '.', '/', $file );
120
+		$file = str_replace('.', '/', $file);
121 121
 
122
-		$file_path = self::get_file_path( $type, $file );
122
+		$file_path = self::get_file_path($type, $file);
123 123
 
124
-		return file_exists( $file_path );
124
+		return file_exists($file_path);
125 125
 
126 126
 	}
127 127
 
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
 	 * @param  string $type
134 134
 	 * @return array
135 135
 	 */
136
-	public static function get_available_file( $type = 'view', $page ) {
136
+	public static function get_available_file($type = 'view', $page) {
137 137
 
138
-		$views = self::get_request_hierarchy_list( $page );
138
+		$views = self::get_request_hierarchy_list($page);
139 139
 
140
-		foreach ( $views as $view ) {
140
+		foreach ($views as $view) {
141 141
 
142
-			if ( self::file_exists( $type, $view ) ) :
142
+			if (self::file_exists($type, $view)) :
143 143
 
144 144
 				return $view;
145 145
 
@@ -158,43 +158,43 @@  discard block
 block discarded – undo
158 158
 	 * @param  string $type
159 159
 	 * @return array
160 160
 	 */
161
-	private static function get_request_hierarchy_list( $type ) {
161
+	private static function get_request_hierarchy_list($type) {
162 162
 
163 163
 		$views = array();
164 164
 
165 165
 		// Home
166 166
 
167
-		if ( 'home' === $type ) :
167
+		if ('home' === $type) :
168 168
 
169 169
 			$views[] = 'home';
170 170
 
171 171
 			// Single
172 172
 
173
-		elseif ( 'single' === $type ) :
173
+		elseif ('single' === $type) :
174 174
 
175 175
 			$post_type = get_post_type();
176 176
 
177
-			$views[] = $post_type . '.single';
177
+			$views[] = $post_type.'.single';
178 178
 
179 179
 			$views[] = 'single';
180 180
 
181 181
 			// Post type
182 182
 
183
-		elseif ( 'post_type_archive' === $type ) :
183
+		elseif ('post_type_archive' === $type) :
184 184
 
185 185
 			$post_type = get_post_type();
186 186
 
187
-			$views[] = $post_type . '.archive';
187
+			$views[] = $post_type.'.archive';
188 188
 
189 189
 			$views[] = 'archive';
190 190
 
191 191
 			// Taxonomy
192 192
 
193
-		elseif ( 'taxonomy' === $type ) :
193
+		elseif ('taxonomy' === $type) :
194 194
 
195 195
 			$term = get_queried_object();
196 196
 
197
-			if ( ! empty( $term->slug ) ) {
197
+			if (!empty($term->slug)) {
198 198
 
199 199
 				$taxonomy = $term->taxonomy;
200 200
 
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
 
210 210
 			// Category
211 211
 
212
-		elseif ( 'category' === $type ) :
212
+		elseif ('category' === $type) :
213 213
 
214 214
 			$category = get_queried_object();
215 215
 
216
-			if ( ! empty( $category->slug ) ) {
216
+			if (!empty($category->slug)) {
217 217
 				$views[] = "category.{$category->slug}";
218 218
 				$views[] = "category.{$category->term_id}";
219 219
 			}
@@ -224,23 +224,23 @@  discard block
 block discarded – undo
224 224
 
225 225
 			// Attachment
226 226
 
227
-		elseif ( 'attachment' === $type ) :
227
+		elseif ('attachment' === $type) :
228 228
 
229 229
 			$attachment = get_queried_object();
230 230
 
231
-			if ( $attachment ) {
231
+			if ($attachment) {
232 232
 
233
-				if ( false !== strpos( $attachment->post_mime_type, '/' ) ) {
233
+				if (false !== strpos($attachment->post_mime_type, '/')) {
234 234
 
235
-					list( $type, $subtype ) = explode( '/', $attachment->post_mime_type );
235
+					list($type, $subtype) = explode('/', $attachment->post_mime_type);
236 236
 
237 237
 				} else {
238 238
 
239
-					list( $type, $subtype ) = array( $attachment->post_mime_type, '' );
239
+					list($type, $subtype) = array($attachment->post_mime_type, '');
240 240
 
241 241
 				}
242 242
 
243
-				if ( ! empty( $subtype ) ) {
243
+				if (!empty($subtype)) {
244 244
 					$views[] = "attachment.{$type}.{$subtype}";
245 245
 					$views[] = "attachment.{$subtype}";
246 246
 
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
 
260 260
 			// Tag
261 261
 
262
-		elseif ( 'tag' === $type ) :
262
+		elseif ('tag' === $type) :
263 263
 
264 264
 			$tag = get_queried_object();
265 265
 
266
-			if ( ! empty( $tag->slug ) ) {
266
+			if (!empty($tag->slug)) {
267 267
 				$views[] = "post.tag.{$tag->slug}";
268 268
 				$views[] = "post.tag.{$tag->term_id}";
269 269
 
@@ -276,11 +276,11 @@  discard block
 block discarded – undo
276 276
 
277 277
 			// Author
278 278
 
279
-		elseif ( 'author' === $type ) :
279
+		elseif ('author' === $type) :
280 280
 
281 281
 			$author = get_queried_object();
282 282
 
283
-			if ( $author instanceof WP_User ) {
283
+			if ($author instanceof WP_User) {
284 284
 				$views[] = "post.author.{$author->user_nicename}";
285 285
 				$views[] = "post.author.{$author->ID}";
286 286
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 
295 295
 			// Front Page
296 296
 
297
-		elseif ( 'front-page' === $type ) :
297
+		elseif ('front-page' === $type) :
298 298
 
299 299
 			$views[] = 'front-page.front-page';
300 300
 			$views[] = 'front-page';
@@ -302,45 +302,45 @@  discard block
 block discarded – undo
302 302
 			$views[] = 'home.home';
303 303
 			$views[] = 'home';
304 304
 
305
-			$views = array_merge( $views, self::get_request_hierarchy_list( 'post_type_archive' ) );
305
+			$views = array_merge($views, self::get_request_hierarchy_list('post_type_archive'));
306 306
 
307 307
 			// Page
308 308
 
309
-		elseif ( 'classy-template' === $type ) :
309
+		elseif ('classy-template' === $type) :
310 310
 
311 311
 			$template = self::get_classy_template();
312 312
 
313 313
 			$views[] = $template;
314 314
 
315
-			$views[] = 'page.' . $template;
315
+			$views[] = 'page.'.$template;
316 316
 
317
-			$views[] = 'template.' . $template;
317
+			$views[] = 'template.'.$template;
318 318
 
319 319
 			$views[] = 'page.page';
320 320
 
321 321
 			$views[] = 'page';
322 322
 
323
-		elseif ( 'page' === $type ) :
323
+		elseif ('page' === $type) :
324 324
 
325 325
 			$id = get_queried_object_id();
326 326
 
327
-			$pagename = get_query_var( 'pagename' );
327
+			$pagename = get_query_var('pagename');
328 328
 
329
-			if ( ! $pagename && $id ) {
329
+			if (!$pagename && $id) {
330 330
 				// If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object
331 331
 				$post = get_queried_object();
332 332
 
333
-				if ( $post ) {
333
+				if ($post) {
334 334
 					$pagename = $post->post_name;
335 335
 				}
336 336
 			}
337 337
 
338
-			if ( $pagename ) {
339
-				$views[] = 'page.' . $pagename;
338
+			if ($pagename) {
339
+				$views[] = 'page.'.$pagename;
340 340
 			}
341 341
 
342
-			if ( $id ) {
343
-				$views[] = 'page.' . $id;
342
+			if ($id) {
343
+				$views[] = 'page.'.$id;
344 344
 			}
345 345
 
346 346
 			$views[] = 'page.page';
@@ -382,9 +382,9 @@  discard block
 block discarded – undo
382 382
 
383 383
 		$template_slug = get_page_template_slug();
384 384
 
385
-		preg_match( '/classy\-(.*)/', $template_slug, $matches );
385
+		preg_match('/classy\-(.*)/', $template_slug, $matches);
386 386
 
387
-		if ( ! empty( $matches ) && isset( $matches[1] ) ) { return $matches[1]; }
387
+		if (!empty($matches) && isset($matches[1])) { return $matches[1]; }
388 388
 
389 389
 		return false;
390 390
 
Please login to merge, or discard this patch.
app/classes/scope.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -26,21 +26,21 @@  discard block
 block discarded – undo
26 26
 	 *
27 27
 	 * @return array
28 28
 	 */
29
-	public static function get_scope( $view_name = null ) {
29
+	public static function get_scope($view_name = null) {
30 30
 
31 31
 		$scope = self::get_common_scope();
32 32
 
33
-		if ( is_string( $view_name ) ) {
33
+		if (is_string($view_name)) {
34 34
 
35
-			$scope = self::extend_scope( $scope, $view_name );
35
+			$scope = self::extend_scope($scope, $view_name);
36 36
 
37 37
 		} else {
38 38
 
39 39
 			$request = Hierarchy::get_current_request();
40 40
 
41
-			$file = Hierarchy::get_available_file( 'scope', $request );
41
+			$file = Hierarchy::get_available_file('scope', $request);
42 42
 
43
-			$scope = self::extend_scope( $scope, $file );
43
+			$scope = self::extend_scope($scope, $file);
44 44
 
45 45
 		}
46 46
 
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 	 *
57 57
 	 * @return array
58 58
 	 */
59
-	public static function extend_scope( $scope, $view_name ) {
59
+	public static function extend_scope($scope, $view_name) {
60 60
 
61
-		$scope = array_merge( $scope, self::require_scope( $view_name ) );
61
+		$scope = array_merge($scope, self::require_scope($view_name));
62 62
 
63 63
 		return $scope;
64 64
 
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	public static function get_common_scope() {
73 73
 
74
-		if ( null === self::$common ) {
74
+		if (null === self::$common) {
75 75
 
76
-			self::$common = self::require_scope( 'common' );
76
+			self::$common = self::require_scope('common');
77 77
 
78 78
 		}
79 79
 
@@ -88,19 +88,19 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @return array
90 90
 	 */
91
-	public static function require_scope( $filename ) {
91
+	public static function require_scope($filename) {
92 92
 
93 93
 		$_return = array();
94 94
 
95
-		$file = Hierarchy::get_file_path( 'scope', $filename );
95
+		$file = Hierarchy::get_file_path('scope', $filename);
96 96
 
97
-		if ( file_exists( $file ) ) {
97
+		if (file_exists($file)) {
98 98
 
99 99
 			require $file;
100 100
 
101 101
 		}
102 102
 
103
-		if ( isset( $data ) ) {
103
+		if (isset($data)) {
104 104
 
105 105
 			$_return = $data;
106 106
 
Please login to merge, or discard this patch.
app/classes/basis.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,28 +12,28 @@
 block discarded – undo
12 12
 	 * @param  object|array $data
13 13
 	 * @return void
14 14
 	 */
15
-	protected function import( $data ) {
15
+	protected function import($data) {
16 16
 
17
-		if ( is_object( $data ) ) {
17
+		if (is_object($data)) {
18 18
 
19
-			$data = get_object_vars( $data );
19
+			$data = get_object_vars($data);
20 20
 
21 21
 		}
22 22
 
23
-		if ( is_array( $data ) ) {
23
+		if (is_array($data)) {
24 24
 
25 25
 			// In case if we import WP_User object.
26
-			if ( isset( $data['data'] ) ) {
26
+			if (isset($data['data'])) {
27 27
 				$data = $data['data'];
28 28
 			}
29 29
 
30
-			foreach ( $data as $key => $value ) {
30
+			foreach ($data as $key => $value) {
31 31
 
32
-				if ( ! empty( $key ) ) {
32
+				if (!empty($key)) {
33 33
 
34 34
 					$this->$key = $value;
35 35
 
36
-				} else if ( ! empty( $key ) && ! method_exists( $this, $key ) ) {
36
+				} else if (!empty($key) && !method_exists($this, $key)) {
37 37
 
38 38
 					$this->$key = $value;
39 39
 
Please login to merge, or discard this patch.
app/classes/menu_item.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
 	 *
44 44
 	 * @param \WP_Post $item
45 45
 	 */
46
-	public function __construct( $item ) {
46
+	public function __construct($item) {
47 47
 
48
-		if ( is_a( $item, '\WP_Post' ) ) {
48
+		if (is_a($item, '\WP_Post')) {
49 49
 
50
-			$this->import( $item );
50
+			$this->import($item);
51 51
 			$this->filter_classes();
52 52
 
53 53
 		}
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	public function get_classes() {
106 106
 
107
-		return implode( ' ', $this->classes );
107
+		return implode(' ', $this->classes);
108 108
 
109 109
 	}
110 110
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @param string $class_name
115 115
 	 */
116
-	public function add_class( $class_name ) {
116
+	public function add_class($class_name) {
117 117
 
118 118
 		$this->classes[] = $class_name;
119 119
 
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @param Menu_Item $item
126 126
 	 */
127
-	public function add_child( $item ) {
127
+	public function add_child($item) {
128 128
 
129
-		if ( ! $this->has_child ) {
130
-			$this->add_class( 'menu-item-has-children' );
129
+		if (!$this->has_child) {
130
+			$this->add_class('menu-item-has-children');
131 131
 			$this->has_child = true;
132 132
 		}
133 133
 
134 134
 		$this->children[] = $item;
135 135
 		$item->level = $this->level + 1;
136 136
 
137
-		if ( $item->children ) {
137
+		if ($item->children) {
138 138
 			$this->update_child_levels();
139 139
 		}
140 140
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	protected function filter_classes() {
149 149
 
150
-		$this->classes = apply_filters( 'nav_menu_css_class', $this->classes, $this );
150
+		$this->classes = apply_filters('nav_menu_css_class', $this->classes, $this);
151 151
 
152 152
 	}
153 153
 
@@ -158,9 +158,9 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
 	protected function update_child_levels() {
160 160
 
161
-		if ( is_array( $this->children ) ) {
161
+		if (is_array($this->children)) {
162 162
 
163
-			foreach ( $this->children as $child ) {
163
+			foreach ($this->children as $child) {
164 164
 				$child->level = $this->level + 1;
165 165
 				$child->update_child_levels();
166 166
 			}
Please login to merge, or discard this patch.
app/classes/helper.php 1 patch
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -15,44 +15,44 @@  discard block
 block discarded – undo
15 15
 	 * @param string  $allowed_tags
16 16
 	 * @return string
17 17
 	 */
18
-	public static function trim_words( $text, $num_words = 55, $more = null, $allowed_tags = 'p a span b i br blockquote' ) {
19
-		if ( null === $more ) {
20
-			$more = __( '&hellip;' );
18
+	public static function trim_words($text, $num_words = 55, $more = null, $allowed_tags = 'p a span b i br blockquote') {
19
+		if (null === $more) {
20
+			$more = __('&hellip;');
21 21
 		}
22 22
 
23 23
 		$original_text = $text;
24 24
 		$allowed_tag_string = '';
25 25
 
26
-		foreach ( explode( ' ', $allowed_tags ) as $tag ) {
27
-			$allowed_tag_string .= '<' . $tag . '>';
26
+		foreach (explode(' ', $allowed_tags) as $tag) {
27
+			$allowed_tag_string .= '<'.$tag.'>';
28 28
 		}
29 29
 
30
-		$text = strip_tags( $text, $allowed_tag_string );
30
+		$text = strip_tags($text, $allowed_tag_string);
31 31
 
32 32
 		/* translators: If your word count is based on single characters (East Asian characters),
33 33
 		enter 'characters'. Otherwise, enter 'words'. Do not translate into your own language. */
34 34
 
35
-		if ( 'characters' === _x( 'words', 'word count: words or characters?' ) && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) {
36
-			$text = trim( preg_replace( "/[\n\r\t ]+/", ' ', $text ), ' ' );
37
-			preg_match_all( '/./u', $text, $words_array );
38
-			$words_array = array_slice( $words_array[0], 0, $num_words + 1 );
35
+		if ('characters' === _x('words', 'word count: words or characters?') && preg_match('/^utf\-?8$/i', get_option('blog_charset'))) {
36
+			$text = trim(preg_replace("/[\n\r\t ]+/", ' ', $text), ' ');
37
+			preg_match_all('/./u', $text, $words_array);
38
+			$words_array = array_slice($words_array[0], 0, $num_words + 1);
39 39
 			$sep = '';
40 40
 		} else {
41
-			$words_array = preg_split( "/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY );
41
+			$words_array = preg_split("/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY);
42 42
 			$sep = ' ';
43 43
 		}
44 44
 
45
-		if ( count( $words_array ) > $num_words ) {
46
-			array_pop( $words_array );
47
-			$text = implode( $sep, $words_array );
48
-			$text = $text . $more;
45
+		if (count($words_array) > $num_words) {
46
+			array_pop($words_array);
47
+			$text = implode($sep, $words_array);
48
+			$text = $text.$more;
49 49
 		} else {
50
-			$text = implode( $sep, $words_array );
50
+			$text = implode($sep, $words_array);
51 51
 		}
52 52
 
53
-		$text = self::close_tags( $text );
53
+		$text = self::close_tags($text);
54 54
 
55
-		return apply_filters( 'wp_trim_words', $text, $num_words, $more, $original_text );
55
+		return apply_filters('wp_trim_words', $text, $num_words, $more, $original_text);
56 56
 	}
57 57
 
58 58
 
@@ -62,36 +62,36 @@  discard block
 block discarded – undo
62 62
 	 * @param string  $html
63 63
 	 * @return string
64 64
 	 */
65
-	public static function close_tags( $html ) {
65
+	public static function close_tags($html) {
66 66
 		//put all opened tags into an array
67
-		preg_match_all( '#<([a-z]+)(?: .*)?(?<![/|/ ])>#iU', $html, $result );
67
+		preg_match_all('#<([a-z]+)(?: .*)?(?<![/|/ ])>#iU', $html, $result);
68 68
 
69 69
 		$openedtags = $result[1];
70 70
 
71 71
 		//put all closed tags into an array
72
-		preg_match_all( '#</([a-z]+)>#iU', $html, $result );
72
+		preg_match_all('#</([a-z]+)>#iU', $html, $result);
73 73
 
74 74
 		$closedtags = $result[1];
75
-		$len_opened = count( $openedtags );
75
+		$len_opened = count($openedtags);
76 76
 
77 77
 		// all tags are closed
78
-		if ( count( $closedtags ) === $len_opened ) {
78
+		if (count($closedtags) === $len_opened) {
79 79
 			return $html;
80 80
 		}
81 81
 
82
-		$openedtags = array_reverse( $openedtags );
82
+		$openedtags = array_reverse($openedtags);
83 83
 
84 84
 		// close tags
85
-		for ( $i = 0; $i < $len_opened; $i++ ) {
86
-			if ( ! in_array( $openedtags[ $i ], $closedtags, true ) ) {
87
-				$html .= '</' . $openedtags[ $i ] . '>';
85
+		for ($i = 0; $i < $len_opened; $i++) {
86
+			if (!in_array($openedtags[$i], $closedtags, true)) {
87
+				$html .= '</'.$openedtags[$i].'>';
88 88
 			} else {
89
-				unset( $closedtags[ array_search( $openedtags[ $i ], $closedtags ) ] );
89
+				unset($closedtags[array_search($openedtags[$i], $closedtags)]);
90 90
 			}
91 91
 		}
92 92
 
93
-		$html = str_replace( array( '</br>', '</hr>', '</wbr>' ), '', $html );
94
-		$html = str_replace( array( '<br>', '<hr>', '<wbr>' ), array( '<br />', '<hr />', '<wbr />' ), $html );
93
+		$html = str_replace(array('</br>', '</hr>', '</wbr>'), '', $html);
94
+		$html = str_replace(array('<br>', '<hr>', '<wbr>'), array('<br />', '<hr />', '<wbr />'), $html);
95 95
 
96 96
 		return $html;
97 97
 	}
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
 	 *
104 104
 	 * @return bool
105 105
 	 */
106
-	public static function error_log( $arg ) {
107
-		if ( ! WP_DEBUG ) {
106
+	public static function error_log($arg) {
107
+		if (!WP_DEBUG) {
108 108
 			return true;
109 109
 		}
110
-		if ( is_object( $arg ) || is_array( $arg ) ) {
111
-			$arg = print_r( $arg, true );
110
+		if (is_object($arg) || is_array($arg)) {
111
+			$arg = print_r($arg, true);
112 112
 		}
113
-		return error_log( $arg );
113
+		return error_log($arg);
114 114
 	}
115 115
 
116 116
 	/**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * @param string  $args
120 120
 	 * @return array
121 121
 	 */
122
-	public static function paginate_links( $args = '' ) {
122
+	public static function paginate_links($args = '') {
123 123
 		$defaults = array(
124 124
 			'base' => '%_%', // http://example.com/all_posts.php%_% : %_% is replaced by format (below)
125 125
 			'format' => '?page=%#%', // ?page=%#% : %#% is replaced by the page number
@@ -127,43 +127,43 @@  discard block
 block discarded – undo
127 127
 			'current' => 0,
128 128
 			'show_all' => false,
129 129
 			'prev_next' => true,
130
-			'prev_text' => __( '&laquo; Previous' ),
131
-			'next_text' => __( 'Next &raquo;' ),
130
+			'prev_text' => __('&laquo; Previous'),
131
+			'next_text' => __('Next &raquo;'),
132 132
 			'end_size' => 1,
133 133
 			'mid_size' => 2,
134 134
 			'type' => 'array',
135 135
 			'add_args' => false, // array of query args to add
136 136
 			'add_fragment' => '',
137 137
 		);
138
-		$args = wp_parse_args( $args, $defaults );
138
+		$args = wp_parse_args($args, $defaults);
139 139
 		// Who knows what else people pass in $args
140
-		$args['total'] = intval( (int) $args['total'] );
141
-		if ( $args['total'] < 2 ) {
140
+		$args['total'] = intval((int) $args['total']);
141
+		if ($args['total'] < 2) {
142 142
 			return array();
143 143
 		}
144 144
 		$args['current'] = (int) $args['current'];
145 145
 		$args['end_size'] = 0 < (int) $args['end_size'] ? (int) $args['end_size'] : 1; // Out of bounds?  Make it the default.
146 146
 		$args['mid_size'] = 0 <= (int) $args['mid_size'] ? (int) $args['mid_size'] : 2;
147
-		$args['add_args'] = is_array( $args['add_args'] ) ? $args['add_args'] : false;
147
+		$args['add_args'] = is_array($args['add_args']) ? $args['add_args'] : false;
148 148
 		$page_links = array();
149 149
 		$dots = false;
150
-		if ( $args['prev_next'] && $args['current'] && 1 < $args['current'] ) {
151
-			$link = str_replace( '%_%', 2 === absint( $args['current'] ) ? '' : $args['format'], $args['base'] );
152
-			$link = str_replace( '%#%', $args['current'] - 1, $link );
153
-			if ( $args['add_args'] ) {
154
-				$link = add_query_arg( $args['add_args'], $link );
150
+		if ($args['prev_next'] && $args['current'] && 1 < $args['current']) {
151
+			$link = str_replace('%_%', 2 === absint($args['current']) ? '' : $args['format'], $args['base']);
152
+			$link = str_replace('%#%', $args['current'] - 1, $link);
153
+			if ($args['add_args']) {
154
+				$link = add_query_arg($args['add_args'], $link);
155 155
 			}
156 156
 			$link .= $args['add_fragment'];
157
-			$link = untrailingslashit( $link );
157
+			$link = untrailingslashit($link);
158 158
 			$page_links[] = array(
159 159
 				'class' => 'prev page-numbers',
160
-				'link' => esc_url( apply_filters( 'paginate_links', $link ) ),
160
+				'link' => esc_url(apply_filters('paginate_links', $link)),
161 161
 				'title' => $args['prev_text'],
162 162
 			);
163 163
 		}
164
-		for ( $n = 1; $n <= $args['total']; $n++ ) {
165
-			$n_display = number_format_i18n( $n );
166
-			if ( absint( $args['current'] ) === $n ) {
164
+		for ($n = 1; $n <= $args['total']; $n++) {
165
+			$n_display = number_format_i18n($n);
166
+			if (absint($args['current']) === $n) {
167 167
 				$page_links[] = array(
168 168
 					'class' => 'page-number page-numbers current',
169 169
 					'title' => $n_display,
@@ -173,42 +173,42 @@  discard block
 block discarded – undo
173 173
 				);
174 174
 				$dots = true;
175 175
 			} else {
176
-				if ( $args['show_all'] || ( $n <= $args['end_size'] || ( $args['current'] && $n >= $args['current'] - $args['mid_size'] && $n <= $args['current'] + $args['mid_size'] ) || $n > $args['total'] - $args['end_size'] ) ) {
177
-					$link = str_replace( '%_%', 1 === absint( $n ) ? '' : $args['format'], $args['base'] );
178
-					$link = str_replace( '%#%', $n, $link );
179
-					$link = trailingslashit( $link ) . ltrim( $args['add_fragment'], '/' );
180
-					if ( $args['add_args'] ) {
181
-						$link = rtrim( add_query_arg( $args['add_args'], $link ), '/' );
176
+				if ($args['show_all'] || ($n <= $args['end_size'] || ($args['current'] && $n >= $args['current'] - $args['mid_size'] && $n <= $args['current'] + $args['mid_size']) || $n > $args['total'] - $args['end_size'])) {
177
+					$link = str_replace('%_%', 1 === absint($n) ? '' : $args['format'], $args['base']);
178
+					$link = str_replace('%#%', $n, $link);
179
+					$link = trailingslashit($link).ltrim($args['add_fragment'], '/');
180
+					if ($args['add_args']) {
181
+						$link = rtrim(add_query_arg($args['add_args'], $link), '/');
182 182
 					}
183
-					$link = str_replace( ' ', '+', $link );
184
-					$link = untrailingslashit( $link );
183
+					$link = str_replace(' ', '+', $link);
184
+					$link = untrailingslashit($link);
185 185
 					$page_links[] = array(
186 186
 						'class' => 'page-number page-numbers',
187
-						'link' => esc_url( apply_filters( 'paginate_links', $link ) ),
187
+						'link' => esc_url(apply_filters('paginate_links', $link)),
188 188
 						'title' => $n_display,
189 189
 						'name' => $n_display,
190
-						'current' => absint( $args['current'] ) === $n,
190
+						'current' => absint($args['current']) === $n,
191 191
 					);
192 192
 					$dots = true;
193
-				} elseif ( $dots && ! $args['show_all'] ) {
193
+				} elseif ($dots && !$args['show_all']) {
194 194
 					$page_links[] = array(
195 195
 						'class' => 'dots',
196
-						'title' => __( '&hellip;' ),
196
+						'title' => __('&hellip;'),
197 197
 					);
198 198
 					$dots = false;
199 199
 				}
200 200
 			}
201 201
 		}
202
-		if ( $args['prev_next'] && $args['current'] && ( $args['current'] < $args['total'] || -1 === intval( $args['total'] ) ) ) {
203
-			$link = str_replace( '%_%', $args['format'], $args['base'] );
204
-			$link = str_replace( '%#%', $args['current'] + 1, $link );
205
-			if ( $args['add_args'] ) {
206
-				$link = add_query_arg( $args['add_args'], $link );
202
+		if ($args['prev_next'] && $args['current'] && ($args['current'] < $args['total'] || -1 === intval($args['total']))) {
203
+			$link = str_replace('%_%', $args['format'], $args['base']);
204
+			$link = str_replace('%#%', $args['current'] + 1, $link);
205
+			if ($args['add_args']) {
206
+				$link = add_query_arg($args['add_args'], $link);
207 207
 			}
208
-			$link = untrailingslashit( trailingslashit( $link ) . $args['add_fragment'] );
208
+			$link = untrailingslashit(trailingslashit($link).$args['add_fragment']);
209 209
 			$page_links[] = array(
210 210
 				'class' => 'next page-numbers',
211
-				'link' => esc_url( apply_filters( 'paginate_links', $link ) ),
211
+				'link' => esc_url(apply_filters('paginate_links', $link)),
212 212
 				'title' => $args['next_text'],
213 213
 			);
214 214
 		}
@@ -222,13 +222,13 @@  discard block
 block discarded – undo
222 222
 	 * @param  array $array
223 223
 	 * @return object
224 224
 	 */
225
-	public static function array_to_object( $array ) {
225
+	public static function array_to_object($array) {
226 226
 		$obj = new stdClass;
227 227
 
228
-		foreach ( $array as $k => $v ) {
229
-			if ( strlen( $k ) ) {
230
-				if ( is_array( $v ) ) {
231
-					$obj->{$k} = self::array_to_object( $v ); //RECURSION
228
+		foreach ($array as $k => $v) {
229
+			if (strlen($k)) {
230
+				if (is_array($v)) {
231
+					$obj->{$k} = self::array_to_object($v); //RECURSION
232 232
 				} else {
233 233
 					$obj->{$k} = $v;
234 234
 				}
@@ -251,42 +251,42 @@  discard block
 block discarded – undo
251 251
 
252 252
 	    $archives_title = '';
253 253
 
254
-	    if ( is_category() ) {
254
+	    if (is_category()) {
255 255
 
256
-	        $archives_title = single_cat_title( '', false );
256
+	        $archives_title = single_cat_title('', false);
257 257
 
258
-	    } else if ( is_tag() ) {
258
+	    } else if (is_tag()) {
259 259
 
260
-	        $archives_title = 'Tag: ' . single_tag_title( '', false );
260
+	        $archives_title = 'Tag: '.single_tag_title('', false);
261 261
 
262
-	    } else if ( is_author() ) {
262
+	    } else if (is_author()) {
263 263
 
264
-	        if ( have_posts() ) {
264
+	        if (have_posts()) {
265 265
 
266 266
 	            the_post();
267
-	            $archives_title = 'Author: ' . get_the_author();
267
+	            $archives_title = 'Author: '.get_the_author();
268 268
 
269 269
 	        }
270 270
 
271 271
 	        rewind_posts();
272 272
 
273
-	    } else if ( is_search() ) {
273
+	    } else if (is_search()) {
274 274
 
275
-	        $archives_title = sprintf( __( 'Search Results for: %s', $textdomain ), '<span>' . get_search_query() . '</span>' );
275
+	        $archives_title = sprintf(__('Search Results for: %s', $textdomain), '<span>'.get_search_query().'</span>');
276 276
 
277
-	    } else if ( is_archive() ) {
277
+	    } else if (is_archive()) {
278 278
 
279
-	        if ( is_day() ) {
279
+	        if (is_day()) {
280 280
 
281 281
 	            $archives_title = get_the_date();
282 282
 
283
-	        } elseif ( is_month() ) {
283
+	        } elseif (is_month()) {
284 284
 
285
-	            $archives_title = get_the_date( _x( 'F Y', 'monthly archives date format', $textdomain ) );
285
+	            $archives_title = get_the_date(_x('F Y', 'monthly archives date format', $textdomain));
286 286
 
287
-	        } elseif ( is_year() ) {
287
+	        } elseif (is_year()) {
288 288
 
289
-	            $archives_title = get_the_date( _x( 'Y', 'yearly archives date format', $textdomain ) );
289
+	            $archives_title = get_the_date(_x('Y', 'yearly archives date format', $textdomain));
290 290
 
291 291
 	        } else {
292 292
 
Please login to merge, or discard this patch.