| @@ -14,7 +14,7 @@ | ||
| 14 | 14 | |
| 15 | 15 | // If this file is called directly, abort. | 
| 16 | 16 |  if ( ! defined( 'WPINC' ) ) { | 
| 17 | - die; | |
| 17 | + die; | |
| 18 | 18 | } | 
| 19 | 19 | |
| 20 | 20 | define( 'LSX_TO_REVIEWS_PATH', plugin_dir_path( __FILE__ ) ); | 
| @@ -18,57 +18,57 @@ discard block | ||
| 18 | 18 | |
| 19 | 19 |  class LSX_TO_Reviews_Frontend extends LSX_TO_Reviews { | 
| 20 | 20 | |
| 21 | - /** | |
| 22 | - * Holds the $page_links array while its being built on the single review page. | |
| 23 | - * | |
| 24 | - * @var array | |
| 25 | - */ | |
| 26 | - public $page_links = false; | |
| 27 | - | |
| 28 | - /** | |
| 29 | - * Constructor | |
| 30 | - */ | |
| 31 | -	public function __construct() { | |
| 32 | - $this->set_vars(); | |
| 33 | - | |
| 34 | - add_action( 'wp_head', array( $this, 'change_single_review_layout' ), 20, 1 ); | |
| 35 | - | |
| 36 | - add_filter( 'lsx_to_entry_class', array( $this, 'entry_class' ) ); | |
| 37 | - add_action( 'init', array( $this, 'init' ) ); | |
| 38 | - | |
| 39 | -		if ( ! class_exists( 'LSX_TO_Template_Redirects' ) ) { | |
| 40 | - require_once( LSX_TO_REVIEWS_PATH . 'classes/class-template-redirects.php' ); | |
| 41 | - } | |
| 42 | - | |
| 43 | - $this->redirects = new LSX_TO_Template_Redirects( LSX_TO_REVIEWS_PATH, array_keys( $this->post_types ) ); | |
| 44 | - | |
| 45 | - add_action( 'lsx_to_review_content', array( $this->redirects, 'content_part' ), 10 , 2 ); | |
| 46 | - | |
| 47 | - add_filter( 'lsx_to_page_navigation', array( $this, 'page_links' ) ); | |
| 48 | - | |
| 49 | - add_action( 'lsx_entry_top', array( $this, 'archive_entry_top' ), 15 ); | |
| 50 | - add_action( 'lsx_entry_bottom', array( $this, 'archive_entry_bottom' ) ); | |
| 51 | - add_action( 'lsx_content_bottom', array( $this, 'single_content_bottom' ) ); | |
| 52 | - add_action( 'lsx_to_fast_facts', array( $this, 'single_fast_facts' ) ); | |
| 53 | - } | |
| 54 | - | |
| 55 | - /** | |
| 56 | - * Change single review layout. | |
| 57 | - */ | |
| 58 | -	public function change_single_review_layout() { | |
| 59 | - global $lsx_to_archive; | |
| 60 | - | |
| 61 | -		if ( is_singular( 'review' ) && 1 !== $lsx_to_archive ) { | |
| 62 | - remove_action( 'lsx_entry_bottom', 'lsx_to_single_entry_bottom' ); | |
| 63 | - add_action( 'lsx_entry_top', array( $this, 'lsx_to_single_entry_bottom' ) ); | |
| 64 | - } | |
| 65 | - } | |
| 66 | - | |
| 67 | - /** | |
| 68 | - * Change single review layout. | |
| 69 | - */ | |
| 70 | -	public function lsx_to_single_entry_bottom() { | |
| 71 | -		if ( is_singular( 'review' ) ) { ?> | |
| 21 | + /** | |
| 22 | + * Holds the $page_links array while its being built on the single review page. | |
| 23 | + * | |
| 24 | + * @var array | |
| 25 | + */ | |
| 26 | + public $page_links = false; | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * Constructor | |
| 30 | + */ | |
| 31 | +     public function __construct() { | |
| 32 | + $this->set_vars(); | |
| 33 | + | |
| 34 | + add_action( 'wp_head', array( $this, 'change_single_review_layout' ), 20, 1 ); | |
| 35 | + | |
| 36 | + add_filter( 'lsx_to_entry_class', array( $this, 'entry_class' ) ); | |
| 37 | + add_action( 'init', array( $this, 'init' ) ); | |
| 38 | + | |
| 39 | +          if ( ! class_exists( 'LSX_TO_Template_Redirects' ) ) { | |
| 40 | + require_once( LSX_TO_REVIEWS_PATH . 'classes/class-template-redirects.php' ); | |
| 41 | + } | |
| 42 | + | |
| 43 | + $this->redirects = new LSX_TO_Template_Redirects( LSX_TO_REVIEWS_PATH, array_keys( $this->post_types ) ); | |
| 44 | + | |
| 45 | + add_action( 'lsx_to_review_content', array( $this->redirects, 'content_part' ), 10 , 2 ); | |
| 46 | + | |
| 47 | + add_filter( 'lsx_to_page_navigation', array( $this, 'page_links' ) ); | |
| 48 | + | |
| 49 | + add_action( 'lsx_entry_top', array( $this, 'archive_entry_top' ), 15 ); | |
| 50 | + add_action( 'lsx_entry_bottom', array( $this, 'archive_entry_bottom' ) ); | |
| 51 | + add_action( 'lsx_content_bottom', array( $this, 'single_content_bottom' ) ); | |
| 52 | + add_action( 'lsx_to_fast_facts', array( $this, 'single_fast_facts' ) ); | |
| 53 | + } | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * Change single review layout. | |
| 57 | + */ | |
| 58 | +     public function change_single_review_layout() { | |
| 59 | + global $lsx_to_archive; | |
| 60 | + | |
| 61 | +          if ( is_singular( 'review' ) && 1 !== $lsx_to_archive ) { | |
| 62 | + remove_action( 'lsx_entry_bottom', 'lsx_to_single_entry_bottom' ); | |
| 63 | + add_action( 'lsx_entry_top', array( $this, 'lsx_to_single_entry_bottom' ) ); | |
| 64 | + } | |
| 65 | + } | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * Change single review layout. | |
| 69 | + */ | |
| 70 | +     public function lsx_to_single_entry_bottom() { | |
| 71 | +          if ( is_singular( 'review' ) ) { ?> | |
| 72 | 72 | <div class="col-xs-12 col-sm-4 col-md-3"> | 
| 73 | 73 | <figure class="lsx-to-review-thumb"> | 
| 74 | 74 | <?php lsx_thumbnail( 'lsx-thumbnail-square' ); ?> | 
| @@ -78,266 +78,266 @@ discard block | ||
| 78 | 78 | <h3 class="lsx-to-summary-title text-center"><?php echo esc_html( $reviewer_name ); ?></h3> | 
| 79 | 79 | </div> | 
| 80 | 80 | <?php } | 
| 81 | - } | |
| 82 | - | |
| 83 | - /** | |
| 84 | - * Runs on init after all files have been parsed. | |
| 85 | - */ | |
| 86 | -	public function init() { | |
| 87 | - add_filter( 'lsx_to_custom_field_query',array( $this, 'rating' ),5,10 ); | |
| 88 | - } | |
| 89 | - | |
| 90 | - /** | |
| 91 | - * A filter to set the content area to a small column on single | |
| 92 | - */ | |
| 93 | -	public function entry_class( $classes ) { | |
| 94 | - global $lsx_to_archive; | |
| 95 | - | |
| 96 | -		if ( 1 !== $lsx_to_archive ) { | |
| 97 | - $lsx_to_archive = false; | |
| 98 | - } | |
| 99 | - | |
| 100 | -		if ( is_main_query() && is_singular( 'review' ) && false === $lsx_to_archive ) { | |
| 101 | -			//if ( lsx_to_has_enquiry_contact() ) { | |
| 102 | - $classes[] = 'col-xs-12 col-sm-8 col-md-9'; | |
| 103 | -			//} else { | |
| 104 | - //$classes[] = 'col-sm-12'; | |
| 105 | - //} | |
| 106 | - } | |
| 107 | - | |
| 108 | - return $classes; | |
| 109 | - } | |
| 110 | - | |
| 111 | - /** | |
| 112 | - * Filter and make the star ratings | |
| 113 | - */ | |
| 114 | -	public function rating( $html = '', $meta_key = false, $value = false, $before = '', $after = '' ) { | |
| 115 | -		if ( get_post_type() === 'review' && 'rating' === $meta_key ) { | |
| 116 | - $ratings_array = array(); | |
| 117 | - $counter = 5; | |
| 118 | - $html = ''; | |
| 119 | -			if ( 0 !== (int) $value ) { | |
| 120 | -				while ( $counter > 0 ) { | |
| 121 | -					if ( $value > 0 ) { | |
| 122 | - $ratings_array[] = '<i class="fa fa-star"></i>'; | |
| 123 | -					} else { | |
| 124 | - $ratings_array[] = '<i class="fa fa-star-o"></i>'; | |
| 125 | - } | |
| 126 | - | |
| 127 | - $counter--; | |
| 128 | - $value--; | |
| 129 | - } | |
| 130 | - | |
| 131 | - $html = $before . implode( '', $ratings_array ) . $after; | |
| 132 | - } | |
| 133 | - } | |
| 134 | - return $html; | |
| 135 | - } | |
| 136 | - | |
| 137 | - /** | |
| 138 | - * Adds our navigation links to the review single post | |
| 139 | - * | |
| 140 | - * @param $page_links array | |
| 141 | - * @return $page_links array | |
| 142 | - */ | |
| 143 | -	public function page_links( $page_links ) { | |
| 144 | -		if ( is_singular( 'review' ) ) { | |
| 145 | - $this->page_links = $page_links; | |
| 146 | - | |
| 147 | - $this->get_related_accommodation_link(); | |
| 148 | - $this->get_related_tours_link(); | |
| 149 | - $this->get_related_destinations_link(); | |
| 150 | - $this->get_gallery_link(); | |
| 151 | - $this->get_videos_link(); | |
| 152 | - $this->get_related_posts_link(); | |
| 153 | - | |
| 154 | - $page_links = $this->page_links; | |
| 155 | - } | |
| 156 | - | |
| 157 | - return $page_links; | |
| 158 | - } | |
| 159 | - | |
| 160 | - /** | |
| 161 | - * Tests for the Related Accommodation and returns a link for the section | |
| 162 | - */ | |
| 163 | -	public function get_related_accommodation_link() { | |
| 164 | - $connected_accommodation = get_post_meta( get_the_ID(), 'accommodation_to_review', false ); | |
| 165 | - | |
| 166 | -		if ( post_type_exists( 'accommodation' ) && is_array( $connected_accommodation ) && ! empty( $connected_accommodation ) ) { | |
| 167 | - $connected_accommodation = new \WP_Query( array( | |
| 168 | - 'post_type' => 'accommodation', | |
| 169 | - 'post__in' => $connected_accommodation, | |
| 170 | - 'post_status' => 'publish', | |
| 171 | - 'nopagin' => true, | |
| 172 | - 'posts_per_page' => '-1', | |
| 173 | - 'fields' => 'ids', | |
| 174 | - ) ); | |
| 175 | - | |
| 176 | - $connected_accommodation = $connected_accommodation->posts; | |
| 177 | - | |
| 178 | -			if ( is_array( $connected_accommodation ) && ! empty( $connected_accommodation ) ) { | |
| 179 | - $this->page_links['accommodation'] = esc_html__( 'Accommodation', 'to-reviews' ); | |
| 180 | - } | |
| 181 | - } | |
| 182 | - } | |
| 183 | - | |
| 184 | - /** | |
| 185 | - * Tests for the Related Tours and returns a link for the section | |
| 186 | - */ | |
| 187 | -	public function get_related_tours_link() { | |
| 188 | - $connected_tours = get_post_meta( get_the_ID(), 'tour_to_review', false ); | |
| 189 | - | |
| 190 | -		if ( post_type_exists( 'tour' ) && is_array( $connected_tours ) && ! empty( $connected_tours ) ) { | |
| 191 | - $connected_tours = new \WP_Query( array( | |
| 192 | - 'post_type' => 'tour', | |
| 193 | - 'post__in' => $connected_tours, | |
| 194 | - 'post_status' => 'publish', | |
| 195 | - 'nopagin' => true, | |
| 196 | - 'posts_per_page' => '-1', | |
| 197 | - 'fields' => 'ids', | |
| 198 | - ) ); | |
| 199 | - | |
| 200 | - $connected_tours = $connected_tours->posts; | |
| 201 | - | |
| 202 | -			if ( is_array( $connected_tours ) && ! empty( $connected_tours ) ) { | |
| 203 | - $this->page_links['tours'] = esc_html__( 'Tours', 'to-reviews' ); | |
| 204 | - } | |
| 205 | - } | |
| 206 | - } | |
| 207 | - | |
| 208 | - /** | |
| 209 | - * Tests for the Related Destinations and returns a link for the section | |
| 210 | - */ | |
| 211 | -	public function get_related_destinations_link() { | |
| 212 | - $connected_destination = ''; | |
| 213 | - $connected_destinations = get_post_meta( get_the_ID(), 'destination_to_review', false ); | |
| 214 | - | |
| 215 | -		if ( post_type_exists( 'destination' ) && is_array( $connected_destinations ) && ! empty( $connected_destinations ) ) { | |
| 216 | - $connected_destination = new \WP_Query( array( | |
| 217 | - 'post_type' => 'destination', | |
| 218 | - 'post__in' => $connected_destination, | |
| 219 | - 'post_status' => 'publish', | |
| 220 | - 'nopagin' => true, | |
| 221 | - 'posts_per_page' => '-1', | |
| 222 | - 'fields' => 'ids', | |
| 223 | - ) ); | |
| 224 | - | |
| 225 | - $connected_destination = $connected_destination->posts; | |
| 226 | - | |
| 227 | -			if ( is_array( $connected_destination ) && ! empty( $connected_destination ) ) { | |
| 228 | - $this->page_links['destinations'] = esc_html__( 'Destinations', 'to-reviews' ); | |
| 229 | - } | |
| 230 | - } | |
| 231 | - } | |
| 232 | - | |
| 233 | - /** | |
| 234 | - * Tests for the Gallery and returns a link for the section | |
| 235 | - */ | |
| 236 | -	public function get_gallery_link() { | |
| 237 | - $gallery_ids = get_post_meta( get_the_ID(), 'gallery', false ); | |
| 238 | - $envira_gallery = get_post_meta( get_the_ID(), 'envira_gallery', true ); | |
| 239 | - | |
| 240 | -		if ( ( ! empty( $gallery_ids ) && is_array( $gallery_ids ) ) || ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) ) { | |
| 241 | -			if ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) { | |
| 242 | - // Envira Gallery | |
| 243 | - $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-reviews' ); | |
| 244 | - return; | |
| 245 | -			} else { | |
| 246 | -				if ( function_exists( 'envira_dynamic' ) ) { | |
| 247 | - // Envira Gallery - Dynamic | |
| 248 | - $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-reviews' ); | |
| 249 | - return; | |
| 250 | -				} else { | |
| 251 | - // WordPress Gallery | |
| 252 | - $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-reviews' ); | |
| 253 | - return; | |
| 254 | - } | |
| 255 | - } | |
| 256 | - } | |
| 257 | - } | |
| 258 | - | |
| 259 | - /** | |
| 260 | - * Tests for the Videos and returns a link for the section | |
| 261 | - */ | |
| 262 | -	public function get_videos_link() { | |
| 263 | - $videos_id = false; | |
| 264 | - | |
| 265 | -		if ( class_exists( 'Envira_Videos' ) ) { | |
| 266 | - $videos_id = get_post_meta( get_the_ID(), 'envira_video', true ); | |
| 267 | - } | |
| 268 | - | |
| 269 | -		if ( empty( $videos_id ) && function_exists( 'lsx_to_videos' ) ) { | |
| 270 | - $videos_id = get_post_meta( get_the_ID(), 'videos', true ); | |
| 271 | - } | |
| 272 | - | |
| 273 | -		if ( ! empty( $videos_id ) ) { | |
| 274 | - $this->page_links['videos'] = esc_html__( 'Videos', 'to-reviews' ); | |
| 275 | - } | |
| 276 | - } | |
| 277 | - | |
| 278 | - /** | |
| 279 | - * Tests for the Related Posts and returns a link for the section | |
| 280 | - */ | |
| 281 | -	public function get_related_posts_link() { | |
| 282 | - $connected_posts = get_post_meta( get_the_ID(), 'post_to_review', false ); | |
| 283 | - | |
| 284 | -		if ( is_array( $connected_posts ) && ! empty( $connected_posts ) ) { | |
| 285 | - $connected_posts = new \WP_Query( array( | |
| 286 | - 'post_type' => 'post', | |
| 287 | - 'post__in' => $connected_posts, | |
| 288 | - 'post_status' => 'publish', | |
| 289 | - 'nopagin' => true, | |
| 290 | - 'posts_per_page' => '-1', | |
| 291 | - 'fields' => 'ids', | |
| 292 | - ) ); | |
| 293 | - | |
| 294 | - $connected_posts = $connected_posts->posts; | |
| 295 | - | |
| 296 | -			if ( is_array( $connected_posts ) && ! empty( $connected_posts ) ) { | |
| 297 | - $this->page_links['posts'] = esc_html__( 'Posts', 'to-reviews' ); | |
| 298 | - } | |
| 299 | - } | |
| 300 | - } | |
| 301 | - | |
| 302 | - /** | |
| 303 | - * Adds the template tags to the top of the archive review | |
| 304 | - */ | |
| 305 | -	public function archive_entry_top() { | |
| 306 | - global $lsx_to_archive; | |
| 307 | - | |
| 308 | -		if ( 'review' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { | |
| 309 | -			if ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?> | |
| 81 | + } | |
| 82 | + | |
| 83 | + /** | |
| 84 | + * Runs on init after all files have been parsed. | |
| 85 | + */ | |
| 86 | +     public function init() { | |
| 87 | + add_filter( 'lsx_to_custom_field_query',array( $this, 'rating' ),5,10 ); | |
| 88 | + } | |
| 89 | + | |
| 90 | + /** | |
| 91 | + * A filter to set the content area to a small column on single | |
| 92 | + */ | |
| 93 | +     public function entry_class( $classes ) { | |
| 94 | + global $lsx_to_archive; | |
| 95 | + | |
| 96 | +          if ( 1 !== $lsx_to_archive ) { | |
| 97 | + $lsx_to_archive = false; | |
| 98 | + } | |
| 99 | + | |
| 100 | +          if ( is_main_query() && is_singular( 'review' ) && false === $lsx_to_archive ) { | |
| 101 | +               //if ( lsx_to_has_enquiry_contact() ) { | |
| 102 | + $classes[] = 'col-xs-12 col-sm-8 col-md-9'; | |
| 103 | +               //} else { | |
| 104 | + //$classes[] = 'col-sm-12'; | |
| 105 | + //} | |
| 106 | + } | |
| 107 | + | |
| 108 | + return $classes; | |
| 109 | + } | |
| 110 | + | |
| 111 | + /** | |
| 112 | + * Filter and make the star ratings | |
| 113 | + */ | |
| 114 | +     public function rating( $html = '', $meta_key = false, $value = false, $before = '', $after = '' ) { | |
| 115 | +          if ( get_post_type() === 'review' && 'rating' === $meta_key ) { | |
| 116 | + $ratings_array = array(); | |
| 117 | + $counter = 5; | |
| 118 | + $html = ''; | |
| 119 | +               if ( 0 !== (int) $value ) { | |
| 120 | +                    while ( $counter > 0 ) { | |
| 121 | +                         if ( $value > 0 ) { | |
| 122 | + $ratings_array[] = '<i class="fa fa-star"></i>'; | |
| 123 | +                         } else { | |
| 124 | + $ratings_array[] = '<i class="fa fa-star-o"></i>'; | |
| 125 | + } | |
| 126 | + | |
| 127 | + $counter--; | |
| 128 | + $value--; | |
| 129 | + } | |
| 130 | + | |
| 131 | + $html = $before . implode( '', $ratings_array ) . $after; | |
| 132 | + } | |
| 133 | + } | |
| 134 | + return $html; | |
| 135 | + } | |
| 136 | + | |
| 137 | + /** | |
| 138 | + * Adds our navigation links to the review single post | |
| 139 | + * | |
| 140 | + * @param $page_links array | |
| 141 | + * @return $page_links array | |
| 142 | + */ | |
| 143 | +     public function page_links( $page_links ) { | |
| 144 | +          if ( is_singular( 'review' ) ) { | |
| 145 | + $this->page_links = $page_links; | |
| 146 | + | |
| 147 | + $this->get_related_accommodation_link(); | |
| 148 | + $this->get_related_tours_link(); | |
| 149 | + $this->get_related_destinations_link(); | |
| 150 | + $this->get_gallery_link(); | |
| 151 | + $this->get_videos_link(); | |
| 152 | + $this->get_related_posts_link(); | |
| 153 | + | |
| 154 | + $page_links = $this->page_links; | |
| 155 | + } | |
| 156 | + | |
| 157 | + return $page_links; | |
| 158 | + } | |
| 159 | + | |
| 160 | + /** | |
| 161 | + * Tests for the Related Accommodation and returns a link for the section | |
| 162 | + */ | |
| 163 | +     public function get_related_accommodation_link() { | |
| 164 | + $connected_accommodation = get_post_meta( get_the_ID(), 'accommodation_to_review', false ); | |
| 165 | + | |
| 166 | +          if ( post_type_exists( 'accommodation' ) && is_array( $connected_accommodation ) && ! empty( $connected_accommodation ) ) { | |
| 167 | + $connected_accommodation = new \WP_Query( array( | |
| 168 | + 'post_type' => 'accommodation', | |
| 169 | + 'post__in' => $connected_accommodation, | |
| 170 | + 'post_status' => 'publish', | |
| 171 | + 'nopagin' => true, | |
| 172 | + 'posts_per_page' => '-1', | |
| 173 | + 'fields' => 'ids', | |
| 174 | + ) ); | |
| 175 | + | |
| 176 | + $connected_accommodation = $connected_accommodation->posts; | |
| 177 | + | |
| 178 | +               if ( is_array( $connected_accommodation ) && ! empty( $connected_accommodation ) ) { | |
| 179 | + $this->page_links['accommodation'] = esc_html__( 'Accommodation', 'to-reviews' ); | |
| 180 | + } | |
| 181 | + } | |
| 182 | + } | |
| 183 | + | |
| 184 | + /** | |
| 185 | + * Tests for the Related Tours and returns a link for the section | |
| 186 | + */ | |
| 187 | +     public function get_related_tours_link() { | |
| 188 | + $connected_tours = get_post_meta( get_the_ID(), 'tour_to_review', false ); | |
| 189 | + | |
| 190 | +          if ( post_type_exists( 'tour' ) && is_array( $connected_tours ) && ! empty( $connected_tours ) ) { | |
| 191 | + $connected_tours = new \WP_Query( array( | |
| 192 | + 'post_type' => 'tour', | |
| 193 | + 'post__in' => $connected_tours, | |
| 194 | + 'post_status' => 'publish', | |
| 195 | + 'nopagin' => true, | |
| 196 | + 'posts_per_page' => '-1', | |
| 197 | + 'fields' => 'ids', | |
| 198 | + ) ); | |
| 199 | + | |
| 200 | + $connected_tours = $connected_tours->posts; | |
| 201 | + | |
| 202 | +               if ( is_array( $connected_tours ) && ! empty( $connected_tours ) ) { | |
| 203 | + $this->page_links['tours'] = esc_html__( 'Tours', 'to-reviews' ); | |
| 204 | + } | |
| 205 | + } | |
| 206 | + } | |
| 207 | + | |
| 208 | + /** | |
| 209 | + * Tests for the Related Destinations and returns a link for the section | |
| 210 | + */ | |
| 211 | +     public function get_related_destinations_link() { | |
| 212 | + $connected_destination = ''; | |
| 213 | + $connected_destinations = get_post_meta( get_the_ID(), 'destination_to_review', false ); | |
| 214 | + | |
| 215 | +          if ( post_type_exists( 'destination' ) && is_array( $connected_destinations ) && ! empty( $connected_destinations ) ) { | |
| 216 | + $connected_destination = new \WP_Query( array( | |
| 217 | + 'post_type' => 'destination', | |
| 218 | + 'post__in' => $connected_destination, | |
| 219 | + 'post_status' => 'publish', | |
| 220 | + 'nopagin' => true, | |
| 221 | + 'posts_per_page' => '-1', | |
| 222 | + 'fields' => 'ids', | |
| 223 | + ) ); | |
| 224 | + | |
| 225 | + $connected_destination = $connected_destination->posts; | |
| 226 | + | |
| 227 | +               if ( is_array( $connected_destination ) && ! empty( $connected_destination ) ) { | |
| 228 | + $this->page_links['destinations'] = esc_html__( 'Destinations', 'to-reviews' ); | |
| 229 | + } | |
| 230 | + } | |
| 231 | + } | |
| 232 | + | |
| 233 | + /** | |
| 234 | + * Tests for the Gallery and returns a link for the section | |
| 235 | + */ | |
| 236 | +     public function get_gallery_link() { | |
| 237 | + $gallery_ids = get_post_meta( get_the_ID(), 'gallery', false ); | |
| 238 | + $envira_gallery = get_post_meta( get_the_ID(), 'envira_gallery', true ); | |
| 239 | + | |
| 240 | +          if ( ( ! empty( $gallery_ids ) && is_array( $gallery_ids ) ) || ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) ) { | |
| 241 | +               if ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) { | |
| 242 | + // Envira Gallery | |
| 243 | + $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-reviews' ); | |
| 244 | + return; | |
| 245 | +               } else { | |
| 246 | +                    if ( function_exists( 'envira_dynamic' ) ) { | |
| 247 | + // Envira Gallery - Dynamic | |
| 248 | + $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-reviews' ); | |
| 249 | + return; | |
| 250 | +                    } else { | |
| 251 | + // WordPress Gallery | |
| 252 | + $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-reviews' ); | |
| 253 | + return; | |
| 254 | + } | |
| 255 | + } | |
| 256 | + } | |
| 257 | + } | |
| 258 | + | |
| 259 | + /** | |
| 260 | + * Tests for the Videos and returns a link for the section | |
| 261 | + */ | |
| 262 | +     public function get_videos_link() { | |
| 263 | + $videos_id = false; | |
| 264 | + | |
| 265 | +          if ( class_exists( 'Envira_Videos' ) ) { | |
| 266 | + $videos_id = get_post_meta( get_the_ID(), 'envira_video', true ); | |
| 267 | + } | |
| 268 | + | |
| 269 | +          if ( empty( $videos_id ) && function_exists( 'lsx_to_videos' ) ) { | |
| 270 | + $videos_id = get_post_meta( get_the_ID(), 'videos', true ); | |
| 271 | + } | |
| 272 | + | |
| 273 | +          if ( ! empty( $videos_id ) ) { | |
| 274 | + $this->page_links['videos'] = esc_html__( 'Videos', 'to-reviews' ); | |
| 275 | + } | |
| 276 | + } | |
| 277 | + | |
| 278 | + /** | |
| 279 | + * Tests for the Related Posts and returns a link for the section | |
| 280 | + */ | |
| 281 | +     public function get_related_posts_link() { | |
| 282 | + $connected_posts = get_post_meta( get_the_ID(), 'post_to_review', false ); | |
| 283 | + | |
| 284 | +          if ( is_array( $connected_posts ) && ! empty( $connected_posts ) ) { | |
| 285 | + $connected_posts = new \WP_Query( array( | |
| 286 | + 'post_type' => 'post', | |
| 287 | + 'post__in' => $connected_posts, | |
| 288 | + 'post_status' => 'publish', | |
| 289 | + 'nopagin' => true, | |
| 290 | + 'posts_per_page' => '-1', | |
| 291 | + 'fields' => 'ids', | |
| 292 | + ) ); | |
| 293 | + | |
| 294 | + $connected_posts = $connected_posts->posts; | |
| 295 | + | |
| 296 | +               if ( is_array( $connected_posts ) && ! empty( $connected_posts ) ) { | |
| 297 | + $this->page_links['posts'] = esc_html__( 'Posts', 'to-reviews' ); | |
| 298 | + } | |
| 299 | + } | |
| 300 | + } | |
| 301 | + | |
| 302 | + /** | |
| 303 | + * Adds the template tags to the top of the archive review | |
| 304 | + */ | |
| 305 | +     public function archive_entry_top() { | |
| 306 | + global $lsx_to_archive; | |
| 307 | + | |
| 308 | +          if ( 'review' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { | |
| 309 | +               if ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?> | |
| 310 | 310 | <div class="lsx-to-archive-meta-data lsx-to-archive-meta-data-grid-mode"> | 
| 311 | 311 | <?php | 
| 312 | - $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; | |
| 312 | + $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; | |
| 313 | 313 | |
| 314 | - lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'to-reviews' ) . ':</span> ', '</span>' ); | |
| 315 | - lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'to-reviews' ) . ':</span> ', '</span>' ); | |
| 316 | - lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Destinations', 'to-reviews' ) . ':</span> ', '</span>' ); | |
| 317 | - ?> | |
| 314 | + lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'to-reviews' ) . ':</span> ', '</span>' ); | |
| 315 | + lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'to-reviews' ) . ':</span> ', '</span>' ); | |
| 316 | + lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Destinations', 'to-reviews' ) . ':</span> ', '</span>' ); | |
| 317 | + ?> | |
| 318 | 318 | </div> | 
| 319 | 319 | <?php } ?> | 
| 320 | 320 | <?php } | 
| 321 | - } | |
| 321 | + } | |
| 322 | 322 | |
| 323 | - /** | |
| 324 | - * Adds the template tags to the bottom of the archive review | |
| 325 | - */ | |
| 326 | -	public function archive_entry_bottom() { | |
| 327 | - global $lsx_to_archive; | |
| 323 | + /** | |
| 324 | + * Adds the template tags to the bottom of the archive review | |
| 325 | + */ | |
| 326 | +     public function archive_entry_bottom() { | |
| 327 | + global $lsx_to_archive; | |
| 328 | 328 | |
| 329 | -		if ( 'review' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { ?> | |
| 329 | +          if ( 'review' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { ?> | |
| 330 | 330 | </div> | 
| 331 | 331 | |
| 332 | 332 |  				<?php if ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?> | 
| 333 | 333 | <div class="lsx-to-archive-meta-data lsx-to-archive-meta-data-list-mode"> | 
| 334 | 334 | <?php | 
| 335 | - $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; | |
| 335 | + $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; | |
| 336 | 336 | |
| 337 | - lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'to-reviews' ) . ':</span> ', '</span>' ); | |
| 338 | - lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'to-reviews' ) . ':</span> ', '</span>' ); | |
| 339 | - lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Destinations', 'to-reviews' ) . ':</span> ', '</span>' ); | |
| 340 | - ?> | |
| 337 | + lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'to-reviews' ) . ':</span> ', '</span>' ); | |
| 338 | + lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'to-reviews' ) . ':</span> ', '</span>' ); | |
| 339 | + lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Destinations', 'to-reviews' ) . ':</span> ', '</span>' ); | |
| 340 | + ?> | |
| 341 | 341 | </div> | 
| 342 | 342 | <?php } ?> | 
| 343 | 343 | </div> | 
| @@ -348,51 +348,51 @@ discard block | ||
| 348 | 348 | <a href="<?php the_permalink(); ?>" class="moretag"><?php esc_html_e( 'View more', 'to-reviews' ); ?></a> | 
| 349 | 349 | <?php endif; ?> | 
| 350 | 350 | <?php } | 
| 351 | - } | |
| 351 | + } | |
| 352 | 352 | |
| 353 | - /** | |
| 354 | - * Adds the template tags fast facts | |
| 355 | - */ | |
| 356 | -	public function single_fast_facts() { | |
| 357 | -		if ( is_singular( 'review' ) ) { ?> | |
| 353 | + /** | |
| 354 | + * Adds the template tags fast facts | |
| 355 | + */ | |
| 356 | +     public function single_fast_facts() { | |
| 357 | +          if ( is_singular( 'review' ) ) { ?> | |
| 358 | 358 | <section id="fast-facts"> | 
| 359 | 359 | <div class="lsx-to-single-meta-data"> | 
| 360 | 360 | <?php | 
| 361 | - $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; | |
| 362 | - | |
| 363 | - lsx_to_review_rating( '<span class="' . $meta_class . 'rating"><span class="lsx-to-meta-data-key">' . esc_html__( 'Rating', 'to-reviews' ) . ':</span> ', '</span>' ); | |
| 364 | - lsx_to_review_dates( '<span class="' . $meta_class . 'travel-dates"><span class="lsx-to-meta-data-key">' . esc_html__( 'Date Travelled', 'to-reviews' ) . ':</span> ', '</span>' ); | |
| 365 | - lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . esc_html__( 'Accommodation', 'to-reviews' ) . ':</span> ', '</span>' ); | |
| 366 | - lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . esc_html__( 'Tours', 'to-reviews' ) . ':</span> ', '</span>' ); | |
| 367 | - lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . esc_html__( 'Destinations', 'to-reviews' ) . ':</span> ', '</span>' ); | |
| 368 | - ?> | |
| 361 | + $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; | |
| 362 | + | |
| 363 | + lsx_to_review_rating( '<span class="' . $meta_class . 'rating"><span class="lsx-to-meta-data-key">' . esc_html__( 'Rating', 'to-reviews' ) . ':</span> ', '</span>' ); | |
| 364 | + lsx_to_review_dates( '<span class="' . $meta_class . 'travel-dates"><span class="lsx-to-meta-data-key">' . esc_html__( 'Date Travelled', 'to-reviews' ) . ':</span> ', '</span>' ); | |
| 365 | + lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . esc_html__( 'Accommodation', 'to-reviews' ) . ':</span> ', '</span>' ); | |
| 366 | + lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . esc_html__( 'Tours', 'to-reviews' ) . ':</span> ', '</span>' ); | |
| 367 | + lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . esc_html__( 'Destinations', 'to-reviews' ) . ':</span> ', '</span>' ); | |
| 368 | + ?> | |
| 369 | 369 | </div> | 
| 370 | 370 | </section> | 
| 371 | 371 | <?php } | 
| 372 | - } | |
| 372 | + } | |
| 373 | 373 | |
| 374 | - /** | |
| 375 | - * Adds the template tags to the bottom of the single review | |
| 376 | - */ | |
| 377 | -	public function single_content_bottom() { | |
| 378 | -		if ( is_singular( 'review' ) ) { | |
| 379 | - lsx_to_review_accommodation(); | |
| 374 | + /** | |
| 375 | + * Adds the template tags to the bottom of the single review | |
| 376 | + */ | |
| 377 | +     public function single_content_bottom() { | |
| 378 | +          if ( is_singular( 'review' ) ) { | |
| 379 | + lsx_to_review_accommodation(); | |
| 380 | 380 | |
| 381 | - lsx_to_review_tour(); | |
| 381 | + lsx_to_review_tour(); | |
| 382 | 382 | |
| 383 | - lsx_to_review_destination(); | |
| 383 | + lsx_to_review_destination(); | |
| 384 | 384 | |
| 385 | - 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-reviews' ) . '</h2><div id="collapse-gallery" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); | |
| 385 | + 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-reviews' ) . '</h2><div id="collapse-gallery" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); | |
| 386 | 386 | |
| 387 | -			if ( function_exists( 'lsx_to_videos' ) ) { | |
| 388 | - 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-reviews' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); | |
| 389 | -			} elseif ( class_exists( 'Envira_Videos' ) ) { | |
| 390 | - 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-reviews' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); | |
| 391 | - } | |
| 387 | +               if ( function_exists( 'lsx_to_videos' ) ) { | |
| 388 | + 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-reviews' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); | |
| 389 | +               } elseif ( class_exists( 'Envira_Videos' ) ) { | |
| 390 | + 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-reviews' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); | |
| 391 | + } | |
| 392 | 392 | |
| 393 | - lsx_to_review_posts(); | |
| 394 | - } | |
| 395 | - } | |
| 393 | + lsx_to_review_posts(); | |
| 394 | + } | |
| 395 | + } | |
| 396 | 396 | |
| 397 | 397 | } | 
| 398 | 398 | |
| @@ -9,230 +9,230 @@ | ||
| 9 | 9 | * @copyright 2016 LightSpeedDevelopment | 
| 10 | 10 | */ | 
| 11 | 11 |  if (!class_exists( 'LSX_TO_Reviews' ) ) { | 
| 12 | - /** | |
| 13 | - * Main plugin class. | |
| 14 | - * | |
| 15 | - * @package LSX_TO_Reviews | |
| 16 | - * @author LightSpeed | |
| 17 | - */ | |
| 18 | -	class LSX_TO_Reviews { | |
| 12 | + /** | |
| 13 | + * Main plugin class. | |
| 14 | + * | |
| 15 | + * @package LSX_TO_Reviews | |
| 16 | + * @author LightSpeed | |
| 17 | + */ | |
| 18 | +     class LSX_TO_Reviews { | |
| 19 | 19 | |
| 20 | - /** | |
| 21 | - * The plugins id | |
| 22 | - */ | |
| 23 | - public $plugin_slug = 'to-reviews'; | |
| 24 | - | |
| 25 | - /** | |
| 26 | - * The post types the plugin registers | |
| 27 | - */ | |
| 28 | - public $post_types = false; | |
| 29 | - | |
| 30 | - /** | |
| 31 | - * The singular post types the plugin registers | |
| 32 | - */ | |
| 33 | - public $post_types_singular = false; | |
| 34 | - | |
| 35 | - /** | |
| 36 | - * An array of the post types slugs plugin registers | |
| 37 | - */ | |
| 38 | - public $post_type_slugs = false; | |
| 39 | - | |
| 40 | - /** | |
| 41 | - * The taxonomies the plugin registers | |
| 42 | - */ | |
| 43 | - public $taxonomies = false; | |
| 44 | - | |
| 45 | - /** | |
| 46 | - * The taxonomies the plugin registers (plural) | |
| 47 | - */ | |
| 48 | - public $taxonomies_plural = false; | |
| 49 | - | |
| 50 | - /** | |
| 51 | - * Constructor | |
| 52 | - */ | |
| 53 | -		public function __construct() { | |
| 54 | - //Set the variables | |
| 55 | - $this->set_vars(); | |
| 56 | - $this->lsx_to_search_integration(); | |
| 57 | - | |
| 58 | - // Make TO last plugin to load. | |
| 59 | - add_action( 'activated_plugin', array( $this, 'activated_plugin' ) ); | |
| 60 | - | |
| 61 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); | |
| 62 | - | |
| 63 | -			if ( false !== $this->post_types ) { | |
| 64 | - add_filter( 'lsx_to_framework_post_types', array( $this, 'post_types_filter' ) ); | |
| 65 | - add_filter( 'lsx_to_post_types', array( $this, 'post_types_filter' ) ); | |
| 66 | - add_filter( 'lsx_to_post_types_singular', array( $this, 'post_types_singular_filter' ) ); | |
| 67 | - add_filter( 'lsx_to_settings_path', array( $this, 'plugin_path' ), 10, 2 ); | |
| 68 | - } | |
| 69 | -			if ( false !== $this->taxonomies ) { | |
| 70 | - add_filter( 'lsx_to_framework_taxonomies', array( $this, 'taxonomies_filter' ) ); | |
| 71 | - add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'taxonomies_plural_filter' ) ); | |
| 72 | - } | |
| 73 | - | |
| 74 | - require_once LSX_TO_REVIEWS_PATH . '/classes/class-to-reviews-admin.php'; | |
| 75 | - require_once LSX_TO_REVIEWS_PATH . '/classes/class-to-reviews-frontend.php'; | |
| 76 | - require_once LSX_TO_REVIEWS_PATH . '/includes/template-tags.php'; | |
| 77 | - | |
| 78 | - // flush_rewrite_rules. | |
| 79 | - register_activation_hook( LSX_TO_REVIEWS_CORE, array( $this, 'register_activation_hook' ) ); | |
| 80 | - add_action( 'admin_init', array( $this, 'register_activation_hook_check' ) ); | |
| 81 | - | |
| 82 | - add_filter( 'wpseo_schema_graph_pieces', array( $this, 'add_graph_pieces' ), 11, 2 ); | |
| 83 | - } | |
| 84 | - | |
| 85 | - /** | |
| 86 | - * Include the post type for the search integration | |
| 87 | - */ | |
| 88 | -		public function lsx_to_search_integration(){ | |
| 89 | - add_filter( 'lsx_to_search_post_types', array( $this, 'post_types_filter' ) ); | |
| 90 | - add_filter( 'lsx_to_search_taxonomies', array( $this, 'taxonomies_filter' ) ); | |
| 91 | - } | |
| 20 | + /** | |
| 21 | + * The plugins id | |
| 22 | + */ | |
| 23 | + public $plugin_slug = 'to-reviews'; | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * The post types the plugin registers | |
| 27 | + */ | |
| 28 | + public $post_types = false; | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * The singular post types the plugin registers | |
| 32 | + */ | |
| 33 | + public $post_types_singular = false; | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * An array of the post types slugs plugin registers | |
| 37 | + */ | |
| 38 | + public $post_type_slugs = false; | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * The taxonomies the plugin registers | |
| 42 | + */ | |
| 43 | + public $taxonomies = false; | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * The taxonomies the plugin registers (plural) | |
| 47 | + */ | |
| 48 | + public $taxonomies_plural = false; | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * Constructor | |
| 52 | + */ | |
| 53 | +          public function __construct() { | |
| 54 | + //Set the variables | |
| 55 | + $this->set_vars(); | |
| 56 | + $this->lsx_to_search_integration(); | |
| 57 | + | |
| 58 | + // Make TO last plugin to load. | |
| 59 | + add_action( 'activated_plugin', array( $this, 'activated_plugin' ) ); | |
| 60 | + | |
| 61 | + add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); | |
| 62 | + | |
| 63 | +               if ( false !== $this->post_types ) { | |
| 64 | + add_filter( 'lsx_to_framework_post_types', array( $this, 'post_types_filter' ) ); | |
| 65 | + add_filter( 'lsx_to_post_types', array( $this, 'post_types_filter' ) ); | |
| 66 | + add_filter( 'lsx_to_post_types_singular', array( $this, 'post_types_singular_filter' ) ); | |
| 67 | + add_filter( 'lsx_to_settings_path', array( $this, 'plugin_path' ), 10, 2 ); | |
| 68 | + } | |
| 69 | +               if ( false !== $this->taxonomies ) { | |
| 70 | + add_filter( 'lsx_to_framework_taxonomies', array( $this, 'taxonomies_filter' ) ); | |
| 71 | + add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'taxonomies_plural_filter' ) ); | |
| 72 | + } | |
| 73 | + | |
| 74 | + require_once LSX_TO_REVIEWS_PATH . '/classes/class-to-reviews-admin.php'; | |
| 75 | + require_once LSX_TO_REVIEWS_PATH . '/classes/class-to-reviews-frontend.php'; | |
| 76 | + require_once LSX_TO_REVIEWS_PATH . '/includes/template-tags.php'; | |
| 77 | + | |
| 78 | + // flush_rewrite_rules. | |
| 79 | + register_activation_hook( LSX_TO_REVIEWS_CORE, array( $this, 'register_activation_hook' ) ); | |
| 80 | + add_action( 'admin_init', array( $this, 'register_activation_hook_check' ) ); | |
| 81 | + | |
| 82 | + add_filter( 'wpseo_schema_graph_pieces', array( $this, 'add_graph_pieces' ), 11, 2 ); | |
| 83 | + } | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * Include the post type for the search integration | |
| 87 | + */ | |
| 88 | +          public function lsx_to_search_integration(){ | |
| 89 | + add_filter( 'lsx_to_search_post_types', array( $this, 'post_types_filter' ) ); | |
| 90 | + add_filter( 'lsx_to_search_taxonomies', array( $this, 'taxonomies_filter' ) ); | |
| 91 | + } | |
| 92 | 92 | |
| 93 | - /** | |
| 94 | - * Load the plugin text domain for translation. | |
| 95 | - */ | |
| 96 | -		public function load_plugin_textdomain() { | |
| 97 | - load_plugin_textdomain( 'to-reviews', FALSE, basename( LSX_TO_REVIEWS_PATH ) . '/languages'); | |
| 98 | - } | |
| 99 | - | |
| 100 | - /** | |
| 101 | - * Sets the plugins variables | |
| 102 | - */ | |
| 103 | -		public function set_vars() { | |
| 104 | - $this->post_types = array( | |
| 105 | -				'review'	=>	__('Reviews','to-reviews') | |
| 106 | - ); | |
| 107 | - $this->post_types_singular = array( | |
| 108 | -				'review'	=>	__('Review','to-reviews') | |
| 109 | - ); | |
| 110 | - $this->post_type_slugs = array_keys($this->post_types); | |
| 111 | - } | |
| 112 | - | |
| 113 | - /** | |
| 114 | - * Adds our post types to an array via a filter | |
| 115 | - */ | |
| 116 | -		public function plugin_path($path,$post_type){ | |
| 117 | -			if(false !== $this->post_types && array_key_exists($post_type,$this->post_types)){ | |
| 118 | - $path = LSX_TO_REVIEWS_PATH; | |
| 119 | - } | |
| 120 | - return $path; | |
| 121 | - } | |
| 122 | - | |
| 123 | - /** | |
| 124 | - * Adds our post types to an array via a filter | |
| 125 | - */ | |
| 126 | -		public function post_types_slugs_filter($post_types){ | |
| 127 | -			if(is_array($post_types)){ | |
| 128 | - $post_types = array_merge($post_types,$this->post_type_slugs); | |
| 129 | -			}else{ | |
| 130 | - $post_types = $this->post_type_slugs; | |
| 131 | - } | |
| 132 | - return $post_types; | |
| 133 | - } | |
| 134 | - | |
| 135 | - /** | |
| 136 | - * Adds our post types to an array via a filter | |
| 137 | - */ | |
| 138 | -		public function post_types_filter( $post_types ) { | |
| 139 | -			if ( is_array( $post_types ) && is_array( $this->post_types ) ) { | |
| 140 | - $post_types = array_merge( $post_types, $this->post_types ); | |
| 141 | -			} elseif ( is_array( $this->post_types ) ) { | |
| 142 | - $post_types = $this->post_types; | |
| 143 | - } | |
| 144 | - return $post_types; | |
| 145 | - } | |
| 146 | - | |
| 147 | - /** | |
| 148 | - * Adds our post types to an array via a filter | |
| 149 | - */ | |
| 150 | -		public function post_types_singular_filter( $post_types_singular ) { | |
| 151 | -			if ( is_array( $post_types_singular ) && is_array( $this->post_types_singular ) ) { | |
| 152 | - $post_types_singular = array_merge( $post_types_singular, $this->post_types_singular ); | |
| 153 | -			} elseif ( is_array( $this->post_types_singular ) ) { | |
| 154 | - $post_types_singular = $this->post_types_singular; | |
| 155 | - } | |
| 156 | - return $post_types_singular; | |
| 157 | - } | |
| 158 | - | |
| 159 | - /** | |
| 160 | - * Adds our taxonomies to an array via a filter | |
| 161 | - */ | |
| 162 | -		public function taxonomies_filter( $taxonomies ) { | |
| 163 | -			if ( is_array( $taxonomies ) && is_array( $this->taxonomies ) ) { | |
| 164 | - $taxonomies = array_merge( $taxonomies, $this->taxonomies ); | |
| 165 | -			} elseif ( is_array( $this->taxonomies ) ) { | |
| 166 | - $taxonomies = $this->taxonomies; | |
| 167 | - } | |
| 168 | - return $taxonomies; | |
| 169 | - } | |
| 170 | - | |
| 171 | - /** | |
| 172 | - * Adds our taxonomies_plural to an array via a filter | |
| 173 | - */ | |
| 174 | -		public function taxonomies_plural_filter( $taxonomies_plural ) { | |
| 175 | -			if ( is_array( $taxonomies_plural ) && is_array( $this->taxonomies_plural ) ) { | |
| 176 | - $taxonomies_plural = array_merge( $taxonomies_plural, $this->taxonomies_plural ); | |
| 177 | -			} elseif ( is_array( $this->taxonomies_plural ) ) { | |
| 178 | - $taxonomies_plural = $this->taxonomies_plural; | |
| 179 | - } | |
| 180 | - return $taxonomies_plural; | |
| 181 | - } | |
| 182 | - | |
| 183 | - /** | |
| 184 | - * Make TO last plugin to load. | |
| 185 | - */ | |
| 186 | -		public function activated_plugin() { | |
| 187 | -			if ( $plugins = get_option( 'active_plugins' ) ) { | |
| 188 | - $search = preg_grep( '/.*\/tour-operator\.php/', $plugins ); | |
| 189 | - $key = array_search( $search, $plugins ); | |
| 190 | - | |
| 191 | -				if ( is_array( $search ) && count( $search ) ) { | |
| 192 | -					foreach ( $search as $key => $path ) { | |
| 193 | - array_splice( $plugins, $key, 1 ); | |
| 194 | - array_push( $plugins, $path ); | |
| 195 | - update_option( 'active_plugins', $plugins ); | |
| 196 | - } | |
| 197 | - } | |
| 198 | - } | |
| 199 | - } | |
| 200 | - | |
| 201 | - /** | |
| 202 | - * On plugin activation | |
| 203 | - */ | |
| 204 | -		public function register_activation_hook() { | |
| 205 | -			if ( ! is_network_admin() && ! isset( $_GET['activate-multi'] ) ) { | |
| 206 | - set_transient( '_tour_operators_reviews_flush_rewrite_rules', 1, 30 ); | |
| 207 | - } | |
| 208 | - } | |
| 209 | - | |
| 210 | - /** | |
| 211 | - * On plugin activation (check) | |
| 212 | - */ | |
| 213 | -		public function register_activation_hook_check() { | |
| 214 | -			if ( ! get_transient( '_tour_operators_reviews_flush_rewrite_rules' ) ) { | |
| 215 | - return; | |
| 216 | - } | |
| 217 | - | |
| 218 | - delete_transient( '_tour_operators_reviews_flush_rewrite_rules' ); | |
| 219 | - flush_rewrite_rules(); | |
| 220 | - } | |
| 221 | - /** | |
| 222 | - * Adds Schema pieces to our output. | |
| 223 | - * | |
| 224 | - * @param array $pieces Graph pieces to output. | |
| 225 | - * @param \WPSEO_Schema_Context $context Object with context variables. | |
| 226 | - * | |
| 227 | - * @return array $pieces Graph pieces to output. | |
| 228 | - */ | |
| 229 | -		public function add_graph_pieces( $pieces, $context ) { | |
| 230 | -			if ( class_exists( 'LSX_TO_Schema_Graph_Piece' ) ) { | |
| 231 | - require_once LSX_TO_REVIEWS_PATH . '/classes/class-to-review-schema.php'; | |
| 232 | - $pieces[] = new LSX_TO_Schema_Review( $context ); | |
| 233 | - } | |
| 234 | - return $pieces; | |
| 235 | - } | |
| 236 | - } | |
| 237 | - new LSX_TO_Reviews(); | |
| 93 | + /** | |
| 94 | + * Load the plugin text domain for translation. | |
| 95 | + */ | |
| 96 | +          public function load_plugin_textdomain() { | |
| 97 | + load_plugin_textdomain( 'to-reviews', FALSE, basename( LSX_TO_REVIEWS_PATH ) . '/languages'); | |
| 98 | + } | |
| 99 | + | |
| 100 | + /** | |
| 101 | + * Sets the plugins variables | |
| 102 | + */ | |
| 103 | +          public function set_vars() { | |
| 104 | + $this->post_types = array( | |
| 105 | +                    'review'	=>	__('Reviews','to-reviews') | |
| 106 | + ); | |
| 107 | + $this->post_types_singular = array( | |
| 108 | +                    'review'	=>	__('Review','to-reviews') | |
| 109 | + ); | |
| 110 | + $this->post_type_slugs = array_keys($this->post_types); | |
| 111 | + } | |
| 112 | + | |
| 113 | + /** | |
| 114 | + * Adds our post types to an array via a filter | |
| 115 | + */ | |
| 116 | +          public function plugin_path($path,$post_type){ | |
| 117 | +               if(false !== $this->post_types && array_key_exists($post_type,$this->post_types)){ | |
| 118 | + $path = LSX_TO_REVIEWS_PATH; | |
| 119 | + } | |
| 120 | + return $path; | |
| 121 | + } | |
| 122 | + | |
| 123 | + /** | |
| 124 | + * Adds our post types to an array via a filter | |
| 125 | + */ | |
| 126 | +          public function post_types_slugs_filter($post_types){ | |
| 127 | +               if(is_array($post_types)){ | |
| 128 | + $post_types = array_merge($post_types,$this->post_type_slugs); | |
| 129 | +               }else{ | |
| 130 | + $post_types = $this->post_type_slugs; | |
| 131 | + } | |
| 132 | + return $post_types; | |
| 133 | + } | |
| 134 | + | |
| 135 | + /** | |
| 136 | + * Adds our post types to an array via a filter | |
| 137 | + */ | |
| 138 | +          public function post_types_filter( $post_types ) { | |
| 139 | +               if ( is_array( $post_types ) && is_array( $this->post_types ) ) { | |
| 140 | + $post_types = array_merge( $post_types, $this->post_types ); | |
| 141 | +               } elseif ( is_array( $this->post_types ) ) { | |
| 142 | + $post_types = $this->post_types; | |
| 143 | + } | |
| 144 | + return $post_types; | |
| 145 | + } | |
| 146 | + | |
| 147 | + /** | |
| 148 | + * Adds our post types to an array via a filter | |
| 149 | + */ | |
| 150 | +          public function post_types_singular_filter( $post_types_singular ) { | |
| 151 | +               if ( is_array( $post_types_singular ) && is_array( $this->post_types_singular ) ) { | |
| 152 | + $post_types_singular = array_merge( $post_types_singular, $this->post_types_singular ); | |
| 153 | +               } elseif ( is_array( $this->post_types_singular ) ) { | |
| 154 | + $post_types_singular = $this->post_types_singular; | |
| 155 | + } | |
| 156 | + return $post_types_singular; | |
| 157 | + } | |
| 158 | + | |
| 159 | + /** | |
| 160 | + * Adds our taxonomies to an array via a filter | |
| 161 | + */ | |
| 162 | +          public function taxonomies_filter( $taxonomies ) { | |
| 163 | +               if ( is_array( $taxonomies ) && is_array( $this->taxonomies ) ) { | |
| 164 | + $taxonomies = array_merge( $taxonomies, $this->taxonomies ); | |
| 165 | +               } elseif ( is_array( $this->taxonomies ) ) { | |
| 166 | + $taxonomies = $this->taxonomies; | |
| 167 | + } | |
| 168 | + return $taxonomies; | |
| 169 | + } | |
| 170 | + | |
| 171 | + /** | |
| 172 | + * Adds our taxonomies_plural to an array via a filter | |
| 173 | + */ | |
| 174 | +          public function taxonomies_plural_filter( $taxonomies_plural ) { | |
| 175 | +               if ( is_array( $taxonomies_plural ) && is_array( $this->taxonomies_plural ) ) { | |
| 176 | + $taxonomies_plural = array_merge( $taxonomies_plural, $this->taxonomies_plural ); | |
| 177 | +               } elseif ( is_array( $this->taxonomies_plural ) ) { | |
| 178 | + $taxonomies_plural = $this->taxonomies_plural; | |
| 179 | + } | |
| 180 | + return $taxonomies_plural; | |
| 181 | + } | |
| 182 | + | |
| 183 | + /** | |
| 184 | + * Make TO last plugin to load. | |
| 185 | + */ | |
| 186 | +          public function activated_plugin() { | |
| 187 | +               if ( $plugins = get_option( 'active_plugins' ) ) { | |
| 188 | + $search = preg_grep( '/.*\/tour-operator\.php/', $plugins ); | |
| 189 | + $key = array_search( $search, $plugins ); | |
| 190 | + | |
| 191 | +                    if ( is_array( $search ) && count( $search ) ) { | |
| 192 | +                         foreach ( $search as $key => $path ) { | |
| 193 | + array_splice( $plugins, $key, 1 ); | |
| 194 | + array_push( $plugins, $path ); | |
| 195 | + update_option( 'active_plugins', $plugins ); | |
| 196 | + } | |
| 197 | + } | |
| 198 | + } | |
| 199 | + } | |
| 200 | + | |
| 201 | + /** | |
| 202 | + * On plugin activation | |
| 203 | + */ | |
| 204 | +          public function register_activation_hook() { | |
| 205 | +               if ( ! is_network_admin() && ! isset( $_GET['activate-multi'] ) ) { | |
| 206 | + set_transient( '_tour_operators_reviews_flush_rewrite_rules', 1, 30 ); | |
| 207 | + } | |
| 208 | + } | |
| 209 | + | |
| 210 | + /** | |
| 211 | + * On plugin activation (check) | |
| 212 | + */ | |
| 213 | +          public function register_activation_hook_check() { | |
| 214 | +               if ( ! get_transient( '_tour_operators_reviews_flush_rewrite_rules' ) ) { | |
| 215 | + return; | |
| 216 | + } | |
| 217 | + | |
| 218 | + delete_transient( '_tour_operators_reviews_flush_rewrite_rules' ); | |
| 219 | + flush_rewrite_rules(); | |
| 220 | + } | |
| 221 | + /** | |
| 222 | + * Adds Schema pieces to our output. | |
| 223 | + * | |
| 224 | + * @param array $pieces Graph pieces to output. | |
| 225 | + * @param \WPSEO_Schema_Context $context Object with context variables. | |
| 226 | + * | |
| 227 | + * @return array $pieces Graph pieces to output. | |
| 228 | + */ | |
| 229 | +          public function add_graph_pieces( $pieces, $context ) { | |
| 230 | +               if ( class_exists( 'LSX_TO_Schema_Graph_Piece' ) ) { | |
| 231 | + require_once LSX_TO_REVIEWS_PATH . '/classes/class-to-review-schema.php'; | |
| 232 | + $pieces[] = new LSX_TO_Schema_Review( $context ); | |
| 233 | + } | |
| 234 | + return $pieces; | |
| 235 | + } | |
| 236 | + } | |
| 237 | + new LSX_TO_Reviews(); | |
| 238 | 238 | } | 
| @@ -12,100 +12,100 @@ | ||
| 12 | 12 | */ | 
| 13 | 13 |  class LSX_TO_Schema_Review 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 = 'review'; | |
| 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 = 'review'; | |
| 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 | - $post = get_post( $this->context->id ); | |
| 32 | - $review_author = get_post_meta( $post->ID, 'reviewer_name', true ); | |
| 33 | - $review_email = get_post_meta( $post->ID, 'reviewer_email', true ); | |
| 34 | - $rating_value = get_post_meta( $post->ID, 'rating', true ); | |
| 35 | - $description = wp_strip_all_tags( get_the_content() ); | |
| 36 | - $tour_list = get_post_meta( get_the_ID(), 'tour_to_review', false ); | |
| 37 | - $accom_list = get_post_meta( get_the_ID(), 'accommodation_to_review', false ); | |
| 38 | - $comment_count = get_comment_count( $this->context->id ); | |
| 39 | - $review_author = get_post_meta( $post->ID, 'reviewer_name', true ); | |
| 40 | - $date_of_visit_start = get_post_meta( $post->ID, 'date_of_visit_start', true ); | |
| 41 | - $date_of_visit_end = get_post_meta( $post->ID, 'date_of_visit_end', true ); | |
| 25 | + /** | |
| 26 | + * Returns Review data. | |
| 27 | + * | |
| 28 | + * @return array $data Review data. | |
| 29 | + */ | |
| 30 | +     public function generate() { | |
| 31 | + $post = get_post( $this->context->id ); | |
| 32 | + $review_author = get_post_meta( $post->ID, 'reviewer_name', true ); | |
| 33 | + $review_email = get_post_meta( $post->ID, 'reviewer_email', true ); | |
| 34 | + $rating_value = get_post_meta( $post->ID, 'rating', true ); | |
| 35 | + $description = wp_strip_all_tags( get_the_content() ); | |
| 36 | + $tour_list = get_post_meta( get_the_ID(), 'tour_to_review', false ); | |
| 37 | + $accom_list = get_post_meta( get_the_ID(), 'accommodation_to_review', false ); | |
| 38 | + $comment_count = get_comment_count( $this->context->id ); | |
| 39 | + $review_author = get_post_meta( $post->ID, 'reviewer_name', true ); | |
| 40 | + $date_of_visit_start = get_post_meta( $post->ID, 'date_of_visit_start', true ); | |
| 41 | + $date_of_visit_end = get_post_meta( $post->ID, 'date_of_visit_end', true ); | |
| 42 | 42 | |
| 43 | - $data = array( | |
| 44 | - '@type' => 'Review', | |
| 45 | - '@id' => $this->context->canonical . '#review', | |
| 46 | - 'author' => array( | |
| 47 | - '@type' => 'Person', | |
| 48 | - '@id' => \lsx\legacy\Schema_Utils::get_author_schema_id( $review_author, $review_email, $this->context ), | |
| 49 | - 'name' => $review_author, | |
| 50 | - 'email' => $review_email, | |
| 51 | - ), | |
| 52 | - 'headline' => get_the_title(), | |
| 53 | - 'datePublished' => mysql2date( DATE_W3C, $post->post_date_gmt, false ), | |
| 54 | - 'dateModified' => mysql2date( DATE_W3C, $post->post_modified_gmt, false ), | |
| 55 | - 'commentCount' => $comment_count['approved'], | |
| 56 | - 'mainEntityOfPage' => array( | |
| 57 | - '@id' => $this->context->canonical . WPSEO_Schema_IDs::WEBPAGE_HASH, | |
| 58 | - ), | |
| 59 | - 'reviewRating' => array( | |
| 60 | - '@type' => 'Rating', | |
| 61 | - 'ratingValue' => $rating_value, | |
| 62 | - 'bestRating' => $rating_value, | |
| 63 | - ), | |
| 64 | - 'reviewBody' => $description, | |
| 65 | - 'itemReviewed' => \lsx\legacy\Schema_Utils::get_item_reviewed( $tour_list, 'Product' ), | |
| 66 | - 'itemReviewed' => \lsx\legacy\Schema_Utils::get_item_reviewed( $accom_list, 'Product' ), | |
| 67 | - ); | |
| 43 | + $data = array( | |
| 44 | + '@type' => 'Review', | |
| 45 | + '@id' => $this->context->canonical . '#review', | |
| 46 | + 'author' => array( | |
| 47 | + '@type' => 'Person', | |
| 48 | + '@id' => \lsx\legacy\Schema_Utils::get_author_schema_id( $review_author, $review_email, $this->context ), | |
| 49 | + 'name' => $review_author, | |
| 50 | + 'email' => $review_email, | |
| 51 | + ), | |
| 52 | + 'headline' => get_the_title(), | |
| 53 | + 'datePublished' => mysql2date( DATE_W3C, $post->post_date_gmt, false ), | |
| 54 | + 'dateModified' => mysql2date( DATE_W3C, $post->post_modified_gmt, false ), | |
| 55 | + 'commentCount' => $comment_count['approved'], | |
| 56 | + 'mainEntityOfPage' => array( | |
| 57 | + '@id' => $this->context->canonical . WPSEO_Schema_IDs::WEBPAGE_HASH, | |
| 58 | + ), | |
| 59 | + 'reviewRating' => array( | |
| 60 | + '@type' => 'Rating', | |
| 61 | + 'ratingValue' => $rating_value, | |
| 62 | + 'bestRating' => $rating_value, | |
| 63 | + ), | |
| 64 | + 'reviewBody' => $description, | |
| 65 | + 'itemReviewed' => \lsx\legacy\Schema_Utils::get_item_reviewed( $tour_list, 'Product' ), | |
| 66 | + 'itemReviewed' => \lsx\legacy\Schema_Utils::get_item_reviewed( $accom_list, 'Product' ), | |
| 67 | + ); | |
| 68 | 68 | |
| 69 | -		if ( $this->context->site_represents_reference ) { | |
| 70 | - $data['publisher'] = $this->context->site_represents_reference; | |
| 71 | - } | |
| 69 | +          if ( $this->context->site_represents_reference ) { | |
| 70 | + $data['publisher'] = $this->context->site_represents_reference; | |
| 71 | + } | |
| 72 | 72 | |
| 73 | -		if ( '' !== $date_of_visit_start && '' !== $date_of_visit_end ) { | |
| 74 | - $data['temporalCoverage'] = $date_of_visit_start . ' - ' . $date_of_visit_end; | |
| 75 | - } | |
| 73 | +          if ( '' !== $date_of_visit_start && '' !== $date_of_visit_end ) { | |
| 74 | + $data['temporalCoverage'] = $date_of_visit_start . ' - ' . $date_of_visit_end; | |
| 75 | + } | |
| 76 | 76 | |
| 77 | - $data = \lsx\legacy\Schema_Utils::add_image( $data, $this->context ); | |
| 78 | - $data = $this->add_taxonomy_terms( $data, 'keywords', 'post_tag' ); | |
| 79 | - $data = $this->add_taxonomy_terms( $data, 'reviewSection', 'category' ); | |
| 80 | - $data = $this->add_offers( $data ); | |
| 81 | - $data = $this->add_destinations( $data ); | |
| 82 | - return $data; | |
| 83 | - } | |
| 77 | + $data = \lsx\legacy\Schema_Utils::add_image( $data, $this->context ); | |
| 78 | + $data = $this->add_taxonomy_terms( $data, 'keywords', 'post_tag' ); | |
| 79 | + $data = $this->add_taxonomy_terms( $data, 'reviewSection', 'category' ); | |
| 80 | + $data = $this->add_offers( $data ); | |
| 81 | + $data = $this->add_destinations( $data ); | |
| 82 | + return $data; | |
| 83 | + } | |
| 84 | 84 | |
| 85 | - /** | |
| 86 | - * Adds the Destinations attached to the review | |
| 87 | - * | |
| 88 | - * @param array $data Country / State data. | |
| 89 | - * | |
| 90 | - * @return array $data Country / State data. | |
| 91 | - */ | |
| 92 | -	public function add_destinations( $data, $data_key = '' ) { | |
| 93 | - $places_array = array(); | |
| 94 | - $destinations = get_post_meta( $this->context->id, 'destination_to_' . $this->post_type, false ); | |
| 95 | -		if ( ! empty( $destinations ) ) { | |
| 96 | -			foreach ( $destinations as $destination_id ) { | |
| 97 | -				if ( '' !== $destination_id ) { | |
| 98 | -					if ( 0 === wp_get_post_parent_id( $destination_id ) || false === wp_get_post_parent_id( $destination_id ) ) { | |
| 99 | - $places_array = \lsx\legacy\Schema_Utils::add_place( $places_array, 'Country', $destination_id, $this->context ); | |
| 100 | -					} else { | |
| 101 | - $places_array = \lsx\legacy\Schema_Utils::add_place( $places_array, 'State', $destination_id, $this->context ); | |
| 102 | - } | |
| 103 | - } | |
| 104 | - } | |
| 105 | - } | |
| 106 | -		if ( ! empty( $places_array ) ) { | |
| 107 | - $data['spatialCoverage'] = $places_array; | |
| 108 | - } | |
| 109 | - return $data; | |
| 110 | - } | |
| 85 | + /** | |
| 86 | + * Adds the Destinations attached to the review | |
| 87 | + * | |
| 88 | + * @param array $data Country / State data. | |
| 89 | + * | |
| 90 | + * @return array $data Country / State data. | |
| 91 | + */ | |
| 92 | +     public function add_destinations( $data, $data_key = '' ) { | |
| 93 | + $places_array = array(); | |
| 94 | + $destinations = get_post_meta( $this->context->id, 'destination_to_' . $this->post_type, false ); | |
| 95 | +          if ( ! empty( $destinations ) ) { | |
| 96 | +               foreach ( $destinations as $destination_id ) { | |
| 97 | +                    if ( '' !== $destination_id ) { | |
| 98 | +                         if ( 0 === wp_get_post_parent_id( $destination_id ) || false === wp_get_post_parent_id( $destination_id ) ) { | |
| 99 | + $places_array = \lsx\legacy\Schema_Utils::add_place( $places_array, 'Country', $destination_id, $this->context ); | |
| 100 | +                         } else { | |
| 101 | + $places_array = \lsx\legacy\Schema_Utils::add_place( $places_array, 'State', $destination_id, $this->context ); | |
| 102 | + } | |
| 103 | + } | |
| 104 | + } | |
| 105 | + } | |
| 106 | +          if ( ! empty( $places_array ) ) { | |
| 107 | + $data['spatialCoverage'] = $places_array; | |
| 108 | + } | |
| 109 | + return $data; | |
| 110 | + } | |
| 111 | 111 | } | 
| @@ -18,99 +18,99 @@ | ||
| 18 | 18 | |
| 19 | 19 |  class LSX_TO_Reviews_Admin extends LSX_TO_Reviews { | 
| 20 | 20 | |
| 21 | - /** | |
| 22 | - * Constructor | |
| 23 | - */ | |
| 24 | -	public function __construct() { | |
| 25 | - $this->set_vars(); | |
| 21 | + /** | |
| 22 | + * Constructor | |
| 23 | + */ | |
| 24 | +     public function __construct() { | |
| 25 | + $this->set_vars(); | |
| 26 | 26 | |
| 27 | - add_filter( 'lsx_get_post-types_configs', array( $this, 'post_type_config' ), 10, 1 ); | |
| 28 | - add_filter( 'lsx_get_metaboxes_configs', array( $this, 'meta_box_config' ), 10, 1 ); | |
| 27 | + add_filter( 'lsx_get_post-types_configs', array( $this, 'post_type_config' ), 10, 1 ); | |
| 28 | + add_filter( 'lsx_get_metaboxes_configs', array( $this, 'meta_box_config' ), 10, 1 ); | |
| 29 | 29 | |
| 30 | - add_filter( 'lsx_to_destination_custom_fields', array( $this, 'custom_fields' ) ); | |
| 31 | - add_filter( 'lsx_to_tour_custom_fields', array( $this, 'custom_fields' ) ); | |
| 32 | - add_filter( 'lsx_to_accommodation_custom_fields', array( $this, 'custom_fields' ) ); | |
| 30 | + add_filter( 'lsx_to_destination_custom_fields', array( $this, 'custom_fields' ) ); | |
| 31 | + add_filter( 'lsx_to_tour_custom_fields', array( $this, 'custom_fields' ) ); | |
| 32 | + add_filter( 'lsx_to_accommodation_custom_fields', array( $this, 'custom_fields' ) ); | |
| 33 | 33 | |
| 34 | - add_filter( 'lsx_to_team_custom_fields', array( $this, 'custom_fields' ) ); | |
| 35 | - add_filter( 'lsx_to_special_custom_fields', array( $this, 'custom_fields' ) ); | |
| 36 | - add_filter( 'lsx_to_activity_custom_fields', array( $this, 'custom_fields' ) ); | |
| 37 | - } | |
| 34 | + add_filter( 'lsx_to_team_custom_fields', array( $this, 'custom_fields' ) ); | |
| 35 | + add_filter( 'lsx_to_special_custom_fields', array( $this, 'custom_fields' ) ); | |
| 36 | + add_filter( 'lsx_to_activity_custom_fields', array( $this, 'custom_fields' ) ); | |
| 37 | + } | |
| 38 | 38 | |
| 39 | - /** | |
| 40 | - * Register the activity post type config | |
| 41 | - * | |
| 42 | - * @param $objects | |
| 43 | - * @return array | |
| 44 | - */ | |
| 45 | -	public function post_type_config( $objects ) { | |
| 39 | + /** | |
| 40 | + * Register the activity post type config | |
| 41 | + * | |
| 42 | + * @param $objects | |
| 43 | + * @return array | |
| 44 | + */ | |
| 45 | +     public function post_type_config( $objects ) { | |
| 46 | 46 | |
| 47 | -		foreach ( $this->post_types as $key => $label ) { | |
| 48 | -			if ( file_exists( LSX_TO_REVIEWS_PATH . 'includes/post-types/config-' . $key . '.php' ) ) { | |
| 49 | - $objects[ $key ] = include LSX_TO_REVIEWS_PATH . 'includes/post-types/config-' . $key . '.php'; | |
| 50 | - } | |
| 51 | - } | |
| 47 | +          foreach ( $this->post_types as $key => $label ) { | |
| 48 | +               if ( file_exists( LSX_TO_REVIEWS_PATH . 'includes/post-types/config-' . $key . '.php' ) ) { | |
| 49 | + $objects[ $key ] = include LSX_TO_REVIEWS_PATH . 'includes/post-types/config-' . $key . '.php'; | |
| 50 | + } | |
| 51 | + } | |
| 52 | 52 | |
| 53 | - return $objects; | |
| 54 | - } | |
| 53 | + return $objects; | |
| 54 | + } | |
| 55 | 55 | |
| 56 | - /** | |
| 57 | - * Register the activity metabox config | |
| 58 | - * | |
| 59 | - * @param $meta_boxes | |
| 60 | - * @return array | |
| 61 | - */ | |
| 62 | -	public function meta_box_config( $meta_boxes ) { | |
| 63 | -		foreach ( $this->post_types as $key => $label ) { | |
| 64 | -			if ( file_exists( LSX_TO_REVIEWS_PATH . 'includes/metaboxes/config-' . $key . '.php' ) ) { | |
| 65 | - $meta_boxes[ $key ] = include LSX_TO_REVIEWS_PATH . 'includes/metaboxes/config-' . $key . '.php'; | |
| 66 | - } | |
| 67 | - } | |
| 68 | - return $meta_boxes; | |
| 69 | - } | |
| 56 | + /** | |
| 57 | + * Register the activity metabox config | |
| 58 | + * | |
| 59 | + * @param $meta_boxes | |
| 60 | + * @return array | |
| 61 | + */ | |
| 62 | +     public function meta_box_config( $meta_boxes ) { | |
| 63 | +          foreach ( $this->post_types as $key => $label ) { | |
| 64 | +               if ( file_exists( LSX_TO_REVIEWS_PATH . 'includes/metaboxes/config-' . $key . '.php' ) ) { | |
| 65 | + $meta_boxes[ $key ] = include LSX_TO_REVIEWS_PATH . 'includes/metaboxes/config-' . $key . '.php'; | |
| 66 | + } | |
| 67 | + } | |
| 68 | + return $meta_boxes; | |
| 69 | + } | |
| 70 | 70 | |
| 71 | - /** | |
| 72 | - * Adds in the fields to the Tour Operators Post Types. | |
| 73 | - */ | |
| 74 | -	public function custom_fields( $fields ) { | |
| 75 | - global $post, $typenow, $current_screen; | |
| 71 | + /** | |
| 72 | + * Adds in the fields to the Tour Operators Post Types. | |
| 73 | + */ | |
| 74 | +     public function custom_fields( $fields ) { | |
| 75 | + global $post, $typenow, $current_screen; | |
| 76 | 76 | |
| 77 | - $post_type = false; | |
| 78 | -		if ( $post && $post->post_type ) { | |
| 79 | - $post_type = $post->post_type; | |
| 80 | -		} elseif ( $typenow ) { | |
| 81 | - $post_type = $typenow; | |
| 82 | -		} elseif ( $current_screen && $current_screen->post_type ) { | |
| 83 | - $post_type = $current_screen->post_type; | |
| 84 | -		} elseif ( isset( $_REQUEST['post_type'] ) ) { | |
| 85 | - $post_type = sanitize_key( $_REQUEST['post_type'] ); | |
| 86 | -		} elseif ( isset( $_REQUEST['post'] ) ) { | |
| 87 | - $post_type = get_post_type( sanitize_key( $_REQUEST['post'] ) ); | |
| 88 | - } | |
| 89 | -		if ( false !== $post_type ) { | |
| 90 | - $fields[] = array( | |
| 91 | - 'id' => 'review_title', | |
| 92 | - 'name' => 'Reviews', | |
| 93 | - 'type' => 'title', | |
| 94 | - 'cols' => 12, | |
| 95 | - ); | |
| 96 | - $fields[] = array( | |
| 97 | - 'id' => 'review_to_' . $post_type, | |
| 98 | - 'name' => 'Reviews related with this ' . $post_type, | |
| 99 | - 'type' => 'post_select', | |
| 100 | - 'use_ajax' => false, | |
| 101 | - 'query' => array( | |
| 102 | - 'post_type' => 'review', | |
| 103 | - 'nopagin' => true, | |
| 104 | - 'posts_per_page' => '-1', | |
| 105 | - 'orderby' => 'title', | |
| 106 | - 'order' => 'ASC', | |
| 107 | - ), | |
| 108 | - 'repeatable' => true, | |
| 109 | - 'allow_none' => true, | |
| 110 | - 'cols' => 12, | |
| 111 | - ); | |
| 112 | - } | |
| 113 | - return $fields; | |
| 114 | - } | |
| 77 | + $post_type = false; | |
| 78 | +          if ( $post && $post->post_type ) { | |
| 79 | + $post_type = $post->post_type; | |
| 80 | +          } elseif ( $typenow ) { | |
| 81 | + $post_type = $typenow; | |
| 82 | +          } elseif ( $current_screen && $current_screen->post_type ) { | |
| 83 | + $post_type = $current_screen->post_type; | |
| 84 | +          } elseif ( isset( $_REQUEST['post_type'] ) ) { | |
| 85 | + $post_type = sanitize_key( $_REQUEST['post_type'] ); | |
| 86 | +          } elseif ( isset( $_REQUEST['post'] ) ) { | |
| 87 | + $post_type = get_post_type( sanitize_key( $_REQUEST['post'] ) ); | |
| 88 | + } | |
| 89 | +          if ( false !== $post_type ) { | |
| 90 | + $fields[] = array( | |
| 91 | + 'id' => 'review_title', | |
| 92 | + 'name' => 'Reviews', | |
| 93 | + 'type' => 'title', | |
| 94 | + 'cols' => 12, | |
| 95 | + ); | |
| 96 | + $fields[] = array( | |
| 97 | + 'id' => 'review_to_' . $post_type, | |
| 98 | + 'name' => 'Reviews related with this ' . $post_type, | |
| 99 | + 'type' => 'post_select', | |
| 100 | + 'use_ajax' => false, | |
| 101 | + 'query' => array( | |
| 102 | + 'post_type' => 'review', | |
| 103 | + 'nopagin' => true, | |
| 104 | + 'posts_per_page' => '-1', | |
| 105 | + 'orderby' => 'title', | |
| 106 | + 'order' => 'ASC', | |
| 107 | + ), | |
| 108 | + 'repeatable' => true, | |
| 109 | + 'allow_none' => true, | |
| 110 | + 'cols' => 12, | |
| 111 | + ); | |
| 112 | + } | |
| 113 | + return $fields; | |
| 114 | + } | |
| 115 | 115 | } | 
| 116 | 116 | new LSX_TO_Reviews_Admin(); | 
| @@ -10,180 +10,180 @@ | ||
| 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 ) { | |
| 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 | 61 | |
| 62 | -		if ( is_main_query() && is_post_type_archive($this->post_types)) { | |
| 63 | - $current_post_type = get_post_type(); | |
| 64 | -			if ( '' == locate_template( array( 'archive-'.$current_post_type.'.php' ) )	&& file_exists( $this->plugin_path.'templates/archive-'.$current_post_type.'.php' )) { | |
| 65 | - $template = $this->plugin_path.'templates/archive-'.$current_post_type.'.php'; | |
| 66 | - } | |
| 67 | - } | |
| 68 | - return $template; | |
| 69 | - } | |
| 62 | +          if ( is_main_query() && is_post_type_archive($this->post_types)) { | |
| 63 | + $current_post_type = get_post_type(); | |
| 64 | +               if ( '' == locate_template( array( 'archive-'.$current_post_type.'.php' ) )	&& file_exists( $this->plugin_path.'templates/archive-'.$current_post_type.'.php' )) { | |
| 65 | + $template = $this->plugin_path.'templates/archive-'.$current_post_type.'.php'; | |
| 66 | + } | |
| 67 | + } | |
| 68 | + return $template; | |
| 69 | + } | |
| 70 | 70 | |
| 71 | - /** | |
| 72 | - * Redirect wordpress to the single template located in the plugin | |
| 73 | - * | |
| 74 | - * @param $template | |
| 75 | - * | |
| 76 | - * @return $template | |
| 77 | - */ | |
| 78 | -	public function post_type_single_template_include($template) { | |
| 79 | -		if ( is_main_query() && is_singular($this->post_types) ) { | |
| 80 | - $current_post_type = get_post_type(); | |
| 71 | + /** | |
| 72 | + * Redirect wordpress to the single template located in the plugin | |
| 73 | + * | |
| 74 | + * @param $template | |
| 75 | + * | |
| 76 | + * @return $template | |
| 77 | + */ | |
| 78 | +     public function post_type_single_template_include($template) { | |
| 79 | +          if ( is_main_query() && is_singular($this->post_types) ) { | |
| 80 | + $current_post_type = get_post_type(); | |
| 81 | 81 | |
| 82 | -			if ( '' == locate_template( array( 'single-'.$current_post_type.'.php' ) )	&& file_exists( $this->plugin_path.'templates/single-'.$current_post_type.'.php') ) { | |
| 83 | - $template = $this->plugin_path.'templates/single-'.$current_post_type.'.php'; | |
| 84 | - } | |
| 85 | - } | |
| 86 | - return $template; | |
| 87 | - } | |
| 82 | +               if ( '' == locate_template( array( 'single-'.$current_post_type.'.php' ) )	&& file_exists( $this->plugin_path.'templates/single-'.$current_post_type.'.php') ) { | |
| 83 | + $template = $this->plugin_path.'templates/single-'.$current_post_type.'.php'; | |
| 84 | + } | |
| 85 | + } | |
| 86 | + return $template; | |
| 87 | + } | |
| 88 | 88 | |
| 89 | - /** | |
| 90 | - * Redirect wordpress to the taxonomy located in the plugin | |
| 91 | - * | |
| 92 | - * @param $template | |
| 93 | - * | |
| 94 | - * @return $template | |
| 95 | - */ | |
| 96 | -	public function taxonomy_template_include($template) { | |
| 89 | + /** | |
| 90 | + * Redirect wordpress to the taxonomy located in the plugin | |
| 91 | + * | |
| 92 | + * @param $template | |
| 93 | + * | |
| 94 | + * @return $template | |
| 95 | + */ | |
| 96 | +     public function taxonomy_template_include($template) { | |
| 97 | 97 | |
| 98 | -		if ( is_main_query() && is_tax($this->taxonomies) ) { | |
| 99 | -			$current_taxonomy = get_query_var('taxonomy'); | |
| 98 | +          if ( is_main_query() && is_tax($this->taxonomies) ) { | |
| 99 | +               $current_taxonomy = get_query_var('taxonomy'); | |
| 100 | 100 | |
| 101 | -			if ( '' == locate_template( array( 'taxonomy-'.$current_taxonomy.'.php' ) ) && file_exists( $this->plugin_path.'templates/taxonomy-'.$current_taxonomy.'.php') ) { | |
| 102 | - $template = $this->plugin_path.'templates/taxonomy-'.$current_taxonomy.'.php'; | |
| 103 | - } | |
| 104 | - } | |
| 105 | - return $template; | |
| 106 | - } | |
| 101 | +               if ( '' == locate_template( array( 'taxonomy-'.$current_taxonomy.'.php' ) ) && file_exists( $this->plugin_path.'templates/taxonomy-'.$current_taxonomy.'.php') ) { | |
| 102 | + $template = $this->plugin_path.'templates/taxonomy-'.$current_taxonomy.'.php'; | |
| 103 | + } | |
| 104 | + } | |
| 105 | + return $template; | |
| 106 | + } | |
| 107 | 107 | |
| 108 | - /** | |
| 109 | - * Redirect wordpress to the search template located in the plugin | |
| 110 | - * | |
| 111 | - * @param $template | |
| 112 | - * | |
| 113 | - * @return $template | |
| 114 | - */ | |
| 115 | -	public function search_template_include( $template ) { | |
| 108 | + /** | |
| 109 | + * Redirect wordpress to the search template located in the plugin | |
| 110 | + * | |
| 111 | + * @param $template | |
| 112 | + * | |
| 113 | + * @return $template | |
| 114 | + */ | |
| 115 | +     public function search_template_include( $template ) { | |
| 116 | 116 | |
| 117 | -		if ( is_main_query() && is_search() ) { | |
| 118 | -			if ( file_exists( $this->plugin_path.'templates/search.php' )) { | |
| 119 | - $template = $this->plugin_path.'templates/search.php'; | |
| 120 | - } | |
| 121 | - } | |
| 122 | - return $template; | |
| 123 | - } | |
| 117 | +          if ( is_main_query() && is_search() ) { | |
| 118 | +               if ( file_exists( $this->plugin_path.'templates/search.php' )) { | |
| 119 | + $template = $this->plugin_path.'templates/search.php'; | |
| 120 | + } | |
| 121 | + } | |
| 122 | + return $template; | |
| 123 | + } | |
| 124 | 124 | |
| 125 | - /** | |
| 126 | - * Redirect wordpress to the single template located in the plugin | |
| 127 | - * | |
| 128 | - * @param $template | |
| 129 | - * | |
| 130 | - * @return $template | |
| 131 | - */ | |
| 132 | -	public function content_part($slug, $name = null) { | |
| 133 | - $template = array(); | |
| 134 | - $name = (string) $name; | |
| 135 | -		if ( '' !== $name ){ | |
| 136 | -			$template = "{$slug}-{$name}.php"; | |
| 137 | -		}else{ | |
| 138 | -			$template = "{$slug}.php"; | |
| 139 | - } | |
| 140 | - $original_name = $template; | |
| 141 | -		$path = apply_filters('lsx_to_content_path','',get_post_type()); | |
| 125 | + /** | |
| 126 | + * Redirect wordpress to the single template located in the plugin | |
| 127 | + * | |
| 128 | + * @param $template | |
| 129 | + * | |
| 130 | + * @return $template | |
| 131 | + */ | |
| 132 | +     public function content_part($slug, $name = null) { | |
| 133 | + $template = array(); | |
| 134 | + $name = (string) $name; | |
| 135 | +          if ( '' !== $name ){ | |
| 136 | +               $template = "{$slug}-{$name}.php"; | |
| 137 | +          }else{ | |
| 138 | +               $template = "{$slug}.php"; | |
| 139 | + } | |
| 140 | + $original_name = $template; | |
| 141 | +          $path = apply_filters('lsx_to_content_path','',get_post_type()); | |
| 142 | 142 | |
| 143 | -		if ( '' == locate_template( array( $template ) ) && file_exists( $path.'templates/'.$template) ) { | |
| 144 | - $template = $path.'templates/'.$template; | |
| 145 | -		}elseif(file_exists( get_stylesheet_directory().'/'.$template)){ | |
| 146 | - $template = get_stylesheet_directory().'/'.$template; | |
| 147 | -		}else{ | |
| 148 | - $template = false; | |
| 149 | - } | |
| 143 | +          if ( '' == locate_template( array( $template ) ) && file_exists( $path.'templates/'.$template) ) { | |
| 144 | + $template = $path.'templates/'.$template; | |
| 145 | +          }elseif(file_exists( get_stylesheet_directory().'/'.$template)){ | |
| 146 | + $template = get_stylesheet_directory().'/'.$template; | |
| 147 | +          }else{ | |
| 148 | + $template = false; | |
| 149 | + } | |
| 150 | 150 | |
| 151 | -		if(false !== $template){ | |
| 152 | - load_template( $template, false ); | |
| 153 | -		}else { | |
| 154 | -			echo wp_kses_post('<p>No '.$original_name.' can be found.</p>'); | |
| 155 | - } | |
| 156 | - } | |
| 151 | +          if(false !== $template){ | |
| 152 | + load_template( $template, false ); | |
| 153 | +          }else { | |
| 154 | +               echo wp_kses_post('<p>No '.$original_name.' can be found.</p>'); | |
| 155 | + } | |
| 156 | + } | |
| 157 | 157 | |
| 158 | - /** | |
| 159 | - * Redirect wordpress to the widget template located in the plugin | |
| 160 | - * | |
| 161 | - * @param $path | |
| 162 | - * @param $post_type | |
| 163 | - * | |
| 164 | - * @return $path | |
| 165 | - */ | |
| 166 | -	public function widget_path($path,$slug) { | |
| 167 | - if((false !== $this->post_types && in_array($slug,$this->post_types)) | |
| 168 | -		 || (false !== $this->taxonomies && in_array($slug,$this->taxonomies)) || 'post' === $slug){ | |
| 169 | - $path = $this->plugin_path; | |
| 170 | - } | |
| 171 | - return $path; | |
| 172 | - } | |
| 158 | + /** | |
| 159 | + * Redirect wordpress to the widget template located in the plugin | |
| 160 | + * | |
| 161 | + * @param $path | |
| 162 | + * @param $post_type | |
| 163 | + * | |
| 164 | + * @return $path | |
| 165 | + */ | |
| 166 | +     public function widget_path($path,$slug) { | |
| 167 | + if((false !== $this->post_types && in_array($slug,$this->post_types)) | |
| 168 | +           || (false !== $this->taxonomies && in_array($slug,$this->taxonomies)) || 'post' === $slug){ | |
| 169 | + $path = $this->plugin_path; | |
| 170 | + } | |
| 171 | + return $path; | |
| 172 | + } | |
| 173 | 173 | |
| 174 | - /** | |
| 175 | - * Redirect wordpress to the single template located in the plugin | |
| 176 | - * | |
| 177 | - * @param $path | |
| 178 | - * @param $post_type | |
| 179 | - * | |
| 180 | - * @return $path | |
| 181 | - */ | |
| 182 | -	public function content_path($path,$slug) { | |
| 183 | - if((false !== $this->post_types && in_array($slug,$this->post_types)) | |
| 184 | -		 || (false !== $this->taxonomies && in_array($slug,$this->taxonomies)) || 'post' === $slug){ | |
| 185 | - $path = $this->plugin_path; | |
| 186 | - } | |
| 187 | - return $path; | |
| 188 | - } | |
| 174 | + /** | |
| 175 | + * Redirect wordpress to the single template located in the plugin | |
| 176 | + * | |
| 177 | + * @param $path | |
| 178 | + * @param $post_type | |
| 179 | + * | |
| 180 | + * @return $path | |
| 181 | + */ | |
| 182 | +     public function content_path($path,$slug) { | |
| 183 | + if((false !== $this->post_types && in_array($slug,$this->post_types)) | |
| 184 | +           || (false !== $this->taxonomies && in_array($slug,$this->taxonomies)) || 'post' === $slug){ | |
| 185 | + $path = $this->plugin_path; | |
| 186 | + } | |
| 187 | + return $path; | |
| 188 | + } | |
| 189 | 189 | } | 
| 190 | 190 | \ No newline at end of file | 
| @@ -14,19 +14,19 @@ discard block | ||
| 14 | 14 | * @category review | 
| 15 | 15 | */ | 
| 16 | 16 |  if ( ! function_exists( 'lsx_to_review_posts' ) ) { | 
| 17 | -	function lsx_to_review_posts() { | |
| 18 | - global $lsx_to_archive; | |
| 19 | - | |
| 20 | - $args = array( | |
| 21 | - 'from' => 'post', | |
| 22 | - 'to' => 'review', | |
| 23 | - 'column' => '3', | |
| 24 | - '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">' . esc_html__( 'Featured Posts', 'to-reviews' ) . '</h2><div id="collapse-posts" class="collapse in"><div class="collapse-inner">', | |
| 25 | - 'after' => '</div></div></section>', | |
| 26 | - ); | |
| 27 | - | |
| 28 | - lsx_to_connected_panel_query( $args ); | |
| 29 | - } | |
| 17 | +     function lsx_to_review_posts() { | |
| 18 | + global $lsx_to_archive; | |
| 19 | + | |
| 20 | + $args = array( | |
| 21 | + 'from' => 'post', | |
| 22 | + 'to' => 'review', | |
| 23 | + 'column' => '3', | |
| 24 | + '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">' . esc_html__( 'Featured Posts', 'to-reviews' ) . '</h2><div id="collapse-posts" class="collapse in"><div class="collapse-inner">', | |
| 25 | + 'after' => '</div></div></section>', | |
| 26 | + ); | |
| 27 | + | |
| 28 | + lsx_to_connected_panel_query( $args ); | |
| 29 | + } | |
| 30 | 30 | } | 
| 31 | 31 | |
| 32 | 32 | /** | 
| @@ -37,7 +37,7 @@ discard block | ||
| 37 | 37 | * @category content | 
| 38 | 38 | */ | 
| 39 | 39 |  function lsx_to_review_content( $slug, $name = null ) { | 
| 40 | - do_action( 'lsx_to_review_content', $slug, $name ); | |
| 40 | + do_action( 'lsx_to_review_content', $slug, $name ); | |
| 41 | 41 | } | 
| 42 | 42 | |
| 43 | 43 | /* ================ REVIEWS =========================== */ | 
| @@ -54,7 +54,7 @@ discard block | ||
| 54 | 54 | * @category review | 
| 55 | 55 | */ | 
| 56 | 56 |  function lsx_to_review_rating( $before = '', $after = '', $echo = true ) { | 
| 57 | - lsx_to_custom_field_query( 'rating', $before, $after, $echo ); | |
| 57 | + lsx_to_custom_field_query( 'rating', $before, $after, $echo ); | |
| 58 | 58 | } | 
| 59 | 59 | |
| 60 | 60 | /** | 
| @@ -70,26 +70,26 @@ discard block | ||
| 70 | 70 | * @category review | 
| 71 | 71 | */ | 
| 72 | 72 |  function lsx_to_review_dates( $before = '', $after = '', $echo = true ) { | 
| 73 | - $valid_from = get_post_meta( get_the_ID(), 'date_of_visit_start', true ); | |
| 74 | - $valid_to = get_post_meta( get_the_ID(), 'date_of_visit_end', true ); | |
| 75 | - | |
| 76 | -	if ( false !== $valid_from && '' !== $valid_from ) { | |
| 77 | - $valid_from = date( 'd M Y', strtotime( $valid_from ) ); | |
| 78 | - } | |
| 79 | - | |
| 80 | -	if ( false !== $valid_to && '' !== $valid_to ) { | |
| 81 | - $valid_from .= ' - ' . date( 'd M Y', strtotime( $valid_to ) ); | |
| 82 | - } | |
| 83 | - | |
| 84 | -	if ( false !== $valid_from && '' !== $valid_from ) { | |
| 85 | - $return = $before . $valid_from . $after; | |
| 86 | - | |
| 87 | -		if ( $echo ) { | |
| 88 | - echo $return; | |
| 89 | -		} else { | |
| 90 | - return $return; | |
| 91 | - } | |
| 92 | - } | |
| 73 | + $valid_from = get_post_meta( get_the_ID(), 'date_of_visit_start', true ); | |
| 74 | + $valid_to = get_post_meta( get_the_ID(), 'date_of_visit_end', true ); | |
| 75 | + | |
| 76 | +     if ( false !== $valid_from && '' !== $valid_from ) { | |
| 77 | + $valid_from = date( 'd M Y', strtotime( $valid_from ) ); | |
| 78 | + } | |
| 79 | + | |
| 80 | +     if ( false !== $valid_to && '' !== $valid_to ) { | |
| 81 | + $valid_from .= ' - ' . date( 'd M Y', strtotime( $valid_to ) ); | |
| 82 | + } | |
| 83 | + | |
| 84 | +     if ( false !== $valid_from && '' !== $valid_from ) { | |
| 85 | + $return = $before . $valid_from . $after; | |
| 86 | + | |
| 87 | +          if ( $echo ) { | |
| 88 | + echo $return; | |
| 89 | +          } else { | |
| 90 | + return $return; | |
| 91 | + } | |
| 92 | + } | |
| 93 | 93 | } | 
| 94 | 94 | /** | 
| 95 | 95 | * Outputs the connected accommodation for a review | 
| @@ -99,19 +99,19 @@ discard block | ||
| 99 | 99 | * @category review | 
| 100 | 100 | */ | 
| 101 | 101 |  function lsx_to_review_accommodation() { | 
| 102 | - global $lsx_archive; | |
| 103 | - | |
| 104 | -	if ( post_type_exists( 'accommodation' ) && is_singular( 'review' ) ) { | |
| 105 | - $args = array( | |
| 106 | - 'from' => 'accommodation', | |
| 107 | - 'to' => 'review', | |
| 108 | - 'column' => '3', | |
| 109 | - '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-reviews' ) . '</h2><div id="collapse-accommodation" class="collapse in"><div class="collapse-inner">', | |
| 110 | - 'after' => '</div></div></section>', | |
| 111 | - ); | |
| 112 | - | |
| 113 | - lsx_to_connected_panel_query( $args ); | |
| 114 | - } | |
| 102 | + global $lsx_archive; | |
| 103 | + | |
| 104 | +     if ( post_type_exists( 'accommodation' ) && is_singular( 'review' ) ) { | |
| 105 | + $args = array( | |
| 106 | + 'from' => 'accommodation', | |
| 107 | + 'to' => 'review', | |
| 108 | + 'column' => '3', | |
| 109 | + '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-reviews' ) . '</h2><div id="collapse-accommodation" class="collapse in"><div class="collapse-inner">', | |
| 110 | + 'after' => '</div></div></section>', | |
| 111 | + ); | |
| 112 | + | |
| 113 | + lsx_to_connected_panel_query( $args ); | |
| 114 | + } | |
| 115 | 115 | } | 
| 116 | 116 | |
| 117 | 117 | /** | 
| @@ -122,19 +122,19 @@ discard block | ||
| 122 | 122 | * @category review | 
| 123 | 123 | */ | 
| 124 | 124 |  function lsx_to_review_tour() { | 
| 125 | - global $lsx_archive; | |
| 126 | - | |
| 127 | -	if ( post_type_exists( 'tour' ) && is_singular( 'review' ) ) { | |
| 128 | - $args = array( | |
| 129 | - 'from' => 'tour', | |
| 130 | - 'to' => 'review', | |
| 131 | - 'column' => '3', | |
| 132 | - '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-reviews' ) . '</h2><div id="collapse-tours" class="collapse in"><div class="collapse-inner">', | |
| 133 | - 'after' => '</div></div></section>', | |
| 134 | - ); | |
| 135 | - | |
| 136 | - lsx_to_connected_panel_query( $args ); | |
| 137 | - } | |
| 125 | + global $lsx_archive; | |
| 126 | + | |
| 127 | +     if ( post_type_exists( 'tour' ) && is_singular( 'review' ) ) { | |
| 128 | + $args = array( | |
| 129 | + 'from' => 'tour', | |
| 130 | + 'to' => 'review', | |
| 131 | + 'column' => '3', | |
| 132 | + '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-reviews' ) . '</h2><div id="collapse-tours" class="collapse in"><div class="collapse-inner">', | |
| 133 | + 'after' => '</div></div></section>', | |
| 134 | + ); | |
| 135 | + | |
| 136 | + lsx_to_connected_panel_query( $args ); | |
| 137 | + } | |
| 138 | 138 | } | 
| 139 | 139 | |
| 140 | 140 | /** | 
| @@ -145,19 +145,19 @@ discard block | ||
| 145 | 145 | * @category review | 
| 146 | 146 | */ | 
| 147 | 147 |  function lsx_to_review_destination() { | 
| 148 | - global $lsx_archive; | |
| 149 | - | |
| 150 | -	if ( post_type_exists( 'destination' ) && is_singular( 'review' ) ) { | |
| 151 | - $args = array( | |
| 152 | - 'from' => 'destination', | |
| 153 | - 'to' => 'review', | |
| 154 | - 'column' => '3', | |
| 155 | - 'before' => '<section id="destinations" 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-destinations">' . __( lsx_to_get_post_type_section_title( 'destination', '', 'Featured Destinations' ), 'to-reviews' ) . '</h2><div id="collapse-destinations" class="collapse in"><div class="collapse-inner">', | |
| 156 | - 'after' => '</div></div></section>', | |
| 157 | - ); | |
| 158 | - | |
| 159 | - lsx_to_connected_panel_query( $args ); | |
| 160 | - } | |
| 148 | + global $lsx_archive; | |
| 149 | + | |
| 150 | +     if ( post_type_exists( 'destination' ) && is_singular( 'review' ) ) { | |
| 151 | + $args = array( | |
| 152 | + 'from' => 'destination', | |
| 153 | + 'to' => 'review', | |
| 154 | + 'column' => '3', | |
| 155 | + 'before' => '<section id="destinations" 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-destinations">' . __( lsx_to_get_post_type_section_title( 'destination', '', 'Featured Destinations' ), 'to-reviews' ) . '</h2><div id="collapse-destinations" class="collapse in"><div class="collapse-inner">', | |
| 156 | + 'after' => '</div></div></section>', | |
| 157 | + ); | |
| 158 | + | |
| 159 | + lsx_to_connected_panel_query( $args ); | |
| 160 | + } | |
| 161 | 161 | } | 
| 162 | 162 | |
| 163 | 163 | /** | 
| @@ -168,19 +168,19 @@ discard block | ||
| 168 | 168 | * @category review | 
| 169 | 169 | */ | 
| 170 | 170 |  function lsx_to_accommodation_reviews() { | 
| 171 | - global $lsx_archive; | |
| 172 | - | |
| 173 | -	if ( post_type_exists( 'review' ) && is_singular( 'accommodation' ) ) { | |
| 174 | - $args = array( | |
| 175 | - 'from' => 'review', | |
| 176 | - 'to' => 'accommodation', | |
| 177 | - 'column' => '2', | |
| 178 | - 'before' => '<section id="review" 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-review">' . __( lsx_to_get_post_type_section_title( 'review', '', 'Reviews' ), 'to-reviews' ) . '</h2><div id="collapse-review" class="collapse in"><div class="collapse-inner">', | |
| 179 | - 'after' => '</div></div></section>', | |
| 180 | - ); | |
| 181 | - | |
| 182 | - lsx_to_connected_panel_query( $args ); | |
| 183 | - } | |
| 171 | + global $lsx_archive; | |
| 172 | + | |
| 173 | +     if ( post_type_exists( 'review' ) && is_singular( 'accommodation' ) ) { | |
| 174 | + $args = array( | |
| 175 | + 'from' => 'review', | |
| 176 | + 'to' => 'accommodation', | |
| 177 | + 'column' => '2', | |
| 178 | + 'before' => '<section id="review" 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-review">' . __( lsx_to_get_post_type_section_title( 'review', '', 'Reviews' ), 'to-reviews' ) . '</h2><div id="collapse-review" class="collapse in"><div class="collapse-inner">', | |
| 179 | + 'after' => '</div></div></section>', | |
| 180 | + ); | |
| 181 | + | |
| 182 | + lsx_to_connected_panel_query( $args ); | |
| 183 | + } | |
| 184 | 184 | } | 
| 185 | 185 | |
| 186 | 186 | /** | 
| @@ -191,19 +191,19 @@ discard block | ||
| 191 | 191 | * @category review | 
| 192 | 192 | */ | 
| 193 | 193 |  function lsx_to_tour_reviews() { | 
| 194 | - global $lsx_archive; | |
| 195 | - | |
| 196 | -	if ( post_type_exists( 'review' ) && is_singular( 'tour' ) ) { | |
| 197 | - $args = array( | |
| 198 | - 'from' => 'review', | |
| 199 | - 'to' => 'tour', | |
| 200 | - 'column' => '2', | |
| 201 | - 'before' => '<section id="review" 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-review">' . __( lsx_to_get_post_type_section_title( 'review', '', 'Reviews' ), 'to-reviews' ) . '</h2><div id="collapse-review" class="collapse in"><div class="collapse-inner">', | |
| 202 | - 'after' => '</div></div></section>', | |
| 203 | - ); | |
| 204 | - | |
| 205 | - lsx_to_connected_panel_query( $args ); | |
| 206 | - } | |
| 194 | + global $lsx_archive; | |
| 195 | + | |
| 196 | +     if ( post_type_exists( 'review' ) && is_singular( 'tour' ) ) { | |
| 197 | + $args = array( | |
| 198 | + 'from' => 'review', | |
| 199 | + 'to' => 'tour', | |
| 200 | + 'column' => '2', | |
| 201 | + 'before' => '<section id="review" 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-review">' . __( lsx_to_get_post_type_section_title( 'review', '', 'Reviews' ), 'to-reviews' ) . '</h2><div id="collapse-review" class="collapse in"><div class="collapse-inner">', | |
| 202 | + 'after' => '</div></div></section>', | |
| 203 | + ); | |
| 204 | + | |
| 205 | + lsx_to_connected_panel_query( $args ); | |
| 206 | + } | |
| 207 | 207 | } | 
| 208 | 208 | |
| 209 | 209 | /** | 
| @@ -214,19 +214,19 @@ discard block | ||
| 214 | 214 | * @category review | 
| 215 | 215 | */ | 
| 216 | 216 |  function lsx_to_destination_reviews() { | 
| 217 | - global $lsx_archive; | |
| 218 | - | |
| 219 | -	if ( post_type_exists( 'review' ) && is_singular( 'destination' ) ) { | |
| 220 | - $args = array( | |
| 221 | - 'from' => 'review', | |
| 222 | - 'to' => 'destination', | |
| 223 | - 'column' => '2', | |
| 224 | - 'before' => '<section id="review" 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-review">' . __( lsx_to_get_post_type_section_title( 'review', '', 'Reviews' ), 'to-reviews' ) . '</h2><div id="collapse-review" class="collapse in"><div class="collapse-inner">', | |
| 225 | - 'after' => '</div></div></section>', | |
| 226 | - ); | |
| 227 | - | |
| 228 | - lsx_to_connected_panel_query( $args ); | |
| 229 | - } | |
| 217 | + global $lsx_archive; | |
| 218 | + | |
| 219 | +     if ( post_type_exists( 'review' ) && is_singular( 'destination' ) ) { | |
| 220 | + $args = array( | |
| 221 | + 'from' => 'review', | |
| 222 | + 'to' => 'destination', | |
| 223 | + 'column' => '2', | |
| 224 | + 'before' => '<section id="review" 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-review">' . __( lsx_to_get_post_type_section_title( 'review', '', 'Reviews' ), 'to-reviews' ) . '</h2><div id="collapse-review" class="collapse in"><div class="collapse-inner">', | |
| 225 | + 'after' => '</div></div></section>', | |
| 226 | + ); | |
| 227 | + | |
| 228 | + lsx_to_connected_panel_query( $args ); | |
| 229 | + } | |
| 230 | 230 | } | 
| 231 | 231 | |
| 232 | 232 | /** | 
| @@ -242,5 +242,5 @@ discard block | ||
| 242 | 242 | * @category connections | 
| 243 | 243 | */ | 
| 244 | 244 |  function lsx_to_connected_reviews( $before = '', $after = '', $echo = true ) { | 
| 245 | - lsx_to_connected_items_query( 'review', get_post_type(), $before, $after, $echo ); | |
| 245 | + lsx_to_connected_items_query( 'review', get_post_type(), $before, $after, $echo ); | |
| 246 | 246 | } | 
| @@ -10,182 +10,182 @@ | ||
| 10 | 10 | */ | 
| 11 | 11 | |
| 12 | 12 | $metabox = array( | 
| 13 | - 'title' => esc_html__( 'Tour Operator Plugin', 'to-reviews' ), | |
| 14 | - 'pages' => 'review', | |
| 15 | - 'fields' => array(), | |
| 13 | + 'title' => esc_html__( 'Tour Operator Plugin', 'to-reviews' ), | |
| 14 | + 'pages' => 'review', | |
| 15 | + 'fields' => array(), | |
| 16 | 16 | ); | 
| 17 | 17 | |
| 18 | 18 | $metabox['fields'][] = array( | 
| 19 | - 'id' => 'featured', | |
| 20 | - 'name' => esc_html__( 'Featured', 'to-reviews' ), | |
| 21 | - 'type' => 'checkbox', | |
| 19 | + 'id' => 'featured', | |
| 20 | + 'name' => esc_html__( 'Featured', 'to-reviews' ), | |
| 21 | + 'type' => 'checkbox', | |
| 22 | 22 | ); | 
| 23 | 23 | |
| 24 | 24 | $metabox['fields'][] = array( | 
| 25 | - 'id' => 'disable_single', | |
| 26 | - 'name' => esc_html__( 'Disable Single', 'to-reviews' ), | |
| 27 | - 'type' => 'checkbox', | |
| 25 | + 'id' => 'disable_single', | |
| 26 | + 'name' => esc_html__( 'Disable Single', 'to-reviews' ), | |
| 27 | + 'type' => 'checkbox', | |
| 28 | 28 | ); | 
| 29 | 29 | |
| 30 | 30 |  if ( ! class_exists( 'LSX_Banners' ) ) { | 
| 31 | - $metabox['fields'][] = array( | |
| 32 | - 'id' => 'tagline', | |
| 33 | - 'name' => esc_html__( 'Tagline', 'to-reviews' ), | |
| 34 | - 'type' => 'text', | |
| 35 | - ); | |
| 31 | + $metabox['fields'][] = array( | |
| 32 | + 'id' => 'tagline', | |
| 33 | + 'name' => esc_html__( 'Tagline', 'to-reviews' ), | |
| 34 | + 'type' => 'text', | |
| 35 | + ); | |
| 36 | 36 | } | 
| 37 | 37 | |
| 38 | 38 | $metabox['fields'][] = array( | 
| 39 | - 'id' => 'no_adults', | |
| 40 | - 'name' => esc_html__( 'No of Adults', 'to-reviews' ), | |
| 41 | - 'type' => 'text', | |
| 42 | - 'cols' => 6, | |
| 39 | + 'id' => 'no_adults', | |
| 40 | + 'name' => esc_html__( 'No of Adults', 'to-reviews' ), | |
| 41 | + 'type' => 'text', | |
| 42 | + 'cols' => 6, | |
| 43 | 43 | ); | 
| 44 | 44 | |
| 45 | 45 | $metabox['fields'][] = array( | 
| 46 | - 'id' => 'no_children', | |
| 47 | - 'name' => esc_html__( 'No of Children', 'to-reviews' ), | |
| 48 | - 'type' => 'text', | |
| 49 | - 'cols' => 6, | |
| 46 | + 'id' => 'no_children', | |
| 47 | + 'name' => esc_html__( 'No of Children', 'to-reviews' ), | |
| 48 | + 'type' => 'text', | |
| 49 | + 'cols' => 6, | |
| 50 | 50 | ); | 
| 51 | 51 | |
| 52 | 52 | $metabox['fields'][] = array( | 
| 53 | - 'id' => 'reviewer_name', | |
| 54 | - 'name' => esc_html__( 'Reviewer Name', 'to-reviews' ), | |
| 55 | - 'type' => 'text', | |
| 56 | - 'cols' => 6, | |
| 53 | + 'id' => 'reviewer_name', | |
| 54 | + 'name' => esc_html__( 'Reviewer Name', 'to-reviews' ), | |
| 55 | + 'type' => 'text', | |
| 56 | + 'cols' => 6, | |
| 57 | 57 | ); | 
| 58 | 58 | |
| 59 | 59 | $metabox['fields'][] = array( | 
| 60 | - 'id' => 'reviewer_email', | |
| 61 | - 'name' => esc_html__( 'Reviewer Email', 'to-reviews' ), | |
| 62 | - 'type' => 'text', | |
| 63 | - 'cols' => 6, | |
| 60 | + 'id' => 'reviewer_email', | |
| 61 | + 'name' => esc_html__( 'Reviewer Email', 'to-reviews' ), | |
| 62 | + 'type' => 'text', | |
| 63 | + 'cols' => 6, | |
| 64 | 64 | ); | 
| 65 | 65 | |
| 66 | 66 | $metabox['fields'][] = array( | 
| 67 | - 'id' => 'rating', | |
| 68 | - 'name' => esc_html__( 'Rating', 'to-reviews' ), | |
| 69 | - 'type' => 'radio', | |
| 70 | - 'options' => array( '0', '1', '2', '3', '4', '5' ), | |
| 71 | - 'allow_none' => true, | |
| 67 | + 'id' => 'rating', | |
| 68 | + 'name' => esc_html__( 'Rating', 'to-reviews' ), | |
| 69 | + 'type' => 'radio', | |
| 70 | + 'options' => array( '0', '1', '2', '3', '4', '5' ), | |
| 71 | + 'allow_none' => true, | |
| 72 | 72 | ); | 
| 73 | 73 | $metabox['fields'][] = array( | 
| 74 | - 'id' => 'date_of_visit_start', | |
| 75 | - 'name' => esc_html__( 'Date of visit', 'to-reviews' ), | |
| 76 | - 'type' => 'date', | |
| 77 | - 'cols' => 6, | |
| 74 | + 'id' => 'date_of_visit_start', | |
| 75 | + 'name' => esc_html__( 'Date of visit', 'to-reviews' ), | |
| 76 | + 'type' => 'date', | |
| 77 | + 'cols' => 6, | |
| 78 | 78 | ); | 
| 79 | 79 | |
| 80 | 80 | $metabox['fields'][] = array( | 
| 81 | - 'id' => 'date_of_visit_end', | |
| 82 | - 'name' => '', | |
| 83 | - 'type' => 'date', | |
| 84 | - 'cols' => 6, | |
| 81 | + 'id' => 'date_of_visit_end', | |
| 82 | + 'name' => '', | |
| 83 | + 'type' => 'date', | |
| 84 | + 'cols' => 6, | |
| 85 | 85 | ); | 
| 86 | 86 | |
| 87 | 87 |  if ( class_exists( 'LSX_TO_Team' ) ) { | 
| 88 | - $metabox['fields'][] = array( | |
| 89 | - 'id' => 'team_to_review', | |
| 90 | - 'name' => esc_html__( 'Reviewed By', 'to-reviews' ), | |
| 91 | - 'type' => 'post_select', | |
| 92 | - 'use_ajax' => false, | |
| 93 | - 'allow_none' => true, | |
| 94 | - 'query' => array( | |
| 95 | - 'post_type' => 'team', | |
| 96 | - 'nopagin' => true, | |
| 97 | - 'posts_per_page' => 1000, | |
| 98 | - 'orderby' => 'title', | |
| 99 | - 'order' => 'ASC', | |
| 100 | - ), | |
| 101 | - ); | |
| 88 | + $metabox['fields'][] = array( | |
| 89 | + 'id' => 'team_to_review', | |
| 90 | + 'name' => esc_html__( 'Reviewed By', 'to-reviews' ), | |
| 91 | + 'type' => 'post_select', | |
| 92 | + 'use_ajax' => false, | |
| 93 | + 'allow_none' => true, | |
| 94 | + 'query' => array( | |
| 95 | + 'post_type' => 'team', | |
| 96 | + 'nopagin' => true, | |
| 97 | + 'posts_per_page' => 1000, | |
| 98 | + 'orderby' => 'title', | |
| 99 | + 'order' => 'ASC', | |
| 100 | + ), | |
| 101 | + ); | |
| 102 | 102 | } | 
| 103 | 103 | |
| 104 | 104 | $metabox['fields'][] = array( | 
| 105 | - 'id' => 'gallery_title', | |
| 106 | - 'name' => esc_html__( 'Gallery', 'to-reviews' ), | |
| 107 | - 'type' => 'title', | |
| 105 | + 'id' => 'gallery_title', | |
| 106 | + 'name' => esc_html__( 'Gallery', 'to-reviews' ), | |
| 107 | + 'type' => 'title', | |
| 108 | 108 | ); | 
| 109 | 109 | |
| 110 | 110 | $metabox['fields'][] = array( | 
| 111 | - 'id' => 'gallery', | |
| 112 | - 'name' => '', | |
| 113 | - 'type' => 'image', | |
| 114 | - 'repeatable' => true, | |
| 115 | - 'show_size' => false, | |
| 116 | - 'sortable' => true, | |
| 117 | - 'string-repeat-field' => esc_html__( 'Add new image', 'tour-operator' ), | |
| 111 | + 'id' => 'gallery', | |
| 112 | + 'name' => '', | |
| 113 | + 'type' => 'image', | |
| 114 | + 'repeatable' => true, | |
| 115 | + 'show_size' => false, | |
| 116 | + 'sortable' => true, | |
| 117 | + 'string-repeat-field' => esc_html__( 'Add new image', 'tour-operator' ), | |
| 118 | 118 | ); | 
| 119 | 119 | |
| 120 | 120 |  if ( class_exists( 'Envira_Gallery' ) ) { | 
| 121 | - $metabox['fields'][] = array( | |
| 122 | - 'id' => 'envira_title', | |
| 123 | - 'name' => esc_html__( 'Envira Gallery', 'to-reviews' ), | |
| 124 | - 'type' => 'title', | |
| 125 | - ); | |
| 126 | - | |
| 127 | - $metabox['fields'][] = array( | |
| 128 | - 'id' => 'envira_gallery', | |
| 129 | - 'name' => esc_html__( 'Envira Gallery', 'to-reviews' ), | |
| 130 | - 'type' => 'post_select', | |
| 131 | - 'use_ajax' => false, | |
| 132 | - 'allow_none' => true, | |
| 133 | - 'query' => array( | |
| 134 | - 'post_type' => 'envira', | |
| 135 | - 'nopagin' => true, | |
| 136 | - 'posts_per_page' => '-1', | |
| 137 | - 'orderby' => 'title', | |
| 138 | - 'order' => 'ASC', | |
| 139 | - ), | |
| 140 | - ); | |
| 141 | - | |
| 142 | -	if ( class_exists( 'Envira_Videos' ) ) { | |
| 143 | - $metabox['fields'][] = array( | |
| 144 | - 'id' => 'envira_video', | |
| 145 | - 'name' => esc_html__( 'Envira Video Gallery', 'to-reviews' ), | |
| 146 | - 'type' => 'post_select', | |
| 147 | - 'use_ajax' => false, | |
| 148 | - 'allow_none' => true, | |
| 149 | - 'query' => array( | |
| 150 | - 'post_type' => 'envira', | |
| 151 | - 'nopagin' => true, | |
| 152 | - 'posts_per_page' => '-1', | |
| 153 | - 'orderby' => 'title', | |
| 154 | - 'order' => 'ASC', | |
| 155 | - ), | |
| 156 | - ); | |
| 157 | - } | |
| 121 | + $metabox['fields'][] = array( | |
| 122 | + 'id' => 'envira_title', | |
| 123 | + 'name' => esc_html__( 'Envira Gallery', 'to-reviews' ), | |
| 124 | + 'type' => 'title', | |
| 125 | + ); | |
| 126 | + | |
| 127 | + $metabox['fields'][] = array( | |
| 128 | + 'id' => 'envira_gallery', | |
| 129 | + 'name' => esc_html__( 'Envira Gallery', 'to-reviews' ), | |
| 130 | + 'type' => 'post_select', | |
| 131 | + 'use_ajax' => false, | |
| 132 | + 'allow_none' => true, | |
| 133 | + 'query' => array( | |
| 134 | + 'post_type' => 'envira', | |
| 135 | + 'nopagin' => true, | |
| 136 | + 'posts_per_page' => '-1', | |
| 137 | + 'orderby' => 'title', | |
| 138 | + 'order' => 'ASC', | |
| 139 | + ), | |
| 140 | + ); | |
| 141 | + | |
| 142 | +     if ( class_exists( 'Envira_Videos' ) ) { | |
| 143 | + $metabox['fields'][] = array( | |
| 144 | + 'id' => 'envira_video', | |
| 145 | + 'name' => esc_html__( 'Envira Video Gallery', 'to-reviews' ), | |
| 146 | + 'type' => 'post_select', | |
| 147 | + 'use_ajax' => false, | |
| 148 | + 'allow_none' => true, | |
| 149 | + 'query' => array( | |
| 150 | + 'post_type' => 'envira', | |
| 151 | + 'nopagin' => true, | |
| 152 | + 'posts_per_page' => '-1', | |
| 153 | + 'orderby' => 'title', | |
| 154 | + 'order' => 'ASC', | |
| 155 | + ), | |
| 156 | + ); | |
| 157 | + } | |
| 158 | 158 | } | 
| 159 | 159 | |
| 160 | 160 | $post_types = array( | 
| 161 | - 'post' => esc_html__( 'Posts', 'to-reviews' ), | |
| 162 | - 'accommodation' => esc_html__( 'Accommodation', 'to-reviews' ), | |
| 163 | - 'destination' => esc_html__( 'Destinations', 'to-reviews' ), | |
| 164 | - 'tour' => esc_html__( 'Tours', 'to-reviews' ), | |
| 161 | + 'post' => esc_html__( 'Posts', 'to-reviews' ), | |
| 162 | + 'accommodation' => esc_html__( 'Accommodation', 'to-reviews' ), | |
| 163 | + 'destination' => esc_html__( 'Destinations', 'to-reviews' ), | |
| 164 | + 'tour' => esc_html__( 'Tours', 'to-reviews' ), | |
| 165 | 165 | ); | 
| 166 | 166 | |
| 167 | 167 |  foreach ( $post_types as $slug => $label ) { | 
| 168 | - $metabox['fields'][] = array( | |
| 169 | - 'id' => $slug . '_title', | |
| 170 | - 'name' => $label, | |
| 171 | - 'type' => 'title', | |
| 172 | - ); | |
| 173 | - | |
| 174 | - $metabox['fields'][] = array( | |
| 175 | - 'id' => $slug . '_to_review', | |
| 176 | - 'name' => $label . esc_html__( ' related with this review', 'to-reviews' ), | |
| 177 | - 'type' => 'post_select', | |
| 178 | - 'use_ajax' => false, | |
| 179 | - 'repeatable' => true, | |
| 180 | - 'allow_none' => true, | |
| 181 | - 'query' => array( | |
| 182 | - 'post_type' => $slug, | |
| 183 | - 'nopagin' => true, | |
| 184 | - 'posts_per_page' => '-1', | |
| 185 | - 'orderby' => 'title', | |
| 186 | - 'order' => 'ASC', | |
| 187 | - ), | |
| 188 | - ); | |
| 168 | + $metabox['fields'][] = array( | |
| 169 | + 'id' => $slug . '_title', | |
| 170 | + 'name' => $label, | |
| 171 | + 'type' => 'title', | |
| 172 | + ); | |
| 173 | + | |
| 174 | + $metabox['fields'][] = array( | |
| 175 | + 'id' => $slug . '_to_review', | |
| 176 | + 'name' => $label . esc_html__( ' related with this review', 'to-reviews' ), | |
| 177 | + 'type' => 'post_select', | |
| 178 | + 'use_ajax' => false, | |
| 179 | + 'repeatable' => true, | |
| 180 | + 'allow_none' => true, | |
| 181 | + 'query' => array( | |
| 182 | + 'post_type' => $slug, | |
| 183 | + 'nopagin' => true, | |
| 184 | + 'posts_per_page' => '-1', | |
| 185 | + 'orderby' => 'title', | |
| 186 | + 'order' => 'ASC', | |
| 187 | + ), | |
| 188 | + ); | |
| 189 | 189 | } | 
| 190 | 190 | |
| 191 | 191 | $metabox['fields'] = apply_filters( 'lsx_to_review_custom_fields', $metabox['fields'] ); | 
| @@ -9,7 +9,7 @@ discard block | ||
| 9 | 9 | global $lsx_to_archive, $post; | 
| 10 | 10 | |
| 11 | 11 |  if ( 1 !== $lsx_to_archive ) { | 
| 12 | - $lsx_to_archive = false; | |
| 12 | + $lsx_to_archive = false; | |
| 13 | 13 | } | 
| 14 | 14 | ?> | 
| 15 | 15 | |
| @@ -35,10 +35,10 @@ discard block | ||
| 35 | 35 |  	<?php } elseif ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_text'] ) ) { ?> | 
| 36 | 36 | |
| 37 | 37 | <div <?php lsx_to_entry_class( 'entry-content' ); ?>><?php | 
| 38 | - lsx_to_entry_content_top(); | |
| 39 | - the_excerpt(); | |
| 40 | - lsx_to_entry_content_bottom(); | |
| 41 | - ?></div> | |
| 38 | + lsx_to_entry_content_top(); | |
| 39 | + the_excerpt(); | |
| 40 | + lsx_to_entry_content_bottom(); | |
| 41 | + ?></div> | |
| 42 | 42 | |
| 43 | 43 | <?php } ?> | 
| 44 | 44 | |