@@ -109,21 +109,21 @@ |
||
| 109 | 109 | * |
| 110 | 110 | * @return boolean |
| 111 | 111 | */ |
| 112 | - public function can_edit() { |
|
| 113 | - if ( !function_exists( 'current_user_can' ) ) { |
|
| 114 | - return false; |
|
| 115 | - } |
|
| 116 | - if ( current_user_can( 'edit_post', $this->ID ) ) { |
|
| 117 | - return true; |
|
| 118 | - } |
|
| 119 | - return false; |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - /** |
|
| 123 | - * Returns the Post Edit url |
|
| 124 | - * |
|
| 125 | - * @return string |
|
| 126 | - */ |
|
| 112 | + public function can_edit() { |
|
| 113 | + if ( !function_exists( 'current_user_can' ) ) { |
|
| 114 | + return false; |
|
| 115 | + } |
|
| 116 | + if ( current_user_can( 'edit_post', $this->ID ) ) { |
|
| 117 | + return true; |
|
| 118 | + } |
|
| 119 | + return false; |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + /** |
|
| 123 | + * Returns the Post Edit url |
|
| 124 | + * |
|
| 125 | + * @return string |
|
| 126 | + */ |
|
| 127 | 127 | public function get_edit_url() { |
| 128 | 128 | if ( $this->can_edit() ) { |
| 129 | 129 | return get_edit_post_link($this->ID); |
@@ -258,7 +258,8 @@ discard block |
||
| 258 | 258 | if ( $force ) { |
| 259 | 259 | $text = ClassyHelper::trim_words($this->post_excerpt, $len, false); |
| 260 | 260 | $trimmed = true; |
| 261 | - } else { |
|
| 261 | + } |
|
| 262 | + else { |
|
| 262 | 263 | $text = $this->post_excerpt; |
| 263 | 264 | } |
| 264 | 265 | |
@@ -318,7 +319,8 @@ discard block |
||
| 318 | 319 | |
| 319 | 320 | if ( $readmore && isset($readmore_matches) && !empty($readmore_matches[1]) ) { |
| 320 | 321 | $text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim($readmore_matches[1]) . '</a>'; |
| 321 | - } elseif ( $readmore ) { |
|
| 322 | + } |
|
| 323 | + elseif ( $readmore ) { |
|
| 322 | 324 | $text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim($readmore) . '</a>'; |
| 323 | 325 | } |
| 324 | 326 | |
@@ -43,7 +43,8 @@ |
||
| 43 | 43 | |
| 44 | 44 | wp_register_script( 'theme_plugins', THEME_DIR . 'assets/js/min/production.js', array( 'jquery' ), THEME_VERSION, true ); |
| 45 | 45 | |
| 46 | - } else { |
|
| 46 | + } |
|
| 47 | + else { |
|
| 47 | 48 | |
| 48 | 49 | wp_register_script( 'theme_plugins', THEME_DIR . 'assets/js/plugins.js', array( 'jquery' ), THEME_VERSION, true ); |
| 49 | 50 | |
@@ -36,13 +36,13 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public static function get_current_query() { |
| 38 | 38 | |
| 39 | - global $wp_query; |
|
| 39 | + global $wp_query; |
|
| 40 | 40 | |
| 41 | - $query =& $wp_query; |
|
| 41 | + $query =& $wp_query; |
|
| 42 | 42 | |
| 43 | - $query = self::handle_maybe_custom_posts_page($query); |
|
| 43 | + $query = self::handle_maybe_custom_posts_page($query); |
|
| 44 | 44 | |
| 45 | - return $query; |
|
| 45 | + return $query; |
|
| 46 | 46 | |
| 47 | 47 | } |
| 48 | 48 | |
@@ -52,20 +52,20 @@ discard block |
||
| 52 | 52 | * @param object $query WP_Query |
| 53 | 53 | * @return object WP_Query |
| 54 | 54 | */ |
| 55 | - private static function handle_maybe_custom_posts_page( $query ) { |
|
| 55 | + private static function handle_maybe_custom_posts_page( $query ) { |
|
| 56 | 56 | |
| 57 | - if ($custom_posts_page = get_option('page_for_posts')) { |
|
| 57 | + if ($custom_posts_page = get_option('page_for_posts')) { |
|
| 58 | 58 | |
| 59 | - if ( isset($query->query['p']) && $query->query['p'] == $custom_posts_page ) { |
|
| 59 | + if ( isset($query->query['p']) && $query->query['p'] == $custom_posts_page ) { |
|
| 60 | 60 | |
| 61 | - return new WP_Query(array('post_type' => 'post')); |
|
| 61 | + return new WP_Query(array('post_type' => 'post')); |
|
| 62 | 62 | |
| 63 | - } |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - } |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - return $query; |
|
| 67 | + return $query; |
|
| 68 | 68 | |
| 69 | - } |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | 71 | } |
| 72 | 72 | \ No newline at end of file |
@@ -16,13 +16,15 @@ |
||
| 16 | 16 | |
| 17 | 17 | return self::get_current_query(); |
| 18 | 18 | |
| 19 | - } elseif (is_array($args)) { |
|
| 19 | + } |
|
| 20 | + elseif (is_array($args)) { |
|
| 20 | 21 | |
| 21 | 22 | $args = array_merge($default_args, $args); |
| 22 | 23 | |
| 23 | 24 | return new WP_Query($args); |
| 24 | 25 | |
| 25 | - } else { |
|
| 26 | + } |
|
| 27 | + else { |
|
| 26 | 28 | |
| 27 | 29 | return new WP_Query($default_args); |
| 28 | 30 | |
@@ -6,36 +6,36 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ClassyBasis { |
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * Imports data params into the class instance |
|
| 11 | - * |
|
| 12 | - * @param object/array $data |
|
| 13 | - * @return void |
|
| 14 | - */ |
|
| 9 | + /** |
|
| 10 | + * Imports data params into the class instance |
|
| 11 | + * |
|
| 12 | + * @param object/array $data |
|
| 13 | + * @return void |
|
| 14 | + */ |
|
| 15 | 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 | - foreach ( $data as $key => $value ) { |
|
| 25 | + foreach ( $data as $key => $value ) { |
|
| 26 | 26 | |
| 27 | - if ( !empty( $key ) ) { |
|
| 27 | + if ( !empty( $key ) ) { |
|
| 28 | 28 | |
| 29 | - $this->$key = $value; |
|
| 29 | + $this->$key = $value; |
|
| 30 | 30 | |
| 31 | - } else if ( !empty( $key ) && !method_exists($this, $key) ){ |
|
| 31 | + } else if ( !empty( $key ) && !method_exists($this, $key) ){ |
|
| 32 | 32 | |
| 33 | - $this->$key = $value; |
|
| 33 | + $this->$key = $value; |
|
| 34 | 34 | |
| 35 | - } |
|
| 36 | - } |
|
| 35 | + } |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - } |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | } |
| 41 | 41 | |
@@ -28,7 +28,8 @@ |
||
| 28 | 28 | |
| 29 | 29 | $this->$key = $value; |
| 30 | 30 | |
| 31 | - } else if ( !empty( $key ) && !method_exists($this, $key) ){ |
|
| 31 | + } |
|
| 32 | + else if ( !empty( $key ) && !method_exists($this, $key) ) { |
|
| 32 | 33 | |
| 33 | 34 | $this->$key = $value; |
| 34 | 35 | |
@@ -29,7 +29,8 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | $menu_id = $this->check_menu_id($arg); |
| 31 | 31 | |
| 32 | - } elseif (is_string($arg)) { |
|
| 32 | + } |
|
| 33 | + elseif (is_string($arg)) { |
|
| 33 | 34 | |
| 34 | 35 | $menu_id = $this->get_menu_id_by_name($arg); |
| 35 | 36 | |
@@ -148,11 +149,15 @@ discard block |
||
| 148 | 149 | |
| 149 | 150 | $menu_id = get_term_by('slug', $slug, 'nav_menu'); |
| 150 | 151 | |
| 151 | - if ($menu_id) return $menu_id; |
|
| 152 | + if ($menu_id) { |
|
| 153 | + return $menu_id; |
|
| 154 | + } |
|
| 152 | 155 | |
| 153 | 156 | $menu_id = get_term_by('name', $slug, 'nav_menu'); |
| 154 | 157 | |
| 155 | - if ($menu_id) return $menu_id; |
|
| 158 | + if ($menu_id) { |
|
| 159 | + return $menu_id; |
|
| 160 | + } |
|
| 156 | 161 | |
| 157 | 162 | } |
| 158 | 163 | |
@@ -146,7 +146,9 @@ discard block |
||
| 146 | 146 | public static function get_config_var($name) { |
| 147 | 147 | $vars = ClassyConfig::get_vars(); |
| 148 | 148 | |
| 149 | - if (isset($vars[$name])) return $vars[$name]; |
|
| 149 | + if (isset($vars[$name])) { |
|
| 150 | + return $vars[$name]; |
|
| 151 | + } |
|
| 150 | 152 | |
| 151 | 153 | return false; |
| 152 | 154 | } |
@@ -207,11 +209,13 @@ discard block |
||
| 207 | 209 | |
| 208 | 210 | $_return[] = new ClassyPost($post_id); |
| 209 | 211 | |
| 210 | - } elseif($return_type == 'object') { |
|
| 212 | + } |
|
| 213 | + elseif($return_type == 'object') { |
|
| 211 | 214 | |
| 212 | 215 | $_return[] = get_post($post_id); |
| 213 | 216 | |
| 214 | - } else { |
|
| 217 | + } |
|
| 218 | + else { |
|
| 215 | 219 | |
| 216 | 220 | $_return[] = $post_id; |
| 217 | 221 | |
@@ -263,7 +267,8 @@ discard block |
||
| 263 | 267 | $args['format'] = 'page/%#%'; |
| 264 | 268 | $args['base'] = trailingslashit( $url[0] ).'%_%'; |
| 265 | 269 | |
| 266 | - } else { |
|
| 270 | + } |
|
| 271 | + else { |
|
| 267 | 272 | $big = 999999999; |
| 268 | 273 | $args['base'] = str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ); |
| 269 | 274 | } |
@@ -275,7 +280,8 @@ discard block |
||
| 275 | 280 | |
| 276 | 281 | if ( is_int( $prefs ) ) { |
| 277 | 282 | $args['mid_size'] = $prefs - 2; |
| 278 | - } else { |
|
| 283 | + } |
|
| 284 | + else { |
|
| 279 | 285 | $args = array_merge( $args, $prefs ); |
| 280 | 286 | } |
| 281 | 287 | |
@@ -155,7 +155,8 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | list( $type, $subtype ) = explode( '/', $attachment->post_mime_type ); |
| 157 | 157 | |
| 158 | - } else { |
|
| 158 | + } |
|
| 159 | + else { |
|
| 159 | 160 | |
| 160 | 161 | list( $type, $subtype ) = array( $attachment->post_mime_type, '' ); |
| 161 | 162 | |
@@ -208,18 +209,22 @@ discard block |
||
| 208 | 209 | if ( ! $pagename && $id ) { |
| 209 | 210 | // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object |
| 210 | 211 | $post = get_queried_object(); |
| 211 | - if ( $post ) |
|
| 212 | - $pagename = $post->post_name; |
|
| 212 | + if ( $post ) { |
|
| 213 | + $pagename = $post->post_name; |
|
| 214 | + } |
|
| 213 | 215 | } |
| 214 | 216 | |
| 215 | 217 | $template = get_post_meta('theme-page-template', $id); |
| 216 | 218 | |
| 217 | - if ( $template != 'index' ) |
|
| 218 | - $templates[] = $template; |
|
| 219 | - if ( $pagename ) |
|
| 220 | - $templates[] = "page-$pagename"; |
|
| 221 | - if ( $id ) |
|
| 222 | - $templates[] = "page-$id"; |
|
| 219 | + if ( $template != 'index' ) { |
|
| 220 | + $templates[] = $template; |
|
| 221 | + } |
|
| 222 | + if ( $pagename ) { |
|
| 223 | + $templates[] = "page-$pagename"; |
|
| 224 | + } |
|
| 225 | + if ( $id ) { |
|
| 226 | + $templates[] = "page-$id"; |
|
| 227 | + } |
|
| 223 | 228 | $templates[] = ''; |
| 224 | 229 | |
| 225 | 230 | // Page |
@@ -235,24 +240,30 @@ discard block |
||
| 235 | 240 | if ( ! $pagename && $id ) { |
| 236 | 241 | // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object |
| 237 | 242 | $post = get_queried_object(); |
| 238 | - if ( $post ) |
|
| 239 | - $pagename = $post->post_name; |
|
| 243 | + if ( $post ) { |
|
| 244 | + $pagename = $post->post_name; |
|
| 245 | + } |
|
| 240 | 246 | } |
| 241 | 247 | |
| 242 | - if ( $template != 'index' ) |
|
| 243 | - $templates[] = $template; |
|
| 244 | - if ( $pagename ) |
|
| 245 | - $templates[] = "page-$pagename"; |
|
| 246 | - if ( $id ) |
|
| 247 | - $templates[] = "page-$id"; |
|
| 248 | + if ( $template != 'index' ) { |
|
| 249 | + $templates[] = $template; |
|
| 250 | + } |
|
| 251 | + if ( $pagename ) { |
|
| 252 | + $templates[] = "page-$pagename"; |
|
| 253 | + } |
|
| 254 | + if ( $id ) { |
|
| 255 | + $templates[] = "page-$id"; |
|
| 256 | + } |
|
| 248 | 257 | $templates[] = 'page'; |
| 249 | 258 | |
| 250 | 259 | |
| 251 | 260 | // Default |
| 252 | 261 | |
| 253 | - else: |
|
| 262 | + else { |
|
| 263 | + : |
|
| 254 | 264 | |
| 255 | 265 | $templates[] = $type; |
| 266 | + } |
|
| 256 | 267 | |
| 257 | 268 | endif; |
| 258 | 269 | |
@@ -301,9 +312,11 @@ discard block |
||
| 301 | 312 | |
| 302 | 313 | elseif ( is_paged() && $template = self::get_available_template('paged') ) : |
| 303 | 314 | |
| 304 | - else : |
|
| 315 | + else { |
|
| 316 | + : |
|
| 305 | 317 | |
| 306 | 318 | $template = 'index'; |
| 319 | + } |
|
| 307 | 320 | |
| 308 | 321 | endif; |
| 309 | 322 | |
@@ -324,7 +337,8 @@ discard block |
||
| 324 | 337 | |
| 325 | 338 | return $template; |
| 326 | 339 | |
| 327 | - } else { |
|
| 340 | + } |
|
| 341 | + else { |
|
| 328 | 342 | |
| 329 | 343 | return $template . '.' . $template; |
| 330 | 344 | |
@@ -378,13 +392,15 @@ discard block |
||
| 378 | 392 | |
| 379 | 393 | $scope = array_merge($common_scope, $data); |
| 380 | 394 | |
| 381 | - } else { |
|
| 395 | + } |
|
| 396 | + else { |
|
| 382 | 397 | |
| 383 | 398 | $scope = $common_scope; |
| 384 | 399 | |
| 385 | 400 | } |
| 386 | 401 | |
| 387 | - } else { |
|
| 402 | + } |
|
| 403 | + else { |
|
| 388 | 404 | |
| 389 | 405 | $current_page = self::get_current_page(); |
| 390 | 406 | |