@@ -12,7 +12,7 @@ |
||
| 12 | 12 | /** |
| 13 | 13 | * Returns list of allowed variables that can be used in theme config |
| 14 | 14 | * |
| 15 | - * @return array |
|
| 15 | + * @return string[] |
|
| 16 | 16 | */ |
| 17 | 17 | private static function get_allowed_variables() { |
| 18 | 18 | |
@@ -12,6 +12,7 @@ |
||
| 12 | 12 | /** |
| 13 | 13 | * Returns basic scope |
| 14 | 14 | * |
| 15 | + * @param string $template_name |
|
| 15 | 16 | * @return array |
| 16 | 17 | */ |
| 17 | 18 | public static function get_scope($template_name = null) { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * Returns template name for render, based on type of request |
| 53 | 53 | * |
| 54 | 54 | * @param string $type |
| 55 | - * @return array |
|
| 55 | + * @return string|false |
|
| 56 | 56 | */ |
| 57 | 57 | public static function get_available_template($type) { |
| 58 | 58 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * Returns list of templates to check, based on type of request |
| 78 | 78 | * |
| 79 | 79 | * @param string $type |
| 80 | - * @return array |
|
| 80 | + * @return string[] |
|
| 81 | 81 | */ |
| 82 | 82 | private static function get_request_templates_list($type) { |
| 83 | 83 | |
@@ -336,6 +336,7 @@ discard block |
||
| 336 | 336 | /** |
| 337 | 337 | * Returns available template, based on page argument |
| 338 | 338 | * |
| 339 | + * @param string $page |
|
| 339 | 340 | * @return string |
| 340 | 341 | */ |
| 341 | 342 | public static function get_blade_template($page = null) { |
@@ -54,6 +54,7 @@ discard block |
||
| 54 | 54 | * |
| 55 | 55 | * @param string |
| 56 | 56 | * @param string |
| 57 | + * @param string $name |
|
| 57 | 58 | */ |
| 58 | 59 | private function define( $name, $value ) { |
| 59 | 60 | if ( !defined($name) ) { |
@@ -241,7 +242,7 @@ discard block |
||
| 241 | 242 | |
| 242 | 243 | /** |
| 243 | 244 | * @param array $prefs |
| 244 | - * @return array mixed |
|
| 245 | + * @return stdClass mixed |
|
| 245 | 246 | */ |
| 246 | 247 | public static function get_pagination( $prefs = array() ) { |
| 247 | 248 | global $wp_query; |
@@ -61,6 +61,9 @@ |
||
| 61 | 61 | $this->init(); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | + /** |
|
| 65 | + * @param integer|null $uid |
|
| 66 | + */ |
|
| 64 | 67 | private function verify_id($uid) { |
| 65 | 68 | return $uid; |
| 66 | 69 | } |
@@ -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); |
@@ -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 |
@@ -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 | |
@@ -245,58 +245,58 @@ |
||
| 245 | 245 | */ |
| 246 | 246 | public static function get_archives_title() { |
| 247 | 247 | |
| 248 | - $archives_title = ''; |
|
| 248 | + $archives_title = ''; |
|
| 249 | 249 | |
| 250 | - if ( is_category() ) { |
|
| 250 | + if ( is_category() ) { |
|
| 251 | 251 | |
| 252 | - $archives_title = single_cat_title( '', false ); |
|
| 252 | + $archives_title = single_cat_title( '', false ); |
|
| 253 | 253 | |
| 254 | - } else if ( is_tag() ) { |
|
| 254 | + } else if ( is_tag() ) { |
|
| 255 | 255 | |
| 256 | - $archives_title = 'Tag: ' . single_tag_title( '', false ); |
|
| 256 | + $archives_title = 'Tag: ' . single_tag_title( '', false ); |
|
| 257 | 257 | |
| 258 | - } else if ( is_author() ) { |
|
| 258 | + } else if ( is_author() ) { |
|
| 259 | 259 | |
| 260 | - if ( have_posts() ) { |
|
| 260 | + if ( have_posts() ) { |
|
| 261 | 261 | |
| 262 | - the_post(); |
|
| 263 | - $archives_title = 'Author: ' . get_the_author(); |
|
| 262 | + the_post(); |
|
| 263 | + $archives_title = 'Author: ' . get_the_author(); |
|
| 264 | 264 | |
| 265 | - } |
|
| 265 | + } |
|
| 266 | 266 | |
| 267 | - rewind_posts(); |
|
| 267 | + rewind_posts(); |
|
| 268 | 268 | |
| 269 | - } else if ( is_search() ) { |
|
| 269 | + } else if ( is_search() ) { |
|
| 270 | 270 | |
| 271 | - $archives_title = sprintf( __( 'Search Results for: %s', 'flotheme' ), '<span>' . get_search_query() . '</span>' ); |
|
| 271 | + $archives_title = sprintf( __( 'Search Results for: %s', 'flotheme' ), '<span>' . get_search_query() . '</span>' ); |
|
| 272 | 272 | |
| 273 | - } else if ( is_archive() ) { |
|
| 273 | + } else if ( is_archive() ) { |
|
| 274 | 274 | |
| 275 | - if ( is_day() ) { |
|
| 275 | + if ( is_day() ) { |
|
| 276 | 276 | |
| 277 | - $archives_title = get_the_date(); |
|
| 277 | + $archives_title = get_the_date(); |
|
| 278 | 278 | |
| 279 | - } elseif ( is_month() ) { |
|
| 279 | + } elseif ( is_month() ) { |
|
| 280 | 280 | |
| 281 | - $archives_title = get_the_date( _x( 'F Y', 'monthly archives date format', 'flotheme')); |
|
| 281 | + $archives_title = get_the_date( _x( 'F Y', 'monthly archives date format', 'flotheme')); |
|
| 282 | 282 | |
| 283 | - } elseif ( is_year() ) { |
|
| 283 | + } elseif ( is_year() ) { |
|
| 284 | 284 | |
| 285 | - $archives_title = get_the_date( _x( 'Y', 'yearly archives date format', 'flotheme')); |
|
| 285 | + $archives_title = get_the_date( _x( 'Y', 'yearly archives date format', 'flotheme')); |
|
| 286 | 286 | |
| 287 | - } else { |
|
| 287 | + } else { |
|
| 288 | 288 | |
| 289 | - $archives_title = 'Archives'; |
|
| 289 | + $archives_title = 'Archives'; |
|
| 290 | 290 | |
| 291 | - } |
|
| 291 | + } |
|
| 292 | 292 | |
| 293 | - } else { |
|
| 293 | + } else { |
|
| 294 | 294 | |
| 295 | - $archives_title = 'Archives'; |
|
| 295 | + $archives_title = 'Archives'; |
|
| 296 | 296 | |
| 297 | - } |
|
| 297 | + } |
|
| 298 | 298 | |
| 299 | - return $archives_title; |
|
| 299 | + return $archives_title; |
|
| 300 | 300 | |
| 301 | 301 | } |
| 302 | 302 | |