Passed
Push — master ( fbc7e7...8923a7 )
by Chris
03:02
created
to-vehicles.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
 // If this file is called directly, abort.
16 16
 if ( ! defined( 'WPINC' ) ) {
17
-	die;
17
+     die;
18 18
 }
19 19
 
20 20
 define( 'LSX_TO_VEHICLES_PATH', plugin_dir_path( __FILE__ ) );
Please login to merge, or discard this patch.
includes/template-tags.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * @category    content
15 15
  */
16 16
 function lsx_vehicle_content( $slug, $name = null ) {
17
-	do_action( 'lsx_vehicle_content', $slug, $name );
17
+     do_action( 'lsx_vehicle_content', $slug, $name );
18 18
 }
19 19
 
20 20
 /* ================  VEHICLES =========================== */
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
  * @category    vehicle
32 32
  */
33 33
 function lsx_vehicle_code( $before = '', $after = '', $echo = true ) {
34
-	lsx_to_custom_field_query( 'code', $before, $after, $echo );
34
+     lsx_to_custom_field_query( 'code', $before, $after, $echo );
35 35
 }
36 36
 /**
37 37
  * Outputs the current vehicles vehicle_type.
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
  * @category    vehicle
47 47
  */
48 48
 function lsx_vehicle_type( $before = '', $after = '', $echo = true ) {
49
-	lsx_to_custom_field_query( 'vehicle_type', $before, $after, $echo );
49
+     lsx_to_custom_field_query( 'vehicle_type', $before, $after, $echo );
50 50
 }
51 51
 /**
52 52
  * Outputs the current vehicles price.
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
  * @category    vehicle
62 62
  */
63 63
 function lsx_vehicle_price( $before = '', $after = '', $echo = true ) {
64
-	lsx_to_custom_field_query( 'price', $before, $after, $echo );
64
+     lsx_to_custom_field_query( 'price', $before, $after, $echo );
65 65
 }
66 66
 /**
67 67
  * Outputs the current vehicles engine_type.
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
  * @category    vehicle
77 77
  */
78 78
 function lsx_vehicle_engine_type( $before = '', $after = '', $echo = true ) {
79
-	lsx_to_custom_field_query( 'engine_type', $before, $after, $echo );
79
+     lsx_to_custom_field_query( 'engine_type', $before, $after, $echo );
80 80
 }
81 81
 /**
82 82
  * Outputs the current vehicles gearbox.
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
  * @category    vehicle
92 92
  */
93 93
 function lsx_vehicle_gearbox( $before = '', $after = '', $echo = true ) {
94
-	lsx_to_custom_field_query( 'gearbox', $before, $after, $echo );
94
+     lsx_to_custom_field_query( 'gearbox', $before, $after, $echo );
95 95
 }
96 96
 /**
97 97
  * Outputs the current vehicles engine_size.
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
  * @category    vehicle
107 107
  */
108 108
 function lsx_vehicle_engine_size( $before = '', $after = '', $echo = true ) {
109
-	lsx_to_custom_field_query( 'engine_size', $before, $after, $echo );
109
+     lsx_to_custom_field_query( 'engine_size', $before, $after, $echo );
110 110
 }
111 111
 /**
112 112
  * Outputs the current vehicles gears.
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
  * @category    vehicle
122 122
  */
123 123
 function lsx_vehicle_gears( $before = '', $after = '', $echo = true ) {
124
-	lsx_to_custom_field_query( 'gears', $before, $after, $echo );
124
+     lsx_to_custom_field_query( 'gears', $before, $after, $echo );
125 125
 }
126 126
 /**
127 127
  * Outputs the current vehicles seating.
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
  * @category    vehicle
137 137
  */
138 138
 function lsx_vehicle_seating( $before = '', $after = '', $echo = true ) {
139
-	lsx_to_custom_field_query( 'seating', $before, $after, $echo );
139
+     lsx_to_custom_field_query( 'seating', $before, $after, $echo );
140 140
 }
141 141
 
142 142
 /**
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
  * @category    vehicle
149 149
  */
150 150
 function lsx_has_vehicle_features() {
151
-	return lsx_to_has_custom_field_query( 'features', get_the_ID() );
151
+     return lsx_to_has_custom_field_query( 'features', get_the_ID() );
152 152
 }
153 153
 /**
154 154
  * Outputs the Vehicles Custom Fields on the Single Vehicle Templates
@@ -158,9 +158,9 @@  discard block
 block discarded – undo
158 158
  * @category    vehicle
159 159
  */
160 160
 function lsx_vehicle_features() {
161
-	if ( is_singular( 'vehicle' ) ) {
162
-		$features = lsx_to_custom_field_query( 'features', '', '', false );
163
-		if ( null !== $features ) { ?>
161
+     if ( is_singular( 'vehicle' ) ) {
162
+          $features = lsx_to_custom_field_query( 'features', '', '', false );
163
+          if ( null !== $features ) { ?>
164 164
 			<section id="features">
165 165
 				<div class="row">						
166 166
 					<?php if ( null !== $features ) { ?>
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 							<h3 class="section-title"><?php esc_html_e( 'Features', 'to-vehicles' ); ?></h3>
169 169
 							<div class="entry-content">
170 170
 								<?php
171
-									$the_feature = apply_filters( 'the_content', $features );
172
-								?>
171
+                                             $the_feature = apply_filters( 'the_content', $features );
172
+                                        ?>
173 173
 								<?php echo wp_kses_post( $the_feature ); ?>
174 174
 							</div>
175 175
 						</div>
@@ -177,8 +177,8 @@  discard block
 block discarded – undo
177 177
 				</div>
178 178
 			</section>
179 179
 			<?php
180
-		}
181
-	}
180
+          }
181
+     }
182 182
 }
183 183
 
184 184
 /**
@@ -189,17 +189,17 @@  discard block
 block discarded – undo
189 189
  * @category    vehicle
190 190
  */
191 191
 function lsx_vehicle_accommodation() {
192
-	global $lsx_archive;
193
-	if ( post_type_exists( 'accommodation' ) && is_singular( 'vehicle' ) ) {
194
-		$args = array(
195
-			'from'   => 'accommodation',
196
-			'to'     => 'vehicle',
197
-			'column' => '3',
198
-			'before' => '<section id="accommodation"><h2 class="section-title">' . lsx_to_get_post_type_section_title( 'accommodation', '', 'Featured Accommodations' ) . '</h2>',
199
-			'after'  => '</section>',
200
-		);
201
-		lsx_to_connected_panel_query( $args );
202
-	}
192
+     global $lsx_archive;
193
+     if ( post_type_exists( 'accommodation' ) && is_singular( 'vehicle' ) ) {
194
+          $args = array(
195
+               'from'   => 'accommodation',
196
+               'to'     => 'vehicle',
197
+               'column' => '3',
198
+               'before' => '<section id="accommodation"><h2 class="section-title">' . lsx_to_get_post_type_section_title( 'accommodation', '', 'Featured Accommodations' ) . '</h2>',
199
+               'after'  => '</section>',
200
+          );
201
+          lsx_to_connected_panel_query( $args );
202
+     }
203 203
 }
204 204
 
205 205
 /**
@@ -210,19 +210,19 @@  discard block
 block discarded – undo
210 210
  * @category 	vehicle
211 211
  */
212 212
 function lsx_to_destination_vehicles() {
213
-	global $lsx_archive;
213
+     global $lsx_archive;
214 214
 
215
-	if ( post_type_exists( 'vehicle' ) && is_singular( 'destination' ) ) {
216
-		$args = array(
217
-			'from'		=> 'vehicle',
218
-			'to'		=> 'destination',
219
-			'column'	=> '3',
220
-			'before'	=> '<section id="vehicle" 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-special">' . lsx_to_get_post_type_section_title( 'vehicle', '', __( 'Featured Vehicles', 'to-vehicles' ) ) . '</h2><div id="collapse-vehicle" class="collapse in"><div class="collapse-inner">',
221
-			'after'		=> '</div></div></section>',
222
-		);
215
+     if ( post_type_exists( 'vehicle' ) && is_singular( 'destination' ) ) {
216
+          $args = array(
217
+               'from'		=> 'vehicle',
218
+               'to'		=> 'destination',
219
+               'column'	=> '3',
220
+               'before'	=> '<section id="vehicle" 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-special">' . lsx_to_get_post_type_section_title( 'vehicle', '', __( 'Featured Vehicles', 'to-vehicles' ) ) . '</h2><div id="collapse-vehicle" class="collapse in"><div class="collapse-inner">',
221
+               'after'		=> '</div></div></section>',
222
+          );
223 223
 
224
-		lsx_to_connected_panel_query( $args );
225
-	}
224
+          lsx_to_connected_panel_query( $args );
225
+     }
226 226
 }
227 227
 
228 228
 /**
@@ -233,15 +233,15 @@  discard block
 block discarded – undo
233 233
  * @category    vehicle
234 234
  */
235 235
 function lsx_vehicle_tours() {
236
-	global $lsx_archive;
237
-	if ( post_type_exists( 'tour' ) && is_singular( 'vehicle' ) ) {
238
-		$args = array(
239
-			'from'   => 'tour',
240
-			'to'     => 'vehicle',
241
-			'column' => '3',
242
-			'before' => '<section id="tours"><h2 class="section-title">' . lsx_to_get_post_type_section_title( 'tour', '', 'Featured Tours' ) . '</h2>',
243
-			'after'  => '</section>',
244
-		);
245
-		lsx_to_connected_panel_query( $args );
246
-	}
236
+     global $lsx_archive;
237
+     if ( post_type_exists( 'tour' ) && is_singular( 'vehicle' ) ) {
238
+          $args = array(
239
+               'from'   => 'tour',
240
+               'to'     => 'vehicle',
241
+               'column' => '3',
242
+               'before' => '<section id="tours"><h2 class="section-title">' . lsx_to_get_post_type_section_title( 'tour', '', 'Featured Tours' ) . '</h2>',
243
+               'after'  => '</section>',
244
+          );
245
+          lsx_to_connected_panel_query( $args );
246
+     }
247 247
 }
Please login to merge, or discard this patch.
templates/content-widget-vehicle.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 $permalink = '';
13 13
 
14 14
 if ( $has_single ) {
15
-	$permalink = get_the_permalink();
15
+     $permalink = get_the_permalink();
16 16
 } elseif ( ! is_post_type_archive( 'vehicle' ) ) {
17
-	$has_single = true;
18
-	$permalink = get_post_type_archive_link( 'vehicle' ) . '#vehicle-' . $post->post_name;
17
+     $has_single = true;
18
+     $permalink = get_post_type_archive_link( 'vehicle' ) . '#vehicle-' . $post->post_name;
19 19
 }
20 20
 ?>
21 21
 <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 
45 45
 		<div class="lsx-to-widget-meta-data">
46 46
 			<?php
47
-				$meta_class = 'lsx-to-meta-data lsx-to-meta-data-';
48
-			?>
47
+                    $meta_class = 'lsx-to-meta-data lsx-to-meta-data-';
48
+               ?>
49 49
 			<?php if ( false !== get_post_meta( get_the_ID(), 'vehicle_type', true ) ) { ?>
50 50
 				<div <?php echo 'class="' . esc_html( $meta_class ) . 'type"'; ?>><span class="lsx-to-meta-data-key"><?php esc_html_e( 'Type', 'to-vehicles' ); ?>:</span> <?php echo esc_attr( get_post_meta( get_the_ID(), 'vehicle_type', true ) ); ?></div>
51 51
 			<?php } ?>
@@ -57,19 +57,19 @@  discard block
 block discarded – undo
57 57
 			<?php } ?>
