@@ -14,8 +14,9 @@ discard block |
||
| 14 | 14 | class LSX_TEAM_SCPO_Engine { |
| 15 | 15 | |
| 16 | 16 | public function __construct() { |
| 17 | - if ( ! get_option( 'lsx_team_scporder_install' ) ) |
|
| 18 | - $this->lsx_team_scporder_install(); |
|
| 17 | + if ( ! get_option( 'lsx_team_scporder_install' ) ) { |
|
| 18 | + $this->lsx_team_scporder_install(); |
|
| 19 | + } |
|
| 19 | 20 | |
| 20 | 21 | add_action( 'admin_init', array( $this, 'refresh' ) ); |
| 21 | 22 | add_action( 'admin_init', array( $this, 'load_script_css' ) ); |
@@ -52,11 +53,13 @@ discard block |
||
| 52 | 53 | $objects = $this->get_lsx_team_scporder_options_objects(); |
| 53 | 54 | $tags = $this->get_lsx_team_scporder_options_tags(); |
| 54 | 55 | |
| 55 | - if ( empty( $objects ) && empty( $tags ) ) |
|
| 56 | - return false; |
|
| 56 | + if ( empty( $objects ) && empty( $tags ) ) { |
|
| 57 | + return false; |
|
| 58 | + } |
|
| 57 | 59 | |
| 58 | - if ( isset( $_GET['orderby'] ) || strstr( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'action=edit' ) || strstr( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'wp-admin/post-new.php' ) ) |
|
| 59 | - return false; |
|
| 60 | + if ( isset( $_GET['orderby'] ) || strstr( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'action=edit' ) || strstr( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'wp-admin/post-new.php' ) ) { |
|
| 61 | + return false; |
|
| 62 | + } |
|
| 60 | 63 | |
| 61 | 64 | if ( ! empty( $objects ) ) { |
| 62 | 65 | if ( isset( $_GET['post_type'] ) && ! isset( $_GET['taxonomy'] ) && array_key_exists( sanitize_text_field( wp_unslash( $_GET['post_type'] ) ), $objects ) ) { // if page or custom post types. |
@@ -104,8 +107,9 @@ discard block |
||
| 104 | 107 | WHERE post_type = '%s' AND post_status IN ( 'publish', 'pending', 'draft', 'private', 'future' ) |
| 105 | 108 | ", $object ) ); |
| 106 | 109 | |
| 107 | - if ( 0 == $result[0]->cnt || $result[0]->cnt == $result[0]->max ) |
|
| 108 | - continue; |
|
| 110 | + if ( 0 == $result[0]->cnt || $result[0]->cnt == $result[0]->max ) { |
|
| 111 | + continue; |
|
| 112 | + } |
|
| 109 | 113 | |
| 110 | 114 | $results = $wpdb->get_results( $wpdb->prepare( " |
| 111 | 115 | SELECT ID |
@@ -136,8 +140,9 @@ discard block |
||
| 136 | 140 | WHERE term_taxonomy.taxonomy = '%s' |
| 137 | 141 | ", $taxonomy ) ); |
| 138 | 142 | |
| 139 | - if ( 0 == $result[0]->cnt || $result[0]->cnt == $result[0]->max ) |
|
| 140 | - continue; |
|
| 143 | + if ( 0 == $result[0]->cnt || $result[0]->cnt == $result[0]->max ) { |
|
| 144 | + continue; |
|
| 145 | + } |
|
| 141 | 146 | |
| 142 | 147 | $results = $wpdb->get_results( $wpdb->prepare( " |
| 143 | 148 | SELECT terms.term_id |
@@ -169,8 +174,9 @@ discard block |
||
| 169 | 174 | |
| 170 | 175 | parse_str( sanitize_text_field( wp_unslash( $_POST['order'] ) ), $data ); |
| 171 | 176 | |
| 172 | - if ( ! is_array( $data ) ) |
|
| 173 | - return false; |
|
| 177 | + if ( ! is_array( $data ) ) { |
|
| 178 | + return false; |
|
| 179 | + } |
|
| 174 | 180 | |
| 175 | 181 | $id_arr = array(); |
| 176 | 182 | |
@@ -212,8 +218,9 @@ discard block |
||
| 212 | 218 | |
| 213 | 219 | parse_str( sanitize_text_field( wp_unslash( $_POST['order'] ) ), $data ); |
| 214 | 220 | |
| 215 | - if ( ! is_array( $data ) ) |
|
| 216 | - return false; |
|
| 221 | + if ( ! is_array( $data ) ) { |
|
| 222 | + return false; |
|
| 223 | + } |
|
| 217 | 224 | |
| 218 | 225 | $id_arr = array(); |
| 219 | 226 | |
@@ -255,8 +262,9 @@ discard block |
||
| 255 | 262 | global $post; |
| 256 | 263 | $objects = $this->get_lsx_team_scporder_options_objects(); |
| 257 | 264 | |
| 258 | - if ( empty( $objects ) ) |
|
| 259 | - return $where; |
|
| 265 | + if ( empty( $objects ) ) { |
|
| 266 | + return $where; |
|
| 267 | + } |
|
| 260 | 268 | |
| 261 | 269 | if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) { |
| 262 | 270 | $current_menu_order = $post->menu_order; |
@@ -270,8 +278,9 @@ discard block |
||
| 270 | 278 | global $post; |
| 271 | 279 | $objects = $this->get_lsx_team_scporder_options_objects(); |
| 272 | 280 | |
| 273 | - if ( empty( $objects ) ) |
|
| 274 | - return $orderby; |
|
| 281 | + if ( empty( $objects ) ) { |
|
| 282 | + return $orderby; |
|
| 283 | + } |
|
| 275 | 284 | |
| 276 | 285 | if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) { |
| 277 | 286 | $orderby = 'ORDER BY p.menu_order ASC LIMIT 1'; |
@@ -284,8 +293,9 @@ discard block |
||
| 284 | 293 | global $post; |
| 285 | 294 | $objects = $this->get_lsx_team_scporder_options_objects(); |
| 286 | 295 | |
| 287 | - if ( empty( $objects ) ) |
|
| 288 | - return $where; |
|
| 296 | + if ( empty( $objects ) ) { |
|
| 297 | + return $where; |
|
| 298 | + } |
|
| 289 | 299 | |
| 290 | 300 | if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) { |
| 291 | 301 | $current_menu_order = $post->menu_order; |
@@ -299,8 +309,9 @@ discard block |
||
| 299 | 309 | global $post; |
| 300 | 310 | $objects = $this->get_lsx_team_scporder_options_objects(); |
| 301 | 311 | |
| 302 | - if ( empty( $objects ) ) |
|
| 303 | - return $orderby; |
|
| 312 | + if ( empty( $objects ) ) { |
|
| 313 | + return $orderby; |
|
| 314 | + } |
|
| 304 | 315 | |
| 305 | 316 | if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) { |
| 306 | 317 | $orderby = 'ORDER BY p.menu_order DESC LIMIT 1'; |
@@ -312,8 +323,9 @@ discard block |
||
| 312 | 323 | public function lsx_team_scporder_pre_get_posts( $wp_query ) { |
| 313 | 324 | $objects = $this->get_lsx_team_scporder_options_objects(); |
| 314 | 325 | |
| 315 | - if ( empty( $objects ) ) |
|
| 316 | - return false; |
|
| 326 | + if ( empty( $objects ) ) { |
|
| 327 | + return false; |
|
| 328 | + } |
|
| 317 | 329 | |
| 318 | 330 | if ( is_admin() ) { |
| 319 | 331 | if ( isset( $wp_query->query['post_type'] ) && ! isset( $_GET['orderby'] ) ) { |
@@ -337,37 +349,46 @@ discard block |
||
| 337 | 349 | } |
| 338 | 350 | } |
| 339 | 351 | |
| 340 | - if ( ! $active ) |
|
| 341 | - return false; |
|
| 352 | + if ( ! $active ) { |
|
| 353 | + return false; |
|
| 354 | + } |
|
| 342 | 355 | |
| 343 | 356 | if ( isset( $wp_query->query['suppress_filters'] ) ) { |
| 344 | - if ( $wp_query->get( 'orderby' ) == 'date' ) |
|
| 345 | - $wp_query->set( 'orderby', 'menu_order' ); |
|
| 346 | - if ( $wp_query->get( 'order' ) == 'DESC' ) |
|
| 347 | - $wp_query->set( 'order', 'ASC' ); |
|
| 357 | + if ( $wp_query->get( 'orderby' ) == 'date' ) { |
|
| 358 | + $wp_query->set( 'orderby', 'menu_order' ); |
|
| 359 | + } |
|
| 360 | + if ( $wp_query->get( 'order' ) == 'DESC' ) { |
|
| 361 | + $wp_query->set( 'order', 'ASC' ); |
|
| 362 | + } |
|
| 348 | 363 | } else { |
| 349 | - if ( ! $wp_query->get( 'orderby' ) ) |
|
| 350 | - $wp_query->set( 'orderby', 'menu_order' ); |
|
| 351 | - if ( ! $wp_query->get( 'order' ) ) |
|
| 352 | - $wp_query->set( 'order', 'ASC' ); |
|
| 364 | + if ( ! $wp_query->get( 'orderby' ) ) { |
|
| 365 | + $wp_query->set( 'orderby', 'menu_order' ); |
|
| 366 | + } |
|
| 367 | + if ( ! $wp_query->get( 'order' ) ) { |
|
| 368 | + $wp_query->set( 'order', 'ASC' ); |
|
| 369 | + } |
|
| 353 | 370 | } |
| 354 | 371 | } |
| 355 | 372 | } |
| 356 | 373 | |
| 357 | 374 | public function lsx_team_scporder_get_terms_orderby( $orderby, $args ) { |
| 358 | - if ( is_admin() ) |
|
| 359 | - return $orderby; |
|
| 375 | + if ( is_admin() ) { |
|
| 376 | + return $orderby; |
|
| 377 | + } |
|
| 360 | 378 | |
| 361 | 379 | $tags = $this->get_lsx_team_scporder_options_tags(); |
| 362 | 380 | |
| 363 | - if ( ! isset( $args['taxonomy'] ) ) |
|
| 364 | - return $orderby; |
|
| 381 | + if ( ! isset( $args['taxonomy'] ) ) { |
|
| 382 | + return $orderby; |
|
| 383 | + } |
|
| 365 | 384 | |
| 366 | 385 | $taxonomy = $args['taxonomy']; |
| 367 | - if ( is_array( $taxonomy ) && count( $taxonomy ) == 1 ) |
|
| 368 | - $taxonomy = $taxonomy[0]; |
|
| 369 | - if ( ! array_key_exists( $taxonomy[0], $tags ) ) |
|
| 370 | - return $orderby; |
|
| 386 | + if ( is_array( $taxonomy ) && count( $taxonomy ) == 1 ) { |
|
| 387 | + $taxonomy = $taxonomy[0]; |
|
| 388 | + } |
|
| 389 | + if ( ! array_key_exists( $taxonomy[0], $tags ) ) { |
|
| 390 | + return $orderby; |
|
| 391 | + } |
|
| 371 | 392 | |
| 372 | 393 | $orderby = 't.lsx_team_term_order'; |
| 373 | 394 | return $orderby; |
@@ -376,14 +397,16 @@ discard block |
||
| 376 | 397 | public function lsx_team_scporder_get_object_terms( $terms ) { |
| 377 | 398 | $tags = $this->get_lsx_team_scporder_options_tags(); |
| 378 | 399 | |
| 379 | - if ( is_admin() && isset( $_GET['orderby'] ) ) |
|
| 380 | - return $terms; |
|
| 400 | + if ( is_admin() && isset( $_GET['orderby'] ) ) { |
|
| 401 | + return $terms; |
|
| 402 | + } |
|
| 381 | 403 | |
| 382 | 404 | foreach ( $terms as $key => $term ) { |
| 383 | 405 | if ( is_object( $term ) && isset( $term->taxonomy ) ) { |
| 384 | 406 | $taxonomy = $term->taxonomy; |
| 385 | - if ( ! array_key_exists( $taxonomy, $tags ) ) |
|
| 386 | - return $terms; |
|
| 407 | + if ( ! array_key_exists( $taxonomy, $tags ) ) { |
|
| 408 | + return $terms; |
|
| 409 | + } |
|
| 387 | 410 | } else { |
| 388 | 411 | return $terms; |
| 389 | 412 | } |
@@ -394,8 +417,9 @@ discard block |
||
| 394 | 417 | } |
| 395 | 418 | |
| 396 | 419 | public function taxcmp( $a, $b ) { |
| 397 | - if ( $a->lsx_team_term_order == $b->lsx_team_term_order ) |
|
| 398 | - return 0; |
|
| 420 | + if ( $a->lsx_team_term_order == $b->lsx_team_term_order ) { |
|
| 421 | + return 0; |
|
| 422 | + } |
|
| 399 | 423 | |
| 400 | 424 | return ( $a->lsx_team_term_order < $b->lsx_team_term_order ) ? -1 : 1; |
| 401 | 425 | } |
@@ -188,13 +188,19 @@ |
||
| 188 | 188 | <div class="entry-tabs"> |
| 189 | 189 | <ul class="nav nav-tabs"> |
| 190 | 190 | <?php foreach ( $tabs as $i => $tab ) : ?> |
| 191 | - <li<?php if ( 0 === $i ) echo ' class="active"'; ?>><a data-toggle="tab" href="#<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>"><?php echo esc_html( $tab['title'] ); ?></a></li> |
|
| 191 | + <li<?php if ( 0 === $i ) { |
|
| 192 | + echo ' class="active"'; |
|
| 193 | +} |
|
| 194 | +?>><a data-toggle="tab" href="#<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>"><?php echo esc_html( $tab['title'] ); ?></a></li> |
|
| 192 | 195 | <?php endforeach; ?> |
| 193 | 196 | </ul> |
| 194 | 197 | |
| 195 | 198 | <div class="tab-content"> |
| 196 | 199 | <?php foreach ( $tabs as $i => $tab ) : ?> |
| 197 | - <div id="<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>" class="tab-pane fade<?php if ( 0 === $i ) echo ' in active'; ?>"> |
|
| 200 | + <div id="<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>" class="tab-pane fade<?php if ( 0 === $i ) { |
|
| 201 | + echo ' in active'; |
|
| 202 | +} |
|
| 203 | +?>"> |
|
| 198 | 204 | <?php echo do_shortcode( $tab['shortcode'] ); ?> |
| 199 | 205 | </div> |
| 200 | 206 | <?php endforeach; ?> |
@@ -19,16 +19,22 @@ |
||
| 19 | 19 | <figure class="lsx-team-avatar"> |
| 20 | 20 | <?php if ( empty( team_get_option( 'team_disable_single' ) ) ) : ?> |
| 21 | 21 | <a href="<?php the_permalink(); ?>"><?php echo wp_kses_post( $thumbnail ); ?></a> |
| 22 | - <?php else : ?> |
|
| 23 | - <?php echo wp_kses_post( $thumbnail ); ?> |
|
| 22 | + <?php else { |
|
| 23 | + : ?> |
|
| 24 | + <?php echo wp_kses_post( $thumbnail ); |
|
| 25 | +} |
|
| 26 | +?> |
|
| 24 | 27 | <?php endif; ?> |
| 25 | 28 | </figure> |
| 26 | 29 | |
| 27 | 30 | <h5 class="lsx-team-name"> |
| 28 | 31 | <?php if ( empty( team_get_option( 'team_disable_single' ) ) ) : ?> |
| 29 | 32 | <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> |
| 30 | - <?php else : ?> |
|
| 31 | - <?php the_title(); ?> |
|
| 33 | + <?php else { |
|
| 34 | + : ?> |
|
| 35 | + <?php the_title(); |
|
| 36 | +} |
|
| 37 | +?> |
|
| 32 | 38 | <?php endif; ?> |
| 33 | 39 | </h5> |
| 34 | 40 | |
@@ -36,9 +36,12 @@ |
||
| 36 | 36 | |
| 37 | 37 | <?php lsx_paging_nav(); ?> |
| 38 | 38 | |
| 39 | - <?php else : ?> |
|
| 39 | + <?php else { |
|
| 40 | + : ?> |
|
| 40 | 41 | |
| 41 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
| 42 | + <?php get_template_part( 'partials/content', 'none' ); |
|
| 43 | +} |
|
| 44 | +?> |
|
| 42 | 45 | |
| 43 | 46 | <?php endif; ?> |
| 44 | 47 | |
@@ -36,9 +36,12 @@ |
||
| 36 | 36 | |
| 37 | 37 | <?php lsx_paging_nav(); ?> |
| 38 | 38 | |
| 39 | - <?php else : ?> |
|
| 39 | + <?php else { |
|
| 40 | + : ?> |
|
| 40 | 41 | |
| 41 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
| 42 | + <?php get_template_part( 'partials/content', 'none' ); |
|
| 43 | +} |
|
| 44 | +?> |
|
| 42 | 45 | |
| 43 | 46 | <?php endif; ?> |
| 44 | 47 | |