@@ -14,36 +14,36 @@ discard block |
||
| 14 | 14 | class LSX_TEAM_SCPO_Engine { |
| 15 | 15 | |
| 16 | 16 | public function __construct() { |
| 17 | - if ( ! get_option( 'lsx_team_scporder_install' ) ) |
|
| 17 | + if (!get_option('lsx_team_scporder_install')) |
|
| 18 | 18 | $this->lsx_team_scporder_install(); |
| 19 | 19 | |
| 20 | - add_action( 'admin_init', array( $this, 'refresh' ) ); |
|
| 21 | - add_action( 'admin_init', array( $this, 'load_script_css' ) ); |
|
| 20 | + add_action('admin_init', array($this, 'refresh')); |
|
| 21 | + add_action('admin_init', array($this, 'load_script_css')); |
|
| 22 | 22 | |
| 23 | - add_action( 'wp_ajax_update-menu-order', array( $this, 'update_menu_order' ) ); |
|
| 24 | - add_action( 'wp_ajax_update-menu-order-tags', array( $this, 'update_menu_order_tags' ) ); |
|
| 23 | + add_action('wp_ajax_update-menu-order', array($this, 'update_menu_order')); |
|
| 24 | + add_action('wp_ajax_update-menu-order-tags', array($this, 'update_menu_order_tags')); |
|
| 25 | 25 | |
| 26 | - add_action( 'pre_get_posts', array( $this, 'lsx_team_scporder_pre_get_posts' ) ); |
|
| 26 | + add_action('pre_get_posts', array($this, 'lsx_team_scporder_pre_get_posts')); |
|
| 27 | 27 | |
| 28 | - add_filter( 'get_previous_post_where', array( $this, 'lsx_team_scporder_previous_post_where' ) ); |
|
| 29 | - add_filter( 'get_previous_post_sort', array( $this, 'lsx_team_scporder_previous_post_sort' ) ); |
|
| 30 | - add_filter( 'get_next_post_where', array( $this, 'lsx_team_scporder_next_post_where' ) ); |
|
| 31 | - add_filter( 'get_next_post_sort', array( $this, 'lsx_team_scporder_next_post_sort' ) ); |
|
| 28 | + add_filter('get_previous_post_where', array($this, 'lsx_team_scporder_previous_post_where')); |
|
| 29 | + add_filter('get_previous_post_sort', array($this, 'lsx_team_scporder_previous_post_sort')); |
|
| 30 | + add_filter('get_next_post_where', array($this, 'lsx_team_scporder_next_post_where')); |
|
| 31 | + add_filter('get_next_post_sort', array($this, 'lsx_team_scporder_next_post_sort')); |
|
| 32 | 32 | |
| 33 | - add_filter( 'get_terms_orderby', array( $this, 'lsx_team_scporder_get_terms_orderby' ), 10, 3 ); |
|
| 34 | - add_filter( 'wp_get_object_terms', array( $this, 'lsx_team_scporder_get_object_terms' ), 10, 3 ); |
|
| 35 | - add_filter( 'get_terms', array( $this, 'lsx_team_scporder_get_object_terms' ), 10, 3 ); |
|
| 33 | + add_filter('get_terms_orderby', array($this, 'lsx_team_scporder_get_terms_orderby'), 10, 3); |
|
| 34 | + add_filter('wp_get_object_terms', array($this, 'lsx_team_scporder_get_object_terms'), 10, 3); |
|
| 35 | + add_filter('get_terms', array($this, 'lsx_team_scporder_get_object_terms'), 10, 3); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function lsx_team_scporder_install() { |
| 39 | 39 | global $wpdb; |
| 40 | - $result = $wpdb->query( "DESCRIBE $wpdb->terms `lsx_team_term_order`" ); |
|
| 40 | + $result = $wpdb->query("DESCRIBE $wpdb->terms `lsx_team_term_order`"); |
|
| 41 | 41 | |
| 42 | - if ( ! $result ) { |
|
| 43 | - $result = $wpdb->query( "ALTER TABLE $wpdb->terms ADD `lsx_team_term_order` INT( 4 ) NULL DEFAULT '0'" ); |
|
| 42 | + if (!$result) { |
|
| 43 | + $result = $wpdb->query("ALTER TABLE $wpdb->terms ADD `lsx_team_term_order` INT( 4 ) NULL DEFAULT '0'"); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - update_option( 'lsx_team_scporder_install', 1 ); |
|
| 46 | + update_option('lsx_team_scporder_install', 1); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | public function _check_load_script_css() { |
@@ -52,23 +52,23 @@ discard block |
||
| 52 | 52 | $objects = $this->get_lsx_team_scporder_options_objects(); |
| 53 | 53 | $tags = $this->get_lsx_team_scporder_options_tags(); |
| 54 | 54 | |
| 55 | - if ( empty( $objects ) && empty( $tags ) ) |
|
| 55 | + if (empty($objects) && empty($tags)) |
|
| 56 | 56 | return false; |
| 57 | 57 | |
| 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' ) ) |
|
| 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 | 59 | return false; |
| 60 | 60 | |
| 61 | - if ( ! empty( $objects ) ) { |
|
| 62 | - 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. |
|
| 61 | + if (!empty($objects)) { |
|
| 62 | + 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. |
|
| 63 | 63 | $active = true; |
| 64 | 64 | } |
| 65 | - if ( ! isset( $_GET['post_type'] ) && strstr( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'wp-admin/edit.php' ) && array_key_exists( 'post', $objects ) ) { // if post. |
|
| 65 | + if (!isset($_GET['post_type']) && strstr(sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'])), 'wp-admin/edit.php') && array_key_exists('post', $objects)) { // if post. |
|
| 66 | 66 | $active = true; |
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if ( ! empty( $tags ) ) { |
|
| 71 | - if ( isset( $_GET['taxonomy'] ) && array_key_exists( sanitize_text_field( wp_unslash( $_GET['taxonomy'] ) ), $tags ) ) { |
|
| 70 | + if (!empty($tags)) { |
|
| 71 | + if (isset($_GET['taxonomy']) && array_key_exists(sanitize_text_field(wp_unslash($_GET['taxonomy'])), $tags)) { |
|
| 72 | 72 | $active = true; |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -77,17 +77,17 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | public function load_script_css() { |
| 80 | - if ( $this->_check_load_script_css() ) { |
|
| 81 | - wp_enqueue_script( 'scporderjs', LSX_TEAM_URL . 'assets/js/scporder.min.js', array( 'jquery', 'jquery-ui-sortable' ), null, true ); |
|
| 80 | + if ($this->_check_load_script_css()) { |
|
| 81 | + wp_enqueue_script('scporderjs', LSX_TEAM_URL.'assets/js/scporder.min.js', array('jquery', 'jquery-ui-sortable'), null, true); |
|
| 82 | 82 | |
| 83 | 83 | $scporderjs_params = array( |
| 84 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 85 | - 'ajax_nonce' => wp_create_nonce( 'scporder' ), |
|
| 84 | + 'ajax_url' => admin_url('admin-ajax.php'), |
|
| 85 | + 'ajax_nonce' => wp_create_nonce('scporder'), |
|
| 86 | 86 | ); |
| 87 | 87 | |
| 88 | - wp_localize_script( 'scporderjs', 'scporderjs_params', $scporderjs_params ); |
|
| 88 | + wp_localize_script('scporderjs', 'scporderjs_params', $scporderjs_params); |
|
| 89 | 89 | |
| 90 | - wp_enqueue_style( 'scporder', LSX_TEAM_URL . 'assets/css/scporder.css', array(), null ); |
|
| 90 | + wp_enqueue_style('scporder', LSX_TEAM_URL.'assets/css/scporder.css', array(), null); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
@@ -96,26 +96,26 @@ discard block |
||
| 96 | 96 | $objects = $this->get_lsx_team_scporder_options_objects(); |
| 97 | 97 | $tags = $this->get_lsx_team_scporder_options_tags(); |
| 98 | 98 | |
| 99 | - if ( ! empty( $objects ) ) { |
|
| 100 | - foreach ( $objects as $object => $object_data ) { |
|
| 101 | - $result = $wpdb->get_results( $wpdb->prepare( " |
|
| 99 | + if (!empty($objects)) { |
|
| 100 | + foreach ($objects as $object => $object_data) { |
|
| 101 | + $result = $wpdb->get_results($wpdb->prepare(" |
|
| 102 | 102 | SELECT count( * ) as cnt, max( menu_order ) as max, min( menu_order ) as min |
| 103 | 103 | FROM $wpdb->posts |
| 104 | 104 | WHERE post_type = '%s' AND post_status IN ( 'publish', 'pending', 'draft', 'private', 'future' ) |
| 105 | - ", $object ) ); |
|
| 105 | + ", $object)); |
|
| 106 | 106 | |
| 107 | - if ( 0 == $result[0]->cnt || $result[0]->cnt == $result[0]->max ) |
|
| 107 | + if (0 == $result[0]->cnt || $result[0]->cnt == $result[0]->max) |
|
| 108 | 108 | continue; |
| 109 | 109 | |
| 110 | - $results = $wpdb->get_results( $wpdb->prepare( " |
|
| 110 | + $results = $wpdb->get_results($wpdb->prepare(" |
|
| 111 | 111 | SELECT ID |
| 112 | 112 | FROM $wpdb->posts |
| 113 | 113 | WHERE post_type = '%s' AND post_status IN ( 'publish', 'pending', 'draft', 'private', 'future' ) |
| 114 | 114 | ORDER BY menu_order ASC |
| 115 | - ", $object ) ); |
|
| 115 | + ", $object)); |
|
| 116 | 116 | |
| 117 | - foreach ( $results as $key => $result ) { |
|
| 118 | - $wpdb->update( $wpdb->posts, |
|
| 117 | + foreach ($results as $key => $result) { |
|
| 118 | + $wpdb->update($wpdb->posts, |
|
| 119 | 119 | array( |
| 120 | 120 | 'menu_order' => $key + 1, |
| 121 | 121 | ), |
@@ -127,27 +127,27 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - if ( ! empty( $tags ) ) { |
|
| 131 | - foreach ( $tags as $taxonomy => $taxonomy_data ) { |
|
| 132 | - $result = $wpdb->get_results( $wpdb->prepare( " |
|
| 130 | + if (!empty($tags)) { |
|
| 131 | + foreach ($tags as $taxonomy => $taxonomy_data) { |
|
| 132 | + $result = $wpdb->get_results($wpdb->prepare(" |
|
| 133 | 133 | SELECT count( * ) as cnt, max( lsx_team_term_order ) as max, min( lsx_team_term_order ) as min |
| 134 | 134 | FROM $wpdb->terms AS terms |
| 135 | 135 | INNER JOIN $wpdb->term_taxonomy AS term_taxonomy ON ( terms.term_id = term_taxonomy.term_id ) |
| 136 | 136 | WHERE term_taxonomy.taxonomy = '%s' |
| 137 | - ", $taxonomy ) ); |
|
| 137 | + ", $taxonomy)); |
|
| 138 | 138 | |
| 139 | - if ( 0 == $result[0]->cnt || $result[0]->cnt == $result[0]->max ) |
|
| 139 | + if (0 == $result[0]->cnt || $result[0]->cnt == $result[0]->max) |
|
| 140 | 140 | continue; |
| 141 | 141 | |
| 142 | - $results = $wpdb->get_results( $wpdb->prepare( " |
|
| 142 | + $results = $wpdb->get_results($wpdb->prepare(" |
|
| 143 | 143 | SELECT terms.term_id |
| 144 | 144 | FROM $wpdb->terms AS terms |
| 145 | 145 | INNER JOIN $wpdb->term_taxonomy AS term_taxonomy ON ( terms.term_id = term_taxonomy.term_id ) |
| 146 | 146 | WHERE term_taxonomy.taxonomy = '%s' |
| 147 | 147 | ORDER BY lsx_team_term_order ASC |
| 148 | - ", $taxonomy ) ); |
|
| 148 | + ", $taxonomy)); |
|
| 149 | 149 | |
| 150 | - foreach ( $results as $key => $result ) { |
|
| 150 | + foreach ($results as $key => $result) { |
|
| 151 | 151 | $wpdb->update( |
| 152 | 152 | $wpdb->terms, |
| 153 | 153 | array( |
@@ -163,42 +163,42 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | public function update_menu_order() { |
| 166 | - check_ajax_referer( 'scporder', 'security' ); |
|
| 166 | + check_ajax_referer('scporder', 'security'); |
|
| 167 | 167 | |
| 168 | 168 | global $wpdb; |
| 169 | 169 | |
| 170 | - parse_str( sanitize_text_field( wp_unslash( $_POST['order'] ) ), $data ); |
|
| 170 | + parse_str(sanitize_text_field(wp_unslash($_POST['order'])), $data); |
|
| 171 | 171 | |
| 172 | - if ( ! is_array( $data ) ) |
|
| 172 | + if (!is_array($data)) |
|
| 173 | 173 | return false; |
| 174 | 174 | |
| 175 | 175 | $id_arr = array(); |
| 176 | 176 | |
| 177 | - foreach ( $data as $key => $values ) { |
|
| 178 | - foreach ( $values as $position => $id ) { |
|
| 177 | + foreach ($data as $key => $values) { |
|
| 178 | + foreach ($values as $position => $id) { |
|
| 179 | 179 | $id_arr[] = $id; |
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | $menu_order_arr = array(); |
| 184 | 184 | |
| 185 | - foreach ( $id_arr as $key => $id ) { |
|
| 186 | - $results = $wpdb->get_results( "SELECT menu_order FROM $wpdb->posts WHERE ID = " . intval( $id ) ); |
|
| 187 | - foreach ( $results as $result ) { |
|
| 185 | + foreach ($id_arr as $key => $id) { |
|
| 186 | + $results = $wpdb->get_results("SELECT menu_order FROM $wpdb->posts WHERE ID = ".intval($id)); |
|
| 187 | + foreach ($results as $result) { |
|
| 188 | 188 | $menu_order_arr[] = $result->menu_order; |
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - sort( $menu_order_arr ); |
|
| 192 | + sort($menu_order_arr); |
|
| 193 | 193 | |
| 194 | - foreach ( $data as $key => $values ) { |
|
| 195 | - foreach ( $values as $position => $id ) { |
|
| 196 | - $wpdb->update( $wpdb->posts, |
|
| 194 | + foreach ($data as $key => $values) { |
|
| 195 | + foreach ($values as $position => $id) { |
|
| 196 | + $wpdb->update($wpdb->posts, |
|
| 197 | 197 | array( |
| 198 | - 'menu_order' => $menu_order_arr[ $position ], |
|
| 198 | + 'menu_order' => $menu_order_arr[$position], |
|
| 199 | 199 | ), |
| 200 | 200 | array( |
| 201 | - 'ID' => intval( $id ), |
|
| 201 | + 'ID' => intval($id), |
|
| 202 | 202 | ) |
| 203 | 203 | ); |
| 204 | 204 | } |
@@ -206,209 +206,209 @@ discard block |
||
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | public function update_menu_order_tags() { |
| 209 | - check_ajax_referer( 'scporder', 'security' ); |
|
| 209 | + check_ajax_referer('scporder', 'security'); |
|
| 210 | 210 | |
| 211 | 211 | global $wpdb; |
| 212 | 212 | |
| 213 | - parse_str( sanitize_text_field( wp_unslash( $_POST['order'] ) ), $data ); |
|
| 213 | + parse_str(sanitize_text_field(wp_unslash($_POST['order'])), $data); |
|
| 214 | 214 | |
| 215 | - if ( ! is_array( $data ) ) |
|
| 215 | + if (!is_array($data)) |
|
| 216 | 216 | return false; |
| 217 | 217 | |
| 218 | 218 | $id_arr = array(); |
| 219 | 219 | |
| 220 | - foreach ( $data as $key => $values ) { |
|
| 221 | - foreach ( $values as $position => $id ) { |
|
| 220 | + foreach ($data as $key => $values) { |
|
| 221 | + foreach ($values as $position => $id) { |
|
| 222 | 222 | $id_arr[] = $id; |
| 223 | 223 | } |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | $menu_order_arr = array(); |
| 227 | 227 | |
| 228 | - foreach ( $id_arr as $key => $id ) { |
|
| 229 | - $results = $wpdb->get_results( " |
|
| 228 | + foreach ($id_arr as $key => $id) { |
|
| 229 | + $results = $wpdb->get_results(" |
|
| 230 | 230 | SELECT lsx_team_term_order |
| 231 | 231 | FROM $wpdb->terms |
| 232 | - WHERE term_id = " . intval( $id ) ); |
|
| 233 | - foreach ( $results as $result ) { |
|
| 232 | + WHERE term_id = ".intval($id)); |
|
| 233 | + foreach ($results as $result) { |
|
| 234 | 234 | $menu_order_arr[] = $result->lsx_team_term_order; |
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - sort( $menu_order_arr ); |
|
| 238 | + sort($menu_order_arr); |
|
| 239 | 239 | |
| 240 | - foreach ( $data as $key => $values ) { |
|
| 241 | - foreach ( $values as $position => $id ) { |
|
| 242 | - $wpdb->update( $wpdb->terms, |
|
| 240 | + foreach ($data as $key => $values) { |
|
| 241 | + foreach ($values as $position => $id) { |
|
| 242 | + $wpdb->update($wpdb->terms, |
|
| 243 | 243 | array( |
| 244 | - 'lsx_team_term_order' => $menu_order_arr[ $position ], |
|
| 244 | + 'lsx_team_term_order' => $menu_order_arr[$position], |
|
| 245 | 245 | ), |
| 246 | 246 | array( |
| 247 | - 'term_id' => intval( $id ), |
|
| 247 | + 'term_id' => intval($id), |
|
| 248 | 248 | ) |
| 249 | 249 | ); |
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | - public function lsx_team_scporder_previous_post_where( $where ) { |
|
| 254 | + public function lsx_team_scporder_previous_post_where($where) { |
|
| 255 | 255 | global $post; |
| 256 | 256 | $objects = $this->get_lsx_team_scporder_options_objects(); |
| 257 | 257 | |
| 258 | - if ( empty( $objects ) ) |
|
| 258 | + if (empty($objects)) |
|
| 259 | 259 | return $where; |
| 260 | 260 | |
| 261 | - if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) { |
|
| 261 | + if (isset($post->post_type) && array_key_exists($post->post_type, $objects)) { |
|
| 262 | 262 | $current_menu_order = $post->menu_order; |
| 263 | - $where = "WHERE p.menu_order > '" . $current_menu_order . "' AND p.post_type = '" . $post->post_type . "' AND p.post_status = 'publish'"; |
|
| 263 | + $where = "WHERE p.menu_order > '".$current_menu_order."' AND p.post_type = '".$post->post_type."' AND p.post_status = 'publish'"; |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | return $where; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - public function lsx_team_scporder_previous_post_sort( $orderby ) { |
|
| 269 | + public function lsx_team_scporder_previous_post_sort($orderby) { |
|
| 270 | 270 | global $post; |
| 271 | 271 | $objects = $this->get_lsx_team_scporder_options_objects(); |
| 272 | 272 | |
| 273 | - if ( empty( $objects ) ) |
|
| 273 | + if (empty($objects)) |
|
| 274 | 274 | return $orderby; |
| 275 | 275 | |
| 276 | - if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) { |
|
| 276 | + if (isset($post->post_type) && array_key_exists($post->post_type, $objects)) { |
|
| 277 | 277 | $orderby = 'ORDER BY p.menu_order ASC LIMIT 1'; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | return $orderby; |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | - public function lsx_team_scporder_next_post_where( $where ) { |
|
| 283 | + public function lsx_team_scporder_next_post_where($where) { |
|
| 284 | 284 | global $post; |
| 285 | 285 | $objects = $this->get_lsx_team_scporder_options_objects(); |
| 286 | 286 | |
| 287 | - if ( empty( $objects ) ) |
|
| 287 | + if (empty($objects)) |
|
| 288 | 288 | return $where; |
| 289 | 289 | |
| 290 | - if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) { |
|
| 290 | + if (isset($post->post_type) && array_key_exists($post->post_type, $objects)) { |
|
| 291 | 291 | $current_menu_order = $post->menu_order; |
| 292 | - $where = "WHERE p.menu_order < '" . $current_menu_order . "' AND p.post_type = '" . $post->post_type . "' AND p.post_status = 'publish'"; |
|
| 292 | + $where = "WHERE p.menu_order < '".$current_menu_order."' AND p.post_type = '".$post->post_type."' AND p.post_status = 'publish'"; |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | return $where; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | - public function lsx_team_scporder_next_post_sort( $orderby ) { |
|
| 298 | + public function lsx_team_scporder_next_post_sort($orderby) { |
|
| 299 | 299 | global $post; |
| 300 | 300 | $objects = $this->get_lsx_team_scporder_options_objects(); |
| 301 | 301 | |
| 302 | - if ( empty( $objects ) ) |
|
| 302 | + if (empty($objects)) |
|
| 303 | 303 | return $orderby; |
| 304 | 304 | |
| 305 | - if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) { |
|
| 305 | + if (isset($post->post_type) && array_key_exists($post->post_type, $objects)) { |
|
| 306 | 306 | $orderby = 'ORDER BY p.menu_order DESC LIMIT 1'; |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | return $orderby; |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | - public function lsx_team_scporder_pre_get_posts( $wp_query ) { |
|
| 312 | + public function lsx_team_scporder_pre_get_posts($wp_query) { |
|
| 313 | 313 | $objects = $this->get_lsx_team_scporder_options_objects(); |
| 314 | 314 | |
| 315 | - if ( empty( $objects ) ) |
|
| 315 | + if (empty($objects)) |
|
| 316 | 316 | return false; |
| 317 | 317 | |
| 318 | - if ( is_admin() ) { |
|
| 319 | - if ( isset( $wp_query->query['post_type'] ) && ! isset( $_GET['orderby'] ) ) { |
|
| 320 | - if ( array_key_exists( $wp_query->query['post_type'], $objects ) ) { |
|
| 321 | - $wp_query->set( 'orderby', 'menu_order' ); |
|
| 322 | - $wp_query->set( 'order', 'ASC' ); |
|
| 318 | + if (is_admin()) { |
|
| 319 | + if (isset($wp_query->query['post_type']) && !isset($_GET['orderby'])) { |
|
| 320 | + if (array_key_exists($wp_query->query['post_type'], $objects)) { |
|
| 321 | + $wp_query->set('orderby', 'menu_order'); |
|
| 322 | + $wp_query->set('order', 'ASC'); |
|
| 323 | 323 | } |
| 324 | 324 | } |
| 325 | 325 | } else { |
| 326 | 326 | $active = false; |
| 327 | 327 | |
| 328 | - if ( isset( $wp_query->query['post_type'] ) ) { |
|
| 329 | - if ( ! is_array( $wp_query->query['post_type'] ) ) { |
|
| 330 | - if ( array_key_exists( $wp_query->query['post_type'], $objects ) ) { |
|
| 328 | + if (isset($wp_query->query['post_type'])) { |
|
| 329 | + if (!is_array($wp_query->query['post_type'])) { |
|
| 330 | + if (array_key_exists($wp_query->query['post_type'], $objects)) { |
|
| 331 | 331 | $active = true; |
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | } else { |
| 335 | - if ( array_key_exists( 'post', $objects ) ) { |
|
| 335 | + if (array_key_exists('post', $objects)) { |
|
| 336 | 336 | $active = true; |
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - if ( ! $active ) |
|
| 340 | + if (!$active) |
|
| 341 | 341 | return false; |
| 342 | 342 | |
| 343 | - 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' ); |
|
| 343 | + 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'); |
|
| 348 | 348 | } 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' ); |
|
| 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'); |
|
| 353 | 353 | } |
| 354 | 354 | } |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | - public function lsx_team_scporder_get_terms_orderby( $orderby, $args ) { |
|
| 358 | - if ( is_admin() ) |
|
| 357 | + public function lsx_team_scporder_get_terms_orderby($orderby, $args) { |
|
| 358 | + if (is_admin()) |
|
| 359 | 359 | return $orderby; |
| 360 | 360 | |
| 361 | 361 | $tags = $this->get_lsx_team_scporder_options_tags(); |
| 362 | 362 | |
| 363 | - if ( ! isset( $args['taxonomy'] ) ) |
|
| 363 | + if (!isset($args['taxonomy'])) |
|
| 364 | 364 | return $orderby; |
| 365 | 365 | |
| 366 | 366 | $taxonomy = $args['taxonomy']; |
| 367 | - if ( is_array( $taxonomy ) && count( $taxonomy ) == 1 ) |
|
| 367 | + if (is_array($taxonomy) && count($taxonomy) == 1) |
|
| 368 | 368 | $taxonomy = $taxonomy[0]; |
| 369 | - if ( ! array_key_exists( $taxonomy[0], $tags ) ) |
|
| 369 | + if (!array_key_exists($taxonomy[0], $tags)) |
|
| 370 | 370 | return $orderby; |
| 371 | 371 | |
| 372 | 372 | $orderby = 't.lsx_team_term_order'; |
| 373 | 373 | return $orderby; |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | - public function lsx_team_scporder_get_object_terms( $terms ) { |
|
| 376 | + public function lsx_team_scporder_get_object_terms($terms) { |
|
| 377 | 377 | $tags = $this->get_lsx_team_scporder_options_tags(); |
| 378 | 378 | |
| 379 | - if ( is_admin() && isset( $_GET['orderby'] ) ) |
|
| 379 | + if (is_admin() && isset($_GET['orderby'])) |
|
| 380 | 380 | return $terms; |
| 381 | 381 | |
| 382 | - foreach ( $terms as $key => $term ) { |
|
| 383 | - if ( is_object( $term ) && isset( $term->taxonomy ) ) { |
|
| 382 | + foreach ($terms as $key => $term) { |
|
| 383 | + if (is_object($term) && isset($term->taxonomy)) { |
|
| 384 | 384 | $taxonomy = $term->taxonomy; |
| 385 | - if ( ! array_key_exists( $taxonomy, $tags ) ) |
|
| 385 | + if (!array_key_exists($taxonomy, $tags)) |
|
| 386 | 386 | return $terms; |
| 387 | 387 | } else { |
| 388 | 388 | return $terms; |
| 389 | 389 | } |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | - usort( $terms, array( $this, 'taxcmp' ) ); |
|
| 392 | + usort($terms, array($this, 'taxcmp')); |
|
| 393 | 393 | return $terms; |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | - public function taxcmp( $a, $b ) { |
|
| 397 | - if ( $a->lsx_team_term_order == $b->lsx_team_term_order ) |
|
| 396 | + public function taxcmp($a, $b) { |
|
| 397 | + if ($a->lsx_team_term_order == $b->lsx_team_term_order) |
|
| 398 | 398 | return 0; |
| 399 | 399 | |
| 400 | - return ( $a->lsx_team_term_order < $b->lsx_team_term_order ) ? -1 : 1; |
|
| 400 | + return ($a->lsx_team_term_order < $b->lsx_team_term_order) ? -1 : 1; |
|
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | public function get_lsx_team_scporder_options_objects() { |
| 404 | 404 | return array( |
| 405 | - 'team' => esc_html_x( 'Team Member', 'post type singular name', 'lsx-team' ), |
|
| 405 | + 'team' => esc_html_x('Team Member', 'post type singular name', 'lsx-team'), |
|
| 406 | 406 | ); |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | public function get_lsx_team_scporder_options_tags() { |
| 410 | 410 | return array( |
| 411 | - 'team_role' => esc_html_x( 'Role', 'taxonomy singular name', 'lsx-team' ), |
|
| 411 | + 'team_role' => esc_html_x('Role', 'taxonomy singular name', 'lsx-team'), |
|
| 412 | 412 | ); |
| 413 | 413 | } |
| 414 | 414 | |
@@ -417,21 +417,21 @@ discard block |
||
| 417 | 417 | /** |
| 418 | 418 | * SCP Order Uninstall hook |
| 419 | 419 | */ |
| 420 | -register_uninstall_hook( __FILE__, 'lsx_team_scporder_uninstall' ); |
|
| 420 | +register_uninstall_hook(__FILE__, 'lsx_team_scporder_uninstall'); |
|
| 421 | 421 | |
| 422 | 422 | function lsx_team_scporder_uninstall() { |
| 423 | 423 | global $wpdb; |
| 424 | 424 | |
| 425 | - if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
| 425 | + if (function_exists('is_multisite') && is_multisite()) { |
|
| 426 | 426 | $curr_blog = $wpdb->blogid; |
| 427 | - $blogids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ); |
|
| 427 | + $blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs"); |
|
| 428 | 428 | |
| 429 | - foreach ( $blogids as $blog_id ) { |
|
| 430 | - switch_to_blog( $blog_id ); |
|
| 429 | + foreach ($blogids as $blog_id) { |
|
| 430 | + switch_to_blog($blog_id); |
|
| 431 | 431 | lsx_team_scporder_uninstall_db(); |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | - switch_to_blog( $curr_blog ); |
|
| 434 | + switch_to_blog($curr_blog); |
|
| 435 | 435 | } else { |
| 436 | 436 | lsx_team_scporder_uninstall_db(); |
| 437 | 437 | } |
@@ -439,11 +439,11 @@ discard block |
||
| 439 | 439 | |
| 440 | 440 | function lsx_team_scporder_uninstall_db() { |
| 441 | 441 | global $wpdb; |
| 442 | - $result = $wpdb->query( "DESCRIBE $wpdb->terms `lsx_team_term_order`" ); |
|
| 442 | + $result = $wpdb->query("DESCRIBE $wpdb->terms `lsx_team_term_order`"); |
|
| 443 | 443 | |
| 444 | - if ( $result ) { |
|
| 445 | - $result = $wpdb->query( "ALTER TABLE $wpdb->terms DROP `lsx_team_term_order`" ); |
|
| 444 | + if ($result) { |
|
| 445 | + $result = $wpdb->query("ALTER TABLE $wpdb->terms DROP `lsx_team_term_order`"); |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | - delete_option( 'lsx_team_scporder_install' ); |
|
| 448 | + delete_option('lsx_team_scporder_install'); |
|
| 449 | 449 | } |
@@ -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 | } |
@@ -13,9 +13,9 @@ discard block |
||
| 13 | 13 | * Add our action to init to set up our vars first. |
| 14 | 14 | */ |
| 15 | 15 | function lsx_team_load_plugin_textdomain() { |
| 16 | - load_plugin_textdomain( 'lsx-team', false, basename( LSX_TEAM_PATH ) . '/languages' ); |
|
| 16 | + load_plugin_textdomain('lsx-team', false, basename(LSX_TEAM_PATH).'/languages'); |
|
| 17 | 17 | } |
| 18 | -add_action( 'init', 'lsx_team_load_plugin_textdomain' ); |
|
| 18 | +add_action('init', 'lsx_team_load_plugin_textdomain'); |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * Wrapper function around cmb2_get_option |
@@ -26,19 +26,19 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | function team_get_options() { |
| 28 | 28 | $options = array(); |
| 29 | - if ( function_exists( 'tour_operator' ) ) { |
|
| 30 | - $options = get_option( '_lsx-to_settings', false ); |
|
| 29 | + if (function_exists('tour_operator')) { |
|
| 30 | + $options = get_option('_lsx-to_settings', false); |
|
| 31 | 31 | } else { |
| 32 | - $options = get_option( '_lsx_settings', false ); |
|
| 32 | + $options = get_option('_lsx_settings', false); |
|
| 33 | 33 | |
| 34 | - if ( false === $options ) { |
|
| 35 | - $options = get_option( '_lsx_lsx-settings', false ); |
|
| 34 | + if (false === $options) { |
|
| 35 | + $options = get_option('_lsx_lsx-settings', false); |
|
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // If there are new CMB2 options available, then use those. |
| 40 | - $new_options = get_option( 'lsx_team_options', false ); |
|
| 41 | - if ( false !== $new_options ) { |
|
| 40 | + $new_options = get_option('lsx_team_options', false); |
|
| 41 | + if (false !== $new_options) { |
|
| 42 | 42 | $options['display'] = $new_options; |
| 43 | 43 | } |
| 44 | 44 | return $options; |
@@ -51,27 +51,27 @@ discard block |
||
| 51 | 51 | * @param mixed $default Optional default value |
| 52 | 52 | * @return mixed Option value |
| 53 | 53 | */ |
| 54 | -function team_get_option( $key = '', $default = false ) { |
|
| 54 | +function team_get_option($key = '', $default = false) { |
|
| 55 | 55 | $options = array(); |
| 56 | 56 | $value = $default; |
| 57 | - if ( function_exists( 'tour_operator' ) ) { |
|
| 58 | - $options = get_option( '_lsx-to_settings', false ); |
|
| 57 | + if (function_exists('tour_operator')) { |
|
| 58 | + $options = get_option('_lsx-to_settings', false); |
|
| 59 | 59 | } else { |
| 60 | - $options = get_option( '_lsx_settings', false ); |
|
| 60 | + $options = get_option('_lsx_settings', false); |
|
| 61 | 61 | |
| 62 | - if ( false === $options ) { |
|
| 63 | - $options = get_option( '_lsx_lsx-settings', false ); |
|
| 62 | + if (false === $options) { |
|
| 63 | + $options = get_option('_lsx_lsx-settings', false); |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | // If there are new CMB2 options available, then use those. |
| 68 | - $new_options = get_option( 'lsx_team_options', false ); |
|
| 69 | - if ( false !== $new_options ) { |
|
| 68 | + $new_options = get_option('lsx_team_options', false); |
|
| 69 | + if (false !== $new_options) { |
|
| 70 | 70 | $options['display'] = $new_options; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if ( isset( $options['display'] ) && isset( $options['display'][ $key ] ) ) { |
|
| 74 | - $value = $options['display'][ $key ]; |
|
| 73 | + if (isset($options['display']) && isset($options['display'][$key])) { |
|
| 74 | + $value = $options['display'][$key]; |
|
| 75 | 75 | } |
| 76 | 76 | return $value; |
| 77 | 77 | } |
@@ -79,19 +79,19 @@ discard block |
||
| 79 | 79 | /** |
| 80 | 80 | * Wraps the output class in a function to be called in templates |
| 81 | 81 | */ |
| 82 | -function lsx_team( $args ) { |
|
| 82 | +function lsx_team($args) { |
|
| 83 | 83 | $lsx_team = new LSX_Team; |
| 84 | - echo wp_kses_post( $lsx_team->output( $args ) ); |
|
| 84 | + echo wp_kses_post($lsx_team->output($args)); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | 88 | * Shortcode |
| 89 | 89 | */ |
| 90 | -function lsx_team_shortcode( $atts ) { |
|
| 90 | +function lsx_team_shortcode($atts) { |
|
| 91 | 91 | $lsx_team = new LSX_Team; |
| 92 | - return $lsx_team->output( $atts ); |
|
| 92 | + return $lsx_team->output($atts); |
|
| 93 | 93 | } |
| 94 | -add_shortcode( 'lsx_team', 'lsx_team_shortcode' ); |
|
| 94 | +add_shortcode('lsx_team', 'lsx_team_shortcode'); |
|
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | 97 | * Creates the feature images sizes for the REST API responses. |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | * @param [type] $field_name name. |
| 101 | 101 | * @param [type] $request request. |
| 102 | 102 | */ |
| 103 | -function lsx_team_get_images_urls( $object, $field_name, $request ) { |
|
| 104 | - $medium = wp_get_attachment_image_src( get_post_thumbnail_id( $object->id ), 'medium' ); |
|
| 103 | +function lsx_team_get_images_urls($object, $field_name, $request) { |
|
| 104 | + $medium = wp_get_attachment_image_src(get_post_thumbnail_id($object->id), 'medium'); |
|
| 105 | 105 | $medium_url = $medium['0']; |
| 106 | 106 | |
| 107 | - $large = wp_get_attachment_image_src( get_post_thumbnail_id( $object->id ), 'large' ); |
|
| 107 | + $large = wp_get_attachment_image_src(get_post_thumbnail_id($object->id), 'large'); |
|
| 108 | 108 | $large_url = $large['0']; |
| 109 | 109 | |
| 110 | 110 | return array( |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | ) |
| 130 | 130 | ); |
| 131 | 131 | } |
| 132 | -add_action( 'rest_api_init', 'lsx_team_register_images_field' ); |
|
| 132 | +add_action('rest_api_init', 'lsx_team_register_images_field'); |
|
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | 135 | * Creates the Additional Meta the REST API responses. |
@@ -138,15 +138,15 @@ discard block |
||
| 138 | 138 | * @param [type] $field_name name. |
| 139 | 139 | * @param [type] $request request. |
| 140 | 140 | */ |
| 141 | -function lsx_team_get_additional_meta( $object, $field_name, $request ) { |
|
| 142 | - $role = get_the_terms( get_the_ID(), 'team_role' ); |
|
| 143 | - $job_title = get_post_meta( get_the_ID(), 'lsx_job_title', true ); |
|
| 144 | - $email = get_post_meta( get_the_ID(), 'lsx_email_contact', true ); |
|
| 145 | - $phone = get_post_meta( get_the_ID(), 'lsx_tel', true ); |
|
| 146 | - $skype = get_post_meta( get_the_ID(), 'lsx_skype', true ); |
|
| 147 | - $facebook = get_post_meta( get_the_ID(), 'lsx_facebook', true ); |
|
| 148 | - $twitter = get_post_meta( get_the_ID(), 'lsx_twitter', true ); |
|
| 149 | - $linkedin = get_post_meta( get_the_ID(), 'lsx_linkedin', true ); |
|
| 141 | +function lsx_team_get_additional_meta($object, $field_name, $request) { |
|
| 142 | + $role = get_the_terms(get_the_ID(), 'team_role'); |
|
| 143 | + $job_title = get_post_meta(get_the_ID(), 'lsx_job_title', true); |
|
| 144 | + $email = get_post_meta(get_the_ID(), 'lsx_email_contact', true); |
|
| 145 | + $phone = get_post_meta(get_the_ID(), 'lsx_tel', true); |
|
| 146 | + $skype = get_post_meta(get_the_ID(), 'lsx_skype', true); |
|
| 147 | + $facebook = get_post_meta(get_the_ID(), 'lsx_facebook', true); |
|
| 148 | + $twitter = get_post_meta(get_the_ID(), 'lsx_twitter', true); |
|
| 149 | + $linkedin = get_post_meta(get_the_ID(), 'lsx_linkedin', true); |
|
| 150 | 150 | |
| 151 | 151 | return array( |
| 152 | 152 | 'role' => $role, |
@@ -176,4 +176,4 @@ discard block |
||
| 176 | 176 | ) |
| 177 | 177 | ); |
| 178 | 178 | } |
| 179 | -add_action( 'rest_api_init', 'lsx_team_register_additional_meta' ); |
|
| 179 | +add_action('rest_api_init', 'lsx_team_register_additional_meta'); |
|
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | <?php lsx_content_wrap_before(); ?> |
| 11 | 11 | |
| 12 | -<div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
| 12 | +<div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
| 13 | 13 | |
| 14 | 14 | <?php lsx_content_before(); ?> |
| 15 | 15 | |
@@ -17,11 +17,11 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | <?php lsx_content_top(); ?> |
| 19 | 19 | |
| 20 | - <?php if ( have_posts() ) : ?> |
|
| 20 | + <?php if (have_posts()) : ?> |
|
| 21 | 21 | |
| 22 | - <?php while ( have_posts() ) : the_post(); ?> |
|
| 22 | + <?php while (have_posts()) : the_post(); ?> |
|
| 23 | 23 | |
| 24 | - <?php include( LSX_TEAM_PATH . '/templates/content-single-team.php' ); ?> |
|
| 24 | + <?php include(LSX_TEAM_PATH.'/templates/content-single-team.php'); ?> |
|
| 25 | 25 | |
| 26 | 26 | <?php endwhile; ?> |
| 27 | 27 | |
@@ -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; ?> |
@@ -7,34 +7,34 @@ discard block |
||
| 7 | 7 | <?php |
| 8 | 8 | global $lsx_team; |
| 9 | 9 | |
| 10 | - $thumbnail = $lsx_team->get_thumbnail( get_the_ID(), 'lsx-team-single' ); |
|
| 10 | + $thumbnail = $lsx_team->get_thumbnail(get_the_ID(), 'lsx-team-single'); |
|
| 11 | 11 | |
| 12 | - $job_title = get_post_meta( get_the_ID(), 'lsx_job_title', true ); |
|
| 12 | + $job_title = get_post_meta(get_the_ID(), 'lsx_job_title', true); |
|
| 13 | 13 | |
| 14 | 14 | $links = array( |
| 15 | - 'facebook' => get_post_meta( get_the_ID(), 'lsx_facebook', true ), |
|
| 16 | - 'twitter' => get_post_meta( get_the_ID(), 'lsx_twitter', true ), |
|
| 17 | - 'linkedin' => get_post_meta( get_the_ID(), 'lsx_linkedin', true ), |
|
| 18 | - 'github' => get_post_meta( get_the_ID(), 'lsx_github', true ), |
|
| 19 | - 'wordpress' => get_post_meta( get_the_ID(), 'lsx_wordpress', true ), |
|
| 15 | + 'facebook' => get_post_meta(get_the_ID(), 'lsx_facebook', true), |
|
| 16 | + 'twitter' => get_post_meta(get_the_ID(), 'lsx_twitter', true), |
|
| 17 | + 'linkedin' => get_post_meta(get_the_ID(), 'lsx_linkedin', true), |
|
| 18 | + 'github' => get_post_meta(get_the_ID(), 'lsx_github', true), |
|
| 19 | + 'wordpress' => get_post_meta(get_the_ID(), 'lsx_wordpress', true), |
|
| 20 | 20 | ); |
| 21 | 21 | |
| 22 | - foreach ( $links as $service => $link ) { |
|
| 23 | - if ( empty( $link ) ) { |
|
| 24 | - unset( $links[ $service ] ); |
|
| 22 | + foreach ($links as $service => $link) { |
|
| 23 | + if (empty($link)) { |
|
| 24 | + unset($links[$service]); |
|
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - $email = get_post_meta( get_the_ID(), 'lsx_email_contact', true ); |
|
| 29 | - $phone = get_post_meta( get_the_ID(), 'lsx_tel', true ); |
|
| 30 | - $skype = get_post_meta( get_the_ID(), 'lsx_skype', true ); |
|
| 28 | + $email = get_post_meta(get_the_ID(), 'lsx_email_contact', true); |
|
| 29 | + $phone = get_post_meta(get_the_ID(), 'lsx_tel', true); |
|
| 30 | + $skype = get_post_meta(get_the_ID(), 'lsx_skype', true); |
|
| 31 | 31 | |
| 32 | 32 | $phone_attr = $phone; |
| 33 | - $phone_attr = str_replace( ' ', '', $phone_attr ); |
|
| 34 | - $phone_attr = str_replace( '+', '', $phone_attr ); |
|
| 35 | - $phone_attr = str_replace( '(', '', $phone_attr ); |
|
| 36 | - $phone_attr = str_replace( ')', '', $phone_attr ); |
|
| 37 | - $phone_attr = str_replace( '.', '', $phone_attr ); |
|
| 33 | + $phone_attr = str_replace(' ', '', $phone_attr); |
|
| 34 | + $phone_attr = str_replace('+', '', $phone_attr); |
|
| 35 | + $phone_attr = str_replace('(', '', $phone_attr); |
|
| 36 | + $phone_attr = str_replace(')', '', $phone_attr); |
|
| 37 | + $phone_attr = str_replace('.', '', $phone_attr); |
|
| 38 | 38 | |
| 39 | 39 | // Tabs |
| 40 | 40 | |
@@ -42,13 +42,13 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | // Tab Posts |
| 44 | 44 | |
| 45 | - $site_user = get_post_meta( get_the_ID(), 'lsx_site_user', true ); |
|
| 45 | + $site_user = get_post_meta(get_the_ID(), 'lsx_site_user', true); |
|
| 46 | 46 | |
| 47 | - if ( ! empty( $site_user ) ) { |
|
| 48 | - if ( is_user_member_of_blog( $site_user ) ) { |
|
| 49 | - $user_posts = count_user_posts( $site_user, 'post' ); |
|
| 47 | + if (!empty($site_user)) { |
|
| 48 | + if (is_user_member_of_blog($site_user)) { |
|
| 49 | + $user_posts = count_user_posts($site_user, 'post'); |
|
| 50 | 50 | |
| 51 | - if ( $user_posts > 0 ) { |
|
| 51 | + if ($user_posts > 0) { |
|
| 52 | 52 | $params = array( |
| 53 | 53 | 'post_type' => 'post', |
| 54 | 54 | 'author' => $site_user, |
@@ -76,16 +76,16 @@ discard block |
||
| 76 | 76 | ), |
| 77 | 77 | ); |
| 78 | 78 | |
| 79 | - $posts_query = new \WP_Query( $params ); |
|
| 79 | + $posts_query = new \WP_Query($params); |
|
| 80 | 80 | |
| 81 | - if ( $posts_query->have_posts() ) { |
|
| 81 | + if ($posts_query->have_posts()) { |
|
| 82 | 82 | $tab_post['post_type'] = 'post'; |
| 83 | - $tab_post['title'] = esc_html__( 'Posts', 'lsx-team' ); |
|
| 83 | + $tab_post['title'] = esc_html__('Posts', 'lsx-team'); |
|
| 84 | 84 | $tab_post['posts'] = $posts_query->posts; |
| 85 | 85 | |
| 86 | - if ( ! empty( $tab_post['posts'] ) ) { |
|
| 87 | - $post_ids = join( ',', $tab_post['posts'] ); |
|
| 88 | - $tab_post['shortcode'] = '[lsx_posts columns="3" limit="9" include="' . $post_ids . '"]'; |
|
| 86 | + if (!empty($tab_post['posts'])) { |
|
| 87 | + $post_ids = join(',', $tab_post['posts']); |
|
| 88 | + $tab_post['shortcode'] = '[lsx_posts columns="3" limit="9" include="'.$post_ids.'"]'; |
|
| 89 | 89 | $tabs[] = $tab_post; |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -96,25 +96,25 @@ discard block |
||
| 96 | 96 | // Tab Projects |
| 97 | 97 | |
| 98 | 98 | $tab_project['post_type'] = 'project'; |
| 99 | - $tab_project['title'] = esc_html__( 'Projects', 'lsx-team' ); |
|
| 100 | - $tab_project['posts'] = get_post_meta( get_the_ID(), 'project_to_team', true ); |
|
| 99 | + $tab_project['title'] = esc_html__('Projects', 'lsx-team'); |
|
| 100 | + $tab_project['posts'] = get_post_meta(get_the_ID(), 'project_to_team', true); |
|
| 101 | 101 | |
| 102 | - if ( is_plugin_active( 'lsx-projects/lsx-projects.php' ) && ( ! empty( $tab_project['posts'] ) ) ) { |
|
| 103 | - $post_ids = join( ',', $tab_project['posts'] ); |
|
| 104 | - $tab_project['shortcode'] = '[lsx_projects columns="3" include="' . $post_ids . '"]'; |
|
| 102 | + if (is_plugin_active('lsx-projects/lsx-projects.php') && (!empty($tab_project['posts']))) { |
|
| 103 | + $post_ids = join(',', $tab_project['posts']); |
|
| 104 | + $tab_project['shortcode'] = '[lsx_projects columns="3" include="'.$post_ids.'"]'; |
|
| 105 | 105 | $tabs[] = $tab_project; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | // Tab Services |
| 109 | 109 | |
| 110 | - if ( is_plugin_active( 'lsx-services/lsx-services.php' ) ) { |
|
| 110 | + if (is_plugin_active('lsx-services/lsx-services.php')) { |
|
| 111 | 111 | $tab_service['post_type'] = 'service'; |
| 112 | - $tab_service['title'] = esc_html__( 'Services', 'lsx-team' ); |
|
| 113 | - $tab_service['posts'] = get_post_meta( get_the_ID(), 'service_to_team', true ); |
|
| 112 | + $tab_service['title'] = esc_html__('Services', 'lsx-team'); |
|
| 113 | + $tab_service['posts'] = get_post_meta(get_the_ID(), 'service_to_team', true); |
|
| 114 | 114 | |
| 115 | - if ( ! empty( $tab_service['posts'] ) ) { |
|
| 116 | - $post_ids = join( ',', $tab_service['posts'] ); |
|
| 117 | - $tab_service['shortcode'] = '[lsx_services columns="3" include="' . $post_ids . '"]'; |
|
| 115 | + if (!empty($tab_service['posts'])) { |
|
| 116 | + $post_ids = join(',', $tab_service['posts']); |
|
| 117 | + $tab_service['shortcode'] = '[lsx_services columns="3" include="'.$post_ids.'"]'; |
|
| 118 | 118 | $tabs[] = $tab_service; |
| 119 | 119 | } |
| 120 | 120 | } |
@@ -122,18 +122,18 @@ discard block |
||
| 122 | 122 | // Tab Testimonials |
| 123 | 123 | |
| 124 | 124 | $tab_testimonial['post_type'] = 'testimonial'; |
| 125 | - $tab_testimonial['title'] = esc_html__( 'Testimonials', 'lsx-team' ); |
|
| 126 | - $tab_testimonial['posts'] = get_post_meta( get_the_ID(), 'testimonial_to_team', true ); |
|
| 125 | + $tab_testimonial['title'] = esc_html__('Testimonials', 'lsx-team'); |
|
| 126 | + $tab_testimonial['posts'] = get_post_meta(get_the_ID(), 'testimonial_to_team', true); |
|
| 127 | 127 | |
| 128 | - if ( is_plugin_active( 'lsx-testimonials/lsx-testimonials.php' ) && ( ! empty( $tab_testimonial['posts'] ) ) ) { |
|
| 129 | - if ( count( $tab_testimonial['posts'] ) <= 2 ) { |
|
| 130 | - $columns = count( $tab_testimonial['posts'] ); |
|
| 128 | + if (is_plugin_active('lsx-testimonials/lsx-testimonials.php') && (!empty($tab_testimonial['posts']))) { |
|
| 129 | + if (count($tab_testimonial['posts']) <= 2) { |
|
| 130 | + $columns = count($tab_testimonial['posts']); |
|
| 131 | 131 | } else { |
| 132 | 132 | $columns = 2; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $post_ids = join( ',', $tab_testimonial['posts'] ); |
|
| 136 | - $tab_testimonial['shortcode'] = '[lsx_testimonials columns="' . $columns . '" include="' . $post_ids . '" orderby="date" order="DESC" display="excerpt"]'; |
|
| 135 | + $post_ids = join(',', $tab_testimonial['posts']); |
|
| 136 | + $tab_testimonial['shortcode'] = '[lsx_testimonials columns="'.$columns.'" include="'.$post_ids.'" orderby="date" order="DESC" display="excerpt"]'; |
|
| 137 | 137 | $tabs[] = $tab_testimonial; |
| 138 | 138 | } |
| 139 | 139 | ?> |
@@ -147,15 +147,15 @@ discard block |
||
| 147 | 147 | <div class="row"> |
| 148 | 148 | <div class="col-xs-12 col-sm-6 col-md-4"> |
| 149 | 149 | <figure class="lsx-team-avatar"> |
| 150 | - <?php echo wp_kses_post( $thumbnail ); ?> |
|
| 150 | + <?php echo wp_kses_post($thumbnail); ?> |
|
| 151 | 151 | </figure> |
| 152 | 152 | |
| 153 | - <?php if ( count( $links ) > 0 ) : ?> |
|
| 154 | - <span class="lsx-team-socials-header"><?php echo esc_html__( 'Follow', 'lsx-team' ) . ':'; ?></span> |
|
| 153 | + <?php if (count($links) > 0) : ?> |
|
| 154 | + <span class="lsx-team-socials-header"><?php echo esc_html__('Follow', 'lsx-team').':'; ?></span> |
|
| 155 | 155 | |
| 156 | 156 | <ul class="lsx-team-socials list-inline"> |
| 157 | - <?php foreach ( $links as $service => $link ) : ?> |
|
| 158 | - <li><a href="<?php echo esc_html( $link ); ?>" target="_blank" rel="nofollow noreferrer noopener"><i class="fa fa-<?php echo esc_html( $service ); ?>" aria-hidden="true"></i></a></li> |
|
| 157 | + <?php foreach ($links as $service => $link) : ?> |
|
| 158 | + <li><a href="<?php echo esc_html($link); ?>" target="_blank" rel="nofollow noreferrer noopener"><i class="fa fa-<?php echo esc_html($service); ?>" aria-hidden="true"></i></a></li> |
|
| 159 | 159 | <?php endforeach; ?> |
| 160 | 160 | </ul> |
| 161 | 161 | <?php endif; ?> |
@@ -163,39 +163,39 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | <div class="col-xs-12 col-sm-6 col-md-8"> |
| 165 | 165 | <h2 class="lsx-team-name"><?php the_title(); ?></h2> |
| 166 | - <h5 class="lsx-team-job-title"><?php echo esc_html( $job_title ); ?></h5> |
|
| 166 | + <h5 class="lsx-team-job-title"><?php echo esc_html($job_title); ?></h5> |
|
| 167 | 167 | <div class="lsx-team-content"><?php the_content(); ?></div> |
| 168 | 168 | |
| 169 | - <?php if ( ! empty( $email ) || ! empty( $phone ) || ! empty( $skype ) ) : ?> |
|
| 169 | + <?php if (!empty($email) || !empty($phone) || !empty($skype)) : ?> |
|
| 170 | 170 | <ul class="lsx-team-contact list-inline"> |
| 171 | - <?php if ( ! empty( $email ) ) : ?> |
|
| 172 | - <li><a href="mailto:<?php echo esc_attr( $email ); ?>"><i class="fa fa-envelope-o" aria-hidden="true"></i> <?php echo esc_attr( $email ); ?></a></li> |
|
| 171 | + <?php if (!empty($email)) : ?> |
|
| 172 | + <li><a href="mailto:<?php echo esc_attr($email); ?>"><i class="fa fa-envelope-o" aria-hidden="true"></i> <?php echo esc_attr($email); ?></a></li> |
|
| 173 | 173 | <?php endif; ?> |
| 174 | 174 | |
| 175 | - <?php if ( ! empty( $phone ) ) : ?> |
|
| 176 | - <li><a href="tel:<?php echo esc_attr( $phone_attr ); ?>"><i class="fa fa-phone" aria-hidden="true"></i> <?php echo esc_attr( $phone ); ?></a></li> |
|
| 175 | + <?php if (!empty($phone)) : ?> |
|
| 176 | + <li><a href="tel:<?php echo esc_attr($phone_attr); ?>"><i class="fa fa-phone" aria-hidden="true"></i> <?php echo esc_attr($phone); ?></a></li> |
|
| 177 | 177 | <?php endif; ?> |
| 178 | 178 | |
| 179 | - <?php if ( ! empty( $skype ) ) : ?> |
|
| 180 | - <li><i class="fa fa-skype" aria-hidden="true"></i> <?php echo esc_attr( $skype ); ?></li> |
|
| 179 | + <?php if (!empty($skype)) : ?> |
|
| 180 | + <li><i class="fa fa-skype" aria-hidden="true"></i> <?php echo esc_attr($skype); ?></li> |
|
| 181 | 181 | <?php endif; ?> |
| 182 | 182 | </ul> |
| 183 | 183 | <?php endif; ?> |
| 184 | 184 | </div> |
| 185 | 185 | </div> |
| 186 | 186 | |
| 187 | - <?php if ( count( $tabs ) > 0 ) : ?> |
|
| 187 | + <?php if (count($tabs) > 0) : ?> |
|
| 188 | 188 | <div class="entry-tabs"> |
| 189 | 189 | <ul class="nav nav-tabs"> |
| 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> |
|
| 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> |
|
| 192 | 192 | <?php endforeach; ?> |
| 193 | 193 | </ul> |
| 194 | 194 | |
| 195 | 195 | <div class="tab-content"> |
| 196 | - <?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'; ?>"> |
|
| 198 | - <?php echo do_shortcode( $tab['shortcode'] ); ?> |
|
| 196 | + <?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'; ?>"> |
|
| 198 | + <?php echo do_shortcode($tab['shortcode']); ?> |
|
| 199 | 199 | </div> |
| 200 | 200 | <?php endforeach; ?> |
| 201 | 201 | </div> |
@@ -4,30 +4,30 @@ |
||
| 4 | 4 | */ |
| 5 | 5 | ?> |
| 6 | 6 | |
| 7 | -<?php if ( ! empty( team_get_option( 'team_careers_cta_enable' ) ) ) : ?> |
|
| 7 | +<?php if (!empty(team_get_option('team_careers_cta_enable'))) : ?> |
|
| 8 | 8 | <?php |
| 9 | 9 | $thumbnail = '<img loading="lazy" class="img-responsive wp-post-image" src="https://www.gravatar.com/avatar/none?d=mm&s=170" width="170" />'; |
| 10 | - $title = team_get_option( 'team_careers_cta_title' ); |
|
| 11 | - $tagline = team_get_option( 'team_careers_cta_tagline' ); |
|
| 12 | - $link_text = team_get_option( 'team_careers_cta_link_text' ); |
|
| 13 | - $link = team_get_option( 'team_careers_cta_link' ); |
|
| 10 | + $title = team_get_option('team_careers_cta_title'); |
|
| 11 | + $tagline = team_get_option('team_careers_cta_tagline'); |
|
| 12 | + $link_text = team_get_option('team_careers_cta_link_text'); |
|
| 13 | + $link = team_get_option('team_careers_cta_link'); |
|
| 14 | 14 | ?> |
| 15 | 15 | |
| 16 | 16 | <div class="col-xs-12 col-sm-6 col-md-3"> |
| 17 | 17 | <article class="lsx-team-slot"> |
| 18 | 18 | <figure class="lsx-team-avatar"> |
| 19 | - <a href="<?php echo esc_attr( $link ); ?>"><?php echo wp_kses_post( $thumbnail ); ?></a> |
|
| 19 | + <a href="<?php echo esc_attr($link); ?>"><?php echo wp_kses_post($thumbnail); ?></a> |
|
| 20 | 20 | </figure> |
| 21 | 21 | |
| 22 | 22 | <h5 class="lsx-team-name"> |
| 23 | - <a href="<?php echo esc_attr( $link ); ?>"><?php echo esc_html( $title ); ?></a> |
|
| 23 | + <a href="<?php echo esc_attr($link); ?>"><?php echo esc_html($title); ?></a> |
|
| 24 | 24 | </h5> |
| 25 | 25 | |
| 26 | - <?php if ( ! empty( $tagline ) ) : ?> |
|
| 27 | - <small class="lsx-team-job-title"><?php echo esc_html( $tagline ); ?></small> |
|
| 26 | + <?php if (!empty($tagline)) : ?> |
|
| 27 | + <small class="lsx-team-job-title"><?php echo esc_html($tagline); ?></small> |
|
| 28 | 28 | <?php endif; ?> |
| 29 | 29 | |
| 30 | - <a href="<?php echo esc_attr( $link ); ?>" class="lsx-team-show-more"><?php echo esc_html( $link_text ); ?> <i class="fa fa-long-arrow-right"></i></a> |
|
| 30 | + <a href="<?php echo esc_attr($link); ?>" class="lsx-team-show-more"><?php echo esc_html($link_text); ?> <i class="fa fa-long-arrow-right"></i></a> |
|
| 31 | 31 | </article> |
| 32 | 32 | </div> |
| 33 | 33 | <?php endif; ?> |
@@ -7,9 +7,9 @@ discard block |
||
| 7 | 7 | <?php |
| 8 | 8 | global $lsx_team; |
| 9 | 9 | |
| 10 | - $thumbnail = $lsx_team->get_thumbnail( get_the_ID(), 'lsx-team-archive' ); |
|
| 10 | + $thumbnail = $lsx_team->get_thumbnail(get_the_ID(), 'lsx-team-archive'); |
|
| 11 | 11 | |
| 12 | - $job_title = get_post_meta( get_the_ID(), 'lsx_job_title', true ); |
|
| 12 | + $job_title = get_post_meta(get_the_ID(), 'lsx_job_title', true); |
|
| 13 | 13 | ?> |
| 14 | 14 | |
| 15 | 15 | <?php lsx_entry_before(); ?> |
@@ -17,28 +17,28 @@ discard block |
||
| 17 | 17 | <div class="col-xs-12 col-sm-6 col-md-3"> |
| 18 | 18 | <article class="lsx-team-slot"> |
| 19 | 19 | <figure class="lsx-team-avatar"> |
| 20 | - <?php if ( empty( team_get_option( 'team_disable_single' ) ) ) : ?> |
|
| 21 | - <a href="<?php the_permalink(); ?>"><?php echo wp_kses_post( $thumbnail ); ?></a> |
|
| 20 | + <?php if (empty(team_get_option('team_disable_single'))) : ?> |
|
| 21 | + <a href="<?php the_permalink(); ?>"><?php echo wp_kses_post($thumbnail); ?></a> |
|
| 22 | 22 | <?php else : ?> |
| 23 | - <?php echo wp_kses_post( $thumbnail ); ?> |
|
| 23 | + <?php echo wp_kses_post($thumbnail); ?> |
|
| 24 | 24 | <?php endif; ?> |
| 25 | 25 | </figure> |
| 26 | 26 | |
| 27 | 27 | <h5 class="lsx-team-name"> |
| 28 | - <?php if ( empty( team_get_option( 'team_disable_single' ) ) ) : ?> |
|
| 28 | + <?php if (empty(team_get_option('team_disable_single'))) : ?> |
|
| 29 | 29 | <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> |
| 30 | 30 | <?php else : ?> |
| 31 | 31 | <?php the_title(); ?> |
| 32 | 32 | <?php endif; ?> |
| 33 | 33 | </h5> |
| 34 | 34 | |
| 35 | - <?php if ( ! empty( $job_title ) ) : ?> |
|
| 36 | - <small class="lsx-team-job-title"><?php echo wp_kses_post( $job_title ); ?></small> |
|
| 35 | + <?php if (!empty($job_title)) : ?> |
|
| 36 | + <small class="lsx-team-job-title"><?php echo wp_kses_post($job_title); ?></small> |
|
| 37 | 37 | <?php endif; ?> |
| 38 | 38 | |
| 39 | - <?php if ( empty( team_get_option( 'team_disable_single' ) ) ) : ?> |
|
| 39 | + <?php if (empty(team_get_option('team_disable_single'))) : ?> |
|
| 40 | 40 | <?php /* translators: %s: search term */ ?> |
| 41 | - <a href="<?php the_permalink(); ?>" class="lsx-team-show-more"><?php printf( esc_html__( ' More about %s', 'lsx-team' ), esc_html( strtok( get_the_title(), ' ' ) ) ); ?> <i class="fa fa-long-arrow-right"></i></a> |
|
| 41 | + <a href="<?php the_permalink(); ?>" class="lsx-team-show-more"><?php printf(esc_html__(' More about %s', 'lsx-team'), esc_html(strtok(get_the_title(), ' '))); ?> <i class="fa fa-long-arrow-right"></i></a> |
|
| 42 | 42 | <?php endif; ?> |
| 43 | 43 | </article> |
| 44 | 44 | </div> |
@@ -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 | |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | <?php lsx_content_wrap_before(); ?> |
| 11 | 11 | |
| 12 | -<div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
| 12 | +<div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
| 13 | 13 | |
| 14 | 14 | <?php lsx_content_before(); ?> |
| 15 | 15 | |
@@ -17,18 +17,18 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | <?php lsx_content_top(); ?> |
| 19 | 19 | |
| 20 | - <?php if ( have_posts() ) : ?> |
|
| 20 | + <?php if (have_posts()) : ?> |
|
| 21 | 21 | |
| 22 | 22 | <div class="lsx-team-container"> |
| 23 | 23 | <div class="row row-flex"> |
| 24 | 24 | |
| 25 | 25 | <?php |
| 26 | - while ( have_posts() ) { |
|
| 26 | + while (have_posts()) { |
|
| 27 | 27 | the_post(); |
| 28 | - include( LSX_TEAM_PATH . '/templates/content-archive-team.php' ); |
|
| 28 | + include(LSX_TEAM_PATH.'/templates/content-archive-team.php'); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - include( LSX_TEAM_PATH . '/templates/content-archive-team-careers-cta.php' ); |
|
| 31 | + include(LSX_TEAM_PATH.'/templates/content-archive-team-careers-cta.php'); |
|
| 32 | 32 | ?> |
| 33 | 33 | |
| 34 | 34 | </div> |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | <?php else : ?> |
| 40 | 40 | |
| 41 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
| 41 | + <?php get_template_part('partials/content', 'none'); ?> |
|
| 42 | 42 | |
| 43 | 43 | <?php endif; ?> |
| 44 | 44 | |
@@ -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 | |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | * |
| 16 | 16 | * @param \WPSEO_Schema_Context $context A value object with context variables. |
| 17 | 17 | */ |
| 18 | - public function __construct( WPSEO_Schema_Context $context ) { |
|
| 18 | + public function __construct(WPSEO_Schema_Context $context) { |
|
| 19 | 19 | $this->post_type = 'team'; |
| 20 | - parent::__construct( $context ); |
|
| 20 | + parent::__construct($context); |
|
| 21 | 21 | } |
| 22 | 22 | /** |
| 23 | 23 | * Returns Review data. |
@@ -29,22 +29,22 @@ discard block |
||
| 29 | 29 | '@type' => array( |
| 30 | 30 | 'Person', |
| 31 | 31 | ), |
| 32 | - '@id' => $this->context->canonical . '#person', |
|
| 32 | + '@id' => $this->context->canonical.'#person', |
|
| 33 | 33 | 'name' => $this->post->post_title, |
| 34 | - 'description' => wp_strip_all_tags( $this->post->post_content ), |
|
| 34 | + 'description' => wp_strip_all_tags($this->post->post_content), |
|
| 35 | 35 | 'url' => $this->post_url, |
| 36 | 36 | 'mainEntityOfPage' => array( |
| 37 | - '@id' => $this->context->canonical . WPSEO_Schema_IDs::WEBPAGE_HASH, |
|
| 37 | + '@id' => $this->context->canonical.WPSEO_Schema_IDs::WEBPAGE_HASH, |
|
| 38 | 38 | ), |
| 39 | 39 | ); |
| 40 | - if ( $this->context->site_represents_reference ) { |
|
| 40 | + if ($this->context->site_represents_reference) { |
|
| 41 | 41 | $data['worksFor'] = $this->context->site_represents_reference; |
| 42 | 42 | $data['memberOf'] = $this->context->site_represents_reference; |
| 43 | 43 | } |
| 44 | - $data = $this->add_custom_field( $data, 'jobTitle', 'lsx_job_title' ); |
|
| 45 | - $data = $this->add_custom_field( $data, 'email', 'lsx_email_contact' ); |
|
| 46 | - $data = $this->add_custom_field( $data, 'telephone', 'lsx_tel' ); |
|
| 47 | - $data = LSX_Schema_Utils::add_image( $data, $this->context ); |
|
| 44 | + $data = $this->add_custom_field($data, 'jobTitle', 'lsx_job_title'); |
|
| 45 | + $data = $this->add_custom_field($data, 'email', 'lsx_email_contact'); |
|
| 46 | + $data = $this->add_custom_field($data, 'telephone', 'lsx_tel'); |
|
| 47 | + $data = LSX_Schema_Utils::add_image($data, $this->context); |
|
| 48 | 48 | return $data; |
| 49 | 49 | } |
| 50 | 50 | /** |
@@ -53,11 +53,11 @@ discard block |
||
| 53 | 53 | * @param array $data |
| 54 | 54 | * @return array |
| 55 | 55 | */ |
| 56 | - public function add_products( $data ) { |
|
| 56 | + public function add_products($data) { |
|
| 57 | 57 | $connections_array = array(); |
| 58 | - $connections_array = $this->add_project( $connections_array ); |
|
| 59 | - $connections_array = $this->add_testimonial( $connections_array ); |
|
| 60 | - if ( ! empty( $connections_array ) ) { |
|
| 58 | + $connections_array = $this->add_project($connections_array); |
|
| 59 | + $connections_array = $this->add_testimonial($connections_array); |
|
| 60 | + if (!empty($connections_array)) { |
|
| 61 | 61 | $data['owns'] = $connections_array; |
| 62 | 62 | } |
| 63 | 63 | return $data; |
@@ -15,23 +15,23 @@ discard block |
||
| 15 | 15 | public function __construct() { |
| 16 | 16 | $this->options = team_get_options(); |
| 17 | 17 | |
| 18 | - add_action( 'init', array( $this, 'custom_image_sizes' ) ); |
|
| 19 | - add_filter( 'lsx_banner_allowed_post_types', array( $this, 'lsx_banner_allowed_post_types' ) ); |
|
| 18 | + add_action('init', array($this, 'custom_image_sizes')); |
|
| 19 | + add_filter('lsx_banner_allowed_post_types', array($this, 'lsx_banner_allowed_post_types')); |
|
| 20 | 20 | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * Enable project custom post type on LSX Banners. |
| 25 | 25 | */ |
| 26 | - public function custom_image_sizes( $post_types ) { |
|
| 27 | - add_image_size( 'lsx-team-archive', 170, 170, true ); |
|
| 28 | - add_image_size( 'lsx-team-single', 320, 320, true ); |
|
| 26 | + public function custom_image_sizes($post_types) { |
|
| 27 | + add_image_size('lsx-team-archive', 170, 170, true); |
|
| 28 | + add_image_size('lsx-team-single', 320, 320, true); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * Enable project custom post type on LSX Banners. |
| 33 | 33 | */ |
| 34 | - public function lsx_banner_allowed_post_types( $post_types ) { |
|
| 34 | + public function lsx_banner_allowed_post_types($post_types) { |
|
| 35 | 35 | $post_types[] = 'team'; |
| 36 | 36 | return $post_types; |
| 37 | 37 | } |
@@ -39,39 +39,39 @@ discard block |
||
| 39 | 39 | /** |
| 40 | 40 | * Return the team thumbnail. |
| 41 | 41 | */ |
| 42 | - public function get_thumbnail( $post_id, $size ) { |
|
| 43 | - add_filter( 'lsx_placeholder_url', array( $this, 'placeholder' ), 10, 1 ); |
|
| 44 | - add_filter( 'lsx_to_placeholder_url', array( $this, 'placeholder' ), 10, 1 ); |
|
| 42 | + public function get_thumbnail($post_id, $size) { |
|
| 43 | + add_filter('lsx_placeholder_url', array($this, 'placeholder'), 10, 1); |
|
| 44 | + add_filter('lsx_to_placeholder_url', array($this, 'placeholder'), 10, 1); |
|
| 45 | 45 | |
| 46 | - if ( is_numeric( $size ) ) { |
|
| 47 | - $thumb_size = array( $size, $size ); |
|
| 46 | + if (is_numeric($size)) { |
|
| 47 | + $thumb_size = array($size, $size); |
|
| 48 | 48 | } else { |
| 49 | 49 | $thumb_size = $size; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $thumbnail_class = 'img-responsive'; |
| 53 | 53 | |
| 54 | - if ( ! empty( get_the_post_thumbnail( $post_id ) ) || ! empty( get_post_meta( $post_id, 'lsx_email_gravatar', true ) ) ) { |
|
| 55 | - if ( ! empty( get_the_post_thumbnail( $post_id ) ) ) { |
|
| 56 | - $thumbnail = get_the_post_thumbnail( $post_id, $thumb_size, array( |
|
| 54 | + if (!empty(get_the_post_thumbnail($post_id)) || !empty(get_post_meta($post_id, 'lsx_email_gravatar', true))) { |
|
| 55 | + if (!empty(get_the_post_thumbnail($post_id))) { |
|
| 56 | + $thumbnail = get_the_post_thumbnail($post_id, $thumb_size, array( |
|
| 57 | 57 | 'class' => $thumbnail_class, |
| 58 | - ) ); |
|
| 58 | + )); |
|
| 59 | 59 | } else { |
| 60 | - $thumbnail = get_avatar( get_post_meta( $post_id, 'lsx_email_gravatar', true ), $size, $this->options['display']['team_placeholder'], false, array( |
|
| 60 | + $thumbnail = get_avatar(get_post_meta($post_id, 'lsx_email_gravatar', true), $size, $this->options['display']['team_placeholder'], false, array( |
|
| 61 | 61 | 'class' => $thumbnail_class, |
| 62 | - ) ); |
|
| 62 | + )); |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | - if ( empty( $thumbnail ) ) { |
|
| 66 | - if ( $this->options['display'] && ! empty( $this->options['display']['team_placeholder'] ) ) { |
|
| 67 | - $thumbnail = '<img loading="lazy" class="img-responsive wp-post-image" src="' . $this->options['display']['team_placeholder'] . '" width="' . $size . '" />'; |
|
| 65 | + if (empty($thumbnail)) { |
|
| 66 | + if ($this->options['display'] && !empty($this->options['display']['team_placeholder'])) { |
|
| 67 | + $thumbnail = '<img loading="lazy" class="img-responsive wp-post-image" src="'.$this->options['display']['team_placeholder'].'" width="'.$size.'" />'; |
|
| 68 | 68 | } else { |
| 69 | - $thumbnail = '<img loading="lazy" class="img-responsive wp-post-image" src="https://www.gravatar.com/avatar/none?d=mm&s=' . $size . '" width="' . $size . '" />'; |
|
| 69 | + $thumbnail = '<img loading="lazy" class="img-responsive wp-post-image" src="https://www.gravatar.com/avatar/none?d=mm&s='.$size.'" width="'.$size.'" />'; |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - remove_filter( 'lsx_placeholder_url', array( $this, 'placeholder' ), 10, 1 ); |
|
| 74 | - remove_filter( 'lsx_to_placeholder_url', array( $this, 'placeholder' ), 10, 1 ); |
|
| 73 | + remove_filter('lsx_placeholder_url', array($this, 'placeholder'), 10, 1); |
|
| 74 | + remove_filter('lsx_to_placeholder_url', array($this, 'placeholder'), 10, 1); |
|
| 75 | 75 | |
| 76 | 76 | return $thumbnail; |
| 77 | 77 | } |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | /** |
| 80 | 80 | * Replaces the widget with Mystery Man |
| 81 | 81 | */ |
| 82 | - public function placeholder( $image ) { |
|
| 82 | + public function placeholder($image) { |
|
| 83 | 83 | $image = array( |
| 84 | - LSX_TEAM_URL . 'assets/img/mystery-man-square.png', |
|
| 84 | + LSX_TEAM_URL.'assets/img/mystery-man-square.png', |
|
| 85 | 85 | 512, |
| 86 | 86 | 512, |
| 87 | 87 | true, |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | /** |
| 94 | 94 | * Returns the shortcode output markup |
| 95 | 95 | */ |
| 96 | - public function output( $atts ) { |
|
| 97 | - extract( shortcode_atts(array( |
|
| 96 | + public function output($atts) { |
|
| 97 | + extract(shortcode_atts(array( |
|
| 98 | 98 | 'columns' => 4, |
| 99 | 99 | 'orderby' => 'name', |
| 100 | 100 | 'order' => 'ASC', |
@@ -112,12 +112,12 @@ discard block |
||
| 112 | 112 | 'show_social' => true, |
| 113 | 113 | 'carousel' => true, |
| 114 | 114 | 'featured' => false, |
| 115 | - ), $atts ) ); |
|
| 115 | + ), $atts)); |
|
| 116 | 116 | |
| 117 | 117 | $output = ''; |
| 118 | 118 | |
| 119 | - if ( ! empty( $include ) ) { |
|
| 120 | - $include = explode( ',', $include ); |
|
| 119 | + if (!empty($include)) { |
|
| 120 | + $include = explode(',', $include); |
|
| 121 | 121 | |
| 122 | 122 | $args = array( |
| 123 | 123 | 'post_type' => 'team', |
@@ -134,13 +134,13 @@ discard block |
||
| 134 | 134 | 'order' => $order, |
| 135 | 135 | ); |
| 136 | 136 | |
| 137 | - if ( 'true' === $featured || true === $featured ) { |
|
| 137 | + if ('true' === $featured || true === $featured) { |
|
| 138 | 138 | $args['meta_key'] = 'lsx_featured'; |
| 139 | 139 | $args['meta_value'] = 1; |
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - if ( ! empty( $role ) ) { |
|
| 143 | + if (!empty($role)) { |
|
| 144 | 144 | $args['tax_query'] = array( |
| 145 | 145 | array( |
| 146 | 146 | 'taxonomy' => 'team_role', |
@@ -150,32 +150,32 @@ discard block |
||
| 150 | 150 | ); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - $team = new \WP_Query( $args ); |
|
| 153 | + $team = new \WP_Query($args); |
|
| 154 | 154 | |
| 155 | - if ( $team->have_posts() ) { |
|
| 155 | + if ($team->have_posts()) { |
|
| 156 | 156 | global $post; |
| 157 | 157 | |
| 158 | 158 | $count = 0; |
| 159 | 159 | $count_global = 0; |
| 160 | 160 | |
| 161 | - $column_size = intval( 12 / $columns ); |
|
| 161 | + $column_size = intval(12 / $columns); |
|
| 162 | 162 | |
| 163 | 163 | $carousel = true === $carousel || 'true' === $carousel ? true : false; |
| 164 | 164 | |
| 165 | - if ( $carousel ) { |
|
| 165 | + if ($carousel) { |
|
| 166 | 166 | $output .= "<div class='lsx-team-shortcode' id='lsx-team-slider' data-slick='{\"slidesToShow\": $columns, \"slidesToScroll\": $columns }'>"; |
| 167 | 167 | } else { |
| 168 | 168 | $output .= "<div class='lsx-team-shortcode'><div class='row'>"; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - while ( $team->have_posts() ) { |
|
| 171 | + while ($team->have_posts()) { |
|
| 172 | 172 | $team->the_post(); |
| 173 | 173 | |
| 174 | 174 | // Count |
| 175 | 175 | $count++; |
| 176 | 176 | $count_global++; |
| 177 | 177 | |
| 178 | - $member_name = apply_filters( 'the_title', $post->post_title ); |
|
| 178 | + $member_name = apply_filters('the_title', $post->post_title); |
|
| 179 | 179 | $member_roles = ''; |
| 180 | 180 | $member_description = ''; |
| 181 | 181 | $member_avatar = ''; |
@@ -183,91 +183,91 @@ discard block |
||
| 183 | 183 | $member_job_title = ''; |
| 184 | 184 | $member_email = ''; |
| 185 | 185 | $bottom_link = ''; |
| 186 | - $facebook = get_post_meta( $post->ID, 'lsx_facebook', true ); |
|
| 187 | - $twitter = get_post_meta( $post->ID, 'lsx_twitter', true ); |
|
| 188 | - $linkedin = get_post_meta( $post->ID, 'lsx_linkedin', true ); |
|
| 186 | + $facebook = get_post_meta($post->ID, 'lsx_facebook', true); |
|
| 187 | + $twitter = get_post_meta($post->ID, 'lsx_twitter', true); |
|
| 188 | + $linkedin = get_post_meta($post->ID, 'lsx_linkedin', true); |
|
| 189 | 189 | |
| 190 | 190 | // Link to single |
| 191 | - if ( ( true === $show_link || 'true' === $show_link ) && ( empty( team_get_option( 'team_disable_single' ) ) ) ) { |
|
| 192 | - $bottom_link = '<a href="' . get_permalink( $post->ID ) . '" class="lsx-team-show-more">More about ' . strtok( $member_name, ' ' ) . '<i class="fa fa-long-arrow-right" aria-hidden="true"></i></a>'; |
|
| 191 | + if ((true === $show_link || 'true' === $show_link) && (empty(team_get_option('team_disable_single')))) { |
|
| 192 | + $bottom_link = '<a href="'.get_permalink($post->ID).'" class="lsx-team-show-more">More about '.strtok($member_name, ' ').'<i class="fa fa-long-arrow-right" aria-hidden="true"></i></a>'; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - if ( true === $show_email || 'true' === $show_email ) { |
|
| 196 | - $email = get_post_meta( $post->ID, 'lsx_email_contact', true ); |
|
| 195 | + if (true === $show_email || 'true' === $show_email) { |
|
| 196 | + $email = get_post_meta($post->ID, 'lsx_email_contact', true); |
|
| 197 | 197 | |
| 198 | - $member_email = '<a href="mailto:' . sanitize_email( $email ) . '" class="lsx-team-email">' . sanitize_email( $email ) . '</a>'; |
|
| 198 | + $member_email = '<a href="mailto:'.sanitize_email($email).'" class="lsx-team-email">'.sanitize_email($email).'</a>'; |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - if ( ( true === $show_link || 'true' === $show_link ) && ( empty( team_get_option( 'team_disable_single' ) ) ) ) { |
|
| 202 | - $member_name = '<h5 class="lsx-team-name"><a href="' . get_permalink() . '">' . $member_name . '</a></h5>'; |
|
| 201 | + if ((true === $show_link || 'true' === $show_link) && (empty(team_get_option('team_disable_single')))) { |
|
| 202 | + $member_name = '<h5 class="lsx-team-name"><a href="'.get_permalink().'">'.$member_name.'</a></h5>'; |
|
| 203 | 203 | } else { |
| 204 | - $member_name = '<h5 class="lsx-team-name">' . $member_name . '</h5>'; |
|
| 204 | + $member_name = '<h5 class="lsx-team-name">'.$member_name.'</h5>'; |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | // Member roles |
| 208 | - if ( true === $show_roles || 'true' === $show_roles ) { |
|
| 208 | + if (true === $show_roles || 'true' === $show_roles) { |
|
| 209 | 209 | $roles = ''; |
| 210 | - $terms = get_the_terms( $post->ID, 'team_role' ); |
|
| 210 | + $terms = get_the_terms($post->ID, 'team_role'); |
|
| 211 | 211 | |
| 212 | - if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 212 | + if ($terms && !is_wp_error($terms)) { |
|
| 213 | 213 | $roles = array(); |
| 214 | 214 | |
| 215 | - foreach ( $terms as $term ) { |
|
| 215 | + foreach ($terms as $term) { |
|
| 216 | 216 | $roles[] = $term->name; |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - $roles = join( ', ', $roles ); |
|
| 219 | + $roles = join(', ', $roles); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | $member_roles = '' !== $roles ? "<small class='lsx-team-roles'>$roles</small>" : ''; |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - if ( true === $show_job_title || 'true' === $show_job_title ) { |
|
| 226 | - $job_title = get_post_meta( $post->ID, 'lsx_job_title', true ); |
|
| 227 | - $member_job_title = ! empty( $job_title ) ? "<small class='lsx-team-job-title'>$job_title</small>" : ''; |
|
| 225 | + if (true === $show_job_title || 'true' === $show_job_title) { |
|
| 226 | + $job_title = get_post_meta($post->ID, 'lsx_job_title', true); |
|
| 227 | + $member_job_title = !empty($job_title) ? "<small class='lsx-team-job-title'>$job_title</small>" : ''; |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | // Member description |
| 231 | - if ( true === $show_desc || 'true' === $show_desc ) { |
|
| 232 | - if ( 'full' === $display ) { |
|
| 233 | - $member_description = apply_filters( 'the_content', get_the_content( esc_html__( 'Read More', 'lsx-team' ) ) ); |
|
| 234 | - $member_description = str_replace( ']]>', ']]>', $member_description ); |
|
| 235 | - } elseif ( 'excerpt' === $display ) { |
|
| 236 | - $member_description = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
| 231 | + if (true === $show_desc || 'true' === $show_desc) { |
|
| 232 | + if ('full' === $display) { |
|
| 233 | + $member_description = apply_filters('the_content', get_the_content(esc_html__('Read More', 'lsx-team'))); |
|
| 234 | + $member_description = str_replace(']]>', ']]>', $member_description); |
|
| 235 | + } elseif ('excerpt' === $display) { |
|
| 236 | + $member_description = apply_filters('the_excerpt', get_the_excerpt()); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - $member_description = ! empty( $member_description ) ? "<div class='lsx-team-description'>$member_description</div>" : ''; |
|
| 239 | + $member_description = !empty($member_description) ? "<div class='lsx-team-description'>$member_description</div>" : ''; |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | // Member avatar |
| 243 | - if ( true === $show_image || 'true' === $show_image ) { |
|
| 244 | - $member_avatar = $this->get_thumbnail( $post->ID, $size ); |
|
| 243 | + if (true === $show_image || 'true' === $show_image) { |
|
| 244 | + $member_avatar = $this->get_thumbnail($post->ID, $size); |
|
| 245 | 245 | |
| 246 | - if ( ( true === $show_link || 'true' === $show_link ) && ( empty( $this->options['display'] ) || empty( team_get_option( 'team_disable_single' ) ) ) ) { |
|
| 247 | - $member_avatar = "<figure class='lsx-team-avatar'><a href='" . get_permalink() . "'>$member_avatar</a></figure>"; |
|
| 246 | + if ((true === $show_link || 'true' === $show_link) && (empty($this->options['display']) || empty(team_get_option('team_disable_single')))) { |
|
| 247 | + $member_avatar = "<figure class='lsx-team-avatar'><a href='".get_permalink()."'>$member_avatar</a></figure>"; |
|
| 248 | 248 | } else { |
| 249 | 249 | $member_avatar = "<figure class='lsx-team-avatar'>$member_avatar</figure>"; |
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | // Member socials |
| 254 | - if ( true === $show_social || 'true' === $show_social ) { |
|
| 254 | + if (true === $show_social || 'true' === $show_social) { |
|
| 255 | 255 | $links = array( |
| 256 | 256 | 'facebook' => $facebook, |
| 257 | 257 | 'twitter' => $twitter, |
| 258 | 258 | 'linkedin' => $linkedin, |
| 259 | 259 | ); |
| 260 | 260 | |
| 261 | - foreach ( $links as $sm => $sm_link ) { |
|
| 262 | - if ( ! empty( $sm_link ) ) { |
|
| 261 | + foreach ($links as $sm => $sm_link) { |
|
| 262 | + if (!empty($sm_link)) { |
|
| 263 | 263 | $member_socials .= "<li><a href='$sm_link' target='_blank'><i class='fa fa-$sm' aria-hidden='true'></i></a></li>"; |
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - $member_socials = ! empty( $member_socials ) ? "<ul class='lsx-team-socials list-inline'>$member_socials</ul>" : ''; |
|
| 267 | + $member_socials = !empty($member_socials) ? "<ul class='lsx-team-socials list-inline'>$member_socials</ul>" : ''; |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - if ( ! $carousel ) { |
|
| 270 | + if (!$carousel) { |
|
| 271 | 271 | $output .= "<div class='col-xs-12 col-md-$column_size'>"; |
| 272 | 272 | } |
| 273 | 273 | |
@@ -284,10 +284,10 @@ discard block |
||
| 284 | 284 | </div> |
| 285 | 285 | "; |
| 286 | 286 | |
| 287 | - if ( ! $carousel ) { |
|
| 287 | + if (!$carousel) { |
|
| 288 | 288 | $output .= '</div>'; |
| 289 | 289 | |
| 290 | - if ( $count == $columns && $team->post_count > $count_global ) { |
|
| 290 | + if ($count == $columns && $team->post_count > $count_global) { |
|
| 291 | 291 | $output .= '</div>'; |
| 292 | 292 | $output .= '<div class="row">'; |
| 293 | 293 | $count = 0; |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | wp_reset_postdata(); |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - if ( ! $carousel ) { |
|
| 300 | + if (!$carousel) { |
|
| 301 | 301 | $output .= '</div>'; |
| 302 | 302 | } |
| 303 | 303 | |