58 58
 		</div>
59 59
 		<?php
60
-			ob_start();
61
-			lsx_to_widget_entry_content_top();
62
-			the_excerpt();
63
-			lsx_to_widget_entry_content_bottom();
64
-			$excerpt = ob_get_clean();
60
+               ob_start();
61
+               lsx_to_widget_entry_content_top();
62
+               the_excerpt();
63
+               lsx_to_widget_entry_content_bottom();
64
+               $excerpt = ob_get_clean();
65 65
 
66
-			if ( empty( $disable_text ) && ! empty( $excerpt ) ) {
67
-				echo wp_kses_post( $excerpt );
68
-			} elseif ( $has_single ) { ?>
66
+               if ( empty( $disable_text ) && ! empty( $excerpt ) ) {
67
+                    echo wp_kses_post( $excerpt );
68
+               } elseif ( $has_single ) { ?>
69 69
 				<p><a href="<?php echo esc_url( $permalink ); ?>" class="moretag"><?php esc_html_e( 'View more', 'tour-operator' ); ?></a></p>
70 70
 			<?php
71
-		}
72
-		?>
71
+          }
72
+          ?>
73 73
 		<?php lsx_widget_entry_content_bottom(); ?>
74 74
 	</div>	
75 75
 	<?php lsx_widget_entry_bottom(); ?>
Please login to merge, or discard this patch.
templates/archive-vehicle.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,4 +53,4 @@
 block discarded – undo
53 53
 <?php get_sidebar(); ?>
54 54
 
55 55
 <?php
56
-	get_footer();
56
+     get_footer();
Please login to merge, or discard this patch.
templates/content-vehicle.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 global $lsx_archive, $lsx_to_archive, $post;
10 10
 
11 11
 if ( 1 !== $lsx_archive ) {
12
-	$lsx_archive = false;
12
+     $lsx_archive = false;
13 13
 }
14 14
 ?>
15 15
 
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 				<h3 class="lsx-to-archive-content-title">
30 30
 					<a href="<?php the_permalink(); ?>" title="<?php esc_html_e( 'Read more', 'tour-operator' ); ?>">
31 31
 						<?php
32
-						the_title();
33
-						do_action( 'lsx_to_the_title_end', get_the_ID() );
34
-						?>
32
+                              the_title();
33
+                              do_action( 'lsx_to_the_title_end', get_the_ID() );
34
+                              ?>
35 35
 					</a>
36 36
 				</h3>
37 37
 				<!-- .entry-header -->
@@ -83,14 +83,14 @@  discard block
 block discarded – undo
83 83
 							<?php if ( lsx_to_has_enquiry_contact() ) : ?>
84 84
 								<div class="lsx-to-contact-widget">
85 85
 									<?php
86
-									if ( function_exists( 'lsx_to_has_team_member' ) && lsx_to_has_team_member() ) {
87
-										lsx_to_team_member_panel( '<div class="lsx-to-contact">', '</div>' );
88
-									} else {
89
-										lsx_to_enquiry_contact( '<div class="lsx-to-contact">', '</div>' );
90
-									}
86
+                                             if ( function_exists( 'lsx_to_has_team_member' ) && lsx_to_has_team_member() ) {
87
+                                                  lsx_to_team_member_panel( '<div class="lsx-to-contact">', '</div>' );
88
+                                             } else {
89
+                                                  lsx_to_enquiry_contact( '<div class="lsx-to-contact">', '</div>' );
90
+                                             }
91 91
 
92
-									lsx_to_enquire_modal();
93
-									?>
92
+                                             lsx_to_enquire_modal();
93
+                                             ?>
94 94
 								</div>
95 95
 							<?php endif ?>
96 96
 						</div>
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
 	<?php } ?>
122 122
 
123 123
 		<?php
124
-		/**
125
-		 * Hooked
126
-		 *
127
-		 *  - lsx_vehicle_metabox() - 10
128
-		 */
129
-		lsx_entry_bottom();
130
-		?>
124
+          /**
125
+           * Hooked
126
+           *
127
+           *  - lsx_vehicle_metabox() - 10
128
+           */
129
+          lsx_entry_bottom();
130
+          ?>
131 131
 
132 132
 	</article><!-- #post-## -->
133 133
 
Please login to merge, or discard this patch.
classes/class-lsx-to-vehicles.php 1 patch
Indentation   +227 added lines, -227 removed lines patch added patch discarded remove patch
@@ -9,231 +9,231 @@
 block discarded – undo
9 9
  * @copyright 2016 LightSpeedDevelopment
10 10
  */
