| @@ -17,9 +17,9 @@ discard block | ||
| 17 | 17 | * | 
| 18 | 18 | * @param \WPSEO_Schema_Context $context A value object with context variables. | 
| 19 | 19 | */ | 
| 20 | -	public function __construct( WPSEO_Schema_Context $context ) { | |
| 20 | +	public function __construct(WPSEO_Schema_Context $context) { | |
| 21 | 21 | $this->post_type = 'team'; | 
| 22 | - parent::__construct( $context ); | |
| 22 | + parent::__construct($context); | |
| 23 | 23 | } | 
| 24 | 24 | |
| 25 | 25 | /** | 
| @@ -34,24 +34,24 @@ discard block | ||
| 34 | 34 | ), | 
| 35 | 35 | '@id' => $this->context->canonical . '#person', | 
| 36 | 36 | 'name' => $this->post->post_title, | 
| 37 | - 'description' => wp_strip_all_tags( $this->post->post_content ), | |
| 37 | + 'description' => wp_strip_all_tags($this->post->post_content), | |
| 38 | 38 | 'url' => $this->post_url, | 
| 39 | 39 | 'mainEntityOfPage' => array( | 
| 40 | 40 | '@id' => $this->context->canonical . WPSEO_Schema_IDs::WEBPAGE_HASH, | 
| 41 | 41 | ), | 
| 42 | 42 | ); | 
| 43 | 43 | |
| 44 | -		if ( $this->context->site_represents_reference ) { | |
| 44 | +		if ($this->context->site_represents_reference) { | |
| 45 | 45 | $data['worksFor'] = $this->context->site_represents_reference; | 
| 46 | 46 | $data['memberOf'] = $this->context->site_represents_reference; | 
| 47 | 47 | } | 
| 48 | 48 | |
| 49 | - $data = $this->add_taxonomy_terms( $data, 'jobTitle', 'role' ); | |
| 50 | - $data = $this->add_custom_field( $data, 'email', 'contact_email' ); | |
| 51 | - $data = $this->add_custom_field( $data, 'telephone', 'contact_number' ); | |
| 52 | - $data = $this->add_products( $data ); | |
| 53 | - $data = $this->add_offers( $data, 'makesOffer' ); | |
| 54 | - $data = \lsx\legacy\Schema_Utils::add_image( $data, $this->context ); | |
| 49 | + $data = $this->add_taxonomy_terms($data, 'jobTitle', 'role'); | |
| 50 | + $data = $this->add_custom_field($data, 'email', 'contact_email'); | |
| 51 | + $data = $this->add_custom_field($data, 'telephone', 'contact_number'); | |
| 52 | + $data = $this->add_products($data); | |
| 53 | + $data = $this->add_offers($data, 'makesOffer'); | |
| 54 | + $data = \lsx\legacy\Schema_Utils::add_image($data, $this->context); | |
| 55 | 55 | return $data; | 
| 56 | 56 | } | 
| 57 | 57 | |
| @@ -61,11 +61,11 @@ discard block | ||
| 61 | 61 | * @param array $data | 
| 62 | 62 | * @return array | 
| 63 | 63 | */ | 
| 64 | -	public function add_products( $data ) { | |
| 64 | +	public function add_products($data) { | |
| 65 | 65 | $places_array = array(); | 
| 66 | - $places_array = $this->add_accommodation( $places_array ); | |
| 67 | - $places_array = $this->add_tours( $places_array ); | |
| 68 | -		if ( ! empty( $places_array ) ) { | |
| 66 | + $places_array = $this->add_accommodation($places_array); | |
| 67 | + $places_array = $this->add_tours($places_array); | |
| 68 | +		if ( ! empty($places_array)) { | |
| 69 | 69 | $data['owns'] = $places_array; | 
| 70 | 70 | } | 
| 71 | 71 | return $data; | 
| @@ -12,62 +12,62 @@ | ||
| 12 | 12 | */ | 
| 13 | 13 |  class LSX_TO_Team_Schema extends LSX_TO_Schema_Graph_Piece { | 
| 14 | 14 | |
| 15 | - /** | |
| 16 | - * Constructor. | |
| 17 | - * | |
| 18 | - * @param \WPSEO_Schema_Context $context A value object with context variables. | |
| 19 | - */ | |
| 20 | -	public function __construct( WPSEO_Schema_Context $context ) { | |
| 21 | - $this->post_type = 'team'; | |
| 22 | - parent::__construct( $context ); | |
| 23 | - } | |
| 15 | + /** | |
| 16 | + * Constructor. | |
| 17 | + * | |
| 18 | + * @param \WPSEO_Schema_Context $context A value object with context variables. | |
| 19 | + */ | |
| 20 | +     public function __construct( WPSEO_Schema_Context $context ) { | |
| 21 | + $this->post_type = 'team'; | |
| 22 | + parent::__construct( $context ); | |
| 23 | + } | |
| 24 | 24 | |
| 25 | - /** | |
| 26 | - * Returns Review data. | |
| 27 | - * | |
| 28 | - * @return array $data Review data. | |
| 29 | - */ | |
| 30 | -	public function generate() { | |
| 31 | - $data = array( | |
| 32 | - '@type' => array( | |
| 33 | - 'Person', | |
| 34 | - ), | |
| 35 | - '@id' => $this->context->canonical . '#person', | |
| 36 | - 'name' => $this->post->post_title, | |
| 37 | - 'description' => wp_strip_all_tags( $this->post->post_content ), | |
| 38 | - 'url' => $this->post_url, | |
| 39 | - 'mainEntityOfPage' => array( | |
| 40 | - '@id' => $this->context->canonical . WPSEO_Schema_IDs::WEBPAGE_HASH, | |
| 41 | - ), | |
| 42 | - ); | |
| 25 | + /** | |
| 26 | + * Returns Review data. | |
| 27 | + * | |
| 28 | + * @return array $data Review data. | |
| 29 | + */ | |
| 30 | +     public function generate() { | |
| 31 | + $data = array( | |
| 32 | + '@type' => array( | |
| 33 | + 'Person', | |
| 34 | + ), | |
| 35 | + '@id' => $this->context->canonical . '#person', | |
| 36 | + 'name' => $this->post->post_title, | |
| 37 | + 'description' => wp_strip_all_tags( $this->post->post_content ), | |
| 38 | + 'url' => $this->post_url, | |
| 39 | + 'mainEntityOfPage' => array( | |
| 40 | + '@id' => $this->context->canonical . WPSEO_Schema_IDs::WEBPAGE_HASH, | |
| 41 | + ), | |
| 42 | + ); | |
| 43 | 43 | |
| 44 | -		if ( $this->context->site_represents_reference ) { | |
| 45 | - $data['worksFor'] = $this->context->site_represents_reference; | |
| 46 | - $data['memberOf'] = $this->context->site_represents_reference; | |
| 47 | - } | |
| 44 | +          if ( $this->context->site_represents_reference ) { | |
| 45 | + $data['worksFor'] = $this->context->site_represents_reference; | |
| 46 | + $data['memberOf'] = $this->context->site_represents_reference; | |
| 47 | + } | |
| 48 | 48 | |
| 49 | - $data = $this->add_taxonomy_terms( $data, 'jobTitle', 'role' ); | |
| 50 | - $data = $this->add_custom_field( $data, 'email', 'contact_email' ); | |
| 51 | - $data = $this->add_custom_field( $data, 'telephone', 'contact_number' ); | |
| 52 | - $data = $this->add_products( $data ); | |
| 53 | - $data = $this->add_offers( $data, 'makesOffer' ); | |
| 54 | - $data = \lsx\legacy\Schema_Utils::add_image( $data, $this->context ); | |
| 55 | - return $data; | |
| 56 | - } | |
| 49 | + $data = $this->add_taxonomy_terms( $data, 'jobTitle', 'role' ); | |
| 50 | + $data = $this->add_custom_field( $data, 'email', 'contact_email' ); | |
| 51 | + $data = $this->add_custom_field( $data, 'telephone', 'contact_number' ); | |
| 52 | + $data = $this->add_products( $data ); | |
| 53 | + $data = $this->add_offers( $data, 'makesOffer' ); | |
| 54 | + $data = \lsx\legacy\Schema_Utils::add_image( $data, $this->context ); | |
| 55 | + return $data; | |
| 56 | + } | |
| 57 | 57 | |
| 58 | - /** | |
| 59 | - * Adds the accommodation and tour products under the 'owns' parameter | |
| 60 | - * | |
| 61 | - * @param array $data | |
| 62 | - * @return array | |
| 63 | - */ | |
| 64 | -	public function add_products( $data ) { | |
| 65 | - $places_array = array(); | |
| 66 | - $places_array = $this->add_accommodation( $places_array ); | |
| 67 | - $places_array = $this->add_tours( $places_array ); | |
| 68 | -		if ( ! empty( $places_array ) ) { | |
| 69 | - $data['owns'] = $places_array; | |
| 70 | - } | |
| 71 | - return $data; | |
| 72 | - } | |
| 58 | + /** | |
| 59 | + * Adds the accommodation and tour products under the 'owns' parameter | |
| 60 | + * | |
| 61 | + * @param array $data | |
| 62 | + * @return array | |
| 63 | + */ | |
| 64 | +     public function add_products( $data ) { | |
| 65 | + $places_array = array(); | |
| 66 | + $places_array = $this->add_accommodation( $places_array ); | |
| 67 | + $places_array = $this->add_tours( $places_array ); | |
| 68 | +          if ( ! empty( $places_array ) ) { | |
| 69 | + $data['owns'] = $places_array; | |
| 70 | + } | |
| 71 | + return $data; | |
| 72 | + } | |
| 73 | 73 | } | 
| @@ -23,23 +23,23 @@ discard block | ||
| 23 | 23 |  	public function __construct() { | 
| 24 | 24 | $this->set_vars(); | 
| 25 | 25 | |
| 26 | - add_action( 'init', array( $this, 'init' ), 20 ); | |
| 26 | +		add_action('init', array($this, 'init'), 20); | |
| 27 | 27 | |
| 28 | - add_filter( 'lsx_get_post-types_configs', array( $this, 'post_type_config' ), 10, 1 ); | |
| 29 | - add_filter( 'lsx_get_metaboxes_configs', array( $this, 'meta_box_config' ), 10, 1 ); | |
| 30 | - add_filter( 'lsx_get_taxonomies_configs', array( $this, 'taxonomy_config' ), 10, 1 ); | |
| 28 | +		add_filter('lsx_get_post-types_configs', array($this, 'post_type_config'), 10, 1); | |
| 29 | +		add_filter('lsx_get_metaboxes_configs', array($this, 'meta_box_config'), 10, 1); | |
| 30 | +		add_filter('lsx_get_taxonomies_configs', array($this, 'taxonomy_config'), 10, 1); | |
| 31 | 31 | |
| 32 | - add_filter( 'lsx_to_destination_custom_fields', array( $this, 'custom_fields' ) ); | |
| 33 | - add_filter( 'lsx_to_tour_custom_fields', array( $this, 'custom_fields' ) ); | |
| 34 | - add_filter( 'lsx_to_accommodation_custom_fields', array( $this, 'custom_fields' ) ); | |
| 32 | +		add_filter('lsx_to_destination_custom_fields', array($this, 'custom_fields')); | |
| 33 | +		add_filter('lsx_to_tour_custom_fields', array($this, 'custom_fields')); | |
| 34 | +		add_filter('lsx_to_accommodation_custom_fields', array($this, 'custom_fields')); | |
| 35 | 35 | |
| 36 | - add_filter( 'lsx_to_special_custom_fields', array( $this, 'custom_fields' ) ); | |
| 37 | - add_filter( 'lsx_to_review_custom_fields', array( $this, 'custom_fields' ) ); | |
| 38 | - add_filter( 'lsx_to_activity_custom_fields', array( $this, 'custom_fields' ) ); | |
| 36 | +		add_filter('lsx_to_special_custom_fields', array($this, 'custom_fields')); | |
| 37 | +		add_filter('lsx_to_review_custom_fields', array($this, 'custom_fields')); | |
| 38 | +		add_filter('lsx_to_activity_custom_fields', array($this, 'custom_fields')); | |
| 39 | 39 | |
| 40 | - add_filter( 'lsx_to_taxonomies', array( $this, 'to_register_taxonomy' ), 10, 1 ); | |
| 41 | - add_filter( 'lsx_to_framework_taxonomies', array( $this, 'to_register_taxonomy' ), 10, 1 ); | |
| 42 | - add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'to_register_taxonomy_plural' ), 10, 1 ); | |
| 40 | +		add_filter('lsx_to_taxonomies', array($this, 'to_register_taxonomy'), 10, 1); | |
| 41 | +		add_filter('lsx_to_framework_taxonomies', array($this, 'to_register_taxonomy'), 10, 1); | |
| 42 | +		add_filter('lsx_to_framework_taxonomies_plural', array($this, 'to_register_taxonomy_plural'), 10, 1); | |
| 43 | 43 | } | 
| 44 | 44 | |
| 45 | 45 | /** | 
| @@ -47,8 +47,8 @@ discard block | ||
| 47 | 47 | * | 
| 48 | 48 | * @since 0.1.0 | 
| 49 | 49 | */ | 
| 50 | -	public function to_register_taxonomy( $taxonomies ) { | |
| 51 | - $taxonomies['role'] = esc_attr__( 'Role', 'to-team' ); | |
| 50 | +	public function to_register_taxonomy($taxonomies) { | |
| 51 | +		$taxonomies['role'] = esc_attr__('Role', 'to-team'); | |
| 52 | 52 | return $taxonomies; | 
| 53 | 53 | } | 
| 54 | 54 | |
| @@ -57,8 +57,8 @@ discard block | ||
| 57 | 57 | * | 
| 58 | 58 | * @since 0.1.0 | 
| 59 | 59 | */ | 
| 60 | -	public function to_register_taxonomy_plural( $taxonomies ) { | |
| 61 | - $taxonomies['role'] = esc_attr__( 'Roles', 'to-team' ); | |
| 60 | +	public function to_register_taxonomy_plural($taxonomies) { | |
| 61 | +		$taxonomies['role'] = esc_attr__('Roles', 'to-team'); | |
| 62 | 62 | return $taxonomies; | 
| 63 | 63 | } | 
| 64 | 64 | |
| @@ -68,23 +68,23 @@ discard block | ||
| 68 | 68 | * @since 0.1.0 | 
| 69 | 69 | */ | 
| 70 | 70 |  	public function init() { | 
| 71 | -		if ( function_exists( 'lsx_to_get_taxonomies' ) ) { | |
| 72 | - $this->taxonomies = array_keys( lsx_to_get_taxonomies() ); | |
| 71 | +		if (function_exists('lsx_to_get_taxonomies')) { | |
| 72 | + $this->taxonomies = array_keys(lsx_to_get_taxonomies()); | |
| 73 | 73 | } | 
| 74 | 74 | |
| 75 | - add_filter( 'lsx_to_taxonomy_widget_taxonomies', array( $this, 'widget_taxonomies' ), 10, 1 ); | |
| 75 | +		add_filter('lsx_to_taxonomy_widget_taxonomies', array($this, 'widget_taxonomies'), 10, 1); | |
| 76 | 76 | |
| 77 | -		if ( false !== $this->taxonomies ) { | |
| 78 | - add_action( 'create_term', array( $this, 'save_meta' ), 10, 2 ); | |
| 79 | - add_action( 'edit_term', array( $this, 'save_meta' ), 10, 2 ); | |
| 77 | +		if (false !== $this->taxonomies) { | |
| 78 | +			add_action('create_term', array($this, 'save_meta'), 10, 2); | |
| 79 | +			add_action('edit_term', array($this, 'save_meta'), 10, 2); | |
| 80 | 80 | |
| 81 | -			foreach ( $this->taxonomies as $taxonomy ) { | |
| 82 | -				add_action( "{$taxonomy}_edit_form_fields", array( $this, 'add_expert_form_field' ), 3, 1 ); | |
| 81 | +			foreach ($this->taxonomies as $taxonomy) { | |
| 82 | +				add_action("{$taxonomy}_edit_form_fields", array($this, 'add_expert_form_field'), 3, 1); | |
| 83 | 83 | } | 
| 84 | 84 | } | 
| 85 | 85 | |
| 86 | - add_action( 'lsx_to_framework_team_tab_content', array( $this, 'general_settings' ), 10, 2 ); | |
| 87 | - add_action( 'lsx_to_framework_team_tab_content', array( $this, 'archive_settings' ), 10, 2 ); | |
| 86 | +		add_action('lsx_to_framework_team_tab_content', array($this, 'general_settings'), 10, 2); | |
| 87 | +		add_action('lsx_to_framework_team_tab_content', array($this, 'archive_settings'), 10, 2); | |
| 88 | 88 | } | 
| 89 | 89 | |
| 90 | 90 | /** | 
| @@ -93,10 +93,10 @@ discard block | ||
| 93 | 93 | * @param $objects | 
| 94 | 94 | * @return array | 
| 95 | 95 | */ | 
| 96 | -	public function post_type_config( $objects ) { | |
| 97 | -		foreach ( $this->post_types as $key => $label ) { | |
| 98 | -			if ( file_exists( LSX_TO_TEAM_PATH . 'includes/post-types/config-' . $key . '.php' ) ) { | |
| 99 | - $objects[ $key ] = include LSX_TO_TEAM_PATH . 'includes/post-types/config-' . $key . '.php'; | |
| 96 | +	public function post_type_config($objects) { | |
| 97 | +		foreach ($this->post_types as $key => $label) { | |
| 98 | +			if (file_exists(LSX_TO_TEAM_PATH . 'includes/post-types/config-' . $key . '.php')) { | |
| 99 | + $objects[$key] = include LSX_TO_TEAM_PATH . 'includes/post-types/config-' . $key . '.php'; | |
| 100 | 100 | } | 
| 101 | 101 | } | 
| 102 | 102 | |
| @@ -109,10 +109,10 @@ discard block | ||
| 109 | 109 | * @param $meta_boxes | 
| 110 | 110 | * @return array | 
| 111 | 111 | */ | 
| 112 | -	public function meta_box_config( $meta_boxes ) { | |
| 113 | -		foreach ( $this->post_types as $key => $label ) { | |
| 114 | -			if ( file_exists( LSX_TO_TEAM_PATH . 'includes/metaboxes/config-' . $key . '.php' ) ) { | |
| 115 | - $meta_boxes[ $key ] = include LSX_TO_TEAM_PATH . 'includes/metaboxes/config-' . $key . '.php'; | |
| 112 | +	public function meta_box_config($meta_boxes) { | |
| 113 | +		foreach ($this->post_types as $key => $label) { | |
| 114 | +			if (file_exists(LSX_TO_TEAM_PATH . 'includes/metaboxes/config-' . $key . '.php')) { | |
| 115 | + $meta_boxes[$key] = include LSX_TO_TEAM_PATH . 'includes/metaboxes/config-' . $key . '.php'; | |
| 116 | 116 | } | 
| 117 | 117 | } | 
| 118 | 118 | |
| @@ -125,8 +125,8 @@ discard block | ||
| 125 | 125 | * | 
| 126 | 126 | * @return null | 
| 127 | 127 | */ | 
| 128 | -	public function taxonomy_config( $taxonomies ) { | |
| 129 | -		if ( file_exists( LSX_TO_TEAM_PATH . 'includes/taxonomies/config-role.php' ) ) { | |
| 128 | +	public function taxonomy_config($taxonomies) { | |
| 129 | +		if (file_exists(LSX_TO_TEAM_PATH . 'includes/taxonomies/config-role.php')) { | |
| 130 | 130 | $taxonomies['role'] = include LSX_TO_TEAM_PATH . 'includes/taxonomies/config-role.php'; | 
| 131 | 131 | } | 
| 132 | 132 | |
| @@ -136,24 +136,24 @@ discard block | ||
| 136 | 136 | /** | 
| 137 | 137 | * Adds in the fields to the Tour Operators Post Types. | 
| 138 | 138 | */ | 
| 139 | -	public function custom_fields( $fields ) { | |
| 139 | +	public function custom_fields($fields) { | |
| 140 | 140 | global $post, $typenow, $current_screen; | 
| 141 | 141 | |
| 142 | -		if ( $post && $post->post_type ) { | |
| 142 | +		if ($post && $post->post_type) { | |
| 143 | 143 | $post_type = $post->post_type; | 
| 144 | -		} elseif ( $typenow ) { | |
| 144 | +		} elseif ($typenow) { | |
| 145 | 145 | $post_type = $typenow; | 
| 146 | -		} elseif ( $current_screen && $current_screen->post_type ) { | |
| 146 | +		} elseif ($current_screen && $current_screen->post_type) { | |
| 147 | 147 | $post_type = $current_screen->post_type; | 
| 148 | -		} elseif ( isset( $_REQUEST['post_type'] ) ) { | |
| 149 | - $post_type = sanitize_key( $_REQUEST['post_type'] ); | |
| 150 | -		} elseif ( isset( $_REQUEST['post'] ) ) { | |
| 151 | - $post_type = get_post_type( sanitize_key( $_REQUEST['post'] ) ); | |
| 148 | +		} elseif (isset($_REQUEST['post_type'])) { | |
| 149 | + $post_type = sanitize_key($_REQUEST['post_type']); | |
| 150 | +		} elseif (isset($_REQUEST['post'])) { | |
| 151 | + $post_type = get_post_type(sanitize_key($_REQUEST['post'])); | |
| 152 | 152 |  		} else { | 
| 153 | 153 | $post_type = false; | 
| 154 | 154 | } | 
| 155 | 155 | |
| 156 | -		if ( false !== $post_type ) { | |
| 156 | +		if (false !== $post_type) { | |
| 157 | 157 | $fields[] = array( | 
| 158 | 158 | 'id' => 'team_title', | 
| 159 | 159 | 'name' => 'Teams', | 
| @@ -187,9 +187,9 @@ discard block | ||
| 187 | 187 | * | 
| 188 | 188 | * @since 0.1.0 | 
| 189 | 189 | */ | 
| 190 | -	public function add_expert_form_field( $term = false ) { | |
| 191 | -		if ( is_object( $term ) ) { | |
| 192 | - $value = get_term_meta( $term->term_id, 'expert', true ); | |
| 190 | +	public function add_expert_form_field($term = false) { | |
| 191 | +		if (is_object($term)) { | |
| 192 | + $value = get_term_meta($term->term_id, 'expert', true); | |
| 193 | 193 |  		} else { | 
| 194 | 194 | $value = false; | 
| 195 | 195 | } | 
| @@ -205,20 +205,20 @@ discard block | ||
| 205 | 205 | ?> | 
| 206 | 206 | <tr class="form-field form-required term-expert-wrap"> | 
| 207 | 207 | <th scope="row"> | 
| 208 | - <label for="expert"><?php esc_html_e( 'Expert', 'to-team' ); ?></label> | |
| 208 | +				<label for="expert"><?php esc_html_e('Expert', 'to-team'); ?></label> | |
| 209 | 209 | </th> | 
| 210 | 210 | <td> | 
| 211 | 211 | <select name="expert" id="expert" aria-required="true"> | 
| 212 | - <option value=""><?php esc_html_e( 'None', 'to-team' ); ?></option> | |
| 212 | +					<option value=""><?php esc_html_e('None', 'to-team'); ?></option> | |
| 213 | 213 | |
| 214 | 214 | <?php | 
| 215 | -						foreach ( $experts as $expert ) { | |
| 216 | - echo '<option value="' . esc_attr( $expert->ID ) . '"' . selected( $value, $expert->ID, false ) . '>' . esc_html( $expert->post_title ) . '</option>'; | |
| 215 | +						foreach ($experts as $expert) { | |
| 216 | + echo '<option value="' . esc_attr($expert->ID) . '"' . selected($value, $expert->ID, false) . '>' . esc_html($expert->post_title) . '</option>'; | |
| 217 | 217 | } | 
| 218 | 218 | ?> | 
| 219 | 219 | </select> | 
| 220 | 220 | |
| 221 | - <?php wp_nonce_field( 'lsx_to_team_save_term_expert', 'lsx_to_team_term_expert_nonce' ); ?> | |
| 221 | +				<?php wp_nonce_field('lsx_to_team_save_term_expert', 'lsx_to_team_term_expert_nonce'); ?> | |
| 222 | 222 | </td> | 
| 223 | 223 | </tr> | 
| 224 | 224 | |
| @@ -232,22 +232,22 @@ discard block | ||
| 232 | 232 | * @param int $term_id | 
| 233 | 233 | * @param string $taxonomy | 
| 234 | 234 | */ | 
| 235 | -	public function save_meta( $term_id = 0, $taxonomy = '' ) { | |
| 236 | -		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { | |
| 235 | +	public function save_meta($term_id = 0, $taxonomy = '') { | |
| 236 | +		if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { | |
| 237 | 237 | return; | 
| 238 | 238 | } | 
| 239 | 239 | |
| 240 | -		if ( ! isset( $_POST['expert'] ) ) { | |
| 240 | +		if ( ! isset($_POST['expert'])) { | |
| 241 | 241 | return; | 
| 242 | 242 | } | 
| 243 | 243 | |
| 244 | -		if ( check_admin_referer( 'lsx_to_team_save_term_expert', 'lsx_to_team_term_expert_nonce' ) ) { | |
| 245 | - $meta = ! empty( sanitize_text_field( wp_unslash( $_POST['expert'] ) ) ) ? sanitize_text_field( wp_unslash( $_POST['expert'] ) ) : ''; | |
| 244 | +		if (check_admin_referer('lsx_to_team_save_term_expert', 'lsx_to_team_term_expert_nonce')) { | |
| 245 | + $meta = ! empty(sanitize_text_field(wp_unslash($_POST['expert']))) ? sanitize_text_field(wp_unslash($_POST['expert'])) : ''; | |
| 246 | 246 | |
| 247 | -			if ( empty( $meta ) ) { | |
| 248 | - delete_term_meta( $term_id, 'expert' ); | |
| 247 | +			if (empty($meta)) { | |
| 248 | + delete_term_meta($term_id, 'expert'); | |
| 249 | 249 |  			} else { | 
| 250 | - update_term_meta( $term_id, 'expert', $meta ); | |
| 250 | + update_term_meta($term_id, 'expert', $meta); | |
| 251 | 251 | } | 
| 252 | 252 | } | 
| 253 | 253 | } | 
| @@ -255,8 +255,8 @@ discard block | ||
| 255 | 255 | /** | 
| 256 | 256 | * Adds the team specific options | 
| 257 | 257 | */ | 
| 258 | -	public function general_settings( $post_type = false, $tab = false ) { | |
| 259 | -		if ( 'general' !== $tab ) { | |
| 258 | +	public function general_settings($post_type = false, $tab = false) { | |
| 259 | +		if ('general' !== $tab) { | |
| 260 | 260 | return false; | 
| 261 | 261 | } | 
| 262 | 262 | |
| @@ -271,11 +271,11 @@ discard block | ||
| 271 | 271 | ?> | 
| 272 | 272 | <tr class="form-field"> | 
| 273 | 273 | <th scope="row"> | 
| 274 | - <label for="disable_team_panel"><?php esc_html_e( 'Disable Team Panel', 'to-team' ); ?></label> | |
| 274 | +				<label for="disable_team_panel"><?php esc_html_e('Disable Team Panel', 'to-team'); ?></label> | |
| 275 | 275 | </th> | 
| 276 | 276 | <td> | 
| 277 | 277 |  				<input type="checkbox" {{#if disable_team_panel}} checked="checked" {{/if}} name="disable_team_panel" /> | 
| 278 | - <small><?php esc_html_e( 'This disables the team member panel on all post types.', 'to-team' ); ?></small> | |
| 278 | +				<small><?php esc_html_e('This disables the team member panel on all post types.', 'to-team'); ?></small> | |
| 279 | 279 | </td> | 
| 280 | 280 | </tr> | 
| 281 | 281 | <tr class="form-field-wrap"> | 
| @@ -283,9 +283,9 @@ discard block | ||
| 283 | 283 | <label> Select your consultants</label> | 
| 284 | 284 | </th> | 
| 285 | 285 | <td> | 
| 286 | - <?php foreach ( $experts as $expert ) : ?> | |
| 287 | - <label for="expert-<?php echo esc_attr( $expert->ID ) ?>"> | |
| 288 | -						<input type="checkbox" {{#if expert-<?php echo esc_attr( $expert->ID ) ?>}} checked="checked" {{/if}} name="expert-<?php echo esc_attr( $expert->ID ) ?>" id="expert-<?php echo esc_attr( $expert->ID ) ?>" value="<?php echo esc_attr( $expert->ID ) ?>" /> <?php echo esc_html( $expert->post_title ) ?> | |
| 286 | + <?php foreach ($experts as $expert) : ?> | |
| 287 | + <label for="expert-<?php echo esc_attr($expert->ID) ?>"> | |
| 288 | +						<input type="checkbox" {{#if expert-<?php echo esc_attr($expert->ID) ?>}} checked="checked" {{/if}} name="expert-<?php echo esc_attr($expert->ID) ?>" id="expert-<?php echo esc_attr($expert->ID) ?>" value="<?php echo esc_attr($expert->ID) ?>" /> <?php echo esc_html($expert->post_title) ?> | |
| 289 | 289 | </label> | 
| 290 | 290 | <br> | 
| 291 | 291 | <?php endforeach ?> | 
| @@ -297,18 +297,18 @@ discard block | ||
| 297 | 297 | /** | 
| 298 | 298 | * Adds the team specific options | 
| 299 | 299 | */ | 
| 300 | -	public function archive_settings( $post_type = false, $tab = false ) { | |
| 301 | -		if ( 'archives' !== $tab ) { | |
| 300 | +	public function archive_settings($post_type = false, $tab = false) { | |
| 301 | +		if ('archives' !== $tab) { | |
| 302 | 302 | return false; | 
| 303 | 303 | } | 
| 304 | 304 | ?> | 
| 305 | 305 | <tr class="form-field"> | 
| 306 | 306 | <th scope="row"> | 
| 307 | - <label for="group_items_by_role"><?php esc_html_e( 'Group by Role', 'to-team' ); ?></label> | |
| 307 | +				<label for="group_items_by_role"><?php esc_html_e('Group by Role', 'to-team'); ?></label> | |
| 308 | 308 | </th> | 
| 309 | 309 | <td> | 
| 310 | 310 |  				<input type="checkbox" {{#if group_items_by_role}} checked="checked" {{/if}} name="group_items_by_role" /> | 
| 311 | - <small><?php esc_html_e( 'This groups archive items by role taxonomy and display the role title.', 'to-team' ); ?></small> | |
| 311 | +				<small><?php esc_html_e('This groups archive items by role taxonomy and display the role title.', 'to-team'); ?></small> | |
| 312 | 312 | </td> | 
| 313 | 313 | </tr> | 
| 314 | 314 | <?php | 
| @@ -17,192 +17,192 @@ discard block | ||
| 17 | 17 | */ | 
| 18 | 18 |  class LSX_TO_Team_Admin extends LSX_TO_Team { | 
| 19 | 19 | |
| 20 | - /** | |
| 21 | - * Constructor | |
| 22 | - */ | |
| 23 | -	public function __construct() { | |
| 24 | - $this->set_vars(); | |
| 25 | - | |
| 26 | - add_action( 'init', array( $this, 'init' ), 20 ); | |
| 27 | - | |
| 28 | - add_filter( 'lsx_get_post-types_configs', array( $this, 'post_type_config' ), 10, 1 ); | |
| 29 | - add_filter( 'lsx_get_metaboxes_configs', array( $this, 'meta_box_config' ), 10, 1 ); | |
| 30 | - add_filter( 'lsx_get_taxonomies_configs', array( $this, 'taxonomy_config' ), 10, 1 ); | |
| 31 | - | |
| 32 | - add_filter( 'lsx_to_destination_custom_fields', array( $this, 'custom_fields' ) ); | |
| 33 | - add_filter( 'lsx_to_tour_custom_fields', array( $this, 'custom_fields' ) ); | |
| 34 | - add_filter( 'lsx_to_accommodation_custom_fields', array( $this, 'custom_fields' ) ); | |
| 35 | - | |
| 36 | - add_filter( 'lsx_to_special_custom_fields', array( $this, 'custom_fields' ) ); | |
| 37 | - add_filter( 'lsx_to_review_custom_fields', array( $this, 'custom_fields' ) ); | |
| 38 | - add_filter( 'lsx_to_activity_custom_fields', array( $this, 'custom_fields' ) ); | |
| 39 | - | |
| 40 | - add_filter( 'lsx_to_taxonomies', array( $this, 'to_register_taxonomy' ), 10, 1 ); | |
| 41 | - add_filter( 'lsx_to_framework_taxonomies', array( $this, 'to_register_taxonomy' ), 10, 1 ); | |
| 42 | - add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'to_register_taxonomy_plural' ), 10, 1 ); | |
| 43 | - } | |
| 44 | - | |
| 45 | - /** | |
| 46 | - * Register the taxonomy with the TO plugin | |
| 47 | - * | |
| 48 | - * @since 0.1.0 | |
| 49 | - */ | |
| 50 | -	public function to_register_taxonomy( $taxonomies ) { | |
| 51 | - $taxonomies['role'] = esc_attr__( 'Role', 'to-team' ); | |
| 52 | - return $taxonomies; | |
| 53 | - } | |
| 54 | - | |
| 55 | - /** | |
| 56 | - * Register the taxonomy with the TO plugin | |
| 57 | - * | |
| 58 | - * @since 0.1.0 | |
| 59 | - */ | |
| 60 | -	public function to_register_taxonomy_plural( $taxonomies ) { | |
| 61 | - $taxonomies['role'] = esc_attr__( 'Roles', 'to-team' ); | |
| 62 | - return $taxonomies; | |
| 63 | - } | |
| 64 | - | |
| 65 | - /** | |
| 66 | - * Output the form field for this metadata when adding a new term | |
| 67 | - * | |
| 68 | - * @since 0.1.0 | |
| 69 | - */ | |
| 70 | -	public function init() { | |
| 71 | -		if ( function_exists( 'lsx_to_get_taxonomies' ) ) { | |
| 72 | - $this->taxonomies = array_keys( lsx_to_get_taxonomies() ); | |
| 73 | - } | |
| 74 | - | |
| 75 | - add_filter( 'lsx_to_taxonomy_widget_taxonomies', array( $this, 'widget_taxonomies' ), 10, 1 ); | |
| 76 | - | |
| 77 | -		if ( false !== $this->taxonomies ) { | |
| 78 | - add_action( 'create_term', array( $this, 'save_meta' ), 10, 2 ); | |
| 79 | - add_action( 'edit_term', array( $this, 'save_meta' ), 10, 2 ); | |
| 80 | - | |
| 81 | -			foreach ( $this->taxonomies as $taxonomy ) { | |
| 82 | -				add_action( "{$taxonomy}_edit_form_fields", array( $this, 'add_expert_form_field' ), 3, 1 ); | |
| 83 | - } | |
| 84 | - } | |
| 85 | - | |
| 86 | - add_action( 'lsx_to_framework_team_tab_content', array( $this, 'general_settings' ), 10, 2 ); | |
| 87 | - add_action( 'lsx_to_framework_team_tab_content', array( $this, 'archive_settings' ), 10, 2 ); | |
| 88 | - } | |
| 89 | - | |
| 90 | - /** | |
| 91 | - * Register the activity post type config | |
| 92 | - * | |
| 93 | - * @param $objects | |
| 94 | - * @return array | |
| 95 | - */ | |
| 96 | -	public function post_type_config( $objects ) { | |
| 97 | -		foreach ( $this->post_types as $key => $label ) { | |
| 98 | -			if ( file_exists( LSX_TO_TEAM_PATH . 'includes/post-types/config-' . $key . '.php' ) ) { | |
| 99 | - $objects[ $key ] = include LSX_TO_TEAM_PATH . 'includes/post-types/config-' . $key . '.php'; | |
| 100 | - } | |
| 101 | - } | |
| 102 | - | |
| 103 | - return $objects; | |
| 104 | - } | |
| 105 | - | |
| 106 | - /** | |
| 107 | - * Register the activity metabox config | |
| 108 | - * | |
| 109 | - * @param $meta_boxes | |
| 110 | - * @return array | |
| 111 | - */ | |
| 112 | -	public function meta_box_config( $meta_boxes ) { | |
| 113 | -		foreach ( $this->post_types as $key => $label ) { | |
| 114 | -			if ( file_exists( LSX_TO_TEAM_PATH . 'includes/metaboxes/config-' . $key . '.php' ) ) { | |
| 115 | - $meta_boxes[ $key ] = include LSX_TO_TEAM_PATH . 'includes/metaboxes/config-' . $key . '.php'; | |
| 116 | - } | |
| 117 | - } | |
| 118 | - | |
| 119 | - return $meta_boxes; | |
| 120 | - } | |
| 121 | - | |
| 122 | - /** | |
| 123 | - * Register the Role taxonomy | |
| 124 | - * | |
| 125 | - * | |
| 126 | - * @return null | |
| 127 | - */ | |
| 128 | -	public function taxonomy_config( $taxonomies ) { | |
| 129 | -		if ( file_exists( LSX_TO_TEAM_PATH . 'includes/taxonomies/config-role.php' ) ) { | |
| 130 | - $taxonomies['role'] = include LSX_TO_TEAM_PATH . 'includes/taxonomies/config-role.php'; | |
| 131 | - } | |
| 132 | - | |
| 133 | - return $taxonomies; | |
| 134 | - } | |
| 135 | - | |
| 136 | - /** | |
| 137 | - * Adds in the fields to the Tour Operators Post Types. | |
| 138 | - */ | |
| 139 | -	public function custom_fields( $fields ) { | |
| 140 | - global $post, $typenow, $current_screen; | |
| 141 | - | |
| 142 | -		if ( $post && $post->post_type ) { | |
| 143 | - $post_type = $post->post_type; | |
| 144 | -		} elseif ( $typenow ) { | |
| 145 | - $post_type = $typenow; | |
| 146 | -		} elseif ( $current_screen && $current_screen->post_type ) { | |
| 147 | - $post_type = $current_screen->post_type; | |
| 148 | -		} elseif ( isset( $_REQUEST['post_type'] ) ) { | |
| 149 | - $post_type = sanitize_key( $_REQUEST['post_type'] ); | |
| 150 | -		} elseif ( isset( $_REQUEST['post'] ) ) { | |
| 151 | - $post_type = get_post_type( sanitize_key( $_REQUEST['post'] ) ); | |
| 152 | -		} else { | |
| 153 | - $post_type = false; | |
| 154 | - } | |
| 155 | - | |
| 156 | -		if ( false !== $post_type ) { | |
| 157 | - $fields[] = array( | |
| 158 | - 'id' => 'team_title', | |
| 159 | - 'name' => 'Teams', | |
| 160 | - 'type' => 'title', | |
| 161 | - 'cols' => 12, | |
| 162 | - ); | |
| 163 | - | |
| 164 | - $fields[] = array( | |
| 165 | - 'id' => 'team_to_' . $post_type, | |
| 166 | - 'name' => 'Specials related with this ' . $post_type, | |
| 167 | - 'type' => 'post_select', | |
| 168 | - 'use_ajax' => false, | |
| 169 | - 'query' => array( | |
| 170 | - 'post_type' => 'team', | |
| 171 | - 'nopagin' => true, | |
| 172 | - 'posts_per_page' => '-1', | |
| 173 | - 'orderby' => 'title', | |
| 174 | - 'order' => 'ASC', | |
| 175 | - ), | |
| 176 | - 'repeatable' => true, | |
| 177 | - 'allow_none' => true, | |
| 178 | - 'cols' => 12, | |
| 179 | - ); | |
| 180 | - } | |
| 181 | - | |
| 182 | - return $fields; | |
| 183 | - } | |
| 184 | - | |
| 185 | - /** | |
| 186 | - * Output the form field for this metadata when adding a new term | |
| 187 | - * | |
| 188 | - * @since 0.1.0 | |
| 189 | - */ | |
| 190 | -	public function add_expert_form_field( $term = false ) { | |
| 191 | -		if ( is_object( $term ) ) { | |
| 192 | - $value = get_term_meta( $term->term_id, 'expert', true ); | |
| 193 | -		} else { | |
| 194 | - $value = false; | |
| 195 | - } | |
| 196 | - | |
| 197 | - $experts = get_posts( | |
| 198 | - array( | |
| 199 | - 'post_type' => 'team', | |
| 200 | - 'posts_per_page' => -1, | |
| 201 | - 'orderby' => 'menu_order', | |
| 202 | - 'order' => 'ASC', | |
| 203 | - ) | |
| 204 | - ); | |
| 205 | - ?> | |
| 20 | + /** | |
| 21 | + * Constructor | |
| 22 | + */ | |
| 23 | +     public function __construct() { | |
| 24 | + $this->set_vars(); | |
| 25 | + | |
| 26 | + add_action( 'init', array( $this, 'init' ), 20 ); | |
| 27 | + | |
| 28 | + add_filter( 'lsx_get_post-types_configs', array( $this, 'post_type_config' ), 10, 1 ); | |
| 29 | + add_filter( 'lsx_get_metaboxes_configs', array( $this, 'meta_box_config' ), 10, 1 ); | |
| 30 | + add_filter( 'lsx_get_taxonomies_configs', array( $this, 'taxonomy_config' ), 10, 1 ); | |
| 31 | + | |
| 32 | + add_filter( 'lsx_to_destination_custom_fields', array( $this, 'custom_fields' ) ); | |
| 33 | + add_filter( 'lsx_to_tour_custom_fields', array( $this, 'custom_fields' ) ); | |
| 34 | + add_filter( 'lsx_to_accommodation_custom_fields', array( $this, 'custom_fields' ) ); | |
| 35 | + | |
| 36 | + add_filter( 'lsx_to_special_custom_fields', array( $this, 'custom_fields' ) ); | |
| 37 | + add_filter( 'lsx_to_review_custom_fields', array( $this, 'custom_fields' ) ); | |
| 38 | + add_filter( 'lsx_to_activity_custom_fields', array( $this, 'custom_fields' ) ); | |
| 39 | + | |
| 40 | + add_filter( 'lsx_to_taxonomies', array( $this, 'to_register_taxonomy' ), 10, 1 ); | |
| 41 | + add_filter( 'lsx_to_framework_taxonomies', array( $this, 'to_register_taxonomy' ), 10, 1 ); | |
| 42 | + add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'to_register_taxonomy_plural' ), 10, 1 ); | |
| 43 | + } | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * Register the taxonomy with the TO plugin | |
| 47 | + * | |
| 48 | + * @since 0.1.0 | |
| 49 | + */ | |
| 50 | +     public function to_register_taxonomy( $taxonomies ) { | |
| 51 | + $taxonomies['role'] = esc_attr__( 'Role', 'to-team' ); | |
| 52 | + return $taxonomies; | |
| 53 | + } | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * Register the taxonomy with the TO plugin | |
| 57 | + * | |
| 58 | + * @since 0.1.0 | |
| 59 | + */ | |
| 60 | +     public function to_register_taxonomy_plural( $taxonomies ) { | |
| 61 | + $taxonomies['role'] = esc_attr__( 'Roles', 'to-team' ); | |
| 62 | + return $taxonomies; | |
| 63 | + } | |
| 64 | + | |
| 65 | + /** | |
| 66 | + * Output the form field for this metadata when adding a new term | |
| 67 | + * | |
| 68 | + * @since 0.1.0 | |
| 69 | + */ | |
| 70 | +     public function init() { | |
| 71 | +          if ( function_exists( 'lsx_to_get_taxonomies' ) ) { | |
| 72 | + $this->taxonomies = array_keys( lsx_to_get_taxonomies() ); | |
| 73 | + } | |
| 74 | + | |
| 75 | + add_filter( 'lsx_to_taxonomy_widget_taxonomies', array( $this, 'widget_taxonomies' ), 10, 1 ); | |
| 76 | + | |
| 77 | +          if ( false !== $this->taxonomies ) { | |
| 78 | + add_action( 'create_term', array( $this, 'save_meta' ), 10, 2 ); | |
| 79 | + add_action( 'edit_term', array( $this, 'save_meta' ), 10, 2 ); | |
| 80 | + | |
| 81 | +               foreach ( $this->taxonomies as $taxonomy ) { | |
| 82 | +                    add_action( "{$taxonomy}_edit_form_fields", array( $this, 'add_expert_form_field' ), 3, 1 ); | |
| 83 | + } | |
| 84 | + } | |
| 85 | + | |
| 86 | + add_action( 'lsx_to_framework_team_tab_content', array( $this, 'general_settings' ), 10, 2 ); | |
| 87 | + add_action( 'lsx_to_framework_team_tab_content', array( $this, 'archive_settings' ), 10, 2 ); | |
| 88 | + } | |
| 89 | + | |
| 90 | + /** | |
| 91 | + * Register the activity post type config | |
| 92 | + * | |
| 93 | + * @param $objects | |
| 94 | + * @return array | |
| 95 | + */ | |
| 96 | +     public function post_type_config( $objects ) { | |
| 97 | +          foreach ( $this->post_types as $key => $label ) { | |
| 98 | +               if ( file_exists( LSX_TO_TEAM_PATH . 'includes/post-types/config-' . $key . '.php' ) ) { | |
| 99 | + $objects[ $key ] = include LSX_TO_TEAM_PATH . 'includes/post-types/config-' . $key . '.php'; | |
| 100 | + } | |
| 101 | + } | |
| 102 | + | |
| 103 | + return $objects; | |
| 104 | + } | |
| 105 | + | |
| 106 | + /** | |
| 107 | + * Register the activity metabox config | |
| 108 | + * | |
| 109 | + * @param $meta_boxes | |
| 110 | + * @return array | |
| 111 | + */ | |
| 112 | +     public function meta_box_config( $meta_boxes ) { | |
| 113 | +          foreach ( $this->post_types as $key => $label ) { | |
| 114 | +               if ( file_exists( LSX_TO_TEAM_PATH . 'includes/metaboxes/config-' . $key . '.php' ) ) { | |
| 115 | + $meta_boxes[ $key ] = include LSX_TO_TEAM_PATH . 'includes/metaboxes/config-' . $key . '.php'; | |
| 116 | + } | |
| 117 | + } | |
| 118 | + | |
| 119 | + return $meta_boxes; | |
| 120 | + } | |
| 121 | + | |
| 122 | + /** | |
| 123 | + * Register the Role taxonomy | |
| 124 | + * | |
| 125 | + * | |
| 126 | + * @return null | |
| 127 | + */ | |
| 128 | +     public function taxonomy_config( $taxonomies ) { | |
| 129 | +          if ( file_exists( LSX_TO_TEAM_PATH . 'includes/taxonomies/config-role.php' ) ) { | |
| 130 | + $taxonomies['role'] = include LSX_TO_TEAM_PATH . 'includes/taxonomies/config-role.php'; | |
| 131 | + } | |
| 132 | + | |
| 133 | + return $taxonomies; | |
| 134 | + } | |
| 135 | + | |
| 136 | + /** | |
| 137 | + * Adds in the fields to the Tour Operators Post Types. | |
| 138 | + */ | |
| 139 | +     public function custom_fields( $fields ) { | |
| 140 | + global $post, $typenow, $current_screen; | |
| 141 | + | |
| 142 | +          if ( $post && $post->post_type ) { | |
| 143 | + $post_type = $post->post_type; | |
| 144 | +          } elseif ( $typenow ) { | |
| 145 | + $post_type = $typenow; | |
| 146 | +          } elseif ( $current_screen && $current_screen->post_type ) { | |
| 147 | + $post_type = $current_screen->post_type; | |
| 148 | +          } elseif ( isset( $_REQUEST['post_type'] ) ) { | |
| 149 | + $post_type = sanitize_key( $_REQUEST['post_type'] ); | |
| 150 | +          } elseif ( isset( $_REQUEST['post'] ) ) { | |
| 151 | + $post_type = get_post_type( sanitize_key( $_REQUEST['post'] ) ); | |
| 152 | +          } else { | |
| 153 | + $post_type = false; | |
| 154 | + } | |
| 155 | + | |
| 156 | +          if ( false !== $post_type ) { | |
| 157 | + $fields[] = array( | |
| 158 | + 'id' => 'team_title', | |
| 159 | + 'name' => 'Teams', | |
| 160 | + 'type' => 'title', | |
| 161 | + 'cols' => 12, | |
| 162 | + ); | |
| 163 | + | |
| 164 | + $fields[] = array( | |
| 165 | + 'id' => 'team_to_' . $post_type, | |
| 166 | + 'name' => 'Specials related with this ' . $post_type, | |
| 167 | + 'type' => 'post_select', | |
| 168 | + 'use_ajax' => false, | |
| 169 | + 'query' => array( | |
| 170 | + 'post_type' => 'team', | |
| 171 | + 'nopagin' => true, | |
| 172 | + 'posts_per_page' => '-1', | |
| 173 | + 'orderby' => 'title', | |
| 174 | + 'order' => 'ASC', | |
| 175 | + ), | |
| 176 | + 'repeatable' => true, | |
| 177 | + 'allow_none' => true, | |
| 178 | + 'cols' => 12, | |
| 179 | + ); | |
| 180 | + } | |
| 181 | + | |
| 182 | + return $fields; | |
| 183 | + } | |
| 184 | + | |
| 185 | + /** | |
| 186 | + * Output the form field for this metadata when adding a new term | |
| 187 | + * | |
| 188 | + * @since 0.1.0 | |
| 189 | + */ | |
| 190 | +     public function add_expert_form_field( $term = false ) { | |
| 191 | +          if ( is_object( $term ) ) { | |
| 192 | + $value = get_term_meta( $term->term_id, 'expert', true ); | |
| 193 | +          } else { | |
| 194 | + $value = false; | |
| 195 | + } | |
| 196 | + | |
| 197 | + $experts = get_posts( | |
| 198 | + array( | |
| 199 | + 'post_type' => 'team', | |
| 200 | + 'posts_per_page' => -1, | |
| 201 | + 'orderby' => 'menu_order', | |
| 202 | + 'order' => 'ASC', | |
| 203 | + ) | |
| 204 | + ); | |
| 205 | + ?> | |
| 206 | 206 | <tr class="form-field form-required term-expert-wrap"> | 
| 207 | 207 | <th scope="row"> | 
| 208 | 208 | <label for="expert"><?php esc_html_e( 'Expert', 'to-team' ); ?></label> | 
| @@ -212,10 +212,10 @@ discard block | ||
| 212 | 212 | <option value=""><?php esc_html_e( 'None', 'to-team' ); ?></option> | 
| 213 | 213 | |
| 214 | 214 | <?php | 
| 215 | -						foreach ( $experts as $expert ) { | |
| 216 | - echo '<option value="' . esc_attr( $expert->ID ) . '"' . selected( $value, $expert->ID, false ) . '>' . esc_html( $expert->post_title ) . '</option>'; | |
| 217 | - } | |
| 218 | - ?> | |
| 215 | +                              foreach ( $experts as $expert ) { | |
| 216 | + echo '<option value="' . esc_attr( $expert->ID ) . '"' . selected( $value, $expert->ID, false ) . '>' . esc_html( $expert->post_title ) . '</option>'; | |
| 217 | + } | |
| 218 | + ?> | |
| 219 | 219 | </select> | 
| 220 | 220 | |
| 221 | 221 | <?php wp_nonce_field( 'lsx_to_team_save_term_expert', 'lsx_to_team_term_expert_nonce' ); ?> | 
| @@ -223,52 +223,52 @@ discard block | ||
| 223 | 223 | </tr> | 
| 224 | 224 | |
| 225 | 225 | <?php | 
| 226 | - } | |
| 227 | - /** | |
| 228 | - * Saves the Taxnomy term banner image | |
| 229 | - * | |
| 230 | - * @since 0.1.0 | |
| 231 | - * | |
| 232 | - * @param int $term_id | |
| 233 | - * @param string $taxonomy | |
| 234 | - */ | |
| 235 | -	public function save_meta( $term_id = 0, $taxonomy = '' ) { | |
| 236 | -		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { | |
| 237 | - return; | |
| 238 | - } | |
| 239 | - | |
| 240 | -		if ( ! isset( $_POST['expert'] ) ) { | |
| 241 | - return; | |
| 242 | - } | |
| 243 | - | |
| 244 | -		if ( check_admin_referer( 'lsx_to_team_save_term_expert', 'lsx_to_team_term_expert_nonce' ) ) { | |
| 245 | - $meta = ! empty( sanitize_text_field( wp_unslash( $_POST['expert'] ) ) ) ? sanitize_text_field( wp_unslash( $_POST['expert'] ) ) : ''; | |
| 246 | - | |
| 247 | -			if ( empty( $meta ) ) { | |
| 248 | - delete_term_meta( $term_id, 'expert' ); | |
| 249 | -			} else { | |
| 250 | - update_term_meta( $term_id, 'expert', $meta ); | |
| 251 | - } | |
| 252 | - } | |
| 253 | - } | |
| 254 | - | |
| 255 | - /** | |
| 256 | - * Adds the team specific options | |
| 257 | - */ | |
| 258 | -	public function general_settings( $post_type = false, $tab = false ) { | |
| 259 | -		if ( 'general' !== $tab ) { | |
| 260 | - return false; | |
| 261 | - } | |
| 262 | - | |
| 263 | - $experts = get_posts( | |
| 264 | - array( | |
| 265 | - 'post_type' => 'team', | |
| 266 | - 'posts_per_page' => -1, | |
| 267 | - 'orderby' => 'menu_order', | |
| 268 | - 'order' => 'ASC', | |
| 269 | - ) | |
| 270 | - ); | |
| 271 | - ?> | |
| 226 | + } | |
| 227 | + /** | |
| 228 | + * Saves the Taxnomy term banner image | |
| 229 | + * | |
| 230 | + * @since 0.1.0 | |
| 231 | + * | |
| 232 | + * @param int $term_id | |
| 233 | + * @param string $taxonomy | |
| 234 | + */ | |
| 235 | +     public function save_meta( $term_id = 0, $taxonomy = '' ) { | |
| 236 | +          if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { | |
| 237 | + return; | |
| 238 | + } | |
| 239 | + | |
| 240 | +          if ( ! isset( $_POST['expert'] ) ) { | |
| 241 | + return; | |
| 242 | + } | |
| 243 | + | |
| 244 | +          if ( check_admin_referer( 'lsx_to_team_save_term_expert', 'lsx_to_team_term_expert_nonce' ) ) { | |
| 245 | + $meta = ! empty( sanitize_text_field( wp_unslash( $_POST['expert'] ) ) ) ? sanitize_text_field( wp_unslash( $_POST['expert'] ) ) : ''; | |
| 246 | + | |
| 247 | +               if ( empty( $meta ) ) { | |
| 248 | + delete_term_meta( $term_id, 'expert' ); | |
| 249 | +               } else { | |
| 250 | + update_term_meta( $term_id, 'expert', $meta ); | |
| 251 | + } | |
| 252 | + } | |
| 253 | + } | |
| 254 | + | |
| 255 | + /** | |
| 256 | + * Adds the team specific options | |
| 257 | + */ | |
| 258 | +     public function general_settings( $post_type = false, $tab = false ) { | |
| 259 | +          if ( 'general' !== $tab ) { | |
| 260 | + return false; | |
| 261 | + } | |
| 262 | + | |
| 263 | + $experts = get_posts( | |
| 264 | + array( | |
| 265 | + 'post_type' => 'team', | |
| 266 | + 'posts_per_page' => -1, | |
| 267 | + 'orderby' => 'menu_order', | |
| 268 | + 'order' => 'ASC', | |
| 269 | + ) | |
| 270 | + ); | |
| 271 | + ?> | |
| 272 | 272 | <tr class="form-field"> | 
| 273 | 273 | <th scope="row"> | 
| 274 | 274 | <label for="disable_team_panel"><?php esc_html_e( 'Disable Team Panel', 'to-team' ); ?></label> | 
| @@ -292,16 +292,16 @@ discard block | ||
| 292 | 292 | </td> | 
| 293 | 293 | </tr> | 
| 294 | 294 | <?php | 
| 295 | - } | |
| 296 | - | |
| 297 | - /** | |
| 298 | - * Adds the team specific options | |
| 299 | - */ | |
| 300 | -	public function archive_settings( $post_type = false, $tab = false ) { | |
| 301 | -		if ( 'archives' !== $tab ) { | |
| 302 | - return false; | |
| 303 | - } | |
| 304 | - ?> | |
| 295 | + } | |
| 296 | + | |
| 297 | + /** | |
| 298 | + * Adds the team specific options | |
| 299 | + */ | |
| 300 | +     public function archive_settings( $post_type = false, $tab = false ) { | |
| 301 | +          if ( 'archives' !== $tab ) { | |
| 302 | + return false; | |
| 303 | + } | |
| 304 | + ?> | |
| 305 | 305 | <tr class="form-field"> | 
| 306 | 306 | <th scope="row"> | 
| 307 | 307 | <label for="group_items_by_role"><?php esc_html_e( 'Group by Role', 'to-team' ); ?></label> | 
| @@ -312,7 +312,7 @@ discard block | ||
| 312 | 312 | </td> | 
| 313 | 313 | </tr> | 
| 314 | 314 | <?php | 
| 315 | - } | |
| 315 | + } | |
| 316 | 316 | } | 
| 317 | 317 | |
| 318 | 318 | new LSX_TO_Team_Admin(); | 
| @@ -35,34 +35,34 @@ discard block | ||
| 35 | 35 | * Constructor | 
| 36 | 36 | */ | 
| 37 | 37 |  	public function __construct() { | 
| 38 | - $this->options = get_option( '_lsx-to_settings', false ); | |
| 38 | +		$this->options = get_option('_lsx-to_settings', false); | |
| 39 | 39 | |
| 40 | - add_action( 'wp_head', array( $this, 'change_single_team_layout' ), 20, 1 ); | |
| 40 | +		add_action('wp_head', array($this, 'change_single_team_layout'), 20, 1); | |
| 41 | 41 | |
| 42 | -		if ( ! is_admin() ) { | |
| 43 | - add_filter( 'posts_orderby', array( $this, 'enable_role_taxonomy_order' ), 10, 2 ); | |
| 42 | +		if ( ! is_admin()) { | |
| 43 | +			add_filter('posts_orderby', array($this, 'enable_role_taxonomy_order'), 10, 2); | |
| 44 | 44 | } | 
| 45 | 45 | |
| 46 | - add_filter( 'lsx_to_archive_class', array( $this, 'archive_class' ), 10, 3 ); | |
| 47 | - add_filter( 'lsx_to_entry_class', array( $this, 'entry_class' ) ); | |
| 48 | - add_action( 'lsx_to_settings_current_tab', array( $this, 'set_settings_current_tab' ) ); | |
| 46 | +		add_filter('lsx_to_archive_class', array($this, 'archive_class'), 10, 3); | |
| 47 | +		add_filter('lsx_to_entry_class', array($this, 'entry_class')); | |
| 48 | +		add_action('lsx_to_settings_current_tab', array($this, 'set_settings_current_tab')); | |
| 49 | 49 | |
| 50 | -		if ( ! class_exists( 'LSX_TO_Template_Redirects' ) ) { | |
| 51 | - require_once( LSX_TO_TEAM_PATH . 'classes/class-lsx-to-template-redirects.php' ); | |
| 50 | +		if ( ! class_exists('LSX_TO_Template_Redirects')) { | |
| 51 | + require_once(LSX_TO_TEAM_PATH . 'classes/class-lsx-to-template-redirects.php'); | |
| 52 | 52 | } | 
| 53 | 53 | |
| 54 | - $this->redirects = new LSX_TO_Template_Redirects( LSX_TO_TEAM_PATH, array( 'team' ), array( 'role' ) ); | |
| 54 | +		$this->redirects = new LSX_TO_Template_Redirects(LSX_TO_TEAM_PATH, array('team'), array('role')); | |
| 55 | 55 | |
| 56 | - add_action( 'lsx_to_team_content', array( $this->redirects, 'content_part' ), 10, 2 ); | |
| 56 | +		add_action('lsx_to_team_content', array($this->redirects, 'content_part'), 10, 2); | |
| 57 | 57 | |
| 58 | - add_filter( 'lsx_to_page_navigation', array( $this, 'page_links' ) ); | |
| 58 | +		add_filter('lsx_to_page_navigation', array($this, 'page_links')); | |
| 59 | 59 | |
| 60 | - add_action( 'lsx_entry_top', array( $this, 'archive_entry_top' ), 15 ); | |
| 61 | - add_action( 'lsx_entry_bottom', array( $this, 'archive_entry_bottom' ) ); | |
| 62 | - add_action( 'lsx_content_bottom', array( $this, 'single_content_bottom' ) ); | |
| 60 | +		add_action('lsx_entry_top', array($this, 'archive_entry_top'), 15); | |
| 61 | +		add_action('lsx_entry_bottom', array($this, 'archive_entry_bottom')); | |
| 62 | +		add_action('lsx_content_bottom', array($this, 'single_content_bottom')); | |
| 63 | 63 | |
| 64 | - add_filter( 'lsx_to_maps_args', array( $this, 'lsx_to_maps_args' ), 10, 2 ); | |
| 65 | - add_filter( 'lsx_to_has_maps_location', array( $this, 'lsx_to_has_maps_location' ), 50, 2 ); | |
| 64 | +		add_filter('lsx_to_maps_args', array($this, 'lsx_to_maps_args'), 10, 2); | |
| 65 | +		add_filter('lsx_to_has_maps_location', array($this, 'lsx_to_has_maps_location'), 50, 2); | |
| 66 | 66 | } | 
| 67 | 67 | |
| 68 | 68 | /** | 
| @@ -71,9 +71,9 @@ discard block | ||
| 71 | 71 |  	public function change_single_team_layout() { | 
| 72 | 72 | global $lsx_to_archive; | 
| 73 | 73 | |
| 74 | -		if ( is_singular( 'team' ) && 1 !== $lsx_to_archive ) { | |
| 75 | - remove_action( 'lsx_entry_bottom', 'lsx_to_single_entry_bottom' ); | |
| 76 | - add_action( 'lsx_entry_top', array( $this, 'lsx_to_single_entry_bottom' ) ); | |
| 74 | +		if (is_singular('team') && 1 !== $lsx_to_archive) { | |
| 75 | +			remove_action('lsx_entry_bottom', 'lsx_to_single_entry_bottom'); | |
| 76 | +			add_action('lsx_entry_top', array($this, 'lsx_to_single_entry_bottom')); | |
| 77 | 77 | } | 
| 78 | 78 | } | 
| 79 | 79 | |
| @@ -81,15 +81,15 @@ discard block | ||
| 81 | 81 | * Change single team layout. | 
| 82 | 82 | */ | 
| 83 | 83 |  	public function lsx_to_single_entry_bottom() { | 
| 84 | -		if ( is_singular( 'team' ) ) { ?> | |
| 84 | +		if (is_singular('team')) { ?> | |
| 85 | 85 | <div class="col-xs-12 col-sm-5 col-md-4"> | 
| 86 | 86 | <figure class="lsx-to-team-thumb"> | 
| 87 | - <?php lsx_thumbnail( 'lsx-thumbnail-square' ); ?> | |
| 87 | +					<?php lsx_thumbnail('lsx-thumbnail-square'); ?> | |
| 88 | 88 | </figure> | 
| 89 | 89 | |
| 90 | 90 | <?php | 
| 91 | - lsx_to_team_social_profiles( '<span class="lsx-to-team-socials-header">' . esc_html__( 'Follow', 'to-team' ) . ':</span><div class="lsx-to-team-socials">', '</div>' ); | |
| 92 | - lsx_to_enquire_modal( esc_html__( 'Get in touch', 'to-team' ) ); | |
| 91 | +					lsx_to_team_social_profiles('<span class="lsx-to-team-socials-header">' . esc_html__('Follow', 'to-team') . ':</span><div class="lsx-to-team-socials">', '</div>'); | |
| 92 | +					lsx_to_enquire_modal(esc_html__('Get in touch', 'to-team')); | |
| 93 | 93 | ?> | 
| 94 | 94 | </div> | 
| 95 | 95 | <?php | 
| @@ -99,11 +99,11 @@ discard block | ||
| 99 | 99 | /** | 
| 100 | 100 | * Enable role taxonomy order. | 
| 101 | 101 | */ | 
| 102 | -	public function enable_role_taxonomy_order( $orderby, $query ) { | |
| 102 | +	public function enable_role_taxonomy_order($orderby, $query) { | |
| 103 | 103 | global $wpdb; | 
| 104 | 104 | |
| 105 | -		if ( $query->is_main_query() && $query->is_post_type_archive( 'team' ) ) { | |
| 106 | -			if ( isset( $this->options['team'] ) && isset( $this->options['team']['group_items_by_role'] ) ) { | |
| 105 | +		if ($query->is_main_query() && $query->is_post_type_archive('team')) { | |
| 106 | +			if (isset($this->options['team']) && isset($this->options['team']['group_items_by_role'])) { | |
| 107 | 107 | $new_orderby = "( | 
| 108 | 108 | SELECT GROUP_CONCAT(lsx_to_term_order ORDER BY lsx_to_term_order ASC) | 
| 109 | 109 | FROM $wpdb->term_relationships | 
| @@ -114,7 +114,7 @@ discard block | ||
| 114 | 114 | GROUP BY object_id | 
| 115 | 115 | ) "; | 
| 116 | 116 | |
| 117 | - $new_orderby .= ( 'ASC' == strtoupper( $query->get( 'order' ) ) ) ? 'ASC' : 'DESC'; | |
| 117 | +				$new_orderby .= ('ASC' == strtoupper($query->get('order'))) ? 'ASC' : 'DESC'; | |
| 118 | 118 | $orderby = $new_orderby . ', ' . $orderby; | 
| 119 | 119 | } | 
| 120 | 120 | } | 
| @@ -125,11 +125,11 @@ discard block | ||
| 125 | 125 | /** | 
| 126 | 126 | * A filter to set the content area to a small column on single | 
| 127 | 127 | */ | 
| 128 | -	public function archive_class( $new_classes, $classes, $layout ) { | |
| 129 | -		if ( is_post_type_archive( 'team' ) ) { | |
| 128 | +	public function archive_class($new_classes, $classes, $layout) { | |
| 129 | +		if (is_post_type_archive('team')) { | |
| 130 | 130 | $new_classes = $classes; | 
| 131 | 131 | |
| 132 | -			if ( 'grid' === $layout ) { | |
| 132 | +			if ('grid' === $layout) { | |
| 133 | 133 | $new_classes[] = 'col-xs-12 col-sm-6 col-md-3'; | 
| 134 | 134 |  			} else { | 
| 135 | 135 | $new_classes[] = 'col-xs-12'; | 
| @@ -142,15 +142,15 @@ discard block | ||
| 142 | 142 | /** | 
| 143 | 143 | * A filter to set the content area to a small column on single | 
| 144 | 144 | */ | 
| 145 | -	public function entry_class( $classes ) { | |
| 145 | +	public function entry_class($classes) { | |
| 146 | 146 | global $lsx_to_archive; | 
| 147 | 147 | |
| 148 | -		if ( 1 !== $lsx_to_archive ) { | |
| 148 | +		if (1 !== $lsx_to_archive) { | |
| 149 | 149 | $lsx_to_archive = false; | 
| 150 | 150 | } | 
| 151 | 151 | |
| 152 | -		if ( is_main_query() && is_singular( 'team' ) && false === $lsx_to_archive ) { | |
| 153 | -			if ( lsx_to_has_enquiry_contact() ) { | |
| 152 | +		if (is_main_query() && is_singular('team') && false === $lsx_to_archive) { | |
| 153 | +			if (lsx_to_has_enquiry_contact()) { | |
| 154 | 154 | $classes[] = 'col-xs-12 col-sm-7 col-md-8'; | 
| 155 | 155 |  			} else { | 
| 156 | 156 | $classes[] = 'col-xs-12'; | 
| @@ -163,11 +163,11 @@ discard block | ||
| 163 | 163 | /** | 
| 164 | 164 | * Sets the current tab selected. | 
| 165 | 165 | */ | 
| 166 | -	public function set_settings_current_tab( $settings_tab ) { | |
| 167 | -		if ( is_tax( 'role' ) ) { | |
| 168 | - $taxonomy = get_query_var( 'taxonomy' ); | |
| 166 | +	public function set_settings_current_tab($settings_tab) { | |
| 167 | +		if (is_tax('role')) { | |
| 168 | +			$taxonomy = get_query_var('taxonomy'); | |
| 169 | 169 | |
| 170 | -			if ( 'role' === $taxonomy ) { | |
| 170 | +			if ('role' === $taxonomy) { | |
| 171 | 171 | $settings_tab = 'team'; | 
| 172 | 172 | } | 
| 173 | 173 | } | 
| @@ -181,8 +181,8 @@ discard block | ||
| 181 | 181 | * @param $page_links array | 
| 182 | 182 | * @return $page_links array | 
| 183 | 183 | */ | 
| 184 | -	public function page_links( $page_links ) { | |
| 185 | -		if ( is_singular( 'team' ) ) { | |
| 184 | +	public function page_links($page_links) { | |
| 185 | +		if (is_singular('team')) { | |
| 186 | 186 | $this->page_links = $page_links; | 
| 187 | 187 | |
| 188 | 188 | $this->get_map_link(); | 
| @@ -206,14 +206,14 @@ discard block | ||
| 206 | 206 | * Tests for the Related Posts and returns a link for the section | 
| 207 | 207 | */ | 
| 208 | 208 |  	public function get_related_posts_link() { | 
| 209 | - $site_user = get_post_meta( get_the_ID(), 'site_user', true ); | |
| 209 | + $site_user = get_post_meta(get_the_ID(), 'site_user', true); | |
| 210 | 210 | |
| 211 | -		if ( ! empty( $site_user ) ) { | |
| 212 | -			if ( is_user_member_of_blog( $site_user ) ) { | |
| 213 | - $user_posts = count_user_posts( $site_user, 'post' ); | |
| 211 | +		if ( ! empty($site_user)) { | |
| 212 | +			if (is_user_member_of_blog($site_user)) { | |
| 213 | + $user_posts = count_user_posts($site_user, 'post'); | |
| 214 | 214 | |
| 215 | -				if ( $user_posts > 0 ) { | |
| 216 | - $this->page_links['posts'] = esc_html__( 'Posts', 'to-team' ); | |
| 215 | +				if ($user_posts > 0) { | |
| 216 | +					$this->page_links['posts'] = esc_html__('Posts', 'to-team'); | |
| 217 | 217 | } | 
| 218 | 218 | } | 
| 219 | 219 | } | 
| @@ -223,8 +223,8 @@ discard block | ||
| 223 | 223 | * Tests for the Google Map and returns a link for the section | 
| 224 | 224 | */ | 
| 225 | 225 |  	public function get_map_link() { | 
| 226 | -		if ( function_exists( 'lsx_to_has_map' ) && lsx_to_has_map() ) { | |
| 227 | - $this->page_links['team-map'] = esc_html__( 'Map', 'tour-operator' ); | |
| 226 | +		if (function_exists('lsx_to_has_map') && lsx_to_has_map()) { | |
| 227 | +			$this->page_links['team-map'] = esc_html__('Map', 'tour-operator'); | |
| 228 | 228 | } | 
| 229 | 229 | } | 
| 230 | 230 | |
| @@ -232,22 +232,22 @@ discard block | ||
| 232 | 232 | * Tests for the Related Accommodation and returns a link for the section | 
| 233 | 233 | */ | 
| 234 | 234 |  	public function get_related_accommodation_link() { | 
| 235 | - $connected_accommodation = get_post_meta( get_the_ID(), 'accommodation_to_team', false ); | |
| 235 | + $connected_accommodation = get_post_meta(get_the_ID(), 'accommodation_to_team', false); | |
| 236 | 236 | |
| 237 | -		if ( post_type_exists( 'accommodation' ) && is_array( $connected_accommodation ) && ! empty( $connected_accommodation ) ) { | |
| 238 | - $connected_accommodation = new \WP_Query( array( | |
| 237 | +		if (post_type_exists('accommodation') && is_array($connected_accommodation) && ! empty($connected_accommodation)) { | |
| 238 | + $connected_accommodation = new \WP_Query(array( | |
| 239 | 239 | 'post_type' => 'accommodation', | 
| 240 | 240 | 'post__in' => $connected_accommodation, | 
| 241 | 241 | 'post_status' => 'publish', | 
| 242 | 242 | 'nopagin' => true, | 
| 243 | 243 | 'posts_per_page' => '-1', | 
| 244 | 244 | 'fields' => 'ids', | 
| 245 | - ) ); | |
| 245 | + )); | |
| 246 | 246 | |
| 247 | 247 | $connected_accommodation = $connected_accommodation->posts; | 
| 248 | 248 | |
| 249 | -			if ( is_array( $connected_accommodation ) && ! empty( $connected_accommodation ) ) { | |
| 250 | - $this->page_links['accommodation'] = esc_html__( 'Accommodation', 'to-team' ); | |
| 249 | +			if (is_array($connected_accommodation) && ! empty($connected_accommodation)) { | |
| 250 | +				$this->page_links['accommodation'] = esc_html__('Accommodation', 'to-team'); | |
| 251 | 251 | } | 
| 252 | 252 | } | 
| 253 | 253 | } | 
| @@ -256,22 +256,22 @@ discard block | ||
| 256 | 256 | * Tests for the Related Destinations and returns a link for the section | 
| 257 | 257 | */ | 
| 258 | 258 |  	public function get_related_destination_link() { | 
| 259 | - $connected_destination = get_post_meta( get_the_ID(), 'destination_to_team', false ); | |
| 259 | + $connected_destination = get_post_meta(get_the_ID(), 'destination_to_team', false); | |
| 260 | 260 | |
| 261 | -		if ( post_type_exists( 'destination' ) && is_array( $connected_destination ) && ! empty( $connected_destination ) ) { | |
| 262 | - $connected_destination = new \WP_Query( array( | |
| 261 | +		if (post_type_exists('destination') && is_array($connected_destination) && ! empty($connected_destination)) { | |
| 262 | + $connected_destination = new \WP_Query(array( | |
| 263 | 263 | 'post_type' => 'destination', | 
| 264 | 264 | 'post__in' => $connected_destination, | 
| 265 | 265 | 'post_status' => 'publish', | 
| 266 | 266 | 'nopagin' => true, | 
| 267 | 267 | 'posts_per_page' => '-1', | 
| 268 | 268 | 'fields' => 'ids', | 
| 269 | - ) ); | |
| 269 | + )); | |
| 270 | 270 | |
| 271 | 271 | $connected_destination = $connected_destination->posts; | 
| 272 | 272 | |
| 273 | -			if ( is_array( $connected_destination ) && ! empty( $connected_destination ) ) { | |
| 274 | - $this->page_links['destination'] = esc_html__( 'Destinations', 'to-team' ); | |
| 273 | +			if (is_array($connected_destination) && ! empty($connected_destination)) { | |
| 274 | +				$this->page_links['destination'] = esc_html__('Destinations', 'to-team'); | |
| 275 | 275 | } | 
| 276 | 276 | } | 
| 277 | 277 | } | 
| @@ -280,22 +280,22 @@ discard block | ||
| 280 | 280 | * Tests for the Related Tours and returns a link for the section | 
| 281 | 281 | */ | 
| 282 | 282 |  	public function get_related_tours_link() { | 
| 283 | - $connected_tours = get_post_meta( get_the_ID(), 'tour_to_team', false ); | |
| 283 | + $connected_tours = get_post_meta(get_the_ID(), 'tour_to_team', false); | |
| 284 | 284 | |
| 285 | -		if ( post_type_exists( 'tour' ) && is_array( $connected_tours ) && ! empty( $connected_tours ) ) { | |
| 286 | - $connected_tours = new \WP_Query( array( | |
| 285 | +		if (post_type_exists('tour') && is_array($connected_tours) && ! empty($connected_tours)) { | |
| 286 | + $connected_tours = new \WP_Query(array( | |
| 287 | 287 | 'post_type' => 'tour', | 
| 288 | 288 | 'post__in' => $connected_tours, | 
| 289 | 289 | 'post_status' => 'publish', | 
| 290 | 290 | 'nopagin' => true, | 
| 291 | 291 | 'posts_per_page' => '-1', | 
| 292 | 292 | 'fields' => 'ids', | 
| 293 | - ) ); | |
| 293 | + )); | |
| 294 | 294 | |
| 295 | 295 | $connected_tours = $connected_tours->posts; | 
| 296 | 296 | |
| 297 | -			if ( is_array( $connected_tours ) && ! empty( $connected_tours ) ) { | |
| 298 | - $this->page_links['tours'] = esc_html__( 'Tours', 'to-team' ); | |
| 297 | +			if (is_array($connected_tours) && ! empty($connected_tours)) { | |
| 298 | +				$this->page_links['tours'] = esc_html__('Tours', 'to-team'); | |
| 299 | 299 | } | 
| 300 | 300 | } | 
| 301 | 301 | } | 
| @@ -304,22 +304,22 @@ discard block | ||
| 304 | 304 | * Tests for the Related Tours and returns a link for the section | 
| 305 | 305 | */ | 
| 306 | 306 |  	public function get_related_reviews_link() { | 
| 307 | - $connected_reviews = get_post_meta( get_the_ID(), 'review_to_team', false ); | |
| 307 | + $connected_reviews = get_post_meta(get_the_ID(), 'review_to_team', false); | |
| 308 | 308 | |
| 309 | -		if ( post_type_exists( 'review' ) && is_array( $connected_reviews ) && ! empty( $connected_reviews ) ) { | |
| 310 | - $connected_reviews = new \WP_Query( array( | |
| 309 | +		if (post_type_exists('review') && is_array($connected_reviews) && ! empty($connected_reviews)) { | |
| 310 | + $connected_reviews = new \WP_Query(array( | |
| 311 | 311 | 'post_type' => 'review', | 
| 312 | 312 | 'post__in' => $connected_reviews, | 
| 313 | 313 | 'post_status' => 'publish', | 
| 314 | 314 | 'nopagin' => true, | 
| 315 | 315 | 'posts_per_page' => '-1', | 
| 316 | 316 | 'fields' => 'ids', | 
| 317 | - ) ); | |
| 317 | + )); | |
| 318 | 318 | |
| 319 | 319 | $connected_reviews = $connected_reviews->posts; | 
| 320 | 320 | |
| 321 | -			if ( is_array( $connected_reviews ) && ! empty( $connected_reviews ) ) { | |
| 322 | - $this->page_links['reviews'] = esc_html__( 'Reviews', 'to-team' ); | |
| 321 | +			if (is_array($connected_reviews) && ! empty($connected_reviews)) { | |
| 322 | +				$this->page_links['reviews'] = esc_html__('Reviews', 'to-team'); | |
| 323 | 323 | } | 
| 324 | 324 | } | 
| 325 | 325 | } | 
| @@ -328,22 +328,22 @@ discard block | ||
| 328 | 328 | * Tests for the Gallery and returns a link for the section | 
| 329 | 329 | */ | 
| 330 | 330 |  	public function get_gallery_link() { | 
| 331 | - $gallery_ids = get_post_meta( get_the_ID(), 'gallery', false ); | |
| 332 | - $envira_gallery = get_post_meta( get_the_ID(), 'envira_gallery', true ); | |
| 331 | + $gallery_ids = get_post_meta(get_the_ID(), 'gallery', false); | |
| 332 | + $envira_gallery = get_post_meta(get_the_ID(), 'envira_gallery', true); | |
| 333 | 333 | |
| 334 | -		if ( ( ! empty( $gallery_ids ) && is_array( $gallery_ids ) ) || ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) ) { | |
| 335 | -			if ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) { | |
| 334 | +		if (( ! empty($gallery_ids) && is_array($gallery_ids)) || (function_exists('envira_gallery') && ! empty($envira_gallery) && false === lsx_to_enable_envira_banner())) { | |
| 335 | +			if (function_exists('envira_gallery') && ! empty($envira_gallery) && false === lsx_to_enable_envira_banner()) { | |
| 336 | 336 | // Envira Gallery. | 
| 337 | - $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-team' ); | |
| 337 | +				$this->page_links['gallery'] = esc_html__('Gallery', 'to-team'); | |
| 338 | 338 | return; | 
| 339 | 339 |  			} else { | 
| 340 | -				if ( function_exists( 'envira_dynamic' ) ) { | |
| 340 | +				if (function_exists('envira_dynamic')) { | |
| 341 | 341 | // Envira Gallery - Dynamic. | 
| 342 | - $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-team' ); | |
| 342 | +					$this->page_links['gallery'] = esc_html__('Gallery', 'to-team'); | |
| 343 | 343 | return; | 
| 344 | 344 |  				} else { | 
| 345 | 345 | // WordPress Gallery. | 
| 346 | - $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-team' ); | |
| 346 | +					$this->page_links['gallery'] = esc_html__('Gallery', 'to-team'); | |
| 347 | 347 | return; | 
| 348 | 348 | } | 
| 349 | 349 | } | 
| @@ -356,16 +356,16 @@ discard block | ||
| 356 | 356 |  	public function get_videos_link() { | 
| 357 | 357 | $videos_id = false; | 
| 358 | 358 | |
| 359 | -		if ( class_exists( 'Envira_Videos' ) ) { | |
| 360 | - $videos_id = get_post_meta( get_the_ID(), 'envira_video', true ); | |
| 359 | +		if (class_exists('Envira_Videos')) { | |
| 360 | + $videos_id = get_post_meta(get_the_ID(), 'envira_video', true); | |
| 361 | 361 | } | 
| 362 | 362 | |
| 363 | -		if ( empty( $videos_id ) && function_exists( 'lsx_to_videos' ) ) { | |
| 364 | - $videos_id = get_post_meta( get_the_ID(), 'videos', true ); | |
| 363 | +		if (empty($videos_id) && function_exists('lsx_to_videos')) { | |
| 364 | + $videos_id = get_post_meta(get_the_ID(), 'videos', true); | |
| 365 | 365 | } | 
| 366 | 366 | |
| 367 | -		if ( ! empty( $videos_id ) ) { | |
| 368 | - $this->page_links['videos'] = esc_html__( 'Videos', 'to-team' ); | |
| 367 | +		if ( ! empty($videos_id)) { | |
| 368 | +			$this->page_links['videos'] = esc_html__('Videos', 'to-team'); | |
| 369 | 369 | } | 
| 370 | 370 | } | 
| 371 | 371 | |
| @@ -375,18 +375,18 @@ discard block | ||
| 375 | 375 |  	public function archive_entry_top() { | 
| 376 | 376 | global $lsx_to_archive; | 
| 377 | 377 | |
| 378 | -		if ( 'team' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { | |
| 378 | +		if ('team' === get_post_type() && (is_archive() || $lsx_to_archive)) { | |
| 379 | 379 | ?> | 
| 380 | -			<?php if ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?> | |
| 380 | +			<?php if (is_search() || empty(tour_operator()->options[get_post_type()]['disable_entry_metadata'])) { ?> | |
| 381 | 381 | <div class="lsx-to-archive-meta-data lsx-to-archive-meta-data-grid-mode"> | 
| 382 | 382 | <?php | 
| 383 | 383 | $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; | 
| 384 | 384 | |
| 385 | - lsx_to_team_role( '<span class="' . $meta_class . 'role"><span class="lsx-to-meta-data-key">' . __( 'Role', 'to-team' ) . ':</span> ', '</span>' ); | |
| 386 | - lsx_to_team_contact_number( '<span class="' . $meta_class . 'phone">', '</span>' ); | |
| 387 | - lsx_to_team_contact_email( '<span class="' . $meta_class . 'email">', '</span>' ); | |
| 388 | - lsx_to_team_contact_skype( '<span class="' . $meta_class . 'skype">', '</span>' ); | |
| 389 | - lsx_to_team_social_profiles( '<div class="' . $meta_class . 'socials">', '</div>' ); | |
| 385 | +						lsx_to_team_role('<span class="' . $meta_class . 'role"><span class="lsx-to-meta-data-key">' . __('Role', 'to-team') . ':</span> ', '</span>'); | |
| 386 | +						lsx_to_team_contact_number('<span class="' . $meta_class . 'phone">', '</span>'); | |
| 387 | +						lsx_to_team_contact_email('<span class="' . $meta_class . 'email">', '</span>'); | |
| 388 | +						lsx_to_team_contact_skype('<span class="' . $meta_class . 'skype">', '</span>'); | |
| 389 | +						lsx_to_team_social_profiles('<div class="' . $meta_class . 'socials">', '</div>'); | |
| 390 | 390 | ?> | 
| 391 | 391 | </div> | 
| 392 | 392 | <?php } ?> | 
| @@ -400,20 +400,20 @@ discard block | ||
| 400 | 400 |  	public function archive_entry_bottom() { | 
| 401 | 401 | global $lsx_to_archive; | 
| 402 | 402 | |
| 403 | -		if ( 'team' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { | |
| 403 | +		if ('team' === get_post_type() && (is_archive() || $lsx_to_archive)) { | |
| 404 | 404 | ?> | 
| 405 | 405 | </div> | 
| 406 | 406 | |
| 407 | -				<?php if ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?> | |
| 407 | +				<?php if (is_search() || empty(tour_operator()->options[get_post_type()]['disable_entry_metadata'])) { ?> | |
| 408 | 408 | <div class="lsx-to-archive-meta-data lsx-to-archive-meta-data-list-mode"> | 
| 409 | 409 | <?php | 
| 410 | 410 | $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; | 
| 411 | 411 | |
| 412 | - lsx_to_team_role( '<span class="' . $meta_class . 'role"><span class="lsx-to-meta-data-key">' . __( 'Role', 'to-team' ) . ':</span> ', '</span>' ); | |
| 413 | - lsx_to_team_contact_number( '<span class="' . $meta_class . 'phone">', '</span>' ); | |
| 414 | - lsx_to_team_contact_email( '<span class="' . $meta_class . 'email">', '</span>' ); | |
| 415 | - lsx_to_team_contact_skype( '<span class="' . $meta_class . 'skype">', '</span>' ); | |
| 416 | - lsx_to_team_social_profiles( '<div class="' . $meta_class . 'socials">', '</div>' ); | |
| 412 | +							lsx_to_team_role('<span class="' . $meta_class . 'role"><span class="lsx-to-meta-data-key">' . __('Role', 'to-team') . ':</span> ', '</span>'); | |
| 413 | +							lsx_to_team_contact_number('<span class="' . $meta_class . 'phone">', '</span>'); | |
| 414 | +							lsx_to_team_contact_email('<span class="' . $meta_class . 'email">', '</span>'); | |
| 415 | +							lsx_to_team_contact_skype('<span class="' . $meta_class . 'skype">', '</span>'); | |
| 416 | +							lsx_to_team_social_profiles('<div class="' . $meta_class . 'socials">', '</div>'); | |
| 417 | 417 | ?> | 
| 418 | 418 | </div> | 
| 419 | 419 | <?php } ?> | 
| @@ -423,8 +423,8 @@ discard block | ||
| 423 | 423 | $has_single = ! lsx_to_is_single_disabled(); | 
| 424 | 424 | ?> | 
| 425 | 425 | |
| 426 | - <?php if ( $has_single && 'grid' === tour_operator()->archive_layout ) : ?> | |
| 427 | - <p class="text-center lsx-to-single-link"><a href="<?php the_permalink(); ?>"><?php echo esc_html__( 'More about', 'to-team' ) . ' ' . esc_html( strtok( $member_name, ' ' ) ); ?> <i class="fa fa-angle-right" aria-hidden="true"></i></a></p> | |
| 426 | + <?php if ($has_single && 'grid' === tour_operator()->archive_layout) : ?> | |
| 427 | +					<p class="text-center lsx-to-single-link"><a href="<?php the_permalink(); ?>"><?php echo esc_html__('More about', 'to-team') . ' ' . esc_html(strtok($member_name, ' ')); ?> <i class="fa fa-angle-right" aria-hidden="true"></i></a></p> | |
| 428 | 428 | <?php endif; ?> | 
| 429 | 429 | </div> | 
| 430 | 430 | <?php | 
| @@ -435,14 +435,14 @@ discard block | ||
| 435 | 435 | * Adds the template tags to the bottom of the single team | 
| 436 | 436 | */ | 
| 437 | 437 |  	public function single_content_bottom() { | 
| 438 | -		if ( is_singular( 'team' ) ) { | |
| 439 | - if ( function_exists( 'lsx_to_has_map' ) && lsx_to_has_map() ) : | |
| 438 | +		if (is_singular('team')) { | |
| 439 | +			if (function_exists('lsx_to_has_map') && lsx_to_has_map()) : | |
| 440 | 440 | global $post; | 
| 441 | 441 | $map_title = $post->post_title; | 
| 442 | - $map_title = $map_title . __( "'s favourite places", 'to-team' ); | |
| 442 | +				$map_title = $map_title . __("'s favourite places", 'to-team'); | |
| 443 | 443 | ?> | 
| 444 | 444 | <section id="team-map" class="lsx-to-section lsx-to-collapse-section"> | 
| 445 | - <h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-team-map"><?php echo esc_html( $map_title ); ?></h2> | |
| 445 | + <h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-team-map"><?php echo esc_html($map_title); ?></h2> | |
| 446 | 446 | |
| 447 | 447 | <div id="collapse-team-map" class="collapse in"> | 
| 448 | 448 | <div class="collapse-inner"> | 
| @@ -463,20 +463,20 @@ discard block | ||
| 463 | 463 | |
| 464 | 464 | lsx_to_team_reviews(); | 
| 465 | 465 | |
| 466 | - lsx_to_gallery( '<section id="gallery" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-gallery">' . esc_html__( 'Gallery', 'to-team' ) . '</h2><div id="collapse-gallery" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); | |
| 466 | +			lsx_to_gallery('<section id="gallery" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-gallery">' . esc_html__('Gallery', 'to-team') . '</h2><div id="collapse-gallery" class="collapse in"><div class="collapse-inner">', '</div></div></section>'); | |
| 467 | 467 | |
| 468 | -			if ( function_exists( 'lsx_to_videos' ) ) { | |
| 469 | - lsx_to_videos( '<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__( 'Videos', 'to-team' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); | |
| 470 | -			} elseif ( class_exists( 'Envira_Videos' ) ) { | |
| 471 | - lsx_to_envira_videos( '<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__( 'Videos', 'to-team' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); | |
| 468 | +			if (function_exists('lsx_to_videos')) { | |
| 469 | +				lsx_to_videos('<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__('Videos', 'to-team') . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>'); | |
| 470 | +			} elseif (class_exists('Envira_Videos')) { | |
| 471 | +				lsx_to_envira_videos('<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__('Videos', 'to-team') . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>'); | |
| 472 | 472 | } | 
| 473 | 473 | } | 
| 474 | 474 | } | 
| 475 | 475 | |
| 476 | -	public function lsx_to_maps_args( $args, $post_id ) { | |
| 477 | -		if ( is_singular( 'team' ) ) { | |
| 478 | - $accommodation_connected = get_post_meta( get_the_ID(), 'accommodation_to_team' ); | |
| 479 | -			if ( is_array( $accommodation_connected ) && ! empty( $accommodation_connected ) ) { | |
| 476 | +	public function lsx_to_maps_args($args, $post_id) { | |
| 477 | +		if (is_singular('team')) { | |
| 478 | + $accommodation_connected = get_post_meta(get_the_ID(), 'accommodation_to_team'); | |
| 479 | +			if (is_array($accommodation_connected) && ! empty($accommodation_connected)) { | |
| 480 | 480 | $args = array( | 
| 481 | 481 | 'lat' => true, | 
| 482 | 482 | 'long' => true, | 
| @@ -491,10 +491,10 @@ discard block | ||
| 491 | 491 | return $args; | 
| 492 | 492 | } | 
| 493 | 493 | |
| 494 | -	public function lsx_to_has_maps_location( $location, $id ) { | |
| 495 | -		if ( is_singular( 'team' ) ) { | |
| 496 | - $accommodation_connected = get_post_meta( $id, 'accommodation_to_team' ); | |
| 497 | -			if ( is_array( $accommodation_connected ) && ! empty( $accommodation_connected ) ) { | |
| 494 | +	public function lsx_to_has_maps_location($location, $id) { | |
| 495 | +		if (is_singular('team')) { | |
| 496 | + $accommodation_connected = get_post_meta($id, 'accommodation_to_team'); | |
| 497 | +			if (is_array($accommodation_connected) && ! empty($accommodation_connected)) { | |
| 498 | 498 | $location = array( | 
| 499 | 499 | 'lat' => true, | 
| 500 | 500 | 'connections' => $accommodation_connected, | 
| @@ -17,94 +17,94 @@ discard block | ||
| 17 | 17 | */ | 
| 18 | 18 |  class LSX_TO_Team_Frontend extends LSX_TO_Team { | 
| 19 | 19 | |
| 20 | - /** | |
| 21 | - * Holds the $page_links array while its being built on the single team page. | |
| 22 | - * | |
| 23 | - * @var array | |
| 24 | - */ | |
| 25 | - public $page_links = false; | |
| 26 | - | |
| 27 | - /** | |
| 28 | - * Holds the array of options. | |
| 29 | - * | |
| 30 | - * @var array | |
| 31 | - */ | |
| 32 | - public $options = false; | |
| 33 | - | |
| 34 | - /** | |
| 35 | - * Constructor | |
| 36 | - */ | |
| 37 | -	public function __construct() { | |
| 38 | - $this->options = get_option( '_lsx-to_settings', false ); | |
| 39 | - | |
| 40 | - add_action( 'wp_head', array( $this, 'change_single_team_layout' ), 20, 1 ); | |
| 41 | - | |
| 42 | -		if ( ! is_admin() ) { | |
| 43 | - add_filter( 'posts_orderby', array( $this, 'enable_role_taxonomy_order' ), 10, 2 ); | |
| 44 | - } | |
| 45 | - | |
| 46 | - add_filter( 'lsx_to_archive_class', array( $this, 'archive_class' ), 10, 3 ); | |
| 47 | - add_filter( 'lsx_to_entry_class', array( $this, 'entry_class' ) ); | |
| 48 | - add_action( 'lsx_to_settings_current_tab', array( $this, 'set_settings_current_tab' ) ); | |
| 49 | - | |
| 50 | -		if ( ! class_exists( 'LSX_TO_Template_Redirects' ) ) { | |
| 51 | - require_once( LSX_TO_TEAM_PATH . 'classes/class-lsx-to-template-redirects.php' ); | |
| 52 | - } | |
| 53 | - | |
| 54 | - $this->redirects = new LSX_TO_Template_Redirects( LSX_TO_TEAM_PATH, array( 'team' ), array( 'role' ) ); | |
| 55 | - | |
| 56 | - add_action( 'lsx_to_team_content', array( $this->redirects, 'content_part' ), 10, 2 ); | |
| 57 | - | |
| 58 | - add_filter( 'lsx_to_page_navigation', array( $this, 'page_links' ) ); | |
| 59 | - | |
| 60 | - add_action( 'lsx_entry_top', array( $this, 'archive_entry_top' ), 15 ); | |
| 61 | - add_action( 'lsx_entry_bottom', array( $this, 'archive_entry_bottom' ) ); | |
| 62 | - add_action( 'lsx_content_bottom', array( $this, 'single_content_bottom' ) ); | |
| 63 | - | |
| 64 | - add_filter( 'lsx_to_maps_args', array( $this, 'lsx_to_maps_args' ), 10, 2 ); | |
| 65 | - add_filter( 'lsx_to_has_maps_location', array( $this, 'lsx_to_has_maps_location' ), 50, 2 ); | |
| 66 | - } | |
| 67 | - | |
| 68 | - /** | |
| 69 | - * Change single team layout. | |
| 70 | - */ | |
| 71 | -	public function change_single_team_layout() { | |
| 72 | - global $lsx_to_archive; | |
| 73 | - | |
| 74 | -		if ( is_singular( 'team' ) && 1 !== $lsx_to_archive ) { | |
| 75 | - remove_action( 'lsx_entry_bottom', 'lsx_to_single_entry_bottom' ); | |
| 76 | - add_action( 'lsx_entry_top', array( $this, 'lsx_to_single_entry_bottom' ) ); | |
| 77 | - } | |
| 78 | - } | |
| 79 | - | |
| 80 | - /** | |
| 81 | - * Change single team layout. | |
| 82 | - */ | |
| 83 | -	public function lsx_to_single_entry_bottom() { | |
| 84 | -		if ( is_singular( 'team' ) ) { ?> | |
| 20 | + /** | |
| 21 | + * Holds the $page_links array while its being built on the single team page. | |
| 22 | + * | |
| 23 | + * @var array | |
| 24 | + */ | |
| 25 | + public $page_links = false; | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * Holds the array of options. | |
| 29 | + * | |
| 30 | + * @var array | |
| 31 | + */ | |
| 32 | + public $options = false; | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * Constructor | |
| 36 | + */ | |
| 37 | +     public function __construct() { | |
| 38 | + $this->options = get_option( '_lsx-to_settings', false ); | |
| 39 | + | |
| 40 | + add_action( 'wp_head', array( $this, 'change_single_team_layout' ), 20, 1 ); | |
| 41 | + | |
| 42 | +          if ( ! is_admin() ) { | |
| 43 | + add_filter( 'posts_orderby', array( $this, 'enable_role_taxonomy_order' ), 10, 2 ); | |
| 44 | + } | |
| 45 | + | |
| 46 | + add_filter( 'lsx_to_archive_class', array( $this, 'archive_class' ), 10, 3 ); | |
| 47 | + add_filter( 'lsx_to_entry_class', array( $this, 'entry_class' ) ); | |
| 48 | + add_action( 'lsx_to_settings_current_tab', array( $this, 'set_settings_current_tab' ) ); | |
| 49 | + | |
| 50 | +          if ( ! class_exists( 'LSX_TO_Template_Redirects' ) ) { | |
| 51 | + require_once( LSX_TO_TEAM_PATH . 'classes/class-lsx-to-template-redirects.php' ); | |
| 52 | + } | |
| 53 | + | |
| 54 | + $this->redirects = new LSX_TO_Template_Redirects( LSX_TO_TEAM_PATH, array( 'team' ), array( 'role' ) ); | |
| 55 | + | |
| 56 | + add_action( 'lsx_to_team_content', array( $this->redirects, 'content_part' ), 10, 2 ); | |
| 57 | + | |
| 58 | + add_filter( 'lsx_to_page_navigation', array( $this, 'page_links' ) ); | |
| 59 | + | |
| 60 | + add_action( 'lsx_entry_top', array( $this, 'archive_entry_top' ), 15 ); | |
| 61 | + add_action( 'lsx_entry_bottom', array( $this, 'archive_entry_bottom' ) ); | |
| 62 | + add_action( 'lsx_content_bottom', array( $this, 'single_content_bottom' ) ); | |
| 63 | + | |
| 64 | + add_filter( 'lsx_to_maps_args', array( $this, 'lsx_to_maps_args' ), 10, 2 ); | |
| 65 | + add_filter( 'lsx_to_has_maps_location', array( $this, 'lsx_to_has_maps_location' ), 50, 2 ); | |
| 66 | + } | |
| 67 | + | |
| 68 | + /** | |
| 69 | + * Change single team layout. | |
| 70 | + */ | |
| 71 | +     public function change_single_team_layout() { | |
| 72 | + global $lsx_to_archive; | |
| 73 | + | |
| 74 | +          if ( is_singular( 'team' ) && 1 !== $lsx_to_archive ) { | |
| 75 | + remove_action( 'lsx_entry_bottom', 'lsx_to_single_entry_bottom' ); | |
| 76 | + add_action( 'lsx_entry_top', array( $this, 'lsx_to_single_entry_bottom' ) ); | |
| 77 | + } | |
| 78 | + } | |
| 79 | + | |
| 80 | + /** | |
| 81 | + * Change single team layout. | |
| 82 | + */ | |
| 83 | +     public function lsx_to_single_entry_bottom() { | |
| 84 | +          if ( is_singular( 'team' ) ) { ?> | |
| 85 | 85 | <div class="col-xs-12 col-sm-5 col-md-4"> | 
| 86 | 86 | <figure class="lsx-to-team-thumb"> | 
| 87 | 87 | <?php lsx_thumbnail( 'lsx-thumbnail-square' ); ?> | 
| 88 | 88 | </figure> | 
| 89 | 89 | |
| 90 | 90 | <?php | 
| 91 | - lsx_to_team_social_profiles( '<span class="lsx-to-team-socials-header">' . esc_html__( 'Follow', 'to-team' ) . ':</span><div class="lsx-to-team-socials">', '</div>' ); | |
| 92 | - lsx_to_enquire_modal( esc_html__( 'Get in touch', 'to-team' ) ); | |
| 93 | - ?> | |
| 91 | + lsx_to_team_social_profiles( '<span class="lsx-to-team-socials-header">' . esc_html__( 'Follow', 'to-team' ) . ':</span><div class="lsx-to-team-socials">', '</div>' ); | |
| 92 | + lsx_to_enquire_modal( esc_html__( 'Get in touch', 'to-team' ) ); | |
| 93 | + ?> | |
| 94 | 94 | </div> | 
| 95 | 95 | <?php | 
| 96 | - } | |
| 97 | - } | |
| 98 | - | |
| 99 | - /** | |
| 100 | - * Enable role taxonomy order. | |
| 101 | - */ | |
| 102 | -	public function enable_role_taxonomy_order( $orderby, $query ) { | |
| 103 | - global $wpdb; | |
| 104 | - | |
| 105 | -		if ( $query->is_main_query() && $query->is_post_type_archive( 'team' ) ) { | |
| 106 | -			if ( isset( $this->options['team'] ) && isset( $this->options['team']['group_items_by_role'] ) ) { | |
| 107 | - $new_orderby = "( | |
| 96 | + } | |
| 97 | + } | |
| 98 | + | |
| 99 | + /** | |
| 100 | + * Enable role taxonomy order. | |
| 101 | + */ | |
| 102 | +     public function enable_role_taxonomy_order( $orderby, $query ) { | |
| 103 | + global $wpdb; | |
| 104 | + | |
| 105 | +          if ( $query->is_main_query() && $query->is_post_type_archive( 'team' ) ) { | |
| 106 | +               if ( isset( $this->options['team'] ) && isset( $this->options['team']['group_items_by_role'] ) ) { | |
| 107 | + $new_orderby = "( | |
| 108 | 108 | SELECT GROUP_CONCAT(lsx_to_term_order ORDER BY lsx_to_term_order ASC) | 
| 109 | 109 | FROM $wpdb->term_relationships | 
| 110 | 110 | INNER JOIN $wpdb->term_taxonomy USING (term_taxonomy_id) | 
| @@ -114,333 +114,333 @@ discard block | ||
| 114 | 114 | GROUP BY object_id | 
| 115 | 115 | ) "; | 
| 116 | 116 | |
| 117 | - $new_orderby .= ( 'ASC' == strtoupper( $query->get( 'order' ) ) ) ? 'ASC' : 'DESC'; | |
| 118 | - $orderby = $new_orderby . ', ' . $orderby; | |
| 119 | - } | |
| 120 | - } | |
| 121 | - | |
| 122 | - return $orderby; | |
| 123 | - } | |
| 124 | - | |
| 125 | - /** | |
| 126 | - * A filter to set the content area to a small column on single | |
| 127 | - */ | |
| 128 | -	public function archive_class( $new_classes, $classes, $layout ) { | |
| 129 | -		if ( is_post_type_archive( 'team' ) ) { | |
| 130 | - $new_classes = $classes; | |
| 131 | - | |
| 132 | -			if ( 'grid' === $layout ) { | |
| 133 | - $new_classes[] = 'col-xs-12 col-sm-6 col-md-3'; | |
| 134 | -			} else { | |
| 135 | - $new_classes[] = 'col-xs-12'; | |
| 136 | - } | |
| 137 | - } | |
| 138 | - | |
| 139 | - return $new_classes; | |
| 140 | - } | |
| 141 | - | |
| 142 | - /** | |
| 143 | - * A filter to set the content area to a small column on single | |
| 144 | - */ | |
| 145 | -	public function entry_class( $classes ) { | |
| 146 | - global $lsx_to_archive; | |
| 147 | - | |
| 148 | -		if ( 1 !== $lsx_to_archive ) { | |
| 149 | - $lsx_to_archive = false; | |
| 150 | - } | |
| 151 | - | |
| 152 | -		if ( is_main_query() && is_singular( 'team' ) && false === $lsx_to_archive ) { | |
| 153 | -			if ( lsx_to_has_enquiry_contact() ) { | |
| 154 | - $classes[] = 'col-xs-12 col-sm-7 col-md-8'; | |
| 155 | -			} else { | |
| 156 | - $classes[] = 'col-xs-12'; | |
| 157 | - } | |
| 158 | - } | |
| 159 | - | |
| 160 | - return $classes; | |
| 161 | - } | |
| 162 | - | |
| 163 | - /** | |
| 164 | - * Sets the current tab selected. | |
| 165 | - */ | |
| 166 | -	public function set_settings_current_tab( $settings_tab ) { | |
| 167 | -		if ( is_tax( 'role' ) ) { | |
| 168 | - $taxonomy = get_query_var( 'taxonomy' ); | |
| 169 | - | |
| 170 | -			if ( 'role' === $taxonomy ) { | |
| 171 | - $settings_tab = 'team'; | |
| 172 | - } | |
| 173 | - } | |
| 174 | - | |
| 175 | - return $settings_tab; | |
| 176 | - } | |
| 177 | - | |
| 178 | - /** | |
| 179 | - * Adds our navigation links to the team single post | |
| 180 | - * | |
| 181 | - * @param $page_links array | |
| 182 | - * @return $page_links array | |
| 183 | - */ | |
| 184 | -	public function page_links( $page_links ) { | |
| 185 | -		if ( is_singular( 'team' ) ) { | |
| 186 | - $this->page_links = $page_links; | |
| 187 | - | |
| 188 | - $this->get_map_link(); | |
| 189 | - | |
| 190 | - $this->get_related_posts_link(); | |
| 191 | - $this->get_related_accommodation_link(); | |
| 192 | - $this->get_related_destination_link(); | |
| 193 | - $this->get_related_tours_link(); | |
| 194 | - $this->get_related_reviews_link(); | |
| 195 | - | |
| 196 | - $this->get_gallery_link(); | |
| 197 | - $this->get_videos_link(); | |
| 198 | - | |
| 199 | - $page_links = $this->page_links; | |
| 200 | - } | |
| 201 | - | |
| 202 | - return $page_links; | |
| 203 | - } | |
| 204 | - | |
| 205 | - /** | |
| 206 | - * Tests for the Related Posts and returns a link for the section | |
| 207 | - */ | |
| 208 | -	public function get_related_posts_link() { | |
| 209 | - $site_user = get_post_meta( get_the_ID(), 'site_user', true ); | |
| 210 | - | |
| 211 | -		if ( ! empty( $site_user ) ) { | |
| 212 | -			if ( is_user_member_of_blog( $site_user ) ) { | |
| 213 | - $user_posts = count_user_posts( $site_user, 'post' ); | |
| 214 | - | |
| 215 | -				if ( $user_posts > 0 ) { | |
| 216 | - $this->page_links['posts'] = esc_html__( 'Posts', 'to-team' ); | |
| 217 | - } | |
| 218 | - } | |
| 219 | - } | |
| 220 | - } | |
| 221 | - | |
| 222 | - /** | |
| 223 | - * Tests for the Google Map and returns a link for the section | |
| 224 | - */ | |
| 225 | -	public function get_map_link() { | |
| 226 | -		if ( function_exists( 'lsx_to_has_map' ) && lsx_to_has_map() ) { | |
| 227 | - $this->page_links['team-map'] = esc_html__( 'Map', 'tour-operator' ); | |
| 228 | - } | |
| 229 | - } | |
| 230 | - | |
| 231 | - /** | |
| 232 | - * Tests for the Related Accommodation and returns a link for the section | |
| 233 | - */ | |
| 234 | -	public function get_related_accommodation_link() { | |
| 235 | - $connected_accommodation = get_post_meta( get_the_ID(), 'accommodation_to_team', false ); | |
| 236 | - | |
| 237 | -		if ( post_type_exists( 'accommodation' ) && is_array( $connected_accommodation ) && ! empty( $connected_accommodation ) ) { | |
| 238 | - $connected_accommodation = new \WP_Query( array( | |
| 239 | - 'post_type' => 'accommodation', | |
| 240 | - 'post__in' => $connected_accommodation, | |
| 241 | - 'post_status' => 'publish', | |
| 242 | - 'nopagin' => true, | |
| 243 | - 'posts_per_page' => '-1', | |
| 244 | - 'fields' => 'ids', | |
| 245 | - ) ); | |
| 246 | - | |
| 247 | - $connected_accommodation = $connected_accommodation->posts; | |
| 248 | - | |
| 249 | -			if ( is_array( $connected_accommodation ) && ! empty( $connected_accommodation ) ) { | |
| 250 | - $this->page_links['accommodation'] = esc_html__( 'Accommodation', 'to-team' ); | |
| 251 | - } | |
| 252 | - } | |
| 253 | - } | |
| 254 | - | |
| 255 | - /** | |
| 256 | - * Tests for the Related Destinations and returns a link for the section | |
| 257 | - */ | |
| 258 | -	public function get_related_destination_link() { | |
| 259 | - $connected_destination = get_post_meta( get_the_ID(), 'destination_to_team', false ); | |
| 260 | - | |
| 261 | -		if ( post_type_exists( 'destination' ) && is_array( $connected_destination ) && ! empty( $connected_destination ) ) { | |
| 262 | - $connected_destination = new \WP_Query( array( | |
| 263 | - 'post_type' => 'destination', | |
| 264 | - 'post__in' => $connected_destination, | |
| 265 | - 'post_status' => 'publish', | |
| 266 | - 'nopagin' => true, | |
| 267 | - 'posts_per_page' => '-1', | |
| 268 | - 'fields' => 'ids', | |
| 269 | - ) ); | |
| 270 | - | |
| 271 | - $connected_destination = $connected_destination->posts; | |
| 272 | - | |
| 273 | -			if ( is_array( $connected_destination ) && ! empty( $connected_destination ) ) { | |
| 274 | - $this->page_links['destination'] = esc_html__( 'Destinations', 'to-team' ); | |
| 275 | - } | |
| 276 | - } | |
| 277 | - } | |
| 278 | - | |
| 279 | - /** | |
| 280 | - * Tests for the Related Tours and returns a link for the section | |
| 281 | - */ | |
| 282 | -	public function get_related_tours_link() { | |
| 283 | - $connected_tours = get_post_meta( get_the_ID(), 'tour_to_team', false ); | |
| 284 | - | |
| 285 | -		if ( post_type_exists( 'tour' ) && is_array( $connected_tours ) && ! empty( $connected_tours ) ) { | |
| 286 | - $connected_tours = new \WP_Query( array( | |
| 287 | - 'post_type' => 'tour', | |
| 288 | - 'post__in' => $connected_tours, | |
| 289 | - 'post_status' => 'publish', | |
| 290 | - 'nopagin' => true, | |
| 291 | - 'posts_per_page' => '-1', | |
| 292 | - 'fields' => 'ids', | |
| 293 | - ) ); | |
| 294 | - | |
| 295 | - $connected_tours = $connected_tours->posts; | |
| 296 | - | |
| 297 | -			if ( is_array( $connected_tours ) && ! empty( $connected_tours ) ) { | |
| 298 | - $this->page_links['tours'] = esc_html__( 'Tours', 'to-team' ); | |
| 299 | - } | |
| 300 | - } | |
| 301 | - } | |
| 302 | - | |
| 303 | - /** | |
| 304 | - * Tests for the Related Tours and returns a link for the section | |
| 305 | - */ | |
| 306 | -	public function get_related_reviews_link() { | |
| 307 | - $connected_reviews = get_post_meta( get_the_ID(), 'review_to_team', false ); | |
| 308 | - | |
| 309 | -		if ( post_type_exists( 'review' ) && is_array( $connected_reviews ) && ! empty( $connected_reviews ) ) { | |
| 310 | - $connected_reviews = new \WP_Query( array( | |
| 311 | - 'post_type' => 'review', | |
| 312 | - 'post__in' => $connected_reviews, | |
| 313 | - 'post_status' => 'publish', | |
| 314 | - 'nopagin' => true, | |
| 315 | - 'posts_per_page' => '-1', | |
| 316 | - 'fields' => 'ids', | |
| 317 | - ) ); | |
| 318 | - | |
| 319 | - $connected_reviews = $connected_reviews->posts; | |
| 320 | - | |
| 321 | -			if ( is_array( $connected_reviews ) && ! empty( $connected_reviews ) ) { | |
| 322 | - $this->page_links['reviews'] = esc_html__( 'Reviews', 'to-team' ); | |
| 323 | - } | |
| 324 | - } | |
| 325 | - } | |
| 326 | - | |
| 327 | - /** | |
| 328 | - * Tests for the Gallery and returns a link for the section | |
| 329 | - */ | |
| 330 | -	public function get_gallery_link() { | |
| 331 | - $gallery_ids = get_post_meta( get_the_ID(), 'gallery', false ); | |
| 332 | - $envira_gallery = get_post_meta( get_the_ID(), 'envira_gallery', true ); | |
| 333 | - | |
| 334 | -		if ( ( ! empty( $gallery_ids ) && is_array( $gallery_ids ) ) || ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) ) { | |
| 335 | -			if ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) { | |
| 336 | - // Envira Gallery. | |
| 337 | - $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-team' ); | |
| 338 | - return; | |
| 339 | -			} else { | |
| 340 | -				if ( function_exists( 'envira_dynamic' ) ) { | |
| 341 | - // Envira Gallery - Dynamic. | |
| 342 | - $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-team' ); | |
| 343 | - return; | |
| 344 | -				} else { | |
| 345 | - // WordPress Gallery. | |
| 346 | - $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-team' ); | |
| 347 | - return; | |
| 348 | - } | |
| 349 | - } | |
| 350 | - } | |
| 351 | - } | |
| 352 | - | |
| 353 | - /** | |
| 354 | - * Tests for the Videos and returns a link for the section | |
| 355 | - */ | |
| 356 | -	public function get_videos_link() { | |
| 357 | - $videos_id = false; | |
| 358 | - | |
| 359 | -		if ( class_exists( 'Envira_Videos' ) ) { | |
| 360 | - $videos_id = get_post_meta( get_the_ID(), 'envira_video', true ); | |
| 361 | - } | |
| 362 | - | |
| 363 | -		if ( empty( $videos_id ) && function_exists( 'lsx_to_videos' ) ) { | |
| 364 | - $videos_id = get_post_meta( get_the_ID(), 'videos', true ); | |
| 365 | - } | |
| 366 | - | |
| 367 | -		if ( ! empty( $videos_id ) ) { | |
| 368 | - $this->page_links['videos'] = esc_html__( 'Videos', 'to-team' ); | |
| 369 | - } | |
| 370 | - } | |
| 371 | - | |
| 372 | - /** | |
| 373 | - * Adds the template tags to the top of the archive team | |
| 374 | - */ | |
| 375 | -	public function archive_entry_top() { | |
| 376 | - global $lsx_to_archive; | |
| 377 | - | |
| 378 | -		if ( 'team' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { | |
| 379 | - ?> | |
| 117 | + $new_orderby .= ( 'ASC' == strtoupper( $query->get( 'order' ) ) ) ? 'ASC' : 'DESC'; | |
| 118 | + $orderby = $new_orderby . ', ' . $orderby; | |
| 119 | + } | |
| 120 | + } | |
| 121 | + | |
| 122 | + return $orderby; | |
| 123 | + } | |
| 124 | + | |
| 125 | + /** | |
| 126 | + * A filter to set the content area to a small column on single | |
| 127 | + */ | |
| 128 | +     public function archive_class( $new_classes, $classes, $layout ) { | |
| 129 | +          if ( is_post_type_archive( 'team' ) ) { | |
| 130 | + $new_classes = $classes; | |
| 131 | + | |
| 132 | +               if ( 'grid' === $layout ) { | |
| 133 | + $new_classes[] = 'col-xs-12 col-sm-6 col-md-3'; | |
| 134 | +               } else { | |
| 135 | + $new_classes[] = 'col-xs-12'; | |
| 136 | + } | |
| 137 | + } | |
| 138 | + | |
| 139 | + return $new_classes; | |
| 140 | + } | |
| 141 | + | |
| 142 | + /** | |
| 143 | + * A filter to set the content area to a small column on single | |
| 144 | + */ | |
| 145 | +     public function entry_class( $classes ) { | |
| 146 | + global $lsx_to_archive; | |
| 147 | + | |
| 148 | +          if ( 1 !== $lsx_to_archive ) { | |
| 149 | + $lsx_to_archive = false; | |
| 150 | + } | |
| 151 | + | |
| 152 | +          if ( is_main_query() && is_singular( 'team' ) && false === $lsx_to_archive ) { | |
| 153 | +               if ( lsx_to_has_enquiry_contact() ) { | |
| 154 | + $classes[] = 'col-xs-12 col-sm-7 col-md-8'; | |
| 155 | +               } else { | |
| 156 | + $classes[] = 'col-xs-12'; | |
| 157 | + } | |
| 158 | + } | |
| 159 | + | |
| 160 | + return $classes; | |
| 161 | + } | |
| 162 | + | |
| 163 | + /** | |
| 164 | + * Sets the current tab selected. | |
| 165 | + */ | |
| 166 | +     public function set_settings_current_tab( $settings_tab ) { | |
| 167 | +          if ( is_tax( 'role' ) ) { | |
| 168 | + $taxonomy = get_query_var( 'taxonomy' ); | |
| 169 | + | |
| 170 | +               if ( 'role' === $taxonomy ) { | |
| 171 | + $settings_tab = 'team'; | |
| 172 | + } | |
| 173 | + } | |
| 174 | + | |
| 175 | + return $settings_tab; | |
| 176 | + } | |
| 177 | + | |
| 178 | + /** | |
| 179 | + * Adds our navigation links to the team single post | |
| 180 | + * | |
| 181 | + * @param $page_links array | |
| 182 | + * @return $page_links array | |
| 183 | + */ | |
| 184 | +     public function page_links( $page_links ) { | |
| 185 | +          if ( is_singular( 'team' ) ) { | |
| 186 | + $this->page_links = $page_links; | |
| 187 | + | |
| 188 | + $this->get_map_link(); | |
| 189 | + | |
| 190 | + $this->get_related_posts_link(); | |
| 191 | + $this->get_related_accommodation_link(); | |
| 192 | + $this->get_related_destination_link(); | |
| 193 | + $this->get_related_tours_link(); | |
| 194 | + $this->get_related_reviews_link(); | |
| 195 | + | |
| 196 | + $this->get_gallery_link(); | |
| 197 | + $this->get_videos_link(); | |
| 198 | + | |
| 199 | + $page_links = $this->page_links; | |
| 200 | + } | |
| 201 | + | |
| 202 | + return $page_links; | |
| 203 | + } | |
| 204 | + | |
| 205 | + /** | |
| 206 | + * Tests for the Related Posts and returns a link for the section | |
| 207 | + */ | |
| 208 | +     public function get_related_posts_link() { | |
| 209 | + $site_user = get_post_meta( get_the_ID(), 'site_user', true ); | |
| 210 | + | |
| 211 | +          if ( ! empty( $site_user ) ) { | |
| 212 | +               if ( is_user_member_of_blog( $site_user ) ) { | |
| 213 | + $user_posts = count_user_posts( $site_user, 'post' ); | |
| 214 | + | |
| 215 | +                    if ( $user_posts > 0 ) { | |
| 216 | + $this->page_links['posts'] = esc_html__( 'Posts', 'to-team' ); | |
| 217 | + } | |
| 218 | + } | |
| 219 | + } | |
| 220 | + } | |
| 221 | + | |
| 222 | + /** | |
| 223 | + * Tests for the Google Map and returns a link for the section | |
| 224 | + */ | |
| 225 | +     public function get_map_link() { | |
| 226 | +          if ( function_exists( 'lsx_to_has_map' ) && lsx_to_has_map() ) { | |
| 227 | + $this->page_links['team-map'] = esc_html__( 'Map', 'tour-operator' ); | |
| 228 | + } | |
| 229 | + } | |
| 230 | + | |
| 231 | + /** | |
| 232 | + * Tests for the Related Accommodation and returns a link for the section | |
| 233 | + */ | |
| 234 | +     public function get_related_accommodation_link() { | |
| 235 | + $connected_accommodation = get_post_meta( get_the_ID(), 'accommodation_to_team', false ); | |
| 236 | + | |
| 237 | +          if ( post_type_exists( 'accommodation' ) && is_array( $connected_accommodation ) && ! empty( $connected_accommodation ) ) { | |
| 238 | + $connected_accommodation = new \WP_Query( array( | |
| 239 | + 'post_type' => 'accommodation', | |
| 240 | + 'post__in' => $connected_accommodation, | |
| 241 | + 'post_status' => 'publish', | |
| 242 | + 'nopagin' => true, | |
| 243 | + 'posts_per_page' => '-1', | |
| 244 | + 'fields' => 'ids', | |
| 245 | + ) ); | |
| 246 | + | |
| 247 | + $connected_accommodation = $connected_accommodation->posts; | |
| 248 | + | |
| 249 | +               if ( is_array( $connected_accommodation ) && ! empty( $connected_accommodation ) ) { | |
| 250 | + $this->page_links['accommodation'] = esc_html__( 'Accommodation', 'to-team' ); | |
| 251 | + } | |
| 252 | + } | |
| 253 | + } | |
| 254 | + | |
| 255 | + /** | |
| 256 | + * Tests for the Related Destinations and returns a link for the section | |
| 257 | + */ | |
| 258 | +     public function get_related_destination_link() { | |
| 259 | + $connected_destination = get_post_meta( get_the_ID(), 'destination_to_team', false ); | |
| 260 | + | |
| 261 | +          if ( post_type_exists( 'destination' ) && is_array( $connected_destination ) && ! empty( $connected_destination ) ) { | |
| 262 | + $connected_destination = new \WP_Query( array( | |
| 263 | + 'post_type' => 'destination', | |
| 264 | + 'post__in' => $connected_destination, | |
| 265 | + 'post_status' => 'publish', | |
| 266 | + 'nopagin' => true, | |
| 267 | + 'posts_per_page' => '-1', | |
| 268 | + 'fields' => 'ids', | |
| 269 | + ) ); | |
| 270 | + | |
| 271 | + $connected_destination = $connected_destination->posts; | |
| 272 | + | |
| 273 | +               if ( is_array( $connected_destination ) && ! empty( $connected_destination ) ) { | |
| 274 | + $this->page_links['destination'] = esc_html__( 'Destinations', 'to-team' ); | |
| 275 | + } | |
| 276 | + } | |
| 277 | + } | |
| 278 | + | |
| 279 | + /** | |
| 280 | + * Tests for the Related Tours and returns a link for the section | |
| 281 | + */ | |
| 282 | +     public function get_related_tours_link() { | |
| 283 | + $connected_tours = get_post_meta( get_the_ID(), 'tour_to_team', false ); | |
| 284 | + | |
| 285 | +          if ( post_type_exists( 'tour' ) && is_array( $connected_tours ) && ! empty( $connected_tours ) ) { | |
| 286 | + $connected_tours = new \WP_Query( array( | |
| 287 | + 'post_type' => 'tour', | |
| 288 | + 'post__in' => $connected_tours, | |
| 289 | + 'post_status' => 'publish', | |
| 290 | + 'nopagin' => true, | |
| 291 | + 'posts_per_page' => '-1', | |
| 292 | + 'fields' => 'ids', | |
| 293 | + ) ); | |
| 294 | + | |
| 295 | + $connected_tours = $connected_tours->posts; | |
| 296 | + | |
| 297 | +               if ( is_array( $connected_tours ) && ! empty( $connected_tours ) ) { | |
| 298 | + $this->page_links['tours'] = esc_html__( 'Tours', 'to-team' ); | |
| 299 | + } | |
| 300 | + } | |
| 301 | + } | |
| 302 | + | |
| 303 | + /** | |
| 304 | + * Tests for the Related Tours and returns a link for the section | |
| 305 | + */ | |
| 306 | +     public function get_related_reviews_link() { | |
| 307 | + $connected_reviews = get_post_meta( get_the_ID(), 'review_to_team', false ); | |
| 308 | + | |
| 309 | +          if ( post_type_exists( 'review' ) && is_array( $connected_reviews ) && ! empty( $connected_reviews ) ) { | |
| 310 | + $connected_reviews = new \WP_Query( array( | |
| 311 | + 'post_type' => 'review', | |
| 312 | + 'post__in' => $connected_reviews, | |
| 313 | + 'post_status' => 'publish', | |
| 314 | + 'nopagin' => true, | |
| 315 | + 'posts_per_page' => '-1', | |
| 316 | + 'fields' => 'ids', | |
| 317 | + ) ); | |
| 318 | + | |
| 319 | + $connected_reviews = $connected_reviews->posts; | |
| 320 | + | |
| 321 | +               if ( is_array( $connected_reviews ) && ! empty( $connected_reviews ) ) { | |
| 322 | + $this->page_links['reviews'] = esc_html__( 'Reviews', 'to-team' ); | |
| 323 | + } | |
| 324 | + } | |
| 325 | + } | |
| 326 | + | |
| 327 | + /** | |
| 328 | + * Tests for the Gallery and returns a link for the section | |
| 329 | + */ | |
| 330 | +     public function get_gallery_link() { | |
| 331 | + $gallery_ids = get_post_meta( get_the_ID(), 'gallery', false ); | |
| 332 | + $envira_gallery = get_post_meta( get_the_ID(), 'envira_gallery', true ); | |
| 333 | + | |
| 334 | +          if ( ( ! empty( $gallery_ids ) && is_array( $gallery_ids ) ) || ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) ) { | |
| 335 | +               if ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) { | |
| 336 | + // Envira Gallery. | |
| 337 | + $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-team' ); | |
| 338 | + return; | |
| 339 | +               } else { | |
| 340 | +                    if ( function_exists( 'envira_dynamic' ) ) { | |
| 341 | + // Envira Gallery - Dynamic. | |
| 342 | + $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-team' ); | |
| 343 | + return; | |
| 344 | +                    } else { | |
| 345 | + // WordPress Gallery. | |
| 346 | + $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-team' ); | |
| 347 | + return; | |
| 348 | + } | |
| 349 | + } | |
| 350 | + } | |
| 351 | + } | |
| 352 | + | |
| 353 | + /** | |
| 354 | + * Tests for the Videos and returns a link for the section | |
| 355 | + */ | |
| 356 | +     public function get_videos_link() { | |
| 357 | + $videos_id = false; | |
| 358 | + | |
| 359 | +          if ( class_exists( 'Envira_Videos' ) ) { | |
| 360 | + $videos_id = get_post_meta( get_the_ID(), 'envira_video', true ); | |
| 361 | + } | |
| 362 | + | |
| 363 | +          if ( empty( $videos_id ) && function_exists( 'lsx_to_videos' ) ) { | |
| 364 | + $videos_id = get_post_meta( get_the_ID(), 'videos', true ); | |
| 365 | + } | |
| 366 | + | |
| 367 | +          if ( ! empty( $videos_id ) ) { | |
| 368 | + $this->page_links['videos'] = esc_html__( 'Videos', 'to-team' ); | |
| 369 | + } | |
| 370 | + } | |
| 371 | + | |
| 372 | + /** | |
| 373 | + * Adds the template tags to the top of the archive team | |
| 374 | + */ | |
| 375 | +     public function archive_entry_top() { | |
| 376 | + global $lsx_to_archive; | |
| 377 | + | |
| 378 | +          if ( 'team' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { | |
| 379 | + ?> | |
| 380 | 380 |  			<?php if ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?> | 
| 381 | 381 | <div class="lsx-to-archive-meta-data lsx-to-archive-meta-data-grid-mode"> | 
| 382 | 382 | <?php | 
| 383 | - $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; | |
| 384 | - | |
| 385 | - lsx_to_team_role( '<span class="' . $meta_class . 'role"><span class="lsx-to-meta-data-key">' . __( 'Role', 'to-team' ) . ':</span> ', '</span>' ); | |
| 386 | - lsx_to_team_contact_number( '<span class="' . $meta_class . 'phone">', '</span>' ); | |
| 387 | - lsx_to_team_contact_email( '<span class="' . $meta_class . 'email">', '</span>' ); | |
| 388 | - lsx_to_team_contact_skype( '<span class="' . $meta_class . 'skype">', '</span>' ); | |
| 389 | - lsx_to_team_social_profiles( '<div class="' . $meta_class . 'socials">', '</div>' ); | |
| 390 | - ?> | |
| 383 | + $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; | |
| 384 | + | |
| 385 | + lsx_to_team_role( '<span class="' . $meta_class . 'role"><span class="lsx-to-meta-data-key">' . __( 'Role', 'to-team' ) . ':</span> ', '</span>' ); | |
| 386 | + lsx_to_team_contact_number( '<span class="' . $meta_class . 'phone">', '</span>' ); | |
| 387 | + lsx_to_team_contact_email( '<span class="' . $meta_class . 'email">', '</span>' ); | |
| 388 | + lsx_to_team_contact_skype( '<span class="' . $meta_class . 'skype">', '</span>' ); | |
| 389 | + lsx_to_team_social_profiles( '<div class="' . $meta_class . 'socials">', '</div>' ); | |
| 390 | + ?> | |
| 391 | 391 | </div> | 
| 392 | 392 | <?php } ?> | 
| 393 | 393 | <?php | 
| 394 | - } | |
| 395 | - } | |
| 394 | + } | |
| 395 | + } | |
| 396 | 396 | |
| 397 | - /** | |
| 398 | - * Adds the template tags to the bottom of the archive team | |
| 399 | - */ | |
| 400 | -	public function archive_entry_bottom() { | |
| 401 | - global $lsx_to_archive; | |
| 397 | + /** | |
| 398 | + * Adds the template tags to the bottom of the archive team | |
| 399 | + */ | |
| 400 | +     public function archive_entry_bottom() { | |
| 401 | + global $lsx_to_archive; | |
| 402 | 402 | |
| 403 | -		if ( 'team' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { | |
| 404 | - ?> | |
| 403 | +          if ( 'team' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { | |
| 404 | + ?> | |
| 405 | 405 | </div> | 
| 406 | 406 | |
| 407 | 407 |  				<?php if ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?> | 
| 408 | 408 | <div class="lsx-to-archive-meta-data lsx-to-archive-meta-data-list-mode"> | 
| 409 | 409 | <?php | 
| 410 | - $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; | |
| 411 | - | |
| 412 | - lsx_to_team_role( '<span class="' . $meta_class . 'role"><span class="lsx-to-meta-data-key">' . __( 'Role', 'to-team' ) . ':</span> ', '</span>' ); | |
| 413 | - lsx_to_team_contact_number( '<span class="' . $meta_class . 'phone">', '</span>' ); | |
| 414 | - lsx_to_team_contact_email( '<span class="' . $meta_class . 'email">', '</span>' ); | |
| 415 | - lsx_to_team_contact_skype( '<span class="' . $meta_class . 'skype">', '</span>' ); | |
| 416 | - lsx_to_team_social_profiles( '<div class="' . $meta_class . 'socials">', '</div>' ); | |
| 417 | - ?> | |
| 410 | + $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; | |
| 411 | + | |
| 412 | + lsx_to_team_role( '<span class="' . $meta_class . 'role"><span class="lsx-to-meta-data-key">' . __( 'Role', 'to-team' ) . ':</span> ', '</span>' ); | |
| 413 | + lsx_to_team_contact_number( '<span class="' . $meta_class . 'phone">', '</span>' ); | |
| 414 | + lsx_to_team_contact_email( '<span class="' . $meta_class . 'email">', '</span>' ); | |
| 415 | + lsx_to_team_contact_skype( '<span class="' . $meta_class . 'skype">', '</span>' ); | |
| 416 | + lsx_to_team_social_profiles( '<div class="' . $meta_class . 'socials">', '</div>' ); | |
| 417 | + ?> | |
| 418 | 418 | </div> | 
| 419 | 419 | <?php } ?> | 
| 420 | 420 | |
| 421 | 421 | <?php | 
| 422 | - $member_name = get_the_title(); | |
| 423 | - $has_single = ! lsx_to_is_single_disabled(); | |
| 424 | - ?> | |
| 422 | + $member_name = get_the_title(); | |
| 423 | + $has_single = ! lsx_to_is_single_disabled(); | |
| 424 | + ?> | |
| 425 | 425 | |
| 426 | 426 | <?php if ( $has_single && 'grid' === tour_operator()->archive_layout ) : ?> | 
| 427 | 427 | <p class="text-center lsx-to-single-link"><a href="<?php the_permalink(); ?>"><?php echo esc_html__( 'More about', 'to-team' ) . ' ' . esc_html( strtok( $member_name, ' ' ) ); ?> <i class="fa fa-angle-right" aria-hidden="true"></i></a></p> | 
| 428 | 428 | <?php endif; ?> | 
| 429 | 429 | </div> | 
| 430 | 430 | <?php | 
| 431 | - } | |
| 432 | - } | |
| 433 | - | |
| 434 | - /** | |
| 435 | - * Adds the template tags to the bottom of the single team | |
| 436 | - */ | |
| 437 | -	public function single_content_bottom() { | |
| 438 | -		if ( is_singular( 'team' ) ) { | |
| 439 | - if ( function_exists( 'lsx_to_has_map' ) && lsx_to_has_map() ) : | |
| 440 | - global $post; | |
| 441 | - $map_title = $post->post_title; | |
| 442 | - $map_title = $map_title . __( "'s favourite places", 'to-team' ); | |
| 443 | - ?> | |
| 431 | + } | |
| 432 | + } | |
| 433 | + | |
| 434 | + /** | |
| 435 | + * Adds the template tags to the bottom of the single team | |
| 436 | + */ | |
| 437 | +     public function single_content_bottom() { | |
| 438 | +          if ( is_singular( 'team' ) ) { | |
| 439 | + if ( function_exists( 'lsx_to_has_map' ) && lsx_to_has_map() ) : | |
| 440 | + global $post; | |
| 441 | + $map_title = $post->post_title; | |
| 442 | + $map_title = $map_title . __( "'s favourite places", 'to-team' ); | |
| 443 | + ?> | |
| 444 | 444 | <section id="team-map" class="lsx-to-section lsx-to-collapse-section"> | 
| 445 | 445 | <h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-team-map"><?php echo esc_html( $map_title ); ?></h2> | 
| 446 | 446 | |
| @@ -451,58 +451,58 @@ discard block | ||
| 451 | 451 | </div> | 
| 452 | 452 | </section> | 
| 453 | 453 | <?php | 
| 454 | - endif; | |
| 455 | - | |
| 456 | - lsx_to_team_posts(); | |
| 457 | - | |
| 458 | - lsx_to_team_accommodation(); | |
| 459 | - | |
| 460 | - lsx_to_team_destination(); | |
| 461 | - | |
| 462 | - lsx_to_team_tours(); | |
| 463 | - | |
| 464 | - lsx_to_team_reviews(); | |
| 465 | - | |
| 466 | - lsx_to_gallery( '<section id="gallery" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-gallery">' . esc_html__( 'Gallery', 'to-team' ) . '</h2><div id="collapse-gallery" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); | |
| 467 | - | |
| 468 | -			if ( function_exists( 'lsx_to_videos' ) ) { | |
| 469 | - lsx_to_videos( '<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__( 'Videos', 'to-team' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); | |
| 470 | -			} elseif ( class_exists( 'Envira_Videos' ) ) { | |
| 471 | - lsx_to_envira_videos( '<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__( 'Videos', 'to-team' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); | |
| 472 | - } | |
| 473 | - } | |
| 474 | - } | |
| 475 | - | |
| 476 | -	public function lsx_to_maps_args( $args, $post_id ) { | |
| 477 | -		if ( is_singular( 'team' ) ) { | |
| 478 | - $accommodation_connected = get_post_meta( get_the_ID(), 'accommodation_to_team' ); | |
| 479 | -			if ( is_array( $accommodation_connected ) && ! empty( $accommodation_connected ) ) { | |
| 480 | - $args = array( | |
| 481 | - 'lat' => true, | |
| 482 | - 'long' => true, | |
| 483 | - 'connections' => $accommodation_connected, | |
| 484 | - 'content' => 'excerpt', | |
| 485 | - 'type' => 'cluster', | |
| 486 | - 'width' => '100%', | |
| 487 | - 'height' => '500px', | |
| 488 | - ); | |
| 489 | - } | |
| 490 | - } | |
| 491 | - return $args; | |
| 492 | - } | |
| 493 | - | |
| 494 | -	public function lsx_to_has_maps_location( $location, $id ) { | |
| 495 | -		if ( is_singular( 'team' ) ) { | |
| 496 | - $accommodation_connected = get_post_meta( $id, 'accommodation_to_team' ); | |
| 497 | -			if ( is_array( $accommodation_connected ) && ! empty( $accommodation_connected ) ) { | |
| 498 | - $location = array( | |
| 499 | - 'lat' => true, | |
| 500 | - 'connections' => $accommodation_connected, | |
| 501 | - ); | |
| 502 | - } | |
| 503 | - } | |
| 504 | - return $location; | |
| 505 | - } | |
| 454 | + endif; | |
| 455 | + | |
| 456 | + lsx_to_team_posts(); | |
| 457 | + | |
| 458 | + lsx_to_team_accommodation(); | |
| 459 | + | |
| 460 | + lsx_to_team_destination(); | |
| 461 | + | |
| 462 | + lsx_to_team_tours(); | |
| 463 | + | |
| 464 | + lsx_to_team_reviews(); | |
| 465 | + | |
| 466 | + lsx_to_gallery( '<section id="gallery" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-gallery">' . esc_html__( 'Gallery', 'to-team' ) . '</h2><div id="collapse-gallery" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); | |
| 467 | + | |
| 468 | +               if ( function_exists( 'lsx_to_videos' ) ) { | |
| 469 | + lsx_to_videos( '<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__( 'Videos', 'to-team' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); | |
| 470 | +               } elseif ( class_exists( 'Envira_Videos' ) ) { | |
| 471 | + lsx_to_envira_videos( '<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__( 'Videos', 'to-team' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); | |
| 472 | + } | |
| 473 | + } | |
| 474 | + } | |
| 475 | + | |
| 476 | +     public function lsx_to_maps_args( $args, $post_id ) { | |
| 477 | +          if ( is_singular( 'team' ) ) { | |
| 478 | + $accommodation_connected = get_post_meta( get_the_ID(), 'accommodation_to_team' ); | |
| 479 | +               if ( is_array( $accommodation_connected ) && ! empty( $accommodation_connected ) ) { | |
| 480 | + $args = array( | |
| 481 | + 'lat' => true, | |
| 482 | + 'long' => true, | |
| 483 | + 'connections' => $accommodation_connected, | |
| 484 | + 'content' => 'excerpt', | |
| 485 | + 'type' => 'cluster', | |
| 486 | + 'width' => '100%', | |
| 487 | + 'height' => '500px', | |
| 488 | + ); | |
| 489 | + } | |
| 490 | + } | |
| 491 | + return $args; | |
| 492 | + } | |
| 493 | + | |
| 494 | +     public function lsx_to_has_maps_location( $location, $id ) { | |
| 495 | +          if ( is_singular( 'team' ) ) { | |
| 496 | + $accommodation_connected = get_post_meta( $id, 'accommodation_to_team' ); | |
| 497 | +               if ( is_array( $accommodation_connected ) && ! empty( $accommodation_connected ) ) { | |
| 498 | + $location = array( | |
| 499 | + 'lat' => true, | |
| 500 | + 'connections' => $accommodation_connected, | |
| 501 | + ); | |
| 502 | + } | |
| 503 | + } | |
| 504 | + return $location; | |
| 505 | + } | |
| 506 | 506 | } | 
| 507 | 507 | |
| 508 | 508 | global $lsx_to_team_frontend; | 
| @@ -9,7 +9,7 @@ discard block | ||
| 9 | 9 |   * @copyright {year} LightSpeedDevelopment | 
| 10 | 10 | */ | 
| 11 | 11 | |
| 12 | -if ( ! class_exists( 'LSX_TO_Team' ) ) { | |
| 12 | +if ( ! class_exists('LSX_TO_Team')) { | |
| 13 | 13 | |
| 14 | 14 | /** | 
| 15 | 15 | * Main plugin class. | 
| @@ -63,19 +63,19 @@ discard block | ||
| 63 | 63 | $this->lsx_to_search_integration(); | 
| 64 | 64 | |
| 65 | 65 | // Make TO last plugin to load. | 
| 66 | - add_action( 'activated_plugin', array( $this, 'activated_plugin' ) ); | |
| 66 | +			add_action('activated_plugin', array($this, 'activated_plugin')); | |
| 67 | 67 | |
| 68 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); | |
| 68 | +			add_action('init', array($this, 'load_plugin_textdomain')); | |
| 69 | 69 | |
| 70 | -			if ( false !== $this->post_types ) { | |
| 71 | - add_filter( 'lsx_to_framework_post_types', array( $this, 'post_types_filter' ) ); | |
| 72 | - add_filter( 'lsx_to_post_types', array( $this, 'post_types_filter' ) ); | |
| 73 | - add_filter( 'lsx_to_post_types_singular', array( $this, 'post_types_singular_filter' ) ); | |
| 74 | - add_filter( 'lsx_to_settings_path', array( $this, 'plugin_path' ), 10, 2 ); | |
| 70 | +			if (false !== $this->post_types) { | |
| 71 | +				add_filter('lsx_to_framework_post_types', array($this, 'post_types_filter')); | |
| 72 | +				add_filter('lsx_to_post_types', array($this, 'post_types_filter')); | |
| 73 | +				add_filter('lsx_to_post_types_singular', array($this, 'post_types_singular_filter')); | |
| 74 | +				add_filter('lsx_to_settings_path', array($this, 'plugin_path'), 10, 2); | |
| 75 | 75 | } | 
| 76 | -			if ( false !== $this->taxonomies ) { | |
| 77 | - add_filter( 'lsx_to_framework_taxonomies', array( $this, 'taxonomies_filter' ) ); | |
| 78 | - add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'taxonomies_plural_filter' ) ); | |
| 76 | +			if (false !== $this->taxonomies) { | |
| 77 | +				add_filter('lsx_to_framework_taxonomies', array($this, 'taxonomies_filter')); | |
| 78 | +				add_filter('lsx_to_framework_taxonomies_plural', array($this, 'taxonomies_plural_filter')); | |
| 79 | 79 | } | 
| 80 | 80 | |
| 81 | 81 | require_once LSX_TO_TEAM_PATH . '/classes/class-lsx-to-team-admin.php'; | 
| @@ -83,24 +83,24 @@ discard block | ||
| 83 | 83 | require_once LSX_TO_TEAM_PATH . '/includes/template-tags.php'; | 
| 84 | 84 | |
| 85 | 85 | // flush_rewrite_rules. | 
| 86 | - register_activation_hook( LSX_TO_TEAM_CORE, array( $this, 'register_activation_hook' ) ); | |
| 87 | - add_action( 'admin_init', array( $this, 'register_activation_hook_check' ) ); | |
| 88 | - add_filter( 'wpseo_schema_graph_pieces', array( $this, 'add_graph_pieces' ), 11, 2 ); | |
| 86 | + register_activation_hook(LSX_TO_TEAM_CORE, array($this, 'register_activation_hook')); | |
| 87 | +			add_action('admin_init', array($this, 'register_activation_hook_check')); | |
| 88 | +			add_filter('wpseo_schema_graph_pieces', array($this, 'add_graph_pieces'), 11, 2); | |
| 89 | 89 | } | 
| 90 | 90 | |
| 91 | 91 | /** | 
| 92 | 92 | * Include the post type for the search integration | 
| 93 | 93 | */ | 
| 94 | 94 |  		public function lsx_to_search_integration() { | 
| 95 | - add_filter( 'lsx_to_search_post_types', array( $this, 'post_types_filter' ) ); | |
| 96 | - add_filter( 'lsx_to_search_taxonomies', array( $this, 'taxonomies_filter' ) ); | |
| 95 | +			add_filter('lsx_to_search_post_types', array($this, 'post_types_filter')); | |
| 96 | +			add_filter('lsx_to_search_taxonomies', array($this, 'taxonomies_filter')); | |
| 97 | 97 | } | 
| 98 | 98 | |
| 99 | 99 | /** | 
| 100 | 100 | * Load the plugin text domain for translation. | 
| 101 | 101 | */ | 
| 102 | 102 |  		public function load_plugin_textdomain() { | 
| 103 | - load_plugin_textdomain( 'to-team', false, basename( LSX_TO_TEAM_PATH ) . '/languages' ); | |
| 103 | +			load_plugin_textdomain('to-team', false, basename(LSX_TO_TEAM_PATH) . '/languages'); | |
| 104 | 104 | } | 
| 105 | 105 | |
| 106 | 106 | /** | 
| @@ -108,18 +108,18 @@ discard block | ||
| 108 | 108 | */ | 
| 109 | 109 |  		public function set_vars() { | 
| 110 | 110 | $this->post_types = array( | 
| 111 | - 'team' => __( 'Team', 'to-team' ), | |
| 111 | +				'team' => __('Team', 'to-team'), | |
| 112 | 112 | ); | 
| 113 | 113 | |
| 114 | 114 | $this->post_types_singular = array( | 
| 115 | - 'team' => __( 'Team Member', 'to-team' ), | |
| 115 | +				'team' => __('Team Member', 'to-team'), | |
| 116 | 116 | ); | 
| 117 | 117 | |
| 118 | - $this->post_type_slugs = array_keys( $this->post_types ); | |
| 118 | + $this->post_type_slugs = array_keys($this->post_types); | |
| 119 | 119 | |
| 120 | 120 | $users = get_users(); | 
| 121 | 121 | |
| 122 | -			foreach ( $users as $user ) { | |
| 122 | +			foreach ($users as $user) { | |
| 123 | 123 | $this->site_users[] = array( | 
| 124 | 124 | 'name' => $user->display_name, | 
| 125 | 125 | 'value' => $user->ID, | 
| @@ -130,8 +130,8 @@ discard block | ||
| 130 | 130 | /** | 
| 131 | 131 | * Adds our post types to an array via a filter | 
| 132 | 132 | */ | 
| 133 | -		public function plugin_path( $path, $post_type ) { | |
| 134 | -			if ( false !== $this->post_types && array_key_exists( $post_type, $this->post_types ) ) { | |
| 133 | +		public function plugin_path($path, $post_type) { | |
| 134 | +			if (false !== $this->post_types && array_key_exists($post_type, $this->post_types)) { | |
| 135 | 135 | $path = LSX_TO_TEAM_PATH; | 
| 136 | 136 | } | 
| 137 | 137 | |
| @@ -141,9 +141,9 @@ discard block | ||
| 141 | 141 | /** | 
| 142 | 142 | * Adds our post types to an array via a filter | 
| 143 | 143 | */ | 
| 144 | -		public function post_types_slugs_filter( $post_types ) { | |
| 145 | -			if ( is_array( $post_types ) ) { | |
| 146 | - $post_types = array_merge( $post_types, $this->post_type_slugs ); | |
| 144 | +		public function post_types_slugs_filter($post_types) { | |
| 145 | +			if (is_array($post_types)) { | |
| 146 | + $post_types = array_merge($post_types, $this->post_type_slugs); | |
| 147 | 147 |  			} else { | 
| 148 | 148 | $post_types = $this->post_type_slugs; | 
| 149 | 149 | } | 
| @@ -154,10 +154,10 @@ discard block | ||
| 154 | 154 | /** | 
| 155 | 155 | * Adds our post types to an array via a filter | 
| 156 | 156 | */ | 
| 157 | -		public function post_types_filter( $post_types ) { | |
| 158 | -			if ( is_array( $post_types ) && is_array( $this->post_types ) ) { | |
| 159 | - $post_types = array_merge( $post_types, $this->post_types ); | |
| 160 | -			} elseif ( is_array( $this->post_types ) ) { | |
| 157 | +		public function post_types_filter($post_types) { | |
| 158 | +			if (is_array($post_types) && is_array($this->post_types)) { | |
| 159 | + $post_types = array_merge($post_types, $this->post_types); | |
| 160 | +			} elseif (is_array($this->post_types)) { | |
| 161 | 161 | $post_types = $this->post_types; | 
| 162 | 162 | } | 
| 163 | 163 | |
| @@ -167,10 +167,10 @@ discard block | ||
| 167 | 167 | /** | 
| 168 | 168 | * Adds our post types to an array via a filter | 
| 169 | 169 | */ | 
| 170 | -		public function post_types_singular_filter( $post_types_singular ) { | |
| 171 | -			if ( is_array( $post_types_singular ) && is_array( $this->post_types_singular ) ) { | |
| 172 | - $post_types_singular = array_merge( $post_types_singular, $this->post_types_singular ); | |
| 173 | -			} elseif ( is_array( $this->post_types_singular ) ) { | |
| 170 | +		public function post_types_singular_filter($post_types_singular) { | |
| 171 | +			if (is_array($post_types_singular) && is_array($this->post_types_singular)) { | |
| 172 | + $post_types_singular = array_merge($post_types_singular, $this->post_types_singular); | |
| 173 | +			} elseif (is_array($this->post_types_singular)) { | |
| 174 | 174 | $post_types_singular = $this->post_types_singular; | 
| 175 | 175 | } | 
| 176 | 176 | |
| @@ -180,10 +180,10 @@ discard block | ||
| 180 | 180 | /** | 
| 181 | 181 | * Adds our taxonomies to an array via a filter | 
| 182 | 182 | */ | 
| 183 | -		public function taxonomies_filter( $taxonomies ) { | |
| 184 | -			if ( is_array( $taxonomies ) && is_array( $this->taxonomies ) ) { | |
| 185 | - $taxonomies = array_merge( $taxonomies, $this->taxonomies ); | |
| 186 | -			} elseif ( is_array( $this->taxonomies ) ) { | |
| 183 | +		public function taxonomies_filter($taxonomies) { | |
| 184 | +			if (is_array($taxonomies) && is_array($this->taxonomies)) { | |
| 185 | + $taxonomies = array_merge($taxonomies, $this->taxonomies); | |
| 186 | +			} elseif (is_array($this->taxonomies)) { | |
| 187 | 187 | $taxonomies = $this->taxonomies; | 
| 188 | 188 | } | 
| 189 | 189 | |
| @@ -193,10 +193,10 @@ discard block | ||
| 193 | 193 | /** | 
| 194 | 194 | * Adds our taxonomies_plural to an array via a filter | 
| 195 | 195 | */ | 
| 196 | -		public function taxonomies_plural_filter( $taxonomies_plural ) { | |
| 197 | -			if ( is_array( $taxonomies_plural ) && is_array( $this->taxonomies_plural ) ) { | |
| 198 | - $taxonomies_plural = array_merge( $taxonomies_plural, $this->taxonomies_plural ); | |
| 199 | -			} elseif ( is_array( $this->taxonomies_plural ) ) { | |
| 196 | +		public function taxonomies_plural_filter($taxonomies_plural) { | |
| 197 | +			if (is_array($taxonomies_plural) && is_array($this->taxonomies_plural)) { | |
| 198 | + $taxonomies_plural = array_merge($taxonomies_plural, $this->taxonomies_plural); | |
| 199 | +			} elseif (is_array($this->taxonomies_plural)) { | |
| 200 | 200 | $taxonomies_plural = $this->taxonomies_plural; | 
| 201 | 201 | } | 
| 202 | 202 | |
| @@ -208,15 +208,15 @@ discard block | ||
| 208 | 208 | */ | 
| 209 | 209 |  		public function activated_plugin() { | 
| 210 | 210 | // @codingStandardsIgnoreLine | 
| 211 | -			if ( $plugins = get_option( 'active_plugins' ) ) { | |
| 212 | - $search = preg_grep( '/.*\/tour-operator\.php/', $plugins ); | |
| 213 | - $key = array_search( $search, $plugins ); | |
| 214 | - | |
| 215 | -				if ( is_array( $search ) && count( $search ) ) { | |
| 216 | -					foreach ( $search as $key => $path ) { | |
| 217 | - array_splice( $plugins, $key, 1 ); | |
| 218 | - array_push( $plugins, $path ); | |
| 219 | - update_option( 'active_plugins', $plugins ); | |
| 211 | +			if ($plugins = get_option('active_plugins')) { | |
| 212 | +				$search = preg_grep('/.*\/tour-operator\.php/', $plugins); | |
| 213 | + $key = array_search($search, $plugins); | |
| 214 | + | |
| 215 | +				if (is_array($search) && count($search)) { | |
| 216 | +					foreach ($search as $key => $path) { | |
| 217 | + array_splice($plugins, $key, 1); | |
| 218 | + array_push($plugins, $path); | |
| 219 | +						update_option('active_plugins', $plugins); | |
| 220 | 220 | } | 
| 221 | 221 | } | 
| 222 | 222 | } | 
| @@ -226,8 +226,8 @@ discard block | ||
| 226 | 226 | * On plugin activation | 
| 227 | 227 | */ | 
| 228 | 228 |  		public function register_activation_hook() { | 
| 229 | -			if ( ! is_network_admin() && ! isset( $_GET['activate-multi'] ) ) { | |
| 230 | - set_transient( '_tour_operators_team_flush_rewrite_rules', 1, 30 ); | |
| 229 | +			if ( ! is_network_admin() && ! isset($_GET['activate-multi'])) { | |
| 230 | +				set_transient('_tour_operators_team_flush_rewrite_rules', 1, 30); | |
| 231 | 231 | } | 
| 232 | 232 | } | 
| 233 | 233 | |
| @@ -235,11 +235,11 @@ discard block | ||
| 235 | 235 | * On plugin activation (check) | 
| 236 | 236 | */ | 
| 237 | 237 |  		public function register_activation_hook_check() { | 
| 238 | -			if ( ! get_transient( '_tour_operators_team_flush_rewrite_rules' ) ) { | |
| 238 | +			if ( ! get_transient('_tour_operators_team_flush_rewrite_rules')) { | |
| 239 | 239 | return; | 
| 240 | 240 | } | 
| 241 | 241 | |
| 242 | - delete_transient( '_tour_operators_team_flush_rewrite_rules' ); | |
| 242 | +			delete_transient('_tour_operators_team_flush_rewrite_rules'); | |
| 243 | 243 | flush_rewrite_rules(); | 
| 244 | 244 | } | 
| 245 | 245 | |
| @@ -251,10 +251,10 @@ discard block | ||
| 251 | 251 | * | 
| 252 | 252 | * @return array $pieces Graph pieces to output. | 
| 253 | 253 | */ | 
| 254 | -		public function add_graph_pieces( $pieces, $context ) { | |
| 255 | -			if ( class_exists( 'LSX_TO_Schema_Graph_Piece' ) ) { | |
| 254 | +		public function add_graph_pieces($pieces, $context) { | |
| 255 | +			if (class_exists('LSX_TO_Schema_Graph_Piece')) { | |
| 256 | 256 | require_once LSX_TO_TEAM_PATH . 'classes/class-lsx-to-team-schema.php'; | 
| 257 | - $pieces[] = new LSX_TO_Team_Schema( $context ); | |
| 257 | + $pieces[] = new LSX_TO_Team_Schema($context); | |
| 258 | 258 | } | 
| 259 | 259 | return $pieces; | 
| 260 | 260 | } | 
| @@ -11,256 +11,256 @@ | ||
| 11 | 11 | |
| 12 | 12 |  if ( ! class_exists( 'LSX_TO_Team' ) ) { | 
| 13 | 13 | |
| 14 | - /** | |
| 15 | - * Main plugin class. | |
| 16 | - * | |
| 17 | - * @package LSX_TO_Team | |
| 18 | - * @author LightSpeed | |
| 19 | - */ | |
| 20 | -	class LSX_TO_Team { | |
| 21 | - | |
| 22 | - /** | |
| 23 | - * The plugins id | |
| 24 | - */ | |
| 25 | - public $plugin_slug = 'to-team'; | |
| 26 | - | |
| 27 | - /** | |
| 28 | - * The post types the plugin registers | |
| 29 | - */ | |
| 30 | - public $post_types = false; | |
| 31 | - | |
| 32 | - /** | |
| 33 | - * The singular post types the plugin registers | |
| 34 | - */ | |
| 35 | - public $post_types_singular = false; | |
| 36 | - | |
| 37 | - /** | |
| 38 | - * An array of the post types slugs plugin registers | |
| 39 | - */ | |
| 40 | - public $post_type_slugs = false; | |
| 41 | - | |
| 42 | - /** | |
| 43 | - * The taxonomies the plugin registers | |
| 44 | - */ | |
| 45 | - public $taxonomies = false; | |
| 46 | - | |
| 47 | - /** | |
| 48 | - * The taxonomies the plugin registers (plural) | |
| 49 | - */ | |
| 50 | - public $taxonomies_plural = false; | |
| 51 | - | |
| 52 | - /** | |
| 53 | - * Site users | |
| 54 | - */ | |
| 55 | - public $site_users = array(); | |
| 56 | - | |
| 57 | - /** | |
| 58 | - * Constructor | |
| 59 | - */ | |
| 60 | -		public function __construct() { | |
| 61 | - // Set the variables. | |
| 62 | - $this->set_vars(); | |
| 63 | - $this->lsx_to_search_integration(); | |
| 64 | - | |
| 65 | - // Make TO last plugin to load. | |
| 66 | - add_action( 'activated_plugin', array( $this, 'activated_plugin' ) ); | |
| 67 | - | |
| 68 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); | |
| 69 | - | |
| 70 | -			if ( false !== $this->post_types ) { | |
| 71 | - add_filter( 'lsx_to_framework_post_types', array( $this, 'post_types_filter' ) ); | |
| 72 | - add_filter( 'lsx_to_post_types', array( $this, 'post_types_filter' ) ); | |
| 73 | - add_filter( 'lsx_to_post_types_singular', array( $this, 'post_types_singular_filter' ) ); | |
| 74 | - add_filter( 'lsx_to_settings_path', array( $this, 'plugin_path' ), 10, 2 ); | |
| 75 | - } | |
| 76 | -			if ( false !== $this->taxonomies ) { | |
| 77 | - add_filter( 'lsx_to_framework_taxonomies', array( $this, 'taxonomies_filter' ) ); | |
| 78 | - add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'taxonomies_plural_filter' ) ); | |
| 79 | - } | |
| 80 | - | |
| 81 | - require_once LSX_TO_TEAM_PATH . '/classes/class-lsx-to-team-admin.php'; | |
| 82 | - require_once LSX_TO_TEAM_PATH . '/classes/class-lsx-to-team-frontend.php'; | |
| 83 | - require_once LSX_TO_TEAM_PATH . '/includes/template-tags.php'; | |
| 84 | - | |
| 85 | - // flush_rewrite_rules. | |
| 86 | - register_activation_hook( LSX_TO_TEAM_CORE, array( $this, 'register_activation_hook' ) ); | |
| 87 | - add_action( 'admin_init', array( $this, 'register_activation_hook_check' ) ); | |
| 88 | - add_filter( 'wpseo_schema_graph_pieces', array( $this, 'add_graph_pieces' ), 11, 2 ); | |
| 89 | - } | |
| 90 | - | |
| 91 | - /** | |
| 92 | - * Include the post type for the search integration | |
| 93 | - */ | |
| 94 | -		public function lsx_to_search_integration() { | |
| 95 | - add_filter( 'lsx_to_search_post_types', array( $this, 'post_types_filter' ) ); | |
| 96 | - add_filter( 'lsx_to_search_taxonomies', array( $this, 'taxonomies_filter' ) ); | |
| 97 | - } | |
| 98 | - | |
| 99 | - /** | |
| 100 | - * Load the plugin text domain for translation. | |
| 101 | - */ | |
| 102 | -		public function load_plugin_textdomain() { | |
| 103 | - load_plugin_textdomain( 'to-team', false, basename( LSX_TO_TEAM_PATH ) . '/languages' ); | |
| 104 | - } | |
| 105 | - | |
| 106 | - /** | |
| 107 | - * Sets the plugins variables | |
| 108 | - */ | |
| 109 | -		public function set_vars() { | |
| 110 | - $this->post_types = array( | |
| 111 | - 'team' => __( 'Team', 'to-team' ), | |
| 112 | - ); | |
| 113 | - | |
| 114 | - $this->post_types_singular = array( | |
| 115 | - 'team' => __( 'Team Member', 'to-team' ), | |
| 116 | - ); | |
| 117 | - | |
| 118 | - $this->post_type_slugs = array_keys( $this->post_types ); | |
| 119 | - | |
| 120 | - $users = get_users(); | |
| 121 | - | |
| 122 | -			foreach ( $users as $user ) { | |
| 123 | - $this->site_users[] = array( | |
| 124 | - 'name' => $user->display_name, | |
| 125 | - 'value' => $user->ID, | |
| 126 | - ); | |
| 127 | - } | |
| 128 | - } | |
| 129 | - | |
| 130 | - /** | |
| 131 | - * Adds our post types to an array via a filter | |
| 132 | - */ | |
| 133 | -		public function plugin_path( $path, $post_type ) { | |
| 134 | -			if ( false !== $this->post_types && array_key_exists( $post_type, $this->post_types ) ) { | |
| 135 | - $path = LSX_TO_TEAM_PATH; | |
| 136 | - } | |
| 137 | - | |
| 138 | - return $path; | |
| 139 | - } | |
| 140 | - | |
| 141 | - /** | |
| 142 | - * Adds our post types to an array via a filter | |
| 143 | - */ | |
| 144 | -		public function post_types_slugs_filter( $post_types ) { | |
| 145 | -			if ( is_array( $post_types ) ) { | |
| 146 | - $post_types = array_merge( $post_types, $this->post_type_slugs ); | |
| 147 | -			} else { | |
| 148 | - $post_types = $this->post_type_slugs; | |
| 149 | - } | |
| 150 | - | |
| 151 | - return $post_types; | |
| 152 | - } | |
| 153 | - | |
| 154 | - /** | |
| 155 | - * Adds our post types to an array via a filter | |
| 156 | - */ | |
| 157 | -		public function post_types_filter( $post_types ) { | |
| 158 | -			if ( is_array( $post_types ) && is_array( $this->post_types ) ) { | |
| 159 | - $post_types = array_merge( $post_types, $this->post_types ); | |
| 160 | -			} elseif ( is_array( $this->post_types ) ) { | |
| 161 | - $post_types = $this->post_types; | |
| 162 | - } | |
| 163 | - | |
| 164 | - return $post_types; | |
| 165 | - } | |
| 166 | - | |
| 167 | - /** | |
| 168 | - * Adds our post types to an array via a filter | |
| 169 | - */ | |
| 170 | -		public function post_types_singular_filter( $post_types_singular ) { | |
| 171 | -			if ( is_array( $post_types_singular ) && is_array( $this->post_types_singular ) ) { | |
| 172 | - $post_types_singular = array_merge( $post_types_singular, $this->post_types_singular ); | |
| 173 | -			} elseif ( is_array( $this->post_types_singular ) ) { | |
| 174 | - $post_types_singular = $this->post_types_singular; | |
| 175 | - } | |
| 176 | - | |
| 177 | - return $post_types_singular; | |
| 178 | - } | |
| 179 | - | |
| 180 | - /** | |
| 181 | - * Adds our taxonomies to an array via a filter | |
| 182 | - */ | |
| 183 | -		public function taxonomies_filter( $taxonomies ) { | |
| 184 | -			if ( is_array( $taxonomies ) && is_array( $this->taxonomies ) ) { | |
| 185 | - $taxonomies = array_merge( $taxonomies, $this->taxonomies ); | |
| 186 | -			} elseif ( is_array( $this->taxonomies ) ) { | |
| 187 | - $taxonomies = $this->taxonomies; | |
| 188 | - } | |
| 189 | - | |
| 190 | - return $taxonomies; | |
| 191 | - } | |
| 192 | - | |
| 193 | - /** | |
| 194 | - * Adds our taxonomies_plural to an array via a filter | |
| 195 | - */ | |
| 196 | -		public function taxonomies_plural_filter( $taxonomies_plural ) { | |
| 197 | -			if ( is_array( $taxonomies_plural ) && is_array( $this->taxonomies_plural ) ) { | |
| 198 | - $taxonomies_plural = array_merge( $taxonomies_plural, $this->taxonomies_plural ); | |
| 199 | -			} elseif ( is_array( $this->taxonomies_plural ) ) { | |
| 200 | - $taxonomies_plural = $this->taxonomies_plural; | |
| 201 | - } | |
| 202 | - | |
| 203 | - return $taxonomies_plural; | |
| 204 | - } | |
| 205 | - | |
| 206 | - /** | |
| 207 | - * Make TO last plugin to load. | |
| 208 | - */ | |
| 209 | -		public function activated_plugin() { | |
| 210 | - // @codingStandardsIgnoreLine | |
| 211 | -			if ( $plugins = get_option( 'active_plugins' ) ) { | |
| 212 | - $search = preg_grep( '/.*\/tour-operator\.php/', $plugins ); | |
| 213 | - $key = array_search( $search, $plugins ); | |
| 214 | - | |
| 215 | -				if ( is_array( $search ) && count( $search ) ) { | |
| 216 | -					foreach ( $search as $key => $path ) { | |
| 217 | - array_splice( $plugins, $key, 1 ); | |
| 218 | - array_push( $plugins, $path ); | |
| 219 | - update_option( 'active_plugins', $plugins ); | |
| 220 | - } | |
| 221 | - } | |
| 222 | - } | |
| 223 | - } | |
| 224 | - | |
| 225 | - /** | |
| 226 | - * On plugin activation | |
| 227 | - */ | |
| 228 | -		public function register_activation_hook() { | |
| 229 | -			if ( ! is_network_admin() && ! isset( $_GET['activate-multi'] ) ) { | |
| 230 | - set_transient( '_tour_operators_team_flush_rewrite_rules', 1, 30 ); | |
| 231 | - } | |
| 232 | - } | |
| 233 | - | |
| 234 | - /** | |
| 235 | - * On plugin activation (check) | |
| 236 | - */ | |
| 237 | -		public function register_activation_hook_check() { | |
| 238 | -			if ( ! get_transient( '_tour_operators_team_flush_rewrite_rules' ) ) { | |
| 239 | - return; | |
| 240 | - } | |
| 241 | - | |
| 242 | - delete_transient( '_tour_operators_team_flush_rewrite_rules' ); | |
| 243 | - flush_rewrite_rules(); | |
| 244 | - } | |
| 245 | - | |
| 246 | - /** | |
| 247 | - * Adds Schema pieces to our output. | |
| 248 | - * | |
| 249 | - * @param array $pieces Graph pieces to output. | |
| 250 | - * @param \WPSEO_Schema_Context $context Object with context variables. | |
| 251 | - * | |
| 252 | - * @return array $pieces Graph pieces to output. | |
| 253 | - */ | |
| 254 | -		public function add_graph_pieces( $pieces, $context ) { | |
| 255 | -			if ( class_exists( 'LSX_TO_Schema_Graph_Piece' ) ) { | |
| 256 | - require_once LSX_TO_TEAM_PATH . 'classes/class-lsx-to-team-schema.php'; | |
| 257 | - $pieces[] = new LSX_TO_Team_Schema( $context ); | |
| 258 | - } | |
| 259 | - return $pieces; | |
| 260 | - } | |
| 261 | - } | |
| 262 | - | |
| 263 | - global $lsx_to_team; | |
| 264 | - $lsx_to_team = new LSX_TO_Team(); | |
| 14 | + /** | |
| 15 | + * Main plugin class. | |
| 16 | + * | |
| 17 | + * @package LSX_TO_Team | |
| 18 | + * @author LightSpeed | |
| 19 | + */ | |
| 20 | +     class LSX_TO_Team { | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * The plugins id | |
| 24 | + */ | |
| 25 | + public $plugin_slug = 'to-team'; | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * The post types the plugin registers | |
| 29 | + */ | |
| 30 | + public $post_types = false; | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * The singular post types the plugin registers | |
| 34 | + */ | |
| 35 | + public $post_types_singular = false; | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * An array of the post types slugs plugin registers | |
| 39 | + */ | |
| 40 | + public $post_type_slugs = false; | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * The taxonomies the plugin registers | |
| 44 | + */ | |
| 45 | + public $taxonomies = false; | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * The taxonomies the plugin registers (plural) | |
| 49 | + */ | |
| 50 | + public $taxonomies_plural = false; | |
| 51 | + | |
| 52 | + /** | |
| 53 | + * Site users | |
| 54 | + */ | |
| 55 | + public $site_users = array(); | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * Constructor | |
| 59 | + */ | |
| 60 | +          public function __construct() { | |
| 61 | + // Set the variables. | |
| 62 | + $this->set_vars(); | |
| 63 | + $this->lsx_to_search_integration(); | |
| 64 | + | |
| 65 | + // Make TO last plugin to load. | |
| 66 | + add_action( 'activated_plugin', array( $this, 'activated_plugin' ) ); | |
| 67 | + | |
| 68 | + add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); | |
| 69 | + | |
| 70 | +               if ( false !== $this->post_types ) { | |
| 71 | + add_filter( 'lsx_to_framework_post_types', array( $this, 'post_types_filter' ) ); | |
| 72 | + add_filter( 'lsx_to_post_types', array( $this, 'post_types_filter' ) ); | |
| 73 | + add_filter( 'lsx_to_post_types_singular', array( $this, 'post_types_singular_filter' ) ); | |
| 74 | + add_filter( 'lsx_to_settings_path', array( $this, 'plugin_path' ), 10, 2 ); | |
| 75 | + } | |
| 76 | +               if ( false !== $this->taxonomies ) { | |
| 77 | + add_filter( 'lsx_to_framework_taxonomies', array( $this, 'taxonomies_filter' ) ); | |
| 78 | + add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'taxonomies_plural_filter' ) ); | |
| 79 | + } | |
| 80 | + | |
| 81 | + require_once LSX_TO_TEAM_PATH . '/classes/class-lsx-to-team-admin.php'; | |
| 82 | + require_once LSX_TO_TEAM_PATH . '/classes/class-lsx-to-team-frontend.php'; | |
| 83 | + require_once LSX_TO_TEAM_PATH . '/includes/template-tags.php'; | |
| 84 | + | |
| 85 | + // flush_rewrite_rules. | |
| 86 | + register_activation_hook( LSX_TO_TEAM_CORE, array( $this, 'register_activation_hook' ) ); | |
| 87 | + add_action( 'admin_init', array( $this, 'register_activation_hook_check' ) ); | |
| 88 | + add_filter( 'wpseo_schema_graph_pieces', array( $this, 'add_graph_pieces' ), 11, 2 ); | |
| 89 | + } | |
| 90 | + | |
| 91 | + /** | |
| 92 | + * Include the post type for the search integration | |
| 93 | + */ | |
| 94 | +          public function lsx_to_search_integration() { | |
| 95 | + add_filter( 'lsx_to_search_post_types', array( $this, 'post_types_filter' ) ); | |
| 96 | + add_filter( 'lsx_to_search_taxonomies', array( $this, 'taxonomies_filter' ) ); | |
| 97 | + } | |
| 98 | + | |
| 99 | + /** | |
| 100 | + * Load the plugin text domain for translation. | |
| 101 | + */ | |
| 102 | +          public function load_plugin_textdomain() { | |
| 103 | + load_plugin_textdomain( 'to-team', false, basename( LSX_TO_TEAM_PATH ) . '/languages' ); | |
| 104 | + } | |
| 105 | + | |
| 106 | + /** | |
| 107 | + * Sets the plugins variables | |
| 108 | + */ | |
| 109 | +          public function set_vars() { | |
| 110 | + $this->post_types = array( | |
| 111 | + 'team' => __( 'Team', 'to-team' ), | |
| 112 | + ); | |
| 113 | + | |
| 114 | + $this->post_types_singular = array( | |
| 115 | + 'team' => __( 'Team Member', 'to-team' ), | |
| 116 | + ); | |
| 117 | + | |
| 118 | + $this->post_type_slugs = array_keys( $this->post_types ); | |
| 119 | + | |
| 120 | + $users = get_users(); | |
| 121 | + | |
| 122 | +               foreach ( $users as $user ) { | |
| 123 | + $this->site_users[] = array( | |
| 124 | + 'name' => $user->display_name, | |
| 125 | + 'value' => $user->ID, | |
| 126 | + ); | |
| 127 | + } | |
| 128 | + } | |
| 129 | + | |
| 130 | + /** | |
| 131 | + * Adds our post types to an array via a filter | |
| 132 | + */ | |
| 133 | +          public function plugin_path( $path, $post_type ) { | |
| 134 | +               if ( false !== $this->post_types && array_key_exists( $post_type, $this->post_types ) ) { | |
| 135 | + $path = LSX_TO_TEAM_PATH; | |
| 136 | + } | |
| 137 | + | |
| 138 | + return $path; | |
| 139 | + } | |
| 140 | + | |
| 141 | + /** | |
| 142 | + * Adds our post types to an array via a filter | |
| 143 | + */ | |
| 144 | +          public function post_types_slugs_filter( $post_types ) { | |
| 145 | +               if ( is_array( $post_types ) ) { | |
| 146 | + $post_types = array_merge( $post_types, $this->post_type_slugs ); | |
| 147 | +               } else { | |
| 148 | + $post_types = $this->post_type_slugs; | |
| 149 | + } | |
| 150 | + | |
| 151 | + return $post_types; | |
| 152 | + } | |
| 153 | + | |
| 154 | + /** | |
| 155 | + * Adds our post types to an array via a filter | |
| 156 | + */ | |
| 157 | +          public function post_types_filter( $post_types ) { | |
| 158 | +               if ( is_array( $post_types ) && is_array( $this->post_types ) ) { | |
| 159 | + $post_types = array_merge( $post_types, $this->post_types ); | |
| 160 | +               } elseif ( is_array( $this->post_types ) ) { | |
| 161 | + $post_types = $this->post_types; | |
| 162 | + } | |
| 163 | + | |
| 164 | + return $post_types; | |
| 165 | + } | |
| 166 | + | |
| 167 | + /** | |
| 168 | + * Adds our post types to an array via a filter | |
| 169 | + */ | |
| 170 | +          public function post_types_singular_filter( $post_types_singular ) { | |
| 171 | +               if ( is_array( $post_types_singular ) && is_array( $this->post_types_singular ) ) { | |
| 172 | + $post_types_singular = array_merge( $post_types_singular, $this->post_types_singular ); | |
| 173 | +               } elseif ( is_array( $this->post_types_singular ) ) { | |
| 174 | + $post_types_singular = $this->post_types_singular; | |
| 175 | + } | |
| 176 | + | |
| 177 | + return $post_types_singular; | |
| 178 | + } | |
| 179 | + | |
| 180 | + /** | |
| 181 | + * Adds our taxonomies to an array via a filter | |
| 182 | + */ | |
| 183 | +          public function taxonomies_filter( $taxonomies ) { | |
| 184 | +               if ( is_array( $taxonomies ) && is_array( $this->taxonomies ) ) { | |
| 185 | + $taxonomies = array_merge( $taxonomies, $this->taxonomies ); | |
| 186 | +               } elseif ( is_array( $this->taxonomies ) ) { | |
| 187 | + $taxonomies = $this->taxonomies; | |
| 188 | + } | |
| 189 | + | |
| 190 | + return $taxonomies; | |
| 191 | + } | |
| 192 | + | |
| 193 | + /** | |
| 194 | + * Adds our taxonomies_plural to an array via a filter | |
| 195 | + */ | |
| 196 | +          public function taxonomies_plural_filter( $taxonomies_plural ) { | |
| 197 | +               if ( is_array( $taxonomies_plural ) && is_array( $this->taxonomies_plural ) ) { | |
| 198 | + $taxonomies_plural = array_merge( $taxonomies_plural, $this->taxonomies_plural ); | |
| 199 | +               } elseif ( is_array( $this->taxonomies_plural ) ) { | |
| 200 | + $taxonomies_plural = $this->taxonomies_plural; | |
| 201 | + } | |
| 202 | + | |
| 203 | + return $taxonomies_plural; | |
| 204 | + } | |
| 205 | + | |
| 206 | + /** | |
| 207 | + * Make TO last plugin to load. | |
| 208 | + */ | |
| 209 | +          public function activated_plugin() { | |
| 210 | + // @codingStandardsIgnoreLine | |
| 211 | +               if ( $plugins = get_option( 'active_plugins' ) ) { | |
| 212 | + $search = preg_grep( '/.*\/tour-operator\.php/', $plugins ); | |
| 213 | + $key = array_search( $search, $plugins ); | |
| 214 | + | |
| 215 | +                    if ( is_array( $search ) && count( $search ) ) { | |
| 216 | +                         foreach ( $search as $key => $path ) { | |
| 217 | + array_splice( $plugins, $key, 1 ); | |
| 218 | + array_push( $plugins, $path ); | |
| 219 | + update_option( 'active_plugins', $plugins ); | |
| 220 | + } | |
| 221 | + } | |
| 222 | + } | |
| 223 | + } | |
| 224 | + | |
| 225 | + /** | |
| 226 | + * On plugin activation | |
| 227 | + */ | |
| 228 | +          public function register_activation_hook() { | |
| 229 | +               if ( ! is_network_admin() && ! isset( $_GET['activate-multi'] ) ) { | |
| 230 | + set_transient( '_tour_operators_team_flush_rewrite_rules', 1, 30 ); | |
| 231 | + } | |
| 232 | + } | |
| 233 | + | |
| 234 | + /** | |
| 235 | + * On plugin activation (check) | |
| 236 | + */ | |
| 237 | +          public function register_activation_hook_check() { | |
| 238 | +               if ( ! get_transient( '_tour_operators_team_flush_rewrite_rules' ) ) { | |
| 239 | + return; | |
| 240 | + } | |
| 241 | + | |
| 242 | + delete_transient( '_tour_operators_team_flush_rewrite_rules' ); | |
| 243 | + flush_rewrite_rules(); | |
| 244 | + } | |
| 245 | + | |
| 246 | + /** | |
| 247 | + * Adds Schema pieces to our output. | |
| 248 | + * | |
| 249 | + * @param array $pieces Graph pieces to output. | |
| 250 | + * @param \WPSEO_Schema_Context $context Object with context variables. | |
| 251 | + * | |
| 252 | + * @return array $pieces Graph pieces to output. | |
| 253 | + */ | |
| 254 | +          public function add_graph_pieces( $pieces, $context ) { | |
| 255 | +               if ( class_exists( 'LSX_TO_Schema_Graph_Piece' ) ) { | |
| 256 | + require_once LSX_TO_TEAM_PATH . 'classes/class-lsx-to-team-schema.php'; | |
| 257 | + $pieces[] = new LSX_TO_Team_Schema( $context ); | |
| 258 | + } | |
| 259 | + return $pieces; | |
| 260 | + } | |
| 261 | + } | |
| 262 | + | |
| 263 | + global $lsx_to_team; | |
| 264 | + $lsx_to_team = new LSX_TO_Team(); | |
| 265 | 265 | |
| 266 | 266 | } | 
| @@ -31,22 +31,22 @@ discard block | ||
| 31 | 31 | * @param array $post_types an array of the post types to redirect. | 
| 32 | 32 | * @param array $taxonomies an array of the taxonomies to redirect. | 
| 33 | 33 | */ | 
| 34 | -	public function __construct( $plugin_path = false, $post_types = false, $taxonomies = false ) { | |
| 35 | -		if ( false !== $plugin_path ) { | |
| 34 | +	public function __construct($plugin_path = false, $post_types = false, $taxonomies = false) { | |
| 35 | +		if (false !== $plugin_path) { | |
| 36 | 36 | $this->plugin_path = $plugin_path; | 
| 37 | 37 | |
| 38 | - add_filter( 'lsx_to_widget_path', array( $this, 'widget_path' ), 10, 2 ); | |
| 39 | - add_filter( 'lsx_to_content_path', array( $this, 'content_path' ), 10, 3 ); | |
| 38 | +			add_filter('lsx_to_widget_path', array($this, 'widget_path'), 10, 2); | |
| 39 | +			add_filter('lsx_to_content_path', array($this, 'content_path'), 10, 3); | |
| 40 | 40 | |
| 41 | -			if ( false !== $post_types ) { | |
| 41 | +			if (false !== $post_types) { | |
| 42 | 42 | $this->post_types = $post_types; | 
| 43 | - add_filter( 'template_include', array( $this, 'post_type_archive_template_include' ), 99 ); | |
| 44 | - add_filter( 'template_include', array( $this, 'post_type_single_template_include' ), 99 ); | |
| 45 | - add_filter( 'template_include', array( $this, 'search_template_include' ), 99 ); | |
| 43 | +				add_filter('template_include', array($this, 'post_type_archive_template_include'), 99); | |
| 44 | +				add_filter('template_include', array($this, 'post_type_single_template_include'), 99); | |
| 45 | +				add_filter('template_include', array($this, 'search_template_include'), 99); | |
| 46 | 46 | } | 
| 47 | -			if ( false !== $taxonomies ) { | |
| 47 | +			if (false !== $taxonomies) { | |
| 48 | 48 | $this->taxonomies = $taxonomies; | 
| 49 | - add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 ); | |
| 49 | +				add_filter('template_include', array($this, 'taxonomy_template_include'), 99); | |
| 50 | 50 | } | 
| 51 | 51 | } | 
| 52 | 52 | } | 
| @@ -57,10 +57,10 @@ discard block | ||
| 57 | 57 | * @param $template | 
| 58 | 58 | * @return $template | 
| 59 | 59 | */ | 
| 60 | -	public function post_type_archive_template_include( $template ) { | |
| 61 | -		if ( is_main_query() && is_post_type_archive( $this->post_types ) ) { | |
| 60 | +	public function post_type_archive_template_include($template) { | |
| 61 | +		if (is_main_query() && is_post_type_archive($this->post_types)) { | |
| 62 | 62 | $current_post_type = get_post_type(); | 
| 63 | -			if ( '' == locate_template( array( 'archive-' . $current_post_type . '.php' ) )	&& file_exists( $this->plugin_path . 'templates/archive-' . $current_post_type . '.php' ) ) { | |
| 63 | +			if ('' == locate_template(array('archive-' . $current_post_type . '.php')) && file_exists($this->plugin_path . 'templates/archive-' . $current_post_type . '.php')) { | |
| 64 | 64 | $template = $this->plugin_path . 'templates/archive-' . $current_post_type . '.php'; | 
| 65 | 65 | } | 
| 66 | 66 | } | 
| @@ -73,10 +73,10 @@ discard block | ||
| 73 | 73 | * | 
| 74 | 74 | * @return $template | 
| 75 | 75 | */ | 
| 76 | -	public function post_type_single_template_include( $template ) { | |
| 77 | -		if ( is_main_query() && is_singular( $this->post_types ) ) { | |
| 76 | +	public function post_type_single_template_include($template) { | |
| 77 | +		if (is_main_query() && is_singular($this->post_types)) { | |
| 78 | 78 | $current_post_type = get_post_type(); | 
| 79 | -			if ( '' == locate_template( array( 'single-' . $current_post_type . '.php' ) )	&& file_exists( $this->plugin_path . 'templates/single-' . $current_post_type . '.php' ) ) { | |
| 79 | +			if ('' == locate_template(array('single-' . $current_post_type . '.php')) && file_exists($this->plugin_path . 'templates/single-' . $current_post_type . '.php')) { | |
| 80 | 80 | $template = $this->plugin_path . 'templates/single-' . $current_post_type . '.php'; | 
| 81 | 81 | } | 
| 82 | 82 | } | 
| @@ -89,11 +89,11 @@ discard block | ||
| 89 | 89 | * | 
| 90 | 90 | * @return $template | 
| 91 | 91 | */ | 
| 92 | -	public function taxonomy_template_include( $template ) { | |
| 92 | +	public function taxonomy_template_include($template) { | |
| 93 | 93 | |
| 94 | -		if ( is_main_query() && is_tax( $this->taxonomies ) ) { | |
| 95 | - $current_taxonomy = get_query_var( 'taxonomy' ); | |
| 96 | -			if ( '' == locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( $this->plugin_path . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) { | |
| 94 | +		if (is_main_query() && is_tax($this->taxonomies)) { | |
| 95 | +			$current_taxonomy = get_query_var('taxonomy'); | |
| 96 | +			if ('' == locate_template(array('taxonomy-' . $current_taxonomy . '.php')) && file_exists($this->plugin_path . 'templates/taxonomy-' . $current_taxonomy . '.php')) { | |
| 97 | 97 | $template = $this->plugin_path . 'templates/taxonomy-' . $current_taxonomy . '.php'; | 
| 98 | 98 | } | 
| 99 | 99 | } | 
| @@ -107,9 +107,9 @@ discard block | ||
| 107 | 107 | * | 
| 108 | 108 | * @return $template | 
| 109 | 109 | */ | 
| 110 | -	public function search_template_include( $template ) { | |
| 111 | -		if ( is_main_query() && is_search() ) { | |
| 112 | -			if ( file_exists( $this->plugin_path . 'templates/search.php' ) ) { | |
| 110 | +	public function search_template_include($template) { | |
| 111 | +		if (is_main_query() && is_search()) { | |
| 112 | +			if (file_exists($this->plugin_path . 'templates/search.php')) { | |
| 113 | 113 | $template = $this->plugin_path . 'templates/search.php'; | 
| 114 | 114 | } | 
| 115 | 115 | } | 
| @@ -123,28 +123,28 @@ discard block | ||
| 123 | 123 | * | 
| 124 | 124 | * @return $template | 
| 125 | 125 | */ | 
| 126 | -	public function content_part( $slug, $name = null ) { | |
| 126 | +	public function content_part($slug, $name = null) { | |
| 127 | 127 | $template = array(); | 
| 128 | 128 | $name = (string) $name; | 
| 129 | -		if ( '' !== $name ) { | |
| 129 | +		if ('' !== $name) { | |
| 130 | 130 |  			$template = "{$slug}-{$name}.php"; | 
| 131 | 131 |  		} else { | 
| 132 | 132 |  			$template = "{$slug}.php"; | 
| 133 | 133 | } | 
| 134 | 134 | $original_name = $template; | 
| 135 | - $path = apply_filters( 'lsx_to_content_path', '', get_post_type() ); | |
| 135 | +		$path = apply_filters('lsx_to_content_path', '', get_post_type()); | |
| 136 | 136 | |
| 137 | -		if ( '' == locate_template( array( $template ) ) && file_exists( $path . 'templates/' . $template ) ) { | |
| 137 | +		if ('' == locate_template(array($template)) && file_exists($path . 'templates/' . $template)) { | |
| 138 | 138 | $template = $path . 'templates/' . $template; | 
| 139 | -		} elseif ( file_exists( get_stylesheet_directory() . '/' . $template ) ) { | |
| 139 | +		} elseif (file_exists(get_stylesheet_directory() . '/' . $template)) { | |
| 140 | 140 | $template = get_stylesheet_directory() . '/' . $template; | 
| 141 | 141 |  		} else { | 
| 142 | 142 | $template = false; | 
| 143 | 143 | } | 
| 144 | -		if ( false !== $template ) { | |
| 145 | - load_template( $template, false ); | |
| 144 | +		if (false !== $template) { | |
| 145 | + load_template($template, false); | |
| 146 | 146 |  		} else { | 
| 147 | - echo wp_kses_post( '<p>No ' . $original_name . ' can be found.</p>' ); | |
| 147 | +			echo wp_kses_post('<p>No ' . $original_name . ' can be found.</p>'); | |
| 148 | 148 | } | 
| 149 | 149 | } | 
| 150 | 150 | |
| @@ -156,9 +156,9 @@ discard block | ||
| 156 | 156 | * | 
| 157 | 157 | * @return $path | 
| 158 | 158 | */ | 
| 159 | -	public function widget_path( $path, $slug ) { | |
| 160 | - if ( ( false !== $this->post_types && in_array( $slug, $this->post_types ) ) | |
| 161 | -		 || ( false !== $this->taxonomies && in_array( $slug, $this->taxonomies ) ) || 'post' === $slug ) { | |
| 159 | +	public function widget_path($path, $slug) { | |
| 160 | + if ((false !== $this->post_types && in_array($slug, $this->post_types)) | |
| 161 | +		 || (false !== $this->taxonomies && in_array($slug, $this->taxonomies)) || 'post' === $slug) { | |
| 162 | 162 | $path = $this->plugin_path; | 
| 163 | 163 | } | 
| 164 | 164 | return $path; | 
| @@ -172,9 +172,9 @@ discard block | ||
| 172 | 172 | * | 
| 173 | 173 | * @return $path | 
| 174 | 174 | */ | 
| 175 | -	public function content_path( $path, $slug ) { | |
| 176 | - if ( ( false !== $this->post_types && in_array( $slug, $this->post_types ) ) | |
| 177 | -		 || ( false !== $this->taxonomies && in_array( $slug, $this->taxonomies ) ) || 'post' === $slug ) { | |
| 175 | +	public function content_path($path, $slug) { | |
| 176 | + if ((false !== $this->post_types && in_array($slug, $this->post_types)) | |
| 177 | +		 || (false !== $this->taxonomies && in_array($slug, $this->taxonomies)) || 'post' === $slug) { | |
| 178 | 178 | $path = $this->plugin_path; | 
| 179 | 179 | } | 
| 180 | 180 | return $path; | 
| @@ -10,173 +10,173 @@ | ||
| 10 | 10 | |
| 11 | 11 |  class LSX_TO_Template_Redirects { | 
| 12 | 12 | |
| 13 | - /** | |
| 14 | - * Plugin Path | |
| 15 | - */ | |
| 16 | - public $plugin_path = false; | |
| 13 | + /** | |
| 14 | + * Plugin Path | |
| 15 | + */ | |
| 16 | + public $plugin_path = false; | |
| 17 | 17 | |
| 18 | - /** | |
| 19 | - * Post Types | |
| 20 | - */ | |
| 21 | - public $post_types = false; | |
| 18 | + /** | |
| 19 | + * Post Types | |
| 20 | + */ | |
| 21 | + public $post_types = false; | |
| 22 | 22 | |
| 23 | - /** | |
| 24 | - * Taxonomies | |
| 25 | - */ | |
| 26 | - public $taxonomies = false; | |
| 23 | + /** | |
| 24 | + * Taxonomies | |
| 25 | + */ | |
| 26 | + public $taxonomies = false; | |
| 27 | 27 | |
| 28 | - /** | |
| 29 | - * Initialize the plugin by setting localization, filters, and administration functions. | |
| 30 | - * | |
| 31 | - * @param array $post_types an array of the post types to redirect. | |
| 32 | - * @param array $taxonomies an array of the taxonomies to redirect. | |
| 33 | - */ | |
| 34 | -	public function __construct( $plugin_path = false, $post_types = false, $taxonomies = false ) { | |
| 35 | -		if ( false !== $plugin_path ) { | |
| 36 | - $this->plugin_path = $plugin_path; | |
| 28 | + /** | |
| 29 | + * Initialize the plugin by setting localization, filters, and administration functions. | |
| 30 | + * | |
| 31 | + * @param array $post_types an array of the post types to redirect. | |
| 32 | + * @param array $taxonomies an array of the taxonomies to redirect. | |
| 33 | + */ | |
| 34 | +     public function __construct( $plugin_path = false, $post_types = false, $taxonomies = false ) { | |
| 35 | +          if ( false !== $plugin_path ) { | |
| 36 | + $this->plugin_path = $plugin_path; | |
| 37 | 37 | |
| 38 | - add_filter( 'lsx_to_widget_path', array( $this, 'widget_path' ), 10, 2 ); | |
| 39 | - add_filter( 'lsx_to_content_path', array( $this, 'content_path' ), 10, 3 ); | |
| 38 | + add_filter( 'lsx_to_widget_path', array( $this, 'widget_path' ), 10, 2 ); | |
| 39 | + add_filter( 'lsx_to_content_path', array( $this, 'content_path' ), 10, 3 ); | |
| 40 | 40 | |
| 41 | -			if ( false !== $post_types ) { | |
| 42 | - $this->post_types = $post_types; | |
| 43 | - add_filter( 'template_include', array( $this, 'post_type_archive_template_include' ), 99 ); | |
| 44 | - add_filter( 'template_include', array( $this, 'post_type_single_template_include' ), 99 ); | |
| 45 | - add_filter( 'template_include', array( $this, 'search_template_include' ), 99 ); | |
| 46 | - } | |
| 47 | -			if ( false !== $taxonomies ) { | |
| 48 | - $this->taxonomies = $taxonomies; | |
| 49 | - add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 ); | |
| 50 | - } | |
| 51 | - } | |
| 52 | - } | |
| 41 | +               if ( false !== $post_types ) { | |
| 42 | + $this->post_types = $post_types; | |
| 43 | + add_filter( 'template_include', array( $this, 'post_type_archive_template_include' ), 99 ); | |
| 44 | + add_filter( 'template_include', array( $this, 'post_type_single_template_include' ), 99 ); | |
| 45 | + add_filter( 'template_include', array( $this, 'search_template_include' ), 99 ); | |
| 46 | + } | |
| 47 | +               if ( false !== $taxonomies ) { | |
| 48 | + $this->taxonomies = $taxonomies; | |
| 49 | + add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 ); | |
| 50 | + } | |
| 51 | + } | |
| 52 | + } | |
| 53 | 53 | |
| 54 | - /** | |
| 55 | - * Redirect wordpress to the archive template located in the plugin | |
| 56 | - * | |
| 57 | - * @param $template | |
| 58 | - * @return $template | |
| 59 | - */ | |
| 60 | -	public function post_type_archive_template_include( $template ) { | |
| 61 | -		if ( is_main_query() && is_post_type_archive( $this->post_types ) ) { | |
| 62 | - $current_post_type = get_post_type(); | |
| 63 | -			if ( '' == locate_template( array( 'archive-' . $current_post_type . '.php' ) )	&& file_exists( $this->plugin_path . 'templates/archive-' . $current_post_type . '.php' ) ) { | |
| 64 | - $template = $this->plugin_path . 'templates/archive-' . $current_post_type . '.php'; | |
| 65 | - } | |
| 66 | - } | |
| 67 | - return $template; | |
| 68 | - } | |
| 69 | - /** | |
| 70 | - * Redirect wordpress to the single template located in the plugin | |
| 71 | - * | |
| 72 | - * @param $template | |
| 73 | - * | |
| 74 | - * @return $template | |
| 75 | - */ | |
| 76 | -	public function post_type_single_template_include( $template ) { | |
| 77 | -		if ( is_main_query() && is_singular( $this->post_types ) ) { | |
| 78 | - $current_post_type = get_post_type(); | |
| 79 | -			if ( '' == locate_template( array( 'single-' . $current_post_type . '.php' ) )	&& file_exists( $this->plugin_path . 'templates/single-' . $current_post_type . '.php' ) ) { | |
| 80 | - $template = $this->plugin_path . 'templates/single-' . $current_post_type . '.php'; | |
| 81 | - } | |
| 82 | - } | |
| 83 | - return $template; | |
| 84 | - } | |
| 85 | - /** | |
| 86 | - * Redirect wordpress to the taxonomy located in the plugin | |
| 87 | - * | |
| 88 | - * @param $template | |
| 89 | - * | |
| 90 | - * @return $template | |
| 91 | - */ | |
| 92 | -	public function taxonomy_template_include( $template ) { | |
| 54 | + /** | |
| 55 | + * Redirect wordpress to the archive template located in the plugin | |
| 56 | + * | |
| 57 | + * @param $template | |
| 58 | + * @return $template | |
| 59 | + */ | |
| 60 | +     public function post_type_archive_template_include( $template ) { | |
| 61 | +          if ( is_main_query() && is_post_type_archive( $this->post_types ) ) { | |
| 62 | + $current_post_type = get_post_type(); | |
| 63 | +               if ( '' == locate_template( array( 'archive-' . $current_post_type . '.php' ) )	&& file_exists( $this->plugin_path . 'templates/archive-' . $current_post_type . '.php' ) ) { | |
| 64 | + $template = $this->plugin_path . 'templates/archive-' . $current_post_type . '.php'; | |
| 65 | + } | |
| 66 | + } | |
| 67 | + return $template; | |
| 68 | + } | |
| 69 | + /** | |
| 70 | + * Redirect wordpress to the single template located in the plugin | |
| 71 | + * | |
| 72 | + * @param $template | |
| 73 | + * | |
| 74 | + * @return $template | |
| 75 | + */ | |
| 76 | +     public function post_type_single_template_include( $template ) { | |
| 77 | +          if ( is_main_query() && is_singular( $this->post_types ) ) { | |
| 78 | + $current_post_type = get_post_type(); | |
| 79 | +               if ( '' == locate_template( array( 'single-' . $current_post_type . '.php' ) )	&& file_exists( $this->plugin_path . 'templates/single-' . $current_post_type . '.php' ) ) { | |
| 80 | + $template = $this->plugin_path . 'templates/single-' . $current_post_type . '.php'; | |
| 81 | + } | |
| 82 | + } | |
| 83 | + return $template; | |
| 84 | + } | |
| 85 | + /** | |
| 86 | + * Redirect wordpress to the taxonomy located in the plugin | |
| 87 | + * | |
| 88 | + * @param $template | |
| 89 | + * | |
| 90 | + * @return $template | |
| 91 | + */ | |
| 92 | +     public function taxonomy_template_include( $template ) { | |
| 93 | 93 | |
| 94 | -		if ( is_main_query() && is_tax( $this->taxonomies ) ) { | |
| 95 | - $current_taxonomy = get_query_var( 'taxonomy' ); | |
| 96 | -			if ( '' == locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( $this->plugin_path . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) { | |
| 97 | - $template = $this->plugin_path . 'templates/taxonomy-' . $current_taxonomy . '.php'; | |
| 98 | - } | |
| 99 | - } | |
| 100 | - return $template; | |
| 101 | - } | |
| 94 | +          if ( is_main_query() && is_tax( $this->taxonomies ) ) { | |
| 95 | + $current_taxonomy = get_query_var( 'taxonomy' ); | |
| 96 | +               if ( '' == locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( $this->plugin_path . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) { | |
| 97 | + $template = $this->plugin_path . 'templates/taxonomy-' . $current_taxonomy . '.php'; | |
| 98 | + } | |
| 99 | + } | |
| 100 | + return $template; | |
| 101 | + } | |
| 102 | 102 | |
| 103 | - /** | |
| 104 | - * Redirect wordpress to the search template located in the plugin | |
| 105 | - * | |
| 106 | - * @param $template | |
| 107 | - * | |
| 108 | - * @return $template | |
| 109 | - */ | |
| 110 | -	public function search_template_include( $template ) { | |
| 111 | -		if ( is_main_query() && is_search() ) { | |
| 112 | -			if ( file_exists( $this->plugin_path . 'templates/search.php' ) ) { | |
| 113 | - $template = $this->plugin_path . 'templates/search.php'; | |
| 114 | - } | |
| 115 | - } | |
| 116 | - return $template; | |
| 117 | - } | |
| 103 | + /** | |
| 104 | + * Redirect wordpress to the search template located in the plugin | |
| 105 | + * | |
| 106 | + * @param $template | |
| 107 | + * | |
| 108 | + * @return $template | |
| 109 | + */ | |
| 110 | +     public function search_template_include( $template ) { | |
| 111 | +          if ( is_main_query() && is_search() ) { | |
| 112 | +               if ( file_exists( $this->plugin_path . 'templates/search.php' ) ) { | |
| 113 | + $template = $this->plugin_path . 'templates/search.php'; | |
| 114 | + } | |
| 115 | + } | |
| 116 | + return $template; | |
| 117 | + } | |
| 118 | 118 | |
| 119 | - /** | |
| 120 | - * Redirect wordpress to the single template located in the plugin | |
| 121 | - * | |
| 122 | - * @param $template | |
| 123 | - * | |
| 124 | - * @return $template | |
| 125 | - */ | |
| 126 | -	public function content_part( $slug, $name = null ) { | |
| 127 | - $template = array(); | |
| 128 | - $name = (string) $name; | |
| 129 | -		if ( '' !== $name ) { | |
| 130 | -			$template = "{$slug}-{$name}.php"; | |
| 131 | -		} else { | |
| 132 | -			$template = "{$slug}.php"; | |
| 133 | - } | |
| 134 | - $original_name = $template; | |
| 135 | - $path = apply_filters( 'lsx_to_content_path', '', get_post_type() ); | |
| 119 | + /** | |
| 120 | + * Redirect wordpress to the single template located in the plugin | |
| 121 | + * | |
| 122 | + * @param $template | |
| 123 | + * | |
| 124 | + * @return $template | |
| 125 | + */ | |
| 126 | +     public function content_part( $slug, $name = null ) { | |
| 127 | + $template = array(); | |
| 128 | + $name = (string) $name; | |
| 129 | +          if ( '' !== $name ) { | |
| 130 | +               $template = "{$slug}-{$name}.php"; | |
| 131 | +          } else { | |
| 132 | +               $template = "{$slug}.php"; | |
| 133 | + } | |
| 134 | + $original_name = $template; | |
| 135 | + $path = apply_filters( 'lsx_to_content_path', '', get_post_type() ); | |
| 136 | 136 | |
| 137 | -		if ( '' == locate_template( array( $template ) ) && file_exists( $path . 'templates/' . $template ) ) { | |
| 138 | - $template = $path . 'templates/' . $template; | |
| 139 | -		} elseif ( file_exists( get_stylesheet_directory() . '/' . $template ) ) { | |
| 140 | - $template = get_stylesheet_directory() . '/' . $template; | |
| 141 | -		} else { | |
| 142 | - $template = false; | |
| 143 | - } | |
| 144 | -		if ( false !== $template ) { | |
| 145 | - load_template( $template, false ); | |
| 146 | -		} else { | |
| 147 | - echo wp_kses_post( '<p>No ' . $original_name . ' can be found.</p>' ); | |
| 148 | - } | |
| 149 | - } | |
| 137 | +          if ( '' == locate_template( array( $template ) ) && file_exists( $path . 'templates/' . $template ) ) { | |
| 138 | + $template = $path . 'templates/' . $template; | |
| 139 | +          } elseif ( file_exists( get_stylesheet_directory() . '/' . $template ) ) { | |
| 140 | + $template = get_stylesheet_directory() . '/' . $template; | |
| 141 | +          } else { | |
| 142 | + $template = false; | |
| 143 | + } | |
| 144 | +          if ( false !== $template ) { | |
| 145 | + load_template( $template, false ); | |
| 146 | +          } else { | |
| 147 | + echo wp_kses_post( '<p>No ' . $original_name . ' can be found.</p>' ); | |
| 148 | + } | |
| 149 | + } | |
| 150 | 150 | |
| 151 | - /** | |
| 152 | - * Redirect wordpress to the widget template located in the plugin | |
| 153 | - * | |
| 154 | - * @param $path | |
| 155 | - * @param $post_type | |
| 156 | - * | |
| 157 | - * @return $path | |
| 158 | - */ | |
| 159 | -	public function widget_path( $path, $slug ) { | |
| 160 | - if ( ( false !== $this->post_types && in_array( $slug, $this->post_types ) ) | |
| 161 | -		 || ( false !== $this->taxonomies && in_array( $slug, $this->taxonomies ) ) || 'post' === $slug ) { | |
| 162 | - $path = $this->plugin_path; | |
| 163 | - } | |
| 164 | - return $path; | |
| 165 | - } | |
| 151 | + /** | |
| 152 | + * Redirect wordpress to the widget template located in the plugin | |
| 153 | + * | |
| 154 | + * @param $path | |
| 155 | + * @param $post_type | |
| 156 | + * | |
| 157 | + * @return $path | |
| 158 | + */ | |
| 159 | +     public function widget_path( $path, $slug ) { | |
| 160 | + if ( ( false !== $this->post_types && in_array( $slug, $this->post_types ) ) | |
| 161 | +           || ( false !== $this->taxonomies && in_array( $slug, $this->taxonomies ) ) || 'post' === $slug ) { | |
| 162 | + $path = $this->plugin_path; | |
| 163 | + } | |
| 164 | + return $path; | |
| 165 | + } | |
| 166 | 166 | |
| 167 | - /** | |
| 168 | - * Redirect wordpress to the single template located in the plugin | |
| 169 | - * | |
| 170 | - * @param $path | |
| 171 | - * @param $post_type | |
| 172 | - * | |
| 173 | - * @return $path | |
| 174 | - */ | |
| 175 | -	public function content_path( $path, $slug ) { | |
| 176 | - if ( ( false !== $this->post_types && in_array( $slug, $this->post_types ) ) | |
| 177 | -		 || ( false !== $this->taxonomies && in_array( $slug, $this->taxonomies ) ) || 'post' === $slug ) { | |
| 178 | - $path = $this->plugin_path; | |
| 179 | - } | |
| 180 | - return $path; | |
| 181 | - } | |
| 167 | + /** | |
| 168 | + * Redirect wordpress to the single template located in the plugin | |
| 169 | + * | |
| 170 | + * @param $path | |
| 171 | + * @param $post_type | |
| 172 | + * | |
| 173 | + * @return $path | |
| 174 | + */ | |
| 175 | +     public function content_path( $path, $slug ) { | |
| 176 | + if ( ( false !== $this->post_types && in_array( $slug, $this->post_types ) ) | |
| 177 | +           || ( false !== $this->taxonomies && in_array( $slug, $this->taxonomies ) ) || 'post' === $slug ) { | |
| 178 | + $path = $this->plugin_path; | |
| 179 | + } | |
| 180 | + return $path; | |
| 181 | + } | |
| 182 | 182 | } | 
| @@ -13,23 +13,23 @@ | ||
| 13 | 13 | 'class' => 'LSX_TO_Team', | 
| 14 | 14 | 'menu_icon' => 'dashicons-id-alt', | 
| 15 | 15 | 'labels' => array( | 
| 16 | - 'name' => esc_html__( 'Team', 'to-team' ), | |
| 17 | - 'singular_name' => esc_html__( 'Team Member', 'to-team' ), | |
| 18 | - 'add_new' => esc_html__( 'Add New', 'to-team' ), | |
| 19 | - 'add_new_item' => esc_html__( 'Add New Team Member', 'to-team' ), | |
| 20 | - 'edit_item' => esc_html__( 'Edit', 'to-team' ), | |
| 21 | - 'new_item' => esc_html__( 'New', 'to-team' ), | |
| 22 | - 'all_items' => esc_html__( 'Team', 'to-team' ), | |
| 23 | - 'view_item' => esc_html__( 'View', 'to-team' ), | |
| 24 | - 'search_items' => esc_html__( 'Search the Team', 'to-team' ), | |
| 25 | - 'not_found' => esc_html__( 'No team member found', 'to-team' ), | |
| 26 | - 'not_found_in_trash' => esc_html__( 'No team member found in Trash', 'to-team' ), | |
| 16 | +		'name'               => esc_html__('Team', 'to-team'), | |
| 17 | +		'singular_name'      => esc_html__('Team Member', 'to-team'), | |
| 18 | +		'add_new'            => esc_html__('Add New', 'to-team'), | |
| 19 | +		'add_new_item'       => esc_html__('Add New Team Member', 'to-team'), | |
| 20 | +		'edit_item'          => esc_html__('Edit', 'to-team'), | |
| 21 | +		'new_item'           => esc_html__('New', 'to-team'), | |
| 22 | +		'all_items'          => esc_html__('Team', 'to-team'), | |
| 23 | +		'view_item'          => esc_html__('View', 'to-team'), | |
| 24 | +		'search_items'       => esc_html__('Search the Team', 'to-team'), | |
| 25 | +		'not_found'          => esc_html__('No team member found', 'to-team'), | |
| 26 | +		'not_found_in_trash' => esc_html__('No team member found in Trash', 'to-team'), | |
| 27 | 27 | 'parent_item_colon' => '', | 
| 28 | - 'menu_name' => esc_html__( 'Team', 'lsx-team' ), | |
| 29 | - 'featured_image' => esc_html__( 'Profile Picture', 'to-team' ), | |
| 30 | - 'set_featured_image' => esc_html__( 'Set Profile Picture', 'to-team' ), | |
| 31 | - 'remove_featured_image' => esc_html__( 'Remove profile picture', 'to-team' ), | |
| 32 | - 'use_featured_image' => esc_html__( 'Use as profile picture', 'to-team' ), | |
| 28 | +		'menu_name'          => esc_html__('Team', 'lsx-team'), | |
| 29 | +		'featured_image'	=> esc_html__('Profile Picture', 'to-team'), | |
| 30 | +		'set_featured_image'	=> esc_html__('Set Profile Picture', 'to-team'), | |
| 31 | +		'remove_featured_image'	=> esc_html__('Remove profile picture', 'to-team'), | |
| 32 | +		'use_featured_image'	=> esc_html__('Use as profile picture', 'to-team'), | |
| 33 | 33 | ), | 
| 34 | 34 | 'public' => true, | 
| 35 | 35 | 'publicly_queryable' => true, | 
| @@ -10,50 +10,50 @@ | ||
| 10 | 10 | */ | 
| 11 | 11 | |
| 12 | 12 | $post_type = array( | 
| 13 | - 'class' => 'LSX_TO_Team', | |
| 14 | - 'menu_icon' => 'dashicons-id-alt', | |
| 15 | - 'labels' => array( | |
| 16 | - 'name' => esc_html__( 'Team', 'to-team' ), | |
| 17 | - 'singular_name' => esc_html__( 'Team Member', 'to-team' ), | |
| 18 | - 'add_new' => esc_html__( 'Add New', 'to-team' ), | |
| 19 | - 'add_new_item' => esc_html__( 'Add New Team Member', 'to-team' ), | |
| 20 | - 'edit_item' => esc_html__( 'Edit', 'to-team' ), | |
| 21 | - 'new_item' => esc_html__( 'New', 'to-team' ), | |
| 22 | - 'all_items' => esc_html__( 'Team', 'to-team' ), | |
| 23 | - 'view_item' => esc_html__( 'View', 'to-team' ), | |
| 24 | - 'search_items' => esc_html__( 'Search the Team', 'to-team' ), | |
| 25 | - 'not_found' => esc_html__( 'No team member found', 'to-team' ), | |
| 26 | - 'not_found_in_trash' => esc_html__( 'No team member found in Trash', 'to-team' ), | |
| 27 | - 'parent_item_colon' => '', | |
| 28 | - 'menu_name' => esc_html__( 'Team', 'lsx-team' ), | |
| 29 | - 'featured_image' => esc_html__( 'Profile Picture', 'to-team' ), | |
| 30 | - 'set_featured_image' => esc_html__( 'Set Profile Picture', 'to-team' ), | |
| 31 | - 'remove_featured_image' => esc_html__( 'Remove profile picture', 'to-team' ), | |
| 32 | - 'use_featured_image' => esc_html__( 'Use as profile picture', 'to-team' ), | |
| 33 | - ), | |
| 34 | - 'public' => true, | |
| 35 | - 'publicly_queryable' => true, | |
| 36 | - 'show_ui' => true, | |
| 37 | - 'show_in_menu' => 'tour-operator', | |
| 38 | - 'menu_position' => 75, | |
| 39 | - 'query_var' => true, | |
| 40 | - 'rewrite' => array( | |
| 41 | - 'slug' => 'team', | |
| 42 | - 'with_front' => false, | |
| 43 | - ), | |
| 44 | - 'exclude_from_search' => false, | |
| 45 | - 'capability_type' => 'post', | |
| 46 | - 'has_archive' => 'team', | |
| 47 | - 'hierarchical' => false, | |
| 48 | - 'show_in_rest' => true, | |
| 49 | - 'supports' => array( | |
| 50 | - 'title', | |
| 51 | - 'slug', | |
| 52 | - 'editor', | |
| 53 | - 'thumbnail', | |
| 54 | - 'excerpt', | |
| 55 | - 'custom-fields', | |
| 56 | - ), | |
| 13 | + 'class' => 'LSX_TO_Team', | |
| 14 | + 'menu_icon' => 'dashicons-id-alt', | |
| 15 | + 'labels' => array( | |
| 16 | + 'name' => esc_html__( 'Team', 'to-team' ), | |
| 17 | + 'singular_name' => esc_html__( 'Team Member', 'to-team' ), | |
| 18 | + 'add_new' => esc_html__( 'Add New', 'to-team' ), | |
| 19 | + 'add_new_item' => esc_html__( 'Add New Team Member', 'to-team' ), | |
| 20 | + 'edit_item' => esc_html__( 'Edit', 'to-team' ), | |
| 21 | + 'new_item' => esc_html__( 'New', 'to-team' ), | |
| 22 | + 'all_items' => esc_html__( 'Team', 'to-team' ), | |
| 23 | + 'view_item' => esc_html__( 'View', 'to-team' ), | |
| 24 | + 'search_items' => esc_html__( 'Search the Team', 'to-team' ), | |
| 25 | + 'not_found' => esc_html__( 'No team member found', 'to-team' ), | |
| 26 | + 'not_found_in_trash' => esc_html__( 'No team member found in Trash', 'to-team' ), | |
| 27 | + 'parent_item_colon' => '', | |
| 28 | + 'menu_name' => esc_html__( 'Team', 'lsx-team' ), | |
| 29 | + 'featured_image' => esc_html__( 'Profile Picture', 'to-team' ), | |
| 30 | + 'set_featured_image' => esc_html__( 'Set Profile Picture', 'to-team' ), | |
| 31 | + 'remove_featured_image' => esc_html__( 'Remove profile picture', 'to-team' ), | |
| 32 | + 'use_featured_image' => esc_html__( 'Use as profile picture', 'to-team' ), | |
| 33 | + ), | |
| 34 | + 'public' => true, | |
| 35 | + 'publicly_queryable' => true, | |
| 36 | + 'show_ui' => true, | |
| 37 | + 'show_in_menu' => 'tour-operator', | |
| 38 | + 'menu_position' => 75, | |
| 39 | + 'query_var' => true, | |
| 40 | + 'rewrite' => array( | |
| 41 | + 'slug' => 'team', | |
| 42 | + 'with_front' => false, | |
| 43 | + ), | |
| 44 | + 'exclude_from_search' => false, | |
| 45 | + 'capability_type' => 'post', | |
| 46 | + 'has_archive' => 'team', | |
| 47 | + 'hierarchical' => false, | |
| 48 | + 'show_in_rest' => true, | |
| 49 | + 'supports' => array( | |
| 50 | + 'title', | |
| 51 | + 'slug', | |
| 52 | + 'editor', | |
| 53 | + 'thumbnail', | |
| 54 | + 'excerpt', | |
| 55 | + 'custom-fields', | |
| 56 | + ), | |
| 57 | 57 | ); | 
| 58 | 58 | |
| 59 | 59 | return $post_type; | 
| @@ -16,8 +16,8 @@ discard block | ||
| 16 | 16 | * @subpackage template-tag | 
| 17 | 17 | * @category content | 
| 18 | 18 | */ | 
| 19 | -function lsx_to_team_content( $slug, $name = null ) { | |
| 20 | - do_action( 'lsx_to_team_content',$slug, $name ); | |
| 19 | +function lsx_to_team_content($slug, $name = null) { | |
| 20 | +	do_action('lsx_to_team_content', $slug, $name); | |
| 21 | 21 | } | 
| 22 | 22 | |
| 23 | 23 | /** | 
| @@ -31,8 +31,8 @@ discard block | ||
| 31 | 31 | * @package to-team | 
| 32 | 32 | * @subpackage template-tags | 
| 33 | 33 | */ | 
| 34 | -function lsx_to_team_role( $before = '', $after = '', $echo = true ) { | |
| 35 | - lsx_to_custom_field_query( 'role',$before,$after,$echo ); | |
| 34 | +function lsx_to_team_role($before = '', $after = '', $echo = true) { | |
| 35 | +	lsx_to_custom_field_query('role', $before, $after, $echo); | |
| 36 | 36 | } | 
| 37 | 37 | |
| 38 | 38 | /** | 
| @@ -46,14 +46,14 @@ discard block | ||
| 46 | 46 | * @package to-team | 
| 47 | 47 | * @subpackage template-tags | 
| 48 | 48 | */ | 
| 49 | -function lsx_to_team_contact_number( $before = '', $after = '', $echo = true ) { | |
| 50 | - $contact_number = get_post_meta( get_the_ID(), 'contact_number', true ); | |
| 49 | +function lsx_to_team_contact_number($before = '', $after = '', $echo = true) { | |
| 50 | + $contact_number = get_post_meta(get_the_ID(), 'contact_number', true); | |
| 51 | 51 | |
| 52 | -	if ( false !== $contact_number && '' !== $contact_number ) { | |
| 52 | +	if (false !== $contact_number && '' !== $contact_number) { | |
| 53 | 53 | $contact_html = $before . '<a href="tel:+' . $contact_number . '">' . $contact_number . '</a>' . $after; | 
| 54 | 54 | |
| 55 | -		if ( $echo ) { | |
| 56 | - echo wp_kses_post( $contact_html ); | |
| 55 | +		if ($echo) { | |
| 56 | + echo wp_kses_post($contact_html); | |
| 57 | 57 |  		} else { | 
| 58 | 58 | return $contact_html; | 
| 59 | 59 | } | 
| @@ -71,14 +71,14 @@ discard block | ||
| 71 | 71 | * @package to-team | 
| 72 | 72 | * @subpackage template-tags | 
| 73 | 73 | */ | 
| 74 | -function lsx_to_team_contact_email( $before = '', $after = '', $echo = true ) { | |
| 75 | - $contact_email = get_post_meta( get_the_ID(), 'contact_email', true ); | |
| 74 | +function lsx_to_team_contact_email($before = '', $after = '', $echo = true) { | |
| 75 | + $contact_email = get_post_meta(get_the_ID(), 'contact_email', true); | |
| 76 | 76 | |
| 77 | -	if ( false !== $contact_email && '' !== $contact_email ) { | |
| 77 | +	if (false !== $contact_email && '' !== $contact_email) { | |
| 78 | 78 | $contact_html = $before . '<a href="mailto:' . $contact_email . '">' . $contact_email . '</a>' . $after; | 
| 79 | 79 | |
| 80 | -		if ( $echo ) { | |
| 81 | - echo wp_kses_post( $contact_html ); | |
| 80 | +		if ($echo) { | |
| 81 | + echo wp_kses_post($contact_html); | |
| 82 | 82 |  		} else { | 
| 83 | 83 | return $contact_html; | 
| 84 | 84 | } | 
| @@ -96,14 +96,14 @@ discard block | ||
| 96 | 96 | * @package to-team | 
| 97 | 97 | * @subpackage template-tags | 
| 98 | 98 | */ | 
| 99 | -function lsx_to_team_contact_skype( $before = '', $after = '', $echo = true ) { | |
| 100 | - $contact_skype = get_post_meta( get_the_ID(), 'skype', true ); | |
| 99 | +function lsx_to_team_contact_skype($before = '', $after = '', $echo = true) { | |
| 100 | + $contact_skype = get_post_meta(get_the_ID(), 'skype', true); | |
| 101 | 101 | |
| 102 | -	if ( false !== $contact_skype && '' !== $contact_skype ) { | |
| 102 | +	if (false !== $contact_skype && '' !== $contact_skype) { | |
| 103 | 103 | $contact_html = $before . '<span>' . $contact_skype . '</span>' . $after; | 
| 104 | 104 | |
| 105 | -		if ( $echo ) { | |
| 106 | - echo wp_kses_post( $contact_html ); | |
| 105 | +		if ($echo) { | |
| 106 | + echo wp_kses_post($contact_html); | |
| 107 | 107 |  		} else { | 
| 108 | 108 | return $contact_html; | 
| 109 | 109 | } | 
| @@ -121,17 +121,17 @@ discard block | ||
| 121 | 121 | * @package to-team | 
| 122 | 122 | * @subpackage template-tags | 
| 123 | 123 | */ | 
| 124 | -function lsx_to_team_social_profiles( $before = '', $after = '', $echo = true ) { | |
| 125 | - $social_profiles = array( 'facebook', 'twitter', 'googleplus', 'linkedin', 'pinterest' ); | |
| 124 | +function lsx_to_team_social_profiles($before = '', $after = '', $echo = true) { | |
| 125 | +	$social_profiles = array('facebook', 'twitter', 'googleplus', 'linkedin', 'pinterest'); | |
| 126 | 126 | $social_profile_html = false; | 
| 127 | 127 | |
| 128 | -	foreach ( $social_profiles as $meta_key ) { | |
| 129 | - $meta_value = get_post_meta( get_the_ID(),$meta_key,true ); | |
| 128 | +	foreach ($social_profiles as $meta_key) { | |
| 129 | + $meta_value = get_post_meta(get_the_ID(), $meta_key, true); | |
| 130 | 130 | |
| 131 | -		if ( false !== $meta_value && '' !== $meta_value ) { | |
| 131 | +		if (false !== $meta_value && '' !== $meta_value) { | |
| 132 | 132 | $icon_class = ''; | 
| 133 | 133 | |
| 134 | -			switch ( $meta_key ) { | |
| 134 | +			switch ($meta_key) { | |
| 135 | 135 | case 'facebook': | 
| 136 | 136 | $icon_class = 'facebook'; | 
| 137 | 137 | break; | 
| @@ -159,11 +159,11 @@ discard block | ||
| 159 | 159 | } | 
| 160 | 160 | } | 
| 161 | 161 | |
| 162 | -	if ( false !== $social_profile_html && '' !== $social_profile_html ) { | |
| 162 | +	if (false !== $social_profile_html && '' !== $social_profile_html) { | |
| 163 | 163 | $social_profile_html = $before . $social_profile_html . $after; | 
| 164 | 164 | |
| 165 | -		if ( $echo ) { | |
| 166 | - echo wp_kses_post( $social_profile_html ); | |
| 165 | +		if ($echo) { | |
| 166 | + echo wp_kses_post($social_profile_html); | |
| 167 | 167 |  		} else { | 
| 168 | 168 | return $social_profile_html; | 
| 169 | 169 | } | 
| @@ -181,8 +181,8 @@ discard block | ||
| 181 | 181 | * @package to-team | 
| 182 | 182 | * @subpackage template-tags | 
| 183 | 183 | */ | 
| 184 | -function lsx_to_team_tagline( $before = '', $after = '', $echo = true ) { | |
| 185 | - lsx_to_tagline( $before,$after,$echo ); | |
| 184 | +function lsx_to_team_tagline($before = '', $after = '', $echo = true) { | |
| 185 | + lsx_to_tagline($before, $after, $echo); | |
| 186 | 186 | } | 
| 187 | 187 | |
| 188 | 188 | /** | 
| @@ -200,24 +200,24 @@ discard block | ||
| 200 | 200 | $has_team = false; | 
| 201 | 201 | |
| 202 | 202 | // Check if the team member panel has been disabled. | 
| 203 | -	if ( ! is_singular( 'team' ) && ! is_singular( 'review' ) ) { | |
| 204 | -		if ( is_object( $tour_operator ) && isset( $tour_operator->options[ $tab ] ) && is_array( $tour_operator->options[ $tab ] ) && isset( $tour_operator->options[ $tab ]['disable_team_panel'] ) ) { | |
| 203 | +	if ( ! is_singular('team') && ! is_singular('review')) { | |
| 204 | +		if (is_object($tour_operator) && isset($tour_operator->options[$tab]) && is_array($tour_operator->options[$tab]) && isset($tour_operator->options[$tab]['disable_team_panel'])) { | |
| 205 | 205 | return false; | 
| 206 | 206 | } | 
| 207 | 207 | } | 
| 208 | 208 | |
| 209 | -	if ( is_singular( 'team' ) || is_singular( 'review' ) ) { | |
| 209 | +	if (is_singular('team') || is_singular('review')) { | |
| 210 | 210 | $has_team = has_post_thumbnail(); | 
| 211 | -	} elseif ( is_tax() ) { | |
| 212 | - $has_team = lsx_to_has_custom_field_query( 'expert', get_queried_object()->term_id, true ); | |
| 211 | +	} elseif (is_tax()) { | |
| 212 | +		$has_team = lsx_to_has_custom_field_query('expert', get_queried_object()->term_id, true); | |
| 213 | 213 |  	} else { | 
| 214 | - $has_team = lsx_to_has_custom_field_query( 'team_to_' . get_post_type(), get_the_ID() ); | |
| 214 | +		$has_team = lsx_to_has_custom_field_query('team_to_' . get_post_type(), get_the_ID()); | |
| 215 | 215 | } | 
| 216 | 216 | |
| 217 | -	if ( false === $has_team ) { | |
| 218 | -		if ( is_object( $tour_operator ) && isset( $tour_operator->options[ $tab ] ) && is_array( $tour_operator->options[ $tab ] ) ) { | |
| 219 | -			foreach ( $tour_operator->options[ $tab ] as $key => $value ) { | |
| 220 | -				if ( substr( $key, 0, strlen( $start_with ) ) === $start_with ) { | |
| 217 | +	if (false === $has_team) { | |
| 218 | +		if (is_object($tour_operator) && isset($tour_operator->options[$tab]) && is_array($tour_operator->options[$tab])) { | |
| 219 | +			foreach ($tour_operator->options[$tab] as $key => $value) { | |
| 220 | +				if (substr($key, 0, strlen($start_with)) === $start_with) { | |
| 221 | 221 | $has_team = true; | 
| 222 | 222 | break; | 
| 223 | 223 | } | 
| @@ -239,49 +239,49 @@ discard block | ||
| 239 | 239 | * @subpackage template-tags | 
| 240 | 240 | * @category team | 
| 241 | 241 | */ | 
| 242 | -function lsx_to_team_member_panel( $before = '', $after = '' ) { | |
| 242 | +function lsx_to_team_member_panel($before = '', $after = '') { | |
| 243 | 243 | $team_id = false; | 
| 244 | 244 | |
| 245 | -	if ( is_tax() ) { | |
| 245 | +	if (is_tax()) { | |
| 246 | 246 | $meta_key = 'expert'; | 
| 247 | - $team_id = get_transient( get_queried_object()->term_id . '_' . $meta_key ); | |
| 247 | + $team_id = get_transient(get_queried_object()->term_id . '_' . $meta_key); | |
| 248 | 248 |  	} else { | 
| 249 | 249 | $meta_key = 'team_to_' . get_post_type(); | 
| 250 | - $team_id = get_transient( get_the_ID() . '_' . $meta_key ); | |
| 250 | + $team_id = get_transient(get_the_ID() . '_' . $meta_key); | |
| 251 | 251 | } | 
| 252 | 252 | |
| 253 | -	if ( false === $team_id ) { | |
| 253 | +	if (false === $team_id) { | |
| 254 | 254 | $tour_operator = tour_operator(); | 
| 255 | 255 | $tab = 'team'; | 
| 256 | 256 | $start_with = 'expert-'; | 
| 257 | 257 | $team_ids = array(); | 
| 258 | 258 | |
| 259 | -		if ( is_object( $tour_operator ) && isset( $tour_operator->options[ $tab ] ) && is_array( $tour_operator->options[ $tab ] ) ) { | |
| 260 | -			foreach ( $tour_operator->options[ $tab ] as $key => $value ) { | |
| 261 | -				if ( substr( $key, 0, strlen( $start_with ) ) === $start_with ) { | |
| 259 | +		if (is_object($tour_operator) && isset($tour_operator->options[$tab]) && is_array($tour_operator->options[$tab])) { | |
| 260 | +			foreach ($tour_operator->options[$tab] as $key => $value) { | |
| 261 | +				if (substr($key, 0, strlen($start_with)) === $start_with) { | |
| 262 | 262 | $team_ids[] = $value; | 
| 263 | 263 | } | 
| 264 | 264 | } | 
| 265 | 265 | } | 
| 266 | 266 | |
| 267 | -		if ( count( $team_ids ) > 0 ) { | |
| 268 | - $team_id = $team_ids[ array_rand( $team_ids ) ]; | |
| 267 | +		if (count($team_ids) > 0) { | |
| 268 | + $team_id = $team_ids[array_rand($team_ids)]; | |
| 269 | 269 | } | 
| 270 | 270 | } | 
| 271 | 271 | |
| 272 | -	if ( false !== $team_id ) { | |
| 272 | +	if (false !== $team_id) { | |
| 273 | 273 | $team_args = array( | 
| 274 | 274 | 'post_type' => 'team', | 
| 275 | 275 | 'post_status' => 'publish', | 
| 276 | 276 | 'p' => $team_id, | 
| 277 | 277 | ); | 
| 278 | 278 | |
| 279 | - $team = new WP_Query( $team_args ); | |
| 279 | + $team = new WP_Query($team_args); | |
| 280 | 280 | |
| 281 | - if ( $team->have_posts() ) : | |
| 282 | - echo wp_kses_post( $before ); | |
| 281 | + if ($team->have_posts()) : | |
| 282 | + echo wp_kses_post($before); | |
| 283 | 283 | |
| 284 | - while ( $team->have_posts() ) : | |
| 284 | + while ($team->have_posts()) : | |
| 285 | 285 | global $post; | 
| 286 | 286 | |
| 287 | 287 | $team->the_post(); | 
| @@ -289,43 +289,43 @@ discard block | ||
| 289 | 289 | $has_single = ! lsx_to_is_single_disabled(); | 
| 290 | 290 | $permalink = ''; | 
| 291 | 291 | |
| 292 | -				if ( $has_single ) { | |
| 292 | +				if ($has_single) { | |
| 293 | 293 | $permalink = get_the_permalink(); | 
| 294 | -				} elseif ( ! is_post_type_archive( 'team' ) ) { | |
| 294 | +				} elseif ( ! is_post_type_archive('team')) { | |
| 295 | 295 | $has_single = true; | 
| 296 | - $permalink = get_post_type_archive_link( 'team' ) . '#team-' . $post->post_name; | |
| 296 | +					$permalink = get_post_type_archive_link('team') . '#team-' . $post->post_name; | |
| 297 | 297 | } | 
| 298 | 298 | ?> | 
| 299 | 299 | <article <?php post_class(); ?>> | 
| 300 | 300 | <div class="lsx-to-contact-thumb"> | 
| 301 | -						<?php if ( $has_single ) { ?><a href="<?php echo esc_url( $permalink ); ?>"><?php } ?> | |
| 302 | - <?php lsx_thumbnail( 'lsx-thumbnail-square' ); ?> | |
| 303 | -						<?php if ( $has_single ) { ?></a><?php } ?> | |
| 301 | +						<?php if ($has_single) { ?><a href="<?php echo esc_url($permalink); ?>"><?php } ?> | |
| 302 | +							<?php lsx_thumbnail('lsx-thumbnail-square'); ?> | |
| 303 | +						<?php if ($has_single) { ?></a><?php } ?> | |
| 304 | 304 | </div> | 
| 305 | 305 | |
| 306 | 306 | <div class="lsx-to-contact-info"> | 
| 307 | 307 | <small class="lsx-to-contact-prefix text-center">Your travel expert:</small> | 
| 308 | 308 | |
| 309 | 309 | <h4 class="lsx-to-contact-name text-center"> | 
| 310 | -							<?php if ( $has_single ) { ?><a href="<?php echo esc_url( $permalink ); ?>"><?php } ?> | |
| 310 | +							<?php if ($has_single) { ?><a href="<?php echo esc_url($permalink); ?>"><?php } ?> | |
| 311 | 311 | <?php the_title(); ?> | 
| 312 | -							<?php if ( $has_single ) { ?></a><?php } ?> | |
| 312 | +							<?php if ($has_single) { ?></a><?php } ?> | |
| 313 | 313 | </h4> | 
| 314 | 314 | </div> | 
| 315 | 315 | |
| 316 | 316 | <div class="lsx-to-contact-meta-data text-center hidden"> | 
| 317 | 317 | <?php | 
| 318 | - lsx_to_team_contact_number( '<span class="lsx-to-meta-data contact-number"><i class="fa fa-phone orange"></i> ', '</span>' ); | |
| 319 | - lsx_to_team_contact_email( '<span class="lsx-to-meta-data email"><i class="fa fa-envelope orange"></i> ', '</span>' ); | |
| 320 | - lsx_to_team_contact_skype( '<span class="lsx-to-meta-data skype"><i class="fa fa-skype orange"></i> ', '</span>' ); | |
| 321 | - lsx_to_team_social_profiles( '<div class="lsx-to-meta-data lsx-to-contact-socials">', '</div>' ); | |
| 318 | +							lsx_to_team_contact_number('<span class="lsx-to-meta-data contact-number"><i class="fa fa-phone orange"></i> ', '</span>'); | |
| 319 | +							lsx_to_team_contact_email('<span class="lsx-to-meta-data email"><i class="fa fa-envelope orange"></i> ', '</span>'); | |
| 320 | +							lsx_to_team_contact_skype('<span class="lsx-to-meta-data skype"><i class="fa fa-skype orange"></i> ', '</span>'); | |
| 321 | +							lsx_to_team_social_profiles('<div class="lsx-to-meta-data lsx-to-contact-socials">', '</div>'); | |
| 322 | 322 | ?> | 
| 323 | 323 | </div> | 
| 324 | 324 | </article> | 
| 325 | 325 | <?php | 
| 326 | 326 | endwhile; | 
| 327 | 327 | |
| 328 | - echo wp_kses_post( $after ); | |
| 328 | + echo wp_kses_post($after); | |
| 329 | 329 | |
| 330 | 330 | wp_reset_postdata(); | 
| 331 | 331 | endif; | 
| @@ -342,17 +342,17 @@ discard block | ||
| 342 | 342 |  function lsx_to_team_accommodation() { | 
| 343 | 343 | global $lsx_to_archive; | 
| 344 | 344 | |
| 345 | -	if ( post_type_exists( 'accommodation' ) && is_singular( 'team' ) ) { | |
| 345 | +	if (post_type_exists('accommodation') && is_singular('team')) { | |
| 346 | 346 | $args = array( | 
| 347 | 347 | 'from' => 'accommodation', | 
| 348 | 348 | 'to' => 'team', | 
| 349 | 349 | 'column' => '3', | 
| 350 | 350 | // @codingStandardsIgnoreLine | 
| 351 | - 'before' => '<section id="accommodation" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-accommodation">' . __( lsx_to_get_post_type_section_title( 'accommodation', '', 'Featured Accommodations' ), 'to-team' ) . '</h2><div id="collapse-accommodation" class="collapse in"><div class="collapse-inner">', | |
| 351 | +			'before'	=> '<section id="accommodation" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-accommodation">' . __(lsx_to_get_post_type_section_title('accommodation', '', 'Featured Accommodations'), 'to-team') . '</h2><div id="collapse-accommodation" class="collapse in"><div class="collapse-inner">', | |
| 352 | 352 | 'after' => '</div></div></section>', | 
| 353 | 353 | ); | 
| 354 | 354 | |
| 355 | - lsx_to_connected_panel_query( $args ); | |
| 355 | + lsx_to_connected_panel_query($args); | |
| 356 | 356 | } | 
| 357 | 357 | } | 
| 358 | 358 | |
| @@ -366,17 +366,17 @@ discard block | ||
| 366 | 366 |  function lsx_to_team_destination() { | 
| 367 | 367 | global $lsx_to_archive; | 
| 368 | 368 | |
| 369 | -	if ( post_type_exists( 'destination' ) && is_singular( 'team' ) ) { | |
| 369 | +	if (post_type_exists('destination') && is_singular('team')) { | |
| 370 | 370 | $args = array( | 
| 371 | 371 | 'from' => 'destination', | 
| 372 | 372 | 'to' => 'team', | 
| 373 | 373 | 'column' => '3', | 
| 374 | 374 | // @codingStandardsIgnoreLine | 
| 375 | - 'before' => '<section id="destination" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-destination">' . __( lsx_to_get_post_type_section_title( 'destination', '', 'Featured Destinations' ), 'to-team' ) . '</h2><div id="collapse-destination" class="collapse in"><div class="collapse-inner">', | |
| 375 | +			'before' => '<section id="destination" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-destination">' . __(lsx_to_get_post_type_section_title('destination', '', 'Featured Destinations'), 'to-team') . '</h2><div id="collapse-destination" class="collapse in"><div class="collapse-inner">', | |
| 376 | 376 | 'after' => '</div></div></section>', | 
| 377 | 377 | ); | 
| 378 | 378 | |
| 379 | - lsx_to_connected_panel_query( $args ); | |
| 379 | + lsx_to_connected_panel_query($args); | |
| 380 | 380 | } | 
| 381 | 381 | } | 
| 382 | 382 | |
| @@ -390,17 +390,17 @@ discard block | ||
| 390 | 390 |  function lsx_to_team_tours() { | 
| 391 | 391 | global $lsx_to_archive; | 
| 392 | 392 | |
| 393 | -	if ( post_type_exists( 'tour' ) && is_singular( 'team' ) ) { | |
| 393 | +	if (post_type_exists('tour') && is_singular('team')) { | |
| 394 | 394 | $args = array( | 
| 395 | 395 | 'from' => 'tour', | 
| 396 | 396 | 'to' => 'team', | 
| 397 | 397 | 'column' => '3', | 
| 398 | 398 | // @codingStandardsIgnoreLine | 
| 399 | - 'before' => '<section id="tours" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-tours">' . __( lsx_to_get_post_type_section_title( 'tour', '', 'Featured Tours' ), 'to-team' ) . '</h2><div id="collapse-tours" class="collapse in"><div class="collapse-inner">', | |
| 399 | +			'before'	=> '<section id="tours" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-tours">' . __(lsx_to_get_post_type_section_title('tour', '', 'Featured Tours'), 'to-team') . '</h2><div id="collapse-tours" class="collapse in"><div class="collapse-inner">', | |
| 400 | 400 | 'after' => '</div></div></section>', | 
| 401 | 401 | ); | 
| 402 | 402 | |
| 403 | - lsx_to_connected_panel_query( $args ); | |
| 403 | + lsx_to_connected_panel_query($args); | |
| 404 | 404 | } | 
| 405 | 405 | } | 
| 406 | 406 | |
| @@ -414,17 +414,17 @@ discard block | ||
| 414 | 414 |  function lsx_to_team_reviews() { | 
| 415 | 415 | global $lsx_to_archive; | 
| 416 | 416 | |
| 417 | -	if ( post_type_exists( 'review' ) && is_singular( 'team' ) ) { | |
| 417 | +	if (post_type_exists('review') && is_singular('team')) { | |
| 418 | 418 | $args = array( | 
| 419 | 419 | 'from' => 'review', | 
| 420 | 420 | 'to' => 'team', | 
| 421 | 421 | 'column' => '2', | 
| 422 | 422 | // @codingStandardsIgnoreLine | 
| 423 | - 'before' => '<section id="reviews" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-reviews">' . __( lsx_to_get_post_type_section_title( 'review', '', 'Featured Reviews' ), 'to-team' ) . '</h2><div id="collapse-reviews" class="collapse in"><div class="collapse-inner">', | |
| 423 | +			'before'	=> '<section id="reviews" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-reviews">' . __(lsx_to_get_post_type_section_title('review', '', 'Featured Reviews'), 'to-team') . '</h2><div id="collapse-reviews" class="collapse in"><div class="collapse-inner">', | |
| 424 | 424 | 'after' => '</div></div></section>', | 
| 425 | 425 | ); | 
| 426 | 426 | |
| 427 | - lsx_to_connected_panel_query( $args ); | |
| 427 | + lsx_to_connected_panel_query($args); | |
| 428 | 428 | } | 
| 429 | 429 | } | 
| 430 | 430 | |
| @@ -440,8 +440,8 @@ discard block | ||
| 440 | 440 | * @subpackage template-tags | 
| 441 | 441 | * @category connections | 
| 442 | 442 | */ | 
| 443 | -function lsx_to_connected_team( $before = '', $after = '', $echo = true ) { | |
| 444 | - lsx_to_connected_items_query( 'team', get_post_type(), $before, $after, $echo ); | |
| 443 | +function lsx_to_connected_team($before = '', $after = '', $echo = true) { | |
| 444 | +	lsx_to_connected_items_query('team', get_post_type(), $before, $after, $echo); | |
| 445 | 445 | } | 
| 446 | 446 | |
| 447 | 447 | /** | 
| @@ -454,16 +454,16 @@ discard block | ||
| 454 | 454 |  function lsx_to_team_posts() { | 
| 455 | 455 | //$site_user = get_post_meta( get_the_ID(), 'site_user', true ); | 
| 456 | 456 | |
| 457 | -	if ( post_type_exists( 'post' ) && is_singular( 'team' ) ) { | |
| 457 | +	if (post_type_exists('post') && is_singular('team')) { | |
| 458 | 458 | $args = array( | 
| 459 | 459 | 'from' => 'post', | 
| 460 | 460 | 'to' => 'team', | 
| 461 | 461 | 'column' => '3', | 
| 462 | 462 | // @codingStandardsIgnoreLine | 
| 463 | - 'before' => '<section id="posts" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-posts">' . __( lsx_to_get_post_type_section_title( 'post', '', 'Featured Posts' ), 'to-team' ) . '</h2><div id="collapse-posts" class="collapse in"><div class="collapse-inner">', | |
| 463 | +			'before'	=> '<section id="posts" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-posts">' . __(lsx_to_get_post_type_section_title('post', '', 'Featured Posts'), 'to-team') . '</h2><div id="collapse-posts" class="collapse in"><div class="collapse-inner">', | |
| 464 | 464 | 'after' => '</div></div></section>', | 
| 465 | 465 | ); | 
| 466 | 466 | |
| 467 | - lsx_to_connected_panel_query( $args ); | |
| 467 | + lsx_to_connected_panel_query($args); | |
| 468 | 468 | } | 
| 469 | 469 | } | 
| @@ -17,7 +17,7 @@ discard block | ||
| 17 | 17 | * @category content | 
| 18 | 18 | */ | 
| 19 | 19 |  function lsx_to_team_content( $slug, $name = null ) { | 
| 20 | - do_action( 'lsx_to_team_content',$slug, $name ); | |
| 20 | + do_action( 'lsx_to_team_content',$slug, $name ); | |
| 21 | 21 | } | 
| 22 | 22 | |
| 23 | 23 | /** | 
| @@ -32,7 +32,7 @@ discard block | ||
| 32 | 32 | * @subpackage template-tags | 
| 33 | 33 | */ | 
| 34 | 34 |  function lsx_to_team_role( $before = '', $after = '', $echo = true ) { | 
| 35 | - lsx_to_custom_field_query( 'role',$before,$after,$echo ); | |
| 35 | + lsx_to_custom_field_query( 'role',$before,$after,$echo ); | |
| 36 | 36 | } | 
| 37 | 37 | |
| 38 | 38 | /** | 
| @@ -47,17 +47,17 @@ discard block | ||
| 47 | 47 | * @subpackage template-tags | 
| 48 | 48 | */ | 
| 49 | 49 |  function lsx_to_team_contact_number( $before = '', $after = '', $echo = true ) { | 
| 50 | - $contact_number = get_post_meta( get_the_ID(), 'contact_number', true ); | |
| 50 | + $contact_number = get_post_meta( get_the_ID(), 'contact_number', true ); | |
| 51 | 51 | |
| 52 | -	if ( false !== $contact_number && '' !== $contact_number ) { | |
| 53 | - $contact_html = $before . '<a href="tel:+' . $contact_number . '">' . $contact_number . '</a>' . $after; | |
| 52 | +     if ( false !== $contact_number && '' !== $contact_number ) { | |
| 53 | + $contact_html = $before . '<a href="tel:+' . $contact_number . '">' . $contact_number . '</a>' . $after; | |
| 54 | 54 | |
| 55 | -		if ( $echo ) { | |
| 56 | - echo wp_kses_post( $contact_html ); | |
| 57 | -		} else { | |
| 58 | - return $contact_html; | |
| 59 | - } | |
| 60 | - } | |
| 55 | +          if ( $echo ) { | |
| 56 | + echo wp_kses_post( $contact_html ); | |
| 57 | +          } else { | |
| 58 | + return $contact_html; | |
| 59 | + } | |
| 60 | + } | |
| 61 | 61 | } | 
| 62 | 62 | |
| 63 | 63 | /** | 
| @@ -72,17 +72,17 @@ discard block | ||
| 72 | 72 | * @subpackage template-tags | 
| 73 | 73 | */ | 
| 74 | 74 |  function lsx_to_team_contact_email( $before = '', $after = '', $echo = true ) { | 
| 75 | - $contact_email = get_post_meta( get_the_ID(), 'contact_email', true ); | |
| 75 | + $contact_email = get_post_meta( get_the_ID(), 'contact_email', true ); | |
| 76 | 76 | |
| 77 | -	if ( false !== $contact_email && '' !== $contact_email ) { | |
| 78 | - $contact_html = $before . '<a href="mailto:' . $contact_email . '">' . $contact_email . '</a>' . $after; | |
| 77 | +     if ( false !== $contact_email && '' !== $contact_email ) { | |
| 78 | + $contact_html = $before . '<a href="mailto:' . $contact_email . '">' . $contact_email . '</a>' . $after; | |
| 79 | 79 | |
| 80 | -		if ( $echo ) { | |
| 81 | - echo wp_kses_post( $contact_html ); | |
| 82 | -		} else { | |
| 83 | - return $contact_html; | |
| 84 | - } | |
| 85 | - } | |
| 80 | +          if ( $echo ) { | |
| 81 | + echo wp_kses_post( $contact_html ); | |
| 82 | +          } else { | |
| 83 | + return $contact_html; | |
| 84 | + } | |
| 85 | + } | |
| 86 | 86 | } | 
| 87 | 87 | |
| 88 | 88 | /** | 
| @@ -97,17 +97,17 @@ discard block | ||
| 97 | 97 | * @subpackage template-tags | 
| 98 | 98 | */ | 
| 99 | 99 |  function lsx_to_team_contact_skype( $before = '', $after = '', $echo = true ) { | 
| 100 | - $contact_skype = get_post_meta( get_the_ID(), 'skype', true ); | |
| 100 | + $contact_skype = get_post_meta( get_the_ID(), 'skype', true ); | |
| 101 | 101 | |
| 102 | -	if ( false !== $contact_skype && '' !== $contact_skype ) { | |
| 103 | - $contact_html = $before . '<span>' . $contact_skype . '</span>' . $after; | |
| 102 | +     if ( false !== $contact_skype && '' !== $contact_skype ) { | |
| 103 | + $contact_html = $before . '<span>' . $contact_skype . '</span>' . $after; | |
| 104 | 104 | |
| 105 | -		if ( $echo ) { | |
| 106 | - echo wp_kses_post( $contact_html ); | |
| 107 | -		} else { | |
| 108 | - return $contact_html; | |
| 109 | - } | |
| 110 | - } | |
| 105 | +          if ( $echo ) { | |
| 106 | + echo wp_kses_post( $contact_html ); | |
| 107 | +          } else { | |
| 108 | + return $contact_html; | |
| 109 | + } | |
| 110 | + } | |
| 111 | 111 | } | 
| 112 | 112 | |
| 113 | 113 | /** | 
| @@ -122,52 +122,52 @@ discard block | ||
| 122 | 122 | * @subpackage template-tags | 
| 123 | 123 | */ | 
| 124 | 124 |  function lsx_to_team_social_profiles( $before = '', $after = '', $echo = true ) { | 
| 125 | - $social_profiles = array( 'facebook', 'twitter', 'googleplus', 'linkedin', 'pinterest' ); | |
| 126 | - $social_profile_html = false; | |
| 125 | + $social_profiles = array( 'facebook', 'twitter', 'googleplus', 'linkedin', 'pinterest' ); | |
| 126 | + $social_profile_html = false; | |
| 127 | 127 | |
| 128 | -	foreach ( $social_profiles as $meta_key ) { | |
| 129 | - $meta_value = get_post_meta( get_the_ID(),$meta_key,true ); | |
| 128 | +     foreach ( $social_profiles as $meta_key ) { | |
| 129 | + $meta_value = get_post_meta( get_the_ID(),$meta_key,true ); | |
| 130 | 130 | |
| 131 | -		if ( false !== $meta_value && '' !== $meta_value ) { | |
| 132 | - $icon_class = ''; | |
| 131 | +          if ( false !== $meta_value && '' !== $meta_value ) { | |
| 132 | + $icon_class = ''; | |
| 133 | 133 | |
| 134 | -			switch ( $meta_key ) { | |
| 135 | - case 'facebook': | |
| 136 | - $icon_class = 'facebook'; | |
| 137 | - break; | |
| 134 | +               switch ( $meta_key ) { | |
| 135 | + case 'facebook': | |
| 136 | + $icon_class = 'facebook'; | |
| 137 | + break; | |
| 138 | 138 | |
| 139 | - case 'twitter': | |
| 140 | - $icon_class = 'twitter'; | |
| 141 | - break; | |
| 139 | + case 'twitter': | |
| 140 | + $icon_class = 'twitter'; | |
| 141 | + break; | |
| 142 | 142 | |
| 143 | - case 'googleplus': | |
| 144 | - $icon_class = 'google-plus'; | |
| 145 | - break; | |
| 143 | + case 'googleplus': | |
| 144 | + $icon_class = 'google-plus'; | |
| 145 | + break; | |
| 146 | 146 | |
| 147 | - case 'linkedin': | |
| 148 | - $icon_class = 'linkedin'; | |
| 149 | - break; | |
| 147 | + case 'linkedin': | |
| 148 | + $icon_class = 'linkedin'; | |
| 149 | + break; | |
| 150 | 150 | |
| 151 | - case 'pinterest': | |
| 152 | - $icon_class = 'pinterest-p'; | |
| 151 | + case 'pinterest': | |
| 152 | + $icon_class = 'pinterest-p'; | |
| 153 | 153 | |
| 154 | - default: | |
| 155 | - break; | |
| 156 | - } | |
| 154 | + default: | |
| 155 | + break; | |
| 156 | + } | |
| 157 | 157 | |
| 158 | - $social_profile_html .= '<a target="_blank" rel="noopener noreferrer" href="' . $meta_value . '"><i class="fa fa-' . $icon_class . '" aria-hidden="true"></i></a>'; | |
| 159 | - } | |
| 160 | - } | |
| 158 | + $social_profile_html .= '<a target="_blank" rel="noopener noreferrer" href="' . $meta_value . '"><i class="fa fa-' . $icon_class . '" aria-hidden="true"></i></a>'; | |
| 159 | + } | |
| 160 | + } | |
| 161 | 161 | |
| 162 | -	if ( false !== $social_profile_html && '' !== $social_profile_html ) { | |
| 163 | - $social_profile_html = $before . $social_profile_html . $after; | |
| 162 | +     if ( false !== $social_profile_html && '' !== $social_profile_html ) { | |
| 163 | + $social_profile_html = $before . $social_profile_html . $after; | |
| 164 | 164 | |
| 165 | -		if ( $echo ) { | |
| 166 | - echo wp_kses_post( $social_profile_html ); | |
| 167 | -		} else { | |
| 168 | - return $social_profile_html; | |
| 169 | - } | |
| 170 | - } | |
| 165 | +          if ( $echo ) { | |
| 166 | + echo wp_kses_post( $social_profile_html ); | |
| 167 | +          } else { | |
| 168 | + return $social_profile_html; | |
| 169 | + } | |
| 170 | + } | |
| 171 | 171 | } | 
| 172 | 172 | |
| 173 | 173 | /** | 
| @@ -182,7 +182,7 @@ discard block | ||
| 182 | 182 | * @subpackage template-tags | 
| 183 | 183 | */ | 
| 184 | 184 |  function lsx_to_team_tagline( $before = '', $after = '', $echo = true ) { | 
| 185 | - lsx_to_tagline( $before,$after,$echo ); | |
| 185 | + lsx_to_tagline( $before,$after,$echo ); | |
| 186 | 186 | } | 
| 187 | 187 | |
| 188 | 188 | /** | 
| @@ -194,37 +194,37 @@ discard block | ||
| 194 | 194 | * @category team | 
| 195 | 195 | */ | 
| 196 | 196 |  function lsx_to_has_team_member() { | 
| 197 | - $tour_operator = tour_operator(); | |
| 198 | - $tab = 'team'; | |
| 199 | - $start_with = 'expert-'; | |
| 200 | - $has_team = false; | |
| 201 | - | |
| 202 | - // Check if the team member panel has been disabled. | |
| 203 | -	if ( ! is_singular( 'team' ) && ! is_singular( 'review' ) ) { | |
| 204 | -		if ( is_object( $tour_operator ) && isset( $tour_operator->options[ $tab ] ) && is_array( $tour_operator->options[ $tab ] ) && isset( $tour_operator->options[ $tab ]['disable_team_panel'] ) ) { | |
| 205 | - return false; | |
| 206 | - } | |
| 207 | - } | |
| 208 | - | |
| 209 | -	if ( is_singular( 'team' ) || is_singular( 'review' ) ) { | |
| 210 | - $has_team = has_post_thumbnail(); | |
| 211 | -	} elseif ( is_tax() ) { | |
| 212 | - $has_team = lsx_to_has_custom_field_query( 'expert', get_queried_object()->term_id, true ); | |
| 213 | -	} else { | |
| 214 | - $has_team = lsx_to_has_custom_field_query( 'team_to_' . get_post_type(), get_the_ID() ); | |
| 215 | - } | |
| 216 | - | |
| 217 | -	if ( false === $has_team ) { | |
| 218 | -		if ( is_object( $tour_operator ) && isset( $tour_operator->options[ $tab ] ) && is_array( $tour_operator->options[ $tab ] ) ) { | |
| 219 | -			foreach ( $tour_operator->options[ $tab ] as $key => $value ) { | |
| 220 | -				if ( substr( $key, 0, strlen( $start_with ) ) === $start_with ) { | |
| 221 | - $has_team = true; | |
| 222 | - break; | |
| 223 | - } | |
| 224 | - } | |
| 225 | - } | |
| 226 | - } | |
| 227 | - return $has_team; | |
| 197 | + $tour_operator = tour_operator(); | |
| 198 | + $tab = 'team'; | |
| 199 | + $start_with = 'expert-'; | |
| 200 | + $has_team = false; | |
| 201 | + | |
| 202 | + // Check if the team member panel has been disabled. | |
| 203 | +     if ( ! is_singular( 'team' ) && ! is_singular( 'review' ) ) { | |
| 204 | +          if ( is_object( $tour_operator ) && isset( $tour_operator->options[ $tab ] ) && is_array( $tour_operator->options[ $tab ] ) && isset( $tour_operator->options[ $tab ]['disable_team_panel'] ) ) { | |
| 205 | + return false; | |
| 206 | + } | |
| 207 | + } | |
| 208 | + | |
| 209 | +     if ( is_singular( 'team' ) || is_singular( 'review' ) ) { | |
| 210 | + $has_team = has_post_thumbnail(); | |
| 211 | +     } elseif ( is_tax() ) { | |
| 212 | + $has_team = lsx_to_has_custom_field_query( 'expert', get_queried_object()->term_id, true ); | |
| 213 | +     } else { | |
| 214 | + $has_team = lsx_to_has_custom_field_query( 'team_to_' . get_post_type(), get_the_ID() ); | |
| 215 | + } | |
| 216 | + | |
| 217 | +     if ( false === $has_team ) { | |
| 218 | +          if ( is_object( $tour_operator ) && isset( $tour_operator->options[ $tab ] ) && is_array( $tour_operator->options[ $tab ] ) ) { | |
| 219 | +               foreach ( $tour_operator->options[ $tab ] as $key => $value ) { | |
| 220 | +                    if ( substr( $key, 0, strlen( $start_with ) ) === $start_with ) { | |
| 221 | + $has_team = true; | |
| 222 | + break; | |
| 223 | + } | |
| 224 | + } | |
| 225 | + } | |
| 226 | + } | |
| 227 | + return $has_team; | |
| 228 | 228 | } | 
| 229 | 229 | |
| 230 | 230 | /** | 
| @@ -240,62 +240,62 @@ discard block | ||
| 240 | 240 | * @category team | 
| 241 | 241 | */ | 
| 242 | 242 |  function lsx_to_team_member_panel( $before = '', $after = '' ) { | 
| 243 | - $team_id = false; | |
| 244 | - | |
| 245 | -	if ( is_tax() ) { | |
| 246 | - $meta_key = 'expert'; | |
| 247 | - $team_id = get_transient( get_queried_object()->term_id . '_' . $meta_key ); | |
| 248 | -	} else { | |
| 249 | - $meta_key = 'team_to_' . get_post_type(); | |
| 250 | - $team_id = get_transient( get_the_ID() . '_' . $meta_key ); | |
| 251 | - } | |
| 252 | - | |
| 253 | -	if ( false === $team_id ) { | |
| 254 | - $tour_operator = tour_operator(); | |
| 255 | - $tab = 'team'; | |
| 256 | - $start_with = 'expert-'; | |
| 257 | - $team_ids = array(); | |
| 258 | - | |
| 259 | -		if ( is_object( $tour_operator ) && isset( $tour_operator->options[ $tab ] ) && is_array( $tour_operator->options[ $tab ] ) ) { | |
| 260 | -			foreach ( $tour_operator->options[ $tab ] as $key => $value ) { | |
| 261 | -				if ( substr( $key, 0, strlen( $start_with ) ) === $start_with ) { | |
| 262 | - $team_ids[] = $value; | |
| 263 | - } | |
| 264 | - } | |
| 265 | - } | |
| 266 | - | |
| 267 | -		if ( count( $team_ids ) > 0 ) { | |
| 268 | - $team_id = $team_ids[ array_rand( $team_ids ) ]; | |
| 269 | - } | |
| 270 | - } | |
| 271 | - | |
| 272 | -	if ( false !== $team_id ) { | |
| 273 | - $team_args = array( | |
| 274 | - 'post_type' => 'team', | |
| 275 | - 'post_status' => 'publish', | |
| 276 | - 'p' => $team_id, | |
| 277 | - ); | |
| 278 | - | |
| 279 | - $team = new WP_Query( $team_args ); | |
| 280 | - | |
| 281 | - if ( $team->have_posts() ) : | |
| 282 | - echo wp_kses_post( $before ); | |
| 283 | - | |
| 284 | - while ( $team->have_posts() ) : | |
| 285 | - global $post; | |
| 286 | - | |
| 287 | - $team->the_post(); | |
| 288 | - | |
| 289 | - $has_single = ! lsx_to_is_single_disabled(); | |
| 290 | - $permalink = ''; | |
| 291 | - | |
| 292 | -				if ( $has_single ) { | |
| 293 | - $permalink = get_the_permalink(); | |
| 294 | -				} elseif ( ! is_post_type_archive( 'team' ) ) { | |
| 295 | - $has_single = true; | |
| 296 | - $permalink = get_post_type_archive_link( 'team' ) . '#team-' . $post->post_name; | |
| 297 | - } | |
| 298 | - ?> | |
| 243 | + $team_id = false; | |
| 244 | + | |
| 245 | +     if ( is_tax() ) { | |
| 246 | + $meta_key = 'expert'; | |
| 247 | + $team_id = get_transient( get_queried_object()->term_id . '_' . $meta_key ); | |
| 248 | +     } else { | |
| 249 | + $meta_key = 'team_to_' . get_post_type(); | |
| 250 | + $team_id = get_transient( get_the_ID() . '_' . $meta_key ); | |
| 251 | + } | |
| 252 | + | |
| 253 | +     if ( false === $team_id ) { | |
| 254 | + $tour_operator = tour_operator(); | |
| 255 | + $tab = 'team'; | |
| 256 | + $start_with = 'expert-'; | |
| 257 | + $team_ids = array(); | |
| 258 | + | |
| 259 | +          if ( is_object( $tour_operator ) && isset( $tour_operator->options[ $tab ] ) && is_array( $tour_operator->options[ $tab ] ) ) { | |
| 260 | +               foreach ( $tour_operator->options[ $tab ] as $key => $value ) { | |
| 261 | +                    if ( substr( $key, 0, strlen( $start_with ) ) === $start_with ) { | |
| 262 | + $team_ids[] = $value; | |
| 263 | + } | |
| 264 | + } | |
| 265 | + } | |
| 266 | + | |
| 267 | +          if ( count( $team_ids ) > 0 ) { | |
| 268 | + $team_id = $team_ids[ array_rand( $team_ids ) ]; | |
| 269 | + } | |
| 270 | + } | |
| 271 | + | |
| 272 | +     if ( false !== $team_id ) { | |
| 273 | + $team_args = array( | |
| 274 | + 'post_type' => 'team', | |
| 275 | + 'post_status' => 'publish', | |
| 276 | + 'p' => $team_id, | |
| 277 | + ); | |
| 278 | + | |
| 279 | + $team = new WP_Query( $team_args ); | |
| 280 | + | |
| 281 | + if ( $team->have_posts() ) : | |
| 282 | + echo wp_kses_post( $before ); | |
| 283 | + | |
| 284 | + while ( $team->have_posts() ) : | |
| 285 | + global $post; | |
| 286 | + | |
| 287 | + $team->the_post(); | |
| 288 | + | |
| 289 | + $has_single = ! lsx_to_is_single_disabled(); | |
| 290 | + $permalink = ''; | |
| 291 | + | |
| 292 | +                    if ( $has_single ) { | |
| 293 | + $permalink = get_the_permalink(); | |
| 294 | +                    } elseif ( ! is_post_type_archive( 'team' ) ) { | |
| 295 | + $has_single = true; | |
| 296 | + $permalink = get_post_type_archive_link( 'team' ) . '#team-' . $post->post_name; | |
| 297 | + } | |
| 298 | + ?> | |
| 299 | 299 | <article <?php post_class(); ?>> | 
| 300 | 300 | <div class="lsx-to-contact-thumb"> | 
| 301 | 301 |  						<?php if ( $has_single ) { ?><a href="<?php echo esc_url( $permalink ); ?>"><?php } ?> | 
| @@ -315,21 +315,21 @@ discard block | ||
| 315 | 315 | |
| 316 | 316 | <div class="lsx-to-contact-meta-data text-center hidden"> | 
| 317 | 317 | <?php | 
| 318 | - lsx_to_team_contact_number( '<span class="lsx-to-meta-data contact-number"><i class="fa fa-phone orange"></i> ', '</span>' ); | |
| 319 | - lsx_to_team_contact_email( '<span class="lsx-to-meta-data email"><i class="fa fa-envelope orange"></i> ', '</span>' ); | |
| 320 | - lsx_to_team_contact_skype( '<span class="lsx-to-meta-data skype"><i class="fa fa-skype orange"></i> ', '</span>' ); | |
| 321 | - lsx_to_team_social_profiles( '<div class="lsx-to-meta-data lsx-to-contact-socials">', '</div>' ); | |
| 322 | - ?> | |
| 318 | + lsx_to_team_contact_number( '<span class="lsx-to-meta-data contact-number"><i class="fa fa-phone orange"></i> ', '</span>' ); | |
| 319 | + lsx_to_team_contact_email( '<span class="lsx-to-meta-data email"><i class="fa fa-envelope orange"></i> ', '</span>' ); | |
| 320 | + lsx_to_team_contact_skype( '<span class="lsx-to-meta-data skype"><i class="fa fa-skype orange"></i> ', '</span>' ); | |
| 321 | + lsx_to_team_social_profiles( '<div class="lsx-to-meta-data lsx-to-contact-socials">', '</div>' ); | |
| 322 | + ?> | |
| 323 | 323 | </div> | 
| 324 | 324 | </article> | 
| 325 | 325 | <?php | 
| 326 | - endwhile; | |
| 326 | + endwhile; | |
| 327 | 327 | |
| 328 | - echo wp_kses_post( $after ); | |
| 328 | + echo wp_kses_post( $after ); | |
| 329 | 329 | |
| 330 | - wp_reset_postdata(); | |
| 331 | - endif; | |
| 332 | - } | |
| 330 | + wp_reset_postdata(); | |
| 331 | + endif; | |
| 332 | + } | |
| 333 | 333 | } | 
| 334 | 334 | |
| 335 | 335 | /** | 
| @@ -340,20 +340,20 @@ discard block | ||
| 340 | 340 | * @category team | 
| 341 | 341 | */ | 
| 342 | 342 |  function lsx_to_team_accommodation() { | 
| 343 | - global $lsx_to_archive; | |
| 344 | - | |
| 345 | -	if ( post_type_exists( 'accommodation' ) && is_singular( 'team' ) ) { | |
| 346 | - $args = array( | |
| 347 | - 'from' => 'accommodation', | |
| 348 | - 'to' => 'team', | |
| 349 | - 'column' => '3', | |
| 350 | - // @codingStandardsIgnoreLine | |
| 351 | - 'before' => '<section id="accommodation" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-accommodation">' . __( lsx_to_get_post_type_section_title( 'accommodation', '', 'Featured Accommodations' ), 'to-team' ) . '</h2><div id="collapse-accommodation" class="collapse in"><div class="collapse-inner">', | |
| 352 | - 'after' => '</div></div></section>', | |
| 353 | - ); | |
| 354 | - | |
| 355 | - lsx_to_connected_panel_query( $args ); | |
| 356 | - } | |
| 343 | + global $lsx_to_archive; | |
| 344 | + | |
| 345 | +     if ( post_type_exists( 'accommodation' ) && is_singular( 'team' ) ) { | |
| 346 | + $args = array( | |
| 347 | + 'from' => 'accommodation', | |
| 348 | + 'to' => 'team', | |
| 349 | + 'column' => '3', | |
| 350 | + // @codingStandardsIgnoreLine | |
| 351 | + 'before' => '<section id="accommodation" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-accommodation">' . __( lsx_to_get_post_type_section_title( 'accommodation', '', 'Featured Accommodations' ), 'to-team' ) . '</h2><div id="collapse-accommodation" class="collapse in"><div class="collapse-inner">', | |
| 352 | + 'after' => '</div></div></section>', | |
| 353 | + ); | |
| 354 | + | |
| 355 | + lsx_to_connected_panel_query( $args ); | |
| 356 | + } | |
| 357 | 357 | } | 
| 358 | 358 | |
| 359 | 359 | /** | 
| @@ -364,20 +364,20 @@ discard block | ||
| 364 | 364 | * @category team | 
| 365 | 365 | */ | 
| 366 | 366 |  function lsx_to_team_destination() { | 
| 367 | - global $lsx_to_archive; | |
| 368 | - | |
| 369 | -	if ( post_type_exists( 'destination' ) && is_singular( 'team' ) ) { | |
| 370 | - $args = array( | |
| 371 | - 'from' => 'destination', | |
| 372 | - 'to' => 'team', | |
| 373 | - 'column' => '3', | |
| 374 | - // @codingStandardsIgnoreLine | |
| 375 | - 'before' => '<section id="destination" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-destination">' . __( lsx_to_get_post_type_section_title( 'destination', '', 'Featured Destinations' ), 'to-team' ) . '</h2><div id="collapse-destination" class="collapse in"><div class="collapse-inner">', | |
| 376 | - 'after' => '</div></div></section>', | |
| 377 | - ); | |
| 378 | - | |
| 379 | - lsx_to_connected_panel_query( $args ); | |
| 380 | - } | |
| 367 | + global $lsx_to_archive; | |
| 368 | + | |
| 369 | +     if ( post_type_exists( 'destination' ) && is_singular( 'team' ) ) { | |
| 370 | + $args = array( | |
| 371 | + 'from' => 'destination', | |
| 372 | + 'to' => 'team', | |
| 373 | + 'column' => '3', | |
| 374 | + // @codingStandardsIgnoreLine | |
| 375 | + 'before' => '<section id="destination" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-destination">' . __( lsx_to_get_post_type_section_title( 'destination', '', 'Featured Destinations' ), 'to-team' ) . '</h2><div id="collapse-destination" class="collapse in"><div class="collapse-inner">', | |
| 376 | + 'after' => '</div></div></section>', | |
| 377 | + ); | |
| 378 | + | |
| 379 | + lsx_to_connected_panel_query( $args ); | |
| 380 | + } | |
| 381 | 381 | } | 
| 382 | 382 | |
| 383 | 383 | /** | 
| @@ -388,20 +388,20 @@ discard block | ||
| 388 | 388 | * @category team | 
| 389 | 389 | */ | 
| 390 | 390 |  function lsx_to_team_tours() { | 
| 391 | - global $lsx_to_archive; | |
| 392 | - | |
| 393 | -	if ( post_type_exists( 'tour' ) && is_singular( 'team' ) ) { | |
| 394 | - $args = array( | |
| 395 | - 'from' => 'tour', | |
| 396 | - 'to' => 'team', | |
| 397 | - 'column' => '3', | |
| 398 | - // @codingStandardsIgnoreLine | |
| 399 | - 'before' => '<section id="tours" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-tours">' . __( lsx_to_get_post_type_section_title( 'tour', '', 'Featured Tours' ), 'to-team' ) . '</h2><div id="collapse-tours" class="collapse in"><div class="collapse-inner">', | |
| 400 | - 'after' => '</div></div></section>', | |
| 401 | - ); | |
| 402 | - | |
| 403 | - lsx_to_connected_panel_query( $args ); | |
| 404 | - } | |
| 391 | + global $lsx_to_archive; | |
| 392 | + | |
| 393 | +     if ( post_type_exists( 'tour' ) && is_singular( 'team' ) ) { | |
| 394 | + $args = array( | |
| 395 | + 'from' => 'tour', | |
| 396 | + 'to' => 'team', | |
| 397 | + 'column' => '3', | |
| 398 | + // @codingStandardsIgnoreLine | |
| 399 | + 'before' => '<section id="tours" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-tours">' . __( lsx_to_get_post_type_section_title( 'tour', '', 'Featured Tours' ), 'to-team' ) . '</h2><div id="collapse-tours" class="collapse in"><div class="collapse-inner">', | |
| 400 | + 'after' => '</div></div></section>', | |
| 401 | + ); | |
| 402 | + | |
| 403 | + lsx_to_connected_panel_query( $args ); | |
| 404 | + } | |
| 405 | 405 | } | 
| 406 | 406 | |
| 407 | 407 | /** | 
| @@ -412,20 +412,20 @@ discard block | ||
| 412 | 412 | * @category team | 
| 413 | 413 | */ | 
| 414 | 414 |  function lsx_to_team_reviews() { | 
| 415 | - global $lsx_to_archive; | |
| 416 | - | |
| 417 | -	if ( post_type_exists( 'review' ) && is_singular( 'team' ) ) { | |
| 418 | - $args = array( | |
| 419 | - 'from' => 'review', | |
| 420 | - 'to' => 'team', | |
| 421 | - 'column' => '2', | |
| 422 | - // @codingStandardsIgnoreLine | |
| 423 | - 'before' => '<section id="reviews" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-reviews">' . __( lsx_to_get_post_type_section_title( 'review', '', 'Featured Reviews' ), 'to-team' ) . '</h2><div id="collapse-reviews" class="collapse in"><div class="collapse-inner">', | |
| 424 | - 'after' => '</div></div></section>', | |
| 425 | - ); | |
| 426 | - | |
| 427 | - lsx_to_connected_panel_query( $args ); | |
| 428 | - } | |
| 415 | + global $lsx_to_archive; | |
| 416 | + | |
| 417 | +     if ( post_type_exists( 'review' ) && is_singular( 'team' ) ) { | |
| 418 | + $args = array( | |
| 419 | + 'from' => 'review', | |
| 420 | + 'to' => 'team', | |
| 421 | + 'column' => '2', | |
| 422 | + // @codingStandardsIgnoreLine | |
| 423 | + 'before' => '<section id="reviews" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-reviews">' . __( lsx_to_get_post_type_section_title( 'review', '', 'Featured Reviews' ), 'to-team' ) . '</h2><div id="collapse-reviews" class="collapse in"><div class="collapse-inner">', | |
| 424 | + 'after' => '</div></div></section>', | |
| 425 | + ); | |
| 426 | + | |
| 427 | + lsx_to_connected_panel_query( $args ); | |
| 428 | + } | |
| 429 | 429 | } | 
| 430 | 430 | |
| 431 | 431 | /** | 
| @@ -441,7 +441,7 @@ discard block | ||
| 441 | 441 | * @category connections | 
| 442 | 442 | */ | 
| 443 | 443 |  function lsx_to_connected_team( $before = '', $after = '', $echo = true ) { | 
| 444 | - lsx_to_connected_items_query( 'team', get_post_type(), $before, $after, $echo ); | |
| 444 | + lsx_to_connected_items_query( 'team', get_post_type(), $before, $after, $echo ); | |
| 445 | 445 | } | 
| 446 | 446 | |
| 447 | 447 | /** | 
| @@ -452,18 +452,18 @@ discard block | ||
| 452 | 452 | * @category team | 
| 453 | 453 | */ | 
| 454 | 454 |  function lsx_to_team_posts() { | 
| 455 | - //$site_user = get_post_meta( get_the_ID(), 'site_user', true ); | |
| 456 | - | |
| 457 | -	if ( post_type_exists( 'post' ) && is_singular( 'team' ) ) { | |
| 458 | - $args = array( | |
| 459 | - 'from' => 'post', | |
| 460 | - 'to' => 'team', | |
| 461 | - 'column' => '3', | |
| 462 | - // @codingStandardsIgnoreLine | |
| 463 | - 'before' => '<section id="posts" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-posts">' . __( lsx_to_get_post_type_section_title( 'post', '', 'Featured Posts' ), 'to-team' ) . '</h2><div id="collapse-posts" class="collapse in"><div class="collapse-inner">', | |
| 464 | - 'after' => '</div></div></section>', | |
| 465 | - ); | |
| 466 | - | |
| 467 | - lsx_to_connected_panel_query( $args ); | |
| 468 | - } | |
| 455 | + //$site_user = get_post_meta( get_the_ID(), 'site_user', true ); | |
| 456 | + | |
| 457 | +     if ( post_type_exists( 'post' ) && is_singular( 'team' ) ) { | |
| 458 | + $args = array( | |
| 459 | + 'from' => 'post', | |
| 460 | + 'to' => 'team', | |
| 461 | + 'column' => '3', | |
| 462 | + // @codingStandardsIgnoreLine | |
| 463 | + 'before' => '<section id="posts" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-posts">' . __( lsx_to_get_post_type_section_title( 'post', '', 'Featured Posts' ), 'to-team' ) . '</h2><div id="collapse-posts" class="collapse in"><div class="collapse-inner">', | |
| 464 | + 'after' => '</div></div></section>', | |
| 465 | + ); | |
| 466 | + | |
| 467 | + lsx_to_connected_panel_query( $args ); | |
| 468 | + } | |
| 469 | 469 | } | 
| @@ -12,39 +12,39 @@ discard block | ||
| 12 | 12 | global $lsx_to_team; | 
| 13 | 13 | |
| 14 | 14 | $metabox = array( | 
| 15 | - 'title' => esc_html__( 'Tour Operator Plugin', 'to-team' ), | |
| 15 | +	'title'  => esc_html__('Tour Operator Plugin', 'to-team'), | |
| 16 | 16 | 'pages' => 'team', | 
| 17 | 17 | 'fields' => array(), | 
| 18 | 18 | ); | 
| 19 | 19 | |
| 20 | 20 | $metabox['fields'][] = array( | 
| 21 | 21 | 'id' => 'featured', | 
| 22 | - 'name' => esc_html__( 'Featured', 'to-team' ), | |
| 22 | +	'name' => esc_html__('Featured', 'to-team'), | |
| 23 | 23 | 'type' => 'checkbox', | 
| 24 | 24 | ); | 
| 25 | 25 | |
| 26 | 26 | $metabox['fields'][] = array( | 
| 27 | 27 | 'id' => 'disable_single', | 
| 28 | - 'name' => esc_html__( 'Disable Single', 'to-team' ), | |
| 28 | +	'name' => esc_html__('Disable Single', 'to-team'), | |
| 29 | 29 | 'type' => 'checkbox', | 
| 30 | 30 | ); | 
| 31 | 31 | |
| 32 | -if ( ! class_exists( 'LSX_Banners' ) ) { | |
| 32 | +if ( ! class_exists('LSX_Banners')) { | |
| 33 | 33 | $metabox['fields'][] = array( | 
| 34 | 34 | 'id' => 'tagline', | 
| 35 | - 'name' => esc_html__( 'Tagline', 'to-team' ), | |
| 35 | +		'name' => esc_html__('Tagline', 'to-team'), | |
| 36 | 36 | 'type' => 'text', | 
| 37 | 37 | ); | 
| 38 | 38 | } | 
| 39 | 39 | |
| 40 | 40 | $metabox['fields'][] = array( | 
| 41 | 41 | 'id' => 'role', | 
| 42 | - 'name' => esc_html__( 'Role', 'to-team' ), | |
| 42 | +	'name'	=> esc_html__('Role', 'to-team'), | |
| 43 | 43 | 'type' => 'text', | 
| 44 | 44 | ); | 
| 45 | 45 | |
| 46 | 46 | $metabox['fields'][] = array( | 
| 47 | - 'name' => esc_html__( 'Site User', 'to-team' ), | |
| 47 | +	'name' => esc_html__('Site User', 'to-team'), | |
| 48 | 48 | 'id' => 'site_user', | 
| 49 | 49 | 'allow_none' => true, | 
| 50 | 50 | 'type' => 'select', | 
| @@ -53,67 +53,67 @@ discard block | ||
| 53 | 53 | |
| 54 | 54 | $metabox['fields'][] = array( | 
| 55 | 55 | 'id' => 'contact_title', | 
| 56 | - 'name' => esc_html__( 'Contact', 'to-team' ), | |
| 56 | +	'name'	=> esc_html__('Contact', 'to-team'), | |
| 57 | 57 | 'type' => 'title', | 
| 58 | 58 | ); | 
| 59 | 59 | |
| 60 | 60 | $metabox['fields'][] = array( | 
| 61 | 61 | 'id' => 'contact_email', | 
| 62 | - 'name' => esc_html__( 'Email', 'to-team' ), | |
| 62 | +	'name'	=> esc_html__('Email', 'to-team'), | |
| 63 | 63 | 'type' => 'text', | 
| 64 | 64 | ); | 
| 65 | 65 | |
| 66 | 66 | $metabox['fields'][] = array( | 
| 67 | 67 | 'id' => 'contact_number', | 
| 68 | - 'name' => esc_html__( 'Number (international format)', 'to-team' ), | |
| 68 | +	'name'	=> esc_html__('Number (international format)', 'to-team'), | |
| 69 | 69 | 'type' => 'text', | 
| 70 | 70 | ); | 
| 71 | 71 | |
| 72 | 72 | $metabox['fields'][] = array( | 
| 73 | 73 | 'id' => 'skype', | 
| 74 | - 'name' => esc_html__( 'Skype', 'to-team' ), | |
| 74 | +	'name'	=> esc_html__('Skype', 'to-team'), | |
| 75 | 75 | 'type' => 'text', | 
| 76 | 76 | ); | 
| 77 | 77 | |
| 78 | 78 | $metabox['fields'][] = array( | 
| 79 | 79 | 'id' => 'social_title', | 
| 80 | - 'name' => esc_html__( 'Social Profiles', 'to-team' ), | |
| 80 | +	'name'	=> esc_html__('Social Profiles', 'to-team'), | |
| 81 | 81 | 'type' => 'title', | 
| 82 | 82 | ); | 
| 83 | 83 | |
| 84 | 84 | $metabox['fields'][] = array( | 
| 85 | 85 | 'id' => 'facebook', | 
| 86 | - 'name' => esc_html__( 'Facebook', 'to-team' ), | |
| 86 | +	'name'	=> esc_html__('Facebook', 'to-team'), | |
| 87 | 87 | 'type' => 'text', | 
| 88 | 88 | ); | 
| 89 | 89 | |
| 90 | 90 | $metabox['fields'][] = array( | 
| 91 | 91 | 'id' => 'twitter', | 
| 92 | - 'name' => esc_html__( 'Twitter', 'to-team' ), | |
| 92 | +	'name'	=> esc_html__('Twitter', 'to-team'), | |
| 93 | 93 | 'type' => 'text', | 
| 94 | 94 | ); | 
| 95 | 95 | |
| 96 | 96 | $metabox['fields'][] = array( | 
| 97 | 97 | 'id' => 'googleplus', | 
| 98 | - 'name' => esc_html__( 'Google Plus', 'to-team' ), | |
| 98 | +	'name'	=> esc_html__('Google Plus', 'to-team'), | |
| 99 | 99 | 'type' => 'text', | 
| 100 | 100 | ); | 
| 101 | 101 | |
| 102 | 102 | $metabox['fields'][] = array( | 
| 103 | 103 | 'id' => 'linkedin', | 
| 104 | - 'name' => esc_html__( 'LinkedIn', 'to-team' ), | |
| 104 | +	'name'	=> esc_html__('LinkedIn', 'to-team'), | |
| 105 | 105 | 'type' => 'text', | 
| 106 | 106 | ); | 
| 107 | 107 | |
| 108 | 108 | $metabox['fields'][] = array( | 
| 109 | 109 | 'id' => 'pinterest', | 
| 110 | - 'name' => esc_html__( 'Pinterest', 'to-team' ), | |
| 110 | +	'name'	=> esc_html__('Pinterest', 'to-team'), | |
| 111 | 111 | 'type' => 'text', | 
| 112 | 112 | ); | 
| 113 | 113 | |
| 114 | 114 | $metabox['fields'][] = array( | 
| 115 | 115 | 'id' => 'gallery_title', | 
| 116 | - 'name' => esc_html__( 'Gallery', 'to-team' ), | |
| 116 | +	'name' => esc_html__('Gallery', 'to-team'), | |
| 117 | 117 | 'type' => 'title', | 
| 118 | 118 | ); | 
| 119 | 119 | |
| @@ -124,19 +124,19 @@ discard block | ||
| 124 | 124 | 'repeatable' => true, | 
| 125 | 125 | 'show_size' => false, | 
| 126 | 126 | 'sortable' => true, | 
| 127 | - 'string-repeat-field' => esc_html__( 'Add new image', 'tour-operator' ), | |
| 127 | +	'string-repeat-field' => esc_html__('Add new image', 'tour-operator'), | |
| 128 | 128 | ); | 
| 129 | 129 | |
| 130 | -if ( class_exists( 'Envira_Gallery' ) ) { | |
| 130 | +if (class_exists('Envira_Gallery')) { | |
| 131 | 131 | $metabox['fields'][] = array( | 
| 132 | 132 | 'id' => 'envira_title', | 
| 133 | - 'name' => esc_html__( 'Envira Gallery', 'to-team' ), | |
| 133 | +		'name' => esc_html__('Envira Gallery', 'to-team'), | |
| 134 | 134 | 'type' => 'title', | 
| 135 | 135 | ); | 
| 136 | 136 | |
| 137 | 137 | $metabox['fields'][] = array( | 
| 138 | 138 | 'id' => 'envira_gallery', | 
| 139 | - 'name' => esc_html__( 'Envira Gallery', 'to-team' ), | |
| 139 | +		'name'       => esc_html__('Envira Gallery', 'to-team'), | |
| 140 | 140 | 'type' => 'post_select', | 
| 141 | 141 | 'use_ajax' => false, | 
| 142 | 142 | 'allow_none' => true, | 
| @@ -149,10 +149,10 @@ discard block | ||
| 149 | 149 | ), | 
| 150 | 150 | ); | 
| 151 | 151 | |
| 152 | -	if ( class_exists( 'Envira_Videos' ) ) { | |
| 152 | +	if (class_exists('Envira_Videos')) { | |
| 153 | 153 | $metabox['fields'][] = array( | 
| 154 | 154 | 'id' => 'envira_video', | 
| 155 | - 'name' => esc_html__( 'Envira Video Gallery', 'to-team' ), | |
| 155 | +			'name'       => esc_html__('Envira Video Gallery', 'to-team'), | |
| 156 | 156 | 'type' => 'post_select', | 
| 157 | 157 | 'use_ajax' => false, | 
| 158 | 158 | 'allow_none' => true, | 
| @@ -168,13 +168,13 @@ discard block | ||
| 168 | 168 | } | 
| 169 | 169 | |
| 170 | 170 | $post_types = array( | 
| 171 | - 'accommodation' => esc_html__( 'Accommodation', 'to-team' ), | |
| 172 | - 'destination' => esc_html__( 'Destinations', 'to-team' ), | |
| 173 | - 'tour' => esc_html__( 'Tours', 'to-team' ), | |
| 174 | - 'post' => esc_html__( 'Posts', 'to-team' ), | |
| 171 | +	'accommodation'		=> esc_html__('Accommodation', 'to-team'), | |
| 172 | +	'destination'		=> esc_html__('Destinations', 'to-team'), | |
| 173 | +	'tour'				=> esc_html__('Tours', 'to-team'), | |
| 174 | +	'post'				=> esc_html__('Posts', 'to-team'), | |
| 175 | 175 | ); | 
| 176 | 176 | |
| 177 | -foreach ( $post_types as $slug => $label ) { | |
| 177 | +foreach ($post_types as $slug => $label) { | |
| 178 | 178 | $metabox['fields'][] = array( | 
| 179 | 179 | 'id' => $slug . '_title', | 
| 180 | 180 | 'name' => $label, | 
| @@ -183,7 +183,7 @@ discard block | ||
| 183 | 183 | |
| 184 | 184 | $metabox['fields'][] = array( | 
| 185 | 185 | 'id' => $slug . '_to_team', | 
| 186 | - 'name' => $label . esc_html__( ' related with this team', 'to-team' ), | |
| 186 | +		'name'       => $label . esc_html__(' related with this team', 'to-team'), | |
| 187 | 187 | 'type' => 'post_select', | 
| 188 | 188 | 'use_ajax' => false, | 
| 189 | 189 | 'repeatable' => true, | 
| @@ -198,6 +198,6 @@ discard block | ||
| 198 | 198 | ); | 
| 199 | 199 | } | 
| 200 | 200 | |
| 201 | -$metabox['fields'] = apply_filters( 'lsx_to_team_custom_fields', $metabox['fields'] ); | |
| 201 | +$metabox['fields'] = apply_filters('lsx_to_team_custom_fields', $metabox['fields']); | |
| 202 | 202 | |
| 203 | 203 | return $metabox; | 
| @@ -12,190 +12,190 @@ | ||
| 12 | 12 | global $lsx_to_team; | 
| 13 | 13 | |
| 14 | 14 | $metabox = array( | 
| 15 | - 'title' => esc_html__( 'Tour Operator Plugin', 'to-team' ), | |
| 16 | - 'pages' => 'team', | |
| 17 | - 'fields' => array(), | |
| 15 | + 'title' => esc_html__( 'Tour Operator Plugin', 'to-team' ), | |
| 16 | + 'pages' => 'team', | |
| 17 | + 'fields' => array(), | |
| 18 | 18 | ); | 
| 19 | 19 | |
| 20 | 20 | $metabox['fields'][] = array( | 
| 21 | - 'id' => 'featured', | |
| 22 | - 'name' => esc_html__( 'Featured', 'to-team' ), | |
| 23 | - 'type' => 'checkbox', | |
| 21 | + 'id' => 'featured', | |
| 22 | + 'name' => esc_html__( 'Featured', 'to-team' ), | |
| 23 | + 'type' => 'checkbox', | |
| 24 | 24 | ); | 
| 25 | 25 | |
| 26 | 26 | $metabox['fields'][] = array( | 
| 27 | - 'id' => 'disable_single', | |
| 28 | - 'name' => esc_html__( 'Disable Single', 'to-team' ), | |
| 29 | - 'type' => 'checkbox', | |
| 27 | + 'id' => 'disable_single', | |
| 28 | + 'name' => esc_html__( 'Disable Single', 'to-team' ), | |
| 29 | + 'type' => 'checkbox', | |
| 30 | 30 | ); | 
| 31 | 31 | |
| 32 | 32 |  if ( ! class_exists( 'LSX_Banners' ) ) { | 
| 33 | - $metabox['fields'][] = array( | |
| 34 | - 'id' => 'tagline', | |
| 35 | - 'name' => esc_html__( 'Tagline', 'to-team' ), | |
| 36 | - 'type' => 'text', | |
| 37 | - ); | |
| 33 | + $metabox['fields'][] = array( | |
| 34 | + 'id' => 'tagline', | |
| 35 | + 'name' => esc_html__( 'Tagline', 'to-team' ), | |
| 36 | + 'type' => 'text', | |
| 37 | + ); | |
| 38 | 38 | } | 
| 39 | 39 | |
| 40 | 40 | $metabox['fields'][] = array( | 
| 41 | - 'id' => 'role', | |
| 42 | - 'name' => esc_html__( 'Role', 'to-team' ), | |
| 43 | - 'type' => 'text', | |
| 41 | + 'id' => 'role', | |
| 42 | + 'name' => esc_html__( 'Role', 'to-team' ), | |
| 43 | + 'type' => 'text', | |
| 44 | 44 | ); | 
| 45 | 45 | |
| 46 | 46 | $metabox['fields'][] = array( | 
| 47 | - 'name' => esc_html__( 'Site User', 'to-team' ), | |
| 48 | - 'id' => 'site_user', | |
| 49 | - 'allow_none' => true, | |
| 50 | - 'type' => 'select', | |
| 51 | - 'options' => $lsx_to_team->site_users, | |
| 47 | + 'name' => esc_html__( 'Site User', 'to-team' ), | |
| 48 | + 'id' => 'site_user', | |
| 49 | + 'allow_none' => true, | |
| 50 | + 'type' => 'select', | |
| 51 | + 'options' => $lsx_to_team->site_users, | |
| 52 | 52 | ); | 
| 53 | 53 | |
| 54 | 54 | $metabox['fields'][] = array( | 
| 55 | - 'id' => 'contact_title', | |
| 56 | - 'name' => esc_html__( 'Contact', 'to-team' ), | |
| 57 | - 'type' => 'title', | |
| 55 | + 'id' => 'contact_title', | |
| 56 | + 'name' => esc_html__( 'Contact', 'to-team' ), | |
| 57 | + 'type' => 'title', | |
| 58 | 58 | ); | 
| 59 | 59 | |
| 60 | 60 | $metabox['fields'][] = array( | 
| 61 | - 'id' => 'contact_email', | |
| 62 | - 'name' => esc_html__( 'Email', 'to-team' ), | |
| 63 | - 'type' => 'text', | |
| 61 | + 'id' => 'contact_email', | |
| 62 | + 'name' => esc_html__( 'Email', 'to-team' ), | |
| 63 | + 'type' => 'text', | |
| 64 | 64 | ); | 
| 65 | 65 | |
| 66 | 66 | $metabox['fields'][] = array( | 
| 67 | - 'id' => 'contact_number', | |
| 68 | - 'name' => esc_html__( 'Number (international format)', 'to-team' ), | |
| 69 | - 'type' => 'text', | |
| 67 | + 'id' => 'contact_number', | |
| 68 | + 'name' => esc_html__( 'Number (international format)', 'to-team' ), | |
| 69 | + 'type' => 'text', | |
| 70 | 70 | ); | 
| 71 | 71 | |
| 72 | 72 | $metabox['fields'][] = array( | 
| 73 | - 'id' => 'skype', | |
| 74 | - 'name' => esc_html__( 'Skype', 'to-team' ), | |
| 75 | - 'type' => 'text', | |
| 73 | + 'id' => 'skype', | |
| 74 | + 'name' => esc_html__( 'Skype', 'to-team' ), | |
| 75 | + 'type' => 'text', | |
| 76 | 76 | ); | 
| 77 | 77 | |
| 78 | 78 | $metabox['fields'][] = array( | 
| 79 | - 'id' => 'social_title', | |
| 80 | - 'name' => esc_html__( 'Social Profiles', 'to-team' ), | |
| 81 | - 'type' => 'title', | |
| 79 | + 'id' => 'social_title', | |
| 80 | + 'name' => esc_html__( 'Social Profiles', 'to-team' ), | |
| 81 | + 'type' => 'title', | |
| 82 | 82 | ); | 
| 83 | 83 | |
| 84 | 84 | $metabox['fields'][] = array( | 
| 85 | - 'id' => 'facebook', | |
| 86 | - 'name' => esc_html__( 'Facebook', 'to-team' ), | |
| 87 | - 'type' => 'text', | |
| 85 | + 'id' => 'facebook', | |
| 86 | + 'name' => esc_html__( 'Facebook', 'to-team' ), | |
| 87 | + 'type' => 'text', | |
| 88 | 88 | ); | 
| 89 | 89 | |
| 90 | 90 | $metabox['fields'][] = array( | 
| 91 | - 'id' => 'twitter', | |
| 92 | - 'name' => esc_html__( 'Twitter', 'to-team' ), | |
| 93 | - 'type' => 'text', | |
| 91 | + 'id' => 'twitter', | |
| 92 | + 'name' => esc_html__( 'Twitter', 'to-team' ), | |
| 93 | + 'type' => 'text', | |
| 94 | 94 | ); | 
| 95 | 95 | |
| 96 | 96 | $metabox['fields'][] = array( | 
| 97 | - 'id' => 'googleplus', | |
| 98 | - 'name' => esc_html__( 'Google Plus', 'to-team' ), | |
| 99 | - 'type' => 'text', | |
| 97 | + 'id' => 'googleplus', | |
| 98 | + 'name' => esc_html__( 'Google Plus', 'to-team' ), | |
| 99 | + 'type' => 'text', | |
| 100 | 100 | ); | 
| 101 | 101 | |
| 102 | 102 | $metabox['fields'][] = array( | 
| 103 | - 'id' => 'linkedin', | |
| 104 | - 'name' => esc_html__( 'LinkedIn', 'to-team' ), | |
| 105 | - 'type' => 'text', | |
| 103 | + 'id' => 'linkedin', | |
| 104 | + 'name' => esc_html__( 'LinkedIn', 'to-team' ), | |
| 105 | + 'type' => 'text', | |
| 106 | 106 | ); | 
| 107 | 107 | |
| 108 | 108 | $metabox['fields'][] = array( | 
| 109 | - 'id' => 'pinterest', | |
| 110 | - 'name' => esc_html__( 'Pinterest', 'to-team' ), | |
| 111 | - 'type' => 'text', | |
| 109 | + 'id' => 'pinterest', | |
| 110 | + 'name' => esc_html__( 'Pinterest', 'to-team' ), | |
| 111 | + 'type' => 'text', | |
| 112 | 112 | ); | 
| 113 | 113 | |
| 114 | 114 | $metabox['fields'][] = array( | 
| 115 | - 'id' => 'gallery_title', | |
| 116 | - 'name' => esc_html__( 'Gallery', 'to-team' ), | |
| 117 | - 'type' => 'title', | |
| 115 | + 'id' => 'gallery_title', | |
| 116 | + 'name' => esc_html__( 'Gallery', 'to-team' ), | |
| 117 | + 'type' => 'title', | |
| 118 | 118 | ); | 
| 119 | 119 | |
| 120 | 120 | $metabox['fields'][] = array( | 
| 121 | - 'id' => 'gallery', | |
| 122 | - 'name' => '', | |
| 123 | - 'type' => 'image', | |
| 124 | - 'repeatable' => true, | |
| 125 | - 'show_size' => false, | |
| 126 | - 'sortable' => true, | |
| 127 | - 'string-repeat-field' => esc_html__( 'Add new image', 'tour-operator' ), | |
| 121 | + 'id' => 'gallery', | |
| 122 | + 'name' => '', | |
| 123 | + 'type' => 'image', | |
| 124 | + 'repeatable' => true, | |
| 125 | + 'show_size' => false, | |
| 126 | + 'sortable' => true, | |
| 127 | + 'string-repeat-field' => esc_html__( 'Add new image', 'tour-operator' ), | |
| 128 | 128 | ); | 
| 129 | 129 | |
| 130 | 130 |  if ( class_exists( 'Envira_Gallery' ) ) { | 
| 131 | - $metabox['fields'][] = array( | |
| 132 | - 'id' => 'envira_title', | |
| 133 | - 'name' => esc_html__( 'Envira Gallery', 'to-team' ), | |
| 134 | - 'type' => 'title', | |
| 135 | - ); | |
| 136 | - | |
| 137 | - $metabox['fields'][] = array( | |
| 138 | - 'id' => 'envira_gallery', | |
| 139 | - 'name' => esc_html__( 'Envira Gallery', 'to-team' ), | |
| 140 | - 'type' => 'post_select', | |
| 141 | - 'use_ajax' => false, | |
| 142 | - 'allow_none' => true, | |
| 143 | - 'query' => array( | |
| 144 | - 'post_type' => 'envira', | |
| 145 | - 'nopagin' => true, | |
| 146 | - 'posts_per_page' => '-1', | |
| 147 | - 'orderby' => 'title', | |
| 148 | - 'order' => 'ASC', | |
| 149 | - ), | |
| 150 | - ); | |
| 151 | - | |
| 152 | -	if ( class_exists( 'Envira_Videos' ) ) { | |
| 153 | - $metabox['fields'][] = array( | |
| 154 | - 'id' => 'envira_video', | |
| 155 | - 'name' => esc_html__( 'Envira Video Gallery', 'to-team' ), | |
| 156 | - 'type' => 'post_select', | |
| 157 | - 'use_ajax' => false, | |
| 158 | - 'allow_none' => true, | |
| 159 | - 'query' => array( | |
| 160 | - 'post_type' => 'envira', | |
| 161 | - 'nopagin' => true, | |
| 162 | - 'posts_per_page' => '-1', | |
| 163 | - 'orderby' => 'title', | |
| 164 | - 'order' => 'ASC', | |
| 165 | - ), | |
| 166 | - ); | |
| 167 | - } | |
| 131 | + $metabox['fields'][] = array( | |
| 132 | + 'id' => 'envira_title', | |
| 133 | + 'name' => esc_html__( 'Envira Gallery', 'to-team' ), | |
| 134 | + 'type' => 'title', | |
| 135 | + ); | |
| 136 | + | |
| 137 | + $metabox['fields'][] = array( | |
| 138 | + 'id' => 'envira_gallery', | |
| 139 | + 'name' => esc_html__( 'Envira Gallery', 'to-team' ), | |
| 140 | + 'type' => 'post_select', | |
| 141 | + 'use_ajax' => false, | |
| 142 | + 'allow_none' => true, | |
| 143 | + 'query' => array( | |
| 144 | + 'post_type' => 'envira', | |
| 145 | + 'nopagin' => true, | |
| 146 | + 'posts_per_page' => '-1', | |
| 147 | + 'orderby' => 'title', | |
| 148 | + 'order' => 'ASC', | |
| 149 | + ), | |
| 150 | + ); | |
| 151 | + | |
| 152 | +     if ( class_exists( 'Envira_Videos' ) ) { | |
| 153 | + $metabox['fields'][] = array( | |
| 154 | + 'id' => 'envira_video', | |
| 155 | + 'name' => esc_html__( 'Envira Video Gallery', 'to-team' ), | |
| 156 | + 'type' => 'post_select', | |
| 157 | + 'use_ajax' => false, | |
| 158 | + 'allow_none' => true, | |
| 159 | + 'query' => array( | |
| 160 | + 'post_type' => 'envira', | |
| 161 | + 'nopagin' => true, | |
| 162 | + 'posts_per_page' => '-1', | |
| 163 | + 'orderby' => 'title', | |
| 164 | + 'order' => 'ASC', | |
| 165 | + ), | |
| 166 | + ); | |
| 167 | + } | |
| 168 | 168 | } | 
| 169 | 169 | |
| 170 | 170 | $post_types = array( | 
| 171 | - 'accommodation' => esc_html__( 'Accommodation', 'to-team' ), | |
| 172 | - 'destination' => esc_html__( 'Destinations', 'to-team' ), | |
| 173 | - 'tour' => esc_html__( 'Tours', 'to-team' ), | |
| 174 | - 'post' => esc_html__( 'Posts', 'to-team' ), | |
| 171 | + 'accommodation' => esc_html__( 'Accommodation', 'to-team' ), | |
| 172 | + 'destination' => esc_html__( 'Destinations', 'to-team' ), | |
| 173 | + 'tour' => esc_html__( 'Tours', 'to-team' ), | |
| 174 | + 'post' => esc_html__( 'Posts', 'to-team' ), | |
| 175 | 175 | ); | 
| 176 | 176 | |
| 177 | 177 |  foreach ( $post_types as $slug => $label ) { | 
| 178 | - $metabox['fields'][] = array( | |
| 179 | - 'id' => $slug . '_title', | |
| 180 | - 'name' => $label, | |
| 181 | - 'type' => 'title', | |
| 182 | - ); | |
| 183 | - | |
| 184 | - $metabox['fields'][] = array( | |
| 185 | - 'id' => $slug . '_to_team', | |
| 186 | - 'name' => $label . esc_html__( ' related with this team', 'to-team' ), | |
| 187 | - 'type' => 'post_select', | |
| 188 | - 'use_ajax' => false, | |
| 189 | - 'repeatable' => true, | |
| 190 | - 'allow_none' => true, | |
| 191 | - 'query' => array( | |
| 192 | - 'post_type' => $slug, | |
| 193 | - 'nopagin' => true, | |
| 194 | - 'posts_per_page' => '-1', | |
| 195 | - 'orderby' => 'title', | |
| 196 | - 'order' => 'ASC', | |
| 197 | - ), | |
| 198 | - ); | |
| 178 | + $metabox['fields'][] = array( | |
| 179 | + 'id' => $slug . '_title', | |
| 180 | + 'name' => $label, | |
| 181 | + 'type' => 'title', | |
| 182 | + ); | |
| 183 | + | |
| 184 | + $metabox['fields'][] = array( | |
| 185 | + 'id' => $slug . '_to_team', | |
| 186 | + 'name' => $label . esc_html__( ' related with this team', 'to-team' ), | |
| 187 | + 'type' => 'post_select', | |
| 188 | + 'use_ajax' => false, | |
| 189 | + 'repeatable' => true, | |
| 190 | + 'allow_none' => true, | |
| 191 | + 'query' => array( | |
| 192 | + 'post_type' => $slug, | |
| 193 | + 'nopagin' => true, | |
| 194 | + 'posts_per_page' => '-1', | |
| 195 | + 'orderby' => 'title', | |
| 196 | + 'order' => 'ASC', | |
| 197 | + ), | |
| 198 | + ); | |
| 199 | 199 | } | 
| 200 | 200 | |
| 201 | 201 | $metabox['fields'] = apply_filters( 'lsx_to_team_custom_fields', $metabox['fields'] ); | 
| @@ -15,17 +15,17 @@ discard block | ||
| 15 | 15 | 'args' => array( | 
| 16 | 16 | 'hierarchical' => true, | 
| 17 | 17 | 'labels' => array( | 
| 18 | - 'name' => esc_html__( 'Roles', 'to-team' ), | |
| 19 | - 'singular_name' => esc_html__( 'Role', 'to-team' ), | |
| 20 | - 'search_items' => esc_html__( 'Search Roles', 'to-team' ), | |
| 21 | - 'all_items' => esc_html__( 'Roles', 'to-team' ), | |
| 22 | - 'parent_item' => esc_html__( 'Parent', 'to-team' ), | |
| 23 | - 'parent_item_colon' => esc_html__( 'Parent:', 'to-team' ), | |
| 24 | - 'edit_item' => esc_html__( 'Edit Role', 'to-team' ), | |
| 25 | - 'update_item' => esc_html__( 'Update Role', 'to-team' ), | |
| 26 | - 'add_new_item' => esc_html__( 'Add New Role', 'to-team' ), | |
| 27 | - 'new_item_name' => esc_html__( 'New Role', 'to-team' ), | |
| 28 | - 'menu_name' => esc_html__( 'Roles', 'to-team' ), | |
| 18 | +			'name'              => esc_html__('Roles', 'to-team'), | |
| 19 | +			'singular_name'     => esc_html__('Role', 'to-team'), | |
| 20 | +			'search_items'      => esc_html__('Search Roles', 'to-team'), | |
| 21 | +			'all_items'         => esc_html__('Roles', 'to-team'), | |
| 22 | +			'parent_item'       => esc_html__('Parent', 'to-team'), | |
| 23 | +			'parent_item_colon' => esc_html__('Parent:', 'to-team'), | |
| 24 | +			'edit_item'         => esc_html__('Edit Role', 'to-team'), | |
| 25 | +			'update_item'       => esc_html__('Update Role', 'to-team'), | |
| 26 | +			'add_new_item'      => esc_html__('Add New Role', 'to-team'), | |
| 27 | +			'new_item_name'     => esc_html__('New Role', 'to-team'), | |
| 28 | +			'menu_name'         => esc_html__('Roles', 'to-team'), | |
| 29 | 29 | ), | 
| 30 | 30 | 'show_ui' => true, | 
| 31 | 31 | 'public' => true, | 
| @@ -33,7 +33,7 @@ discard block | ||
| 33 | 33 | 'exclude_from_search' => true, | 
| 34 | 34 | 'show_admin_column' => true, | 
| 35 | 35 | 'query_var' => true, | 
| 36 | - 'rewrite' => array( 'role' ), | |
| 36 | +		'rewrite'             => array('role'), | |
| 37 | 37 | ), | 
| 38 | 38 | ); | 
| 39 | 39 | |
| @@ -10,31 +10,31 @@ | ||
| 10 | 10 | */ | 
| 11 | 11 | |
| 12 | 12 | $taxonomy = array( | 
| 13 | - 'object_types' => 'team', | |
| 14 | - 'menu_position' => 77, | |
| 15 | - 'args' => array( | |
| 16 | - 'hierarchical' => true, | |
| 17 | - 'labels' => array( | |
| 18 | - 'name' => esc_html__( 'Roles', 'to-team' ), | |
| 19 | - 'singular_name' => esc_html__( 'Role', 'to-team' ), | |
| 20 | - 'search_items' => esc_html__( 'Search Roles', 'to-team' ), | |
| 21 | - 'all_items' => esc_html__( 'Roles', 'to-team' ), | |
| 22 | - 'parent_item' => esc_html__( 'Parent', 'to-team' ), | |
| 23 | - 'parent_item_colon' => esc_html__( 'Parent:', 'to-team' ), | |
| 24 | - 'edit_item' => esc_html__( 'Edit Role', 'to-team' ), | |
| 25 | - 'update_item' => esc_html__( 'Update Role', 'to-team' ), | |
| 26 | - 'add_new_item' => esc_html__( 'Add New Role', 'to-team' ), | |
| 27 | - 'new_item_name' => esc_html__( 'New Role', 'to-team' ), | |
| 28 | - 'menu_name' => esc_html__( 'Roles', 'to-team' ), | |
| 29 | - ), | |
| 30 | - 'show_ui' => true, | |
| 31 | - 'public' => true, | |
| 32 | - 'show_tagcloud' => false, | |
| 33 | - 'exclude_from_search' => true, | |
| 34 | - 'show_admin_column' => true, | |
| 35 | - 'query_var' => true, | |
| 36 | - 'rewrite' => array( 'role' ), | |
| 37 | - ), | |
| 13 | + 'object_types' => 'team', | |
| 14 | + 'menu_position' => 77, | |
| 15 | + 'args' => array( | |
| 16 | + 'hierarchical' => true, | |
| 17 | + 'labels' => array( | |
| 18 | + 'name' => esc_html__( 'Roles', 'to-team' ), | |
| 19 | + 'singular_name' => esc_html__( 'Role', 'to-team' ), | |
| 20 | + 'search_items' => esc_html__( 'Search Roles', 'to-team' ), | |
| 21 | + 'all_items' => esc_html__( 'Roles', 'to-team' ), | |
| 22 | + 'parent_item' => esc_html__( 'Parent', 'to-team' ), | |
| 23 | + 'parent_item_colon' => esc_html__( 'Parent:', 'to-team' ), | |
| 24 | + 'edit_item' => esc_html__( 'Edit Role', 'to-team' ), | |
| 25 | + 'update_item' => esc_html__( 'Update Role', 'to-team' ), | |
| 26 | + 'add_new_item' => esc_html__( 'Add New Role', 'to-team' ), | |
| 27 | + 'new_item_name' => esc_html__( 'New Role', 'to-team' ), | |
| 28 | + 'menu_name' => esc_html__( 'Roles', 'to-team' ), | |
| 29 | + ), | |
| 30 | + 'show_ui' => true, | |
| 31 | + 'public' => true, | |
| 32 | + 'show_tagcloud' => false, | |
| 33 | + 'exclude_from_search' => true, | |
| 34 | + 'show_admin_column' => true, | |
| 35 | + 'query_var' => true, | |
| 36 | + 'rewrite' => array( 'role' ), | |
| 37 | + ), | |
| 38 | 38 | ); | 
| 39 | 39 | |
| 40 | 40 | return $taxonomy; |