@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | public function post_types_slugs_filter($post_types){ |
| 145 | 145 | if(is_array($post_types)){ |
| 146 | 146 | $post_types = array_merge($post_types,$this->post_type_slugs); |
| 147 | - }else{ |
|
| 147 | + } else{ |
|
| 148 | 148 | $post_types = $this->post_type_slugs; |
| 149 | 149 | } |
| 150 | 150 | return $post_types; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | public function post_types_filter($post_types){ |
| 157 | 157 | if(is_array($post_types) && is_array($this->post_types)){ |
| 158 | 158 | $post_types = array_merge($post_types,$this->post_types); |
| 159 | - }elseif(is_array($this->post_types)){ |
|
| 159 | + } elseif(is_array($this->post_types)){ |
|
| 160 | 160 | $post_types = $this->post_types; |
| 161 | 161 | } |
| 162 | 162 | return $post_types; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | public function post_types_singular_filter($post_types_singular){ |
| 169 | 169 | if(is_array($post_types_singular) && is_array($this->post_types_singular)){ |
| 170 | 170 | $post_types_singular = array_merge($post_types_singular,$this->post_types_singular); |
| 171 | - }elseif(is_array($this->post_types_singular)){ |
|
| 171 | + } elseif(is_array($this->post_types_singular)){ |
|
| 172 | 172 | $post_types_singular = $this->post_types_singular; |
| 173 | 173 | } |
| 174 | 174 | return $post_types_singular; |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | public function taxonomies_filter($taxonomies){ |
| 181 | 181 | if(is_array($taxonomies) && is_array($this->taxonomies)){ |
| 182 | 182 | $taxonomies = array_merge($taxonomies,$this->taxonomies); |
| 183 | - }elseif(is_array($this->taxonomies)){ |
|
| 183 | + } elseif(is_array($this->taxonomies)){ |
|
| 184 | 184 | $taxonomies = $this->taxonomies; |
| 185 | 185 | } |
| 186 | 186 | return $taxonomies; |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | public function taxonomies_plural_filter($taxonomies_plural){ |
| 193 | 193 | if(is_array($taxonomies_plural) && is_array($this->taxonomies_plural)){ |
| 194 | 194 | $taxonomies_plural = array_merge($taxonomies_plural,$this->taxonomies_plural); |
| 195 | - }elseif(is_array($this->taxonomies_plural)){ |
|
| 195 | + } elseif(is_array($this->taxonomies_plural)){ |
|
| 196 | 196 | $taxonomies_plural = $this->taxonomies_plural; |
| 197 | 197 | } |
| 198 | 198 | return $taxonomies_plural; |
@@ -9,234 +9,234 @@ |
||
| 9 | 9 | * @copyright 2018 LightSpeedDevelopment |
| 10 | 10 | */ |
| 11 | 11 | if (!class_exists( 'LSX_Activities' ) ) { |
| 12 | - /** |
|
| 13 | - * Main plugin class. |
|
| 14 | - * |
|
| 15 | - * @package LSX_Activities |
|
| 16 | - * @author LightSpeed |
|
| 17 | - */ |
|
| 18 | - class LSX_Activities { |
|
| 12 | + /** |
|
| 13 | + * Main plugin class. |
|
| 14 | + * |
|
| 15 | + * @package LSX_Activities |
|
| 16 | + * @author LightSpeed |
|
| 17 | + */ |
|
| 18 | + class LSX_Activities { |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * The plugins id |
|
| 22 | - */ |
|
| 23 | - public $plugin_slug = 'lsx-activities'; |
|
| 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 | - * Hold the TO options |
|
| 52 | - */ |
|
| 53 | - public $options = array(); |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * Hold the GoogleMaps API key |
|
| 57 | - */ |
|
| 58 | - public $api_key = false; |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * Constructor |
|
| 62 | - */ |
|
| 63 | - public function __construct() { |
|
| 64 | - //Set the variables |
|
| 65 | - $this->set_vars(); |
|
| 66 | - $this->lsx_to_search_integration(); |
|
| 67 | - |
|
| 68 | - // Make TO last plugin to load |
|
| 69 | - add_action( 'activated_plugin', array( $this, 'activated_plugin' ) ); |
|
| 20 | + /** |
|
| 21 | + * The plugins id |
|
| 22 | + */ |
|
| 23 | + public $plugin_slug = 'lsx-activities'; |
|
| 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 | + * Hold the TO options |
|
| 52 | + */ |
|
| 53 | + public $options = array(); |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * Hold the GoogleMaps API key |
|
| 57 | + */ |
|
| 58 | + public $api_key = false; |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * Constructor |
|
| 62 | + */ |
|
| 63 | + public function __construct() { |
|
| 64 | + //Set the variables |
|
| 65 | + $this->set_vars(); |
|
| 66 | + $this->lsx_to_search_integration(); |
|
| 67 | + |
|
| 68 | + // Make TO last plugin to load |
|
| 69 | + add_action( 'activated_plugin', array( $this, 'activated_plugin' ) ); |
|
| 70 | 70 | |
| 71 | - add_action('init',array($this,'load_plugin_textdomain')); |
|
| 72 | - |
|
| 73 | - if(false !== $this->post_types){ |
|
| 74 | - add_filter( 'lsx_to_framework_post_types', array( $this, 'post_types_filter') ); |
|
| 75 | - add_filter( 'lsx_to_post_types', array( $this, 'post_types_filter') ); |
|
| 76 | - add_filter( 'lsx_to_post_types_singular', array( $this, 'post_types_singular_filter') ); |
|
| 77 | - add_filter('lsx_to_settings_path',array( $this, 'plugin_path'),10,2); |
|
| 78 | - } |
|
| 79 | - if(false !== $this->taxonomies){ |
|
| 80 | - add_filter( 'lsx_to_framework_taxonomies', array( $this, 'taxonomies_filter') ); |
|
| 81 | - add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'taxonomies_plural_filter') ); |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - require_once(LSX_ACTIVITIES_PATH . '/classes/class-lsx-activities-admin.php'); |
|
| 85 | - require_once(LSX_ACTIVITIES_PATH . '/classes/class-lsx-activities-frontend.php'); |
|
| 86 | - require_once(LSX_ACTIVITIES_PATH . '/includes/template-tags.php'); |
|
| 87 | - |
|
| 88 | - // flush_rewrite_rules() |
|
| 89 | - register_activation_hook( LSX_ACTIVITIES_CORE, array( $this, 'register_activation_hook' ) ); |
|
| 90 | - add_action( 'admin_init', array( $this, 'register_activation_hook_check' ) ); |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - /** |
|
| 94 | - * Include the post type for the search integration |
|
| 95 | - */ |
|
| 96 | - public function lsx_to_search_integration(){ |
|
| 97 | - add_filter( 'lsx_to_search_post_types', array( $this, 'post_types_filter') ); |
|
| 98 | - add_filter( 'lsx_to_search_taxonomies', array( $this, 'taxonomies_filter') ); |
|
| 99 | - } |
|
| 71 | + add_action('init',array($this,'load_plugin_textdomain')); |
|
| 72 | + |
|
| 73 | + if(false !== $this->post_types){ |
|
| 74 | + add_filter( 'lsx_to_framework_post_types', array( $this, 'post_types_filter') ); |
|
| 75 | + add_filter( 'lsx_to_post_types', array( $this, 'post_types_filter') ); |
|
| 76 | + add_filter( 'lsx_to_post_types_singular', array( $this, 'post_types_singular_filter') ); |
|
| 77 | + add_filter('lsx_to_settings_path',array( $this, 'plugin_path'),10,2); |
|
| 78 | + } |
|
| 79 | + if(false !== $this->taxonomies){ |
|
| 80 | + add_filter( 'lsx_to_framework_taxonomies', array( $this, 'taxonomies_filter') ); |
|
| 81 | + add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'taxonomies_plural_filter') ); |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + require_once(LSX_ACTIVITIES_PATH . '/classes/class-lsx-activities-admin.php'); |
|
| 85 | + require_once(LSX_ACTIVITIES_PATH . '/classes/class-lsx-activities-frontend.php'); |
|
| 86 | + require_once(LSX_ACTIVITIES_PATH . '/includes/template-tags.php'); |
|
| 87 | + |
|
| 88 | + // flush_rewrite_rules() |
|
| 89 | + register_activation_hook( LSX_ACTIVITIES_CORE, array( $this, 'register_activation_hook' ) ); |
|
| 90 | + add_action( 'admin_init', array( $this, 'register_activation_hook_check' ) ); |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + /** |
|
| 94 | + * Include the post type for the search integration |
|
| 95 | + */ |
|
| 96 | + public function lsx_to_search_integration(){ |
|
| 97 | + add_filter( 'lsx_to_search_post_types', array( $this, 'post_types_filter') ); |
|
| 98 | + add_filter( 'lsx_to_search_taxonomies', array( $this, 'taxonomies_filter') ); |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | - /** |
|
| 102 | - * Load the plugin text domain for translation. |
|
| 103 | - */ |
|
| 104 | - public function load_plugin_textdomain() { |
|
| 105 | - load_plugin_textdomain( 'lsx-activities', FALSE, basename( LSX_ACTIVITIES_PATH ) . '/languages'); |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - /** |
|
| 109 | - * Sets the plugins variables |
|
| 110 | - */ |
|
| 111 | - public function set_vars() { |
|
| 112 | - $this->post_types = array( |
|
| 113 | - 'activity' => __('Activities','lsx-activities') |
|
| 114 | - ); |
|
| 115 | - $this->post_types_singular = array( |
|
| 116 | - 'activity' => __('Activity','lsx-activities') |
|
| 117 | - ); |
|
| 118 | - $this->post_type_slugs = array_keys($this->post_types); |
|
| 119 | - |
|
| 120 | - $this->options = get_option('_lsx-to_settings',false); |
|
| 121 | - if((false !== $this->options && isset($this->options['api']['googlemaps_key'])) || defined('GOOGLEMAPS_API_KEY')) { |
|
| 122 | - |
|
| 123 | - if (!defined('GOOGLEMAPS_API_KEY')) { |
|
| 124 | - $this->api_key = $this->options['api']['googlemaps_key']; |
|
| 125 | - } else { |
|
| 126 | - $this->api_key = GOOGLEMAPS_API_KEY; |
|
| 127 | - } |
|
| 128 | - } |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - /** |
|
| 132 | - * Adds our post types to an array via a filter |
|
| 133 | - */ |
|
| 134 | - public function plugin_path($path,$post_type){ |
|
| 135 | - if(false !== $this->post_types && array_key_exists($post_type,$this->post_types)){ |
|
| 136 | - $path = LSX_ACTIVITIES_PATH; |
|
| 137 | - } |
|
| 138 | - return $path; |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * Adds our post types to an array via a filter |
|
| 143 | - */ |
|
| 144 | - public function post_types_slugs_filter($post_types){ |
|
| 145 | - if(is_array($post_types)){ |
|
| 146 | - $post_types = array_merge($post_types,$this->post_type_slugs); |
|
| 147 | - }else{ |
|
| 148 | - $post_types = $this->post_type_slugs; |
|
| 149 | - } |
|
| 150 | - return $post_types; |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * Adds our post types to an array via a filter |
|
| 155 | - */ |
|
| 156 | - public function post_types_filter($post_types){ |
|
| 157 | - if(is_array($post_types) && is_array($this->post_types)){ |
|
| 158 | - $post_types = array_merge($post_types,$this->post_types); |
|
| 159 | - }elseif(is_array($this->post_types)){ |
|
| 160 | - $post_types = $this->post_types; |
|
| 161 | - } |
|
| 162 | - return $post_types; |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - /** |
|
| 166 | - * Adds our post types to an array via a filter |
|
| 167 | - */ |
|
| 168 | - public function post_types_singular_filter($post_types_singular){ |
|
| 169 | - if(is_array($post_types_singular) && is_array($this->post_types_singular)){ |
|
| 170 | - $post_types_singular = array_merge($post_types_singular,$this->post_types_singular); |
|
| 171 | - }elseif(is_array($this->post_types_singular)){ |
|
| 172 | - $post_types_singular = $this->post_types_singular; |
|
| 173 | - } |
|
| 174 | - return $post_types_singular; |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - /** |
|
| 178 | - * Adds our taxonomies to an array via a filter |
|
| 179 | - */ |
|
| 180 | - public function taxonomies_filter($taxonomies){ |
|
| 181 | - if(is_array($taxonomies) && is_array($this->taxonomies)){ |
|
| 182 | - $taxonomies = array_merge($taxonomies,$this->taxonomies); |
|
| 183 | - }elseif(is_array($this->taxonomies)){ |
|
| 184 | - $taxonomies = $this->taxonomies; |
|
| 185 | - } |
|
| 186 | - return $taxonomies; |
|
| 187 | - } |
|
| 188 | - |
|
| 189 | - /** |
|
| 190 | - * Adds our taxonomies_plural to an array via a filter |
|
| 191 | - */ |
|
| 192 | - public function taxonomies_plural_filter($taxonomies_plural){ |
|
| 193 | - if(is_array($taxonomies_plural) && is_array($this->taxonomies_plural)){ |
|
| 194 | - $taxonomies_plural = array_merge($taxonomies_plural,$this->taxonomies_plural); |
|
| 195 | - }elseif(is_array($this->taxonomies_plural)){ |
|
| 196 | - $taxonomies_plural = $this->taxonomies_plural; |
|
| 197 | - } |
|
| 198 | - return $taxonomies_plural; |
|
| 199 | - } |
|
| 101 | + /** |
|
| 102 | + * Load the plugin text domain for translation. |
|
| 103 | + */ |
|
| 104 | + public function load_plugin_textdomain() { |
|
| 105 | + load_plugin_textdomain( 'lsx-activities', FALSE, basename( LSX_ACTIVITIES_PATH ) . '/languages'); |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + /** |
|
| 109 | + * Sets the plugins variables |
|
| 110 | + */ |
|
| 111 | + public function set_vars() { |
|
| 112 | + $this->post_types = array( |
|
| 113 | + 'activity' => __('Activities','lsx-activities') |
|
| 114 | + ); |
|
| 115 | + $this->post_types_singular = array( |
|
| 116 | + 'activity' => __('Activity','lsx-activities') |
|
| 117 | + ); |
|
| 118 | + $this->post_type_slugs = array_keys($this->post_types); |
|
| 119 | + |
|
| 120 | + $this->options = get_option('_lsx-to_settings',false); |
|
| 121 | + if((false !== $this->options && isset($this->options['api']['googlemaps_key'])) || defined('GOOGLEMAPS_API_KEY')) { |
|
| 122 | + |
|
| 123 | + if (!defined('GOOGLEMAPS_API_KEY')) { |
|
| 124 | + $this->api_key = $this->options['api']['googlemaps_key']; |
|
| 125 | + } else { |
|
| 126 | + $this->api_key = GOOGLEMAPS_API_KEY; |
|
| 127 | + } |
|
| 128 | + } |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + /** |
|
| 132 | + * Adds our post types to an array via a filter |
|
| 133 | + */ |
|
| 134 | + public function plugin_path($path,$post_type){ |
|
| 135 | + if(false !== $this->post_types && array_key_exists($post_type,$this->post_types)){ |
|
| 136 | + $path = LSX_ACTIVITIES_PATH; |
|
| 137 | + } |
|
| 138 | + return $path; |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * Adds our post types to an array via a filter |
|
| 143 | + */ |
|
| 144 | + public function post_types_slugs_filter($post_types){ |
|
| 145 | + if(is_array($post_types)){ |
|
| 146 | + $post_types = array_merge($post_types,$this->post_type_slugs); |
|
| 147 | + }else{ |
|
| 148 | + $post_types = $this->post_type_slugs; |
|
| 149 | + } |
|
| 150 | + return $post_types; |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * Adds our post types to an array via a filter |
|
| 155 | + */ |
|
| 156 | + public function post_types_filter($post_types){ |
|
| 157 | + if(is_array($post_types) && is_array($this->post_types)){ |
|
| 158 | + $post_types = array_merge($post_types,$this->post_types); |
|
| 159 | + }elseif(is_array($this->post_types)){ |
|
| 160 | + $post_types = $this->post_types; |
|
| 161 | + } |
|
| 162 | + return $post_types; |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + /** |
|
| 166 | + * Adds our post types to an array via a filter |
|
| 167 | + */ |
|
| 168 | + public function post_types_singular_filter($post_types_singular){ |
|
| 169 | + if(is_array($post_types_singular) && is_array($this->post_types_singular)){ |
|
| 170 | + $post_types_singular = array_merge($post_types_singular,$this->post_types_singular); |
|
| 171 | + }elseif(is_array($this->post_types_singular)){ |
|
| 172 | + $post_types_singular = $this->post_types_singular; |
|
| 173 | + } |
|
| 174 | + return $post_types_singular; |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + /** |
|
| 178 | + * Adds our taxonomies to an array via a filter |
|
| 179 | + */ |
|
| 180 | + public function taxonomies_filter($taxonomies){ |
|
| 181 | + if(is_array($taxonomies) && is_array($this->taxonomies)){ |
|
| 182 | + $taxonomies = array_merge($taxonomies,$this->taxonomies); |
|
| 183 | + }elseif(is_array($this->taxonomies)){ |
|
| 184 | + $taxonomies = $this->taxonomies; |
|
| 185 | + } |
|
| 186 | + return $taxonomies; |
|
| 187 | + } |
|
| 188 | + |
|
| 189 | + /** |
|
| 190 | + * Adds our taxonomies_plural to an array via a filter |
|
| 191 | + */ |
|
| 192 | + public function taxonomies_plural_filter($taxonomies_plural){ |
|
| 193 | + if(is_array($taxonomies_plural) && is_array($this->taxonomies_plural)){ |
|
| 194 | + $taxonomies_plural = array_merge($taxonomies_plural,$this->taxonomies_plural); |
|
| 195 | + }elseif(is_array($this->taxonomies_plural)){ |
|
| 196 | + $taxonomies_plural = $this->taxonomies_plural; |
|
| 197 | + } |
|
| 198 | + return $taxonomies_plural; |
|
| 199 | + } |
|
| 200 | 200 | |
| 201 | - /** |
|
| 202 | - * Make TO last plugin to load. |
|
| 203 | - */ |
|
| 204 | - public function activated_plugin() { |
|
| 205 | - if ( $plugins = get_option( 'active_plugins' ) ) { |
|
| 206 | - $search = preg_grep( '/.*\/tour-operator\.php/', $plugins ); |
|
| 207 | - $key = array_search( $search, $plugins ); |
|
| 208 | - |
|
| 209 | - if ( is_array( $search ) && count( $search ) ) { |
|
| 210 | - foreach ( $search as $key => $path ) { |
|
| 211 | - array_splice( $plugins, $key, 1 ); |
|
| 212 | - array_push( $plugins, $path ); |
|
| 213 | - update_option( 'active_plugins', $plugins ); |
|
| 214 | - } |
|
| 215 | - } |
|
| 216 | - } |
|
| 217 | - } |
|
| 201 | + /** |
|
| 202 | + * Make TO last plugin to load. |
|
| 203 | + */ |
|
| 204 | + public function activated_plugin() { |
|
| 205 | + if ( $plugins = get_option( 'active_plugins' ) ) { |
|
| 206 | + $search = preg_grep( '/.*\/tour-operator\.php/', $plugins ); |
|
| 207 | + $key = array_search( $search, $plugins ); |
|
| 208 | + |
|
| 209 | + if ( is_array( $search ) && count( $search ) ) { |
|
| 210 | + foreach ( $search as $key => $path ) { |
|
| 211 | + array_splice( $plugins, $key, 1 ); |
|
| 212 | + array_push( $plugins, $path ); |
|
| 213 | + update_option( 'active_plugins', $plugins ); |
|
| 214 | + } |
|
| 215 | + } |
|
| 216 | + } |
|
| 217 | + } |
|
| 218 | 218 | |
| 219 | - /** |
|
| 220 | - * On plugin activation |
|
| 221 | - */ |
|
| 222 | - public function register_activation_hook() { |
|
| 223 | - if ( ! is_network_admin() && ! isset( $_GET['activate-multi'] ) ) { |
|
| 224 | - set_transient( '_tour_operators_activities_flush_rewrite_rules', 1, 30 ); |
|
| 225 | - } |
|
| 226 | - } |
|
| 219 | + /** |
|
| 220 | + * On plugin activation |
|
| 221 | + */ |
|
| 222 | + public function register_activation_hook() { |
|
| 223 | + if ( ! is_network_admin() && ! isset( $_GET['activate-multi'] ) ) { |
|
| 224 | + set_transient( '_tour_operators_activities_flush_rewrite_rules', 1, 30 ); |
|
| 225 | + } |
|
| 226 | + } |
|
| 227 | 227 | |
| 228 | - /** |
|
| 229 | - * On plugin activation (check) |
|
| 230 | - */ |
|
| 231 | - public function register_activation_hook_check() { |
|
| 232 | - if ( ! get_transient( '_tour_operators_activities_flush_rewrite_rules' ) ) { |
|
| 233 | - return; |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - delete_transient( '_tour_operators_activities_flush_rewrite_rules' ); |
|
| 237 | - flush_rewrite_rules(); |
|
| 238 | - } |
|
| 239 | - |
|
| 240 | - } |
|
| 241 | - new LSX_Activities(); |
|
| 228 | + /** |
|
| 229 | + * On plugin activation (check) |
|
| 230 | + */ |
|
| 231 | + public function register_activation_hook_check() { |
|
| 232 | + if ( ! get_transient( '_tour_operators_activities_flush_rewrite_rules' ) ) { |
|
| 233 | + return; |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + delete_transient( '_tour_operators_activities_flush_rewrite_rules' ); |
|
| 237 | + flush_rewrite_rules(); |
|
| 238 | + } |
|
| 239 | + |
|
| 240 | + } |
|
| 241 | + new LSX_Activities(); |
|
| 242 | 242 | } |
| 243 | 243 | \ No newline at end of file |
@@ -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 | } |
@@ -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,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_ACTIVITIES_PATH', plugin_dir_path( __FILE__ ) ); |
@@ -10,196 +10,196 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | $metabox = array( |
| 13 | - 'title' => esc_html__( 'Tour Operator Plugin', 'lsx-activities' ), |
|
| 14 | - 'pages' => 'activity', |
|
| 15 | - 'fields' => array(), |
|
| 13 | + 'title' => esc_html__( 'Tour Operator Plugin', 'lsx-activities' ), |
|
| 14 | + 'pages' => 'activity', |
|
| 15 | + 'fields' => array(), |
|
| 16 | 16 | ); |
| 17 | 17 | |
| 18 | 18 | $metabox['fields'][] = array( |
| 19 | - 'id' => 'featured', |
|
| 20 | - 'name' => esc_html__( 'Featured', 'lsx-activities' ), |
|
| 21 | - 'type' => 'checkbox', |
|
| 19 | + 'id' => 'featured', |
|
| 20 | + 'name' => esc_html__( 'Featured', 'lsx-activities' ), |
|
| 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', 'lsx-activities' ), |
|
| 34 | - 'type' => 'text', |
|
| 35 | - ); |
|
| 31 | + $metabox['fields'][] = array( |
|
| 32 | + 'id' => 'tagline', |
|
| 33 | + 'name' => esc_html__( 'Tagline', 'lsx-activities' ), |
|
| 34 | + 'type' => 'text', |
|
| 35 | + ); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | $metabox['fields'][] = array( |
| 39 | - 'id' => 'friendly', |
|
| 40 | - 'name' => 'Friendly', |
|
| 41 | - 'type' => 'select', |
|
| 42 | - 'multiple' => true, |
|
| 43 | - 'options' => array( |
|
| 44 | - 'business' => esc_html__( 'Business', 'lsx-activities' ), |
|
| 45 | - 'children' => esc_html__( 'Children', 'lsx-activities' ), |
|
| 46 | - 'disability' => esc_html__( 'Disability', 'lsx-activities' ), |
|
| 47 | - 'leisure' => esc_html__( 'Leisure', 'lsx-activities' ), |
|
| 48 | - 'luxury' => esc_html__( 'Luxury', 'lsx-activities' ), |
|
| 49 | - 'pet' => esc_html__( 'Pet', 'lsx-activities' ), |
|
| 50 | - 'romance' => esc_html__( 'Romance', 'lsx-activities' ), |
|
| 51 | - 'vegetarian' => esc_html__( 'Vegetarian', 'lsx-activities' ), |
|
| 52 | - 'weddings' => esc_html__( 'Weddings', 'lsx-activities' ), |
|
| 53 | - ), |
|
| 39 | + 'id' => 'friendly', |
|
| 40 | + 'name' => 'Friendly', |
|
| 41 | + 'type' => 'select', |
|
| 42 | + 'multiple' => true, |
|
| 43 | + 'options' => array( |
|
| 44 | + 'business' => esc_html__( 'Business', 'lsx-activities' ), |
|
| 45 | + 'children' => esc_html__( 'Children', 'lsx-activities' ), |
|
| 46 | + 'disability' => esc_html__( 'Disability', 'lsx-activities' ), |
|
| 47 | + 'leisure' => esc_html__( 'Leisure', 'lsx-activities' ), |
|
| 48 | + 'luxury' => esc_html__( 'Luxury', 'lsx-activities' ), |
|
| 49 | + 'pet' => esc_html__( 'Pet', 'lsx-activities' ), |
|
| 50 | + 'romance' => esc_html__( 'Romance', 'lsx-activities' ), |
|
| 51 | + 'vegetarian' => esc_html__( 'Vegetarian', 'lsx-activities' ), |
|
| 52 | + 'weddings' => esc_html__( 'Weddings', 'lsx-activities' ), |
|
| 53 | + ), |
|
| 54 | 54 | ); |
| 55 | 55 | |
| 56 | 56 | if ( class_exists( 'LSX_TO_Team' ) ) { |
| 57 | - $metabox['fields'][] = array( |
|
| 58 | - 'id' => 'team_to_activity', |
|
| 59 | - 'name' => esc_html__( 'Team Member', 'lsx-activities' ), |
|
| 60 | - 'type' => 'post_select', |
|
| 61 | - 'use_ajax' => false, |
|
| 62 | - 'allow_none' => true, |
|
| 63 | - 'query' => array( |
|
| 64 | - 'post_type' => 'team', |
|
| 65 | - 'nopagin' => true, |
|
| 66 | - 'posts_per_page' => 1000, |
|
| 67 | - 'orderby' => 'title', |
|
| 68 | - 'order' => 'ASC', |
|
| 69 | - ), |
|
| 70 | - ); |
|
| 57 | + $metabox['fields'][] = array( |
|
| 58 | + 'id' => 'team_to_activity', |
|
| 59 | + 'name' => esc_html__( 'Team Member', 'lsx-activities' ), |
|
| 60 | + 'type' => 'post_select', |
|
| 61 | + 'use_ajax' => false, |
|
| 62 | + 'allow_none' => true, |
|
| 63 | + 'query' => array( |
|
| 64 | + 'post_type' => 'team', |
|
| 65 | + 'nopagin' => true, |
|
| 66 | + 'posts_per_page' => 1000, |
|
| 67 | + 'orderby' => 'title', |
|
| 68 | + 'order' => 'ASC', |
|
| 69 | + ), |
|
| 70 | + ); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $metabox['fields'][] = array( |
| 74 | - 'id' => 'price_title', |
|
| 75 | - 'name' => __( 'Price','lsx-activities' ), |
|
| 76 | - 'type' => 'title', |
|
| 74 | + 'id' => 'price_title', |
|
| 75 | + 'name' => __( 'Price','lsx-activities' ), |
|
| 76 | + 'type' => 'title', |
|
| 77 | 77 | ); |
| 78 | 78 | |
| 79 | 79 | $metabox['fields'][] = array( |
| 80 | - 'id' => 'price', |
|
| 81 | - 'name' => __( 'Price','lsx-activities' ), |
|
| 82 | - 'type' => 'text', |
|
| 83 | - 'cols' => 6, |
|
| 80 | + 'id' => 'price', |
|
| 81 | + 'name' => __( 'Price','lsx-activities' ), |
|
| 82 | + 'type' => 'text', |
|
| 83 | + 'cols' => 6, |
|
| 84 | 84 | ); |
| 85 | 85 | |
| 86 | 86 | $metabox['fields'][] = array( |
| 87 | - 'id' => 'price_type', |
|
| 88 | - 'name' => __( 'Price Type','lsx-activities' ), |
|
| 89 | - 'type' => 'select', |
|
| 90 | - 'cols' => 6, |
|
| 91 | - 'options' => array( |
|
| 92 | - 'none' => 'Select a type', |
|
| 93 | - 'per_person' => __( 'Per Person','lsx-activities' ), |
|
| 94 | - 'per_group' => __( 'Per Group','lsx-activities' ), |
|
| 95 | - ), |
|
| 87 | + 'id' => 'price_type', |
|
| 88 | + 'name' => __( 'Price Type','lsx-activities' ), |
|
| 89 | + 'type' => 'select', |
|
| 90 | + 'cols' => 6, |
|
| 91 | + 'options' => array( |
|
| 92 | + 'none' => 'Select a type', |
|
| 93 | + 'per_person' => __( 'Per Person','lsx-activities' ), |
|
| 94 | + 'per_group' => __( 'Per Group','lsx-activities' ), |
|
| 95 | + ), |
|
| 96 | 96 | ); |
| 97 | 97 | |
| 98 | 98 | if ( class_exists( 'LSX_TO_Maps' ) ) { |
| 99 | - $tour_operator = tour_operator(); |
|
| 100 | - $api_key = false; |
|
| 101 | - |
|
| 102 | - if ( isset( $tour_operator->options['api']['googlemaps_key'] ) ) { |
|
| 103 | - $api_key = $tour_operator->options['api']['googlemaps_key']; |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - $metabox['fields'][] = array( |
|
| 107 | - 'id' => 'location_title', |
|
| 108 | - 'name' => esc_html__( 'Location', 'lsx-activities' ), |
|
| 109 | - 'type' => 'title', |
|
| 110 | - ); |
|
| 111 | - |
|
| 112 | - $metabox['fields'][] = array( |
|
| 113 | - 'id' => 'location', |
|
| 114 | - 'name' => esc_html__( 'Location', 'lsx-activities' ), |
|
| 115 | - 'type' => 'gmap', |
|
| 116 | - 'google_api_key' => $api_key, |
|
| 117 | - ); |
|
| 99 | + $tour_operator = tour_operator(); |
|
| 100 | + $api_key = false; |
|
| 101 | + |
|
| 102 | + if ( isset( $tour_operator->options['api']['googlemaps_key'] ) ) { |
|
| 103 | + $api_key = $tour_operator->options['api']['googlemaps_key']; |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + $metabox['fields'][] = array( |
|
| 107 | + 'id' => 'location_title', |
|
| 108 | + 'name' => esc_html__( 'Location', 'lsx-activities' ), |
|
| 109 | + 'type' => 'title', |
|
| 110 | + ); |
|
| 111 | + |
|
| 112 | + $metabox['fields'][] = array( |
|
| 113 | + 'id' => 'location', |
|
| 114 | + 'name' => esc_html__( 'Location', 'lsx-activities' ), |
|
| 115 | + 'type' => 'gmap', |
|
| 116 | + 'google_api_key' => $api_key, |
|
| 117 | + ); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | $metabox['fields'][] = array( |
| 121 | - 'id' => 'gallery_title', |
|
| 122 | - 'name' => esc_html__( 'Gallery', 'lsx-activities' ), |
|
| 123 | - 'type' => 'title', |
|
| 121 | + 'id' => 'gallery_title', |
|
| 122 | + 'name' => esc_html__( 'Gallery', 'lsx-activities' ), |
|
| 123 | + 'type' => 'title', |
|
| 124 | 124 | ); |
| 125 | 125 | |
| 126 | 126 | $metabox['fields'][] = array( |
| 127 | - 'id' => 'gallery', |
|
| 128 | - 'name' => esc_html__( 'Gallery', 'lsx-activities' ), |
|
| 129 | - 'type' => 'image', |
|
| 130 | - 'repeatable' => true, |
|
| 131 | - 'show_size' => false, |
|
| 127 | + 'id' => 'gallery', |
|
| 128 | + 'name' => esc_html__( 'Gallery', 'lsx-activities' ), |
|
| 129 | + 'type' => 'image', |
|
| 130 | + 'repeatable' => true, |
|
| 131 | + 'show_size' => false, |
|
| 132 | 132 | ); |
| 133 | 133 | |
| 134 | 134 | if ( class_exists( 'Envira_Gallery' ) ) { |
| 135 | - $metabox['fields'][] = array( |
|
| 136 | - 'id' => 'envira_title', |
|
| 137 | - 'name' => esc_html__( 'Envira Gallery', 'lsx-activities' ), |
|
| 138 | - 'type' => 'title', |
|
| 139 | - ); |
|
| 140 | - |
|
| 141 | - $metabox['fields'][] = array( |
|
| 142 | - 'id' => 'envira_gallery', |
|
| 143 | - 'name' => esc_html__( 'Envira Gallery', 'lsx-activities' ), |
|
| 144 | - 'type' => 'post_select', |
|
| 145 | - 'use_ajax' => false, |
|
| 146 | - 'allow_none' => true, |
|
| 147 | - 'query' => array( |
|
| 148 | - 'post_type' => 'envira', |
|
| 149 | - 'nopagin' => true, |
|
| 150 | - 'posts_per_page' => '-1', |
|
| 151 | - 'orderby' => 'title', |
|
| 152 | - 'order' => 'ASC', |
|
| 153 | - ), |
|
| 154 | - ); |
|
| 155 | - |
|
| 156 | - if ( class_exists( 'Envira_Videos' ) ) { |
|
| 157 | - $metabox['fields'][] = array( |
|
| 158 | - 'id' => 'envira_video', |
|
| 159 | - 'name' => esc_html__( 'Envira Video Gallery', 'lsx-activities' ), |
|
| 160 | - 'type' => 'post_select', |
|
| 161 | - 'use_ajax' => false, |
|
| 162 | - 'allow_none' => true, |
|
| 163 | - 'query' => array( |
|
| 164 | - 'post_type' => 'envira', |
|
| 165 | - 'nopagin' => true, |
|
| 166 | - 'posts_per_page' => '-1', |
|
| 167 | - 'orderby' => 'title', |
|
| 168 | - 'order' => 'ASC', |
|
| 169 | - ), |
|
| 170 | - ); |
|
| 171 | - } |
|
| 135 | + $metabox['fields'][] = array( |
|
| 136 | + 'id' => 'envira_title', |
|
| 137 | + 'name' => esc_html__( 'Envira Gallery', 'lsx-activities' ), |
|
| 138 | + 'type' => 'title', |
|
| 139 | + ); |
|
| 140 | + |
|
| 141 | + $metabox['fields'][] = array( |
|
| 142 | + 'id' => 'envira_gallery', |
|
| 143 | + 'name' => esc_html__( 'Envira Gallery', 'lsx-activities' ), |
|
| 144 | + 'type' => 'post_select', |
|
| 145 | + 'use_ajax' => false, |
|
| 146 | + 'allow_none' => true, |
|
| 147 | + 'query' => array( |
|
| 148 | + 'post_type' => 'envira', |
|
| 149 | + 'nopagin' => true, |
|
| 150 | + 'posts_per_page' => '-1', |
|
| 151 | + 'orderby' => 'title', |
|
| 152 | + 'order' => 'ASC', |
|
| 153 | + ), |
|
| 154 | + ); |
|
| 155 | + |
|
| 156 | + if ( class_exists( 'Envira_Videos' ) ) { |
|
| 157 | + $metabox['fields'][] = array( |
|
| 158 | + 'id' => 'envira_video', |
|
| 159 | + 'name' => esc_html__( 'Envira Video Gallery', 'lsx-activities' ), |
|
| 160 | + 'type' => 'post_select', |
|
| 161 | + 'use_ajax' => false, |
|
| 162 | + 'allow_none' => true, |
|
| 163 | + 'query' => array( |
|
| 164 | + 'post_type' => 'envira', |
|
| 165 | + 'nopagin' => true, |
|
| 166 | + 'posts_per_page' => '-1', |
|
| 167 | + 'orderby' => 'title', |
|
| 168 | + 'order' => 'ASC', |
|
| 169 | + ), |
|
| 170 | + ); |
|
| 171 | + } |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | $post_types = array( |
| 175 | - 'post' => esc_html__( 'Posts', 'lsx-activities' ), |
|
| 176 | - 'accommodation' => esc_html__( 'Accommodation', 'lsx-activities' ), |
|
| 177 | - 'destination' => esc_html__( 'Destinations', 'lsx-activities' ), |
|
| 178 | - 'tour' => esc_html__( 'Tours', 'lsx-activities' ), |
|
| 175 | + 'post' => esc_html__( 'Posts', 'lsx-activities' ), |
|
| 176 | + 'accommodation' => esc_html__( 'Accommodation', 'lsx-activities' ), |
|
| 177 | + 'destination' => esc_html__( 'Destinations', 'lsx-activities' ), |
|
| 178 | + 'tour' => esc_html__( 'Tours', 'lsx-activities' ), |
|
| 179 | 179 | ); |
| 180 | 180 | |
| 181 | 181 | foreach ( $post_types as $slug => $label ) { |
| 182 | - $metabox['fields'][] = array( |
|
| 183 | - 'id' => $slug . '_title', |
|
| 184 | - 'name' => $label, |
|
| 185 | - 'type' => 'title', |
|
| 186 | - ); |
|
| 187 | - |
|
| 188 | - $metabox['fields'][] = array( |
|
| 189 | - 'id' => $slug . '_to_activity', |
|
| 190 | - 'name' => $label . esc_html__( ' related with this activity', 'lsx-activities' ), |
|
| 191 | - 'type' => 'post_select', |
|
| 192 | - 'use_ajax' => false, |
|
| 193 | - 'repeatable' => true, |
|
| 194 | - 'allow_none' => true, |
|
| 195 | - 'query' => array( |
|
| 196 | - 'post_type' => $slug, |
|
| 197 | - 'nopagin' => true, |
|
| 198 | - 'posts_per_page' => '-1', |
|
| 199 | - 'orderby' => 'title', |
|
| 200 | - 'order' => 'ASC', |
|
| 201 | - ), |
|
| 202 | - ); |
|
| 182 | + $metabox['fields'][] = array( |
|
| 183 | + 'id' => $slug . '_title', |
|
| 184 | + 'name' => $label, |
|
| 185 | + 'type' => 'title', |
|
| 186 | + ); |
|
| 187 | + |
|
| 188 | + $metabox['fields'][] = array( |
|
| 189 | + 'id' => $slug . '_to_activity', |
|
| 190 | + 'name' => $label . esc_html__( ' related with this activity', 'lsx-activities' ), |
|
| 191 | + 'type' => 'post_select', |
|
| 192 | + 'use_ajax' => false, |
|
| 193 | + 'repeatable' => true, |
|
| 194 | + 'allow_none' => true, |
|
| 195 | + 'query' => array( |
|
| 196 | + 'post_type' => $slug, |
|
| 197 | + 'nopagin' => true, |
|
| 198 | + 'posts_per_page' => '-1', |
|
| 199 | + 'orderby' => 'title', |
|
| 200 | + 'order' => 'ASC', |
|
| 201 | + ), |
|
| 202 | + ); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | $metabox['fields'] = apply_filters( 'lsx_to_activity_custom_fields', $metabox['fields'] ); |
@@ -14,19 +14,19 @@ discard block |
||
| 14 | 14 | * @category activity |
| 15 | 15 | */ |
| 16 | 16 | if ( ! function_exists( 'lsx_to_activity_posts' ) ) { |
| 17 | - function lsx_to_activity_posts() { |
|
| 18 | - global $lsx_to_archive; |
|
| 17 | + function lsx_to_activity_posts() { |
|
| 18 | + global $lsx_to_archive; |
|
| 19 | 19 | |
| 20 | - $args = array( |
|
| 21 | - 'from' => 'post', |
|
| 22 | - 'to' => 'activity', |
|
| 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', 'lsx-activities' ) . '</h2><div id="collapse-posts" class="collapse in"><div class="collapse-inner">', |
|
| 25 | - 'after' => '</div></div></section>', |
|
| 26 | - ); |
|
| 20 | + $args = array( |
|
| 21 | + 'from' => 'post', |
|
| 22 | + 'to' => 'activity', |
|
| 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', 'lsx-activities' ) . '</h2><div id="collapse-posts" class="collapse in"><div class="collapse-inner">', |
|
| 25 | + 'after' => '</div></div></section>', |
|
| 26 | + ); |
|
| 27 | 27 | |
| 28 | - lsx_to_connected_panel_query( $args ); |
|
| 29 | - } |
|
| 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_activity_content( $slug, $name = null ) { |
| 40 | - do_action( 'lsx_to_activity_content', $slug, $name ); |
|
| 40 | + do_action( 'lsx_to_activity_content', $slug, $name ); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -48,22 +48,22 @@ discard block |
||
| 48 | 48 | * @category activity |
| 49 | 49 | */ |
| 50 | 50 | if ( ! function_exists( 'lsx_to_activity_tours' ) ) { |
| 51 | - function lsx_to_activity_tours() { |
|
| 52 | - global $wp_query; |
|
| 51 | + function lsx_to_activity_tours() { |
|
| 52 | + global $wp_query; |
|
| 53 | 53 | |
| 54 | - if ( post_type_exists( 'tour' ) && is_singular( 'activity' ) ) { |
|
| 55 | - $args = array( |
|
| 56 | - 'from' => 'tour', |
|
| 57 | - 'to' => 'activity', |
|
| 58 | - 'content_part' => 'tour', |
|
| 59 | - 'column' => '3', |
|
| 60 | - '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' ), 'lsx-activities' ) . '</h2><div id="collapse-tours" class="collapse in"><div class="collapse-inner">', |
|
| 61 | - 'after' => '</div></div></section>', |
|
| 62 | - ); |
|
| 54 | + if ( post_type_exists( 'tour' ) && is_singular( 'activity' ) ) { |
|
| 55 | + $args = array( |
|
| 56 | + 'from' => 'tour', |
|
| 57 | + 'to' => 'activity', |
|
| 58 | + 'content_part' => 'tour', |
|
| 59 | + 'column' => '3', |
|
| 60 | + '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' ), 'lsx-activities' ) . '</h2><div id="collapse-tours" class="collapse in"><div class="collapse-inner">', |
|
| 61 | + 'after' => '</div></div></section>', |
|
| 62 | + ); |
|
| 63 | 63 | |
| 64 | - lsx_to_connected_panel_query( $args ); |
|
| 65 | - } |
|
| 66 | - } |
|
| 64 | + lsx_to_connected_panel_query( $args ); |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | 67 | } |
| 68 | 68 | /** |
| 69 | 69 | * Outputs the activites accommodation |
@@ -73,22 +73,22 @@ discard block |
||
| 73 | 73 | * @category activity |
| 74 | 74 | */ |
| 75 | 75 | if ( ! function_exists( 'lsx_to_activity_accommodation' ) ) { |
| 76 | - function lsx_to_activity_accommodation() { |
|
| 77 | - global $wp_query; |
|
| 76 | + function lsx_to_activity_accommodation() { |
|
| 77 | + global $wp_query; |
|
| 78 | 78 | |
| 79 | - if ( post_type_exists( 'accommodation' ) && is_singular( 'activity' ) ) { |
|
| 80 | - $args = array( |
|
| 81 | - 'from' => 'accommodation', |
|
| 82 | - 'to' => 'activity', |
|
| 83 | - 'content_part' => 'accommodation', |
|
| 84 | - 'column' => '3', |
|
| 85 | - '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' ), 'lsx-activities' ) . '</h2><div id="collapse-accommodation" class="collapse in"><div class="collapse-inner">', |
|
| 86 | - 'after' => '</div></div></section>', |
|
| 87 | - ); |
|
| 79 | + if ( post_type_exists( 'accommodation' ) && is_singular( 'activity' ) ) { |
|
| 80 | + $args = array( |
|
| 81 | + 'from' => 'accommodation', |
|
| 82 | + 'to' => 'activity', |
|
| 83 | + 'content_part' => 'accommodation', |
|
| 84 | + 'column' => '3', |
|
| 85 | + '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' ), 'lsx-activities' ) . '</h2><div id="collapse-accommodation" class="collapse in"><div class="collapse-inner">', |
|
| 86 | + 'after' => '</div></div></section>', |
|
| 87 | + ); |
|
| 88 | 88 | |
| 89 | - lsx_to_connected_panel_query( $args ); |
|
| 90 | - } |
|
| 91 | - } |
|
| 89 | + lsx_to_connected_panel_query( $args ); |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -104,5 +104,5 @@ discard block |
||
| 104 | 104 | * @category connections |
| 105 | 105 | */ |
| 106 | 106 | function lsx_to_connected_activities( $before = '', $after = '', $echo = true ) { |
| 107 | - lsx_to_connected_items_query( 'activity', get_post_type(), $before, $after, $echo ); |
|
| 107 | + lsx_to_connected_items_query( 'activity', get_post_type(), $before, $after, $echo ); |
|
| 108 | 108 | } |
@@ -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 | |
@@ -33,10 +33,10 @@ discard block |
||
| 33 | 33 | <?php } elseif ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_text'] ) ) { ?> |
| 34 | 34 | |
| 35 | 35 | <div <?php lsx_to_entry_class( 'entry-content' ); ?>><?php |
| 36 | - lsx_to_entry_content_top(); |
|
| 37 | - the_excerpt(); |
|
| 38 | - lsx_to_entry_content_bottom(); |
|
| 39 | - ?></div> |
|
| 36 | + lsx_to_entry_content_top(); |
|
| 37 | + the_excerpt(); |
|
| 38 | + lsx_to_entry_content_bottom(); |
|
| 39 | + ?></div> |
|
| 40 | 40 | |
| 41 | 41 | <?php } ?> |
| 42 | 42 | |
@@ -32,9 +32,12 @@ |
||
| 32 | 32 | |
| 33 | 33 | </div> |
| 34 | 34 | |
| 35 | - <?php else : ?> |
|
| 35 | + <?php else { |
|
| 36 | + : ?> |
|
| 36 | 37 | |
| 37 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
| 38 | + <?php get_template_part( 'partials/content', 'none' ); |
|
| 39 | +} |
|
| 40 | +?> |
|
| 38 | 41 | |
| 39 | 42 | <?php endif; ?> |
| 40 | 43 | |
@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | $permalink = ''; |
| 14 | 14 | |
| 15 | 15 | if ( $has_single ) { |
| 16 | - $permalink = get_the_permalink(); |
|
| 16 | + $permalink = get_the_permalink(); |
|
| 17 | 17 | } elseif ( ! is_post_type_archive( 'activity' ) ) { |
| 18 | - $has_single = true; |
|
| 19 | - $permalink = get_post_type_archive_link( 'activity' ) . '#activity-' . $post->post_name; |
|
| 18 | + $has_single = true; |
|
| 19 | + $permalink = get_post_type_archive_link( 'activity' ) . '#activity-' . $post->post_name; |
|
| 20 | 20 | } |
| 21 | 21 | ?> |
| 22 | 22 | <article <?php post_class(); ?>> |
@@ -36,35 +36,35 @@ discard block |
||
| 36 | 36 | </h4> |
| 37 | 37 | |
| 38 | 38 | <?php |
| 39 | - // if ( empty( $disable_text ) ) { |
|
| 40 | - // lsx_to_tagline( '<p class="lsx-to-widget-tagline text-center">', '</p>' ); |
|
| 41 | - // } |
|
| 42 | - ?> |
|
| 39 | + // if ( empty( $disable_text ) ) { |
|
| 40 | + // lsx_to_tagline( '<p class="lsx-to-widget-tagline text-center">', '</p>' ); |
|
| 41 | + // } |
|
| 42 | + ?> |
|
| 43 | 43 | |
| 44 | 44 | <div class="lsx-to-widget-meta-data"> |
| 45 | 45 | <?php |
| 46 | - $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
|
| 46 | + $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
|
| 47 | 47 | |
| 48 | - lsx_to_price( '<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__( 'From price', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
| 49 | - lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Location', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
| 50 | - lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
| 51 | - lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
| 52 | - ?> |
|
| 48 | + lsx_to_price( '<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__( 'From price', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
| 49 | + lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Location', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
| 50 | + lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
| 51 | + lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
| 52 | + ?> |
|
| 53 | 53 | </div> |
| 54 | 54 | |
| 55 | 55 | <?php |
| 56 | - ob_start(); |
|
| 57 | - lsx_to_widget_entry_content_top(); |
|
| 58 | - the_excerpt(); |
|
| 59 | - lsx_to_widget_entry_content_bottom(); |
|
| 60 | - $excerpt = ob_get_clean(); |
|
| 56 | + ob_start(); |
|
| 57 | + lsx_to_widget_entry_content_top(); |
|
| 58 | + the_excerpt(); |
|
| 59 | + lsx_to_widget_entry_content_bottom(); |
|
| 60 | + $excerpt = ob_get_clean(); |
|
| 61 | 61 | |
| 62 | - if ( empty( $disable_text ) && ! empty( $excerpt ) ) { |
|
| 63 | - echo wp_kses_post( $excerpt ); |
|
| 64 | - } elseif ( $has_single ) { ?> |
|
| 62 | + if ( empty( $disable_text ) && ! empty( $excerpt ) ) { |
|
| 63 | + echo wp_kses_post( $excerpt ); |
|
| 64 | + } elseif ( $has_single ) { ?> |
|
| 65 | 65 | <p><a href="<?php echo esc_url( $permalink ); ?>" class="moretag"><?php esc_html_e( 'View more', 'lsx-activities' ); ?></a></p> |
| 66 | 66 | <?php } |
| 67 | - ?> |
|
| 67 | + ?> |
|
| 68 | 68 | </div> |
| 69 | 69 | |
| 70 | 70 | </article> |
@@ -18,99 +18,99 @@ |
||
| 18 | 18 | |
| 19 | 19 | class LSX_Activities_Admin extends LSX_Activities { |
| 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_review_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_review_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 ) { |
|
| 46 | - foreach ( $this->post_types as $key => $label ) { |
|
| 47 | - if ( file_exists( LSX_ACTIVITIES_PATH . 'includes/post-types/config-' . $key . '.php' ) ) { |
|
| 48 | - $objects[ $key ] = include LSX_ACTIVITIES_PATH . 'includes/post-types/config-' . $key . '.php'; |
|
| 49 | - } |
|
| 50 | - } |
|
| 51 | - return $objects; |
|
| 52 | - } |
|
| 39 | + /** |
|
| 40 | + * Register the activity post type config |
|
| 41 | + * |
|
| 42 | + * @param $objects |
|
| 43 | + * @return array |
|
| 44 | + */ |
|
| 45 | + public function post_type_config( $objects ) { |
|
| 46 | + foreach ( $this->post_types as $key => $label ) { |
|
| 47 | + if ( file_exists( LSX_ACTIVITIES_PATH . 'includes/post-types/config-' . $key . '.php' ) ) { |
|
| 48 | + $objects[ $key ] = include LSX_ACTIVITIES_PATH . 'includes/post-types/config-' . $key . '.php'; |
|
| 49 | + } |
|
| 50 | + } |
|
| 51 | + return $objects; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Register the activity metabox config |
|
| 56 | - * |
|
| 57 | - * @param $meta_boxes |
|
| 58 | - * @return array |
|
| 59 | - */ |
|
| 60 | - public function meta_box_config( $meta_boxes ) { |
|
| 61 | - foreach ( $this->post_types as $key => $label ) { |
|
| 62 | - if ( file_exists( LSX_ACTIVITIES_PATH . 'includes/metaboxes/config-' . $key . '.php' ) ) { |
|
| 63 | - $meta_boxes[ $key ] = include LSX_ACTIVITIES_PATH . 'includes/metaboxes/config-' . $key . '.php'; |
|
| 64 | - } |
|
| 65 | - } |
|
| 66 | - return $meta_boxes; |
|
| 67 | - } |
|
| 54 | + /** |
|
| 55 | + * Register the activity metabox config |
|
| 56 | + * |
|
| 57 | + * @param $meta_boxes |
|
| 58 | + * @return array |
|
| 59 | + */ |
|
| 60 | + public function meta_box_config( $meta_boxes ) { |
|
| 61 | + foreach ( $this->post_types as $key => $label ) { |
|
| 62 | + if ( file_exists( LSX_ACTIVITIES_PATH . 'includes/metaboxes/config-' . $key . '.php' ) ) { |
|
| 63 | + $meta_boxes[ $key ] = include LSX_ACTIVITIES_PATH . 'includes/metaboxes/config-' . $key . '.php'; |
|
| 64 | + } |
|
| 65 | + } |
|
| 66 | + return $meta_boxes; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * Adds in the gallery fields to the Tour Operators Post Types. |
|
| 71 | - */ |
|
| 72 | - public function custom_fields( $fields ) { |
|
| 73 | - global $post, $typenow, $current_screen; |
|
| 69 | + /** |
|
| 70 | + * Adds in the gallery fields to the Tour Operators Post Types. |
|
| 71 | + */ |
|
| 72 | + public function custom_fields( $fields ) { |
|
| 73 | + global $post, $typenow, $current_screen; |
|
| 74 | 74 | |
| 75 | - $post_type = false; |
|
| 75 | + $post_type = false; |
|
| 76 | 76 | |
| 77 | - if ( $post && $post->post_type ) { |
|
| 78 | - $post_type = $post->post_type; |
|
| 79 | - } elseif ( $typenow ) { |
|
| 80 | - $post_type = $typenow; |
|
| 81 | - } elseif ( $current_screen && $current_screen->post_type ) { |
|
| 82 | - $post_type = $current_screen->post_type; |
|
| 83 | - } elseif ( isset( $_REQUEST['post_type'] ) ) { |
|
| 84 | - $post_type = sanitize_key( $_REQUEST['post_type'] ); |
|
| 85 | - } elseif ( isset( $_REQUEST['post'] ) ) { |
|
| 86 | - $post_type = get_post_type( sanitize_key( $_REQUEST['post'] ) ); |
|
| 87 | - } |
|
| 77 | + if ( $post && $post->post_type ) { |
|
| 78 | + $post_type = $post->post_type; |
|
| 79 | + } elseif ( $typenow ) { |
|
| 80 | + $post_type = $typenow; |
|
| 81 | + } elseif ( $current_screen && $current_screen->post_type ) { |
|
| 82 | + $post_type = $current_screen->post_type; |
|
| 83 | + } elseif ( isset( $_REQUEST['post_type'] ) ) { |
|
| 84 | + $post_type = sanitize_key( $_REQUEST['post_type'] ); |
|
| 85 | + } elseif ( isset( $_REQUEST['post'] ) ) { |
|
| 86 | + $post_type = get_post_type( sanitize_key( $_REQUEST['post'] ) ); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - if ( false !== $post_type ) { |
|
| 90 | - $fields[] = array( |
|
| 91 | - 'id' => 'activity_title', |
|
| 92 | - 'name' => 'Activities', |
|
| 93 | - 'type' => 'title', |
|
| 94 | - 'cols' => 12, |
|
| 95 | - ); |
|
| 96 | - $fields[] = array( |
|
| 97 | - 'id' => 'activity_to_' . $post_type, |
|
| 98 | - 'name' => 'Activities related with this ' . $post_type, |
|
| 99 | - 'type' => 'post_select', |
|
| 100 | - 'use_ajax' => false, |
|
| 101 | - 'query' => array( |
|
| 102 | - 'post_type' => 'activity', |
|
| 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 | - } |
|
| 89 | + if ( false !== $post_type ) { |
|
| 90 | + $fields[] = array( |
|
| 91 | + 'id' => 'activity_title', |
|
| 92 | + 'name' => 'Activities', |
|
| 93 | + 'type' => 'title', |
|
| 94 | + 'cols' => 12, |
|
| 95 | + ); |
|
| 96 | + $fields[] = array( |
|
| 97 | + 'id' => 'activity_to_' . $post_type, |
|
| 98 | + 'name' => 'Activities related with this ' . $post_type, |
|
| 99 | + 'type' => 'post_select', |
|
| 100 | + 'use_ajax' => false, |
|
| 101 | + 'query' => array( |
|
| 102 | + 'post_type' => 'activity', |
|
| 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_Activities_Admin(); |