11 11
 if ( ! class_exists( 'LSX_TO_Vehicles' ) ) {
12
-	/**
13
-	 * Main plugin class.
14
-	 *
15
-	 * @package LSX_TO_Vehicles
16
-	 * @author  LightSpeed
17
-	 */
18
-	class LSX_TO_Vehicles {
19
-
20
-		/**
21
-		 * The plugins id
22
-		 */
23
-		public $plugin_slug = 'to-vehicles';
24
-
25
-		/**
26
-		 * The post types the plugin registers
27
-		 */
28
-		public $post_types = false;
29
-
30
-		/**
31
-		 * The singular post types the plugin registers
32
-		 */
33
-		public $post_types_singular = false;
34
-
35
-		/**
36
-		 * An array of the post types slugs plugin registers
37
-		 */
38
-		public $post_type_slugs = false;
39
-
40
-		/**
41
-		 * The taxonomies the plugin registers
42
-		 */
43
-		public $taxonomies = false;
44
-
45
-		/**
46
-		 * The taxonomies the plugin registers (plural)
47
-		 */
48
-		public $taxonomies_plural = false;
49
-
50
-		/**
51
-		 * Constructor
52
-		 */
53
-		public function __construct() {
54
-			//Set the variables
55
-			$this->set_vars();
56
-			$this->lsx_to_search_integration();
57
-
58
-			// Make TO last plugin to load
59
-			add_action( 'activated_plugin', array( $this, 'activated_plugin' ) );
60
-
61
-			add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
62
-
63
-			if ( false !== $this->post_types ) {
64
-				add_filter( 'lsx_to_framework_post_types', array( $this, 'post_types_filter' ) );
65
-				add_filter( 'lsx_to_post_types', array( $this, 'post_types_filter' ) );
66
-				add_filter( 'lsx_to_post_types_singular', array( $this, 'post_types_singular_filter' ) );
67
-				add_filter( 'lsx_to_settings_path', array( $this, 'plugin_path' ), 10, 2 );
68
-			}
69
-			if ( false !== $this->taxonomies ) {
70
-				add_filter( 'lsx_to_framework_taxonomies', array( $this, 'taxonomies_filter' ) );
71
-				add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'taxonomies_plural_filter' ) );
72
-			}
73
-
74
-			require_once( LSX_TO_VEHICLES_PATH . '/classes/class-lsx-to-vehicles-admin.php' );
75
-			require_once( LSX_TO_VEHICLES_PATH . '/classes/class-lsx-to-vehicles-frontend.php' );
76
-			require_once( LSX_TO_VEHICLES_PATH . '/includes/template-tags.php' );
77
-
78
-			// flush_rewrite_rules()
79
-			register_activation_hook( LSX_TO_VEHICLES_CORE, array( $this, 'register_activation_hook' ) );
80
-			add_action( 'admin_init', array( $this, 'register_activation_hook_check' ) );
81
-		}
82
-
83
-		/**
84
-		 * Include the post type for the search integration
85
-		 */
86
-		public function lsx_to_search_integration() {
87
-			add_filter( 'lsx_to_search_post_types', array( $this, 'post_types_filter' ) );
88
-			add_filter( 'lsx_to_search_taxonomies', array( $this, 'taxonomies_filter' ) );
89
-		}
90
-
91
-		/**
92
-		 * Load the plugin text domain for translation.
93
-		 */
94
-		public function load_plugin_textdomain() {
95
-			load_plugin_textdomain( 'to-vehicles', false, basename( LSX_TO_VEHICLES_PATH ) . '/languages' );
96
-		}
97
-
98
-		/**
99
-		 * Sets the plugins variables
100
-		 */
101
-		public function set_vars() {
102
-			$this->post_types = array(
103
-				'vehicle' => __( 'Vehicles', 'to-vehicles' ),
104
-			);
105
-			$this->post_types_singular = array(
106
-				'vehicle' => __( 'Vehicle', 'to-vehicles' ),
107
-			);
108
-			$this->post_type_slugs = array_keys( $this->post_types );
109
-		}
110
-
111
-		/**
112
-		 * Adds our post types to an array via a filter
113
-		 */
114
-		public function plugin_path( $path, $post_type ) {
115
-			if ( false !== $this->post_types && array_key_exists( $post_type, $this->post_types ) ) {
116
-				$path = LSX_TO_VEHICLES_PATH;
117
-			}
118
-			return $path;
119
-		}
120
-
121
-		/**
122
-		 * Adds our post types to an array via a filter
123
-		 */
124
-		public function post_types_slugs_filter( $post_types ) {
125
-			if ( is_array( $post_types ) ) {
126
-				$post_types = array_merge( $post_types, $this->post_type_slugs );
127
-			} else {
128
-				$post_types = $this->post_type_slugs;
129
-			}
130
-			return $post_types;
131
-		}
132
-
133
-		/**
134
-		 * Adds our post types to an array via a filter
135
-		 */
136
-		public function post_types_filter( $post_types ) {
137
-			if ( is_array( $post_types ) && is_array( $this->post_types ) ) {
138
-				$post_types = array_merge( $post_types, $this->post_types );
139
-			} elseif ( is_array( $this->post_types ) ) {
140
-				$post_types = $this->post_types;
141
-			}
142
-			return $post_types;
143
-		}
144
-
145
-		/**
146
-		 * Adds our post types to an array via a filter
147
-		 */
148
-		public function post_types_singular_filter( $post_types_singular ) {
149
-			if ( is_array( $post_types_singular ) && is_array( $this->post_types_singular ) ) {
150
-				$post_types_singular = array_merge( $post_types_singular, $this->post_types_singular );
151
-			} elseif ( is_array( $this->post_types_singular ) ) {
152
-				$post_types_singular = $this->post_types_singular;
153
-			}
154
-			return $post_types_singular;
155
-		}
156
-
157
-		/**
158
-		 * Adds our taxonomies to an array via a filter
159
-		 */
160
-		public function taxonomies_filter( $taxonomies ) {
161
-			if ( is_array( $taxonomies ) && is_array( $this->taxonomies ) ) {
162
-				$taxonomies = array_merge( $taxonomies, $this->taxonomies );
163
-			} elseif ( is_array( $this->taxonomies ) ) {
164
-				$taxonomies = $this->taxonomies;
165
-			}
166
-			return $taxonomies;
167
-		}
168
-
169
-		/**
170
-		 * Adds our taxonomies_plural to an array via a filter
171
-		 */
172
-		public function taxonomies_plural_filter( $taxonomies_plural ) {
173
-			if ( is_array( $taxonomies_plural ) && is_array( $this->taxonomies_plural ) ) {
174
-				$taxonomies_plural = array_merge( $taxonomies_plural, $this->taxonomies_plural );
175
-			} elseif ( is_array( $this->taxonomies_plural ) ) {
176
-				$taxonomies_plural = $this->taxonomies_plural;
177
-			}
178
-			return $taxonomies_plural;
179
-		}
180
-
181
-		/**
182
-		 * Make TO last plugin to load.
183
-		 */
184
-		public function activated_plugin() {
185
-			if ( get_option( 'active_plugins' ) === $plugins ) {
186
-				$search = preg_grep( '/.*\/tour-operator\.php/', $plugins );
187
-				$key = array_search( $search, $plugins );
188
-
189
-				if ( is_array( $search ) && count( $search ) ) {
190
-					foreach ( $search as $key => $path ) {
191
-						array_splice( $plugins, $key, 1 );
192
-						array_push( $plugins, $path );
193
-						update_option( 'active_plugins', $plugins );
194
-					}
195
-				}
196
-			}
197
-		}
198
-
199
-		/**
200
-		 * On plugin activation
201
-		 */
202
-		public function register_activation_hook() {
203
-			if ( ! is_network_admin() && ! isset( $_GET['activate-multi'] ) ) {
204
-				set_transient( '_tour_operators_vehicles_flush_rewrite_rules', 1, 30 );
205
-			}
206
-		}
207
-
208
-		/**
209
-		 * On plugin activation (check)
210
-		 */
211
-		public function register_activation_hook_check() {
212
-			if ( ! get_transient( '_tour_operators_vehicles_flush_rewrite_rules' ) ) {
213
-				return;
214
-			}
215
-
216
-			delete_transient( '_tour_operators_vehicles_flush_rewrite_rules' );
217
-			flush_rewrite_rules();
218
-		}
219
-
220
-		/**
221
-		 * Enabled banners for the additional post types
222
-		 *
223
-		 * @package    theme
224
-		 * @subpackage setup
225
-		 * @category   banners
226
-		 *
227
-		 * @param   $post_types array()
228
-		 * @return  $post_types array()
229
-		 */
230
-		function theme_allowed_post_type_banners( $post_types ) {
231
-			$post_types[] = 'summary';
232
-			$post_types[] = 'gallery';
233
-			$post_types[] = 'video';
234
-			return $post_types;
235
-		}
236
-
237
-	}
238
-	new LSX_TO_Vehicles();
12
+     /**
13
+      * Main plugin class.
14
+      *
15
+      * @package LSX_TO_Vehicles
16
+      * @author  LightSpeed
17
+      */
18
+     class LSX_TO_Vehicles {
19
+
20
+          /**
21
+           * The plugins id
22
+           */
23
+          public $plugin_slug = 'to-vehicles';
24
+
25
+          /**
26
+           * The post types the plugin registers
27
+           */
28
+          public $post_types = false;
29
+
30
+          /**
31
+           * The singular post types the plugin registers
32
+           */
33
+          public $post_types_singular = false;
34
+
35
+          /**
36
+           * An array of the post types slugs plugin registers
37
+           */
38
+          public $post_type_slugs = false;
39
+
40
+          /**
41
+           * The taxonomies the plugin registers
42
+           */
43
+          public $taxonomies = false;
44
+
45
+          /**
46
+           * The taxonomies the plugin registers (plural)
47
+           */
48
+          public $taxonomies_plural = false;
49
+
50
+          /**
51
+           * Constructor
52
+           */
53
+          public function __construct() {
54
+               //Set the variables
55
+               $this->set_vars();
56
+               $this->lsx_to_search_integration();
57
+
58
+               // Make TO last plugin to load
59
+               add_action( 'activated_plugin', array( $this, 'activated_plugin' ) );
60
+
61
+               add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
62
+
63
+               if ( false !== $this->post_types ) {
64
+                    add_filter( 'lsx_to_framework_post_types', array( $this, 'post_types_filter' ) );
65
+                    add_filter( 'lsx_to_post_types', array( $this, 'post_types_filter' ) );
66
+                    add_filter( 'lsx_to_post_types_singular', array( $this, 'post_types_singular_filter' ) );
67
+                    add_filter( 'lsx_to_settings_path', array( $this, 'plugin_path' ), 10, 2 );
68
+               }
69
+               if ( false !== $this->taxonomies ) {
70
+                    add_filter( 'lsx_to_framework_taxonomies', array( $this, 'taxonomies_filter' ) );
71
+                    add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'taxonomies_plural_filter' ) );
72
+               }
73
+
74
+               require_once( LSX_TO_VEHICLES_PATH . '/classes/class-lsx-to-vehicles-admin.php' );
75
+               require_once( LSX_TO_VEHICLES_PATH . '/classes/class-lsx-to-vehicles-frontend.php' );
76
+               require_once( LSX_TO_VEHICLES_PATH . '/includes/template-tags.php' );
77
+
78
+               // flush_rewrite_rules()
79
+               register_activation_hook( LSX_TO_VEHICLES_CORE, array( $this, 'register_activation_hook' ) );
80
+               add_action( 'admin_init', array( $this, 'register_activation_hook_check' ) );
81
+          }
82
+
83
+          /**
84
+           * Include the post type for the search integration
85
+           */
86
+          public function lsx_to_search_integration() {
87
+               add_filter( 'lsx_to_search_post_types', array( $this, 'post_types_filter' ) );
88
+               add_filter( 'lsx_to_search_taxonomies', array( $this, 'taxonomies_filter' ) );
89
+          }
90
+
91
+          /**
92
+           * Load the plugin text domain for translation.
93
+           */
94
+          public function load_plugin_textdomain() {
95
+               load_plugin_textdomain( 'to-vehicles', false, basename( LSX_TO_VEHICLES_PATH ) . '/languages' );
96
+          }
97
+
98
+          /**
99
+           * Sets the plugins variables
100
+           */
101
+          public function set_vars() {
102
+               $this->post_types = array(
103
+                    'vehicle' => __( 'Vehicles', 'to-vehicles' ),
104
+               );
105
+               $this->post_types_singular = array(
106
+                    'vehicle' => __( 'Vehicle', 'to-vehicles' ),
107
+               );
108
+               $this->post_type_slugs = array_keys( $this->post_types );
109
+          }
110
+
111
+          /**
112
+           * Adds our post types to an array via a filter
113
+           */
114
+          public function plugin_path( $path, $post_type ) {
115
+               if ( false !== $this->post_types && array_key_exists( $post_type, $this->post_types ) ) {
116
+                    $path = LSX_TO_VEHICLES_PATH;
117
+               }
118
+               return $path;
119
+          }
120
+
121
+          /**
122
+           * Adds our post types to an array via a filter
123
+           */
124
+          public function post_types_slugs_filter( $post_types ) {
125
+               if ( is_array( $post_types ) ) {
126
+                    $post_types = array_merge( $post_types, $this->post_type_slugs );
127
+               } else {
128
+                    $post_types = $this->post_type_slugs;
129
+               }
130
+               return $post_types;
131
+          }
132
+
133
+          /**
134
+           * Adds our post types to an array via a filter
135
+           */
136
+          public function post_types_filter( $post_types ) {
137
+               if ( is_array( $post_types ) && is_array( $this->post_types ) ) {
138
+                    $post_types = array_merge( $post_types, $this->post_types );
139
+               } elseif ( is_array( $this->post_types ) ) {
140
+                    $post_types = $this->post_types;
141
+               }
142
+               return $post_types;
143
+          }
144
+
145
+          /**
146
+           * Adds our post types to an array via a filter
147
+           */
148
+          public function post_types_singular_filter( $post_types_singular ) {
149
+               if ( is_array( $post_types_singular ) && is_array( $this->post_types_singular ) ) {
150
+                    $post_types_singular = array_merge( $post_types_singular, $this->post_types_singular );
151
+               } elseif ( is_array( $this->post_types_singular ) ) {
152
+                    $post_types_singular = $this->post_types_singular;
153
+               }
154
+               return $post_types_singular;
155
+          }
156
+
157
+          /**
158
+           * Adds our taxonomies to an array via a filter
159
+           */
160
+          public function taxonomies_filter( $taxonomies ) {
161
+               if ( is_array( $taxonomies ) && is_array( $this->taxonomies ) ) {
162
+                    $taxonomies = array_merge( $taxonomies, $this->taxonomies );
163
+               } elseif ( is_array( $this->taxonomies ) ) {
164
+                    $taxonomies = $this->taxonomies;
165
+               }
166
+               return $taxonomies;
167
+          }
168
+
169
+          /**
170
+           * Adds our taxonomies_plural to an array via a filter
171
+           */
172
+          public function taxonomies_plural_filter( $taxonomies_plural ) {
173
+               if ( is_array( $taxonomies_plural ) && is_array( $this->taxonomies_plural ) ) {
174
+                    $taxonomies_plural = array_merge( $taxonomies_plural, $this->taxonomies_plural );
175
+               } elseif ( is_array( $this->taxonomies_plural ) ) {
176
+                    $taxonomies_plural = $this->taxonomies_plural;
177
+               }
178
+               return $taxonomies_plural;
179
+          }
180
+
181
+          /**
182
+           * Make TO last plugin to load.
183
+           */
184
+          public function activated_plugin() {
185
+               if ( get_option( 'active_plugins' ) === $plugins ) {
186
+                    $search = preg_grep( '/.*\/tour-operator\.php/', $plugins );
187
+                    $key = array_search( $search, $plugins );
188
+
189
+                    if ( is_array( $search ) && count( $search ) ) {
190
+                         foreach ( $search as $key => $path ) {
191
+                              array_splice( $plugins, $key, 1 );
192
+                              array_push( $plugins, $path );
193
+                              update_option( 'active_plugins', $plugins );
194
+                         }
195
+                    }
196
+               }
197
+          }
198
+
199
+          /**
200
+           * On plugin activation
201
+           */
202
+          public function register_activation_hook() {
203
+               if ( ! is_network_admin() && ! isset( $_GET['activate-multi'] ) ) {
204
+                    set_transient( '_tour_operators_vehicles_flush_rewrite_rules', 1, 30 );
205
+               }
206
+          }
207
+
208
+          /**
209
+           * On plugin activation (check)
210
+           */
211
+          public function register_activation_hook_check() {
212
+               if ( ! get_transient( '_tour_operators_vehicles_flush_rewrite_rules' ) ) {
213
+                    return;
214
+               }
215
+
216
+               delete_transient( '_tour_operators_vehicles_flush_rewrite_rules' );
217
+               flush_rewrite_rules();
218
+          }
219
+
220
+          /**
221
+           * Enabled banners for the additional post types
222
+           *
223
+           * @package    theme
224
+           * @subpackage setup
225
+           * @category   banners
226
+           *
227
+           * @param   $post_types array()
228
+           * @return  $post_types array()
229
+           */
230
+          function theme_allowed_post_type_banners( $post_types ) {
231
+               $post_types[] = 'summary';
232
+               $post_types[] = 'gallery';
233
+               $post_types[] = 'video';
234
+               return $post_types;
235
+          }
236
+
237
+     }
238
+     new LSX_TO_Vehicles();
239 239
 }
Please login to merge, or discard this patch.
classes/class-lsx-to-vehicles-admin.php 1 patch
Indentation   +420 added lines, -420 removed lines patch added patch discarded remove patch
@@ -18,446 +18,446 @@
 block discarded – undo
18 18
 
