@@ -8,31 +8,31 @@ |
||
| 8 | 8 | |
| 9 | 9 | global $lsx_to_archive, $post; |
| 10 | 10 | |
| 11 | -if ( 1 !== $lsx_to_archive ) { |
|
| 11 | +if (1 !== $lsx_to_archive) { |
|
| 12 | 12 | $lsx_to_archive = false; |
| 13 | 13 | } |
| 14 | 14 | ?> |
| 15 | 15 | |
| 16 | 16 | <?php lsx_entry_before(); ?> |
| 17 | 17 | |
| 18 | -<article id="special-<?php echo esc_attr( $post->post_name ); ?>" <?php post_class( 'lsx-to-archive-container' ); ?>> |
|
| 18 | +<article id="special-<?php echo esc_attr($post->post_name); ?>" <?php post_class('lsx-to-archive-container'); ?>> |
|
| 19 | 19 | <?php lsx_entry_top(); ?> |
| 20 | 20 | |
| 21 | - <?php if ( is_single() && false === $lsx_to_archive ) { ?> |
|
| 21 | + <?php if (is_single() && false === $lsx_to_archive) { ?> |
|
| 22 | 22 | |
| 23 | - <div <?php lsx_to_entry_class( 'entry-content' ); ?>> |
|
| 23 | + <div <?php lsx_to_entry_class('entry-content'); ?>> |
|
| 24 | 24 | <div class="lsx-to-summary"> |
| 25 | 25 | <h2 class="lsx-to-summary-title"><?php the_title(); ?></h2> |
| 26 | 26 | </div> |
| 27 | 27 | |
| 28 | - <?php lsx_to_price( '<p class="lsx-to-meta-data lsx-to-meta-data-big lsx-to-meta-data-price"><span class="lsx-to-meta-data-key">' . esc_html__( 'From price', 'tour-operator' ) . ':</span> ', '</p>' ); ?> |
|
| 28 | + <?php lsx_to_price('<p class="lsx-to-meta-data lsx-to-meta-data-big lsx-to-meta-data-price"><span class="lsx-to-meta-data-key">' . esc_html__('From price', 'tour-operator') . ':</span> ', '</p>'); ?> |
|
| 29 | 29 | <?php the_content(); ?> |
| 30 | 30 | <?php lsx_to_sharing(); ?> |
| 31 | 31 | </div> |
| 32 | 32 | |
| 33 | - <?php } elseif ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_text'] ) ) { ?> |
|
| 33 | + <?php } elseif (is_search() || empty(tour_operator()->options[get_post_type()]['disable_entry_text'])) { ?> |
|
| 34 | 34 | |
| 35 | - <div <?php lsx_to_entry_class( 'entry-content' ); ?>><?php |
|
| 35 | + <div <?php lsx_to_entry_class('entry-content'); ?>><?php |
|
| 36 | 36 | lsx_to_entry_content_top(); |
| 37 | 37 | the_excerpt(); |
| 38 | 38 | lsx_to_entry_content_bottom(); |
@@ -13,16 +13,16 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | 15 | // If this file is called directly, abort. |
| 16 | -if ( ! defined( 'WPINC' ) ) { |
|
| 16 | +if ( ! defined('WPINC')) { |
|
| 17 | 17 | die; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -define('LSX_TO_SPECIALS_PATH', plugin_dir_path( __FILE__ ) ); |
|
| 21 | -define('LSX_TO_SPECIALS_CORE', __FILE__ ); |
|
| 22 | -define('LSX_TO_SPECIALS_URL', plugin_dir_url( __FILE__ ) ); |
|
| 23 | -define('LSX_TO_SPECIALS_VER', '1.3.1' ); |
|
| 20 | +define('LSX_TO_SPECIALS_PATH', plugin_dir_path(__FILE__)); |
|
| 21 | +define('LSX_TO_SPECIALS_CORE', __FILE__); |
|
| 22 | +define('LSX_TO_SPECIALS_URL', plugin_dir_url(__FILE__)); |
|
| 23 | +define('LSX_TO_SPECIALS_VER', '1.3.1'); |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | /* ======================= Below is the Plugin Class init ========================= */ |
| 27 | 27 | |
| 28 | -require_once( LSX_TO_SPECIALS_PATH . '/classes/class-to-specials.php' ); |
|
| 28 | +require_once(LSX_TO_SPECIALS_PATH . '/classes/class-to-specials.php'); |
|
@@ -31,22 +31,22 @@ discard block |
||
| 31 | 31 | * @param array $post_types an array of the post types to redirect. |
| 32 | 32 | * @param array $taxonomies an array of the taxonomies to redirect. |
| 33 | 33 | */ |
| 34 | - public function __construct($plugin_path=false,$post_types=false,$taxonomies=false) { |
|
| 35 | - if(false !== $plugin_path){ |
|
| 34 | + public function __construct($plugin_path = false, $post_types = false, $taxonomies = false) { |
|
| 35 | + if (false !== $plugin_path) { |
|
| 36 | 36 | $this->plugin_path = $plugin_path; |
| 37 | 37 | |
| 38 | - add_filter( 'lsx_to_widget_path', array( $this, 'widget_path'), 10, 2 ); |
|
| 39 | - add_filter( 'lsx_to_content_path', array( $this, 'content_path'), 10, 3 ); |
|
| 38 | + add_filter('lsx_to_widget_path', array($this, 'widget_path'), 10, 2); |
|
| 39 | + add_filter('lsx_to_content_path', array($this, 'content_path'), 10, 3); |
|
| 40 | 40 | |
| 41 | - if(false !== $post_types){ |
|
| 41 | + if (false !== $post_types) { |
|
| 42 | 42 | $this->post_types = $post_types; |
| 43 | - add_filter( 'template_include', array( $this, 'post_type_archive_template_include'), 99 ); |
|
| 44 | - add_filter( 'template_include', array( $this, 'post_type_single_template_include'), 99 ); |
|
| 45 | - add_filter( 'template_include', array( $this, 'search_template_include'), 99 ); |
|
| 43 | + add_filter('template_include', array($this, 'post_type_archive_template_include'), 99); |
|
| 44 | + add_filter('template_include', array($this, 'post_type_single_template_include'), 99); |
|
| 45 | + add_filter('template_include', array($this, 'search_template_include'), 99); |
|
| 46 | 46 | } |
| 47 | - if(false !== $taxonomies){ |
|
| 47 | + if (false !== $taxonomies) { |
|
| 48 | 48 | $this->taxonomies = $taxonomies; |
| 49 | - add_filter( 'template_include', array( $this, 'taxonomy_template_include'), 99 ); |
|
| 49 | + add_filter('template_include', array($this, 'taxonomy_template_include'), 99); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -57,12 +57,12 @@ discard block |
||
| 57 | 57 | * @param $template |
| 58 | 58 | * @return $template |
| 59 | 59 | */ |
| 60 | - public function post_type_archive_template_include( $template ) { |
|
| 60 | + public function post_type_archive_template_include($template) { |
|
| 61 | 61 | |
| 62 | - if ( is_main_query() && is_post_type_archive($this->post_types)) { |
|
| 62 | + if (is_main_query() && is_post_type_archive($this->post_types)) { |
|
| 63 | 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'; |
|
| 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 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | return $template; |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | * @return $template |
| 77 | 77 | */ |
| 78 | 78 | public function post_type_single_template_include($template) { |
| 79 | - if ( is_main_query() && is_singular($this->post_types) ) { |
|
| 79 | + if (is_main_query() && is_singular($this->post_types)) { |
|
| 80 | 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'; |
|
| 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 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | return $template; |
@@ -95,11 +95,11 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function taxonomy_template_include($template) { |
| 97 | 97 | |
| 98 | - if ( is_main_query() && is_tax($this->taxonomies) ) { |
|
| 98 | + if (is_main_query() && is_tax($this->taxonomies)) { |
|
| 99 | 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'; |
|
| 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 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | return $template; |
@@ -112,11 +112,11 @@ discard block |
||
| 112 | 112 | * |
| 113 | 113 | * @return $template |
| 114 | 114 | */ |
| 115 | - public function search_template_include( $template ) { |
|
| 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'; |
|
| 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 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | return $template; |
@@ -132,26 +132,26 @@ discard block |
||
| 132 | 132 | public function content_part($slug, $name = null) { |
| 133 | 133 | $template = array(); |
| 134 | 134 | $name = (string) $name; |
| 135 | - if ( '' !== $name ){ |
|
| 135 | + if ('' !== $name) { |
|
| 136 | 136 | $template = "{$slug}-{$name}.php"; |
| 137 | - }else{ |
|
| 137 | + } else { |
|
| 138 | 138 | $template = "{$slug}.php"; |
| 139 | 139 | } |
| 140 | 140 | $original_name = $template; |
| 141 | - $path = apply_filters('lsx_to_content_path','',get_post_type()); |
|
| 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{ |
|
| 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 | 148 | $template = false; |
| 149 | 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>'); |
|
| 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 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | |
@@ -163,9 +163,9 @@ discard block |
||
| 163 | 163 | * |
| 164 | 164 | * @return $path |
| 165 | 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){ |
|
| 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 | 169 | $path = $this->plugin_path; |
| 170 | 170 | } |
| 171 | 171 | return $path; |
@@ -179,9 +179,9 @@ discard block |
||
| 179 | 179 | * |
| 180 | 180 | * @return $path |
| 181 | 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){ |
|
| 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 | 185 | $path = $this->plugin_path; |
| 186 | 186 | } |
| 187 | 187 | return $path; |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $name = (string) $name; |
| 135 | 135 | if ( '' !== $name ){ |
| 136 | 136 | $template = "{$slug}-{$name}.php"; |
| 137 | - }else{ |
|
| 137 | + } else{ |
|
| 138 | 138 | $template = "{$slug}.php"; |
| 139 | 139 | } |
| 140 | 140 | $original_name = $template; |
@@ -142,15 +142,15 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | if ( '' == locate_template( array( $template ) ) && file_exists( $path.'templates/'.$template) ) { |
| 144 | 144 | $template = $path.'templates/'.$template; |
| 145 | - }elseif(file_exists( get_stylesheet_directory().'/'.$template)){ |
|
| 145 | + } elseif(file_exists( get_stylesheet_directory().'/'.$template)){ |
|
| 146 | 146 | $template = get_stylesheet_directory().'/'.$template; |
| 147 | - }else{ |
|
| 147 | + } else{ |
|
| 148 | 148 | $template = false; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | if(false !== $template){ |
| 152 | 152 | load_template( $template, false ); |
| 153 | - }else { |
|
| 153 | + } else { |
|
| 154 | 154 | echo wp_kses_post('<p>No '.$original_name.' can be found.</p>'); |
| 155 | 155 | } |
| 156 | 156 | } |
@@ -31,48 +31,48 @@ discard block |
||
| 31 | 31 | public function __construct() { |
| 32 | 32 | $this->set_vars(); |
| 33 | 33 | |
| 34 | - add_filter( 'lsx_to_entry_class', array( $this, 'entry_class' ) ); |
|
| 35 | - add_action( 'lsx_to_settings_current_tab', array( $this, 'set_settings_current_tab' ) ); |
|
| 36 | - add_action( 'init', array( $this, 'init' ) ); |
|
| 34 | + add_filter('lsx_to_entry_class', array($this, 'entry_class')); |
|
| 35 | + add_action('lsx_to_settings_current_tab', array($this, 'set_settings_current_tab')); |
|
| 36 | + add_action('init', array($this, 'init')); |
|
| 37 | 37 | |
| 38 | - if ( ! class_exists( 'LSX_TO_Template_Redirects' ) ) { |
|
| 39 | - require_once( LSX_TO_SPECIALS_PATH . 'classes/class-template-redirects.php' ); |
|
| 38 | + if ( ! class_exists('LSX_TO_Template_Redirects')) { |
|
| 39 | + require_once(LSX_TO_SPECIALS_PATH . 'classes/class-template-redirects.php'); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - $this->redirects = new LSX_TO_Template_Redirects( LSX_TO_SPECIALS_PATH, array_keys( $this->post_types ), array_keys( $this->taxonomies ) ); |
|
| 42 | + $this->redirects = new LSX_TO_Template_Redirects(LSX_TO_SPECIALS_PATH, array_keys($this->post_types), array_keys($this->taxonomies)); |
|
| 43 | 43 | |
| 44 | - add_action( 'lsx_special_content', array( $this->redirects, 'content_part' ), 10 , 2 ); |
|
| 44 | + add_action('lsx_special_content', array($this->redirects, 'content_part'), 10, 2); |
|
| 45 | 45 | |
| 46 | - add_filter( 'lsx_to_page_navigation', array( $this, 'page_links' ) ); |
|
| 46 | + add_filter('lsx_to_page_navigation', array($this, 'page_links')); |
|
| 47 | 47 | |
| 48 | - add_action( 'lsx_entry_top', array( $this, 'archive_entry_top' ), 15 ); |
|
| 49 | - add_action( 'lsx_entry_bottom', array( $this, 'archive_entry_bottom' ) ); |
|
| 50 | - add_action( 'lsx_content_bottom', array( $this, 'single_content_bottom' ) ); |
|
| 51 | - add_action( 'lsx_to_fast_facts', array( $this, 'single_fast_facts' ) ); |
|
| 48 | + add_action('lsx_entry_top', array($this, 'archive_entry_top'), 15); |
|
| 49 | + add_action('lsx_entry_bottom', array($this, 'archive_entry_bottom')); |
|
| 50 | + add_action('lsx_content_bottom', array($this, 'single_content_bottom')); |
|
| 51 | + add_action('lsx_to_fast_facts', array($this, 'single_fast_facts')); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | 55 | * Runs on init after all files have been parsed. |
| 56 | 56 | */ |
| 57 | 57 | public function init() { |
| 58 | - if ( ! class_exists( 'LSX_Currencies' ) ) { |
|
| 59 | - add_filter( 'lsx_to_custom_field_query', array( $this, 'price_filter' ), 5, 10 ); |
|
| 58 | + if ( ! class_exists('LSX_Currencies')) { |
|
| 59 | + add_filter('lsx_to_custom_field_query', array($this, 'price_filter'), 5, 10); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - add_filter( 'lsx_to_custom_field_query', array( $this, 'terms_conditions_filter' ), 5, 10 ); |
|
| 62 | + add_filter('lsx_to_custom_field_query', array($this, 'terms_conditions_filter'), 5, 10); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * A filter to set the content area to a small column on single |
| 67 | 67 | */ |
| 68 | - public function entry_class( $classes ) { |
|
| 68 | + public function entry_class($classes) { |
|
| 69 | 69 | global $lsx_to_archive; |
| 70 | 70 | |
| 71 | - if ( 1 !== $lsx_to_archive ) { |
|
| 71 | + if (1 !== $lsx_to_archive) { |
|
| 72 | 72 | $lsx_to_archive = false; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - if ( is_main_query() && is_singular( 'special' ) && false === $lsx_to_archive ) { |
|
| 75 | + if (is_main_query() && is_singular('special') && false === $lsx_to_archive) { |
|
| 76 | 76 | $classes[] = 'col-xs-12 col-sm-12 col-md-6'; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -82,11 +82,11 @@ discard block |
||
| 82 | 82 | /** |
| 83 | 83 | * Sets the current tab selected. |
| 84 | 84 | */ |
| 85 | - public function set_settings_current_tab( $settings_tab ) { |
|
| 86 | - if ( is_tax( array_keys( $this->taxonomies ) ) ) { |
|
| 87 | - $taxonomy = get_query_var( 'taxonomy' ); |
|
| 85 | + public function set_settings_current_tab($settings_tab) { |
|
| 86 | + if (is_tax(array_keys($this->taxonomies))) { |
|
| 87 | + $taxonomy = get_query_var('taxonomy'); |
|
| 88 | 88 | |
| 89 | - if ( 'special-type' === $taxonomy ) { |
|
| 89 | + if ('special-type' === $taxonomy) { |
|
| 90 | 90 | $settings_tab = 'special'; |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -97,35 +97,35 @@ discard block |
||
| 97 | 97 | /** |
| 98 | 98 | * Adds in additional info for the price custom field |
| 99 | 99 | */ |
| 100 | - public function price_filter( $html = '', $meta_key = false, $value = false, $before = '', $after = '' ) { |
|
| 101 | - if ( get_post_type() === 'special' && 'price' === $meta_key ) { |
|
| 102 | - $price_type = get_post_meta( get_the_ID(), 'price_type', true ); |
|
| 103 | - $value = preg_replace( '/[^0-9,.]/', '', $value ); |
|
| 104 | - $value = ltrim( $value, '.' ); |
|
| 105 | - $value = str_replace( ', ', '', $value ); |
|
| 106 | - $value = number_format( (int) $value, 2 ); |
|
| 100 | + public function price_filter($html = '', $meta_key = false, $value = false, $before = '', $after = '') { |
|
| 101 | + if (get_post_type() === 'special' && 'price' === $meta_key) { |
|
| 102 | + $price_type = get_post_meta(get_the_ID(), 'price_type', true); |
|
| 103 | + $value = preg_replace('/[^0-9,.]/', '', $value); |
|
| 104 | + $value = ltrim($value, '.'); |
|
| 105 | + $value = str_replace(', ', '', $value); |
|
| 106 | + $value = number_format((int) $value, 2); |
|
| 107 | 107 | $tour_operator = tour_operator(); |
| 108 | 108 | $currency = ''; |
| 109 | 109 | |
| 110 | - if ( is_object( $tour_operator ) && isset( $tour_operator->options['general'] ) && is_array( $tour_operator->options['general'] ) ) { |
|
| 111 | - if ( isset( $tour_operator->options['general']['currency'] ) && ! empty( $tour_operator->options['general']['currency'] ) ) { |
|
| 110 | + if (is_object($tour_operator) && isset($tour_operator->options['general']) && is_array($tour_operator->options['general'])) { |
|
| 111 | + if (isset($tour_operator->options['general']['currency']) && ! empty($tour_operator->options['general']['currency'])) { |
|
| 112 | 112 | $currency = $tour_operator->options['general']['currency']; |
| 113 | - $currency = '<span class="currency-icon ' . mb_strtolower( $currency ) . '">' . $currency . '</span>'; |
|
| 113 | + $currency = '<span class="currency-icon ' . mb_strtolower($currency) . '">' . $currency . '</span>'; |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - switch ( $price_type ) { |
|
| 117 | + switch ($price_type) { |
|
| 118 | 118 | case 'per_person': |
| 119 | 119 | case 'per_person_per_night': |
| 120 | 120 | case 'per_person_sharing': |
| 121 | 121 | case 'per_person_sharing_per_night': |
| 122 | - $value = $currency . $value . ' ' . ucwords( str_replace( '_', ' ', $price_type ) ) . ''; |
|
| 123 | - $value = str_replace( 'Per Person', 'P/P', $value ); |
|
| 122 | + $value = $currency . $value . ' ' . ucwords(str_replace('_', ' ', $price_type)) . ''; |
|
| 123 | + $value = str_replace('Per Person', 'P/P', $value); |
|
| 124 | 124 | break; |
| 125 | 125 | |
| 126 | 126 | case 'total_percentage': |
| 127 | - $value .= '% ' . __( 'Off', 'to-specials' ) . ''; |
|
| 128 | - $before = str_replace( 'from price', '', $before ); |
|
| 127 | + $value .= '% ' . __('Off', 'to-specials') . ''; |
|
| 128 | + $before = str_replace('from price', '', $before); |
|
| 129 | 129 | break; |
| 130 | 130 | |
| 131 | 131 | case 'none': |
@@ -143,9 +143,9 @@ discard block |
||
| 143 | 143 | /** |
| 144 | 144 | * Filters text area type filters |
| 145 | 145 | */ |
| 146 | - public function terms_conditions_filter( $html = '', $meta_key = false, $value = false, $before = '', $after = '' ) { |
|
| 147 | - if ( get_post_type() === 'special' && 'terms_conditions' === $meta_key ) { |
|
| 148 | - $html = $before . '<div class="entry-content">' . apply_filters( 'the_content', wpautop( $value ) ) . '</div>' . $after; |
|
| 146 | + public function terms_conditions_filter($html = '', $meta_key = false, $value = false, $before = '', $after = '') { |
|
| 147 | + if (get_post_type() === 'special' && 'terms_conditions' === $meta_key) { |
|
| 148 | + $html = $before . '<div class="entry-content">' . apply_filters('the_content', wpautop($value)) . '</div>' . $after; |
|
| 149 | 149 | |
| 150 | 150 | } |
| 151 | 151 | |
@@ -158,8 +158,8 @@ discard block |
||
| 158 | 158 | * @param $page_links array |
| 159 | 159 | * @return $page_links array |
| 160 | 160 | */ |
| 161 | - public function page_links( $page_links ) { |
|
| 162 | - if ( is_singular( 'special' ) ) { |
|
| 161 | + public function page_links($page_links) { |
|
| 162 | + if (is_singular('special')) { |
|
| 163 | 163 | $this->page_links = $page_links; |
| 164 | 164 | |
| 165 | 165 | $this->get_map_link(); |
@@ -179,8 +179,8 @@ discard block |
||
| 179 | 179 | * Tests for the Google Map and returns a link for the section |
| 180 | 180 | */ |
| 181 | 181 | public function get_map_link() { |
| 182 | - if ( function_exists( 'lsx_to_has_map' ) && lsx_to_has_map() ) { |
|
| 183 | - $this->page_links['special-map'] = esc_html__( 'Map', 'to-specials' ); |
|
| 182 | + if (function_exists('lsx_to_has_map') && lsx_to_has_map()) { |
|
| 183 | + $this->page_links['special-map'] = esc_html__('Map', 'to-specials'); |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
@@ -188,22 +188,22 @@ discard block |
||
| 188 | 188 | * Tests for the Gallery and returns a link for the section |
| 189 | 189 | */ |
| 190 | 190 | public function get_gallery_link() { |
| 191 | - $gallery_ids = get_post_meta( get_the_ID(), 'gallery', false ); |
|
| 192 | - $envira_gallery = get_post_meta( get_the_ID(), 'envira_gallery', true ); |
|
| 191 | + $gallery_ids = get_post_meta(get_the_ID(), 'gallery', false); |
|
| 192 | + $envira_gallery = get_post_meta(get_the_ID(), 'envira_gallery', true); |
|
| 193 | 193 | |
| 194 | - if ( ( ! empty( $gallery_ids ) && is_array( $gallery_ids ) ) || ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) ) { |
|
| 195 | - if ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) { |
|
| 194 | + if (( ! empty($gallery_ids) && is_array($gallery_ids)) || (function_exists('envira_gallery') && ! empty($envira_gallery) && false === lsx_to_enable_envira_banner())) { |
|
| 195 | + if (function_exists('envira_gallery') && ! empty($envira_gallery) && false === lsx_to_enable_envira_banner()) { |
|
| 196 | 196 | // Envira Gallery |
| 197 | - $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-specials' ); |
|
| 197 | + $this->page_links['gallery'] = esc_html__('Gallery', 'to-specials'); |
|
| 198 | 198 | return; |
| 199 | 199 | } else { |
| 200 | - if ( function_exists( 'envira_dynamic' ) ) { |
|
| 200 | + if (function_exists('envira_dynamic')) { |
|
| 201 | 201 | // Envira Gallery - Dynamic |
| 202 | - $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-specials' ); |
|
| 202 | + $this->page_links['gallery'] = esc_html__('Gallery', 'to-specials'); |
|
| 203 | 203 | return; |
| 204 | 204 | } else { |
| 205 | 205 | // WordPress Gallery |
| 206 | - $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-specials' ); |
|
| 206 | + $this->page_links['gallery'] = esc_html__('Gallery', 'to-specials'); |
|
| 207 | 207 | return; |
| 208 | 208 | } |
| 209 | 209 | } |
@@ -216,16 +216,16 @@ discard block |
||
| 216 | 216 | public function get_videos_link() { |
| 217 | 217 | $videos_id = false; |
| 218 | 218 | |
| 219 | - if ( class_exists( 'Envira_Videos' ) ) { |
|
| 220 | - $videos_id = get_post_meta( get_the_ID(), 'envira_video', true ); |
|
| 219 | + if (class_exists('Envira_Videos')) { |
|
| 220 | + $videos_id = get_post_meta(get_the_ID(), 'envira_video', true); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - if ( empty( $videos_id ) && function_exists( 'lsx_to_videos' ) ) { |
|
| 224 | - $videos_id = get_post_meta( get_the_ID(), 'videos', true ); |
|
| 223 | + if (empty($videos_id) && function_exists('lsx_to_videos')) { |
|
| 224 | + $videos_id = get_post_meta(get_the_ID(), 'videos', true); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - if ( ! empty( $videos_id ) ) { |
|
| 228 | - $this->page_links['videos'] = esc_html__( 'Videos', 'to-specials' ); |
|
| 227 | + if ( ! empty($videos_id)) { |
|
| 228 | + $this->page_links['videos'] = esc_html__('Videos', 'to-specials'); |
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
@@ -233,22 +233,22 @@ discard block |
||
| 233 | 233 | * Tests for the Related Posts and returns a link for the section |
| 234 | 234 | */ |
| 235 | 235 | public function get_related_posts_link() { |
| 236 | - $connected_posts = get_post_meta( get_the_ID(), 'post_to_special', false ); |
|
| 236 | + $connected_posts = get_post_meta(get_the_ID(), 'post_to_special', false); |
|
| 237 | 237 | |
| 238 | - if ( is_array( $connected_posts ) && ! empty( $connected_posts ) ) { |
|
| 239 | - $connected_posts = new \WP_Query( array( |
|
| 238 | + if (is_array($connected_posts) && ! empty($connected_posts)) { |
|
| 239 | + $connected_posts = new \WP_Query(array( |
|
| 240 | 240 | 'post_type' => 'post', |
| 241 | 241 | 'post__in' => $connected_posts, |
| 242 | 242 | 'post_status' => 'publish', |
| 243 | 243 | 'nopagin' => true, |
| 244 | 244 | 'posts_per_page' => '-1', |
| 245 | 245 | 'fields' => 'ids', |
| 246 | - ) ); |
|
| 246 | + )); |
|
| 247 | 247 | |
| 248 | 248 | $connected_posts = $connected_posts->posts; |
| 249 | 249 | |
| 250 | - if ( is_array( $connected_posts ) && ! empty( $connected_posts ) ) { |
|
| 251 | - $this->page_links['posts'] = esc_html__( 'Posts', 'to-specials' ); |
|
| 250 | + if (is_array($connected_posts) && ! empty($connected_posts)) { |
|
| 251 | + $this->page_links['posts'] = esc_html__('Posts', 'to-specials'); |
|
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | } |
@@ -257,10 +257,10 @@ discard block |
||
| 257 | 257 | * Tests for the Term and Conditions and returns a link for the section |
| 258 | 258 | */ |
| 259 | 259 | public function get_terms_and_conditions_link() { |
| 260 | - $terms_conditions = get_post_meta( get_the_ID(), 'terms_conditions', true ); |
|
| 260 | + $terms_conditions = get_post_meta(get_the_ID(), 'terms_conditions', true); |
|
| 261 | 261 | |
| 262 | - if ( ! empty( $terms_conditions ) ) { |
|
| 263 | - $this->page_links['terms-and-conditions'] = esc_html__( 'Terms and Conditions', 'to-specials' ); |
|
| 262 | + if ( ! empty($terms_conditions)) { |
|
| 263 | + $this->page_links['terms-and-conditions'] = esc_html__('Terms and Conditions', 'to-specials'); |
|
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | |
@@ -270,23 +270,23 @@ discard block |
||
| 270 | 270 | public function archive_entry_top() { |
| 271 | 271 | global $lsx_to_archive; |
| 272 | 272 | |
| 273 | - if ( 'special' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { |
|
| 274 | - if ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?> |
|
| 273 | + if ('special' === get_post_type() && (is_archive() || $lsx_to_archive)) { |
|
| 274 | + if (is_search() || empty(tour_operator()->options[get_post_type()]['disable_entry_metadata'])) { ?> |
|
| 275 | 275 | <div class="lsx-to-archive-meta-data lsx-to-archive-meta-data-grid-mode"> |
| 276 | 276 | <?php |
| 277 | 277 | $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
| 278 | 278 | |
| 279 | - lsx_to_price( '<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__( 'From price', 'to-specials' ) . ':</span> ', '</span>' ); |
|
| 280 | - lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'to-specials' ) . ':</span> ', '</span>' ); |
|
| 281 | - lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'to-specials' ) . ':</span> ', '</span>' ); |
|
| 282 | - the_terms( get_the_ID(), 'travel-style', '<span class="' . $meta_class . 'style"><span class="lsx-to-meta-data-key">' . __( 'Travel Style', 'to-specials' ) . ':</span> ', ', ', '</span>' ); |
|
| 283 | - the_terms( get_the_ID(), 'special-type', '<span class="' . $meta_class . 'type"><span class="lsx-to-meta-data-key">' . __( 'Type', 'to-specials' ) . ':</span> ', ', ', '</span>' ); |
|
| 284 | - lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Destinations', 'to-specials' ) . ':</span> ', '</span>' ); |
|
| 285 | - lsx_to_specials_validity( '<span class="' . $meta_class . 'valid-from"><span class="lsx-to-meta-data-key">' . __( 'Booking Validity', 'to-specials' ) . ':</span> ', '</span>' ); |
|
| 286 | - lsx_to_travel_dates( '<span class="' . $meta_class . 'travel-dates"><span class="lsx-to-meta-data-key">' . __( 'Travel Dates', 'to-specials' ) . ':</span> ', '</span>' ); |
|
| 287 | - |
|
| 288 | - if ( function_exists( 'lsx_to_connected_activities' ) ) { |
|
| 289 | - lsx_to_connected_activities( '<span class="' . $meta_class . 'activities"><span class="lsx-to-meta-data-key">' . __( 'Activites', 'to-specials' ) . ':</span> ', '</span>' ); |
|
| 279 | + lsx_to_price('<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__('From price', 'to-specials') . ':</span> ', '</span>'); |
|
| 280 | + lsx_to_connected_tours('<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __('Tours', 'to-specials') . ':</span> ', '</span>'); |
|
| 281 | + lsx_to_connected_accommodation('<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __('Accommodation', 'to-specials') . ':</span> ', '</span>'); |
|
| 282 | + the_terms(get_the_ID(), 'travel-style', '<span class="' . $meta_class . 'style"><span class="lsx-to-meta-data-key">' . __('Travel Style', 'to-specials') . ':</span> ', ', ', '</span>'); |
|
| 283 | + the_terms(get_the_ID(), 'special-type', '<span class="' . $meta_class . 'type"><span class="lsx-to-meta-data-key">' . __('Type', 'to-specials') . ':</span> ', ', ', '</span>'); |
|
| 284 | + lsx_to_connected_destinations('<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __('Destinations', 'to-specials') . ':</span> ', '</span>'); |
|
| 285 | + lsx_to_specials_validity('<span class="' . $meta_class . 'valid-from"><span class="lsx-to-meta-data-key">' . __('Booking Validity', 'to-specials') . ':</span> ', '</span>'); |
|
| 286 | + lsx_to_travel_dates('<span class="' . $meta_class . 'travel-dates"><span class="lsx-to-meta-data-key">' . __('Travel Dates', 'to-specials') . ':</span> ', '</span>'); |
|
| 287 | + |
|
| 288 | + if (function_exists('lsx_to_connected_activities')) { |
|
| 289 | + lsx_to_connected_activities('<span class="' . $meta_class . 'activities"><span class="lsx-to-meta-data-key">' . __('Activites', 'to-specials') . ':</span> ', '</span>'); |
|
| 290 | 290 | } |
| 291 | 291 | ?> |
| 292 | 292 | </div> |
@@ -300,25 +300,25 @@ discard block |
||
| 300 | 300 | public function archive_entry_bottom() { |
| 301 | 301 | global $lsx_to_archive; |
| 302 | 302 | |
| 303 | - if ( 'special' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { ?> |
|
| 303 | + if ('special' === get_post_type() && (is_archive() || $lsx_to_archive)) { ?> |
|
| 304 | 304 | </div> |
| 305 | 305 | |
| 306 | - <?php if ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?> |
|
| 306 | + <?php if (is_search() || empty(tour_operator()->options[get_post_type()]['disable_entry_metadata'])) { ?> |
|
| 307 | 307 | <div class="lsx-to-archive-meta-data lsx-to-archive-meta-data-list-mode"> |
| 308 | 308 | <?php |
| 309 | 309 | $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
| 310 | 310 | |
| 311 | - lsx_to_price( '<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__( 'From price', 'to-specials' ) . ':</span> ', '</span>' ); |
|
| 312 | - lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'to-specials' ) . ':</span> ', '</span>' ); |
|
| 313 | - lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'to-specials' ) . ':</span> ', '</span>' ); |
|
| 314 | - the_terms( get_the_ID(), 'travel-style', '<span class="' . $meta_class . 'style"><span class="lsx-to-meta-data-key">' . __( 'Travel Style', 'to-specials' ) . ':</span> ', ', ', '</span>' ); |
|
| 315 | - the_terms( get_the_ID(), 'special-type', '<span class="' . $meta_class . 'type"><span class="lsx-to-meta-data-key">' . __( 'Type', 'to-specials' ) . ':</span> ', ', ', '</span>' ); |
|
| 316 | - lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Destinations', 'to-specials' ) . ':</span> ', '</span>' ); |
|
| 317 | - lsx_to_specials_validity( '<span class="' . $meta_class . 'valid-from"><span class="lsx-to-meta-data-key">' . __( 'Booking Validity', 'to-specials' ) . ':</span> ', '</span>' ); |
|
| 318 | - lsx_to_travel_dates( '<span class="' . $meta_class . 'travel-dates"><span class="lsx-to-meta-data-key">' . __( 'Travel Dates', 'to-specials' ) . ':</span> ', '</span>' ); |
|
| 319 | - |
|
| 320 | - if ( function_exists( 'lsx_to_connected_activities' ) ) { |
|
| 321 | - lsx_to_connected_activities( '<span class="' . $meta_class . 'activities"><span class="lsx-to-meta-data-key">' . __( 'Activites', 'to-specials' ) . ':</span> ', '</span>' ); |
|
| 311 | + lsx_to_price('<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__('From price', 'to-specials') . ':</span> ', '</span>'); |
|
| 312 | + lsx_to_connected_tours('<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __('Tours', 'to-specials') . ':</span> ', '</span>'); |
|
| 313 | + lsx_to_connected_accommodation('<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __('Accommodation', 'to-specials') . ':</span> ', '</span>'); |
|
| 314 | + the_terms(get_the_ID(), 'travel-style', '<span class="' . $meta_class . 'style"><span class="lsx-to-meta-data-key">' . __('Travel Style', 'to-specials') . ':</span> ', ', ', '</span>'); |
|
| 315 | + the_terms(get_the_ID(), 'special-type', '<span class="' . $meta_class . 'type"><span class="lsx-to-meta-data-key">' . __('Type', 'to-specials') . ':</span> ', ', ', '</span>'); |
|
| 316 | + lsx_to_connected_destinations('<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __('Destinations', 'to-specials') . ':</span> ', '</span>'); |
|
| 317 | + lsx_to_specials_validity('<span class="' . $meta_class . 'valid-from"><span class="lsx-to-meta-data-key">' . __('Booking Validity', 'to-specials') . ':</span> ', '</span>'); |
|
| 318 | + lsx_to_travel_dates('<span class="' . $meta_class . 'travel-dates"><span class="lsx-to-meta-data-key">' . __('Travel Dates', 'to-specials') . ':</span> ', '</span>'); |
|
| 319 | + |
|
| 320 | + if (function_exists('lsx_to_connected_activities')) { |
|
| 321 | + lsx_to_connected_activities('<span class="' . $meta_class . 'activities"><span class="lsx-to-meta-data-key">' . __('Activites', 'to-specials') . ':</span> ', '</span>'); |
|
| 322 | 322 | } |
| 323 | 323 | ?> |
| 324 | 324 | </div> |
@@ -327,8 +327,8 @@ discard block |
||
| 327 | 327 | |
| 328 | 328 | <?php $has_single = ! lsx_to_is_single_disabled(); ?> |
| 329 | 329 | |
| 330 | - <?php if ( $has_single && 'grid' === tour_operator()->archive_layout ) : ?> |
|
| 331 | - <a href="<?php the_permalink(); ?>" class="moretag"><?php esc_html_e( 'View more', 'to-specials' ); ?></a> |
|
| 330 | + <?php if ($has_single && 'grid' === tour_operator()->archive_layout) : ?> |
|
| 331 | + <a href="<?php the_permalink(); ?>" class="moretag"><?php esc_html_e('View more', 'to-specials'); ?></a> |
|
| 332 | 332 | <?php endif; ?> |
| 333 | 333 | <?php } |
| 334 | 334 | } |
@@ -337,26 +337,26 @@ discard block |
||
| 337 | 337 | * Adds the template tags fast facts |
| 338 | 338 | */ |
| 339 | 339 | public function single_fast_facts() { |
| 340 | - if ( is_singular( 'special' ) ) { ?> |
|
| 340 | + if (is_singular('special')) { ?> |
|
| 341 | 341 | <section id="fast-facts"> |
| 342 | 342 | <div class="lsx-to-section-inner"> |
| 343 | - <h3 class="lsx-to-section-title"><?php esc_html_e( 'Special Summary', 'to-specials' ); ?></h3> |
|
| 343 | + <h3 class="lsx-to-section-title"><?php esc_html_e('Special Summary', 'to-specials'); ?></h3> |
|
| 344 | 344 | |
| 345 | 345 | <div class="lsx-to-single-meta-data"> |
| 346 | 346 | <?php |
| 347 | 347 | $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
| 348 | 348 | |
| 349 | 349 | // lsx_to_price( '<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__( 'From price', 'to-specials' ) . ':</span> ', '</span>' ); |
| 350 | - lsx_to_specials_validity( '<span class="' . $meta_class . 'valid-from"><span class="lsx-to-meta-data-key">' . esc_html__( 'Booking Validity', 'to-specials' ) . ':</span> ', '</span>' ); |
|
| 351 | - lsx_to_travel_dates( '<span class="' . $meta_class . 'travel-dates"><span class="lsx-to-meta-data-key">' . esc_html__( 'Travel Dates', 'to-specials' ) . ':</span> ', '</span>' ); |
|
| 352 | - the_terms( get_the_ID(), 'travel-style', '<span class="' . $meta_class . 'style"><span class="lsx-to-meta-data-key">' . esc_html__( 'Travel Style', 'to-specials' ) . ':</span> ', ', ', '</span>' ); |
|
| 353 | - the_terms( get_the_ID(), 'special-type', '<span class="' . $meta_class . 'type"><span class="lsx-to-meta-data-key">' . esc_html__( 'Type', 'to-specials' ) . ':</span> ', ', ', '</span>' ); |
|
| 354 | - lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . esc_html__( 'Tours', 'to-specials' ) . ':</span> ', '</span>' ); |
|
| 355 | - lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . esc_html__( 'Accommodation', 'to-specials' ) . ':</span> ', '</span>' ); |
|
| 356 | - lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . esc_html__( 'Destinations', 'to-specials' ) . ':</span> ', '</span>' ); |
|
| 357 | - |
|
| 358 | - if ( function_exists( 'lsx_to_connected_activities' ) ) { |
|
| 359 | - lsx_to_connected_activities( '<span class="' . $meta_class . 'activities"><span class="lsx-to-meta-data-key">' . esc_html__( 'Activites', 'to-specials' ) . ':</span> ', '</span>' ); |
|
| 350 | + lsx_to_specials_validity('<span class="' . $meta_class . 'valid-from"><span class="lsx-to-meta-data-key">' . esc_html__('Booking Validity', 'to-specials') . ':</span> ', '</span>'); |
|
| 351 | + lsx_to_travel_dates('<span class="' . $meta_class . 'travel-dates"><span class="lsx-to-meta-data-key">' . esc_html__('Travel Dates', 'to-specials') . ':</span> ', '</span>'); |
|
| 352 | + the_terms(get_the_ID(), 'travel-style', '<span class="' . $meta_class . 'style"><span class="lsx-to-meta-data-key">' . esc_html__('Travel Style', 'to-specials') . ':</span> ', ', ', '</span>'); |
|
| 353 | + the_terms(get_the_ID(), 'special-type', '<span class="' . $meta_class . 'type"><span class="lsx-to-meta-data-key">' . esc_html__('Type', 'to-specials') . ':</span> ', ', ', '</span>'); |
|
| 354 | + lsx_to_connected_tours('<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . esc_html__('Tours', 'to-specials') . ':</span> ', '</span>'); |
|
| 355 | + lsx_to_connected_accommodation('<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . esc_html__('Accommodation', 'to-specials') . ':</span> ', '</span>'); |
|
| 356 | + lsx_to_connected_destinations('<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . esc_html__('Destinations', 'to-specials') . ':</span> ', '</span>'); |
|
| 357 | + |
|
| 358 | + if (function_exists('lsx_to_connected_activities')) { |
|
| 359 | + lsx_to_connected_activities('<span class="' . $meta_class . 'activities"><span class="lsx-to-meta-data-key">' . esc_html__('Activites', 'to-specials') . ':</span> ', '</span>'); |
|
| 360 | 360 | } |
| 361 | 361 | ?> |
| 362 | 362 | </div> |
@@ -369,10 +369,10 @@ discard block |
||
| 369 | 369 | * Adds the template tags to the bottom of the single special |
| 370 | 370 | */ |
| 371 | 371 | public function single_content_bottom() { |
| 372 | - if ( is_singular( 'special' ) ) { |
|
| 373 | - if ( function_exists( 'lsx_to_has_map' ) && lsx_to_has_map() ) : ?> |
|
| 372 | + if (is_singular('special')) { |
|
| 373 | + if (function_exists('lsx_to_has_map') && lsx_to_has_map()) : ?> |
|
| 374 | 374 | <section id="special-map" class="lsx-to-section lsx-to-collapse-section"> |
| 375 | - <h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title hidden-lg" data-toggle="collapse" data-target="#collapse-special-map"><?php esc_html_e( 'Map', 'to-specials' ); ?></h2> |
|
| 375 | + <h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title hidden-lg" data-toggle="collapse" data-target="#collapse-special-map"><?php esc_html_e('Map', 'to-specials'); ?></h2> |
|
| 376 | 376 | |
| 377 | 377 | <div id="collapse-special-map" class="collapse in"> |
| 378 | 378 | <div class="collapse-inner"> |
@@ -383,19 +383,19 @@ discard block |
||
| 383 | 383 | <?php |
| 384 | 384 | endif; |
| 385 | 385 | |
| 386 | - 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-specials' ) . '</h2><div id="collapse-gallery" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
|
| 386 | + 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-specials') . '</h2><div id="collapse-gallery" class="collapse in"><div class="collapse-inner">', '</div></div></section>'); |
|
| 387 | 387 | |
| 388 | - if ( function_exists( 'lsx_to_videos' ) ) { |
|
| 389 | - 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-specials' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
|
| 390 | - } elseif ( class_exists( 'Envira_Videos' ) ) { |
|
| 391 | - 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-specials' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
|
| 388 | + if (function_exists('lsx_to_videos')) { |
|
| 389 | + 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-specials') . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>'); |
|
| 390 | + } elseif (class_exists('Envira_Videos')) { |
|
| 391 | + 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-specials') . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>'); |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | - $terms_conditions = get_post_meta( get_the_ID(), 'terms_conditions', true ); |
|
| 394 | + $terms_conditions = get_post_meta(get_the_ID(), 'terms_conditions', true); |
|
| 395 | 395 | |
| 396 | - if ( false !== $terms_conditions && '' !== $terms_conditions ) { ?> |
|
| 396 | + if (false !== $terms_conditions && '' !== $terms_conditions) { ?> |
|
| 397 | 397 | <section id="terms-and-conditions" class="lsx-to-section lsx-to-collapse-section"> |
| 398 | - <h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-terms-and-conditions"><?php esc_html_e( 'Terms and Conditions', 'to-specials' ); ?></h2> |
|
| 398 | + <h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-terms-and-conditions"><?php esc_html_e('Terms and Conditions', 'to-specials'); ?></h2> |
|
| 399 | 399 | |
| 400 | 400 | <div id="collapse-terms-and-conditions" class="collapse in"> |
| 401 | 401 | <div class="collapse-inner"> |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function __construct() { |
| 25 | 25 | $this->set_vars(); |
| 26 | - add_action( 'wp_head', array( $this, 'specials_single_schema' ), 1499 ); |
|
| 26 | + add_action('wp_head', array($this, 'specials_single_schema'), 1499); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -33,23 +33,23 @@ discard block |
||
| 33 | 33 | * @return object A single instance of this class. |
| 34 | 34 | */ |
| 35 | 35 | public function specials_single_schema() { |
| 36 | - if ( is_singular( 'special' ) ) { |
|
| 36 | + if (is_singular('special')) { |
|
| 37 | 37 | |
| 38 | - $destination_list_special = get_post_meta( get_the_ID(), 'destination_to_special', false ); |
|
| 38 | + $destination_list_special = get_post_meta(get_the_ID(), 'destination_to_special', false); |
|
| 39 | 39 | $destination_list_schema = array(); |
| 40 | 40 | $url_option = get_the_permalink(); |
| 41 | 41 | $special_title = get_the_title(); |
| 42 | 42 | $primary_url = get_the_permalink(); |
| 43 | - $special_content = wp_strip_all_tags( get_the_content() ); |
|
| 44 | - $thumb_url = get_the_post_thumbnail_url( get_the_ID(), 'full' ); |
|
| 45 | - $price = get_post_meta( get_the_ID(), 'price', false ); |
|
| 46 | - $start_validity = get_post_meta( get_the_ID(), 'booking_validity_start', false ); |
|
| 47 | - $end_validity = get_post_meta( get_the_ID(), 'booking_validity_end', false ); |
|
| 43 | + $special_content = wp_strip_all_tags(get_the_content()); |
|
| 44 | + $thumb_url = get_the_post_thumbnail_url(get_the_ID(), 'full'); |
|
| 45 | + $price = get_post_meta(get_the_ID(), 'price', false); |
|
| 46 | + $start_validity = get_post_meta(get_the_ID(), 'booking_validity_start', false); |
|
| 47 | + $end_validity = get_post_meta(get_the_ID(), 'booking_validity_end', false); |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | - if ( ! empty( $destination_list_special ) ) { |
|
| 51 | - foreach( $destination_list_special as $single_destination ) { |
|
| 52 | - $url_option = get_the_permalink() . '#destination-' . $i; |
|
| 50 | + if ( ! empty($destination_list_special)) { |
|
| 51 | + foreach ($destination_list_special as $single_destination) { |
|
| 52 | + $url_option = get_the_permalink() . '#destination-' . $i; |
|
| 53 | 53 | $destination_name = get_the_title($single_destination); |
| 54 | 54 | $schema_day = array( |
| 55 | 55 | "@type" => "PostalAddress", |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | "url" => $primary_url, |
| 79 | 79 | ), |
| 80 | 80 | ); |
| 81 | - $output = wp_json_encode( $meta, JSON_UNESCAPED_SLASHES ); |
|
| 81 | + $output = wp_json_encode($meta, JSON_UNESCAPED_SLASHES); |
|
| 82 | 82 | ?> |
| 83 | 83 | <script type="application/ld+json"> |
| 84 | - <?php echo wp_kses_post( $output ); ?> |
|
| 84 | + <?php echo wp_kses_post($output); ?> |
|
| 85 | 85 | </script> |
| 86 | 86 | <?php |
| 87 | 87 | } |
@@ -24,19 +24,19 @@ discard block |
||
| 24 | 24 | public function __construct() { |
| 25 | 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 ); |
|
| 29 | - add_filter( 'lsx_get_taxonomies_configs', array( $this, 'taxonomy_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 | + add_filter('lsx_get_taxonomies_configs', array($this, 'taxonomy_config'), 10, 1); |
|
| 30 | 30 | |
| 31 | - add_filter( 'lsx_to_destination_custom_fields', array( $this, 'custom_fields' ) ); |
|
| 32 | - add_filter( 'lsx_to_tour_custom_fields', array( $this, 'custom_fields' ) ); |
|
| 33 | - add_filter( 'lsx_to_accommodation_custom_fields', array( $this, 'custom_fields' ) ); |
|
| 31 | + add_filter('lsx_to_destination_custom_fields', array($this, 'custom_fields')); |
|
| 32 | + add_filter('lsx_to_tour_custom_fields', array($this, 'custom_fields')); |
|
| 33 | + add_filter('lsx_to_accommodation_custom_fields', array($this, 'custom_fields')); |
|
| 34 | 34 | |
| 35 | - add_filter( 'lsx_to_team_custom_fields', array( $this, 'custom_fields' ) ); |
|
| 36 | - add_filter( 'lsx_to_review_custom_fields', array( $this, 'custom_fields' ) ); |
|
| 37 | - add_filter( 'lsx_to_activity_custom_fields', array( $this, 'custom_fields' ) ); |
|
| 35 | + add_filter('lsx_to_team_custom_fields', array($this, 'custom_fields')); |
|
| 36 | + add_filter('lsx_to_review_custom_fields', array($this, 'custom_fields')); |
|
| 37 | + add_filter('lsx_to_activity_custom_fields', array($this, 'custom_fields')); |
|
| 38 | 38 | |
| 39 | - add_action( 'lsx_to_framework_special_tab_general_settings_bottom', array( $this, 'general_settings' ), 10, 1 ); |
|
| 39 | + add_action('lsx_to_framework_special_tab_general_settings_bottom', array($this, 'general_settings'), 10, 1); |
|
| 40 | 40 | } |
| 41 | 41 | /** |
| 42 | 42 | * Register the specials post type config |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | * @param $objects |
| 45 | 45 | * @return array |
| 46 | 46 | */ |
| 47 | - public function post_type_config( $objects ) { |
|
| 47 | + public function post_type_config($objects) { |
|
| 48 | 48 | |
| 49 | - foreach ( $this->post_types as $key => $label ) { |
|
| 50 | - if ( file_exists( LSX_TO_SPECIALS_PATH . 'includes/post-types/config-' . $key . '.php' ) ) { |
|
| 51 | - $objects[ $key ] = include LSX_TO_SPECIALS_PATH . 'includes/post-types/config-' . $key . '.php'; |
|
| 49 | + foreach ($this->post_types as $key => $label) { |
|
| 50 | + if (file_exists(LSX_TO_SPECIALS_PATH . 'includes/post-types/config-' . $key . '.php')) { |
|
| 51 | + $objects[$key] = include LSX_TO_SPECIALS_PATH . 'includes/post-types/config-' . $key . '.php'; |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
@@ -61,10 +61,10 @@ discard block |
||
| 61 | 61 | * @param $meta_boxes |
| 62 | 62 | * @return array |
| 63 | 63 | */ |
| 64 | - public function meta_box_config( $meta_boxes ) { |
|
| 65 | - foreach ( $this->post_types as $key => $label ) { |
|
| 66 | - if ( file_exists( LSX_TO_SPECIALS_PATH . 'includes/metaboxes/config-' . $key . '.php' ) ) { |
|
| 67 | - $meta_boxes[ $key ] = include LSX_TO_SPECIALS_PATH . 'includes/metaboxes/config-' . $key . '.php'; |
|
| 64 | + public function meta_box_config($meta_boxes) { |
|
| 65 | + foreach ($this->post_types as $key => $label) { |
|
| 66 | + if (file_exists(LSX_TO_SPECIALS_PATH . 'includes/metaboxes/config-' . $key . '.php')) { |
|
| 67 | + $meta_boxes[$key] = include LSX_TO_SPECIALS_PATH . 'includes/metaboxes/config-' . $key . '.php'; |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | return $meta_boxes; |
@@ -76,9 +76,9 @@ discard block |
||
| 76 | 76 | * |
| 77 | 77 | * @return null |
| 78 | 78 | */ |
| 79 | - public function taxonomy_config( $taxonomies ) { |
|
| 79 | + public function taxonomy_config($taxonomies) { |
|
| 80 | 80 | |
| 81 | - if ( file_exists( LSX_TO_SPECIALS_PATH . 'includes/taxonomies/config-special-type.php' ) ) { |
|
| 81 | + if (file_exists(LSX_TO_SPECIALS_PATH . 'includes/taxonomies/config-special-type.php')) { |
|
| 82 | 82 | $taxonomies['special-type'] = include LSX_TO_SPECIALS_PATH . 'includes/taxonomies/config-special-type.php'; |
| 83 | 83 | } |
| 84 | 84 | return $taxonomies; |
@@ -93,21 +93,21 @@ discard block |
||
| 93 | 93 | public function register_taxonomies() { |
| 94 | 94 | |
| 95 | 95 | $labels = array( |
| 96 | - 'name' => _x( 'Special Type', 'to-specials' ), |
|
| 97 | - 'singular_name' => _x( 'Special Type', 'to-specials' ), |
|
| 98 | - 'search_items' => __( 'Search Special Types' , 'to-specials' ), |
|
| 99 | - 'all_items' => __( 'Special Types' , 'to-specials' ), |
|
| 100 | - 'parent_item' => __( 'Parent Special Type' , 'to-specials' ), |
|
| 101 | - 'parent_item_colon' => __( 'Parent Special Type:' , 'to-specials' ), |
|
| 102 | - 'edit_item' => __( 'Edit Special Type' , 'to-specials' ), |
|
| 103 | - 'update_item' => __( 'Update Special Type' , 'to-specials' ), |
|
| 104 | - 'add_new_item' => __( 'Add New Special Type' , 'to-specials' ), |
|
| 105 | - 'new_item_name' => __( 'New Special Type' , 'to-specials' ), |
|
| 106 | - 'menu_name' => __( 'Special Types' , 'to-specials' ), |
|
| 96 | + 'name' => _x('Special Type', 'to-specials'), |
|
| 97 | + 'singular_name' => _x('Special Type', 'to-specials'), |
|
| 98 | + 'search_items' => __('Search Special Types', 'to-specials'), |
|
| 99 | + 'all_items' => __('Special Types', 'to-specials'), |
|
| 100 | + 'parent_item' => __('Parent Special Type', 'to-specials'), |
|
| 101 | + 'parent_item_colon' => __('Parent Special Type:', 'to-specials'), |
|
| 102 | + 'edit_item' => __('Edit Special Type', 'to-specials'), |
|
| 103 | + 'update_item' => __('Update Special Type', 'to-specials'), |
|
| 104 | + 'add_new_item' => __('Add New Special Type', 'to-specials'), |
|
| 105 | + 'new_item_name' => __('New Special Type', 'to-specials'), |
|
| 106 | + 'menu_name' => __('Special Types', 'to-specials'), |
|
| 107 | 107 | ); |
| 108 | 108 | |
| 109 | 109 | // Now register the taxonomy |
| 110 | - register_taxonomy('special-type',$this->plugin_slug, array( |
|
| 110 | + register_taxonomy('special-type', $this->plugin_slug, array( |
|
| 111 | 111 | 'hierarchical' => true, |
| 112 | 112 | 'labels' => $labels, |
| 113 | 113 | 'show_ui' => true, |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | 'exclude_from_search' => true, |
| 117 | 117 | 'show_admin_column' => true, |
| 118 | 118 | 'query_var' => true, |
| 119 | - 'rewrite' => array( 'special-type' ), |
|
| 119 | + 'rewrite' => array('special-type'), |
|
| 120 | 120 | )); |
| 121 | 121 | |
| 122 | 122 | } |
@@ -124,23 +124,23 @@ discard block |
||
| 124 | 124 | /** |
| 125 | 125 | * Adds in the fields to the Tour Operators Post Types. |
| 126 | 126 | */ |
| 127 | - public function custom_fields( $fields ) { |
|
| 127 | + public function custom_fields($fields) { |
|
| 128 | 128 | global $post, $typenow, $current_screen; |
| 129 | 129 | |
| 130 | 130 | $post_type = false; |
| 131 | - if ( $post && $post->post_type ) { |
|
| 131 | + if ($post && $post->post_type) { |
|
| 132 | 132 | $post_type = $post->post_type; |
| 133 | - } elseif ( $typenow ) { |
|
| 133 | + } elseif ($typenow) { |
|
| 134 | 134 | $post_type = $typenow; |
| 135 | - } elseif ( $current_screen && $current_screen->post_type ) { |
|
| 135 | + } elseif ($current_screen && $current_screen->post_type) { |
|
| 136 | 136 | $post_type = $current_screen->post_type; |
| 137 | - } elseif ( isset( $_REQUEST['post_type'] ) ) { |
|
| 138 | - $post_type = sanitize_key( $_REQUEST['post_type'] ); |
|
| 139 | - } elseif ( isset( $_REQUEST['post'] ) ) { |
|
| 140 | - $post_type = get_post_type( sanitize_key( $_REQUEST['post'] ) ); |
|
| 137 | + } elseif (isset($_REQUEST['post_type'])) { |
|
| 138 | + $post_type = sanitize_key($_REQUEST['post_type']); |
|
| 139 | + } elseif (isset($_REQUEST['post'])) { |
|
| 140 | + $post_type = get_post_type(sanitize_key($_REQUEST['post'])); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - if ( false !== $post_type ) { |
|
| 143 | + if (false !== $post_type) { |
|
| 144 | 144 | $fields[] = array( |
| 145 | 145 | 'id' => 'specials_title', |
| 146 | 146 | 'name' => 'Specials', |
@@ -174,22 +174,22 @@ discard block |
||
| 174 | 174 | ?> |
| 175 | 175 | <tr class="form-field-wrap"> |
| 176 | 176 | <th scope="row"> |
| 177 | - <label for="enable_widget_excerpt"> <?php esc_html_e( 'Disable Widget Excerpt', 'tour-operator' ); ?></label> |
|
| 177 | + <label for="enable_widget_excerpt"> <?php esc_html_e('Disable Widget Excerpt', 'tour-operator'); ?></label> |
|
| 178 | 178 | </th> |
| 179 | 179 | <td> |
| 180 | 180 | <input type="checkbox" {{#if enable_widget_excerpt}} checked="checked" {{/if}} name="enable_widget_excerpt" /> |
| 181 | - <small><?php esc_html_e( 'This enables the excerpt text on the widget.', 'tour-operator' ); ?></small> |
|
| 181 | + <small><?php esc_html_e('This enables the excerpt text on the widget.', 'tour-operator'); ?></small> |
|
| 182 | 182 | </td> |
| 183 | 183 | </tr> |
| 184 | 184 | <tr class="form-field-wrap"> |
| 185 | 185 | <th scope="row"> |
| 186 | - <label for="expiration_status"> <?php esc_html_e( 'Expiration Status', 'tour-operator' ); ?></label> |
|
| 186 | + <label for="expiration_status"> <?php esc_html_e('Expiration Status', 'tour-operator'); ?></label> |
|
| 187 | 187 | </th> |
| 188 | 188 | <td> |
| 189 | 189 | <select value="{{expiration_status}}" name="expiration_status"> |
| 190 | - <option value="draft" {{#is expiration_status value=""}}selected="selected"{{/is}} {{#is expiration_status value="draft"}} selected="selected"{{/is}}><?php esc_html_e( 'Draft', 'tour-operator' ); ?></option> |
|
| 191 | - <option value="delete" {{#is expiration_status value="delete"}} selected="selected"{{/is}}><?php esc_html_e( 'Delete', 'tour-operator' ); ?></option> |
|
| 192 | - <option value="private" {{#is expiration_status value="private"}} selected="selected"{{/is}}><?php esc_html_e( 'Private', 'tour-operator' ); ?></option> |
|
| 190 | + <option value="draft" {{#is expiration_status value=""}}selected="selected"{{/is}} {{#is expiration_status value="draft"}} selected="selected"{{/is}}><?php esc_html_e('Draft', 'tour-operator'); ?></option> |
|
| 191 | + <option value="delete" {{#is expiration_status value="delete"}} selected="selected"{{/is}}><?php esc_html_e('Delete', 'tour-operator'); ?></option> |
|
| 192 | + <option value="private" {{#is expiration_status value="private"}} selected="selected"{{/is}}><?php esc_html_e('Private', 'tour-operator'); ?></option> |
|
| 193 | 193 | </select> |
| 194 | 194 | </td> |
| 195 | 195 | </tr> |
@@ -17,9 +17,9 @@ discard block |
||
| 17 | 17 | * |
| 18 | 18 | * @param \WPSEO_Schema_Context $context A value object with context variables. |
| 19 | 19 | */ |
| 20 | - public function __construct( WPSEO_Schema_Context $context ) { |
|
| 20 | + public function __construct(WPSEO_Schema_Context $context) { |
|
| 21 | 21 | $this->post_type = 'special'; |
| 22 | - parent::__construct( $context ); |
|
| 22 | + parent::__construct($context); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -28,36 +28,36 @@ discard block |
||
| 28 | 28 | * @return array $data Review data. |
| 29 | 29 | */ |
| 30 | 30 | public function generate() { |
| 31 | - $tour_list = get_post_meta( get_the_ID(), 'tour_to_special', false ); |
|
| 32 | - $accom_list = get_post_meta( get_the_ID(), 'accommodation_to_special', false ); |
|
| 31 | + $tour_list = get_post_meta(get_the_ID(), 'tour_to_special', false); |
|
| 32 | + $accom_list = get_post_meta(get_the_ID(), 'accommodation_to_special', false); |
|
| 33 | 33 | $data = array( |
| 34 | 34 | '@type' => array( |
| 35 | 35 | 'Offer', |
| 36 | 36 | ), |
| 37 | 37 | '@id' => $this->context->canonical . '#special', |
| 38 | 38 | 'name' => $this->post->post_title, |
| 39 | - 'description' => wp_strip_all_tags( $this->post->post_content ), |
|
| 39 | + 'description' => wp_strip_all_tags($this->post->post_content), |
|
| 40 | 40 | 'url' => $this->post_url, |
| 41 | 41 | 'mainEntityOfPage' => array( |
| 42 | 42 | '@id' => $this->context->canonical . WPSEO_Schema_IDs::WEBPAGE_HASH, |
| 43 | 43 | ), |
| 44 | 44 | ); |
| 45 | 45 | |
| 46 | - if ( $this->context->site_represents_reference ) { |
|
| 46 | + if ($this->context->site_represents_reference) { |
|
| 47 | 47 | $data['offeredBy'] = $this->context->site_represents_reference; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - $data = $this->add_custom_field( $data, 'availabilityStarts', 'booking_validity_start' ); |
|
| 51 | - $data = $this->add_custom_field( $data, 'availabilityEnds', 'booking_validity_end' ); |
|
| 52 | - $data = $this->add_custom_field( $data, 'priceValidUntil', 'booking_validity_end' ); |
|
| 53 | - $data = $this->add_custom_field( $data, 'priceValidUntil', 'booking_validity_end' ); |
|
| 54 | - $data = $this->get_price( $data ); |
|
| 50 | + $data = $this->add_custom_field($data, 'availabilityStarts', 'booking_validity_start'); |
|
| 51 | + $data = $this->add_custom_field($data, 'availabilityEnds', 'booking_validity_end'); |
|
| 52 | + $data = $this->add_custom_field($data, 'priceValidUntil', 'booking_validity_end'); |
|
| 53 | + $data = $this->add_custom_field($data, 'priceValidUntil', 'booking_validity_end'); |
|
| 54 | + $data = $this->get_price($data); |
|
| 55 | 55 | |
| 56 | - $data['itemOffered'] = \lsx\legacy\Schema_Utils::get_item_reviewed( $tour_list, 'Product' ); |
|
| 57 | - $data['itemOffered'] = \lsx\legacy\Schema_Utils::get_item_reviewed( $accom_list, 'Product' ); |
|
| 56 | + $data['itemOffered'] = \lsx\legacy\Schema_Utils::get_item_reviewed($tour_list, 'Product'); |
|
| 57 | + $data['itemOffered'] = \lsx\legacy\Schema_Utils::get_item_reviewed($accom_list, 'Product'); |
|
| 58 | 58 | |
| 59 | - $data = $this->add_articles( $data ); |
|
| 60 | - $data = \lsx\legacy\Schema_Utils::add_image( $data, $this->context ); |
|
| 59 | + $data = $this->add_articles($data); |
|
| 60 | + $data = \lsx\legacy\Schema_Utils::add_image($data, $this->context); |
|
| 61 | 61 | |
| 62 | 62 | return $data; |
| 63 | 63 | } |
@@ -68,24 +68,24 @@ discard block |
||
| 68 | 68 | * @param array $data An array of offers already added. |
| 69 | 69 | * @return array $data |
| 70 | 70 | */ |
| 71 | - public function get_price( $data ) { |
|
| 72 | - $price = get_post_meta( $this->context->id, 'price', true ); |
|
| 71 | + public function get_price($data) { |
|
| 72 | + $price = get_post_meta($this->context->id, 'price', true); |
|
| 73 | 73 | $currency = 'USD'; |
| 74 | 74 | $tour_operator = tour_operator(); |
| 75 | - if ( is_object( $tour_operator ) && isset( $tour_operator->options['general'] ) && is_array( $tour_operator->options['general'] ) ) { |
|
| 76 | - if ( isset( $tour_operator->options['general']['currency'] ) && ! empty( $tour_operator->options['general']['currency'] ) ) { |
|
| 75 | + if (is_object($tour_operator) && isset($tour_operator->options['general']) && is_array($tour_operator->options['general'])) { |
|
| 76 | + if (isset($tour_operator->options['general']['currency']) && ! empty($tour_operator->options['general']['currency'])) { |
|
| 77 | 77 | $currency = $tour_operator->options['general']['currency']; |
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | - if ( false !== $price && '' !== $price ) { |
|
| 80 | + if (false !== $price && '' !== $price) { |
|
| 81 | 81 | $data['price'] = $price; |
| 82 | 82 | $data['priceCurrency'] = $currency; |
| 83 | - $data['category'] = __( 'Special', 'tour-operator-specials' ); |
|
| 83 | + $data['category'] = __('Special', 'tour-operator-specials'); |
|
| 84 | 84 | $data['availability'] = 'https://schema.org/LimitedAvailability'; |
| 85 | 85 | |
| 86 | - $price_type = get_post_meta( $this->context->id, 'price_type', true ); |
|
| 87 | - if ( false !== $price_type && '' !== $price_type && 'none' !== $price_type ) { |
|
| 88 | - $data['PriceSpecification'] = lsx_to_get_price_type_label( $price_type ); |
|
| 86 | + $price_type = get_post_meta($this->context->id, 'price_type', true); |
|
| 87 | + if (false !== $price_type && '' !== $price_type && 'none' !== $price_type) { |
|
| 88 | + $data['PriceSpecification'] = lsx_to_get_price_type_label($price_type); |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | return $data; |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * @link |
| 9 | 9 | * @copyright 2018 LightSpeedDevelopment |
| 10 | 10 | */ |
| 11 | -if (!class_exists( 'LSX_TO_Specials' ) ) { |
|
| 11 | +if ( ! class_exists('LSX_TO_Specials')) { |
|
| 12 | 12 | /** |
| 13 | 13 | * Main plugin class. |
| 14 | 14 | * |
@@ -56,19 +56,19 @@ discard block |
||
| 56 | 56 | $this->lsx_to_search_integration(); |
| 57 | 57 | |
| 58 | 58 | // Make TO last plugin to load |
| 59 | - add_action( 'activated_plugin', array( $this, 'activated_plugin' ) ); |
|
| 59 | + add_action('activated_plugin', array($this, 'activated_plugin')); |
|
| 60 | 60 | |
| 61 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
|
| 61 | + add_action('init', array($this, 'load_plugin_textdomain')); |
|
| 62 | 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 ); |
|
| 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 | 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' ) ); |
|
| 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 | 72 | } |
| 73 | 73 | |
| 74 | 74 | require_once LSX_TO_SPECIALS_PATH . '/classes/class-to-specials-admin.php'; |
@@ -76,24 +76,24 @@ discard block |
||
| 76 | 76 | require_once LSX_TO_SPECIALS_PATH . '/includes/template-tags.php'; |
| 77 | 77 | |
| 78 | 78 | // flush_rewrite_rules. |
| 79 | - register_activation_hook( LSX_TO_SPECIALS_CORE, array( $this, 'register_activation_hook' ) ); |
|
| 80 | - add_action( 'admin_init', array( $this, 'register_activation_hook_check' ) ); |
|
| 81 | - add_filter( 'wpseo_schema_graph_pieces', array( $this, 'add_graph_pieces' ), 11, 2 ); |
|
| 79 | + register_activation_hook(LSX_TO_SPECIALS_CORE, array($this, 'register_activation_hook')); |
|
| 80 | + add_action('admin_init', array($this, 'register_activation_hook_check')); |
|
| 81 | + add_filter('wpseo_schema_graph_pieces', array($this, 'add_graph_pieces'), 11, 2); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * Include the post type for the search integration |
| 86 | 86 | */ |
| 87 | 87 | public function lsx_to_search_integration() { |
| 88 | - add_filter( 'lsx_to_search_post_types', array( $this, 'post_types_filter' ) ); |
|
| 89 | - add_filter( 'lsx_to_search_taxonomies', array( $this, 'taxonomies_filter' ) ); |
|
| 88 | + add_filter('lsx_to_search_post_types', array($this, 'post_types_filter')); |
|
| 89 | + add_filter('lsx_to_search_taxonomies', array($this, 'taxonomies_filter')); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | 93 | * Load the plugin text domain for translation. |
| 94 | 94 | */ |
| 95 | 95 | public function load_plugin_textdomain() { |
| 96 | - load_plugin_textdomain( 'to-specials', FALSE, basename( LSX_TO_SPECIALS_PATH ) . '/languages'); |
|
| 96 | + load_plugin_textdomain('to-specials', FALSE, basename(LSX_TO_SPECIALS_PATH) . '/languages'); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -101,25 +101,25 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public function set_vars() { |
| 103 | 103 | $this->post_types = array( |
| 104 | - 'special' => __( 'Specials', 'to-specials' ), |
|
| 104 | + 'special' => __('Specials', 'to-specials'), |
|
| 105 | 105 | ); |
| 106 | 106 | $this->post_types_singular = array( |
| 107 | - 'special' => __( 'Special', 'to-specials' ), |
|
| 107 | + 'special' => __('Special', 'to-specials'), |
|
| 108 | 108 | ); |
| 109 | - $this->post_type_slugs = array_keys( $this->post_types ); |
|
| 109 | + $this->post_type_slugs = array_keys($this->post_types); |
|
| 110 | 110 | $this->taxonomies = array( |
| 111 | - 'special-type' => __( 'Special Type', 'to-specials' ), |
|
| 111 | + 'special-type' => __('Special Type', 'to-specials'), |
|
| 112 | 112 | ); |
| 113 | 113 | $this->taxonomies_plural = array( |
| 114 | - 'special-type' => __( 'Special Types', 'to-specials' ), |
|
| 114 | + 'special-type' => __('Special Types', 'to-specials'), |
|
| 115 | 115 | ); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
| 119 | 119 | * Adds our post types to an array via a filter |
| 120 | 120 | */ |
| 121 | - public function plugin_path( $path, $post_type ) { |
|
| 122 | - if ( false !== $this->post_types && array_key_exists( $post_type, $this->post_types ) ) { |
|
| 121 | + public function plugin_path($path, $post_type) { |
|
| 122 | + if (false !== $this->post_types && array_key_exists($post_type, $this->post_types)) { |
|
| 123 | 123 | $path = LSX_TO_SPECIALS_PATH; |
| 124 | 124 | } |
| 125 | 125 | return $path; |
@@ -128,9 +128,9 @@ discard block |
||
| 128 | 128 | /** |
| 129 | 129 | * Adds our post types to an array via a filter |
| 130 | 130 | */ |
| 131 | - public function post_types_slugs_filter( $post_types ) { |
|
| 132 | - if ( is_array( $post_types ) ) { |
|
| 133 | - $post_types = array_merge( $post_types, $this->post_type_slugs ); |
|
| 131 | + public function post_types_slugs_filter($post_types) { |
|
| 132 | + if (is_array($post_types)) { |
|
| 133 | + $post_types = array_merge($post_types, $this->post_type_slugs); |
|
| 134 | 134 | } else { |
| 135 | 135 | $post_types = $this->post_type_slugs; |
| 136 | 136 | } |
@@ -140,10 +140,10 @@ discard block |
||
| 140 | 140 | /** |
| 141 | 141 | * Adds our post types to an array via a filter |
| 142 | 142 | */ |
| 143 | - public function post_types_filter( $post_types ) { |
|
| 144 | - if ( is_array( $post_types ) && is_array( $this->post_types ) ) { |
|
| 145 | - $post_types = array_merge( $post_types, $this->post_types ); |
|
| 146 | - } elseif ( is_array( $this->post_types ) ) { |
|
| 143 | + public function post_types_filter($post_types) { |
|
| 144 | + if (is_array($post_types) && is_array($this->post_types)) { |
|
| 145 | + $post_types = array_merge($post_types, $this->post_types); |
|
| 146 | + } elseif (is_array($this->post_types)) { |
|
| 147 | 147 | $post_types = $this->post_types; |
| 148 | 148 | } |
| 149 | 149 | return $post_types; |
@@ -152,10 +152,10 @@ discard block |
||
| 152 | 152 | /** |
| 153 | 153 | * Adds our post types to an array via a filter |
| 154 | 154 | */ |
| 155 | - public function post_types_singular_filter( $post_types_singular ){ |
|
| 156 | - if ( is_array( $post_types_singular ) && is_array( $this->post_types_singular ) ) { |
|
| 157 | - $post_types_singular = array_merge( $post_types_singular, $this->post_types_singular ); |
|
| 158 | - } elseif ( is_array( $this->post_types_singular ) ) { |
|
| 155 | + public function post_types_singular_filter($post_types_singular) { |
|
| 156 | + if (is_array($post_types_singular) && is_array($this->post_types_singular)) { |
|
| 157 | + $post_types_singular = array_merge($post_types_singular, $this->post_types_singular); |
|
| 158 | + } elseif (is_array($this->post_types_singular)) { |
|
| 159 | 159 | $post_types_singular = $this->post_types_singular; |
| 160 | 160 | } |
| 161 | 161 | return $post_types_singular; |
@@ -164,10 +164,10 @@ discard block |
||
| 164 | 164 | /** |
| 165 | 165 | * Adds our taxonomies to an array via a filter |
| 166 | 166 | */ |
| 167 | - public function taxonomies_filter( $taxonomies ) { |
|
| 168 | - if ( is_array( $taxonomies ) && is_array( $this->taxonomies ) ) { |
|
| 169 | - $taxonomies = array_merge( $taxonomies, $this->taxonomies ); |
|
| 170 | - } elseif ( is_array( $this->taxonomies ) ) { |
|
| 167 | + public function taxonomies_filter($taxonomies) { |
|
| 168 | + if (is_array($taxonomies) && is_array($this->taxonomies)) { |
|
| 169 | + $taxonomies = array_merge($taxonomies, $this->taxonomies); |
|
| 170 | + } elseif (is_array($this->taxonomies)) { |
|
| 171 | 171 | $taxonomies = $this->taxonomies; |
| 172 | 172 | } |
| 173 | 173 | return $taxonomies; |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | /** |
| 177 | 177 | * Adds our taxonomies_plural to an array via a filter |
| 178 | 178 | */ |
| 179 | - public function taxonomies_plural_filter( $taxonomies_plural ) { |
|
| 180 | - if ( is_array( $taxonomies_plural ) && is_array( $this->taxonomies_plural ) ) { |
|
| 181 | - $taxonomies_plural = array_merge( $taxonomies_plural, $this->taxonomies_plural ); |
|
| 182 | - } elseif ( is_array( $this->taxonomies_plural ) ) { |
|
| 179 | + public function taxonomies_plural_filter($taxonomies_plural) { |
|
| 180 | + if (is_array($taxonomies_plural) && is_array($this->taxonomies_plural)) { |
|
| 181 | + $taxonomies_plural = array_merge($taxonomies_plural, $this->taxonomies_plural); |
|
| 182 | + } elseif (is_array($this->taxonomies_plural)) { |
|
| 183 | 183 | $taxonomies_plural = $this->taxonomies_plural; |
| 184 | 184 | } |
| 185 | 185 | return $taxonomies_plural; |
@@ -189,15 +189,15 @@ discard block |
||
| 189 | 189 | * Make TO last plugin to load. |
| 190 | 190 | */ |
| 191 | 191 | public function activated_plugin() { |
| 192 | - if ( $plugins = get_option( 'active_plugins' ) ) { |
|
| 193 | - $search = preg_grep( '/.*\/tour-operator\.php/', $plugins ); |
|
| 194 | - $key = array_search( $search, $plugins ); |
|
| 195 | - |
|
| 196 | - if ( is_array( $search ) && count( $search ) ) { |
|
| 197 | - foreach ( $search as $key => $path ) { |
|
| 198 | - array_splice( $plugins, $key, 1 ); |
|
| 199 | - array_push( $plugins, $path ); |
|
| 200 | - update_option( 'active_plugins', $plugins ); |
|
| 192 | + if ($plugins = get_option('active_plugins')) { |
|
| 193 | + $search = preg_grep('/.*\/tour-operator\.php/', $plugins); |
|
| 194 | + $key = array_search($search, $plugins); |
|
| 195 | + |
|
| 196 | + if (is_array($search) && count($search)) { |
|
| 197 | + foreach ($search as $key => $path) { |
|
| 198 | + array_splice($plugins, $key, 1); |
|
| 199 | + array_push($plugins, $path); |
|
| 200 | + update_option('active_plugins', $plugins); |
|
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | } |
@@ -207,8 +207,8 @@ discard block |
||
| 207 | 207 | * On plugin activation |
| 208 | 208 | */ |
| 209 | 209 | public function register_activation_hook() { |
| 210 | - if ( ! is_network_admin() && ! isset( $_GET['activate-multi'] ) ) { |
|
| 211 | - set_transient( '_tour_operators_specials_flush_rewrite_rules', 1, 30 ); |
|
| 210 | + if ( ! is_network_admin() && ! isset($_GET['activate-multi'])) { |
|
| 211 | + set_transient('_tour_operators_specials_flush_rewrite_rules', 1, 30); |
|
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | 214 | |
@@ -216,10 +216,10 @@ discard block |
||
| 216 | 216 | * On plugin activation (check) |
| 217 | 217 | */ |
| 218 | 218 | public function register_activation_hook_check() { |
| 219 | - if ( ! get_transient( '_tour_operators_specials_flush_rewrite_rules' ) ) { |
|
| 219 | + if ( ! get_transient('_tour_operators_specials_flush_rewrite_rules')) { |
|
| 220 | 220 | return; |
| 221 | 221 | } |
| 222 | - delete_transient( '_tour_operators_specials_flush_rewrite_rules' ); |
|
| 222 | + delete_transient('_tour_operators_specials_flush_rewrite_rules'); |
|
| 223 | 223 | flush_rewrite_rules(); |
| 224 | 224 | } |
| 225 | 225 | /** |
@@ -230,10 +230,10 @@ discard block |
||
| 230 | 230 | * |
| 231 | 231 | * @return array $pieces Graph pieces to output. |
| 232 | 232 | */ |
| 233 | - public function add_graph_pieces( $pieces, $context ) { |
|
| 234 | - if ( class_exists( 'LSX_TO_Schema_Graph_Piece' ) ) { |
|
| 233 | + public function add_graph_pieces($pieces, $context) { |
|
| 234 | + if (class_exists('LSX_TO_Schema_Graph_Piece')) { |
|
| 235 | 235 | require_once LSX_TO_SPECIALS_PATH . 'classes/class-to-specials-schema.php'; |
| 236 | - $pieces[] = new LSX_TO_Specials_Schema( $context ); |
|
| 236 | + $pieces[] = new LSX_TO_Specials_Schema($context); |
|
| 237 | 237 | } |
| 238 | 238 | return $pieces; |
| 239 | 239 | } |