Completed
Pull Request — master (#26)
by
unknown
06:23
created
app/classes/scope.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -35,15 +35,15 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @return array
37 37
 	 */
38
-	public static function get_scope( $view_name = null ) {
38
+	public static function get_scope($view_name = null) {
39 39
 		$scope = self::get_common_scope();
40 40
 
41
-		if ( is_string( $view_name ) ) {
42
-			$scope = self::extend_scope( $scope, $view_name );
41
+		if (is_string($view_name)) {
42
+			$scope = self::extend_scope($scope, $view_name);
43 43
 		} else {
44 44
 			$request = Hierarchy::get_current_request();
45
-			$file = Hierarchy::get_available_file( 'scope', $request );
46
-			$scope = self::extend_scope( $scope, $file );
45
+			$file = Hierarchy::get_available_file('scope', $request);
46
+			$scope = self::extend_scope($scope, $file);
47 47
 		}
48 48
 
49 49
 		return $scope;
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
 	 *
58 58
 	 * @return array
59 59
 	 */
60
-	public static function extend_scope( $scope, $view_name ) {
61
-		return array_merge( $scope, self::require_scope( $view_name ) );
60
+	public static function extend_scope($scope, $view_name) {
61
+		return array_merge($scope, self::require_scope($view_name));
62 62
 	}
63 63
 
64 64
 	/**
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
 	 * @return array
68 68
 	 */
69 69
 	public static function get_common_scope() {
70
-		if ( is_null( self::$common ) ) {
71
-			self::$common = self::require_scope( 'common' );
70
+		if (is_null(self::$common)) {
71
+			self::$common = self::require_scope('common');
72 72
 		}
73 73
 
74 74
 		return self::$common;
@@ -81,16 +81,16 @@  discard block
 block discarded – undo
81 81
 	 *
82 82
 	 * @return array
83 83
 	 */
84
-	public static function require_scope( $filename ) {
84
+	public static function require_scope($filename) {
85 85
 		$_return = array();
86 86
 
87
-		$file = Hierarchy::get_file_path( 'scope', $filename );
87
+		$file = Hierarchy::get_file_path('scope', $filename);
88 88
 
89
-		if ( file_exists( $file ) ) {
89
+		if (file_exists($file)) {
90 90
 			require $file;
91 91
 		}
92 92
 
93
-		if ( isset( $data ) ) {
93
+		if (isset($data)) {
94 94
 			$_return = $data;
95 95
 		}
96 96
 
Please login to merge, or discard this patch.
app/classes/config.php 1 patch
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -43,25 +43,25 @@  discard block
 block discarded – undo
43 43
 	 * @return array
44 44
 	 */
45 45
 	public static function get_vars() {
46
-		if ( is_null( self::$vars ) ) {
46
+		if (is_null(self::$vars)) {
47 47
 			// Check for a theme config.
48
-			$config_file = CLASSY_THEME_FRAMEWORK_PATH . 'config.php';
48
+			$config_file = CLASSY_THEME_FRAMEWORK_PATH.'config.php';
49 49
 
50
-			if ( ! file_exists( $config_file ) ) {
51
-				wp_die( sprintf(
50
+			if (!file_exists($config_file)) {
51
+				wp_die(sprintf(
52 52
 					'There is no config file in %s custom/config.php',
53
-					esc_html( CLASSY_THEME )
54
-				) );
53
+					esc_html(CLASSY_THEME)
54
+				));
55 55
 			}
56 56
 
57
-			require_once( CLASSY_THEME_FRAMEWORK_PATH . 'config.php' );
57
+			require_once(CLASSY_THEME_FRAMEWORK_PATH.'config.php');
58 58
 			$vars = self::get_allowed_variables();
59 59
 
60
-			foreach ( $vars as $var ) {
61
-				if ( isset( $$var ) ) {
62
-					self::$vars[ $var ] = $$var;
60
+			foreach ($vars as $var) {
61
+				if (isset($$var)) {
62
+					self::$vars[$var] = $$var;
63 63
 
64
-					unset( $$var ); // We don't require it anymore.
64
+					unset($$var); // We don't require it anymore.
65 65
 				}
66 66
 			}
67 67
 		}
@@ -76,23 +76,23 @@  discard block
 block discarded – undo
76 76
 		$vars = self::get_vars();
77 77
 
78 78
 		// Init Post Types.
79
-		if ( isset( $vars['post_types'] ) ) {
80
-			self::init_post_types( $vars['post_types'] );
79
+		if (isset($vars['post_types'])) {
80
+			self::init_post_types($vars['post_types']);
81 81
 		}
82 82
 
83 83
 		// Init Taxonomies.
84
-		if ( isset( $vars['taxonomies'] ) ) {
85
-			self::init_taxonomies( $vars['taxonomies'] );
84
+		if (isset($vars['taxonomies'])) {
85
+			self::init_taxonomies($vars['taxonomies']);
86 86
 		}
87 87
 
88 88
 		// Init Post Formats.
89
-		if ( isset( $vars['post_formats'] ) ) {
90
-			self::init_post_formats( $vars['post_formats'] );
89
+		if (isset($vars['post_formats'])) {
90
+			self::init_post_formats($vars['post_formats']);
91 91
 		}
92 92
 
93 93
 		// Init Sidebars.
94
-		if ( isset( $vars['sidebars'] ) ) {
95
-			self::init_sidebars( $vars['sidebars'] );
94
+		if (isset($vars['sidebars'])) {
95
+			self::init_sidebars($vars['sidebars']);
96 96
 		}
97 97
 	}
98 98
 
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 * @param array $post_types Custom post types to be registered.
103 103
 	 */
104
-	private static function init_post_types( $post_types ) {
105
-		if ( is_array( $post_types ) ) {
106
-			foreach ( $post_types as $type => $options ) {
104
+	private static function init_post_types($post_types) {
105
+		if (is_array($post_types)) {
106
+			foreach ($post_types as $type => $options) {
107 107
 				self::add_post_type(
108 108
 					$type,
109 109
 					$options['config'],
@@ -122,25 +122,25 @@  discard block
 block discarded – undo
122 122
 	 * @param string $singular Optional. Default singular name.
123 123
 	 * @param string $multiple Optional. Default multiple name.
124 124
 	 */
125
-	private static function add_post_type( $name, $config, $singular = 'Entry', $multiple = 'Entries' ) {
125
+	private static function add_post_type($name, $config, $singular = 'Entry', $multiple = 'Entries') {
126 126
 		$domain = Classy::textdomain();
127 127
 
128
-		if ( ! isset( $config['labels'] ) ) {
128
+		if (!isset($config['labels'])) {
129 129
 			$config['labels'] = array(
130
-				'name' => __( $multiple, $domain ),
131
-				'singular_name' => __( $singular, $domain ),
132
-				'not_found' => __( 'No ' . $multiple . ' Found', $domain ),
133
-				'not_found_in_trash' => __( 'No ' . $multiple . ' found in Trash', $domain ),
134
-				'edit_item' => __( 'Edit ', $singular, $domain ),
135
-				'search_items' => __( 'Search ' . $multiple, $domain ),
136
-				'view_item' => __( 'View ', $singular, $domain ),
137
-				'new_item' => __( 'New ' . $singular, $domain ),
138
-				'add_new' => __( 'Add New', $domain ),
139
-				'add_new_item' => __( 'Add New ' . $singular, $domain ),
130
+				'name' => __($multiple, $domain),
131
+				'singular_name' => __($singular, $domain),
132
+				'not_found' => __('No '.$multiple.' Found', $domain),
133
+				'not_found_in_trash' => __('No '.$multiple.' found in Trash', $domain),
134
+				'edit_item' => __('Edit ', $singular, $domain),
135
+				'search_items' => __('Search '.$multiple, $domain),
136
+				'view_item' => __('View ', $singular, $domain),
137
+				'new_item' => __('New '.$singular, $domain),
138
+				'add_new' => __('Add New', $domain),
139
+				'add_new_item' => __('Add New '.$singular, $domain),
140 140
 			);
141 141
 		}
142 142
 
143
-		register_post_type( $name, $config );
143
+		register_post_type($name, $config);
144 144
 	}
145 145
 
146 146
 	/**
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 	 *
149 149
 	 * @param array $taxonomies Taxonomies to be registered.
150 150
 	 */
151
-	private static function init_taxonomies( $taxonomies ) {
152
-		if ( is_array( $taxonomies ) ) {
153
-			foreach ( $taxonomies as $type => $options ) {
151
+	private static function init_taxonomies($taxonomies) {
152
+		if (is_array($taxonomies)) {
153
+			foreach ($taxonomies as $type => $options) {
154 154
 				self::add_taxonomy(
155 155
 					$type,
156 156
 					$options['for'],
@@ -171,26 +171,26 @@  discard block
 block discarded – undo
171 171
 	 * @param string $singular    Optional. Default singular name.
172 172
 	 * @param string $multiple 	  Optional. Default multiple name.
173 173
 	 */
174
-	private static function add_taxonomy( $name, $object_type, $config, $singular = 'Entry', $multiple = 'Entries' ) {
174
+	private static function add_taxonomy($name, $object_type, $config, $singular = 'Entry', $multiple = 'Entries') {
175 175
 		$domain = Classy::textdomain();
176 176
 
177
-		if ( ! isset( $config['labels'] ) ) {
177
+		if (!isset($config['labels'])) {
178 178
 			$config['labels'] = array(
179
-				'name' => __( $multiple, $domain ),
180
-				'singular_name' => __( $singular, $domain ),
181
-				'search_items' => __( 'Search ' . $multiple, $domain ),
182
-				'all_items' => __( 'All ' . $multiple, $domain ),
183
-				'parent_item' => __( 'Parent ' . $singular, $domain ),
184
-				'parent_item_colon' => __( 'Parent ' . $singular . ':', $domain ),
185
-				'edit_item' => __( 'Edit ' . $singular, $domain ),
186
-				'update_item' => __( 'Update ' . $singular, $domain ),
187
-				'add_new_item' => __( 'Add New ' . $singular, $domain ),
188
-				'new_item_name' => __( 'New ' . $singular . ' Name', $domain ),
189
-				'menu_name' => __( $singular, $domain ),
179
+				'name' => __($multiple, $domain),
180
+				'singular_name' => __($singular, $domain),
181
+				'search_items' => __('Search '.$multiple, $domain),
182
+				'all_items' => __('All '.$multiple, $domain),
183
+				'parent_item' => __('Parent '.$singular, $domain),
184
+				'parent_item_colon' => __('Parent '.$singular.':', $domain),
185
+				'edit_item' => __('Edit '.$singular, $domain),
186
+				'update_item' => __('Update '.$singular, $domain),
187
+				'add_new_item' => __('Add New '.$singular, $domain),
188
+				'new_item_name' => __('New '.$singular.' Name', $domain),
189
+				'menu_name' => __($singular, $domain),
190 190
 			);
191 191
 		}
192 192
 
193
-		register_taxonomy( $name, $object_type, $config );
193
+		register_taxonomy($name, $object_type, $config);
194 194
 	}
195 195
 
196 196
 	/**
@@ -198,9 +198,9 @@  discard block
 block discarded – undo
198 198
 	 *
199 199
 	 * @param array $post_formats Array with available post formats.
200 200
 	 */
201
-	private static function init_post_formats( $post_formats ) {
202
-		if ( is_array( $post_formats ) ) {
203
-			add_theme_support( 'post-formats', $post_formats );
201
+	private static function init_post_formats($post_formats) {
202
+		if (is_array($post_formats)) {
203
+			add_theme_support('post-formats', $post_formats);
204 204
 		}
205 205
 	}
206 206
 
@@ -209,16 +209,16 @@  discard block
 block discarded – undo
209 209
 	 *
210 210
 	 * @param array $sidebars Sidebars to be registered.
211 211
 	 */
212
-	private static function init_sidebars( $sidebars ) {
212
+	private static function init_sidebars($sidebars) {
213 213
 		$domain = Classy::textdomain();
214 214
 
215
-		if ( is_array( $sidebars ) ) {
216
-			foreach ( $sidebars as $id => $title ) {
215
+		if (is_array($sidebars)) {
216
+			foreach ($sidebars as $id => $title) {
217 217
 				register_sidebar(
218 218
 					array(
219 219
 						'id' => $id,
220
-						'name' => __( $title, $domain ),
221
-						'description' => __( $title, $domain ),
220
+						'name' => __($title, $domain),
221
+						'description' => __($title, $domain),
222 222
 						'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget-inner">',
223 223
 						'after_widget' => '</div></div>',
224 224
 						'before_title' => '<h3>',
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
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @param \WP_Post $item WP_Post object.
54 54
 	 */
55
-	public function __construct( $item ) {
56
-		if ( is_a( $item, '\WP_Post' ) ) {
57
-			$this->import( $item );
55
+	public function __construct($item) {
56
+		if (is_a($item, '\WP_Post')) {
57
+			$this->import($item);
58 58
 			$this->filter_classes();
59 59
 		}
60 60
 	}
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * @return string
102 102
 	 */
103 103
 	public function get_classes() {
104
-		return implode( ' ', $this->classes );
104
+		return implode(' ', $this->classes);
105 105
 	}
106 106
 
107 107
 	/**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @param string $class_name CSS class name.
111 111
 	 */
112
-	public function add_class( $class_name ) {
112
+	public function add_class($class_name) {
113 113
 		$this->classes[] = $class_name;
114 114
 	}
115 115
 
@@ -118,16 +118,16 @@  discard block
 block discarded – undo
118 118
 	 *
119 119
 	 * @param Menu_Item $item Menu_Item object.
120 120
 	 */
121
-	public function add_child( $item ) {
122
-		if ( ! $this->has_child ) {
123
-			$this->add_class( 'menu-item-has-children' );
121
+	public function add_child($item) {
122
+		if (!$this->has_child) {
123
+			$this->add_class('menu-item-has-children');
124 124
 			$this->has_child = true;
125 125
 		}
126 126
 
127 127
 		$this->children[] = $item;
128 128
 		$item->level = $this->level + 1;
129 129
 
130
-		if ( $item->children ) {
130
+		if ($item->children) {
131 131
 			$this->update_child_levels();
132 132
 		}
133 133
 	}
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 * Applies filters for item classes.
137 137
 	 */
138 138
 	protected function filter_classes() {
139
-		$this->classes = apply_filters( 'nav_menu_css_class', $this->classes, $this );
139
+		$this->classes = apply_filters('nav_menu_css_class', $this->classes, $this);
140 140
 	}
141 141
 
142 142
 	/**
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
 	 * @return boolean
146 146
 	 */
147 147
 	protected function update_child_levels() {
148
-		if ( is_array( $this->children ) ) {
149
-			foreach ( $this->children as $child ) {
148
+		if (is_array($this->children)) {
149
+			foreach ($this->children as $child) {
150 150
 				$child->level = $this->level + 1;
151 151
 				$child->update_child_levels();
152 152
 			}
Please login to merge, or discard this patch.
app/classes/comment.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 * @param \WP_Comment $item WP_Comment object.
103 103
 	 */
104
-	public function __construct( $item ) {
105
-		if ( is_a( $item, '\WP_Comment' ) ) {
106
-			$this->import( $item );
104
+	public function __construct($item) {
105
+		if (is_a($item, '\WP_Comment')) {
106
+			$this->import($item);
107 107
 		}
108 108
 	}
109 109
 
@@ -113,18 +113,18 @@  discard block
 block discarded – undo
113 113
 	 * @return \Classy\Models\User
114 114
 	 */
115 115
 	public function author() {
116
-		if ( ! $this->user_id ) {
116
+		if (!$this->user_id) {
117 117
 
118
-			$author = new Models\User( 0 );
118
+			$author = new Models\User(0);
119 119
 
120
-			if ( isset( $this->comment_author ) && $this->comment_author ) {
120
+			if (isset($this->comment_author) && $this->comment_author) {
121 121
 				$author->name = $this->comment_author;
122 122
 			}
123 123
 
124 124
 			return $author;
125 125
 		}
126 126
 
127
-		return new Models\User( $this->user_id );
127
+		return new Models\User($this->user_id);
128 128
 	}
129 129
 
130 130
 	/**
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @return string
134 134
 	 */
135 135
 	public function content() {
136
-		return apply_filters( 'get_comment_text ', $this->comment_content );
136
+		return apply_filters('get_comment_text ', $this->comment_content);
137 137
 	}
138 138
 
139 139
 	/**
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
 	 *
153 153
 	 * @return string
154 154
 	 */
155
-	public function date( $date_format = '' ) {
156
-		$df = $date_format ? $date_format : get_option( 'date_format' );
157
-		$the_date = (string) mysql2date( $df, $this->comment_date );
155
+	public function date($date_format = '') {
156
+		$df = $date_format ? $date_format : get_option('date_format');
157
+		$the_date = (string) mysql2date($df, $this->comment_date);
158 158
 
159
-		return apply_filters( 'get_comment_date ', $the_date, $df );
159
+		return apply_filters('get_comment_date ', $the_date, $df);
160 160
 	}
161 161
 
162 162
 	/**
@@ -176,25 +176,25 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @return string
178 178
 	 */
179
-	public function avatar( $size = 92, $default = '' ) {
180
-		if ( ! get_option( 'show_avatars' ) ) {
179
+	public function avatar($size = 92, $default = '') {
180
+		if (!get_option('show_avatars')) {
181 181
 			return false;
182 182
 		}
183 183
 
184
-		if ( ! is_numeric( $size ) ) { $size = '92'; }
184
+		if (!is_numeric($size)) { $size = '92'; }
185 185
 
186 186
 		$email = $this->get_avatar_email();
187 187
 		$email_hash = '';
188 188
 
189
-		if ( ! empty( $email ) ) {
190
-			$email_hash = md5( strtolower( trim( $email ) ) );
189
+		if (!empty($email)) {
190
+			$email_hash = md5(strtolower(trim($email)));
191 191
 		}
192 192
 
193
-		$host = $this->get_avatar_host( $email_hash );
194
-		$default = $this->get_default_avatar( $default, $email, $size, $host );
193
+		$host = $this->get_avatar_host($email_hash);
194
+		$default = $this->get_default_avatar($default, $email, $size, $host);
195 195
 
196
-		if ( ! empty( $email ) ) {
197
-			$avatar = $this->get_avatar_url( $default, $host, $email_hash, $size );
196
+		if (!empty($email)) {
197
+			$avatar = $this->get_avatar_url($default, $host, $email_hash, $size);
198 198
 		} else {
199 199
 			$avatar = $default;
200 200
 		}
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	protected function get_avatar_email() {
211 211
 		$id = (int) $this->user_id;
212
-		$user = get_userdata( $id );
212
+		$user = get_userdata($id);
213 213
 
214
-		if ( $user ) {
214
+		if ($user) {
215 215
 			$email = $user->user_email;
216 216
 		} else {
217 217
 			$email = $this->comment_author_email;
@@ -229,31 +229,31 @@  discard block
 block discarded – undo
229 229
 	 * @param  string $host
230 230
 	 * @return string
231 231
 	 */
232
-	protected function get_default_avatar( $default, $email, $size, $host ) {
233
-		if ( '/' === substr( $default, 0, 1 ) ) {
234
-			$default = home_url() . $default;
232
+	protected function get_default_avatar($default, $email, $size, $host) {
233
+		if ('/' === substr($default, 0, 1)) {
234
+			$default = home_url().$default;
235 235
 		}
236 236
 
237
-		if ( empty( $default ) ) {
238
-			$avatar_default = get_option( 'avatar_default' );
239
-			if ( empty( $avatar_default ) ) {
237
+		if (empty($default)) {
238
+			$avatar_default = get_option('avatar_default');
239
+			if (empty($avatar_default)) {
240 240
 				$default = 'mystery';
241 241
 			} else {
242 242
 				$default = $avatar_default;
243 243
 			}
244 244
 		}
245 245
 
246
-		if ( 'mystery' === $default ) {
247
-			$default = $host . '/avatar/ad516503a11cd5ca435acc9bb6523536?s=' . $size;
246
+		if ('mystery' === $default) {
247
+			$default = $host.'/avatar/ad516503a11cd5ca435acc9bb6523536?s='.$size;
248 248
 			// ad516503a11cd5ca435acc9bb6523536 == md5('[email protected]')
249
-		} else if ( 'blank' === $default ) {
250
-			$default = $email ? 'blank' : includes_url( 'images/blank.gif' );
251
-		} else if ( ! empty( $email ) && 'gravatar_default' === $default ) {
249
+		} else if ('blank' === $default) {
250
+			$default = $email ? 'blank' : includes_url('images/blank.gif');
251
+		} else if (!empty($email) && 'gravatar_default' === $default) {
252 252
 			$default = '';
253
-		} else if ( 'gravatar_default' === $default ) {
254
-			$default = $host . '/avatar/?s=' . $size;
255
-		} else if ( empty( $email ) && ! strstr( $default, 'http://' ) ) {
256
-			$default = $host . '/avatar/?d=' . $default . '&amp;s=' . $size;
253
+		} else if ('gravatar_default' === $default) {
254
+			$default = $host.'/avatar/?s='.$size;
255
+		} else if (empty($email) && !strstr($default, 'http://')) {
256
+			$default = $host.'/avatar/?d='.$default.'&amp;s='.$size;
257 257
 		}
258 258
 
259 259
 		return $default;
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
 	 * @param  string $email_hash
266 266
 	 * @return string
267 267
 	 */
268
-	protected function get_avatar_host( $email_hash ) {
268
+	protected function get_avatar_host($email_hash) {
269 269
 
270
-		if ( is_ssl() ) {
270
+		if (is_ssl()) {
271 271
 			$host = 'https://secure.gravatar.com';
272 272
 		} else {
273
-			if ( ! empty( $email_hash ) ) {
274
-				$host = sprintf( 'http://%d.gravatar.com', (hexdec( $email_hash[0] ) % 2) );
273
+			if (!empty($email_hash)) {
274
+				$host = sprintf('http://%d.gravatar.com', (hexdec($email_hash[0]) % 2));
275 275
 			} else {
276 276
 				$host = 'http://0.gravatar.com';
277 277
 			}
@@ -289,15 +289,15 @@  discard block
 block discarded – undo
289 289
 	 * @param  int $size
290 290
 	 * @return string
291 291
 	 */
292
-	protected function get_avatar_url( $default, $host, $email_hash, $size ) {
293
-		$_return = $host . '/avatar/' . $email_hash . '?s=' . $size . '&amp;d=' . urlencode( $default );
294
-		$rating = get_option( 'avatar_rating' );
292
+	protected function get_avatar_url($default, $host, $email_hash, $size) {
293
+		$_return = $host.'/avatar/'.$email_hash.'?s='.$size.'&amp;d='.urlencode($default);
294
+		$rating = get_option('avatar_rating');
295 295
 
296
-		if ( ! empty( $rating ) ) {
297
-			$_return .= '&amp;r=' . $rating;
296
+		if (!empty($rating)) {
297
+			$_return .= '&amp;r='.$rating;
298 298
 		}
299 299
 
300
-		return str_replace( '&#038;', '&amp;', esc_url( $_return ) );
300
+		return str_replace('&#038;', '&amp;', esc_url($_return));
301 301
 	}
302 302
 
303 303
 	/**
@@ -305,11 +305,11 @@  discard block
 block discarded – undo
305 305
 	 *
306 306
 	 * @param Comment $comment
307 307
 	 */
308
-	public function add_child( $comment ) {
308
+	public function add_child($comment) {
309 309
 		$this->children[] = $comment;
310 310
 		$item->level = $this->level + 1;
311 311
 
312
-		if ( $item->children ) {
312
+		if ($item->children) {
313 313
 			$this->update_child_levels();
314 314
 		}
315 315
 	}
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
 	 * @return boolean
321 321
 	 */
322 322
 	protected function update_child_levels() {
323
-		if ( is_array( $this->children ) ) {
324
-			foreach ( $this->children as $child ) {
323
+		if (is_array($this->children)) {
324
+			foreach ($this->children as $child) {
325 325
 				$child->level = $this->level + 1;
326 326
 				$child->update_child_levels();
327 327
 			}
Please login to merge, or discard this patch.
header.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,4 +3,4 @@
 block discarded – undo
3 3
  * Theme header.
4 4
  */
5 5
 $framework = get_theme_framework();
6
-$framework::render( 'layout.header' );
6
+$framework::render('layout.header');
Please login to merge, or discard this patch.
footer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,4 +3,4 @@
 block discarded – undo
3 3
  * Theme footer.
4 4
  */
5 5
 $framework = get_theme_framework();
6
-$framework::render( 'layout.footer' );
6
+$framework::render('layout.footer');
Please login to merge, or discard this patch.
app/classes/menu.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -38,22 +38,22 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @param string $arg It can be menu id, slug or full name.
40 40
 	 */
41
-	public function __construct( $arg = null ) {
41
+	public function __construct($arg = null) {
42 42
 		$locations = get_nav_menu_locations();
43 43
 
44
-		if ( is_numeric( $arg ) && 0 !== absint( $arg ) ) {
45
-			$menu_id = $this->check_menu_id( $arg );
46
-		} elseif ( is_array( $locations ) && count( $locations ) ) {
47
-			$menu_id = $this->get_locations_menu_id( $locations, $arg );
48
-		} elseif ( is_string( $arg ) ) {
49
-			$menu_id = $this->get_menu_id_by_name( $arg );
44
+		if (is_numeric($arg) && 0 !== absint($arg)) {
45
+			$menu_id = $this->check_menu_id($arg);
46
+		} elseif (is_array($locations) && count($locations)) {
47
+			$menu_id = $this->get_locations_menu_id($locations, $arg);
48
+		} elseif (is_string($arg)) {
49
+			$menu_id = $this->get_menu_id_by_name($arg);
50 50
 		}
51 51
 
52
-		if ( ! isset( $menu_id ) ) {
52
+		if (!isset($menu_id)) {
53 53
 			$menu_id = $this->get_first_menu_id();
54 54
 		}
55 55
 
56
-		if ( $menu_id ) {
56
+		if ($menu_id) {
57 57
 			$this->ID = $menu_id;
58 58
 			$this->title = $this->get_menu_name_by_id();
59 59
 			$this->init();
@@ -65,21 +65,21 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	protected function init() {
67 67
 		$_return = array();
68
-		$items = wp_get_nav_menu_items( $this->ID );
68
+		$items = wp_get_nav_menu_items($this->ID);
69 69
 
70
-		foreach ( $items as $item ) {
71
-			$_return[ $item->ID ] = new Menu_Item( $item );
70
+		foreach ($items as $item) {
71
+			$_return[$item->ID] = new Menu_Item($item);
72 72
 		}
73 73
 
74 74
 		// Apply nesting.
75
-		foreach ( $_return as $item_id => $item ) {
75
+		foreach ($_return as $item_id => $item) {
76 76
 			if (
77
-				isset( $item->menu_item_parent ) &&
77
+				isset($item->menu_item_parent) &&
78 78
 				$item->menu_item_parent &&
79
-				isset( $_return[ $item->menu_item_parent ] )
79
+				isset($_return[$item->menu_item_parent])
80 80
 			) {
81
-				$_return[ $item->menu_item_parent ]->add_child( $item );
82
-				unset( $_return[ $item_id ] );
81
+				$_return[$item->menu_item_parent]->add_child($item);
82
+				unset($_return[$item_id]);
83 83
 			}
84 84
 		}
85 85
 
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
 	 * @return int|bool
93 93
 	 */
94 94
 	protected function get_first_menu_id() {
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 ) ) {
98
-			if ( isset( $menus[0]->term_id ) ) {
97
+		if (is_array($menus) && count($menus)) {
98
+			if (isset($menus[0]->term_id)) {
99 99
 				return $menus[0]->term_id;
100 100
 			}
101 101
 		}
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
 	 * @param  int|string $arg navigation id.
111 111
 	 * @return int
112 112
 	 */
113
-	protected function get_locations_menu_id( $locations, $arg ) {
114
-		if ( is_numeric( $arg ) ) {
115
-			$arg = array_search( $arg, $locations );
113
+	protected function get_locations_menu_id($locations, $arg) {
114
+		if (is_numeric($arg)) {
115
+			$arg = array_search($arg, $locations);
116 116
 		}
117 117
 
118
-		if ( isset( $locations[ $arg ] ) ) {
119
-			$menu_id = $locations[ $arg ];
118
+		if (isset($locations[$arg])) {
119
+			$menu_id = $locations[$arg];
120 120
 
121 121
 			return $menu_id;
122 122
 		}
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @return int|boolean
131 131
 	 */
132
-	protected function check_menu_id( $menu_id ) {
133
-		$menus = get_terms( 'nav_menu', array( 'hide_empty' => true ) );
132
+	protected function check_menu_id($menu_id) {
133
+		$menus = get_terms('nav_menu', array('hide_empty' => true));
134 134
 
135
-		if ( is_array( $menus ) && count( $menus ) ) {
136
-			foreach ( $menus as $menu ) {
137
-				if ( absint( $menu->term_id ) === absint( $menu_id ) ) {
135
+		if (is_array($menus) && count($menus)) {
136
+			foreach ($menus as $menu) {
137
+				if (absint($menu->term_id) === absint($menu_id)) {
138 138
 					return $menu_id;
139 139
 				}
140 140
 			}
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
 	 *
151 151
 	 * @return int|bool
152 152
 	 */
153
-	protected function get_menu_id_by_name( $slug = null ) {
154
-		if ( $slug && is_string( $slug ) ) {
155
-			if ( $menu_id = get_term_by( 'slug', $slug, 'nav_menu' ) ) {
153
+	protected function get_menu_id_by_name($slug = null) {
154
+		if ($slug && is_string($slug)) {
155
+			if ($menu_id = get_term_by('slug', $slug, 'nav_menu')) {
156 156
 				return $menu_id;
157 157
 			}
158 158
 
159
-			if ( $menu_id = get_term_by( 'name', $slug, 'nav_menu' ) ) {
159
+			if ($menu_id = get_term_by('name', $slug, 'nav_menu')) {
160 160
 				return $menu_id;
161 161
 			}
162 162
 		}
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 	 * @return int|bool
171 171
 	 */
172 172
 	protected function get_menu_name_by_id() {
173
-		$menu_obj = wp_get_nav_menu_object( $this->ID );
173
+		$menu_obj = wp_get_nav_menu_object($this->ID);
174 174
 
175
-		if ( $menu_obj ) {
175
+		if ($menu_obj) {
176 176
 			return $menu_obj->name;
177 177
 		}
178 178
 
Please login to merge, or discard this patch.
app/classes/classy.php 1 patch
Spacing   +65 added lines, -65 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,11 +179,11 @@  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
-		$html = $renderer->render( $view, $scope );
184
+		$html = $renderer->render($view, $scope);
185 185
 
186
-		echo self::maybe_minify( $html );
186
+		echo self::maybe_minify($html);
187 187
 
188 188
 	}
189 189
 
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
 	 * @param  string $html HTML string.
194 194
 	 * @return string
195 195
 	 */
196
-	private static function maybe_minify( $html ) {
196
+	private static function maybe_minify($html) {
197 197
 
198
-		$minify_html = self::get_config_var( 'minify_html' );
198
+		$minify_html = self::get_config_var('minify_html');
199 199
 
200
-		if ( true === $minify_html ) {
200
+		if (true === $minify_html) {
201 201
 
202
-			$html = self::minify_html( $html );
202
+			$html = self::minify_html($html);
203 203
 
204 204
 		}
205 205
 
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
 	 * @param  string $html HTML string.
214 214
 	 * @return string
215 215
 	 */
216
-	private static function minify_html( $html ) {
216
+	private static function minify_html($html) {
217 217
 
218 218
 		$search = array(
219 219
 			"/\n/s",
220
-			'/\>[^\S ]+/s',  // Strip whitespaces after tags, except space.
221
-			'/[^\S ]+\</s',  // Strip whitespaces before tags, except space.
222
-			'/(\s)+/s',       // Shorten multiple whitespace sequences.
220
+			'/\>[^\S ]+/s', // Strip whitespaces after tags, except space.
221
+			'/[^\S ]+\</s', // Strip whitespaces before tags, except space.
222
+			'/(\s)+/s', // Shorten multiple whitespace sequences.
223 223
 			'/<!--(.|\s)*?-->/',
224 224
 		);
225 225
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 			'',
232 232
 		);
233 233
 
234
-		return preg_replace( $search, $replace, $html );
234
+		return preg_replace($search, $replace, $html);
235 235
 
236 236
 	}
237 237
 
@@ -256,27 +256,27 @@  discard block
 block discarded – undo
256 256
 	 *
257 257
 	 * @return array
258 258
 	 */
259
-	public static function get_posts( $args = false, $return = '\Classy\Models\Post' ) {
259
+	public static function get_posts($args = false, $return = '\Classy\Models\Post') {
260 260
 
261 261
 		$_return = array();
262 262
 
263
-		$query = Query_Helper::find_query( $args );
263
+		$query = Query_Helper::find_query($args);
264 264
 
265
-		if ( isset( $query->posts ) ) {
265
+		if (isset($query->posts)) {
266 266
 
267
-			foreach ( $query->posts as $post ) {
267
+			foreach ($query->posts as $post) {
268 268
 
269
-				if ( 'id' === $return ) {
269
+				if ('id' === $return) {
270 270
 
271 271
 					$_return[] = $post->id;
272 272
 
273
-				} elseif ( 'object' === $return ) {
273
+				} elseif ('object' === $return) {
274 274
 
275 275
 					$_return[] = $post;
276 276
 
277
-				} elseif ( class_exists( $return ) ) {
277
+				} elseif (class_exists($return)) {
278 278
 
279
-					$_return[] = new $return( $post );
279
+					$_return[] = new $return($post);
280 280
 
281 281
 				}
282 282
 			}
@@ -294,11 +294,11 @@  discard block
 block discarded – undo
294 294
 	 *
295 295
 	 * @return mixed
296 296
 	 */
297
-	public static function get_post( $args = false, $return_type = '\Classy\Models\Post' ) {
297
+	public static function get_post($args = false, $return_type = '\Classy\Models\Post') {
298 298
 
299
-		$posts = self::get_posts( $args, $return_type );
299
+		$posts = self::get_posts($args, $return_type);
300 300
 
301
-		if ( $post = reset( $posts ) ) {
301
+		if ($post = reset($posts)) {
302 302
 			return $post;
303 303
 		}
304 304
 
@@ -311,62 +311,62 @@  discard block
 block discarded – undo
311 311
 	 *
312 312
 	 * @return array mixed
313 313
 	 */
314
-	public static function get_pagination( $prefs = array() ) {
314
+	public static function get_pagination($prefs = array()) {
315 315
 
316 316
 		global $wp_query;
317 317
 		global $paged;
318 318
 		global $wp_rewrite;
319 319
 
320 320
 		$args = array();
321
-		$args['total'] = ceil( $wp_query->found_posts / $wp_query->query_vars['posts_per_page'] );
321
+		$args['total'] = ceil($wp_query->found_posts / $wp_query->query_vars['posts_per_page']);
322 322
 
323
-		if ( $wp_rewrite->using_permalinks() ) {
323
+		if ($wp_rewrite->using_permalinks()) {
324 324
 
325
-			$url = explode( '?', get_pagenum_link( 0 ) );
325
+			$url = explode('?', get_pagenum_link(0));
326 326
 
327
-			if ( isset( $url[1] ) ) {
328
-				parse_str( $url[1], $query );
327
+			if (isset($url[1])) {
328
+				parse_str($url[1], $query);
329 329
 				$args['add_args'] = $query;
330 330
 			}
331 331
 
332 332
 			$args['format'] = 'page/%#%';
333
-			$args['base'] = trailingslashit( $url[0] ).'%_%';
333
+			$args['base'] = trailingslashit($url[0]).'%_%';
334 334
 
335 335
 		} else {
336 336
 			$big = 999999999;
337
-			$args['base'] = str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) );
337
+			$args['base'] = str_replace($big, '%#%', esc_url(get_pagenum_link($big)));
338 338
 		}
339 339
 
340 340
 		$args['type'] = 'array';
341
-		$args['current'] = max( 1, get_query_var( 'paged' ) );
342
-		$args['mid_size'] = max( 9 - $args['current'], 3 );
341
+		$args['current'] = max(1, get_query_var('paged'));
342
+		$args['mid_size'] = max(9 - $args['current'], 3);
343 343
 		$args['prev_next'] = false;
344 344
 
345
-		if ( is_int( $prefs ) ) {
345
+		if (is_int($prefs)) {
346 346
 			$args['mid_size'] = $prefs - 2;
347 347
 		} else {
348
-			$args = array_merge( $args, $prefs );
348
+			$args = array_merge($args, $prefs);
349 349
 		}
350 350
 
351 351
 		$data = array();
352
-		$data['pages'] = Helper::paginate_links( $args );
353
-		$next = get_next_posts_page_link( $args['total'] );
352
+		$data['pages'] = Helper::paginate_links($args);
353
+		$next = get_next_posts_page_link($args['total']);
354 354
 
355
-		if ( $next ) {
356
-			$data['next'] = array( 'link' => untrailingslashit( $next ), 'class' => 'page-numbers next' );
355
+		if ($next) {
356
+			$data['next'] = array('link' => untrailingslashit($next), 'class' => 'page-numbers next');
357 357
 		}
358 358
 
359
-		$prev = previous_posts( false );
359
+		$prev = previous_posts(false);
360 360
 
361
-		if ( $prev ) {
362
-			$data['prev'] = array( 'link' => untrailingslashit( $prev ), 'class' => 'page-numbers prev' );
361
+		if ($prev) {
362
+			$data['prev'] = array('link' => untrailingslashit($prev), 'class' => 'page-numbers prev');
363 363
 		}
364 364
 
365
-		if ( $paged < 2 ) {
365
+		if ($paged < 2) {
366 366
 			$data['prev'] = null;
367 367
 		}
368 368
 
369
-		return Helper::array_to_object( $data );
369
+		return Helper::array_to_object($data);
370 370
 
371 371
 	}
372 372
 }
Please login to merge, or discard this patch.
app/classes/models/post.php 1 patch
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @param object|int $post WP_Post or WP_Post.ID.
100 100
 	 */
101
-	public function __construct( $post = null ) {
102
-		if ( is_integer( $post ) ) {
101
+	public function __construct($post = null) {
102
+		if (is_integer($post)) {
103 103
 			$this->ID = $post;
104 104
 			$this->init();
105
-		} elseif ( is_a( $post, '\WP_Post' ) ) {
106
-			$this->import( $post );
105
+		} elseif (is_a($post, '\WP_Post')) {
106
+			$this->import($post);
107 107
 		}
108 108
 	}
109 109
 
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 	protected function init() {
114 114
 		$post = $this->get_object();
115 115
 
116
-		if ( is_a( $post, '\WP_Post' ) ) {
117
-			$this->import( $post );
116
+		if (is_a($post, '\WP_Post')) {
117
+			$this->import($post);
118 118
 		}
119 119
 	}
120 120
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * @return \WP_Post
125 125
 	 */
126 126
 	public function get_object() {
127
-		return get_post( $this->ID );
127
+		return get_post($this->ID);
128 128
 	}
129 129
 
130 130
 	/**
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
 	 * @return boolean
134 134
 	 */
135 135
 	public function can_edit() {
136
-		if ( ! function_exists( 'current_user_can' ) ) {
136
+		if (!function_exists('current_user_can')) {
137 137
 			return false;
138 138
 		}
139
-		if ( current_user_can( 'edit_post', $this->ID ) ) {
139
+		if (current_user_can('edit_post', $this->ID)) {
140 140
 			return true;
141 141
 		}
142 142
 
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 	 * @return string
150 150
 	 */
151 151
 	public function get_edit_url() {
152
-		if ( $this->can_edit() ) {
153
-			return get_edit_post_link( $this->ID );
152
+		if ($this->can_edit()) {
153
+			return get_edit_post_link($this->ID);
154 154
 		}
155 155
 
156 156
 		return '';
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
 			'fields' => 'ids',
174 174
 		);
175 175
 
176
-		$images = get_children( $attrs );
176
+		$images = get_children($attrs);
177 177
 
178
-		if ( ! count( $images ) ) {
178
+		if (!count($images)) {
179 179
 			return false;
180 180
 		}
181 181
 
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
 
193 193
 		$images = $this->get_attached_images();
194 194
 
195
-		if ( $images ) {
195
+		if ($images) {
196 196
 
197
-			foreach ( $images as $image_id ) {
197
+			foreach ($images as $image_id) {
198 198
 
199
-				$_return[] = new Image( $image_id );
199
+				$_return[] = new Image($image_id);
200 200
 
201 201
 			}
202 202
 		}
@@ -222,13 +222,13 @@  discard block
 block discarded – undo
222 222
 			'fields' => 'ids',
223 223
 		);
224 224
 
225
-		$images = get_children( $attrs );
225
+		$images = get_children($attrs);
226 226
 
227
-		if ( ! count( $images ) ) {
227
+		if (!count($images)) {
228 228
 			return false;
229 229
 		}
230 230
 
231
-		$images = array_values( $images );
231
+		$images = array_values($images);
232 232
 
233 233
 		return $images[0];
234 234
 	}
@@ -242,8 +242,8 @@  discard block
 block discarded – undo
242 242
 
243 243
 		$image_id = $this->get_first_attached_image_id();
244 244
 
245
-		if ( $image_id ) {
246
-			return new Image( $image_id );
245
+		if ($image_id) {
246
+			return new Image($image_id);
247 247
 		}
248 248
 
249 249
 		return new Image();
@@ -255,12 +255,12 @@  discard block
 block discarded – undo
255 255
 	 * @return Image
256 256
 	 */
257 257
 	public function thumbnail() {
258
-		if ( function_exists( 'get_post_thumbnail_id' ) ) {
259
-			$image_id = get_post_thumbnail_id( $this->ID );
258
+		if (function_exists('get_post_thumbnail_id')) {
259
+			$image_id = get_post_thumbnail_id($this->ID);
260 260
 
261
-			if ( $image_id ) {
261
+			if ($image_id) {
262 262
 
263
-				return new Image( $image_id );
263
+				return new Image($image_id);
264 264
 
265 265
 			}
266 266
 		}
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 	 * @return string
275 275
 	 */
276 276
 	public function get_title() {
277
-		return apply_filters( 'the_title', $this->post_title, $this->ID );
277
+		return apply_filters('the_title', $this->post_title, $this->ID);
278 278
 	}
279 279
 
280 280
 	/**
@@ -293,24 +293,24 @@  discard block
 block discarded – undo
293 293
 	 *
294 294
 	 * @return string Post content
295 295
 	 */
296
-	public function get_content( $page = 0 ) {
297
-		if ( 0 === absint( $page ) && $this->post_content ) {
298
-			return apply_filters( 'the_content', $this->post_content );
296
+	public function get_content($page = 0) {
297
+		if (0 === absint($page) && $this->post_content) {
298
+			return apply_filters('the_content', $this->post_content);
299 299
 		}
300 300
 
301 301
 		$content = $this->post_content;
302 302
 
303
-		if ( $page ) {
304
-			$contents = explode( '<!--nextpage-->', $content );
303
+		if ($page) {
304
+			$contents = explode('<!--nextpage-->', $content);
305 305
 
306 306
 			$page--;
307 307
 
308
-			if ( count( $contents ) > $page ) {
309
-				$content = $contents[ $page ];
308
+			if (count($contents) > $page) {
309
+				$content = $contents[$page];
310 310
 			}
311 311
 		}
312 312
 
313
-		$content = apply_filters( 'the_content', ($content) );
313
+		$content = apply_filters('the_content', ($content));
314 314
 
315 315
 		return $content;
316 316
 	}
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 	 * @return object
331 331
 	 */
332 332
 	public function get_post_type() {
333
-		return get_post_type_object( $this->post_type );
333
+		return get_post_type_object($this->post_type);
334 334
 	}
335 335
 
336 336
 	/**
@@ -339,11 +339,11 @@  discard block
 block discarded – undo
339 339
 	 * @return string
340 340
 	 */
341 341
 	public function get_permalink() {
342
-		if ( isset( $this->permalink ) ) {
342
+		if (isset($this->permalink)) {
343 343
 			return $this->permalink;
344 344
 		}
345 345
 
346
-		$this->permalink = get_permalink( $this->ID );
346
+		$this->permalink = get_permalink($this->ID);
347 347
 
348 348
 		return $this->permalink;
349 349
 	}
@@ -369,84 +369,84 @@  discard block
 block discarded – undo
369 369
 	 *
370 370
 	 * @return string            Post preview.
371 371
 	 */
372
-	public function get_preview( $len = 50, $force = false, $readmore = 'Read More', $strip = true ) {
372
+	public function get_preview($len = 50, $force = false, $readmore = 'Read More', $strip = true) {
373 373
 		$text = '';
374 374
 		$trimmed = false;
375 375
 
376
-		if ( isset( $this->post_excerpt ) && strlen( $this->post_excerpt ) ) {
376
+		if (isset($this->post_excerpt) && strlen($this->post_excerpt)) {
377 377
 
378
-			if ( $force ) {
379
-				$text = Helper::trim_words( $this->post_excerpt, $len, false );
378
+			if ($force) {
379
+				$text = Helper::trim_words($this->post_excerpt, $len, false);
380 380
 				$trimmed = true;
381 381
 			} else {
382 382
 				$text = $this->post_excerpt;
383 383
 			}
384 384
 		}
385 385
 
386
-		if ( ! strlen( $text ) && preg_match( '/<!--\s?more(.*?)?-->/', $this->post_content, $readmore_matches ) ) {
386
+		if (!strlen($text) && preg_match('/<!--\s?more(.*?)?-->/', $this->post_content, $readmore_matches)) {
387 387
 
388
-			$pieces = explode( $readmore_matches[0], $this->post_content );
388
+			$pieces = explode($readmore_matches[0], $this->post_content);
389 389
 			$text = $pieces[0];
390 390
 
391
-			if ( $force ) {
392
-				$text = Helper::trim_words( $text, $len, false );
391
+			if ($force) {
392
+				$text = Helper::trim_words($text, $len, false);
393 393
 				$trimmed = true;
394 394
 			}
395 395
 
396
-			$text = do_shortcode( $text );
396
+			$text = do_shortcode($text);
397 397
 
398 398
 		}
399 399
 
400
-		if ( ! strlen( $text ) ) {
400
+		if (!strlen($text)) {
401 401
 
402
-			$text = Helper::trim_words( $this->get_content(), $len, false );
402
+			$text = Helper::trim_words($this->get_content(), $len, false);
403 403
 			$trimmed = true;
404 404
 
405 405
 		}
406 406
 
407
-		if ( ! strlen( trim( $text ) ) ) {
407
+		if (!strlen(trim($text))) {
408 408
 
409
-			return trim( $text );
409
+			return trim($text);
410 410
 
411 411
 		}
412 412
 
413
-		if ( $strip ) {
413
+		if ($strip) {
414 414
 
415
-			$text = trim( strip_tags( $text ) );
415
+			$text = trim(strip_tags($text));
416 416
 
417 417
 		}
418 418
 
419
-		if ( strlen( $text ) ) {
419
+		if (strlen($text)) {
420 420
 
421
-			$text = trim( $text );
422
-			$last = $text[ strlen( $text ) - 1 ];
421
+			$text = trim($text);
422
+			$last = $text[strlen($text) - 1];
423 423
 
424
-			if ( '.' !== $last && $trimmed ) {
424
+			if ('.' !== $last && $trimmed) {
425 425
 				$text .= ' &hellip; ';
426 426
 			}
427 427
 
428
-			if ( ! $strip ) {
429
-				$last_p_tag = strrpos( $text, '</p>' );
430
-				if ( false !== $last_p_tag ) {
431
-					$text = substr( $text, 0, $last_p_tag );
428
+			if (!$strip) {
429
+				$last_p_tag = strrpos($text, '</p>');
430
+				if (false !== $last_p_tag) {
431
+					$text = substr($text, 0, $last_p_tag);
432 432
 				}
433
-				if ( '.' !== $last && $trimmed ) {
433
+				if ('.' !== $last && $trimmed) {
434 434
 					$text .= ' &hellip; ';
435 435
 				}
436 436
 			}
437 437
 
438
-			if ( $readmore && isset( $readmore_matches ) && ! empty( $readmore_matches[1] ) ) {
439
-				$text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim( $readmore_matches[1] ) . '</a>';
440
-			} elseif ( $readmore ) {
441
-				$text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim( $readmore ) . '</a>';
438
+			if ($readmore && isset($readmore_matches) && !empty($readmore_matches[1])) {
439
+				$text .= ' <a href="'.$this->get_permalink().'" class="read-more">'.trim($readmore_matches[1]).'</a>';
440
+			} elseif ($readmore) {
441
+				$text .= ' <a href="'.$this->get_permalink().'" class="read-more">'.trim($readmore).'</a>';
442 442
 			}
443 443
 
444
-			if ( ! $strip ) {
444
+			if (!$strip) {
445 445
 				$text .= '</p>';
446 446
 			}
447 447
 		}
448 448
 
449
-		return trim( $text );
449
+		return trim($text);
450 450
 	}
451 451
 
452 452
 	/**
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 	 *
458 458
 	 * @return array
459 459
 	 */
460
-	public function get_comments( $status = 'approve', $order = 'DESC' ) {
460
+	public function get_comments($status = 'approve', $order = 'DESC') {
461 461
 
462 462
 		$_return = array();
463 463
 
@@ -467,25 +467,25 @@  discard block
 block discarded – undo
467 467
 			'order' => $order,
468 468
 		);
469 469
 
470
-		$comments = get_comments( $args );
470
+		$comments = get_comments($args);
471 471
 
472
-		foreach ( $comments as $comment ) {
472
+		foreach ($comments as $comment) {
473 473
 
474
-			$_return[ $comment->comment_ID ] = new Comment( $comment );
474
+			$_return[$comment->comment_ID] = new Comment($comment);
475 475
 
476 476
 		}
477 477
 
478
-		foreach ( $_return as $key => $comment ) {
478
+		foreach ($_return as $key => $comment) {
479 479
 
480
-			if ( $comment->has_parent() ) {
480
+			if ($comment->has_parent()) {
481 481
 
482
-				$_return[ $comment->comment_parent ]->add_child( $comment );
482
+				$_return[$comment->comment_parent]->add_child($comment);
483 483
 
484
-				unset( $_return[ $key ] );
484
+				unset($_return[$key]);
485 485
 
486 486
 			}
487 487
 		}
488 488
 
489
-		return array_values( $_return );
489
+		return array_values($_return);
490 490
 	}
491 491
 }
Please login to merge, or discard this patch.