19 19
 class LSX_TO_Vehicles_Admin extends LSX_TO_Vehicles {
20 20
 
21
-	/**
22
-	 * Constructor
23
-	 */
24
-	public function __construct() {
25
-		add_action( 'init', array( $this, 'register_post_types' ) );
26
-		add_filter( 'cmb_meta_boxes', array( $this, 'register_metaboxes' ) );
21
+     /**
22
+      * Constructor
23
+      */
24
+     public function __construct() {
25
+          add_action( 'init', array( $this, 'register_post_types' ) );
26
+          add_filter( 'cmb_meta_boxes', array( $this, 'register_metaboxes' ) );
27 27
 
28
-		//add_filter( 'lsx_get_post-types_configs', array( $this, 'post_type_config' ), 10, 1 );
29
-		//add_filter( 'lsx_get_metaboxes_configs', array( $this, 'meta_box_config' ), 10, 1 );
28
+          //add_filter( 'lsx_get_post-types_configs', array( $this, 'post_type_config' ), 10, 1 );
29
+          //add_filter( 'lsx_get_metaboxes_configs', array( $this, 'meta_box_config' ), 10, 1 );
30 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' ) );
34
-		add_filter( 'lsx_to_team_custom_fields', array( $this, 'custom_fields' ) );
35
-		add_filter( 'lsx_to_special_custom_fields', array( $this, 'custom_fields' ) );
36
-		add_filter( 'lsx_to_activity_custom_fields', array( $this, 'custom_fields' ) );
37
-	}
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
+          add_filter( 'lsx_to_team_custom_fields', array( $this, 'custom_fields' ) );
35
+          add_filter( 'lsx_to_special_custom_fields', array( $this, 'custom_fields' ) );
36
+          add_filter( 'lsx_to_activity_custom_fields', array( $this, 'custom_fields' ) );
37
+     }
38 38
 
39
-	/**
40
-	 * Register the activity post type config
41
-	 *
42
-	 * @param  $objects
43
-	 * @return   array
44
-	 */
45
-	public function post_type_config( $objects ) {
39
+     /**
40
+      * Register the activity post type config
41
+      *
42
+      * @param  $objects
43
+      * @return   array
44
+      */
45
+     public function post_type_config( $objects ) {
46 46
 
47
-		foreach ( $this->post_types as $key => $label ) {
48
-			if ( file_exists( LSX_TO_VEHICLES_PATH . 'includes/post-types/config-' . $key . '.php' ) ) {
49
-				$objects[ $key ] = include LSX_TO_VEHICLES_PATH . 'includes/post-types/config-' . $key . '.php';
50
-			}
51
-		}
47
+          foreach ( $this->post_types as $key => $label ) {
48
+               if ( file_exists( LSX_TO_VEHICLES_PATH . 'includes/post-types/config-' . $key . '.php' ) ) {
49
+                    $objects[ $key ] = include LSX_TO_VEHICLES_PATH . 'includes/post-types/config-' . $key . '.php';
50
+               }
51
+          }
52 52
 
53
-		return 	$objects;
54
-	}
53
+          return 	$objects;
54
+     }
55 55
 
56
-	/**
57
-	 * Register the activity metabox config
58
-	 *
59
-	 * @param  $meta_boxes
60
-	 * @return   array
61
-	 */
62
-	public function meta_box_config( $meta_boxes ) {
63
-		foreach ( $this->post_types as $key => $label ) {
64
-			if ( file_exists( LSX_TO_VEHICLES_PATH . 'includes/metaboxes/config-' . $key . '.php' ) ) {
65
-				$meta_boxes[ $key ] = include LSX_TO_VEHICLES_PATH . 'includes/metaboxes/config-' . $key . '.php';
66
-			}
67
-		}
68
-		return 	$meta_boxes;
69
-	}
56
+     /**
57
+      * Register the activity metabox config
58
+      *
59
+      * @param  $meta_boxes
60
+      * @return   array
61
+      */
62
+     public function meta_box_config( $meta_boxes ) {
63
+          foreach ( $this->post_types as $key => $label ) {
64
+               if ( file_exists( LSX_TO_VEHICLES_PATH . 'includes/metaboxes/config-' . $key . '.php' ) ) {
65
+                    $meta_boxes[ $key ] = include LSX_TO_VEHICLES_PATH . 'includes/metaboxes/config-' . $key . '.php';
66
+               }
67
+          }
68
+          return 	$meta_boxes;
69
+     }
70 70
 
71
-	/**
72
-	 * Register the landing pages post type.
73
-	 */
74
-	public function register_post_types() {
71
+     /**
72
+      * Register the landing pages post type.
73
+      */
74
+     public function register_post_types() {
75 75
 
76
-		$labels = array(
77
-			'name'               => _x( 'Vehicles', 'to-vehicles' ),
78
-			'singular_name'      => _x( 'Vehicle', 'to-vehicles' ),
79
-			'add_new'            => _x( 'Add New', 'to-vehicles' ),
80
-			'add_new_item'       => _x( 'Add New Vehicle', 'to-vehicles' ),
81
-			'edit_item'          => _x( 'Edit Vehicle', 'to-vehicles' ),
82
-			'new_item'           => _x( 'New Vehicle', 'to-vehicles' ),
83
-			'all_items'          => _x( 'Vehicles', 'to-vehicles' ),
84
-			'view_item'          => _x( 'View Vehicle', 'to-vehicles' ),
85
-			'search_items'       => _x( 'Search Vehicles', 'to-vehicles' ),
86
-			'not_found'          => _x( 'No vehicles found', 'to-vehicles' ),
87
-			'not_found_in_trash' => _x( 'No vehicles found in Trash', 'to-vehicles' ),
88
-			'parent_item_colon'  => '',
89
-			'menu_name'          => _x( 'Vehicles', 'to-vehicles' ),
90
-		);
76
+          $labels = array(
77
+               'name'               => _x( 'Vehicles', 'to-vehicles' ),
78
+               'singular_name'      => _x( 'Vehicle', 'to-vehicles' ),
79
+               'add_new'            => _x( 'Add New', 'to-vehicles' ),
80
+               'add_new_item'       => _x( 'Add New Vehicle', 'to-vehicles' ),
81
+               'edit_item'          => _x( 'Edit Vehicle', 'to-vehicles' ),
82
+               'new_item'           => _x( 'New Vehicle', 'to-vehicles' ),
83
+               'all_items'          => _x( 'Vehicles', 'to-vehicles' ),
84
+               'view_item'          => _x( 'View Vehicle', 'to-vehicles' ),
85
+               'search_items'       => _x( 'Search Vehicles', 'to-vehicles' ),
86
+               'not_found'          => _x( 'No vehicles found', 'to-vehicles' ),
87
+               'not_found_in_trash' => _x( 'No vehicles found in Trash', 'to-vehicles' ),
88
+               'parent_item_colon'  => '',
89
+               'menu_name'          => _x( 'Vehicles', 'to-vehicles' ),
90
+          );
91 91
 
92
-		$args = array(
93
-			'menu_icon'          => 'dashicons-performance',
94
-			'labels'             => $labels,
95
-			'public'             => true,
96
-			'publicly_queryable' => true,
97
-			'show_ui'            => true,
98
-			'show_in_menu'       => 'tour-operator',
99
-			'menu_position'      => 80,
100
-			'query_var'          => true,
101
-			'rewrite'            => array(
102
-				'slug' => 'vehicle',
103
-			),
104
-			'capability_type'    => 'post',
105
-			'has_archive'        => 'vehicles',
106
-			'hierarchical'       => true,
107
-			'supports'           => array( 'title', 'editor', 'thumbnail', 'excerpt', 'custom-fields' ),
108
-		);
92
+          $args = array(
93
+               'menu_icon'          => 'dashicons-performance',
94
+               'labels'             => $labels,
95
+               'public'             => true,
96
+               'publicly_queryable' => true,
97
+               'show_ui'            => true,
98
+               'show_in_menu'       => 'tour-operator',
99
+               'menu_position'      => 80,
100
+               'query_var'          => true,
101
+               'rewrite'            => array(
102
+                    'slug' => 'vehicle',
103
+               ),
104
+               'capability_type'    => 'post',
105
+               'has_archive'        => 'vehicles',
106
+               'hierarchical'       => true,
107
+               'supports'           => array( 'title', 'editor', 'thumbnail', 'excerpt', 'custom-fields' ),
108
+          );
109 109
 
110
-		register_post_type( 'vehicle', $args );
110
+          register_post_type( 'vehicle', $args );
111 111
 
112
-	}
112
+     }
113 113
 
114
-	function register_metaboxes( array $meta_boxes ) {
114
+     function register_metaboxes( array $meta_boxes ) {
115 115
 
116
-		$fields[] = array(
117
-			'id'   => 'title',
118
-			'name' => 'General',
119
-			'type' => 'title',
120
-		);
121
-		$fields[] = array(
122
-			'id'   => 'featured',
123
-			'name' => 'Featured',
124
-			'type' => 'checkbox',
125
-		);
126
-		if ( ! class_exists( 'LSX_Banners' ) ) {
127
-			$fields[] = array(
128
-				'id'   => 'tagline',
129
-				'name' => 'Tagline',
130
-				'type' => 'text',
131
-			);
132
-		}
133
-		$fields[] = array(
134
-			'id'   => 'code',
135
-			'name' => 'Code',
136
-			'type' => 'text',
137
-		);
138
-		$fields[] = array(
139
-			'id'      => 'gearbox',
140
-			'name'    => 'Gearbox Type',
141
-			'type'    => 'radio',
142
-			'options' => array(
143
-				'Automatic' => 'Automatic',
144
-				'Manual'    => 'Manual',
145
-			),
146
-		);
147
-		$fields[] = array(
148
-			'id'      => 'gears',
149
-			'name'    => 'Gears',
150
-			'type'    => 'radio',
151
-			'options' => array(
152
-				'4',
153
-				'5',
154
-				'6',
155
-				'7',
156
-			),
157
-		);
158
-		$fields[] = array(
159
-			'id'   => 'vehicle_type',
160
-			'name' => 'Vehicle Type',
161
-			'type' => 'text',
162
-		);
163
-		$fields[] = array(
164
-			'id'   => 'price',
165
-			'name' => 'Price Guide',
166
-			'type' => 'text',
167
-		);
168
-		$fields[] = array(
169
-			'id'      => 'engine_type',
170
-			'name'    => 'Engine Type',
171
-			'type'    => 'radio',
172
-			'options' => array(
173
-				'Diesel' => 'Diesel',
174
-				'Petrol' => 'Petrol',
175
-			),
176
-		);
177
-		$fields[] = array(
178
-			'id'   => 'engine_size',
179
-			'name' => 'Engine Size',
180
-			'type' => 'text',
181
-		);
182
-		$fields[] = array(
183
-			'id'   => 'seating',
184
-			'name' => 'Seats',
185
-			'type' => 'text',
186
-		);
187
-		$fields[] = array(
188
-			'id'      => 'features',
189
-			'name'    => 'Features',
190
-			'type'    => 'wysiwyg',
191
-			'options' => array(
192
-				'editor_height' => '100',
193
-			),
194
-		);
195
-		$fields[] = array(
196
-			'id'   => 'gallery_title',
197
-			'name' => 'Gallery',
198
-			'type' => 'title',
199
-		);
116
+          $fields[] = array(
117
+               'id'   => 'title',
118
+               'name' => 'General',
119
+               'type' => 'title',
120
+          );
121
+          $fields[] = array(
122
+               'id'   => 'featured',
123
+               'name' => 'Featured',
124
+               'type' => 'checkbox',
125
+          );
126
+          if ( ! class_exists( 'LSX_Banners' ) ) {
127
+               $fields[] = array(
128
+                    'id'   => 'tagline',
129
+                    'name' => 'Tagline',
130
+                    'type' => 'text',
131
+               );
132
+          }
133
+          $fields[] = array(
134
+               'id'   => 'code',
135
+               'name' => 'Code',
136
+               'type' => 'text',
137
+          );
138
+          $fields[] = array(
139
+               'id'      => 'gearbox',
140
+               'name'    => 'Gearbox Type',
141
+               'type'    => 'radio',
142
+               'options' => array(
143
+                    'Automatic' => 'Automatic',
144
+                    'Manual'    => 'Manual',
145
+               ),
146
+          );
147
+          $fields[] = array(
148
+               'id'      => 'gears',
149
+               'name'    => 'Gears',
150
+               'type'    => 'radio',
151
+               'options' => array(
152
+                    '4',
153
+                    '5',
154
+                    '6',
155
+                    '7',
156
+               ),
157
+          );
158
+          $fields[] = array(
159
+               'id'   => 'vehicle_type',
160
+               'name' => 'Vehicle Type',
161
+               'type' => 'text',
162
+          );
163
+          $fields[] = array(
164
+               'id'   => 'price',
165
+               'name' => 'Price Guide',
166
+               'type' => 'text',
167
+          );
168
+          $fields[] = array(
169
+               'id'      => 'engine_type',
170
+               'name'    => 'Engine Type',
171
+               'type'    => 'radio',
172
+               'options' => array(
173
+                    'Diesel' => 'Diesel',
174
+                    'Petrol' => 'Petrol',
175
+               ),
176
+          );
177
+          $fields[] = array(
178
+               'id'   => 'engine_size',
179
+               'name' => 'Engine Size',
180
+               'type' => 'text',
181
+          );
182
+          $fields[] = array(
183
+               'id'   => 'seating',
184
+               'name' => 'Seats',
185
+               'type' => 'text',
186
+          );
187
+          $fields[] = array(
188
+               'id'      => 'features',
189
+               'name'    => 'Features',
190
+               'type'    => 'wysiwyg',
191
+               'options' => array(
192
+                    'editor_height' => '100',
193
+               ),
194
+          );
195
+          $fields[] = array(
196
+               'id'   => 'gallery_title',
197
+               'name' => 'Gallery',
198
+               'type' => 'title',
199
+          );
200 200
 
201
-		//Galleries Block
202
-		$fields[] = array(
203
-			'id'   => 'gallery_title',
204
-			'name' => esc_html__( 'Gallery', 'tour-operator' ),
205
-			'type' => 'title',
206
-		);
207
-		$fields[] = array(
208
-			'id'                  => 'gallery',
209
-			'name'                => '',
210
-			'type'                => 'image',
211
-			'repeatable'          => true,
212
-			'show_size'           => false,
213
-			'sortable'            => true,
214
-			'string-repeat-field' => esc_html__( 'Add new image', 'tour-operator' ),
215
-		);
216
-		if ( class_exists( 'Envira_Gallery' ) ) {
217
-			$fields[] = array(
218
-				'id'   => 'envira_title',
219
-				'name' => esc_html__( 'Envira Gallery', 'tour-operator' ),
220
-				'type' => 'title',
221
-			);
222
-			$fields[] = array(
223
-				'id'         => 'envira_gallery',
224
-				'name'       => esc_html__( 'Envira Gallery', 'to-galleries' ),
225
-				'type'       => 'post_select',
226
-				'use_ajax'   => false,
227
-				'query'      => array(
228
-					'post_type'      => 'envira',
229
-					'nopagin'        => true,
230
-					'posts_per_page' => '-1',
231
-					'orderby'        => 'title',
232
-					'order'          => 'ASC',
233
-				),
234
-				'allow_none' => true,
235
-			);
236
-			if ( class_exists( 'Envira_Videos' ) ) {
237
-				$fields[] = array(
238
-					'id'         => 'envira_video',
239
-					'name'       => esc_html__( 'Envira Video Gallery', 'to-galleries' ),
240
-					'type'       => 'post_select',
241
-					'use_ajax'   => false,
242
-					'query'      => array(
243
-						'post_type'      => 'envira',
244
-						'nopagin'        => true,
245
-						'posts_per_page' => '-1',
246
-						'orderby'        => 'title',
247
-						'order'          => 'ASC',
248
-					),
249
-					'allow_none' => true,
250
-				);
251
-			}
252
-		}
201
+          //Galleries Block
202
+          $fields[] = array(
203
+               'id'   => 'gallery_title',
204
+               'name' => esc_html__( 'Gallery', 'tour-operator' ),
205
+               'type' => 'title',
206
+          );
207
+          $fields[] = array(
208
+               'id'                  => 'gallery',
209
+               'name'                => '',
210
+               'type'                => 'image',
211
+               'repeatable'          => true,
212
+               'show_size'           => false,
213
+               'sortable'            => true,
214
+               'string-repeat-field' => esc_html__( 'Add new image', 'tour-operator' ),
215
+          );
216
+          if ( class_exists( 'Envira_Gallery' ) ) {
217
+               $fields[] = array(
218
+                    'id'   => 'envira_title',
219
+                    'name' => esc_html__( 'Envira Gallery', 'tour-operator' ),
220
+                    'type' => 'title',
221
+               );
222
+               $fields[] = array(
223
+                    'id'         => 'envira_gallery',
224
+                    'name'       => esc_html__( 'Envira Gallery', 'to-galleries' ),
225
+                    'type'       => 'post_select',
226
+                    'use_ajax'   => false,
227
+                    'query'      => array(
228
+                         'post_type'      => 'envira',
229
+                         'nopagin'        => true,
230
+                         'posts_per_page' => '-1',
231
+                         'orderby'        => 'title',
232
+                         'order'          => 'ASC',
233
+                    ),
234
+                    'allow_none' => true,
235
+               );
236
+               if ( class_exists( 'Envira_Videos' ) ) {
237
+                    $fields[] = array(
238
+                         'id'         => 'envira_video',
239
+                         'name'       => esc_html__( 'Envira Video Gallery', 'to-galleries' ),
240
+                         'type'       => 'post_select',
241
+                         'use_ajax'   => false,
242
+                         'query'      => array(
243
+                              'post_type'      => 'envira',
244
+                              'nopagin'        => true,
245
+                              'posts_per_page' => '-1',
246
+                              'orderby'        => 'title',
247
+                              'order'          => 'ASC',
248
+                         ),
249
+                         'allow_none' => true,
250
+                    );
251
+               }
252
+          }
253 253
 
254
-		if ( class_exists( 'LSX_Field_Pattern' ) ) {
255
-			$fields = array_merge( $fields, LSX_Field_Pattern::videos() );
256
-		}
254
+          if ( class_exists( 'LSX_Field_Pattern' ) ) {
255
+               $fields = array_merge( $fields, LSX_Field_Pattern::videos() );
256
+          }
257 257
 
258
-		$fields[] = array(
259
-			'id'   => 'accommodation_title',
260
-			'name' => 'Accommodation',
261
-			'type' => 'title',
262
-		);
263
-		$fields[] = array(
264
-			'id'         => 'accommodation_to_vehicle',
265
-			'name'       => 'Accommodations related with this vehicle',
266
-			'type'       => 'post_select',
267
-			'use_ajax'   => false,
268
-			'query'      => array(
269
-				'post_type'      => 'accommodation',
270
-				'nopagin'        => true,
271
-				'posts_per_page' => 1000,
272
-				'orderby'        => 'title',
273
-				'order'          => 'ASC',
274
-			),
275
-			'repeatable' => true,
276
-			'sortable'   => true,
277
-			'allow_none' => true,
278
-		);
279
-		$fields[] = array(
280
-			'id'   => 'activity_title',
281
-			'name' => 'Activities',
282
-			'type' => 'title',
283
-		);
284
-		$fields[] = array(
285
-			'id'         => 'activity_to_vehicle',
286
-			'name'       => 'Activities related with this vehicle',
287
-			'type'       => 'post_select',
288
-			'use_ajax'   => false,
289
-			'query'      => array(
290
-				'post_type'      => 'activity',
291
-				'nopagin'        => true,
292
-				'posts_per_page' => 1000,
293
-				'orderby'        => 'title',
294
-				'order'          => 'ASC',
295
-			),
296
-			'repeatable' => true,
297
-			'sortable'   => true,
298
-			'allow_none' => true,
299
-		);
300
-		$fields[] = array(
301
-			'id'   => 'destinations_title',
302
-			'name' => 'Destinations',
303
-			'type' => 'title',
304
-		);
305
-		$fields[] = array(
306
-			'id'         => 'destination_to_vehicle',
307
-			'name'       => 'Destinations related with this vehicle',
308
-			'type'       => 'post_select',
309
-			'use_ajax'   => false,
310
-			'query'      => array(
311
-				'post_type'      => 'destination',
312
-				'nopagin'        => true,
313
-				'posts_per_page' => 1000,
314
-				'orderby'        => 'title',
315
-				'order'          => 'ASC',
316
-			),
317
-			'repeatable' => true,
318
-			'sortable'   => true,
319
-			'allow_none' => true,
320
-		);
321
-		$fields[] = array(
322
-			'id'   => 'review_title',
323
-			'name' => 'Reviews',
324
-			'type' => 'title',
325
-		);
326
-		$fields[] = array(
327
-			'id'         => 'review_to_vehicle',
328
-			'name'       => 'Reviews related with this vehicle',
329
-			'type'       => 'post_select',
330
-			'use_ajax'   => false,
331
-			'query'      => array(
332
-				'post_type'      => 'reviews',
333
-				'nopagin'        => true,
334
-				'posts_per_page' => 1000,
335
-				'orderby'        => 'title',
336
-				'order'          => 'ASC',
337
-			),
338
-			'repeatable' => true,
339
-			'sortable'   => true,
340
-			'allow_none' => true,
341
-		);
342
-		$fields[] = array(
343
-			'id'   => 'specials_title',
344
-			'name' => 'Specials',
345
-			'type' => 'title',
346
-		);
347
-		$fields[] = array(
348
-			'id'         => 'special_to_vehicle',
349
-			'name'       => 'Specials related with this vehicle',
350
-			'type'       => 'post_select',
351
-			'use_ajax'   => false,
352
-			'query'      => array(
353
-				'post_type'      => 'special',
354
-				'nopagin'        => true,
355
-				'posts_per_page' => 1000,
356
-				'orderby'        => 'title',
357
-				'order'          => 'ASC',
358
-			),
359
-			'repeatable' => true,
360
-			'sortable'   => true,
361
-			'allow_none' => true,
362
-		);
363
-		$fields[] = array(
364
-			'id'   => 'team_title',
365
-			'name' => 'Team Members',
366
-			'type' => 'title',
367
-		);
368
-		$fields[] = array(
369
-			'id'         => 'team_to_vehicle',
370
-			'name'       => 'Team members related with this vehicle',
371
-			'type'       => 'post_select',
372
-			'use_ajax'   => false,
373
-			'query'      => array(
374
-				'post_type'      => 'team',
375
-				'nopagin'        => true,
376
-				'posts_per_page' => 1000,
377
-				'orderby'        => 'title',
378
-				'order'          => 'ASC',
379
-			),
380
-			'repeatable' => true,
381
-			'sortable'   => true,
382
-			'allow_none' => true,
383
-		);
384
-		$fields[] = array(
385
-			'id'   => 'tours_title',
386
-			'name' => 'Tours',
387
-			'type' => 'title',
388
-		);
389
-		$fields[] = array(
390
-			'id'         => 'tour_to_vehicle',
391
-			'name'       => 'Tours related with this vehicle',
392
-			'type'       => 'post_select',
393
-			'use_ajax'   => false,
394
-			'query'      => array(
395
-				'post_type'      => 'tour',
396
-				'nopagin'        => true,
397
-				'posts_per_page' => 1000,
398
-				'orderby'        => 'title',
399
-				'order'          => 'ASC',
400
-			),
401
-			'repeatable' => true,
402
-			'sortable'   => true,
403
-			'allow_none' => true,
404
-		);
258
+          $fields[] = array(
259
+               'id'   => 'accommodation_title',
260
+               'name' => 'Accommodation',
261
+               'type' => 'title',
262
+          );
263
+          $fields[] = array(
264
+               'id'         => 'accommodation_to_vehicle',
265
+               'name'       => 'Accommodations related with this vehicle',
266
+               'type'       => 'post_select',
267
+               'use_ajax'   => false,
268
+               'query'      => array(
269
+                    'post_type'      => 'accommodation',
270
+                    'nopagin'        => true,
271
+                    'posts_per_page' => 1000,
272
+                    'orderby'        => 'title',
273
+                    'order'          => 'ASC',
274
+               ),
275
+               'repeatable' => true,
276
+               'sortable'   => true,
277
+               'allow_none' => true,
278
+          );
279
+          $fields[] = array(
280
+               'id'   => 'activity_title',
281
+               'name' => 'Activities',
282
+               'type' => 'title',
283
+          );
284
+          $fields[] = array(
285
+               'id'         => 'activity_to_vehicle',
286
+               'name'       => 'Activities related with this vehicle',
287
+               'type'       => 'post_select',
288
+               'use_ajax'   => false,
289
+               'query'      => array(
290
+                    'post_type'      => 'activity',
291
+                    'nopagin'        => true,
292
+                    'posts_per_page' => 1000,
293
+                    'orderby'        => 'title',
294
+                    'order'          => 'ASC',
295
+               ),
296
+               'repeatable' => true,
297
+               'sortable'   => true,
298
+               'allow_none' => true,
299
+          );
300
+          $fields[] = array(
301
+               'id'   => 'destinations_title',
302
+               'name' => 'Destinations',
303
+               'type' => 'title',
304
+          );
305
+          $fields[] = array(
306
+               'id'         => 'destination_to_vehicle',
307
+               'name'       => 'Destinations related with this vehicle',
308
+               'type'       => 'post_select',
309
+               'use_ajax'   => false,
310
+               'query'      => array(
311
+                    'post_type'      => 'destination',
312
+                    'nopagin'        => true,
313
+                    'posts_per_page' => 1000,
314
+                    'orderby'        => 'title',
315
+                    'order'          => 'ASC',
316
+               ),
317
+               'repeatable' => true,
318
+               'sortable'   => true,
319
+               'allow_none' => true,
320
+          );
321
+          $fields[] = array(
322
+               'id'   => 'review_title',
323
+               'name' => 'Reviews',
324
+               'type' => 'title',
325
+          );
326
+          $fields[] = array(
327
+               'id'         => 'review_to_vehicle',
328
+               'name'       => 'Reviews related with this vehicle',
329
+               'type'       => 'post_select',
330
+               'use_ajax'   => false,
331
+               'query'      => array(
332
+                    'post_type'      => 'reviews',
333
+                    'nopagin'        => true,
334
+                    'posts_per_page' => 1000,
335
+                    'orderby'        => 'title',
336
+                    'order'          => 'ASC',
337
+               ),
338
+               'repeatable' => true,
339
+               'sortable'   => true,
340
+               'allow_none' => true,
341
+          );
342
+          $fields[] = array(
343
+               'id'   => 'specials_title',
344
+               'name' => 'Specials',
345
+               'type' => 'title',
346
+          );
347
+          $fields[] = array(
348
+               'id'         => 'special_to_vehicle',
349
+               'name'       => 'Specials related with this vehicle',
350
+               'type'       => 'post_select',
351
+               'use_ajax'   => false,
352
+               'query'      => array(
353
+                    'post_type'      => 'special',
354
+                    'nopagin'        => true,
355
+                    'posts_per_page' => 1000,
356
+                    'orderby'        => 'title',
357
+                    'order'          => 'ASC',
358
+               ),
359
+               'repeatable' => true,
360
+               'sortable'   => true,
361
+               'allow_none' => true,
362
+          );
363
+          $fields[] = array(
364
+               'id'   => 'team_title',
365
+               'name' => 'Team Members',
366
+               'type' => 'title',
367
+          );
368
+          $fields[] = array(
369
+               'id'         => 'team_to_vehicle',
370
+               'name'       => 'Team members related with this vehicle',
371
+               'type'       => 'post_select',
372
+               'use_ajax'   => false,
373
+               'query'      => array(
374
+                    'post_type'      => 'team',
375
+                    'nopagin'        => true,
376
+                    'posts_per_page' => 1000,
377
+                    'orderby'        => 'title',
378
+                    'order'          => 'ASC',
379
+               ),
380
+               'repeatable' => true,
381
+               'sortable'   => true,
382
+               'allow_none' => true,
383
+          );
384
+          $fields[] = array(
385
+               'id'   => 'tours_title',
386
+               'name' => 'Tours',
387
+               'type' => 'title',
388
+          );
389
+          $fields[] = array(
390
+               'id'         => 'tour_to_vehicle',
391
+               'name'       => 'Tours related with this vehicle',
392
+               'type'       => 'post_select',
393
+               'use_ajax'   => false,
394
+               'query'      => array(
395
+                    'post_type'      => 'tour',
396
+                    'nopagin'        => true,
397
+                    'posts_per_page' => 1000,
398
+                    'orderby'        => 'title',
399
+                    'order'          => 'ASC',
400
+               ),
401
+               'repeatable' => true,
402
+               'sortable'   => true,
403
+               'allow_none' => true,
404
+          );
405 405
 
406
-		$fields = apply_filters( 'lsx_to_vehicle_custom_fields', $fields );
406
+          $fields = apply_filters( 'lsx_to_vehicle_custom_fields', $fields );
407 407
 
408
-		$meta_boxes[] = array(
409
-			'title'  => 'Tour Operator Plugin',
410
-			'pages'  => 'vehicle',
411
-			'fields' => $fields,
412
-		);
413
-		return $meta_boxes;
408
+          $meta_boxes[] = array(
409
+               'title'  => 'Tour Operator Plugin',
410
+               'pages'  => 'vehicle',
411
+               'fields' => $fields,
412
+          );
413
+          return $meta_boxes;
414 414
 
415
-	}
415
+     }
416 416
 
417
-	/**
418
-	 * Adds in the gallery fields to the Tour Operators Post Types.
419
-	 */
420
-	public function custom_fields( $fields ) {
421
-		global $post, $typenow, $current_screen;
417
+     /**
418
+      * Adds in the gallery fields to the Tour Operators Post Types.
419
+      */
420
+     public function custom_fields( $fields ) {
421
+          global $post, $typenow, $current_screen;
422 422
 
423
-		$post_type = false;
424
-		if ( $post && $post->post_type ) {
425
-			$post_type = $post->post_type;
426
-		} elseif ( $typenow ) {
427
-			$post_type = $typenow;
428
-		} elseif ( $current_screen && $current_screen->post_type ) {
429
-			$post_type = $current_screen->post_type;
430
-		} elseif ( isset( $_REQUEST['post_type'] ) ) {
431
-			$post_type = sanitize_key( $_REQUEST['post_type'] );
432
-		} elseif ( isset( $_REQUEST['post'] ) ) {
433
-			$post_type = get_post_type( sanitize_key( $_REQUEST['post'] ) );
434
-		}
435
-		//$post_type = get_post_type();
436
-		if ( false !== $post_type ) {
437
-			$fields[]  = array(
438
-				'id'   => 'vehicle_title',
439
-				'name' => 'Vehicles',
440
-				'type' => 'title',
441
-				'cols' => 12,
442
-			);
443
-			$fields[]  = array(
444
-				'id'         => 'vehicle_to_' . $post_type,
445
-				'name'       => 'Vehicles related with this ' . $post_type,
446
-				'type'       => 'post_select',
447
-				'use_ajax'   => false,
448
-				'query'      => array(
449
-					'post_type'      => 'vehicle',
450
-					'nopagin'        => true,
451
-					'posts_per_page' => '-1',
452
-					'orderby'        => 'title',
453
-					'order'          => 'ASC',
454
-				),
455
-				'repeatable' => true,
456
-				'allow_none' => true,
457
-				'cols'       => 12,
458
-			);
459
-		}
460
-		return $fields;
461
-	}
423
+          $post_type = false;
424
+          if ( $post && $post->post_type ) {
425
+               $post_type = $post->post_type;
426
+          } elseif ( $typenow ) {
427
+               $post_type = $typenow;
428
+          } elseif ( $current_screen && $current_screen->post_type ) {
429
+               $post_type = $current_screen->post_type;
430
+          } elseif ( isset( $_REQUEST['post_type'] ) ) {
431
+               $post_type = sanitize_key( $_REQUEST['post_type'] );
432
+          } elseif ( isset( $_REQUEST['post'] ) ) {
433
+               $post_type = get_post_type( sanitize_key( $_REQUEST['post'] ) );
434
+          }
435
+          //$post_type = get_post_type();
436
+          if ( false !== $post_type ) {
437
+               $fields[]  = array(
438
+                    'id'   => 'vehicle_title',
439
+                    'name' => 'Vehicles',
440
+                    'type' => 'title',
441
+                    'cols' => 12,
442
+               );
443
+               $fields[]  = array(
444
+                    'id'         => 'vehicle_to_' . $post_type,
445
+                    'name'       => 'Vehicles related with this ' . $post_type,
446
+                    'type'       => 'post_select',
447
+                    'use_ajax'   => false,
448
+                    'query'      => array(
449
+                         'post_type'      => 'vehicle',
450
+                         'nopagin'        => true,
451
+                         'posts_per_page' => '-1',
452
+                         'orderby'        => 'title',
453
+                         'order'          => 'ASC',
454
+                    ),
455
+                    'repeatable' => true,
456
+                    'allow_none' => true,
457
+                    'cols'       => 12,
458
+               );
459
+          }
460
+          return $fields;
461
+     }
462 462
 }
463 463
 new LSX_TO_Vehicles_Admin();
Please login to merge, or discard this patch.
classes/class-lsx-to-template-redirects.php 1 patch
Indentation   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -10,173 +10,173 @@
 block discarded – undo
10 10
 
11 11
 class LSX_TO_Template_Redirects {
12 12
 
13
-	/**
14
-	 * Plugin Path
15
-	 */
16
-	public $plugin_path = false;
13
+     /**
14
+      * Plugin Path
15
+      */
16
+     public $plugin_path = false;
17 17
 
18
-	/**
19
-	 * Post Types
20
-	 */
21
-	public $post_types = false;
18
+     /**
19
+      * Post Types
20
+      */
21
+     public $post_types = false;
22 22
 
23
-	/**
24
-	 * Taxonomies
25
-	 */
26
-	public $taxonomies = false;
23
+     /**
24
+      * Taxonomies
25
+      */
26
+     public $taxonomies = false;
27 27
 
28
-	/**
29
-	 * Initialize the plugin by setting localization, filters, and administration functions.
30
-	 *
31
-	 * @param array $post_types an array of the post types to redirect.
32
-	 * @param array $taxonomies an array of the taxonomies to redirect.
33
-	 */
34
-	public function __construct( $plugin_path = false, $post_types = false, $taxonomies = false ) {
35
-		if ( false !== $plugin_path ) {
36
-			$this->plugin_path = $plugin_path;
28
+     /**
29
+      * Initialize the plugin by setting localization, filters, and administration functions.
30
+      *
31
+      * @param array $post_types an array of the post types to redirect.
32
+      * @param array $taxonomies an array of the taxonomies to redirect.
33
+      */
34
+     public function __construct( $plugin_path = false, $post_types = false, $taxonomies = false ) {
35
+          if ( false !== $plugin_path ) {
36
+               $this->plugin_path = $plugin_path;
37 37
 
38
-			add_filter( 'lsx_to_widget_path', array( $this, 'widget_path' ), 10, 2 );
39
-			add_filter( 'lsx_to_content_path', array( $this, 'content_path' ), 10, 3 );
38
+               add_filter( 'lsx_to_widget_path', array( $this, 'widget_path' ), 10, 2 );
39
+               add_filter( 'lsx_to_content_path', array( $this, 'content_path' ), 10, 3 );
40 40
 
41
-			if ( false !== $post_types ) {
42
-				$this->post_types = $post_types;
43
-				add_filter( 'template_include', array( $this, 'post_type_archive_template_include' ), 99 );
44
-				add_filter( 'template_include', array( $this, 'post_type_single_template_include' ), 99 );
45
-				add_filter( 'template_include', array( $this, 'search_template_include' ), 99 );
46
-			}
47
-			if ( false !== $taxonomies ) {
48
-				$this->taxonomies = $taxonomies;
49
-				add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 );
50
-			}
51
-		}
52
-	}
41
+               if ( false !== $post_types ) {
42
+                    $this->post_types = $post_types;
43
+                    add_filter( 'template_include', array( $this, 'post_type_archive_template_include' ), 99 );
44
+                    add_filter( 'template_include', array( $this, 'post_type_single_template_include' ), 99 );
45
+                    add_filter( 'template_include', array( $this, 'search_template_include' ), 99 );
46
+               }
47
+               if ( false !== $taxonomies ) {
48
+                    $this->taxonomies = $taxonomies;
49
+                    add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 );
50
+               }
51
+          }
52
+     }
53 53
 
54
-	/**
55
-	 * Redirect wordpress to the archive template located in the plugin
56
-	 *
57
-	 * @param	$template
58
-	 * @return	$template
59
-	 */
60
-	public function post_type_archive_template_include( $template ) {
61
-		if ( is_main_query() && is_post_type_archive( $this->post_types ) ) {
62
-			$current_post_type = get_post_type();
63
-			if ( '' == locate_template( array( 'archive-' . $current_post_type . '.php' ) )	&& file_exists( $this->plugin_path . 'templates/archive-' . $current_post_type . '.php' ) ) {
64
-				$template = $this->plugin_path . 'templates/archive-' . $current_post_type . '.php';
65
-			}
66
-		}
67
-		return $template;
68
-	}
69
-	/**
70
-	 * Redirect wordpress to the single template located in the plugin
71
-	 *
72
-	 * @param	$template
73
-	 *
74
-	 * @return	$template
75
-	 */
76
-	public function post_type_single_template_include( $template ) {
77
-		if ( is_main_query() && is_singular( $this->post_types ) ) {
78
-			$current_post_type = get_post_type();
79
-			if ( '' == locate_template( array( 'single-' . $current_post_type . '.php' ) )	&& file_exists( $this->plugin_path . 'templates/single-' . $current_post_type . '.php' ) ) {
80
-					$template = $this->plugin_path . 'templates/single-' . $current_post_type . '.php';
81
-			}
82
-		}
83
-		return $template;
84
-	}
85
-	/**
86
-	 * Redirect wordpress to the taxonomy located in the plugin
87
-	 *
88
-	 * @param	$template
89
-	 *
90
-	 * @return	$template
91
-	 */
92
-	public function taxonomy_template_include( $template ) {
54
+     /**
55
+      * Redirect wordpress to the archive template located in the plugin
56
+      *
57
+      * @param	$template
58
+      * @return	$template
59
+      */
60
+     public function post_type_archive_template_include( $template ) {
61
+          if ( is_main_query() && is_post_type_archive( $this->post_types ) ) {
62
+               $current_post_type = get_post_type();
63
+               if ( '' == locate_template( array( 'archive-' . $current_post_type . '.php' ) )	&& file_exists( $this->plugin_path . 'templates/archive-' . $current_post_type . '.php' ) ) {
64
+                    $template = $this->plugin_path . 'templates/archive-' . $current_post_type . '.php';
65
+               }
66
+          }
67
+          return $template;
68
+     }
69
+     /**
70
+      * Redirect wordpress to the single template located in the plugin
71
+      *
72
+      * @param	$template
73
+      *
74
+      * @return	$template
75
+      */
76
+     public function post_type_single_template_include( $template ) {
77
+          if ( is_main_query() && is_singular( $this->post_types ) ) {
78
+               $current_post_type = get_post_type();
79
+               if ( '' == locate_template( array( 'single-' . $current_post_type . '.php' ) )	&& file_exists( $this->plugin_path . 'templates/single-' . $current_post_type . '.php' ) ) {
80
+                         $template = $this->plugin_path . 'templates/single-' . $current_post_type . '.php';
81
+               }
82
+          }
83
+          return $template;
84
+     }
85
+     /**
86
+      * Redirect wordpress to the taxonomy located in the plugin
87
+      *
88
+      * @param	$template
89
+      *
90
+      * @return	$template
91
+      */
92
+     public function taxonomy_template_include( $template ) {
93 93
 
94
-		if ( is_main_query() && is_tax( $this->taxonomies ) ) {
95
-			$current_taxonomy = get_query_var( 'taxonomy' );
96
-			if ( '' == locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( $this->plugin_path . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) {
97
-				$template = $this->plugin_path . 'templates/taxonomy-' . $current_taxonomy . '.php';
98
-			}
99
-		}
100
-		return $template;
101
-	}
94
+          if ( is_main_query() && is_tax( $this->taxonomies ) ) {
95
+               $current_taxonomy = get_query_var( 'taxonomy' );
96
+               if ( '' == locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( $this->plugin_path . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) {
97
+                    $template = $this->plugin_path . 'templates/taxonomy-' . $current_taxonomy . '.php';
98
+               }
99
+          }
100
+          return $template;
101
+     }
102 102
 
103
-	/**
104
-	 * Redirect wordpress to the search template located in the plugin
105
-	 *
106
-	 * @param	$template
107
-	 *
108
-	 * @return	$template
109
-	 */
110
-	public function search_template_include( $template ) {
111
-		if ( is_main_query() && is_search() ) {
112
-			if ( file_exists( $this->plugin_path . 'templates/search.php' ) ) {
113
-				$template = $this->plugin_path . 'templates/search.php';
114
-			}
115
-		}
116
-		return $template;
117
-	}
103
+     /**
104
+      * Redirect wordpress to the search template located in the plugin
105
+      *
106
+      * @param	$template
107
+      *
108
+      * @return	$template
109
+      */
110
+     public function search_template_include( $template ) {
111
+          if ( is_main_query() && is_search() ) {
112
+               if ( file_exists( $this->plugin_path . 'templates/search.php' ) ) {
113
+                    $template = $this->plugin_path . 'templates/search.php';
114
+               }
115
+          }
116
+          return $template;
117
+     }
118 118
 
119
-	/**
120
-	 * Redirect wordpress to the single template located in the plugin
121
-	 *
122
-	 * @param	$template
123
-	 *
124
-	 * @return	$template
125
-	 */
126
-	public function content_part( $slug, $name = null ) {
127
-		$template = array();
128
-		$name = (string) $name;
129
-		if ( '' !== $name ) {
130
-			$template = "{$slug}-{$name}.php";
131
-		} else {
132
-			$template = "{$slug}.php";
133
-		}
134
-		$original_name = $template;
135
-		$path = apply_filters( 'lsx_to_content_path', '', get_post_type() );
119
+     /**
120
+      * Redirect wordpress to the single template located in the plugin
121
+      *
122
+      * @param	$template
123
+      *
124
+      * @return	$template
125
+      */
126
+     public function content_part( $slug, $name = null ) {
127
+          $template = array();
128
+          $name = (string) $name;
129
+          if ( '' !== $name ) {
130
+               $template = "{$slug}-{$name}.php";
131
+          } else {
132
+               $template = "{$slug}.php";
133
+          }
134
+          $original_name = $template;
135
+          $path = apply_filters( 'lsx_to_content_path', '', get_post_type() );
136 136
 
137
-		if ( '' == locate_template( array( $template ) ) && file_exists( $path . 'templates/' . $template ) ) {
138
-			$template = $path . 'templates/' . $template;
139
-		} elseif ( file_exists( get_stylesheet_directory() . '/' . $template ) ) {
140
-			$template = get_stylesheet_directory() . '/' . $template;
141
-		} else {
142
-			$template = false;
143
-		}
144
-		if ( false !== $template ) {
145
-			load_template( $template, false );
146
-		} else {
147
-			echo wp_kses_post( '<p>No ' . $original_name . ' can be found.</p>' );
148
-		}
149
-	}
137
+          if ( '' == locate_template( array( $template ) ) && file_exists( $path . 'templates/' . $template ) ) {
138
+               $template = $path . 'templates/' . $template;
139
+          } elseif ( file_exists( get_stylesheet_directory() . '/' . $template ) ) {
140
+               $template = get_stylesheet_directory() . '/' . $template;
141
+          } else {
142
+               $template = false;
143
+          }
144
+          if ( false !== $template ) {
145
+               load_template( $template, false );
146
+          } else {
147
+               echo wp_kses_post( '<p>No ' . $original_name . ' can be found.</p>' );
148
+          }
149
+     }
150 150
 
151
-	/**
152
-	 * Redirect wordpress to the widget template located in the plugin
153
-	 *
154
-	 * @param	$path
155
-	 * @param	$post_type
156
-	 *
157
-	 * @return	$path
158
-	 */
159
-	public function widget_path( $path, $slug ) {
160
-		if ( ( false !== $this->post_types && in_array( $slug, $this->post_types ) )
161
-		 || ( false !== $this->taxonomies && in_array( $slug, $this->taxonomies ) ) || 'post' === $slug ) {
162
-			$path = $this->plugin_path;
163
-		}
164
-		return $path;
165
-	}
151
+     /**
152
+      * Redirect wordpress to the widget template located in the plugin
153
+      *
154
+      * @param	$path
155
+      * @param	$post_type
156
+      *
157
+      * @return	$path
158
+      */
159
+     public function widget_path( $path, $slug ) {
160
+          if ( ( false !== $this->post_types && in_array( $slug, $this->post_types ) )
161
+           || ( false !== $this->taxonomies && in_array( $slug, $this->taxonomies ) ) || 'post' === $slug ) {
162
+               $path = $this->plugin_path;
163
+          }
164
+          return $path;
165
+     }
166 166
 
167
-	/**
168
-	 * Redirect wordpress to the single template located in the plugin
169
-	 *
170
-	 * @param	$path
171
-	 * @param	$post_type
172
-	 *
173
-	 * @return	$path
174
-	 */
175
-	public function content_path( $path, $slug ) {
176
-		if ( ( false !== $this->post_types && in_array( $slug, $this->post_types ) )
177
-		 || ( false !== $this->taxonomies && in_array( $slug, $this->taxonomies ) ) || 'post' === $slug ) {
178
-			$path = $this->plugin_path;
179
-		}
180
-		return $path;
181
-	}
167
+     /**
168
+      * Redirect wordpress to the single template located in the plugin
169
+      *
170
+      * @param	$path
171
+      * @param	$post_type
172
+      *
173
+      * @return	$path
174
+      */
175
+     public function content_path( $path, $slug ) {
176
+          if ( ( false !== $this->post_types && in_array( $slug, $this->post_types ) )
177
+           || ( false !== $this->taxonomies && in_array( $slug, $this->taxonomies ) ) || 'post' === $slug ) {
178
+               $path = $this->plugin_path;
179
+          }
180
+          return $path;
181
+     }
182 182
 }
Please login to merge, or discard this patch.
classes/class-lsx-to-vehicles-frontend.php 1 patch
Indentation   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -18,135 +18,135 @@
 block discarded – undo
18 18
 
19 19
 class LSX_TO_Vehicles_Frontend extends LSX_TO_Vehicles {
20 20
 
21
-	/**
22
-	 * Holds the $page_links array while its being built on the single team page.
23
-	 *
24
-	 * @var array
25
-	 */
26
-	public $page_links = false;
27
-
28
-	/**
29
-	 * Holds the array of options.
30
-	 *
31
-	 * @var array
32
-	 */
33
-	public $options = false;
34
-
35
-	/**
36
-	 * Constructor
37
-	 */
38
-	public function __construct() {
39
-		$this->set_vars();
40
-
41
-		add_action( 'wp_head', array( $this, 'wp_head' ), 20, 1 );
42
-
43
-		//add_filter( 'lsx_to_entry_class', array( $this, 'entry_class' ) );
44
-		//add_action( 'init', array( $this, 'init' ) );
45
-
46
-		if ( ! class_exists( 'LSX_TO_Template_Redirects' ) ) {
47
-			require_once( LSX_TO_VEHICLES_PATH . 'classes/class-lsx-to-template-redirects.php' );
48
-		}
49
-		$this->redirects = new LSX_TO_Template_Redirects( LSX_TO_VEHICLES_PATH, array_keys( $this->post_types ) );
50
-		add_action( 'lsx_vehicle_content', array( $this->redirects, 'content_part' ), 10, 2 );
51
-
52
-		add_filter( 'lsx_to_page_navigation', array( $this, 'page_links' ) );
53
-
54
-		//add_action( 'lsx_entry_top', array( $this, 'archive_entry_top' ), 15 );
55
-		//add_action( 'lsx_entry_bottom', array( $this, 'archive_entry_bottom' ) );
56
-		add_action( 'lsx_content_bottom', array( $this, 'single_content_bottom' ) );
57
-
58
-		add_action( 'lsx_banner_allowed_post_types', array( $this, 'theme_allowed_post_type_banners' ) );
59
-	}
60
-
61
-	function wp_head() {
62
-		if ( is_singular( 'vehicle' ) ) {
63
-			remove_action( 'lsx_entry_bottom', 'lsx_to_single_entry_bottom' );
64
-		}
65
-	}
66
-
67
-	/**
68
-	 * Adds the template tags to the bottom of the single review
69
-	 */
70
-	public function single_content_bottom() {
71
-		if ( is_singular( 'vehicle' ) ) {
72
-			// lsx_to_review_accommodation();
73
-
74
-			// lsx_to_review_tour();
75
-
76
-			// lsx_to_review_destination();
77
-
78
-			lsx_to_gallery( '<section id="gallery" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-gallery">' . esc_html__( 'Gallery', 'to-reviews' ) . '</h2><div id="collapse-gallery" class="collapse in"><div class="collapse-inner">', '</div></div></section>' );
79
-
80
-			if ( function_exists( 'lsx_to_videos' ) ) {
81
-				lsx_to_videos( '<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__( 'Videos', 'to-reviews' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' );
82
-			} elseif ( class_exists( 'Envira_Videos' ) ) {
83
-				lsx_to_envira_videos( '<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__( 'Videos', 'to-reviews' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' );
84
-			} //lsx_to_review_posts();
85
-		}
86
-	}
87
-
88
-	/**
89
-	 * Adds our navigation links to the team single post
90
-	 *
91
-	 * @param $page_links array
92
-	 * @return $page_links array
93
-	 */
94
-	public function page_links( $page_links ) {
95
-		if ( is_singular( 'vehicle' ) ) {
96
-			$this->page_links = $page_links;
97
-			$this->get_gallery_link();
98
-			$this->get_videos_link();
99
-
100
-			$page_links = $this->page_links;
101
-		}
102
-
103
-		return $page_links;
104
-	}
105
-
106
-	/**
107
-	 * Tests for the Gallery and returns a link for the section
108
-	 */
109
-	public function get_gallery_link() {
110
-		$gallery_ids = get_post_meta( get_the_ID(), 'gallery', false );
111
-		$envira_gallery = get_post_meta( get_the_ID(), 'envira_gallery', true );
112
-
113
-		if ( ( ! empty( $gallery_ids ) && is_array( $gallery_ids ) ) || ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) ) {
114
-			if ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) {
115
-				// Envira Gallery.
116
-				$this->page_links['gallery'] = esc_html__( 'Gallery', 'to-vehicles' );
117
-				return;
118
-			} else {
119
-				if ( function_exists( 'envira_dynamic' ) ) {
120
-					// Envira Gallery - Dynamic.
121
-					$this->page_links['gallery'] = esc_html__( 'Gallery', 'to-vehicles' );
122
-					return;
123
-				} else {
124
-					// WordPress Gallery.
125
-					$this->page_links['gallery'] = esc_html__( 'Gallery', 'to-vehicles' );
126
-					return;
127
-				}
128
-			}
129
-		}
130
-	}
131
-
132
-	/**
133
-	 * Tests for the Videos and returns a link for the section
134
-	 */
135
-	public function get_videos_link() {
136
-		$videos_id = false;
137
-
138
-		if ( class_exists( 'Envira_Videos' ) ) {
139
-			$videos_id = get_post_meta( get_the_ID(), 'envira_video', true );
140
-		}
141
-
142
-		if ( empty( $videos_id ) && function_exists( 'lsx_to_videos' ) ) {
143
-			$videos_id = get_post_meta( get_the_ID(), 'videos', true );
144
-		}
145
-
146
-		if ( ! empty( $videos_id ) ) {
147
-			$this->page_links['videos'] = esc_html__( 'Videos', 'to-vehicles' );
148
-		}
149
-	}
21
+     /**
22
+      * Holds the $page_links array while its being built on the single team page.
23
+      *
24
+      * @var array
25
+      */
26
+     public $page_links = false;
27
+
28
+     /**
29
+      * Holds the array of options.
30
+      *
31
+      * @var array
32
+      */
33
+     public $options = false;
34
+
35
+     /**
36
+      * Constructor
37
+      */
38
+     public function __construct() {
39
+          $this->set_vars();
40
+
41
+          add_action( 'wp_head', array( $this, 'wp_head' ), 20, 1 );
42
+
43
+          //add_filter( 'lsx_to_entry_class', array( $this, 'entry_class' ) );
44
+          //add_action( 'init', array( $this, 'init' ) );
45
+
46
+          if ( ! class_exists( 'LSX_TO_Template_Redirects' ) ) {
47
+               require_once( LSX_TO_VEHICLES_PATH . 'classes/class-lsx-to-template-redirects.php' );
48
+          }
49
+          $this->redirects = new LSX_TO_Template_Redirects( LSX_TO_VEHICLES_PATH, array_keys( $this->post_types ) );
50
+          add_action( 'lsx_vehicle_content', array( $this->redirects, 'content_part' ), 10, 2 );
51
+
52
+          add_filter( 'lsx_to_page_navigation', array( $this, 'page_links' ) );
53
+
54
+          //add_action( 'lsx_entry_top', array( $this, 'archive_entry_top' ), 15 );
55
+          //add_action( 'lsx_entry_bottom', array( $this, 'archive_entry_bottom' ) );
56
+          add_action( 'lsx_content_bottom', array( $this, 'single_content_bottom' ) );
57
+
58
+          add_action( 'lsx_banner_allowed_post_types', array( $this, 'theme_allowed_post_type_banners' ) );
59
+     }
60
+
61
+     function wp_head() {
62
+          if ( is_singular( 'vehicle' ) ) {
63
+               remove_action( 'lsx_entry_bottom', 'lsx_to_single_entry_bottom' );
64
+          }
65
+     }
66
+
67
+     /**
68
+      * Adds the template tags to the bottom of the single review
69
+      */
70
+     public function single_content_bottom() {
71
+          if ( is_singular( 'vehicle' ) ) {
72
+               // lsx_to_review_accommodation();
73
+
74
+               // lsx_to_review_tour();
75
+
76
+               // lsx_to_review_destination();
77
+
78
+               lsx_to_gallery( '<section id="gallery" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-gallery">' . esc_html__( 'Gallery', 'to-reviews' ) . '</h2><div id="collapse-gallery" class="collapse in"><div class="collapse-inner">', '</div></div></section>' );
79
+
80
+               if ( function_exists( 'lsx_to_videos' ) ) {
81
+                    lsx_to_videos( '<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__( 'Videos', 'to-reviews' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' );
82
+               } elseif ( class_exists( 'Envira_Videos' ) ) {
83
+                    lsx_to_envira_videos( '<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__( 'Videos', 'to-reviews' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' );
84
+               } //lsx_to_review_posts();
85
+          }
86
+     }
87
+
88
+     /**
89
+      * Adds our navigation links to the team single post
90
+      *
91
+      * @param $page_links array
92
+      * @return $page_links array
93
+      */
94
+     public function page_links( $page_links ) {
95
+          if ( is_singular( 'vehicle' ) ) {
96
+               $this->page_links = $page_links;
97
+               $this->get_gallery_link();
98
+               $this->get_videos_link();
99
+
100
+               $page_links = $this->page_links;
101
+          }
102
+
103
+          return $page_links;
104
+     }
105
+
106
+     /**
107
+      * Tests for the Gallery and returns a link for the section
108
+      */
109
+     public function get_gallery_link() {
110
+          $gallery_ids = get_post_meta( get_the_ID(), 'gallery', false );
111
+          $envira_gallery = get_post_meta( get_the_ID(), 'envira_gallery', true );
112
+
113
+          if ( ( ! empty( $gallery_ids ) && is_array( $gallery_ids ) ) || ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) ) {
114
+               if ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) {
115
+                    // Envira Gallery.
116
+                    $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-vehicles' );
117
+                    return;
118
+               } else {
119
+                    if ( function_exists( 'envira_dynamic' ) ) {
120
+                         // Envira Gallery - Dynamic.
121
+                         $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-vehicles' );
122
+                         return;
123
+                    } else {
124
+                         // WordPress Gallery.
125
+                         $this->page_links['gallery'] = esc_html__( 'Gallery', 'to-vehicles' );
126
+                         return;
127
+                    }
128
+               }
129
+          }
130
+     }
131
+
132
+     /**
133
+      * Tests for the Videos and returns a link for the section
134
+      */
135
+     public function get_videos_link() {
136
+          $videos_id = false;
137
+
138
+          if ( class_exists( 'Envira_Videos' ) ) {
139
+               $videos_id = get_post_meta( get_the_ID(), 'envira_video', true );
140
+          }
141
+
142
+          if ( empty( $videos_id ) && function_exists( 'lsx_to_videos' ) ) {
143
+               $videos_id = get_post_meta( get_the_ID(), 'videos', true );
144
+          }
145
+
146
+          if ( ! empty( $videos_id ) ) {
147
+               $this->page_links['videos'] = esc_html__( 'Videos', 'to-vehicles' );
148
+          }
149
+     }
150 150
 
151 151
 }
152 152
 new LSX_TO_Vehicles_Frontend();
Please login to merge, or discard this patch.