Test Failed
Push — master ( 33c2aa...380661 )
by Stiofan
04:39
created
geodirectory-functions/cat-meta-functions/Tax-meta-class.php 3 patches
Doc Comments   +15 added lines patch added patch discarded remove patch
@@ -2053,6 +2053,11 @@  discard block
 block discarded – undo
2053 2053
         }
2054 2054
 
2055 2055
         //update meta
2056
+
2057
+        /**
2058
+         * @param string $term_id
2059
+         * @param string $key
2060
+         */
2056 2061
         public function update_tax_meta($term_id, $key, $value, $post_type = '')
2057 2062
         {
2058 2063
 
@@ -2094,6 +2099,12 @@  discard block
 block discarded – undo
2094 2099
 
2095 2100
 //get term meta field
2096 2101
 if (!function_exists('geodir_get_tax_meta')) {
2102
+
2103
+    /**
2104
+     * @param string $key
2105
+     *
2106
+     * @return string
2107
+     */
2097 2108
     function geodir_get_tax_meta($term_id, $key, $multi = false, $post_type = '') {
2098 2109
         if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2099 2110
             $taxObject = get_taxonomy($_REQUEST['taxonomy']);
@@ -2145,6 +2156,10 @@  discard block
 block discarded – undo
2145 2156
 
2146 2157
 //update meta
2147 2158
 if (!function_exists('geodir_update_tax_meta')) {
2159
+
2160
+    /**
2161
+     * @param string $key
2162
+     */
2148 2163
     function geodir_update_tax_meta($term_id, $key, $value, $post_type = '') {
2149 2164
         if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2150 2165
             $taxObject = get_taxonomy($_REQUEST['taxonomy']);
Please login to merge, or discard this patch.
Indentation   +2046 added lines, -2046 removed lines patch added patch discarded remove patch
@@ -28,260 +28,260 @@  discard block
 block discarded – undo
28 28
 
29 29
 if (!class_exists('Geodir_Tax_Meta_Class')) :
30 30
 
31
-    /**
32
-     * All Types Meta Box class.
33
-     *
34
-     * @package All Types Meta Box
35
-     * @since 1.0
36
-     *
37
-     * @todo Nothing.
38
-     */
39
-
40
-
41
-    class Geodir_Tax_Meta_Class
42
-    {
43
-
44
-        /**
45
-         * Holds meta box object
46
-         *
47
-         * @var object
48
-         * @access protected
49
-         */
50
-        protected $_meta_box;
51
-
52
-        /**
53
-         * Holds meta box fields.
54
-         *
55
-         * @var array
56
-         * @access protected
57
-         */
58
-        protected $_prefix;
59
-
60
-        /**
61
-         * Holds Prefix for meta box fields.
62
-         *
63
-         * @var array
64
-         * @access protected
65
-         */
66
-        protected $_fields;
67
-
68
-        /**
69
-         * Use local images.
70
-         *
71
-         * @var bool
72
-         * @access protected
73
-         */
74
-        protected $_Local_images;
75
-
76
-        /**
77
-         * What form is this? edit or new term.
78
-         *
79
-         * @var string
80
-         * @access protected
81
-         * $since 1.0
82
-         */
83
-        protected $_form_type;
84
-        /**
85
-         * SelfPath to allow themes as well as plugins.
86
-         *
87
-         * @var string
88
-         * @access protected
89
-         * $since 1.0
90
-         */
91
-        protected $SelfPath;
92
-
93
-        /**
94
-         * Constructor
95
-         *
96
-         * @since 1.0
97
-         * @access public
98
-         *
99
-         * @param array $meta_box
100
-         */
101
-        public function __construct($meta_box)
102
-        {
103
-
104
-            // If we are not in admin area exit.
105
-            if (!is_admin())
106
-                return;
107
-
108
-            // Assign meta box values to local variables and add it's missed values.
109
-            $this->_meta_box = $meta_box;
110
-            $this->_prefix = (isset($meta_box['prefix'])) ? $meta_box['prefix'] : '';
111
-            $this->_fields = &$this->_meta_box['fields'];
112
-            $this->_Local_images = (isset($meta_box['local_images'])) ? true : false;
113
-            $this->add_missed_values();
114
-            if (isset($meta_box['use_with_theme']))
115
-                if ($meta_box['use_with_theme'] === true) {
116
-                    $this->SelfPath = get_stylesheet_directory_uri() . '/library/cat-meta';
117
-                } elseif ($meta_box['use_with_theme'] === false) {
118
-                    $this->SelfPath = plugins_url('cat-meta-functions', plugin_basename(dirname(__FILE__)));
119
-                } else {
120
-                    $this->SelfPath = $meta_box['use_with_theme'];
121
-                }
122
-            else {
123
-                $this->SelfPath = plugins_url('cat-meta-functions', plugin_basename(dirname(__FILE__)));
124
-            }
125
-
126
-
127
-            // Add Actions
128
-            add_action('admin_init', array(&$this, 'add'));
129
-
130
-            // Check for special fields and add needed actions for them.
131
-            $this->check_field_upload();
132
-            $this->check_field_color();
133
-            $this->check_field_date();
134
-            $this->check_field_time();
135
-
136
-            // Load common js, css files
137
-            // Must enqueue for all pages as we need js for the media upload, too.
138
-            add_action('admin_print_styles', array(&$this, 'load_scripts_styles'));
139
-
140
-        }
141
-
142
-        /**
143
-         * Load all Javascript and CSS
144
-         *
145
-         * @since 1.0
146
-         * @access public
147
-         */
148
-        public function load_scripts_styles()
149
-        {
150
-
151
-            // Get Plugin Path
152
-            $plugin_path = $this->SelfPath;
153
-            //only load styles and js when needed
154
-            /* 
31
+	/**
32
+	 * All Types Meta Box class.
33
+	 *
34
+	 * @package All Types Meta Box
35
+	 * @since 1.0
36
+	 *
37
+	 * @todo Nothing.
38
+	 */
39
+
40
+
41
+	class Geodir_Tax_Meta_Class
42
+	{
43
+
44
+		/**
45
+		 * Holds meta box object
46
+		 *
47
+		 * @var object
48
+		 * @access protected
49
+		 */
50
+		protected $_meta_box;
51
+
52
+		/**
53
+		 * Holds meta box fields.
54
+		 *
55
+		 * @var array
56
+		 * @access protected
57
+		 */
58
+		protected $_prefix;
59
+
60
+		/**
61
+		 * Holds Prefix for meta box fields.
62
+		 *
63
+		 * @var array
64
+		 * @access protected
65
+		 */
66
+		protected $_fields;
67
+
68
+		/**
69
+		 * Use local images.
70
+		 *
71
+		 * @var bool
72
+		 * @access protected
73
+		 */
74
+		protected $_Local_images;
75
+
76
+		/**
77
+		 * What form is this? edit or new term.
78
+		 *
79
+		 * @var string
80
+		 * @access protected
81
+		 * $since 1.0
82
+		 */
83
+		protected $_form_type;
84
+		/**
85
+		 * SelfPath to allow themes as well as plugins.
86
+		 *
87
+		 * @var string
88
+		 * @access protected
89
+		 * $since 1.0
90
+		 */
91
+		protected $SelfPath;
92
+
93
+		/**
94
+		 * Constructor
95
+		 *
96
+		 * @since 1.0
97
+		 * @access public
98
+		 *
99
+		 * @param array $meta_box
100
+		 */
101
+		public function __construct($meta_box)
102
+		{
103
+
104
+			// If we are not in admin area exit.
105
+			if (!is_admin())
106
+				return;
107
+
108
+			// Assign meta box values to local variables and add it's missed values.
109
+			$this->_meta_box = $meta_box;
110
+			$this->_prefix = (isset($meta_box['prefix'])) ? $meta_box['prefix'] : '';
111
+			$this->_fields = &$this->_meta_box['fields'];
112
+			$this->_Local_images = (isset($meta_box['local_images'])) ? true : false;
113
+			$this->add_missed_values();
114
+			if (isset($meta_box['use_with_theme']))
115
+				if ($meta_box['use_with_theme'] === true) {
116
+					$this->SelfPath = get_stylesheet_directory_uri() . '/library/cat-meta';
117
+				} elseif ($meta_box['use_with_theme'] === false) {
118
+					$this->SelfPath = plugins_url('cat-meta-functions', plugin_basename(dirname(__FILE__)));
119
+				} else {
120
+					$this->SelfPath = $meta_box['use_with_theme'];
121
+				}
122
+			else {
123
+				$this->SelfPath = plugins_url('cat-meta-functions', plugin_basename(dirname(__FILE__)));
124
+			}
125
+
126
+
127
+			// Add Actions
128
+			add_action('admin_init', array(&$this, 'add'));
129
+
130
+			// Check for special fields and add needed actions for them.
131
+			$this->check_field_upload();
132
+			$this->check_field_color();
133
+			$this->check_field_date();
134
+			$this->check_field_time();
135
+
136
+			// Load common js, css files
137
+			// Must enqueue for all pages as we need js for the media upload, too.
138
+			add_action('admin_print_styles', array(&$this, 'load_scripts_styles'));
139
+
140
+		}
141
+
142
+		/**
143
+		 * Load all Javascript and CSS
144
+		 *
145
+		 * @since 1.0
146
+		 * @access public
147
+		 */
148
+		public function load_scripts_styles()
149
+		{
150
+
151
+			// Get Plugin Path
152
+			$plugin_path = $this->SelfPath;
153
+			//only load styles and js when needed
154
+			/* 
155 155
 		 * since 1.0
156 156
 		 */
157
-            $taxnow = isset($_REQUEST['taxonomy']) ? $_REQUEST['taxonomy'] : '';
158
-
159
-            if (!empty($this->_meta_box['pages'])) {
160
-                if (in_array($taxnow, $this->_meta_box['pages'])) {
161
-                    // Enqueue Meta Box Style
162
-                    //wp_enqueue_style( 'tax-meta-clss', $plugin_path . '/css/Tax-meta-class.css' );
163
-                    // Enqueue Meta Box Scripts
164
-                    //wp_enqueue_script( 'tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array( 'jquery' ), null, true );
165
-
166
-                }
167
-            }
168
-
169
-        }
170
-
171
-        /**
172
-         * Check the Field Upload, Add needed Actions
173
-         *
174
-         * @since 1.0
175
-         * @access public
176
-         */
177
-        public function enqueue_tax_meta_scripts()
178
-        {
179
-            // Make upload feature work event when custom post type doesn't support 'editor'
180
-            wp_enqueue_script('media-upload');
181
-            wp_enqueue_script('thickbox');
182
-            add_thickbox();
183
-            wp_enqueue_script('jquery-ui-core');
184
-            wp_enqueue_script('jquery-ui-sortable');
185
-
186
-
187
-        }
188
-
189
-        public function check_field_upload()
190
-        {
191
-
192
-            // Check if the field is an image or file. If not, return.
193
-            if (!$this->has_field('image') && !$this->has_field('file'))
194
-                return;
195
-
196
-
197
-            add_action('wp_enqueue_scripts', array(&$this, 'enqueue_tax_meta_scripts'), 100);
198
-
199
-            // Add data encoding type for file uploading.	
200
-            add_action('post_edit_form_tag', array(&$this, 'add_enctype'));
201
-
202
-
203
-            // Add filters for media upload.
204
-            add_filter('media_upload_gallery', array(&$this, 'insert_images'));
205
-            add_filter('media_upload_library', array(&$this, 'insert_images'));
206
-            add_filter('media_upload_image', array(&$this, 'insert_images'));
207
-
208
-            // Delete all attachments when delete custom post type.
209
-            add_action('wp_ajax_at_delete_file', array(&$this, 'delete_file'));
210
-            add_action('wp_ajax_at_reorder_images', array(&$this, 'reorder_images'));
211
-            // Delete file via Ajax
212
-            add_action('wp_ajax_at_delete_mupload', array($this, 'wp_ajax_delete_image'));
213
-        }
214
-
215
-        /**
216
-         * Add data encoding type for file uploading
217
-         *
218
-         * @since 1.0
219
-         * @access public
220
-         */
221
-        public function add_enctype()
222
-        {
223
-            echo ' enctype="multipart/form-data"';
224
-        }
225
-
226
-        /**
227
-         * Process images added to meta field.
228
-         *
229
-         * Modified from Faster Image Insert plugin.
230
-         *
231
-         * @return void
232
-         * @author Cory Crowley
233
-         */
234
-        public function insert_images()
235
-        {
236
-
237
-            // If post variables are empty, return.
238
-            if (!isset($_POST['at-insert']) || empty($_POST['attachments']))
239
-                return;
240
-
241
-            // Security Check
242
-            check_admin_referer('media-form');
243
-
244
-            // Create Security Nonce
245
-            $nonce = wp_create_nonce('at_ajax_delete');
246
-
247
-            // Get Post Id and Field Id
248
-            $term_id = $_POST['post_id'];
249
-            $id = $_POST['field_id'];
250
-
251
-            // Modify the insertion string
252
-            $html = '';
253
-            foreach ($_POST['attachments'] as $attachment_id => $attachment) {
254
-
255
-                // Strip Slashes
256
-                $attachment = stripslashes_deep($attachment);
257
-
258
-                // If not selected or url is empty, continue in loop.
259
-                if (empty($attachment['selected']) || empty($attachment['url']))
260
-                    continue;
261
-
262
-                $li = "<li id='item_{$attachment_id}'>";
263
-                $li .= "<img src='{$attachment['url']}' alt='image_{$attachment_id}' />";
264
-                //$li 	.= "<a title='" . __( 'Delete this image' ) . "' class='at-delete-file' href='#' rel='{$nonce}|{$term_id}|{$id}|{$attachment_id}'>" . __( 'Delete' ) . "</a>";
265
-                $li .= "<a title='" . __('Remove this image', 'geodirectory') . "' class='at-delete-file' href='#' rel='{$nonce}|{$term_id}|{$id}|{$attachment_id}'><img src='" . $this->SelfPath . "/images/delete-16.png' alt='" . __('Remove', 'geodirectory') . "' /></a>";
266
-                $li .= "<input type='hidden' name='{$id}[]' value='{$attachment_id}' />";
267
-                $li .= "</li>";
268
-                $html .= $li;
269
-
270
-            } // End For Each
271
-
272
-            return media_send_to_editor($html);
273
-
274
-        }
275
-
276
-        /**
277
-         * Delete attachments associated with the post.
278
-         *
279
-         * @since 1.0
280
-         * @access public
281
-         *
282
-         * @param int|string $term_id The term ID.
283
-         */
284
-        /*public function delete_attachments( $term_id ) {
157
+			$taxnow = isset($_REQUEST['taxonomy']) ? $_REQUEST['taxonomy'] : '';
158
+
159
+			if (!empty($this->_meta_box['pages'])) {
160
+				if (in_array($taxnow, $this->_meta_box['pages'])) {
161
+					// Enqueue Meta Box Style
162
+					//wp_enqueue_style( 'tax-meta-clss', $plugin_path . '/css/Tax-meta-class.css' );
163
+					// Enqueue Meta Box Scripts
164
+					//wp_enqueue_script( 'tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array( 'jquery' ), null, true );
165
+
166
+				}
167
+			}
168
+
169
+		}
170
+
171
+		/**
172
+		 * Check the Field Upload, Add needed Actions
173
+		 *
174
+		 * @since 1.0
175
+		 * @access public
176
+		 */
177
+		public function enqueue_tax_meta_scripts()
178
+		{
179
+			// Make upload feature work event when custom post type doesn't support 'editor'
180
+			wp_enqueue_script('media-upload');
181
+			wp_enqueue_script('thickbox');
182
+			add_thickbox();
183
+			wp_enqueue_script('jquery-ui-core');
184
+			wp_enqueue_script('jquery-ui-sortable');
185
+
186
+
187
+		}
188
+
189
+		public function check_field_upload()
190
+		{
191
+
192
+			// Check if the field is an image or file. If not, return.
193
+			if (!$this->has_field('image') && !$this->has_field('file'))
194
+				return;
195
+
196
+
197
+			add_action('wp_enqueue_scripts', array(&$this, 'enqueue_tax_meta_scripts'), 100);
198
+
199
+			// Add data encoding type for file uploading.	
200
+			add_action('post_edit_form_tag', array(&$this, 'add_enctype'));
201
+
202
+
203
+			// Add filters for media upload.
204
+			add_filter('media_upload_gallery', array(&$this, 'insert_images'));
205
+			add_filter('media_upload_library', array(&$this, 'insert_images'));
206
+			add_filter('media_upload_image', array(&$this, 'insert_images'));
207
+
208
+			// Delete all attachments when delete custom post type.
209
+			add_action('wp_ajax_at_delete_file', array(&$this, 'delete_file'));
210
+			add_action('wp_ajax_at_reorder_images', array(&$this, 'reorder_images'));
211
+			// Delete file via Ajax
212
+			add_action('wp_ajax_at_delete_mupload', array($this, 'wp_ajax_delete_image'));
213
+		}
214
+
215
+		/**
216
+		 * Add data encoding type for file uploading
217
+		 *
218
+		 * @since 1.0
219
+		 * @access public
220
+		 */
221
+		public function add_enctype()
222
+		{
223
+			echo ' enctype="multipart/form-data"';
224
+		}
225
+
226
+		/**
227
+		 * Process images added to meta field.
228
+		 *
229
+		 * Modified from Faster Image Insert plugin.
230
+		 *
231
+		 * @return void
232
+		 * @author Cory Crowley
233
+		 */
234
+		public function insert_images()
235
+		{
236
+
237
+			// If post variables are empty, return.
238
+			if (!isset($_POST['at-insert']) || empty($_POST['attachments']))
239
+				return;
240
+
241
+			// Security Check
242
+			check_admin_referer('media-form');
243
+
244
+			// Create Security Nonce
245
+			$nonce = wp_create_nonce('at_ajax_delete');
246
+
247
+			// Get Post Id and Field Id
248
+			$term_id = $_POST['post_id'];
249
+			$id = $_POST['field_id'];
250
+
251
+			// Modify the insertion string
252
+			$html = '';
253
+			foreach ($_POST['attachments'] as $attachment_id => $attachment) {
254
+
255
+				// Strip Slashes
256
+				$attachment = stripslashes_deep($attachment);
257
+
258
+				// If not selected or url is empty, continue in loop.
259
+				if (empty($attachment['selected']) || empty($attachment['url']))
260
+					continue;
261
+
262
+				$li = "<li id='item_{$attachment_id}'>";
263
+				$li .= "<img src='{$attachment['url']}' alt='image_{$attachment_id}' />";
264
+				//$li 	.= "<a title='" . __( 'Delete this image' ) . "' class='at-delete-file' href='#' rel='{$nonce}|{$term_id}|{$id}|{$attachment_id}'>" . __( 'Delete' ) . "</a>";
265
+				$li .= "<a title='" . __('Remove this image', 'geodirectory') . "' class='at-delete-file' href='#' rel='{$nonce}|{$term_id}|{$id}|{$attachment_id}'><img src='" . $this->SelfPath . "/images/delete-16.png' alt='" . __('Remove', 'geodirectory') . "' /></a>";
266
+				$li .= "<input type='hidden' name='{$id}[]' value='{$attachment_id}' />";
267
+				$li .= "</li>";
268
+				$html .= $li;
269
+
270
+			} // End For Each
271
+
272
+			return media_send_to_editor($html);
273
+
274
+		}
275
+
276
+		/**
277
+		 * Delete attachments associated with the post.
278
+		 *
279
+		 * @since 1.0
280
+		 * @access public
281
+		 *
282
+		 * @param int|string $term_id The term ID.
283
+		 */
284
+		/*public function delete_attachments( $term_id ) {
285 285
 		
286 286
 		// Get Attachments
287 287
 		$attachments = get_posts( array( 'numberposts' => -1, 'post_type' => 'attachment', 'post_parent' => $term_id ) );
@@ -295,349 +295,349 @@  discard block
 block discarded – undo
295 295
 		
296 296
 	}*/
297 297
 
298
-        /**
299
-         * Ajax callback for deleting files.
300
-         *
301
-         * Modified from a function used by "Verve Meta Boxes" plugin ( http://goo.gl/aw64H )
302
-         *
303
-         * @since 1.0
304
-         * @access public
305
-         */
306
-        public function delete_file()
307
-        {
308
-
309
-
310
-            // If data is not set, die.
311
-            if (!isset($_POST['data']))
312
-                die();
313
-
314
-            list($nonce, $term_id, $key, $attach_id) = explode('|', $_POST['data']);
315
-
316
-            if (!wp_verify_nonce($nonce, 'at_ajax_delete'))
317
-                die('1');
318
-
319
-            $this->delete_tax_meta($term_id, $key, $attach_id);
320
-
321
-            die('0');
322
-
323
-        }
324
-
325
-        /**
326
-         * Ajax callback for deleting files.
327
-         * Modified from a function used by "Verve Meta Boxes" plugin (http://goo.gl/LzYSq)
328
-         * @since 1.0
329
-         * @access public
330
-         */
331
-        public function wp_ajax_delete_image()
332
-        {
333
-            $term_id = isset($_GET['post_id']) ? intval($_GET['post_id']) : 0;
334
-            $field_id = isset($_GET['field_id']) ? $_GET['field_id'] : 0;
335
-            $attachment_id = isset($_GET['attachment_id']) ? intval($_GET['attachment_id']) : 0;
336
-            $ok = false;
337
-            if (strpos($field_id, '[') === false) {
338
-                check_admin_referer("at-delete-mupload_" . urldecode($field_id));
339
-                if ($term_id > 0)
340
-                    $this->delete_tax_meta($term_id, $field_id);
341
-                //$ok = wp_delete_attachment( $attachment_id );
342
-                $ok = 1;
343
-            } else {
344
-                $f = explode('[', urldecode($field_id));
345
-                $f_fiexed = array();
346
-                foreach ($f as $k => $v) {
347
-                    $f[$k] = str_replace(']', '', $v);
348
-                }
349
-                $saved = $this->get_tax_meta($term_id, $f[0], true);
350
-                if (isset($saved[$f[1]][$f[2]])) {
351
-                    unset($saved[$f[1]][$f[2]]);
352
-                    if ($term_id > 0)
353
-                        update_post_meta($term_id, $f[0], $saved);
354
-                    //$ok = wp_delete_attachment( $attachment_id );
355
-                    $ok = 1;
356
-                }
357
-            }
358
-
359
-
360
-            if ($ok) {
361
-                echo json_encode(array('status' => 'success'));
362
-                die();
363
-            } else {
364
-                echo json_encode(array('message' => __('Cannot delete file. Something\'s wrong.', 'geodirectory')));
365
-                die();
366
-            }
367
-        }
368
-
369
-        /**
370
-         * Ajax callback for reordering Images.
371
-         *
372
-         * @since 1.0
373
-         * @access public
374
-         */
375
-        public function reorder_images()
376
-        {
377
-
378
-            if (!isset($_POST['data']))
379
-                die();
380
-
381
-            list($order, $term_id, $key, $nonce) = explode('|', $_POST['data']);
382
-
383
-            if (!wp_verify_nonce($nonce, 'at_ajax_reorder'))
384
-                die('1');
385
-
386
-            parse_str($order, $items);
387
-            $items = $items['item'];
388
-            $order = 1;
389
-            foreach ($items as $item) {
390
-                wp_update_post(array('ID' => $item, 'post_parent' => $term_id, 'menu_order' => $order));
391
-                $order++;
392
-            }
393
-
394
-            die('0');
395
-
396
-        }
397
-
398
-        /**
399
-         * Check Field Color
400
-         *
401
-         * @since 1.0
402
-         * @access public
403
-         */
404
-        public function check_field_color()
405
-        {
406
-
407
-            if ($this->has_field('color') && $this->is_edit_page()) {
408
-                // Enqueu built-in script and style for color picker.
409
-                wp_enqueue_style('farbtastic');
410
-                wp_enqueue_script('farbtastic');
411
-            }
412
-
413
-        }
414
-
415
-        /**
416
-         * Check Field Date
417
-         *
418
-         * @since 1.0
419
-         * @access public
420
-         */
421
-        public function check_field_date()
422
-        {
423
-
424
-            if ($this->has_field('date') && $this->is_edit_page()) {
425
-                // Enqueu JQuery UI, use proper version.
426
-                wp_enqueue_style('tmc-jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/themes/base/jquery-ui.css');
427
-                wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/jquery-ui.min.js', array('jquery'));
428
-            }
429
-
430
-        }
431
-
432
-        /**
433
-         * Check Field Time
434
-         *
435
-         * @since 1.0
436
-         * @access public
437
-         */
438
-        public function check_field_time()
439
-        {
440
-
441
-            if ($this->has_field('time') && $this->is_edit_page()) {
442
-
443
-                // Enqueu JQuery UI, use proper version.
444
-                wp_enqueue_style('tmc-jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/themes/base/jquery-ui.css', array(), false, true);
445
-                wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/jquery-ui.min.js', array('jquery'), false, true);
446
-                wp_enqueue_script('at-timepicker', 'https://github.com/trentrichardson/jQuery-Timepicker-Addon/raw/master/jquery-ui-timepicker-addon.js', array('tmc-jquery-ui'), false, true);
447
-
448
-            }
449
-
450
-        }
451
-
452
-        /**
453
-         * Add Meta Box for multiple post types.
454
-         *
455
-         * @since 1.0
456
-         * @access public
457
-         */
458
-        public function add()
459
-        {
460
-
461
-            // Loop through array
462
-            if (!empty($this->_meta_box['pages'])) {
463
-                foreach ($this->_meta_box['pages'] as $page) {
464
-                    //add fields to edit form
465
-                    add_action($page . '_edit_form_fields', array(&$this, 'show_edit_form'));
466
-                    //add fields to add new form
467
-                    add_action($page . '_add_form_fields', array(&$this, 'show_new_form'));
468
-                    // this saves the edit fields
469
-                    add_action('edited_' . $page, array(&$this, 'save'), 10, 2);
470
-                    // this saves the add fields
471
-                    add_action('created_' . $page, array(&$this, 'save'), 10, 2);
472
-                }
473
-            }
474
-
475
-        }
476
-
477
-        /**
478
-         * Callback function to show fields on add new taxonomy term form.
479
-         *
480
-         * @since 1.0
481
-         * @access public
482
-         */
483
-        public function show_new_form($term_id)
484
-        {
485
-            $this->_form_type = 'new';
486
-            $this->show($term_id);
487
-        }
488
-
489
-        /**
490
-         * Callback function to show fields on term edit form.
491
-         *
492
-         * @since 1.0
493
-         * @access public
494
-         */
495
-        public function show_edit_form($term_id)
496
-        {
497
-            $this->_form_type = 'edit';
498
-            $this->show($term_id);
499
-        }
500
-
501
-
502
-        /**
503
-         * Callback function to show fields in meta box.
504
-         *
505
-         * @since 1.0
506
-         * @access public
507
-         */
508
-        public function show($term_id)
509
-        {
510
-
511
-            wp_nonce_field(basename(__FILE__), 'tax_meta_class_nonce');
512
-
513
-            foreach ($this->_fields as $field) {
514
-                $meta = $this->get_tax_meta($term_id, $field['id'], !$field['multiple']);
515
-                $meta = ($meta !== '') ? $meta : $field['std'];
516
-                if ('image' != $field['type'] && $field['type'] != 'repeater')
517
-                    $meta = is_array($meta) ? array_map('esc_attr', $meta) : esc_attr($meta);
518
-
519
-                if ($field['validate_func']) {
520
-                    echo '<tr class="form-field form-required ' . $field['style'] . '">';
521
-                } else {
522
-                    echo '<tr class="form-field ' . $field['style'] . '">';
523
-                }
524
-
525
-                // Call Separated methods for displaying each type of field.
526
-                call_user_func(array(&$this, 'show_field_' . $field['type']), $field, $meta);
527
-                echo '</tr>';
528
-            }
529
-            echo '</table>';
530
-        }
531
-
532
-        /**
533
-         * Show Repeater Fields.
534
-         *
535
-         * @param string $field
536
-         * @param string $meta
537
-         * @since 1.0
538
-         * @access public
539
-         */
540
-        public function show_field_repeater($field, $meta)
541
-        {
542
-            // Get Plugin Path
543
-            $plugin_path = $this->SelfPath;
544
-            $this->show_field_begin($field, $meta);
545
-            echo "<div class='at-repeat' id='{$field['id']}'>";
546
-
547
-            $c = 0;
548
-
549
-            if (count($meta) > 0 && is_array($meta)) {
550
-                foreach ($meta as $me) {
551
-                    //for labling toggles
552
-                    $mmm = $me[$field['fields'][0]['id']];
553
-                    echo '<div class="at-repater-block">' . $mmm . '<br/><table class="repeater-table" style="display: none;">';
554
-                    if ($field['inline']) {
555
-                        echo '<tr class="at-inline" VALIGN="top">';
556
-                    }
557
-                    foreach ($field['fields'] as $f) {
558
-                        //reset var $id for repeater
559
-                        $id = '';
560
-                        $id = $field['id'] . '[' . $c . '][' . $f['id'] . ']';
561
-                        $m = $me[$f['id']];
562
-                        $m = ($m !== '') ? $m : $f['std'];
563
-                        if ('image' != $f['type'] && $f['type'] != 'repeater')
564
-                            $m = is_array($m) ? array_map('esc_attr', $m) : esc_attr($m);
565
-                        //set new id for field in array format
566
-                        $f['id'] = $id;
567
-                        if (!$field['inline']) {
568
-                            echo '<tr>';
569
-                        }
570
-                        call_user_func(array(&$this, 'show_field_' . $f['type']), $f, $m);
571
-                        if (!$field['inline']) {
572
-                            echo '</tr>';
573
-                        }
574
-                    }
575
-                    if ($field['inline']) {
576
-                        echo '</tr>';
577
-                    }
578
-                    echo '</table>
298
+		/**
299
+		 * Ajax callback for deleting files.
300
+		 *
301
+		 * Modified from a function used by "Verve Meta Boxes" plugin ( http://goo.gl/aw64H )
302
+		 *
303
+		 * @since 1.0
304
+		 * @access public
305
+		 */
306
+		public function delete_file()
307
+		{
308
+
309
+
310
+			// If data is not set, die.
311
+			if (!isset($_POST['data']))
312
+				die();
313
+
314
+			list($nonce, $term_id, $key, $attach_id) = explode('|', $_POST['data']);
315
+
316
+			if (!wp_verify_nonce($nonce, 'at_ajax_delete'))
317
+				die('1');
318
+
319
+			$this->delete_tax_meta($term_id, $key, $attach_id);
320
+
321
+			die('0');
322
+
323
+		}
324
+
325
+		/**
326
+		 * Ajax callback for deleting files.
327
+		 * Modified from a function used by "Verve Meta Boxes" plugin (http://goo.gl/LzYSq)
328
+		 * @since 1.0
329
+		 * @access public
330
+		 */
331
+		public function wp_ajax_delete_image()
332
+		{
333
+			$term_id = isset($_GET['post_id']) ? intval($_GET['post_id']) : 0;
334
+			$field_id = isset($_GET['field_id']) ? $_GET['field_id'] : 0;
335
+			$attachment_id = isset($_GET['attachment_id']) ? intval($_GET['attachment_id']) : 0;
336
+			$ok = false;
337
+			if (strpos($field_id, '[') === false) {
338
+				check_admin_referer("at-delete-mupload_" . urldecode($field_id));
339
+				if ($term_id > 0)
340
+					$this->delete_tax_meta($term_id, $field_id);
341
+				//$ok = wp_delete_attachment( $attachment_id );
342
+				$ok = 1;
343
+			} else {
344
+				$f = explode('[', urldecode($field_id));
345
+				$f_fiexed = array();
346
+				foreach ($f as $k => $v) {
347
+					$f[$k] = str_replace(']', '', $v);
348
+				}
349
+				$saved = $this->get_tax_meta($term_id, $f[0], true);
350
+				if (isset($saved[$f[1]][$f[2]])) {
351
+					unset($saved[$f[1]][$f[2]]);
352
+					if ($term_id > 0)
353
+						update_post_meta($term_id, $f[0], $saved);
354
+					//$ok = wp_delete_attachment( $attachment_id );
355
+					$ok = 1;
356
+				}
357
+			}
358
+
359
+
360
+			if ($ok) {
361
+				echo json_encode(array('status' => 'success'));
362
+				die();
363
+			} else {
364
+				echo json_encode(array('message' => __('Cannot delete file. Something\'s wrong.', 'geodirectory')));
365
+				die();
366
+			}
367
+		}
368
+
369
+		/**
370
+		 * Ajax callback for reordering Images.
371
+		 *
372
+		 * @since 1.0
373
+		 * @access public
374
+		 */
375
+		public function reorder_images()
376
+		{
377
+
378
+			if (!isset($_POST['data']))
379
+				die();
380
+
381
+			list($order, $term_id, $key, $nonce) = explode('|', $_POST['data']);
382
+
383
+			if (!wp_verify_nonce($nonce, 'at_ajax_reorder'))
384
+				die('1');
385
+
386
+			parse_str($order, $items);
387
+			$items = $items['item'];
388
+			$order = 1;
389
+			foreach ($items as $item) {
390
+				wp_update_post(array('ID' => $item, 'post_parent' => $term_id, 'menu_order' => $order));
391
+				$order++;
392
+			}
393
+
394
+			die('0');
395
+
396
+		}
397
+
398
+		/**
399
+		 * Check Field Color
400
+		 *
401
+		 * @since 1.0
402
+		 * @access public
403
+		 */
404
+		public function check_field_color()
405
+		{
406
+
407
+			if ($this->has_field('color') && $this->is_edit_page()) {
408
+				// Enqueu built-in script and style for color picker.
409
+				wp_enqueue_style('farbtastic');
410
+				wp_enqueue_script('farbtastic');
411
+			}
412
+
413
+		}
414
+
415
+		/**
416
+		 * Check Field Date
417
+		 *
418
+		 * @since 1.0
419
+		 * @access public
420
+		 */
421
+		public function check_field_date()
422
+		{
423
+
424
+			if ($this->has_field('date') && $this->is_edit_page()) {
425
+				// Enqueu JQuery UI, use proper version.
426
+				wp_enqueue_style('tmc-jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/themes/base/jquery-ui.css');
427
+				wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/jquery-ui.min.js', array('jquery'));
428
+			}
429
+
430
+		}
431
+
432
+		/**
433
+		 * Check Field Time
434
+		 *
435
+		 * @since 1.0
436
+		 * @access public
437
+		 */
438
+		public function check_field_time()
439
+		{
440
+
441
+			if ($this->has_field('time') && $this->is_edit_page()) {
442
+
443
+				// Enqueu JQuery UI, use proper version.
444
+				wp_enqueue_style('tmc-jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/themes/base/jquery-ui.css', array(), false, true);
445
+				wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/jquery-ui.min.js', array('jquery'), false, true);
446
+				wp_enqueue_script('at-timepicker', 'https://github.com/trentrichardson/jQuery-Timepicker-Addon/raw/master/jquery-ui-timepicker-addon.js', array('tmc-jquery-ui'), false, true);
447
+
448
+			}
449
+
450
+		}
451
+
452
+		/**
453
+		 * Add Meta Box for multiple post types.
454
+		 *
455
+		 * @since 1.0
456
+		 * @access public
457
+		 */
458
+		public function add()
459
+		{
460
+
461
+			// Loop through array
462
+			if (!empty($this->_meta_box['pages'])) {
463
+				foreach ($this->_meta_box['pages'] as $page) {
464
+					//add fields to edit form
465
+					add_action($page . '_edit_form_fields', array(&$this, 'show_edit_form'));
466
+					//add fields to add new form
467
+					add_action($page . '_add_form_fields', array(&$this, 'show_new_form'));
468
+					// this saves the edit fields
469
+					add_action('edited_' . $page, array(&$this, 'save'), 10, 2);
470
+					// this saves the add fields
471
+					add_action('created_' . $page, array(&$this, 'save'), 10, 2);
472
+				}
473
+			}
474
+
475
+		}
476
+
477
+		/**
478
+		 * Callback function to show fields on add new taxonomy term form.
479
+		 *
480
+		 * @since 1.0
481
+		 * @access public
482
+		 */
483
+		public function show_new_form($term_id)
484
+		{
485
+			$this->_form_type = 'new';
486
+			$this->show($term_id);
487
+		}
488
+
489
+		/**
490
+		 * Callback function to show fields on term edit form.
491
+		 *
492
+		 * @since 1.0
493
+		 * @access public
494
+		 */
495
+		public function show_edit_form($term_id)
496
+		{
497
+			$this->_form_type = 'edit';
498
+			$this->show($term_id);
499
+		}
500
+
501
+
502
+		/**
503
+		 * Callback function to show fields in meta box.
504
+		 *
505
+		 * @since 1.0
506
+		 * @access public
507
+		 */
508
+		public function show($term_id)
509
+		{
510
+
511
+			wp_nonce_field(basename(__FILE__), 'tax_meta_class_nonce');
512
+
513
+			foreach ($this->_fields as $field) {
514
+				$meta = $this->get_tax_meta($term_id, $field['id'], !$field['multiple']);
515
+				$meta = ($meta !== '') ? $meta : $field['std'];
516
+				if ('image' != $field['type'] && $field['type'] != 'repeater')
517
+					$meta = is_array($meta) ? array_map('esc_attr', $meta) : esc_attr($meta);
518
+
519
+				if ($field['validate_func']) {
520
+					echo '<tr class="form-field form-required ' . $field['style'] . '">';
521
+				} else {
522
+					echo '<tr class="form-field ' . $field['style'] . '">';
523
+				}
524
+
525
+				// Call Separated methods for displaying each type of field.
526
+				call_user_func(array(&$this, 'show_field_' . $field['type']), $field, $meta);
527
+				echo '</tr>';
528
+			}
529
+			echo '</table>';
530
+		}
531
+
532
+		/**
533
+		 * Show Repeater Fields.
534
+		 *
535
+		 * @param string $field
536
+		 * @param string $meta
537
+		 * @since 1.0
538
+		 * @access public
539
+		 */
540
+		public function show_field_repeater($field, $meta)
541
+		{
542
+			// Get Plugin Path
543
+			$plugin_path = $this->SelfPath;
544
+			$this->show_field_begin($field, $meta);
545
+			echo "<div class='at-repeat' id='{$field['id']}'>";
546
+
547
+			$c = 0;
548
+
549
+			if (count($meta) > 0 && is_array($meta)) {
550
+				foreach ($meta as $me) {
551
+					//for labling toggles
552
+					$mmm = $me[$field['fields'][0]['id']];
553
+					echo '<div class="at-repater-block">' . $mmm . '<br/><table class="repeater-table" style="display: none;">';
554
+					if ($field['inline']) {
555
+						echo '<tr class="at-inline" VALIGN="top">';
556
+					}
557
+					foreach ($field['fields'] as $f) {
558
+						//reset var $id for repeater
559
+						$id = '';
560
+						$id = $field['id'] . '[' . $c . '][' . $f['id'] . ']';
561
+						$m = $me[$f['id']];
562
+						$m = ($m !== '') ? $m : $f['std'];
563
+						if ('image' != $f['type'] && $f['type'] != 'repeater')
564
+							$m = is_array($m) ? array_map('esc_attr', $m) : esc_attr($m);
565
+						//set new id for field in array format
566
+						$f['id'] = $id;
567
+						if (!$field['inline']) {
568
+							echo '<tr>';
569
+						}
570
+						call_user_func(array(&$this, 'show_field_' . $f['type']), $f, $m);
571
+						if (!$field['inline']) {
572
+							echo '</tr>';
573
+						}
574
+					}
575
+					if ($field['inline']) {
576
+						echo '</tr>';
577
+					}
578
+					echo '</table>
579 579
 				<span class="at-re-toggle"><img src="';
580
-                    if ($this->_Local_images) {
581
-                        echo $plugin_path . '/images/edit.png';
582
-                    } else {
583
-                        echo 'http://i.imgur.com/ka0E2.png';
584
-                    }
585
-                    echo '" alt="Edit" title="Edit"/></span> 
580
+					if ($this->_Local_images) {
581
+						echo $plugin_path . '/images/edit.png';
582
+					} else {
583
+						echo 'http://i.imgur.com/ka0E2.png';
584
+					}
585
+					echo '" alt="Edit" title="Edit"/></span> 
586 586
 				<img src="';
587
-                    if ($this->_Local_images) {
588
-                        echo $plugin_path . '/images/remove.png';
589
-                    } else {
590
-                        echo 'http://i.imgur.com/g8Duj.png';
591
-                    }
592
-                    echo '" alt="' . __('Remove', 'geodirectory') . '" title="' . __('Remove', 'geodirectory') . '" id="remove-' . $field['id'] . '"></div>';
593
-                    $c = $c + 1;
594
-
595
-                }
596
-                $this->show_field_end($field, $meta);
597
-            }
598
-
599
-            echo '<img src="';
600
-            if ($this->_Local_images) {
601
-                echo $plugin_path . '/images/add.png';
602
-            } else {
603
-                echo 'http://i.imgur.com/w5Tuc.png';
604
-            }
605
-            echo '" alt="' . __('Add', 'geodirectory') . '" title="' . __('Add', 'geodirectory') . '" id="add-' . $field['id'] . '"><br/></div>';
606
-
607
-            //create all fields once more for js function and catch with object buffer
608
-            ob_start();
609
-            echo '<div class="at-repater-block"><table class="repeater-table">';
610
-            if ($field['inline']) {
611
-                echo '<tr class="at-inline" VALIGN="top">';
612
-            }
613
-            foreach ($field['fields'] as $f) {
614
-                //reset var $id for repeater
615
-                $id = '';
616
-                $id = $field['id'] . '[CurrentCounter][' . $f['id'] . ']';
617
-                $f['id'] = $id;
618
-                if (!$field['inline']) {
619
-                    echo '<tr>';
620
-                }
621
-                call_user_func(array(&$this, 'show_field_' . $f['type']), $f, '');
622
-                if (!$field['inline']) {
623
-                    echo '</tr>';
624
-                }
625
-            }
626
-            if ($field['inline']) {
627
-                echo '</tr>';
628
-            }
629
-            echo '</table><img src="';
630
-            if ($this->_Local_images) {
631
-                echo $plugin_path . '/images/remove.png';
632
-            } else {
633
-                echo 'http://i.imgur.com/g8Duj.png';
634
-            }
635
-            echo '" alt="' . __('Remove', 'geodirectory') . '" title="' . __('Remove', 'geodirectory') . '" id="remove-' . $field['id'] . '"></div>';
636
-            $counter = 'countadd_' . $field['id'];
637
-            $js_code = ob_get_clean();
638
-            $js_code = str_replace("'", "\"", $js_code);
639
-            $js_code = str_replace("CurrentCounter", "' + " . $counter . " + '", $js_code);
640
-            echo '<script>
587
+					if ($this->_Local_images) {
588
+						echo $plugin_path . '/images/remove.png';
589
+					} else {
590
+						echo 'http://i.imgur.com/g8Duj.png';
591
+					}
592
+					echo '" alt="' . __('Remove', 'geodirectory') . '" title="' . __('Remove', 'geodirectory') . '" id="remove-' . $field['id'] . '"></div>';
593
+					$c = $c + 1;
594
+
595
+				}
596
+				$this->show_field_end($field, $meta);
597
+			}
598
+
599
+			echo '<img src="';
600
+			if ($this->_Local_images) {
601
+				echo $plugin_path . '/images/add.png';
602
+			} else {
603
+				echo 'http://i.imgur.com/w5Tuc.png';
604
+			}
605
+			echo '" alt="' . __('Add', 'geodirectory') . '" title="' . __('Add', 'geodirectory') . '" id="add-' . $field['id'] . '"><br/></div>';
606
+
607
+			//create all fields once more for js function and catch with object buffer
608
+			ob_start();
609
+			echo '<div class="at-repater-block"><table class="repeater-table">';
610
+			if ($field['inline']) {
611
+				echo '<tr class="at-inline" VALIGN="top">';
612
+			}
613
+			foreach ($field['fields'] as $f) {
614
+				//reset var $id for repeater
615
+				$id = '';
616
+				$id = $field['id'] . '[CurrentCounter][' . $f['id'] . ']';
617
+				$f['id'] = $id;
618
+				if (!$field['inline']) {
619
+					echo '<tr>';
620
+				}
621
+				call_user_func(array(&$this, 'show_field_' . $f['type']), $f, '');
622
+				if (!$field['inline']) {
623
+					echo '</tr>';
624
+				}
625
+			}
626
+			if ($field['inline']) {
627
+				echo '</tr>';
628
+			}
629
+			echo '</table><img src="';
630
+			if ($this->_Local_images) {
631
+				echo $plugin_path . '/images/remove.png';
632
+			} else {
633
+				echo 'http://i.imgur.com/g8Duj.png';
634
+			}
635
+			echo '" alt="' . __('Remove', 'geodirectory') . '" title="' . __('Remove', 'geodirectory') . '" id="remove-' . $field['id'] . '"></div>';
636
+			$counter = 'countadd_' . $field['id'];
637
+			$js_code = ob_get_clean();
638
+			$js_code = str_replace("'", "\"", $js_code);
639
+			$js_code = str_replace("CurrentCounter", "' + " . $counter . " + '", $js_code);
640
+			echo '<script>
641 641
 				jQuery(document).ready(function() {
642 642
 					var ' . $counter . ' = ' . $c . ';
643 643
 					jQuery("#add-' . $field['id'] . '").live(\'click\', function() {
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
         			});
651 651
     			});
652 652
     		</script>';
653
-            echo '<br/><style>
653
+			echo '<br/><style>
654 654
 .at-inline{line-height: 1 !important;}
655 655
 .at-inline .at-field{border: 0px !important;}
656 656
 .at-inline .at-label{margin: 0 0 1px !important;}
@@ -658,531 +658,531 @@  discard block
 block discarded – undo
658 658
 .at-inline .at-textarea{width: 100px; height: 75px;}
659 659
 .at-repater-block{background-color: #FFFFFF;border: 1px solid;margin: 2px;}
660 660
 </style>';
661
-            $this->show_field_end($field, $meta);
662
-        }
663
-
664
-        /**
665
-         * Begin Field.
666
-         *
667
-         * @param string $field
668
-         * @param string $meta
669
-         * @since 1.0
670
-         * @access public
671
-         */
672
-        public function show_field_begin($field, $meta)
673
-        {
674
-            if (isset($field['group'])) {
675
-                if ($field['group'] == "start") {
676
-                    echo "<td class='at-field'>";
677
-                }
678
-            } else {
679
-                if ($this->_form_type == 'edit') {
680
-                    echo '<th valign="top" scope="row">';
681
-                } else {
682
-                    if ($field['validate_func']) {
683
-                        echo '<td><div class="form-field form-required">';
684
-                    } else {
685
-                        echo '<td><div class="form-field">';
686
-                    }
687
-                }
688
-            }
689
-            if ($field['name'] != '' || $field['name'] != FALSE) {
690
-                //echo "<div class='at-label'>";
691
-                echo "<label for='{$field['id']}'>{$field['name']}</label>";
692
-                //echo "</div>";
693
-            }
694
-            if ($this->_form_type == 'edit') {
695
-                echo '</th><td>';
696
-            }
697
-        }
698
-
699
-        /**
700
-         * End Field.
701
-         *
702
-         * @param string $field
703
-         * @param string $meta
704
-         * @since 1.0
705
-         * @access public
706
-         */
707
-        public function show_field_end($field, $meta = NULL, $group = false)
708
-        {
709
-            if (isset($field['group'])) {
710
-                if ($group == 'end') {
711
-                    if ($field['desc'] != '') {
712
-                        echo "<p class='desc-field'>{$field['desc']}</p></td>";
713
-                    } else {
714
-                        echo "</td>";
715
-                    }
716
-                } else {
717
-                    if ($field['desc'] != '') {
718
-                        echo "<p class='desc-field'>{$field['desc']}</p><br/>";
719
-                    } else {
720
-                        echo '<br/>';
721
-                    }
722
-                }
723
-            } else {
724
-                if ($field['desc'] != '') {
725
-                    echo "<p class='desc-field'>{$field['desc']}</p>";
726
-                }
727
-                if ($this->_form_type == 'edit') {
728
-                    echo '</td>';
729
-                } else {
730
-                    echo '</td></div>';
731
-                }
732
-            }
733
-        }
734
-
735
-        /**
736
-         * Show Field Text.
737
-         *
738
-         * @param string $field
739
-         * @param string $meta
740
-         * @since 1.0
741
-         * @access public
742
-         */
743
-        public function show_field_text($field, $meta)
744
-        {
745
-            $this->show_field_begin($field, $meta);
746
-            echo "<input type='text' class='at-text' name='{$field['id']}' id='{$field['id']}' value='{$meta}' size='30' />";
747
-            $this->show_field_end($field, $meta);
748
-        }
749
-
750
-        /**
751
-         * Show Field hidden.
752
-         *
753
-         * @param string $field
754
-         * @param string|mixed $meta
755
-         * @since 0.1.3
756
-         * @access public
757
-         */
758
-        public function show_field_hidden($field, $meta)
759
-        {
760
-            //$this->show_field_begin( $field, $meta );
761
-            echo "<input type='hidden' class='at-text' name='{$field['id']}' id='{$field['id']}' value='{$meta}'/>";
762
-            //$this->show_field_end( $field, $meta );
763
-        }
764
-
765
-        /**
766
-         * Show Field Paragraph.
767
-         *
768
-         * @param string $field
769
-         * @since 0.1.3
770
-         * @access public
771
-         */
772
-        public function show_field_paragraph($field)
773
-        {
774
-            //$this->show_field_begin( $field, $meta );
775
-            echo '<p>' . $field['value'] . '</p>';
776
-            //$this->show_field_end( $field, $meta );
777
-        }
778
-
779
-        /**
780
-         * Show Field Textarea.
781
-         *
782
-         * @param string $field
783
-         * @param string $meta
784
-         * @since 1.0
785
-         * @access public
786
-         */
787
-        public function show_field_textarea($field, $meta)
788
-        {
789
-            $this->show_field_begin($field, $meta);
790
-            echo "<textarea class='at-textarea large-text' name='{$field['id']}' id='{$field['id']}' cols='60' rows='10'>{$meta}</textarea>";
791
-            $this->show_field_end($field, $meta);
792
-        }
793
-
794
-        /**
795
-         * Show Field Select.
796
-         *
797
-         * @param string $field
798
-         * @param string $meta
799
-         * @since 1.0
800
-         * @access public
801
-         */
802
-        public function show_field_select($field, $meta)
803
-        {
804
-
805
-            if (!is_array($meta))
806
-                $meta = (array)$meta;
807
-
808
-            $this->show_field_begin($field, $meta);
809
-            echo "<select class='at-select' name='{$field['id']}" . ($field['multiple'] ? "[]' id='{$field['id']}' multiple='multiple'" : "'") . ">";
810
-            foreach ($field['options'] as $key => $value) {
811
-                echo "<option value='{$key}'" . selected(in_array($key, $meta), true, false) . ">{$value}</option>";
812
-            }
813
-            echo "</select>";
814
-            $this->show_field_end($field, $meta);
815
-
816
-        }
817
-
818
-        /**
819
-         * Show Radio Field.
820
-         *
821
-         * @param string $field
822
-         * @param string $meta
823
-         * @since 1.0
824
-         * @access public
825
-         */
826
-        public function show_field_radio($field, $meta)
827
-        {
828
-
829
-            if (!is_array($meta))
830
-                $meta = (array)$meta;
831
-
832
-            $this->show_field_begin($field, $meta);
833
-            foreach ($field['options'] as $key => $value) {
834
-                echo "<input type='radio' class='at-radio' name='{$field['id']}' value='{$key}'" . checked(in_array($key, $meta), true, false) . " /> <span class='at-radio-label'>{$value}</span>";
835
-            }
836
-            $this->show_field_end($field, $meta);
837
-        }
838
-
839
-        /**
840
-         * Show Checkbox Field.
841
-         *
842
-         * @param string $field
843
-         * @param string $meta
844
-         * @since 1.0
845
-         * @access public
846
-         */
847
-        public function show_field_checkbox($field, $meta)
848
-        {
849
-
850
-            $this->show_field_begin($field, $meta);
851
-            echo "<input type='checkbox' class='rw-checkbox' name='{$field['id']}' id='{$field['id']}'" . checked(!empty($meta), true, false) . " /> {$field['desc']}";
852
-            $this->show_field_end($field, $meta);
853
-        }
854
-
855
-        /**
856
-         * Show Wysiwig Field.
857
-         *
858
-         * @param string $field
859
-         * @param string $meta
860
-         * @since 1.0
861
-         * @access public
862
-         */
863
-        public function show_field_wysiwyg($field, $meta)
864
-        {
865
-            $this->show_field_begin($field, $meta);
866
-            // Add TinyMCE script for WP version < 3.3
867
-            global $wp_version;
868
-
869
-            if (version_compare($wp_version, '3.2.1') < 1) {
870
-                echo "<textarea class='at-wysiwyg theEditor large-text' name='{$field['id']}' id='{$field['id']}' cols='60' rows='10'>{$meta}</textarea>";
871
-            } else {
872
-                // Use new wp_editor() since WP 3.3
873
-                wp_editor(stripslashes(html_entity_decode($meta)), $field['id'], array('editor_class' => 'at-wysiwyg'));
874
-            }
875
-            $this->show_field_end($field, $meta);
876
-        }
877
-
878
-        /**
879
-         * Show File Field.
880
-         *
881
-         * @global object $post The current post object.
882
-         * @param string $field
883
-         * @param string $meta
884
-         * @since 1.0
885
-         * @access public
886
-         */
887
-        public function show_field_file($field, $meta)
888
-        {
889
-
890
-            global $post;
891
-
892
-            if (!is_array($meta))
893
-                $meta = (array)$meta;
894
-
895
-            $this->show_field_begin($field, $meta);
896
-            echo "{$field['desc']}<br />";
897
-
898
-            if (!empty($meta)) {
899
-                $nonce = wp_create_nonce('at_ajax_delete');
900
-                echo '<div style="margin-bottom: 10px"><strong>' . __('Uploaded files', 'geodirectory') . '</strong></div>';
901
-                echo '<ol class="at-upload">';
902
-                foreach ($meta as $att) {
903
-                    // if (wp_attachment_is_image($att)) continue; // what's image uploader for?
904
-                    echo "<li>" . wp_get_attachment_link($att, '', false, false, ' ') . " (<a class='at-delete-file' href='#' rel='{$nonce}|{$post->ID}|{$field['id']}|{$att}'>" . __('Remove', 'geodirectory') . "</a>)</li>";
905
-                }
906
-                echo '</ol>';
907
-            }
908
-
909
-            // show form upload
910
-
911
-            echo "<div class='at-file-upload-label'>";
912
-            echo "<strong>" . __('Upload new files', 'geodirectory') . "</strong>";
913
-            echo "</div>";
914
-            echo "<div class='new-files'>";
915
-            echo "<div class='file-input'>";
916
-            echo "<input type='file' name='{$field['id']}[]' />";
917
-            echo "</div><!-- End .file-input -->";
918
-            echo "<a class='at-add-file button' href='#'>" . __('Add more files', 'geodirectory') . "</a>";
919
-            echo "</div><!-- End .new-files -->";
920
-            echo "</td>";
921
-            $this->show_field_end($field, $meta);
922
-        }
923
-
924
-        /**
925
-         * Show Image Field.
926
-         *
927
-         * @param array $field
928
-         * @param array $meta
929
-         * @since 1.0
930
-         * @access public
931
-         */
932
-        public function show_field_image($field, $meta)
933
-        {
934
-            $this->show_field_begin($field, $meta);
935
-            $html = wp_nonce_field("at-delete-mupload_{$field['id']}", "nonce-delete-mupload_" . $field['id'], false, false);
936
-            if (is_array($meta)) {
937
-                if (isset($meta[0]) && is_array($meta[0]))
938
-                    $meta = $meta[0];
939
-            }
940
-
941
-            $uploads = wp_upload_dir();
942
-            if (is_array($meta) && isset($meta['src']) && $meta['src'] != '') {
943
-                $file_info = pathinfo($meta['src']);
944
-
945
-                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
946
-                    $sub_dir = $file_info['dirname'];
947
-
948
-                $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
949
-                $uploads_baseurl = $uploads['baseurl'];
950
-                $uploads_path = $uploads['path'];
951
-
952
-                $file_name = $file_info['basename'];
953
-
954
-                if (strpos($sub_dir, 'https://') !== false) {
955
-                    $uploads['baseurl'] = str_replace('http://', 'https://', $uploads['baseurl']);
956
-                } else {
957
-                    $uploads['baseurl'] = str_replace('https://', 'http://', $uploads['baseurl']);
958
-                }
959
-                $sub_dir = str_replace($uploads['baseurl'], '', $sub_dir);
960
-
961
-                $uploads_url = $uploads_baseurl . $sub_dir;
962
-
963
-                $meta['src'] = $uploads_url . '/' . $file_name;
964
-
965
-                $html .= "<span class='mupload_img_holder'><img src='" . $meta['src'] . "' style='max-height: 150px;max-width: 150px;' /></span>";
966
-                $html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='" . $meta['id'] . "' />";
967
-                $html .= "<input type='hidden' class='" . $field['id'] . "[src]' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='" . $meta['src'] . "' />";
968
-                $html .= "<input class='at-delete_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Remove Image', 'geodirectory') . "' />";
969
-            } else {
970
-                $html .= "<span class='mupload_img_holder'></span>";
971
-                $html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='' />";
972
-                $html .= "<input class='" . $field['id'] . "[src]' style='position:absolute;left:-500px;width:50px;' type='text' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='' />";
973
-                $html .= "<input class='at-upload_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Upload Image', 'geodirectory') . "' />";
974
-            }
975
-            echo $html;
976
-            $this->show_field_end($field, $meta);
977
-        }
978
-
979
-        /**
980
-         * Show Color Field.
981
-         *
982
-         * @param string $field
983
-         * @param string $meta
984
-         * @since 1.0
985
-         * @access public
986
-         */
987
-        public function show_field_color($field, $meta)
988
-        {
989
-
990
-            if (empty($meta))
991
-                $meta = '#';
992
-
993
-            $this->show_field_begin($field, $meta);
994
-
995
-            echo "<input class='at-color' type='text' name='{$field['id']}' id='{$field['id']}' value='{$meta}' size='8' />";
996
-            //	echo "<a href='#' class='at-color-select button' rel='{$field['id']}'>" . __( 'Select a color' ) . "</a>";
997
-            echo "<input type='button' class='at-color-select button' rel='{$field['id']}' value='" . __('Select a color', 'geodirectory') . "'/>";
998
-            echo "<div style='display:none' class='at-color-picker' rel='{$field['id']}'></div>";
999
-            $this->show_field_end($field, $meta);
1000
-
1001
-        }
1002
-
1003
-        /**
1004
-         * Show Checkbox List Field
1005
-         *
1006
-         * @param string $field
1007
-         * @param string $meta
1008
-         * @since 1.0
1009
-         * @access public
1010
-         */
1011
-        public function show_field_checkbox_list($field, $meta)
1012
-        {
1013
-
1014
-            if (!is_array($meta))
1015
-                $meta = (array)$meta;
1016
-
1017
-            $this->show_field_begin($field, $meta);
1018
-
1019
-            $html = array();
1020
-
1021
-            foreach ($field['options'] as $key => $value) {
1022
-                $html[] = "<input type='checkbox' class='at-checkbox_list' name='{$field['id']}[]' value='{$key}'" . checked(in_array($key, $meta), true, false) . " /> {$value}";
1023
-            }
1024
-
1025
-            echo implode('<br />', $html);
1026
-
1027
-            $this->show_field_end($field, $meta);
1028
-
1029
-        }
1030
-
1031
-        /**
1032
-         * Show Date Field.
1033
-         *
1034
-         * @param string $field
1035
-         * @param string $meta
1036
-         * @since 1.0
1037
-         * @access public
1038
-         */
1039
-        public function show_field_date($field, $meta)
1040
-        {
1041
-            $this->show_field_begin($field, $meta);
1042
-            echo "<input type='text' class='at-date' name='{$field['id']}' id='{$field['id']}' rel='{$field['format']}' value='{$meta}' size='30' />";
1043
-            $this->show_field_end($field, $meta);
1044
-        }
1045
-
1046
-        /**
1047
-         * Show time field.
1048
-         *
1049
-         * @param string $field
1050
-         * @param string $meta
1051
-         * @since 1.0
1052
-         * @access public
1053
-         */
1054
-        public function show_field_time($field, $meta)
1055
-        {
1056
-            $this->show_field_begin($field, $meta);
1057
-            echo "<input type='text' class='at-time' name='{$field['id']}' id='{$field['id']}' rel='{$field['format']}' value='{$meta}' size='30' />";
1058
-            $this->show_field_end($field, $meta);
1059
-        }
1060
-
1061
-        /**
1062
-         * Show Posts field.
1063
-         * used creating a posts/pages/custom types checkboxlist or a select dropdown
1064
-         *
1065
-         * @global object $post The current post object.
1066
-         * @param string $field
1067
-         * @param string $meta
1068
-         * @since 1.0
1069
-         * @access public
1070
-         */
1071
-        public function show_field_posts($field, $meta)
1072
-        {
1073
-            global $post;
1074
-
1075
-            if (!is_array($meta)) $meta = (array)$meta;
1076
-            $this->show_field_begin($field, $meta);
1077
-            $options = $field['options'];
1078
-            $posts = get_posts($options['args']);
1079
-
1080
-            // checkbox_list
1081
-            if ('checkbox_list' == $options['type']) {
1082
-                foreach ($posts as $p) {
1083
-                    echo "<input type='checkbox' name='{$field['id']}[]' value='$p->ID'" . checked(in_array($p->ID, $meta), true, false) . " /> $p->post_title<br/>";
1084
-                }
1085
-            } // select
1086
-            else {
1087
-                echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1088
-                foreach ($posts as $p) {
1089
-                    echo "<option value='$p->ID'" . selected(in_array($p->ID, $meta), true, false) . ">$p->post_title</option>";
1090
-                }
1091
-                echo "</select>";
1092
-            }
1093
-
1094
-            $this->show_field_end($field, $meta);
1095
-        }
1096
-
1097
-        /**
1098
-         * Show Taxonomy field.
1099
-         * used creating a category/tags/custom taxonomy checkboxlist or a select dropdown
1100
-         *
1101
-         * @global object $post The current post object.
1102
-         * @param string $field
1103
-         * @param string $meta
1104
-         * @since 1.0
1105
-         * @access public
1106
-         *
1107
-         * @uses get_terms()
1108
-         */
1109
-        public function show_field_taxonomy($field, $meta)
1110
-        {
1111
-            global $post;
1112
-
1113
-            if (!is_array($meta)) $meta = (array)$meta;
1114
-            $this->show_field_begin($field, $meta);
1115
-            $options = $field['options'];
1116
-            $terms = get_terms($options['taxonomy'], $options['args']);
1117
-
1118
-            // checkbox_list
1119
-            if ('checkbox_list' == $options['type']) {
1120
-                foreach ($terms as $term) {
1121
-                    echo "<input type='checkbox' name='{$field['id']}[]' value='$term->slug'" . checked(in_array($term->slug, $meta), true, false) . " /> $term->name<br/>";
1122
-                }
1123
-            } // select
1124
-            else {
1125
-                echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1126
-                foreach ($terms as $term) {
1127
-                    echo "<option value='$term->slug'" . selected(in_array($term->slug, $meta), true, false) . ">$term->name</option>";
1128
-                }
1129
-                echo "</select>";
1130
-            }
1131
-
1132
-            $this->show_field_end($field, $meta);
1133
-        }
1134
-
1135
-        /**
1136
-         * Save Data from Metabox
1137
-         *
1138
-         * @param string $term_id The term ID.
1139
-         * @since 1.0
1140
-         * @access public
1141
-         * @return string
1142
-         */
1143
-        public function save($term_id)
1144
-        {
1145
-
1146
-            $taxnow = '';
1147
-            if (isset($_POST['taxonomy']))
1148
-                $taxnow = $_POST['taxonomy'];
1149
-
1150
-            if (!isset($term_id)                                                        // Check Revision
1151
-                || (!in_array($taxnow, $this->_meta_box['pages']))                            // Check if current taxonomy type is supported.
1152
-                || (!check_admin_referer(basename(__FILE__), 'tax_meta_class_nonce'))        // Check nonce - Security
1153
-                || (!current_user_can('manage_categories'))
1154
-            )                                // Check permission
1155
-            {
1156
-                return $term_id;
1157
-            }
1158
-
1159
-
1160
-            foreach ($this->_fields as $field) {
1161
-
1162
-                $name = $field['id'];
1163
-                $type = $field['type'];
1164
-                $old = $this->get_tax_meta($term_id, $name, !$field['multiple']);
1165
-                $new = (isset($_POST[$name])) ? $_POST[$name] : (($field['multiple']) ? array() : '');
1166
-
1167
-                // Validate meta value
1168
-                if (class_exists('Tax_Meta_Validate') && method_exists('Tax_Meta_Validate', $field['validate_func'])) {
1169
-                    $new = call_user_func(array('Tax_Meta_Validate', $field['validate_func']), $new);
1170
-                }
1171
-
1172
-
1173
-                if ($name == 'ct_cat_icon') {
1174
-
1175
-                    $upload_dir = wp_upload_dir();
1176
-
1177
-                    $image_name_arr = explode('/', $new['src']);
1178
-                    //$old_filename = end($image_name_arr);
1179
-                    //$img_name_arr = explode('.',$old_filename);
1180
-
1181
-                    //$old_filename = $upload_dir['path'].'/'.$old_filename;
1182
-
1183
-                    $new_filename = $upload_dir['path'] . '/' . 'cat_icon_' . $term_id . '.png';
1184
-
1185
-                    /*rename($old_filename, $new_filename);
661
+			$this->show_field_end($field, $meta);
662
+		}
663
+
664
+		/**
665
+		 * Begin Field.
666
+		 *
667
+		 * @param string $field
668
+		 * @param string $meta
669
+		 * @since 1.0
670
+		 * @access public
671
+		 */
672
+		public function show_field_begin($field, $meta)
673
+		{
674
+			if (isset($field['group'])) {
675
+				if ($field['group'] == "start") {
676
+					echo "<td class='at-field'>";
677
+				}
678
+			} else {
679
+				if ($this->_form_type == 'edit') {
680
+					echo '<th valign="top" scope="row">';
681
+				} else {
682
+					if ($field['validate_func']) {
683
+						echo '<td><div class="form-field form-required">';
684
+					} else {
685
+						echo '<td><div class="form-field">';
686
+					}
687
+				}
688
+			}
689
+			if ($field['name'] != '' || $field['name'] != FALSE) {
690
+				//echo "<div class='at-label'>";
691
+				echo "<label for='{$field['id']}'>{$field['name']}</label>";
692
+				//echo "</div>";
693
+			}
694
+			if ($this->_form_type == 'edit') {
695
+				echo '</th><td>';
696
+			}
697
+		}
698
+
699
+		/**
700
+		 * End Field.
701
+		 *
702
+		 * @param string $field
703
+		 * @param string $meta
704
+		 * @since 1.0
705
+		 * @access public
706
+		 */
707
+		public function show_field_end($field, $meta = NULL, $group = false)
708
+		{
709
+			if (isset($field['group'])) {
710
+				if ($group == 'end') {
711
+					if ($field['desc'] != '') {
712
+						echo "<p class='desc-field'>{$field['desc']}</p></td>";
713
+					} else {
714
+						echo "</td>";
715
+					}
716
+				} else {
717
+					if ($field['desc'] != '') {
718
+						echo "<p class='desc-field'>{$field['desc']}</p><br/>";
719
+					} else {
720
+						echo '<br/>';
721
+					}
722
+				}
723
+			} else {
724
+				if ($field['desc'] != '') {
725
+					echo "<p class='desc-field'>{$field['desc']}</p>";
726
+				}
727
+				if ($this->_form_type == 'edit') {
728
+					echo '</td>';
729
+				} else {
730
+					echo '</td></div>';
731
+				}
732
+			}
733
+		}
734
+
735
+		/**
736
+		 * Show Field Text.
737
+		 *
738
+		 * @param string $field
739
+		 * @param string $meta
740
+		 * @since 1.0
741
+		 * @access public
742
+		 */
743
+		public function show_field_text($field, $meta)
744
+		{
745
+			$this->show_field_begin($field, $meta);
746
+			echo "<input type='text' class='at-text' name='{$field['id']}' id='{$field['id']}' value='{$meta}' size='30' />";
747
+			$this->show_field_end($field, $meta);
748
+		}
749
+
750
+		/**
751
+		 * Show Field hidden.
752
+		 *
753
+		 * @param string $field
754
+		 * @param string|mixed $meta
755
+		 * @since 0.1.3
756
+		 * @access public
757
+		 */
758
+		public function show_field_hidden($field, $meta)
759
+		{
760
+			//$this->show_field_begin( $field, $meta );
761
+			echo "<input type='hidden' class='at-text' name='{$field['id']}' id='{$field['id']}' value='{$meta}'/>";
762
+			//$this->show_field_end( $field, $meta );
763
+		}
764
+
765
+		/**
766
+		 * Show Field Paragraph.
767
+		 *
768
+		 * @param string $field
769
+		 * @since 0.1.3
770
+		 * @access public
771
+		 */
772
+		public function show_field_paragraph($field)
773
+		{
774
+			//$this->show_field_begin( $field, $meta );
775
+			echo '<p>' . $field['value'] . '</p>';
776
+			//$this->show_field_end( $field, $meta );
777
+		}
778
+
779
+		/**
780
+		 * Show Field Textarea.
781
+		 *
782
+		 * @param string $field
783
+		 * @param string $meta
784
+		 * @since 1.0
785
+		 * @access public
786
+		 */
787
+		public function show_field_textarea($field, $meta)
788
+		{
789
+			$this->show_field_begin($field, $meta);
790
+			echo "<textarea class='at-textarea large-text' name='{$field['id']}' id='{$field['id']}' cols='60' rows='10'>{$meta}</textarea>";
791
+			$this->show_field_end($field, $meta);
792
+		}
793
+
794
+		/**
795
+		 * Show Field Select.
796
+		 *
797
+		 * @param string $field
798
+		 * @param string $meta
799
+		 * @since 1.0
800
+		 * @access public
801
+		 */
802
+		public function show_field_select($field, $meta)
803
+		{
804
+
805
+			if (!is_array($meta))
806
+				$meta = (array)$meta;
807
+
808
+			$this->show_field_begin($field, $meta);
809
+			echo "<select class='at-select' name='{$field['id']}" . ($field['multiple'] ? "[]' id='{$field['id']}' multiple='multiple'" : "'") . ">";
810
+			foreach ($field['options'] as $key => $value) {
811
+				echo "<option value='{$key}'" . selected(in_array($key, $meta), true, false) . ">{$value}</option>";
812
+			}
813
+			echo "</select>";
814
+			$this->show_field_end($field, $meta);
815
+
816
+		}
817
+
818
+		/**
819
+		 * Show Radio Field.
820
+		 *
821
+		 * @param string $field
822
+		 * @param string $meta
823
+		 * @since 1.0
824
+		 * @access public
825
+		 */
826
+		public function show_field_radio($field, $meta)
827
+		{
828
+
829
+			if (!is_array($meta))
830
+				$meta = (array)$meta;
831
+
832
+			$this->show_field_begin($field, $meta);
833
+			foreach ($field['options'] as $key => $value) {
834
+				echo "<input type='radio' class='at-radio' name='{$field['id']}' value='{$key}'" . checked(in_array($key, $meta), true, false) . " /> <span class='at-radio-label'>{$value}</span>";
835
+			}
836
+			$this->show_field_end($field, $meta);
837
+		}
838
+
839
+		/**
840
+		 * Show Checkbox Field.
841
+		 *
842
+		 * @param string $field
843
+		 * @param string $meta
844
+		 * @since 1.0
845
+		 * @access public
846
+		 */
847
+		public function show_field_checkbox($field, $meta)
848
+		{
849
+
850
+			$this->show_field_begin($field, $meta);
851
+			echo "<input type='checkbox' class='rw-checkbox' name='{$field['id']}' id='{$field['id']}'" . checked(!empty($meta), true, false) . " /> {$field['desc']}";
852
+			$this->show_field_end($field, $meta);
853
+		}
854
+
855
+		/**
856
+		 * Show Wysiwig Field.
857
+		 *
858
+		 * @param string $field
859
+		 * @param string $meta
860
+		 * @since 1.0
861
+		 * @access public
862
+		 */
863
+		public function show_field_wysiwyg($field, $meta)
864
+		{
865
+			$this->show_field_begin($field, $meta);
866
+			// Add TinyMCE script for WP version < 3.3
867
+			global $wp_version;
868
+
869
+			if (version_compare($wp_version, '3.2.1') < 1) {
870
+				echo "<textarea class='at-wysiwyg theEditor large-text' name='{$field['id']}' id='{$field['id']}' cols='60' rows='10'>{$meta}</textarea>";
871
+			} else {
872
+				// Use new wp_editor() since WP 3.3
873
+				wp_editor(stripslashes(html_entity_decode($meta)), $field['id'], array('editor_class' => 'at-wysiwyg'));
874
+			}
875
+			$this->show_field_end($field, $meta);
876
+		}
877
+
878
+		/**
879
+		 * Show File Field.
880
+		 *
881
+		 * @global object $post The current post object.
882
+		 * @param string $field
883
+		 * @param string $meta
884
+		 * @since 1.0
885
+		 * @access public
886
+		 */
887
+		public function show_field_file($field, $meta)
888
+		{
889
+
890
+			global $post;
891
+
892
+			if (!is_array($meta))
893
+				$meta = (array)$meta;
894
+
895
+			$this->show_field_begin($field, $meta);
896
+			echo "{$field['desc']}<br />";
897
+
898
+			if (!empty($meta)) {
899
+				$nonce = wp_create_nonce('at_ajax_delete');
900
+				echo '<div style="margin-bottom: 10px"><strong>' . __('Uploaded files', 'geodirectory') . '</strong></div>';
901
+				echo '<ol class="at-upload">';
902
+				foreach ($meta as $att) {
903
+					// if (wp_attachment_is_image($att)) continue; // what's image uploader for?
904
+					echo "<li>" . wp_get_attachment_link($att, '', false, false, ' ') . " (<a class='at-delete-file' href='#' rel='{$nonce}|{$post->ID}|{$field['id']}|{$att}'>" . __('Remove', 'geodirectory') . "</a>)</li>";
905
+				}
906
+				echo '</ol>';
907
+			}
908
+
909
+			// show form upload
910
+
911
+			echo "<div class='at-file-upload-label'>";
912
+			echo "<strong>" . __('Upload new files', 'geodirectory') . "</strong>";
913
+			echo "</div>";
914
+			echo "<div class='new-files'>";
915
+			echo "<div class='file-input'>";
916
+			echo "<input type='file' name='{$field['id']}[]' />";
917
+			echo "</div><!-- End .file-input -->";
918
+			echo "<a class='at-add-file button' href='#'>" . __('Add more files', 'geodirectory') . "</a>";
919
+			echo "</div><!-- End .new-files -->";
920
+			echo "</td>";
921
+			$this->show_field_end($field, $meta);
922
+		}
923
+
924
+		/**
925
+		 * Show Image Field.
926
+		 *
927
+		 * @param array $field
928
+		 * @param array $meta
929
+		 * @since 1.0
930
+		 * @access public
931
+		 */
932
+		public function show_field_image($field, $meta)
933
+		{
934
+			$this->show_field_begin($field, $meta);
935
+			$html = wp_nonce_field("at-delete-mupload_{$field['id']}", "nonce-delete-mupload_" . $field['id'], false, false);
936
+			if (is_array($meta)) {
937
+				if (isset($meta[0]) && is_array($meta[0]))
938
+					$meta = $meta[0];
939
+			}
940
+
941
+			$uploads = wp_upload_dir();
942
+			if (is_array($meta) && isset($meta['src']) && $meta['src'] != '') {
943
+				$file_info = pathinfo($meta['src']);
944
+
945
+				if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
946
+					$sub_dir = $file_info['dirname'];
947
+
948
+				$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
949
+				$uploads_baseurl = $uploads['baseurl'];
950
+				$uploads_path = $uploads['path'];
951
+
952
+				$file_name = $file_info['basename'];
953
+
954
+				if (strpos($sub_dir, 'https://') !== false) {
955
+					$uploads['baseurl'] = str_replace('http://', 'https://', $uploads['baseurl']);
956
+				} else {
957
+					$uploads['baseurl'] = str_replace('https://', 'http://', $uploads['baseurl']);
958
+				}
959
+				$sub_dir = str_replace($uploads['baseurl'], '', $sub_dir);
960
+
961
+				$uploads_url = $uploads_baseurl . $sub_dir;
962
+
963
+				$meta['src'] = $uploads_url . '/' . $file_name;
964
+
965
+				$html .= "<span class='mupload_img_holder'><img src='" . $meta['src'] . "' style='max-height: 150px;max-width: 150px;' /></span>";
966
+				$html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='" . $meta['id'] . "' />";
967
+				$html .= "<input type='hidden' class='" . $field['id'] . "[src]' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='" . $meta['src'] . "' />";
968
+				$html .= "<input class='at-delete_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Remove Image', 'geodirectory') . "' />";
969
+			} else {
970
+				$html .= "<span class='mupload_img_holder'></span>";
971
+				$html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='' />";
972
+				$html .= "<input class='" . $field['id'] . "[src]' style='position:absolute;left:-500px;width:50px;' type='text' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='' />";
973
+				$html .= "<input class='at-upload_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Upload Image', 'geodirectory') . "' />";
974
+			}
975
+			echo $html;
976
+			$this->show_field_end($field, $meta);
977
+		}
978
+
979
+		/**
980
+		 * Show Color Field.
981
+		 *
982
+		 * @param string $field
983
+		 * @param string $meta
984
+		 * @since 1.0
985
+		 * @access public
986
+		 */
987
+		public function show_field_color($field, $meta)
988
+		{
989
+
990
+			if (empty($meta))
991
+				$meta = '#';
992
+
993
+			$this->show_field_begin($field, $meta);
994
+
995
+			echo "<input class='at-color' type='text' name='{$field['id']}' id='{$field['id']}' value='{$meta}' size='8' />";
996
+			//	echo "<a href='#' class='at-color-select button' rel='{$field['id']}'>" . __( 'Select a color' ) . "</a>";
997
+			echo "<input type='button' class='at-color-select button' rel='{$field['id']}' value='" . __('Select a color', 'geodirectory') . "'/>";
998
+			echo "<div style='display:none' class='at-color-picker' rel='{$field['id']}'></div>";
999
+			$this->show_field_end($field, $meta);
1000
+
1001
+		}
1002
+
1003
+		/**
1004
+		 * Show Checkbox List Field
1005
+		 *
1006
+		 * @param string $field
1007
+		 * @param string $meta
1008
+		 * @since 1.0
1009
+		 * @access public
1010
+		 */
1011
+		public function show_field_checkbox_list($field, $meta)
1012
+		{
1013
+
1014
+			if (!is_array($meta))
1015
+				$meta = (array)$meta;
1016
+
1017
+			$this->show_field_begin($field, $meta);
1018
+
1019
+			$html = array();
1020
+
1021
+			foreach ($field['options'] as $key => $value) {
1022
+				$html[] = "<input type='checkbox' class='at-checkbox_list' name='{$field['id']}[]' value='{$key}'" . checked(in_array($key, $meta), true, false) . " /> {$value}";
1023
+			}
1024
+
1025
+			echo implode('<br />', $html);
1026
+
1027
+			$this->show_field_end($field, $meta);
1028
+
1029
+		}
1030
+
1031
+		/**
1032
+		 * Show Date Field.
1033
+		 *
1034
+		 * @param string $field
1035
+		 * @param string $meta
1036
+		 * @since 1.0
1037
+		 * @access public
1038
+		 */
1039
+		public function show_field_date($field, $meta)
1040
+		{
1041
+			$this->show_field_begin($field, $meta);
1042
+			echo "<input type='text' class='at-date' name='{$field['id']}' id='{$field['id']}' rel='{$field['format']}' value='{$meta}' size='30' />";
1043
+			$this->show_field_end($field, $meta);
1044
+		}
1045
+
1046
+		/**
1047
+		 * Show time field.
1048
+		 *
1049
+		 * @param string $field
1050
+		 * @param string $meta
1051
+		 * @since 1.0
1052
+		 * @access public
1053
+		 */
1054
+		public function show_field_time($field, $meta)
1055
+		{
1056
+			$this->show_field_begin($field, $meta);
1057
+			echo "<input type='text' class='at-time' name='{$field['id']}' id='{$field['id']}' rel='{$field['format']}' value='{$meta}' size='30' />";
1058
+			$this->show_field_end($field, $meta);
1059
+		}
1060
+
1061
+		/**
1062
+		 * Show Posts field.
1063
+		 * used creating a posts/pages/custom types checkboxlist or a select dropdown
1064
+		 *
1065
+		 * @global object $post The current post object.
1066
+		 * @param string $field
1067
+		 * @param string $meta
1068
+		 * @since 1.0
1069
+		 * @access public
1070
+		 */
1071
+		public function show_field_posts($field, $meta)
1072
+		{
1073
+			global $post;
1074
+
1075
+			if (!is_array($meta)) $meta = (array)$meta;
1076
+			$this->show_field_begin($field, $meta);
1077
+			$options = $field['options'];
1078
+			$posts = get_posts($options['args']);
1079
+
1080
+			// checkbox_list
1081
+			if ('checkbox_list' == $options['type']) {
1082
+				foreach ($posts as $p) {
1083
+					echo "<input type='checkbox' name='{$field['id']}[]' value='$p->ID'" . checked(in_array($p->ID, $meta), true, false) . " /> $p->post_title<br/>";
1084
+				}
1085
+			} // select
1086
+			else {
1087
+				echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1088
+				foreach ($posts as $p) {
1089
+					echo "<option value='$p->ID'" . selected(in_array($p->ID, $meta), true, false) . ">$p->post_title</option>";
1090
+				}
1091
+				echo "</select>";
1092
+			}
1093
+
1094
+			$this->show_field_end($field, $meta);
1095
+		}
1096
+
1097
+		/**
1098
+		 * Show Taxonomy field.
1099
+		 * used creating a category/tags/custom taxonomy checkboxlist or a select dropdown
1100
+		 *
1101
+		 * @global object $post The current post object.
1102
+		 * @param string $field
1103
+		 * @param string $meta
1104
+		 * @since 1.0
1105
+		 * @access public
1106
+		 *
1107
+		 * @uses get_terms()
1108
+		 */
1109
+		public function show_field_taxonomy($field, $meta)
1110
+		{
1111
+			global $post;
1112
+
1113
+			if (!is_array($meta)) $meta = (array)$meta;
1114
+			$this->show_field_begin($field, $meta);
1115
+			$options = $field['options'];
1116
+			$terms = get_terms($options['taxonomy'], $options['args']);
1117
+
1118
+			// checkbox_list
1119
+			if ('checkbox_list' == $options['type']) {
1120
+				foreach ($terms as $term) {
1121
+					echo "<input type='checkbox' name='{$field['id']}[]' value='$term->slug'" . checked(in_array($term->slug, $meta), true, false) . " /> $term->name<br/>";
1122
+				}
1123
+			} // select
1124
+			else {
1125
+				echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1126
+				foreach ($terms as $term) {
1127
+					echo "<option value='$term->slug'" . selected(in_array($term->slug, $meta), true, false) . ">$term->name</option>";
1128
+				}
1129
+				echo "</select>";
1130
+			}
1131
+
1132
+			$this->show_field_end($field, $meta);
1133
+		}
1134
+
1135
+		/**
1136
+		 * Save Data from Metabox
1137
+		 *
1138
+		 * @param string $term_id The term ID.
1139
+		 * @since 1.0
1140
+		 * @access public
1141
+		 * @return string
1142
+		 */
1143
+		public function save($term_id)
1144
+		{
1145
+
1146
+			$taxnow = '';
1147
+			if (isset($_POST['taxonomy']))
1148
+				$taxnow = $_POST['taxonomy'];
1149
+
1150
+			if (!isset($term_id)                                                        // Check Revision
1151
+				|| (!in_array($taxnow, $this->_meta_box['pages']))                            // Check if current taxonomy type is supported.
1152
+				|| (!check_admin_referer(basename(__FILE__), 'tax_meta_class_nonce'))        // Check nonce - Security
1153
+				|| (!current_user_can('manage_categories'))
1154
+			)                                // Check permission
1155
+			{
1156
+				return $term_id;
1157
+			}
1158
+
1159
+
1160
+			foreach ($this->_fields as $field) {
1161
+
1162
+				$name = $field['id'];
1163
+				$type = $field['type'];
1164
+				$old = $this->get_tax_meta($term_id, $name, !$field['multiple']);
1165
+				$new = (isset($_POST[$name])) ? $_POST[$name] : (($field['multiple']) ? array() : '');
1166
+
1167
+				// Validate meta value
1168
+				if (class_exists('Tax_Meta_Validate') && method_exists('Tax_Meta_Validate', $field['validate_func'])) {
1169
+					$new = call_user_func(array('Tax_Meta_Validate', $field['validate_func']), $new);
1170
+				}
1171
+
1172
+
1173
+				if ($name == 'ct_cat_icon') {
1174
+
1175
+					$upload_dir = wp_upload_dir();
1176
+
1177
+					$image_name_arr = explode('/', $new['src']);
1178
+					//$old_filename = end($image_name_arr);
1179
+					//$img_name_arr = explode('.',$old_filename);
1180
+
1181
+					//$old_filename = $upload_dir['path'].'/'.$old_filename;
1182
+
1183
+					$new_filename = $upload_dir['path'] . '/' . 'cat_icon_' . $term_id . '.png';
1184
+
1185
+					/*rename($old_filename, $new_filename);
1186 1186
 				
1187 1187
 				//subdir
1188 1188
 				$new['src'] = $upload_dir['url'].'/'.'cat_icon_'.$term_id.'.png';
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
 				update_attached_file( $new['id'], $new['src'] );*/
1191 1191
 
1192 1192
 
1193
-                    /*	
1193
+					/*	
1194 1194
 		
1195 1195
 		$new['src'] = $upload_dir['url'].'/'.'cat_icon_'.$term_id.'.png';
1196 1196
 		
@@ -1215,67 +1215,67 @@  discard block
 block discarded – undo
1215 1215
 		$attach_id = wp_insert_attachment( $attachment, $filename);*/
1216 1216
 
1217 1217
 
1218
-                }
1219
-
1220
-
1221
-                //skip on Paragraph field
1222
-                if ($type != "paragraph") {
1223
-
1224
-                    // Call defined method to save meta value, if there's no methods, call common one.
1225
-                    $save_func = 'save_field_' . $type;
1226
-                    if (method_exists($this, $save_func)) {
1227
-                        call_user_func(array(&$this, 'save_field_' . $type), $term_id, $field, $old, $new);
1228
-                    } else {
1229
-                        $this->save_field($term_id, $field, $old, $new);
1230
-                    }
1231
-                }
1232
-
1233
-            } // End foreach
1234
-
1235
-        }
1236
-
1237
-        /**
1238
-         * Common function for saving fields.
1239
-         *
1240
-         * @param string $term_id The term ID.
1241
-         * @param string $field
1242
-         * @param string $old
1243
-         * @param string|mixed $new
1244
-         * @since 1.0
1245
-         * @access public
1246
-         */
1247
-        public function save_field($term_id, $field, $old, $new)
1248
-        {
1249
-            $name = $field['id'];
1250
-            $this->delete_tax_meta($term_id, $name);
1251
-            if ($new === '' || $new === array())
1252
-                return;
1253
-
1254
-            $this->update_tax_meta($term_id, $name, $new);
1255
-        }
1256
-
1257
-        /**
1258
-         * function for saving image field.
1259
-         *
1260
-         * @param string $term_id The term ID.
1261
-         * @param string $field
1262
-         * @param string $old
1263
-         * @param string|mixed $new
1264
-         * @since 1.0
1265
-         * @access public
1266
-         */
1267
-        public function save_field_image($term_id, $field, $old, $new)
1268
-        {
1269
-            $name = $field['id'];
1270
-
1271
-            $this->delete_tax_meta($term_id, $name);
1272
-            if ($new === '' || $new === array() || $new['id'] == '' || $new['src'] == '')
1273
-                return;
1274
-
1275
-            $this->update_tax_meta($term_id, $name, $new);
1276
-        }
1277
-
1278
-        /*
1218
+				}
1219
+
1220
+
1221
+				//skip on Paragraph field
1222
+				if ($type != "paragraph") {
1223
+
1224
+					// Call defined method to save meta value, if there's no methods, call common one.
1225
+					$save_func = 'save_field_' . $type;
1226
+					if (method_exists($this, $save_func)) {
1227
+						call_user_func(array(&$this, 'save_field_' . $type), $term_id, $field, $old, $new);
1228
+					} else {
1229
+						$this->save_field($term_id, $field, $old, $new);
1230
+					}
1231
+				}
1232
+
1233
+			} // End foreach
1234
+
1235
+		}
1236
+
1237
+		/**
1238
+		 * Common function for saving fields.
1239
+		 *
1240
+		 * @param string $term_id The term ID.
1241
+		 * @param string $field
1242
+		 * @param string $old
1243
+		 * @param string|mixed $new
1244
+		 * @since 1.0
1245
+		 * @access public
1246
+		 */
1247
+		public function save_field($term_id, $field, $old, $new)
1248
+		{
1249
+			$name = $field['id'];
1250
+			$this->delete_tax_meta($term_id, $name);
1251
+			if ($new === '' || $new === array())
1252
+				return;
1253
+
1254
+			$this->update_tax_meta($term_id, $name, $new);
1255
+		}
1256
+
1257
+		/**
1258
+		 * function for saving image field.
1259
+		 *
1260
+		 * @param string $term_id The term ID.
1261
+		 * @param string $field
1262
+		 * @param string $old
1263
+		 * @param string|mixed $new
1264
+		 * @since 1.0
1265
+		 * @access public
1266
+		 */
1267
+		public function save_field_image($term_id, $field, $old, $new)
1268
+		{
1269
+			$name = $field['id'];
1270
+
1271
+			$this->delete_tax_meta($term_id, $name);
1272
+			if ($new === '' || $new === array() || $new['id'] == '' || $new['src'] == '')
1273
+				return;
1274
+
1275
+			$this->update_tax_meta($term_id, $name, $new);
1276
+		}
1277
+
1278
+		/*
1279 1279
 	 * Save Wysiwyg Field.
1280 1280
 	 *
1281 1281
 	 * @param string $term_id The term ID. 
@@ -1285,806 +1285,806 @@  discard block
 block discarded – undo
1285 1285
 	 * @since 1.0
1286 1286
 	 * @access public 
1287 1287
 	 */
1288
-        public function save_field_wysiwyg($term_id, $field, $old, $new)
1289
-        {
1290
-            $this->save_field($term_id, $field, $old, $new);
1291
-        }
1292
-
1293
-        /**
1294
-         * Save repeater Fields.
1295
-         *
1296
-         * @param string $term_id The term ID.
1297
-         * @param string $field
1298
-         * @param string|mixed $old
1299
-         * @param string|mixed $new
1300
-         * @since 1.0
1301
-         * @access public
1302
-         */
1303
-        public function save_field_repeater($term_id, $field, $old, $new)
1304
-        {
1305
-            if (is_array($new) && count($new) > 0) {
1306
-                foreach ($new as $n) {
1307
-                    foreach ($field['fields'] as $f) {
1308
-                        $type = $f['type'];
1309
-                        switch ($type) {
1310
-                            case 'wysiwyg':
1311
-                                $n[$f['id']] = wpautop($n[$f['id']]);
1312
-                                break;
1313
-                            case 'file':
1314
-                                $n[$f['id']] = $this->save_field_file_repeater($term_id, $f, '', $n[$f['id']]);
1315
-                                break;
1316
-                            default:
1317
-                                break;
1318
-                        }
1319
-                    }
1320
-                    if (!$this->is_array_empty($n))
1321
-                        $temp[] = $n;
1322
-                }
1323
-                if (isset($temp) && count($temp) > 0 && !$this->is_array_empty($temp)) {
1324
-                    $this->update_tax_meta($term_id, $field['id'], $temp);
1325
-                } else {
1326
-                    //	remove old meta if exists
1327
-                    delete_post_meta($term_id, $field['id']);
1328
-                }
1329
-            } else {
1330
-                //	remove old meta if exists
1331
-                delete_post_meta($term_id, $field['id']);
1332
-            }
1333
-        }
1334
-
1335
-        /**
1336
-         * Save File Field.
1337
-         *
1338
-         * @param string $term_id The term ID.
1339
-         * @param string $field
1340
-         * @param string $old
1341
-         * @param string $new
1342
-         * @since 1.0
1343
-         * @access public
1344
-         */
1345
-        public function save_field_file($term_id, $field, $old, $new)
1346
-        {
1347
-
1348
-            $name = $field['id'];
1349
-            if (empty($_FILES[$name]))
1350
-                return;
1351
-            $this->fix_file_array($_FILES[$name]);
1352
-            foreach ($_FILES[$name] as $position => $fileitem) {
1353
-
1354
-                $file = wp_handle_upload($fileitem, array('test_form' => false));
1355
-                if (empty($file['file']))
1356
-                    continue;
1357
-                $filename = $file['file'];
1358
-
1359
-                $attachment = array(
1360
-                    'post_mime_type' => $file['type'],
1361
-                    'guid' => $file['url'],
1362
-                    'post_parent' => $term_id,
1363
-                    'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),
1364
-                    'post_content' => ''
1365
-                );
1366
-
1367
-                $id = wp_insert_attachment($attachment, $filename, $term_id);
1368
-
1369
-                if (!is_wp_error($id)) {
1370
-
1371
-                    wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1372
-                    add_post_meta($term_id, $name, $id, false);    // save file's url in meta fields
1373
-
1374
-                } // End if
1375
-
1376
-            } // End foreach
1377
-
1378
-        }
1379
-
1380
-        /**
1381
-         * Save repeater File Field.
1382
-         * @param string $term_id The term ID.
1383
-         * @param string $field
1384
-         * @param string $old
1385
-         * @param string $new
1386
-         * @since 1.0
1387
-         * @access public
1388
-         * @return int|void
1389
-         */
1390
-        public function save_field_file_repeater($term_id, $field, $old, $new)
1391
-        {
1392
-
1393
-            $name = $field['id'];
1394
-            if (empty($_FILES[$name]))
1395
-                return;
1396
-            $this->fix_file_array($_FILES[$name]);
1397
-            foreach ($_FILES[$name] as $position => $fileitem) {
1398
-
1399
-                $file = wp_handle_upload($fileitem, array('test_form' => false));
1400
-                if (empty($file['file']))
1401
-                    continue;
1402
-                $filename = $file['file'];
1403
-
1404
-                $attachment = array(
1405
-                    'post_mime_type' => $file['type'],
1406
-                    'guid' => $file['url'],
1407
-                    'post_parent' => $term_id,
1408
-                    'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),
1409
-                    'post_content' => ''
1410
-                );
1411
-
1412
-                $id = wp_insert_attachment($attachment, $filename);
1413
-
1414
-                if (!is_wp_error($id)) {
1415
-
1416
-                    wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1417
-                    return $id;    // return file's url in meta fields
1418
-                } // End if
1419
-            } // End foreach
1420
-        }
1421
-
1422
-        /**
1423
-         * Add missed values for meta box.
1424
-         *
1425
-         * @since 1.0
1426
-         * @access public
1427
-         */
1428
-        public function add_missed_values()
1429
-        {
1430
-
1431
-            // Default values for meta box
1432
-            $this->_meta_box = array_merge(array('context' => 'normal', 'priority' => 'high', 'pages' => array('post')), (array)$this->_meta_box);
1433
-
1434
-            if(is_array($this->_fields)) {
1435
-                // Default values for fields
1436
-                foreach ($this->_fields as &$field) {
1437
-                    $multiple = in_array($field['type'], array('checkbox_list', 'file', 'image'));
1438
-                    $std = $multiple ? array() : '';
1439
-                    $format = 'date' == $field['type'] ? 'yy-mm-dd' : ('time' == $field['type'] ? 'hh:mm' : '');
1440
-                    $field = array_merge(array('multiple' => $multiple, 'std' => $std, 'desc' => '', 'format' => $format, 'validate_func' => ''), $field);
1441
-                } // End foreach
1442
-            }
1443
-        }
1444
-
1445
-        /**
1446
-         * Check if field with $type exists.
1447
-         *
1448
-         * @param string $type
1449
-         * @since 1.0
1450
-         * @access public
1451
-         */
1452
-        public function has_field($type)
1453
-        {
1454
-            if(is_array($this->_fields)) {
1455
-                foreach ($this->_fields as $field) {
1456
-                    if ($type == $field['type'])
1457
-                        return true;
1458
-                }
1459
-            }
1460
-            return false;
1461
-        }
1462
-
1463
-        /**
1464
-         * Check if current page is edit page.
1465
-         *
1466
-         * @since 1.0
1467
-         * @access public
1468
-         */
1469
-        public function is_edit_page()
1470
-        {
1471
-            global $pagenow;
1472
-            return ($pagenow == 'edit-tags.php' || $pagenow == 'term.php');
1473
-        }
1474
-
1475
-        /**
1476
-         * Fixes the odd indexing of multiple file uploads.
1477
-         *
1478
-         * Goes from the format:
1479
-         * $_FILES['field']['key']['index']
1480
-         * to
1481
-         * The More standard and appropriate:
1482
-         * $_FILES['field']['index']['key']
1483
-         *
1484
-         * @param string $files
1485
-         * @since 1.0
1486
-         * @access public
1487
-         */
1488
-        public function fix_file_array(&$files)
1489
-        {
1490
-
1491
-            $output = array();
1492
-
1493
-            foreach ($files as $key => $list) {
1494
-                foreach ($list as $index => $value) {
1495
-                    $output[$index][$key] = $value;
1496
-                }
1497
-            }
1498
-
1499
-            return $files = $output;
1500
-
1501
-        }
1502
-
1503
-        /**
1504
-         * Get proper JQuery UI version.
1505
-         *
1506
-         * Used in order to not conflict with WP Admin Scripts.
1507
-         *
1508
-         * @since 1.0
1509
-         * @access public
1510
-         */
1511
-        public function get_jqueryui_ver()
1512
-        {
1513
-
1514
-            global $wp_version;
1515
-
1516
-            if (version_compare($wp_version, '3.1', '>=')) {
1517
-                return '1.8.10';
1518
-            }
1519
-
1520
-            return '1.7.3';
1521
-
1522
-        }
1523
-
1524
-        /**
1525
-         *  Add Field to meta box (generic function)
1526
-         * @author Ohad Raz
1527
-         * @since 1.0
1528
-         * @access public
1529
-         * @param $id string  field id, i.e. the meta key
1530
-         * @param $args mixed|array
1531
-         */
1532
-        public function addField($id, $args)
1533
-        {
1534
-            $new_field = array('id' => $id, 'std' => '', 'desc' => '', 'style' => '');
1535
-            $new_field = array_merge($new_field, $args);
1536
-            $this->_fields[] = $new_field;
1537
-        }
1538
-
1539
-
1540
-        /**
1541
-         *  Add Text Field to meta box
1542
-         * @author Ohad Raz
1543
-         * @since 1.0
1544
-         * @access public
1545
-         * @param $id string  field id, i.e. the meta key
1546
-         * @param $args mixed|array
1547
-         *    'name' => // field name/label string optional
1548
-         *    'desc' => // field description, string optional
1549
-         *    'std' => // default value, string optional
1550
-         *    'style' =>    // custom style for field, string optional
1551
-         *    'validate_func' => // validate function, string optional
1552
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1553
-         */
1554
-        public function addText($id, $args, $repeater = false)
1555
-        {
1556
-            $new_field = array('type' => 'text', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Text Field', 'geodirectory'));
1557
-            $new_field = array_merge($new_field, $args);
1558
-            if (false === $repeater) {
1559
-                $this->_fields[] = $new_field;
1560
-            } else {
1561
-                return $new_field;
1562
-            }
1563
-        }
1564
-
1565
-        /**
1566
-         *  Add Hidden Field to meta box
1567
-         * @author Ohad Raz
1568
-         * @since 0.1.3
1569
-         * @access public
1570
-         * @param $id string  field id, i.e. the meta key
1571
-         * @param $args mixed|array
1572
-         *    'name' => // field name/label string optional
1573
-         *    'desc' => // field description, string optional
1574
-         *    'std' => // default value, string optional
1575
-         *    'style' =>    // custom style for field, string optional
1576
-         *    'validate_func' => // validate function, string optional
1577
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1578
-         */
1579
-        public function addHidden($id, $args, $repeater = false)
1580
-        {
1581
-            $new_field = array('type' => 'hidden', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Text Field', 'geodirectory'));
1582
-            $new_field = array_merge($new_field, $args);
1583
-            if (false === $repeater) {
1584
-                $this->_fields[] = $new_field;
1585
-            } else {
1586
-                return $new_field;
1587
-            }
1588
-        }
1589
-
1590
-        /**
1591
-         *  Add Paragraph to meta box
1592
-         * @author Ohad Raz
1593
-         * @since 0.1.3
1594
-         * @access public
1595
-         * @param $id string  field id, i.e. the meta key
1596
-         * @param $value  paragraph html
1597
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1598
-         */
1599
-        public function addParagraph($id, $args, $repeater = false)
1600
-        {
1601
-            $new_field = array('type' => 'paragraph', 'id' => $id, 'value' => '', 'style' => '');
1602
-            $new_field = array_merge($new_field, $args);
1603
-            if (false === $repeater) {
1604
-                $this->_fields[] = $new_field;
1605
-            } else {
1606
-                return $new_field;
1607
-            }
1608
-        }
1609
-
1610
-        /**
1611
-         *  Add Checkbox Field to meta box
1612
-         * @author Ohad Raz
1613
-         * @since 1.0
1614
-         * @access public
1615
-         * @param $id string  field id, i.e. the meta key
1616
-         * @param $args mixed|array
1617
-         *    'name' => // field name/label string optional
1618
-         *    'desc' => // field description, string optional
1619
-         *    'std' => // default value, string optional
1620
-         *    'validate_func' => // validate function, string optional
1621
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1622
-         */
1623
-        public function addCheckbox($id, $args, $repeater = false)
1624
-        {
1625
-            $new_field = array('type' => 'checkbox', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Checkbox Field', 'geodirectory'));
1626
-            $new_field = array_merge($new_field, $args);
1627
-            if (false === $repeater) {
1628
-                $this->_fields[] = $new_field;
1629
-            } else {
1630
-                return $new_field;
1631
-            }
1632
-        }
1633
-
1634
-        /**
1635
-         *  Add CheckboxList Field to meta box
1636
-         * @author Ohad Raz
1637
-         * @since 1.0
1638
-         * @access public
1639
-         * @param $id string  field id, i.e. the meta key
1640
-         * @param $options (array)  array of key => value pairs for select options
1641
-         * @param $args mixed|array
1642
-         *    'name' => // field name/label string optional
1643
-         *    'desc' => // field description, string optional
1644
-         *    'std' => // default value, string optional
1645
-         *    'validate_func' => // validate function, string optional
1646
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1647
-         *
1648
-         * @return : remember to call: $checkbox_list = $this->get_tax_meta(get_the_ID(), 'meta_name', false);
1649
-         *   which means the last param as false to get the values in an array
1650
-         */
1651
-        public function addCheckboxList($id, $options, $args, $repeater = false)
1652
-        {
1653
-            $new_field = array('type' => 'checkbox_list', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Checkbox List Field', 'geodirectory'));
1654
-            $new_field = array_merge($new_field, $args);
1655
-            if (false === $repeater) {
1656
-                $this->_fields[] = $new_field;
1657
-            } else {
1658
-                return $new_field;
1659
-            }
1660
-        }
1661
-
1662
-        /**
1663
-         *  Add Textarea Field to meta box
1664
-         * @author Ohad Raz
1665
-         * @since 1.0
1666
-         * @access public
1667
-         * @param $id string  field id, i.e. the meta key
1668
-         * @param $args mixed|array
1669
-         *    'name' => // field name/label string optional
1670
-         *    'desc' => // field description, string optional
1671
-         *    'std' => // default value, string optional
1672
-         *    'style' =>    // custom style for field, string optional
1673
-         *    'validate_func' => // validate function, string optional
1674
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1675
-         */
1676
-        public function addTextarea($id, $args, $repeater = false)
1677
-        {
1678
-            $new_field = array('type' => 'textarea', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Textarea Field', 'geodirectory'));
1679
-            $new_field = array_merge($new_field, $args);
1680
-            if (false === $repeater) {
1681
-                $this->_fields[] = $new_field;
1682
-            } else {
1683
-                return $new_field;
1684
-            }
1685
-        }
1686
-
1687
-        /**
1688
-         *  Add Select Field to meta box
1689
-         * @author Ohad Raz
1690
-         * @since 1.0
1691
-         * @access public
1692
-         * @param $id string field id, i.e. the meta key
1693
-         * @param $options (array)  array of key => value pairs for select options
1694
-         * @param $args mixed|array
1695
-         *    'name' => // field name/label string optional
1696
-         *    'desc' => // field description, string optional
1697
-         *    'std' => // default value, (array) optional
1698
-         *    'multiple' => // select multiple values, optional. Default is false.
1699
-         *    'validate_func' => // validate function, string optional
1700
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1701
-         */
1702
-        public function addSelect($id, $options, $args, $repeater = false)
1703
-        {
1704
-            $new_field = array('type' => 'select', 'id' => $id, 'std' => array(), 'desc' => '', 'style' => '', 'name' => __('Select Field', 'geodirectory'), 'multiple' => false, 'options' => $options);
1705
-            $new_field = array_merge($new_field, $args);
1706
-            if (false === $repeater) {
1707
-                $this->_fields[] = $new_field;
1708
-            } else {
1709
-                return $new_field;
1710
-            }
1711
-        }
1712
-
1713
-
1714
-        /**
1715
-         *  Add Radio Field to meta box
1716
-         * @author Ohad Raz
1717
-         * @since 1.0
1718
-         * @access public
1719
-         * @param $id string field id, i.e. the meta key
1720
-         * @param $options (array)  array of key => value pairs for radio options
1721
-         * @param $args mixed|array
1722
-         *    'name' => // field name/label string optional
1723
-         *    'desc' => // field description, string optional
1724
-         *    'std' => // default value, string optional
1725
-         *    'validate_func' => // validate function, string optional
1726
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1727
-         */
1728
-        public function addRadio($id, $options, $args, $repeater = false)
1729
-        {
1730
-            $new_field = array('type' => 'radio', 'id' => $id, 'std' => array(), 'desc' => '', 'style' => '', 'name' => __('Radio Field', 'geodirectory'), 'options' => $options);
1731
-            $new_field = array_merge($new_field, $args);
1732
-            if (false === $repeater) {
1733
-                $this->_fields[] = $new_field;
1734
-            } else {
1735
-                return $new_field;
1736
-            }
1737
-        }
1738
-
1739
-        /**
1740
-         *  Add Date Field to meta box
1741
-         * @author Ohad Raz
1742
-         * @since 1.0
1743
-         * @access public
1744
-         * @param $id string  field id, i.e. the meta key
1745
-         * @param $args mixed|array
1746
-         *    'name' => // field name/label string optional
1747
-         *    'desc' => // field description, string optional
1748
-         *    'std' => // default value, string optional
1749
-         *    'validate_func' => // validate function, string optional
1750
-         *    'format' => // date format, default yy-mm-dd. Optional. Default "'d MM, yy'"  See more formats here: http://goo.gl/Wcwxn
1751
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1752
-         */
1753
-        public function addDate($id, $args, $repeater = false)
1754
-        {
1755
-            $new_field = array('type' => 'date', 'id' => $id, 'std' => '', 'desc' => '', 'format' => 'yy-mm-dd', 'name' => __('Date Field', 'geodirectory'));
1756
-            $new_field = array_merge($new_field, $args);
1757
-            if (false === $repeater) {
1758
-                $this->_fields[] = $new_field;
1759
-            } else {
1760
-                return $new_field;
1761
-            }
1762
-        }
1763
-
1764
-        /**
1765
-         *  Add Time Field to meta box
1766
-         * @author Ohad Raz
1767
-         * @since 1.0
1768
-         * @access public
1769
-         * @param $id string- field id, i.e. the meta key
1770
-         * @param $args mixed|array
1771
-         *    'name' => // field name/label string optional
1772
-         *    'desc' => // field description, string optional
1773
-         *    'std' => // default value, string optional
1774
-         *    'validate_func' => // validate function, string optional
1775
-         *    'format' => // time format, default hh:mm. Optional. See more formats here: http://goo.gl/83woX
1776
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1777
-         */
1778
-        public function addTime($id, $args, $repeater = false)
1779
-        {
1780
-            $new_field = array('type' => 'time', 'id' => $id, 'std' => '', 'desc' => '', 'format' => 'hh:mm', 'name' => __('Time Field', 'geodirectory'));
1781
-            $new_field = array_merge($new_field, $args);
1782
-            if (false === $repeater) {
1783
-                $this->_fields[] = $new_field;
1784
-            } else {
1785
-                return $new_field;
1786
-            }
1787
-        }
1788
-
1789
-        /**
1790
-         *  Add Color Field to meta box
1791
-         * @author Ohad Raz
1792
-         * @since 1.0
1793
-         * @access public
1794
-         * @param $id string  field id, i.e. the meta key
1795
-         * @param $args mixed|array
1796
-         *    'name' => // field name/label string optional
1797
-         *    'desc' => // field description, string optional
1798
-         *    'std' => // default value, string optional
1799
-         *    'validate_func' => // validate function, string optional
1800
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1801
-         */
1802
-        public function addColor($id, $args, $repeater = false)
1803
-        {
1804
-            $new_field = array('type' => 'color', 'id' => $id, 'std' => '', 'desc' => '', 'name' => __('ColorPicker Field', 'geodirectory'));
1805
-            $new_field = array_merge($new_field, $args);
1806
-            if (false === $repeater) {
1807
-                $this->_fields[] = $new_field;
1808
-            } else {
1809
-                return $new_field;
1810
-            }
1811
-        }
1812
-
1813
-        /**
1814
-         *  Add Image Field to meta box
1815
-         * @author Ohad Raz
1816
-         * @since 1.0
1817
-         * @access public
1818
-         * @param $id string  field id, i.e. the meta key
1819
-         * @param $args mixed|array
1820
-         *    'name' => // field name/label string optional
1821
-         *    'desc' => // field description, string optional
1822
-         *    'validate_func' => // validate function, string optional
1823
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1824
-         */
1825
-        public function addImage($id, $args, $repeater = false)
1826
-        {
1827
-            $new_field = array('type' => 'image', 'id' => $id, 'desc' => '', 'style' => '', 'name' => __('Image Field', 'geodirectory'));
1828
-            $new_field = array_merge($new_field, $args);
1829
-
1830
-            if (false === $repeater) {
1831
-                $this->_fields[] = $new_field;
1832
-            } else {
1833
-                return $new_field;
1834
-            }
1835
-        }
1836
-
1837
-        /**
1838
-         *  Add File Field to meta box
1839
-         * @author Ohad Raz
1840
-         * @since 1.0
1841
-         * @access public
1842
-         * @param $id string  field id, i.e. the meta key
1843
-         * @param $args mixed|array
1844
-         *    'name' => // field name/label string optional
1845
-         *    'desc' => // field description, string optional
1846
-         *    'validate_func' => // validate function, string optional
1847
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1848
-         */
1849
-        public function addFile($id, $args, $repeater = false)
1850
-        {
1851
-            $new_field = array('type' => 'file', 'id' => $id, 'desc' => '', 'style' => '', 'name' => __('File Field', 'geodirectory'));
1852
-            $new_field = array_merge($new_field, $args);
1853
-            if (false === $repeater) {
1854
-                $this->_fields[] = $new_field;
1855
-            } else {
1856
-                return $new_field;
1857
-            }
1858
-        }
1859
-
1860
-        /**
1861
-         *  Add WYSIWYG Field to meta box
1862
-         * @author Ohad Raz
1863
-         * @since 1.0
1864
-         * @access public
1865
-         * @param $id string  field id, i.e. the meta key
1866
-         * @param $args mixed|array
1867
-         *    'name' => // field name/label string optional
1868
-         *    'desc' => // field description, string optional
1869
-         *    'std' => // default value, string optional
1870
-         *    'style' =>    // custom style for field, string optional Default 'width: 300px; height: 400px'
1871
-         *    'validate_func' => // validate function, string optional
1872
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1873
-         */
1874
-        public function addWysiwyg($id, $args, $repeater = false)
1875
-        {
1876
-            $new_field = array('type' => 'wysiwyg', 'id' => $id, 'std' => '', 'desc' => '', 'style' => 'width: 300px; height: 400px', 'name' => __('WYSIWYG Editor Field', 'geodirectory'));
1877
-            $new_field = array_merge($new_field, $args);
1878
-            if (false === $repeater) {
1879
-                $this->_fields[] = $new_field;
1880
-            } else {
1881
-                return $new_field;
1882
-            }
1883
-        }
1884
-
1885
-        /**
1886
-         *  Add Taxonomy Field to meta box
1887
-         * @author Ohad Raz
1888
-         * @since 1.0
1889
-         * @access public
1890
-         * @param $id string  field id, i.e. the meta key
1891
-         * @param $options mixed|array options of taxonomy field
1892
-         *    'taxonomy' =>    // taxonomy name can be category,post_tag or any custom taxonomy default is category
1893
-         * 'type' =>  // how to show taxonomy? 'select' (default) or 'checkbox_list'
1894
-         * 'args' =>  // arguments to query taxonomy, see http://goo.gl/uAANN default ('hide_empty' => false)
1895
-         * @param $args mixed|array
1896
-         *    'name' => // field name/label string optional
1897
-         *    'desc' => // field description, string optional
1898
-         *    'std' => // default value, string optional
1899
-         *    'validate_func' => // validate function, string optional
1900
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1901
-         */
1902
-        public function addTaxonomy($id, $options, $args, $repeater = false)
1903
-        {
1904
-            $q = array('hide_empty' => 0);
1905
-            $tax = 'category';
1906
-            $type = 'select';
1907
-            $temp = array($tax, $type, $q);
1908
-            $options = array_merge($temp, $options);
1909
-            $new_field = array('type' => 'taxonomy', 'id' => $id, 'desc' => '', 'name' => __('Taxonomy Field', 'geodirectory'), 'options' => $options);
1910
-            $new_field = array_merge($new_field, $args);
1911
-            if (false === $repeater) {
1912
-                $this->_fields[] = $new_field;
1913
-            } else {
1914
-                return $new_field;
1915
-            }
1916
-        }
1917
-
1918
-        /**
1919
-         *  Add posts Field to meta box
1920
-         * @author Ohad Raz
1921
-         * @since 1.0
1922
-         * @access public
1923
-         * @param $id string  field id, i.e. the meta key
1924
-         * @param $options mixed|array options of taxonomy field
1925
-         *    'post_type' =>    // post type name, 'post' (default) 'page' or any custom post type
1926
-         * 'type' =>  // how to show posts? 'select' (default) or 'checkbox_list'
1927
-         * 'args' =>  // arguments to query posts, see http://goo.gl/is0yK default ('posts_per_page' => -1)
1928
-         * @param $args mixed|array
1929
-         *    'name' => // field name/label string optional
1930
-         *    'desc' => // field description, string optional
1931
-         *    'std' => // default value, string optional
1932
-         *    'validate_func' => // validate function, string optional
1933
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1934
-         */
1935
-        public function addPosts($id, $options, $args, $repeater = false)
1936
-        {
1937
-            $q = array('posts_per_page' => -1);
1938
-            $temp = array('post_type' => 'post', 'type' => 'select', 'args' => $q);
1939
-            $options = array_merge($temp, $options);
1940
-            $new_field = array('type' => 'posts', 'id' => $id, 'desc' => '', 'name' => __('Posts Field', 'geodirectory'), 'options' => $options);
1941
-            $new_field = array_merge($new_field, $args);
1942
-            if (false === $repeater) {
1943
-                $this->_fields[] = $new_field;
1944
-            } else {
1945
-                return $new_field;
1946
-            }
1947
-        }
1948
-
1949
-        /**
1950
-         *  Add repeater Field Block to meta box
1951
-         * @author Ohad Raz
1952
-         * @since 1.0
1953
-         * @access public
1954
-         * @param $id string  field id, i.e. the meta key
1955
-         * @param $args mixed|array
1956
-         *    'name' => // field name/label string optional
1957
-         *    'desc' => // field description, string optional
1958
-         *    'std' => // default value, string optional
1959
-         *    'style' =>    // custom style for field, string optional
1960
-         *    'validate_func' => // validate function, string optional
1961
-         *    'fields' => //fields to repeater
1962
-         */
1963
-        public function addRepeaterBlock($id, $args)
1964
-        {
1965
-            $new_field = array('type' => 'repeater', 'id' => $id, 'name' => __('Reapeater Field', 'geodirectory'), 'fields' => array(), 'inline' => false);
1966
-            $new_field = array_merge($new_field, $args);
1967
-            $this->_fields[] = $new_field;
1968
-        }
1969
-
1970
-
1971
-        /**
1972
-         * Finish Declaration of Meta Box
1973
-         * @author Ohad Raz
1974
-         * @since 1.0
1975
-         * @access public
1976
-         */
1977
-        public function Finish()
1978
-        {
1979
-            $this->add_missed_values();
1980
-            $this->check_field_upload();
1981
-            $this->check_field_color();
1982
-            $this->check_field_date();
1983
-            $this->check_field_time();
1984
-        }
1985
-
1986
-        /**
1987
-         * Helper function to check for empty arrays
1988
-         * @author Ohad Raz
1989
-         * @since 1.0
1990
-         * @access public
1991
-         * @param $args mixed|array
1992
-         */
1993
-        public function is_array_empty($array)
1994
-        {
1995
-            if (!is_array($array))
1996
-                return true;
1997
-
1998
-            foreach ($array as $a) {
1999
-                if (is_array($a)) {
2000
-                    foreach ($a as $sub_a) {
2001
-                        if (!empty($sub_a) && $sub_a != '')
2002
-                            return false;
2003
-                    }
2004
-                } else {
2005
-                    if (!empty($a) && $a != '')
2006
-                        return false;
2007
-                }
2008
-            }
2009
-            return true;
2010
-        }
2011
-
2012
-
2013
-        //get term meta field
2014
-        public function get_tax_meta($term_id, $key, $multi = false, $post_type = '')
2015
-        {
2016
-
2017
-            if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2018
-                $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2019
-                $post_type = $taxObject->object_type[0];
2020
-            }
2021
-
2022
-            if($post_type=='post'){$post_type='';}
2023
-            if($post_type){$post_type = $post_type.'_';}
2024
-
2025
-            $t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2026
-
2027
-            $m = get_option('tax_meta_' . $post_type  . $t_id);
2028
-            if (isset($m[$key])) {
2029
-                return $m[$key];
2030
-            } else {
2031
-                return '';
2032
-            }
2033
-        }
2034
-
2035
-        //delete meta
2036
-        public function delete_tax_meta($term_id, $key, $post_type = '')
2037
-        {
2038
-
2039
-            if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2040
-                $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2041
-                $post_type = $taxObject->object_type[0];
2042
-            }
2043
-
2044
-            if($post_type=='post'){$post_type='';}
2045
-            if($post_type){$post_type = $post_type.'_';}
2046
-
2047
-            $m = get_option('tax_meta_' . $post_type  . $term_id);
2048
-
2049
-            if (isset($m[$key])) {
2050
-                unset($m[$key]);
2051
-            }
2052
-            update_option('tax_meta_' . $post_type  . $term_id, $m);
2053
-        }
2054
-
2055
-        //update meta
2056
-        public function update_tax_meta($term_id, $key, $value, $post_type = '')
2057
-        {
2058
-
2059
-            if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2060
-                $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2061
-                $post_type = $taxObject->object_type[0];
2062
-            }
2063
-
2064
-            if($post_type=='post'){$post_type='';}
2065
-            if($post_type){$post_type = $post_type.'_';}
2066
-
2067
-            $m = get_option('tax_meta_' . $post_type  . $term_id);
2068
-
2069
-            $m[$key] = $value;
2070
-            update_option('tax_meta_' . $post_type  . $term_id, $m);
2071
-
2072
-            /**
2073
-             * Called after the tax meta is updated.
2074
-             *
2075
-             * Used to update things after a GD category is saved.
2076
-             *
2077
-             * @since 1.0.0
2078
-             * @param bool $false False.
2079
-             * @param bool $true True.
2080
-             * @param int $term_id The term id being updated.
2081
-             * @param string $post_type The post type of the cat being updated.
2082
-             */
2083
-            do_action('gd_tax_meta_updated', false, true, $term_id, $post_type);
2084
-        }
2085
-
2086
-
2087
-    } // End Class
1288
+		public function save_field_wysiwyg($term_id, $field, $old, $new)
1289
+		{
1290
+			$this->save_field($term_id, $field, $old, $new);
1291
+		}
1292
+
1293
+		/**
1294
+		 * Save repeater Fields.
1295
+		 *
1296
+		 * @param string $term_id The term ID.
1297
+		 * @param string $field
1298
+		 * @param string|mixed $old
1299
+		 * @param string|mixed $new
1300
+		 * @since 1.0
1301
+		 * @access public
1302
+		 */
1303
+		public function save_field_repeater($term_id, $field, $old, $new)
1304
+		{
1305
+			if (is_array($new) && count($new) > 0) {
1306
+				foreach ($new as $n) {
1307
+					foreach ($field['fields'] as $f) {
1308
+						$type = $f['type'];
1309
+						switch ($type) {
1310
+							case 'wysiwyg':
1311
+								$n[$f['id']] = wpautop($n[$f['id']]);
1312
+								break;
1313
+							case 'file':
1314
+								$n[$f['id']] = $this->save_field_file_repeater($term_id, $f, '', $n[$f['id']]);
1315
+								break;
1316
+							default:
1317
+								break;
1318
+						}
1319
+					}
1320
+					if (!$this->is_array_empty($n))
1321
+						$temp[] = $n;
1322
+				}
1323
+				if (isset($temp) && count($temp) > 0 && !$this->is_array_empty($temp)) {
1324
+					$this->update_tax_meta($term_id, $field['id'], $temp);
1325
+				} else {
1326
+					//	remove old meta if exists
1327
+					delete_post_meta($term_id, $field['id']);
1328
+				}
1329
+			} else {
1330
+				//	remove old meta if exists
1331
+				delete_post_meta($term_id, $field['id']);
1332
+			}
1333
+		}
1334
+
1335
+		/**
1336
+		 * Save File Field.
1337
+		 *
1338
+		 * @param string $term_id The term ID.
1339
+		 * @param string $field
1340
+		 * @param string $old
1341
+		 * @param string $new
1342
+		 * @since 1.0
1343
+		 * @access public
1344
+		 */
1345
+		public function save_field_file($term_id, $field, $old, $new)
1346
+		{
1347
+
1348
+			$name = $field['id'];
1349
+			if (empty($_FILES[$name]))
1350
+				return;
1351
+			$this->fix_file_array($_FILES[$name]);
1352
+			foreach ($_FILES[$name] as $position => $fileitem) {
1353
+
1354
+				$file = wp_handle_upload($fileitem, array('test_form' => false));
1355
+				if (empty($file['file']))
1356
+					continue;
1357
+				$filename = $file['file'];
1358
+
1359
+				$attachment = array(
1360
+					'post_mime_type' => $file['type'],
1361
+					'guid' => $file['url'],
1362
+					'post_parent' => $term_id,
1363
+					'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),
1364
+					'post_content' => ''
1365
+				);
1366
+
1367
+				$id = wp_insert_attachment($attachment, $filename, $term_id);
1368
+
1369
+				if (!is_wp_error($id)) {
1370
+
1371
+					wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1372
+					add_post_meta($term_id, $name, $id, false);    // save file's url in meta fields
1373
+
1374
+				} // End if
1375
+
1376
+			} // End foreach
1377
+
1378
+		}
1379
+
1380
+		/**
1381
+		 * Save repeater File Field.
1382
+		 * @param string $term_id The term ID.
1383
+		 * @param string $field
1384
+		 * @param string $old
1385
+		 * @param string $new
1386
+		 * @since 1.0
1387
+		 * @access public
1388
+		 * @return int|void
1389
+		 */
1390
+		public function save_field_file_repeater($term_id, $field, $old, $new)
1391
+		{
1392
+
1393
+			$name = $field['id'];
1394
+			if (empty($_FILES[$name]))
1395
+				return;
1396
+			$this->fix_file_array($_FILES[$name]);
1397
+			foreach ($_FILES[$name] as $position => $fileitem) {
1398
+
1399
+				$file = wp_handle_upload($fileitem, array('test_form' => false));
1400
+				if (empty($file['file']))
1401
+					continue;
1402
+				$filename = $file['file'];
1403
+
1404
+				$attachment = array(
1405
+					'post_mime_type' => $file['type'],
1406
+					'guid' => $file['url'],
1407
+					'post_parent' => $term_id,
1408
+					'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),
1409
+					'post_content' => ''
1410
+				);
1411
+
1412
+				$id = wp_insert_attachment($attachment, $filename);
1413
+
1414
+				if (!is_wp_error($id)) {
1415
+
1416
+					wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1417
+					return $id;    // return file's url in meta fields
1418
+				} // End if
1419
+			} // End foreach
1420
+		}
1421
+
1422
+		/**
1423
+		 * Add missed values for meta box.
1424
+		 *
1425
+		 * @since 1.0
1426
+		 * @access public
1427
+		 */
1428
+		public function add_missed_values()
1429
+		{
1430
+
1431
+			// Default values for meta box
1432
+			$this->_meta_box = array_merge(array('context' => 'normal', 'priority' => 'high', 'pages' => array('post')), (array)$this->_meta_box);
1433
+
1434
+			if(is_array($this->_fields)) {
1435
+				// Default values for fields
1436
+				foreach ($this->_fields as &$field) {
1437
+					$multiple = in_array($field['type'], array('checkbox_list', 'file', 'image'));
1438
+					$std = $multiple ? array() : '';
1439
+					$format = 'date' == $field['type'] ? 'yy-mm-dd' : ('time' == $field['type'] ? 'hh:mm' : '');
1440
+					$field = array_merge(array('multiple' => $multiple, 'std' => $std, 'desc' => '', 'format' => $format, 'validate_func' => ''), $field);
1441
+				} // End foreach
1442
+			}
1443
+		}
1444
+
1445
+		/**
1446
+		 * Check if field with $type exists.
1447
+		 *
1448
+		 * @param string $type
1449
+		 * @since 1.0
1450
+		 * @access public
1451
+		 */
1452
+		public function has_field($type)
1453
+		{
1454
+			if(is_array($this->_fields)) {
1455
+				foreach ($this->_fields as $field) {
1456
+					if ($type == $field['type'])
1457
+						return true;
1458
+				}
1459
+			}
1460
+			return false;
1461
+		}
1462
+
1463
+		/**
1464
+		 * Check if current page is edit page.
1465
+		 *
1466
+		 * @since 1.0
1467
+		 * @access public
1468
+		 */
1469
+		public function is_edit_page()
1470
+		{
1471
+			global $pagenow;
1472
+			return ($pagenow == 'edit-tags.php' || $pagenow == 'term.php');
1473
+		}
1474
+
1475
+		/**
1476
+		 * Fixes the odd indexing of multiple file uploads.
1477
+		 *
1478
+		 * Goes from the format:
1479
+		 * $_FILES['field']['key']['index']
1480
+		 * to
1481
+		 * The More standard and appropriate:
1482
+		 * $_FILES['field']['index']['key']
1483
+		 *
1484
+		 * @param string $files
1485
+		 * @since 1.0
1486
+		 * @access public
1487
+		 */
1488
+		public function fix_file_array(&$files)
1489
+		{
1490
+
1491
+			$output = array();
1492
+
1493
+			foreach ($files as $key => $list) {
1494
+				foreach ($list as $index => $value) {
1495
+					$output[$index][$key] = $value;
1496
+				}
1497
+			}
1498
+
1499
+			return $files = $output;
1500
+
1501
+		}
1502
+
1503
+		/**
1504
+		 * Get proper JQuery UI version.
1505
+		 *
1506
+		 * Used in order to not conflict with WP Admin Scripts.
1507
+		 *
1508
+		 * @since 1.0
1509
+		 * @access public
1510
+		 */
1511
+		public function get_jqueryui_ver()
1512
+		{
1513
+
1514
+			global $wp_version;
1515
+
1516
+			if (version_compare($wp_version, '3.1', '>=')) {
1517
+				return '1.8.10';
1518
+			}
1519
+
1520
+			return '1.7.3';
1521
+
1522
+		}
1523
+
1524
+		/**
1525
+		 *  Add Field to meta box (generic function)
1526
+		 * @author Ohad Raz
1527
+		 * @since 1.0
1528
+		 * @access public
1529
+		 * @param $id string  field id, i.e. the meta key
1530
+		 * @param $args mixed|array
1531
+		 */
1532
+		public function addField($id, $args)
1533
+		{
1534
+			$new_field = array('id' => $id, 'std' => '', 'desc' => '', 'style' => '');
1535
+			$new_field = array_merge($new_field, $args);
1536
+			$this->_fields[] = $new_field;
1537
+		}
1538
+
1539
+
1540
+		/**
1541
+		 *  Add Text Field to meta box
1542
+		 * @author Ohad Raz
1543
+		 * @since 1.0
1544
+		 * @access public
1545
+		 * @param $id string  field id, i.e. the meta key
1546
+		 * @param $args mixed|array
1547
+		 *    'name' => // field name/label string optional
1548
+		 *    'desc' => // field description, string optional
1549
+		 *    'std' => // default value, string optional
1550
+		 *    'style' =>    // custom style for field, string optional
1551
+		 *    'validate_func' => // validate function, string optional
1552
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1553
+		 */
1554
+		public function addText($id, $args, $repeater = false)
1555
+		{
1556
+			$new_field = array('type' => 'text', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Text Field', 'geodirectory'));
1557
+			$new_field = array_merge($new_field, $args);
1558
+			if (false === $repeater) {
1559
+				$this->_fields[] = $new_field;
1560
+			} else {
1561
+				return $new_field;
1562
+			}
1563
+		}
1564
+
1565
+		/**
1566
+		 *  Add Hidden Field to meta box
1567
+		 * @author Ohad Raz
1568
+		 * @since 0.1.3
1569
+		 * @access public
1570
+		 * @param $id string  field id, i.e. the meta key
1571
+		 * @param $args mixed|array
1572
+		 *    'name' => // field name/label string optional
1573
+		 *    'desc' => // field description, string optional
1574
+		 *    'std' => // default value, string optional
1575
+		 *    'style' =>    // custom style for field, string optional
1576
+		 *    'validate_func' => // validate function, string optional
1577
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1578
+		 */
1579
+		public function addHidden($id, $args, $repeater = false)
1580
+		{
1581
+			$new_field = array('type' => 'hidden', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Text Field', 'geodirectory'));
1582
+			$new_field = array_merge($new_field, $args);
1583
+			if (false === $repeater) {
1584
+				$this->_fields[] = $new_field;
1585
+			} else {
1586
+				return $new_field;
1587
+			}
1588
+		}
1589
+
1590
+		/**
1591
+		 *  Add Paragraph to meta box
1592
+		 * @author Ohad Raz
1593
+		 * @since 0.1.3
1594
+		 * @access public
1595
+		 * @param $id string  field id, i.e. the meta key
1596
+		 * @param $value  paragraph html
1597
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1598
+		 */
1599
+		public function addParagraph($id, $args, $repeater = false)
1600
+		{
1601
+			$new_field = array('type' => 'paragraph', 'id' => $id, 'value' => '', 'style' => '');
1602
+			$new_field = array_merge($new_field, $args);
1603
+			if (false === $repeater) {
1604
+				$this->_fields[] = $new_field;
1605
+			} else {
1606
+				return $new_field;
1607
+			}
1608
+		}
1609
+
1610
+		/**
1611
+		 *  Add Checkbox Field to meta box
1612
+		 * @author Ohad Raz
1613
+		 * @since 1.0
1614
+		 * @access public
1615
+		 * @param $id string  field id, i.e. the meta key
1616
+		 * @param $args mixed|array
1617
+		 *    'name' => // field name/label string optional
1618
+		 *    'desc' => // field description, string optional
1619
+		 *    'std' => // default value, string optional
1620
+		 *    'validate_func' => // validate function, string optional
1621
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1622
+		 */
1623
+		public function addCheckbox($id, $args, $repeater = false)
1624
+		{
1625
+			$new_field = array('type' => 'checkbox', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Checkbox Field', 'geodirectory'));
1626
+			$new_field = array_merge($new_field, $args);
1627
+			if (false === $repeater) {
1628
+				$this->_fields[] = $new_field;
1629
+			} else {
1630
+				return $new_field;
1631
+			}
1632
+		}
1633
+
1634
+		/**
1635
+		 *  Add CheckboxList Field to meta box
1636
+		 * @author Ohad Raz
1637
+		 * @since 1.0
1638
+		 * @access public
1639
+		 * @param $id string  field id, i.e. the meta key
1640
+		 * @param $options (array)  array of key => value pairs for select options
1641
+		 * @param $args mixed|array
1642
+		 *    'name' => // field name/label string optional
1643
+		 *    'desc' => // field description, string optional
1644
+		 *    'std' => // default value, string optional
1645
+		 *    'validate_func' => // validate function, string optional
1646
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1647
+		 *
1648
+		 * @return : remember to call: $checkbox_list = $this->get_tax_meta(get_the_ID(), 'meta_name', false);
1649
+		 *   which means the last param as false to get the values in an array
1650
+		 */
1651
+		public function addCheckboxList($id, $options, $args, $repeater = false)
1652
+		{
1653
+			$new_field = array('type' => 'checkbox_list', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Checkbox List Field', 'geodirectory'));
1654
+			$new_field = array_merge($new_field, $args);
1655
+			if (false === $repeater) {
1656
+				$this->_fields[] = $new_field;
1657
+			} else {
1658
+				return $new_field;
1659
+			}
1660
+		}
1661
+
1662
+		/**
1663
+		 *  Add Textarea Field to meta box
1664
+		 * @author Ohad Raz
1665
+		 * @since 1.0
1666
+		 * @access public
1667
+		 * @param $id string  field id, i.e. the meta key
1668
+		 * @param $args mixed|array
1669
+		 *    'name' => // field name/label string optional
1670
+		 *    'desc' => // field description, string optional
1671
+		 *    'std' => // default value, string optional
1672
+		 *    'style' =>    // custom style for field, string optional
1673
+		 *    'validate_func' => // validate function, string optional
1674
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1675
+		 */
1676
+		public function addTextarea($id, $args, $repeater = false)
1677
+		{
1678
+			$new_field = array('type' => 'textarea', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Textarea Field', 'geodirectory'));
1679
+			$new_field = array_merge($new_field, $args);
1680
+			if (false === $repeater) {
1681
+				$this->_fields[] = $new_field;
1682
+			} else {
1683
+				return $new_field;
1684
+			}
1685
+		}
1686
+
1687
+		/**
1688
+		 *  Add Select Field to meta box
1689
+		 * @author Ohad Raz
1690
+		 * @since 1.0
1691
+		 * @access public
1692
+		 * @param $id string field id, i.e. the meta key
1693
+		 * @param $options (array)  array of key => value pairs for select options
1694
+		 * @param $args mixed|array
1695
+		 *    'name' => // field name/label string optional
1696
+		 *    'desc' => // field description, string optional
1697
+		 *    'std' => // default value, (array) optional
1698
+		 *    'multiple' => // select multiple values, optional. Default is false.
1699
+		 *    'validate_func' => // validate function, string optional
1700
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1701
+		 */
1702
+		public function addSelect($id, $options, $args, $repeater = false)
1703
+		{
1704
+			$new_field = array('type' => 'select', 'id' => $id, 'std' => array(), 'desc' => '', 'style' => '', 'name' => __('Select Field', 'geodirectory'), 'multiple' => false, 'options' => $options);
1705
+			$new_field = array_merge($new_field, $args);
1706
+			if (false === $repeater) {
1707
+				$this->_fields[] = $new_field;
1708
+			} else {
1709
+				return $new_field;
1710
+			}
1711
+		}
1712
+
1713
+
1714
+		/**
1715
+		 *  Add Radio Field to meta box
1716
+		 * @author Ohad Raz
1717
+		 * @since 1.0
1718
+		 * @access public
1719
+		 * @param $id string field id, i.e. the meta key
1720
+		 * @param $options (array)  array of key => value pairs for radio options
1721
+		 * @param $args mixed|array
1722
+		 *    'name' => // field name/label string optional
1723
+		 *    'desc' => // field description, string optional
1724
+		 *    'std' => // default value, string optional
1725
+		 *    'validate_func' => // validate function, string optional
1726
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1727
+		 */
1728
+		public function addRadio($id, $options, $args, $repeater = false)
1729
+		{
1730
+			$new_field = array('type' => 'radio', 'id' => $id, 'std' => array(), 'desc' => '', 'style' => '', 'name' => __('Radio Field', 'geodirectory'), 'options' => $options);
1731
+			$new_field = array_merge($new_field, $args);
1732
+			if (false === $repeater) {
1733
+				$this->_fields[] = $new_field;
1734
+			} else {
1735
+				return $new_field;
1736
+			}
1737
+		}
1738
+
1739
+		/**
1740
+		 *  Add Date Field to meta box
1741
+		 * @author Ohad Raz
1742
+		 * @since 1.0
1743
+		 * @access public
1744
+		 * @param $id string  field id, i.e. the meta key
1745
+		 * @param $args mixed|array
1746
+		 *    'name' => // field name/label string optional
1747
+		 *    'desc' => // field description, string optional
1748
+		 *    'std' => // default value, string optional
1749
+		 *    'validate_func' => // validate function, string optional
1750
+		 *    'format' => // date format, default yy-mm-dd. Optional. Default "'d MM, yy'"  See more formats here: http://goo.gl/Wcwxn
1751
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1752
+		 */
1753
+		public function addDate($id, $args, $repeater = false)
1754
+		{
1755
+			$new_field = array('type' => 'date', 'id' => $id, 'std' => '', 'desc' => '', 'format' => 'yy-mm-dd', 'name' => __('Date Field', 'geodirectory'));
1756
+			$new_field = array_merge($new_field, $args);
1757
+			if (false === $repeater) {
1758
+				$this->_fields[] = $new_field;
1759
+			} else {
1760
+				return $new_field;
1761
+			}
1762
+		}
1763
+
1764
+		/**
1765
+		 *  Add Time Field to meta box
1766
+		 * @author Ohad Raz
1767
+		 * @since 1.0
1768
+		 * @access public
1769
+		 * @param $id string- field id, i.e. the meta key
1770
+		 * @param $args mixed|array
1771
+		 *    'name' => // field name/label string optional
1772
+		 *    'desc' => // field description, string optional
1773
+		 *    'std' => // default value, string optional
1774
+		 *    'validate_func' => // validate function, string optional
1775
+		 *    'format' => // time format, default hh:mm. Optional. See more formats here: http://goo.gl/83woX
1776
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1777
+		 */
1778
+		public function addTime($id, $args, $repeater = false)
1779
+		{
1780
+			$new_field = array('type' => 'time', 'id' => $id, 'std' => '', 'desc' => '', 'format' => 'hh:mm', 'name' => __('Time Field', 'geodirectory'));
1781
+			$new_field = array_merge($new_field, $args);
1782
+			if (false === $repeater) {
1783
+				$this->_fields[] = $new_field;
1784
+			} else {
1785
+				return $new_field;
1786
+			}
1787
+		}
1788
+
1789
+		/**
1790
+		 *  Add Color Field to meta box
1791
+		 * @author Ohad Raz
1792
+		 * @since 1.0
1793
+		 * @access public
1794
+		 * @param $id string  field id, i.e. the meta key
1795
+		 * @param $args mixed|array
1796
+		 *    'name' => // field name/label string optional
1797
+		 *    'desc' => // field description, string optional
1798
+		 *    'std' => // default value, string optional
1799
+		 *    'validate_func' => // validate function, string optional
1800
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1801
+		 */
1802
+		public function addColor($id, $args, $repeater = false)
1803
+		{
1804
+			$new_field = array('type' => 'color', 'id' => $id, 'std' => '', 'desc' => '', 'name' => __('ColorPicker Field', 'geodirectory'));
1805
+			$new_field = array_merge($new_field, $args);
1806
+			if (false === $repeater) {
1807
+				$this->_fields[] = $new_field;
1808
+			} else {
1809
+				return $new_field;
1810
+			}
1811
+		}
1812
+
1813
+		/**
1814
+		 *  Add Image Field to meta box
1815
+		 * @author Ohad Raz
1816
+		 * @since 1.0
1817
+		 * @access public
1818
+		 * @param $id string  field id, i.e. the meta key
1819
+		 * @param $args mixed|array
1820
+		 *    'name' => // field name/label string optional
1821
+		 *    'desc' => // field description, string optional
1822
+		 *    'validate_func' => // validate function, string optional
1823
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1824
+		 */
1825
+		public function addImage($id, $args, $repeater = false)
1826
+		{
1827
+			$new_field = array('type' => 'image', 'id' => $id, 'desc' => '', 'style' => '', 'name' => __('Image Field', 'geodirectory'));
1828
+			$new_field = array_merge($new_field, $args);
1829
+
1830
+			if (false === $repeater) {
1831
+				$this->_fields[] = $new_field;
1832
+			} else {
1833
+				return $new_field;
1834
+			}
1835
+		}
1836
+
1837
+		/**
1838
+		 *  Add File Field to meta box
1839
+		 * @author Ohad Raz
1840
+		 * @since 1.0
1841
+		 * @access public
1842
+		 * @param $id string  field id, i.e. the meta key
1843
+		 * @param $args mixed|array
1844
+		 *    'name' => // field name/label string optional
1845
+		 *    'desc' => // field description, string optional
1846
+		 *    'validate_func' => // validate function, string optional
1847
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1848
+		 */
1849
+		public function addFile($id, $args, $repeater = false)
1850
+		{
1851
+			$new_field = array('type' => 'file', 'id' => $id, 'desc' => '', 'style' => '', 'name' => __('File Field', 'geodirectory'));
1852
+			$new_field = array_merge($new_field, $args);
1853
+			if (false === $repeater) {
1854
+				$this->_fields[] = $new_field;
1855
+			} else {
1856
+				return $new_field;
1857
+			}
1858
+		}
1859
+
1860
+		/**
1861
+		 *  Add WYSIWYG Field to meta box
1862
+		 * @author Ohad Raz
1863
+		 * @since 1.0
1864
+		 * @access public
1865
+		 * @param $id string  field id, i.e. the meta key
1866
+		 * @param $args mixed|array
1867
+		 *    'name' => // field name/label string optional
1868
+		 *    'desc' => // field description, string optional
1869
+		 *    'std' => // default value, string optional
1870
+		 *    'style' =>    // custom style for field, string optional Default 'width: 300px; height: 400px'
1871
+		 *    'validate_func' => // validate function, string optional
1872
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1873
+		 */
1874
+		public function addWysiwyg($id, $args, $repeater = false)
1875
+		{
1876
+			$new_field = array('type' => 'wysiwyg', 'id' => $id, 'std' => '', 'desc' => '', 'style' => 'width: 300px; height: 400px', 'name' => __('WYSIWYG Editor Field', 'geodirectory'));
1877
+			$new_field = array_merge($new_field, $args);
1878
+			if (false === $repeater) {
1879
+				$this->_fields[] = $new_field;
1880
+			} else {
1881
+				return $new_field;
1882
+			}
1883
+		}
1884
+
1885
+		/**
1886
+		 *  Add Taxonomy Field to meta box
1887
+		 * @author Ohad Raz
1888
+		 * @since 1.0
1889
+		 * @access public
1890
+		 * @param $id string  field id, i.e. the meta key
1891
+		 * @param $options mixed|array options of taxonomy field
1892
+		 *    'taxonomy' =>    // taxonomy name can be category,post_tag or any custom taxonomy default is category
1893
+		 * 'type' =>  // how to show taxonomy? 'select' (default) or 'checkbox_list'
1894
+		 * 'args' =>  // arguments to query taxonomy, see http://goo.gl/uAANN default ('hide_empty' => false)
1895
+		 * @param $args mixed|array
1896
+		 *    'name' => // field name/label string optional
1897
+		 *    'desc' => // field description, string optional
1898
+		 *    'std' => // default value, string optional
1899
+		 *    'validate_func' => // validate function, string optional
1900
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1901
+		 */
1902
+		public function addTaxonomy($id, $options, $args, $repeater = false)
1903
+		{
1904
+			$q = array('hide_empty' => 0);
1905
+			$tax = 'category';
1906
+			$type = 'select';
1907
+			$temp = array($tax, $type, $q);
1908
+			$options = array_merge($temp, $options);
1909
+			$new_field = array('type' => 'taxonomy', 'id' => $id, 'desc' => '', 'name' => __('Taxonomy Field', 'geodirectory'), 'options' => $options);
1910
+			$new_field = array_merge($new_field, $args);
1911
+			if (false === $repeater) {
1912
+				$this->_fields[] = $new_field;
1913
+			} else {
1914
+				return $new_field;
1915
+			}
1916
+		}
1917
+
1918
+		/**
1919
+		 *  Add posts Field to meta box
1920
+		 * @author Ohad Raz
1921
+		 * @since 1.0
1922
+		 * @access public
1923
+		 * @param $id string  field id, i.e. the meta key
1924
+		 * @param $options mixed|array options of taxonomy field
1925
+		 *    'post_type' =>    // post type name, 'post' (default) 'page' or any custom post type
1926
+		 * 'type' =>  // how to show posts? 'select' (default) or 'checkbox_list'
1927
+		 * 'args' =>  // arguments to query posts, see http://goo.gl/is0yK default ('posts_per_page' => -1)
1928
+		 * @param $args mixed|array
1929
+		 *    'name' => // field name/label string optional
1930
+		 *    'desc' => // field description, string optional
1931
+		 *    'std' => // default value, string optional
1932
+		 *    'validate_func' => // validate function, string optional
1933
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1934
+		 */
1935
+		public function addPosts($id, $options, $args, $repeater = false)
1936
+		{
1937
+			$q = array('posts_per_page' => -1);
1938
+			$temp = array('post_type' => 'post', 'type' => 'select', 'args' => $q);
1939
+			$options = array_merge($temp, $options);
1940
+			$new_field = array('type' => 'posts', 'id' => $id, 'desc' => '', 'name' => __('Posts Field', 'geodirectory'), 'options' => $options);
1941
+			$new_field = array_merge($new_field, $args);
1942
+			if (false === $repeater) {
1943
+				$this->_fields[] = $new_field;
1944
+			} else {
1945
+				return $new_field;
1946
+			}
1947
+		}
1948
+
1949
+		/**
1950
+		 *  Add repeater Field Block to meta box
1951
+		 * @author Ohad Raz
1952
+		 * @since 1.0
1953
+		 * @access public
1954
+		 * @param $id string  field id, i.e. the meta key
1955
+		 * @param $args mixed|array
1956
+		 *    'name' => // field name/label string optional
1957
+		 *    'desc' => // field description, string optional
1958
+		 *    'std' => // default value, string optional
1959
+		 *    'style' =>    // custom style for field, string optional
1960
+		 *    'validate_func' => // validate function, string optional
1961
+		 *    'fields' => //fields to repeater
1962
+		 */
1963
+		public function addRepeaterBlock($id, $args)
1964
+		{
1965
+			$new_field = array('type' => 'repeater', 'id' => $id, 'name' => __('Reapeater Field', 'geodirectory'), 'fields' => array(), 'inline' => false);
1966
+			$new_field = array_merge($new_field, $args);
1967
+			$this->_fields[] = $new_field;
1968
+		}
1969
+
1970
+
1971
+		/**
1972
+		 * Finish Declaration of Meta Box
1973
+		 * @author Ohad Raz
1974
+		 * @since 1.0
1975
+		 * @access public
1976
+		 */
1977
+		public function Finish()
1978
+		{
1979
+			$this->add_missed_values();
1980
+			$this->check_field_upload();
1981
+			$this->check_field_color();
1982
+			$this->check_field_date();
1983
+			$this->check_field_time();
1984
+		}
1985
+
1986
+		/**
1987
+		 * Helper function to check for empty arrays
1988
+		 * @author Ohad Raz
1989
+		 * @since 1.0
1990
+		 * @access public
1991
+		 * @param $args mixed|array
1992
+		 */
1993
+		public function is_array_empty($array)
1994
+		{
1995
+			if (!is_array($array))
1996
+				return true;
1997
+
1998
+			foreach ($array as $a) {
1999
+				if (is_array($a)) {
2000
+					foreach ($a as $sub_a) {
2001
+						if (!empty($sub_a) && $sub_a != '')
2002
+							return false;
2003
+					}
2004
+				} else {
2005
+					if (!empty($a) && $a != '')
2006
+						return false;
2007
+				}
2008
+			}
2009
+			return true;
2010
+		}
2011
+
2012
+
2013
+		//get term meta field
2014
+		public function get_tax_meta($term_id, $key, $multi = false, $post_type = '')
2015
+		{
2016
+
2017
+			if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2018
+				$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2019
+				$post_type = $taxObject->object_type[0];
2020
+			}
2021
+
2022
+			if($post_type=='post'){$post_type='';}
2023
+			if($post_type){$post_type = $post_type.'_';}
2024
+
2025
+			$t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2026
+
2027
+			$m = get_option('tax_meta_' . $post_type  . $t_id);
2028
+			if (isset($m[$key])) {
2029
+				return $m[$key];
2030
+			} else {
2031
+				return '';
2032
+			}
2033
+		}
2034
+
2035
+		//delete meta
2036
+		public function delete_tax_meta($term_id, $key, $post_type = '')
2037
+		{
2038
+
2039
+			if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2040
+				$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2041
+				$post_type = $taxObject->object_type[0];
2042
+			}
2043
+
2044
+			if($post_type=='post'){$post_type='';}
2045
+			if($post_type){$post_type = $post_type.'_';}
2046
+
2047
+			$m = get_option('tax_meta_' . $post_type  . $term_id);
2048
+
2049
+			if (isset($m[$key])) {
2050
+				unset($m[$key]);
2051
+			}
2052
+			update_option('tax_meta_' . $post_type  . $term_id, $m);
2053
+		}
2054
+
2055
+		//update meta
2056
+		public function update_tax_meta($term_id, $key, $value, $post_type = '')
2057
+		{
2058
+
2059
+			if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2060
+				$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2061
+				$post_type = $taxObject->object_type[0];
2062
+			}
2063
+
2064
+			if($post_type=='post'){$post_type='';}
2065
+			if($post_type){$post_type = $post_type.'_';}
2066
+
2067
+			$m = get_option('tax_meta_' . $post_type  . $term_id);
2068
+
2069
+			$m[$key] = $value;
2070
+			update_option('tax_meta_' . $post_type  . $term_id, $m);
2071
+
2072
+			/**
2073
+			 * Called after the tax meta is updated.
2074
+			 *
2075
+			 * Used to update things after a GD category is saved.
2076
+			 *
2077
+			 * @since 1.0.0
2078
+			 * @param bool $false False.
2079
+			 * @param bool $true True.
2080
+			 * @param int $term_id The term id being updated.
2081
+			 * @param string $post_type The post type of the cat being updated.
2082
+			 */
2083
+			do_action('gd_tax_meta_updated', false, true, $term_id, $post_type);
2084
+		}
2085
+
2086
+
2087
+	} // End Class
2088 2088
 
2089 2089
 endif; // End Check Class Exists
2090 2090
 
@@ -2094,79 +2094,79 @@  discard block
 block discarded – undo
2094 2094
 
2095 2095
 //get term meta field
2096 2096
 if (!function_exists('geodir_get_tax_meta')) {
2097
-    function geodir_get_tax_meta($term_id, $key, $multi = false, $post_type = '') {
2098
-        if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2099
-            $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2097
+	function geodir_get_tax_meta($term_id, $key, $multi = false, $post_type = '') {
2098
+		if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2099
+			$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2100 2100
             
2101
-            if (!empty($taxObject->object_type)) {
2102
-                $post_type = $taxObject->object_type[0];
2103
-            }
2104
-        }
2105
-
2106
-        if ($post_type == 'post') {
2107
-            $post_type = '';
2108
-        }
2109
-        if ($post_type) {
2110
-            $post_type = $post_type . '_';
2111
-        }
2112
-
2113
-        $t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2114
-
2115
-        $m = get_option('tax_meta_' . $post_type  . $t_id);
2116
-        if (isset($m[$key])) {
2117
-            return $m[$key];
2118
-        } else {
2119
-            return '';
2120
-        }
2121
-    }
2101
+			if (!empty($taxObject->object_type)) {
2102
+				$post_type = $taxObject->object_type[0];
2103
+			}
2104
+		}
2105
+
2106
+		if ($post_type == 'post') {
2107
+			$post_type = '';
2108
+		}
2109
+		if ($post_type) {
2110
+			$post_type = $post_type . '_';
2111
+		}
2112
+
2113
+		$t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2114
+
2115
+		$m = get_option('tax_meta_' . $post_type  . $t_id);
2116
+		if (isset($m[$key])) {
2117
+			return $m[$key];
2118
+		} else {
2119
+			return '';
2120
+		}
2121
+	}
2122 2122
 }
2123 2123
 
2124 2124
 //delete meta
2125 2125
 if (!function_exists('geodir_delete_tax_meta')) {
2126
-    function geodir_delete_tax_meta($term_id, $key) {
2127
-        $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2128
-        $post_type = !empty($taxObject->object_type) ? $taxObject->object_type[0] : '';
2129
-
2130
-        if ($post_type == 'post') {
2131
-            $post_type = '';
2132
-        }
2133
-        if ($post_type) {
2134
-            $post_type = $post_type . '_';
2135
-        }
2136
-
2137
-        $m = get_option('tax_meta_' . $post_type . $term_id);
2138
-
2139
-        if (isset($m[$key])) {
2140
-            unset($m[$key]);
2141
-        }
2142
-        update_option('tax_meta_' . $post_type  . $term_id, $m);
2143
-    }
2126
+	function geodir_delete_tax_meta($term_id, $key) {
2127
+		$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2128
+		$post_type = !empty($taxObject->object_type) ? $taxObject->object_type[0] : '';
2129
+
2130
+		if ($post_type == 'post') {
2131
+			$post_type = '';
2132
+		}
2133
+		if ($post_type) {
2134
+			$post_type = $post_type . '_';
2135
+		}
2136
+
2137
+		$m = get_option('tax_meta_' . $post_type . $term_id);
2138
+
2139
+		if (isset($m[$key])) {
2140
+			unset($m[$key]);
2141
+		}
2142
+		update_option('tax_meta_' . $post_type  . $term_id, $m);
2143
+	}
2144 2144
 }
2145 2145
 
2146 2146
 //update meta
2147 2147
 if (!function_exists('geodir_update_tax_meta')) {
2148
-    function geodir_update_tax_meta($term_id, $key, $value, $post_type = '') {
2149
-        if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2150
-            $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2148
+	function geodir_update_tax_meta($term_id, $key, $value, $post_type = '') {
2149
+		if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2150
+			$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2151 2151
             
2152
-            if (!empty($taxObject->object_type)) {
2153
-                $post_type = $taxObject->object_type[0];
2154
-            }
2155
-        }
2156
-
2157
-        if ($post_type == 'post') {
2158
-            $post_type = '';
2159
-        }
2160
-        if ($post_type) {
2161
-            $post_type = $post_type . '_';
2162
-        }
2163
-
2164
-        $m = get_option('tax_meta_' . $post_type  . $term_id);
2165
-
2166
-        $m[$key] = $value;
2167
-        update_option('tax_meta_' . $post_type . $term_id, $m);
2168
-
2169
-        /** This action is documented in geodirectory-functions/cat-meta-functions/Tax-meta-class.php */
2170
-        do_action('gd_tax_meta_updated', false, true, $term_id, $post_type);
2171
-    }
2152
+			if (!empty($taxObject->object_type)) {
2153
+				$post_type = $taxObject->object_type[0];
2154
+			}
2155
+		}
2156
+
2157
+		if ($post_type == 'post') {
2158
+			$post_type = '';
2159
+		}
2160
+		if ($post_type) {
2161
+			$post_type = $post_type . '_';
2162
+		}
2163
+
2164
+		$m = get_option('tax_meta_' . $post_type  . $term_id);
2165
+
2166
+		$m[$key] = $value;
2167
+		update_option('tax_meta_' . $post_type . $term_id, $m);
2168
+
2169
+		/** This action is documented in geodirectory-functions/cat-meta-functions/Tax-meta-class.php */
2170
+		do_action('gd_tax_meta_updated', false, true, $term_id, $post_type);
2171
+	}
2172 2172
 }
2173 2173
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
             $this->add_missed_values();
114 114
             if (isset($meta_box['use_with_theme']))
115 115
                 if ($meta_box['use_with_theme'] === true) {
116
-                    $this->SelfPath = get_stylesheet_directory_uri() . '/library/cat-meta';
116
+                    $this->SelfPath = get_stylesheet_directory_uri().'/library/cat-meta';
117 117
                 } elseif ($meta_box['use_with_theme'] === false) {
118 118
                     $this->SelfPath = plugins_url('cat-meta-functions', plugin_basename(dirname(__FILE__)));
119 119
                 } else {
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
                 $li = "<li id='item_{$attachment_id}'>";
263 263
                 $li .= "<img src='{$attachment['url']}' alt='image_{$attachment_id}' />";
264 264
                 //$li 	.= "<a title='" . __( 'Delete this image' ) . "' class='at-delete-file' href='#' rel='{$nonce}|{$term_id}|{$id}|{$attachment_id}'>" . __( 'Delete' ) . "</a>";
265
-                $li .= "<a title='" . __('Remove this image', 'geodirectory') . "' class='at-delete-file' href='#' rel='{$nonce}|{$term_id}|{$id}|{$attachment_id}'><img src='" . $this->SelfPath . "/images/delete-16.png' alt='" . __('Remove', 'geodirectory') . "' /></a>";
265
+                $li .= "<a title='".__('Remove this image', 'geodirectory')."' class='at-delete-file' href='#' rel='{$nonce}|{$term_id}|{$id}|{$attachment_id}'><img src='".$this->SelfPath."/images/delete-16.png' alt='".__('Remove', 'geodirectory')."' /></a>";
266 266
                 $li .= "<input type='hidden' name='{$id}[]' value='{$attachment_id}' />";
267 267
                 $li .= "</li>";
268 268
                 $html .= $li;
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
             $attachment_id = isset($_GET['attachment_id']) ? intval($_GET['attachment_id']) : 0;
336 336
             $ok = false;
337 337
             if (strpos($field_id, '[') === false) {
338
-                check_admin_referer("at-delete-mupload_" . urldecode($field_id));
338
+                check_admin_referer("at-delete-mupload_".urldecode($field_id));
339 339
                 if ($term_id > 0)
340 340
                     $this->delete_tax_meta($term_id, $field_id);
341 341
                 //$ok = wp_delete_attachment( $attachment_id );
@@ -423,8 +423,8 @@  discard block
 block discarded – undo
423 423
 
424 424
             if ($this->has_field('date') && $this->is_edit_page()) {
425 425
                 // Enqueu JQuery UI, use proper version.
426
-                wp_enqueue_style('tmc-jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/themes/base/jquery-ui.css');
427
-                wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/jquery-ui.min.js', array('jquery'));
426
+                wp_enqueue_style('tmc-jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/'.$this->get_jqueryui_ver().'/themes/base/jquery-ui.css');
427
+                wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/'.$this->get_jqueryui_ver().'/jquery-ui.min.js', array('jquery'));
428 428
             }
429 429
 
430 430
         }
@@ -441,8 +441,8 @@  discard block
 block discarded – undo
441 441
             if ($this->has_field('time') && $this->is_edit_page()) {
442 442
 
443 443
                 // Enqueu JQuery UI, use proper version.
444
-                wp_enqueue_style('tmc-jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/themes/base/jquery-ui.css', array(), false, true);
445
-                wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/' . $this->get_jqueryui_ver() . '/jquery-ui.min.js', array('jquery'), false, true);
444
+                wp_enqueue_style('tmc-jquery-ui-css', 'https://ajax.googleapis.com/ajax/libs/jqueryui/'.$this->get_jqueryui_ver().'/themes/base/jquery-ui.css', array(), false, true);
445
+                wp_enqueue_script('tmc-jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/'.$this->get_jqueryui_ver().'/jquery-ui.min.js', array('jquery'), false, true);
446 446
                 wp_enqueue_script('at-timepicker', 'https://github.com/trentrichardson/jQuery-Timepicker-Addon/raw/master/jquery-ui-timepicker-addon.js', array('tmc-jquery-ui'), false, true);
447 447
 
448 448
             }
@@ -462,13 +462,13 @@  discard block
 block discarded – undo
462 462
             if (!empty($this->_meta_box['pages'])) {
463 463
                 foreach ($this->_meta_box['pages'] as $page) {
464 464
                     //add fields to edit form
465
-                    add_action($page . '_edit_form_fields', array(&$this, 'show_edit_form'));
465
+                    add_action($page.'_edit_form_fields', array(&$this, 'show_edit_form'));
466 466
                     //add fields to add new form
467
-                    add_action($page . '_add_form_fields', array(&$this, 'show_new_form'));
467
+                    add_action($page.'_add_form_fields', array(&$this, 'show_new_form'));
468 468
                     // this saves the edit fields
469
-                    add_action('edited_' . $page, array(&$this, 'save'), 10, 2);
469
+                    add_action('edited_'.$page, array(&$this, 'save'), 10, 2);
470 470
                     // this saves the add fields
471
-                    add_action('created_' . $page, array(&$this, 'save'), 10, 2);
471
+                    add_action('created_'.$page, array(&$this, 'save'), 10, 2);
472 472
                 }
473 473
             }
474 474
 
@@ -517,13 +517,13 @@  discard block
 block discarded – undo
517 517
                     $meta = is_array($meta) ? array_map('esc_attr', $meta) : esc_attr($meta);
518 518
 
519 519
                 if ($field['validate_func']) {
520
-                    echo '<tr class="form-field form-required ' . $field['style'] . '">';
520
+                    echo '<tr class="form-field form-required '.$field['style'].'">';
521 521
                 } else {
522
-                    echo '<tr class="form-field ' . $field['style'] . '">';
522
+                    echo '<tr class="form-field '.$field['style'].'">';
523 523
                 }
524 524
 
525 525
                 // Call Separated methods for displaying each type of field.
526
-                call_user_func(array(&$this, 'show_field_' . $field['type']), $field, $meta);
526
+                call_user_func(array(&$this, 'show_field_'.$field['type']), $field, $meta);
527 527
                 echo '</tr>';
528 528
             }
529 529
             echo '</table>';
@@ -550,14 +550,14 @@  discard block
 block discarded – undo
550 550
                 foreach ($meta as $me) {
551 551
                     //for labling toggles
552 552
                     $mmm = $me[$field['fields'][0]['id']];
553
-                    echo '<div class="at-repater-block">' . $mmm . '<br/><table class="repeater-table" style="display: none;">';
553
+                    echo '<div class="at-repater-block">'.$mmm.'<br/><table class="repeater-table" style="display: none;">';
554 554
                     if ($field['inline']) {
555 555
                         echo '<tr class="at-inline" VALIGN="top">';
556 556
                     }
557 557
                     foreach ($field['fields'] as $f) {
558 558
                         //reset var $id for repeater
559 559
                         $id = '';
560
-                        $id = $field['id'] . '[' . $c . '][' . $f['id'] . ']';
560
+                        $id = $field['id'].'['.$c.']['.$f['id'].']';
561 561
                         $m = $me[$f['id']];
562 562
                         $m = ($m !== '') ? $m : $f['std'];
563 563
                         if ('image' != $f['type'] && $f['type'] != 'repeater')
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
                         if (!$field['inline']) {
568 568
                             echo '<tr>';
569 569
                         }
570
-                        call_user_func(array(&$this, 'show_field_' . $f['type']), $f, $m);
570
+                        call_user_func(array(&$this, 'show_field_'.$f['type']), $f, $m);
571 571
                         if (!$field['inline']) {
572 572
                             echo '</tr>';
573 573
                         }
@@ -578,18 +578,18 @@  discard block
 block discarded – undo
578 578
                     echo '</table>
579 579
 				<span class="at-re-toggle"><img src="';
580 580
                     if ($this->_Local_images) {
581
-                        echo $plugin_path . '/images/edit.png';
581
+                        echo $plugin_path.'/images/edit.png';
582 582
                     } else {
583 583
                         echo 'http://i.imgur.com/ka0E2.png';
584 584
                     }
585 585
                     echo '" alt="Edit" title="Edit"/></span> 
586 586
 				<img src="';
587 587
                     if ($this->_Local_images) {
588
-                        echo $plugin_path . '/images/remove.png';
588
+                        echo $plugin_path.'/images/remove.png';
589 589
                     } else {
590 590
                         echo 'http://i.imgur.com/g8Duj.png';
591 591
                     }
592
-                    echo '" alt="' . __('Remove', 'geodirectory') . '" title="' . __('Remove', 'geodirectory') . '" id="remove-' . $field['id'] . '"></div>';
592
+                    echo '" alt="'.__('Remove', 'geodirectory').'" title="'.__('Remove', 'geodirectory').'" id="remove-'.$field['id'].'"></div>';
593 593
                     $c = $c + 1;
594 594
 
595 595
                 }
@@ -598,11 +598,11 @@  discard block
 block discarded – undo
598 598
 
599 599
             echo '<img src="';
600 600
             if ($this->_Local_images) {
601
-                echo $plugin_path . '/images/add.png';
601
+                echo $plugin_path.'/images/add.png';
602 602
             } else {
603 603
                 echo 'http://i.imgur.com/w5Tuc.png';
604 604
             }
605
-            echo '" alt="' . __('Add', 'geodirectory') . '" title="' . __('Add', 'geodirectory') . '" id="add-' . $field['id'] . '"><br/></div>';
605
+            echo '" alt="'.__('Add', 'geodirectory').'" title="'.__('Add', 'geodirectory').'" id="add-'.$field['id'].'"><br/></div>';
606 606
 
607 607
             //create all fields once more for js function and catch with object buffer
608 608
             ob_start();
@@ -613,12 +613,12 @@  discard block
 block discarded – undo
613 613
             foreach ($field['fields'] as $f) {
614 614
                 //reset var $id for repeater
615 615
                 $id = '';
616
-                $id = $field['id'] . '[CurrentCounter][' . $f['id'] . ']';
616
+                $id = $field['id'].'[CurrentCounter]['.$f['id'].']';
617 617
                 $f['id'] = $id;
618 618
                 if (!$field['inline']) {
619 619
                     echo '<tr>';
620 620
                 }
621
-                call_user_func(array(&$this, 'show_field_' . $f['type']), $f, '');
621
+                call_user_func(array(&$this, 'show_field_'.$f['type']), $f, '');
622 622
                 if (!$field['inline']) {
623 623
                     echo '</tr>';
624 624
                 }
@@ -628,24 +628,24 @@  discard block
 block discarded – undo
628 628
             }
629 629
             echo '</table><img src="';
630 630
             if ($this->_Local_images) {
631
-                echo $plugin_path . '/images/remove.png';
631
+                echo $plugin_path.'/images/remove.png';
632 632
             } else {
633 633
                 echo 'http://i.imgur.com/g8Duj.png';
634 634
             }
635
-            echo '" alt="' . __('Remove', 'geodirectory') . '" title="' . __('Remove', 'geodirectory') . '" id="remove-' . $field['id'] . '"></div>';
636
-            $counter = 'countadd_' . $field['id'];
635
+            echo '" alt="'.__('Remove', 'geodirectory').'" title="'.__('Remove', 'geodirectory').'" id="remove-'.$field['id'].'"></div>';
636
+            $counter = 'countadd_'.$field['id'];
637 637
             $js_code = ob_get_clean();
638 638
             $js_code = str_replace("'", "\"", $js_code);
639
-            $js_code = str_replace("CurrentCounter", "' + " . $counter . " + '", $js_code);
639
+            $js_code = str_replace("CurrentCounter", "' + ".$counter." + '", $js_code);
640 640
             echo '<script>
641 641
 				jQuery(document).ready(function() {
642
-					var ' . $counter . ' = ' . $c . ';
643
-					jQuery("#add-' . $field['id'] . '").live(\'click\', function() {
644
-						' . $counter . ' = ' . $counter . ' + 1;
645
-						jQuery(this).before(\'' . $js_code . '\');						
642
+					var ' . $counter.' = '.$c.';
643
+					jQuery("#add-' . $field['id'].'").live(\'click\', function() {
644
+						' . $counter.' = '.$counter.' + 1;
645
+						jQuery(this).before(\'' . $js_code.'\');						
646 646
 						update_repeater_fields();
647 647
 					});
648
-        			jQuery("#remove-' . $field['id'] . '").live(\'click\', function() {
648
+        			jQuery("#remove-' . $field['id'].'").live(\'click\', function() {
649 649
             			jQuery(this).parent().remove();
650 650
         			});
651 651
     			});
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
         public function show_field_paragraph($field)
773 773
         {
774 774
             //$this->show_field_begin( $field, $meta );
775
-            echo '<p>' . $field['value'] . '</p>';
775
+            echo '<p>'.$field['value'].'</p>';
776 776
             //$this->show_field_end( $field, $meta );
777 777
         }
778 778
 
@@ -803,12 +803,12 @@  discard block
 block discarded – undo
803 803
         {
804 804
 
805 805
             if (!is_array($meta))
806
-                $meta = (array)$meta;
806
+                $meta = (array) $meta;
807 807
 
808 808
             $this->show_field_begin($field, $meta);
809
-            echo "<select class='at-select' name='{$field['id']}" . ($field['multiple'] ? "[]' id='{$field['id']}' multiple='multiple'" : "'") . ">";
809
+            echo "<select class='at-select' name='{$field['id']}".($field['multiple'] ? "[]' id='{$field['id']}' multiple='multiple'" : "'").">";
810 810
             foreach ($field['options'] as $key => $value) {
811
-                echo "<option value='{$key}'" . selected(in_array($key, $meta), true, false) . ">{$value}</option>";
811
+                echo "<option value='{$key}'".selected(in_array($key, $meta), true, false).">{$value}</option>";
812 812
             }
813 813
             echo "</select>";
814 814
             $this->show_field_end($field, $meta);
@@ -827,11 +827,11 @@  discard block
 block discarded – undo
827 827
         {
828 828
 
829 829
             if (!is_array($meta))
830
-                $meta = (array)$meta;
830
+                $meta = (array) $meta;
831 831
 
832 832
             $this->show_field_begin($field, $meta);
833 833
             foreach ($field['options'] as $key => $value) {
834
-                echo "<input type='radio' class='at-radio' name='{$field['id']}' value='{$key}'" . checked(in_array($key, $meta), true, false) . " /> <span class='at-radio-label'>{$value}</span>";
834
+                echo "<input type='radio' class='at-radio' name='{$field['id']}' value='{$key}'".checked(in_array($key, $meta), true, false)." /> <span class='at-radio-label'>{$value}</span>";
835 835
             }
836 836
             $this->show_field_end($field, $meta);
837 837
         }
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
         {
849 849
 
850 850
             $this->show_field_begin($field, $meta);
851
-            echo "<input type='checkbox' class='rw-checkbox' name='{$field['id']}' id='{$field['id']}'" . checked(!empty($meta), true, false) . " /> {$field['desc']}";
851
+            echo "<input type='checkbox' class='rw-checkbox' name='{$field['id']}' id='{$field['id']}'".checked(!empty($meta), true, false)." /> {$field['desc']}";
852 852
             $this->show_field_end($field, $meta);
853 853
         }
854 854
 
@@ -890,18 +890,18 @@  discard block
 block discarded – undo
890 890
             global $post;
891 891
 
892 892
             if (!is_array($meta))
893
-                $meta = (array)$meta;
893
+                $meta = (array) $meta;
894 894
 
895 895
             $this->show_field_begin($field, $meta);
896 896
             echo "{$field['desc']}<br />";
897 897
 
898 898
             if (!empty($meta)) {
899 899
                 $nonce = wp_create_nonce('at_ajax_delete');
900
-                echo '<div style="margin-bottom: 10px"><strong>' . __('Uploaded files', 'geodirectory') . '</strong></div>';
900
+                echo '<div style="margin-bottom: 10px"><strong>'.__('Uploaded files', 'geodirectory').'</strong></div>';
901 901
                 echo '<ol class="at-upload">';
902 902
                 foreach ($meta as $att) {
903 903
                     // if (wp_attachment_is_image($att)) continue; // what's image uploader for?
904
-                    echo "<li>" . wp_get_attachment_link($att, '', false, false, ' ') . " (<a class='at-delete-file' href='#' rel='{$nonce}|{$post->ID}|{$field['id']}|{$att}'>" . __('Remove', 'geodirectory') . "</a>)</li>";
904
+                    echo "<li>".wp_get_attachment_link($att, '', false, false, ' ')." (<a class='at-delete-file' href='#' rel='{$nonce}|{$post->ID}|{$field['id']}|{$att}'>".__('Remove', 'geodirectory')."</a>)</li>";
905 905
                 }
906 906
                 echo '</ol>';
907 907
             }
@@ -909,13 +909,13 @@  discard block
 block discarded – undo
909 909
             // show form upload
910 910
 
911 911
             echo "<div class='at-file-upload-label'>";
912
-            echo "<strong>" . __('Upload new files', 'geodirectory') . "</strong>";
912
+            echo "<strong>".__('Upload new files', 'geodirectory')."</strong>";
913 913
             echo "</div>";
914 914
             echo "<div class='new-files'>";
915 915
             echo "<div class='file-input'>";
916 916
             echo "<input type='file' name='{$field['id']}[]' />";
917 917
             echo "</div><!-- End .file-input -->";
918
-            echo "<a class='at-add-file button' href='#'>" . __('Add more files', 'geodirectory') . "</a>";
918
+            echo "<a class='at-add-file button' href='#'>".__('Add more files', 'geodirectory')."</a>";
919 919
             echo "</div><!-- End .new-files -->";
920 920
             echo "</td>";
921 921
             $this->show_field_end($field, $meta);
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
         public function show_field_image($field, $meta)
933 933
         {
934 934
             $this->show_field_begin($field, $meta);
935
-            $html = wp_nonce_field("at-delete-mupload_{$field['id']}", "nonce-delete-mupload_" . $field['id'], false, false);
935
+            $html = wp_nonce_field("at-delete-mupload_{$field['id']}", "nonce-delete-mupload_".$field['id'], false, false);
936 936
             if (is_array($meta)) {
937 937
                 if (isset($meta[0]) && is_array($meta[0]))
938 938
                     $meta = $meta[0];
@@ -958,19 +958,19 @@  discard block
 block discarded – undo
958 958
                 }
959 959
                 $sub_dir = str_replace($uploads['baseurl'], '', $sub_dir);
960 960
 
961
-                $uploads_url = $uploads_baseurl . $sub_dir;
961
+                $uploads_url = $uploads_baseurl.$sub_dir;
962 962
 
963
-                $meta['src'] = $uploads_url . '/' . $file_name;
963
+                $meta['src'] = $uploads_url.'/'.$file_name;
964 964
 
965
-                $html .= "<span class='mupload_img_holder'><img src='" . $meta['src'] . "' style='max-height: 150px;max-width: 150px;' /></span>";
966
-                $html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='" . $meta['id'] . "' />";
967
-                $html .= "<input type='hidden' class='" . $field['id'] . "[src]' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='" . $meta['src'] . "' />";
968
-                $html .= "<input class='at-delete_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Remove Image', 'geodirectory') . "' />";
965
+                $html .= "<span class='mupload_img_holder'><img src='".$meta['src']."' style='max-height: 150px;max-width: 150px;' /></span>";
966
+                $html .= "<input type='hidden' name='".$field['id']."[id]' id='".$field['id']."[id]' value='".$meta['id']."' />";
967
+                $html .= "<input type='hidden' class='".$field['id']."[src]' name='".$field['id']."[src]' id='".$field['id']."[src]' value='".$meta['src']."' />";
968
+                $html .= "<input class='at-delete_image_button' type='button' rel='".$field['id']."' value='".__('Remove Image', 'geodirectory')."' />";
969 969
             } else {
970 970
                 $html .= "<span class='mupload_img_holder'></span>";
971
-                $html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='' />";
972
-                $html .= "<input class='" . $field['id'] . "[src]' style='position:absolute;left:-500px;width:50px;' type='text' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='' />";
973
-                $html .= "<input class='at-upload_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Upload Image', 'geodirectory') . "' />";
971
+                $html .= "<input type='hidden' name='".$field['id']."[id]' id='".$field['id']."[id]' value='' />";
972
+                $html .= "<input class='".$field['id']."[src]' style='position:absolute;left:-500px;width:50px;' type='text' name='".$field['id']."[src]' id='".$field['id']."[src]' value='' />";
973
+                $html .= "<input class='at-upload_image_button' type='button' rel='".$field['id']."' value='".__('Upload Image', 'geodirectory')."' />";
974 974
             }
975 975
             echo $html;
976 976
             $this->show_field_end($field, $meta);
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
 
995 995
             echo "<input class='at-color' type='text' name='{$field['id']}' id='{$field['id']}' value='{$meta}' size='8' />";
996 996
             //	echo "<a href='#' class='at-color-select button' rel='{$field['id']}'>" . __( 'Select a color' ) . "</a>";
997
-            echo "<input type='button' class='at-color-select button' rel='{$field['id']}' value='" . __('Select a color', 'geodirectory') . "'/>";
997
+            echo "<input type='button' class='at-color-select button' rel='{$field['id']}' value='".__('Select a color', 'geodirectory')."'/>";
998 998
             echo "<div style='display:none' class='at-color-picker' rel='{$field['id']}'></div>";
999 999
             $this->show_field_end($field, $meta);
1000 1000
 
@@ -1012,14 +1012,14 @@  discard block
 block discarded – undo
1012 1012
         {
1013 1013
 
1014 1014
             if (!is_array($meta))
1015
-                $meta = (array)$meta;
1015
+                $meta = (array) $meta;
1016 1016
 
1017 1017
             $this->show_field_begin($field, $meta);
1018 1018
 
1019 1019
             $html = array();
1020 1020
 
1021 1021
             foreach ($field['options'] as $key => $value) {
1022
-                $html[] = "<input type='checkbox' class='at-checkbox_list' name='{$field['id']}[]' value='{$key}'" . checked(in_array($key, $meta), true, false) . " /> {$value}";
1022
+                $html[] = "<input type='checkbox' class='at-checkbox_list' name='{$field['id']}[]' value='{$key}'".checked(in_array($key, $meta), true, false)." /> {$value}";
1023 1023
             }
1024 1024
 
1025 1025
             echo implode('<br />', $html);
@@ -1072,7 +1072,7 @@  discard block
 block discarded – undo
1072 1072
         {
1073 1073
             global $post;
1074 1074
 
1075
-            if (!is_array($meta)) $meta = (array)$meta;
1075
+            if (!is_array($meta)) $meta = (array) $meta;
1076 1076
             $this->show_field_begin($field, $meta);
1077 1077
             $options = $field['options'];
1078 1078
             $posts = get_posts($options['args']);
@@ -1080,13 +1080,13 @@  discard block
 block discarded – undo
1080 1080
             // checkbox_list
1081 1081
             if ('checkbox_list' == $options['type']) {
1082 1082
                 foreach ($posts as $p) {
1083
-                    echo "<input type='checkbox' name='{$field['id']}[]' value='$p->ID'" . checked(in_array($p->ID, $meta), true, false) . " /> $p->post_title<br/>";
1083
+                    echo "<input type='checkbox' name='{$field['id']}[]' value='$p->ID'".checked(in_array($p->ID, $meta), true, false)." /> $p->post_title<br/>";
1084 1084
                 }
1085 1085
             } // select
1086 1086
             else {
1087
-                echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1087
+                echo "<select name='{$field['id']}".($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'").">";
1088 1088
                 foreach ($posts as $p) {
1089
-                    echo "<option value='$p->ID'" . selected(in_array($p->ID, $meta), true, false) . ">$p->post_title</option>";
1089
+                    echo "<option value='$p->ID'".selected(in_array($p->ID, $meta), true, false).">$p->post_title</option>";
1090 1090
                 }
1091 1091
                 echo "</select>";
1092 1092
             }
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
         {
1111 1111
             global $post;
1112 1112
 
1113
-            if (!is_array($meta)) $meta = (array)$meta;
1113
+            if (!is_array($meta)) $meta = (array) $meta;
1114 1114
             $this->show_field_begin($field, $meta);
1115 1115
             $options = $field['options'];
1116 1116
             $terms = get_terms($options['taxonomy'], $options['args']);
@@ -1118,13 +1118,13 @@  discard block
 block discarded – undo
1118 1118
             // checkbox_list
1119 1119
             if ('checkbox_list' == $options['type']) {
1120 1120
                 foreach ($terms as $term) {
1121
-                    echo "<input type='checkbox' name='{$field['id']}[]' value='$term->slug'" . checked(in_array($term->slug, $meta), true, false) . " /> $term->name<br/>";
1121
+                    echo "<input type='checkbox' name='{$field['id']}[]' value='$term->slug'".checked(in_array($term->slug, $meta), true, false)." /> $term->name<br/>";
1122 1122
                 }
1123 1123
             } // select
1124 1124
             else {
1125
-                echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1125
+                echo "<select name='{$field['id']}".($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'").">";
1126 1126
                 foreach ($terms as $term) {
1127
-                    echo "<option value='$term->slug'" . selected(in_array($term->slug, $meta), true, false) . ">$term->name</option>";
1127
+                    echo "<option value='$term->slug'".selected(in_array($term->slug, $meta), true, false).">$term->name</option>";
1128 1128
                 }
1129 1129
                 echo "</select>";
1130 1130
             }
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
 
1181 1181
                     //$old_filename = $upload_dir['path'].'/'.$old_filename;
1182 1182
 
1183
-                    $new_filename = $upload_dir['path'] . '/' . 'cat_icon_' . $term_id . '.png';
1183
+                    $new_filename = $upload_dir['path'].'/'.'cat_icon_'.$term_id.'.png';
1184 1184
 
1185 1185
                     /*rename($old_filename, $new_filename);
1186 1186
 				
@@ -1222,9 +1222,9 @@  discard block
 block discarded – undo
1222 1222
                 if ($type != "paragraph") {
1223 1223
 
1224 1224
                     // Call defined method to save meta value, if there's no methods, call common one.
1225
-                    $save_func = 'save_field_' . $type;
1225
+                    $save_func = 'save_field_'.$type;
1226 1226
                     if (method_exists($this, $save_func)) {
1227
-                        call_user_func(array(&$this, 'save_field_' . $type), $term_id, $field, $old, $new);
1227
+                        call_user_func(array(&$this, 'save_field_'.$type), $term_id, $field, $old, $new);
1228 1228
                     } else {
1229 1229
                         $this->save_field($term_id, $field, $old, $new);
1230 1230
                     }
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
                 if (!is_wp_error($id)) {
1370 1370
 
1371 1371
                     wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1372
-                    add_post_meta($term_id, $name, $id, false);    // save file's url in meta fields
1372
+                    add_post_meta($term_id, $name, $id, false); // save file's url in meta fields
1373 1373
 
1374 1374
                 } // End if
1375 1375
 
@@ -1414,7 +1414,7 @@  discard block
 block discarded – undo
1414 1414
                 if (!is_wp_error($id)) {
1415 1415
 
1416 1416
                     wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1417
-                    return $id;    // return file's url in meta fields
1417
+                    return $id; // return file's url in meta fields
1418 1418
                 } // End if
1419 1419
             } // End foreach
1420 1420
         }
@@ -1429,9 +1429,9 @@  discard block
 block discarded – undo
1429 1429
         {
1430 1430
 
1431 1431
             // Default values for meta box
1432
-            $this->_meta_box = array_merge(array('context' => 'normal', 'priority' => 'high', 'pages' => array('post')), (array)$this->_meta_box);
1432
+            $this->_meta_box = array_merge(array('context' => 'normal', 'priority' => 'high', 'pages' => array('post')), (array) $this->_meta_box);
1433 1433
 
1434
-            if(is_array($this->_fields)) {
1434
+            if (is_array($this->_fields)) {
1435 1435
                 // Default values for fields
1436 1436
                 foreach ($this->_fields as &$field) {
1437 1437
                     $multiple = in_array($field['type'], array('checkbox_list', 'file', 'image'));
@@ -1451,7 +1451,7 @@  discard block
 block discarded – undo
1451 1451
          */
1452 1452
         public function has_field($type)
1453 1453
         {
1454
-            if(is_array($this->_fields)) {
1454
+            if (is_array($this->_fields)) {
1455 1455
                 foreach ($this->_fields as $field) {
1456 1456
                     if ($type == $field['type'])
1457 1457
                         return true;
@@ -2019,12 +2019,12 @@  discard block
 block discarded – undo
2019 2019
                 $post_type = $taxObject->object_type[0];
2020 2020
             }
2021 2021
 
2022
-            if($post_type=='post'){$post_type='';}
2023
-            if($post_type){$post_type = $post_type.'_';}
2022
+            if ($post_type == 'post') {$post_type = ''; }
2023
+            if ($post_type) {$post_type = $post_type.'_'; }
2024 2024
 
2025 2025
             $t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2026 2026
 
2027
-            $m = get_option('tax_meta_' . $post_type  . $t_id);
2027
+            $m = get_option('tax_meta_'.$post_type.$t_id);
2028 2028
             if (isset($m[$key])) {
2029 2029
                 return $m[$key];
2030 2030
             } else {
@@ -2041,15 +2041,15 @@  discard block
 block discarded – undo
2041 2041
                 $post_type = $taxObject->object_type[0];
2042 2042
             }
2043 2043
 
2044
-            if($post_type=='post'){$post_type='';}
2045
-            if($post_type){$post_type = $post_type.'_';}
2044
+            if ($post_type == 'post') {$post_type = ''; }
2045
+            if ($post_type) {$post_type = $post_type.'_'; }
2046 2046
 
2047
-            $m = get_option('tax_meta_' . $post_type  . $term_id);
2047
+            $m = get_option('tax_meta_'.$post_type.$term_id);
2048 2048
 
2049 2049
             if (isset($m[$key])) {
2050 2050
                 unset($m[$key]);
2051 2051
             }
2052
-            update_option('tax_meta_' . $post_type  . $term_id, $m);
2052
+            update_option('tax_meta_'.$post_type.$term_id, $m);
2053 2053
         }
2054 2054
 
2055 2055
         //update meta
@@ -2061,13 +2061,13 @@  discard block
 block discarded – undo
2061 2061
                 $post_type = $taxObject->object_type[0];
2062 2062
             }
2063 2063
 
2064
-            if($post_type=='post'){$post_type='';}
2065
-            if($post_type){$post_type = $post_type.'_';}
2064
+            if ($post_type == 'post') {$post_type = ''; }
2065
+            if ($post_type) {$post_type = $post_type.'_'; }
2066 2066
 
2067
-            $m = get_option('tax_meta_' . $post_type  . $term_id);
2067
+            $m = get_option('tax_meta_'.$post_type.$term_id);
2068 2068
 
2069 2069
             $m[$key] = $value;
2070
-            update_option('tax_meta_' . $post_type  . $term_id, $m);
2070
+            update_option('tax_meta_'.$post_type.$term_id, $m);
2071 2071
 
2072 2072
             /**
2073 2073
              * Called after the tax meta is updated.
@@ -2107,12 +2107,12 @@  discard block
 block discarded – undo
2107 2107
             $post_type = '';
2108 2108
         }
2109 2109
         if ($post_type) {
2110
-            $post_type = $post_type . '_';
2110
+            $post_type = $post_type.'_';
2111 2111
         }
2112 2112
 
2113 2113
         $t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2114 2114
 
2115
-        $m = get_option('tax_meta_' . $post_type  . $t_id);
2115
+        $m = get_option('tax_meta_'.$post_type.$t_id);
2116 2116
         if (isset($m[$key])) {
2117 2117
             return $m[$key];
2118 2118
         } else {
@@ -2131,15 +2131,15 @@  discard block
 block discarded – undo
2131 2131
             $post_type = '';
2132 2132
         }
2133 2133
         if ($post_type) {
2134
-            $post_type = $post_type . '_';
2134
+            $post_type = $post_type.'_';
2135 2135
         }
2136 2136
 
2137
-        $m = get_option('tax_meta_' . $post_type . $term_id);
2137
+        $m = get_option('tax_meta_'.$post_type.$term_id);
2138 2138
 
2139 2139
         if (isset($m[$key])) {
2140 2140
             unset($m[$key]);
2141 2141
         }
2142
-        update_option('tax_meta_' . $post_type  . $term_id, $m);
2142
+        update_option('tax_meta_'.$post_type.$term_id, $m);
2143 2143
     }
2144 2144
 }
2145 2145
 
@@ -2158,13 +2158,13 @@  discard block
 block discarded – undo
2158 2158
             $post_type = '';
2159 2159
         }
2160 2160
         if ($post_type) {
2161
-            $post_type = $post_type . '_';
2161
+            $post_type = $post_type.'_';
2162 2162
         }
2163 2163
 
2164
-        $m = get_option('tax_meta_' . $post_type  . $term_id);
2164
+        $m = get_option('tax_meta_'.$post_type.$term_id);
2165 2165
 
2166 2166
         $m[$key] = $value;
2167
-        update_option('tax_meta_' . $post_type . $term_id, $m);
2167
+        update_option('tax_meta_'.$post_type.$term_id, $m);
2168 2168
 
2169 2169
         /** This action is documented in geodirectory-functions/cat-meta-functions/Tax-meta-class.php */
2170 2170
         do_action('gd_tax_meta_updated', false, true, $term_id, $post_type);
Please login to merge, or discard this patch.
geodirectory-admin/admin_dummy_data_functions.php 1 patch
Indentation   +232 added lines, -232 removed lines patch added patch discarded remove patch
@@ -19,151 +19,151 @@  discard block
 block discarded – undo
19 19
  * @global string $dummy_image_path The dummy image path.
20 20
  */
21 21
 function geodir_dummy_data_taxonomies($post_type,$category_array) {
22
-    global $wpdb, $dummy_image_path;
22
+	global $wpdb, $dummy_image_path;
23 23
 
24 24
 
25 25
 
26
-    $last_catid = '';
26
+	$last_catid = '';
27 27
 
28
-    $uploads = wp_upload_dir(); // Array of key => value pairs
28
+	$uploads = wp_upload_dir(); // Array of key => value pairs
29 29
 
30
-    for ($i = 0; $i < count($category_array); $i++) {
31
-        $parent_catid = 0;
32
-        if (is_array($category_array[$i])) {
33
-            $cat_name_arr = $category_array[$i];
34
-            for ($j = 0; $j < count($cat_name_arr); $j++) {
35
-                $catname = $cat_name_arr[$j];
30
+	for ($i = 0; $i < count($category_array); $i++) {
31
+		$parent_catid = 0;
32
+		if (is_array($category_array[$i])) {
33
+			$cat_name_arr = $category_array[$i];
34
+			for ($j = 0; $j < count($cat_name_arr); $j++) {
35
+				$catname = $cat_name_arr[$j];
36 36
 
37
-                if (!term_exists($catname, $post_type.'category')) {
38
-                    $last_catid = wp_insert_term($catname, $post_type.'category', $args = array('parent' => $parent_catid));
37
+				if (!term_exists($catname, $post_type.'category')) {
38
+					$last_catid = wp_insert_term($catname, $post_type.'category', $args = array('parent' => $parent_catid));
39 39
 
40
-                    if ($j == 0) {
41
-                        $parent_catid = $last_catid;
42
-                    }
40
+					if ($j == 0) {
41
+						$parent_catid = $last_catid;
42
+					}
43 43
 
44 44
 
45
-                    if (geodir_dummy_folder_exists())
46
-                        $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
47
-                    else
48
-                        $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
45
+					if (geodir_dummy_folder_exists())
46
+						$dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
47
+					else
48
+						$dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
49 49
 
50
-                    $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
50
+					$dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
51 51
 
52
-                    $catname = str_replace(' ', '_', $catname);
53
-                    $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
52
+					$catname = str_replace(' ', '_', $catname);
53
+					$uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
54 54
 
55
-                    if (empty($uploaded['error'])) {
56
-                        $new_path = $uploaded['file'];
57
-                        $new_url = $uploaded['url'];
58
-                    }
55
+					if (empty($uploaded['error'])) {
56
+						$new_path = $uploaded['file'];
57
+						$new_url = $uploaded['url'];
58
+					}
59 59
 
60
-                    $wp_filetype = wp_check_filetype(basename($new_path), null);
61
-
62
-                    $attachment = array(
63
-                        'guid' => $uploads['baseurl'] . '/' . basename($new_path),
64
-                        'post_mime_type' => $wp_filetype['type'],
65
-                        'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
66
-                        'post_content' => '',
67
-                        'post_status' => 'inherit'
68
-                    );
69
-                    $attach_id = wp_insert_attachment($attachment, $new_path);
70
-
71
-                    // you must first include the image.php file
72
-                    // for the function wp_generate_attachment_metadata() to work
73
-                    require_once(ABSPATH . 'wp-admin/includes/image.php');
74
-                    $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
75
-                    wp_update_attachment_metadata($attach_id, $attach_data);
76
-
77
-                    if (!geodir_get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) {
78
-                        geodir_update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), $post_type);
79
-                    }
80
-                }
81
-            }
60
+					$wp_filetype = wp_check_filetype(basename($new_path), null);
82 61
 
83
-        } else {
84
-            $catname = $category_array[$i];
62
+					$attachment = array(
63
+						'guid' => $uploads['baseurl'] . '/' . basename($new_path),
64
+						'post_mime_type' => $wp_filetype['type'],
65
+						'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
66
+						'post_content' => '',
67
+						'post_status' => 'inherit'
68
+					);
69
+					$attach_id = wp_insert_attachment($attachment, $new_path);
85 70
 
86
-            if (!term_exists($catname, $post_type.'category')) {
87
-                $last_catid = wp_insert_term($catname, $post_type.'category');
71
+					// you must first include the image.php file
72
+					// for the function wp_generate_attachment_metadata() to work
73
+					require_once(ABSPATH . 'wp-admin/includes/image.php');
74
+					$attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
75
+					wp_update_attachment_metadata($attach_id, $attach_data);
88 76
 
89
-                if (geodir_dummy_folder_exists())
90
-                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
91
-                else
92
-                    $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
77
+					if (!geodir_get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) {
78
+						geodir_update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), $post_type);
79
+					}
80
+				}
81
+			}
93 82
 
94
-                $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
83
+		} else {
84
+			$catname = $category_array[$i];
95 85
 
96
-                $catname = str_replace(' ', '_', $catname);
97
-                $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
86
+			if (!term_exists($catname, $post_type.'category')) {
87
+				$last_catid = wp_insert_term($catname, $post_type.'category');
98 88
 
99
-                if (empty($uploaded['error'])) {
100
-                    $new_path = $uploaded['file'];
101
-                    $new_url = $uploaded['url'];
102
-                }
89
+				if (geodir_dummy_folder_exists())
90
+					$dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
91
+				else
92
+					$dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
103 93
 
104
-                $wp_filetype = wp_check_filetype(basename($new_path), null);
94
+				$dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
105 95
 
106
-                $attachment = array(
107
-                    'guid' => $uploads['baseurl'] . '/' . basename($new_path),
108
-                    'post_mime_type' => $wp_filetype['type'],
109
-                    'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
110
-                    'post_content' => '',
111
-                    'post_status' => 'inherit'
112
-                );
96
+				$catname = str_replace(' ', '_', $catname);
97
+				$uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
113 98
 
114
-                $attach_id = wp_insert_attachment($attachment, $new_path);
99
+				if (empty($uploaded['error'])) {
100
+					$new_path = $uploaded['file'];
101
+					$new_url = $uploaded['url'];
102
+				}
115 103
 
104
+				$wp_filetype = wp_check_filetype(basename($new_path), null);
116 105
 
117
-                // you must first include the image.php file
118
-                // for the function wp_generate_attachment_metadata() to work
119
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
120
-                $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
121
-                wp_update_attachment_metadata($attach_id, $attach_data);
106
+				$attachment = array(
107
+					'guid' => $uploads['baseurl'] . '/' . basename($new_path),
108
+					'post_mime_type' => $wp_filetype['type'],
109
+					'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
110
+					'post_content' => '',
111
+					'post_status' => 'inherit'
112
+				);
113
+
114
+				$attach_id = wp_insert_attachment($attachment, $new_path);
122 115
 
123
-                if (!geodir_get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) {
124
-                    geodir_update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), $post_type);
125
-                }
126
-            }
127
-        }
128 116
 
129
-    }
117
+				// you must first include the image.php file
118
+				// for the function wp_generate_attachment_metadata() to work
119
+				require_once(ABSPATH . 'wp-admin/includes/image.php');
120
+				$attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
121
+				wp_update_attachment_metadata($attach_id, $attach_data);
122
+
123
+				if (!geodir_get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, $post_type)) {
124
+					geodir_update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), $post_type);
125
+				}
126
+			}
127
+		}
128
+
129
+	}
130 130
 }
131 131
 
132 132
 
133 133
 function geodir_dummy_data_types(){
134
-    $data =  array(
135
-        'standard_places' => array(
136
-            'name'=>__('Default','geodirectory'),
137
-            'count'=> 30
138
-        ),
139
-        'property_sale' => array(
140
-            'name'=>__('Property for sale','geodirectory'),
141
-            'count'=> 10
142
-        ),
143
-        'property_rent' => array(
144
-            'name'=>__('Property for rent','geodirectory'),
145
-            'count'=> 10
146
-        )
147
-    );
148
-
149
-    return apply_filters('geodir_dummy_data_types',$data );
134
+	$data =  array(
135
+		'standard_places' => array(
136
+			'name'=>__('Default','geodirectory'),
137
+			'count'=> 30
138
+		),
139
+		'property_sale' => array(
140
+			'name'=>__('Property for sale','geodirectory'),
141
+			'count'=> 10
142
+		),
143
+		'property_rent' => array(
144
+			'name'=>__('Property for rent','geodirectory'),
145
+			'count'=> 10
146
+		)
147
+	);
148
+
149
+	return apply_filters('geodir_dummy_data_types',$data );
150 150
 }
151 151
 
152 152
 
153 153
 function geodir_create_dummy_fields($fields)
154 154
 {
155 155
     
156
-    /**
157
-     * Filter the array of default custom fields DB table data.
158
-     *
159
-     * @since 1.0.0
160
-     * @param string $fields The default custom fields as an array.
161
-     */
162
-    $fields = apply_filters('geodir_before_dummy_custom_fields_saved', $fields);
163
-    foreach ($fields as $field_index => $field) {
164
-        geodir_custom_field_save($field);
165
-
166
-    }
156
+	/**
157
+	 * Filter the array of default custom fields DB table data.
158
+	 *
159
+	 * @since 1.0.0
160
+	 * @param string $fields The default custom fields as an array.
161
+	 */
162
+	$fields = apply_filters('geodir_before_dummy_custom_fields_saved', $fields);
163
+	foreach ($fields as $field_index => $field) {
164
+		geodir_custom_field_save($field);
165
+
166
+	}
167 167
 }
168 168
 
169 169
 /**
@@ -176,20 +176,20 @@  discard block
 block discarded – undo
176 176
  */
177 177
 function geodir_delete_dummy_posts($post_type,$data_type)
178 178
 {
179
-    global $wpdb, $plugin_prefix;
179
+	global $wpdb, $plugin_prefix;
180 180
 
181 181
 
182
-    $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . $post_type."_detail WHERE post_dummy='1'");
182
+	$post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . $post_type."_detail WHERE post_dummy='1'");
183 183
 
184 184
 
185
-    foreach ($post_ids as $post_ids_obj) {
186
-        wp_delete_post($post_ids_obj->post_id);
187
-    }
185
+	foreach ($post_ids as $post_ids_obj) {
186
+		wp_delete_post($post_ids_obj->post_id);
187
+	}
188 188
 
189
-    //double check posts are deleted
190
-    $wpdb->get_results("DELETE FROM " . $plugin_prefix . $post_type. "_detail WHERE post_dummy='1'");
189
+	//double check posts are deleted
190
+	$wpdb->get_results("DELETE FROM " . $plugin_prefix . $post_type. "_detail WHERE post_dummy='1'");
191 191
 
192
-    update_option($post_type.'_dummy_data_type','');
192
+	update_option($post_type.'_dummy_data_type','');
193 193
 }
194 194
 
195 195
 /**
@@ -203,78 +203,78 @@  discard block
 block discarded – undo
203 203
 function geodir_insert_dummy_posts($post_type,$data_type,$item_index)
204 204
 {
205 205
 
206
-    ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
207
-    $data_types = geodir_dummy_data_types();
208
-
209
-    $total_count = 0;
210
-    global $dummy_post_index;
211
-    $dummy_post_index = $item_index;
212
-    foreach( $data_types as $key=>$val){
213
-        if($key==$data_type){
214
-            $total_count = $val['count'];
215
-            if($key=='standard_places'){
216
-                /**
217
-                 * Contains dummy post content.
218
-                 *
219
-                 * @since 1.0.0
220
-                 * @package GeoDirectory
221
-                 */
222
-                include_once( 'dummy-data/standard_places.php' );
223
-            }elseif($key=='property_sale'){
224
-                /**
225
-                 * Contains dummy property for sale post content.
226
-                 *
227
-                 * @since 1.6.11
228
-                 * @package GeoDirectory
229
-                 */
230
-                include_once( 'dummy-data/property_sale.php' );
231
-            }elseif($key=='property_rent'){
232
-                /**
233
-                 * Contains dummy property for sale post content.
234
-                 *
235
-                 * @since 1.6.11
236
-                 * @package GeoDirectory
237
-                 */
238
-                include_once( 'dummy-data/property_rent.php' );
239
-            }
240
-
241
-        }
242
-
243
-        do_action('geodir_insert_dummy_data_loop',$post_type,$data_type,$item_index);
244
-    }
245
-
246
-
247
-
248
-    // delete image cache on last entry
249
-    if($total_count == $item_index){
250
-        delete_transient( 'cached_dummy_images' );
251
-        flush_rewrite_rules();
252
-    }
206
+	ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
207
+	$data_types = geodir_dummy_data_types();
208
+
209
+	$total_count = 0;
210
+	global $dummy_post_index;
211
+	$dummy_post_index = $item_index;
212
+	foreach( $data_types as $key=>$val){
213
+		if($key==$data_type){
214
+			$total_count = $val['count'];
215
+			if($key=='standard_places'){
216
+				/**
217
+				 * Contains dummy post content.
218
+				 *
219
+				 * @since 1.0.0
220
+				 * @package GeoDirectory
221
+				 */
222
+				include_once( 'dummy-data/standard_places.php' );
223
+			}elseif($key=='property_sale'){
224
+				/**
225
+				 * Contains dummy property for sale post content.
226
+				 *
227
+				 * @since 1.6.11
228
+				 * @package GeoDirectory
229
+				 */
230
+				include_once( 'dummy-data/property_sale.php' );
231
+			}elseif($key=='property_rent'){
232
+				/**
233
+				 * Contains dummy property for sale post content.
234
+				 *
235
+				 * @since 1.6.11
236
+				 * @package GeoDirectory
237
+				 */
238
+				include_once( 'dummy-data/property_rent.php' );
239
+			}
240
+
241
+		}
242
+
243
+		do_action('geodir_insert_dummy_data_loop',$post_type,$data_type,$item_index);
244
+	}
245
+
246
+
247
+
248
+	// delete image cache on last entry
249
+	if($total_count == $item_index){
250
+		delete_transient( 'cached_dummy_images' );
251
+		flush_rewrite_rules();
252
+	}
253 253
 
254 254
 
255 255
 }
256 256
 
257 257
 
258 258
 if (!function_exists('geodir_autoinstall_admin_header') && (get_option('geodir_installed') || defined( 'GD_TESTING_MODE' ))) {
259
-    /**
260
-     * GeoDirectory dummy data installation.
261
-     *
262
-     * @since 1.0.0
263
-     * @package GeoDirectory
264
-     * @global object $wpdb WordPress Database object.
265
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
266
-     * @param string $post_type The post type.
267
-     */
268
-    function geodir_autoinstall_admin_header($post_type = 'gd_place')
269
-    {
270
-
271
-        global $wpdb, $plugin_prefix;
272
-
273
-        if (!geodir_is_default_location_set()) {
274
-            echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
275
-        } else {
276
-
277
-            ?>
259
+	/**
260
+	 * GeoDirectory dummy data installation.
261
+	 *
262
+	 * @since 1.0.0
263
+	 * @package GeoDirectory
264
+	 * @global object $wpdb WordPress Database object.
265
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
266
+	 * @param string $post_type The post type.
267
+	 */
268
+	function geodir_autoinstall_admin_header($post_type = 'gd_place')
269
+	{
270
+
271
+		global $wpdb, $plugin_prefix;
272
+
273
+		if (!geodir_is_default_location_set()) {
274
+			echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
275
+		} else {
276
+
277
+			?>
278 278
             <span class="gd-dummy-hint"><small><?php _e('*Hint*: Installing our Advanced Search addon FIRST will add extra search fields to non-default data types.','geodirectory');?></small></span>
279 279
             <table class="form-table gd-dummy-table">
280 280
                 <tbody>
@@ -286,78 +286,78 @@  discard block
 block discarded – undo
286 286
 
287 287
                 <?php
288 288
 
289
-                $cpts = geodir_get_posttypes('array');
289
+				$cpts = geodir_get_posttypes('array');
290 290
 
291
-                $data_types = geodir_dummy_data_types();
291
+				$data_types = geodir_dummy_data_types();
292 292
 
293
-                $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
293
+				$nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
294 294
 
295
-                foreach($cpts as $post_type=>$cpt){
295
+				foreach($cpts as $post_type=>$cpt){
296 296
 
297
-                    $data_types_for = apply_filters('geodir_dummy_date_types_for',$data_types,$post_type);
297
+					$data_types_for = apply_filters('geodir_dummy_date_types_for',$data_types,$post_type);
298 298
 
299 299
 
300
-                    $set_dt = get_option($post_type.'_dummy_data_type');
300
+					$set_dt = get_option($post_type.'_dummy_data_type');
301 301
 
302
-                    $count = 30;
302
+					$count = 30;
303 303
 
304
-                    geodir_add_column_if_not_exist($plugin_prefix . $post_type. "_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'");
304
+					geodir_add_column_if_not_exist($plugin_prefix . $post_type. "_detail", 'post_dummy', "enum( '1', '0' ) NULL DEFAULT '0'");
305 305
 
306
-                    $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
306
+					$post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
307 307
 
308
-                    echo "<tr>";
309
-                    echo "<td><strong>".$cpt['labels']['name']."</strong></td>";
308
+					echo "<tr>";
309
+					echo "<td><strong>".$cpt['labels']['name']."</strong></td>";
310 310
 
311 311
 
312
-                    $select_disabled = $post_counts > 0 ? 'disabled' : '';
313
-                    echo "<td>";
314
-                    echo "<select id='".$post_type."_data_type' onchange='geodir_dummy_set_count(this,\"$post_type\");' $select_disabled>";
312
+					$select_disabled = $post_counts > 0 ? 'disabled' : '';
313
+					echo "<td>";
314
+					echo "<select id='".$post_type."_data_type' onchange='geodir_dummy_set_count(this,\"$post_type\");' $select_disabled>";
315 315
 
316
-                    foreach($data_types_for as $key=>$val){
317
-                        $selected = ($key==$set_dt) ? "selected='selected'" : '';
318
-                        if($selected || count($data_types_for)==1){$count = $val['count'];}
319
-                        echo "<option $selected value='$key' data-count='".$val['count']."'>".$val['name']."</option>";
320
-                    }
321
-                    echo "</select>";
322
-
323
-                    $select_display = $post_counts > 0 ? 'display:none;' : '';
324
-                    echo "<select id='".$post_type."_data_type_count' style='$select_display' >";
325
-                    $x = 1;
326
-                    while($x <= $count){
327
-                        $selected = ($x==$count) ? "selected='selected'" : '';
328
-                        echo "<option $selected value='$x'>".$x."</option>";
329
-                        $x++;
330
-                    }
331
-                    echo "</select>";
332
-                    echo "</td>";
316
+					foreach($data_types_for as $key=>$val){
317
+						$selected = ($key==$set_dt) ? "selected='selected'" : '';
318
+						if($selected || count($data_types_for)==1){$count = $val['count'];}
319
+						echo "<option $selected value='$key' data-count='".$val['count']."'>".$val['name']."</option>";
320
+					}
321
+					echo "</select>";
333 322
 
323
+					$select_display = $post_counts > 0 ? 'display:none;' : '';
324
+					echo "<select id='".$post_type."_data_type_count' style='$select_display' >";
325
+					$x = 1;
326
+					while($x <= $count){
327
+						$selected = ($x==$count) ? "selected='selected'" : '';
328
+						echo "<option $selected value='$x'>".$x."</option>";
329
+						$x++;
330
+					}
331
+					echo "</select>";
332
+					echo "</td>";
334 333
 
335 334
 
336 335
 
337 336
 
338
-                    if($post_counts > 0){
339
-                        echo '<td><input type="button" value="'.__('Remove data','geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
340
-                    }else{
341
-                        echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
342
-                    }
343 337
 
344
-                    echo "</tr>";
345
-                    //print_r($cpt);
346
-                }
338
+					if($post_counts > 0){
339
+						echo '<td><input type="button" value="'.__('Remove data','geodirectory').'" class="button-primary geodir_dummy_button gd-remove-data" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
340
+					}else{
341
+						echo '<td><input type="button" value="'.__('Insert data','geodirectory').'" class="button-primary geodir_dummy_button" onclick="gdInstallDummyData(this,\'' . $nonce . '\',\'' . $post_type . '\'); return false;" ></td>';
342
+					}
343
+
344
+					echo "</tr>";
345
+					//print_r($cpt);
346
+				}
347 347
 
348
-                ?>
348
+				?>
349 349
                 </tbody>
350 350
             </table>
351 351
             <?php
352 352
 
353 353
 
354
-            $default_location = geodir_get_default_location();
355
-            $city = isset($default_location->city) ? $default_location->city : '';
356
-            $region = isset($default_location->region) ? $default_location->region : '';
357
-            $country = isset($default_location->country) ? $default_location->country : '';
358
-            $city_latitude = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
359
-            $city_longitude = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
360
-            ?>
354
+			$default_location = geodir_get_default_location();
355
+			$city = isset($default_location->city) ? $default_location->city : '';
356
+			$region = isset($default_location->region) ? $default_location->region : '';
357
+			$country = isset($default_location->country) ? $default_location->country : '';
358
+			$city_latitude = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
359
+			$city_longitude = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
360
+			?>
361 361
             <script type="text/javascript">
362 362
 
363 363
                 function geodir_dummy_set_count(data,cpt){
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
                 }
534 534
             </script>
535 535
             <?php
536
-        }
537
-    }
536
+		}
537
+	}
538 538
 }
539 539
 
Please login to merge, or discard this patch.
geodirectory-admin/admin_functions.php 2 patches
Indentation   +2908 added lines, -2908 removed lines patch added patch discarded remove patch
@@ -13,125 +13,125 @@  discard block
 block discarded – undo
13 13
  * @package GeoDirectory
14 14
  */
15 15
 function geodir_deactivation() {
16
-    // Update installed variable
17
-    update_option("geodir_installed", 0);
16
+	// Update installed variable
17
+	update_option("geodir_installed", 0);
18 18
 
19
-    // Remove rewrite rules and then recreate rewrite rules.
20
-    flush_rewrite_rules();
19
+	// Remove rewrite rules and then recreate rewrite rules.
20
+	flush_rewrite_rules();
21 21
 }
22 22
 
23 23
 if (!function_exists('geodir_admin_styles')) {
24
-    /**
25
-     * Enqueue Admin Styles.
26
-     *
27
-     * @since 1.0.0
28
-     * @package GeoDirectory
29
-     */
30
-    function geodir_admin_styles() {
31
-        wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
32
-        wp_enqueue_style('geodirectory-admin-css');
24
+	/**
25
+	 * Enqueue Admin Styles.
26
+	 *
27
+	 * @since 1.0.0
28
+	 * @package GeoDirectory
29
+	 */
30
+	function geodir_admin_styles() {
31
+		wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
32
+		wp_enqueue_style('geodirectory-admin-css');
33 33
 
34
-        wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
35
-        wp_enqueue_style('geodirectory-frontend-style');
34
+		wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
35
+		wp_enqueue_style('geodirectory-frontend-style');
36 36
 
37
-        wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
38
-        wp_enqueue_style('geodir-chosen-style');
37
+		wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
38
+		wp_enqueue_style('geodir-chosen-style');
39 39
 
40
-        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
41
-        wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
40
+		wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
41
+		wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
42 42
 
43
-        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
44
-        wp_enqueue_style('geodirectory-jquery-ui-css');
43
+		wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
44
+		wp_enqueue_style('geodirectory-jquery-ui-css');
45 45
 
46
-        wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
47
-        wp_enqueue_style('geodirectory-custom-fields-css');
46
+		wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
47
+		wp_enqueue_style('geodirectory-custom-fields-css');
48 48
 
49
-        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
50
-        wp_enqueue_style('geodirectory-pluplodar-css');
49
+		wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
50
+		wp_enqueue_style('geodirectory-pluplodar-css');
51 51
 
52
-        wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
53
-        wp_enqueue_style('geodir-rating-style');
52
+		wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
53
+		wp_enqueue_style('geodir-rating-style');
54 54
 
55
-        wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
56
-        wp_enqueue_style('geodir-rtl-style');
57
-    }
55
+		wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
56
+		wp_enqueue_style('geodir-rtl-style');
57
+	}
58 58
 }
59 59
 
60 60
 if (!function_exists('geodir_admin_styles_req')) {
61
-    /**
62
-     * Loads stylesheets from CDN.
63
-     *
64
-     * @since 1.0.0
65
-     * @package GeoDirectory
66
-     */
67
-    function geodir_admin_styles_req()
68
-    {
61
+	/**
62
+	 * Loads stylesheets from CDN.
63
+	 *
64
+	 * @since 1.0.0
65
+	 * @package GeoDirectory
66
+	 */
67
+	function geodir_admin_styles_req()
68
+	{
69 69
 
70
-        wp_register_style('font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
71
-        wp_enqueue_style('font-awesome');
70
+		wp_register_style('font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
71
+		wp_enqueue_style('font-awesome');
72 72
 
73
-        wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
74
-        wp_enqueue_script('geodirectory-admin');
73
+		wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
74
+		wp_enqueue_script('geodirectory-admin');
75 75
 
76
-    }
76
+	}
77 77
 }
78 78
 
79 79
 if (!function_exists('geodir_admin_scripts')) {
80
-    /**
81
-     * Enqueue Admin Scripts.
82
-     *
83
-     * @since 1.0.0
84
-     * @package GeoDirectory
85
-     */
86
-    function geodir_admin_scripts()
87
-    {
88
-        $geodir_map_name = geodir_map_name();
80
+	/**
81
+	 * Enqueue Admin Scripts.
82
+	 *
83
+	 * @since 1.0.0
84
+	 * @package GeoDirectory
85
+	 */
86
+	function geodir_admin_scripts()
87
+	{
88
+		$geodir_map_name = geodir_map_name();
89 89
         
90
-        wp_enqueue_script('jquery');
90
+		wp_enqueue_script('jquery');
91 91
 
92
-        wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true);
92
+		wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true);
93 93
 
94
-        wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
95
-        wp_enqueue_script('chosen');
94
+		wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
95
+		wp_enqueue_script('chosen');
96 96
 
97
-        wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
98
-        wp_enqueue_script('geodirectory-choose-ajax');
97
+		wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
98
+		wp_enqueue_script('geodirectory-choose-ajax');
99 99
 
100
-        if (isset($_REQUEST['listing_type'])) {
101
-            wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
102
-        }
100
+		if (isset($_REQUEST['listing_type'])) {
101
+			wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
102
+		}
103 103
 
104
-        wp_enqueue_script('geodirectory-custom-fields-script');
105
-        $plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
104
+		wp_enqueue_script('geodirectory-custom-fields-script');
105
+		$plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
106 106
 
107
-        wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
107
+		wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
108 108
 
109
-        if (in_array($geodir_map_name, array('auto', 'google'))) {
110
-            $map_lang = "&language=" . geodir_get_map_default_language();
111
-            $map_key = "&key=" . geodir_get_map_api_key();
112
-            /** This filter is documented in geodirectory_template_tags.php */
113
-            $map_extra = apply_filters('geodir_googlemap_script_extra', '');
114
-            wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra, '', NULL);
115
-        }
109
+		if (in_array($geodir_map_name, array('auto', 'google'))) {
110
+			$map_lang = "&language=" . geodir_get_map_default_language();
111
+			$map_key = "&key=" . geodir_get_map_api_key();
112
+			/** This filter is documented in geodirectory_template_tags.php */
113
+			$map_extra = apply_filters('geodir_googlemap_script_extra', '');
114
+			wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra, '', NULL);
115
+		}
116 116
         
117
-        if ($geodir_map_name == 'osm') {
118
-            // Leaflet OpenStreetMap
119
-            wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
120
-            wp_enqueue_style('geodirectory-leaflet-style');
117
+		if ($geodir_map_name == 'osm') {
118
+			// Leaflet OpenStreetMap
119
+			wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
120
+			wp_enqueue_style('geodirectory-leaflet-style');
121 121
                 
122
-            wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
123
-            wp_enqueue_script('geodirectory-leaflet-script');
122
+			wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
123
+			wp_enqueue_script('geodirectory-leaflet-script');
124 124
             
125
-            wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
126
-            wp_enqueue_script('geodirectory-leaflet-geo-script');
127
-        }
128
-        wp_enqueue_script( 'jquery-ui-autocomplete' );
125
+			wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
126
+			wp_enqueue_script('geodirectory-leaflet-geo-script');
127
+		}
128
+		wp_enqueue_script( 'jquery-ui-autocomplete' );
129 129
         
130
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
131
-        wp_enqueue_script('geodirectory-goMap-script');
130
+		wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
131
+		wp_enqueue_script('geodirectory-goMap-script');
132 132
 
133
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
134
-        wp_enqueue_script('geodirectory-goMap-script');
133
+		wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
134
+		wp_enqueue_script('geodirectory-goMap-script');
135 135
 
136 136
 		// font awesome rating script
137 137
 		if (get_option('geodir_reviewrating_enable_font_awesome')) {
@@ -142,167 +142,167 @@  discard block
 block discarded – undo
142 142
 			wp_enqueue_script('geodir-jRating-js');
143 143
 		}
144 144
 
145
-        wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js', array(), GEODIRECTORY_VERSION);
146
-        wp_enqueue_script('geodir-on-document-load');
147
-
148
-
149
-        // SCRIPT FOR UPLOAD
150
-        wp_enqueue_script('plupload-all');
151
-        wp_enqueue_script('jquery-ui-sortable');
152
-
153
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
154
-        wp_enqueue_script('geodirectory-plupload-script');
155
-
156
-        // SCRIPT FOR UPLOAD END
157
-
158
-
159
-        // place js config array for plupload
160
-        $plupload_init = array(
161
-            'runtimes' => 'html5,silverlight,flash,html4',
162
-            'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
163
-            'container' => 'plupload-upload-ui', // will be adjusted per uploader
164
-            'drop_element' => 'dropbox', // will be adjusted per uploader
165
-            'file_data_name' => 'async-upload', // will be adjusted per uploader
166
-            'multiple_queues' => true,
167
-            'max_file_size' => geodir_max_upload_size(),
168
-            'url' => admin_url('admin-ajax.php'),
169
-            'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
170
-            'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
171
-            'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
172
-            'multipart' => true,
173
-            'urlstream_upload' => true,
174
-            'multi_selection' => false, // will be added per uploader
175
-            // additional post data to send to our ajax hook
176
-            'multipart_params' => array(
177
-                '_ajax_nonce' => "", // will be added per uploader
178
-                'action' => 'plupload_action', // the ajax action name
179
-                'imgid' => 0 // will be added per uploader
180
-            )
181
-        );
182
-        $base_plupload_config = json_encode($plupload_init);
183
-
184
-
185
-        $thumb_img_arr = array();
186
-
187
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
188
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
189
-
190
-        $totImg = '';
191
-        $image_limit = '';
192
-        if (!empty($thumb_img_arr)) {
193
-            $totImg = count($thumb_img_arr);
194
-        }
145
+		wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js', array(), GEODIRECTORY_VERSION);
146
+		wp_enqueue_script('geodir-on-document-load');
147
+
148
+
149
+		// SCRIPT FOR UPLOAD
150
+		wp_enqueue_script('plupload-all');
151
+		wp_enqueue_script('jquery-ui-sortable');
152
+
153
+		wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
154
+		wp_enqueue_script('geodirectory-plupload-script');
155
+
156
+		// SCRIPT FOR UPLOAD END
157
+
158
+
159
+		// place js config array for plupload
160
+		$plupload_init = array(
161
+			'runtimes' => 'html5,silverlight,flash,html4',
162
+			'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
163
+			'container' => 'plupload-upload-ui', // will be adjusted per uploader
164
+			'drop_element' => 'dropbox', // will be adjusted per uploader
165
+			'file_data_name' => 'async-upload', // will be adjusted per uploader
166
+			'multiple_queues' => true,
167
+			'max_file_size' => geodir_max_upload_size(),
168
+			'url' => admin_url('admin-ajax.php'),
169
+			'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
170
+			'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
171
+			'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
172
+			'multipart' => true,
173
+			'urlstream_upload' => true,
174
+			'multi_selection' => false, // will be added per uploader
175
+			// additional post data to send to our ajax hook
176
+			'multipart_params' => array(
177
+				'_ajax_nonce' => "", // will be added per uploader
178
+				'action' => 'plupload_action', // the ajax action name
179
+				'imgid' => 0 // will be added per uploader
180
+			)
181
+		);
182
+		$base_plupload_config = json_encode($plupload_init);
183
+
184
+
185
+		$thumb_img_arr = array();
186
+
187
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
188
+			$thumb_img_arr = geodir_get_images($_REQUEST['pid']);
189
+
190
+		$totImg = '';
191
+		$image_limit = '';
192
+		if (!empty($thumb_img_arr)) {
193
+			$totImg = count($thumb_img_arr);
194
+		}
195 195
 
196
-        $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
197
-            'totalImg' => $totImg,
198
-            'image_limit' => $image_limit,
199
-            'upload_img_size' => geodir_max_upload_size());
196
+		$gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
197
+			'totalImg' => $totImg,
198
+			'image_limit' => $image_limit,
199
+			'upload_img_size' => geodir_max_upload_size());
200 200
 
201
-        wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
201
+		wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
202 202
 
203
-        $ajax_cons_data = array('url' => __(admin_url('admin-ajax.php')));
204
-        wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
203
+		$ajax_cons_data = array('url' => __(admin_url('admin-ajax.php')));
204
+		wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
205 205
 
206 206
 
207
-        wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
208
-        wp_enqueue_script('geodirectory-admin-script');
207
+		wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
208
+		wp_enqueue_script('geodirectory-admin-script');
209 209
 
210
-        wp_enqueue_style('farbtastic');
211
-        wp_enqueue_script('farbtastic');
210
+		wp_enqueue_style('farbtastic');
211
+		wp_enqueue_script('farbtastic');
212 212
 
213
-        $screen = get_current_screen();
214
-        if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
215
-            wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
216
-        }
213
+		$screen = get_current_screen();
214
+		if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
215
+			wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
216
+		}
217 217
 
218
-        $ajax_cons_data = array('url' => esc_url(__(get_option('siteurl') . '?geodir_ajax=true')));
219
-        wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
218
+		$ajax_cons_data = array('url' => esc_url(__(get_option('siteurl') . '?geodir_ajax=true')));
219
+		wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
220 220
 
221
-    }
221
+	}
222 222
 }
223 223
 
224 224
 if (!function_exists('geodir_admin_menu')) {
225
-    /**
226
-     * Admin Menus
227
-     *
228
-     * Sets up the admin menus in wordpress.
229
-     *
230
-     * @since 1.0.0
231
-     * @package GeoDirectory
232
-     * @global array $menu Menu array.
233
-     * @global object $geodirectory GeoDirectory plugin object.
234
-     */
235
-    function geodir_admin_menu()
236
-    {
237
-        global $menu, $geodirectory;
225
+	/**
226
+	 * Admin Menus
227
+	 *
228
+	 * Sets up the admin menus in wordpress.
229
+	 *
230
+	 * @since 1.0.0
231
+	 * @package GeoDirectory
232
+	 * @global array $menu Menu array.
233
+	 * @global object $geodirectory GeoDirectory plugin object.
234
+	 */
235
+	function geodir_admin_menu()
236
+	{
237
+		global $menu, $geodirectory;
238 238
 
239
-        if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
239
+		if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
240 240
 
241
-        add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
241
+		add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
242 242
 
243 243
 
244
-    }
244
+	}
245 245
 }
246 246
 
247 247
 if (!function_exists('geodir_admin_menu_order')) {
248
-    /**
249
-     * Order admin menus.
250
-     *
251
-     * @since 1.0.0
252
-     * @package GeoDirectory
253
-     * @param array $menu_order Menu order array.
254
-     * @return array Modified menu order array.
255
-     */
256
-    function geodir_admin_menu_order($menu_order)
257
-    {
258
-
259
-        // Initialize our custom order array
260
-        $geodir_menu_order = array();
261
-
262
-        // Get the index of our custom separator
263
-        $geodir_separator = array_search('separator-geodirectory', $menu_order);
264
-
265
-        // Get index of posttype menu
266
-        $post_types = geodir_get_posttypes();
267
-
268
-        // Loop through menu order and do some rearranging
269
-        foreach ($menu_order as $index => $item) :
270
-
271
-            if ((('geodirectory') == $item)) :
272
-                $geodir_menu_order[] = 'separator-geodirectory';
273
-                if (!empty($post_types)) {
274
-                    foreach ($post_types as $post_type) {
275
-                        $geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
276
-                    }
277
-                }
278
-                $geodir_menu_order[] = $item;
248
+	/**
249
+	 * Order admin menus.
250
+	 *
251
+	 * @since 1.0.0
252
+	 * @package GeoDirectory
253
+	 * @param array $menu_order Menu order array.
254
+	 * @return array Modified menu order array.
255
+	 */
256
+	function geodir_admin_menu_order($menu_order)
257
+	{
279 258
 
280
-                unset($menu_order[$geodir_separator]);
281
-            //unset( $menu_order[$geodir_places] );
282
-            elseif (!in_array($item, array('separator-geodirectory'))) :
283
-                $geodir_menu_order[] = $item;
284
-            endif;
259
+		// Initialize our custom order array
260
+		$geodir_menu_order = array();
285 261
 
286
-        endforeach;
262
+		// Get the index of our custom separator
263
+		$geodir_separator = array_search('separator-geodirectory', $menu_order);
287 264
 
288
-        // Return order
289
-        return $geodir_menu_order;
290
-    }
265
+		// Get index of posttype menu
266
+		$post_types = geodir_get_posttypes();
267
+
268
+		// Loop through menu order and do some rearranging
269
+		foreach ($menu_order as $index => $item) :
270
+
271
+			if ((('geodirectory') == $item)) :
272
+				$geodir_menu_order[] = 'separator-geodirectory';
273
+				if (!empty($post_types)) {
274
+					foreach ($post_types as $post_type) {
275
+						$geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
276
+					}
277
+				}
278
+				$geodir_menu_order[] = $item;
279
+
280
+				unset($menu_order[$geodir_separator]);
281
+			//unset( $menu_order[$geodir_places] );
282
+			elseif (!in_array($item, array('separator-geodirectory'))) :
283
+				$geodir_menu_order[] = $item;
284
+			endif;
285
+
286
+		endforeach;
287
+
288
+		// Return order
289
+		return $geodir_menu_order;
290
+	}
291 291
 }
292 292
 
293 293
 if (!function_exists('geodir_admin_custom_menu_order')) {
294
-    /**
295
-     * Enables custom menu order.
296
-     *
297
-     * @since 1.0.0
298
-     * @package GeoDirectory
299
-     * @return bool
300
-     */
301
-    function geodir_admin_custom_menu_order()
302
-    {
303
-        if (!current_user_can('manage_options')) return false;
304
-        return true;
305
-    }
294
+	/**
295
+	 * Enables custom menu order.
296
+	 *
297
+	 * @since 1.0.0
298
+	 * @package GeoDirectory
299
+	 * @return bool
300
+	 */
301
+	function geodir_admin_custom_menu_order()
302
+	{
303
+		if (!current_user_can('manage_options')) return false;
304
+		return true;
305
+	}
306 306
 }
307 307
 
308 308
 /**
@@ -313,51 +313,51 @@  discard block
 block discarded – undo
313 313
  */
314 314
 function geodir_before_admin_panel()
315 315
 {
316
-    if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
317
-        echo '<div id="message" class="updated fade">
316
+	if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
317
+		echo '<div id="message" class="updated fade">
318 318
                         <p style="float:right;">' . __('Like Geodirectory?', 'geodirectory') . ' <a href="http://wordpress.org/extend/plugins/Geodirectory/" target="_blank">' . __('Support us by leaving a rating!', 'geodirectory') . '</a></p>
319 319
                         <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory') . '</strong></p>
320 320
                 </div>';
321 321
 
322
-    }
322
+	}
323 323
 
324
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
325
-        switch ($_REQUEST['msg']) {
326
-            case 'success':
327
-                echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
328
-                flush_rewrite_rules(false);
324
+	if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
325
+		switch ($_REQUEST['msg']) {
326
+			case 'success':
327
+				echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
328
+				flush_rewrite_rules(false);
329 329
 
330
-                break;
330
+				break;
331 331
 			case 'fail':
332 332
 				$gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
333 333
 				
334 334
 				if ($gderr == 21)
335
-			    	echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
335
+					echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
336 336
 				else
337 337
 					echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
338
-                break;
339
-        }
340
-    }
338
+				break;
339
+		}
340
+	}
341 341
 
342
-    $geodir_load_map = get_option('geodir_load_map');
343
-    $need_map_key = false;
344
-    if($geodir_load_map=='' || $geodir_load_map=='google' || $geodir_load_map=='auto' ){
345
-        $need_map_key = true;
346
-    }
342
+	$geodir_load_map = get_option('geodir_load_map');
343
+	$need_map_key = false;
344
+	if($geodir_load_map=='' || $geodir_load_map=='google' || $geodir_load_map=='auto' ){
345
+		$need_map_key = true;
346
+	}
347 347
 
348
-    if (!geodir_get_map_api_key() && $need_map_key) {
349
-        echo '<div class="error"><p><strong>' . sprintf(__('Google Maps API KEY not set, %sclick here%s to set one OR use Open Street Maps instead.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=design_settings&active_tab=geodir_map_settings') . '\'>', '</a>') . '</strong></p></div>';
350
-    }
348
+	if (!geodir_get_map_api_key() && $need_map_key) {
349
+		echo '<div class="error"><p><strong>' . sprintf(__('Google Maps API KEY not set, %sclick here%s to set one OR use Open Street Maps instead.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=design_settings&active_tab=geodir_map_settings') . '\'>', '</a>') . '</strong></p></div>';
350
+	}
351 351
 
352
-    if (!geodir_is_default_location_set()) {
353
-        echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
352
+	if (!geodir_is_default_location_set()) {
353
+		echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
354 354
 
355
-    }
355
+	}
356 356
 
357
-    if (!function_exists('curl_init')) {
358
-        echo '<div class="error"><p><strong>' . __('CURL is not installed on this server, this can cause problems, please ask your server admin to install it.', 'geodirectory') . '</strong></p></div>';
357
+	if (!function_exists('curl_init')) {
358
+		echo '<div class="error"><p><strong>' . __('CURL is not installed on this server, this can cause problems, please ask your server admin to install it.', 'geodirectory') . '</strong></p></div>';
359 359
 
360
-    }
360
+	}
361 361
 
362 362
 
363 363
 
@@ -374,19 +374,19 @@  discard block
 block discarded – undo
374 374
  */
375 375
 function geodir_handle_option_form_submit($current_tab)
376 376
 {
377
-    global $geodir_settings;
378
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
379
-        /**
380
-         * Contains settings array for current tab.
381
-         *
382
-         * @since 1.0.0
383
-         * @package GeoDirectory
384
-         */
385
-        include_once('option-pages/' . $current_tab . '_array.php');
386
-    }
387
-    if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
388
-        if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
389
-        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
377
+	global $geodir_settings;
378
+	if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
379
+		/**
380
+		 * Contains settings array for current tab.
381
+		 *
382
+		 * @since 1.0.0
383
+		 * @package GeoDirectory
384
+		 */
385
+		include_once('option-pages/' . $current_tab . '_array.php');
386
+	}
387
+	if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
388
+		if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
389
+		if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
390 390
 		
391 391
 		/**
392 392
 		 * Fires before updating geodirectory admin settings.
@@ -398,38 +398,38 @@  discard block
 block discarded – undo
398 398
 		 */
399 399
 		do_action('geodir_before_update_options', $current_tab, $geodir_settings);		
400 400
 		
401
-        if (!empty($geodir_settings[$current_tab]))
402
-            geodir_update_options($geodir_settings[$current_tab]);
401
+		if (!empty($geodir_settings[$current_tab]))
402
+			geodir_update_options($geodir_settings[$current_tab]);
403 403
 
404
-        /**
405
-         * Called after GeoDirectory options settings are updated.
406
-         *
407
-         * @since 1.0.0
408
-         * @param array $geodir_settings The array of GeoDirectory settings.
409
-         * @see 'geodir_before_update_options'
410
-         */
411
-        do_action('geodir_update_options', $geodir_settings);
404
+		/**
405
+		 * Called after GeoDirectory options settings are updated.
406
+		 *
407
+		 * @since 1.0.0
408
+		 * @param array $geodir_settings The array of GeoDirectory settings.
409
+		 * @see 'geodir_before_update_options'
410
+		 */
411
+		do_action('geodir_update_options', $geodir_settings);
412 412
 
413
-        /**
414
-         * Called after GeoDirectory options settings are updated.
415
-         *
416
-         * Provides tab specific settings.
417
-         *
418
-         * @since 1.0.0
419
-         * @param string $current_tab The current settings tab name.
420
-         * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
421
-         */
422
-        do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
413
+		/**
414
+		 * Called after GeoDirectory options settings are updated.
415
+		 *
416
+		 * Provides tab specific settings.
417
+		 *
418
+		 * @since 1.0.0
419
+		 * @param string $current_tab The current settings tab name.
420
+		 * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
421
+		 */
422
+		do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
423 423
 
424
-        flush_rewrite_rules(false);
424
+		flush_rewrite_rules(false);
425 425
 
426
-        $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
426
+		$current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
427 427
 
428
-        $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
428
+		$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
429 429
 
430
-        wp_redirect($redirect_url);
431
-        exit();
432
-    endif;
430
+		wp_redirect($redirect_url);
431
+		exit();
432
+	endif;
433 433
 
434 434
 
435 435
 }
@@ -447,144 +447,144 @@  discard block
 block discarded – undo
447 447
  * @return bool Returns true if saved.
448 448
  */
449 449
 function geodir_update_options($options, $dummy = false) {
450
-    if ((!isset($_POST) || !$_POST) && !$dummy) return false;
450
+	if ((!isset($_POST) || !$_POST) && !$dummy) return false;
451 451
 
452
-    foreach ($options as $value) {
453
-        if ($dummy && isset($value['std']))
454
-            $_POST[$value['id']] = $value['std'];
452
+	foreach ($options as $value) {
453
+		if ($dummy && isset($value['std']))
454
+			$_POST[$value['id']] = $value['std'];
455 455
 
456 456
 
457
-        if (isset($value['type']) && $value['type'] == 'checkbox') :
457
+		if (isset($value['type']) && $value['type'] == 'checkbox') :
458 458
 
459
-            if (isset($value['id']) && isset($_POST[$value['id']])) {
460
-                update_option($value['id'], $_POST[$value['id']]);
461
-            } else {
462
-                update_option($value['id'], 0);
463
-            }
459
+			if (isset($value['id']) && isset($_POST[$value['id']])) {
460
+				update_option($value['id'], $_POST[$value['id']]);
461
+			} else {
462
+				update_option($value['id'], 0);
463
+			}
464 464
 
465
-        elseif (isset($value['type']) && $value['type'] == 'image_width') :
465
+		elseif (isset($value['type']) && $value['type'] == 'image_width') :
466 466
 
467
-            if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
468
-                update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
469
-                update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
470
-                if (isset($_POST[$value['id'] . '_crop'])) :
471
-                    update_option($value['id'] . '_crop', 1);
472
-                else :
473
-                    update_option($value['id'] . '_crop', 0);
474
-                endif;
475
-            } else {
476
-                update_option($value['id'] . '_width', $value['std']);
477
-                update_option($value['id'] . '_height', $value['std']);
478
-                update_option($value['id'] . '_crop', 1);
479
-            }
467
+			if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
468
+				update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
469
+				update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
470
+				if (isset($_POST[$value['id'] . '_crop'])) :
471
+					update_option($value['id'] . '_crop', 1);
472
+				else :
473
+					update_option($value['id'] . '_crop', 0);
474
+				endif;
475
+			} else {
476
+				update_option($value['id'] . '_width', $value['std']);
477
+				update_option($value['id'] . '_height', $value['std']);
478
+				update_option($value['id'] . '_crop', 1);
479
+			}
480 480
 
481
-        elseif (isset($value['type']) && $value['type'] == 'map') :
482
-            $post_types = array();
483
-            $categories = array();
481
+		elseif (isset($value['type']) && $value['type'] == 'map') :
482
+			$post_types = array();
483
+			$categories = array();
484 484
 
485
-            if (!empty($_POST['home_map_post_types'])) :
486
-                foreach ($_POST['home_map_post_types'] as $post_type) :
487
-                    $post_types[] = $post_type;
488
-                endforeach;
489
-            endif;
485
+			if (!empty($_POST['home_map_post_types'])) :
486
+				foreach ($_POST['home_map_post_types'] as $post_type) :
487
+					$post_types[] = $post_type;
488
+				endforeach;
489
+			endif;
490 490
 
491
-            update_option('geodir_exclude_post_type_on_map', $post_types);
491
+			update_option('geodir_exclude_post_type_on_map', $post_types);
492 492
 
493
-            if (!empty($_POST['post_category'])) :
494
-                foreach ($_POST['post_category'] as $texonomy => $cat_arr) :
495
-                    $categories[$texonomy] = array();
496
-                    foreach ($cat_arr as $category) :
497
-                        $categories[$texonomy][] = $category;
498
-                    endforeach;
499
-                    $categories[$texonomy] = !empty($categories[$texonomy]) ? array_unique($categories[$texonomy]) : array();
500
-                endforeach;
501
-            endif;
502
-            update_option('geodir_exclude_cat_on_map', $categories);
503
-            update_option('geodir_exclude_cat_on_map_upgrade', 1);
504
-        elseif (isset($value['type']) && $value['type'] == 'map_default_settings') :
493
+			if (!empty($_POST['post_category'])) :
494
+				foreach ($_POST['post_category'] as $texonomy => $cat_arr) :
495
+					$categories[$texonomy] = array();
496
+					foreach ($cat_arr as $category) :
497
+						$categories[$texonomy][] = $category;
498
+					endforeach;
499
+					$categories[$texonomy] = !empty($categories[$texonomy]) ? array_unique($categories[$texonomy]) : array();
500
+				endforeach;
501
+			endif;
502
+			update_option('geodir_exclude_cat_on_map', $categories);
503
+			update_option('geodir_exclude_cat_on_map_upgrade', 1);
504
+		elseif (isset($value['type']) && $value['type'] == 'map_default_settings') :
505 505
 
506 506
 
507
-            if (!empty($_POST['geodir_default_map_language'])):
508
-                update_option('geodir_default_map_language', $_POST['geodir_default_map_language']);
509
-            endif;
507
+			if (!empty($_POST['geodir_default_map_language'])):
508
+				update_option('geodir_default_map_language', $_POST['geodir_default_map_language']);
509
+			endif;
510 510
 
511 511
 
512
-            if (!empty($_POST['geodir_default_map_search_pt'])):
513
-                update_option('geodir_default_map_search_pt', $_POST['geodir_default_map_search_pt']);
514
-            endif;
512
+			if (!empty($_POST['geodir_default_map_search_pt'])):
513
+				update_option('geodir_default_map_search_pt', $_POST['geodir_default_map_search_pt']);
514
+			endif;
515 515
 
516 516
 
517
-        elseif (isset($value['type']) && $value['type'] == 'file') :
517
+		elseif (isset($value['type']) && $value['type'] == 'file') :
518 518
 
519 519
 
520
-            if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
520
+			if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
521 521
 
522
-                if (get_option($value['id'])) {
523
-                    $image_name_arr = explode('/', get_option($value['id']));
524
-                    $noimg_name = end($image_name_arr);
525
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
526
-                    if (file_exists($img_path))
527
-                        unlink($img_path);
528
-                }
522
+				if (get_option($value['id'])) {
523
+					$image_name_arr = explode('/', get_option($value['id']));
524
+					$noimg_name = end($image_name_arr);
525
+					$img_path = $uploads['path'] . '/' . $noimg_name;
526
+					if (file_exists($img_path))
527
+						unlink($img_path);
528
+				}
529 529
 
530
-                update_option($value['id'], '');
531
-            }
530
+				update_option($value['id'], '');
531
+			}
532 532
 
533
-            $uploadedfile = isset($_FILES[$value['id']]) ? $_FILES[$value['id']] : '';
534
-            $filename = isset($_FILES[$value['id']]['name']) ? $_FILES[$value['id']]['name'] : '';
535
-
536
-            if (!empty($filename)):
537
-                $ext = pathinfo($filename, PATHINFO_EXTENSION);
538
-                $uplaods = array();
539
-
540
-                foreach ($uploadedfile as $key => $uplaod):
541
-                    if ($key == 'name'):
542
-                        $uplaods[$key] = $filename;
543
-                    else :
544
-                        $uplaods[$key] = $uplaod;
545
-                    endif;
546
-                endforeach;
547
-
548
-                $uploads = wp_upload_dir();
549
-
550
-                if (get_option($value['id'])) {
551
-                    $image_name_arr = explode('/', get_option($value['id']));
552
-                    $noimg_name = end($image_name_arr);
553
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
554
-                    if (file_exists($img_path))
555
-                        unlink($img_path);
556
-                }
533
+			$uploadedfile = isset($_FILES[$value['id']]) ? $_FILES[$value['id']] : '';
534
+			$filename = isset($_FILES[$value['id']]['name']) ? $_FILES[$value['id']]['name'] : '';
535
+
536
+			if (!empty($filename)):
537
+				$ext = pathinfo($filename, PATHINFO_EXTENSION);
538
+				$uplaods = array();
539
+
540
+				foreach ($uploadedfile as $key => $uplaod):
541
+					if ($key == 'name'):
542
+						$uplaods[$key] = $filename;
543
+					else :
544
+						$uplaods[$key] = $uplaod;
545
+					endif;
546
+				endforeach;
547
+
548
+				$uploads = wp_upload_dir();
549
+
550
+				if (get_option($value['id'])) {
551
+					$image_name_arr = explode('/', get_option($value['id']));
552
+					$noimg_name = end($image_name_arr);
553
+					$img_path = $uploads['path'] . '/' . $noimg_name;
554
+					if (file_exists($img_path))
555
+						unlink($img_path);
556
+				}
557 557
 
558
-                $upload_overrides = array('test_form' => false);
559
-                $movefile = wp_handle_upload($uplaods, $upload_overrides);
558
+				$upload_overrides = array('test_form' => false);
559
+				$movefile = wp_handle_upload($uplaods, $upload_overrides);
560 560
 
561
-                update_option($value['id'], $movefile['url']);
561
+				update_option($value['id'], $movefile['url']);
562 562
 
563
-            endif;
563
+			endif;
564 564
 
565
-            if (!get_option($value['id']) && isset($value['value'])):
566
-                update_option($value['id'], $value['value']);
567
-            endif;
565
+			if (!get_option($value['id']) && isset($value['value'])):
566
+				update_option($value['id'], $value['value']);
567
+			endif;
568 568
 
569 569
 
570
-        else :
571
-            // same menu setting per theme.
572
-            if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
573
-                $theme = wp_get_theme();
574
-                update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
575
-            }
570
+		else :
571
+			// same menu setting per theme.
572
+			if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
573
+				$theme = wp_get_theme();
574
+				update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
575
+			}
576 576
 
577
-            if (isset($value['id']) && isset($_POST[$value['id']])) {
578
-                update_option($value['id'], $_POST[$value['id']]);
579
-            } else {
580
-                delete_option($value['id']);
581
-            }
577
+			if (isset($value['id']) && isset($_POST[$value['id']])) {
578
+				update_option($value['id'], $_POST[$value['id']]);
579
+			} else {
580
+				delete_option($value['id']);
581
+			}
582 582
 
583
-        endif;
584
-    }
585
-    if ($dummy)
586
-        $_POST = array();
587
-    return true;
583
+		endif;
584
+	}
585
+	if ($dummy)
586
+		$_POST = array();
587
+	return true;
588 588
 
589 589
 }
590 590
 
@@ -633,33 +633,33 @@  discard block
 block discarded – undo
633 633
 function places_custom_fields_tab($tabs)
634 634
 {
635 635
 
636
-    $geodir_post_types = get_option('geodir_post_types');
636
+	$geodir_post_types = get_option('geodir_post_types');
637 637
 
638
-    if (!empty($geodir_post_types)) {
638
+	if (!empty($geodir_post_types)) {
639 639
 
640
-        foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info):
640
+		foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info):
641 641
 
642
-            $listing_slug = __($geodir_posttype_info['labels']['singular_name'], 'geodirectory');
642
+			$listing_slug = __($geodir_posttype_info['labels']['singular_name'], 'geodirectory');
643 643
 
644
-            $tabs[$geodir_post_type . '_fields_settings'] = array(
645
-                'label' => wp_sprintf(__('%s Settings', 'geodirectory'), $listing_slug),
646
-                'subtabs' => array(
647
-                    array('subtab' => 'custom_fields',
648
-                        'label' => __('Custom Fields', 'geodirectory'),
649
-                        'request' => array('listing_type' => $geodir_post_type)),
650
-                    array('subtab' => 'sorting_options',
651
-                        'label' => __('Sorting Options', 'geodirectory'),
652
-                        'request' => array('listing_type' => $geodir_post_type)),
653
-                ),
654
-                'tab_index' => 9,
655
-                'request' => array('listing_type' => $geodir_post_type)
656
-            );
644
+			$tabs[$geodir_post_type . '_fields_settings'] = array(
645
+				'label' => wp_sprintf(__('%s Settings', 'geodirectory'), $listing_slug),
646
+				'subtabs' => array(
647
+					array('subtab' => 'custom_fields',
648
+						'label' => __('Custom Fields', 'geodirectory'),
649
+						'request' => array('listing_type' => $geodir_post_type)),
650
+					array('subtab' => 'sorting_options',
651
+						'label' => __('Sorting Options', 'geodirectory'),
652
+						'request' => array('listing_type' => $geodir_post_type)),
653
+				),
654
+				'tab_index' => 9,
655
+				'request' => array('listing_type' => $geodir_post_type)
656
+			);
657 657
 
658
-        endforeach;
658
+		endforeach;
659 659
 
660
-    }
660
+	}
661 661
 
662
-    return $tabs;
662
+	return $tabs;
663 663
 }
664 664
 
665 665
 
@@ -675,9 +675,9 @@  discard block
 block discarded – undo
675 675
  */
676 676
 function geodir_tools_setting_tab($tabs)
677 677
 {
678
-    wp_enqueue_script( 'jquery-ui-progressbar' );
679
-    $tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
680
-    return $tabs;
678
+	wp_enqueue_script( 'jquery-ui-progressbar' );
679
+	$tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
680
+	return $tabs;
681 681
 }
682 682
 
683 683
 /**
@@ -692,8 +692,8 @@  discard block
 block discarded – undo
692 692
  */
693 693
 function geodir_compatibility_setting_tab($tabs)
694 694
 {
695
-    $tabs['compatibility_settings'] = array('label' => __('Theme Compatibility', 'geodirectory'));
696
-    return $tabs;
695
+	$tabs['compatibility_settings'] = array('label' => __('Theme Compatibility', 'geodirectory'));
696
+	return $tabs;
697 697
 }
698 698
 
699 699
 
@@ -709,144 +709,144 @@  discard block
 block discarded – undo
709 709
  */
710 710
 function geodir_extend_geodirectory_setting_tab($tabs)
711 711
 {
712
-    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'https://wpgeodirectory.com', 'target' => '_blank');
713
-    return $tabs;
712
+	$tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'https://wpgeodirectory.com', 'target' => '_blank');
713
+	return $tabs;
714 714
 }
715 715
 
716 716
 
717 717
 if (!function_exists('geodir_edit_post_columns')) {
718
-    /**
719
-     * Modify admin post listing page columns.
720
-     *
721
-     * @since 1.0.0
722
-     * @package GeoDirectory
723
-     * @param array $columns The column array.
724
-     * @return array Altered column array.
725
-     */
726
-    function geodir_edit_post_columns($columns)
727
-    {
728
-
729
-        $new_columns = array('location' => __('Location (ID)', 'geodirectory'),
730
-            'categorys' => __('Categories', 'geodirectory'));
731
-
732
-        if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
733
-        {
734
-            $offset = 0; // should we prepend $array with $data?
735
-            $offset = count($columns); // or should we append $array with $data? lets pick this one...
736
-        }
718
+	/**
719
+	 * Modify admin post listing page columns.
720
+	 *
721
+	 * @since 1.0.0
722
+	 * @package GeoDirectory
723
+	 * @param array $columns The column array.
724
+	 * @return array Altered column array.
725
+	 */
726
+	function geodir_edit_post_columns($columns)
727
+	{
737 728
 
738
-        $columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset));
729
+		$new_columns = array('location' => __('Location (ID)', 'geodirectory'),
730
+			'categorys' => __('Categories', 'geodirectory'));
739 731
 
740
-        $columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
732
+		if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
733
+		{
734
+			$offset = 0; // should we prepend $array with $data?
735
+			$offset = count($columns); // or should we append $array with $data? lets pick this one...
736
+		}
741 737
 
742
-        return $columns;
743
-    }
738
+		$columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset));
739
+
740
+		$columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
741
+
742
+		return $columns;
743
+	}
744 744
 }
745 745
 
746 746
 
747 747
 if (!function_exists('geodir_manage_post_columns')) {
748
-    /**
749
-     * Adds content to our custom post listing page columns.
750
-     *
751
-     * @since 1.0.0
752
-     * @package GeoDirectory
753
-     * @global object $wpdb WordPress Database object.
754
-     * @global object $post WordPress Post object.
755
-     * @param string $column The column name.
756
-     * @param int $post_id The post ID.
757
-     */
758
-    function geodir_manage_post_columns($column, $post_id)
759
-    {
760
-        global $post, $wpdb;
761
-
762
-        switch ($column):
763
-            /* If displaying the 'city' column. */
764
-            case 'location' :
765
-                $location_id = geodir_get_post_meta($post->ID, 'post_location_id', true);
766
-                $location = geodir_get_location($location_id);
767
-                /* If no city is found, output a default message. */
768
-                if (empty($location)) {
769
-                    _e('Unknown', 'geodirectory');
770
-                } else {
771
-                    /* If there is a city id, append 'city name' to the text string. */
772
-                    $add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
773
-                    echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
774
-                }
775
-                break;
776
-
777
-            /* If displaying the 'expire' column. */
778
-            case 'expire' :
779
-                $expire_date = geodir_get_post_meta($post->ID, 'expire_date', true);
780
-                $d1 = $expire_date; // get expire_date
781
-                $d2 = date('Y-m-d'); // get current date
782
-                $state = __('days left', 'geodirectory');
783
-                $date_diff_text = '';
784
-                $expire_class = 'expire_left';
785
-                if ($expire_date != 'Never') {
786
-                    if (strtotime($d1) < strtotime($d2)) {
787
-                        $state = __('days overdue', 'geodirectory');
788
-                        $expire_class = 'expire_over';
789
-                    }
790
-                    $date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the difference in days
791
-                    $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
792
-                }
793
-                /* If no expire_date is found, output a default message. */
794
-                if (empty($expire_date))
795
-                    echo __('Unknown', 'geodirectory');
796
-                /* If there is a expire_date, append 'days left' to the text string. */
797
-                else
798
-                    echo $expire_date . $date_diff_text;
799
-                break;
800
-
801
-            /* If displaying the 'categorys' column. */
802
-            case 'categorys' :
803
-
804
-                /* Get the categorys for the post. */
805
-
806
-
807
-                $terms = wp_get_object_terms($post_id, get_object_taxonomies($post));
808
-
809
-                /* If terms were found. */
810
-                if (!empty($terms)) {
811
-                    $out = array();
812
-                    /* Loop through each term, linking to the 'edit posts' page for the specific term. */
813
-                    foreach ($terms as $term) {
814
-                        if (!strstr($term->taxonomy, 'tag')) {
815
-                            $out[] = sprintf('<a href="%s">%s</a>',
816
-                                esc_url(add_query_arg(array('post_type' => $post->post_type, $term->taxonomy => $term->slug), 'edit.php')),
817
-                                esc_html(sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, 'display'))
818
-                            );
819
-                        }
820
-                    }
821
-                    /* Join the terms, separating them with a comma. */
822
-                    echo(join(', ', $out));
823
-                } /* If no terms were found, output a default message. */
824
-                else {
825
-                    _e('No Categories', 'geodirectory');
826
-                }
827
-                break;
748
+	/**
749
+	 * Adds content to our custom post listing page columns.
750
+	 *
751
+	 * @since 1.0.0
752
+	 * @package GeoDirectory
753
+	 * @global object $wpdb WordPress Database object.
754
+	 * @global object $post WordPress Post object.
755
+	 * @param string $column The column name.
756
+	 * @param int $post_id The post ID.
757
+	 */
758
+	function geodir_manage_post_columns($column, $post_id)
759
+	{
760
+		global $post, $wpdb;
761
+
762
+		switch ($column):
763
+			/* If displaying the 'city' column. */
764
+			case 'location' :
765
+				$location_id = geodir_get_post_meta($post->ID, 'post_location_id', true);
766
+				$location = geodir_get_location($location_id);
767
+				/* If no city is found, output a default message. */
768
+				if (empty($location)) {
769
+					_e('Unknown', 'geodirectory');
770
+				} else {
771
+					/* If there is a city id, append 'city name' to the text string. */
772
+					$add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
773
+					echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
774
+				}
775
+				break;
776
+
777
+			/* If displaying the 'expire' column. */
778
+			case 'expire' :
779
+				$expire_date = geodir_get_post_meta($post->ID, 'expire_date', true);
780
+				$d1 = $expire_date; // get expire_date
781
+				$d2 = date('Y-m-d'); // get current date
782
+				$state = __('days left', 'geodirectory');
783
+				$date_diff_text = '';
784
+				$expire_class = 'expire_left';
785
+				if ($expire_date != 'Never') {
786
+					if (strtotime($d1) < strtotime($d2)) {
787
+						$state = __('days overdue', 'geodirectory');
788
+						$expire_class = 'expire_over';
789
+					}
790
+					$date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the difference in days
791
+					$date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
792
+				}
793
+				/* If no expire_date is found, output a default message. */
794
+				if (empty($expire_date))
795
+					echo __('Unknown', 'geodirectory');
796
+				/* If there is a expire_date, append 'days left' to the text string. */
797
+				else
798
+					echo $expire_date . $date_diff_text;
799
+				break;
828 800
 
829
-        endswitch;
830
-    }
801
+			/* If displaying the 'categorys' column. */
802
+			case 'categorys' :
803
+
804
+				/* Get the categorys for the post. */
805
+
806
+
807
+				$terms = wp_get_object_terms($post_id, get_object_taxonomies($post));
808
+
809
+				/* If terms were found. */
810
+				if (!empty($terms)) {
811
+					$out = array();
812
+					/* Loop through each term, linking to the 'edit posts' page for the specific term. */
813
+					foreach ($terms as $term) {
814
+						if (!strstr($term->taxonomy, 'tag')) {
815
+							$out[] = sprintf('<a href="%s">%s</a>',
816
+								esc_url(add_query_arg(array('post_type' => $post->post_type, $term->taxonomy => $term->slug), 'edit.php')),
817
+								esc_html(sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, 'display'))
818
+							);
819
+						}
820
+					}
821
+					/* Join the terms, separating them with a comma. */
822
+					echo(join(', ', $out));
823
+				} /* If no terms were found, output a default message. */
824
+				else {
825
+					_e('No Categories', 'geodirectory');
826
+				}
827
+				break;
828
+
829
+		endswitch;
830
+	}
831 831
 }
832 832
 
833 833
 
834 834
 if (!function_exists('geodir_post_sortable_columns')) {
835
-    /**
836
-     * Makes admin post listing page columns sortable.
837
-     *
838
-     * @since 1.0.0
839
-     * @package GeoDirectory
840
-     * @param array $columns The column array.
841
-     * @return array Altered column array.
842
-     */
843
-    function geodir_post_sortable_columns($columns)
844
-    {
845
-
846
-        $columns['expire'] = 'expire';
847
-
848
-        return $columns;
849
-    }
835
+	/**
836
+	 * Makes admin post listing page columns sortable.
837
+	 *
838
+	 * @since 1.0.0
839
+	 * @package GeoDirectory
840
+	 * @param array $columns The column array.
841
+	 * @return array Altered column array.
842
+	 */
843
+	function geodir_post_sortable_columns($columns)
844
+	{
845
+
846
+		$columns['expire'] = 'expire';
847
+
848
+		return $columns;
849
+	}
850 850
 }
851 851
 
852 852
 /**
@@ -860,32 +860,32 @@  discard block
 block discarded – undo
860 860
  * @param int $post_id The post ID.
861 861
  */
862 862
 function geodir_post_information_save($post_id, $post) {
863
-    global $wpdb, $current_user;
863
+	global $wpdb, $current_user;
864 864
 
865
-    if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
866
-        return;
867
-    }
865
+	if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
866
+		return;
867
+	}
868 868
 
869
-    $geodir_posttypes = geodir_get_posttypes();
869
+	$geodir_posttypes = geodir_get_posttypes();
870 870
 
871
-    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
872
-        return;
871
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
872
+		return;
873 873
 
874
-    if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
875
-        if (isset($_REQUEST['_status']))
876
-            geodir_change_post_status($post_id, $_REQUEST['_status']);
874
+	if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
875
+		if (isset($_REQUEST['_status']))
876
+			geodir_change_post_status($post_id, $_REQUEST['_status']);
877 877
 
878
-        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
879
-            return;
878
+		if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
879
+			return;
880 880
 
881
-        if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
882
-            return;
881
+		if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
882
+			return;
883 883
 
884
-        if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
885
-            return;
884
+		if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
885
+			return;
886 886
 
887
-        geodir_save_listing($_REQUEST);
888
-    }
887
+		geodir_save_listing($_REQUEST);
888
+	}
889 889
 }
890 890
 
891 891
 /**
@@ -901,102 +901,102 @@  discard block
 block discarded – undo
901 901
  */
902 902
 function geodir_admin_fields($options)
903 903
 {
904
-    global $geodirectory;
905
-
906
-    $first_title = true;
907
-    $tab_id = '';
908
-    $i = 0;
909
-    foreach ($options as $value) :
910
-        if (!isset($value['name'])) $value['name'] = '';
911
-        if (!isset($value['class'])) $value['class'] = '';
912
-        if (!isset($value['css'])) $value['css'] = '';
913
-        if (!isset($value['std'])) $value['std'] = '';
914
-        $desc = '';
915
-        switch ($value['type']) :
916
-            case 'dummy_installer':
917
-                $post_type = isset($value['post_type']) ? $value['post_type'] : 'gd_place';
918
-                geodir_autoinstall_admin_header($post_type);
919
-                break;
920
-            case 'title':
921
-
922
-                if ($i == 0) {
923
-                    echo '<dl id="geodir_oiption_tabs" class="gd-tab-head"></dl>';
924
-                    echo '<div class="inner_content_tab_main">';
925
-                }
904
+	global $geodirectory;
905
+
906
+	$first_title = true;
907
+	$tab_id = '';
908
+	$i = 0;
909
+	foreach ($options as $value) :
910
+		if (!isset($value['name'])) $value['name'] = '';
911
+		if (!isset($value['class'])) $value['class'] = '';
912
+		if (!isset($value['css'])) $value['css'] = '';
913
+		if (!isset($value['std'])) $value['std'] = '';
914
+		$desc = '';
915
+		switch ($value['type']) :
916
+			case 'dummy_installer':
917
+				$post_type = isset($value['post_type']) ? $value['post_type'] : 'gd_place';
918
+				geodir_autoinstall_admin_header($post_type);
919
+				break;
920
+			case 'title':
921
+
922
+				if ($i == 0) {
923
+					echo '<dl id="geodir_oiption_tabs" class="gd-tab-head"></dl>';
924
+					echo '<div class="inner_content_tab_main">';
925
+				}
926 926
 
927
-                $i++;
927
+				$i++;
928 928
 
929
-                if (isset($value['id']) && $value['id'])
930
-                    $tab_id = $value['id'];
929
+				if (isset($value['id']) && $value['id'])
930
+					$tab_id = $value['id'];
931 931
 
932
-                if (isset($value['desc']) && $value['desc'])
933
-                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
932
+				if (isset($value['desc']) && $value['desc'])
933
+					$desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
934 934
 
935
-                if (isset($value['name']) && $value['name']) {
936
-                    if ($first_title === true) {
937
-                        $first_title = false;
938
-                    } else {
939
-                        echo '</div>';
940
-                    }
941
-                    echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
935
+				if (isset($value['name']) && $value['name']) {
936
+					if ($first_title === true) {
937
+						$first_title = false;
938
+					} else {
939
+						echo '</div>';
940
+					}
941
+					echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
942 942
 
943
-                    echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
944
-                }
943
+					echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
944
+				}
945 945
 
946
-                /**
947
-                 * Called after a GeoDirectory settings title is output in the GD settings page.
948
-                 *
949
-                 * The action is called dynamically geodir_settings_$value['id'].
950
-                 *
951
-                 * @since 1.0.0
952
-                 */
953
-                do_action('geodir_settings_' . sanitize_title($value['id']));
954
-                break;
955
-
956
-            case 'no_tabs':
957
-
958
-                echo '<div class="inner_content_tab_main">';
959
-                echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
960
-
961
-                break;
962
-
963
-            case 'sectionstart':
964
-                if (isset($value['desc']) && $value['desc'])
965
-                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
966
-                if (isset($value['name']) && $value['name'])
967
-                    echo '<h3>' . $value['name'] . $desc . '</h3>';
968
-                /**
969
-                 * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
970
-                 *
971
-                 * The action is called dynamically geodir_settings_$value['id']_start.
972
-                 *
973
-                 * @since 1.0.0
974
-                 */
975
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
976
-                echo '<table class="form-table">' . "\n\n";
977
-
978
-                break;
979
-            case 'sectionend':
980
-                /**
981
-                 * Called before a GeoDirectory settings sectionend is output in the GD settings page.
982
-                 *
983
-                 * The action is called dynamically geodir_settings_$value['id']_end.
984
-                 *
985
-                 * @since 1.0.0
986
-                 */
987
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
988
-                echo '</table>';
989
-                /**
990
-                 * Called after a GeoDirectory settings sectionend is output in the GD settings page.
991
-                 *
992
-                 * The action is called dynamically geodir_settings_$value['id']_end.
993
-                 *
994
-                 * @since 1.0.0
995
-                 */
996
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
997
-                break;
998
-            case 'text':
999
-                ?>
946
+				/**
947
+				 * Called after a GeoDirectory settings title is output in the GD settings page.
948
+				 *
949
+				 * The action is called dynamically geodir_settings_$value['id'].
950
+				 *
951
+				 * @since 1.0.0
952
+				 */
953
+				do_action('geodir_settings_' . sanitize_title($value['id']));
954
+				break;
955
+
956
+			case 'no_tabs':
957
+
958
+				echo '<div class="inner_content_tab_main">';
959
+				echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
960
+
961
+				break;
962
+
963
+			case 'sectionstart':
964
+				if (isset($value['desc']) && $value['desc'])
965
+					$desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
966
+				if (isset($value['name']) && $value['name'])
967
+					echo '<h3>' . $value['name'] . $desc . '</h3>';
968
+				/**
969
+				 * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
970
+				 *
971
+				 * The action is called dynamically geodir_settings_$value['id']_start.
972
+				 *
973
+				 * @since 1.0.0
974
+				 */
975
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
976
+				echo '<table class="form-table">' . "\n\n";
977
+
978
+				break;
979
+			case 'sectionend':
980
+				/**
981
+				 * Called before a GeoDirectory settings sectionend is output in the GD settings page.
982
+				 *
983
+				 * The action is called dynamically geodir_settings_$value['id']_end.
984
+				 *
985
+				 * @since 1.0.0
986
+				 */
987
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
988
+				echo '</table>';
989
+				/**
990
+				 * Called after a GeoDirectory settings sectionend is output in the GD settings page.
991
+				 *
992
+				 * The action is called dynamically geodir_settings_$value['id']_end.
993
+				 *
994
+				 * @since 1.0.0
995
+				 */
996
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
997
+				break;
998
+			case 'text':
999
+				?>
1000 1000
                 <tr valign="top">
1001 1001
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1002 1002
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
@@ -1005,15 +1005,15 @@  discard block
 block discarded – undo
1005 1005
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1006 1006
                                            style=" <?php echo esc_attr($value['css']); ?>"
1007 1007
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1008
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1009
-                                           } else {
1010
-                                               echo esc_attr($value['std']);
1011
-                                           } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1008
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1009
+										   } else {
1010
+											   echo esc_attr($value['std']);
1011
+										   } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1012 1012
                 </tr><?php
1013
-                break;
1013
+				break;
1014 1014
 
1015
-            case 'map-key':
1016
-                ?>
1015
+			case 'map-key':
1016
+				?>
1017 1017
                 <tr valign="top">
1018 1018
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1019 1019
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
@@ -1022,17 +1022,17 @@  discard block
 block discarded – undo
1022 1022
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1023 1023
                                            style=" <?php echo esc_attr($value['css']); ?>"
1024 1024
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1025
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1026
-                                           } else {
1027
-                                               echo esc_attr($value['std']);
1028
-                                           } ?>"/>
1025
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1026
+										   } else {
1027
+											   echo esc_attr($value['std']);
1028
+										   } ?>"/>
1029 1029
                     <a href='https://console.developers.google.com/henhouse/?pb=["hh-1","maps_backend",null,[],"https://developers.google.com",null,["static_maps_backend","street_view_image_backend","maps_embed_backend","places_backend","geocoding_backend","directions_backend","distance_matrix_backend","geolocation","elevation_backend","timezone_backend","maps_backend"],null]&TB_iframe=true&width=600&height=400' class="thickbox button-primary" name="<?php _e('Generate API Key - ( MUST be logged in to your Google account )','geodirectory');?>" ><?php _e('Generate API Key','geodirectory');?></a>
1030 1030
                     <span class="description"><?php echo $value['desc']; ?></span></td>
1031 1031
                 </tr><?php
1032
-                break;
1032
+				break;
1033 1033
 
1034
-            case 'password':
1035
-                ?>
1034
+			case 'password':
1035
+				?>
1036 1036
                 <tr valign="top">
1037 1037
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1038 1038
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
@@ -1041,42 +1041,42 @@  discard block
 block discarded – undo
1041 1041
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1042 1042
                                            style="<?php echo esc_attr($value['css']); ?>"
1043 1043
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1044
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1045
-                                           } else {
1046
-                                               echo esc_attr($value['std']);
1047
-                                           } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1044
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1045
+										   } else {
1046
+											   echo esc_attr($value['std']);
1047
+										   } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1048 1048
                 </tr><?php
1049
-                break;
1049
+				break;
1050 1050
 
1051
-            case 'html_content':
1052
-                ?>
1051
+			case 'html_content':
1052
+				?>
1053 1053
                 <tr valign="top">
1054 1054
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1055 1055
                 <td class="forminp"><span class="description"><?php echo $value['desc']; ?></span></td>
1056 1056
                 </tr><?php
1057
-                break;
1057
+				break;
1058 1058
 
1059
-            case 'color' :
1060
-                ?>
1059
+			case 'color' :
1060
+				?>
1061 1061
                 <tr valign="top">
1062 1062
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1063 1063
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1064 1064
                                            id="<?php echo esc_attr($value['id']); ?>" type="text"
1065 1065
                                            style="<?php echo esc_attr($value['css']); ?>"
1066 1066
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1067
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1068
-                                           } else {
1069
-                                               echo esc_attr($value['std']);
1070
-                                           } ?>" class="colorpick"/> <span
1067
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1068
+										   } else {
1069
+											   echo esc_attr($value['std']);
1070
+										   } ?>" class="colorpick"/> <span
1071 1071
                         class="description"><?php echo $value['desc']; ?></span>
1072 1072
 
1073 1073
                     <div id="colorPickerDiv_<?php echo esc_attr($value['id']); ?>" class="colorpickdiv"
1074 1074
                          style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div>
1075 1075
                 </td>
1076 1076
                 </tr><?php
1077
-                break;
1078
-            case 'image_width' :
1079
-                ?>
1077
+				break;
1078
+			case 'image_width' :
1079
+				?>
1080 1080
                 <tr valign="top">
1081 1081
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1082 1082
                 <td class="forminp">
@@ -1098,11 +1098,11 @@  discard block
 block discarded – undo
1098 1098
 
1099 1099
                     <span class="description"><?php echo $value['desc'] ?></span></td>
1100 1100
                 </tr><?php
1101
-                break;
1102
-            case 'select':
1103
-                $option_value = get_option($value['id']);
1104
-                $option_value = !empty($option_value) ? stripslashes_deep($option_value) : $option_value;
1105
-                ?>
1101
+				break;
1102
+			case 'select':
1103
+				$option_value = get_option($value['id']);
1104
+				$option_value = !empty($option_value) ? stripslashes_deep($option_value) : $option_value;
1105
+				?>
1106 1106
                 <tr valign="top">
1107 1107
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1108 1108
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
@@ -1111,33 +1111,33 @@  discard block
 block discarded – undo
1111 1111
                                             class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1112 1112
                                             option-ajaxchosen="false">
1113 1113
                         <?php
1114
-                        foreach ($value['options'] as $key => $val) {
1115
-                            $geodir_select_value = '';
1116
-                            if ($option_value != '') {
1117
-                                if ($option_value != '' && $option_value == $key)
1118
-                                    $geodir_select_value = ' selected="selected" ';
1119
-                            } else {
1120
-                                if ($value['std'] == $key)
1121
-                                    $geodir_select_value = ' selected="selected" ';
1122
-                            }
1123
-                            ?>
1114
+						foreach ($value['options'] as $key => $val) {
1115
+							$geodir_select_value = '';
1116
+							if ($option_value != '') {
1117
+								if ($option_value != '' && $option_value == $key)
1118
+									$geodir_select_value = ' selected="selected" ';
1119
+							} else {
1120
+								if ($value['std'] == $key)
1121
+									$geodir_select_value = ' selected="selected" ';
1122
+							}
1123
+							?>
1124 1124
                             <option
1125 1125
                                 value="<?php echo esc_attr($key); ?>" <?php echo $geodir_select_value; ?> ><?php echo geodir_utf8_ucfirst($val) ?></option>
1126 1126
                         <?php
1127
-                        }
1128
-                        ?>
1127
+						}
1128
+						?>
1129 1129
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1130 1130
                 </td>
1131 1131
                 </tr><?php
1132
-                break;
1132
+				break;
1133 1133
 
1134
-            case 'multiselect':
1135
-                $option_values = get_option($value['id']);
1136
-                if ($option_values === '' && !empty($value['std']) && is_array($value['std'])) {
1137
-                   $option_values = $value['std'];
1138
-                }
1139
-                $option_values = !empty($option_values) ? stripslashes_deep($option_values) : $option_values;
1140
-                ?>
1134
+			case 'multiselect':
1135
+				$option_values = get_option($value['id']);
1136
+				if ($option_values === '' && !empty($value['std']) && is_array($value['std'])) {
1137
+				   $option_values = $value['std'];
1138
+				}
1139
+				$option_values = !empty($option_values) ? stripslashes_deep($option_values) : $option_values;
1140
+				?>
1141 1141
                 <tr valign="top">
1142 1142
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1143 1143
                 <td class="forminp"><select multiple="multiple" name="<?php echo esc_attr($value['id']); ?>[]"
@@ -1147,26 +1147,26 @@  discard block
 block discarded – undo
1147 1147
                                             data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
1148 1148
                                             option-ajaxchosen="false">
1149 1149
                         <?php
1150
-                        foreach ($value['options'] as $key => $val) {
1151
-                            if (strpos($key, 'optgroup_start-') === 0) {
1152
-                                ?><optgroup label="<?php echo geodir_utf8_ucfirst($val); ?>"><?php
1153
-                            } else if (strpos($key, 'optgroup_end-') === 0) {
1154
-                                ?></optgroup><?php
1155
-                            } else {
1156
-                                ?>
1150
+						foreach ($value['options'] as $key => $val) {
1151
+							if (strpos($key, 'optgroup_start-') === 0) {
1152
+								?><optgroup label="<?php echo geodir_utf8_ucfirst($val); ?>"><?php
1153
+							} else if (strpos($key, 'optgroup_end-') === 0) {
1154
+								?></optgroup><?php
1155
+							} else {
1156
+								?>
1157 1157
                                 <option value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values)));?>>
1158 1158
                                     <?php echo geodir_utf8_ucfirst($val) ?>
1159 1159
                                 </option>
1160 1160
                             <?php
1161
-                            }
1162
-                        }
1163
-                        ?>
1161
+							}
1162
+						}
1163
+						?>
1164 1164
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1165 1165
                 </td>
1166 1166
                 </tr><?php
1167
-                break;
1168
-            case 'file':
1169
-                ?>
1167
+				break;
1168
+			case 'file':
1169
+				?>
1170 1170
                 <tr valign="top">
1171 1171
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1172 1172
                 <td class="forminp">
@@ -1186,87 +1186,87 @@  discard block
 block discarded – undo
1186 1186
                     <?php } ?>
1187 1187
                 </td>
1188 1188
                 </tr><?php
1189
-                break;
1190
-            case 'map_default_settings' :
1191
-                ?>
1189
+				break;
1190
+			case 'map_default_settings' :
1191
+				?>
1192 1192
 
1193 1193
                 <tr valign="top">
1194 1194
                     <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
1195 1195
                     <td width="60%">
1196 1196
                         <select name="geodir_default_map_language" style="width:60%">
1197 1197
                             <?php
1198
-                            $arr_map_langages = array(
1199
-                                'ar' => __('ARABIC', 'geodirectory'),
1200
-                                'eu' => __('BASQUE', 'geodirectory'),
1201
-                                'bg' => __('BULGARIAN', 'geodirectory'),
1202
-                                'bn' => __('BENGALI', 'geodirectory'),
1203
-                                'ca' => __('CATALAN', 'geodirectory'),
1204
-                                'cs' => __('CZECH', 'geodirectory'),
1205
-                                'da' => __('DANISH', 'geodirectory'),
1206
-                                'de' => __('GERMAN', 'geodirectory'),
1207
-                                'el' => __('GREEK', 'geodirectory'),
1208
-                                'en' => __('ENGLISH', 'geodirectory'),
1209
-                                'en-AU' => __('ENGLISH (AUSTRALIAN)', 'geodirectory'),
1210
-                                'en-GB' => __('ENGLISH (GREAT BRITAIN)', 'geodirectory'),
1211
-                                'es' => __('SPANISH', 'geodirectory'),
1212
-                                'eu' => __('BASQUE', 'geodirectory'),
1213
-                                'fa' => __('FARSI', 'geodirectory'),
1214
-                                'fi' => __('FINNISH', 'geodirectory'),
1215
-                                'fil' => __('FILIPINO', 'geodirectory'),
1216
-                                'fr' => __('FRENCH', 'geodirectory'),
1217
-                                'gl' => __('GALICIAN', 'geodirectory'),
1218
-                                'gu' => __('GUJARATI', 'geodirectory'),
1219
-                                'hi' => __('HINDI', 'geodirectory'),
1220
-                                'hr' => __('CROATIAN', 'geodirectory'),
1221
-                                'hu' => __('HUNGARIAN', 'geodirectory'),
1222
-                                'id' => __('INDONESIAN', 'geodirectory'),
1223
-                                'it' => __('ITALIAN', 'geodirectory'),
1224
-                                'iw' => __('HEBREW', 'geodirectory'),
1225
-                                'ja' => __('JAPANESE', 'geodirectory'),
1226
-                                'kn' => __('KANNADA', 'geodirectory'),
1227
-                                'ko' => __('KOREAN', 'geodirectory'),
1228
-                                'lt' => __('LITHUANIAN', 'geodirectory'),
1229
-                                'lv' => __('LATVIAN', 'geodirectory'),
1230
-                                'ml' => __('MALAYALAM', 'geodirectory'),
1231
-                                'mr' => __('MARATHI', 'geodirectory'),
1232
-                                'nl' => __('DUTCH', 'geodirectory'),
1233
-                                'no' => __('NORWEGIAN', 'geodirectory'),
1234
-                                'pl' => __('POLISH', 'geodirectory'),
1235
-                                'pt' => __('PORTUGUESE', 'geodirectory'),
1236
-                                'pt-BR' => __('PORTUGUESE (BRAZIL)', 'geodirectory'),
1237
-                                'pt-PT' => __('PORTUGUESE (PORTUGAL)', 'geodirectory'),
1238
-                                'ro' => __('ROMANIAN', 'geodirectory'),
1239
-                                'ru' => __('RUSSIAN', 'geodirectory'),
1240
-                                'ru' => __('RUSSIAN', 'geodirectory'),
1241
-                                'sk' => __('SLOVAK', 'geodirectory'),
1242
-                                'sl' => __('SLOVENIAN', 'geodirectory'),
1243
-                                'sr' => __('SERBIAN', 'geodirectory'),
1244
-                                'sv' => __('	SWEDISH', 'geodirectory'),
1245
-                                'tl' => __('TAGALOG', 'geodirectory'),
1246
-                                'ta' => __('TAMIL', 'geodirectory'),
1247
-                                'te' => __('TELUGU', 'geodirectory'),
1248
-                                'th' => __('THAI', 'geodirectory'),
1249
-                                'tr' => __('TURKISH', 'geodirectory'),
1250
-                                'uk' => __('UKRAINIAN', 'geodirectory'),
1251
-                                'vi' => __('VIETNAMESE', 'geodirectory'),
1252
-                                'zh-CN' => __('CHINESE (SIMPLIFIED)', 'geodirectory'),
1253
-                                'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
1254
-                            );
1255
-                            $geodir_default_map_language = get_option('geodir_default_map_language');
1256
-                            if (empty($geodir_default_map_language))
1257
-                                $geodir_default_map_language = 'en';
1258
-                            foreach ($arr_map_langages as $language_key => $language_txt) {
1259
-                                if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
1260
-                                    $geodir_default_language_selected = "selected='selected'";
1261
-                                else
1262
-                                    $geodir_default_language_selected = '';
1263
-
1264
-                                ?>
1198
+							$arr_map_langages = array(
1199
+								'ar' => __('ARABIC', 'geodirectory'),
1200
+								'eu' => __('BASQUE', 'geodirectory'),
1201
+								'bg' => __('BULGARIAN', 'geodirectory'),
1202
+								'bn' => __('BENGALI', 'geodirectory'),
1203
+								'ca' => __('CATALAN', 'geodirectory'),
1204
+								'cs' => __('CZECH', 'geodirectory'),
1205
+								'da' => __('DANISH', 'geodirectory'),
1206
+								'de' => __('GERMAN', 'geodirectory'),
1207
+								'el' => __('GREEK', 'geodirectory'),
1208
+								'en' => __('ENGLISH', 'geodirectory'),
1209
+								'en-AU' => __('ENGLISH (AUSTRALIAN)', 'geodirectory'),
1210
+								'en-GB' => __('ENGLISH (GREAT BRITAIN)', 'geodirectory'),
1211
+								'es' => __('SPANISH', 'geodirectory'),
1212
+								'eu' => __('BASQUE', 'geodirectory'),
1213
+								'fa' => __('FARSI', 'geodirectory'),
1214
+								'fi' => __('FINNISH', 'geodirectory'),
1215
+								'fil' => __('FILIPINO', 'geodirectory'),
1216
+								'fr' => __('FRENCH', 'geodirectory'),
1217
+								'gl' => __('GALICIAN', 'geodirectory'),
1218
+								'gu' => __('GUJARATI', 'geodirectory'),
1219
+								'hi' => __('HINDI', 'geodirectory'),
1220
+								'hr' => __('CROATIAN', 'geodirectory'),
1221
+								'hu' => __('HUNGARIAN', 'geodirectory'),
1222
+								'id' => __('INDONESIAN', 'geodirectory'),
1223
+								'it' => __('ITALIAN', 'geodirectory'),
1224
+								'iw' => __('HEBREW', 'geodirectory'),
1225
+								'ja' => __('JAPANESE', 'geodirectory'),
1226
+								'kn' => __('KANNADA', 'geodirectory'),
1227
+								'ko' => __('KOREAN', 'geodirectory'),
1228
+								'lt' => __('LITHUANIAN', 'geodirectory'),
1229
+								'lv' => __('LATVIAN', 'geodirectory'),
1230
+								'ml' => __('MALAYALAM', 'geodirectory'),
1231
+								'mr' => __('MARATHI', 'geodirectory'),
1232
+								'nl' => __('DUTCH', 'geodirectory'),
1233
+								'no' => __('NORWEGIAN', 'geodirectory'),
1234
+								'pl' => __('POLISH', 'geodirectory'),
1235
+								'pt' => __('PORTUGUESE', 'geodirectory'),
1236
+								'pt-BR' => __('PORTUGUESE (BRAZIL)', 'geodirectory'),
1237
+								'pt-PT' => __('PORTUGUESE (PORTUGAL)', 'geodirectory'),
1238
+								'ro' => __('ROMANIAN', 'geodirectory'),
1239
+								'ru' => __('RUSSIAN', 'geodirectory'),
1240
+								'ru' => __('RUSSIAN', 'geodirectory'),
1241
+								'sk' => __('SLOVAK', 'geodirectory'),
1242
+								'sl' => __('SLOVENIAN', 'geodirectory'),
1243
+								'sr' => __('SERBIAN', 'geodirectory'),
1244
+								'sv' => __('	SWEDISH', 'geodirectory'),
1245
+								'tl' => __('TAGALOG', 'geodirectory'),
1246
+								'ta' => __('TAMIL', 'geodirectory'),
1247
+								'te' => __('TELUGU', 'geodirectory'),
1248
+								'th' => __('THAI', 'geodirectory'),
1249
+								'tr' => __('TURKISH', 'geodirectory'),
1250
+								'uk' => __('UKRAINIAN', 'geodirectory'),
1251
+								'vi' => __('VIETNAMESE', 'geodirectory'),
1252
+								'zh-CN' => __('CHINESE (SIMPLIFIED)', 'geodirectory'),
1253
+								'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
1254
+							);
1255
+							$geodir_default_map_language = get_option('geodir_default_map_language');
1256
+							if (empty($geodir_default_map_language))
1257
+								$geodir_default_map_language = 'en';
1258
+							foreach ($arr_map_langages as $language_key => $language_txt) {
1259
+								if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
1260
+									$geodir_default_language_selected = "selected='selected'";
1261
+								else
1262
+									$geodir_default_language_selected = '';
1263
+
1264
+								?>
1265 1265
                                 <option
1266 1266
                                     value="<?php echo $language_key?>" <?php echo $geodir_default_language_selected; ?>><?php echo $language_txt; ?></option>
1267 1267
 
1268 1268
                             <?php }
1269
-                            ?>
1269
+							?>
1270 1270
                         </select>
1271 1271
                     </td>
1272 1272
                 </tr>
@@ -1277,46 +1277,46 @@  discard block
 block discarded – undo
1277 1277
                     <td width="60%">
1278 1278
                         <select name="geodir_default_map_search_pt" style="width:60%">
1279 1279
                             <?php
1280
-                            $post_types = geodir_get_posttypes('array');
1281
-                            $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
1282
-                            if (empty($geodir_default_map_search_pt))
1283
-                                $geodir_default_map_search_pt = 'gd_place';
1284
-                            if (is_array($post_types)) {
1285
-                                foreach ($post_types as $key => $post_types_obj) {
1286
-                                    if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
1287
-                                        $geodir_search_pt_selected = "selected='selected'";
1288
-                                    else
1289
-                                        $geodir_search_pt_selected = '';
1290
-
1291
-                                    ?>
1280
+							$post_types = geodir_get_posttypes('array');
1281
+							$geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
1282
+							if (empty($geodir_default_map_search_pt))
1283
+								$geodir_default_map_search_pt = 'gd_place';
1284
+							if (is_array($post_types)) {
1285
+								foreach ($post_types as $key => $post_types_obj) {
1286
+									if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
1287
+										$geodir_search_pt_selected = "selected='selected'";
1288
+									else
1289
+										$geodir_search_pt_selected = '';
1290
+
1291
+									?>
1292 1292
                                     <option
1293 1293
                                         value="<?php echo $key?>" <?php echo $geodir_search_pt_selected; ?>><?php echo __($post_types_obj['labels']['singular_name'], 'geodirectory'); ?></option>
1294 1294
 
1295 1295
                                 <?php }
1296 1296
 
1297
-                            }
1297
+							}
1298 1298
 
1299
-                            ?>
1299
+							?>
1300 1300
                         </select>
1301 1301
                     </td>
1302 1302
                 </tr>
1303 1303
 
1304 1304
                 <?php
1305
-                break;
1305
+				break;
1306 1306
 
1307
-            case 'map':
1308
-                ?>
1307
+			case 'map':
1308
+				?>
1309 1309
                 <tr valign="top">
1310 1310
                     <td class="forminp">
1311 1311
                         <?php
1312
-                        global $post_cat, $cat_display;
1313
-                        $post_types = geodir_get_posttypes('object');
1314
-                        $cat_display = 'checkbox';
1315
-                        $gd_post_types = get_option('geodir_exclude_post_type_on_map');
1316
-                        $gd_cats = get_option('geodir_exclude_cat_on_map');
1317
-                        $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1318
-                        $count = 1;
1319
-                        ?>
1312
+						global $post_cat, $cat_display;
1313
+						$post_types = geodir_get_posttypes('object');
1314
+						$cat_display = 'checkbox';
1315
+						$gd_post_types = get_option('geodir_exclude_post_type_on_map');
1316
+						$gd_cats = get_option('geodir_exclude_cat_on_map');
1317
+						$gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1318
+						$count = 1;
1319
+						?>
1320 1320
                         <table width="70%" class="widefat">
1321 1321
                             <thead>
1322 1322
                             <tr>
@@ -1325,18 +1325,18 @@  discard block
 block discarded – undo
1325 1325
                                 <th><b><?php echo DESIGN_POST_TYPE_CAT; ?></b></th>
1326 1326
                             </tr>
1327 1327
                             <?php
1328
-                            $gd_categs = $gd_cats;
1329
-                            foreach ($post_types as $key => $post_types_obj) :
1330
-                                $checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : '';
1331
-                                $gd_taxonomy = geodir_get_taxonomies($key);
1332
-                                if ($gd_cats_upgrade) {
1333
-                                    $gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : '';
1334
-                                    $gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array();
1335
-                                    $gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array();
1336
-                                }
1337
-                                $post_cat = implode(',', $gd_cats);
1338
-                                $gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy);
1339
-                                ?>
1328
+							$gd_categs = $gd_cats;
1329
+							foreach ($post_types as $key => $post_types_obj) :
1330
+								$checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : '';
1331
+								$gd_taxonomy = geodir_get_taxonomies($key);
1332
+								if ($gd_cats_upgrade) {
1333
+									$gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : '';
1334
+									$gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array();
1335
+									$gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array();
1336
+								}
1337
+								$post_cat = implode(',', $gd_cats);
1338
+								$gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy);
1339
+								?>
1340 1340
                                 <tr>
1341 1341
                                     <td valign="top" width="5%"><?php echo $count; ?></td>
1342 1342
                                     <td valign="top" width="25%" id="td_post_types"><input type="checkbox"
@@ -1357,19 +1357,19 @@  discard block
 block discarded – undo
1357 1357
                     </td>
1358 1358
                 </tr>
1359 1359
                 <?php
1360
-                break;
1360
+				break;
1361 1361
 
1362
-            case 'checkbox' :
1362
+			case 'checkbox' :
1363 1363
 
1364
-                if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'start')) :
1365
-                    ?>
1364
+				if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'start')) :
1365
+					?>
1366 1366
                     <tr valign="top">
1367 1367
                     <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1368 1368
                     <td class="forminp">
1369 1369
                 <?php
1370
-                endif;
1370
+				endif;
1371 1371
 
1372
-                ?>
1372
+				?>
1373 1373
                 <fieldset>
1374 1374
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1375 1375
                     <label for="<?php echo $value['id'] ?>">
@@ -1379,49 +1379,49 @@  discard block
 block discarded – undo
1379 1379
                 </fieldset>
1380 1380
                 <?php
1381 1381
 
1382
-                if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'end')) :
1383
-                    ?>
1382
+				if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'end')) :
1383
+					?>
1384 1384
                     </td>
1385 1385
                     </tr>
1386 1386
                 <?php
1387
-                endif;
1387
+				endif;
1388 1388
 
1389
-                break;
1389
+				break;
1390 1390
 
1391
-            case 'radio' :
1391
+			case 'radio' :
1392 1392
 
1393
-                if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'start')) :
1394
-                    ?>
1393
+				if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'start')) :
1394
+					?>
1395 1395
                     <tr valign="top">
1396 1396
                     <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1397 1397
                     <td class="forminp">
1398 1398
                 <?php
1399
-                endif;
1399
+				endif;
1400 1400
 
1401
-                ?>
1401
+				?>
1402 1402
                 <fieldset>
1403 1403
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1404 1404
                     <label for="<?php echo $value['id'];?>">
1405 1405
                         <input name="<?php echo esc_attr($value['id']); ?>"
1406 1406
                                id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
1407 1407
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
1408
-                            echo 'checked="checked"';
1409
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1408
+							echo 'checked="checked"';
1409
+						}elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1410 1410
                         <?php echo $value['desc']; ?></label><br>
1411 1411
                 </fieldset>
1412 1412
                 <?php
1413 1413
 
1414
-                if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'end')) :
1415
-                    ?>
1414
+				if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'end')) :
1415
+					?>
1416 1416
                     </td>
1417 1417
                     </tr>
1418 1418
                 <?php
1419
-                endif;
1419
+				endif;
1420 1420
 
1421
-                break;
1421
+				break;
1422 1422
 
1423
-            case 'textarea':
1424
-                ?>
1423
+			case 'textarea':
1424
+				?>
1425 1425
                 <tr valign="top">
1426 1426
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1427 1427
                 <td class="forminp">
@@ -1434,30 +1434,30 @@  discard block
 block discarded – undo
1434 1434
 
1435 1435
                 </td>
1436 1436
                 </tr><?php
1437
-                break;
1437
+				break;
1438 1438
 
1439
-            case 'editor':
1440
-                ?>
1439
+			case 'editor':
1440
+				?>
1441 1441
                 <tr valign="top">
1442 1442
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1443 1443
                 <td class="forminp"><?php
1444
-                    if (get_option($value['id']))
1445
-                        $content = stripslashes(get_option($value['id']));
1446
-                    else
1447
-                        $content = $value['std'];
1444
+					if (get_option($value['id']))
1445
+						$content = stripslashes(get_option($value['id']));
1446
+					else
1447
+						$content = $value['std'];
1448 1448
 
1449
-                    $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
1449
+					$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
1450 1450
 
1451
-                    wp_editor($content, esc_attr($value['id']), $editor_settings);
1451
+					wp_editor($content, esc_attr($value['id']), $editor_settings);
1452 1452
 
1453
-                    ?> <span class="description"><?php echo $value['desc'] ?></span>
1453
+					?> <span class="description"><?php echo $value['desc'] ?></span>
1454 1454
 
1455 1455
                 </td>
1456 1456
                 </tr><?php
1457
-                break;
1457
+				break;
1458 1458
 
1459
-            case 'single_select_page' :
1460
-                // WPML
1459
+			case 'single_select_page' :
1460
+				// WPML
1461 1461
 				$switch_lang = false;
1462 1462
 				$disabled = '';
1463 1463
 				if (geodir_is_wpml() && isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
@@ -1475,18 +1475,18 @@  discard block
 block discarded – undo
1475 1475
 				//
1476 1476
 				$page_setting = (int)get_option($value['id']);
1477 1477
 
1478
-                $args = array('name' => $value['id'],
1479
-                    'id' => $value['id'],
1480
-                    'sort_column' => 'menu_order',
1481
-                    'sort_order' => 'ASC',
1482
-                    'show_option_none' => ' ',
1483
-                    'class' => $value['class'],
1484
-                    'echo' => false,
1485
-                    'selected' => $page_setting);
1478
+				$args = array('name' => $value['id'],
1479
+					'id' => $value['id'],
1480
+					'sort_column' => 'menu_order',
1481
+					'sort_order' => 'ASC',
1482
+					'show_option_none' => ' ',
1483
+					'class' => $value['class'],
1484
+					'echo' => false,
1485
+					'selected' => $page_setting);
1486 1486
 
1487
-                if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
1487
+				if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
1488 1488
 
1489
-                ?>
1489
+				?>
1490 1490
                 <tr valign="top" class="single_select_page">
1491 1491
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1492 1492
                 <td class="forminp">
@@ -1497,17 +1497,17 @@  discard block
 block discarded – undo
1497 1497
 				if ($switch_lang) {
1498 1498
 					$sitepress->switch_lang($switch_lang, true);
1499 1499
 				}
1500
-                break;
1501
-            case 'single_select_country' :
1502
-                $country_setting = (string)get_option($value['id']);
1503
-                if (strstr($country_setting, ':')) :
1504
-                    $country = current(explode(':', $country_setting));
1505
-                    $state = end(explode(':', $country_setting));
1506
-                else :
1507
-                    $country = $country_setting;
1508
-                    $state = '*';
1509
-                endif;
1510
-                ?>
1500
+				break;
1501
+			case 'single_select_country' :
1502
+				$country_setting = (string)get_option($value['id']);
1503
+				if (strstr($country_setting, ':')) :
1504
+					$country = current(explode(':', $country_setting));
1505
+					$state = end(explode(':', $country_setting));
1506
+				else :
1507
+					$country = $country_setting;
1508
+					$state = '*';
1509
+				endif;
1510
+				?>
1511 1511
                 <tr valign="top">
1512 1512
                 <th scope="rpw" class="titledesc"><?php echo $value['name'] ?></th>
1513 1513
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
@@ -1518,12 +1518,12 @@  discard block
 block discarded – undo
1518 1518
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1519 1519
                 </td>
1520 1520
                 </tr><?php
1521
-                break;
1522
-            case 'multi_select_countries' :
1523
-                $countries = $geodirectory->countries->countries;
1524
-                asort($countries);
1525
-                $selections = (array)get_option($value['id']);
1526
-                ?>
1521
+				break;
1522
+			case 'multi_select_countries' :
1523
+				$countries = $geodirectory->countries->countries;
1524
+				asort($countries);
1525
+				$selections = (array)get_option($value['id']);
1526
+				?>
1527 1527
                 <tr valign="top">
1528 1528
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1529 1529
                 <td class="forminp">
@@ -1531,21 +1531,21 @@  discard block
 block discarded – undo
1531 1531
                             data-placeholder="<?php _e('Choose countries&hellip;', 'geodirectory'); ?>"
1532 1532
                             title="Country" class="chosen_select">
1533 1533
                         <?php
1534
-                        if ($countries) foreach ($countries as $key => $val) :
1535
-                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1536
-                        endforeach;
1537
-                        ?>
1534
+						if ($countries) foreach ($countries as $key => $val) :
1535
+							echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1536
+						endforeach;
1537
+						?>
1538 1538
                     </select>
1539 1539
                 </td>
1540 1540
                 </tr>
1541 1541
 
1542 1542
                 <?php
1543 1543
 
1544
-                break;
1544
+				break;
1545 1545
 
1546
-            case 'google_analytics' :
1547
-                $selections = (array)get_option($value['id']);
1548
-                    ?>
1546
+			case 'google_analytics' :
1547
+				$selections = (array)get_option($value['id']);
1548
+					?>
1549 1549
                     <tr valign="top">
1550 1550
                         <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1551 1551
                         <td class="forminp">
@@ -1553,62 +1553,62 @@  discard block
 block discarded – undo
1553 1553
 
1554 1554
                             <?php
1555 1555
 
1556
-                            $oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1557
-                            $scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1558
-                            $state = "&state=123";//any string
1559
-                            $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1560
-                            $response_type = "&response_type=code";
1561
-                            $client_id = "&client_id=".get_option('geodir_ga_client_id');
1562
-                            $access_type = "&access_type=offline";
1563
-                            $approval_prompt = "&approval_prompt=force";
1556
+							$oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1557
+							$scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1558
+							$state = "&state=123";//any string
1559
+							$redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1560
+							$response_type = "&response_type=code";
1561
+							$client_id = "&client_id=".get_option('geodir_ga_client_id');
1562
+							$access_type = "&access_type=offline";
1563
+							$approval_prompt = "&approval_prompt=force";
1564 1564
 
1565
-                            $auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
1565
+							$auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
1566 1566
 
1567 1567
 
1568
-                            if (get_option('geodir_ga_auth_token')) {
1569
-                                ?>
1568
+							if (get_option('geodir_ga_auth_token')) {
1569
+								?>
1570 1570
                                 <span class="button-primary"
1571 1571
                                       onclick="gd_GA_Deauthorize('<?php echo wp_create_nonce('gd_ga_deauthorize');?>');"><?php _e('Deauthorize', 'geodirectory'); ?></span>
1572 1572
                                 <span style="color: green; font-weight: bold;"><?php _e('Authorized', 'geodirectory'); ?></span>
1573 1573
                             <?php
1574
-                                global $gd_ga_errors;
1575
-                                if(!empty($gd_ga_errors)){
1576
-                                    print_r($gd_ga_errors);
1577
-                                }
1578
-                            } else {
1579
-                                ?>
1574
+								global $gd_ga_errors;
1575
+								if(!empty($gd_ga_errors)){
1576
+									print_r($gd_ga_errors);
1577
+								}
1578
+							} else {
1579
+								?>
1580 1580
                                 <span class="button-primary"
1581 1581
                                       onclick="window.open('<?php echo  geodir_ga_activation_url();?>', 'activate','width=700, height=600, menubar=0, status=0, location=0, toolbar=0')"><?php _e('Authorize', 'geodirectory');?></span>
1582 1582
                             <?php
1583
-                            }
1584
-                            ?>
1583
+							}
1584
+							?>
1585 1585
                         </td>
1586 1586
                     </tr>
1587 1587
 
1588 1588
                 <?php
1589 1589
 
1590 1590
 
1591
-                break;
1591
+				break;
1592 1592
 
1593
-            case 'field_seperator' :
1593
+			case 'field_seperator' :
1594 1594
 
1595
-                ?>
1595
+				?>
1596 1596
                 <tr valign="top">
1597 1597
                     <td colspan="2" class="forminp geodir_line_seperator"></td>
1598 1598
                 </tr>
1599 1599
                 <?php
1600 1600
 
1601
-                break;
1601
+				break;
1602 1602
 
1603
-        endswitch;
1603
+		endswitch;
1604 1604
 
1605
-    endforeach;
1605
+	endforeach;
1606 1606
 
1607
-    if ($first_title === false) {
1608
-        echo "</div>";
1609
-    }
1607
+	if ($first_title === false) {
1608
+		echo "</div>";
1609
+	}
1610 1610
 
1611
-    ?>
1611
+	?>
1612 1612
 
1613 1613
     <script type="text/javascript">
1614 1614
 
@@ -1668,33 +1668,33 @@  discard block
 block discarded – undo
1668 1668
  */
1669 1669
 function geodir_post_info_setting()
1670 1670
 {
1671
-    global $post, $post_id;
1672
-
1673
-    $post_type = get_post_type();
1674
-
1675
-    $package_info = array();
1676
-
1677
-    $package_info = geodir_post_package_info($package_info, $post, $post_type);
1678
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_info_noncename');
1679
-    echo '<div id="geodir_wrapper">';
1680
-    /**
1681
-     * Called before the GD custom fields are output in the wp-admin area.
1682
-     *
1683
-     * @since 1.0.0
1684
-     * @see 'geodir_after_default_field_in_meta_box'
1685
-     */
1686
-    do_action('geodir_before_default_field_in_meta_box');
1687
-    //geodir_get_custom_fields_html($package_info->pid,'default',$post_type);
1688
-    // to display all fields in one information box
1689
-    geodir_get_custom_fields_html($package_info->pid, 'all', $post_type);
1690
-    /**
1691
-     * Called after the GD custom fields are output in the wp-admin area.
1692
-     *
1693
-     * @since 1.0.0
1694
-     * @see 'geodir_before_default_field_in_meta_box'
1695
-     */
1696
-    do_action('geodir_after_default_field_in_meta_box');
1697
-    echo '</div>';
1671
+	global $post, $post_id;
1672
+
1673
+	$post_type = get_post_type();
1674
+
1675
+	$package_info = array();
1676
+
1677
+	$package_info = geodir_post_package_info($package_info, $post, $post_type);
1678
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_info_noncename');
1679
+	echo '<div id="geodir_wrapper">';
1680
+	/**
1681
+	 * Called before the GD custom fields are output in the wp-admin area.
1682
+	 *
1683
+	 * @since 1.0.0
1684
+	 * @see 'geodir_after_default_field_in_meta_box'
1685
+	 */
1686
+	do_action('geodir_before_default_field_in_meta_box');
1687
+	//geodir_get_custom_fields_html($package_info->pid,'default',$post_type);
1688
+	// to display all fields in one information box
1689
+	geodir_get_custom_fields_html($package_info->pid, 'all', $post_type);
1690
+	/**
1691
+	 * Called after the GD custom fields are output in the wp-admin area.
1692
+	 *
1693
+	 * @since 1.0.0
1694
+	 * @see 'geodir_before_default_field_in_meta_box'
1695
+	 */
1696
+	do_action('geodir_after_default_field_in_meta_box');
1697
+	echo '</div>';
1698 1698
 }
1699 1699
 
1700 1700
 /**
@@ -1707,18 +1707,18 @@  discard block
 block discarded – undo
1707 1707
  */
1708 1708
 function geodir_post_addinfo_setting()
1709 1709
 {
1710
-    global $post, $post_id;
1710
+	global $post, $post_id;
1711 1711
 
1712
-    $post_type = get_post_type();
1712
+	$post_type = get_post_type();
1713 1713
 
1714
-    $package_info = array();
1714
+	$package_info = array();
1715 1715
 
1716
-    $package_info = geodir_post_package_info($package_info, $post, $post_type);
1716
+	$package_info = geodir_post_package_info($package_info, $post, $post_type);
1717 1717
 
1718
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_addinfo_noncename');
1719
-    echo '<div id="geodir_wrapper">';
1720
-    geodir_get_custom_fields_html($package_info->pid, 'custom', $post_type);
1721
-    echo '</div>';
1718
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_addinfo_noncename');
1719
+	echo '<div id="geodir_wrapper">';
1720
+	geodir_get_custom_fields_html($package_info->pid, 'custom', $post_type);
1721
+	echo '</div>';
1722 1722
 
1723 1723
 }
1724 1724
 
@@ -1732,60 +1732,60 @@  discard block
 block discarded – undo
1732 1732
  */
1733 1733
 function geodir_post_attachments()
1734 1734
 {
1735
-    global $post, $post_id;
1735
+	global $post, $post_id;
1736 1736
 
1737
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
1737
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
1738 1738
 
1739
-    if (geodir_get_featured_image($post_id, 'thumbnail')) {
1740
-        echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
1741
-        geodir_show_featured_image($post_id, 'thumbnail');
1742
-    }
1739
+	if (geodir_get_featured_image($post_id, 'thumbnail')) {
1740
+		echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
1741
+		geodir_show_featured_image($post_id, 'thumbnail');
1742
+	}
1743 1743
 
1744
-    $image_limit = 0;
1744
+	$image_limit = 0;
1745 1745
 
1746
-    ?>
1746
+	?>
1747 1747
 
1748 1748
 
1749 1749
     <h5 class="form_title">
1750 1750
         <?php if ($image_limit != 0 && $image_limit == 1) {
1751
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
1752
-        } ?>
1751
+			echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
1752
+		} ?>
1753 1753
         <?php if ($image_limit != 0 && $image_limit > 1) {
1754
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
1755
-        } ?>
1754
+			echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
1755
+		} ?>
1756 1756
         <?php if ($image_limit == 0) {
1757
-            echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
1758
-        } ?>
1757
+			echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
1758
+		} ?>
1759 1759
     </h5>
1760 1760
 
1761 1761
 
1762 1762
     <?php
1763 1763
 
1764
-    $curImages = geodir_get_images($post_id);
1765
-    $place_img_array = array();
1764
+	$curImages = geodir_get_images($post_id);
1765
+	$place_img_array = array();
1766 1766
 
1767
-    if (!empty($curImages)):
1768
-        foreach ($curImages as $p_img):
1769
-            $place_img_array[] = $p_img->src;
1770
-        endforeach;
1771
-    endif;
1767
+	if (!empty($curImages)):
1768
+		foreach ($curImages as $p_img):
1769
+			$place_img_array[] = $p_img->src;
1770
+		endforeach;
1771
+	endif;
1772 1772
 
1773
-    if (!empty($place_img_array))
1774
-        $curImages = implode(',', $place_img_array);
1773
+	if (!empty($place_img_array))
1774
+		$curImages = implode(',', $place_img_array);
1775 1775
 
1776 1776
 
1777
-    // adjust values here
1778
-    $id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
1777
+	// adjust values here
1778
+	$id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
1779 1779
 
1780
-    $svalue = $curImages; // this will be initial value of the above form field. Image urls.
1780
+	$svalue = $curImages; // this will be initial value of the above form field. Image urls.
1781 1781
 
1782
-    $multiple = true; // allow multiple files upload
1782
+	$multiple = true; // allow multiple files upload
1783 1783
 
1784
-    $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1784
+	$width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1785 1785
 
1786
-    $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
1786
+	$height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
1787 1787
 
1788
-    ?>
1788
+	?>
1789 1789
 
1790 1790
     <div class="gtd-form_row clearfix" id="<?php echo $id; ?>dropbox" style="border:1px solid #999999;padding:5px;text-align:center;">
1791 1791
         <input type="hidden" name="<?php echo $id; ?>" id="<?php echo $id; ?>" value="<?php echo $svalue; ?>"/>
@@ -1827,13 +1827,13 @@  discard block
 block discarded – undo
1827 1827
  */
1828 1828
 function geodir_action_post_updated($post_ID, $post_after, $post_before)
1829 1829
 {
1830
-    $post_type = get_post_type($post_ID);
1830
+	$post_type = get_post_type($post_ID);
1831 1831
 
1832
-    if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
1833
-        if ($post_type != '' && in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_ID) && !empty($post_after->post_title) && $post_after->post_title != $post_before->post_title) {
1834
-            geodir_save_post_meta($post_ID, 'post_title', $post_after->post_title);
1835
-        }
1836
-    }
1832
+	if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
1833
+		if ($post_type != '' && in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_ID) && !empty($post_after->post_title) && $post_after->post_title != $post_before->post_title) {
1834
+			geodir_save_post_meta($post_ID, 'post_title', $post_after->post_title);
1835
+		}
1836
+	}
1837 1837
 }
1838 1838
 
1839 1839
 /**
@@ -1848,39 +1848,39 @@  discard block
 block discarded – undo
1848 1848
  */
1849 1849
 function geodir_notification_add_bcc_option($settings)
1850 1850
 {
1851
-    if (!empty($settings)) {
1852
-        $new_settings = array();
1853
-        foreach ($settings as $setting) {
1854
-            if (isset($setting['id']) && $setting['id'] == 'site_bcc_options' && isset($setting['type']) && $setting['type'] == 'sectionend') {
1855
-                $geodir_bcc_listing_published_yes = array(
1856
-                    'name' => __('Listing published', 'geodirectory'),
1857
-                    'desc' => __('Yes', 'geodirectory'),
1858
-                    'id' => 'geodir_bcc_listing_published',
1859
-                    'std' => 'yes',
1860
-                    'type' => 'radio',
1861
-                    'value' => '1',
1862
-                    'radiogroup' => 'start'
1863
-                );
1864
-
1865
-                $geodir_bcc_listing_published_no = array(
1866
-                    'name' => __('Listing published', 'geodirectory'),
1867
-                    'desc' => __('No', 'geodirectory'),
1868
-                    'id' => 'geodir_bcc_listing_published',
1869
-                    'std' => 'yes',
1870
-                    'type' => 'radio',
1871
-                    'value' => '0',
1872
-                    'radiogroup' => 'end'
1873
-                );
1874
-
1875
-                $new_settings[] = $geodir_bcc_listing_published_yes;
1876
-                $new_settings[] = $geodir_bcc_listing_published_no;
1877
-            }
1878
-            $new_settings[] = $setting;
1879
-        }
1880
-        $settings = $new_settings;
1881
-    }
1851
+	if (!empty($settings)) {
1852
+		$new_settings = array();
1853
+		foreach ($settings as $setting) {
1854
+			if (isset($setting['id']) && $setting['id'] == 'site_bcc_options' && isset($setting['type']) && $setting['type'] == 'sectionend') {
1855
+				$geodir_bcc_listing_published_yes = array(
1856
+					'name' => __('Listing published', 'geodirectory'),
1857
+					'desc' => __('Yes', 'geodirectory'),
1858
+					'id' => 'geodir_bcc_listing_published',
1859
+					'std' => 'yes',
1860
+					'type' => 'radio',
1861
+					'value' => '1',
1862
+					'radiogroup' => 'start'
1863
+				);
1864
+
1865
+				$geodir_bcc_listing_published_no = array(
1866
+					'name' => __('Listing published', 'geodirectory'),
1867
+					'desc' => __('No', 'geodirectory'),
1868
+					'id' => 'geodir_bcc_listing_published',
1869
+					'std' => 'yes',
1870
+					'type' => 'radio',
1871
+					'value' => '0',
1872
+					'radiogroup' => 'end'
1873
+				);
1874
+
1875
+				$new_settings[] = $geodir_bcc_listing_published_yes;
1876
+				$new_settings[] = $geodir_bcc_listing_published_no;
1877
+			}
1878
+			$new_settings[] = $setting;
1879
+		}
1880
+		$settings = $new_settings;
1881
+	}
1882 1882
 
1883
-    return $settings;
1883
+	return $settings;
1884 1884
 }
1885 1885
 
1886 1886
 
@@ -1895,19 +1895,19 @@  discard block
 block discarded – undo
1895 1895
  */
1896 1896
 function get_gd_theme_compat_callback()
1897 1897
 {
1898
-    global $wpdb;
1899
-    $themes = get_option('gd_theme_compats');
1900
-
1901
-    if (isset($_POST['theme']) && isset($themes[$_POST['theme']]) && !empty($themes[$_POST['theme']])) {
1902
-        if (isset($_POST['export'])) {
1903
-            echo json_encode(array($_POST['theme'] => $themes[$_POST['theme']]));
1904
-        } else {
1905
-            echo json_encode($themes[$_POST['theme']]);
1906
-        }
1898
+	global $wpdb;
1899
+	$themes = get_option('gd_theme_compats');
1907 1900
 
1908
-    }
1901
+	if (isset($_POST['theme']) && isset($themes[$_POST['theme']]) && !empty($themes[$_POST['theme']])) {
1902
+		if (isset($_POST['export'])) {
1903
+			echo json_encode(array($_POST['theme'] => $themes[$_POST['theme']]));
1904
+		} else {
1905
+			echo json_encode($themes[$_POST['theme']]);
1906
+		}
1907
+
1908
+	}
1909 1909
 
1910
-    die();
1910
+	die();
1911 1911
 }
1912 1912
 
1913 1913
 add_action('wp_ajax_get_gd_theme_compat_import_callback', 'get_gd_theme_compat_import_callback');
@@ -1921,20 +1921,20 @@  discard block
 block discarded – undo
1921 1921
  */
1922 1922
 function get_gd_theme_compat_import_callback()
1923 1923
 {
1924
-    global $wpdb;
1925
-    $themes = get_option('gd_theme_compats');
1926
-    if (isset($_POST['theme']) && !empty($_POST['theme'])) {
1927
-        $json = json_decode(stripslashes($_POST['theme']), true);
1928
-        if (!empty($json) && is_array($json)) {
1929
-            $key = sanitize_text_field(key($json));
1930
-            $themes[$key] = $json[$key];
1931
-            update_option('gd_theme_compats', $themes);
1932
-            echo $key;
1933
-            die();
1934
-        }
1935
-    }
1936
-    echo '0';
1937
-    die();
1924
+	global $wpdb;
1925
+	$themes = get_option('gd_theme_compats');
1926
+	if (isset($_POST['theme']) && !empty($_POST['theme'])) {
1927
+		$json = json_decode(stripslashes($_POST['theme']), true);
1928
+		if (!empty($json) && is_array($json)) {
1929
+			$key = sanitize_text_field(key($json));
1930
+			$themes[$key] = $json[$key];
1931
+			update_option('gd_theme_compats', $themes);
1932
+			echo $key;
1933
+			die();
1934
+		}
1935
+	}
1936
+	echo '0';
1937
+	die();
1938 1938
 }
1939 1939
 
1940 1940
 
@@ -1947,39 +1947,39 @@  discard block
 block discarded – undo
1947 1947
  */
1948 1948
 function gd_set_theme_compat()
1949 1949
 {
1950
-    global $wpdb;
1951
-    $theme = wp_get_theme();
1950
+	global $wpdb;
1951
+	$theme = wp_get_theme();
1952 1952
 
1953
-    if ($theme->parent()) {
1954
-        $theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
1955
-    } else {
1956
-        $theme_name = str_replace(" ", "_", $theme->get('Name'));
1957
-    }
1953
+	if ($theme->parent()) {
1954
+		$theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
1955
+	} else {
1956
+		$theme_name = str_replace(" ", "_", $theme->get('Name'));
1957
+	}
1958 1958
 
1959
-    $theme_compats = get_option('gd_theme_compats');
1960
-    $current_compat = get_option('gd_theme_compat');
1961
-    $current_compat = str_replace("_custom", "", $current_compat);
1959
+	$theme_compats = get_option('gd_theme_compats');
1960
+	$current_compat = get_option('gd_theme_compat');
1961
+	$current_compat = str_replace("_custom", "", $current_compat);
1962 1962
  
1963
-    if ($current_compat == $theme_name && strpos(get_option('gd_theme_compat'), "_custom") !== false) {
1964
-        return;
1965
-    }// if already running correct compat then bail
1963
+	if ($current_compat == $theme_name && strpos(get_option('gd_theme_compat'), "_custom") !== false) {
1964
+		return;
1965
+	}// if already running correct compat then bail
1966 1966
 
1967
-    if (isset($theme_compats[$theme_name])) {// if there is a compat avail then set it
1968
-        update_option('gd_theme_compat', $theme_name);
1969
-        update_option('theme_compatibility_setting', $theme_compats[$theme_name]);
1967
+	if (isset($theme_compats[$theme_name])) {// if there is a compat avail then set it
1968
+		update_option('gd_theme_compat', $theme_name);
1969
+		update_option('theme_compatibility_setting', $theme_compats[$theme_name]);
1970 1970
 
1971
-        // if there are default options to set then set them
1972
-        if (isset($theme_compats[$theme_name]['geodir_theme_compat_default_options']) && !empty($theme_compats[$theme_name]['geodir_theme_compat_default_options'])) {
1971
+		// if there are default options to set then set them
1972
+		if (isset($theme_compats[$theme_name]['geodir_theme_compat_default_options']) && !empty($theme_compats[$theme_name]['geodir_theme_compat_default_options'])) {
1973 1973
 
1974
-            foreach ($theme_compats[$theme_name]['geodir_theme_compat_default_options'] as $key => $val) {
1975
-                update_option($key, $val);
1976
-            }
1977
-        }
1974
+			foreach ($theme_compats[$theme_name]['geodir_theme_compat_default_options'] as $key => $val) {
1975
+				update_option($key, $val);
1976
+			}
1977
+		}
1978 1978
 
1979
-    } else {
1980
-        update_option('gd_theme_compat', '');
1981
-        update_option('theme_compatibility_setting', '');
1982
-    }
1979
+	} else {
1980
+		update_option('gd_theme_compat', '');
1981
+		update_option('theme_compatibility_setting', '');
1982
+	}
1983 1983
 
1984 1984
 
1985 1985
 }
@@ -1994,9 +1994,9 @@  discard block
 block discarded – undo
1994 1994
  */
1995 1995
 function gd_check_avada_compat()
1996 1996
 {
1997
-    if (function_exists('avada_load_textdomain') && !get_option('avada_nag')) {
1998
-        add_action('admin_notices', 'gd_avada_compat_warning');
1999
-    }
1997
+	if (function_exists('avada_load_textdomain') && !get_option('avada_nag')) {
1998
+		add_action('admin_notices', 'gd_avada_compat_warning');
1999
+	}
2000 2000
 }
2001 2001
 
2002 2002
 
@@ -2009,22 +2009,22 @@  discard block
 block discarded – undo
2009 2009
 function gd_avada_compat_warning()
2010 2010
 {
2011 2011
 
2012
-    /*
2012
+	/*
2013 2013
     $msg_type = error
2014 2014
     $msg_type = updated fade
2015 2015
     $msg_type = update-nag
2016 2016
     */
2017 2017
 
2018
-    $plugin = 'avada-nag';
2019
-    $timestamp = 'avada-nag1234';
2020
-    $message = __('Welcome to GeoDirectory, please have a look <a href="https://docs.wpgeodirectory.com/category/getting-started/" target="_blank">here</a> to get started. :)', 'geodirectory');
2021
-    echo '<div id="' . $timestamp . '"  class="error">';
2022
-    echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>';
2023
-    echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
2024
-    echo "<p>$message</p>";
2025
-    echo "</div>";
2018
+	$plugin = 'avada-nag';
2019
+	$timestamp = 'avada-nag1234';
2020
+	$message = __('Welcome to GeoDirectory, please have a look <a href="https://docs.wpgeodirectory.com/category/getting-started/" target="_blank">here</a> to get started. :)', 'geodirectory');
2021
+	echo '<div id="' . $timestamp . '"  class="error">';
2022
+	echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>';
2023
+	echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
2024
+	echo "<p>$message</p>";
2025
+	echo "</div>";
2026 2026
 
2027
-    ?>
2027
+	?>
2028 2028
     <script>
2029 2029
         function gdRemoveANotification($plugin, $timestamp) {
2030 2030
 
@@ -2092,10 +2092,10 @@  discard block
 block discarded – undo
2092 2092
  */
2093 2093
 function geodir_avada_remove_notification()
2094 2094
 {
2095
-    update_option('avada_nag', TRUE);
2095
+	update_option('avada_nag', TRUE);
2096 2096
 
2097
-    // Always die in functions echoing ajax content
2098
-    die();
2097
+	// Always die in functions echoing ajax content
2098
+	die();
2099 2099
 }
2100 2100
 
2101 2101
 
@@ -2117,11 +2117,11 @@  discard block
 block discarded – undo
2117 2117
 	global $post, $typenow, $current_screen;
2118 2118
 	
2119 2119
 	$post_type = NULL;
2120
-    if (isset($_REQUEST['post_type']))
2120
+	if (isset($_REQUEST['post_type']))
2121 2121
 		$post_type = sanitize_key($_REQUEST['post_type']);
2122
-    elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post']))
2122
+	elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post']))
2123 2123
 		$post_type = get_post_type($_REQUEST['post']);
2124
-    elseif ($post && isset($post->post_type))
2124
+	elseif ($post && isset($post->post_type))
2125 2125
 		$post_type = $post->post_type;
2126 2126
 	elseif ($typenow)
2127 2127
 		$post_type = $typenow;
@@ -2155,7 +2155,7 @@  discard block
 block discarded – undo
2155 2155
 		// Don't allow same slug url for listing and location
2156 2156
 		if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
2157 2157
 			$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
2158
-        	wp_redirect($redirect_url);
2158
+			wp_redirect($redirect_url);
2159 2159
 			exit;
2160 2160
 		}
2161 2161
 		
@@ -2185,10 +2185,10 @@  discard block
 block discarded – undo
2185 2185
  * @package GeoDirectory
2186 2186
  */
2187 2187
 function geodir_hide_admin_preview_button() {
2188
-    global $post_type;
2189
-    $post_types = geodir_get_posttypes();
2190
-    if(in_array($post_type, $post_types))
2191
-        echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2188
+	global $post_type;
2189
+	$post_types = geodir_get_posttypes();
2190
+	if(in_array($post_type, $post_types))
2191
+		echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2192 2192
 }
2193 2193
 add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
2194 2194
 add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
@@ -2203,7 +2203,7 @@  discard block
 block discarded – undo
2203 2203
  */
2204 2204
 function geodir_import_export_tab( $tabs ) {
2205 2205
 	$tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
2206
-    return $tabs;
2206
+	return $tabs;
2207 2207
 }
2208 2208
 
2209 2209
 /**
@@ -2218,26 +2218,26 @@  discard block
 block discarded – undo
2218 2218
 function geodir_import_export_page() {
2219 2219
 	$nonce = wp_create_nonce( 'geodir_import_export_nonce' );
2220 2220
 	$gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
2221
-    /**
2222
-     * Filter sample category data csv file url.
2223
-     *
2224
-     * @since 1.0.0
2225
-     * @package GeoDirectory
2226
-     *
2227
-     * @param string $gd_cats_sample_csv Sample category data csv file url.
2228
-     */
2221
+	/**
2222
+	 * Filter sample category data csv file url.
2223
+	 *
2224
+	 * @since 1.0.0
2225
+	 * @package GeoDirectory
2226
+	 *
2227
+	 * @param string $gd_cats_sample_csv Sample category data csv file url.
2228
+	 */
2229 2229
 	$gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
2230 2230
 	
2231 2231
 	$gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
2232
-    /**
2233
-     * Filter sample post data csv file url.
2234
-     *
2235
-     * @since 1.0.0
2236
-     * @package GeoDirectory
2237
-     *
2238
-     * @param string $gd_posts_sample_csv Sample post data csv file url.
2239
-     */
2240
-    $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2232
+	/**
2233
+	 * Filter sample post data csv file url.
2234
+	 *
2235
+	 * @since 1.0.0
2236
+	 * @package GeoDirectory
2237
+	 *
2238
+	 * @param string $gd_posts_sample_csv Sample post data csv file url.
2239
+	 */
2240
+	$gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2241 2241
 	
2242 2242
 	$gd_posttypes = geodir_get_posttypes( 'array' );
2243 2243
 	
@@ -2260,14 +2260,14 @@  discard block
 block discarded – undo
2260 2260
 	$gd_chunksize_options[100000] = 100000;
2261 2261
 	 
2262 2262
 	 /**
2263
-     * Filter max entries per export csv file.
2264
-     *
2265
-     * @since 1.5.6
2266
-     * @package GeoDirectory
2267
-     *
2268
-     * @param string $gd_chunksize_options Entries options.
2269
-     */
2270
-    $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2263
+	  * Filter max entries per export csv file.
2264
+	  *
2265
+	  * @since 1.5.6
2266
+	  * @package GeoDirectory
2267
+	  *
2268
+	  * @param string $gd_chunksize_options Entries options.
2269
+	  */
2270
+	$gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2271 2271
 	
2272 2272
 	$gd_chunksize_option = '';
2273 2273
 	foreach ($gd_chunksize_options as $value => $title) {
@@ -2284,12 +2284,12 @@  discard block
 block discarded – undo
2284 2284
   <div class="gd-content-heading">
2285 2285
 
2286 2286
   <?php
2287
-    ini_set('max_execution_time', 999999);
2288
-    $ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2289
-    ini_restore('max_execution_time');
2287
+	ini_set('max_execution_time', 999999);
2288
+	$ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2289
+	ini_restore('max_execution_time');
2290 2290
 
2291
-    if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2292
-        ?>
2291
+	if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2292
+		?>
2293 2293
 	<div id="gd_ie_reqs" class="metabox-holder">
2294 2294
       <div class="meta-box-sortables ui-sortable">
2295 2295
         <div class="postbox">
@@ -2464,7 +2464,7 @@  discard block
 block discarded – undo
2464 2464
 						 * Called just after the sample CSV download link.
2465 2465
 						 *
2466 2466
 						 * @since 1.0.0
2467
-                         * @package GeoDirectory
2467
+						 * @package GeoDirectory
2468 2468
 						 */
2469 2469
 						do_action('geodir_sample_cats_csv_download_link');
2470 2470
 						?>
@@ -2549,11 +2549,11 @@  discard block
 block discarded – undo
2549 2549
 	 *
2550 2550
 	 * Called after the last setting on the GD > Import & Export page.
2551 2551
 	 * @since 1.4.6
2552
-     * @package GeoDirectory
2552
+	 * @package GeoDirectory
2553 2553
 	 *
2554 2554
 	 * @param array $gd_posttypes GD post types.
2555
-     * @param array $gd_chunksize_options File chunk size options.
2556
-     * @param string $nonce Wordpress security token for GD import & export.
2555
+	 * @param array $gd_chunksize_options File chunk size options.
2556
+	 * @param string $nonce Wordpress security token for GD import & export.
2557 2557
 	 */
2558 2558
 	do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
2559 2559
 	?>
@@ -3240,44 +3240,44 @@  discard block
 block discarded – undo
3240 3240
 function geodir_init_filesystem()
3241 3241
 {
3242 3242
 
3243
-    if(!function_exists('get_filesystem_method')){
3244
-        require_once(ABSPATH."/wp-admin/includes/file.php");
3245
-    }
3246
-    $access_type = get_filesystem_method();
3247
-    if ($access_type === 'direct') {
3248
-        /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3249
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3250
-
3251
-        /* initialize the API */
3252
-        if (!WP_Filesystem($creds)) {
3253
-            /* any problems and we exit */
3254
-            //return '@@@3';
3255
-            return false;
3256
-        }
3243
+	if(!function_exists('get_filesystem_method')){
3244
+		require_once(ABSPATH."/wp-admin/includes/file.php");
3245
+	}
3246
+	$access_type = get_filesystem_method();
3247
+	if ($access_type === 'direct') {
3248
+		/* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3249
+		$creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3250
+
3251
+		/* initialize the API */
3252
+		if (!WP_Filesystem($creds)) {
3253
+			/* any problems and we exit */
3254
+			//return '@@@3';
3255
+			return false;
3256
+		}
3257 3257
 
3258
-        global $wp_filesystem;
3259
-        return $wp_filesystem;
3260
-        /* do our file manipulations below */
3261
-    } elseif (defined('FTP_USER')) {
3262
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3258
+		global $wp_filesystem;
3259
+		return $wp_filesystem;
3260
+		/* do our file manipulations below */
3261
+	} elseif (defined('FTP_USER')) {
3262
+		$creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3263
+
3264
+		/* initialize the API */
3265
+		if (!WP_Filesystem($creds)) {
3266
+			/* any problems and we exit */
3267
+			//return '@@@33';
3268
+			return false;
3269
+		}
3263 3270
 
3264
-        /* initialize the API */
3265
-        if (!WP_Filesystem($creds)) {
3266
-            /* any problems and we exit */
3267
-            //return '@@@33';
3268
-            return false;
3269
-        }
3271
+		global $wp_filesystem;
3272
+		//return '@@@1';
3273
+		return $wp_filesystem;
3270 3274
 
3271
-        global $wp_filesystem;
3272
-        //return '@@@1';
3273
-        return $wp_filesystem;
3274
-
3275
-    } else {
3276
-        //return '@@@2';
3277
-        /* don't have direct write access. Prompt user with our notice */
3278
-        add_action('admin_notice', 'geodir_filesystem_notice');
3279
-        return false;
3280
-    }
3275
+	} else {
3276
+		//return '@@@2';
3277
+		/* don't have direct write access. Prompt user with our notice */
3278
+		add_action('admin_notice', 'geodir_filesystem_notice');
3279
+		return false;
3280
+	}
3281 3281
 
3282 3282
 }
3283 3283
 
@@ -3295,10 +3295,10 @@  discard block
 block discarded – undo
3295 3295
  */
3296 3296
 function geodir_filesystem_notice()
3297 3297
 {   if ( defined( 'DOING_AJAX' ) ){return;}
3298
-    $access_type = get_filesystem_method();
3299
-    if ($access_type === 'direct') {
3300
-    } elseif (!defined('FTP_USER')) {
3301
-        ?>
3298
+	$access_type = get_filesystem_method();
3299
+	if ($access_type === 'direct') {
3300
+	} elseif (!defined('FTP_USER')) {
3301
+		?>
3302 3302
         <div class="error">
3303 3303
             <p><?php _e('GeoDirectory does not have access to your filesystem, thing like import/export will not work. Please define your details in wp-config.php as explained here', 'geodirectory'); ?>
3304 3304
                 <a target="_blank" href="http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants">http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants</a>
@@ -3326,1273 +3326,1273 @@  discard block
 block discarded – undo
3326 3326
  * @return string Json data.
3327 3327
  */
3328 3328
 function geodir_ajax_import_export() {
3329
-    global $wpdb, $plugin_prefix, $current_user, $wp_filesystem;
3329
+	global $wpdb, $plugin_prefix, $current_user, $wp_filesystem;
3330 3330
     
3331
-    error_reporting(0);
3331
+	error_reporting(0);
3332 3332
 
3333
-    $xstart = microtime(true);
3333
+	$xstart = microtime(true);
3334 3334
 
3335
-    // try to set higher limits for import
3336
-    $max_input_time = ini_get('max_input_time');
3337
-    $max_execution_time = ini_get('max_execution_time');
3338
-    $memory_limit= ini_get('memory_limit');
3335
+	// try to set higher limits for import
3336
+	$max_input_time = ini_get('max_input_time');
3337
+	$max_execution_time = ini_get('max_execution_time');
3338
+	$memory_limit= ini_get('memory_limit');
3339 3339
 
3340
-    if(!$max_input_time || $max_input_time<3000){
3341
-        ini_set('max_input_time', 3000);
3342
-    }
3340
+	if(!$max_input_time || $max_input_time<3000){
3341
+		ini_set('max_input_time', 3000);
3342
+	}
3343 3343
 
3344
-    if(!$max_execution_time || $max_execution_time<3000){
3345
-        ini_set('max_execution_time', 3000);
3346
-    }
3344
+	if(!$max_execution_time || $max_execution_time<3000){
3345
+		ini_set('max_execution_time', 3000);
3346
+	}
3347 3347
 
3348
-    if($memory_limit && str_replace('M','',$memory_limit)){
3349
-        if(str_replace('M','',$memory_limit)<256){
3350
-            ini_set('memory_limit', '256M');
3351
-        }
3352
-    }
3348
+	if($memory_limit && str_replace('M','',$memory_limit)){
3349
+		if(str_replace('M','',$memory_limit)<256){
3350
+			ini_set('memory_limit', '256M');
3351
+		}
3352
+	}
3353 3353
 
3354
-    $json = array();
3354
+	$json = array();
3355 3355
 
3356
-    if ( !current_user_can( 'manage_options' ) ) {
3357
-        wp_send_json( $json );
3358
-    }
3356
+	if ( !current_user_can( 'manage_options' ) ) {
3357
+		wp_send_json( $json );
3358
+	}
3359 3359
 
3360
-    $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3361
-    $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3362
-    $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3360
+	$task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3361
+	$nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3362
+	$stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3363 3363
 
3364
-    if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3365
-        wp_send_json( $json );
3366
-    }
3364
+	if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3365
+		wp_send_json( $json );
3366
+	}
3367 3367
 
3368
-    $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3369
-    $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3370
-    $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3371
-    $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3368
+	$post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3369
+	$chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3370
+	$chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3371
+	$chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3372 3372
 
3373
-    $wp_filesystem = geodir_init_filesystem();
3374
-    if (!$wp_filesystem) {
3375
-        $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3376
-        wp_send_json( $json );
3377
-    }
3373
+	$wp_filesystem = geodir_init_filesystem();
3374
+	if (!$wp_filesystem) {
3375
+		$json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3376
+		wp_send_json( $json );
3377
+	}
3378 3378
 
3379
-    if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3380
-        $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3381
-        wp_send_json( $json );
3382
-    }
3379
+	if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3380
+		$json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3381
+		wp_send_json( $json );
3382
+	}
3383 3383
 
3384
-    $csv_file_dir = geodir_path_import_export( false );
3385
-    if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3386
-        if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3387
-            $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3388
-            wp_send_json( $json );
3389
-        }
3390
-    }
3384
+	$csv_file_dir = geodir_path_import_export( false );
3385
+	if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3386
+		if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3387
+			$json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3388
+			wp_send_json( $json );
3389
+		}
3390
+	}
3391 3391
     
3392
-    $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3393
-    $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3394
-
3395
-    switch ( $task ) {
3396
-        case 'export_posts': {
3397
-            // WPML
3398
-            $is_wpml = geodir_is_wpml();
3399
-            if ($is_wpml) {
3400
-                global $sitepress;
3401
-                $active_lang = ICL_LANGUAGE_CODE;
3392
+	$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3393
+	$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3394
+
3395
+	switch ( $task ) {
3396
+		case 'export_posts': {
3397
+			// WPML
3398
+			$is_wpml = geodir_is_wpml();
3399
+			if ($is_wpml) {
3400
+				global $sitepress;
3401
+				$active_lang = ICL_LANGUAGE_CODE;
3402 3402
                 
3403
-                $sitepress->switch_lang('all', true);
3404
-            }
3405
-            // WPML
3406
-            if ( $post_type == 'gd_event' ) {
3407
-                add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3408
-            }
3409
-            $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
3403
+				$sitepress->switch_lang('all', true);
3404
+			}
3405
+			// WPML
3406
+			if ( $post_type == 'gd_event' ) {
3407
+				add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3408
+			}
3409
+			$filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
3410 3410
             
3411
-            $file_name = $post_type . '_' . date( 'dmyHi' );
3412
-            if ( $filters && isset( $filters['start_date'] ) && isset( $filters['end_date'] ) ) {
3413
-                $file_name = $post_type . '_' . date_i18n( 'dmy', strtotime( $filters['start_date'] ) ) . '_' . date_i18n( 'dmy', strtotime( $filters['end_date'] ) );
3414
-            }
3415
-            $posts_count = geodir_get_posts_count( $post_type );
3416
-            $file_url_base = geodir_path_import_export() . '/';
3417
-            $file_url = $file_url_base . $file_name . '.csv';
3418
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3419
-            $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3411
+			$file_name = $post_type . '_' . date( 'dmyHi' );
3412
+			if ( $filters && isset( $filters['start_date'] ) && isset( $filters['end_date'] ) ) {
3413
+				$file_name = $post_type . '_' . date_i18n( 'dmy', strtotime( $filters['start_date'] ) ) . '_' . date_i18n( 'dmy', strtotime( $filters['end_date'] ) );
3414
+			}
3415
+			$posts_count = geodir_get_posts_count( $post_type );
3416
+			$file_url_base = geodir_path_import_export() . '/';
3417
+			$file_url = $file_url_base . $file_name . '.csv';
3418
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3419
+			$file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3420 3420
             
3421
-            $chunk_file_paths = array();
3421
+			$chunk_file_paths = array();
3422 3422
 
3423
-            if ( isset( $_REQUEST['_c'] ) ) {
3424
-                $json['total'] = $posts_count;
3425
-                // WPML
3426
-                if ($is_wpml) {
3427
-                    $sitepress->switch_lang($active_lang, true);
3428
-                }
3429
-                // WPML
3430
-                wp_send_json( $json );
3431
-                gd_die();
3432
-            } else if ( isset( $_REQUEST['_st'] ) ) {
3433
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3434
-                $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3435
-                $percentage = min( $percentage, 100 );
3423
+			if ( isset( $_REQUEST['_c'] ) ) {
3424
+				$json['total'] = $posts_count;
3425
+				// WPML
3426
+				if ($is_wpml) {
3427
+					$sitepress->switch_lang($active_lang, true);
3428
+				}
3429
+				// WPML
3430
+				wp_send_json( $json );
3431
+				gd_die();
3432
+			} else if ( isset( $_REQUEST['_st'] ) ) {
3433
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3434
+				$percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3435
+				$percentage = min( $percentage, 100 );
3436 3436
                 
3437
-                $json['percentage'] = $percentage;
3438
-                // WPML
3439
-                if ($is_wpml) {
3440
-                    $sitepress->switch_lang($active_lang, true);
3441
-                }
3442
-                // WPML
3443
-                wp_send_json( $json );
3444
-                gd_die();
3445
-            } else {
3446
-                if ( !$posts_count > 0 ) {
3447
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3448
-                } else {
3449
-                    $total_posts = $posts_count;
3450
-                    if ($chunk_per_page > $total_posts) {
3451
-                        $chunk_per_page = $total_posts;
3452
-                    }
3453
-                    $chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3437
+				$json['percentage'] = $percentage;
3438
+				// WPML
3439
+				if ($is_wpml) {
3440
+					$sitepress->switch_lang($active_lang, true);
3441
+				}
3442
+				// WPML
3443
+				wp_send_json( $json );
3444
+				gd_die();
3445
+			} else {
3446
+				if ( !$posts_count > 0 ) {
3447
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3448
+				} else {
3449
+					$total_posts = $posts_count;
3450
+					if ($chunk_per_page > $total_posts) {
3451
+						$chunk_per_page = $total_posts;
3452
+					}
3453
+					$chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3454 3454
                     
3455
-                    $j = $chunk_page_no;
3456
-                    $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3455
+					$j = $chunk_page_no;
3456
+					$chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3457 3457
                     
3458
-                    $per_page = 500;
3459
-                    if ($per_page > $chunk_per_page) {
3460
-                        $per_page = $chunk_per_page;
3461
-                    }
3462
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3458
+					$per_page = 500;
3459
+					if ($per_page > $chunk_per_page) {
3460
+						$per_page = $chunk_per_page;
3461
+					}
3462
+					$total_pages = ceil( $chunk_per_page / $per_page );
3463 3463
                     
3464
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3465
-                        $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3464
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3465
+						$save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3466 3466
                         
3467
-                        $clear = $i == 0 ? true : false;
3468
-                        geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3469
-                    }
3467
+						$clear = $i == 0 ? true : false;
3468
+						geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3469
+					}
3470 3470
                         
3471
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3472
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3473
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3474
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3475
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3471
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3472
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3473
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3474
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3475
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3476 3476
                         
3477
-                        $file_url = $file_url_base . $chunk_file_name;
3478
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3479
-                    }
3477
+						$file_url = $file_url_base . $chunk_file_name;
3478
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3479
+					}
3480 3480
                     
3481
-                    if ( !empty($chunk_file_paths) ) {
3482
-                        $json['total'] = $posts_count;
3483
-                        $json['files'] = $chunk_file_paths;
3484
-                    } else {
3485
-                        if ($j > 1) {
3486
-                            $json['total'] = $posts_count;
3487
-                            $json['files'] = array();
3488
-                        } else {
3489
-                            $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3490
-                        }
3491
-                    }
3492
-                }
3493
-                // WPML
3494
-                if ($is_wpml) {
3495
-                    $sitepress->switch_lang($active_lang, true);
3496
-                }
3497
-                // WPML
3498
-                wp_send_json( $json );
3499
-            }
3500
-        }
3501
-        break;
3502
-        case 'export_cats': {
3503
-            // WPML
3504
-            $is_wpml = geodir_is_wpml();
3505
-            if ($is_wpml) {
3506
-                global $sitepress;
3507
-                $active_lang = ICL_LANGUAGE_CODE;
3481
+					if ( !empty($chunk_file_paths) ) {
3482
+						$json['total'] = $posts_count;
3483
+						$json['files'] = $chunk_file_paths;
3484
+					} else {
3485
+						if ($j > 1) {
3486
+							$json['total'] = $posts_count;
3487
+							$json['files'] = array();
3488
+						} else {
3489
+							$json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3490
+						}
3491
+					}
3492
+				}
3493
+				// WPML
3494
+				if ($is_wpml) {
3495
+					$sitepress->switch_lang($active_lang, true);
3496
+				}
3497
+				// WPML
3498
+				wp_send_json( $json );
3499
+			}
3500
+		}
3501
+		break;
3502
+		case 'export_cats': {
3503
+			// WPML
3504
+			$is_wpml = geodir_is_wpml();
3505
+			if ($is_wpml) {
3506
+				global $sitepress;
3507
+				$active_lang = ICL_LANGUAGE_CODE;
3508 3508
                 
3509
-                $sitepress->switch_lang('all', true);
3510
-            }
3511
-            // WPML
3512
-            $file_name = $post_type . 'category_' . date( 'dmyHi' );
3509
+				$sitepress->switch_lang('all', true);
3510
+			}
3511
+			// WPML
3512
+			$file_name = $post_type . 'category_' . date( 'dmyHi' );
3513 3513
             
3514
-            $terms_count = geodir_get_terms_count( $post_type );
3515
-            $file_url_base = geodir_path_import_export() . '/';
3516
-            $file_url = $file_url_base . $file_name . '.csv';
3517
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3518
-            $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3514
+			$terms_count = geodir_get_terms_count( $post_type );
3515
+			$file_url_base = geodir_path_import_export() . '/';
3516
+			$file_url = $file_url_base . $file_name . '.csv';
3517
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3518
+			$file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3519 3519
             
3520
-            $chunk_file_paths = array();
3520
+			$chunk_file_paths = array();
3521 3521
             
3522
-            if ( isset( $_REQUEST['_st'] ) ) {
3523
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3524
-                $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3525
-                $percentage = min( $percentage, 100 );
3522
+			if ( isset( $_REQUEST['_st'] ) ) {
3523
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3524
+				$percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3525
+				$percentage = min( $percentage, 100 );
3526 3526
                 
3527
-                $json['percentage'] = $percentage;
3528
-                // WPML
3529
-                if ($is_wpml) {
3530
-                    $sitepress->switch_lang($active_lang, true);
3531
-                }
3532
-                // WPML
3533
-                wp_send_json( $json );
3534
-            } else {
3535
-                if ( !$terms_count > 0 ) {
3536
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3537
-                } else {
3538
-                    $total_terms = $terms_count;
3539
-                    if ($chunk_per_page > $terms_count) {
3540
-                        $chunk_per_page = $terms_count;
3541
-                    }
3542
-                    $chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3527
+				$json['percentage'] = $percentage;
3528
+				// WPML
3529
+				if ($is_wpml) {
3530
+					$sitepress->switch_lang($active_lang, true);
3531
+				}
3532
+				// WPML
3533
+				wp_send_json( $json );
3534
+			} else {
3535
+				if ( !$terms_count > 0 ) {
3536
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3537
+				} else {
3538
+					$total_terms = $terms_count;
3539
+					if ($chunk_per_page > $terms_count) {
3540
+						$chunk_per_page = $terms_count;
3541
+					}
3542
+					$chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3543 3543
                     
3544
-                    $j = $chunk_page_no;
3545
-                    $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3544
+					$j = $chunk_page_no;
3545
+					$chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3546 3546
                     
3547
-                    $per_page = 500;
3548
-                    if ($per_page > $chunk_per_page) {
3549
-                        $per_page = $chunk_per_page;
3550
-                    }
3551
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3547
+					$per_page = 500;
3548
+					if ($per_page > $chunk_per_page) {
3549
+						$per_page = $chunk_per_page;
3550
+					}
3551
+					$total_pages = ceil( $chunk_per_page / $per_page );
3552 3552
                     
3553
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3554
-                        $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3553
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3554
+						$save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3555 3555
                         
3556
-                        $clear = $i == 0 ? true : false;
3557
-                        geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3558
-                    }
3556
+						$clear = $i == 0 ? true : false;
3557
+						geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3558
+					}
3559 3559
                     
3560
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3561
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3562
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3563
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3564
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3560
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3561
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3562
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3563
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3564
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3565 3565
                         
3566
-                        $file_url = $file_url_base . $chunk_file_name;
3567
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3568
-                    }
3566
+						$file_url = $file_url_base . $chunk_file_name;
3567
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3568
+					}
3569 3569
                     
3570
-                    if ( !empty($chunk_file_paths) ) {
3571
-                        $json['total'] = $terms_count;
3572
-                        $json['files'] = $chunk_file_paths;
3573
-                    } else {
3574
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3575
-                    }
3576
-                }
3577
-                // WPML
3578
-                if ($is_wpml) {
3579
-                    $sitepress->switch_lang($active_lang, true);
3580
-                }
3581
-                // WPML
3582
-                wp_send_json( $json );
3583
-            }
3584
-        }
3585
-        break;
3586
-        case 'export_locations': {
3587
-            $file_url_base = geodir_path_import_export() . '/';
3588
-            $file_name = 'gd_locations_' . date( 'dmyHi' );
3589
-            $file_url = $file_url_base . $file_name . '.csv';
3590
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3591
-            $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3570
+					if ( !empty($chunk_file_paths) ) {
3571
+						$json['total'] = $terms_count;
3572
+						$json['files'] = $chunk_file_paths;
3573
+					} else {
3574
+						$json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3575
+					}
3576
+				}
3577
+				// WPML
3578
+				if ($is_wpml) {
3579
+					$sitepress->switch_lang($active_lang, true);
3580
+				}
3581
+				// WPML
3582
+				wp_send_json( $json );
3583
+			}
3584
+		}
3585
+		break;
3586
+		case 'export_locations': {
3587
+			$file_url_base = geodir_path_import_export() . '/';
3588
+			$file_name = 'gd_locations_' . date( 'dmyHi' );
3589
+			$file_url = $file_url_base . $file_name . '.csv';
3590
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3591
+			$file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3592 3592
             
3593
-            $items_count = (int)geodir_location_imex_count_locations();
3593
+			$items_count = (int)geodir_location_imex_count_locations();
3594 3594
             
3595
-            if ( isset( $_REQUEST['_st'] ) ) {
3596
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3597
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3598
-                $percentage = min( $percentage, 100 );
3595
+			if ( isset( $_REQUEST['_st'] ) ) {
3596
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3597
+				$percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3598
+				$percentage = min( $percentage, 100 );
3599 3599
                 
3600
-                $json['percentage'] = $percentage;
3601
-                wp_send_json( $json );
3602
-            } else {
3603
-                $chunk_file_paths = array();
3600
+				$json['percentage'] = $percentage;
3601
+				wp_send_json( $json );
3602
+			} else {
3603
+				$chunk_file_paths = array();
3604 3604
                 
3605
-                if ( !$items_count > 0 ) {
3606
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3607
-                } else {
3608
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3609
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3605
+				if ( !$items_count > 0 ) {
3606
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3607
+				} else {
3608
+					$chunk_per_page = min( $chunk_per_page, $items_count );
3609
+					$chunk_total_pages = ceil( $items_count / $chunk_per_page );
3610 3610
                     
3611
-                    $j = $chunk_page_no;
3612
-                    $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3611
+					$j = $chunk_page_no;
3612
+					$chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3613 3613
                     
3614
-                    $per_page = 500;
3615
-                    $per_page = min( $per_page, $chunk_per_page );
3616
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3614
+					$per_page = 500;
3615
+					$per_page = min( $per_page, $chunk_per_page );
3616
+					$total_pages = ceil( $chunk_per_page / $per_page );
3617 3617
                     
3618
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3619
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3618
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3619
+						$save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3620 3620
                         
3621
-                        $clear = $i == 0 ? true : false;
3622
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3623
-                    }
3621
+						$clear = $i == 0 ? true : false;
3622
+						geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3623
+					}
3624 3624
                     
3625
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3626
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3627
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3628
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3629
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3625
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3626
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3627
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3628
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3629
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3630 3630
                         
3631
-                        $file_url = $file_url_base . $chunk_file_name;
3632
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3633
-                    }
3631
+						$file_url = $file_url_base . $chunk_file_name;
3632
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3633
+					}
3634 3634
                     
3635
-                    if ( !empty($chunk_file_paths) ) {
3636
-                        $json['total'] = $items_count;
3637
-                        $json['files'] = $chunk_file_paths;
3638
-                    } else {
3639
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3640
-                    }
3641
-                }
3642
-                wp_send_json( $json );
3643
-            }
3644
-        }
3645
-        break;
3646
-        case 'export_hoods': {
3647
-            $file_url_base = geodir_path_import_export() . '/';
3648
-            $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3649
-            $file_url = $file_url_base . $file_name . '.csv';
3650
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3651
-            $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3635
+					if ( !empty($chunk_file_paths) ) {
3636
+						$json['total'] = $items_count;
3637
+						$json['files'] = $chunk_file_paths;
3638
+					} else {
3639
+						$json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3640
+					}
3641
+				}
3642
+				wp_send_json( $json );
3643
+			}
3644
+		}
3645
+		break;
3646
+		case 'export_hoods': {
3647
+			$file_url_base = geodir_path_import_export() . '/';
3648
+			$file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3649
+			$file_url = $file_url_base . $file_name . '.csv';
3650
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3651
+			$file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3652 3652
             
3653
-            $items_count = (int)geodir_location_imex_count_neighbourhoods();
3653
+			$items_count = (int)geodir_location_imex_count_neighbourhoods();
3654 3654
             
3655
-            if ( isset( $_REQUEST['_st'] ) ) {
3656
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3657
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3658
-                $percentage = min( $percentage, 100 );
3655
+			if ( isset( $_REQUEST['_st'] ) ) {
3656
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3657
+				$percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3658
+				$percentage = min( $percentage, 100 );
3659 3659
                 
3660
-                $json['percentage'] = $percentage;
3661
-                wp_send_json( $json );
3662
-            } else {
3663
-                $chunk_file_paths = array();
3660
+				$json['percentage'] = $percentage;
3661
+				wp_send_json( $json );
3662
+			} else {
3663
+				$chunk_file_paths = array();
3664 3664
                 
3665
-                if ( !$items_count > 0 ) {
3666
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3667
-                } else {
3668
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3669
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3665
+				if ( !$items_count > 0 ) {
3666
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3667
+				} else {
3668
+					$chunk_per_page = min( $chunk_per_page, $items_count );
3669
+					$chunk_total_pages = ceil( $items_count / $chunk_per_page );
3670 3670
                     
3671
-                    $j = $chunk_page_no;
3672
-                    $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3671
+					$j = $chunk_page_no;
3672
+					$chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3673 3673
                     
3674
-                    $per_page = 500;
3675
-                    $per_page = min( $per_page, $chunk_per_page );
3676
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3674
+					$per_page = 500;
3675
+					$per_page = min( $per_page, $chunk_per_page );
3676
+					$total_pages = ceil( $chunk_per_page / $per_page );
3677 3677
                     
3678
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3679
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3678
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3679
+						$save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3680 3680
                         
3681
-                        $clear = $i == 0 ? true : false;
3682
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3683
-                    }
3681
+						$clear = $i == 0 ? true : false;
3682
+						geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3683
+					}
3684 3684
                     
3685
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3686
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3687
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3688
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3689
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3685
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3686
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3687
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3688
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3689
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3690 3690
                         
3691
-                        $file_url = $file_url_base . $chunk_file_name;
3692
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3693
-                    }
3691
+						$file_url = $file_url_base . $chunk_file_name;
3692
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3693
+					}
3694 3694
                     
3695
-                    if ( !empty($chunk_file_paths) ) {
3696
-                        $json['total'] = $items_count;
3697
-                        $json['files'] = $chunk_file_paths;
3698
-                    } else {
3699
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3700
-                    }
3701
-                }
3702
-                wp_send_json( $json );
3703
-            }
3704
-        }
3705
-        break;
3706
-        case 'prepare_import':
3707
-        case 'import_cat':
3708
-        case 'import_post':
3709
-        case 'import_loc':
3710
-        case 'import_hood': {
3711
-            // WPML
3712
-            $is_wpml = geodir_is_wpml();
3713
-            if ($is_wpml) {
3714
-                global $sitepress;
3715
-                $active_lang = ICL_LANGUAGE_CODE;
3716
-            }
3717
-            // WPML
3695
+					if ( !empty($chunk_file_paths) ) {
3696
+						$json['total'] = $items_count;
3697
+						$json['files'] = $chunk_file_paths;
3698
+					} else {
3699
+						$json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3700
+					}
3701
+				}
3702
+				wp_send_json( $json );
3703
+			}
3704
+		}
3705
+		break;
3706
+		case 'prepare_import':
3707
+		case 'import_cat':
3708
+		case 'import_post':
3709
+		case 'import_loc':
3710
+		case 'import_hood': {
3711
+			// WPML
3712
+			$is_wpml = geodir_is_wpml();
3713
+			if ($is_wpml) {
3714
+				global $sitepress;
3715
+				$active_lang = ICL_LANGUAGE_CODE;
3716
+			}
3717
+			// WPML
3718 3718
             
3719
-            ini_set( 'auto_detect_line_endings', true );
3719
+			ini_set( 'auto_detect_line_endings', true );
3720 3720
             
3721
-            $uploads = wp_upload_dir();
3722
-            $uploads_dir = $uploads['path'];
3723
-            $uploads_subdir = $uploads['subdir'];
3721
+			$uploads = wp_upload_dir();
3722
+			$uploads_dir = $uploads['path'];
3723
+			$uploads_subdir = $uploads['subdir'];
3724 3724
             
3725
-            $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3726
-            $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3725
+			$csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3726
+			$import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3727 3727
             
3728
-            $csv_file_arr = explode( '/', $csv_file );
3729
-            $csv_filename = end( $csv_file_arr );
3730
-            $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3728
+			$csv_file_arr = explode( '/', $csv_file );
3729
+			$csv_filename = end( $csv_file_arr );
3730
+			$target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3731 3731
             
3732
-            $json['file'] = $csv_file;
3733
-            $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3734
-            $file = array();
3732
+			$json['file'] = $csv_file;
3733
+			$json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3734
+			$file = array();
3735 3735
 
3736
-            if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3737
-                $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
3736
+			if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3737
+				$wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
3738 3738
                 
3739
-                if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
3740
-                    $json['error'] = NULL;
3741
-
3742
-                    $lc_all = setlocale(LC_ALL, 0); // Fix issue of fgetcsv ignores special characters when they are at the beginning of line
3743
-                    setlocale(LC_ALL, 'en_US.UTF-8');
3744
-                    if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
3745
-                        while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
3746
-                            if ( !empty( $data ) ) {
3747
-                                $file[] = $data;
3748
-                            }
3749
-                        }
3750
-                        fclose($handle);
3751
-                    }
3752
-                    setlocale(LC_ALL, $lc_all);
3739
+				if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
3740
+					$json['error'] = NULL;
3741
+
3742
+					$lc_all = setlocale(LC_ALL, 0); // Fix issue of fgetcsv ignores special characters when they are at the beginning of line
3743
+					setlocale(LC_ALL, 'en_US.UTF-8');
3744
+					if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
3745
+						while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
3746
+							if ( !empty( $data ) ) {
3747
+								$file[] = $data;
3748
+							}
3749
+						}
3750
+						fclose($handle);
3751
+					}
3752
+					setlocale(LC_ALL, $lc_all);
3753 3753
 
3754
-                    $json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
3754
+					$json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
3755 3755
                     
3756
-                    if (!$json['rows'] > 0) {
3757
-                        $json['error'] = __('No data found in csv file.', 'geodirectory');
3758
-                    }
3759
-                } else {
3760
-                    wp_send_json( $json );
3761
-                }
3762
-            } else {
3763
-                wp_send_json( $json );
3764
-            }
3756
+					if (!$json['rows'] > 0) {
3757
+						$json['error'] = __('No data found in csv file.', 'geodirectory');
3758
+					}
3759
+				} else {
3760
+					wp_send_json( $json );
3761
+				}
3762
+			} else {
3763
+				wp_send_json( $json );
3764
+			}
3765 3765
             
3766
-            if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
3767
-                wp_send_json( $json );
3768
-            }
3766
+			if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
3767
+				wp_send_json( $json );
3768
+			}
3769 3769
             
3770
-            $total = $json['rows'];
3771
-            $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
3772
-            $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
3770
+			$total = $json['rows'];
3771
+			$limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
3772
+			$processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
3773 3773
             
3774
-            $count = $limit;
3774
+			$count = $limit;
3775 3775
             
3776
-            if ($count < $total) {
3777
-                $count = $processed + $count;
3778
-                if ($count > $total) {
3779
-                    $count = $total;
3780
-                }
3781
-            } else {
3782
-                $count = $total;
3783
-            }
3776
+			if ($count < $total) {
3777
+				$count = $processed + $count;
3778
+				if ($count > $total) {
3779
+					$count = $total;
3780
+				}
3781
+			} else {
3782
+				$count = $total;
3783
+			}
3784 3784
             
3785
-            $created = 0;
3786
-            $updated = 0;
3787
-            $skipped = 0;
3788
-            $invalid = 0;
3789
-            $invalid_addr = 0;
3790
-            $images = 0;
3785
+			$created = 0;
3786
+			$updated = 0;
3787
+			$skipped = 0;
3788
+			$invalid = 0;
3789
+			$invalid_addr = 0;
3790
+			$images = 0;
3791 3791
             
3792
-            $gd_post_info = array();
3793
-            $countpost = 0;
3792
+			$gd_post_info = array();
3793
+			$countpost = 0;
3794 3794
             
3795
-            $post_types = geodir_get_posttypes();
3795
+			$post_types = geodir_get_posttypes();
3796 3796
 
3797
-            if ( $task == 'import_cat' ) {
3798
-                if (!empty($file)) {
3799
-                    $columns = isset($file[0]) ? $file[0] : NULL;
3797
+			if ( $task == 'import_cat' ) {
3798
+				if (!empty($file)) {
3799
+					$columns = isset($file[0]) ? $file[0] : NULL;
3800 3800
                     
3801
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
3802
-                        $json['error'] = CSV_INVAILD_FILE;
3803
-                        wp_send_json( $json );
3804
-                        exit;
3805
-                    }
3801
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
3802
+						$json['error'] = CSV_INVAILD_FILE;
3803
+						wp_send_json( $json );
3804
+						exit;
3805
+					}
3806 3806
                     
3807
-                    $gd_error_log = __('GD IMPORT CATEGORIES [ROW %d]:', 'geodirectory');
3807
+					$gd_error_log = __('GD IMPORT CATEGORIES [ROW %d]:', 'geodirectory');
3808 3808
                     
3809
-                    for ($i = 1; $i <= $limit; $i++) {
3810
-                        $index = $processed + $i;
3809
+					for ($i = 1; $i <= $limit; $i++) {
3810
+						$index = $processed + $i;
3811 3811
                         
3812
-                        if (isset($file[$index])) {
3813
-                            $row = $file[$index];
3814
-                            $row = array_map( 'trim', $row );
3815
-                            //$row = array_map( 'utf8_encode', $row );
3812
+						if (isset($file[$index])) {
3813
+							$row = $file[$index];
3814
+							$row = array_map( 'trim', $row );
3815
+							//$row = array_map( 'utf8_encode', $row );
3816 3816
                             
3817
-                            $cat_id = '';
3818
-                            $cat_name = '';
3819
-                            $cat_slug = '';
3820
-                            $cat_posttype = '';
3821
-                            $cat_parent = '';
3822
-                            $cat_description = '';
3823
-                            $cat_schema = '';
3824
-                            $cat_top_description = '';
3825
-                            $cat_image = '';
3826
-                            $cat_icon = '';
3827
-                            $cat_language = '';
3828
-                            $cat_id_original = '';
3817
+							$cat_id = '';
3818
+							$cat_name = '';
3819
+							$cat_slug = '';
3820
+							$cat_posttype = '';
3821
+							$cat_parent = '';
3822
+							$cat_description = '';
3823
+							$cat_schema = '';
3824
+							$cat_top_description = '';
3825
+							$cat_image = '';
3826
+							$cat_icon = '';
3827
+							$cat_language = '';
3828
+							$cat_id_original = '';
3829 3829
                             
3830
-                            $c = 0;
3831
-                            foreach ($columns as $column ) {
3832
-                                if ( $column == 'cat_id' ) {
3833
-                                    $cat_id = (int)$row[$c];
3834
-                                } else if ( $column == 'cat_name' ) {
3835
-                                    $cat_name = $row[$c];
3836
-                                } else if ( $column == 'cat_slug' ) {
3837
-                                    $cat_slug = $row[$c];
3838
-                                } else if ( $column == 'cat_posttype' ) {
3839
-                                    $cat_posttype = $row[$c];
3840
-                                } else if ( $column == 'cat_parent' ) {
3841
-                                    $cat_parent = trim($row[$c]);
3842
-                                } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
3843
-                                    $cat_schema = $row[$c];
3844
-                                } else if ( $column == 'cat_description' ) {
3845
-                                    $cat_description = $row[$c];
3846
-                                } else if ( $column == 'cat_top_description' ) {
3847
-                                    $cat_top_description = $row[$c];
3848
-                                } else if ( $column == 'cat_image' ) {
3849
-                                    $cat_image = $row[$c];
3850
-                                } else if ( $column == 'cat_icon' ) {
3851
-                                    $cat_icon = $row[$c];
3852
-                                }
3853
-                                // WPML
3854
-                                if ( $is_wpml ) {
3855
-                                    if ( $column == 'cat_language' ) {
3856
-                                        $cat_language = geodir_strtolower( trim( $row[$c] ) );
3857
-                                    } else if ( $column == 'cat_id_original' ) {
3858
-                                        $cat_id_original = (int)$row[$c];
3859
-                                    }
3860
-                                }
3861
-                                // WPML
3862
-                                $c++;
3863
-                            }
3830
+							$c = 0;
3831
+							foreach ($columns as $column ) {
3832
+								if ( $column == 'cat_id' ) {
3833
+									$cat_id = (int)$row[$c];
3834
+								} else if ( $column == 'cat_name' ) {
3835
+									$cat_name = $row[$c];
3836
+								} else if ( $column == 'cat_slug' ) {
3837
+									$cat_slug = $row[$c];
3838
+								} else if ( $column == 'cat_posttype' ) {
3839
+									$cat_posttype = $row[$c];
3840
+								} else if ( $column == 'cat_parent' ) {
3841
+									$cat_parent = trim($row[$c]);
3842
+								} else if ( $column == 'cat_schema' && $row[$c] != '' ) {
3843
+									$cat_schema = $row[$c];
3844
+								} else if ( $column == 'cat_description' ) {
3845
+									$cat_description = $row[$c];
3846
+								} else if ( $column == 'cat_top_description' ) {
3847
+									$cat_top_description = $row[$c];
3848
+								} else if ( $column == 'cat_image' ) {
3849
+									$cat_image = $row[$c];
3850
+								} else if ( $column == 'cat_icon' ) {
3851
+									$cat_icon = $row[$c];
3852
+								}
3853
+								// WPML
3854
+								if ( $is_wpml ) {
3855
+									if ( $column == 'cat_language' ) {
3856
+										$cat_language = geodir_strtolower( trim( $row[$c] ) );
3857
+									} else if ( $column == 'cat_id_original' ) {
3858
+										$cat_id_original = (int)$row[$c];
3859
+									}
3860
+								}
3861
+								// WPML
3862
+								$c++;
3863
+							}
3864 3864
                             
3865
-                            if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
3866
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
3865
+							if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
3866
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
3867 3867
                                 
3868
-                                $invalid++;
3869
-                                continue;
3870
-                            }
3868
+								$invalid++;
3869
+								continue;
3870
+							}
3871 3871
                             
3872
-                            // WPML
3873
-                            if ($is_wpml && $cat_language != '') {
3874
-                                $sitepress->switch_lang($cat_language, true);
3875
-                            }
3876
-                            // WPML
3872
+							// WPML
3873
+							if ($is_wpml && $cat_language != '') {
3874
+								$sitepress->switch_lang($cat_language, true);
3875
+							}
3876
+							// WPML
3877 3877
                                                         
3878
-                            $term_data = array();
3879
-                            $term_data['name'] = $cat_name;
3880
-                            $term_data['slug'] = $cat_slug;
3881
-                            $term_data['description'] = $cat_description;
3882
-                            $term_data['cat_schema'] = $cat_schema;
3883
-                            $term_data['top_description'] = $cat_top_description;
3884
-                            $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
3885
-                            $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
3878
+							$term_data = array();
3879
+							$term_data['name'] = $cat_name;
3880
+							$term_data['slug'] = $cat_slug;
3881
+							$term_data['description'] = $cat_description;
3882
+							$term_data['cat_schema'] = $cat_schema;
3883
+							$term_data['top_description'] = $cat_top_description;
3884
+							$term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
3885
+							$term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
3886 3886
                             
3887
-                            //$term_data = array_map( 'utf8_encode', $term_data );
3887
+							//$term_data = array_map( 'utf8_encode', $term_data );
3888 3888
                             
3889
-                            $taxonomy = $cat_posttype . 'category';
3889
+							$taxonomy = $cat_posttype . 'category';
3890 3890
                             
3891
-                            $term_data['taxonomy'] = $taxonomy;
3891
+							$term_data['taxonomy'] = $taxonomy;
3892 3892
 
3893
-                            $term_parent_id = 0;
3894
-                            if ($cat_parent != "" || (int)$cat_parent > 0) {
3895
-                                $term_parent = '';
3893
+							$term_parent_id = 0;
3894
+							if ($cat_parent != "" || (int)$cat_parent > 0) {
3895
+								$term_parent = '';
3896 3896
                                 
3897
-                                if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
3898
-                                    //
3899
-                                } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
3900
-                                    //
3901
-                                } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
3902
-                                    //
3903
-                                } else {
3904
-                                    $term_parent_data = array();
3905
-                                    $term_parent_data['name'] = $cat_parent;
3906
-                                    //$term_parent_data = array_map( 'utf8_encode', $term_parent_data );
3907
-                                    $term_parent_data['taxonomy'] = $taxonomy;
3897
+								if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
3898
+									//
3899
+								} else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
3900
+									//
3901
+								} else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
3902
+									//
3903
+								} else {
3904
+									$term_parent_data = array();
3905
+									$term_parent_data['name'] = $cat_parent;
3906
+									//$term_parent_data = array_map( 'utf8_encode', $term_parent_data );
3907
+									$term_parent_data['taxonomy'] = $taxonomy;
3908 3908
                                     
3909
-                                    $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
3910
-                                }
3909
+									$term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
3910
+								}
3911 3911
                                 
3912
-                                if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
3913
-                                    $term_parent_id = (int)$term_parent->term_id;
3914
-                                }
3915
-                            }
3916
-                            $term_data['parent'] = (int)$term_parent_id;
3912
+								if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
3913
+									$term_parent_id = (int)$term_parent->term_id;
3914
+								}
3915
+							}
3916
+							$term_data['parent'] = (int)$term_parent_id;
3917 3917
 
3918
-                            $term_id = NULL;
3919
-                            if ( $import_choice == 'update' ) {
3920
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
3921
-                                    $term_data['term_id'] = $term['term_id'];
3918
+							$term_id = NULL;
3919
+							if ( $import_choice == 'update' ) {
3920
+								if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
3921
+									$term_data['term_id'] = $term['term_id'];
3922 3922
                                     
3923
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
3924
-                                        $updated++;
3925
-                                    } else {
3926
-                                        $invalid++;
3927
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
3928
-                                    }
3929
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
3930
-                                    $term_data['term_id'] = $term['term_id'];
3923
+									if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
3924
+										$updated++;
3925
+									} else {
3926
+										$invalid++;
3927
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
3928
+									}
3929
+								} else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
3930
+									$term_data['term_id'] = $term['term_id'];
3931 3931
                                     
3932
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
3933
-                                        $updated++;
3934
-                                    } else {
3935
-                                        $invalid++;
3936
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
3937
-                                    }
3938
-                                } else {
3939
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
3940
-                                        $created++;
3941
-                                    } else {
3942
-                                        $invalid++;
3943
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
3944
-                                    }
3945
-                                }
3946
-                            } else if ( $import_choice == 'skip' ) {
3947
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
3948
-                                    $skipped++;
3949
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
3950
-                                    $skipped++;
3951
-                                } else {
3952
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
3953
-                                        $created++;
3954
-                                    } else {
3955
-                                        $invalid++;
3956
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
3957
-                                    }
3958
-                                }
3959
-                            } else {
3960
-                                $invalid++;
3961
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
3962
-                            }
3932
+									if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
3933
+										$updated++;
3934
+									} else {
3935
+										$invalid++;
3936
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
3937
+									}
3938
+								} else {
3939
+									if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
3940
+										$created++;
3941
+									} else {
3942
+										$invalid++;
3943
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
3944
+									}
3945
+								}
3946
+							} else if ( $import_choice == 'skip' ) {
3947
+								if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
3948
+									$skipped++;
3949
+								} else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
3950
+									$skipped++;
3951
+								} else {
3952
+									if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
3953
+										$created++;
3954
+									} else {
3955
+										$invalid++;
3956
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
3957
+									}
3958
+								}
3959
+							} else {
3960
+								$invalid++;
3961
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
3962
+							}
3963 3963
                             
3964
-                            if ( $term_id ) {
3965
-                                // WPML
3966
-                                if ($is_wpml && $cat_id_original > 0 && $cat_language != '') {
3967
-                                    $wpml_element_type = 'tax_' . $taxonomy;
3968
-                                    $source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type );
3969
-                                    $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
3970
-
3971
-                                    $trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type );
3964
+							if ( $term_id ) {
3965
+								// WPML
3966
+								if ($is_wpml && $cat_id_original > 0 && $cat_language != '') {
3967
+									$wpml_element_type = 'tax_' . $taxonomy;
3968
+									$source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type );
3969
+									$source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
3970
+
3971
+									$trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type );
3972 3972
                                     
3973
-                                    $sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language );
3974
-                                }
3975
-                                // WPML
3973
+									$sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language );
3974
+								}
3975
+								// WPML
3976 3976
                                 
3977
-                                if ( isset( $term_data['top_description'] ) ) {
3978
-                                    geodir_update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
3979
-                                }
3977
+								if ( isset( $term_data['top_description'] ) ) {
3978
+									geodir_update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
3979
+								}
3980 3980
                                 
3981
-                                if ( isset( $term_data['cat_schema'] ) ) {
3982
-                                    geodir_update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
3983
-                                }
3981
+								if ( isset( $term_data['cat_schema'] ) ) {
3982
+									geodir_update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
3983
+								}
3984 3984
             
3985
-                                $attachment = false;
3986
-                                if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
3987
-                                    $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
3988
-                                    $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
3985
+								$attachment = false;
3986
+								if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
3987
+									$cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
3988
+									$cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
3989 3989
                                     
3990
-                                    if ( basename($cat_image) != $term_data['image'] ) {
3991
-                                        $attachment = true;
3992
-                                        geodir_update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
3993
-                                    }
3994
-                                }
3990
+									if ( basename($cat_image) != $term_data['image'] ) {
3991
+										$attachment = true;
3992
+										geodir_update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
3993
+									}
3994
+								}
3995 3995
                                 
3996
-                                if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
3997
-                                    $cat_icon = geodir_get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
3998
-                                    $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
3999
-
4000
-                                    if ( basename($cat_icon) != $term_data['icon'] ) {
4001
-                                        $attachment = true;
4002
-                                        geodir_update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4003
-                                    }
4004
-                                }
3996
+								if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
3997
+									$cat_icon = geodir_get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
3998
+									$cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
3999
+
4000
+									if ( basename($cat_icon) != $term_data['icon'] ) {
4001
+										$attachment = true;
4002
+										geodir_update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4003
+									}
4004
+								}
4005 4005
                                 
4006
-                                if ( $attachment ) {
4007
-                                    $images++;
4008
-                                }
4009
-                            }
4006
+								if ( $attachment ) {
4007
+									$images++;
4008
+								}
4009
+							}
4010 4010
                             
4011
-                            // WPML
4012
-                            if ($is_wpml && $cat_language != '') {
4013
-                                $sitepress->switch_lang($active_lang, true);
4014
-                            }
4015
-                            // WPML
4016
-                        }
4017
-                    }
4018
-                }
4011
+							// WPML
4012
+							if ($is_wpml && $cat_language != '') {
4013
+								$sitepress->switch_lang($active_lang, true);
4014
+							}
4015
+							// WPML
4016
+						}
4017
+					}
4018
+				}
4019 4019
                 
4020
-                $json = array();
4021
-                $json['processed'] = $limit;
4022
-                $json['created'] = $created;
4023
-                $json['updated'] = $updated;
4024
-                $json['skipped'] = $skipped;
4025
-                $json['invalid'] = $invalid;
4026
-                $json['images'] = $images;
4020
+				$json = array();
4021
+				$json['processed'] = $limit;
4022
+				$json['created'] = $created;
4023
+				$json['updated'] = $updated;
4024
+				$json['skipped'] = $skipped;
4025
+				$json['invalid'] = $invalid;
4026
+				$json['images'] = $images;
4027 4027
                 
4028
-                wp_send_json( $json );
4029
-                exit;
4030
-            } else if ( $task == 'import_post' ) {
4031
-                $xtimings['###1'] = microtime(true)-$xstart;
4032
-                //run some stuff to make the import quicker
4033
-                wp_defer_term_counting( true );
4034
-                wp_defer_comment_counting( true );
4035
-                $wpdb->query( 'SET autocommit = 0;' );
4028
+				wp_send_json( $json );
4029
+				exit;
4030
+			} else if ( $task == 'import_post' ) {
4031
+				$xtimings['###1'] = microtime(true)-$xstart;
4032
+				//run some stuff to make the import quicker
4033
+				wp_defer_term_counting( true );
4034
+				wp_defer_comment_counting( true );
4035
+				$wpdb->query( 'SET autocommit = 0;' );
4036 4036
 //
4037 4037
 //                remove_all_actions('publish_post');
4038 4038
 //                remove_all_actions('transition_post_status');
4039 4039
 //                remove_all_actions('publish_future_post');
4040 4040
 
4041
-                if (!empty($file)) {
4042
-                    $is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
4043
-                    $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4044
-                    $default_status = 'publish';
4045
-                    $current_date = date_i18n( 'Y-m-d', time() );
4041
+				if (!empty($file)) {
4042
+					$is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
4043
+					$wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4044
+					$default_status = 'publish';
4045
+					$current_date = date_i18n( 'Y-m-d', time() );
4046 4046
                     
4047
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4047
+					$columns = isset($file[0]) ? $file[0] : NULL;
4048 4048
                     
4049
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4050
-                        $json['error'] = CSV_INVAILD_FILE;
4051
-                        wp_send_json( $json );
4052
-                        exit;
4053
-                    }
4054
-                    $xtimings['###2'] = microtime(true)-$xstart;
4055
-                    $gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
4056
-                    $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' );
4057
-                    $processed_actual = 0;
4058
-                    for ($i = 1; $i <= $limit; $i++) {
4059
-                        $index = $processed + $i;
4060
-                        $gd_post = array();
4049
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4050
+						$json['error'] = CSV_INVAILD_FILE;
4051
+						wp_send_json( $json );
4052
+						exit;
4053
+					}
4054
+					$xtimings['###2'] = microtime(true)-$xstart;
4055
+					$gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
4056
+					$wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' );
4057
+					$processed_actual = 0;
4058
+					for ($i = 1; $i <= $limit; $i++) {
4059
+						$index = $processed + $i;
4060
+						$gd_post = array();
4061 4061
                         
4062
-                        if (isset($file[$index])) {
4063
-                            $processed_actual++;
4064
-                            $row = $file[$index];
4065
-                            $row = array_map( 'trim', $row );
4066
-                            //$row = array_map( 'utf8_encode', $row );
4067
-                            $row = array_map( 'addslashes_gpc', $row );
4062
+						if (isset($file[$index])) {
4063
+							$processed_actual++;
4064
+							$row = $file[$index];
4065
+							$row = array_map( 'trim', $row );
4066
+							//$row = array_map( 'utf8_encode', $row );
4067
+							$row = array_map( 'addslashes_gpc', $row );
4068 4068
                             
4069
-                            $post_id = '';
4070
-                            $post_title = '';
4071
-                            $post_date = '';
4072
-                            $post_author = '';
4073
-                            $post_content = '';
4074
-                            $post_category_arr = array();
4075
-                            $default_category = '';
4076
-                            $post_tags = array();
4077
-                            $post_type = '';
4078
-                            $post_status = '';
4079
-                            $geodir_video = '';
4080
-                            $post_address = '';
4081
-                            $post_city = '';
4082
-                            $post_region = '';
4083
-                            $post_country = '';
4084
-                            $post_zip = '';
4085
-                            $post_latitude = '';
4086
-                            $post_longitude = '';
4087
-                            $post_neighbourhood = '';
4088
-                            $neighbourhood_latitude = '';
4089
-                            $neighbourhood_longitude = '';
4090
-                            $geodir_timing = '';
4091
-                            $geodir_contact = '';
4092
-                            $geodir_email = '';
4093
-                            $geodir_website = '';
4094
-                            $geodir_twitter = '';
4095
-                            $geodir_facebook = '';
4096
-                            $geodir_twitter = '';
4097
-                            $geodir_link_business = null;
4098
-                            $post_images = array();
4069
+							$post_id = '';
4070
+							$post_title = '';
4071
+							$post_date = '';
4072
+							$post_author = '';
4073
+							$post_content = '';
4074
+							$post_category_arr = array();
4075
+							$default_category = '';
4076
+							$post_tags = array();
4077
+							$post_type = '';
4078
+							$post_status = '';
4079
+							$geodir_video = '';
4080
+							$post_address = '';
4081
+							$post_city = '';
4082
+							$post_region = '';
4083
+							$post_country = '';
4084
+							$post_zip = '';
4085
+							$post_latitude = '';
4086
+							$post_longitude = '';
4087
+							$post_neighbourhood = '';
4088
+							$neighbourhood_latitude = '';
4089
+							$neighbourhood_longitude = '';
4090
+							$geodir_timing = '';
4091
+							$geodir_contact = '';
4092
+							$geodir_email = '';
4093
+							$geodir_website = '';
4094
+							$geodir_twitter = '';
4095
+							$geodir_facebook = '';
4096
+							$geodir_twitter = '';
4097
+							$geodir_link_business = null;
4098
+							$post_images = array();
4099 4099
                             
4100
-                            $expire_date = 'Never';
4100
+							$expire_date = 'Never';
4101 4101
                             
4102
-                            $language = '';
4103
-                            $original_post_id = '';
4102
+							$language = '';
4103
+							$original_post_id = '';
4104 4104
                             
4105
-                            $c = 0;
4106
-                            foreach ($columns as $column ) {
4107
-                                $gd_post[$column] = $row[$c];
4105
+							$c = 0;
4106
+							foreach ($columns as $column ) {
4107
+								$gd_post[$column] = $row[$c];
4108 4108
                                 
4109
-                                if ( $column == 'post_id' ) {
4110
-                                    $post_id = $row[$c];
4111
-                                } else if ( $column == 'post_title' ) {
4112
-                                    $post_title = sanitize_text_field($row[$c]);
4113
-                                } else if ( $column == 'post_author' ) {
4114
-                                    $post_author = $row[$c];
4115
-                                } else if ( $column == 'post_date' ) {
4116
-                                    $post_date = $row[$c];
4117
-                                } else if ( $column == 'post_content' ) {
4118
-                                    $post_content = $row[$c];
4119
-                                } else if ( $column == 'post_category' && $row[$c] != '' ) {
4120
-                                    $post_category_arr = explode( ',', $row[$c] );
4121
-                                } else if ( $column == 'default_category' ) {
4122
-                                    $default_category = wp_kses_normalize_entities($row[$c]);
4123
-                                } else if ( $column == 'post_tags' && $row[$c] != '' ) {
4124
-                                    $post_tags = explode( ',', sanitize_text_field($row[$c]) );
4125
-                                } else if ( $column == 'post_type' ) {
4126
-                                    $post_type = $row[$c];
4127
-                                } else if ( $column == 'post_status' ) {
4128
-                                    $post_status = sanitize_key( $row[$c] );
4129
-                                } else if ( $column == 'is_featured' ) {
4130
-                                    $is_featured = (int)$row[$c];
4131
-                                } else if ( $column == 'geodir_video' ) {
4132
-                                    $geodir_video = $row[$c];
4133
-                                } else if ( $column == 'post_address' ) {
4134
-                                    $post_address = sanitize_text_field($row[$c]);
4135
-                                } else if ( $column == 'post_city' ) {
4136
-                                    $post_city = sanitize_text_field($row[$c]);
4137
-                                } else if ( $column == 'post_region' ) {
4138
-                                    $post_region = sanitize_text_field($row[$c]);
4139
-                                } else if ( $column == 'post_country' ) {
4140
-                                    $post_country = sanitize_text_field($row[$c]);
4141
-                                } else if ( $column == 'post_zip' ) {
4142
-                                    $post_zip = sanitize_text_field($row[$c]);
4143
-                                } else if ( $column == 'post_latitude' ) {
4144
-                                    $post_latitude = sanitize_text_field($row[$c]);
4145
-                                } else if ( $column == 'post_longitude' ) {
4146
-                                    $post_longitude = sanitize_text_field($row[$c]);
4147
-                                } else if ( $column == 'post_neighbourhood' ) {
4148
-                                    $post_neighbourhood = sanitize_text_field($row[$c]);
4149
-                                    unset($gd_post[$column]);
4150
-                                } else if ( $column == 'neighbourhood_latitude' ) {
4151
-                                    $neighbourhood_latitude = sanitize_text_field($row[$c]);
4152
-                                } else if ( $column == 'neighbourhood_longitude' ) {
4153
-                                    $neighbourhood_longitude = sanitize_text_field($row[$c]);
4154
-                                } else if ( $column == 'geodir_timing' ) {
4155
-                                    $geodir_timing = sanitize_text_field($row[$c]);
4156
-                                } else if ( $column == 'geodir_contact' ) {
4157
-                                    $geodir_contact = sanitize_text_field($row[$c]);
4158
-                                } else if ( $column == 'geodir_email' ) {
4159
-                                    $geodir_email = sanitize_email($row[$c]);
4160
-                                } else if ( $column == 'geodir_website' ) {
4161
-                                    $geodir_website = sanitize_text_field($row[$c]);
4162
-                                } else if ( $column == 'geodir_twitter' ) {
4163
-                                    $geodir_twitter = sanitize_text_field($row[$c]);
4164
-                                } else if ( $column == 'geodir_facebook' ) {
4165
-                                    $geodir_facebook = sanitize_text_field($row[$c]);
4166
-                                } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4167
-                                    $post_images[] = $row[$c];
4168
-                                } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4169
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4170
-                                } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4171
-                                    $row[$c] = str_replace('/', '-', $row[$c]);
4172
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4173
-                                } else if ( strpos( $column, 'linked_' ) === 0 ) {
4174
-                                    $geodir_link_business = (int)$row[$c];
4175
-                                }
4176
-                                // WPML
4177
-                                if ($is_wpml) {
4178
-                                    if ($column == 'language') {
4179
-                                        $language = geodir_strtolower(trim($row[$c]));
4180
-                                    } else if ($column == 'original_post_id') {
4181
-                                        $original_post_id = (int)$row[$c];
4182
-                                    }
4183
-                                }
4184
-                                // WPML
4185
-                                $c++;
4186
-                            }
4187
-                            // listing claimed or not
4188
-                            if ($is_claim_active && isset($gd_post['claimed'])) {
4189
-                                $gd_post['claimed'] = (int)$gd_post['claimed'] == 1 ? 1 : 0;
4190
-                            }
4109
+								if ( $column == 'post_id' ) {
4110
+									$post_id = $row[$c];
4111
+								} else if ( $column == 'post_title' ) {
4112
+									$post_title = sanitize_text_field($row[$c]);
4113
+								} else if ( $column == 'post_author' ) {
4114
+									$post_author = $row[$c];
4115
+								} else if ( $column == 'post_date' ) {
4116
+									$post_date = $row[$c];
4117
+								} else if ( $column == 'post_content' ) {
4118
+									$post_content = $row[$c];
4119
+								} else if ( $column == 'post_category' && $row[$c] != '' ) {
4120
+									$post_category_arr = explode( ',', $row[$c] );
4121
+								} else if ( $column == 'default_category' ) {
4122
+									$default_category = wp_kses_normalize_entities($row[$c]);
4123
+								} else if ( $column == 'post_tags' && $row[$c] != '' ) {
4124
+									$post_tags = explode( ',', sanitize_text_field($row[$c]) );
4125
+								} else if ( $column == 'post_type' ) {
4126
+									$post_type = $row[$c];
4127
+								} else if ( $column == 'post_status' ) {
4128
+									$post_status = sanitize_key( $row[$c] );
4129
+								} else if ( $column == 'is_featured' ) {
4130
+									$is_featured = (int)$row[$c];
4131
+								} else if ( $column == 'geodir_video' ) {
4132
+									$geodir_video = $row[$c];
4133
+								} else if ( $column == 'post_address' ) {
4134
+									$post_address = sanitize_text_field($row[$c]);
4135
+								} else if ( $column == 'post_city' ) {
4136
+									$post_city = sanitize_text_field($row[$c]);
4137
+								} else if ( $column == 'post_region' ) {
4138
+									$post_region = sanitize_text_field($row[$c]);
4139
+								} else if ( $column == 'post_country' ) {
4140
+									$post_country = sanitize_text_field($row[$c]);
4141
+								} else if ( $column == 'post_zip' ) {
4142
+									$post_zip = sanitize_text_field($row[$c]);
4143
+								} else if ( $column == 'post_latitude' ) {
4144
+									$post_latitude = sanitize_text_field($row[$c]);
4145
+								} else if ( $column == 'post_longitude' ) {
4146
+									$post_longitude = sanitize_text_field($row[$c]);
4147
+								} else if ( $column == 'post_neighbourhood' ) {
4148
+									$post_neighbourhood = sanitize_text_field($row[$c]);
4149
+									unset($gd_post[$column]);
4150
+								} else if ( $column == 'neighbourhood_latitude' ) {
4151
+									$neighbourhood_latitude = sanitize_text_field($row[$c]);
4152
+								} else if ( $column == 'neighbourhood_longitude' ) {
4153
+									$neighbourhood_longitude = sanitize_text_field($row[$c]);
4154
+								} else if ( $column == 'geodir_timing' ) {
4155
+									$geodir_timing = sanitize_text_field($row[$c]);
4156
+								} else if ( $column == 'geodir_contact' ) {
4157
+									$geodir_contact = sanitize_text_field($row[$c]);
4158
+								} else if ( $column == 'geodir_email' ) {
4159
+									$geodir_email = sanitize_email($row[$c]);
4160
+								} else if ( $column == 'geodir_website' ) {
4161
+									$geodir_website = sanitize_text_field($row[$c]);
4162
+								} else if ( $column == 'geodir_twitter' ) {
4163
+									$geodir_twitter = sanitize_text_field($row[$c]);
4164
+								} else if ( $column == 'geodir_facebook' ) {
4165
+									$geodir_facebook = sanitize_text_field($row[$c]);
4166
+								} else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4167
+									$post_images[] = $row[$c];
4168
+								} else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4169
+									$expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4170
+								} else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4171
+									$row[$c] = str_replace('/', '-', $row[$c]);
4172
+									$expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4173
+								} else if ( strpos( $column, 'linked_' ) === 0 ) {
4174
+									$geodir_link_business = (int)$row[$c];
4175
+								}
4176
+								// WPML
4177
+								if ($is_wpml) {
4178
+									if ($column == 'language') {
4179
+										$language = geodir_strtolower(trim($row[$c]));
4180
+									} else if ($column == 'original_post_id') {
4181
+										$original_post_id = (int)$row[$c];
4182
+									}
4183
+								}
4184
+								// WPML
4185
+								$c++;
4186
+							}
4187
+							// listing claimed or not
4188
+							if ($is_claim_active && isset($gd_post['claimed'])) {
4189
+								$gd_post['claimed'] = (int)$gd_post['claimed'] == 1 ? 1 : 0;
4190
+							}
4191 4191
                             
4192
-                            // WPML
4193
-                            if ($is_wpml && $language != '') {
4194
-                                $sitepress->switch_lang($language, true);
4195
-                            }
4196
-                            // WPML
4192
+							// WPML
4193
+							if ($is_wpml && $language != '') {
4194
+								$sitepress->switch_lang($language, true);
4195
+							}
4196
+							// WPML
4197 4197
 
4198
-                            $gd_post['IMAGE'] = $post_images;
4198
+							$gd_post['IMAGE'] = $post_images;
4199 4199
                             
4200
-                            $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4201
-                            $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4200
+							$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4201
+							$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4202 4202
                                                                                                                 
4203
-                            $valid = true;
4203
+							$valid = true;
4204 4204
                             
4205
-                            if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4206
-                                $invalid++;
4207
-                                $valid = false;
4208
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4209
-                            }
4210
-                            $xtimings['###3'] = microtime(true)-$xstart;
4211
-                            $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4212
-                            if ( $location_allowed ) {
4213
-                                $location_result = geodir_get_default_location();
4214
-                                if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4215
-                                    $invalid_addr++;
4216
-                                    $valid = false;
4217
-                                    geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) );
4218
-                                } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4219
-                                    if ( ( geodir_strtolower( $post_city ) != geodir_strtolower( $location_result->city ) ) || ( geodir_strtolower( $post_region ) != geodir_strtolower( $location_result->region ) ) || (geodir_strtolower( $post_country ) != geodir_strtolower( $location_result->country ) ) ) {
4220
-                                        $invalid_addr++;
4221
-                                        $valid = false;
4222
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) );
4223
-                                    } else {
4224
-                                        if (!$location_manager) {
4225
-                                            $gd_post['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // Set the default location when location manager not activated.
4226
-                                        }
4227
-                                    }
4228
-                                }
4229
-                            }
4230
-                            $xtimings['###4']   = microtime(true)-$xstart;
4231
-                            if ( !$valid ) {
4232
-                                continue;
4233
-                            }
4205
+							if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4206
+								$invalid++;
4207
+								$valid = false;
4208
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4209
+							}
4210
+							$xtimings['###3'] = microtime(true)-$xstart;
4211
+							$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4212
+							if ( $location_allowed ) {
4213
+								$location_result = geodir_get_default_location();
4214
+								if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4215
+									$invalid_addr++;
4216
+									$valid = false;
4217
+									geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) );
4218
+								} else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4219
+									if ( ( geodir_strtolower( $post_city ) != geodir_strtolower( $location_result->city ) ) || ( geodir_strtolower( $post_region ) != geodir_strtolower( $location_result->region ) ) || (geodir_strtolower( $post_country ) != geodir_strtolower( $location_result->country ) ) ) {
4220
+										$invalid_addr++;
4221
+										$valid = false;
4222
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) );
4223
+									} else {
4224
+										if (!$location_manager) {
4225
+											$gd_post['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // Set the default location when location manager not activated.
4226
+										}
4227
+									}
4228
+								}
4229
+							}
4230
+							$xtimings['###4']   = microtime(true)-$xstart;
4231
+							if ( !$valid ) {
4232
+								continue;
4233
+							}
4234 4234
 
4235
-                            $cat_taxonomy = $post_type . 'category';
4236
-                            $tags_taxonomy = $post_type . '_tags';
4235
+							$cat_taxonomy = $post_type . 'category';
4236
+							$tags_taxonomy = $post_type . '_tags';
4237 4237
                             
4238
-                            if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4239
-                                $post_category_arr = array_merge(array($default_category), $post_category_arr);
4240
-                            }
4238
+							if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4239
+								$post_category_arr = array_merge(array($default_category), $post_category_arr);
4240
+							}
4241 4241
 
4242
-                            $post_category = array();
4243
-                            $default_category_id = NULL;
4244
-                            if ( !empty( $post_category_arr ) ) {
4245
-                                foreach ( $post_category_arr as $value ) {
4246
-                                    $category_name = wp_kses_normalize_entities( trim( $value ) );
4242
+							$post_category = array();
4243
+							$default_category_id = NULL;
4244
+							if ( !empty( $post_category_arr ) ) {
4245
+								foreach ( $post_category_arr as $value ) {
4246
+									$category_name = wp_kses_normalize_entities( trim( $value ) );
4247 4247
                                     
4248
-                                    if ( $category_name != '' ) {
4249
-                                        $term_category = array();
4248
+									if ( $category_name != '' ) {
4249
+										$term_category = array();
4250 4250
                                         
4251
-                                        if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4252
-                                            $term_category = $term;
4253
-                                        } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4254
-                                            $term_category = $term;
4255
-                                        } else {
4256
-                                            $term_data = array();
4257
-                                            $term_data['name'] = $category_name;
4258
-                                            $term_data['taxonomy'] = $cat_taxonomy;
4251
+										if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4252
+											$term_category = $term;
4253
+										} else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4254
+											$term_category = $term;
4255
+										} else {
4256
+											$term_data = array();
4257
+											$term_data['name'] = $category_name;
4258
+											$term_data['taxonomy'] = $cat_taxonomy;
4259 4259
                                             
4260
-                                            $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4261
-                                            if ( $term_id ) {
4262
-                                                $term_category = get_term( $term_id, $cat_taxonomy );
4263
-                                            }
4264
-                                        }
4260
+											$term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4261
+											if ( $term_id ) {
4262
+												$term_category = get_term( $term_id, $cat_taxonomy );
4263
+											}
4264
+										}
4265 4265
                                         
4266
-                                        if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4267
-                                            $post_category[] = intval($term_category->term_id);
4266
+										if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4267
+											$post_category[] = intval($term_category->term_id);
4268 4268
                                             
4269
-                                            if ($category_name == $default_category) {
4270
-                                                $default_category_id = intval($term_category->term_id);
4271
-                                            }
4272
-                                        }
4273
-                                    }
4274
-                                }
4275
-                            }
4276
-                            $xtimings['###5'] = microtime(true)-$xstart;
4277
-                            $save_post = array();
4278
-                            $save_post['post_title'] = $post_title;
4279
-                            if (!empty($post_date)) {
4280
-                                $post_date = geodir_date( $post_date, 'Y-m-d H:i:s' ); // convert to mysql date format.
4269
+											if ($category_name == $default_category) {
4270
+												$default_category_id = intval($term_category->term_id);
4271
+											}
4272
+										}
4273
+									}
4274
+								}
4275
+							}
4276
+							$xtimings['###5'] = microtime(true)-$xstart;
4277
+							$save_post = array();
4278
+							$save_post['post_title'] = $post_title;
4279
+							if (!empty($post_date)) {
4280
+								$post_date = geodir_date( $post_date, 'Y-m-d H:i:s' ); // convert to mysql date format.
4281 4281
                                 
4282
-                                $save_post['post_date'] = $post_date;
4283
-                                $save_post['post_date_gmt'] = get_gmt_from_date( $post_date );
4284
-                            }
4285
-                            $save_post['post_content'] = $post_content;
4286
-                            $save_post['post_type'] = $post_type;
4287
-                            $save_post['post_author'] = $post_author;
4288
-                            $save_post['post_status'] = $post_status;
4289
-                            $save_post['post_category'] = $post_category;
4290
-                            $save_post['post_tags'] = $post_tags;
4291
-
4292
-                            $saved_post_id = NULL;
4293
-                            if ( $import_choice == 'update' ) {
4294
-                                $gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' );
4282
+								$save_post['post_date'] = $post_date;
4283
+								$save_post['post_date_gmt'] = get_gmt_from_date( $post_date );
4284
+							}
4285
+							$save_post['post_content'] = $post_content;
4286
+							$save_post['post_type'] = $post_type;
4287
+							$save_post['post_author'] = $post_author;
4288
+							$save_post['post_status'] = $post_status;
4289
+							$save_post['post_category'] = $post_category;
4290
+							$save_post['post_tags'] = $post_tags;
4291
+
4292
+							$saved_post_id = NULL;
4293
+							if ( $import_choice == 'update' ) {
4294
+								$gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' );
4295 4295
                                 
4296
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4297
-                                    $save_post['ID'] = $post_id;
4296
+								if ( $post_id > 0 && get_post( $post_id ) ) {
4297
+									$save_post['ID'] = $post_id;
4298 4298
                                     
4299
-                                    if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
4300
-                                        if ( is_wp_error( $saved_post_id ) ) {
4301
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4302
-                                            $saved_post_id = 0;
4303
-                                        } else {
4304
-                                            $saved_post_id = $post_id;
4305
-                                            $updated++;
4306
-                                        }
4307
-                                    }
4308
-                                } else {
4309
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4310
-                                        if ( is_wp_error( $saved_post_id ) ) {
4311
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4312
-                                            $saved_post_id = 0;
4313
-                                        } else {
4314
-                                            $created++;
4315
-                                        }
4316
-                                    }
4317
-                                }
4299
+									if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
4300
+										if ( is_wp_error( $saved_post_id ) ) {
4301
+											$gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4302
+											$saved_post_id = 0;
4303
+										} else {
4304
+											$saved_post_id = $post_id;
4305
+											$updated++;
4306
+										}
4307
+									}
4308
+								} else {
4309
+									if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4310
+										if ( is_wp_error( $saved_post_id ) ) {
4311
+											$gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4312
+											$saved_post_id = 0;
4313
+										} else {
4314
+											$created++;
4315
+										}
4316
+									}
4317
+								}
4318 4318
                                 
4319
-                                if ( !$saved_post_id > 0 ) {
4320
-                                    $invalid++;
4321
-                                    geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error );
4322
-                                }
4323
-                            } else if ( $import_choice == 'skip' ) {
4324
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4325
-                                    $skipped++;	
4326
-                                } else {
4327
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4328
-                                        if ( is_wp_error( $saved_post_id ) ) {
4329
-                                            $invalid++;
4319
+								if ( !$saved_post_id > 0 ) {
4320
+									$invalid++;
4321
+									geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error );
4322
+								}
4323
+							} else if ( $import_choice == 'skip' ) {
4324
+								if ( $post_id > 0 && get_post( $post_id ) ) {
4325
+									$skipped++;	
4326
+								} else {
4327
+									if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4328
+										if ( is_wp_error( $saved_post_id ) ) {
4329
+											$invalid++;
4330 4330
                                             
4331
-                                            geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error );
4332
-                                            $saved_post_id = 0;
4333
-                                        } else {
4334
-                                            $created++;
4335
-                                        }
4336
-                                    } else {
4337
-                                        $invalid++;
4331
+											geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error );
4332
+											$saved_post_id = 0;
4333
+										} else {
4334
+											$created++;
4335
+										}
4336
+									} else {
4337
+										$invalid++;
4338 4338
                                         
4339
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4340
-                                    }
4341
-                                }
4342
-                            } else {
4343
-                                $invalid++;
4339
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4340
+									}
4341
+								}
4342
+							} else {
4343
+								$invalid++;
4344 4344
                                 
4345
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4346
-                            }
4347
-                            $xtimings['###6'] = microtime(true)-$xstart;
4348
-                            if ( (int)$saved_post_id > 0 ) {
4349
-                                // WPML
4350
-                                if ($is_wpml && $original_post_id > 0 && $language != '') {
4351
-                                    $wpml_post_type = 'post_' . $post_type;
4352
-                                    $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4353
-                                    $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4354
-
4355
-                                    $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4345
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4346
+							}
4347
+							$xtimings['###6'] = microtime(true)-$xstart;
4348
+							if ( (int)$saved_post_id > 0 ) {
4349
+								// WPML
4350
+								if ($is_wpml && $original_post_id > 0 && $language != '') {
4351
+									$wpml_post_type = 'post_' . $post_type;
4352
+									$source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4353
+									$source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4354
+
4355
+									$trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4356 4356
                                     
4357
-                                    $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4358
-                                }
4359
-                                // WPML
4360
-                                $gd_post_info = geodir_get_post_info( $saved_post_id );
4357
+									$sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4358
+								}
4359
+								// WPML
4360
+								$gd_post_info = geodir_get_post_info( $saved_post_id );
4361 4361
                                 
4362
-                                $gd_post['post_id'] = $saved_post_id;
4363
-                                $gd_post['ID'] = $saved_post_id;
4364
-                                $gd_post['post_tags'] = $post_tags;
4365
-                                $gd_post['post_title'] = $post_title;
4366
-                                $gd_post['post_status'] = $post_status;
4367
-                                $gd_post['submit_time'] = time();
4368
-                                $gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR'];
4362
+								$gd_post['post_id'] = $saved_post_id;
4363
+								$gd_post['ID'] = $saved_post_id;
4364
+								$gd_post['post_tags'] = $post_tags;
4365
+								$gd_post['post_title'] = $post_title;
4366
+								$gd_post['post_status'] = $post_status;
4367
+								$gd_post['submit_time'] = time();
4368
+								$gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR'];
4369 4369
                                                     
4370
-                                // post location
4371
-                                $post_location_id = 0;
4372
-                                if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4373
-                                    $gd_post['post_neighbourhood'] = '';
4370
+								// post location
4371
+								$post_location_id = 0;
4372
+								if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4373
+									$gd_post['post_neighbourhood'] = '';
4374 4374
                                     
4375
-                                    $post_location_info = array(
4376
-                                                                'city' => $post_city,
4377
-                                                                'region' => $post_region,
4378
-                                                                'country' => $post_country,
4379
-                                                                'geo_lat' => $post_latitude,
4380
-                                                                'geo_lng' => $post_longitude
4381
-                                                            );
4382
-                                    if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4383
-                                        $post_location_id = $location_id;
4384
-                                    }
4375
+									$post_location_info = array(
4376
+																'city' => $post_city,
4377
+																'region' => $post_region,
4378
+																'country' => $post_country,
4379
+																'geo_lat' => $post_latitude,
4380
+																'geo_lng' => $post_longitude
4381
+															);
4382
+									if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4383
+										$post_location_id = $location_id;
4384
+									}
4385 4385
                                     
4386
-                                    if ($post_location_id > 0 && $neighbourhood_active && !empty($post_neighbourhood)) {
4387
-                                        $neighbourhood_info = geodir_location_neighbourhood_by_name_loc_id($post_neighbourhood, $post_location_id);
4386
+									if ($post_location_id > 0 && $neighbourhood_active && !empty($post_neighbourhood)) {
4387
+										$neighbourhood_info = geodir_location_neighbourhood_by_name_loc_id($post_neighbourhood, $post_location_id);
4388 4388
 
4389
-                                        $hood_data = array();
4390
-                                        $hood_data['hood_location_id'] = $post_location_id;
4391
-                                        $hood_data['hood_name'] = $post_neighbourhood;
4389
+										$hood_data = array();
4390
+										$hood_data['hood_location_id'] = $post_location_id;
4391
+										$hood_data['hood_name'] = $post_neighbourhood;
4392 4392
                                         
4393
-                                        if (!empty($neighbourhood_info)) {
4394
-                                            $hood_data['hood_id'] = $neighbourhood_info->hood_id;
4395
-                                            $hood_data['hood_slug'] = $neighbourhood_info->hood_slug;
4393
+										if (!empty($neighbourhood_info)) {
4394
+											$hood_data['hood_id'] = $neighbourhood_info->hood_id;
4395
+											$hood_data['hood_slug'] = $neighbourhood_info->hood_slug;
4396 4396
                                             
4397
-                                            if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4398
-                                                $neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4399
-                                                $neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4400
-                                            }
4401
-                                        }
4397
+											if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4398
+												$neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4399
+												$neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4400
+											}
4401
+										}
4402 4402
                                         
4403
-                                        if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4404
-                                            $neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4405
-                                            $neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4406
-                                        }
4403
+										if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4404
+											$neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4405
+											$neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4406
+										}
4407 4407
                                         
4408
-                                        $hood_data['hood_latitude'] = $post_latitude;
4409
-                                        $hood_data['hood_longitude'] = $post_longitude;
4410
-
4411
-                                        $neighbourhood_info = geodir_location_insert_update_neighbourhood($hood_data);
4412
-                                        if (!empty($neighbourhood_info) && isset($neighbourhood_info->hood_slug)) {
4413
-                                            $gd_post['post_neighbourhood'] = $neighbourhood_info->hood_slug;
4414
-                                        }
4415
-                                    }
4416
-                                }
4417
-                                $gd_post['post_location_id'] = $post_location_id;
4408
+										$hood_data['hood_latitude'] = $post_latitude;
4409
+										$hood_data['hood_longitude'] = $post_longitude;
4410
+
4411
+										$neighbourhood_info = geodir_location_insert_update_neighbourhood($hood_data);
4412
+										if (!empty($neighbourhood_info) && isset($neighbourhood_info->hood_slug)) {
4413
+											$gd_post['post_neighbourhood'] = $neighbourhood_info->hood_slug;
4414
+										}
4415
+									}
4416
+								}
4417
+								$gd_post['post_location_id'] = $post_location_id;
4418 4418
                                 
4419
-                                if ($geodir_link_business !== null) {
4420
-                                    $gd_post['geodir_link_business'] = $geodir_link_business > 0 ? $geodir_link_business : '';
4421
-                                }
4419
+								if ($geodir_link_business !== null) {
4420
+									$gd_post['geodir_link_business'] = $geodir_link_business > 0 ? $geodir_link_business : '';
4421
+								}
4422 4422
                                 
4423
-                                // post package info
4424
-                                $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4425
-                                if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4426
-                                    $package_id = $gd_post_info->package_id;
4427
-                                }
4423
+								// post package info
4424
+								$package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4425
+								if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4426
+									$package_id = $gd_post_info->package_id;
4427
+								}
4428 4428
                                 
4429
-                                $package_info = array();
4430
-                                if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4431
-                                    $package_info = (array)geodir_get_package_info_by_id($package_id);
4429
+								$package_info = array();
4430
+								if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4431
+									$package_info = (array)geodir_get_package_info_by_id($package_id);
4432 4432
                                     
4433
-                                    if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4434
-                                        $package_info = array();
4435
-                                    }
4436
-                                }
4433
+									if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4434
+										$package_info = array();
4435
+									}
4436
+								}
4437 4437
                                 
4438
-                                if (empty($package_info)) {
4439
-                                    $package_info = (array)geodir_post_package_info( array(), '', $post_type );
4440
-                                }
4438
+								if (empty($package_info)) {
4439
+									$package_info = (array)geodir_post_package_info( array(), '', $post_type );
4440
+								}
4441 4441
                                  
4442
-                                if (!empty($package_info))	 {
4443
-                                    $package_id = $package_info['pid'];
4442
+								if (!empty($package_info))	 {
4443
+									$package_id = $package_info['pid'];
4444 4444
                                     
4445
-                                    if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4446
-                                        $gd_post['expire_date'] = $expire_date;
4447
-                                    } else {
4448
-                                        if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4449
-                                            $gd_post['alive_days'] = (int)$package_info['days'];
4450
-                                            $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4451
-                                        } else {
4452
-                                            $gd_post['expire_date'] = 'Never';
4453
-                                        }
4454
-                                    }
4445
+									if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4446
+										$gd_post['expire_date'] = $expire_date;
4447
+									} else {
4448
+										if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4449
+											$gd_post['alive_days'] = (int)$package_info['days'];
4450
+											$gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4451
+										} else {
4452
+											$gd_post['expire_date'] = 'Never';
4453
+										}
4454
+									}
4455 4455
                                     
4456
-                                    $gd_post['package_id'] = $package_id;
4457
-                                }
4456
+									$gd_post['package_id'] = $package_id;
4457
+								}
4458 4458
 
4459
-                                $table = $plugin_prefix . $post_type . '_detail';
4459
+								$table = $plugin_prefix . $post_type . '_detail';
4460 4460
                                 
4461
-                                if ($post_type == 'gd_event') {
4462
-                                    $gd_post = geodir_imex_process_event_data($gd_post);
4463
-                                }
4461
+								if ($post_type == 'gd_event') {
4462
+									$gd_post = geodir_imex_process_event_data($gd_post);
4463
+								}
4464 4464
                                 
4465
-                                if (isset($gd_post['post_id'])) {
4466
-                                    unset($gd_post['post_id']);
4467
-                                }
4465
+								if (isset($gd_post['post_id'])) {
4466
+									unset($gd_post['post_id']);
4467
+								}
4468 4468
 
4469
-                                // Export franchise fields
4470
-                                $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4471
-                                if ($is_franchise_active) {
4472
-                                    if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
4473
-                                        $gd_franchise_lock = array();
4469
+								// Export franchise fields
4470
+								$is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4471
+								if ($is_franchise_active) {
4472
+									if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
4473
+										$gd_franchise_lock = array();
4474 4474
                                         
4475
-                                        if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4476
-                                            $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4477
-                                            $gd_franchise_lock = trim( $gd_franchise_lock );
4478
-                                            $gd_franchise_lock = explode( ",", $gd_franchise_lock );
4479
-                                        }
4475
+										if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4476
+											$gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4477
+											$gd_franchise_lock = trim( $gd_franchise_lock );
4478
+											$gd_franchise_lock = explode( ",", $gd_franchise_lock );
4479
+										}
4480 4480
                                         
4481
-                                        update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4482
-                                        update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4483
-                                    } else {
4484
-                                        if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4485
-                                            geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4486
-                                        }
4487
-                                    }
4488
-                                }
4481
+										update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4482
+										update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4483
+									} else {
4484
+										if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4485
+											geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4486
+										}
4487
+									}
4488
+								}
4489 4489
                                 
4490
-                                if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4491
-                                    $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4492
-                                    if ($default_category_id) {
4493
-                                        $save_post['post_default_category'] = $default_category_id;
4494
-                                        $gd_post['default_category'] = $default_category_id;
4495
-                                    }
4496
-                                    $gd_post[$cat_taxonomy] = $save_post['post_category'];
4497
-                                }
4498
-                                $xtimings['###7'] = microtime(true)-$xstart;
4499
-                                // Save post info
4500
-                                geodir_save_post_info( $saved_post_id, $gd_post );
4501
-                                $xtimings['###8'] = microtime(true)-$xstart;
4502
-                                // post taxonomies
4503
-                                if ( !empty( $save_post['post_category'] ) ) {
4504
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4490
+								if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4491
+									$save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4492
+									if ($default_category_id) {
4493
+										$save_post['post_default_category'] = $default_category_id;
4494
+										$gd_post['default_category'] = $default_category_id;
4495
+									}
4496
+									$gd_post[$cat_taxonomy] = $save_post['post_category'];
4497
+								}
4498
+								$xtimings['###7'] = microtime(true)-$xstart;
4499
+								// Save post info
4500
+								geodir_save_post_info( $saved_post_id, $gd_post );
4501
+								$xtimings['###8'] = microtime(true)-$xstart;
4502
+								// post taxonomies
4503
+								if ( !empty( $save_post['post_category'] ) ) {
4504
+									wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4505 4505
                                     
4506
-                                    $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4507
-                                    if ($default_category_id) {
4508
-                                        $post_default_category = $default_category_id;
4509
-                                    }
4510
-                                    $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4511
-                                    $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4512
-                                    $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4506
+									$post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4507
+									if ($default_category_id) {
4508
+										$post_default_category = $default_category_id;
4509
+									}
4510
+									$post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4511
+									$save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4512
+									$post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4513 4513
                                     
4514
-                                    if ($post_category_str != '' && $post_default_category) {
4515
-                                        $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4516
-                                    }
4514
+									if ($post_category_str != '' && $post_default_category) {
4515
+										$post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4516
+									}
4517 4517
                                     
4518
-                                    $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4518
+									$post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4519 4519
                                     
4520
-                                    geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4521
-                                }
4522
-                                $xtimings['###8.1'] = microtime(true)-$xstart;
4523
-                                if ( !empty( $save_post['post_tags'] ) ) {
4524
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4525
-                                }
4526
-                                $xtimings['###9'] = microtime(true)-$xstart;
4527
-                                // Post images
4528
-                                if ( !empty( $post_images ) ) {
4529
-                                    $post_images = array_unique($post_images);
4520
+									geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4521
+								}
4522
+								$xtimings['###8.1'] = microtime(true)-$xstart;
4523
+								if ( !empty( $save_post['post_tags'] ) ) {
4524
+									wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4525
+								}
4526
+								$xtimings['###9'] = microtime(true)-$xstart;
4527
+								// Post images
4528
+								if ( !empty( $post_images ) ) {
4529
+									$post_images = array_unique($post_images);
4530 4530
                                     
4531
-                                    $old_post_images_arr = array();
4532
-                                    $saved_post_images_arr = array();
4531
+									$old_post_images_arr = array();
4532
+									$saved_post_images_arr = array();
4533 4533
                                     
4534
-                                    $order = 1;
4534
+									$order = 1;
4535 4535
                                     
4536
-                                    $old_post_images = geodir_get_images( $saved_post_id );
4537
-                                    $xtimings['###9.1'] = microtime(true)-$xstart;
4538
-                                    if (!empty($old_post_images)) {
4539
-                                        foreach( $old_post_images as $old_post_image ) {
4540
-                                            if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4541
-                                                $old_post_images_arr[] = $old_post_image->file;
4542
-                                            }
4543
-                                        }
4544
-                                    }
4536
+									$old_post_images = geodir_get_images( $saved_post_id );
4537
+									$xtimings['###9.1'] = microtime(true)-$xstart;
4538
+									if (!empty($old_post_images)) {
4539
+										foreach( $old_post_images as $old_post_image ) {
4540
+											if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4541
+												$old_post_images_arr[] = $old_post_image->file;
4542
+											}
4543
+										}
4544
+									}
4545 4545
 
4546
-                                    foreach ( $post_images as $post_image ) {
4547
-                                        $image_name = basename( $post_image );
4548
-                                        $saved_post_images_arr[] = $image_name;
4546
+									foreach ( $post_images as $post_image ) {
4547
+										$image_name = basename( $post_image );
4548
+										$saved_post_images_arr[] = $image_name;
4549 4549
                                         
4550
-                                        if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4551
-                                            continue; // Skip if image already exists.
4552
-                                        }
4550
+										if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4551
+											continue; // Skip if image already exists.
4552
+										}
4553 4553
                                         
4554
-                                        $image_name_parts = explode( '.', $image_name );
4555
-                                        array_pop( $image_name_parts );
4556
-                                        $proper_image_name = implode( '.', $image_name_parts );
4557
-                                        $xtimings['###9.2'] = microtime(true)-$xstart;
4558
-                                        $arr_file_type = wp_check_filetype( $image_name );
4559
-                                        $xtimings['###9.3'] = microtime(true)-$xstart;
4560
-                                        if ( !empty( $arr_file_type ) ) {
4561
-                                            $uploaded_file_type = $arr_file_type['type'];
4554
+										$image_name_parts = explode( '.', $image_name );
4555
+										array_pop( $image_name_parts );
4556
+										$proper_image_name = implode( '.', $image_name_parts );
4557
+										$xtimings['###9.2'] = microtime(true)-$xstart;
4558
+										$arr_file_type = wp_check_filetype( $image_name );
4559
+										$xtimings['###9.3'] = microtime(true)-$xstart;
4560
+										if ( !empty( $arr_file_type ) ) {
4561
+											$uploaded_file_type = $arr_file_type['type'];
4562 4562
                                             
4563
-                                            $attachment = array();
4564
-                                            $attachment['post_id'] = $saved_post_id;
4565
-                                            $attachment['title'] = $proper_image_name;
4566
-                                            $attachment['content'] = '';
4567
-                                            $attachment['file'] = $uploads_subdir . '/' . $image_name;
4568
-                                            $attachment['mime_type'] = $uploaded_file_type;
4569
-                                            $attachment['menu_order'] = $order;
4570
-                                            $attachment['is_featured'] = 0;
4571
-
4572
-                                            $attachment_set = '';
4573
-                                            foreach ( $attachment as $key => $val ) {
4574
-                                                if ( $val != '' ) {
4575
-                                                    $attachment_set .= $key . " = '" . $val . "', ";
4576
-                                                }
4577
-                                            }
4578
-                                            $attachment_set = trim( $attachment_set, ", " );
4563
+											$attachment = array();
4564
+											$attachment['post_id'] = $saved_post_id;
4565
+											$attachment['title'] = $proper_image_name;
4566
+											$attachment['content'] = '';
4567
+											$attachment['file'] = $uploads_subdir . '/' . $image_name;
4568
+											$attachment['mime_type'] = $uploaded_file_type;
4569
+											$attachment['menu_order'] = $order;
4570
+											$attachment['is_featured'] = 0;
4571
+
4572
+											$attachment_set = '';
4573
+											foreach ( $attachment as $key => $val ) {
4574
+												if ( $val != '' ) {
4575
+													$attachment_set .= $key . " = '" . $val . "', ";
4576
+												}
4577
+											}
4578
+											$attachment_set = trim( $attachment_set, ", " );
4579 4579
                                                                                         
4580
-                                            // Add new attachment
4581
-                                            $xtimings['###9.4'] = microtime(true)-$xstart;
4582
-                                            $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4583
-                                            $xtimings['###9.5'] = microtime(true)-$xstart;
4584
-                                            $order++;
4585
-                                        }
4586
-                                    }
4587
-
4588
-                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4589
-                                    // Remove previous attachment
4590
-                                    $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4591
-                                    $xtimings['###9.6'] = microtime(true)-$xstart;
4592
-                                    if ( !empty( $saved_post_images_arr ) ) {
4593
-                                        geodir_set_wp_featured_image($saved_post_id);
4594
-                                        $xtimings['###9.7'] = microtime(true)-$xstart;
4595
-                                        /*
4580
+											// Add new attachment
4581
+											$xtimings['###9.4'] = microtime(true)-$xstart;
4582
+											$wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4583
+											$xtimings['###9.5'] = microtime(true)-$xstart;
4584
+											$order++;
4585
+										}
4586
+									}
4587
+
4588
+									$saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4589
+									// Remove previous attachment
4590
+									$wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4591
+									$xtimings['###9.6'] = microtime(true)-$xstart;
4592
+									if ( !empty( $saved_post_images_arr ) ) {
4593
+										geodir_set_wp_featured_image($saved_post_id);
4594
+										$xtimings['###9.7'] = microtime(true)-$xstart;
4595
+										/*
4596 4596
                                         $menu_order = 1;
4597 4597
                                         
4598 4598
                                         foreach ( $saved_post_images_arr as $img_name ) {
@@ -4605,288 +4605,288 @@  discard block
 block discarded – undo
4605 4605
                                             }
4606 4606
                                             $menu_order++;
4607 4607
                                         }*/
4608
-                                    }
4608
+									}
4609 4609
                                     
4610
-                                    if ( $order > 1 ) {
4611
-                                        $images++;
4612
-                                    }
4613
-                                }
4614
-                                $xtimings['###10'] = microtime(true)-$xstart;
4615
-                                /** This action is documented in geodirectory-functions/post-functions.php */
4616
-                                do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4617
-                                $xtimings['###11'] = microtime(true)-$xstart;
4618
-                                if (isset($is_featured)) {
4619
-                                    geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
4620
-                                }
4621
-                                if (isset($gd_post['alive_days'])) {
4622
-                                    geodir_save_post_meta($saved_post_id, 'alive_days', $gd_post['alive_days']);
4623
-                                }
4624
-                                if (isset($gd_post['expire_date'])) {
4625
-                                    geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
4626
-                                }
4627
-                                $xtimings['###12'] = microtime(true)-$xstart;
4628
-                            }
4610
+									if ( $order > 1 ) {
4611
+										$images++;
4612
+									}
4613
+								}
4614
+								$xtimings['###10'] = microtime(true)-$xstart;
4615
+								/** This action is documented in geodirectory-functions/post-functions.php */
4616
+								do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4617
+								$xtimings['###11'] = microtime(true)-$xstart;
4618
+								if (isset($is_featured)) {
4619
+									geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
4620
+								}
4621
+								if (isset($gd_post['alive_days'])) {
4622
+									geodir_save_post_meta($saved_post_id, 'alive_days', $gd_post['alive_days']);
4623
+								}
4624
+								if (isset($gd_post['expire_date'])) {
4625
+									geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
4626
+								}
4627
+								$xtimings['###12'] = microtime(true)-$xstart;
4628
+							}
4629 4629
                             
4630
-                            // WPML
4631
-                            if ($is_wpml && $language != '') {
4632
-                                $sitepress->switch_lang($active_lang, true);
4633
-                            }
4634
-                            // WPML
4635
-                        }
4636
-                    }
4637
-                }
4630
+							// WPML
4631
+							if ($is_wpml && $language != '') {
4632
+								$sitepress->switch_lang($active_lang, true);
4633
+							}
4634
+							// WPML
4635
+						}
4636
+					}
4637
+				}
4638 4638
 
4639
-                //undo some stuff to make the import quicker
4640
-                wp_defer_term_counting( false );
4641
-                wp_defer_comment_counting( false );
4642
-                $wpdb->query( 'COMMIT;' );
4643
-                $wpdb->query( 'SET autocommit = 1;' );
4644
-                $xtimings['###13'] = microtime(true)-$xstart;
4645
-                $json = array();
4646
-                $json['processed'] = $processed_actual;
4647
-                $json['created'] = $created;
4648
-                $json['updated'] = $updated;
4649
-                $json['skipped'] = $skipped;
4650
-                $json['invalid'] = $invalid;
4651
-                $json['invalid_addr'] = $invalid_addr;
4652
-                $json['images'] = $images;
4653
-                $json['timing'] = microtime(true)-$xstart;
4654
-                $json['timings'] = $xtimings;
4639
+				//undo some stuff to make the import quicker
4640
+				wp_defer_term_counting( false );
4641
+				wp_defer_comment_counting( false );
4642
+				$wpdb->query( 'COMMIT;' );
4643
+				$wpdb->query( 'SET autocommit = 1;' );
4644
+				$xtimings['###13'] = microtime(true)-$xstart;
4645
+				$json = array();
4646
+				$json['processed'] = $processed_actual;
4647
+				$json['created'] = $created;
4648
+				$json['updated'] = $updated;
4649
+				$json['skipped'] = $skipped;
4650
+				$json['invalid'] = $invalid;
4651
+				$json['invalid_addr'] = $invalid_addr;
4652
+				$json['images'] = $images;
4653
+				$json['timing'] = microtime(true)-$xstart;
4654
+				$json['timings'] = $xtimings;
4655 4655
                 
4656 4656
 
4657
-                wp_send_json( $json );
4658
-                exit;
4659
-            } else if ( $task == 'import_loc' ) {
4660
-                global $gd_post_types;
4661
-                $gd_post_types = $post_types;
4657
+				wp_send_json( $json );
4658
+				exit;
4659
+			} else if ( $task == 'import_loc' ) {
4660
+				global $gd_post_types;
4661
+				$gd_post_types = $post_types;
4662 4662
                 
4663
-                if (!empty($file)) {
4664
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4663
+				if (!empty($file)) {
4664
+					$columns = isset($file[0]) ? $file[0] : NULL;
4665 4665
                     
4666
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4667
-                        $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4668
-                        wp_send_json( $json );
4669
-                    }
4666
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4667
+						$json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4668
+						wp_send_json( $json );
4669
+					}
4670 4670
                     
4671
-                    $gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
4672
-                    $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' );
4673
-                    for ($i = 1; $i <= $limit; $i++) {
4674
-                        $index = $processed + $i;
4671
+					$gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
4672
+					$gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' );
4673
+					for ($i = 1; $i <= $limit; $i++) {
4674
+						$index = $processed + $i;
4675 4675
                         
4676
-                        if (isset($file[$index])) {
4677
-                            $row = $file[$index];
4678
-                            $row = array_map( 'trim', $row );
4679
-                            $data = array();
4676
+						if (isset($file[$index])) {
4677
+							$row = $file[$index];
4678
+							$row = array_map( 'trim', $row );
4679
+							$data = array();
4680 4680
                             
4681
-                            foreach ($columns as $c => $column ) {
4682
-                                if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta_title', 'city_meta_desc', 'city_desc', 'region_meta_title', 'region_meta_desc', 'region_desc', 'country_meta_title', 'country_meta_desc', 'country_desc'))) {
4683
-                                    $data[$column] = $row[$c];
4684
-                                }
4685
-                            }
4681
+							foreach ($columns as $c => $column ) {
4682
+								if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta_title', 'city_meta_desc', 'city_desc', 'region_meta_title', 'region_meta_desc', 'region_desc', 'country_meta_title', 'country_meta_desc', 'country_desc'))) {
4683
+									$data[$column] = $row[$c];
4684
+								}
4685
+							}
4686 4686
 
4687
-                            if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4688
-                                $invalid++;
4689
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4690
-                                continue;
4691
-                            }
4687
+							if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4688
+								$invalid++;
4689
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4690
+								continue;
4691
+							}
4692 4692
                             
4693
-                            $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4693
+							$data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4694 4694
                             
4695
-                            if ( $import_choice == 'update' ) {
4696
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4697
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4698
-                                        $updated++;
4699
-                                    } else {
4700
-                                        $invalid++;
4701
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4702
-                                    }
4703
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4704
-                                    $data['location_id'] = (int)$location->location_id;
4695
+							if ( $import_choice == 'update' ) {
4696
+								if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4697
+									if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4698
+										$updated++;
4699
+									} else {
4700
+										$invalid++;
4701
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4702
+									}
4703
+								} else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4704
+									$data['location_id'] = (int)$location->location_id;
4705 4705
                                     
4706
-                                    if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4707
-                                        $data['location_id'] = (int)$location->location_id;
4708
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4709
-                                        $data['location_id'] = (int)$location->location_id;
4710
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4711
-                                        $data['location_id'] = (int)$location->location_id;
4712
-                                    }
4706
+									if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4707
+										$data['location_id'] = (int)$location->location_id;
4708
+									} else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4709
+										$data['location_id'] = (int)$location->location_id;
4710
+									} else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4711
+										$data['location_id'] = (int)$location->location_id;
4712
+									}
4713 4713
                                     
4714
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4715
-                                        $updated++;
4716
-                                    } else {
4717
-                                        $invalid++;
4718
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4719
-                                    }
4720
-                                } else {
4721
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4722
-                                        $created++;
4723
-                                    } else {
4724
-                                        $invalid++;
4725
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4726
-                                    }
4727
-                                }
4728
-                            } elseif ( $import_choice == 'skip' ) {
4729
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4730
-                                    $skipped++;
4731
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4732
-                                    $skipped++;
4733
-                                } else {
4734
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4735
-                                        $created++;
4736
-                                    } else {
4737
-                                        $invalid++;
4738
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4739
-                                    }
4740
-                                }
4741
-                            } else {
4742
-                                $invalid++;
4743
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4744
-                            }
4745
-                        }
4746
-                    }
4747
-                }
4714
+									if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4715
+										$updated++;
4716
+									} else {
4717
+										$invalid++;
4718
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4719
+									}
4720
+								} else {
4721
+									if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4722
+										$created++;
4723
+									} else {
4724
+										$invalid++;
4725
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4726
+									}
4727
+								}
4728
+							} elseif ( $import_choice == 'skip' ) {
4729
+								if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4730
+									$skipped++;
4731
+								} else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4732
+									$skipped++;
4733
+								} else {
4734
+									if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4735
+										$created++;
4736
+									} else {
4737
+										$invalid++;
4738
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4739
+									}
4740
+								}
4741
+							} else {
4742
+								$invalid++;
4743
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4744
+							}
4745
+						}
4746
+					}
4747
+				}
4748 4748
                 
4749
-                $json = array();
4750
-                $json['processed'] = $limit;
4751
-                $json['created'] = $created;
4752
-                $json['updated'] = $updated;
4753
-                $json['skipped'] = $skipped;
4754
-                $json['invalid'] = $invalid;
4755
-                $json['images'] = $images;
4749
+				$json = array();
4750
+				$json['processed'] = $limit;
4751
+				$json['created'] = $created;
4752
+				$json['updated'] = $updated;
4753
+				$json['skipped'] = $skipped;
4754
+				$json['invalid'] = $invalid;
4755
+				$json['images'] = $images;
4756 4756
                 
4757
-                wp_send_json( $json );
4758
-            } else if ( $task == 'import_hood' ) {               
4759
-                if (!empty($file)) {
4760
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4757
+				wp_send_json( $json );
4758
+			} else if ( $task == 'import_hood' ) {               
4759
+				if (!empty($file)) {
4760
+					$columns = isset($file[0]) ? $file[0] : NULL;
4761 4761
                     
4762
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4763
-                        $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4764
-                        wp_send_json( $json );
4765
-                    }
4762
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4763
+						$json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4764
+						wp_send_json( $json );
4765
+					}
4766 4766
                     
4767
-                    $gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
4768
-                    $gd_error_hood = __( 'Could not be saved due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory' );
4769
-                    for ($i = 1; $i <= $limit; $i++) {
4770
-                        $index = $processed + $i;
4767
+					$gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
4768
+					$gd_error_hood = __( 'Could not be saved due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory' );
4769
+					for ($i = 1; $i <= $limit; $i++) {
4770
+						$index = $processed + $i;
4771 4771
                         
4772
-                        if (isset($file[$index])) {
4773
-                            $row = $file[$index];
4774
-                            $row = array_map( 'trim', $row );
4775
-                            $data = array();
4772
+						if (isset($file[$index])) {
4773
+							$row = $file[$index];
4774
+							$row = array_map( 'trim', $row );
4775
+							$data = array();
4776 4776
                             
4777
-                            foreach ($columns as $c => $column) {
4778
-                                if (in_array($column, array('neighbourhood_id', 'neighbourhood_name', 'neighbourhood_slug', 'latitude', 'longitude', 'location_id', 'city', 'region', 'country'))) {
4779
-                                    $data[$column] = sanitize_text_field($row[$c]);
4780
-                                }
4781
-                            }
4777
+							foreach ($columns as $c => $column) {
4778
+								if (in_array($column, array('neighbourhood_id', 'neighbourhood_name', 'neighbourhood_slug', 'latitude', 'longitude', 'location_id', 'city', 'region', 'country'))) {
4779
+									$data[$column] = sanitize_text_field($row[$c]);
4780
+								}
4781
+							}
4782 4782
 
4783
-                            if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
4784
-                                $invalid++;
4785
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4786
-                                continue;
4787
-                            }
4783
+							if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
4784
+								$invalid++;
4785
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4786
+								continue;
4787
+							}
4788 4788
                             
4789
-                            $location_info = array();
4790
-                            if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
4791
-                                $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
4792
-                            } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
4793
-                                $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
4794
-                            }
4789
+							$location_info = array();
4790
+							if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
4791
+								$location_info = geodir_get_location_by_id('', (int)$data['location_id']);
4792
+							} else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
4793
+								$location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
4794
+							}
4795 4795
 
4796
-                            if (empty($location_info)) {
4797
-                                $invalid++;
4798
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4799
-                                continue;
4800
-                            }
4796
+							if (empty($location_info)) {
4797
+								$invalid++;
4798
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4799
+								continue;
4800
+							}
4801 4801
                             
4802
-                            $location_id = $location_info->location_id;
4802
+							$location_id = $location_info->location_id;
4803 4803
 
4804
-                            $data['neighbourhood_id'] = isset($data['neighbourhood_id']) ? absint($data['neighbourhood_id']) : 0;
4804
+							$data['neighbourhood_id'] = isset($data['neighbourhood_id']) ? absint($data['neighbourhood_id']) : 0;
4805 4805
                             
4806
-                            $hood_data = array();
4807
-                            $hood_data['hood_name'] = $data['neighbourhood_name'];
4808
-                            $hood_data['hood_slug'] = $data['neighbourhood_slug'];
4809
-                            $hood_data['hood_latitude'] = $data['latitude'];
4810
-                            $hood_data['hood_longitude'] = $data['longitude'];
4811
-                            $hood_data['hood_location_id'] = $location_id;
4806
+							$hood_data = array();
4807
+							$hood_data['hood_name'] = $data['neighbourhood_name'];
4808
+							$hood_data['hood_slug'] = $data['neighbourhood_slug'];
4809
+							$hood_data['hood_latitude'] = $data['latitude'];
4810
+							$hood_data['hood_longitude'] = $data['longitude'];
4811
+							$hood_data['hood_location_id'] = $location_id;
4812 4812
                                     
4813
-                            if ( $import_choice == 'update' ) {
4814
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4815
-                                    $hood_data['hood_id'] = (int)$data['neighbourhood_id'];
4813
+							if ( $import_choice == 'update' ) {
4814
+								if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4815
+									$hood_data['hood_id'] = (int)$data['neighbourhood_id'];
4816 4816
                                     
4817
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4818
-                                        $updated++;
4819
-                                    } else {
4820
-                                        $invalid++;
4821
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4822
-                                    }
4823
-                                } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4824
-                                    $hood_data['hood_id'] = (int)$neighbourhood->hood_id;
4817
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4818
+										$updated++;
4819
+									} else {
4820
+										$invalid++;
4821
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4822
+									}
4823
+								} else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4824
+									$hood_data['hood_id'] = (int)$neighbourhood->hood_id;
4825 4825
                                     
4826
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4827
-                                        $updated++;
4828
-                                    } else {
4829
-                                        $invalid++;
4830
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4831
-                                    }
4832
-                                } else {
4833
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4834
-                                        $created++;
4835
-                                    } else {
4836
-                                        $invalid++;
4837
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4838
-                                    }
4839
-                                }
4840
-                            } elseif ( $import_choice == 'skip' ) {
4841
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4842
-                                    $skipped++;
4843
-                                } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4844
-                                    $skipped++;
4845
-                                } else {
4826
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4827
+										$updated++;
4828
+									} else {
4829
+										$invalid++;
4830
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4831
+									}
4832
+								} else {
4833
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4834
+										$created++;
4835
+									} else {
4836
+										$invalid++;
4837
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4838
+									}
4839
+								}
4840
+							} elseif ( $import_choice == 'skip' ) {
4841
+								if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4842
+									$skipped++;
4843
+								} else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4844
+									$skipped++;
4845
+								} else {
4846 4846
                                     
4847
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4848
-                                        $created++;
4849
-                                    } else {
4850
-                                        $invalid++;
4851
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4852
-                                    }
4853
-                                }
4854
-                            } else {
4855
-                                $invalid++;
4856
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4857
-                            }
4858
-                        }
4859
-                    }
4860
-                }
4847
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4848
+										$created++;
4849
+									} else {
4850
+										$invalid++;
4851
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4852
+									}
4853
+								}
4854
+							} else {
4855
+								$invalid++;
4856
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4857
+							}
4858
+						}
4859
+					}
4860
+				}
4861 4861
                 
4862
-                $json = array();
4863
-                $json['processed'] = $limit;
4864
-                $json['created'] = $created;
4865
-                $json['updated'] = $updated;
4866
-                $json['skipped'] = $skipped;
4867
-                $json['invalid'] = $invalid;
4868
-                $json['images'] = $images;
4862
+				$json = array();
4863
+				$json['processed'] = $limit;
4864
+				$json['created'] = $created;
4865
+				$json['updated'] = $updated;
4866
+				$json['skipped'] = $skipped;
4867
+				$json['invalid'] = $invalid;
4868
+				$json['images'] = $images;
4869 4869
                 
4870
-                wp_send_json( $json );
4871
-            }
4872
-        }
4873
-        break;
4874
-        case 'import_finish':{
4875
-            /**
4876
-             * Run an action when an import finishes.
4877
-             *
4878
-             * This action can be used to fire functions after an import ends.
4879
-             *
4880
-             * @since 1.5.3
4881
-             * @package GeoDirectory
4882
-             */
4883
-            do_action('geodir_import_finished');
4884
-        }
4885
-        break;
4870
+				wp_send_json( $json );
4871
+			}
4872
+		}
4873
+		break;
4874
+		case 'import_finish':{
4875
+			/**
4876
+			 * Run an action when an import finishes.
4877
+			 *
4878
+			 * This action can be used to fire functions after an import ends.
4879
+			 *
4880
+			 * @since 1.5.3
4881
+			 * @package GeoDirectory
4882
+			 */
4883
+			do_action('geodir_import_finished');
4884
+		}
4885
+		break;
4886 4886
 
4887
-    }
4888
-    echo '0';
4889
-    gd_die();
4887
+	}
4888
+	echo '0';
4889
+	gd_die();
4890 4890
 }
4891 4891
 
4892 4892
 /**
@@ -4930,12 +4930,12 @@  discard block
 block discarded – undo
4930 4930
 		$args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
4931 4931
 	}
4932 4932
 	
4933
-    if( !empty( $term ) ) {
4933
+	if( !empty( $term ) ) {
4934 4934
 		$result = wp_insert_term( $term, $taxonomy, $args );
4935
-        if( !is_wp_error( $result ) ) {
4936
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
4937
-        }
4938
-    }
4935
+		if( !is_wp_error( $result ) ) {
4936
+			return isset( $result['term_id'] ) ? $result['term_id'] : 0;
4937
+		}
4938
+	}
4939 4939
 	
4940 4940
 	return false;
4941 4941
 }
@@ -4981,16 +4981,16 @@  discard block
 block discarded – undo
4981 4981
 		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
4982 4982
 		
4983 4983
 		if( !is_wp_error( $result ) ) {
4984
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
4985
-        }
4984
+			return isset( $result['term_id'] ) ? $result['term_id'] : 0;
4985
+		}
4986 4986
 	} else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4987 4987
 		$term_data['term_id'] = $term_info['term_id'];
4988 4988
 		
4989 4989
 		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
4990 4990
 		
4991 4991
 		if( !is_wp_error( $result ) ) {
4992
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
4993
-        }
4992
+			return isset( $result['term_id'] ) ? $result['term_id'] : 0;
4993
+		}
4994 4994
 	} else {
4995 4995
 		return geodir_imex_insert_term( $taxonomy, $term_data );
4996 4996
 	}
@@ -5012,47 +5012,47 @@  discard block
 block discarded – undo
5012 5012
  * @return int Posts count.
5013 5013
  */
5014 5014
 function geodir_get_posts_count( $post_type ) {
5015
-    global $wpdb, $plugin_prefix;
5015
+	global $wpdb, $plugin_prefix;
5016 5016
 
5017
-    if ( !post_type_exists( $post_type ) ) {
5018
-        return 0;
5019
-    }
5017
+	if ( !post_type_exists( $post_type ) ) {
5018
+		return 0;
5019
+	}
5020 5020
         
5021
-    $table = $plugin_prefix . $post_type . '_detail';
5021
+	$table = $plugin_prefix . $post_type . '_detail';
5022 5022
 
5023
-    // Skip listing with statuses trash, auto-draft etc...
5024
-    $skip_statuses = geodir_imex_export_skip_statuses();
5025
-    $where_statuses = '';
5026
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5027
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5028
-    }
5023
+	// Skip listing with statuses trash, auto-draft etc...
5024
+	$skip_statuses = geodir_imex_export_skip_statuses();
5025
+	$where_statuses = '';
5026
+	if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5027
+		$where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5028
+	}
5029 5029
     
5030
-    /**
5031
-     * Filter the SQL where clause part to filter posts count in import/export.
5032
-     *
5033
-     * @since 1.6.4
5034
-     * @package GeoDirectory
5035
-     *
5036
-     * @param string $where SQL where clause part.
5037
-     */
5038
-    $where_statuses = apply_filters( 'geodir_get_posts_count', $where_statuses, $post_type );
5039
-
5040
-    $query = $wpdb->prepare( "SELECT COUNT({$wpdb->posts}.ID) FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses, $post_type );
5041
-
5042
-    $posts_count = (int)$wpdb->get_var( $query );
5030
+	/**
5031
+	 * Filter the SQL where clause part to filter posts count in import/export.
5032
+	 *
5033
+	 * @since 1.6.4
5034
+	 * @package GeoDirectory
5035
+	 *
5036
+	 * @param string $where SQL where clause part.
5037
+	 */
5038
+	$where_statuses = apply_filters( 'geodir_get_posts_count', $where_statuses, $post_type );
5039
+
5040
+	$query = $wpdb->prepare( "SELECT COUNT({$wpdb->posts}.ID) FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses, $post_type );
5041
+
5042
+	$posts_count = (int)$wpdb->get_var( $query );
5043 5043
     
5044
-    /**
5045
-     * Modify returned post counts for the current post type.
5046
-     *
5047
-     * @since 1.4.6
5048
-     * @package GeoDirectory
5049
-     *
5050
-     * @param int $posts_count Post counts.
5051
-     * @param string $post_type Post type.
5052
-     */
5053
-    $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );
5054
-
5055
-    return $posts_count;
5044
+	/**
5045
+	 * Modify returned post counts for the current post type.
5046
+	 *
5047
+	 * @since 1.4.6
5048
+	 * @package GeoDirectory
5049
+	 *
5050
+	 * @param int $posts_count Post counts.
5051
+	 * @param string $post_type Post type.
5052
+	 */
5053
+	$posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );
5054
+
5055
+	return $posts_count;
5056 5056
 }
5057 5057
 
5058 5058
 /**
@@ -5120,7 +5120,7 @@  discard block
 block discarded – undo
5120 5120
 		}
5121 5121
 		$csv_row[] = 'post_status';
5122 5122
 		$csv_row[] = 'is_featured';
5123
-        // Export claim listing field
5123
+		// Export claim listing field
5124 5124
 		if ($is_claim_active) {
5125 5125
 			$csv_row[] = 'claimed';
5126 5126
 		}
@@ -5129,7 +5129,7 @@  discard block
 block discarded – undo
5129 5129
 			$csv_row[] = 'alive_days';
5130 5130
 			$csv_row[] = 'expire_date';
5131 5131
 		}
5132
-        $csv_row[] = 'post_date';
5132
+		$csv_row[] = 'post_date';
5133 5133
 		$csv_row[] = 'post_address';
5134 5134
 		$csv_row[] = 'post_city';
5135 5135
 		$csv_row[] = 'post_region';
@@ -5137,11 +5137,11 @@  discard block
 block discarded – undo
5137 5137
 		$csv_row[] = 'post_zip';
5138 5138
 		$csv_row[] = 'post_latitude';
5139 5139
 		$csv_row[] = 'post_longitude';
5140
-        if ($neighbourhood_active) {
5141
-            $csv_row[] = 'post_neighbourhood';
5142
-            $csv_row[] = 'neighbourhood_latitude';
5143
-            $csv_row[] = 'neighbourhood_longitude';
5144
-        }
5140
+		if ($neighbourhood_active) {
5141
+			$csv_row[] = 'post_neighbourhood';
5142
+			$csv_row[] = 'neighbourhood_latitude';
5143
+			$csv_row[] = 'neighbourhood_longitude';
5144
+		}
5145 5145
 		$csv_row[] = 'geodir_timing';
5146 5146
 		$csv_row[] = 'geodir_contact';
5147 5147
 		$csv_row[] = 'geodir_email';
@@ -5176,21 +5176,21 @@  discard block
 block discarded – undo
5176 5176
 			$csv_row[] = 'franchise';
5177 5177
 		}
5178 5178
         
5179
-        /**
5180
-         * Filter columns field names of gd export listings csv.
5181
-         *
5182
-         * @since 1.6.5
5183
-         * @package GeoDirectory
5184
-         *
5185
-         * @param array $csv_row Column names being exported in csv.
5186
-         * @param string $post_type The post type.
5187
-         */
5188
-        $csv_row = apply_filters('geodir_export_listing_csv_column_names', $csv_row, $post_type);
5179
+		/**
5180
+		 * Filter columns field names of gd export listings csv.
5181
+		 *
5182
+		 * @since 1.6.5
5183
+		 * @package GeoDirectory
5184
+		 *
5185
+		 * @param array $csv_row Column names being exported in csv.
5186
+		 * @param string $post_type The post type.
5187
+		 */
5188
+		$csv_row = apply_filters('geodir_export_listing_csv_column_names', $csv_row, $post_type);
5189 5189
 		
5190 5190
 		$csv_rows[] = $csv_row;
5191 5191
 
5192 5192
 		$images_count = 5;
5193
-        $xx=0;
5193
+		$xx=0;
5194 5194
 		foreach ( $posts as $post ) {$xx++;
5195 5195
 			$post_id = $post['ID'];
5196 5196
 			
@@ -5321,15 +5321,15 @@  discard block
 block discarded – undo
5321 5321
 			}
5322 5322
 			$csv_row[] = $post_info['post_status']; // post_status
5323 5323
 			$csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured
5324
-            if ($is_claim_active) {
5325
-                $csv_row[] = !empty($post_info['claimed']) && (int)$post_info['claimed'] == 1 ? 1 : ''; // claimed
5326
-            }
5324
+			if ($is_claim_active) {
5325
+				$csv_row[] = !empty($post_info['claimed']) && (int)$post_info['claimed'] == 1 ? 1 : ''; // claimed
5326
+			}
5327 5327
 			if ($is_payment_plugin) {
5328 5328
 				$csv_row[] = (int)$post_info['package_id']; // package_id
5329 5329
 				$csv_row[] = $post_info['alive_days'] !== '' ? absint($post_info['alive_days']) : ''; // alive_days
5330 5330
 				$csv_row[] = $post_info['expire_date'] != '' && geodir_strtolower($post_info['expire_date']) != 'never' ? date_i18n('Y-m-d', strtotime($post_info['expire_date'])) : 'Never'; // expire_date
5331 5331
 			}
5332
-            $csv_row[] = $post_info['post_date']; // post_date
5332
+			$csv_row[] = $post_info['post_date']; // post_date
5333 5333
 			$csv_row[] = stripslashes($post_info['post_address']); // post_address
5334 5334
 			$csv_row[] = stripslashes($post_info['post_city']); // post_city
5335 5335
 			$csv_row[] = stripslashes($post_info['post_region']); // post_region
@@ -5337,21 +5337,21 @@  discard block
 block discarded – undo
5337 5337
 			$csv_row[] = stripslashes($post_info['post_zip']); // post_zip
5338 5338
 			$csv_row[] = $post_info['post_latitude']; // post_latitude
5339 5339
 			$csv_row[] = $post_info['post_longitude']; // post_longitude
5340
-            if ($neighbourhood_active) {
5341
-                $post_neighbourhood = '';
5342
-                $neighbourhood_latitude = '';
5343
-                $neighbourhood_longitude = '';
5344
-                if (!empty($post_info['post_neighbourhood']) && ($hood_info = geodir_location_get_neighbourhood_by_id($post_info['post_neighbourhood'], true, $post_info['post_location_id']))) {
5345
-                    if (!empty($hood_info)) {
5346
-                        $post_neighbourhood = $hood_info->hood_name;
5347
-                        $neighbourhood_latitude = $hood_info->hood_latitude;
5348
-                        $neighbourhood_longitude = $hood_info->hood_longitude;
5349
-                    }
5350
-                }
5351
-                $csv_row[] = stripslashes($post_neighbourhood); // post_neighbourhood
5352
-                $csv_row[] = $neighbourhood_latitude; // neighbourhood_latitude
5353
-                $csv_row[] = $neighbourhood_longitude; // neighbourhood_longitude
5354
-            }
5340
+			if ($neighbourhood_active) {
5341
+				$post_neighbourhood = '';
5342
+				$neighbourhood_latitude = '';
5343
+				$neighbourhood_longitude = '';
5344
+				if (!empty($post_info['post_neighbourhood']) && ($hood_info = geodir_location_get_neighbourhood_by_id($post_info['post_neighbourhood'], true, $post_info['post_location_id']))) {
5345
+					if (!empty($hood_info)) {
5346
+						$post_neighbourhood = $hood_info->hood_name;
5347
+						$neighbourhood_latitude = $hood_info->hood_latitude;
5348
+						$neighbourhood_longitude = $hood_info->hood_longitude;
5349
+					}
5350
+				}
5351
+				$csv_row[] = stripslashes($post_neighbourhood); // post_neighbourhood
5352
+				$csv_row[] = $neighbourhood_latitude; // neighbourhood_latitude
5353
+				$csv_row[] = $neighbourhood_longitude; // neighbourhood_longitude
5354
+			}
5355 5355
 			$csv_row[] = stripslashes($post_info['geodir_timing']); // geodir_timing
5356 5356
 			$csv_row[] = stripslashes($post_info['geodir_contact']); // geodir_contact
5357 5357
 			$csv_row[] = stripslashes($post_info['geodir_email']); // geodir_email
@@ -5394,16 +5394,16 @@  discard block
 block discarded – undo
5394 5394
 				$csv_row[] = (int)$franchise; // franchise id
5395 5395
 			}
5396 5396
             
5397
-            /**
5398
-             * Filter columns values of gd export listings csv file
5399
-             *
5400
-             * @since 1.6.5
5401
-             * @package GeoDirectory
5402
-             *
5403
-             * @param array $csv_row Field values being exported in csv.
5404
-             * @param array $post_info The post info.
5405
-             */
5406
-            $csv_row = apply_filters('geodir_export_listing_csv_column_values', $csv_row, $post_info);
5397
+			/**
5398
+			 * Filter columns values of gd export listings csv file
5399
+			 *
5400
+			 * @since 1.6.5
5401
+			 * @package GeoDirectory
5402
+			 *
5403
+			 * @param array $csv_row Field values being exported in csv.
5404
+			 * @param array $post_info The post info.
5405
+			 */
5406
+			$csv_row = apply_filters('geodir_export_listing_csv_column_values', $csv_row, $post_info);
5407 5407
 			
5408 5408
 			for ( $c = 0; $c < $images_count; $c++ ) {
5409 5409
 				$csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE
@@ -5436,64 +5436,64 @@  discard block
 block discarded – undo
5436 5436
  * @return array Array of posts data.
5437 5437
  */
5438 5438
 function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
5439
-    global $wpdb, $plugin_prefix;
5439
+	global $wpdb, $plugin_prefix;
5440 5440
 
5441
-    if ( ! post_type_exists( $post_type ) )
5442
-        return new stdClass;
5441
+	if ( ! post_type_exists( $post_type ) )
5442
+		return new stdClass;
5443 5443
         
5444
-    $table = $plugin_prefix . $post_type . '_detail';
5444
+	$table = $plugin_prefix . $post_type . '_detail';
5445 5445
 
5446
-    $limit = '';
5447
-    if ( $per_page > 0 && $page_no > 0 ) {
5448
-        $offset = ( $page_no - 1 ) * $per_page;
5446
+	$limit = '';
5447
+	if ( $per_page > 0 && $page_no > 0 ) {
5448
+		$offset = ( $page_no - 1 ) * $per_page;
5449 5449
         
5450
-        if ( $offset > 0 ) {
5451
-            $limit = " LIMIT " . $offset . "," . $per_page;
5452
-        } else {
5453
-            $limit = " LIMIT " . $per_page;
5454
-        }
5455
-    }
5450
+		if ( $offset > 0 ) {
5451
+			$limit = " LIMIT " . $offset . "," . $per_page;
5452
+		} else {
5453
+			$limit = " LIMIT " . $per_page;
5454
+		}
5455
+	}
5456 5456
 
5457
-    // Skip listing with statuses trash, auto-draft etc...
5458
-    $skip_statuses = geodir_imex_export_skip_statuses();
5459
-    $where_statuses = '';
5460
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5461
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5462
-    }
5457
+	// Skip listing with statuses trash, auto-draft etc...
5458
+	$skip_statuses = geodir_imex_export_skip_statuses();
5459
+	$where_statuses = '';
5460
+	if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5461
+		$where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5462
+	}
5463 5463
     
5464
-    /**
5465
-     * Filter the SQL where clause part to filter posts in import/export.
5466
-     *
5467
-     * @since 1.6.4
5468
-     * @package GeoDirectory
5469
-     *
5470
-     * @param string $where SQL where clause part.
5471
-     */
5472
-    $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5473
-
5474
-    $query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " ORDER BY {$wpdb->posts}.ID ASC" . $limit, $post_type );
5475
-    /**
5476
-     * Modify returned posts SQL query for the current post type.
5477
-     *
5478
-     * @since 1.4.6
5479
-     * @package GeoDirectory
5480
-     *
5481
-     * @param int $query The SQL query.
5482
-     * @param string $post_type Post type.
5483
-     */
5484
-    $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
5485
-    $results = (array)$wpdb->get_results( $query, ARRAY_A );
5486
-
5487
-    /**
5488
-     * Modify returned post results for the current post type.
5489
-     *
5490
-     * @since 1.4.6
5491
-     * @package GeoDirectory
5492
-     *
5493
-     * @param object $results An object containing all post ids.
5494
-     * @param string $post_type Post type.
5495
-     */
5496
-    return apply_filters( 'geodir_export_posts', $results, $post_type );
5464
+	/**
5465
+	 * Filter the SQL where clause part to filter posts in import/export.
5466
+	 *
5467
+	 * @since 1.6.4
5468
+	 * @package GeoDirectory
5469
+	 *
5470
+	 * @param string $where SQL where clause part.
5471
+	 */
5472
+	$where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5473
+
5474
+	$query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " ORDER BY {$wpdb->posts}.ID ASC" . $limit, $post_type );
5475
+	/**
5476
+	 * Modify returned posts SQL query for the current post type.
5477
+	 *
5478
+	 * @since 1.4.6
5479
+	 * @package GeoDirectory
5480
+	 *
5481
+	 * @param int $query The SQL query.
5482
+	 * @param string $post_type Post type.
5483
+	 */
5484
+	$query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
5485
+	$results = (array)$wpdb->get_results( $query, ARRAY_A );
5486
+
5487
+	/**
5488
+	 * Modify returned post results for the current post type.
5489
+	 *
5490
+	 * @since 1.4.6
5491
+	 * @package GeoDirectory
5492
+	 *
5493
+	 * @param object $results An object containing all post ids.
5494
+	 * @param string $post_type Post type.
5495
+	 */
5496
+	return apply_filters( 'geodir_export_posts', $results, $post_type );
5497 5497
 }
5498 5498
 
5499 5499
 /**
@@ -5512,26 +5512,26 @@  discard block
 block discarded – undo
5512 5512
  * @return string The SQL query.
5513 5513
  */
5514 5514
 function geodir_imex_get_events_query( $query, $post_type ) {
5515
-    if ( $post_type == 'gd_event' ) {
5516
-        global $wpdb, $plugin_prefix;
5515
+	if ( $post_type == 'gd_event' ) {
5516
+		global $wpdb, $plugin_prefix;
5517 5517
         
5518
-        $table = $plugin_prefix . $post_type . '_detail';
5519
-        $schedule_table = EVENT_SCHEDULE;
5518
+		$table = $plugin_prefix . $post_type . '_detail';
5519
+		$schedule_table = EVENT_SCHEDULE;
5520 5520
         
5521
-        // Skip listing with statuses trash, auto-draft etc...
5522
-        $skip_statuses = geodir_imex_export_skip_statuses();
5523
-        $where_statuses = '';
5524
-        if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5525
-            $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5526
-        }
5521
+		// Skip listing with statuses trash, auto-draft etc...
5522
+		$skip_statuses = geodir_imex_export_skip_statuses();
5523
+		$where_statuses = '';
5524
+		if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5525
+			$where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5526
+		}
5527 5527
         
5528
-        /** This action is documented in geodirectory-functions/geodirectory-admin/admin_functions.php */
5529
-        $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5528
+		/** This action is documented in geodirectory-functions/geodirectory-admin/admin_functions.php */
5529
+		$where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5530 5530
 
5531
-        $query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC", $post_type );
5532
-    }
5531
+		$query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC", $post_type );
5532
+	}
5533 5533
 
5534
-    return $query;
5534
+	return $query;
5535 5535
 }
5536 5536
 
5537 5537
 /**
@@ -5553,36 +5553,36 @@  discard block
 block discarded – undo
5553 5553
  * @return int Total terms count.
5554 5554
  */
5555 5555
 function geodir_get_terms_count( $post_type ) {
5556
-    $args = array( 'hide_empty' => 0 );
5556
+	$args = array( 'hide_empty' => 0 );
5557 5557
 
5558
-    remove_all_filters( 'get_terms' );
5558
+	remove_all_filters( 'get_terms' );
5559 5559
 
5560
-    $taxonomy = $post_type . 'category';
5560
+	$taxonomy = $post_type . 'category';
5561 5561
 
5562
-    // WPML
5563
-    $is_wpml = geodir_is_wpml();
5564
-    $active_lang = 'all';
5565
-    if ( $is_wpml ) {
5566
-        global $sitepress;
5567
-        $active_lang = $sitepress->get_current_language();
5562
+	// WPML
5563
+	$is_wpml = geodir_is_wpml();
5564
+	$active_lang = 'all';
5565
+	if ( $is_wpml ) {
5566
+		global $sitepress;
5567
+		$active_lang = $sitepress->get_current_language();
5568 5568
         
5569
-        if ( $active_lang != 'all' ) {
5570
-            $sitepress->switch_lang( 'all', true );
5571
-        }
5572
-    }
5573
-    // WPML
5569
+		if ( $active_lang != 'all' ) {
5570
+			$sitepress->switch_lang( 'all', true );
5571
+		}
5572
+	}
5573
+	// WPML
5574 5574
             
5575
-    $count_terms = wp_count_terms( $taxonomy, $args );
5575
+	$count_terms = wp_count_terms( $taxonomy, $args );
5576 5576
 
5577
-    // WPML
5578
-    if ( $is_wpml && $active_lang !== 'all' ) {
5579
-        global $sitepress;
5580
-        $sitepress->switch_lang( $active_lang, true );
5581
-    }
5582
-    // WPML
5583
-    $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
5577
+	// WPML
5578
+	if ( $is_wpml && $active_lang !== 'all' ) {
5579
+		global $sitepress;
5580
+		$sitepress->switch_lang( $active_lang, true );
5581
+	}
5582
+	// WPML
5583
+	$count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
5584 5584
      
5585
-    return $count_terms;
5585
+	return $count_terms;
5586 5586
 }
5587 5587
 
5588 5588
 /**
@@ -5621,11 +5621,11 @@  discard block
 block discarded – undo
5621 5621
 		$csv_row[] = 'cat_posttype';
5622 5622
 		$csv_row[] = 'cat_parent';
5623 5623
 		$csv_row[] = 'cat_schema';
5624
-        // WPML
5624
+		// WPML
5625 5625
 		$is_wpml = geodir_is_wpml();
5626 5626
 		if ($is_wpml) {
5627 5627
 			$csv_row[] = 'cat_language';
5628
-            $csv_row[] = 'cat_id_original';
5628
+			$csv_row[] = 'cat_id_original';
5629 5629
 		}
5630 5630
 		// WPML
5631 5631
 		$csv_row[] = 'cat_description';
@@ -5655,10 +5655,10 @@  discard block
 block discarded – undo
5655 5655
 			$csv_row[] = $post_type;
5656 5656
 			$csv_row[] = $cat_parent;
5657 5657
 			$csv_row[] = geodir_get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type );
5658
-            // WPML
5658
+			// WPML
5659 5659
 			if ($is_wpml) {
5660 5660
 				$csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy );
5661
-                $csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy );
5661
+				$csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy );
5662 5662
 			}
5663 5663
 			// WPML
5664 5664
 			$csv_row[] = $term->description;
@@ -6076,43 +6076,43 @@  discard block
 block discarded – undo
6076 6076
  * @param string $status Post status.
6077 6077
  */
6078 6078
 function geodir_create_page($slug, $option, $page_title = '', $page_content = '', $post_parent = 0, $status = 'publish') {
6079
-    global $wpdb, $current_user;
6080
-
6081
-    $option_value = get_option($option);
6082
-
6083
-    if ($option_value > 0) :
6084
-        if (get_post($option_value)) :
6085
-            // Page exists
6086
-            return;
6087
-        endif;
6088
-    endif;
6089
-
6090
-    $page_found = $wpdb->get_var(
6091
-        $wpdb->prepare(
6092
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6093
-            array($slug)
6094
-        )
6095
-    );
6096
-
6097
-    if ($page_found) :
6098
-        // Page exists
6099
-        if (!$option_value) update_option($option, $page_found);
6100
-        return;
6101
-    endif;
6102
-
6103
-    $page_data = array(
6104
-        'post_status' => $status,
6105
-        'post_type' => 'page',
6106
-        'post_author' => $current_user->ID,
6107
-        'post_name' => $slug,
6108
-        'post_title' => $page_title,
6109
-        'post_content' => $page_content,
6110
-        'post_parent' => $post_parent,
6111
-        'comment_status' => 'closed'
6112
-    );
6113
-    $page_id = wp_insert_post($page_data);
6114
-
6115
-    add_option($option, $page_id);
6079
+	global $wpdb, $current_user;
6080
+
6081
+	$option_value = get_option($option);
6082
+
6083
+	if ($option_value > 0) :
6084
+		if (get_post($option_value)) :
6085
+			// Page exists
6086
+			return;
6087
+		endif;
6088
+	endif;
6089
+
6090
+	$page_found = $wpdb->get_var(
6091
+		$wpdb->prepare(
6092
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6093
+			array($slug)
6094
+		)
6095
+	);
6096
+
6097
+	if ($page_found) :
6098
+		// Page exists
6099
+		if (!$option_value) update_option($option, $page_found);
6100
+		return;
6101
+	endif;
6102
+
6103
+	$page_data = array(
6104
+		'post_status' => $status,
6105
+		'post_type' => 'page',
6106
+		'post_author' => $current_user->ID,
6107
+		'post_name' => $slug,
6108
+		'post_title' => $page_title,
6109
+		'post_content' => $page_content,
6110
+		'post_parent' => $post_parent,
6111
+		'comment_status' => 'closed'
6112
+	);
6113
+	$page_id = wp_insert_post($page_data);
6114
+
6115
+	add_option($option, $page_id);
6116 6116
 
6117 6117
 }
6118 6118
 
@@ -6143,9 +6143,9 @@  discard block
 block discarded – undo
6143 6143
  * @package GeoDirectory
6144 6144
  */
6145 6145
 function geodir_admin_upgrade_notice() {
6146
-    $class = "error";
6147
-    $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6148
-    echo"<div class=\"$class\"> <p>$message</p></div>";
6146
+	$class = "error";
6147
+	$message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6148
+	echo"<div class=\"$class\"> <p>$message</p></div>";
6149 6149
 }
6150 6150
 
6151 6151
 /**
@@ -6158,18 +6158,18 @@  discard block
 block discarded – undo
6158 6158
  */
6159 6159
 function geodire_admin_upgrade_notice( $plugin_data, $r )
6160 6160
 {
6161
-    // readme contents
6162
-    $args = array(
6163
-        'timeout'     => 15,
6164
-        'redirection' => 5
6165
-    );
6166
-    $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6167
-    $data       = wp_remote_get( $url, $args );
6161
+	// readme contents
6162
+	$args = array(
6163
+		'timeout'     => 15,
6164
+		'redirection' => 5
6165
+	);
6166
+	$url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6167
+	$data       = wp_remote_get( $url, $args );
6168 6168
 
6169
-    if (!is_wp_error($data) && $data['response']['code'] == 200) {
6169
+	if (!is_wp_error($data) && $data['response']['code'] == 200) {
6170 6170
 
6171
-        geodir_in_plugin_update_message($data['body']);
6172
-    }
6171
+		geodir_in_plugin_update_message($data['body']);
6172
+	}
6173 6173
 }
6174 6174
 
6175 6175
 
@@ -6177,28 +6177,28 @@  discard block
 block discarded – undo
6177 6177
 * @param string $content http response body
6178 6178
 */
6179 6179
 function geodir_in_plugin_update_message($content) {
6180
-    // Output Upgrade Notice
6181
-    $matches        = null;
6182
-    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6183
-    $upgrade_notice = '';
6184
-    if ( preg_match( $regexp, $content, $matches ) ) {
6185
-        if(empty($matches)){return;}
6186
-
6187
-        $version = trim( $matches[1] );
6188
-        if($version && $version>GEODIRECTORY_VERSION){
6189
-
6190
-
6191
-        $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6192
-        if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6193
-            $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6194
-            foreach ( $notices as $index => $line ) {
6195
-                $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6196
-            }
6197
-            $upgrade_notice .= '</div> ';
6198
-        }
6199
-        }
6200
-    }
6201
-    echo $upgrade_notice;
6180
+	// Output Upgrade Notice
6181
+	$matches        = null;
6182
+	$regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6183
+	$upgrade_notice = '';
6184
+	if ( preg_match( $regexp, $content, $matches ) ) {
6185
+		if(empty($matches)){return;}
6186
+
6187
+		$version = trim( $matches[1] );
6188
+		if($version && $version>GEODIRECTORY_VERSION){
6189
+
6190
+
6191
+		$notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6192
+		if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6193
+			$upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6194
+			foreach ( $notices as $index => $line ) {
6195
+				$upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6196
+			}
6197
+			$upgrade_notice .= '</div> ';
6198
+		}
6199
+		}
6200
+	}
6201
+	echo $upgrade_notice;
6202 6202
 }
6203 6203
 
6204 6204
 /**
@@ -6231,19 +6231,19 @@  discard block
 block discarded – undo
6231 6231
  * @param array Listing statuses to be skipped.
6232 6232
  */
6233 6233
 function geodir_imex_export_skip_statuses() {
6234
-    $statuses = array( 'trash', 'auto-draft' );
6234
+	$statuses = array( 'trash', 'auto-draft' );
6235 6235
     
6236
-    /**
6237
-     * Filter the statuses to skip during GD export listings.
6238
-     *
6239
-     * @since 1.6.0
6240
-     * @package GeoDirectory
6241
-     *
6242
-     * @param array $statuses Listing statuses to be skipped.
6243
-     */
6244
-    $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses );
6236
+	/**
6237
+	 * Filter the statuses to skip during GD export listings.
6238
+	 *
6239
+	 * @since 1.6.0
6240
+	 * @package GeoDirectory
6241
+	 *
6242
+	 * @param array $statuses Listing statuses to be skipped.
6243
+	 */
6244
+	$statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses );
6245 6245
      
6246
-    return $statuses;
6246
+	return $statuses;
6247 6247
 }
6248 6248
 
6249 6249
 /**
@@ -6259,42 +6259,42 @@  discard block
 block discarded – undo
6259 6259
  * @global string $typenow Current post type.
6260 6260
  */
6261 6261
 function geodir_admin_dequeue_scripts() {
6262
-    global $typenow;
6262
+	global $typenow;
6263 6263
     
6264
-    // EDD
6265
-    if (wp_script_is('jquery-chosen', 'enqueued')) {
6266
-        wp_dequeue_script('jquery-chosen');
6267
-    }
6264
+	// EDD
6265
+	if (wp_script_is('jquery-chosen', 'enqueued')) {
6266
+		wp_dequeue_script('jquery-chosen');
6267
+	}
6268 6268
     
6269
-    // Ultimate Addons for Visual Composer
6270
-    if (wp_script_is('ultimate-vc-backend-script', 'enqueued')) {
6271
-        wp_dequeue_script('ultimate-vc-backend-script');
6272
-    }
6269
+	// Ultimate Addons for Visual Composer
6270
+	if (wp_script_is('ultimate-vc-backend-script', 'enqueued')) {
6271
+		wp_dequeue_script('ultimate-vc-backend-script');
6272
+	}
6273 6273
     
6274
-    // VC editor conflicts
6275
-    if (class_exists('Vc_Role_Access_Controller') && wp_script_is('dfd_vc_damin_scripts', 'enqueued')) {
6276
-        wp_dequeue_script('dfd_vc_damin_scripts');
6277
-    }
6274
+	// VC editor conflicts
6275
+	if (class_exists('Vc_Role_Access_Controller') && wp_script_is('dfd_vc_damin_scripts', 'enqueued')) {
6276
+		wp_dequeue_script('dfd_vc_damin_scripts');
6277
+	}
6278 6278
     
6279
-    // Ultimate chosen
6280
-    if (wp_script_is('ultimate-chosen-script', 'enqueued')) {
6281
-        wp_dequeue_script('ultimate-chosen-script');
6282
-    }
6279
+	// Ultimate chosen
6280
+	if (wp_script_is('ultimate-chosen-script', 'enqueued')) {
6281
+		wp_dequeue_script('ultimate-chosen-script');
6282
+	}
6283 6283
     
6284
-    // Crum composer choosen
6285
-    if (wp_script_is('crum-composer-choosen', 'enqueued')) {
6286
-        wp_dequeue_script('crum-composer-choosen');
6287
-    }
6284
+	// Crum composer choosen
6285
+	if (wp_script_is('crum-composer-choosen', 'enqueued')) {
6286
+		wp_dequeue_script('crum-composer-choosen');
6287
+	}
6288 6288
     
6289
-    // Fix conflict Fusion Builder jquery chosen with GD jquery chosen.
6290
-    if (class_exists('FusionBuilder') && wp_script_is('fusion_builder_chosen_js', 'enqueued')) {
6291
-        wp_dequeue_script('fusion_builder_chosen_js');
6292
-    }
6289
+	// Fix conflict Fusion Builder jquery chosen with GD jquery chosen.
6290
+	if (class_exists('FusionBuilder') && wp_script_is('fusion_builder_chosen_js', 'enqueued')) {
6291
+		wp_dequeue_script('fusion_builder_chosen_js');
6292
+	}
6293 6293
     
6294
-    // Fix conflicts timepicker & setting date value.
6295
-    if (class_exists('acf') && wp_script_is('acf-timepicker', 'enqueued')) {
6296
-        wp_dequeue_script('acf-timepicker');
6297
-    }
6294
+	// Fix conflicts timepicker & setting date value.
6295
+	if (class_exists('acf') && wp_script_is('acf-timepicker', 'enqueued')) {
6296
+		wp_dequeue_script('acf-timepicker');
6297
+	}
6298 6298
 }
6299 6299
 
6300 6300
 /**
@@ -6310,48 +6310,48 @@  discard block
 block discarded – undo
6310 6310
  * @return string SQL where clause part.
6311 6311
  */
6312 6312
 function geodir_imex_get_filter_where($where = '', $post_type = '') {
6313
-    global $wpdb;
6313
+	global $wpdb;
6314 6314
     
6315
-    $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
6315
+	$filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
6316 6316
     
6317
-    if ( !empty( $filters ) ) {
6318
-        foreach ( $filters as $field => $value ) {
6319
-            switch ($field) {
6320
-                case 'start_date':
6321
-                    $where .= " AND `" . $wpdb->posts . "`.`post_date` >= '" . sanitize_text_field( $value ) . " 00:00:00'";
6322
-                break;
6323
-                case 'end_date':
6324
-                    $where .= " AND `" . $wpdb->posts . "`.`post_date` <= '" . sanitize_text_field( $value ) . " 23:59:59'";
6325
-                break;
6326
-            }
6327
-        }
6328
-    }
6317
+	if ( !empty( $filters ) ) {
6318
+		foreach ( $filters as $field => $value ) {
6319
+			switch ($field) {
6320
+				case 'start_date':
6321
+					$where .= " AND `" . $wpdb->posts . "`.`post_date` >= '" . sanitize_text_field( $value ) . " 00:00:00'";
6322
+				break;
6323
+				case 'end_date':
6324
+					$where .= " AND `" . $wpdb->posts . "`.`post_date` <= '" . sanitize_text_field( $value ) . " 23:59:59'";
6325
+				break;
6326
+			}
6327
+		}
6328
+	}
6329 6329
     
6330
-    return $where;
6330
+	return $where;
6331 6331
 }
6332 6332
 add_filter('geodir_get_posts_count', 'geodir_imex_get_filter_where', 10, 2);
6333 6333
 add_filter('geodir_get_export_posts', 'geodir_imex_get_filter_where', 10, 2);
6334 6334
 
6335 6335
 
6336 6336
 function geodir_fix_for_primer_theme(){
6337
-    if(!defined( 'PRIMER_VERSION' )){return;}
6338
-    global $pagenow;
6337
+	if(!defined( 'PRIMER_VERSION' )){return;}
6338
+	global $pagenow;
6339 6339
 
6340
-    if ( ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) && (isset($_REQUEST['post_type']) || isset($_REQUEST['post']) )  ){
6340
+	if ( ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) && (isset($_REQUEST['post_type']) || isset($_REQUEST['post']) )  ){
6341 6341
 
6342
-        $post_type = isset($_REQUEST['post_type']) ? esc_attr($_REQUEST['post_type']) : get_post_type( $_GET['post'] );
6342
+		$post_type = isset($_REQUEST['post_type']) ? esc_attr($_REQUEST['post_type']) : get_post_type( $_GET['post'] );
6343 6343
 
6344
-        $post_types = geodir_get_posttypes();
6345
-        if ($post_type && in_array($post_type, $post_types) ) {
6346
-            global $primer_customizer_layouts;
6347
-            remove_action( 'add_meta_boxes', array( $primer_customizer_layouts, 'add_meta_box' ), 10);
6348
-        }
6349
-    }
6344
+		$post_types = geodir_get_posttypes();
6345
+		if ($post_type && in_array($post_type, $post_types) ) {
6346
+			global $primer_customizer_layouts;
6347
+			remove_action( 'add_meta_boxes', array( $primer_customizer_layouts, 'add_meta_box' ), 10);
6348
+		}
6349
+	}
6350 6350
 
6351 6351
 }
6352 6352
 
6353 6353
 if(is_admin()){
6354
-    add_action('add_meta_boxes','geodir_fix_for_primer_theme',0);  
6354
+	add_action('add_meta_boxes','geodir_fix_for_primer_theme',0);  
6355 6355
 }
6356 6356
 
6357 6357
 
@@ -6484,96 +6484,96 @@  discard block
 block discarded – undo
6484 6484
 
6485 6485
 function geodir_ga_activation_url() {
6486 6486
 
6487
-    return add_query_arg( array(
6488
-        'next'          => admin_url("admin.php?page=geodirectory&active_tab=google_analytic_settings"),
6489
-        'scope'         => GEODIR_GA_SCOPE,
6490
-        'response_type' => 'code',
6491
-        'redirect_uri'  => GEODIR_GA_REDIRECT,
6492
-        'client_id'     => GEODIR_GA_CLIENTID,
6493
-    ), 'https://accounts.google.com/o/oauth2/auth' );
6487
+	return add_query_arg( array(
6488
+		'next'          => admin_url("admin.php?page=geodirectory&active_tab=google_analytic_settings"),
6489
+		'scope'         => GEODIR_GA_SCOPE,
6490
+		'response_type' => 'code',
6491
+		'redirect_uri'  => GEODIR_GA_REDIRECT,
6492
+		'client_id'     => GEODIR_GA_CLIENTID,
6493
+	), 'https://accounts.google.com/o/oauth2/auth' );
6494 6494
 
6495
-    return $url;
6495
+	return $url;
6496 6496
 }
6497 6497
 
6498 6498
 function geodir_gd_accounts(){
6499
-    $accounts = array();
6500
-    $useAuth = ( get_option( 'geodir_ga_auth_code' ) == '' ? false : true );
6501
-    if($useAuth){
6502
-        try {
6503
-            $accounts = geodir_ga_get_analytics_accounts();
6504
-        } catch (Exception $e) {
6505
-            geodir_error_log( wp_sprintf( __( 'GD Google Analytics API Error(%s) : %s', 'geodirectory' ), $e->getCode(), $e->getMessage() ) );
6506
-        }
6499
+	$accounts = array();
6500
+	$useAuth = ( get_option( 'geodir_ga_auth_code' ) == '' ? false : true );
6501
+	if($useAuth){
6502
+		try {
6503
+			$accounts = geodir_ga_get_analytics_accounts();
6504
+		} catch (Exception $e) {
6505
+			geodir_error_log( wp_sprintf( __( 'GD Google Analytics API Error(%s) : %s', 'geodirectory' ), $e->getCode(), $e->getMessage() ) );
6506
+		}
6507 6507
         
6508
-        if(is_array($accounts)){
6509
-            $accounts = array_merge(array(__('Select Account','geodirectory')),$accounts);
6510
-        }elseif(get_option('geodir_ga_account_id')){
6511
-            $accounts = array();
6512
-            $accounts[get_option('geodir_ga_account_id')] = __('Account re-authorization may be required','geodirectory').' ('.get_option('geodir_ga_account_id').')';
6513
-        }
6514
-    }
6515
-    return $accounts;
6508
+		if(is_array($accounts)){
6509
+			$accounts = array_merge(array(__('Select Account','geodirectory')),$accounts);
6510
+		}elseif(get_option('geodir_ga_account_id')){
6511
+			$accounts = array();
6512
+			$accounts[get_option('geodir_ga_account_id')] = __('Account re-authorization may be required','geodirectory').' ('.get_option('geodir_ga_account_id').')';
6513
+		}
6514
+	}
6515
+	return $accounts;
6516 6516
 }
6517 6517
 
6518 6518
 function geodir_ga_get_analytics_accounts()
6519 6519
 {
6520
-    global $gd_ga_errors;
6521
-    $accounts = array();
6520
+	global $gd_ga_errors;
6521
+	$accounts = array();
6522 6522
 
6523
-    if(get_option('geodir_ga_auth_token')===false){update_option('geodir_ga_auth_token','');}
6523
+	if(get_option('geodir_ga_auth_token')===false){update_option('geodir_ga_auth_token','');}
6524 6524
 
6525 6525
 
6526
-    if(get_option('geodir_gd_uids') && !isset($_POST['geodir_ga_auth_code'])){
6527
-      return get_option('geodir_gd_uids');
6528
-    }
6526
+	if(get_option('geodir_gd_uids') && !isset($_POST['geodir_ga_auth_code'])){
6527
+	  return get_option('geodir_gd_uids');
6528
+	}
6529 6529
 
6530
-    # Create a new Gdata call
6531
-    if ( trim(get_option('geodir_ga_auth_code')) != '' )
6532
-        $stats = new GDGoogleAnalyticsStats();
6533
-    else
6534
-        return false;
6530
+	# Create a new Gdata call
6531
+	if ( trim(get_option('geodir_ga_auth_code')) != '' )
6532
+		$stats = new GDGoogleAnalyticsStats();
6533
+	else
6534
+		return false;
6535 6535
 
6536
-    # Check if Google sucessfully logged in
6537
-    if ( ! $stats->checkLogin() )
6538
-        return false;
6536
+	# Check if Google sucessfully logged in
6537
+	if ( ! $stats->checkLogin() )
6538
+		return false;
6539 6539
 
6540
-    # Get a list of accounts
6541
-    try {
6542
-        $accounts = $stats->getAllProfiles();
6543
-    } catch (Exception $e) {
6544
-        $gd_ga_errors[] = $e->getMessage();
6545
-        return false;
6546
-    }
6540
+	# Get a list of accounts
6541
+	try {
6542
+		$accounts = $stats->getAllProfiles();
6543
+	} catch (Exception $e) {
6544
+		$gd_ga_errors[] = $e->getMessage();
6545
+		return false;
6546
+	}
6547 6547
 
6548 6548
 
6549
-    natcasesort ($accounts);
6549
+	natcasesort ($accounts);
6550 6550
 
6551
-    # Return the account array if there are accounts
6552
-    if ( count($accounts) > 0 ){
6553
-        update_option('geodir_gd_uids',$accounts);
6554
-        return $accounts;
6555
-    }
6556
-    else
6557
-        return false;
6551
+	# Return the account array if there are accounts
6552
+	if ( count($accounts) > 0 ){
6553
+		update_option('geodir_gd_uids',$accounts);
6554
+		return $accounts;
6555
+	}
6556
+	else
6557
+		return false;
6558 6558
 }
6559 6559
 
6560 6560
 add_action( 'wp_ajax_geodir_ga_deauthorize', 'geodir_ga_deauthorize' );
6561 6561
 function geodir_ga_deauthorize(){
6562 6562
 
6563
-    if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'gd_ga_deauthorize' ) ) {
6563
+	if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'gd_ga_deauthorize' ) ) {
6564 6564
 
6565
-        die( 'Security check' );
6565
+		die( 'Security check' );
6566 6566
 
6567
-    } else {
6568
-        update_option('geodir_ga_auth_token','');
6569
-        update_option('geodir_ga_auth_code','');
6570
-        update_option('geodir_gd_uids','');
6567
+	} else {
6568
+		update_option('geodir_ga_auth_token','');
6569
+		update_option('geodir_ga_auth_code','');
6570
+		update_option('geodir_gd_uids','');
6571 6571
 
6572 6572
 
6573
-        echo admin_url('?page=geodirectory&active_tab=google_analytic_settings');
6574
-    }
6573
+		echo admin_url('?page=geodirectory&active_tab=google_analytic_settings');
6574
+	}
6575 6575
 
6576
-    die();
6576
+	die();
6577 6577
 }
6578 6578
 
6579 6579
 
@@ -6584,12 +6584,12 @@  discard block
 block discarded – undo
6584 6584
  * @package GeoDirectory
6585 6585
  */
6586 6586
 function geodir_post_type_setting_fun() {
6587
-    $post_type_arr = array();
6587
+	$post_type_arr = array();
6588 6588
 
6589
-    $post_types = geodir_get_posttypes('object');
6589
+	$post_types = geodir_get_posttypes('object');
6590 6590
 
6591
-    foreach ($post_types as $key => $post_types_obj) {
6592
-        $post_type_arr[$key] = $post_types_obj->labels->singular_name;
6593
-    }
6594
-    return $post_type_arr;
6591
+	foreach ($post_types as $key => $post_types_obj) {
6592
+		$post_type_arr[$key] = $post_types_obj->labels->singular_name;
6593
+	}
6594
+	return $post_type_arr;
6595 6595
 }
6596 6596
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +939 added lines, -939 removed lines patch added patch discarded remove patch
@@ -28,31 +28,31 @@  discard block
 block discarded – undo
28 28
      * @package GeoDirectory
29 29
      */
30 30
     function geodir_admin_styles() {
31
-        wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
31
+        wp_register_style('geodirectory-admin-css', geodir_plugin_url().'/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
32 32
         wp_enqueue_style('geodirectory-admin-css');
33 33
 
34
-        wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
34
+        wp_register_style('geodirectory-frontend-style', geodir_plugin_url().'/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
35 35
         wp_enqueue_style('geodirectory-frontend-style');
36 36
 
37
-        wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
37
+        wp_register_style('geodir-chosen-style', geodir_plugin_url().'/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
38 38
         wp_enqueue_style('geodir-chosen-style');
39 39
 
40
-        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
40
+        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url().'/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
41 41
         wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
42 42
 
43
-        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
43
+        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url().'/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
44 44
         wp_enqueue_style('geodirectory-jquery-ui-css');
45 45
 
46
-        wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
46
+        wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url().'/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
47 47
         wp_enqueue_style('geodirectory-custom-fields-css');
48 48
 
49
-        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
49
+        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url().'/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
50 50
         wp_enqueue_style('geodirectory-pluplodar-css');
51 51
 
52
-        wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
52
+        wp_register_style('geodir-rating-style', geodir_plugin_url().'/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
53 53
         wp_enqueue_style('geodir-rating-style');
54 54
 
55
-        wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
55
+        wp_register_style('geodir-rtl-style', geodir_plugin_url().'/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
56 56
         wp_enqueue_style('geodir-rtl-style');
57 57
     }
58 58
 }
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         wp_register_style('font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
71 71
         wp_enqueue_style('font-awesome');
72 72
 
73
-        wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
73
+        wp_register_script('geodirectory-admin', geodir_plugin_url().'/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
74 74
         wp_enqueue_script('geodirectory-admin');
75 75
 
76 76
     }
@@ -89,60 +89,60 @@  discard block
 block discarded – undo
89 89
         
90 90
         wp_enqueue_script('jquery');
91 91
 
92
-        wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true);
92
+        wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true);
93 93
 
94
-        wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
94
+        wp_register_script('chosen', geodir_plugin_url().'/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
95 95
         wp_enqueue_script('chosen');
96 96
 
97
-        wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
97
+        wp_register_script('geodirectory-choose-ajax', geodir_plugin_url().'/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
98 98
         wp_enqueue_script('geodirectory-choose-ajax');
99 99
 
100 100
         if (isset($_REQUEST['listing_type'])) {
101
-            wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
101
+            wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url().'/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
102 102
         }
103 103
 
104 104
         wp_enqueue_script('geodirectory-custom-fields-script');
105
-        $plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
105
+        $plugin_path = geodir_plugin_url().'/geodirectory-functions/cat-meta-functions';
106 106
 
107
-        wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
107
+        wp_enqueue_script('tax-meta-clss', $plugin_path.'/js/tax-meta-clss.js', array('jquery'), null, true);
108 108
 
109 109
         if (in_array($geodir_map_name, array('auto', 'google'))) {
110
-            $map_lang = "&language=" . geodir_get_map_default_language();
111
-            $map_key = "&key=" . geodir_get_map_api_key();
110
+            $map_lang = "&language=".geodir_get_map_default_language();
111
+            $map_key = "&key=".geodir_get_map_api_key();
112 112
             /** This filter is documented in geodirectory_template_tags.php */
113 113
             $map_extra = apply_filters('geodir_googlemap_script_extra', '');
114
-            wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra, '', NULL);
114
+            wp_enqueue_script('geodirectory-googlemap-script', 'https://maps.google.com/maps/api/js?'.$map_lang.$map_key.$map_extra, '', NULL);
115 115
         }
116 116
         
117 117
         if ($geodir_map_name == 'osm') {
118 118
             // Leaflet OpenStreetMap
119
-            wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
119
+            wp_register_style('geodirectory-leaflet-style', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
120 120
             wp_enqueue_style('geodirectory-leaflet-style');
121 121
                 
122
-            wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
122
+            wp_register_script('geodirectory-leaflet-script', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
123 123
             wp_enqueue_script('geodirectory-leaflet-script');
124 124
             
125
-            wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
125
+            wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url().'/geodirectory-assets/leaflet/osm.geocode.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
126 126
             wp_enqueue_script('geodirectory-leaflet-geo-script');
127 127
         }
128
-        wp_enqueue_script( 'jquery-ui-autocomplete' );
128
+        wp_enqueue_script('jquery-ui-autocomplete');
129 129
         
130
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
130
+        wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
131 131
         wp_enqueue_script('geodirectory-goMap-script');
132 132
 
133
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
133
+        wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
134 134
         wp_enqueue_script('geodirectory-goMap-script');
135 135
 
136 136
 		// font awesome rating script
137 137
 		if (get_option('geodir_reviewrating_enable_font_awesome')) {
138
-			wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION);
138
+			wp_register_script('geodir-barrating-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION);
139 139
 			wp_enqueue_script('geodir-barrating-js');
140 140
 		} else { // default rating script
141
-			wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION);
141
+			wp_register_script('geodir-jRating-js', geodir_plugin_url().'/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION);
142 142
 			wp_enqueue_script('geodir-jRating-js');
143 143
 		}
144 144
 
145
-        wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js', array(), GEODIRECTORY_VERSION);
145
+        wp_register_script('geodir-on-document-load', geodir_plugin_url().'/geodirectory-assets/js/on_document_load.min.js', array(), GEODIRECTORY_VERSION);
146 146
         wp_enqueue_script('geodir-on-document-load');
147 147
 
148 148
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         wp_enqueue_script('plupload-all');
151 151
         wp_enqueue_script('jquery-ui-sortable');
152 152
 
153
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
153
+        wp_register_script('geodirectory-plupload-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
154 154
         wp_enqueue_script('geodirectory-plupload-script');
155 155
 
156 156
         // SCRIPT FOR UPLOAD END
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
205 205
 
206 206
 
207
-        wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
207
+        wp_register_script('geodirectory-admin-script', geodir_plugin_url().'/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
208 208
         wp_enqueue_script('geodirectory-admin-script');
209 209
 
210 210
         wp_enqueue_style('farbtastic');
@@ -212,10 +212,10 @@  discard block
 block discarded – undo
212 212
 
213 213
         $screen = get_current_screen();
214 214
         if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
215
-            wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
215
+            wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url().'/geodirectory-assets/js/listing_validation_admin.js');
216 216
         }
217 217
 
218
-        $ajax_cons_data = array('url' => esc_url(__(get_option('siteurl') . '?geodir_ajax=true')));
218
+        $ajax_cons_data = array('url' => esc_url(__(get_option('siteurl').'?geodir_ajax=true')));
219 219
         wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
220 220
 
221 221
     }
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 
239 239
         if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
240 240
 
241
-        add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
241
+        add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url().'/geodirectory-assets/images/favicon.ico', '55.1984');
242 242
 
243 243
 
244 244
     }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
                 $geodir_menu_order[] = 'separator-geodirectory';
273 273
                 if (!empty($post_types)) {
274 274
                     foreach ($post_types as $post_type) {
275
-                        $geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
275
+                        $geodir_menu_order[] = 'edit.php?post_type='.$post_type;
276 276
                     }
277 277
                 }
278 278
                 $geodir_menu_order[] = $item;
@@ -315,8 +315,8 @@  discard block
 block discarded – undo
315 315
 {
316 316
     if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
317 317
         echo '<div id="message" class="updated fade">
318
-                        <p style="float:right;">' . __('Like Geodirectory?', 'geodirectory') . ' <a href="http://wordpress.org/extend/plugins/Geodirectory/" target="_blank">' . __('Support us by leaving a rating!', 'geodirectory') . '</a></p>
319
-                        <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory') . '</strong></p>
318
+                        <p style="float:right;">' . __('Like Geodirectory?', 'geodirectory').' <a href="http://wordpress.org/extend/plugins/Geodirectory/" target="_blank">'.__('Support us by leaving a rating!', 'geodirectory').'</a></p>
319
+                        <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory').'</strong></p>
320 320
                 </div>';
321 321
 
322 322
     }
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
     if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
325 325
         switch ($_REQUEST['msg']) {
326 326
             case 'success':
327
-                echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
327
+                echo '<div id="message" class="updated fade"><p><strong>'.__('Your settings have been saved.', 'geodirectory').'</strong></p></div>';
328 328
                 flush_rewrite_rules(false);
329 329
 
330 330
                 break;
@@ -332,30 +332,30 @@  discard block
 block discarded – undo
332 332
 				$gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
333 333
 				
334 334
 				if ($gderr == 21)
335
-			    	echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
335
+			    	echo '<div id="message" class="error fade"><p><strong>'.__('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory').'</strong></p></div>';
336 336
 				else
337
-					echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
337
+					echo '<div id="message" class="error fade"><p><strong>'.__('Error: Your settings have not been saved, please try again.', 'geodirectory').'</strong></p></div>';
338 338
                 break;
339 339
         }
340 340
     }
341 341
 
342 342
     $geodir_load_map = get_option('geodir_load_map');
343 343
     $need_map_key = false;
344
-    if($geodir_load_map=='' || $geodir_load_map=='google' || $geodir_load_map=='auto' ){
344
+    if ($geodir_load_map == '' || $geodir_load_map == 'google' || $geodir_load_map == 'auto') {
345 345
         $need_map_key = true;
346 346
     }
347 347
 
348 348
     if (!geodir_get_map_api_key() && $need_map_key) {
349
-        echo '<div class="error"><p><strong>' . sprintf(__('Google Maps API KEY not set, %sclick here%s to set one OR use Open Street Maps instead.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=design_settings&active_tab=geodir_map_settings') . '\'>', '</a>') . '</strong></p></div>';
349
+        echo '<div class="error"><p><strong>'.sprintf(__('Google Maps API KEY not set, %sclick here%s to set one OR use Open Street Maps instead.', 'geodirectory'), '<a href=\''.admin_url('admin.php?page=geodirectory&tab=design_settings&active_tab=geodir_map_settings').'\'>', '</a>').'</strong></p></div>';
350 350
     }
351 351
 
352 352
     if (!geodir_is_default_location_set()) {
353
-        echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
353
+        echo '<div class="updated fade"><p><strong>'.sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\''.admin_url('admin.php?page=geodirectory&tab=default_location_settings').'\'>', '</a>').'</strong></p></div>';
354 354
 
355 355
     }
356 356
 
357 357
     if (!function_exists('curl_init')) {
358
-        echo '<div class="error"><p><strong>' . __('CURL is not installed on this server, this can cause problems, please ask your server admin to install it.', 'geodirectory') . '</strong></p></div>';
358
+        echo '<div class="error"><p><strong>'.__('CURL is not installed on this server, this can cause problems, please ask your server admin to install it.', 'geodirectory').'</strong></p></div>';
359 359
 
360 360
     }
361 361
 
@@ -375,18 +375,18 @@  discard block
 block discarded – undo
375 375
 function geodir_handle_option_form_submit($current_tab)
376 376
 {
377 377
     global $geodir_settings;
378
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
378
+    if (file_exists(dirname(__FILE__).'/option-pages/'.$current_tab.'_array.php')) {
379 379
         /**
380 380
          * Contains settings array for current tab.
381 381
          *
382 382
          * @since 1.0.0
383 383
          * @package GeoDirectory
384 384
          */
385
-        include_once('option-pages/' . $current_tab . '_array.php');
385
+        include_once('option-pages/'.$current_tab.'_array.php');
386 386
     }
387 387
     if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
388 388
         if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
389
-        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
389
+        if (!wp_verify_nonce($_REQUEST['_wpnonce-'.$current_tab], 'geodir-settings-'.$current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
390 390
 		
391 391
 		/**
392 392
 		 * Fires before updating geodirectory admin settings.
@@ -419,13 +419,13 @@  discard block
 block discarded – undo
419 419
          * @param string $current_tab The current settings tab name.
420 420
          * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
421 421
          */
422
-        do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
422
+        do_action('geodir_update_options_'.$current_tab, $geodir_settings[$current_tab]);
423 423
 
424 424
         flush_rewrite_rules(false);
425 425
 
426 426
         $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
427 427
 
428
-        $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
428
+        $redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$_REQUEST['active_tab'].'&msg=success');
429 429
 
430 430
         wp_redirect($redirect_url);
431 431
         exit();
@@ -464,18 +464,18 @@  discard block
 block discarded – undo
464 464
 
465 465
         elseif (isset($value['type']) && $value['type'] == 'image_width') :
466 466
 
467
-            if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
468
-                update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
469
-                update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
470
-                if (isset($_POST[$value['id'] . '_crop'])) :
471
-                    update_option($value['id'] . '_crop', 1);
467
+            if (isset($value['id']) && isset($_POST[$value['id'].'_width'])) {
468
+                update_option($value['id'].'_width', $_POST[$value['id'].'_width']);
469
+                update_option($value['id'].'_height', $_POST[$value['id'].'_height']);
470
+                if (isset($_POST[$value['id'].'_crop'])) :
471
+                    update_option($value['id'].'_crop', 1);
472 472
                 else :
473
-                    update_option($value['id'] . '_crop', 0);
473
+                    update_option($value['id'].'_crop', 0);
474 474
                 endif;
475 475
             } else {
476
-                update_option($value['id'] . '_width', $value['std']);
477
-                update_option($value['id'] . '_height', $value['std']);
478
-                update_option($value['id'] . '_crop', 1);
476
+                update_option($value['id'].'_width', $value['std']);
477
+                update_option($value['id'].'_height', $value['std']);
478
+                update_option($value['id'].'_crop', 1);
479 479
             }
480 480
 
481 481
         elseif (isset($value['type']) && $value['type'] == 'map') :
@@ -517,12 +517,12 @@  discard block
 block discarded – undo
517 517
         elseif (isset($value['type']) && $value['type'] == 'file') :
518 518
 
519 519
 
520
-            if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
520
+            if (isset($_POST[$value['id'].'_remove']) && $_POST[$value['id'].'_remove']) {// if remove is set then remove the file
521 521
 
522 522
                 if (get_option($value['id'])) {
523 523
                     $image_name_arr = explode('/', get_option($value['id']));
524 524
                     $noimg_name = end($image_name_arr);
525
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
525
+                    $img_path = $uploads['path'].'/'.$noimg_name;
526 526
                     if (file_exists($img_path))
527 527
                         unlink($img_path);
528 528
                 }
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
                 if (get_option($value['id'])) {
551 551
                     $image_name_arr = explode('/', get_option($value['id']));
552 552
                     $noimg_name = end($image_name_arr);
553
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
553
+                    $img_path = $uploads['path'].'/'.$noimg_name;
554 554
                     if (file_exists($img_path))
555 555
                         unlink($img_path);
556 556
                 }
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
             // same menu setting per theme.
572 572
             if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
573 573
                 $theme = wp_get_theme();
574
-                update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
574
+                update_option('geodir_theme_location_nav_'.$theme->name, $_POST[$value['id']]);
575 575
             }
576 576
 
577 577
             if (isset($value['id']) && isset($_POST[$value['id']])) {
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 
642 642
             $listing_slug = __($geodir_posttype_info['labels']['singular_name'], 'geodirectory');
643 643
 
644
-            $tabs[$geodir_post_type . '_fields_settings'] = array(
644
+            $tabs[$geodir_post_type.'_fields_settings'] = array(
645 645
                 'label' => wp_sprintf(__('%s Settings', 'geodirectory'), $listing_slug),
646 646
                 'subtabs' => array(
647 647
                     array('subtab' => 'custom_fields',
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
  */
676 676
 function geodir_tools_setting_tab($tabs)
677 677
 {
678
-    wp_enqueue_script( 'jquery-ui-progressbar' );
678
+    wp_enqueue_script('jquery-ui-progressbar');
679 679
     $tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
680 680
     return $tabs;
681 681
 }
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
  */
710 710
 function geodir_extend_geodirectory_setting_tab($tabs)
711 711
 {
712
-    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'https://wpgeodirectory.com', 'target' => '_blank');
712
+    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory').' <i class="fa fa-plug"></i>', 'url' => 'https://wpgeodirectory.com', 'target' => '_blank');
713 713
     return $tabs;
714 714
 }
715 715
 
@@ -769,8 +769,8 @@  discard block
 block discarded – undo
769 769
                     _e('Unknown', 'geodirectory');
770 770
                 } else {
771 771
                     /* If there is a city id, append 'city name' to the text string. */
772
-                    $add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
773
-                    echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
772
+                    $add_location_id = $location_id > 0 ? ' ('.$location_id.')' : '';
773
+                    echo(__($location->country, 'geodirectory').'-'.$location->region.'-'.$location->city.$add_location_id);
774 774
                 }
775 775
                 break;
776 776
 
@@ -788,14 +788,14 @@  discard block
 block discarded – undo
788 788
                         $expire_class = 'expire_over';
789 789
                     }
790 790
                     $date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the difference in days
791
-                    $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
791
+                    $date_diff_text = '<br /><span class="'.$expire_class.'">('.$date_diff.' '.$state.')</span>';
792 792
                 }
793 793
                 /* If no expire_date is found, output a default message. */
794 794
                 if (empty($expire_date))
795 795
                     echo __('Unknown', 'geodirectory');
796 796
                 /* If there is a expire_date, append 'days left' to the text string. */
797 797
                 else
798
-                    echo $expire_date . $date_diff_text;
798
+                    echo $expire_date.$date_diff_text;
799 799
                 break;
800 800
 
801 801
             /* If displaying the 'categorys' column. */
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
 function geodir_post_information_save($post_id, $post) {
863 863
     global $wpdb, $current_user;
864 864
 
865
-    if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
865
+    if (isset($post->post_type) && ($post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post')) {
866 866
         return;
867 867
     }
868 868
 
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
                     $tab_id = $value['id'];
931 931
 
932 932
                 if (isset($value['desc']) && $value['desc'])
933
-                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
933
+                    $desc = '<span style=" text-transform:none;">:- '.$value['desc'].'</span>';
934 934
 
935 935
                 if (isset($value['name']) && $value['name']) {
936 936
                     if ($first_title === true) {
@@ -938,9 +938,9 @@  discard block
 block discarded – undo
938 938
                     } else {
939 939
                         echo '</div>';
940 940
                     }
941
-                    echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
941
+                    echo '<dd id="'.trim($tab_id).'" class="geodir_option_tabs" ><a href="javascript:void(0);">'.$value['name'].'</a></dd>';
942 942
 
943
-                    echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
943
+                    echo '<div id="sub_'.trim($tab_id).'" class="gd-content-heading" style=" margin-bottom:10px;" >';
944 944
                 }
945 945
 
946 946
                 /**
@@ -950,21 +950,21 @@  discard block
 block discarded – undo
950 950
                  *
951 951
                  * @since 1.0.0
952 952
                  */
953
-                do_action('geodir_settings_' . sanitize_title($value['id']));
953
+                do_action('geodir_settings_'.sanitize_title($value['id']));
954 954
                 break;
955 955
 
956 956
             case 'no_tabs':
957 957
 
958 958
                 echo '<div class="inner_content_tab_main">';
959
-                echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
959
+                echo '<div id="sub_'.trim($tab_id).'" class="gd-content-heading" style=" margin-bottom:10px;" >';
960 960
 
961 961
                 break;
962 962
 
963 963
             case 'sectionstart':
964 964
                 if (isset($value['desc']) && $value['desc'])
965
-                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
965
+                    $desc = '<span style=" text-transform:none;"> - '.$value['desc'].'</span>';
966 966
                 if (isset($value['name']) && $value['name'])
967
-                    echo '<h3>' . $value['name'] . $desc . '</h3>';
967
+                    echo '<h3>'.$value['name'].$desc.'</h3>';
968 968
                 /**
969 969
                  * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
970 970
                  *
@@ -972,8 +972,8 @@  discard block
 block discarded – undo
972 972
                  *
973 973
                  * @since 1.0.0
974 974
                  */
975
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
976
-                echo '<table class="form-table">' . "\n\n";
975
+                if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_start');
976
+                echo '<table class="form-table">'."\n\n";
977 977
 
978 978
                 break;
979 979
             case 'sectionend':
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
                  *
985 985
                  * @since 1.0.0
986 986
                  */
987
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
987
+                if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_end');
988 988
                 echo '</table>';
989 989
                 /**
990 990
                  * Called after a GeoDirectory settings sectionend is output in the GD settings page.
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
                  *
994 994
                  * @since 1.0.0
995 995
                  */
996
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
996
+                if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_after');
997 997
                 break;
998 998
             case 'text':
999 999
                 ?>
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1003 1003
                                            id="<?php echo esc_attr($value['id']); ?>"
1004 1004
                                            type="<?php echo esc_attr($value['type']); ?>"
1005
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1005
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1006 1006
                                            style=" <?php echo esc_attr($value['css']); ?>"
1007 1007
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1008 1008
                                                echo esc_attr(stripslashes(get_option($value['id'])));
@@ -1019,14 +1019,14 @@  discard block
 block discarded – undo
1019 1019
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1020 1020
                                            id="<?php echo esc_attr($value['id']); ?>"
1021 1021
                                            type="<?php echo esc_attr($value['type']); ?>"
1022
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1022
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1023 1023
                                            style=" <?php echo esc_attr($value['css']); ?>"
1024 1024
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1025 1025
                                                echo esc_attr(stripslashes(get_option($value['id'])));
1026 1026
                                            } else {
1027 1027
                                                echo esc_attr($value['std']);
1028 1028
                                            } ?>"/>
1029
-                    <a href='https://console.developers.google.com/henhouse/?pb=["hh-1","maps_backend",null,[],"https://developers.google.com",null,["static_maps_backend","street_view_image_backend","maps_embed_backend","places_backend","geocoding_backend","directions_backend","distance_matrix_backend","geolocation","elevation_backend","timezone_backend","maps_backend"],null]&TB_iframe=true&width=600&height=400' class="thickbox button-primary" name="<?php _e('Generate API Key - ( MUST be logged in to your Google account )','geodirectory');?>" ><?php _e('Generate API Key','geodirectory');?></a>
1029
+                    <a href='https://console.developers.google.com/henhouse/?pb=["hh-1","maps_backend",null,[],"https://developers.google.com",null,["static_maps_backend","street_view_image_backend","maps_embed_backend","places_backend","geocoding_backend","directions_backend","distance_matrix_backend","geolocation","elevation_backend","timezone_backend","maps_backend"],null]&TB_iframe=true&width=600&height=400' class="thickbox button-primary" name="<?php _e('Generate API Key - ( MUST be logged in to your Google account )', 'geodirectory'); ?>" ><?php _e('Generate API Key', 'geodirectory'); ?></a>
1030 1030
                     <span class="description"><?php echo $value['desc']; ?></span></td>
1031 1031
                 </tr><?php
1032 1032
                 break;
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1039 1039
                                            id="<?php echo esc_attr($value['id']); ?>"
1040 1040
                                            type="<?php echo esc_attr($value['type']); ?>"
1041
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1041
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1042 1042
                                            style="<?php echo esc_attr($value['css']); ?>"
1043 1043
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1044 1044
                                                echo esc_attr(stripslashes(get_option($value['id'])));
@@ -1084,17 +1084,17 @@  discard block
 block discarded – undo
1084 1084
                     <?php _e('Width', 'geodirectory'); ?> <input
1085 1085
                         name="<?php echo esc_attr($value['id']); ?>_width"
1086 1086
                         id="<?php echo esc_attr($value['id']); ?>_width" type="text" size="3"
1087
-                        value="<?php if ($size = get_option($value['id'] . '_width')) echo stripslashes($size); else echo $value['std']; ?>"/>
1087
+                        value="<?php if ($size = get_option($value['id'].'_width')) echo stripslashes($size); else echo $value['std']; ?>"/>
1088 1088
 
1089 1089
                     <?php _e('Height', 'geodirectory'); ?> <input
1090 1090
                         name="<?php echo esc_attr($value['id']); ?>_height"
1091 1091
                         id="<?php echo esc_attr($value['id']); ?>_height" type="text" size="3"
1092
-                        value="<?php if ($size = get_option($value['id'] . '_height')) echo stripslashes($size); else echo $value['std']; ?>"/>
1092
+                        value="<?php if ($size = get_option($value['id'].'_height')) echo stripslashes($size); else echo $value['std']; ?>"/>
1093 1093
 
1094 1094
                     <label><?php _e('Hard Crop', 'geodirectory'); ?> <input
1095 1095
                             name="<?php echo esc_attr($value['id']); ?>_crop"
1096 1096
                             id="<?php echo esc_attr($value['id']); ?>_crop"
1097
-                            type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') checked(get_option($value['id'] . '_crop'), 1); else checked(1); ?> /></label>
1097
+                            type="checkbox" <?php if (get_option($value['id'].'_crop') != '') checked(get_option($value['id'].'_crop'), 1); else checked(1); ?> /></label>
1098 1098
 
1099 1099
                     <span class="description"><?php echo $value['desc'] ?></span></td>
1100 1100
                 </tr><?php
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
                                             id="<?php echo esc_attr($value['id']); ?>"
1145 1145
                                             style="<?php echo esc_attr($value['css']); ?>"
1146 1146
                                             class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1147
-                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
1147
+                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text']; ?>"
1148 1148
                                             option-ajaxchosen="false">
1149 1149
                         <?php
1150 1150
                         foreach ($value['options'] as $key => $val) {
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
                                 ?></optgroup><?php
1155 1155
                             } else {
1156 1156
                                 ?>
1157
-                                <option value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values)));?>>
1157
+                                <option value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values))); ?>>
1158 1158
                                     <?php echo geodir_utf8_ucfirst($val) ?>
1159 1159
                                 </option>
1160 1160
                             <?php
@@ -1191,7 +1191,7 @@  discard block
 block discarded – undo
1191 1191
                 ?>
1192 1192
 
1193 1193
                 <tr valign="top">
1194
-                    <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
1194
+                    <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory'); ?></th>
1195 1195
                     <td width="60%">
1196 1196
                         <select name="geodir_default_map_language" style="width:60%">
1197 1197
                             <?php
@@ -1273,7 +1273,7 @@  discard block
 block discarded – undo
1273 1273
 
1274 1274
                 <tr valign="top">
1275 1275
                     <th class="titledesc"
1276
-                        width="40%"><?php _e('Default post type search on map', 'geodirectory');?></th>
1276
+                        width="40%"><?php _e('Default post type search on map', 'geodirectory'); ?></th>
1277 1277
                     <td width="60%">
1278 1278
                         <select name="geodir_default_map_search_pt" style="width:60%">
1279 1279
                             <?php
@@ -1314,7 +1314,7 @@  discard block
 block discarded – undo
1314 1314
                         $cat_display = 'checkbox';
1315 1315
                         $gd_post_types = get_option('geodir_exclude_post_type_on_map');
1316 1316
                         $gd_cats = get_option('geodir_exclude_cat_on_map');
1317
-                        $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1317
+                        $gd_cats_upgrade = (int) get_option('geodir_exclude_cat_on_map_upgrade');
1318 1318
                         $count = 1;
1319 1319
                         ?>
1320 1320
                         <table width="70%" class="widefat">
@@ -1343,7 +1343,7 @@  discard block
 block discarded – undo
1343 1343
                                                                                            name="home_map_post_types[]"
1344 1344
                                                                                            id="<?php echo esc_attr($value['id']); ?>"
1345 1345
                                                                                            value="<?php echo $key; ?>"
1346
-                                                                                           class="map_post_type" <?php echo $checked;?> />
1346
+                                                                                           class="map_post_type" <?php echo $checked; ?> />
1347 1347
                                         <?php echo __($post_types_obj->labels->singular_name, 'geodirectory'); ?></td>
1348 1348
                                     <td width="40%">
1349 1349
                                         <div class="home_map_category" style="overflow:auto;width:200px;height:100px;"
@@ -1401,12 +1401,12 @@  discard block
 block discarded – undo
1401 1401
                 ?>
1402 1402
                 <fieldset>
1403 1403
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1404
-                    <label for="<?php echo $value['id'];?>">
1404
+                    <label for="<?php echo $value['id']; ?>">
1405 1405
                         <input name="<?php echo esc_attr($value['id']); ?>"
1406
-                               id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
1406
+                               id="<?php echo esc_attr($value['id'].$value['value']); ?>" type="radio"
1407 1407
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
1408 1408
                             echo 'checked="checked"';
1409
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1409
+                        }elseif (get_option($value['id']) == '' && $value['std'] == $value['value']) {echo 'checked="checked"'; } ?> />
1410 1410
                         <?php echo $value['desc']; ?></label><br>
1411 1411
                 </fieldset>
1412 1412
                 <?php
@@ -1426,9 +1426,9 @@  discard block
 block discarded – undo
1426 1426
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1427 1427
                 <td class="forminp">
1428 1428
                     <textarea
1429
-                        <?php if (isset($value['args'])) echo $value['args'] . ' '; ?>name="<?php echo esc_attr($value['id']); ?>"
1429
+                        <?php if (isset($value['args'])) echo $value['args'].' '; ?>name="<?php echo esc_attr($value['id']); ?>"
1430 1430
                         id="<?php echo esc_attr($value['id']); ?>"
1431
-                        <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1431
+                        <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1432 1432
                         style="<?php echo esc_attr($value['css']); ?>"><?php if (get_option($value['id'])) echo esc_textarea(stripslashes(get_option($value['id']))); else echo esc_textarea($value['std']); ?></textarea><span
1433 1433
                         class="description"><?php echo $value['desc'] ?></span>
1434 1434
 
@@ -1473,7 +1473,7 @@  discard block
 block discarded – undo
1473 1473
 					}
1474 1474
 				}
1475 1475
 				//
1476
-				$page_setting = (int)get_option($value['id']);
1476
+				$page_setting = (int) get_option($value['id']);
1477 1477
 
1478 1478
                 $args = array('name' => $value['id'],
1479 1479
                     'id' => $value['id'],
@@ -1490,7 +1490,7 @@  discard block
 block discarded – undo
1490 1490
                 <tr valign="top" class="single_select_page">
1491 1491
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1492 1492
                 <td class="forminp">
1493
-                    <?php echo str_replace(' id=', " data-placeholder='" . __('Select a page...', 'geodirectory') . "' style='" . $value['css'] . "' class='" . $value['class'] . "' " . $disabled . " id=", wp_dropdown_pages($args)); ?>
1493
+                    <?php echo str_replace(' id=', " data-placeholder='".__('Select a page...', 'geodirectory')."' style='".$value['css']."' class='".$value['class']."' ".$disabled." id=", wp_dropdown_pages($args)); ?>
1494 1494
                     <span class="description"><?php echo $value['desc'] ?></span>
1495 1495
                 </td>
1496 1496
                 </tr><?php
@@ -1499,7 +1499,7 @@  discard block
 block discarded – undo
1499 1499
 				}
1500 1500
                 break;
1501 1501
             case 'single_select_country' :
1502
-                $country_setting = (string)get_option($value['id']);
1502
+                $country_setting = (string) get_option($value['id']);
1503 1503
                 if (strstr($country_setting, ':')) :
1504 1504
                     $country = current(explode(':', $country_setting));
1505 1505
                     $state = end(explode(':', $country_setting));
@@ -1522,7 +1522,7 @@  discard block
 block discarded – undo
1522 1522
             case 'multi_select_countries' :
1523 1523
                 $countries = $geodirectory->countries->countries;
1524 1524
                 asort($countries);
1525
-                $selections = (array)get_option($value['id']);
1525
+                $selections = (array) get_option($value['id']);
1526 1526
                 ?>
1527 1527
                 <tr valign="top">
1528 1528
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
@@ -1532,7 +1532,7 @@  discard block
 block discarded – undo
1532 1532
                             title="Country" class="chosen_select">
1533 1533
                         <?php
1534 1534
                         if ($countries) foreach ($countries as $key => $val) :
1535
-                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1535
+                            echo '<option value="'.$key.'" '.selected(in_array($key, $selections), true, false).'>'.$val.'</option>';
1536 1536
                         endforeach;
1537 1537
                         ?>
1538 1538
                     </select>
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
                 break;
1545 1545
 
1546 1546
             case 'google_analytics' :
1547
-                $selections = (array)get_option($value['id']);
1547
+                $selections = (array) get_option($value['id']);
1548 1548
                     ?>
1549 1549
                     <tr valign="top">
1550 1550
                         <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
@@ -1555,30 +1555,30 @@  discard block
 block discarded – undo
1555 1555
 
1556 1556
                             $oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1557 1557
                             $scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1558
-                            $state = "&state=123";//any string
1559
-                            $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1558
+                            $state = "&state=123"; //any string
1559
+                            $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback";
1560 1560
                             $response_type = "&response_type=code";
1561 1561
                             $client_id = "&client_id=".get_option('geodir_ga_client_id');
1562 1562
                             $access_type = "&access_type=offline";
1563 1563
                             $approval_prompt = "&approval_prompt=force";
1564 1564
 
1565
-                            $auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
1565
+                            $auth_url = $oAuthURL.$scope.$state.$redirect_uri.$response_type.$client_id.$access_type.$approval_prompt;
1566 1566
 
1567 1567
 
1568 1568
                             if (get_option('geodir_ga_auth_token')) {
1569 1569
                                 ?>
1570 1570
                                 <span class="button-primary"
1571
-                                      onclick="gd_GA_Deauthorize('<?php echo wp_create_nonce('gd_ga_deauthorize');?>');"><?php _e('Deauthorize', 'geodirectory'); ?></span>
1571
+                                      onclick="gd_GA_Deauthorize('<?php echo wp_create_nonce('gd_ga_deauthorize'); ?>');"><?php _e('Deauthorize', 'geodirectory'); ?></span>
1572 1572
                                 <span style="color: green; font-weight: bold;"><?php _e('Authorized', 'geodirectory'); ?></span>
1573 1573
                             <?php
1574 1574
                                 global $gd_ga_errors;
1575
-                                if(!empty($gd_ga_errors)){
1575
+                                if (!empty($gd_ga_errors)) {
1576 1576
                                     print_r($gd_ga_errors);
1577 1577
                                 }
1578 1578
                             } else {
1579 1579
                                 ?>
1580 1580
                                 <span class="button-primary"
1581
-                                      onclick="window.open('<?php echo  geodir_ga_activation_url();?>', 'activate','width=700, height=600, menubar=0, status=0, location=0, toolbar=0')"><?php _e('Authorize', 'geodirectory');?></span>
1581
+                                      onclick="window.open('<?php echo  geodir_ga_activation_url(); ?>', 'activate','width=700, height=600, menubar=0, status=0, location=0, toolbar=0')"><?php _e('Authorize', 'geodirectory'); ?></span>
1582 1582
                             <?php
1583 1583
                             }
1584 1584
                             ?>
@@ -1649,9 +1649,9 @@  discard block
 block discarded – undo
1649 1649
 
1650 1650
             <?php if (isset($_REQUEST['active_tab']) && $_REQUEST['active_tab'] != '') { ?>
1651 1651
             jQuery('.geodir_option_tabs').removeClass('gd-tab-active');
1652
-            jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').addClass('gd-tab-active');
1652
+            jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').addClass('gd-tab-active');
1653 1653
             jQuery('.gd-content-heading').hide();
1654
-            jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').show();
1654
+            jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').show();
1655 1655
             <?php } ?>
1656 1656
         });
1657 1657
     </script>
@@ -1737,7 +1737,7 @@  discard block
 block discarded – undo
1737 1737
     wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
1738 1738
 
1739 1739
     if (geodir_get_featured_image($post_id, 'thumbnail')) {
1740
-        echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
1740
+        echo '<h4>'.__('Featured Image', 'geodirectory').'</h4>';
1741 1741
         geodir_show_featured_image($post_id, 'thumbnail');
1742 1742
     }
1743 1743
 
@@ -1748,13 +1748,13 @@  discard block
 block discarded – undo
1748 1748
 
1749 1749
     <h5 class="form_title">
1750 1750
         <?php if ($image_limit != 0 && $image_limit == 1) {
1751
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
1751
+            echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('image with this package', 'geodirectory').')</small>';
1752 1752
         } ?>
1753 1753
         <?php if ($image_limit != 0 && $image_limit > 1) {
1754
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
1754
+            echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('images with this package', 'geodirectory').')</small>';
1755 1755
         } ?>
1756 1756
         <?php if ($image_limit == 0) {
1757
-            echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
1757
+            echo '<br /><small>('.__('You can upload unlimited images with this package', 'geodirectory').')</small>';
1758 1758
         } ?>
1759 1759
     </h5>
1760 1760
 
@@ -1793,10 +1793,10 @@  discard block
 block discarded – undo
1793 1793
         <div
1794 1794
             class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
1795 1795
             id="<?php echo $id; ?>plupload-upload-ui">
1796
-            <h4><?php _e('Drop files to upload', 'geodirectory');?></h4>
1796
+            <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4>
1797 1797
             <input id="<?php echo $id; ?>plupload-browse-button" type="button"
1798 1798
                    value="<?php _e('Select Files', 'geodirectory'); ?>" class="button"/>
1799
-            <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span>
1799
+            <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id.'pluploadan'); ?>"></span>
1800 1800
             <?php if ($width && $height): ?>
1801 1801
                 <span class="plupload-resize"></span>
1802 1802
                 <span class="plupload-width" id="plupload-width<?php echo $width; ?>"></span>
@@ -1808,7 +1808,7 @@  discard block
 block discarded – undo
1808 1808
              id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;">
1809 1809
         </div>
1810 1810
         <span
1811
-            id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory');?></span>
1811
+            id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory'); ?></span>
1812 1812
         <span id="<?php echo $id; ?>upload-error" style="display:none"></span>
1813 1813
     </div>
1814 1814
 
@@ -2018,9 +2018,9 @@  discard block
 block discarded – undo
2018 2018
     $plugin = 'avada-nag';
2019 2019
     $timestamp = 'avada-nag1234';
2020 2020
     $message = __('Welcome to GeoDirectory, please have a look <a href="https://docs.wpgeodirectory.com/category/getting-started/" target="_blank">here</a> to get started. :)', 'geodirectory');
2021
-    echo '<div id="' . $timestamp . '"  class="error">';
2022
-    echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>';
2023
-    echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
2021
+    echo '<div id="'.$timestamp.'"  class="error">';
2022
+    echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\''.$plugin.'\',\''.$timestamp.'\');" ><i class="fa fa-times"></i></span>';
2023
+    echo "<img class='gd-icon-noti' src='".plugin_dir_url('')."geodirectory/geodirectory-assets/images/favicon.ico' > ";
2024 2024
     echo "<p>$message</p>";
2025 2025
     echo "</div>";
2026 2026
 
@@ -2154,7 +2154,7 @@  discard block
 block discarded – undo
2154 2154
 		
2155 2155
 		// Don't allow same slug url for listing and location
2156 2156
 		if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
2157
-			$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
2157
+			$redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$active_tab.'&msg=fail&gderr=21');
2158 2158
         	wp_redirect($redirect_url);
2159 2159
 			exit;
2160 2160
 		}
@@ -2166,7 +2166,7 @@  discard block
 block discarded – undo
2166 2166
 			$default_language = $sitepress->get_default_language();
2167 2167
 			
2168 2168
 			if ($current_language != 'all' && $current_language != $default_language) {
2169
-				$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab);
2169
+				$redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$active_tab);
2170 2170
 				wp_redirect($redirect_url);
2171 2171
 				exit;
2172 2172
 			}
@@ -2187,11 +2187,11 @@  discard block
 block discarded – undo
2187 2187
 function geodir_hide_admin_preview_button() {
2188 2188
     global $post_type;
2189 2189
     $post_types = geodir_get_posttypes();
2190
-    if(in_array($post_type, $post_types))
2190
+    if (in_array($post_type, $post_types))
2191 2191
         echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2192 2192
 }
2193
-add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
2194
-add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
2193
+add_action('admin_head-post-new.php', 'geodir_hide_admin_preview_button');
2194
+add_action('admin_head-post.php', 'geodir_hide_admin_preview_button');
2195 2195
 
2196 2196
 /**
2197 2197
  * Add the tab in left sidebar menu fro import & export page.
@@ -2201,8 +2201,8 @@  discard block
 block discarded – undo
2201 2201
  *
2202 2202
  * @return array Array of tab data.
2203 2203
  */
2204
-function geodir_import_export_tab( $tabs ) {
2205
-	$tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
2204
+function geodir_import_export_tab($tabs) {
2205
+	$tabs['import_export'] = array('label' => __('Import & Export', 'geodirectory'));
2206 2206
     return $tabs;
2207 2207
 }
2208 2208
 
@@ -2216,8 +2216,8 @@  discard block
 block discarded – undo
2216 2216
  * @return string Html content.
2217 2217
  */
2218 2218
 function geodir_import_export_page() {
2219
-	$nonce = wp_create_nonce( 'geodir_import_export_nonce' );
2220
-	$gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
2219
+	$nonce = wp_create_nonce('geodir_import_export_nonce');
2220
+	$gd_cats_sample_csv = geodir_plugin_url().'/geodirectory-assets/gd_sample_categories.csv';
2221 2221
     /**
2222 2222
      * Filter sample category data csv file url.
2223 2223
      *
@@ -2226,9 +2226,9 @@  discard block
 block discarded – undo
2226 2226
      *
2227 2227
      * @param string $gd_cats_sample_csv Sample category data csv file url.
2228 2228
      */
2229
-	$gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
2229
+	$gd_cats_sample_csv = apply_filters('geodir_export_cats_sample_csv', $gd_cats_sample_csv);
2230 2230
 	
2231
-	$gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
2231
+	$gd_posts_sample_csv = geodir_plugin_url().'/geodirectory-assets/place_listing.csv';
2232 2232
     /**
2233 2233
      * Filter sample post data csv file url.
2234 2234
      *
@@ -2237,15 +2237,15 @@  discard block
 block discarded – undo
2237 2237
      *
2238 2238
      * @param string $gd_posts_sample_csv Sample post data csv file url.
2239 2239
      */
2240
-    $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2240
+    $gd_posts_sample_csv = apply_filters('geodir_export_posts_sample_csv', $gd_posts_sample_csv);
2241 2241
 	
2242
-	$gd_posttypes = geodir_get_posttypes( 'array' );
2242
+	$gd_posttypes = geodir_get_posttypes('array');
2243 2243
 	
2244 2244
 	$gd_posttypes_option = '';
2245
-	foreach ( $gd_posttypes as $gd_posttype => $row ) {
2246
-		$gd_posttypes_option .= '<option value="' . $gd_posttype . '" data-cats="' . (int)geodir_get_terms_count( $gd_posttype ) . '" data-posts="' . (int)geodir_get_posts_count( $gd_posttype ) . '">' . __( $row['labels']['name'], 'geodirectory' ) . '</option>';
2245
+	foreach ($gd_posttypes as $gd_posttype => $row) {
2246
+		$gd_posttypes_option .= '<option value="'.$gd_posttype.'" data-cats="'.(int) geodir_get_terms_count($gd_posttype).'" data-posts="'.(int) geodir_get_posts_count($gd_posttype).'">'.__($row['labels']['name'], 'geodirectory').'</option>';
2247 2247
 	}
2248
-	wp_enqueue_script( 'jquery-ui-progressbar' );
2248
+	wp_enqueue_script('jquery-ui-progressbar');
2249 2249
 	
2250 2250
 	$gd_chunksize_options = array();
2251 2251
 	$gd_chunksize_options[100] = 100;
@@ -2267,50 +2267,50 @@  discard block
 block discarded – undo
2267 2267
      *
2268 2268
      * @param string $gd_chunksize_options Entries options.
2269 2269
      */
2270
-    $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2270
+    $gd_chunksize_options = apply_filters('geodir_export_csv_chunksize_options', $gd_chunksize_options);
2271 2271
 	
2272 2272
 	$gd_chunksize_option = '';
2273 2273
 	foreach ($gd_chunksize_options as $value => $title) {
2274
-		$gd_chunksize_option .= '<option value="' . $value . '" ' . selected($value, 5000, false) . '>' . $title . '</option>';
2274
+		$gd_chunksize_option .= '<option value="'.$value.'" '.selected($value, 5000, false).'>'.$title.'</option>';
2275 2275
 	}
2276 2276
 	
2277 2277
 	$uploads = wp_upload_dir();
2278
-	$upload_dir = wp_sprintf( CSV_TRANSFER_IMG_FOLDER, str_replace( ABSPATH, '', $uploads['path'] ) );
2278
+	$upload_dir = wp_sprintf(CSV_TRANSFER_IMG_FOLDER, str_replace(ABSPATH, '', $uploads['path']));
2279 2279
 ?>
2280 2280
 </form>
2281 2281
 <div class="inner_content_tab_main gd-import-export">
2282
-  <h3><?php _e( 'GD Import & Export CSV', 'geodirectory' ) ;?></h3>
2283
-  <span class="description"><?php _e( 'Import & export csv for GD listings & categories.', 'geodirectory' ) ;?></span>
2282
+  <h3><?php _e('GD Import & Export CSV', 'geodirectory'); ?></h3>
2283
+  <span class="description"><?php _e('Import & export csv for GD listings & categories.', 'geodirectory'); ?></span>
2284 2284
   <div class="gd-content-heading">
2285 2285
 
2286 2286
   <?php
2287 2287
     ini_set('max_execution_time', 999999);
2288
-    $ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2288
+    $ini_max_execution_time_check = @ini_get('max_execution_time');
2289 2289
     ini_restore('max_execution_time');
2290 2290
 
2291
-    if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2291
+    if ($ini_max_execution_time_check != 999999) { // only show these setting to the user if we can't change the ini setting
2292 2292
         ?>
2293 2293
 	<div id="gd_ie_reqs" class="metabox-holder">
2294 2294
       <div class="meta-box-sortables ui-sortable">
2295 2295
         <div class="postbox">
2296
-          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __( 'PHP Requirements for GD Import & Export CSV', 'geodirectory' );?></span></h3>
2296
+          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __('PHP Requirements for GD Import & Export CSV', 'geodirectory'); ?></span></h3>
2297 2297
           <div class="inside">
2298
-            <span class="description"><?php echo __( 'Note: In case GD import & export csv not working for larger data then please check and configure following php settings.', 'geodirectory' );?></span>
2298
+            <span class="description"><?php echo __('Note: In case GD import & export csv not working for larger data then please check and configure following php settings.', 'geodirectory'); ?></span>
2299 2299
 			<table class="form-table">
2300 2300
 				<thead>
2301 2301
 				  <tr>
2302
-				  	<th><?php _e( 'PHP Settings', 'geodirectory' );?></th><th><?php _e( 'Current Value', 'geodirectory' );?></th><th><?php _e( 'Recommended Value', 'geodirectory' );?></th>
2302
+				  	<th><?php _e('PHP Settings', 'geodirectory'); ?></th><th><?php _e('Current Value', 'geodirectory'); ?></th><th><?php _e('Recommended Value', 'geodirectory'); ?></th>
2303 2303
 				  </tr>
2304 2304
 				</thead>
2305 2305
 				<tbody>
2306 2306
 				  <tr>
2307
-				  	<td>max_input_time</td><td><?php echo @ini_get( 'max_input_time' );?></td><td>3000</td>
2307
+				  	<td>max_input_time</td><td><?php echo @ini_get('max_input_time'); ?></td><td>3000</td>
2308 2308
 				  </tr>
2309 2309
 				  <tr>
2310
-				  	<td>max_execution_time</td><td><?php  echo @ini_get( 'max_execution_time' );?></td><td>3000</td>
2310
+				  	<td>max_execution_time</td><td><?php  echo @ini_get('max_execution_time'); ?></td><td>3000</td>
2311 2311
 				  </tr>
2312 2312
 				  <tr>
2313
-				  	<td>memory_limit</td><td><?php echo @ini_get( 'memory_limit' );?></td><td>256M</td>
2313
+				  	<td>memory_limit</td><td><?php echo @ini_get('memory_limit'); ?></td><td>256M</td>
2314 2314
 				  </tr>
2315 2315
 				</tbody>
2316 2316
 		    </table>
@@ -2322,21 +2322,21 @@  discard block
 block discarded – undo
2322 2322
 	<div id="gd_ie_imposts" class="metabox-holder">
2323 2323
       <div class="meta-box-sortables ui-sortable">
2324 2324
         <div id="gd_ie_im_posts" class="postbox gd-hndle-pbox">
2325
-          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Listings: Import CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2326
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Import CSV', 'geodirectory' );?></span></h3>
2325
+          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Listings: Import CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2326
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Import CSV', 'geodirectory'); ?></span></h3>
2327 2327
           <div class="inside">
2328 2328
             <table class="form-table">
2329 2329
 				<tbody>
2330 2330
 				  <tr>
2331 2331
 					<td class="gd-imex-box">
2332 2332
 						<div class="gd-im-choices">
2333
-						<p><input type="radio" value="update" name="gd_im_choicepost" id="gd_im_pchoice_u" /><label for="gd_im_pchoice_u"><?php _e( 'Update listing if post with post_id already exists.', 'geodirectory' );?></label></p>
2334
-						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicepost" id="gd_im_pchoice_s" /><label for="gd_im_pchoice_s"><?php _e( 'Ignore listing if post with post_id already exists.', 'geodirectory' );?></label></p>
2333
+						<p><input type="radio" value="update" name="gd_im_choicepost" id="gd_im_pchoice_u" /><label for="gd_im_pchoice_u"><?php _e('Update listing if post with post_id already exists.', 'geodirectory'); ?></label></p>
2334
+						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicepost" id="gd_im_pchoice_s" /><label for="gd_im_pchoice_s"><?php _e('Ignore listing if post with post_id already exists.', 'geodirectory'); ?></label></p>
2335 2335
 						</div>
2336 2336
 						<div class="plupload-upload-uic hide-if-no-js" id="gd_im_postplupload-upload-ui">
2337 2337
 							<input type="text" readonly="readonly" name="gd_im_post_file" class="gd-imex-file gd_im_post_file" id="gd_im_post" onclick="jQuery('#gd_im_postplupload-browse-button').trigger('click');" />
2338
-							<input id="gd_im_postplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-pupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imposts_sample" id="gd_ie_imposts_sample">
2339
-						<input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv;?>" />
2338
+							<input id="gd_im_postplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-pupload button-primary" /><input type="button" value="<?php echo esc_attr(__('Download Sample CSV', 'geodirectory')); ?>" class="button-secondary" name="gd_ie_imposts_sample" id="gd_ie_imposts_sample">
2339
+						<input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv; ?>" />
2340 2340
 						<input type="hidden" id="gd_im_post_allowed_types" data-exts=".csv" value="csv" />
2341 2341
 							<?php
2342 2342
 							/**
@@ -2346,7 +2346,7 @@  discard block
 block discarded – undo
2346 2346
 							 */
2347 2347
 							do_action('geodir_sample_csv_download_link');
2348 2348
 							?>
2349
-							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_postpluploadan' ); ?>"></span>
2349
+							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_postpluploadan'); ?>"></span>
2350 2350
 							<div class="filelist"></div>
2351 2351
 						</div>
2352 2352
 						<span id="gd_im_postupload-error" style="display:none"></span>
@@ -2364,7 +2364,7 @@  discard block
 block discarded – undo
2364 2364
 							<input type="hidden" id="gd_terminateaction" value="continue"/>
2365 2365
 						</div>
2366 2366
 						<div class="gd-import-progress" id="gd-import-progress" style="display:none">
2367
-							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
2367
+							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
2368 2368
 									id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
2369 2369
 									id="gd-import-perc">0%</font> )
2370 2370
 								<div class="gd-fileprogress"></div>
@@ -2376,10 +2376,10 @@  discard block
 block discarded – undo
2376 2376
                     	<div class="gd-imex-btns" style="display:none;">
2377 2377
                         	<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
2378 2378
                         	<input onclick="gd_imex_PrepareImport(this, 'post')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" />
2379
-                        	<input onclick="gd_imex_ContinueImport(this, 'post')" type="button" value="<?php _e( "Continue Import Data", 'geodirectory' );?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2380
-                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'post')"/>
2379
+                        	<input onclick="gd_imex_ContinueImport(this, 'post')" type="button" value="<?php _e("Continue Import Data", 'geodirectory'); ?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2380
+                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory'); ?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'post')"/>
2381 2381
 							<div id="gd_process_data" style="display:none">
2382
-								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
2382
+								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
2383 2383
 							</div>
2384 2384
 						</div>
2385 2385
 					</td>
@@ -2393,30 +2393,30 @@  discard block
 block discarded – undo
2393 2393
 	<div id="gd_ie_excategs" class="metabox-holder">
2394 2394
 	  <div class="meta-box-sortables ui-sortable">
2395 2395
 		<div id="gd_ie_ex_posts" class="postbox gd-hndle-pbox">
2396
-		  <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - Listings: Export CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2397
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Export CSV', 'geodirectory' );?></span></h3>
2396
+		  <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - Listings: Export CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2397
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Export CSV', 'geodirectory'); ?></span></h3>
2398 2398
 		  <div class="inside">
2399 2399
 			<table class="form-table">
2400 2400
 			  <tbody>
2401 2401
 				<tr>
2402 2402
 				  <td class="fld"><label for="gd_post_type">
2403
-					<?php _e( 'Post Type:', 'geodirectory' );?>
2403
+					<?php _e('Post Type:', 'geodirectory'); ?>
2404 2404
 					</label></td>
2405 2405
 				  <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px">
2406
-					  <?php echo $gd_posttypes_option;?>
2406
+					  <?php echo $gd_posttypes_option; ?>
2407 2407
 					</select></td>
2408 2408
 				</tr>
2409 2409
 				<tr>
2410
-					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td>
2411
-					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option;?></select><span class="description"><?php _e( 'Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory' );?></span></td>
2410
+					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
2411
+					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option; ?></select><span class="description"><?php _e('Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory'); ?></span></td>
2412 2412
 				</tr>
2413 2413
                 <tr class="gd-imex-dates">
2414
-					<td class="fld"><label><?php _e( 'Published Date:', 'geodirectory' );?></label></td>
2415
-					<td><label><span class="label-responsive"><?php _e( 'Start date:', 'geodirectory' );?></span><input type="text" id="gd_imex_start_date" name="gd_imex[start_date]" data-type="date" /></label><label><span class="label-responsive"><?php _e( 'End date:', 'geodirectory' );?></span><input type="text" id="gd_imex_end_date" name="gd_imex[end_date]" data-type="date" /></label></td>
2414
+					<td class="fld"><label><?php _e('Published Date:', 'geodirectory'); ?></label></td>
2415
+					<td><label><span class="label-responsive"><?php _e('Start date:', 'geodirectory'); ?></span><input type="text" id="gd_imex_start_date" name="gd_imex[start_date]" data-type="date" /></label><label><span class="label-responsive"><?php _e('End date:', 'geodirectory'); ?></span><input type="text" id="gd_imex_end_date" name="gd_imex[end_date]" data-type="date" /></label></td>
2416 2416
 				</tr>
2417 2417
 				<tr>
2418 2418
 				  <td class="fld" style="vertical-align:top"><label>
2419
-					<?php _e( 'Progress:', 'geodirectory' );?>
2419
+					<?php _e('Progress:', 'geodirectory'); ?>
2420 2420
 					</label></td>
2421 2421
 				  <td><div id='gd_progressbar_box'>
2422 2422
 					  <div id="gd_progressbar" class="gd_progressbar">
@@ -2424,13 +2424,13 @@  discard block
 block discarded – undo
2424 2424
 					  </div>
2425 2425
 					</div>
2426 2426
 					<p style="display:inline-block">
2427
-					  <?php _e( 'Elapsed Time:', 'geodirectory' );?>
2427
+					  <?php _e('Elapsed Time:', 'geodirectory'); ?>
2428 2428
 					</p>
2429 2429
 					  
2430 2430
 					<p id="gd_timer" class="gd_timer">00:00:00</p></td>
2431 2431
 				</tr>
2432 2432
 				<tr class="gd-ie-actions">
2433
-				  <td style="vertical-align:top"><input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_exposts_submit" id="gd_ie_exposts_submit">
2433
+				  <td style="vertical-align:top"><input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_exposts_submit" id="gd_ie_exposts_submit">
2434 2434
 				  </td>
2435 2435
 				  <td id="gd_ie_ex_files" class="gd-ie-files"></td>
2436 2436
 				</tr>
@@ -2443,21 +2443,21 @@  discard block
 block discarded – undo
2443 2443
 	<div id="gd_ie_imcategs" class="metabox-holder">
2444 2444
       <div class="meta-box-sortables ui-sortable">
2445 2445
         <div id="gd_ie_imcats" class="postbox gd-hndle-pbox">
2446
-          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Categories: Import CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2447
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Import CSV', 'geodirectory' );?></span></h3>
2446
+          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Categories: Import CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2447
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Import CSV', 'geodirectory'); ?></span></h3>
2448 2448
           <div class="inside">
2449 2449
             <table class="form-table">
2450 2450
 				<tbody>
2451 2451
 				  <tr>
2452 2452
 					<td class="gd-imex-box">
2453 2453
 						<div class="gd-im-choices">
2454
-						<p><input type="radio" value="update" name="gd_im_choicecat" id="gd_im_cchoice_u" /><label for="gd_im_cchoice_u"><?php _e( 'Update item if item with cat_id/cat_slug already exists.', 'geodirectory' );?></label></p>
2455
-						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicecat" id="gd_im_cchoice_s" /><label for="gd_im_cchoice_s"><?php _e( 'Ignore item if item with cat_id/cat_slug already exists.', 'geodirectory' );?></label></p>
2454
+						<p><input type="radio" value="update" name="gd_im_choicecat" id="gd_im_cchoice_u" /><label for="gd_im_cchoice_u"><?php _e('Update item if item with cat_id/cat_slug already exists.', 'geodirectory'); ?></label></p>
2455
+						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicecat" id="gd_im_cchoice_s" /><label for="gd_im_cchoice_s"><?php _e('Ignore item if item with cat_id/cat_slug already exists.', 'geodirectory'); ?></label></p>
2456 2456
 						</div>
2457 2457
 						<div class="plupload-upload-uic hide-if-no-js" id="gd_im_catplupload-upload-ui">
2458 2458
 							<input type="text" readonly="readonly" name="gd_im_cat_file" class="gd-imex-file gd_im_cat_file" id="gd_im_cat" onclick="jQuery('#gd_im_catplupload-browse-button').trigger('click');" />
2459
-							<input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample">
2460
-						<input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv;?>" />
2459
+							<input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr(__('Download Sample CSV', 'geodirectory')); ?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample">
2460
+						<input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv; ?>" />
2461 2461
 						<input type="hidden" id="gd_im_cat_allowed_types" data-exts=".csv" value="csv" />
2462 2462
 						<?php
2463 2463
 						/**
@@ -2468,7 +2468,7 @@  discard block
 block discarded – undo
2468 2468
 						 */
2469 2469
 						do_action('geodir_sample_cats_csv_download_link');
2470 2470
 						?>
2471
-							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_catpluploadan' ); ?>"></span>
2471
+							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_catpluploadan'); ?>"></span>
2472 2472
 							<div class="filelist"></div>
2473 2473
 						</div>
2474 2474
 						<span id="gd_im_catupload-error" style="display:none"></span>
@@ -2485,7 +2485,7 @@  discard block
 block discarded – undo
2485 2485
 							<input type="hidden" id="gd_terminateaction" value="continue"/>
2486 2486
 						</div>
2487 2487
 						<div class="gd-import-progress" id="gd-import-progress" style="display:none">
2488
-							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
2488
+							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
2489 2489
 									id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
2490 2490
 									id="gd-import-perc">0%</font> )
2491 2491
 								<div class="gd-fileprogress"></div>
@@ -2497,10 +2497,10 @@  discard block
 block discarded – undo
2497 2497
                     	<div class="gd-imex-btns" style="display:none;">
2498 2498
                         	<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
2499 2499
                         	<input onclick="gd_imex_PrepareImport(this, 'cat')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" />
2500
-                        	<input onclick="gd_imex_ContinueImport(this, 'cat')" type="button" value="<?php _e( "Continue Import Data", 'geodirectory' );?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2501
-                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'cat')"/>
2500
+                        	<input onclick="gd_imex_ContinueImport(this, 'cat')" type="button" value="<?php _e("Continue Import Data", 'geodirectory'); ?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2501
+                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory'); ?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'cat')"/>
2502 2502
 							<div id="gd_process_data" style="display:none">
2503
-								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
2503
+								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
2504 2504
 							</div>
2505 2505
 						</div>
2506 2506
 					</td>
@@ -2514,26 +2514,26 @@  discard block
 block discarded – undo
2514 2514
 	<div id="gd_ie_excategs" class="metabox-holder">
2515 2515
       <div class="meta-box-sortables ui-sortable">
2516 2516
         <div id="gd_ie_ex_cats" class="postbox gd-hndle-pbox">
2517
-          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Categories: Export CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2518
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Export CSV', 'geodirectory' );?></span></h3>
2517
+          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Categories: Export CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2518
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Export CSV', 'geodirectory'); ?></span></h3>
2519 2519
           <div class="inside">
2520 2520
             <table class="form-table">
2521 2521
 				<tbody>
2522 2522
 				  <tr>
2523
-					<td class="fld"><label for="gd_post_type"><?php _e( 'Post Type:', 'geodirectory' );?></label></td>
2524
-					<td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option;?></select></td>
2523
+					<td class="fld"><label for="gd_post_type"><?php _e('Post Type:', 'geodirectory'); ?></label></td>
2524
+					<td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option; ?></select></td>
2525 2525
 				  </tr>
2526 2526
 				   <tr>
2527
-					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td>
2528
-					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option;?></select><span class="description"><?php _e( 'Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory' );?></span></td>
2527
+					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
2528
+					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option; ?></select><span class="description"><?php _e('Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory'); ?></span></td>
2529 2529
 				  </tr>
2530 2530
 				  <tr>
2531
-					<td class="fld" style="vertical-align:top"><label><?php _e( 'Progress:', 'geodirectory' );?></label></td>
2532
-					<td><div id='gd_progressbar_box'><div id="gd_progressbar" class="gd_progressbar"><div class="gd-progress-label"></div></div></div><p style="display:inline-block"><?php _e( 'Elapsed Time:', 'geodirectory' );?></p>&nbsp;&nbsp;<p id="gd_timer" class="gd_timer">00:00:00</p></td>
2531
+					<td class="fld" style="vertical-align:top"><label><?php _e('Progress:', 'geodirectory'); ?></label></td>
2532
+					<td><div id='gd_progressbar_box'><div id="gd_progressbar" class="gd_progressbar"><div class="gd-progress-label"></div></div></div><p style="display:inline-block"><?php _e('Elapsed Time:', 'geodirectory'); ?></p>&nbsp;&nbsp;<p id="gd_timer" class="gd_timer">00:00:00</p></td>
2533 2533
 				  </tr>
2534 2534
 				  <tr class="gd-ie-actions">
2535 2535
 					<td style="vertical-align:top">
2536
-						<input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
2536
+						<input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
2537 2537
 					</td>
2538 2538
 					<td id="gd_ie_ex_files" class="gd-ie-files"></td>
2539 2539
 				  </tr>
@@ -2555,7 +2555,7 @@  discard block
 block discarded – undo
2555 2555
      * @param array $gd_chunksize_options File chunk size options.
2556 2556
      * @param string $nonce Wordpress security token for GD import & export.
2557 2557
 	 */
2558
-	do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
2558
+	do_action('geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce);
2559 2559
 	?>
2560 2560
   </div>
2561 2561
 </div>
@@ -2574,7 +2574,7 @@  discard block
 block discarded – undo
2574 2574
         jQuery.ajax({
2575 2575
             url: ajaxurl,
2576 2576
             type: "POST",
2577
-            data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce;?>',
2577
+            data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce; ?>',
2578 2578
             dataType: 'json',
2579 2579
             cache: false,
2580 2580
             success: function(data) {
@@ -2626,7 +2626,7 @@  discard block
 block discarded – undo
2626 2626
 
2627 2627
         jQuery(cont).find('.filelist .file').remove();
2628 2628
         
2629
-        jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr( PLZ_SELECT_CSV_FILE );?></p>");
2629
+        jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr(PLZ_SELECT_CSV_FILE); ?></p>");
2630 2630
         jQuery('#gd-import-msg', cont).show();
2631 2631
         
2632 2632
         return false;
@@ -2685,7 +2685,7 @@  discard block
 block discarded – undo
2685 2685
     jQuery.ajax({
2686 2686
         url: ajaxurl,
2687 2687
         type: "POST",
2688
-        data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce;?>',
2688
+        data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce; ?>',
2689 2689
         dataType : 'json',
2690 2690
         cache: false,
2691 2691
         success: function (data) {
@@ -2874,27 +2874,27 @@  discard block
 block discarded – undo
2874 2874
 
2875 2875
     var gdMsg = '<p></p>';
2876 2876
     if ( processed > 0 ) {
2877
-        var msgParse = '<p><?php echo addslashes( sprintf( __( 'Total %s item(s) found.', 'geodirectory' ), '%s' ) );?></p>';
2877
+        var msgParse = '<p><?php echo addslashes(sprintf(__('Total %s item(s) found.', 'geodirectory'), '%s')); ?></p>';
2878 2878
         msgParse = msgParse.replace("%s", processed);
2879 2879
         gdMsg += msgParse;
2880 2880
     }
2881 2881
 
2882 2882
     if ( updated > 0 ) {
2883
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) updated.', 'geodirectory' ), '%s', '%d' ) );?></p>';
2883
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) updated.', 'geodirectory'), '%s', '%d')); ?></p>';
2884 2884
         msgParse = msgParse.replace("%s", updated);
2885 2885
         msgParse = msgParse.replace("%d", processed);
2886 2886
         gdMsg += msgParse;
2887 2887
     }
2888 2888
 
2889 2889
     if ( created > 0 ) {
2890
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) added.', 'geodirectory' ), '%s', '%d' ) );?></p>';
2890
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) added.', 'geodirectory'), '%s', '%d')); ?></p>';
2891 2891
         msgParse = msgParse.replace("%s", created);
2892 2892
         msgParse = msgParse.replace("%d", processed);
2893 2893
         gdMsg += msgParse;
2894 2894
     }
2895 2895
 
2896 2896
     if ( skipped > 0 ) {
2897
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) ignored due to already exists.', 'geodirectory' ), '%s', '%d' ) );?></p>';
2897
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) ignored due to already exists.', 'geodirectory'), '%s', '%d')); ?></p>';
2898 2898
         msgParse = msgParse.replace("%s", skipped);
2899 2899
         msgParse = msgParse.replace("%d", processed);
2900 2900
         gdMsg += msgParse;
@@ -2904,17 +2904,17 @@  discard block
 block discarded – undo
2904 2904
         if (type=='loc') {
2905 2905
             invalid_addr = invalid;
2906 2906
         }
2907
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ), '%s', '%d' ) );?></p>';
2907
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory'), '%s', '%d')); ?></p>';
2908 2908
         msgParse = msgParse.replace("%s", invalid_addr);
2909 2909
         msgParse = msgParse.replace("%d", total);
2910 2910
         gdMsg += msgParse;
2911 2911
     }
2912 2912
 
2913 2913
     if (invalid > 0 && type!='loc') {
2914
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to blank title/invalid post type/invalid characters used in data.', 'geodirectory' ), '%s', '%d' ) );?></p>';
2914
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank title/invalid post type/invalid characters used in data.', 'geodirectory'), '%s', '%d')); ?></p>';
2915 2915
         
2916 2916
         if (type=='hood') {
2917
-            msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory' ), '%s', '%d' ) );?></p>';
2917
+            msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory'), '%s', '%d')); ?></p>';
2918 2918
         }
2919 2919
         msgParse = msgParse.replace("%s", invalid);
2920 2920
         msgParse = msgParse.replace("%d", total);
@@ -2922,7 +2922,7 @@  discard block
 block discarded – undo
2922 2922
     }
2923 2923
 
2924 2924
     if (images > 0) {
2925
-        gdMsg += '<p><?php echo addslashes( $upload_dir );?></p>';
2925
+        gdMsg += '<p><?php echo addslashes($upload_dir); ?></p>';
2926 2926
     }
2927 2927
     gdMsg += '<p></p>';
2928 2928
     jQuery('#gd-import-msg', cont).find('#message').removeClass('error').addClass('updated').html(gdMsg);
@@ -3086,9 +3086,9 @@  discard block
 block discarded – undo
3086 3086
             if (typeof filters !== 'undefined' && filters && doFilter) {
3087 3087
                 getTotal = true;
3088 3088
                 attach += '&_c=1';
3089
-                gd_progressbar(el, 0, '<i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Preparing...', 'geodirectory' ) );?>');
3089
+                gd_progressbar(el, 0, '<i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Preparing...', 'geodirectory')); ?>');
3090 3090
             } else {
3091
-                gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3091
+                gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3092 3092
             }
3093 3093
             jQuery(el).find('#gd_timer').text('00:00:01');
3094 3094
             jQuery('#gd_ie_ex_files', el).html('');
@@ -3097,7 +3097,7 @@  discard block
 block discarded – undo
3097 3097
         jQuery.ajax({
3098 3098
             url: ajaxurl,
3099 3099
             type: "POST",
3100
-            data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page + attach,
3100
+            data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page + attach,
3101 3101
             dataType : 'json',
3102 3102
             cache: false,
3103 3103
             beforeSend: function (jqXHR, settings) {},
@@ -3122,11 +3122,11 @@  discard block
 block discarded – undo
3122 3122
                         } else {
3123 3123
                             if (pages < page || pages == page) {
3124 3124
                                 window.clearInterval(timer_posts);
3125
-                                gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
3125
+                                gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
3126 3126
                             } else {
3127 3127
                                 var percentage = Math.round(((page * chunk_size) / total_posts) * 100);
3128 3128
                                 percentage = percentage > 100 ? 100 : percentage;
3129
-                                gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3129
+                                gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3130 3130
                             }
3131 3131
                             if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
3132 3132
                                 var obj_files = data.files;
@@ -3157,7 +3157,7 @@  discard block
 block discarded – undo
3157 3157
 
3158 3158
     function gd_process_export_cats(el, post_type, total_cats, chunk_size, pages, page) {
3159 3159
         if (page < 2) {
3160
-            gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3160
+            gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3161 3161
             jQuery(el).find('#gd_timer').text('00:00:01');
3162 3162
             jQuery('#gd_ie_ex_files', el).html('');
3163 3163
         }
@@ -3165,7 +3165,7 @@  discard block
 block discarded – undo
3165 3165
         jQuery.ajax({
3166 3166
             url: ajaxurl,
3167 3167
             type: "POST",
3168
-            data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page,
3168
+            data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page,
3169 3169
             dataType : 'json',
3170 3170
             cache: false,
3171 3171
             beforeSend: function (jqXHR, settings) {},
@@ -3179,11 +3179,11 @@  discard block
 block discarded – undo
3179 3179
                     } else {
3180 3180
                         if (pages < page || pages == page) {
3181 3181
                             window.clearInterval(timer_cats);
3182
-                            gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
3182
+                            gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
3183 3183
                         } else {
3184 3184
                             var percentage = Math.round(((page * chunk_size) / total_cats) * 100);
3185 3185
                             percentage = percentage > 100 ? 100 : percentage;
3186
-                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e( 'Exporting...', 'geodirectory' );?>');
3186
+                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e('Exporting...', 'geodirectory'); ?>');
3187 3187
                         }
3188 3188
                         if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
3189 3189
                             var obj_files = data.files;
@@ -3240,13 +3240,13 @@  discard block
 block discarded – undo
3240 3240
 function geodir_init_filesystem()
3241 3241
 {
3242 3242
 
3243
-    if(!function_exists('get_filesystem_method')){
3243
+    if (!function_exists('get_filesystem_method')) {
3244 3244
         require_once(ABSPATH."/wp-admin/includes/file.php");
3245 3245
     }
3246 3246
     $access_type = get_filesystem_method();
3247 3247
     if ($access_type === 'direct') {
3248 3248
         /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3249
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3249
+        $creds = request_filesystem_credentials(trailingslashit(site_url()).'wp-admin/', '', false, false, array());
3250 3250
 
3251 3251
         /* initialize the API */
3252 3252
         if (!WP_Filesystem($creds)) {
@@ -3259,7 +3259,7 @@  discard block
 block discarded – undo
3259 3259
         return $wp_filesystem;
3260 3260
         /* do our file manipulations below */
3261 3261
     } elseif (defined('FTP_USER')) {
3262
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3262
+        $creds = request_filesystem_credentials(trailingslashit(site_url()).'wp-admin/', '', false, false, array());
3263 3263
 
3264 3264
         /* initialize the API */
3265 3265
         if (!WP_Filesystem($creds)) {
@@ -3294,7 +3294,7 @@  discard block
 block discarded – undo
3294 3294
  * @package GeoDirectory
3295 3295
  */
3296 3296
 function geodir_filesystem_notice()
3297
-{   if ( defined( 'DOING_AJAX' ) ){return;}
3297
+{   if (defined('DOING_AJAX')) {return; }
3298 3298
     $access_type = get_filesystem_method();
3299 3299
     if ($access_type === 'direct') {
3300 3300
     } elseif (!defined('FTP_USER')) {
@@ -3335,64 +3335,64 @@  discard block
 block discarded – undo
3335 3335
     // try to set higher limits for import
3336 3336
     $max_input_time = ini_get('max_input_time');
3337 3337
     $max_execution_time = ini_get('max_execution_time');
3338
-    $memory_limit= ini_get('memory_limit');
3338
+    $memory_limit = ini_get('memory_limit');
3339 3339
 
3340
-    if(!$max_input_time || $max_input_time<3000){
3340
+    if (!$max_input_time || $max_input_time < 3000) {
3341 3341
         ini_set('max_input_time', 3000);
3342 3342
     }
3343 3343
 
3344
-    if(!$max_execution_time || $max_execution_time<3000){
3344
+    if (!$max_execution_time || $max_execution_time < 3000) {
3345 3345
         ini_set('max_execution_time', 3000);
3346 3346
     }
3347 3347
 
3348
-    if($memory_limit && str_replace('M','',$memory_limit)){
3349
-        if(str_replace('M','',$memory_limit)<256){
3348
+    if ($memory_limit && str_replace('M', '', $memory_limit)) {
3349
+        if (str_replace('M', '', $memory_limit) < 256) {
3350 3350
             ini_set('memory_limit', '256M');
3351 3351
         }
3352 3352
     }
3353 3353
 
3354 3354
     $json = array();
3355 3355
 
3356
-    if ( !current_user_can( 'manage_options' ) ) {
3357
-        wp_send_json( $json );
3356
+    if (!current_user_can('manage_options')) {
3357
+        wp_send_json($json);
3358 3358
     }
3359 3359
 
3360
-    $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3361
-    $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3362
-    $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3360
+    $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : NULL;
3361
+    $nonce = isset($_REQUEST['_nonce']) ? $_REQUEST['_nonce'] : NULL;
3362
+    $stat = isset($_REQUEST['_st']) ? $_REQUEST['_st'] : false;
3363 3363
 
3364
-    if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3365
-        wp_send_json( $json );
3364
+    if (!wp_verify_nonce($nonce, 'geodir_import_export_nonce')) {
3365
+        wp_send_json($json);
3366 3366
     }
3367 3367
 
3368
-    $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3369
-    $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3368
+    $post_type = isset($_REQUEST['_pt']) ? $_REQUEST['_pt'] : NULL;
3369
+    $chunk_per_page = isset($_REQUEST['_n']) ? absint($_REQUEST['_n']) : NULL;
3370 3370
     $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3371
-    $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3371
+    $chunk_page_no = isset($_REQUEST['_p']) ? absint($_REQUEST['_p']) : 1;
3372 3372
 
3373 3373
     $wp_filesystem = geodir_init_filesystem();
3374 3374
     if (!$wp_filesystem) {
3375
-        $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3376
-        wp_send_json( $json );
3375
+        $json['error'] = __('Filesystem ERROR: Could not access filesystem.', 'geodirectory');
3376
+        wp_send_json($json);
3377 3377
     }
3378 3378
 
3379 3379
     if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3380
-        $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3381
-        wp_send_json( $json );
3380
+        $json['error'] = __('Filesystem ERROR: '.$wp_filesystem->errors->get_error_message(), 'geodirectory');
3381
+        wp_send_json($json);
3382 3382
     }
3383 3383
 
3384
-    $csv_file_dir = geodir_path_import_export( false );
3385
-    if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3386
-        if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3387
-            $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3388
-            wp_send_json( $json );
3384
+    $csv_file_dir = geodir_path_import_export(false);
3385
+    if (!$wp_filesystem->is_dir($csv_file_dir)) {
3386
+        if (!$wp_filesystem->mkdir($csv_file_dir, FS_CHMOD_DIR)) {
3387
+            $json['error'] = __('ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory');
3388
+            wp_send_json($json);
3389 3389
         }
3390 3390
     }
3391 3391
     
3392 3392
     $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3393 3393
     $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3394 3394
 
3395
-    switch ( $task ) {
3395
+    switch ($task) {
3396 3396
         case 'export_posts': {
3397 3397
             // WPML
3398 3398
             $is_wpml = geodir_is_wpml();
@@ -3403,36 +3403,36 @@  discard block
 block discarded – undo
3403 3403
                 $sitepress->switch_lang('all', true);
3404 3404
             }
3405 3405
             // WPML
3406
-            if ( $post_type == 'gd_event' ) {
3407
-                add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3406
+            if ($post_type == 'gd_event') {
3407
+                add_filter('geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2);
3408 3408
             }
3409
-            $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
3409
+            $filters = !empty($_REQUEST['gd_imex']) && is_array($_REQUEST['gd_imex']) ? $_REQUEST['gd_imex'] : NULL;
3410 3410
             
3411
-            $file_name = $post_type . '_' . date( 'dmyHi' );
3412
-            if ( $filters && isset( $filters['start_date'] ) && isset( $filters['end_date'] ) ) {
3413
-                $file_name = $post_type . '_' . date_i18n( 'dmy', strtotime( $filters['start_date'] ) ) . '_' . date_i18n( 'dmy', strtotime( $filters['end_date'] ) );
3411
+            $file_name = $post_type.'_'.date('dmyHi');
3412
+            if ($filters && isset($filters['start_date']) && isset($filters['end_date'])) {
3413
+                $file_name = $post_type.'_'.date_i18n('dmy', strtotime($filters['start_date'])).'_'.date_i18n('dmy', strtotime($filters['end_date']));
3414 3414
             }
3415
-            $posts_count = geodir_get_posts_count( $post_type );
3416
-            $file_url_base = geodir_path_import_export() . '/';
3417
-            $file_url = $file_url_base . $file_name . '.csv';
3418
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3419
-            $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3415
+            $posts_count = geodir_get_posts_count($post_type);
3416
+            $file_url_base = geodir_path_import_export().'/';
3417
+            $file_url = $file_url_base.$file_name.'.csv';
3418
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3419
+            $file_path_temp = $csv_file_dir.'/'.$post_type.'_'.$nonce.'.csv';
3420 3420
             
3421 3421
             $chunk_file_paths = array();
3422 3422
 
3423
-            if ( isset( $_REQUEST['_c'] ) ) {
3423
+            if (isset($_REQUEST['_c'])) {
3424 3424
                 $json['total'] = $posts_count;
3425 3425
                 // WPML
3426 3426
                 if ($is_wpml) {
3427 3427
                     $sitepress->switch_lang($active_lang, true);
3428 3428
                 }
3429 3429
                 // WPML
3430
-                wp_send_json( $json );
3430
+                wp_send_json($json);
3431 3431
                 gd_die();
3432
-            } else if ( isset( $_REQUEST['_st'] ) ) {
3433
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3434
-                $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3435
-                $percentage = min( $percentage, 100 );
3432
+            } else if (isset($_REQUEST['_st'])) {
3433
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3434
+                $percentage = count($posts_count) > 0 && $line_count > 0 ? ceil($line_count / $posts_count) * 100 : 0;
3435
+                $percentage = min($percentage, 100);
3436 3436
                 
3437 3437
                 $json['percentage'] = $percentage;
3438 3438
                 // WPML
@@ -3440,45 +3440,45 @@  discard block
 block discarded – undo
3440 3440
                     $sitepress->switch_lang($active_lang, true);
3441 3441
                 }
3442 3442
                 // WPML
3443
-                wp_send_json( $json );
3443
+                wp_send_json($json);
3444 3444
                 gd_die();
3445 3445
             } else {
3446
-                if ( !$posts_count > 0 ) {
3447
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3446
+                if (!$posts_count > 0) {
3447
+                    $json['error'] = __('No records to export.', 'geodirectory');
3448 3448
                 } else {
3449 3449
                     $total_posts = $posts_count;
3450 3450
                     if ($chunk_per_page > $total_posts) {
3451 3451
                         $chunk_per_page = $total_posts;
3452 3452
                     }
3453
-                    $chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3453
+                    $chunk_total_pages = ceil($total_posts / $chunk_per_page);
3454 3454
                     
3455 3455
                     $j = $chunk_page_no;
3456
-                    $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3456
+                    $chunk_save_posts = geodir_imex_get_posts($post_type, $chunk_per_page, $j);
3457 3457
                     
3458 3458
                     $per_page = 500;
3459 3459
                     if ($per_page > $chunk_per_page) {
3460 3460
                         $per_page = $chunk_per_page;
3461 3461
                     }
3462
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3462
+                    $total_pages = ceil($chunk_per_page / $per_page);
3463 3463
                     
3464
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3465
-                        $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3464
+                    for ($i = 0; $i <= $total_pages; $i++) {
3465
+                        $save_posts = array_slice($chunk_save_posts, ($i * $per_page), $per_page);
3466 3466
                         
3467 3467
                         $clear = $i == 0 ? true : false;
3468
-                        geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3468
+                        geodir_save_csv_data($file_path_temp, $save_posts, $clear);
3469 3469
                     }
3470 3470
                         
3471
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3472
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3473
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3474
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3475
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3471
+                    if ($wp_filesystem->exists($file_path_temp)) {
3472
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3473
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3474
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3475
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3476 3476
                         
3477
-                        $file_url = $file_url_base . $chunk_file_name;
3478
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3477
+                        $file_url = $file_url_base.$chunk_file_name;
3478
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3479 3479
                     }
3480 3480
                     
3481
-                    if ( !empty($chunk_file_paths) ) {
3481
+                    if (!empty($chunk_file_paths)) {
3482 3482
                         $json['total'] = $posts_count;
3483 3483
                         $json['files'] = $chunk_file_paths;
3484 3484
                     } else {
@@ -3486,7 +3486,7 @@  discard block
 block discarded – undo
3486 3486
                             $json['total'] = $posts_count;
3487 3487
                             $json['files'] = array();
3488 3488
                         } else {
3489
-                            $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3489
+                            $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
3490 3490
                         }
3491 3491
                     }
3492 3492
                 }
@@ -3495,7 +3495,7 @@  discard block
 block discarded – undo
3495 3495
                     $sitepress->switch_lang($active_lang, true);
3496 3496
                 }
3497 3497
                 // WPML
3498
-                wp_send_json( $json );
3498
+                wp_send_json($json);
3499 3499
             }
3500 3500
         }
3501 3501
         break;
@@ -3509,20 +3509,20 @@  discard block
 block discarded – undo
3509 3509
                 $sitepress->switch_lang('all', true);
3510 3510
             }
3511 3511
             // WPML
3512
-            $file_name = $post_type . 'category_' . date( 'dmyHi' );
3512
+            $file_name = $post_type.'category_'.date('dmyHi');
3513 3513
             
3514
-            $terms_count = geodir_get_terms_count( $post_type );
3515
-            $file_url_base = geodir_path_import_export() . '/';
3516
-            $file_url = $file_url_base . $file_name . '.csv';
3517
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3518
-            $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3514
+            $terms_count = geodir_get_terms_count($post_type);
3515
+            $file_url_base = geodir_path_import_export().'/';
3516
+            $file_url = $file_url_base.$file_name.'.csv';
3517
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3518
+            $file_path_temp = $csv_file_dir.'/'.$post_type.'category_'.$nonce.'.csv';
3519 3519
             
3520 3520
             $chunk_file_paths = array();
3521 3521
             
3522
-            if ( isset( $_REQUEST['_st'] ) ) {
3523
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3524
-                $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3525
-                $percentage = min( $percentage, 100 );
3522
+            if (isset($_REQUEST['_st'])) {
3523
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3524
+                $percentage = count($terms_count) > 0 && $line_count > 0 ? ceil($line_count / $terms_count) * 100 : 0;
3525
+                $percentage = min($percentage, 100);
3526 3526
                 
3527 3527
                 $json['percentage'] = $percentage;
3528 3528
                 // WPML
@@ -3530,48 +3530,48 @@  discard block
 block discarded – undo
3530 3530
                     $sitepress->switch_lang($active_lang, true);
3531 3531
                 }
3532 3532
                 // WPML
3533
-                wp_send_json( $json );
3533
+                wp_send_json($json);
3534 3534
             } else {
3535
-                if ( !$terms_count > 0 ) {
3536
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3535
+                if (!$terms_count > 0) {
3536
+                    $json['error'] = __('No records to export.', 'geodirectory');
3537 3537
                 } else {
3538 3538
                     $total_terms = $terms_count;
3539 3539
                     if ($chunk_per_page > $terms_count) {
3540 3540
                         $chunk_per_page = $terms_count;
3541 3541
                     }
3542
-                    $chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3542
+                    $chunk_total_pages = ceil($total_terms / $chunk_per_page);
3543 3543
                     
3544 3544
                     $j = $chunk_page_no;
3545
-                    $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3545
+                    $chunk_save_terms = geodir_imex_get_terms($post_type, $chunk_per_page, $j);
3546 3546
                     
3547 3547
                     $per_page = 500;
3548 3548
                     if ($per_page > $chunk_per_page) {
3549 3549
                         $per_page = $chunk_per_page;
3550 3550
                     }
3551
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3551
+                    $total_pages = ceil($chunk_per_page / $per_page);
3552 3552
                     
3553
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3554
-                        $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3553
+                    for ($i = 0; $i <= $total_pages; $i++) {
3554
+                        $save_terms = array_slice($chunk_save_terms, ($i * $per_page), $per_page);
3555 3555
                         
3556 3556
                         $clear = $i == 0 ? true : false;
3557
-                        geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3557
+                        geodir_save_csv_data($file_path_temp, $save_terms, $clear);
3558 3558
                     }
3559 3559
                     
3560
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3561
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3562
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3563
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3564
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3560
+                    if ($wp_filesystem->exists($file_path_temp)) {
3561
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3562
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3563
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3564
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3565 3565
                         
3566
-                        $file_url = $file_url_base . $chunk_file_name;
3567
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3566
+                        $file_url = $file_url_base.$chunk_file_name;
3567
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3568 3568
                     }
3569 3569
                     
3570
-                    if ( !empty($chunk_file_paths) ) {
3570
+                    if (!empty($chunk_file_paths)) {
3571 3571
                         $json['total'] = $terms_count;
3572 3572
                         $json['files'] = $chunk_file_paths;
3573 3573
                     } else {
3574
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3574
+                        $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
3575 3575
                     }
3576 3576
                 }
3577 3577
                 // WPML
@@ -3579,127 +3579,127 @@  discard block
 block discarded – undo
3579 3579
                     $sitepress->switch_lang($active_lang, true);
3580 3580
                 }
3581 3581
                 // WPML
3582
-                wp_send_json( $json );
3582
+                wp_send_json($json);
3583 3583
             }
3584 3584
         }
3585 3585
         break;
3586 3586
         case 'export_locations': {
3587
-            $file_url_base = geodir_path_import_export() . '/';
3588
-            $file_name = 'gd_locations_' . date( 'dmyHi' );
3589
-            $file_url = $file_url_base . $file_name . '.csv';
3590
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3591
-            $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3587
+            $file_url_base = geodir_path_import_export().'/';
3588
+            $file_name = 'gd_locations_'.date('dmyHi');
3589
+            $file_url = $file_url_base.$file_name.'.csv';
3590
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3591
+            $file_path_temp = $csv_file_dir.'/gd_locations_'.$nonce.'.csv';
3592 3592
             
3593
-            $items_count = (int)geodir_location_imex_count_locations();
3593
+            $items_count = (int) geodir_location_imex_count_locations();
3594 3594
             
3595
-            if ( isset( $_REQUEST['_st'] ) ) {
3596
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3597
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3598
-                $percentage = min( $percentage, 100 );
3595
+            if (isset($_REQUEST['_st'])) {
3596
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3597
+                $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0;
3598
+                $percentage = min($percentage, 100);
3599 3599
                 
3600 3600
                 $json['percentage'] = $percentage;
3601
-                wp_send_json( $json );
3601
+                wp_send_json($json);
3602 3602
             } else {
3603 3603
                 $chunk_file_paths = array();
3604 3604
                 
3605
-                if ( !$items_count > 0 ) {
3606
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3605
+                if (!$items_count > 0) {
3606
+                    $json['error'] = __('No records to export.', 'geodirectory');
3607 3607
                 } else {
3608
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3609
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3608
+                    $chunk_per_page = min($chunk_per_page, $items_count);
3609
+                    $chunk_total_pages = ceil($items_count / $chunk_per_page);
3610 3610
                     
3611 3611
                     $j = $chunk_page_no;
3612
-                    $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3612
+                    $chunk_save_items = geodir_location_imex_locations_data($chunk_per_page, $j);
3613 3613
                     
3614 3614
                     $per_page = 500;
3615
-                    $per_page = min( $per_page, $chunk_per_page );
3616
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3615
+                    $per_page = min($per_page, $chunk_per_page);
3616
+                    $total_pages = ceil($chunk_per_page / $per_page);
3617 3617
                     
3618
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3619
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3618
+                    for ($i = 0; $i <= $total_pages; $i++) {
3619
+                        $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page);
3620 3620
                         
3621 3621
                         $clear = $i == 0 ? true : false;
3622
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3622
+                        geodir_save_csv_data($file_path_temp, $save_items, $clear);
3623 3623
                     }
3624 3624
                     
3625
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3626
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3627
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3628
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3629
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3625
+                    if ($wp_filesystem->exists($file_path_temp)) {
3626
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3627
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3628
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3629
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3630 3630
                         
3631
-                        $file_url = $file_url_base . $chunk_file_name;
3632
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3631
+                        $file_url = $file_url_base.$chunk_file_name;
3632
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3633 3633
                     }
3634 3634
                     
3635
-                    if ( !empty($chunk_file_paths) ) {
3635
+                    if (!empty($chunk_file_paths)) {
3636 3636
                         $json['total'] = $items_count;
3637 3637
                         $json['files'] = $chunk_file_paths;
3638 3638
                     } else {
3639
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3639
+                        $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
3640 3640
                     }
3641 3641
                 }
3642
-                wp_send_json( $json );
3642
+                wp_send_json($json);
3643 3643
             }
3644 3644
         }
3645 3645
         break;
3646 3646
         case 'export_hoods': {
3647
-            $file_url_base = geodir_path_import_export() . '/';
3648
-            $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3649
-            $file_url = $file_url_base . $file_name . '.csv';
3650
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3651
-            $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3647
+            $file_url_base = geodir_path_import_export().'/';
3648
+            $file_name = 'gd_neighbourhoods_'.date('dmyHi');
3649
+            $file_url = $file_url_base.$file_name.'.csv';
3650
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3651
+            $file_path_temp = $csv_file_dir.'/gd_neighbourhoods_'.$nonce.'.csv';
3652 3652
             
3653
-            $items_count = (int)geodir_location_imex_count_neighbourhoods();
3653
+            $items_count = (int) geodir_location_imex_count_neighbourhoods();
3654 3654
             
3655
-            if ( isset( $_REQUEST['_st'] ) ) {
3656
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3657
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3658
-                $percentage = min( $percentage, 100 );
3655
+            if (isset($_REQUEST['_st'])) {
3656
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3657
+                $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0;
3658
+                $percentage = min($percentage, 100);
3659 3659
                 
3660 3660
                 $json['percentage'] = $percentage;
3661
-                wp_send_json( $json );
3661
+                wp_send_json($json);
3662 3662
             } else {
3663 3663
                 $chunk_file_paths = array();
3664 3664
                 
3665
-                if ( !$items_count > 0 ) {
3666
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3665
+                if (!$items_count > 0) {
3666
+                    $json['error'] = __('No records to export.', 'geodirectory');
3667 3667
                 } else {
3668
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3669
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3668
+                    $chunk_per_page = min($chunk_per_page, $items_count);
3669
+                    $chunk_total_pages = ceil($items_count / $chunk_per_page);
3670 3670
                     
3671 3671
                     $j = $chunk_page_no;
3672
-                    $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3672
+                    $chunk_save_items = geodir_location_imex_neighbourhoods_data($chunk_per_page, $j);
3673 3673
                     
3674 3674
                     $per_page = 500;
3675
-                    $per_page = min( $per_page, $chunk_per_page );
3676
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3675
+                    $per_page = min($per_page, $chunk_per_page);
3676
+                    $total_pages = ceil($chunk_per_page / $per_page);
3677 3677
                     
3678
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3679
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3678
+                    for ($i = 0; $i <= $total_pages; $i++) {
3679
+                        $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page);
3680 3680
                         
3681 3681
                         $clear = $i == 0 ? true : false;
3682
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3682
+                        geodir_save_csv_data($file_path_temp, $save_items, $clear);
3683 3683
                     }
3684 3684
                     
3685
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3686
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3687
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3688
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3689
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3685
+                    if ($wp_filesystem->exists($file_path_temp)) {
3686
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3687
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3688
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3689
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3690 3690
                         
3691
-                        $file_url = $file_url_base . $chunk_file_name;
3692
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3691
+                        $file_url = $file_url_base.$chunk_file_name;
3692
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3693 3693
                     }
3694 3694
                     
3695
-                    if ( !empty($chunk_file_paths) ) {
3695
+                    if (!empty($chunk_file_paths)) {
3696 3696
                         $json['total'] = $items_count;
3697 3697
                         $json['files'] = $chunk_file_paths;
3698 3698
                     } else {
3699
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3699
+                        $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
3700 3700
                     }
3701 3701
                 }
3702
-                wp_send_json( $json );
3702
+                wp_send_json($json);
3703 3703
             }
3704 3704
         }
3705 3705
         break;
@@ -3716,34 +3716,34 @@  discard block
 block discarded – undo
3716 3716
             }
3717 3717
             // WPML
3718 3718
             
3719
-            ini_set( 'auto_detect_line_endings', true );
3719
+            ini_set('auto_detect_line_endings', true);
3720 3720
             
3721 3721
             $uploads = wp_upload_dir();
3722 3722
             $uploads_dir = $uploads['path'];
3723 3723
             $uploads_subdir = $uploads['subdir'];
3724 3724
             
3725
-            $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3726
-            $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3725
+            $csv_file = isset($_POST['_file']) ? $_POST['_file'] : NULL;
3726
+            $import_choice = isset($_REQUEST['_ch']) ? $_REQUEST['_ch'] : 'skip';
3727 3727
             
3728
-            $csv_file_arr = explode( '/', $csv_file );
3729
-            $csv_filename = end( $csv_file_arr );
3730
-            $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3728
+            $csv_file_arr = explode('/', $csv_file);
3729
+            $csv_filename = end($csv_file_arr);
3730
+            $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$csv_filename;
3731 3731
             
3732 3732
             $json['file'] = $csv_file;
3733
-            $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3733
+            $json['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
3734 3734
             $file = array();
3735 3735
 
3736
-            if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3737
-                $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
3736
+            if ($csv_file && $wp_filesystem->is_file($target_path) && $wp_filesystem->exists($target_path)) {
3737
+                $wp_filetype = wp_check_filetype_and_ext($target_path, $csv_filename);
3738 3738
                 
3739 3739
                 if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
3740 3740
                     $json['error'] = NULL;
3741 3741
 
3742 3742
                     $lc_all = setlocale(LC_ALL, 0); // Fix issue of fgetcsv ignores special characters when they are at the beginning of line
3743 3743
                     setlocale(LC_ALL, 'en_US.UTF-8');
3744
-                    if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
3745
-                        while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
3746
-                            if ( !empty( $data ) ) {
3744
+                    if (($handle = fopen($target_path, "r")) !== FALSE) {
3745
+                        while (($data = fgetcsv($handle, 100000, ",")) !== FALSE) {
3746
+                            if (!empty($data)) {
3747 3747
                                 $file[] = $data;
3748 3748
                             }
3749 3749
                         }
@@ -3757,19 +3757,19 @@  discard block
 block discarded – undo
3757 3757
                         $json['error'] = __('No data found in csv file.', 'geodirectory');
3758 3758
                     }
3759 3759
                 } else {
3760
-                    wp_send_json( $json );
3760
+                    wp_send_json($json);
3761 3761
                 }
3762 3762
             } else {
3763
-                wp_send_json( $json );
3763
+                wp_send_json($json);
3764 3764
             }
3765 3765
             
3766
-            if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
3767
-                wp_send_json( $json );
3766
+            if ($task == 'prepare_import' || !empty($json['error'])) {
3767
+                wp_send_json($json);
3768 3768
             }
3769 3769
             
3770 3770
             $total = $json['rows'];
3771
-            $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
3772
-            $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
3771
+            $limit = isset($_POST['limit']) ? (int) $_POST['limit'] : 1;
3772
+            $processed = isset($_POST['processed']) ? (int) $_POST['processed'] : 0;
3773 3773
             
3774 3774
             $count = $limit;
3775 3775
             
@@ -3794,13 +3794,13 @@  discard block
 block discarded – undo
3794 3794
             
3795 3795
             $post_types = geodir_get_posttypes();
3796 3796
 
3797
-            if ( $task == 'import_cat' ) {
3797
+            if ($task == 'import_cat') {
3798 3798
                 if (!empty($file)) {
3799 3799
                     $columns = isset($file[0]) ? $file[0] : NULL;
3800 3800
                     
3801 3801
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
3802 3802
                         $json['error'] = CSV_INVAILD_FILE;
3803
-                        wp_send_json( $json );
3803
+                        wp_send_json($json);
3804 3804
                         exit;
3805 3805
                     }
3806 3806
                     
@@ -3811,7 +3811,7 @@  discard block
 block discarded – undo
3811 3811
                         
3812 3812
                         if (isset($file[$index])) {
3813 3813
                             $row = $file[$index];
3814
-                            $row = array_map( 'trim', $row );
3814
+                            $row = array_map('trim', $row);
3815 3815
                             //$row = array_map( 'utf8_encode', $row );
3816 3816
                             
3817 3817
                             $cat_id = '';
@@ -3828,42 +3828,42 @@  discard block
 block discarded – undo
3828 3828
                             $cat_id_original = '';
3829 3829
                             
3830 3830
                             $c = 0;
3831
-                            foreach ($columns as $column ) {
3832
-                                if ( $column == 'cat_id' ) {
3833
-                                    $cat_id = (int)$row[$c];
3834
-                                } else if ( $column == 'cat_name' ) {
3831
+                            foreach ($columns as $column) {
3832
+                                if ($column == 'cat_id') {
3833
+                                    $cat_id = (int) $row[$c];
3834
+                                } else if ($column == 'cat_name') {
3835 3835
                                     $cat_name = $row[$c];
3836
-                                } else if ( $column == 'cat_slug' ) {
3836
+                                } else if ($column == 'cat_slug') {
3837 3837
                                     $cat_slug = $row[$c];
3838
-                                } else if ( $column == 'cat_posttype' ) {
3838
+                                } else if ($column == 'cat_posttype') {
3839 3839
                                     $cat_posttype = $row[$c];
3840
-                                } else if ( $column == 'cat_parent' ) {
3840
+                                } else if ($column == 'cat_parent') {
3841 3841
                                     $cat_parent = trim($row[$c]);
3842
-                                } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
3842
+                                } else if ($column == 'cat_schema' && $row[$c] != '') {
3843 3843
                                     $cat_schema = $row[$c];
3844
-                                } else if ( $column == 'cat_description' ) {
3844
+                                } else if ($column == 'cat_description') {
3845 3845
                                     $cat_description = $row[$c];
3846
-                                } else if ( $column == 'cat_top_description' ) {
3846
+                                } else if ($column == 'cat_top_description') {
3847 3847
                                     $cat_top_description = $row[$c];
3848
-                                } else if ( $column == 'cat_image' ) {
3848
+                                } else if ($column == 'cat_image') {
3849 3849
                                     $cat_image = $row[$c];
3850
-                                } else if ( $column == 'cat_icon' ) {
3850
+                                } else if ($column == 'cat_icon') {
3851 3851
                                     $cat_icon = $row[$c];
3852 3852
                                 }
3853 3853
                                 // WPML
3854
-                                if ( $is_wpml ) {
3855
-                                    if ( $column == 'cat_language' ) {
3856
-                                        $cat_language = geodir_strtolower( trim( $row[$c] ) );
3857
-                                    } else if ( $column == 'cat_id_original' ) {
3858
-                                        $cat_id_original = (int)$row[$c];
3854
+                                if ($is_wpml) {
3855
+                                    if ($column == 'cat_language') {
3856
+                                        $cat_language = geodir_strtolower(trim($row[$c]));
3857
+                                    } else if ($column == 'cat_id_original') {
3858
+                                        $cat_id_original = (int) $row[$c];
3859 3859
                                     }
3860 3860
                                 }
3861 3861
                                 // WPML
3862 3862
                                 $c++;
3863 3863
                             }
3864 3864
                             
3865
-                            if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
3866
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
3865
+                            if ($cat_name == '' || !in_array($cat_posttype, $post_types)) {
3866
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank title/invalid post type', 'geodirectory'));
3867 3867
                                 
3868 3868
                                 $invalid++;
3869 3869
                                 continue;
@@ -3881,24 +3881,24 @@  discard block
 block discarded – undo
3881 3881
                             $term_data['description'] = $cat_description;
3882 3882
                             $term_data['cat_schema'] = $cat_schema;
3883 3883
                             $term_data['top_description'] = $cat_top_description;
3884
-                            $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
3885
-                            $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
3884
+                            $term_data['image'] = $cat_image != '' ? basename($cat_image) : '';
3885
+                            $term_data['icon'] = $cat_icon != '' ? basename($cat_icon) : '';
3886 3886
                             
3887 3887
                             //$term_data = array_map( 'utf8_encode', $term_data );
3888 3888
                             
3889
-                            $taxonomy = $cat_posttype . 'category';
3889
+                            $taxonomy = $cat_posttype.'category';
3890 3890
                             
3891 3891
                             $term_data['taxonomy'] = $taxonomy;
3892 3892
 
3893 3893
                             $term_parent_id = 0;
3894
-                            if ($cat_parent != "" || (int)$cat_parent > 0) {
3894
+                            if ($cat_parent != "" || (int) $cat_parent > 0) {
3895 3895
                                 $term_parent = '';
3896 3896
                                 
3897
-                                if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
3897
+                                if ($term_parent = get_term_by('name', $cat_parent, $taxonomy)) {
3898 3898
                                     //
3899
-                                } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
3899
+                                } else if ($term_parent = get_term_by('slug', $cat_parent, $taxonomy)) {
3900 3900
                                     //
3901
-                                } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
3901
+                                } else if ($term_parent = get_term_by('id', $cat_parent, $taxonomy)) {
3902 3902
                                     //
3903 3903
                                 } else {
3904 3904
                                     $term_parent_data = array();
@@ -3906,104 +3906,104 @@  discard block
 block discarded – undo
3906 3906
                                     //$term_parent_data = array_map( 'utf8_encode', $term_parent_data );
3907 3907
                                     $term_parent_data['taxonomy'] = $taxonomy;
3908 3908
                                     
3909
-                                    $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
3909
+                                    $term_parent_id = (int) geodir_imex_insert_term($taxonomy, $term_parent_data);
3910 3910
                                 }
3911 3911
                                 
3912
-                                if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
3913
-                                    $term_parent_id = (int)$term_parent->term_id;
3912
+                                if (!empty($term_parent) && !is_wp_error($term_parent)) {
3913
+                                    $term_parent_id = (int) $term_parent->term_id;
3914 3914
                                 }
3915 3915
                             }
3916
-                            $term_data['parent'] = (int)$term_parent_id;
3916
+                            $term_data['parent'] = (int) $term_parent_id;
3917 3917
 
3918 3918
                             $term_id = NULL;
3919
-                            if ( $import_choice == 'update' ) {
3920
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
3919
+                            if ($import_choice == 'update') {
3920
+                                if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
3921 3921
                                     $term_data['term_id'] = $term['term_id'];
3922 3922
                                     
3923
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
3923
+                                    if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
3924 3924
                                         $updated++;
3925 3925
                                     } else {
3926 3926
                                         $invalid++;
3927
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
3927
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory'));
3928 3928
                                     }
3929
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
3929
+                                } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
3930 3930
                                     $term_data['term_id'] = $term['term_id'];
3931 3931
                                     
3932
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
3932
+                                    if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
3933 3933
                                         $updated++;
3934 3934
                                     } else {
3935 3935
                                         $invalid++;
3936
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
3936
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory'));
3937 3937
                                     }
3938 3938
                                 } else {
3939
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
3939
+                                    if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
3940 3940
                                         $created++;
3941 3941
                                     } else {
3942 3942
                                         $invalid++;
3943
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
3943
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory'));
3944 3944
                                     }
3945 3945
                                 }
3946
-                            } else if ( $import_choice == 'skip' ) {
3947
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
3946
+                            } else if ($import_choice == 'skip') {
3947
+                                if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
3948 3948
                                     $skipped++;
3949
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
3949
+                                } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
3950 3950
                                     $skipped++;
3951 3951
                                 } else {
3952
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
3952
+                                    if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
3953 3953
                                         $created++;
3954 3954
                                     } else {
3955 3955
                                         $invalid++;
3956
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
3956
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be updated due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory'));
3957 3957
                                     }
3958 3958
                                 }
3959 3959
                             } else {
3960 3960
                                 $invalid++;
3961
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory' ) );
3961
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to invalid data (check & remove if any invalid characters used in data)', 'geodirectory'));
3962 3962
                             }
3963 3963
                             
3964
-                            if ( $term_id ) {
3964
+                            if ($term_id) {
3965 3965
                                 // WPML
3966 3966
                                 if ($is_wpml && $cat_id_original > 0 && $cat_language != '') {
3967
-                                    $wpml_element_type = 'tax_' . $taxonomy;
3968
-                                    $source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type );
3967
+                                    $wpml_element_type = 'tax_'.$taxonomy;
3968
+                                    $source_language = geodir_get_language_for_element($cat_id_original, $wpml_element_type);
3969 3969
                                     $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
3970 3970
 
3971
-                                    $trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type );
3971
+                                    $trid = $sitepress->get_element_trid($cat_id_original, $wpml_element_type);
3972 3972
                                     
3973
-                                    $sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language );
3973
+                                    $sitepress->set_element_language_details($term_id, $wpml_element_type, $trid, $cat_language, $source_language);
3974 3974
                                 }
3975 3975
                                 // WPML
3976 3976
                                 
3977
-                                if ( isset( $term_data['top_description'] ) ) {
3978
-                                    geodir_update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
3977
+                                if (isset($term_data['top_description'])) {
3978
+                                    geodir_update_tax_meta($term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype);
3979 3979
                                 }
3980 3980
                                 
3981
-                                if ( isset( $term_data['cat_schema'] ) ) {
3982
-                                    geodir_update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
3981
+                                if (isset($term_data['cat_schema'])) {
3982
+                                    geodir_update_tax_meta($term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype);
3983 3983
                                 }
3984 3984
             
3985 3985
                                 $attachment = false;
3986
-                                if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
3987
-                                    $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
3988
-                                    $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
3986
+                                if (isset($term_data['image']) && $term_data['image'] != '') {
3987
+                                    $cat_image = geodir_get_default_catimage($term_id, $cat_posttype);
3988
+                                    $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : '';
3989 3989
                                     
3990
-                                    if ( basename($cat_image) != $term_data['image'] ) {
3990
+                                    if (basename($cat_image) != $term_data['image']) {
3991 3991
                                         $attachment = true;
3992
-                                        geodir_update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
3992
+                                        geodir_update_tax_meta($term_id, 'ct_cat_default_img', array('id' => 'image', 'src' => $uploads['url'].'/'.$term_data['image']), $cat_posttype);
3993 3993
                                     }
3994 3994
                                 }
3995 3995
                                 
3996
-                                if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
3997
-                                    $cat_icon = geodir_get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
3998
-                                    $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
3996
+                                if (isset($term_data['icon']) && $term_data['icon'] != '') {
3997
+                                    $cat_icon = geodir_get_tax_meta($term_id, 'ct_cat_icon', false, $cat_posttype);
3998
+                                    $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : '';
3999 3999
 
4000
-                                    if ( basename($cat_icon) != $term_data['icon'] ) {
4000
+                                    if (basename($cat_icon) != $term_data['icon']) {
4001 4001
                                         $attachment = true;
4002
-                                        geodir_update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4002
+                                        geodir_update_tax_meta($term_id, 'ct_cat_icon', array('id' => 'icon', 'src' => $uploads['url'].'/'.$term_data['icon']), $cat_posttype);
4003 4003
                                     }
4004 4004
                                 }
4005 4005
                                 
4006
-                                if ( $attachment ) {
4006
+                                if ($attachment) {
4007 4007
                                     $images++;
4008 4008
                                 }
4009 4009
                             }
@@ -4025,35 +4025,35 @@  discard block
 block discarded – undo
4025 4025
                 $json['invalid'] = $invalid;
4026 4026
                 $json['images'] = $images;
4027 4027
                 
4028
-                wp_send_json( $json );
4028
+                wp_send_json($json);
4029 4029
                 exit;
4030
-            } else if ( $task == 'import_post' ) {
4031
-                $xtimings['###1'] = microtime(true)-$xstart;
4030
+            } else if ($task == 'import_post') {
4031
+                $xtimings['###1'] = microtime(true) - $xstart;
4032 4032
                 //run some stuff to make the import quicker
4033
-                wp_defer_term_counting( true );
4034
-                wp_defer_comment_counting( true );
4035
-                $wpdb->query( 'SET autocommit = 0;' );
4033
+                wp_defer_term_counting(true);
4034
+                wp_defer_comment_counting(true);
4035
+                $wpdb->query('SET autocommit = 0;');
4036 4036
 //
4037 4037
 //                remove_all_actions('publish_post');
4038 4038
 //                remove_all_actions('transition_post_status');
4039 4039
 //                remove_all_actions('publish_future_post');
4040 4040
 
4041 4041
                 if (!empty($file)) {
4042
-                    $is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
4042
+                    $is_claim_active = is_plugin_active('geodir_claim_listing/geodir_claim_listing.php') && get_option('geodir_claim_enable') === 'yes' ? true : false;
4043 4043
                     $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4044 4044
                     $default_status = 'publish';
4045
-                    $current_date = date_i18n( 'Y-m-d', time() );
4045
+                    $current_date = date_i18n('Y-m-d', time());
4046 4046
                     
4047 4047
                     $columns = isset($file[0]) ? $file[0] : NULL;
4048 4048
                     
4049 4049
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4050 4050
                         $json['error'] = CSV_INVAILD_FILE;
4051
-                        wp_send_json( $json );
4051
+                        wp_send_json($json);
4052 4052
                         exit;
4053 4053
                     }
4054
-                    $xtimings['###2'] = microtime(true)-$xstart;
4054
+                    $xtimings['###2'] = microtime(true) - $xstart;
4055 4055
                     $gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
4056
-                    $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' );
4056
+                    $wp_chars_error = __('(check & remove if any invalid characters used in data)', 'geodirectory');
4057 4057
                     $processed_actual = 0;
4058 4058
                     for ($i = 1; $i <= $limit; $i++) {
4059 4059
                         $index = $processed + $i;
@@ -4062,9 +4062,9 @@  discard block
 block discarded – undo
4062 4062
                         if (isset($file[$index])) {
4063 4063
                             $processed_actual++;
4064 4064
                             $row = $file[$index];
4065
-                            $row = array_map( 'trim', $row );
4065
+                            $row = array_map('trim', $row);
4066 4066
                             //$row = array_map( 'utf8_encode', $row );
4067
-                            $row = array_map( 'addslashes_gpc', $row );
4067
+                            $row = array_map('addslashes_gpc', $row);
4068 4068
                             
4069 4069
                             $post_id = '';
4070 4070
                             $post_title = '';
@@ -4103,82 +4103,82 @@  discard block
 block discarded – undo
4103 4103
                             $original_post_id = '';
4104 4104
                             
4105 4105
                             $c = 0;
4106
-                            foreach ($columns as $column ) {
4106
+                            foreach ($columns as $column) {
4107 4107
                                 $gd_post[$column] = $row[$c];
4108 4108
                                 
4109
-                                if ( $column == 'post_id' ) {
4109
+                                if ($column == 'post_id') {
4110 4110
                                     $post_id = $row[$c];
4111
-                                } else if ( $column == 'post_title' ) {
4111
+                                } else if ($column == 'post_title') {
4112 4112
                                     $post_title = sanitize_text_field($row[$c]);
4113
-                                } else if ( $column == 'post_author' ) {
4113
+                                } else if ($column == 'post_author') {
4114 4114
                                     $post_author = $row[$c];
4115
-                                } else if ( $column == 'post_date' ) {
4115
+                                } else if ($column == 'post_date') {
4116 4116
                                     $post_date = $row[$c];
4117
-                                } else if ( $column == 'post_content' ) {
4117
+                                } else if ($column == 'post_content') {
4118 4118
                                     $post_content = $row[$c];
4119
-                                } else if ( $column == 'post_category' && $row[$c] != '' ) {
4120
-                                    $post_category_arr = explode( ',', $row[$c] );
4121
-                                } else if ( $column == 'default_category' ) {
4119
+                                } else if ($column == 'post_category' && $row[$c] != '') {
4120
+                                    $post_category_arr = explode(',', $row[$c]);
4121
+                                } else if ($column == 'default_category') {
4122 4122
                                     $default_category = wp_kses_normalize_entities($row[$c]);
4123
-                                } else if ( $column == 'post_tags' && $row[$c] != '' ) {
4124
-                                    $post_tags = explode( ',', sanitize_text_field($row[$c]) );
4125
-                                } else if ( $column == 'post_type' ) {
4123
+                                } else if ($column == 'post_tags' && $row[$c] != '') {
4124
+                                    $post_tags = explode(',', sanitize_text_field($row[$c]));
4125
+                                } else if ($column == 'post_type') {
4126 4126
                                     $post_type = $row[$c];
4127
-                                } else if ( $column == 'post_status' ) {
4128
-                                    $post_status = sanitize_key( $row[$c] );
4129
-                                } else if ( $column == 'is_featured' ) {
4130
-                                    $is_featured = (int)$row[$c];
4131
-                                } else if ( $column == 'geodir_video' ) {
4127
+                                } else if ($column == 'post_status') {
4128
+                                    $post_status = sanitize_key($row[$c]);
4129
+                                } else if ($column == 'is_featured') {
4130
+                                    $is_featured = (int) $row[$c];
4131
+                                } else if ($column == 'geodir_video') {
4132 4132
                                     $geodir_video = $row[$c];
4133
-                                } else if ( $column == 'post_address' ) {
4133
+                                } else if ($column == 'post_address') {
4134 4134
                                     $post_address = sanitize_text_field($row[$c]);
4135
-                                } else if ( $column == 'post_city' ) {
4135
+                                } else if ($column == 'post_city') {
4136 4136
                                     $post_city = sanitize_text_field($row[$c]);
4137
-                                } else if ( $column == 'post_region' ) {
4137
+                                } else if ($column == 'post_region') {
4138 4138
                                     $post_region = sanitize_text_field($row[$c]);
4139
-                                } else if ( $column == 'post_country' ) {
4139
+                                } else if ($column == 'post_country') {
4140 4140
                                     $post_country = sanitize_text_field($row[$c]);
4141
-                                } else if ( $column == 'post_zip' ) {
4141
+                                } else if ($column == 'post_zip') {
4142 4142
                                     $post_zip = sanitize_text_field($row[$c]);
4143
-                                } else if ( $column == 'post_latitude' ) {
4143
+                                } else if ($column == 'post_latitude') {
4144 4144
                                     $post_latitude = sanitize_text_field($row[$c]);
4145
-                                } else if ( $column == 'post_longitude' ) {
4145
+                                } else if ($column == 'post_longitude') {
4146 4146
                                     $post_longitude = sanitize_text_field($row[$c]);
4147
-                                } else if ( $column == 'post_neighbourhood' ) {
4147
+                                } else if ($column == 'post_neighbourhood') {
4148 4148
                                     $post_neighbourhood = sanitize_text_field($row[$c]);
4149 4149
                                     unset($gd_post[$column]);
4150
-                                } else if ( $column == 'neighbourhood_latitude' ) {
4150
+                                } else if ($column == 'neighbourhood_latitude') {
4151 4151
                                     $neighbourhood_latitude = sanitize_text_field($row[$c]);
4152
-                                } else if ( $column == 'neighbourhood_longitude' ) {
4152
+                                } else if ($column == 'neighbourhood_longitude') {
4153 4153
                                     $neighbourhood_longitude = sanitize_text_field($row[$c]);
4154
-                                } else if ( $column == 'geodir_timing' ) {
4154
+                                } else if ($column == 'geodir_timing') {
4155 4155
                                     $geodir_timing = sanitize_text_field($row[$c]);
4156
-                                } else if ( $column == 'geodir_contact' ) {
4156
+                                } else if ($column == 'geodir_contact') {
4157 4157
                                     $geodir_contact = sanitize_text_field($row[$c]);
4158
-                                } else if ( $column == 'geodir_email' ) {
4158
+                                } else if ($column == 'geodir_email') {
4159 4159
                                     $geodir_email = sanitize_email($row[$c]);
4160
-                                } else if ( $column == 'geodir_website' ) {
4160
+                                } else if ($column == 'geodir_website') {
4161 4161
                                     $geodir_website = sanitize_text_field($row[$c]);
4162
-                                } else if ( $column == 'geodir_twitter' ) {
4162
+                                } else if ($column == 'geodir_twitter') {
4163 4163
                                     $geodir_twitter = sanitize_text_field($row[$c]);
4164
-                                } else if ( $column == 'geodir_facebook' ) {
4164
+                                } else if ($column == 'geodir_facebook') {
4165 4165
                                     $geodir_facebook = sanitize_text_field($row[$c]);
4166
-                                } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4166
+                                } else if ($column == 'IMAGE' && !empty($row[$c]) && $row[$c] != '') {
4167 4167
                                     $post_images[] = $row[$c];
4168
-                                } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4169
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4170
-                                } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4168
+                                } else if ($column == 'alive_days' && (int) $row[$c] > 0) {
4169
+                                    $expire_date = date_i18n('Y-m-d', strtotime($current_date.'+'.(int) $row[$c].' days'));
4170
+                                } else if ($column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never') {
4171 4171
                                     $row[$c] = str_replace('/', '-', $row[$c]);
4172
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4173
-                                } else if ( strpos( $column, 'linked_' ) === 0 ) {
4174
-                                    $geodir_link_business = (int)$row[$c];
4172
+                                    $expire_date = date_i18n('Y-m-d', strtotime($row[$c]));
4173
+                                } else if (strpos($column, 'linked_') === 0) {
4174
+                                    $geodir_link_business = (int) $row[$c];
4175 4175
                                 }
4176 4176
                                 // WPML
4177 4177
                                 if ($is_wpml) {
4178 4178
                                     if ($column == 'language') {
4179 4179
                                         $language = geodir_strtolower(trim($row[$c]));
4180 4180
                                     } else if ($column == 'original_post_id') {
4181
-                                        $original_post_id = (int)$row[$c];
4181
+                                        $original_post_id = (int) $row[$c];
4182 4182
                                     }
4183 4183
                                 }
4184 4184
                                 // WPML
@@ -4186,7 +4186,7 @@  discard block
 block discarded – undo
4186 4186
                             }
4187 4187
                             // listing claimed or not
4188 4188
                             if ($is_claim_active && isset($gd_post['claimed'])) {
4189
-                                $gd_post['claimed'] = (int)$gd_post['claimed'] == 1 ? 1 : 0;
4189
+                                $gd_post['claimed'] = (int) $gd_post['claimed'] == 1 ? 1 : 0;
4190 4190
                             }
4191 4191
                             
4192 4192
                             // WPML
@@ -4197,43 +4197,43 @@  discard block
 block discarded – undo
4197 4197
 
4198 4198
                             $gd_post['IMAGE'] = $post_images;
4199 4199
                             
4200
-                            $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4201
-                            $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4200
+                            $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status;
4201
+                            $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status;
4202 4202
                                                                                                                 
4203 4203
                             $valid = true;
4204 4204
                             
4205
-                            if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4205
+                            if ($post_title == '' || !in_array($post_type, $post_types)) {
4206 4206
                                 $invalid++;
4207 4207
                                 $valid = false;
4208
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4208
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank title/invalid post type', 'geodirectory'));
4209 4209
                             }
4210
-                            $xtimings['###3'] = microtime(true)-$xstart;
4211
-                            $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4212
-                            if ( $location_allowed ) {
4210
+                            $xtimings['###3'] = microtime(true) - $xstart;
4211
+                            $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
4212
+                            if ($location_allowed) {
4213 4213
                                 $location_result = geodir_get_default_location();
4214
-                                if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4214
+                                if ($post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '') {
4215 4215
                                     $invalid_addr++;
4216 4216
                                     $valid = false;
4217
-                                    geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) );
4218
-                                } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4219
-                                    if ( ( geodir_strtolower( $post_city ) != geodir_strtolower( $location_result->city ) ) || ( geodir_strtolower( $post_region ) != geodir_strtolower( $location_result->region ) ) || (geodir_strtolower( $post_country ) != geodir_strtolower( $location_result->country ) ) ) {
4217
+                                    geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory'));
4218
+                                } else if (!empty($location_result) && $location_result->location_id == 0) {
4219
+                                    if ((geodir_strtolower($post_city) != geodir_strtolower($location_result->city)) || (geodir_strtolower($post_region) != geodir_strtolower($location_result->region)) || (geodir_strtolower($post_country) != geodir_strtolower($location_result->country))) {
4220 4220
                                         $invalid_addr++;
4221 4221
                                         $valid = false;
4222
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ) );
4222
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory'));
4223 4223
                                     } else {
4224 4224
                                         if (!$location_manager) {
4225
-                                            $gd_post['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // Set the default location when location manager not activated.
4225
+                                            $gd_post['post_locations'] = '['.$location_result->city_slug.'],['.$location_result->region_slug.'],['.$location_result->country_slug.']'; // Set the default location when location manager not activated.
4226 4226
                                         }
4227 4227
                                     }
4228 4228
                                 }
4229 4229
                             }
4230
-                            $xtimings['###4']   = microtime(true)-$xstart;
4231
-                            if ( !$valid ) {
4230
+                            $xtimings['###4'] = microtime(true) - $xstart;
4231
+                            if (!$valid) {
4232 4232
                                 continue;
4233 4233
                             }
4234 4234
 
4235
-                            $cat_taxonomy = $post_type . 'category';
4236
-                            $tags_taxonomy = $post_type . '_tags';
4235
+                            $cat_taxonomy = $post_type.'category';
4236
+                            $tags_taxonomy = $post_type.'_tags';
4237 4237
                             
4238 4238
                             if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4239 4239
                                 $post_category_arr = array_merge(array($default_category), $post_category_arr);
@@ -4241,29 +4241,29 @@  discard block
 block discarded – undo
4241 4241
 
4242 4242
                             $post_category = array();
4243 4243
                             $default_category_id = NULL;
4244
-                            if ( !empty( $post_category_arr ) ) {
4245
-                                foreach ( $post_category_arr as $value ) {
4246
-                                    $category_name = wp_kses_normalize_entities( trim( $value ) );
4244
+                            if (!empty($post_category_arr)) {
4245
+                                foreach ($post_category_arr as $value) {
4246
+                                    $category_name = wp_kses_normalize_entities(trim($value));
4247 4247
                                     
4248
-                                    if ( $category_name != '' ) {
4248
+                                    if ($category_name != '') {
4249 4249
                                         $term_category = array();
4250 4250
                                         
4251
-                                        if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4251
+                                        if ($term = get_term_by('name', $category_name, $cat_taxonomy)) {
4252 4252
                                             $term_category = $term;
4253
-                                        } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4253
+                                        } else if ($term = get_term_by('slug', $category_name, $cat_taxonomy)) {
4254 4254
                                             $term_category = $term;
4255 4255
                                         } else {
4256 4256
                                             $term_data = array();
4257 4257
                                             $term_data['name'] = $category_name;
4258 4258
                                             $term_data['taxonomy'] = $cat_taxonomy;
4259 4259
                                             
4260
-                                            $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4261
-                                            if ( $term_id ) {
4262
-                                                $term_category = get_term( $term_id, $cat_taxonomy );
4260
+                                            $term_id = geodir_imex_insert_term($cat_taxonomy, $term_data);
4261
+                                            if ($term_id) {
4262
+                                                $term_category = get_term($term_id, $cat_taxonomy);
4263 4263
                                             }
4264 4264
                                         }
4265 4265
                                         
4266
-                                        if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4266
+                                        if (!empty($term_category) && !is_wp_error($term_category)) {
4267 4267
                                             $post_category[] = intval($term_category->term_id);
4268 4268
                                             
4269 4269
                                             if ($category_name == $default_category) {
@@ -4273,14 +4273,14 @@  discard block
 block discarded – undo
4273 4273
                                     }
4274 4274
                                 }
4275 4275
                             }
4276
-                            $xtimings['###5'] = microtime(true)-$xstart;
4276
+                            $xtimings['###5'] = microtime(true) - $xstart;
4277 4277
                             $save_post = array();
4278 4278
                             $save_post['post_title'] = $post_title;
4279 4279
                             if (!empty($post_date)) {
4280
-                                $post_date = geodir_date( $post_date, 'Y-m-d H:i:s' ); // convert to mysql date format.
4280
+                                $post_date = geodir_date($post_date, 'Y-m-d H:i:s'); // convert to mysql date format.
4281 4281
                                 
4282 4282
                                 $save_post['post_date'] = $post_date;
4283
-                                $save_post['post_date_gmt'] = get_gmt_from_date( $post_date );
4283
+                                $save_post['post_date_gmt'] = get_gmt_from_date($post_date);
4284 4284
                             }
4285 4285
                             $save_post['post_content'] = $post_content;
4286 4286
                             $save_post['post_type'] = $post_type;
@@ -4290,15 +4290,15 @@  discard block
 block discarded – undo
4290 4290
                             $save_post['post_tags'] = $post_tags;
4291 4291
 
4292 4292
                             $saved_post_id = NULL;
4293
-                            if ( $import_choice == 'update' ) {
4294
-                                $gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' );
4293
+                            if ($import_choice == 'update') {
4294
+                                $gd_wp_error = __('Unable to add listing, please check the listing data.', 'geodirectory');
4295 4295
                                 
4296
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4296
+                                if ($post_id > 0 && get_post($post_id)) {
4297 4297
                                     $save_post['ID'] = $post_id;
4298 4298
                                     
4299
-                                    if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
4300
-                                        if ( is_wp_error( $saved_post_id ) ) {
4301
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4299
+                                    if ($saved_post_id = wp_update_post($save_post, true)) {
4300
+                                        if (is_wp_error($saved_post_id)) {
4301
+                                            $gd_wp_error = $saved_post_id->get_error_message().' '.$wp_chars_error;
4302 4302
                                             $saved_post_id = 0;
4303 4303
                                         } else {
4304 4304
                                             $saved_post_id = $post_id;
@@ -4306,9 +4306,9 @@  discard block
 block discarded – undo
4306 4306
                                         }
4307 4307
                                     }
4308 4308
                                 } else {
4309
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4310
-                                        if ( is_wp_error( $saved_post_id ) ) {
4311
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4309
+                                    if ($saved_post_id = wp_insert_post($save_post, true)) {
4310
+                                        if (is_wp_error($saved_post_id)) {
4311
+                                            $gd_wp_error = $saved_post_id->get_error_message().' '.$wp_chars_error;
4312 4312
                                             $saved_post_id = 0;
4313 4313
                                         } else {
4314 4314
                                             $created++;
@@ -4316,19 +4316,19 @@  discard block
 block discarded – undo
4316 4316
                                     }
4317 4317
                                 }
4318 4318
                                 
4319
-                                if ( !$saved_post_id > 0 ) {
4319
+                                if (!$saved_post_id > 0) {
4320 4320
                                     $invalid++;
4321
-                                    geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error );
4321
+                                    geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_wp_error);
4322 4322
                                 }
4323
-                            } else if ( $import_choice == 'skip' ) {
4324
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4323
+                            } else if ($import_choice == 'skip') {
4324
+                                if ($post_id > 0 && get_post($post_id)) {
4325 4325
                                     $skipped++;	
4326 4326
                                 } else {
4327
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4328
-                                        if ( is_wp_error( $saved_post_id ) ) {
4327
+                                    if ($saved_post_id = wp_insert_post($save_post, true)) {
4328
+                                        if (is_wp_error($saved_post_id)) {
4329 4329
                                             $invalid++;
4330 4330
                                             
4331
-                                            geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error );
4331
+                                            geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$saved_post_id->get_error_message().' '.$wp_chars_error);
4332 4332
                                             $saved_post_id = 0;
4333 4333
                                         } else {
4334 4334
                                             $created++;
@@ -4336,28 +4336,28 @@  discard block
 block discarded – undo
4336 4336
                                     } else {
4337 4337
                                         $invalid++;
4338 4338
                                         
4339
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4339
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$wp_chars_error);
4340 4340
                                     }
4341 4341
                                 }
4342 4342
                             } else {
4343 4343
                                 $invalid++;
4344 4344
                                 
4345
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4345
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$wp_chars_error);
4346 4346
                             }
4347
-                            $xtimings['###6'] = microtime(true)-$xstart;
4348
-                            if ( (int)$saved_post_id > 0 ) {
4347
+                            $xtimings['###6'] = microtime(true) - $xstart;
4348
+                            if ((int) $saved_post_id > 0) {
4349 4349
                                 // WPML
4350 4350
                                 if ($is_wpml && $original_post_id > 0 && $language != '') {
4351
-                                    $wpml_post_type = 'post_' . $post_type;
4352
-                                    $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4351
+                                    $wpml_post_type = 'post_'.$post_type;
4352
+                                    $source_language = geodir_get_language_for_element($original_post_id, $wpml_post_type);
4353 4353
                                     $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4354 4354
 
4355
-                                    $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4355
+                                    $trid = $sitepress->get_element_trid($original_post_id, $wpml_post_type);
4356 4356
                                     
4357
-                                    $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4357
+                                    $sitepress->set_element_language_details($saved_post_id, $wpml_post_type, $trid, $language, $source_language);
4358 4358
                                 }
4359 4359
                                 // WPML
4360
-                                $gd_post_info = geodir_get_post_info( $saved_post_id );
4360
+                                $gd_post_info = geodir_get_post_info($saved_post_id);
4361 4361
                                 
4362 4362
                                 $gd_post['post_id'] = $saved_post_id;
4363 4363
                                 $gd_post['ID'] = $saved_post_id;
@@ -4369,7 +4369,7 @@  discard block
 block discarded – undo
4369 4369
                                                     
4370 4370
                                 // post location
4371 4371
                                 $post_location_id = 0;
4372
-                                if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4372
+                                if ($location_allowed && !empty($location_result) && $location_result->location_id > 0) {
4373 4373
                                     $gd_post['post_neighbourhood'] = '';
4374 4374
                                     
4375 4375
                                     $post_location_info = array(
@@ -4379,7 +4379,7 @@  discard block
 block discarded – undo
4379 4379
                                                                 'geo_lat' => $post_latitude,
4380 4380
                                                                 'geo_lng' => $post_longitude
4381 4381
                                                             );
4382
-                                    if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4382
+                                    if ($location_id = (int) geodir_add_new_location($post_location_info)) {
4383 4383
                                         $post_location_id = $location_id;
4384 4384
                                     }
4385 4385
                                     
@@ -4421,14 +4421,14 @@  discard block
 block discarded – undo
4421 4421
                                 }
4422 4422
                                 
4423 4423
                                 // post package info
4424
-                                $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4424
+                                $package_id = isset($gd_post['package_id']) && !empty($gd_post['package_id']) ? (int) $gd_post['package_id'] : 0;
4425 4425
                                 if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4426 4426
                                     $package_id = $gd_post_info->package_id;
4427 4427
                                 }
4428 4428
                                 
4429 4429
                                 $package_info = array();
4430 4430
                                 if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4431
-                                    $package_info = (array)geodir_get_package_info_by_id($package_id);
4431
+                                    $package_info = (array) geodir_get_package_info_by_id($package_id);
4432 4432
                                     
4433 4433
                                     if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4434 4434
                                         $package_info = array();
@@ -4436,18 +4436,18 @@  discard block
 block discarded – undo
4436 4436
                                 }
4437 4437
                                 
4438 4438
                                 if (empty($package_info)) {
4439
-                                    $package_info = (array)geodir_post_package_info( array(), '', $post_type );
4439
+                                    $package_info = (array) geodir_post_package_info(array(), '', $post_type);
4440 4440
                                 }
4441 4441
                                  
4442
-                                if (!empty($package_info))	 {
4442
+                                if (!empty($package_info)) {
4443 4443
                                     $package_id = $package_info['pid'];
4444 4444
                                     
4445 4445
                                     if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4446 4446
                                         $gd_post['expire_date'] = $expire_date;
4447 4447
                                     } else {
4448
-                                        if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4449
-                                            $gd_post['alive_days'] = (int)$package_info['days'];
4450
-                                            $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4448
+                                        if (isset($package_info['days']) && (int) $package_info['days'] > 0) {
4449
+                                            $gd_post['alive_days'] = (int) $package_info['days'];
4450
+                                            $gd_post['expire_date'] = date_i18n('Y-m-d', strtotime($current_date.'+'.(int) $package_info['days'].' days'));
4451 4451
                                         } else {
4452 4452
                                             $gd_post['expire_date'] = 'Never';
4453 4453
                                         }
@@ -4456,7 +4456,7 @@  discard block
 block discarded – undo
4456 4456
                                     $gd_post['package_id'] = $package_id;
4457 4457
                                 }
4458 4458
 
4459
-                                $table = $plugin_prefix . $post_type . '_detail';
4459
+                                $table = $plugin_prefix.$post_type.'_detail';
4460 4460
                                 
4461 4461
                                 if ($post_type == 'gd_event') {
4462 4462
                                     $gd_post = geodir_imex_process_event_data($gd_post);
@@ -4467,65 +4467,65 @@  discard block
 block discarded – undo
4467 4467
                                 }
4468 4468
 
4469 4469
                                 // Export franchise fields
4470
-                                $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4470
+                                $is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
4471 4471
                                 if ($is_franchise_active) {
4472
-                                    if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
4472
+                                    if (isset($gd_post['gd_is_franchise']) && (int) $gd_post['gd_is_franchise'] == 1) {
4473 4473
                                         $gd_franchise_lock = array();
4474 4474
                                         
4475
-                                        if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4476
-                                            $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4477
-                                            $gd_franchise_lock = trim( $gd_franchise_lock );
4478
-                                            $gd_franchise_lock = explode( ",", $gd_franchise_lock );
4475
+                                        if (isset($gd_post['gd_franchise_lock'])) {
4476
+                                            $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock']);
4477
+                                            $gd_franchise_lock = trim($gd_franchise_lock);
4478
+                                            $gd_franchise_lock = explode(",", $gd_franchise_lock);
4479 4479
                                         }
4480 4480
                                         
4481
-                                        update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4482
-                                        update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4481
+                                        update_post_meta($saved_post_id, 'gd_is_franchise', 1);
4482
+                                        update_post_meta($saved_post_id, 'gd_franchise_lock', $gd_franchise_lock);
4483 4483
                                     } else {
4484
-                                        if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4485
-                                            geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4484
+                                        if (isset($gd_post['franchise']) && (int) $gd_post['franchise'] > 0 && geodir_franchise_check((int) $gd_post['franchise'])) {
4485
+                                            geodir_save_post_meta($saved_post_id, 'franchise', (int) $gd_post['franchise']);
4486 4486
                                         }
4487 4487
                                     }
4488 4488
                                 }
4489 4489
                                 
4490 4490
                                 if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4491
-                                    $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4491
+                                    $save_post['post_category'] = array_unique(array_map('intval', $save_post['post_category']));
4492 4492
                                     if ($default_category_id) {
4493 4493
                                         $save_post['post_default_category'] = $default_category_id;
4494 4494
                                         $gd_post['default_category'] = $default_category_id;
4495 4495
                                     }
4496 4496
                                     $gd_post[$cat_taxonomy] = $save_post['post_category'];
4497 4497
                                 }
4498
-                                $xtimings['###7'] = microtime(true)-$xstart;
4498
+                                $xtimings['###7'] = microtime(true) - $xstart;
4499 4499
                                 // Save post info
4500
-                                geodir_save_post_info( $saved_post_id, $gd_post );
4501
-                                $xtimings['###8'] = microtime(true)-$xstart;
4500
+                                geodir_save_post_info($saved_post_id, $gd_post);
4501
+                                $xtimings['###8'] = microtime(true) - $xstart;
4502 4502
                                 // post taxonomies
4503
-                                if ( !empty( $save_post['post_category'] ) ) {
4504
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4503
+                                if (!empty($save_post['post_category'])) {
4504
+                                    wp_set_object_terms($saved_post_id, $save_post['post_category'], $cat_taxonomy);
4505 4505
                                     
4506
-                                    $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4506
+                                    $post_default_category = isset($save_post['post_default_category']) ? $save_post['post_default_category'] : '';
4507 4507
                                     if ($default_category_id) {
4508 4508
                                         $post_default_category = $default_category_id;
4509 4509
                                     }
4510 4510
                                     $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4511 4511
                                     $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4512
-                                    $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4512
+                                    $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']).',y:' : '';
4513 4513
                                     
4514 4514
                                     if ($post_category_str != '' && $post_default_category) {
4515
-                                        $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4515
+                                        $post_category_str = str_replace($post_default_category.',y:', $post_default_category.',y,d:', $post_category_str);
4516 4516
                                     }
4517 4517
                                     
4518 4518
                                     $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4519 4519
                                     
4520
-                                    geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4520
+                                    geodir_set_postcat_structure($saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str);
4521 4521
                                 }
4522
-                                $xtimings['###8.1'] = microtime(true)-$xstart;
4523
-                                if ( !empty( $save_post['post_tags'] ) ) {
4524
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4522
+                                $xtimings['###8.1'] = microtime(true) - $xstart;
4523
+                                if (!empty($save_post['post_tags'])) {
4524
+                                    wp_set_object_terms($saved_post_id, $save_post['post_tags'], $tags_taxonomy);
4525 4525
                                 }
4526
-                                $xtimings['###9'] = microtime(true)-$xstart;
4526
+                                $xtimings['###9'] = microtime(true) - $xstart;
4527 4527
                                 // Post images
4528
-                                if ( !empty( $post_images ) ) {
4528
+                                if (!empty($post_images)) {
4529 4529
                                     $post_images = array_unique($post_images);
4530 4530
                                     
4531 4531
                                     $old_post_images_arr = array();
@@ -4533,65 +4533,65 @@  discard block
 block discarded – undo
4533 4533
                                     
4534 4534
                                     $order = 1;
4535 4535
                                     
4536
-                                    $old_post_images = geodir_get_images( $saved_post_id );
4537
-                                    $xtimings['###9.1'] = microtime(true)-$xstart;
4536
+                                    $old_post_images = geodir_get_images($saved_post_id);
4537
+                                    $xtimings['###9.1'] = microtime(true) - $xstart;
4538 4538
                                     if (!empty($old_post_images)) {
4539
-                                        foreach( $old_post_images as $old_post_image ) {
4539
+                                        foreach ($old_post_images as $old_post_image) {
4540 4540
                                             if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4541 4541
                                                 $old_post_images_arr[] = $old_post_image->file;
4542 4542
                                             }
4543 4543
                                         }
4544 4544
                                     }
4545 4545
 
4546
-                                    foreach ( $post_images as $post_image ) {
4547
-                                        $image_name = basename( $post_image );
4546
+                                    foreach ($post_images as $post_image) {
4547
+                                        $image_name = basename($post_image);
4548 4548
                                         $saved_post_images_arr[] = $image_name;
4549 4549
                                         
4550
-                                        if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4550
+                                        if (!empty($old_post_images_arr) && in_array($image_name, $old_post_images_arr)) {
4551 4551
                                             continue; // Skip if image already exists.
4552 4552
                                         }
4553 4553
                                         
4554
-                                        $image_name_parts = explode( '.', $image_name );
4555
-                                        array_pop( $image_name_parts );
4556
-                                        $proper_image_name = implode( '.', $image_name_parts );
4557
-                                        $xtimings['###9.2'] = microtime(true)-$xstart;
4558
-                                        $arr_file_type = wp_check_filetype( $image_name );
4559
-                                        $xtimings['###9.3'] = microtime(true)-$xstart;
4560
-                                        if ( !empty( $arr_file_type ) ) {
4554
+                                        $image_name_parts = explode('.', $image_name);
4555
+                                        array_pop($image_name_parts);
4556
+                                        $proper_image_name = implode('.', $image_name_parts);
4557
+                                        $xtimings['###9.2'] = microtime(true) - $xstart;
4558
+                                        $arr_file_type = wp_check_filetype($image_name);
4559
+                                        $xtimings['###9.3'] = microtime(true) - $xstart;
4560
+                                        if (!empty($arr_file_type)) {
4561 4561
                                             $uploaded_file_type = $arr_file_type['type'];
4562 4562
                                             
4563 4563
                                             $attachment = array();
4564 4564
                                             $attachment['post_id'] = $saved_post_id;
4565 4565
                                             $attachment['title'] = $proper_image_name;
4566 4566
                                             $attachment['content'] = '';
4567
-                                            $attachment['file'] = $uploads_subdir . '/' . $image_name;
4567
+                                            $attachment['file'] = $uploads_subdir.'/'.$image_name;
4568 4568
                                             $attachment['mime_type'] = $uploaded_file_type;
4569 4569
                                             $attachment['menu_order'] = $order;
4570 4570
                                             $attachment['is_featured'] = 0;
4571 4571
 
4572 4572
                                             $attachment_set = '';
4573
-                                            foreach ( $attachment as $key => $val ) {
4574
-                                                if ( $val != '' ) {
4575
-                                                    $attachment_set .= $key . " = '" . $val . "', ";
4573
+                                            foreach ($attachment as $key => $val) {
4574
+                                                if ($val != '') {
4575
+                                                    $attachment_set .= $key." = '".$val."', ";
4576 4576
                                                 }
4577 4577
                                             }
4578
-                                            $attachment_set = trim( $attachment_set, ", " );
4578
+                                            $attachment_set = trim($attachment_set, ", ");
4579 4579
                                                                                         
4580 4580
                                             // Add new attachment
4581
-                                            $xtimings['###9.4'] = microtime(true)-$xstart;
4582
-                                            $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4583
-                                            $xtimings['###9.5'] = microtime(true)-$xstart;
4581
+                                            $xtimings['###9.4'] = microtime(true) - $xstart;
4582
+                                            $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
4583
+                                            $xtimings['###9.5'] = microtime(true) - $xstart;
4584 4584
                                             $order++;
4585 4585
                                         }
4586 4586
                                     }
4587 4587
 
4588
-                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4588
+                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/".implode("' AND file NOT LIKE '%/", $saved_post_images_arr)."' )" : '';
4589 4589
                                     // Remove previous attachment
4590
-                                    $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4591
-                                    $xtimings['###9.6'] = microtime(true)-$xstart;
4592
-                                    if ( !empty( $saved_post_images_arr ) ) {
4590
+                                    $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = ".(int) $saved_post_id." ".$saved_post_images_sql);
4591
+                                    $xtimings['###9.6'] = microtime(true) - $xstart;
4592
+                                    if (!empty($saved_post_images_arr)) {
4593 4593
                                         geodir_set_wp_featured_image($saved_post_id);
4594
-                                        $xtimings['###9.7'] = microtime(true)-$xstart;
4594
+                                        $xtimings['###9.7'] = microtime(true) - $xstart;
4595 4595
                                         /*
4596 4596
                                         $menu_order = 1;
4597 4597
                                         
@@ -4607,14 +4607,14 @@  discard block
 block discarded – undo
4607 4607
                                         }*/
4608 4608
                                     }
4609 4609
                                     
4610
-                                    if ( $order > 1 ) {
4610
+                                    if ($order > 1) {
4611 4611
                                         $images++;
4612 4612
                                     }
4613 4613
                                 }
4614
-                                $xtimings['###10'] = microtime(true)-$xstart;
4614
+                                $xtimings['###10'] = microtime(true) - $xstart;
4615 4615
                                 /** This action is documented in geodirectory-functions/post-functions.php */
4616
-                                do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4617
-                                $xtimings['###11'] = microtime(true)-$xstart;
4616
+                                do_action('geodir_after_save_listing', $saved_post_id, $gd_post);
4617
+                                $xtimings['###11'] = microtime(true) - $xstart;
4618 4618
                                 if (isset($is_featured)) {
4619 4619
                                     geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
4620 4620
                                 }
@@ -4624,7 +4624,7 @@  discard block
 block discarded – undo
4624 4624
                                 if (isset($gd_post['expire_date'])) {
4625 4625
                                     geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
4626 4626
                                 }
4627
-                                $xtimings['###12'] = microtime(true)-$xstart;
4627
+                                $xtimings['###12'] = microtime(true) - $xstart;
4628 4628
                             }
4629 4629
                             
4630 4630
                             // WPML
@@ -4637,11 +4637,11 @@  discard block
 block discarded – undo
4637 4637
                 }
4638 4638
 
4639 4639
                 //undo some stuff to make the import quicker
4640
-                wp_defer_term_counting( false );
4641
-                wp_defer_comment_counting( false );
4642
-                $wpdb->query( 'COMMIT;' );
4643
-                $wpdb->query( 'SET autocommit = 1;' );
4644
-                $xtimings['###13'] = microtime(true)-$xstart;
4640
+                wp_defer_term_counting(false);
4641
+                wp_defer_comment_counting(false);
4642
+                $wpdb->query('COMMIT;');
4643
+                $wpdb->query('SET autocommit = 1;');
4644
+                $xtimings['###13'] = microtime(true) - $xstart;
4645 4645
                 $json = array();
4646 4646
                 $json['processed'] = $processed_actual;
4647 4647
                 $json['created'] = $created;
@@ -4650,13 +4650,13 @@  discard block
 block discarded – undo
4650 4650
                 $json['invalid'] = $invalid;
4651 4651
                 $json['invalid_addr'] = $invalid_addr;
4652 4652
                 $json['images'] = $images;
4653
-                $json['timing'] = microtime(true)-$xstart;
4653
+                $json['timing'] = microtime(true) - $xstart;
4654 4654
                 $json['timings'] = $xtimings;
4655 4655
                 
4656 4656
 
4657
-                wp_send_json( $json );
4657
+                wp_send_json($json);
4658 4658
                 exit;
4659
-            } else if ( $task == 'import_loc' ) {
4659
+            } else if ($task == 'import_loc') {
4660 4660
                 global $gd_post_types;
4661 4661
                 $gd_post_types = $post_types;
4662 4662
                 
@@ -4665,82 +4665,82 @@  discard block
 block discarded – undo
4665 4665
                     
4666 4666
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4667 4667
                         $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4668
-                        wp_send_json( $json );
4668
+                        wp_send_json($json);
4669 4669
                     }
4670 4670
                     
4671 4671
                     $gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
4672
-                    $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' );
4672
+                    $gd_error_location = __('Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory');
4673 4673
                     for ($i = 1; $i <= $limit; $i++) {
4674 4674
                         $index = $processed + $i;
4675 4675
                         
4676 4676
                         if (isset($file[$index])) {
4677 4677
                             $row = $file[$index];
4678
-                            $row = array_map( 'trim', $row );
4678
+                            $row = array_map('trim', $row);
4679 4679
                             $data = array();
4680 4680
                             
4681
-                            foreach ($columns as $c => $column ) {
4681
+                            foreach ($columns as $c => $column) {
4682 4682
                                 if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta_title', 'city_meta_desc', 'city_desc', 'region_meta_title', 'region_meta_desc', 'region_desc', 'country_meta_title', 'country_meta_desc', 'country_desc'))) {
4683 4683
                                     $data[$column] = $row[$c];
4684 4684
                                 }
4685 4685
                             }
4686 4686
 
4687
-                            if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4687
+                            if (empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude'])) {
4688 4688
                                 $invalid++;
4689
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4689
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4690 4690
                                 continue;
4691 4691
                             }
4692 4692
                             
4693 4693
                             $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4694 4694
                             
4695
-                            if ( $import_choice == 'update' ) {
4696
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4697
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4695
+                            if ($import_choice == 'update') {
4696
+                                if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
4697
+                                    if ($location_id = geodir_location_update_city($data, true, $location)) {
4698 4698
                                         $updated++;
4699 4699
                                     } else {
4700 4700
                                         $invalid++;
4701
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4701
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4702 4702
                                     }
4703
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4704
-                                    $data['location_id'] = (int)$location->location_id;
4703
+                                } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
4704
+                                    $data['location_id'] = (int) $location->location_id;
4705 4705
                                     
4706
-                                    if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4707
-                                        $data['location_id'] = (int)$location->location_id;
4708
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4709
-                                        $data['location_id'] = (int)$location->location_id;
4710
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4711
-                                        $data['location_id'] = (int)$location->location_id;
4706
+                                    if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region']))) {
4707
+                                        $data['location_id'] = (int) $location->location_id;
4708
+                                    } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'region' => $data['region']))) {
4709
+                                        $data['location_id'] = (int) $location->location_id;
4710
+                                    } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country']))) {
4711
+                                        $data['location_id'] = (int) $location->location_id;
4712 4712
                                     }
4713 4713
                                     
4714
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4714
+                                    if ($location_id = geodir_location_update_city($data, true, $location)) {
4715 4715
                                         $updated++;
4716 4716
                                     } else {
4717 4717
                                         $invalid++;
4718
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4718
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4719 4719
                                     }
4720 4720
                                 } else {
4721
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4721
+                                    if ($location_id = geodir_location_insert_city($data, true)) {
4722 4722
                                         $created++;
4723 4723
                                     } else {
4724 4724
                                         $invalid++;
4725
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4725
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4726 4726
                                     }
4727 4727
                                 }
4728
-                            } elseif ( $import_choice == 'skip' ) {
4729
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4728
+                            } elseif ($import_choice == 'skip') {
4729
+                                if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
4730 4730
                                     $skipped++;
4731
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4731
+                                } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
4732 4732
                                     $skipped++;
4733 4733
                                 } else {
4734
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4734
+                                    if ($location_id = geodir_location_insert_city($data, true)) {
4735 4735
                                         $created++;
4736 4736
                                     } else {
4737 4737
                                         $invalid++;
4738
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4738
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4739 4739
                                     }
4740 4740
                                 }
4741 4741
                             } else {
4742 4742
                                 $invalid++;
4743
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4743
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4744 4744
                             }
4745 4745
                         }
4746 4746
                     }
@@ -4754,24 +4754,24 @@  discard block
 block discarded – undo
4754 4754
                 $json['invalid'] = $invalid;
4755 4755
                 $json['images'] = $images;
4756 4756
                 
4757
-                wp_send_json( $json );
4758
-            } else if ( $task == 'import_hood' ) {               
4757
+                wp_send_json($json);
4758
+            } else if ($task == 'import_hood') {               
4759 4759
                 if (!empty($file)) {
4760 4760
                     $columns = isset($file[0]) ? $file[0] : NULL;
4761 4761
                     
4762 4762
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4763 4763
                         $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4764
-                        wp_send_json( $json );
4764
+                        wp_send_json($json);
4765 4765
                     }
4766 4766
                     
4767 4767
                     $gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
4768
-                    $gd_error_hood = __( 'Could not be saved due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory' );
4768
+                    $gd_error_hood = __('Could not be saved due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory');
4769 4769
                     for ($i = 1; $i <= $limit; $i++) {
4770 4770
                         $index = $processed + $i;
4771 4771
                         
4772 4772
                         if (isset($file[$index])) {
4773 4773
                             $row = $file[$index];
4774
-                            $row = array_map( 'trim', $row );
4774
+                            $row = array_map('trim', $row);
4775 4775
                             $data = array();
4776 4776
                             
4777 4777
                             foreach ($columns as $c => $column) {
@@ -4782,20 +4782,20 @@  discard block
 block discarded – undo
4782 4782
 
4783 4783
                             if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
4784 4784
                                 $invalid++;
4785
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4785
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4786 4786
                                 continue;
4787 4787
                             }
4788 4788
                             
4789 4789
                             $location_info = array();
4790
-                            if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
4791
-                                $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
4790
+                            if (!empty($data['location_id']) && (int) $data['location_id'] > 0) {
4791
+                                $location_info = geodir_get_location_by_id('', (int) $data['location_id']);
4792 4792
                             } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
4793 4793
                                 $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
4794 4794
                             }
4795 4795
 
4796 4796
                             if (empty($location_info)) {
4797 4797
                                 $invalid++;
4798
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4798
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4799 4799
                                 continue;
4800 4800
                             }
4801 4801
                             
@@ -4810,35 +4810,35 @@  discard block
 block discarded – undo
4810 4810
                             $hood_data['hood_longitude'] = $data['longitude'];
4811 4811
                             $hood_data['hood_location_id'] = $location_id;
4812 4812
                                     
4813
-                            if ( $import_choice == 'update' ) {
4814
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4815
-                                    $hood_data['hood_id'] = (int)$data['neighbourhood_id'];
4813
+                            if ($import_choice == 'update') {
4814
+                                if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
4815
+                                    $hood_data['hood_id'] = (int) $data['neighbourhood_id'];
4816 4816
                                     
4817 4817
                                     if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4818 4818
                                         $updated++;
4819 4819
                                     } else {
4820 4820
                                         $invalid++;
4821
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4821
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4822 4822
                                     }
4823 4823
                                 } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4824
-                                    $hood_data['hood_id'] = (int)$neighbourhood->hood_id;
4824
+                                    $hood_data['hood_id'] = (int) $neighbourhood->hood_id;
4825 4825
                                     
4826 4826
                                     if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4827 4827
                                         $updated++;
4828 4828
                                     } else {
4829 4829
                                         $invalid++;
4830
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4830
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4831 4831
                                     }
4832 4832
                                 } else {
4833 4833
                                     if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4834 4834
                                         $created++;
4835 4835
                                     } else {
4836 4836
                                         $invalid++;
4837
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4837
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4838 4838
                                     }
4839 4839
                                 }
4840
-                            } elseif ( $import_choice == 'skip' ) {
4841
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4840
+                            } elseif ($import_choice == 'skip') {
4841
+                                if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
4842 4842
                                     $skipped++;
4843 4843
                                 } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4844 4844
                                     $skipped++;
@@ -4848,12 +4848,12 @@  discard block
 block discarded – undo
4848 4848
                                         $created++;
4849 4849
                                     } else {
4850 4850
                                         $invalid++;
4851
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4851
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4852 4852
                                     }
4853 4853
                                 }
4854 4854
                             } else {
4855 4855
                                 $invalid++;
4856
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4856
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4857 4857
                             }
4858 4858
                         }
4859 4859
                     }
@@ -4867,7 +4867,7 @@  discard block
 block discarded – undo
4867 4867
                 $json['invalid'] = $invalid;
4868 4868
                 $json['images'] = $images;
4869 4869
                 
4870
-                wp_send_json( $json );
4870
+                wp_send_json($json);
4871 4871
             }
4872 4872
         }
4873 4873
         break;
@@ -4911,29 +4911,29 @@  discard block
 block discarded – undo
4911 4911
  * }
4912 4912
  * @return int|bool Term id when success, false when fail.
4913 4913
  */
4914
-function geodir_imex_insert_term( $taxonomy, $term_data ) {
4915
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
4914
+function geodir_imex_insert_term($taxonomy, $term_data) {
4915
+	if (empty($taxonomy) || empty($term_data)) {
4916 4916
 		return false;
4917 4917
 	}
4918 4918
 	
4919
-	$term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : '';
4919
+	$term = isset($term_data['name']) && !empty($term_data['name']) ? $term_data['name'] : '';
4920 4920
 	$args = array();
4921
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
4922
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
4923
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
4921
+	$args['description'] = isset($term_data['description']) ? $term_data['description'] : '';
4922
+	$args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : '';
4923
+	$args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : '';
4924 4924
 	
4925
-	if ( ( !empty( $args['slug'] ) && term_exists( $args['slug'], $taxonomy ) ) || empty( $args['slug'] ) ) {
4926
-		$term_args = array_merge( $term_data, $args );
4927
-		$defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
4928
-		$term_args = wp_parse_args( $term_args, $defaults );
4929
-		$term_args = sanitize_term( $term_args, $taxonomy, 'db' );
4930
-		$args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
4925
+	if ((!empty($args['slug']) && term_exists($args['slug'], $taxonomy)) || empty($args['slug'])) {
4926
+		$term_args = array_merge($term_data, $args);
4927
+		$defaults = array('alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
4928
+		$term_args = wp_parse_args($term_args, $defaults);
4929
+		$term_args = sanitize_term($term_args, $taxonomy, 'db');
4930
+		$args['slug'] = wp_unique_term_slug($args['slug'], (object) $term_args);
4931 4931
 	}
4932 4932
 	
4933
-    if( !empty( $term ) ) {
4934
-		$result = wp_insert_term( $term, $taxonomy, $args );
4935
-        if( !is_wp_error( $result ) ) {
4936
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
4933
+    if (!empty($term)) {
4934
+		$result = wp_insert_term($term, $taxonomy, $args);
4935
+        if (!is_wp_error($result)) {
4936
+            return isset($result['term_id']) ? $result['term_id'] : 0;
4937 4937
         }
4938 4938
     }
4939 4939
 	
@@ -4963,36 +4963,36 @@  discard block
 block discarded – undo
4963 4963
  * }
4964 4964
  * @return int|bool Term id when success, false when fail.
4965 4965
  */
4966
-function geodir_imex_update_term( $taxonomy, $term_data ) {
4967
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
4966
+function geodir_imex_update_term($taxonomy, $term_data) {
4967
+	if (empty($taxonomy) || empty($term_data)) {
4968 4968
 		return false;
4969 4969
 	}
4970 4970
 	
4971
-	$term_id = isset( $term_data['term_id'] ) && !empty( $term_data['term_id'] ) ? $term_data['term_id'] : 0;
4971
+	$term_id = isset($term_data['term_id']) && !empty($term_data['term_id']) ? $term_data['term_id'] : 0;
4972 4972
 	
4973 4973
 	$args = array();
4974
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
4975
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
4976
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
4974
+	$args['description'] = isset($term_data['description']) ? $term_data['description'] : '';
4975
+	$args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : '';
4976
+	$args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : '';
4977 4977
 	
4978
-	if ( $term_id > 0 && $term_info = (array)get_term( $term_id, $taxonomy ) ) {
4978
+	if ($term_id > 0 && $term_info = (array) get_term($term_id, $taxonomy)) {
4979 4979
 		$term_data['term_id'] = $term_info['term_id'];
4980 4980
 		
4981
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
4981
+		$result = wp_update_term($term_data['term_id'], $taxonomy, $term_data);
4982 4982
 		
4983
-		if( !is_wp_error( $result ) ) {
4984
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
4983
+		if (!is_wp_error($result)) {
4984
+            return isset($result['term_id']) ? $result['term_id'] : 0;
4985 4985
         }
4986
-	} else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4986
+	} else if ($term_data['slug'] != '' && $term_info = (array) term_exists($term_data['slug'], $taxonomy)) {
4987 4987
 		$term_data['term_id'] = $term_info['term_id'];
4988 4988
 		
4989
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
4989
+		$result = wp_update_term($term_data['term_id'], $taxonomy, $term_data);
4990 4990
 		
4991
-		if( !is_wp_error( $result ) ) {
4992
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
4991
+		if (!is_wp_error($result)) {
4992
+            return isset($result['term_id']) ? $result['term_id'] : 0;
4993 4993
         }
4994 4994
 	} else {
4995
-		return geodir_imex_insert_term( $taxonomy, $term_data );
4995
+		return geodir_imex_insert_term($taxonomy, $term_data);
4996 4996
 	}
4997 4997
 	
4998 4998
 	return false;
@@ -5011,20 +5011,20 @@  discard block
 block discarded – undo
5011 5011
  * @param string $post_type Post type.
5012 5012
  * @return int Posts count.
5013 5013
  */
5014
-function geodir_get_posts_count( $post_type ) {
5014
+function geodir_get_posts_count($post_type) {
5015 5015
     global $wpdb, $plugin_prefix;
5016 5016
 
5017
-    if ( !post_type_exists( $post_type ) ) {
5017
+    if (!post_type_exists($post_type)) {
5018 5018
         return 0;
5019 5019
     }
5020 5020
         
5021
-    $table = $plugin_prefix . $post_type . '_detail';
5021
+    $table = $plugin_prefix.$post_type.'_detail';
5022 5022
 
5023 5023
     // Skip listing with statuses trash, auto-draft etc...
5024 5024
     $skip_statuses = geodir_imex_export_skip_statuses();
5025 5025
     $where_statuses = '';
5026
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5027
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5026
+    if (!empty($skip_statuses) && is_array($skip_statuses)) {
5027
+        $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
5028 5028
     }
5029 5029
     
5030 5030
     /**
@@ -5035,11 +5035,11 @@  discard block
 block discarded – undo
5035 5035
      *
5036 5036
      * @param string $where SQL where clause part.
5037 5037
      */
5038
-    $where_statuses = apply_filters( 'geodir_get_posts_count', $where_statuses, $post_type );
5038
+    $where_statuses = apply_filters('geodir_get_posts_count', $where_statuses, $post_type);
5039 5039
 
5040
-    $query = $wpdb->prepare( "SELECT COUNT({$wpdb->posts}.ID) FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses, $post_type );
5040
+    $query = $wpdb->prepare("SELECT COUNT({$wpdb->posts}.ID) FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s ".$where_statuses, $post_type);
5041 5041
 
5042
-    $posts_count = (int)$wpdb->get_var( $query );
5042
+    $posts_count = (int) $wpdb->get_var($query);
5043 5043
     
5044 5044
     /**
5045 5045
      * Modify returned post counts for the current post type.
@@ -5050,7 +5050,7 @@  discard block
 block discarded – undo
5050 5050
      * @param int $posts_count Post counts.
5051 5051
      * @param string $post_type Post type.
5052 5052
      */
5053
-    $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );
5053
+    $posts_count = apply_filters('geodir_imex_count_posts', $posts_count, $post_type);
5054 5054
 
5055 5055
     return $posts_count;
5056 5056
 }
@@ -5072,19 +5072,19 @@  discard block
 block discarded – undo
5072 5072
  * @param int $page_no Page number. Default 0.
5073 5073
  * @return array Array of posts data.
5074 5074
  */
5075
-function geodir_imex_get_posts( $post_type, $per_page = 0, $page_no = 0 ) {	
5075
+function geodir_imex_get_posts($post_type, $per_page = 0, $page_no = 0) {	
5076 5076
 	global $wp_filesystem;
5077 5077
 
5078
-	$posts = geodir_get_export_posts( $post_type, $per_page, $page_no );
5078
+	$posts = geodir_get_export_posts($post_type, $per_page, $page_no);
5079 5079
 
5080 5080
 	$csv_rows = array();
5081 5081
 	
5082
-	if ( !empty( $posts ) ) {
5083
-		$is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' );
5082
+	if (!empty($posts)) {
5083
+		$is_payment_plugin = is_plugin_active('geodir_payment_manager/geodir_payment_manager.php');
5084 5084
 		$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
5085
-		$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5085
+		$location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
5086 5086
 		$neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
5087
-		$is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
5087
+		$is_claim_active = is_plugin_active('geodir_claim_listing/geodir_claim_listing.php') && get_option('geodir_claim_enable') === 'yes' ? true : false;
5088 5088
 		$is_events_active = function_exists('geodir_event_plugin_activated') ? true : false;
5089 5089
 		$is_custom_posts_active = function_exists('geodir_custom_post_type_plugin_activated') ? true : false;
5090 5090
 		
@@ -5099,7 +5099,7 @@  discard block
 block discarded – undo
5099 5099
 		$csv_row[] = 'default_category';
5100 5100
 		$csv_row[] = 'post_tags';
5101 5101
 		$csv_row[] = 'post_type';
5102
-		if ( $post_type == 'gd_event' ) {
5102
+		if ($post_type == 'gd_event') {
5103 5103
 			$csv_row[] = 'event_date';
5104 5104
 			$csv_row[] = 'event_enddate';
5105 5105
 			$csv_row[] = 'starttime';
@@ -5151,7 +5151,7 @@  discard block
 block discarded – undo
5151 5151
 		$csv_row[] = 'geodir_video';
5152 5152
 		$csv_row[] = 'geodir_special_offers';
5153 5153
 		if ($is_events_active || $is_custom_posts_active) {
5154
-			$csv_row[] = !empty($post_ypes[$post_type]['linkable_to']) ? 'linked_' . $post_ypes[$post_type]['linkable_to'] . '_ID' : 'linked_cpt_ID';
5154
+			$csv_row[] = !empty($post_ypes[$post_type]['linkable_to']) ? 'linked_'.$post_ypes[$post_type]['linkable_to'].'_ID' : 'linked_cpt_ID';
5155 5155
 		}
5156 5156
 		// WPML
5157 5157
 		$is_wpml = geodir_is_wpml();
@@ -5161,15 +5161,15 @@  discard block
 block discarded – undo
5161 5161
 		}
5162 5162
 		// WPML
5163 5163
 
5164
-		$custom_fields = geodir_imex_get_custom_fields( $post_type );
5165
-		if ( !empty( $custom_fields ) ) {
5166
-			foreach ( $custom_fields as $custom_field ) {
5164
+		$custom_fields = geodir_imex_get_custom_fields($post_type);
5165
+		if (!empty($custom_fields)) {
5166
+			foreach ($custom_fields as $custom_field) {
5167 5167
 				$csv_row[] = $custom_field->htmlvar_name;
5168 5168
 			}
5169 5169
 		}
5170 5170
 
5171 5171
 		// Export franchise fields
5172
-		$is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
5172
+		$is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
5173 5173
 		if ($is_franchise_active) {
5174 5174
 			$csv_row[] = 'gd_is_franchise';
5175 5175
 			$csv_row[] = 'gd_franchise_lock';
@@ -5190,28 +5190,28 @@  discard block
 block discarded – undo
5190 5190
 		$csv_rows[] = $csv_row;
5191 5191
 
5192 5192
 		$images_count = 5;
5193
-        $xx=0;
5194
-		foreach ( $posts as $post ) {$xx++;
5193
+        $xx = 0;
5194
+		foreach ($posts as $post) {$xx++;
5195 5195
 			$post_id = $post['ID'];
5196 5196
 			
5197
-			$gd_post_info = geodir_get_post_info( $post_id );
5198
-			$post_info = (array)$gd_post_info;
5197
+			$gd_post_info = geodir_get_post_info($post_id);
5198
+			$post_info = (array) $gd_post_info;
5199 5199
 			
5200
-			$taxonomy_category = $post_type . 'category';
5201
-			$taxonomy_tags = $post_type . '_tags';
5200
+			$taxonomy_category = $post_type.'category';
5201
+			$taxonomy_tags = $post_type.'_tags';
5202 5202
 			
5203 5203
 			$post_category = '';
5204 5204
 			$default_category_id = $gd_post_info->default_category;
5205 5205
 			$default_category = '';
5206 5206
 			$post_tags = '';
5207
-			$terms = wp_get_post_terms( $post_id, array( $taxonomy_category, $taxonomy_tags ) );
5207
+			$terms = wp_get_post_terms($post_id, array($taxonomy_category, $taxonomy_tags));
5208 5208
 			
5209
-			if ( !empty( $terms ) && !is_wp_error( $terms ) ) {
5209
+			if (!empty($terms) && !is_wp_error($terms)) {
5210 5210
 				$post_category = array();
5211 5211
 				$post_tags = array();
5212 5212
 			
5213
-				foreach ( $terms as $term ) {
5214
-					if ( $term->taxonomy == $taxonomy_category ) {
5213
+				foreach ($terms as $term) {
5214
+					if ($term->taxonomy == $taxonomy_category) {
5215 5215
 						$post_category[] = $term->name;
5216 5216
 						
5217 5217
 						if ($default_category_id == $term->term_id) {
@@ -5219,7 +5219,7 @@  discard block
 block discarded – undo
5219 5219
 						}
5220 5220
 					}
5221 5221
 					
5222
-					if ( $term->taxonomy == $taxonomy_tags ) {
5222
+					if ($term->taxonomy == $taxonomy_tags) {
5223 5223
 						$post_tags[] = $term->name;
5224 5224
 					}
5225 5225
 				}
@@ -5227,47 +5227,47 @@  discard block
 block discarded – undo
5227 5227
 				if (empty($default_category) && !empty($post_category)) {
5228 5228
 					$default_category = $post_category[0]; // Set first one as default category.
5229 5229
 				}
5230
-				$post_category = !empty( $post_category ) ? implode( ',', $post_category ) : '';
5231
-				$post_tags = !empty( $post_tags ) ? implode( ',', $post_tags ) : '';
5230
+				$post_category = !empty($post_category) ? implode(',', $post_category) : '';
5231
+				$post_tags = !empty($post_tags) ? implode(',', $post_tags) : '';
5232 5232
 			}
5233 5233
 
5234 5234
 			// Franchise data
5235
-			if ($is_franchise_active && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 && geodir_franchise_check((int)$post_info['franchise'])) {
5235
+			if ($is_franchise_active && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 && geodir_franchise_check((int) $post_info['franchise'])) {
5236 5236
 				$franchise_id = $post_info['franchise'];
5237 5237
 				$gd_franchise_info = geodir_get_post_info($franchise_id);
5238 5238
 
5239 5239
 				if (geodir_franchise_pkg_is_active($gd_franchise_info)) {
5240
-					$franchise_info = (array)$gd_franchise_info;
5240
+					$franchise_info = (array) $gd_franchise_info;
5241 5241
 					$locked_fields = geodir_franchise_get_locked_fields($franchise_id, true);
5242 5242
 					
5243 5243
 					if (!empty($locked_fields)) {
5244
-						foreach( $locked_fields as $locked_field) {
5244
+						foreach ($locked_fields as $locked_field) {
5245 5245
 							if (isset($post_info[$locked_field]) && isset($franchise_info[$locked_field])) {
5246 5246
 								$post_info[$locked_field] = $franchise_info[$locked_field];
5247 5247
 							}
5248 5248
 							
5249 5249
 							if (in_array($taxonomy_category, $locked_fields) || in_array('post_tags', $locked_fields)) {
5250
-								$franchise_terms = wp_get_post_terms( $franchise_id, array( $taxonomy_category, $taxonomy_tags ) );
5250
+								$franchise_terms = wp_get_post_terms($franchise_id, array($taxonomy_category, $taxonomy_tags));
5251 5251
 			
5252
-								if ( !empty( $franchise_terms ) && !is_wp_error( $franchise_terms ) ) {
5252
+								if (!empty($franchise_terms) && !is_wp_error($franchise_terms)) {
5253 5253
 									$franchise_post_category = array();
5254 5254
 									$franchise_post_tags = array();
5255 5255
 								
5256
-									foreach ( $franchise_terms as $franchise_term ) {
5257
-										if ( $franchise_term->taxonomy == $taxonomy_category ) {
5256
+									foreach ($franchise_terms as $franchise_term) {
5257
+										if ($franchise_term->taxonomy == $taxonomy_category) {
5258 5258
 											$franchise_post_category[] = $franchise_term->name;
5259 5259
 										}
5260 5260
 										
5261
-										if ( $franchise_term->taxonomy == $taxonomy_tags ) {
5261
+										if ($franchise_term->taxonomy == $taxonomy_tags) {
5262 5262
 											$franchise_post_tags[] = $franchise_term->name;
5263 5263
 										}
5264 5264
 									}
5265 5265
 									
5266 5266
 									if (in_array($taxonomy_category, $locked_fields)) {
5267
-										$post_category = !empty( $franchise_post_category ) ? implode( ',', $franchise_post_category ) : '';
5267
+										$post_category = !empty($franchise_post_category) ? implode(',', $franchise_post_category) : '';
5268 5268
 									}
5269 5269
 									if (in_array('post_tags', $locked_fields)) {
5270
-										$post_tags = !empty( $franchise_post_tags ) ? implode( ',', $franchise_post_tags ) : '';
5270
+										$post_tags = !empty($franchise_post_tags) ? implode(',', $franchise_post_tags) : '';
5271 5271
 									}
5272 5272
 								}
5273 5273
 							}
@@ -5276,18 +5276,18 @@  discard block
 block discarded – undo
5276 5276
 				}
5277 5277
 			}
5278 5278
 						
5279
-			$post_images = geodir_get_images( $post_id );
5279
+			$post_images = geodir_get_images($post_id);
5280 5280
 			$current_images = array();
5281
-			if ( !empty( $post_images ) ) {
5282
-				foreach ( $post_images as $post_image ) {
5283
-					$post_image = (array)$post_image;
5284
-					$image = !empty( $post_image ) && isset( $post_image['path'] ) && $wp_filesystem->is_file( $post_image['path'] ) && $wp_filesystem->exists( $post_image['path'] ) ? $post_image['src'] : '';
5285
-					if ( $image ) {
5281
+			if (!empty($post_images)) {
5282
+				foreach ($post_images as $post_image) {
5283
+					$post_image = (array) $post_image;
5284
+					$image = !empty($post_image) && isset($post_image['path']) && $wp_filesystem->is_file($post_image['path']) && $wp_filesystem->exists($post_image['path']) ? $post_image['src'] : '';
5285
+					if ($image) {
5286 5286
 						$current_images[] = $image;
5287 5287
 					}
5288 5288
 				}
5289 5289
 				
5290
-				$images_count = max( $images_count, count( $current_images ) );
5290
+				$images_count = max($images_count, count($current_images));
5291 5291
 			}
5292 5292
 
5293 5293
 			$csv_row = array();
@@ -5299,7 +5299,7 @@  discard block
 block discarded – undo
5299 5299
 			$csv_row[] = $default_category; // default_category
5300 5300
 			$csv_row[] = $post_tags; // post_tags
5301 5301
 			$csv_row[] = $post_type; // post_type
5302
-			if ( $post_type == 'gd_event' ) {
5302
+			if ($post_type == 'gd_event') {
5303 5303
 				$event_data = geodir_imex_get_event_data($post, $gd_post_info);
5304 5304
 				$csv_row[] = $event_data['event_date']; // event_date
5305 5305
 				$csv_row[] = $event_data['event_enddate']; // enddate
@@ -5320,12 +5320,12 @@  discard block
 block discarded – undo
5320 5320
 				$csv_row[] = $event_data['recurring_end_date']; // repeat_end
5321 5321
 			}
5322 5322
 			$csv_row[] = $post_info['post_status']; // post_status
5323
-			$csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured
5323
+			$csv_row[] = (int) $post_info['is_featured'] == 1 ? 1 : ''; // is_featured
5324 5324
             if ($is_claim_active) {
5325
-                $csv_row[] = !empty($post_info['claimed']) && (int)$post_info['claimed'] == 1 ? 1 : ''; // claimed
5325
+                $csv_row[] = !empty($post_info['claimed']) && (int) $post_info['claimed'] == 1 ? 1 : ''; // claimed
5326 5326
             }
5327 5327
 			if ($is_payment_plugin) {
5328
-				$csv_row[] = (int)$post_info['package_id']; // package_id
5328
+				$csv_row[] = (int) $post_info['package_id']; // package_id
5329 5329
 				$csv_row[] = $post_info['alive_days'] !== '' ? absint($post_info['alive_days']) : ''; // alive_days
5330 5330
 				$csv_row[] = $post_info['expire_date'] != '' && geodir_strtolower($post_info['expire_date']) != 'never' ? date_i18n('Y-m-d', strtotime($post_info['expire_date'])) : 'Never'; // expire_date
5331 5331
 			}
@@ -5361,18 +5361,18 @@  discard block
 block discarded – undo
5361 5361
 			$csv_row[] = stripslashes($post_info['geodir_video']); // geodir_video
5362 5362
 			$csv_row[] = stripslashes($post_info['geodir_special_offers']); // geodir_special_offers
5363 5363
 			if ($is_events_active || $is_custom_posts_active) {
5364
-				$csv_row[] = !empty($post_info['geodir_link_business']) ? (int)$post_info['geodir_link_business'] : ''; // linked business
5364
+				$csv_row[] = !empty($post_info['geodir_link_business']) ? (int) $post_info['geodir_link_business'] : ''; // linked business
5365 5365
 			}
5366 5366
 			// WPML
5367 5367
 			if ($is_wpml) {
5368
-				$csv_row[] = geodir_get_language_for_element( $post_id, 'post_' . $post_type );
5369
-				$csv_row[] = geodir_imex_original_post_id( $post_id, 'post_' . $post_type );
5368
+				$csv_row[] = geodir_get_language_for_element($post_id, 'post_'.$post_type);
5369
+				$csv_row[] = geodir_imex_original_post_id($post_id, 'post_'.$post_type);
5370 5370
 			}
5371 5371
 			// WPML
5372 5372
 			
5373
-			if ( !empty( $custom_fields ) ) {
5374
-				foreach ( $custom_fields as $custom_field ) {
5375
-					$csv_row[] = isset( $post_info[$custom_field->htmlvar_name] ) ? $post_info[$custom_field->htmlvar_name] : '';
5373
+			if (!empty($custom_fields)) {
5374
+				foreach ($custom_fields as $custom_field) {
5375
+					$csv_row[] = isset($post_info[$custom_field->htmlvar_name]) ? $post_info[$custom_field->htmlvar_name] : '';
5376 5376
 				}
5377 5377
 			}
5378 5378
 			
@@ -5383,15 +5383,15 @@  discard block
 block discarded – undo
5383 5383
 				$franchise = '';
5384 5384
 					
5385 5385
 				if (geodir_franchise_pkg_is_active($gd_post_info)) {
5386
-					$gd_is_franchise = (int)get_post_meta( $post_id, 'gd_is_franchise', true );
5387
-					$locaked_fields = $gd_is_franchise ? get_post_meta( $post_id, 'gd_franchise_lock', true ) : '';
5386
+					$gd_is_franchise = (int) get_post_meta($post_id, 'gd_is_franchise', true);
5387
+					$locaked_fields = $gd_is_franchise ? get_post_meta($post_id, 'gd_franchise_lock', true) : '';
5388 5388
 					$locaked_fields = (is_array($locaked_fields) && !empty($locaked_fields) ? implode(",", $locaked_fields) : '');
5389
-					$franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 ? (int)$post_info['franchise'] : 0; // franchise id
5389
+					$franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 ? (int) $post_info['franchise'] : 0; // franchise id
5390 5390
 				}
5391 5391
 				
5392
-				$csv_row[] = (int)$gd_is_franchise; // gd_is_franchise
5392
+				$csv_row[] = (int) $gd_is_franchise; // gd_is_franchise
5393 5393
 				$csv_row[] = $locaked_fields; // gd_franchise_lock fields
5394
-				$csv_row[] = (int)$franchise; // franchise id
5394
+				$csv_row[] = (int) $franchise; // franchise id
5395 5395
 			}
5396 5396
             
5397 5397
             /**
@@ -5405,15 +5405,15 @@  discard block
 block discarded – undo
5405 5405
              */
5406 5406
             $csv_row = apply_filters('geodir_export_listing_csv_column_values', $csv_row, $post_info);
5407 5407
 			
5408
-			for ( $c = 0; $c < $images_count; $c++ ) {
5409
-				$csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE
5408
+			for ($c = 0; $c < $images_count; $c++) {
5409
+				$csv_row[] = isset($current_images[$c]) ? $current_images[$c] : ''; // IMAGE
5410 5410
 			}
5411 5411
 			
5412 5412
 			$csv_rows[] = $csv_row;
5413 5413
 
5414 5414
 		}
5415 5415
 
5416
-		for ( $c = 0; $c < $images_count; $c++ ) {
5416
+		for ($c = 0; $c < $images_count; $c++) {
5417 5417
 			$csv_rows[0][] = 'IMAGE';
5418 5418
 		}
5419 5419
 	}
@@ -5435,30 +5435,30 @@  discard block
 block discarded – undo
5435 5435
  * @param int $page_no Page number. Default 0.
5436 5436
  * @return array Array of posts data.
5437 5437
  */
5438
-function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
5438
+function geodir_get_export_posts($post_type, $per_page = 0, $page_no = 0) {
5439 5439
     global $wpdb, $plugin_prefix;
5440 5440
 
5441
-    if ( ! post_type_exists( $post_type ) )
5441
+    if (!post_type_exists($post_type))
5442 5442
         return new stdClass;
5443 5443
         
5444
-    $table = $plugin_prefix . $post_type . '_detail';
5444
+    $table = $plugin_prefix.$post_type.'_detail';
5445 5445
 
5446 5446
     $limit = '';
5447
-    if ( $per_page > 0 && $page_no > 0 ) {
5448
-        $offset = ( $page_no - 1 ) * $per_page;
5447
+    if ($per_page > 0 && $page_no > 0) {
5448
+        $offset = ($page_no - 1) * $per_page;
5449 5449
         
5450
-        if ( $offset > 0 ) {
5451
-            $limit = " LIMIT " . $offset . "," . $per_page;
5450
+        if ($offset > 0) {
5451
+            $limit = " LIMIT ".$offset.",".$per_page;
5452 5452
         } else {
5453
-            $limit = " LIMIT " . $per_page;
5453
+            $limit = " LIMIT ".$per_page;
5454 5454
         }
5455 5455
     }
5456 5456
 
5457 5457
     // Skip listing with statuses trash, auto-draft etc...
5458 5458
     $skip_statuses = geodir_imex_export_skip_statuses();
5459 5459
     $where_statuses = '';
5460
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5461
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5460
+    if (!empty($skip_statuses) && is_array($skip_statuses)) {
5461
+        $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
5462 5462
     }
5463 5463
     
5464 5464
     /**
@@ -5469,9 +5469,9 @@  discard block
 block discarded – undo
5469 5469
      *
5470 5470
      * @param string $where SQL where clause part.
5471 5471
      */
5472
-    $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5472
+    $where_statuses = apply_filters('geodir_get_export_posts', $where_statuses, $post_type);
5473 5473
 
5474
-    $query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " ORDER BY {$wpdb->posts}.ID ASC" . $limit, $post_type );
5474
+    $query = $wpdb->prepare("SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s ".$where_statuses." ORDER BY {$wpdb->posts}.ID ASC".$limit, $post_type);
5475 5475
     /**
5476 5476
      * Modify returned posts SQL query for the current post type.
5477 5477
      *
@@ -5481,8 +5481,8 @@  discard block
 block discarded – undo
5481 5481
      * @param int $query The SQL query.
5482 5482
      * @param string $post_type Post type.
5483 5483
      */
5484
-    $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
5485
-    $results = (array)$wpdb->get_results( $query, ARRAY_A );
5484
+    $query = apply_filters('geodir_imex_export_posts_query', $query, $post_type);
5485
+    $results = (array) $wpdb->get_results($query, ARRAY_A);
5486 5486
 
5487 5487
     /**
5488 5488
      * Modify returned post results for the current post type.
@@ -5493,7 +5493,7 @@  discard block
 block discarded – undo
5493 5493
      * @param object $results An object containing all post ids.
5494 5494
      * @param string $post_type Post type.
5495 5495
      */
5496
-    return apply_filters( 'geodir_export_posts', $results, $post_type );
5496
+    return apply_filters('geodir_export_posts', $results, $post_type);
5497 5497
 }
5498 5498
 
5499 5499
 /**
@@ -5511,24 +5511,24 @@  discard block
 block discarded – undo
5511 5511
  * @param string $post_type Post type.
5512 5512
  * @return string The SQL query.
5513 5513
  */
5514
-function geodir_imex_get_events_query( $query, $post_type ) {
5515
-    if ( $post_type == 'gd_event' ) {
5514
+function geodir_imex_get_events_query($query, $post_type) {
5515
+    if ($post_type == 'gd_event') {
5516 5516
         global $wpdb, $plugin_prefix;
5517 5517
         
5518
-        $table = $plugin_prefix . $post_type . '_detail';
5518
+        $table = $plugin_prefix.$post_type.'_detail';
5519 5519
         $schedule_table = EVENT_SCHEDULE;
5520 5520
         
5521 5521
         // Skip listing with statuses trash, auto-draft etc...
5522 5522
         $skip_statuses = geodir_imex_export_skip_statuses();
5523 5523
         $where_statuses = '';
5524
-        if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5525
-            $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5524
+        if (!empty($skip_statuses) && is_array($skip_statuses)) {
5525
+            $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
5526 5526
         }
5527 5527
         
5528 5528
         /** This action is documented in geodirectory-functions/geodirectory-admin/admin_functions.php */
5529
-        $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5529
+        $where_statuses = apply_filters('geodir_get_export_posts', $where_statuses, $post_type);
5530 5530
 
5531
-        $query = $wpdb->prepare( "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s " . $where_statuses . " GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC", $post_type );
5531
+        $query = $wpdb->prepare("SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s ".$where_statuses." GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC", $post_type);
5532 5532
     }
5533 5533
 
5534 5534
     return $query;
@@ -5552,35 +5552,35 @@  discard block
 block discarded – undo
5552 5552
  * @param  string $post_type Post type.
5553 5553
  * @return int Total terms count.
5554 5554
  */
5555
-function geodir_get_terms_count( $post_type ) {
5556
-    $args = array( 'hide_empty' => 0 );
5555
+function geodir_get_terms_count($post_type) {
5556
+    $args = array('hide_empty' => 0);
5557 5557
 
5558
-    remove_all_filters( 'get_terms' );
5558
+    remove_all_filters('get_terms');
5559 5559
 
5560
-    $taxonomy = $post_type . 'category';
5560
+    $taxonomy = $post_type.'category';
5561 5561
 
5562 5562
     // WPML
5563 5563
     $is_wpml = geodir_is_wpml();
5564 5564
     $active_lang = 'all';
5565
-    if ( $is_wpml ) {
5565
+    if ($is_wpml) {
5566 5566
         global $sitepress;
5567 5567
         $active_lang = $sitepress->get_current_language();
5568 5568
         
5569
-        if ( $active_lang != 'all' ) {
5570
-            $sitepress->switch_lang( 'all', true );
5569
+        if ($active_lang != 'all') {
5570
+            $sitepress->switch_lang('all', true);
5571 5571
         }
5572 5572
     }
5573 5573
     // WPML
5574 5574
             
5575
-    $count_terms = wp_count_terms( $taxonomy, $args );
5575
+    $count_terms = wp_count_terms($taxonomy, $args);
5576 5576
 
5577 5577
     // WPML
5578
-    if ( $is_wpml && $active_lang !== 'all' ) {
5578
+    if ($is_wpml && $active_lang !== 'all') {
5579 5579
         global $sitepress;
5580
-        $sitepress->switch_lang( $active_lang, true );
5580
+        $sitepress->switch_lang($active_lang, true);
5581 5581
     }
5582 5582
     // WPML
5583
-    $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
5583
+    $count_terms = !is_wp_error($count_terms) ? $count_terms : 0;
5584 5584
      
5585 5585
     return $count_terms;
5586 5586
 }
@@ -5597,23 +5597,23 @@  discard block
 block discarded – undo
5597 5597
  * @param int $page_no Page number. Default 0.
5598 5598
  * @return array Array of terms data.
5599 5599
  */
5600
-function geodir_imex_get_terms( $post_type, $per_page = 0, $page_no = 0 ) {
5601
-	$args = array( 'hide_empty' => 0, 'orderby' => 'id' );
5600
+function geodir_imex_get_terms($post_type, $per_page = 0, $page_no = 0) {
5601
+	$args = array('hide_empty' => 0, 'orderby' => 'id');
5602 5602
 	
5603
-	remove_all_filters( 'get_terms' );
5603
+	remove_all_filters('get_terms');
5604 5604
 	
5605
-	$taxonomy = $post_type . 'category';
5605
+	$taxonomy = $post_type.'category';
5606 5606
 	
5607
-	if ( $per_page > 0 && $page_no > 0 ) {
5608
-		$args['offset'] = ( $page_no - 1 ) * $per_page;
5607
+	if ($per_page > 0 && $page_no > 0) {
5608
+		$args['offset'] = ($page_no - 1) * $per_page;
5609 5609
 		$args['number'] = $per_page;
5610 5610
 	}
5611 5611
 	
5612
-	$terms = get_terms( $taxonomy, $args );
5612
+	$terms = get_terms($taxonomy, $args);
5613 5613
 
5614 5614
 	$csv_rows = array();
5615 5615
 	
5616
-	if ( !empty( $terms ) ) {
5616
+	if (!empty($terms)) {
5617 5617
 		$csv_row = array();
5618 5618
 		$csv_row[] = 'cat_id';
5619 5619
 		$csv_row[] = 'cat_name';
@@ -5635,16 +5635,16 @@  discard block
 block discarded – undo
5635 5635
 		
5636 5636
 		$csv_rows[] = $csv_row;
5637 5637
 		
5638
-		foreach ( $terms as $term ) {
5639
-			$cat_icon = geodir_get_tax_meta( $term->term_id, 'ct_cat_icon', false, $post_type );
5640
-			$cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
5638
+		foreach ($terms as $term) {
5639
+			$cat_icon = geodir_get_tax_meta($term->term_id, 'ct_cat_icon', false, $post_type);
5640
+			$cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : '';
5641 5641
 			
5642
-			$cat_image = geodir_get_default_catimage( $term->term_id, $post_type );
5643
-			$cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; 
5642
+			$cat_image = geodir_get_default_catimage($term->term_id, $post_type);
5643
+			$cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : ''; 
5644 5644
 			
5645 5645
 			$cat_parent = '';
5646
-			if (isset($term->parent) && (int)$term->parent > 0 && term_exists((int)$term->parent, $taxonomy)) {
5647
-				$parent_term = (array)get_term_by( 'id', (int)$term->parent, $taxonomy );
5646
+			if (isset($term->parent) && (int) $term->parent > 0 && term_exists((int) $term->parent, $taxonomy)) {
5647
+				$parent_term = (array) get_term_by('id', (int) $term->parent, $taxonomy);
5648 5648
 				$cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : '';
5649 5649
 			}
5650 5650
 			
@@ -5654,15 +5654,15 @@  discard block
 block discarded – undo
5654 5654
 			$csv_row[] = $term->slug;
5655 5655
 			$csv_row[] = $post_type;
5656 5656
 			$csv_row[] = $cat_parent;
5657
-			$csv_row[] = geodir_get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type );
5657
+			$csv_row[] = geodir_get_tax_meta($term->term_id, 'ct_cat_schema', false, $post_type);
5658 5658
             // WPML
5659 5659
 			if ($is_wpml) {
5660
-				$csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy );
5661
-                $csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy );
5660
+				$csv_row[] = geodir_get_language_for_element($term->term_id, 'tax_'.$taxonomy);
5661
+                $csv_row[] = geodir_imex_original_post_id($term->term_id, 'tax_'.$taxonomy);
5662 5662
 			}
5663 5663
 			// WPML
5664 5664
 			$csv_row[] = $term->description;
5665
-			$csv_row[] = geodir_get_tax_meta( $term->term_id, 'ct_cat_top_desc', false, $post_type );
5665
+			$csv_row[] = geodir_get_tax_meta($term->term_id, 'ct_cat_top_desc', false, $post_type);
5666 5666
 			$csv_row[] = $cat_image;
5667 5667
 			$csv_row[] = $cat_icon;
5668 5668
 			
@@ -5681,10 +5681,10 @@  discard block
 block discarded – undo
5681 5681
  * @param  bool $relative True for relative path & False for absolute path.
5682 5682
  * @return string Path to the cache directory.
5683 5683
  */
5684
-function geodir_path_import_export( $relative = true ) {
5684
+function geodir_path_import_export($relative = true) {
5685 5685
 	$upload_dir = wp_upload_dir();
5686 5686
 	
5687
-	return $relative ? $upload_dir['baseurl'] . '/cache' : $upload_dir['basedir'] . '/cache';
5687
+	return $relative ? $upload_dir['baseurl'].'/cache' : $upload_dir['basedir'].'/cache';
5688 5688
 }
5689 5689
 
5690 5690
 /**
@@ -5700,8 +5700,8 @@  discard block
 block discarded – undo
5700 5700
  * @param  bool $clear If true then it overwrite data otherwise add rows at the end of file.
5701 5701
  * @return bool true if success otherwise false.
5702 5702
  */
5703
-function geodir_save_csv_data( $file_path, $csv_data = array(), $clear = true ) {
5704
-	if ( empty( $csv_data ) ) {
5703
+function geodir_save_csv_data($file_path, $csv_data = array(), $clear = true) {
5704
+	if (empty($csv_data)) {
5705 5705
 		return false;
5706 5706
 	}
5707 5707
 	
@@ -5709,17 +5709,17 @@  discard block
 block discarded – undo
5709 5709
 	
5710 5710
 	$mode = $clear ? 'w+' : 'a+';
5711 5711
 	
5712
-	if ( function_exists( 'fputcsv' ) ) {
5713
-		$file = fopen( $file_path, $mode );
5714
-		foreach( $csv_data as $csv_row ) {
5712
+	if (function_exists('fputcsv')) {
5713
+		$file = fopen($file_path, $mode);
5714
+		foreach ($csv_data as $csv_row) {
5715 5715
 			//$csv_row = array_map( 'utf8_decode', $csv_row );
5716
-			$write_successful = fputcsv( $file, $csv_row, ",", $enclosure = '"' );
5716
+			$write_successful = fputcsv($file, $csv_row, ",", $enclosure = '"');
5717 5717
 		}
5718
-		fclose( $file );
5718
+		fclose($file);
5719 5719
 	} else {
5720
-		foreach( $csv_data as $csv_row ) {
5720
+		foreach ($csv_data as $csv_row) {
5721 5721
 			//$csv_row = array_map( 'utf8_decode', $csv_row );
5722
-			$wp_filesystem->put_contents( $file_path, $csv_row );
5722
+			$wp_filesystem->put_contents($file_path, $csv_row);
5723 5723
 		}
5724 5724
 	}
5725 5725
 		
@@ -5737,14 +5737,14 @@  discard block
 block discarded – undo
5737 5737
  * @param  string $file Full path to file.
5738 5738
  * @return int No of file rows.
5739 5739
  */
5740
-function geodir_import_export_line_count( $file ) {
5740
+function geodir_import_export_line_count($file) {
5741 5741
 	global $wp_filesystem;
5742 5742
 	
5743
-	if ( $wp_filesystem->is_file( $file ) && $wp_filesystem->exists( $file ) ) {
5744
-		$contents = $wp_filesystem->get_contents_array( $file );
5743
+	if ($wp_filesystem->is_file($file) && $wp_filesystem->exists($file)) {
5744
+		$contents = $wp_filesystem->get_contents_array($file);
5745 5745
 		
5746
-		if ( !empty( $contents ) && is_array( $contents ) ) {
5747
-			return count( $contents ) - 1;
5746
+		if (!empty($contents) && is_array($contents)) {
5747
+			return count($contents) - 1;
5748 5748
 		}
5749 5749
 	}
5750 5750
 	
@@ -5761,11 +5761,11 @@  discard block
 block discarded – undo
5761 5761
  * @param string $post_type The post type.
5762 5762
  * @return object Queried object.
5763 5763
  */
5764
-function geodir_imex_get_custom_fields( $post_type ) {
5764
+function geodir_imex_get_custom_fields($post_type) {
5765 5765
 	global $wpdb;
5766 5766
 	 
5767
-	$sql = $wpdb->prepare("SELECT htmlvar_name FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array( $post_type ) );
5768
-	$rows = $wpdb->get_results( $sql );
5767
+	$sql = $wpdb->prepare("SELECT htmlvar_name FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array($post_type));
5768
+	$rows = $wpdb->get_results($sql);
5769 5769
 	 
5770 5770
 	return $rows;
5771 5771
 }
@@ -5781,10 +5781,10 @@  discard block
 block discarded – undo
5781 5781
  * @return array Event data array.
5782 5782
  */
5783 5783
 function geodir_imex_get_event_data($post, $gd_post_info) {
5784
-	$event_date = isset( $post['event_date'] ) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $post['event_date'] ) ) : '';
5784
+	$event_date = isset($post['event_date']) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($post['event_date'])) : '';
5785 5785
 	$event_enddate = $event_date;
5786
-	$starttime = isset( $post['starttime'] ) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['starttime'] ) ) : '';
5787
-	$endtime = isset( $post['endtime'] ) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['endtime'] ) ) : '';
5786
+	$starttime = isset($post['starttime']) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['starttime'])) : '';
5787
+	$endtime = isset($post['endtime']) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['endtime'])) : '';
5788 5788
 	
5789 5789
 	$is_recurring_event = '';
5790 5790
 	$event_duration_days = '';
@@ -5801,15 +5801,15 @@  discard block
 block discarded – undo
5801 5801
 		
5802 5802
 	$recurring_data = isset($gd_post_info->recurring_dates) ? maybe_unserialize($gd_post_info->recurring_dates) : array();
5803 5803
 	if (!empty($recurring_data)) {
5804
-		$event_date = isset( $recurring_data['event_start'] ) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_start'] ) ) : $event_date;
5805
-		$event_enddate = isset( $recurring_data['event_end'] ) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_end'] ) ) : $event_date;
5806
-		$starttime = isset( $recurring_data['starttime'] ) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['starttime'] ) ) : $starttime;
5807
-		$endtime = isset( $recurring_data['endtime'] ) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['endtime'] ) ) : $endtime;
5804
+		$event_date = isset($recurring_data['event_start']) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['event_start'])) : $event_date;
5805
+		$event_enddate = isset($recurring_data['event_end']) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['event_end'])) : $event_date;
5806
+		$starttime = isset($recurring_data['starttime']) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['starttime'])) : $starttime;
5807
+		$endtime = isset($recurring_data['endtime']) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['endtime'])) : $endtime;
5808 5808
 		$is_whole_day_event = !empty($recurring_data['all_day']) ? 1 : '';
5809 5809
 		$different_times = !empty($recurring_data['different_times']) ? true : false;
5810 5810
 	
5811
-		$recurring_pkg = geodir_event_recurring_pkg( $gd_post_info );
5812
-		$is_recurring = isset( $gd_post_info->is_recurring ) && (int)$gd_post_info->is_recurring == 0 ? false : true;
5811
+		$recurring_pkg = geodir_event_recurring_pkg($gd_post_info);
5812
+		$is_recurring = isset($gd_post_info->is_recurring) && (int) $gd_post_info->is_recurring == 0 ? false : true;
5813 5813
 			
5814 5814
 		if ($recurring_pkg && $is_recurring) {
5815 5815
 			$recurring_dates = $event_date;
@@ -5819,13 +5819,13 @@  discard block
 block discarded – undo
5819 5819
 			$recurring_type = !empty($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'custom';
5820 5820
 			
5821 5821
 			if (!empty($recurring_data['event_recurring_dates'])) {
5822
-				$event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
5822
+				$event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
5823 5823
 				
5824 5824
 				if (!empty($event_recurring_dates)) {
5825 5825
 					$recurring_dates = array();
5826 5826
 					
5827 5827
 					foreach ($event_recurring_dates as $date) {
5828
-						$recurring_dates[] = date_i18n( 'd/m/Y', strtotime( $date ) );
5828
+						$recurring_dates[] = date_i18n('d/m/Y', strtotime($date));
5829 5829
 					}
5830 5830
 					
5831 5831
 					$recurring_dates = implode(",", $recurring_dates);
@@ -5841,7 +5841,7 @@  discard block
 block discarded – undo
5841 5841
 						$times = array();
5842 5842
 						
5843 5843
 						foreach ($recurring_data['starttimes'] as $time) {
5844
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
5844
+							$times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
5845 5845
 						}
5846 5846
 						
5847 5847
 						$event_starttimes = implode(",", $times);
@@ -5851,7 +5851,7 @@  discard block
 block discarded – undo
5851 5851
 						$times = array();
5852 5852
 						
5853 5853
 						foreach ($recurring_data['endtimes'] as $time) {
5854
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
5854
+							$times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
5855 5855
 						}
5856 5856
 						
5857 5857
 						$event_endtimes = implode(",", $times);
@@ -5863,8 +5863,8 @@  discard block
 block discarded – undo
5863 5863
 					}
5864 5864
 				}
5865 5865
 			} else {
5866
-				$event_duration_days = isset($recurring_data['duration_x']) ? (int)$recurring_data['duration_x'] : 1;
5867
-				$recurring_interval = !empty($recurring_data['repeat_x']) && (int)$recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
5866
+				$event_duration_days = isset($recurring_data['duration_x']) ? (int) $recurring_data['duration_x'] : 1;
5867
+				$recurring_interval = !empty($recurring_data['repeat_x']) && (int) $recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
5868 5868
 				
5869 5869
 				if (($recurring_type == 'week' || $recurring_type == 'month') && !empty($recurring_data['repeat_days'])) {
5870 5870
 					$week_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
@@ -5880,11 +5880,11 @@  discard block
 block discarded – undo
5880 5880
 				}
5881 5881
 				
5882 5882
 				$recurring_week_nos = $recurring_type == 'month' && !empty($recurring_data['repeat_weeks']) ? implode(",", $recurring_data['repeat_weeks']) : $recurring_week_nos;
5883
-				if (!empty($recurring_data['repeat_end_type']) && (int)$recurring_data['repeat_end_type'] == 1) {
5884
-					$recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['repeat_end'] ) ) : '';
5883
+				if (!empty($recurring_data['repeat_end_type']) && (int) $recurring_data['repeat_end_type'] == 1) {
5884
+					$recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['repeat_end'])) : '';
5885 5885
 					$max_recurring_count = empty($recurring_end_date) ? 1 : '';
5886 5886
 				} else {
5887
-					$max_recurring_count = (!empty($recurring_data['max_repeat']) && (int)$recurring_data['max_repeat'] > 0 ? (int)$recurring_data['max_repeat'] : 1);
5887
+					$max_recurring_count = (!empty($recurring_data['max_repeat']) && (int) $recurring_data['max_repeat'] > 0 ? (int) $recurring_data['max_repeat'] : 1);
5888 5888
 				}
5889 5889
 			}
5890 5890
 		}
@@ -5948,9 +5948,9 @@  discard block
 block discarded – undo
5948 5948
  * @return array Event data array.
5949 5949
  */
5950 5950
 function geodir_imex_process_event_data($gd_post) {
5951
-	$recurring_pkg = geodir_event_recurring_pkg( (object)$gd_post );
5951
+	$recurring_pkg = geodir_event_recurring_pkg((object) $gd_post);
5952 5952
 
5953
-	$is_recurring = isset( $gd_post['is_recurring_event'] ) && (int)$gd_post['is_recurring_event'] == 0 ? false : true;
5953
+	$is_recurring = isset($gd_post['is_recurring_event']) && (int) $gd_post['is_recurring_event'] == 0 ? false : true;
5954 5954
 	$event_date = isset($gd_post['event_date']) && $gd_post['event_date'] != '' ? geodir_date($gd_post['event_date'], 'Y-m-d') : '';
5955 5955
 	$event_enddate = isset($gd_post['event_enddate']) && $gd_post['event_enddate'] != '' ? geodir_date($gd_post['event_enddate'], 'Y-m-d') : $event_date;
5956 5956
 	$all_day = isset($gd_post['is_whole_day_event']) && !empty($gd_post['is_whole_day_event']) ? true : false;
@@ -5997,17 +5997,17 @@  discard block
 block discarded – undo
5997 5997
 				$event_recurring_dates = implode(",", $event_recurring_dates);
5998 5998
 			}
5999 5999
 		} else {
6000
-			$duration_x = !empty( $gd_post['event_duration_days'] ) ? (int)$gd_post['event_duration_days'] : 1;
6001
-			$repeat_x = !empty( $gd_post['recurring_interval'] ) ? (int)$gd_post['recurring_interval'] : 1;
6002
-			$max_repeat = !empty( $gd_post['max_recurring_count'] ) ? (int)$gd_post['max_recurring_count'] : 1;
6003
-			$repeat_end = !empty( $gd_post['recurring_end_date'] ) ? geodir_date($gd_post['recurring_end_date'], 'Y-m-d') : '';
6000
+			$duration_x = !empty($gd_post['event_duration_days']) ? (int) $gd_post['event_duration_days'] : 1;
6001
+			$repeat_x = !empty($gd_post['recurring_interval']) ? (int) $gd_post['recurring_interval'] : 1;
6002
+			$max_repeat = !empty($gd_post['max_recurring_count']) ? (int) $gd_post['max_recurring_count'] : 1;
6003
+			$repeat_end = !empty($gd_post['recurring_end_date']) ? geodir_date($gd_post['recurring_end_date'], 'Y-m-d') : '';
6004 6004
 			
6005 6005
 			$repeat_end_type = $repeat_end != '' ? 1 : 0;
6006 6006
 			$max_repeat = $repeat_end != '' ? '' : $max_repeat;
6007 6007
 			
6008 6008
 			$week_days = array_flip(array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'));
6009 6009
 			
6010
-			$a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days'])!='' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6010
+			$a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days']) != '' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6011 6011
 			$repeat_days = array();
6012 6012
 			if (!empty($a_repeat_days)) {
6013 6013
 				foreach ($a_repeat_days as $repeat_day) {
@@ -6025,7 +6025,7 @@  discard block
 block discarded – undo
6025 6025
 			$repeat_weeks = array();
6026 6026
 			if (!empty($a_repeat_weeks)) {
6027 6027
 				foreach ($a_repeat_weeks as $repeat_week) {
6028
-					$repeat_weeks[] = (int)$repeat_week;
6028
+					$repeat_weeks[] = (int) $repeat_week;
6029 6029
 				}
6030 6030
 				
6031 6031
 				$repeat_weeks = array_unique($repeat_weeks);
@@ -6089,7 +6089,7 @@  discard block
 block discarded – undo
6089 6089
 
6090 6090
     $page_found = $wpdb->get_var(
6091 6091
         $wpdb->prepare(
6092
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6092
+            "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;",
6093 6093
             array($slug)
6094 6094
         )
6095 6095
     );
@@ -6144,7 +6144,7 @@  discard block
 block discarded – undo
6144 6144
  */
6145 6145
 function geodir_admin_upgrade_notice() {
6146 6146
     $class = "error";
6147
-    $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6147
+    $message = __("Please update core GeoDirectory or some addons may not function correctly.", "geodirectory");
6148 6148
     echo"<div class=\"$class\"> <p>$message</p></div>";
6149 6149
 }
6150 6150
 
@@ -6156,7 +6156,7 @@  discard block
 block discarded – undo
6156 6156
  * @param (object) $r
6157 6157
  * @return (string) $output
6158 6158
  */
6159
-function geodire_admin_upgrade_notice( $plugin_data, $r )
6159
+function geodire_admin_upgrade_notice($plugin_data, $r)
6160 6160
 {
6161 6161
     // readme contents
6162 6162
     $args = array(
@@ -6164,7 +6164,7 @@  discard block
 block discarded – undo
6164 6164
         'redirection' => 5
6165 6165
     );
6166 6166
     $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6167
-    $data       = wp_remote_get( $url, $args );
6167
+    $data = wp_remote_get($url, $args);
6168 6168
 
6169 6169
     if (!is_wp_error($data) && $data['response']['code'] == 200) {
6170 6170
 
@@ -6179,20 +6179,20 @@  discard block
 block discarded – undo
6179 6179
 function geodir_in_plugin_update_message($content) {
6180 6180
     // Output Upgrade Notice
6181 6181
     $matches        = null;
6182
-    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6182
+    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*'.preg_quote(GEODIRECTORY_VERSION).'\s*=|$)~Uis';
6183 6183
     $upgrade_notice = '';
6184
-    if ( preg_match( $regexp, $content, $matches ) ) {
6185
-        if(empty($matches)){return;}
6184
+    if (preg_match($regexp, $content, $matches)) {
6185
+        if (empty($matches)) {return; }
6186 6186
 
6187
-        $version = trim( $matches[1] );
6188
-        if($version && $version>GEODIRECTORY_VERSION){
6187
+        $version = trim($matches[1]);
6188
+        if ($version && $version > GEODIRECTORY_VERSION) {
6189 6189
 
6190 6190
 
6191
-        $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6192
-        if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6191
+        $notices = (array) preg_split('~[\r\n]+~', trim($matches[2]));
6192
+        if (version_compare(GEODIRECTORY_VERSION, $version, '<')) {
6193 6193
             $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6194
-            foreach ( $notices as $index => $line ) {
6195
-                $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6194
+            foreach ($notices as $index => $line) {
6195
+                $upgrade_notice .= wp_kses_post(preg_replace('~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line));
6196 6196
             }
6197 6197
             $upgrade_notice .= '</div> ';
6198 6198
         }
@@ -6216,7 +6216,7 @@  discard block
 block discarded – undo
6216 6216
 		$default_language = $sitepress->get_default_language();
6217 6217
 		if ($current_language != 'all' && $current_language != $default_language) {
6218 6218
 	?>
6219
-	<div class="updated error notice-success" id="message"><p style="color:red"><strong><?php _e('Saving GeoDirectory pages settings on a different language breaks pages settings. Try to save after switching to default language.', 'geodirectory');?></strong></p></div>
6219
+	<div class="updated error notice-success" id="message"><p style="color:red"><strong><?php _e('Saving GeoDirectory pages settings on a different language breaks pages settings. Try to save after switching to default language.', 'geodirectory'); ?></strong></p></div>
6220 6220
 	<?php
6221 6221
 		}
6222 6222
 	}
@@ -6231,7 +6231,7 @@  discard block
 block discarded – undo
6231 6231
  * @param array Listing statuses to be skipped.
6232 6232
  */
6233 6233
 function geodir_imex_export_skip_statuses() {
6234
-    $statuses = array( 'trash', 'auto-draft' );
6234
+    $statuses = array('trash', 'auto-draft');
6235 6235
     
6236 6236
     /**
6237 6237
      * Filter the statuses to skip during GD export listings.
@@ -6241,7 +6241,7 @@  discard block
 block discarded – undo
6241 6241
      *
6242 6242
      * @param array $statuses Listing statuses to be skipped.
6243 6243
      */
6244
-    $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses );
6244
+    $statuses = apply_filters('geodir_imex_export_skip_statuses', $statuses);
6245 6245
      
6246 6246
     return $statuses;
6247 6247
 }
@@ -6312,16 +6312,16 @@  discard block
 block discarded – undo
6312 6312
 function geodir_imex_get_filter_where($where = '', $post_type = '') {
6313 6313
     global $wpdb;
6314 6314
     
6315
-    $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
6315
+    $filters = !empty($_REQUEST['gd_imex']) && is_array($_REQUEST['gd_imex']) ? $_REQUEST['gd_imex'] : NULL;
6316 6316
     
6317
-    if ( !empty( $filters ) ) {
6318
-        foreach ( $filters as $field => $value ) {
6317
+    if (!empty($filters)) {
6318
+        foreach ($filters as $field => $value) {
6319 6319
             switch ($field) {
6320 6320
                 case 'start_date':
6321
-                    $where .= " AND `" . $wpdb->posts . "`.`post_date` >= '" . sanitize_text_field( $value ) . " 00:00:00'";
6321
+                    $where .= " AND `".$wpdb->posts."`.`post_date` >= '".sanitize_text_field($value)." 00:00:00'";
6322 6322
                 break;
6323 6323
                 case 'end_date':
6324
-                    $where .= " AND `" . $wpdb->posts . "`.`post_date` <= '" . sanitize_text_field( $value ) . " 23:59:59'";
6324
+                    $where .= " AND `".$wpdb->posts."`.`post_date` <= '".sanitize_text_field($value)." 23:59:59'";
6325 6325
                 break;
6326 6326
             }
6327 6327
         }
@@ -6333,25 +6333,25 @@  discard block
 block discarded – undo
6333 6333
 add_filter('geodir_get_export_posts', 'geodir_imex_get_filter_where', 10, 2);
6334 6334
 
6335 6335
 
6336
-function geodir_fix_for_primer_theme(){
6337
-    if(!defined( 'PRIMER_VERSION' )){return;}
6336
+function geodir_fix_for_primer_theme() {
6337
+    if (!defined('PRIMER_VERSION')) {return; }
6338 6338
     global $pagenow;
6339 6339
 
6340
-    if ( ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) && (isset($_REQUEST['post_type']) || isset($_REQUEST['post']) )  ){
6340
+    if (('post.php' === $pagenow || 'post-new.php' === $pagenow) && (isset($_REQUEST['post_type']) || isset($_REQUEST['post']))) {
6341 6341
 
6342
-        $post_type = isset($_REQUEST['post_type']) ? esc_attr($_REQUEST['post_type']) : get_post_type( $_GET['post'] );
6342
+        $post_type = isset($_REQUEST['post_type']) ? esc_attr($_REQUEST['post_type']) : get_post_type($_GET['post']);
6343 6343
 
6344 6344
         $post_types = geodir_get_posttypes();
6345
-        if ($post_type && in_array($post_type, $post_types) ) {
6345
+        if ($post_type && in_array($post_type, $post_types)) {
6346 6346
             global $primer_customizer_layouts;
6347
-            remove_action( 'add_meta_boxes', array( $primer_customizer_layouts, 'add_meta_box' ), 10);
6347
+            remove_action('add_meta_boxes', array($primer_customizer_layouts, 'add_meta_box'), 10);
6348 6348
         }
6349 6349
     }
6350 6350
 
6351 6351
 }
6352 6352
 
6353
-if(is_admin()){
6354
-    add_action('add_meta_boxes','geodir_fix_for_primer_theme',0);  
6353
+if (is_admin()) {
6354
+    add_action('add_meta_boxes', 'geodir_fix_for_primer_theme', 0);  
6355 6355
 }
6356 6356
 
6357 6357
 
@@ -6484,32 +6484,32 @@  discard block
 block discarded – undo
6484 6484
 
6485 6485
 function geodir_ga_activation_url() {
6486 6486
 
6487
-    return add_query_arg( array(
6487
+    return add_query_arg(array(
6488 6488
         'next'          => admin_url("admin.php?page=geodirectory&active_tab=google_analytic_settings"),
6489 6489
         'scope'         => GEODIR_GA_SCOPE,
6490 6490
         'response_type' => 'code',
6491 6491
         'redirect_uri'  => GEODIR_GA_REDIRECT,
6492 6492
         'client_id'     => GEODIR_GA_CLIENTID,
6493
-    ), 'https://accounts.google.com/o/oauth2/auth' );
6493
+    ), 'https://accounts.google.com/o/oauth2/auth');
6494 6494
 
6495 6495
     return $url;
6496 6496
 }
6497 6497
 
6498
-function geodir_gd_accounts(){
6498
+function geodir_gd_accounts() {
6499 6499
     $accounts = array();
6500
-    $useAuth = ( get_option( 'geodir_ga_auth_code' ) == '' ? false : true );
6501
-    if($useAuth){
6500
+    $useAuth = (get_option('geodir_ga_auth_code') == '' ? false : true);
6501
+    if ($useAuth) {
6502 6502
         try {
6503 6503
             $accounts = geodir_ga_get_analytics_accounts();
6504 6504
         } catch (Exception $e) {
6505
-            geodir_error_log( wp_sprintf( __( 'GD Google Analytics API Error(%s) : %s', 'geodirectory' ), $e->getCode(), $e->getMessage() ) );
6505
+            geodir_error_log(wp_sprintf(__('GD Google Analytics API Error(%s) : %s', 'geodirectory'), $e->getCode(), $e->getMessage()));
6506 6506
         }
6507 6507
         
6508
-        if(is_array($accounts)){
6509
-            $accounts = array_merge(array(__('Select Account','geodirectory')),$accounts);
6510
-        }elseif(get_option('geodir_ga_account_id')){
6508
+        if (is_array($accounts)) {
6509
+            $accounts = array_merge(array(__('Select Account', 'geodirectory')), $accounts);
6510
+        }elseif (get_option('geodir_ga_account_id')) {
6511 6511
             $accounts = array();
6512
-            $accounts[get_option('geodir_ga_account_id')] = __('Account re-authorization may be required','geodirectory').' ('.get_option('geodir_ga_account_id').')';
6512
+            $accounts[get_option('geodir_ga_account_id')] = __('Account re-authorization may be required', 'geodirectory').' ('.get_option('geodir_ga_account_id').')';
6513 6513
         }
6514 6514
     }
6515 6515
     return $accounts;
@@ -6520,21 +6520,21 @@  discard block
 block discarded – undo
6520 6520
     global $gd_ga_errors;
6521 6521
     $accounts = array();
6522 6522
 
6523
-    if(get_option('geodir_ga_auth_token')===false){update_option('geodir_ga_auth_token','');}
6523
+    if (get_option('geodir_ga_auth_token') === false) {update_option('geodir_ga_auth_token', ''); }
6524 6524
 
6525 6525
 
6526
-    if(get_option('geodir_gd_uids') && !isset($_POST['geodir_ga_auth_code'])){
6526
+    if (get_option('geodir_gd_uids') && !isset($_POST['geodir_ga_auth_code'])) {
6527 6527
       return get_option('geodir_gd_uids');
6528 6528
     }
6529 6529
 
6530 6530
     # Create a new Gdata call
6531
-    if ( trim(get_option('geodir_ga_auth_code')) != '' )
6531
+    if (trim(get_option('geodir_ga_auth_code')) != '')
6532 6532
         $stats = new GDGoogleAnalyticsStats();
6533 6533
     else
6534 6534
         return false;
6535 6535
 
6536 6536
     # Check if Google sucessfully logged in
6537
-    if ( ! $stats->checkLogin() )
6537
+    if (!$stats->checkLogin())
6538 6538
         return false;
6539 6539
 
6540 6540
     # Get a list of accounts
@@ -6546,28 +6546,28 @@  discard block
 block discarded – undo
6546 6546
     }
6547 6547
 
6548 6548
 
6549
-    natcasesort ($accounts);
6549
+    natcasesort($accounts);
6550 6550
 
6551 6551
     # Return the account array if there are accounts
6552
-    if ( count($accounts) > 0 ){
6553
-        update_option('geodir_gd_uids',$accounts);
6552
+    if (count($accounts) > 0) {
6553
+        update_option('geodir_gd_uids', $accounts);
6554 6554
         return $accounts;
6555 6555
     }
6556 6556
     else
6557 6557
         return false;
6558 6558
 }
6559 6559
 
6560
-add_action( 'wp_ajax_geodir_ga_deauthorize', 'geodir_ga_deauthorize' );
6561
-function geodir_ga_deauthorize(){
6560
+add_action('wp_ajax_geodir_ga_deauthorize', 'geodir_ga_deauthorize');
6561
+function geodir_ga_deauthorize() {
6562 6562
 
6563
-    if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'gd_ga_deauthorize' ) ) {
6563
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'gd_ga_deauthorize')) {
6564 6564
 
6565
-        die( 'Security check' );
6565
+        die('Security check');
6566 6566
 
6567 6567
     } else {
6568
-        update_option('geodir_ga_auth_token','');
6569
-        update_option('geodir_ga_auth_code','');
6570
-        update_option('geodir_gd_uids','');
6568
+        update_option('geodir_ga_auth_token', '');
6569
+        update_option('geodir_ga_auth_code', '');
6570
+        update_option('geodir_gd_uids', '');
6571 6571
 
6572 6572
 
6573 6573
         echo admin_url('?page=geodirectory&active_tab=google_analytic_settings');
Please login to merge, or discard this patch.
geodirectory_template_actions.php 3 patches
Indentation   +1838 added lines, -1838 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function gd_compat_styles()
19 19
 {
20
-    $tc = get_option('theme_compatibility_setting');
21
-    echo "<style id='gd-compat-styles' type='text/css'>";
22
-    echo $tc['geodir_theme_compat_css'];
23
-    echo "</style>";
20
+	$tc = get_option('theme_compatibility_setting');
21
+	echo "<style id='gd-compat-styles' type='text/css'>";
22
+	echo $tc['geodir_theme_compat_css'];
23
+	echo "</style>";
24 24
 }
25 25
 
26 26
 /**
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function gd_compat_script()
33 33
 {
34
-    $tc = get_option('theme_compatibility_setting');
35
-    echo "<script>";
36
-    echo $tc['geodir_theme_compat_js'];
37
-    echo " </script>";
34
+	$tc = get_option('theme_compatibility_setting');
35
+	echo "<script>";
36
+	echo $tc['geodir_theme_compat_js'];
37
+	echo " </script>";
38 38
 }
39 39
 
40 40
 /**
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
  */
48 48
 function geodir_top_content_add_dynamic()
49 49
 {
50
-    $tc = get_option('theme_compatibility_setting');
51
-    echo $tc['geodir_top_content_add'];
50
+	$tc = get_option('theme_compatibility_setting');
51
+	echo $tc['geodir_top_content_add'];
52 52
 }
53 53
 
54 54
 /**
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
  */
62 62
 function geodir_before_main_content_add_dynamic()
63 63
 {
64
-    $tc = get_option('theme_compatibility_setting');
65
-    echo $tc['geodir_before_main_content_add'];
64
+	$tc = get_option('theme_compatibility_setting');
65
+	echo $tc['geodir_before_main_content_add'];
66 66
 }
67 67
 
68 68
 /**
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
  */
76 76
 function geodir_full_page_class_dynamic()
77 77
 {
78
-    $tc = get_option('theme_compatibility_setting');
79
-    return $tc['geodir_full_page_class_filter'];
78
+	$tc = get_option('theme_compatibility_setting');
79
+	return $tc['geodir_full_page_class_filter'];
80 80
 }
81 81
 
82 82
 /**
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
  */
90 90
 function geodir_before_widget_dynamic()
91 91
 {
92
-    $tc = get_option('theme_compatibility_setting');
93
-    return $tc['geodir_before_widget_filter'];
92
+	$tc = get_option('theme_compatibility_setting');
93
+	return $tc['geodir_before_widget_filter'];
94 94
 }
95 95
 
96 96
 /**
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
  */
104 104
 function geodir_after_widget_dynamic()
105 105
 {
106
-    $tc = get_option('theme_compatibility_setting');
107
-    return $tc['geodir_after_widget_filter'];
106
+	$tc = get_option('theme_compatibility_setting');
107
+	return $tc['geodir_after_widget_filter'];
108 108
 }
109 109
 
110 110
 /**
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
  */
118 118
 function geodir_before_title_dynamic()
119 119
 {
120
-    $tc = get_option('theme_compatibility_setting');
121
-    return $tc['geodir_before_title_filter'];
120
+	$tc = get_option('theme_compatibility_setting');
121
+	return $tc['geodir_before_title_filter'];
122 122
 }
123 123
 
124 124
 /**
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
  */
132 132
 function geodir_after_title_dynamic()
133 133
 {
134
-    $tc = get_option('theme_compatibility_setting');
135
-    return $tc['geodir_after_title_filter'];
134
+	$tc = get_option('theme_compatibility_setting');
135
+	return $tc['geodir_after_title_filter'];
136 136
 }
137 137
 
138 138
 /**
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
  */
146 146
 function geodir_menu_li_class_dynamic()
147 147
 {
148
-    $tc = get_option('theme_compatibility_setting');
149
-    return $tc['geodir_menu_li_class_filter'];
148
+	$tc = get_option('theme_compatibility_setting');
149
+	return $tc['geodir_menu_li_class_filter'];
150 150
 }
151 151
 
152 152
 /**
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
  */
160 160
 function geodir_sub_menu_ul_class_dynamic()
161 161
 {
162
-    $tc = get_option('theme_compatibility_setting');
163
-    return $tc['geodir_sub_menu_ul_class_filter'];
162
+	$tc = get_option('theme_compatibility_setting');
163
+	return $tc['geodir_sub_menu_ul_class_filter'];
164 164
 }
165 165
 
166 166
 /**
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
  */
174 174
 function geodir_sub_menu_li_class_dynamic()
175 175
 {
176
-    $tc = get_option('theme_compatibility_setting');
177
-    return $tc['geodir_sub_menu_li_class_filter'];
176
+	$tc = get_option('theme_compatibility_setting');
177
+	return $tc['geodir_sub_menu_li_class_filter'];
178 178
 }
179 179
 
180 180
 /**
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
  */
188 188
 function geodir_menu_a_class_dynamic()
189 189
 {
190
-    $tc = get_option('theme_compatibility_setting');
191
-    return $tc['geodir_menu_a_class_filter'];
190
+	$tc = get_option('theme_compatibility_setting');
191
+	return $tc['geodir_menu_a_class_filter'];
192 192
 }
193 193
 
194 194
 /**
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
  */
202 202
 function geodir_sub_menu_a_class_dynamic()
203 203
 {
204
-    $tc = get_option('theme_compatibility_setting');
205
-    return $tc['geodir_sub_menu_a_class_filter'];
204
+	$tc = get_option('theme_compatibility_setting');
205
+	return $tc['geodir_sub_menu_a_class_filter'];
206 206
 }
207 207
 
208 208
 /**
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
  */
216 216
 function geodir_location_switcher_menu_li_class_dynamic()
217 217
 {
218
-    $tc = get_option('theme_compatibility_setting');
219
-    return $tc['geodir_location_switcher_menu_li_class_filter'];
218
+	$tc = get_option('theme_compatibility_setting');
219
+	return $tc['geodir_location_switcher_menu_li_class_filter'];
220 220
 }
221 221
 
222 222
 /**
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
  */
230 230
 function geodir_location_switcher_menu_a_class_dynamic()
231 231
 {
232
-    $tc = get_option('theme_compatibility_setting');
233
-    return $tc['geodir_location_switcher_menu_a_class_filter'];
232
+	$tc = get_option('theme_compatibility_setting');
233
+	return $tc['geodir_location_switcher_menu_a_class_filter'];
234 234
 }
235 235
 
236 236
 /**
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
  */
244 244
 function geodir_location_switcher_menu_sub_ul_class_dynamic()
245 245
 {
246
-    $tc = get_option('theme_compatibility_setting');
247
-    return $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
246
+	$tc = get_option('theme_compatibility_setting');
247
+	return $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
248 248
 }
249 249
 
250 250
 /**
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
  */
258 258
 function geodir_location_switcher_menu_sub_li_class_dynamic()
259 259
 {
260
-    $tc = get_option('theme_compatibility_setting');
261
-    return $tc['geodir_location_switcher_menu_sub_li_class_filter'];
260
+	$tc = get_option('theme_compatibility_setting');
261
+	return $tc['geodir_location_switcher_menu_sub_li_class_filter'];
262 262
 }
263 263
 
264 264
 
@@ -275,107 +275,107 @@  discard block
 block discarded – undo
275 275
 function geodir_content_actions_dynamic()
276 276
 {
277 277
 
278
-    $tc = get_option('theme_compatibility_setting');
278
+	$tc = get_option('theme_compatibility_setting');
279 279
 //print_r($tc);
280
-    if (empty($tc)) {
281
-        return;
282
-    }
283
-
284
-    //php
285
-    if (!empty($tc['geodir_theme_compat_code'])) {
286
-        include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
287
-    }
288
-
289
-    //geodir_full_page_class
290
-    if (!empty($tc['geodir_full_page_class_filter'])) {
291
-        add_filter('geodir_full_page_class', 'geodir_full_page_class_dynamic', 10);
292
-    }
293
-
294
-    //widget before filter
295
-    if (!empty($tc['geodir_before_widget_filter'])) {
296
-        add_filter('geodir_before_widget', 'geodir_before_widget_dynamic', 10);
297
-    }
298
-
299
-    //widget after filter
300
-    if (!empty($tc['geodir_after_widget_filter'])) {
301
-        add_filter('geodir_after_widget', 'geodir_after_widget_dynamic', 10);
302
-    }
303
-
304
-    //widget before title filter
305
-    if (!empty($tc['geodir_before_title_filter'])) {
306
-        add_filter('geodir_before_title', 'geodir_before_title_dynamic', 10);
307
-    }
308
-
309
-    //widget before title filter
310
-    if (!empty($tc['geodir_after_title_filter'])) {
311
-        add_filter('geodir_after_title', 'geodir_after_title_dynamic', 10);
312
-    }
313
-
314
-    //menu li class
315
-    if (!empty($tc['geodir_menu_li_class_filter'])) {
316
-        add_filter('geodir_menu_li_class', 'geodir_menu_li_class_dynamic', 10);
317
-    }
318
-
319
-    //menu ul class
320
-    if (!empty($tc['geodir_sub_menu_ul_class_filter'])) {
321
-        add_filter('geodir_sub_menu_ul_class', 'geodir_sub_menu_ul_class_dynamic', 10);
322
-    }
323
-
324
-    //menu sub li class
325
-    if (!empty($tc['geodir_sub_menu_li_class_filter'])) {
326
-        add_filter('geodir_sub_menu_li_class', 'geodir_sub_menu_li_class_dynamic', 10);
327
-    }
328
-
329
-    //menu a class
330
-    if (!empty($tc['geodir_menu_a_class_filter'])) {
331
-        add_filter('geodir_menu_a_class', 'geodir_menu_a_class_dynamic', 10);
332
-    }
333
-
334
-    //menu sub a class
335
-    if (!empty($tc['geodir_sub_menu_a_class_filter'])) {
336
-        add_filter('geodir_sub_menu_a_class', 'geodir_sub_menu_a_class_dynamic', 10);
337
-    }
338
-
339
-    //location menu li class
340
-    if (!empty($tc['geodir_location_switcher_menu_li_class_filter'])) {
341
-        add_filter('geodir_location_switcher_menu_li_class', 'geodir_location_switcher_menu_li_class_dynamic', 10);
342
-    }
343
-
344
-    //location menu sub ul class
345
-    if (!empty($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
346
-        add_filter('geodir_location_switcher_menu_sub_ul_class', 'geodir_location_switcher_menu_sub_ul_class_dynamic', 10);
347
-    }
348
-
349
-    //location menu sub li class
350
-    if (!empty($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
351
-        add_filter('geodir_location_switcher_menu_sub_li_class', 'geodir_location_switcher_menu_sub_li_class_dynamic', 10);
352
-    }
353
-
354
-    //location menu a class
355
-    if (!empty($tc['geodir_location_switcher_menu_a_class_filter'])) {
356
-        add_filter('geodir_location_switcher_menu_a_class', 'geodir_location_switcher_menu_a_class_dynamic', 10);
357
-    }
358
-
359
-    // compat styles
360
-    if (!empty($tc['geodir_theme_compat_css'])) {
361
-        add_action('wp_head', 'gd_compat_styles');
362
-    }
363
-
364
-    // compat js
365
-    if (!empty($tc['geodir_theme_compat_js'])) {
366
-        add_action('wp_footer', 'gd_compat_script');
367
-    }
368
-
369
-
370
-    // geodir_top_content_add
371
-    if (!empty($tc['geodir_top_content_add'])) {
372
-        add_action('geodir_top_content', 'geodir_top_content_add_dynamic', 10, 1);
373
-    }
374
-
375
-    // geodir_before_main_content_add
376
-    if (!empty($tc['geodir_before_main_content_add'])) {
377
-        add_action('geodir_before_main_content', 'geodir_before_main_content_add_dynamic', 10, 1);
378
-    }
280
+	if (empty($tc)) {
281
+		return;
282
+	}
283
+
284
+	//php
285
+	if (!empty($tc['geodir_theme_compat_code'])) {
286
+		include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
287
+	}
288
+
289
+	//geodir_full_page_class
290
+	if (!empty($tc['geodir_full_page_class_filter'])) {
291
+		add_filter('geodir_full_page_class', 'geodir_full_page_class_dynamic', 10);
292
+	}
293
+
294
+	//widget before filter
295
+	if (!empty($tc['geodir_before_widget_filter'])) {
296
+		add_filter('geodir_before_widget', 'geodir_before_widget_dynamic', 10);
297
+	}
298
+
299
+	//widget after filter
300
+	if (!empty($tc['geodir_after_widget_filter'])) {
301
+		add_filter('geodir_after_widget', 'geodir_after_widget_dynamic', 10);
302
+	}
303
+
304
+	//widget before title filter
305
+	if (!empty($tc['geodir_before_title_filter'])) {
306
+		add_filter('geodir_before_title', 'geodir_before_title_dynamic', 10);
307
+	}
308
+
309
+	//widget before title filter
310
+	if (!empty($tc['geodir_after_title_filter'])) {
311
+		add_filter('geodir_after_title', 'geodir_after_title_dynamic', 10);
312
+	}
313
+
314
+	//menu li class
315
+	if (!empty($tc['geodir_menu_li_class_filter'])) {
316
+		add_filter('geodir_menu_li_class', 'geodir_menu_li_class_dynamic', 10);
317
+	}
318
+
319
+	//menu ul class
320
+	if (!empty($tc['geodir_sub_menu_ul_class_filter'])) {
321
+		add_filter('geodir_sub_menu_ul_class', 'geodir_sub_menu_ul_class_dynamic', 10);
322
+	}
323
+
324
+	//menu sub li class
325
+	if (!empty($tc['geodir_sub_menu_li_class_filter'])) {
326
+		add_filter('geodir_sub_menu_li_class', 'geodir_sub_menu_li_class_dynamic', 10);
327
+	}
328
+
329
+	//menu a class
330
+	if (!empty($tc['geodir_menu_a_class_filter'])) {
331
+		add_filter('geodir_menu_a_class', 'geodir_menu_a_class_dynamic', 10);
332
+	}
333
+
334
+	//menu sub a class
335
+	if (!empty($tc['geodir_sub_menu_a_class_filter'])) {
336
+		add_filter('geodir_sub_menu_a_class', 'geodir_sub_menu_a_class_dynamic', 10);
337
+	}
338
+
339
+	//location menu li class
340
+	if (!empty($tc['geodir_location_switcher_menu_li_class_filter'])) {
341
+		add_filter('geodir_location_switcher_menu_li_class', 'geodir_location_switcher_menu_li_class_dynamic', 10);
342
+	}
343
+
344
+	//location menu sub ul class
345
+	if (!empty($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
346
+		add_filter('geodir_location_switcher_menu_sub_ul_class', 'geodir_location_switcher_menu_sub_ul_class_dynamic', 10);
347
+	}
348
+
349
+	//location menu sub li class
350
+	if (!empty($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
351
+		add_filter('geodir_location_switcher_menu_sub_li_class', 'geodir_location_switcher_menu_sub_li_class_dynamic', 10);
352
+	}
353
+
354
+	//location menu a class
355
+	if (!empty($tc['geodir_location_switcher_menu_a_class_filter'])) {
356
+		add_filter('geodir_location_switcher_menu_a_class', 'geodir_location_switcher_menu_a_class_dynamic', 10);
357
+	}
358
+
359
+	// compat styles
360
+	if (!empty($tc['geodir_theme_compat_css'])) {
361
+		add_action('wp_head', 'gd_compat_styles');
362
+	}
363
+
364
+	// compat js
365
+	if (!empty($tc['geodir_theme_compat_js'])) {
366
+		add_action('wp_footer', 'gd_compat_script');
367
+	}
368
+
369
+
370
+	// geodir_top_content_add
371
+	if (!empty($tc['geodir_top_content_add'])) {
372
+		add_action('geodir_top_content', 'geodir_top_content_add_dynamic', 10, 1);
373
+	}
374
+
375
+	// geodir_before_main_content_add
376
+	if (!empty($tc['geodir_before_main_content_add'])) {
377
+		add_action('geodir_before_main_content', 'geodir_before_main_content_add_dynamic', 10, 1);
378
+	}
379 379
 
380 380
 
381 381
 }
@@ -398,23 +398,23 @@  discard block
 block discarded – undo
398 398
  */
399 399
 function geodir_action_wrapper_open($type = '', $id = '', $class = '')
400 400
 {
401
-    $tc = get_option('theme_compatibility_setting');
402
-    if (!empty($tc['geodir_wrapper_open_replace'])) {
403
-        $text = $tc['geodir_wrapper_open_replace'];
404
-    } else {
405
-        $text = '<div id="[id]" class="[class]">';
406
-    }
401
+	$tc = get_option('theme_compatibility_setting');
402
+	if (!empty($tc['geodir_wrapper_open_replace'])) {
403
+		$text = $tc['geodir_wrapper_open_replace'];
404
+	} else {
405
+		$text = '<div id="[id]" class="[class]">';
406
+	}
407 407
 
408
-    if (!empty($tc['geodir_wrapper_open_id'])) {
409
-        $id = $tc['geodir_wrapper_open_id'];
410
-    }
411
-    if (!empty($tc['geodir_wrapper_open_class'])) {
412
-        $class = $tc['geodir_wrapper_open_class'];
413
-    }
408
+	if (!empty($tc['geodir_wrapper_open_id'])) {
409
+		$id = $tc['geodir_wrapper_open_id'];
410
+	}
411
+	if (!empty($tc['geodir_wrapper_open_class'])) {
412
+		$class = $tc['geodir_wrapper_open_class'];
413
+	}
414 414
 
415
-    $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
415
+	$text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
416 416
 
417
-    echo $text;
417
+	echo $text;
418 418
 }
419 419
 
420 420
 // action for adding the wrapperdiv closing tag
@@ -429,14 +429,14 @@  discard block
 block discarded – undo
429 429
  */
430 430
 function geodir_action_wrapper_close($type = '')
431 431
 {
432
-    $tc = get_option('theme_compatibility_setting');
433
-    if (!empty($tc['geodir_wrapper_close_replace'])) {
434
-        $text = $tc['geodir_wrapper_close_replace'];
435
-    } else {
436
-        $text = '</div><!-- wrapper ends here-->';
437
-    }
432
+	$tc = get_option('theme_compatibility_setting');
433
+	if (!empty($tc['geodir_wrapper_close_replace'])) {
434
+		$text = $tc['geodir_wrapper_close_replace'];
435
+	} else {
436
+		$text = '</div><!-- wrapper ends here-->';
437
+	}
438 438
 
439
-    echo $text;
439
+	echo $text;
440 440
 }
441 441
 
442 442
 // action for adding the content div opening tag
@@ -452,35 +452,35 @@  discard block
 block discarded – undo
452 452
  */
453 453
 function geodir_action_wrapper_content_open($type = '', $id = '', $class = '')
454 454
 {
455
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
456
-        $width_css = 'style="width:' . $width . '%;"';
457
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
458
-        $width_css = 'style="width:' . $width . '%;"';
459
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
460
-        $width_css = 'style="width:' . $width . '%;"';
461
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
462
-        $width_css = 'style="width:' . $width . '%;"';
463
-    } else {
464
-        $width_css = '';
465
-    }
466
-
467
-    $tc = get_option('theme_compatibility_setting');
468
-    if (!empty($tc['geodir_wrapper_content_open_replace'])) {
469
-        $text = $tc['geodir_wrapper_content_open_replace'];
470
-    } else {
471
-        $text = '<div id="[id]" class="[class]" role="main" [width_css]>';
472
-    }
473
-
474
-    if (!empty($tc['geodir_wrapper_content_open_id'])) {
475
-        $id = $tc['geodir_wrapper_content_open_id'];
476
-    }
477
-    if (!empty($tc['geodir_wrapper_content_open_class'])) {
478
-        $class = $tc['geodir_wrapper_content_open_class'];
479
-    }
480
-
481
-    $text = str_replace(array("[id]", "[class]", "[width_css]"), array($id, $class, $width_css), $text);
482
-
483
-    echo $text;
455
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
456
+		$width_css = 'style="width:' . $width . '%;"';
457
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
458
+		$width_css = 'style="width:' . $width . '%;"';
459
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
460
+		$width_css = 'style="width:' . $width . '%;"';
461
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
462
+		$width_css = 'style="width:' . $width . '%;"';
463
+	} else {
464
+		$width_css = '';
465
+	}
466
+
467
+	$tc = get_option('theme_compatibility_setting');
468
+	if (!empty($tc['geodir_wrapper_content_open_replace'])) {
469
+		$text = $tc['geodir_wrapper_content_open_replace'];
470
+	} else {
471
+		$text = '<div id="[id]" class="[class]" role="main" [width_css]>';
472
+	}
473
+
474
+	if (!empty($tc['geodir_wrapper_content_open_id'])) {
475
+		$id = $tc['geodir_wrapper_content_open_id'];
476
+	}
477
+	if (!empty($tc['geodir_wrapper_content_open_class'])) {
478
+		$class = $tc['geodir_wrapper_content_open_class'];
479
+	}
480
+
481
+	$text = str_replace(array("[id]", "[class]", "[width_css]"), array($id, $class, $width_css), $text);
482
+
483
+	echo $text;
484 484
 }
485 485
 
486 486
 // action for adding the primary div closing tag
@@ -494,13 +494,13 @@  discard block
 block discarded – undo
494 494
  */
495 495
 function geodir_action_wrapper_content_close($type = '')
496 496
 {
497
-    $tc = get_option('theme_compatibility_setting');
498
-    if (!empty($tc['geodir_wrapper_content_close_replace'])) {
499
-        $text = $tc['geodir_wrapper_content_close_replace'];
500
-    } else {
501
-        $text = '</div><!-- content ends here-->';
502
-    }
503
-    echo $text;
497
+	$tc = get_option('theme_compatibility_setting');
498
+	if (!empty($tc['geodir_wrapper_content_close_replace'])) {
499
+		$text = $tc['geodir_wrapper_content_close_replace'];
500
+	} else {
501
+		$text = '</div><!-- content ends here-->';
502
+	}
503
+	echo $text;
504 504
 }
505 505
 
506 506
 // action for adding the <article> opening tag
@@ -518,24 +518,24 @@  discard block
 block discarded – undo
518 518
  */
519 519
 function geodir_action_article_open($type = '', $id = '', $class = '', $itemtype = '')
520 520
 {
521
-    $class = implode(" ", $class);
522
-    $tc = get_option('theme_compatibility_setting');
523
-    if (!empty($tc['geodir_article_open_replace'])) {
524
-        $text = $tc['geodir_article_open_replace'];
525
-    } else {
526
-        $text = '<article  id="[id]" class="[class]" >';
527
-    }
521
+	$class = implode(" ", $class);
522
+	$tc = get_option('theme_compatibility_setting');
523
+	if (!empty($tc['geodir_article_open_replace'])) {
524
+		$text = $tc['geodir_article_open_replace'];
525
+	} else {
526
+		$text = '<article  id="[id]" class="[class]" >';
527
+	}
528 528
 
529
-    if (!empty($tc['geodir_article_open_id'])) {
530
-        $id = $tc['geodir_article_open_id'];
531
-    }
532
-    if (!empty($tc['geodir_article_open_class'])) {
533
-        $class = $tc['geodir_article_open_class'];
534
-    }
529
+	if (!empty($tc['geodir_article_open_id'])) {
530
+		$id = $tc['geodir_article_open_id'];
531
+	}
532
+	if (!empty($tc['geodir_article_open_class'])) {
533
+		$class = $tc['geodir_article_open_class'];
534
+	}
535 535
 
536
-    $text = str_replace(array("[id]", "[class]", "[itemtype]"), array($id, $class, $itemtype), $text);
536
+	$text = str_replace(array("[id]", "[class]", "[itemtype]"), array($id, $class, $itemtype), $text);
537 537
 
538
-    echo $text;
538
+	echo $text;
539 539
 }
540 540
 
541 541
 // action for adding the primary div closing tag
@@ -549,13 +549,13 @@  discard block
 block discarded – undo
549 549
  */
550 550
 function geodir_action_article_close($type = '')
551 551
 {
552
-    $tc = get_option('theme_compatibility_setting');
553
-    if (!empty($tc['geodir_article_close_replace'])) {
554
-        $text = $tc['geodir_article_close_replace'];
555
-    } else {
556
-        $text = '</article><!-- article ends here-->';
557
-    }
558
-    echo $text;
552
+	$tc = get_option('theme_compatibility_setting');
553
+	if (!empty($tc['geodir_article_close_replace'])) {
554
+		$text = $tc['geodir_article_close_replace'];
555
+	} else {
556
+		$text = '</article><!-- article ends here-->';
557
+	}
558
+	echo $text;
559 559
 }
560 560
 
561 561
 // action for adding the sidebar opening tag
@@ -572,35 +572,35 @@  discard block
 block discarded – undo
572 572
  */
573 573
 function geodir_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')
574 574
 {
575
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
576
-        $width_css = 'style="width:' . $width . '%;"';
577
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
578
-        $width_css = 'style="width:' . $width . '%;"';
579
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
580
-        $width_css = 'style="width:' . $width . '%;"';
581
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
582
-        $width_css = 'style="width:' . $width . '%;"';
583
-    } else {
584
-        $width_css = '';
585
-    }
586
-
587
-    $tc = get_option('theme_compatibility_setting');
588
-    if (!empty($tc['geodir_sidebar_right_open_replace'])) {
589
-        $text = $tc['geodir_sidebar_right_open_replace'];
590
-    } else {
591
-        $text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
592
-    }
593
-
594
-    if (!empty($tc['geodir_sidebar_right_open_id'])) {
595
-        $id = $tc['geodir_sidebar_right_open_id'];
596
-    }
597
-    if (!empty($tc['geodir_sidebar_right_open_class'])) {
598
-        $class = $tc['geodir_sidebar_right_open_class'];
599
-    }
600
-
601
-    $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
602
-
603
-    echo $text;
575
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
576
+		$width_css = 'style="width:' . $width . '%;"';
577
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
578
+		$width_css = 'style="width:' . $width . '%;"';
579
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
580
+		$width_css = 'style="width:' . $width . '%;"';
581
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
582
+		$width_css = 'style="width:' . $width . '%;"';
583
+	} else {
584
+		$width_css = '';
585
+	}
586
+
587
+	$tc = get_option('theme_compatibility_setting');
588
+	if (!empty($tc['geodir_sidebar_right_open_replace'])) {
589
+		$text = $tc['geodir_sidebar_right_open_replace'];
590
+	} else {
591
+		$text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
592
+	}
593
+
594
+	if (!empty($tc['geodir_sidebar_right_open_id'])) {
595
+		$id = $tc['geodir_sidebar_right_open_id'];
596
+	}
597
+	if (!empty($tc['geodir_sidebar_right_open_class'])) {
598
+		$class = $tc['geodir_sidebar_right_open_class'];
599
+	}
600
+
601
+	$text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
602
+
603
+	echo $text;
604 604
 }
605 605
 
606 606
 // action for adding the primary div closing tag
@@ -614,13 +614,13 @@  discard block
 block discarded – undo
614 614
  */
615 615
 function geodir_action_sidebar_right_close($type = '')
616 616
 {
617
-    $tc = get_option('theme_compatibility_setting');
618
-    if (!empty($tc['geodir_sidebar_right_close_replace'])) {
619
-        $text = $tc['geodir_sidebar_right_close_replace'];
620
-    } else {
621
-        $text = '</aside><!-- sidebar ends here-->';
622
-    }
623
-    echo $text;
617
+	$tc = get_option('theme_compatibility_setting');
618
+	if (!empty($tc['geodir_sidebar_right_close_replace'])) {
619
+		$text = $tc['geodir_sidebar_right_close_replace'];
620
+	} else {
621
+		$text = '</aside><!-- sidebar ends here-->';
622
+	}
623
+	echo $text;
624 624
 }
625 625
 
626 626
 
@@ -641,121 +641,121 @@  discard block
 block discarded – undo
641 641
  */
642 642
 function geodir_action_geodir_set_preview_post()
643 643
 {
644
-    global $post, $preview, $gd_session;
645
-    $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
646
-    if (!$preview || $is_backend_preview) {
647
-        return;
648
-    }// bail if not previewing
649
-
650
-    $listing_type = isset($_REQUEST['listing_type']) ? sanitize_text_field($_REQUEST['listing_type']) : '';
651
-
652
-    $fields_info = geodir_get_custom_fields_type($listing_type);
653
-
654
-    foreach ($_REQUEST as $pkey => $pval) {
655
-        if ($pkey == 'geodir_video') {
656
-            $tags = '<iframe>';
657
-        } else if ($pkey == 'post_desc') {
658
-            $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
659
-        } else if (is_array($fields_info) && isset($fields_info[$pkey]) && ($fields_info[$pkey] == 'textarea' || $fields_info[$pkey] == 'html')) {
660
-            $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
661
-        } else if (is_array($_REQUEST[$pkey])) {
662
-            $tags = 'skip_field';
663
-        } else {
664
-            $tags = '';
665
-        }
666
-        /**
667
-         * Allows the filtering of the allowed HTML tags per field when submitting from frontend add listing page.
668
-         *
669
-         * @since 1.0.0
670
-         * @param string $tags The allowed HTML tags for the field. Can be many things, for example the description allows these tags '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'.
671
-         * @param string|array $pkey The field id/name. If array then value is set as "skip_field".
672
-         */
673
-        $tags = apply_filters('geodir_save_post_key', $tags, $pkey);
674
-
675
-        if ($tags != 'skip_field') {
676
-            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
677
-        }
678
-    }
679
-
680
-    $post = (object)$_REQUEST;
681
-
682
-
683
-    if (isset($post->video)) {
684
-        $post->video = stripslashes($post->video);
685
-    }
686
-
687
-    if (isset($post->Video2)) {
688
-        $post->Video2 = stripslashes($post->Video2);
689
-    }
690
-
691
-    $post_type = $post->listing_type;
692
-    $post_type_info = get_post_type_object($post_type);
693
-
694
-    $listing_label = $post_type_info->labels->singular_name;
695
-
696
-    $term_icon = '';
697
-
698
-    if (!empty($post->post_category)) {
699
-        foreach ($post->post_category as $post_taxonomy => $post_term) {
700
-
701
-            if ($post_term != '' && !is_array($post_term)) {
702
-                $post_term = explode(',', trim($post_term, ','));
703
-            }
644
+	global $post, $preview, $gd_session;
645
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
646
+	if (!$preview || $is_backend_preview) {
647
+		return;
648
+	}// bail if not previewing
649
+
650
+	$listing_type = isset($_REQUEST['listing_type']) ? sanitize_text_field($_REQUEST['listing_type']) : '';
651
+
652
+	$fields_info = geodir_get_custom_fields_type($listing_type);
653
+
654
+	foreach ($_REQUEST as $pkey => $pval) {
655
+		if ($pkey == 'geodir_video') {
656
+			$tags = '<iframe>';
657
+		} else if ($pkey == 'post_desc') {
658
+			$tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
659
+		} else if (is_array($fields_info) && isset($fields_info[$pkey]) && ($fields_info[$pkey] == 'textarea' || $fields_info[$pkey] == 'html')) {
660
+			$tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
661
+		} else if (is_array($_REQUEST[$pkey])) {
662
+			$tags = 'skip_field';
663
+		} else {
664
+			$tags = '';
665
+		}
666
+		/**
667
+		 * Allows the filtering of the allowed HTML tags per field when submitting from frontend add listing page.
668
+		 *
669
+		 * @since 1.0.0
670
+		 * @param string $tags The allowed HTML tags for the field. Can be many things, for example the description allows these tags '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'.
671
+		 * @param string|array $pkey The field id/name. If array then value is set as "skip_field".
672
+		 */
673
+		$tags = apply_filters('geodir_save_post_key', $tags, $pkey);
674
+
675
+		if ($tags != 'skip_field') {
676
+			$_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
677
+		}
678
+	}
679
+
680
+	$post = (object)$_REQUEST;
681
+
682
+
683
+	if (isset($post->video)) {
684
+		$post->video = stripslashes($post->video);
685
+	}
686
+
687
+	if (isset($post->Video2)) {
688
+		$post->Video2 = stripslashes($post->Video2);
689
+	}
690
+
691
+	$post_type = $post->listing_type;
692
+	$post_type_info = get_post_type_object($post_type);
693
+
694
+	$listing_label = $post_type_info->labels->singular_name;
695
+
696
+	$term_icon = '';
697
+
698
+	if (!empty($post->post_category)) {
699
+		foreach ($post->post_category as $post_taxonomy => $post_term) {
700
+
701
+			if ($post_term != '' && !is_array($post_term)) {
702
+				$post_term = explode(',', trim($post_term, ','));
703
+			}
704 704
 
705
-            if (is_array($post_term)) {
706
-                $post_term = array_unique($post_term);
707
-            }
705
+			if (is_array($post_term)) {
706
+				$post_term = array_unique($post_term);
707
+			}
708 708
 
709
-            if (!empty($post_term)) {
710
-                foreach ($post_term as $cat_id) {
711
-                    $cat_id = trim($cat_id);
712
-
713
-                    if ($cat_id != '') {
714
-                        $term_icon = get_option('geodir_default_marker_icon');
715
-
716
-                        if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
717
-                            if ($term_icon_url = geodir_get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
718
-                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
719
-                                    $term_icon = $term_icon_url['src'];
720
-                                break;
721
-                            }
722
-                        }
723
-                    }
724
-                }
725
-            }
726
-        }
727
-    }
709
+			if (!empty($post_term)) {
710
+				foreach ($post_term as $cat_id) {
711
+					$cat_id = trim($cat_id);
712
+
713
+					if ($cat_id != '') {
714
+						$term_icon = get_option('geodir_default_marker_icon');
715
+
716
+						if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
717
+							if ($term_icon_url = geodir_get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
718
+								if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
719
+									$term_icon = $term_icon_url['src'];
720
+								break;
721
+							}
722
+						}
723
+					}
724
+				}
725
+			}
726
+		}
727
+	}
728 728
 
729
-    $post_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
730
-    $post_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
729
+	$post_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
730
+	$post_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
731 731
 
732
-    $srcharr = array("'", "/", "-", '"', '\\');
733
-    $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
732
+	$srcharr = array("'", "/", "-", '"', '\\');
733
+	$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
734 734
 
735
-    $json_title = str_replace($srcharr, $replarr, $post->post_title);
735
+	$json_title = str_replace($srcharr, $replarr, $post->post_title);
736 736
 
737
-    $json = '{';
738
-    $json .= '"post_preview": "1",';
739
-    $json .= '"t": "' . $json_title . '",';
740
-    $json .= '"lt": "' . $post_latitude . '",';
741
-    $json .= '"ln": "' . $post_longitude . '",';
742
-    $json .= '"i":"' . $term_icon . '"';
743
-    $json .= '}';
737
+	$json = '{';
738
+	$json .= '"post_preview": "1",';
739
+	$json .= '"t": "' . $json_title . '",';
740
+	$json .= '"lt": "' . $post_latitude . '",';
741
+	$json .= '"ln": "' . $post_longitude . '",';
742
+	$json .= '"i":"' . $term_icon . '"';
743
+	$json .= '}';
744 744
 
745
-    $post->marker_json = $json;
745
+	$post->marker_json = $json;
746 746
 
747
-    $gd_session->set('listing', $_REQUEST);
747
+	$gd_session->set('listing', $_REQUEST);
748 748
 
749
-    // we need to define a few things to trick the setup_postdata
750
-    if (!isset($post->ID)) {
751
-        $post->ID = '';
752
-        $post->post_author = '';
753
-        $post->post_date = '';
754
-        $post->post_content = '';
755
-        $post->default_category = '';
756
-        $post->post_type = '';
757
-    }
758
-    setup_postdata($post);
749
+	// we need to define a few things to trick the setup_postdata
750
+	if (!isset($post->ID)) {
751
+		$post->ID = '';
752
+		$post->post_author = '';
753
+		$post->post_date = '';
754
+		$post->post_content = '';
755
+		$post->default_category = '';
756
+		$post->post_type = '';
757
+	}
758
+	setup_postdata($post);
759 759
 }
760 760
 
761 761
 /**
@@ -767,15 +767,15 @@  discard block
 block discarded – undo
767 767
  */
768 768
 function geodir_action_geodir_preview_code()
769 769
 {
770
-    global $preview;
770
+	global $preview;
771 771
 
772
-    $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
772
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
773 773
 
774
-    if (!$preview || $is_backend_preview) {
775
-        return;
776
-    }// bail if not previewing
774
+	if (!$preview || $is_backend_preview) {
775
+		return;
776
+	}// bail if not previewing
777 777
 
778
-    geodir_get_template_part('preview', 'buttons');
778
+	geodir_get_template_part('preview', 'buttons');
779 779
 }
780 780
 
781 781
 // action for adding the details page top widget area
@@ -791,20 +791,20 @@  discard block
 block discarded – undo
791 791
  */
792 792
 function geodir_action_geodir_sidebar_detail_top($class = '')
793 793
 {
794
-    if (get_option('geodir_show_detail_top_section')) { ?>
794
+	if (get_option('geodir_show_detail_top_section')) { ?>
795 795
         <div
796 796
             class="<?php
797
-            /**
798
-             * Filter the div class for the wrapper of the full width widget areas.
799
-             *
800
-             * Allows you to filter the class of the div for the HTML Container wrapper for the full width widget areas referred to as "Top Section" or "Bottom Section" in the widget areas.
801
-             *
802
-             * @since 1.0.0
803
-             * @param string $class The class of the div.
804
-             * @param string $type The page type the widget area is being used on. Values can be 'geodir_detail_top', 'geodir_detail_bottom', 'geodir_listing_top', 'geodir_listing_bottom', 'Reg/Login Top Section',
805
-             *               'geodir_author_top','geodir_author_bottom', 'geodir_search_top', 'geodir_search_bottom', 'geodir_home_top' or 'geodir_home_bottom'.
806
-             */
807
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_top'); ?> <?php echo $class; ?>">
797
+			/**
798
+			 * Filter the div class for the wrapper of the full width widget areas.
799
+			 *
800
+			 * Allows you to filter the class of the div for the HTML Container wrapper for the full width widget areas referred to as "Top Section" or "Bottom Section" in the widget areas.
801
+			 *
802
+			 * @since 1.0.0
803
+			 * @param string $class The class of the div.
804
+			 * @param string $type The page type the widget area is being used on. Values can be 'geodir_detail_top', 'geodir_detail_bottom', 'geodir_listing_top', 'geodir_listing_bottom', 'Reg/Login Top Section',
805
+			 *               'geodir_author_top','geodir_author_bottom', 'geodir_search_top', 'geodir_search_bottom', 'geodir_home_top' or 'geodir_home_bottom'.
806
+			 */
807
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_top'); ?> <?php echo $class; ?>">
808 808
             <?php dynamic_sidebar('geodir_detail_top'); ?>
809 809
         </div>
810 810
     <?php }
@@ -828,11 +828,11 @@  discard block
 block discarded – undo
828 828
  */
829 829
 function geodir_action_geodir_sidebar_detail_bottom_section($class = '')
830 830
 {
831
-    if (get_option('geodir_show_detail_bottom_section')) { ?>
831
+	if (get_option('geodir_show_detail_bottom_section')) { ?>
832 832
         <div
833 833
             class="<?php
834
-            /** This action is documented in geodirectory_template_actions.php */
835
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_bottom'); ?> <?php echo $class; ?>">
834
+			/** This action is documented in geodirectory_template_actions.php */
835
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_bottom'); ?> <?php echo $class; ?>">
836 836
             <?php dynamic_sidebar('geodir_detail_bottom'); ?>
837 837
         </div><!-- clearfix ends here-->
838 838
     <?php }
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
  */
847 847
 function geodir_details_sidebar_widget_area()
848 848
 {
849
-    dynamic_sidebar('geodir_detail_sidebar');
849
+	dynamic_sidebar('geodir_detail_sidebar');
850 850
 }
851 851
 
852 852
 /**
@@ -857,12 +857,12 @@  discard block
 block discarded – undo
857 857
  */
858 858
 function geodir_details_sidebar_place_details()
859 859
 {
860
-    /**
861
-     * Used to add items to the details page sidebar.
862
-     *
863
-     * @since 1.0.0
864
-     */
865
-    do_action('geodir_detail_page_sidebar');
860
+	/**
861
+	 * Used to add items to the details page sidebar.
862
+	 *
863
+	 * @since 1.0.0
864
+	 */
865
+	do_action('geodir_detail_page_sidebar');
866 866
 }
867 867
 
868 868
 add_action('geodir_detail_sidebar_inside', 'geodir_details_sidebar_place_details', 10);
@@ -877,68 +877,68 @@  discard block
 block discarded – undo
877 877
  */
878 878
 function geodir_action_details_sidebar()
879 879
 {
880
-    // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
881
-    if (get_option('geodir_detail_sidebar_left_section')) {
882
-        /**
883
-         * Called before the details page left sidebar is opened.
884
-         *
885
-         * This is used to add opening wrapper HTML to the details page left sidebar.
886
-         *
887
-         * @since 1.0.0
888
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
889
-         * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-left'.
890
-         * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-left geodir-details-sidebar-left'.
891
-         * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
892
-         */
893
-        do_action('geodir_sidebar_left_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-left geodir-details-sidebar-left', 'https://schema.org/WPSideBar');
894
-        ?>
880
+	// this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
881
+	if (get_option('geodir_detail_sidebar_left_section')) {
882
+		/**
883
+		 * Called before the details page left sidebar is opened.
884
+		 *
885
+		 * This is used to add opening wrapper HTML to the details page left sidebar.
886
+		 *
887
+		 * @since 1.0.0
888
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
889
+		 * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-left'.
890
+		 * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-left geodir-details-sidebar-left'.
891
+		 * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
892
+		 */
893
+		do_action('geodir_sidebar_left_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-left geodir-details-sidebar-left', 'https://schema.org/WPSideBar');
894
+		?>
895 895
         <div class="geodir-content-left geodir-sidebar-wrap"><?php
896
-        /**
897
-         * Called inside the HTML wrapper of the details sidebar for either the left and right sidebar.
898
-         *
899
-         * This is used to add all info to the details page sidebars.
900
-         *
901
-         * @since 1.0.0
902
-         */
903
-        do_action('geodir_detail_sidebar_inside');
904
-        ?></div><!-- end geodir-content-left --><?php
905
-        /**
906
-         * Called after the details page left sidebar.
907
-         *
908
-         * This is used to add closing wrapper HTML to the details page left sidebar.
909
-         *
910
-         * @since 1.0.0
911
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
912
-         */
913
-        do_action('geodir_sidebar_left_close', 'details-page');
914
-    } else {
915
-        /**
916
-         * Called before the details page right sidebar is opened.
917
-         *
918
-         * This is used to add opening wrapper HTML to the details page right sidebar.
919
-         *
920
-         * @since 1.0.0
921
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'add-listing-page', 'author-page', 'search-page' or 'home-page'.
922
-         * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-right'.
923
-         * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-right geodir-details-sidebar-right'.
924
-         * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
925
-         */
926
-        do_action('geodir_sidebar_right_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-right geodir-details-sidebar-right', 'http://schema.org/WPSideBar');
927
-        ?>
896
+		/**
897
+		 * Called inside the HTML wrapper of the details sidebar for either the left and right sidebar.
898
+		 *
899
+		 * This is used to add all info to the details page sidebars.
900
+		 *
901
+		 * @since 1.0.0
902
+		 */
903
+		do_action('geodir_detail_sidebar_inside');
904
+		?></div><!-- end geodir-content-left --><?php
905
+		/**
906
+		 * Called after the details page left sidebar.
907
+		 *
908
+		 * This is used to add closing wrapper HTML to the details page left sidebar.
909
+		 *
910
+		 * @since 1.0.0
911
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
912
+		 */
913
+		do_action('geodir_sidebar_left_close', 'details-page');
914
+	} else {
915
+		/**
916
+		 * Called before the details page right sidebar is opened.
917
+		 *
918
+		 * This is used to add opening wrapper HTML to the details page right sidebar.
919
+		 *
920
+		 * @since 1.0.0
921
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'add-listing-page', 'author-page', 'search-page' or 'home-page'.
922
+		 * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-right'.
923
+		 * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-right geodir-details-sidebar-right'.
924
+		 * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
925
+		 */
926
+		do_action('geodir_sidebar_right_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-right geodir-details-sidebar-right', 'http://schema.org/WPSideBar');
927
+		?>
928 928
         <div class="geodir-content-right geodir-sidebar-wrap"><?php
929
-        /** This action is documented in geodirectory_template_actions.php */
930
-        do_action('geodir_detail_sidebar_inside');
931
-        ?></div><!-- end geodir-content-right --><?php
932
-        /**
933
-         * Called after the details page right sidebar.
934
-         *
935
-         * This is used to add closing wrapper HTML to the details page right sidebar.
936
-         *
937
-         * @since 1.0.0
938
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
939
-         */
940
-        do_action('geodir_sidebar_right_close', 'details-page');
941
-    }
929
+		/** This action is documented in geodirectory_template_actions.php */
930
+		do_action('geodir_detail_sidebar_inside');
931
+		?></div><!-- end geodir-content-right --><?php
932
+		/**
933
+		 * Called after the details page right sidebar.
934
+		 *
935
+		 * This is used to add closing wrapper HTML to the details page right sidebar.
936
+		 *
937
+		 * @since 1.0.0
938
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
939
+		 */
940
+		do_action('geodir_sidebar_right_close', 'details-page');
941
+	}
942 942
 }
943 943
 
944 944
 add_action('geodir_page_title', 'geodir_action_page_title', 10);
@@ -952,21 +952,21 @@  discard block
 block discarded – undo
952 952
  */
953 953
 function geodir_action_page_title()
954 954
 {
955
-    /**
956
-     * Filter the page title HTML h1 class.
957
-     *
958
-     * @since 1.0.0
959
-     * @param string $class The class to use. Default is 'entry-title fn'.
960
-     */
961
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
962
-    /**
963
-     * Filter the page title HTML header wrapper class.
964
-     *
965
-     * @since 1.0.0
966
-     * @param string $class The class to use. Default is 'entry-header'.
967
-     */
968
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
969
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
955
+	/**
956
+	 * Filter the page title HTML h1 class.
957
+	 *
958
+	 * @since 1.0.0
959
+	 * @param string $class The class to use. Default is 'entry-title fn'.
960
+	 */
961
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
962
+	/**
963
+	 * Filter the page title HTML header wrapper class.
964
+	 *
965
+	 * @since 1.0.0
966
+	 * @param string $class The class to use. Default is 'entry-header'.
967
+	 */
968
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
969
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
970 970
 }
971 971
 
972 972
 
@@ -983,94 +983,94 @@  discard block
 block discarded – undo
983 983
  */
984 984
 function geodir_action_details_slider()
985 985
 {
986
-    global $preview, $post;
986
+	global $preview, $post;
987 987
 
988
-    $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // preview from backend
988
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // preview from backend
989 989
 
990
-    if ($is_backend_preview && !empty($post) && !empty($post->ID) && !isset($post->post_images)) {
991
-        $preview_get_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
990
+	if ($is_backend_preview && !empty($post) && !empty($post->ID) && !isset($post->post_images)) {
991
+		$preview_get_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
992 992
 
993
-        $preview_post_images = array();
994
-        if ($preview_get_images) {
995
-            foreach ($preview_get_images as $row) {
996
-                $preview_post_images[] = $row->src;
997
-            }
998
-        }
999
-        if (!empty($preview_post_images)) {
1000
-            $post->post_images = implode(',', $preview_post_images);
1001
-        }
1002
-    }
1003
-
1004
-    if ($preview) {
1005
-        $post_images = array();
1006
-        if (isset($post->post_images) && !empty($post->post_images)) {
1007
-            $post->post_images = trim($post->post_images, ",");
1008
-            $post_images = explode(",", $post->post_images);
1009
-        }
1010
-
1011
-        $main_slides = '';
1012
-        $nav_slides = '';
1013
-        $slides = 0;
1014
-
1015
-        if (!empty($post_images)) {
1016
-            foreach ($post_images as $image) {
1017
-                if (!empty($image)) {
1018
-                    $sizes = getimagesize(trim($image));
1019
-                    $width = !empty($sizes) && isset($sizes[0]) ? $sizes[0] : 0;
1020
-                    $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1021
-
1022
-                    if ($image && $width && $height) {
1023
-                        $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1024
-                    }
1025
-
1026
-                    if (isset($image->src)) {
1027
-                        if ($image->height >= 400) {
1028
-                            $spacer_height = 0;
1029
-                        } else {
1030
-                            $spacer_height = ((400 - $image->height) / 2);
1031
-                        }
1032
-
1033
-                        $image_title = isset($image->title) ? $image->title : '';
1034
-
1035
-                        $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1036
-                        $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1037
-                        $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1038
-                        $slides++;
1039
-                    }
1040
-                }
1041
-            }// endfore
1042
-        } //end if
1043
-    } else {
1044
-        $main_slides = '';
1045
-        $nav_slides = '';
1046
-        /**
1047
-         * Filter if default images should show on the details page.
1048
-         *
1049
-         * @param bool $use_default_image Default false.
1050
-         * @since 1.6.16
1051
-         */
1052
-        $use_default_image = apply_filters('geodir_details_default_image_show', false);
1053
-        $post_images = geodir_get_images($post->ID, 'thumbnail', $use_default_image); // Hide default image on listing preview/detail page.
1054
-        $slides = 0;
1055
-
1056
-        if (!empty($post_images)) {
1057
-            foreach ($post_images as $image) {
1058
-                if ($image->height >= 400) {
1059
-                    $spacer_height = 0;
1060
-                } else {
1061
-                    $spacer_height = ((400 - $image->height) / 2);
1062
-                }
1063
-                $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1064
-                $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1065
-                $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1066
-                $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1067
-                $slides++;
1068
-            }
1069
-        }// endfore
1070
-    }
993
+		$preview_post_images = array();
994
+		if ($preview_get_images) {
995
+			foreach ($preview_get_images as $row) {
996
+				$preview_post_images[] = $row->src;
997
+			}
998
+		}
999
+		if (!empty($preview_post_images)) {
1000
+			$post->post_images = implode(',', $preview_post_images);
1001
+		}
1002
+	}
1003
+
1004
+	if ($preview) {
1005
+		$post_images = array();
1006
+		if (isset($post->post_images) && !empty($post->post_images)) {
1007
+			$post->post_images = trim($post->post_images, ",");
1008
+			$post_images = explode(",", $post->post_images);
1009
+		}
1010
+
1011
+		$main_slides = '';
1012
+		$nav_slides = '';
1013
+		$slides = 0;
1014
+
1015
+		if (!empty($post_images)) {
1016
+			foreach ($post_images as $image) {
1017
+				if (!empty($image)) {
1018
+					$sizes = getimagesize(trim($image));
1019
+					$width = !empty($sizes) && isset($sizes[0]) ? $sizes[0] : 0;
1020
+					$height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1021
+
1022
+					if ($image && $width && $height) {
1023
+						$image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1024
+					}
1025
+
1026
+					if (isset($image->src)) {
1027
+						if ($image->height >= 400) {
1028
+							$spacer_height = 0;
1029
+						} else {
1030
+							$spacer_height = ((400 - $image->height) / 2);
1031
+						}
1032
+
1033
+						$image_title = isset($image->title) ? $image->title : '';
1034
+
1035
+						$main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1036
+						$main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1037
+						$nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1038
+						$slides++;
1039
+					}
1040
+				}
1041
+			}// endfore
1042
+		} //end if
1043
+	} else {
1044
+		$main_slides = '';
1045
+		$nav_slides = '';
1046
+		/**
1047
+		 * Filter if default images should show on the details page.
1048
+		 *
1049
+		 * @param bool $use_default_image Default false.
1050
+		 * @since 1.6.16
1051
+		 */
1052
+		$use_default_image = apply_filters('geodir_details_default_image_show', false);
1053
+		$post_images = geodir_get_images($post->ID, 'thumbnail', $use_default_image); // Hide default image on listing preview/detail page.
1054
+		$slides = 0;
1055
+
1056
+		if (!empty($post_images)) {
1057
+			foreach ($post_images as $image) {
1058
+				if ($image->height >= 400) {
1059
+					$spacer_height = 0;
1060
+				} else {
1061
+					$spacer_height = ((400 - $image->height) / 2);
1062
+				}
1063
+				$caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1064
+				$main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1065
+				$main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1066
+				$nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1067
+				$slides++;
1068
+			}
1069
+		}// endfore
1070
+	}
1071 1071
 
1072
-    if (!empty($post_images)) {
1073
-        ?>
1072
+	if (!empty($post_images)) {
1073
+		?>
1074 1074
         <div class="geodir_flex-container">
1075 1075
             <div class="geodir_flex-loader"><i class="fa fa-refresh fa-spin"></i></div>
1076 1076
             <div id="geodir_slider" class="geodir_flexslider ">
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
             <?php } ?>
1084 1084
         </div>
1085 1085
     <?php
1086
-    }
1086
+	}
1087 1087
 }
1088 1088
 
1089 1089
 add_action('geodir_details_taxonomies', 'geodir_action_details_taxonomies', 10);
@@ -1098,177 +1098,177 @@  discard block
 block discarded – undo
1098 1098
  */
1099 1099
 function geodir_action_details_taxonomies()
1100 1100
 {
1101
-    global $preview, $post;?>
1101
+	global $preview, $post;?>
1102 1102
     <p class="geodir_post_taxomomies clearfix">
1103 1103
     <?php
1104
-    $taxonomies = array();
1105
-
1106
-    $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
1107
-
1108
-    if ($preview && !$is_backend_preview) {
1109
-        $post_type = $post->listing_type;
1110
-        $post_taxonomy = $post_type . 'category';
1111
-        $post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1112
-    } else {
1113
-        $post_type = $post->post_type;
1114
-        $post_taxonomy = $post_type . 'category';
1115
-    }
1104
+	$taxonomies = array();
1105
+
1106
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
1107
+
1108
+	if ($preview && !$is_backend_preview) {
1109
+		$post_type = $post->listing_type;
1110
+		$post_taxonomy = $post_type . 'category';
1111
+		$post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1112
+	} else {
1113
+		$post_type = $post->post_type;
1114
+		$post_taxonomy = $post_type . 'category';
1115
+	}
1116 1116
 //{	
1117
-    $post_type_info = get_post_type_object($post_type);
1118
-    $listing_label = __($post_type_info->labels->singular_name, 'geodirectory');
1119
-
1120
-    if (!empty($post->post_tags)) {
1121
-
1122
-        if (taxonomy_exists($post_type . '_tags')):
1123
-            $links = array();
1124
-            $terms = array();
1125
-            // to limit post tags
1126
-            $post_tags = trim($post->post_tags, ",");
1127
-            $post_id = isset($post->ID) ? $post->ID : '';
1128
-            /**
1129
-             * Filter the post tags.
1130
-             *
1131
-             * Allows you to filter the post tags output on the details page of a post.
1132
-             *
1133
-             * @since 1.0.0
1134
-             * @param string $post_tags A comma seperated list of tags.
1135
-             * @param int $post_id The current post id.
1136
-             */
1137
-            $post_tags = apply_filters('geodir_action_details_post_tags', $post_tags, $post_id);
1138
-
1139
-            $post->post_tags = $post_tags;
1140
-            $post_tags = explode(",", trim($post->post_tags, ","));
1141
-
1142
-
1143
-            foreach ($post_tags as $post_term) {
1144
-
1145
-                // fix slug creation order for tags & location
1146
-                $post_term = trim($post_term);
1147
-
1148
-                $priority_location = false;
1149
-                if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1150
-                    $term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
1151
-                } else {
1152
-                    $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1153
-                    $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
1154
-                    $post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL;
1155
-                    $match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false;
1156
-                    $match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false;
1157
-                    $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1158
-                    if ($match_country || $match_region || $match_city) {
1159
-                        $priority_location = true;
1160
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1161
-                    } else {
1162
-                        $insert_term = wp_insert_term($post_term, $post_type . '_tags');
1163
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1164
-                    }
1165
-                }
1166
-
1167
-                if (!is_wp_error($term) && is_object($term)) {
1168
-
1169
-                    // fix tag link on detail page
1170
-                    if ($priority_location) {
1171
-
1172
-                        $tag_link = "<a href=''>$post_term</a>";
1173
-                        /**
1174
-                         * Filter the tag name on the details page.
1175
-                         *
1176
-                         * @since 1.5.6
1177
-                         * @param string $tag_link The tag link html.
1178
-                         * @param object $term The tag term object.
1179
-                         */
1180
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1181
-                        $links[] = $tag_link;
1182
-                    } else {
1183
-                        $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1184
-                        /** This action is documented in geodirectory-template_actions.php */
1185
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1186
-                        $links[] = $tag_link;
1187
-                    }
1188
-                    $terms[] = $term;
1189
-                }
1190
-                //
1191
-            }
1192
-            if (!isset($listing_label)) {
1193
-                $listing_label = '';
1194
-            }
1195
-            $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1196
-        endif;
1197
-
1198
-    }
1199
-
1200
-    if (!empty($post->{$post_taxonomy})) {
1201
-        $links = array();
1202
-        $terms = array();
1203
-        $termsOrdered = array();
1204
-        if (!is_array($post->{$post_taxonomy})) {
1205
-            $post_term = explode(",", trim($post->{$post_taxonomy}, ","));
1206
-        } else {
1207
-            $post_term = $post->{$post_taxonomy};
1117
+	$post_type_info = get_post_type_object($post_type);
1118
+	$listing_label = __($post_type_info->labels->singular_name, 'geodirectory');
1119
+
1120
+	if (!empty($post->post_tags)) {
1121
+
1122
+		if (taxonomy_exists($post_type . '_tags')):
1123
+			$links = array();
1124
+			$terms = array();
1125
+			// to limit post tags
1126
+			$post_tags = trim($post->post_tags, ",");
1127
+			$post_id = isset($post->ID) ? $post->ID : '';
1128
+			/**
1129
+			 * Filter the post tags.
1130
+			 *
1131
+			 * Allows you to filter the post tags output on the details page of a post.
1132
+			 *
1133
+			 * @since 1.0.0
1134
+			 * @param string $post_tags A comma seperated list of tags.
1135
+			 * @param int $post_id The current post id.
1136
+			 */
1137
+			$post_tags = apply_filters('geodir_action_details_post_tags', $post_tags, $post_id);
1138
+
1139
+			$post->post_tags = $post_tags;
1140
+			$post_tags = explode(",", trim($post->post_tags, ","));
1141
+
1142
+
1143
+			foreach ($post_tags as $post_term) {
1144
+
1145
+				// fix slug creation order for tags & location
1146
+				$post_term = trim($post_term);
1147
+
1148
+				$priority_location = false;
1149
+				if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1150
+					$term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
1151
+				} else {
1152
+					$post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1153
+					$post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
1154
+					$post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL;
1155
+					$match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false;
1156
+					$match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false;
1157
+					$match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1158
+					if ($match_country || $match_region || $match_city) {
1159
+						$priority_location = true;
1160
+						$term = get_term_by('name', $post_term, $post_type . '_tags');
1161
+					} else {
1162
+						$insert_term = wp_insert_term($post_term, $post_type . '_tags');
1163
+						$term = get_term_by('name', $post_term, $post_type . '_tags');
1164
+					}
1165
+				}
1166
+
1167
+				if (!is_wp_error($term) && is_object($term)) {
1168
+
1169
+					// fix tag link on detail page
1170
+					if ($priority_location) {
1171
+
1172
+						$tag_link = "<a href=''>$post_term</a>";
1173
+						/**
1174
+						 * Filter the tag name on the details page.
1175
+						 *
1176
+						 * @since 1.5.6
1177
+						 * @param string $tag_link The tag link html.
1178
+						 * @param object $term The tag term object.
1179
+						 */
1180
+						$tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1181
+						$links[] = $tag_link;
1182
+					} else {
1183
+						$tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1184
+						/** This action is documented in geodirectory-template_actions.php */
1185
+						$tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1186
+						$links[] = $tag_link;
1187
+					}
1188
+					$terms[] = $term;
1189
+				}
1190
+				//
1191
+			}
1192
+			if (!isset($listing_label)) {
1193
+				$listing_label = '';
1194
+			}
1195
+			$taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1196
+		endif;
1197
+
1198
+	}
1199
+
1200
+	if (!empty($post->{$post_taxonomy})) {
1201
+		$links = array();
1202
+		$terms = array();
1203
+		$termsOrdered = array();
1204
+		if (!is_array($post->{$post_taxonomy})) {
1205
+			$post_term = explode(",", trim($post->{$post_taxonomy}, ","));
1206
+		} else {
1207
+			$post_term = $post->{$post_taxonomy};
1208 1208
 			
1209 1209
 			if ($preview && !$is_backend_preview) {
1210 1210
 				$post_term = geodir_add_parent_terms($post_term, $post_taxonomy);
1211 1211
 			}
1212
-        }
1213
-
1214
-        $post_term = array_unique($post_term);
1215
-        if (!empty($post_term)) {
1216
-            foreach ($post_term as $post_term) {
1217
-                $post_term = trim($post_term);
1218
-
1219
-                if ($post_term != ''):
1220
-                    $term = get_term_by('id', $post_term, $post_taxonomy);
1221
-
1222
-                    if (is_object($term)) {
1223
-                        $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1224
-                        /**
1225
-                         * Filter the category name on the details page.
1226
-                         *
1227
-                         * @since 1.5.6
1228
-                         * @param string $term_link The link html to the category.
1229
-                         * @param object $term The category term object.
1230
-                         */
1231
-                        $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1232
-                        $links[] = $term_link;
1233
-                        $terms[] = $term;
1234
-                    }
1235
-                endif;
1236
-            }
1237
-            // order alphabetically
1238
-            asort($links);
1239
-            foreach (array_keys($links) as $key) {
1240
-                $termsOrdered[$key] = $terms[$key];
1241
-            }
1242
-            $terms = $termsOrdered;
1212
+		}
1213
+
1214
+		$post_term = array_unique($post_term);
1215
+		if (!empty($post_term)) {
1216
+			foreach ($post_term as $post_term) {
1217
+				$post_term = trim($post_term);
1218
+
1219
+				if ($post_term != ''):
1220
+					$term = get_term_by('id', $post_term, $post_taxonomy);
1221
+
1222
+					if (is_object($term)) {
1223
+						$term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1224
+						/**
1225
+						 * Filter the category name on the details page.
1226
+						 *
1227
+						 * @since 1.5.6
1228
+						 * @param string $term_link The link html to the category.
1229
+						 * @param object $term The category term object.
1230
+						 */
1231
+						$term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1232
+						$links[] = $term_link;
1233
+						$terms[] = $term;
1234
+					}
1235
+				endif;
1236
+			}
1237
+			// order alphabetically
1238
+			asort($links);
1239
+			foreach (array_keys($links) as $key) {
1240
+				$termsOrdered[$key] = $terms[$key];
1241
+			}
1242
+			$terms = $termsOrdered;
1243 1243
 
1244
-        }
1244
+		}
1245 1245
 
1246
-        if (!isset($listing_label)) {
1247
-            $listing_label = '';
1248
-        }
1249
-        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1246
+		if (!isset($listing_label)) {
1247
+			$listing_label = '';
1248
+		}
1249
+		$taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1250 1250
 
1251
-    }
1251
+	}
1252 1252
 
1253
-    /**
1254
-     * Filter the taxonomies array before output.
1255
-     *
1256
-     * @since 1.5.9
1257
-     * @param array $taxonomies The array of cats and tags.
1258
-     * @param string $post_type The post type being output.
1259
-     * @param string $listing_label The post type label.
1260
-     * @param string $listing_label The post type label with ucwords function.
1261
-     */
1262
-    $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1253
+	/**
1254
+	 * Filter the taxonomies array before output.
1255
+	 *
1256
+	 * @since 1.5.9
1257
+	 * @param array $taxonomies The array of cats and tags.
1258
+	 * @param string $post_type The post type being output.
1259
+	 * @param string $listing_label The post type label.
1260
+	 * @param string $listing_label The post type label with ucwords function.
1261
+	 */
1262
+	$taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1263 1263
 
1264
-    if (isset($taxonomies[$post_taxonomy])) {
1265
-        echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1266
-    }
1264
+	if (isset($taxonomies[$post_taxonomy])) {
1265
+		echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1266
+	}
1267 1267
 
1268
-    if (isset($taxonomies[$post_type . '_tags']))
1269
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1268
+	if (isset($taxonomies[$post_type . '_tags']))
1269
+		echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1270 1270
 
1271
-    ?>
1271
+	?>
1272 1272
     </p><?php
1273 1273
 }
1274 1274
 
@@ -1290,140 +1290,140 @@  discard block
 block discarded – undo
1290 1290
 function geodir_action_details_micordata($post='')
1291 1291
 {
1292 1292
 
1293
-    global $preview;
1294
-    if(empty($post)){global $post;}
1295
-    if ($preview || !geodir_is_page('detail')) {
1296
-        return;
1297
-    }
1298
-
1299
-    // url
1300
-    $c_url = geodir_curPageURL();
1301
-
1302
-    // post reviews
1303
-    $post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
1304
-    if (empty($post_reviews)) {
1305
-        $reviews = '';
1306
-    } else {
1307
-        foreach ($post_reviews as $review) {
1308
-            $reviews[] = array(
1309
-                "@type" => "Review",
1310
-                "author" => $review->comment_author,
1311
-                "datePublished" => $review->comment_date,
1312
-                "description" => $review->comment_content,
1313
-                "reviewRating" => array(
1314
-                    "@type" => "Rating",
1315
-                    "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1316
-                    "ratingValue" => geodir_get_commentoverall($review->comment_ID),
1317
-                    "worstRating" => "1"
1318
-                )
1319
-            );
1320
-        }
1321
-
1322
-    }
1323
-
1324
-    // post images
1325
-    $post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
1326
-    if (empty($post_images)) {
1327
-        $images = '';
1328
-    } else {
1329
-        $i_arr = array();
1330
-        foreach ($post_images as $img) {
1331
-            $i_arr[] = $img->src;
1332
-        }
1333
-
1334
-        if (count($i_arr) == 1) {
1335
-            $images = $i_arr[0];
1336
-        } else {
1337
-            $images = $i_arr;
1338
-        }
1339
-
1340
-    }
1341
-    //print_r($post);
1342
-    // external links
1343
-    $external_links =  array();
1344
-    $external_links[] = $post->geodir_website;
1345
-    $external_links[] = $post->geodir_twitter;
1346
-    $external_links[] = $post->geodir_facebook;
1347
-    $external_links = array_filter($external_links);
1348
-
1349
-    if(!empty($external_links)){
1350
-        $external_links = array_values($external_links);
1351
-    }
1352
-
1353
-    // reviews
1354
-    $comment_count = geodir_get_review_count_total($post->ID);
1355
-    $post_avgratings = geodir_get_post_rating($post->ID);
1356
-
1357
-    // schema type
1358
-    $schema_type = 'LocalBusiness';
1359
-    if(isset($post->default_category) && $post->default_category){
1360
-        $cat_schema = geodir_get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1361
-        if($cat_schema){$schema_type = $cat_schema;}
1362
-        if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1363
-    }
1364
-
1365
-    $schema = array();
1366
-    $schema['@context'] = "https://schema.org";
1367
-    $schema['@type'] = $schema_type;
1368
-    $schema['name'] = $post->post_title;
1369
-    $schema['description'] = wp_strip_all_tags( $post->post_content, true );
1370
-    $schema['telephone'] = $post->geodir_contact;
1371
-    $schema['url'] = $c_url;
1372
-    $schema['sameAs'] = $external_links;
1373
-    $schema['image'] = $images;
1374
-    $schema['address'] = array(
1375
-        "@type" => "PostalAddress",
1376
-        "streetAddress" => $post->post_address,
1377
-        "addressLocality" => $post->post_city,
1378
-        "addressRegion" => $post->post_region,
1379
-        "addressCountry" => $post->post_country,
1380
-        "postalCode" => $post->post_zip
1381
-    );
1382
-
1383
-    if($post->post_latitude && $post->post_longitude) {
1384
-        $schema['geo'] = array(
1385
-            "@type" => "GeoCoordinates",
1386
-            "latitude" => $post->post_latitude,
1387
-            "longitude" => $post->post_longitude
1388
-        );
1389
-    }
1390
-
1391
-    if($post_avgratings) {
1392
-        $schema['aggregateRating'] = array(
1393
-            "@type" => "AggregateRating",
1394
-            "ratingValue" => $post_avgratings,
1395
-            "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1396
-            "worstRating" => "1",
1397
-            "ratingCount" => $comment_count
1398
-        );
1399
-    }
1400
-    $schema['review'] = $reviews;
1401
-
1402
-    /**
1403
-     * Allow the schema JSON-LD info to be filtered.
1404
-     *
1405
-     * @since 1.5.4
1406
-     * @since 1.5.7 Added $post variable.
1407
-     * @param array $schema The array of schema data to be filtered.
1408
-     * @param object $post The post object.
1409
-     */
1410
-    $schema = apply_filters('geodir_details_schema', $schema,$post);
1411
-
1412
-
1413
-    echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1414
-
1415
-
1416
-    $uploads = wp_upload_dir();
1417
-    $facebook_og = (isset($post->featured_image) && $post->featured_image) ? '<meta property="og:image" content="'.$uploads['baseurl'].$post->featured_image.'"/>' : '';
1418
-
1419
-    /**
1420
-     * Show facebook open graph meta info
1421
-     *
1422
-     * @since 1.6.6
1423
-     * @param string $facebook_og The open graph html to be filtered.
1424
-     * @param object $post The post object.
1425
-     */
1426
-    echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
1293
+	global $preview;
1294
+	if(empty($post)){global $post;}
1295
+	if ($preview || !geodir_is_page('detail')) {
1296
+		return;
1297
+	}
1298
+
1299
+	// url
1300
+	$c_url = geodir_curPageURL();
1301
+
1302
+	// post reviews
1303
+	$post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
1304
+	if (empty($post_reviews)) {
1305
+		$reviews = '';
1306
+	} else {
1307
+		foreach ($post_reviews as $review) {
1308
+			$reviews[] = array(
1309
+				"@type" => "Review",
1310
+				"author" => $review->comment_author,
1311
+				"datePublished" => $review->comment_date,
1312
+				"description" => $review->comment_content,
1313
+				"reviewRating" => array(
1314
+					"@type" => "Rating",
1315
+					"bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1316
+					"ratingValue" => geodir_get_commentoverall($review->comment_ID),
1317
+					"worstRating" => "1"
1318
+				)
1319
+			);
1320
+		}
1321
+
1322
+	}
1323
+
1324
+	// post images
1325
+	$post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
1326
+	if (empty($post_images)) {
1327
+		$images = '';
1328
+	} else {
1329
+		$i_arr = array();
1330
+		foreach ($post_images as $img) {
1331
+			$i_arr[] = $img->src;
1332
+		}
1333
+
1334
+		if (count($i_arr) == 1) {
1335
+			$images = $i_arr[0];
1336
+		} else {
1337
+			$images = $i_arr;
1338
+		}
1339
+
1340
+	}
1341
+	//print_r($post);
1342
+	// external links
1343
+	$external_links =  array();
1344
+	$external_links[] = $post->geodir_website;
1345
+	$external_links[] = $post->geodir_twitter;
1346
+	$external_links[] = $post->geodir_facebook;
1347
+	$external_links = array_filter($external_links);
1348
+
1349
+	if(!empty($external_links)){
1350
+		$external_links = array_values($external_links);
1351
+	}
1352
+
1353
+	// reviews
1354
+	$comment_count = geodir_get_review_count_total($post->ID);
1355
+	$post_avgratings = geodir_get_post_rating($post->ID);
1356
+
1357
+	// schema type
1358
+	$schema_type = 'LocalBusiness';
1359
+	if(isset($post->default_category) && $post->default_category){
1360
+		$cat_schema = geodir_get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1361
+		if($cat_schema){$schema_type = $cat_schema;}
1362
+		if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1363
+	}
1364
+
1365
+	$schema = array();
1366
+	$schema['@context'] = "https://schema.org";
1367
+	$schema['@type'] = $schema_type;
1368
+	$schema['name'] = $post->post_title;
1369
+	$schema['description'] = wp_strip_all_tags( $post->post_content, true );
1370
+	$schema['telephone'] = $post->geodir_contact;
1371
+	$schema['url'] = $c_url;
1372
+	$schema['sameAs'] = $external_links;
1373
+	$schema['image'] = $images;
1374
+	$schema['address'] = array(
1375
+		"@type" => "PostalAddress",
1376
+		"streetAddress" => $post->post_address,
1377
+		"addressLocality" => $post->post_city,
1378
+		"addressRegion" => $post->post_region,
1379
+		"addressCountry" => $post->post_country,
1380
+		"postalCode" => $post->post_zip
1381
+	);
1382
+
1383
+	if($post->post_latitude && $post->post_longitude) {
1384
+		$schema['geo'] = array(
1385
+			"@type" => "GeoCoordinates",
1386
+			"latitude" => $post->post_latitude,
1387
+			"longitude" => $post->post_longitude
1388
+		);
1389
+	}
1390
+
1391
+	if($post_avgratings) {
1392
+		$schema['aggregateRating'] = array(
1393
+			"@type" => "AggregateRating",
1394
+			"ratingValue" => $post_avgratings,
1395
+			"bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1396
+			"worstRating" => "1",
1397
+			"ratingCount" => $comment_count
1398
+		);
1399
+	}
1400
+	$schema['review'] = $reviews;
1401
+
1402
+	/**
1403
+	 * Allow the schema JSON-LD info to be filtered.
1404
+	 *
1405
+	 * @since 1.5.4
1406
+	 * @since 1.5.7 Added $post variable.
1407
+	 * @param array $schema The array of schema data to be filtered.
1408
+	 * @param object $post The post object.
1409
+	 */
1410
+	$schema = apply_filters('geodir_details_schema', $schema,$post);
1411
+
1412
+
1413
+	echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1414
+
1415
+
1416
+	$uploads = wp_upload_dir();
1417
+	$facebook_og = (isset($post->featured_image) && $post->featured_image) ? '<meta property="og:image" content="'.$uploads['baseurl'].$post->featured_image.'"/>' : '';
1418
+
1419
+	/**
1420
+	 * Show facebook open graph meta info
1421
+	 *
1422
+	 * @since 1.6.6
1423
+	 * @param string $facebook_og The open graph html to be filtered.
1424
+	 * @param object $post The post object.
1425
+	 */
1426
+	echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
1427 1427
 
1428 1428
 
1429 1429
 
@@ -1443,7 +1443,7 @@  discard block
 block discarded – undo
1443 1443
  */
1444 1444
 function geodir_action_details_next_prev()
1445 1445
 {
1446
-    ?>
1446
+	?>
1447 1447
     <div class="geodir-pos_navigation clearfix">
1448 1448
     <div
1449 1449
         class="geodir-post_left"><?php previous_post_link('%link', '' . __('Previous', 'geodirectory'), false) ?></div>
@@ -1461,15 +1461,15 @@  discard block
 block discarded – undo
1461 1461
  */
1462 1462
 function geodir_action_before_single_post()
1463 1463
 {
1464
-    global $post;
1465
-    /**
1466
-     * Called at the very start of the details page output, before the title section.
1467
-     *
1468
-     * @since 1.0.0
1469
-     * @param object $post The current post object.
1470
-     * @global WP_Post|null $post The current post, if available.
1471
-     */
1472
-    do_action('geodir_before_single_post', $post); // extra action	
1464
+	global $post;
1465
+	/**
1466
+	 * Called at the very start of the details page output, before the title section.
1467
+	 *
1468
+	 * @since 1.0.0
1469
+	 * @param object $post The current post object.
1470
+	 * @global WP_Post|null $post The current post, if available.
1471
+	 */
1472
+	do_action('geodir_before_single_post', $post); // extra action	
1473 1473
 }
1474 1474
 
1475 1475
 /**
@@ -1480,13 +1480,13 @@  discard block
 block discarded – undo
1480 1480
  */
1481 1481
 function geodir_action_after_single_post($post)
1482 1482
 {
1483
-    /**
1484
-     * Called on the details page after the details page tabs section and before the next/prev buttons.
1485
-     *
1486
-     * @since 1.0.0
1487
-     * @param object $post The current post object.
1488
-     */
1489
-    do_action('geodir_after_single_post', $post); // extra action	
1483
+	/**
1484
+	 * Called on the details page after the details page tabs section and before the next/prev buttons.
1485
+	 *
1486
+	 * @since 1.0.0
1487
+	 * @param object $post The current post object.
1488
+	 */
1489
+	do_action('geodir_after_single_post', $post); // extra action	
1490 1490
 }
1491 1491
 
1492 1492
 add_action('geodir_details_main_content', 'geodir_action_before_single_post', 10);
@@ -1512,168 +1512,168 @@  discard block
 block discarded – undo
1512 1512
  */
1513 1513
 function geodir_action_listings_title()
1514 1514
 {
1515
-    global $wp, $term;
1516
-
1517
-    $gd_post_type = geodir_get_current_posttype();
1518
-    $post_type_info = get_post_type_object($gd_post_type);
1519
-
1520
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
1521
-    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1522
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1523
-    }
1524
-
1525
-    $list_title = $add_string_in_title . __($post_type_info->labels->name, 'geodirectory');
1526
-    $single_name = $post_type_info->labels->singular_name;
1527
-
1528
-    $taxonomy = geodir_get_taxonomies($gd_post_type, true);
1529
-
1530
-    $gd_country = get_query_var('gd_country');
1531
-    $gd_region = get_query_var('gd_region');
1532
-    $gd_city = get_query_var('gd_city');
1533
-
1534
-    if (!empty($term)) {
1535
-        $location_name = '';
1536
-        if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
1537
-            if ($gd_country != '') {
1538
-                $location_name = geodir_sanitize_location_name('gd_country', $gd_country);
1539
-            }
1540
-
1541
-            if ($gd_region != '') {
1542
-                $location_name = geodir_sanitize_location_name('gd_region', $gd_region);
1543
-            }
1544
-
1545
-            if ($gd_city != '') {
1546
-                $location_name = geodir_sanitize_location_name('gd_city', $gd_city);
1547
-            }
1548
-        }
1549
-
1550
-        $current_term = get_term_by('slug', $term, $taxonomy[0]);
1551
-        if (!empty($current_term)) {
1552
-            $current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1553
-            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1554
-                $location_last_char = substr($location_name, -1);
1555
-                $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1556
-                $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1557
-            } else {
1558
-                $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1559
-            }
1560
-        } else {
1561
-            if (count($taxonomy) > 1) {
1562
-                $current_term = get_term_by('slug', $term, $taxonomy[1]);
1563
-
1564
-                if (!empty($current_term)) {
1565
-                    $current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1566
-                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1567
-                        $location_last_char = substr($location_name, -1);
1568
-                        $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1569
-                        $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1570
-                    } else {
1571
-                        $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1572
-                    }
1573
-                }
1574
-            }
1575
-        }
1515
+	global $wp, $term;
1576 1516
 
1577
-    } else {
1578
-        $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
1579
-        $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
1580
-        $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
1517
+	$gd_post_type = geodir_get_current_posttype();
1518
+	$post_type_info = get_post_type_object($gd_post_type);
1581 1519
 
1582
-        $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
1520
+	$add_string_in_title = __('All', 'geodirectory') . ' ';
1521
+	if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1522
+		$add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1523
+	}
1583 1524
 
1584
-        if (function_exists('get_actual_location_name')) {
1585
-            $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
1586
-            $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
1587
-            $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
1588
-        }
1525
+	$list_title = $add_string_in_title . __($post_type_info->labels->name, 'geodirectory');
1526
+	$single_name = $post_type_info->labels->singular_name;
1589 1527
 
1590
-        if ($gd_city != '') {
1591
-            if ($gd_city_actual != '') {
1592
-                $gd_city = $gd_city_actual;
1593
-            } else {
1594
-                $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
1595
-                $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
1596
-                $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1597
-            }
1528
+	$taxonomy = geodir_get_taxonomies($gd_post_type, true);
1598 1529
 
1599
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1600
-        } else if ($gd_region != '') {
1601
-            if ($gd_region_actual != '') {
1602
-                $gd_region = $gd_region_actual;
1603
-            } else {
1604
-                $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
1605
-                $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
1606
-                $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1607
-            }
1530
+	$gd_country = get_query_var('gd_country');
1531
+	$gd_region = get_query_var('gd_region');
1532
+	$gd_city = get_query_var('gd_city');
1608 1533
 
1609
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1610
-        } else if ($gd_country != '') {
1611
-            if ($gd_country_actual != '') {
1612
-                $gd_country = $gd_country_actual;
1613
-            } else {
1614
-                $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
1615
-                $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
1616
-                $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1617
-            }
1618
-
1619
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1620
-        }
1621
-    }
1622
-
1623
-    if (is_search()) {
1624
-        $list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1625
-    }
1626
-    /** This action is documented in geodirectory_template_actions.php */
1627
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
1628
-    /** This action is documented in geodirectory_template_actions.php */
1629
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
1630
-
1631
-
1632
-    $title = $list_title;
1633
-    $gd_page = '';
1634
-    if(geodir_is_page('pt')){
1635
-        $gd_page = 'pt';
1636
-        $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1637
-    }
1638
-    elseif(geodir_is_page('listing')){
1639
-        $gd_page = 'listing';
1640
-        global $wp_query;
1641
-        $current_term = $wp_query->get_queried_object();
1642
-        if (strpos($current_term->taxonomy,'_tags') !== false) {
1643
-            $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1644
-        }else{
1645
-            $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1646
-        }
1534
+	if (!empty($term)) {
1535
+		$location_name = '';
1536
+		if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
1537
+			if ($gd_country != '') {
1538
+				$location_name = geodir_sanitize_location_name('gd_country', $gd_country);
1539
+			}
1647 1540
 
1648
-    }
1649
-    elseif(geodir_is_page('author')){
1650
-        $gd_page = 'author';
1651
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1652
-            $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1653
-        }else{
1654
-            $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1655
-        }
1541
+			if ($gd_region != '') {
1542
+				$location_name = geodir_sanitize_location_name('gd_region', $gd_region);
1543
+			}
1656 1544
 
1657
-    }
1545
+			if ($gd_city != '') {
1546
+				$location_name = geodir_sanitize_location_name('gd_city', $gd_city);
1547
+			}
1548
+		}
1549
+
1550
+		$current_term = get_term_by('slug', $term, $taxonomy[0]);
1551
+		if (!empty($current_term)) {
1552
+			$current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1553
+			if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1554
+				$location_last_char = substr($location_name, -1);
1555
+				$location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1556
+				$list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1557
+			} else {
1558
+				$list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1559
+			}
1560
+		} else {
1561
+			if (count($taxonomy) > 1) {
1562
+				$current_term = get_term_by('slug', $term, $taxonomy[1]);
1563
+
1564
+				if (!empty($current_term)) {
1565
+					$current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1566
+					if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1567
+						$location_last_char = substr($location_name, -1);
1568
+						$location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1569
+						$list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1570
+					} else {
1571
+						$list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1572
+					}
1573
+				}
1574
+			}
1575
+		}
1576
+
1577
+	} else {
1578
+		$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
1579
+		$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
1580
+		$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
1581
+
1582
+		$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
1583
+
1584
+		if (function_exists('get_actual_location_name')) {
1585
+			$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
1586
+			$gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
1587
+			$gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
1588
+		}
1589
+
1590
+		if ($gd_city != '') {
1591
+			if ($gd_city_actual != '') {
1592
+				$gd_city = $gd_city_actual;
1593
+			} else {
1594
+				$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
1595
+				$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
1596
+				$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1597
+			}
1658 1598
 
1599
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1600
+		} else if ($gd_region != '') {
1601
+			if ($gd_region_actual != '') {
1602
+				$gd_region = $gd_region_actual;
1603
+			} else {
1604
+				$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
1605
+				$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
1606
+				$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1607
+			}
1659 1608
 
1660
-    /**
1661
-     * Filter page title to replace variables.
1662
-     *
1663
-     * @since 1.5.4
1664
-     * @param string $title The page title including variables.
1665
-     * @param string $gd_page The GeoDirectory page type if any.
1666
-     */
1667
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1609
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1610
+		} else if ($gd_country != '') {
1611
+			if ($gd_country_actual != '') {
1612
+				$gd_country = $gd_country_actual;
1613
+			} else {
1614
+				$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
1615
+				$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
1616
+				$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1617
+			}
1668 1618
 
1669
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1670
-        /**
1671
-         * Filter the listing page title.
1672
-         *
1673
-         * @since 1.0.0
1674
-         * @param string $list_title The title for the category page.
1675
-         */
1676
-        apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1619
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1620
+		}
1621
+	}
1622
+
1623
+	if (is_search()) {
1624
+		$list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1625
+	}
1626
+	/** This action is documented in geodirectory_template_actions.php */
1627
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
1628
+	/** This action is documented in geodirectory_template_actions.php */
1629
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
1630
+
1631
+
1632
+	$title = $list_title;
1633
+	$gd_page = '';
1634
+	if(geodir_is_page('pt')){
1635
+		$gd_page = 'pt';
1636
+		$title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1637
+	}
1638
+	elseif(geodir_is_page('listing')){
1639
+		$gd_page = 'listing';
1640
+		global $wp_query;
1641
+		$current_term = $wp_query->get_queried_object();
1642
+		if (strpos($current_term->taxonomy,'_tags') !== false) {
1643
+			$title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1644
+		}else{
1645
+			$title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1646
+		}
1647
+
1648
+	}
1649
+	elseif(geodir_is_page('author')){
1650
+		$gd_page = 'author';
1651
+		if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1652
+			$title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1653
+		}else{
1654
+			$title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1655
+		}
1656
+
1657
+	}
1658
+
1659
+
1660
+	/**
1661
+	 * Filter page title to replace variables.
1662
+	 *
1663
+	 * @since 1.5.4
1664
+	 * @param string $title The page title including variables.
1665
+	 * @param string $gd_page The GeoDirectory page type if any.
1666
+	 */
1667
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1668
+
1669
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1670
+		/**
1671
+		 * Filter the listing page title.
1672
+		 *
1673
+		 * @since 1.0.0
1674
+		 * @param string $list_title The title for the category page.
1675
+		 */
1676
+		apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1677 1677
 }
1678 1678
 
1679 1679
 add_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
@@ -1686,46 +1686,46 @@  discard block
 block discarded – undo
1686 1686
  */
1687 1687
 function geodir_action_listings_description()
1688 1688
 {
1689
-    global $wp_query;
1690
-    $current_term = $wp_query->get_queried_object();
1689
+	global $wp_query;
1690
+	$current_term = $wp_query->get_queried_object();
1691 1691
 
1692
-    $gd_post_type = geodir_get_current_posttype();
1693
-    if (isset($current_term->term_id) && $current_term->term_id != '') {
1692
+	$gd_post_type = geodir_get_current_posttype();
1693
+	if (isset($current_term->term_id) && $current_term->term_id != '') {
1694 1694
 
1695
-        $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1696
-        $saved_data = stripslashes(geodir_get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1697
-        if ($term_desc && !$saved_data) {
1698
-            $saved_data = $term_desc;
1699
-        }
1695
+		$term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1696
+		$saved_data = stripslashes(geodir_get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1697
+		if ($term_desc && !$saved_data) {
1698
+			$saved_data = $term_desc;
1699
+		}
1700 1700
 
1701
-        // stop payment manager filtering content length
1702
-        $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1703
-        if ( false !== $filter_priority ) {
1704
-            remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1705
-        }
1701
+		// stop payment manager filtering content length
1702
+		$filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1703
+		if ( false !== $filter_priority ) {
1704
+			remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1705
+		}
1706 1706
 
1707
-        /**
1708
-         * Apply the core filter `the_content` filter to the variable string.
1709
-         *
1710
-         * This is a WordPress core filter that does many things.
1711
-         *
1712
-         * @since 1.0.0
1713
-         * @param string $var The string to apply the filter to.
1714
-         */
1715
-        $cat_description = apply_filters('the_content', $saved_data);
1707
+		/**
1708
+		 * Apply the core filter `the_content` filter to the variable string.
1709
+		 *
1710
+		 * This is a WordPress core filter that does many things.
1711
+		 *
1712
+		 * @since 1.0.0
1713
+		 * @param string $var The string to apply the filter to.
1714
+		 */
1715
+		$cat_description = apply_filters('the_content', $saved_data);
1716 1716
 
1717 1717
 
1718
-        if ( false !== $filter_priority ) {
1719
-            add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1720
-        }
1718
+		if ( false !== $filter_priority ) {
1719
+			add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1720
+		}
1721 1721
 
1722
-        if ($cat_description) {
1723
-            ?>
1722
+		if ($cat_description) {
1723
+			?>
1724 1724
 
1725 1725
             <div class="term_description"><?php echo $cat_description;?></div> <?php
1726
-        }
1726
+		}
1727 1727
 
1728
-    }
1728
+	}
1729 1729
 }
1730 1730
 
1731 1731
 // action for adding the listings page top widget area
@@ -1744,11 +1744,11 @@  discard block
 block discarded – undo
1744 1744
  */
1745 1745
 function geodir_action_geodir_sidebar_listings_top()
1746 1746
 {
1747
-    if (get_option('geodir_show_listing_top_section')) { ?>
1747
+	if (get_option('geodir_show_listing_top_section')) { ?>
1748 1748
         <div
1749 1749
             class="<?php
1750
-            /** This action is documented in geodirectory_template_actions.php */
1751
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
1750
+			/** This action is documented in geodirectory_template_actions.php */
1751
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
1752 1752
             <?php dynamic_sidebar('geodir_listing_top'); ?>
1753 1753
         </div><!-- clearfix ends here-->
1754 1754
     <?php }
@@ -1771,35 +1771,35 @@  discard block
 block discarded – undo
1771 1771
  */
1772 1772
 function geodir_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')
1773 1773
 {
1774
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1775
-        $width_css = 'style="width:' . $width . '%;"';
1776
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1777
-        $width_css = 'style="width:' . $width . '%;"';
1778
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1779
-        $width_css = 'style="width:' . $width . '%;"';
1780
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1781
-        $width_css = 'style="width:' . $width . '%;"';
1782
-    } else {
1783
-        $width_css = '';
1784
-    }
1785
-
1786
-    $tc = get_option('theme_compatibility_setting');
1787
-    if (!empty($tc['geodir_sidebar_left_open_replace'])) {
1788
-        $text = $tc['geodir_sidebar_left_open_replace'];
1789
-    } else {
1790
-        $text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
1791
-    }
1792
-
1793
-    if (!empty($tc['geodir_sidebar_left_open_id'])) {
1794
-        $id = $tc['geodir_sidebar_left_open_id'];
1795
-    }
1796
-    if (!empty($tc['geodir_sidebar_left_open_class'])) {
1797
-        $class = $tc['geodir_sidebar_left_open_class'];
1798
-    }
1799
-
1800
-    $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
1801
-
1802
-    echo $text;
1774
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1775
+		$width_css = 'style="width:' . $width . '%;"';
1776
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1777
+		$width_css = 'style="width:' . $width . '%;"';
1778
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1779
+		$width_css = 'style="width:' . $width . '%;"';
1780
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1781
+		$width_css = 'style="width:' . $width . '%;"';
1782
+	} else {
1783
+		$width_css = '';
1784
+	}
1785
+
1786
+	$tc = get_option('theme_compatibility_setting');
1787
+	if (!empty($tc['geodir_sidebar_left_open_replace'])) {
1788
+		$text = $tc['geodir_sidebar_left_open_replace'];
1789
+	} else {
1790
+		$text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
1791
+	}
1792
+
1793
+	if (!empty($tc['geodir_sidebar_left_open_id'])) {
1794
+		$id = $tc['geodir_sidebar_left_open_id'];
1795
+	}
1796
+	if (!empty($tc['geodir_sidebar_left_open_class'])) {
1797
+		$class = $tc['geodir_sidebar_left_open_class'];
1798
+	}
1799
+
1800
+	$text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
1801
+
1802
+	echo $text;
1803 1803
 }
1804 1804
 
1805 1805
 // action for adding the primary div closing tag
@@ -1815,13 +1815,13 @@  discard block
 block discarded – undo
1815 1815
  */
1816 1816
 function geodir_action_sidebar_left_close($type = '')
1817 1817
 {
1818
-    $tc = get_option('theme_compatibility_setting');
1819
-    if (!empty($tc['geodir_sidebar_left_close_replace'])) {
1820
-        $text = $tc['geodir_sidebar_left_close_replace'];
1821
-    } else {
1822
-        $text = '</aside><!-- sidebar ends here-->';
1823
-    }
1824
-    echo $text;
1818
+	$tc = get_option('theme_compatibility_setting');
1819
+	if (!empty($tc['geodir_sidebar_left_close_replace'])) {
1820
+		$text = $tc['geodir_sidebar_left_close_replace'];
1821
+	} else {
1822
+		$text = '</aside><!-- sidebar ends here-->';
1823
+	}
1824
+	echo $text;
1825 1825
 }
1826 1826
 
1827 1827
 /**
@@ -1834,7 +1834,7 @@  discard block
 block discarded – undo
1834 1834
  */
1835 1835
 function geodir_listing_left_section()
1836 1836
 {
1837
-    if (get_option('geodir_show_listing_left_section')) { ?>
1837
+	if (get_option('geodir_show_listing_left_section')) { ?>
1838 1838
         <div class="geodir-content-left geodir-sidebar-wrap">
1839 1839
             <?php dynamic_sidebar('geodir_listing_left_sidebar'); ?>
1840 1840
         </div><!-- end geodir-content-left -->
@@ -1852,20 +1852,20 @@  discard block
 block discarded – undo
1852 1852
  */
1853 1853
 function geodir_action_listings_sidebar_left()
1854 1854
 {
1855
-    if (get_option('geodir_show_listing_left_section')) {
1856
-        /** This action is documented in geodirectory_template_actions.php */
1857
-        do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'https://schema.org/WPSideBar');
1858
-        /**
1859
-         * Calls the listings page (category) left sidebar content.
1860
-         *
1861
-         * All the content for the listings page left sidebar is added via this hook.
1862
-         *
1863
-         * @since 1.0.0
1864
-         */
1865
-        do_action('geodir_listings_sidebar_left_inside');
1866
-        /** This action is documented in geodirectory_template_actions.php */
1867
-        do_action('geodir_sidebar_left_close', 'listings-page');
1868
-    }
1855
+	if (get_option('geodir_show_listing_left_section')) {
1856
+		/** This action is documented in geodirectory_template_actions.php */
1857
+		do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'https://schema.org/WPSideBar');
1858
+		/**
1859
+		 * Calls the listings page (category) left sidebar content.
1860
+		 *
1861
+		 * All the content for the listings page left sidebar is added via this hook.
1862
+		 *
1863
+		 * @since 1.0.0
1864
+		 */
1865
+		do_action('geodir_listings_sidebar_left_inside');
1866
+		/** This action is documented in geodirectory_template_actions.php */
1867
+		do_action('geodir_sidebar_left_close', 'listings-page');
1868
+	}
1869 1869
 }
1870 1870
 
1871 1871
 /**
@@ -1878,7 +1878,7 @@  discard block
 block discarded – undo
1878 1878
  */
1879 1879
 function geodir_listing_right_section()
1880 1880
 {
1881
-    if (get_option('geodir_show_listing_right_section')) { ?>
1881
+	if (get_option('geodir_show_listing_right_section')) { ?>
1882 1882
         <div class="geodir-content-right geodir-sidebar-wrap">
1883 1883
             <?php dynamic_sidebar('geodir_listing_right_sidebar'); ?>
1884 1884
         </div><!-- end geodir-content-right -->
@@ -1896,20 +1896,20 @@  discard block
 block discarded – undo
1896 1896
  */
1897 1897
 function geodir_action_listings_sidebar_right()
1898 1898
 {
1899
-    if (get_option('geodir_show_listing_right_section')) {
1900
-        /** This action is documented in geodirectory_template_actions.php */
1901
-        do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
1902
-        /**
1903
-         * Calls the listings page (category) right sidebar content.
1904
-         *
1905
-         * All the content for the listings page right sidebar is added via this hook.
1906
-         *
1907
-         * @since 1.0.0
1908
-         */
1909
-        do_action('geodir_listings_sidebar_right_inside');
1910
-        /** This action is documented in geodirectory_template_actions.php */
1911
-        do_action('geodir_sidebar_right_close', 'listings-page');
1912
-    }
1899
+	if (get_option('geodir_show_listing_right_section')) {
1900
+		/** This action is documented in geodirectory_template_actions.php */
1901
+		do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
1902
+		/**
1903
+		 * Calls the listings page (category) right sidebar content.
1904
+		 *
1905
+		 * All the content for the listings page right sidebar is added via this hook.
1906
+		 *
1907
+		 * @since 1.0.0
1908
+		 */
1909
+		do_action('geodir_listings_sidebar_right_inside');
1910
+		/** This action is documented in geodirectory_template_actions.php */
1911
+		do_action('geodir_sidebar_right_close', 'listings-page');
1912
+	}
1913 1913
 }
1914 1914
 
1915 1915
 
@@ -1926,23 +1926,23 @@  discard block
 block discarded – undo
1926 1926
  */
1927 1927
 function geodir_action_main_content_open($type = '', $id = '', $class = '')
1928 1928
 {
1929
-    $tc = get_option('theme_compatibility_setting');
1930
-    if (!empty($tc['geodir_main_content_open_replace'])) {
1931
-        $text = $tc['geodir_main_content_open_replace'];
1932
-    } else {
1933
-        $text = '<main id="[id]" class="[class]" role="main">';
1934
-    }
1929
+	$tc = get_option('theme_compatibility_setting');
1930
+	if (!empty($tc['geodir_main_content_open_replace'])) {
1931
+		$text = $tc['geodir_main_content_open_replace'];
1932
+	} else {
1933
+		$text = '<main id="[id]" class="[class]" role="main">';
1934
+	}
1935 1935
 
1936
-    if (!empty($tc['geodir_main_content_open_id'])) {
1937
-        $id = $tc['geodir_main_content_open_id'];
1938
-    }
1939
-    if (!empty($tc['geodir_main_content_open_class'])) {
1940
-        $class = $tc['geodir_main_content_open_class'];
1941
-    }
1936
+	if (!empty($tc['geodir_main_content_open_id'])) {
1937
+		$id = $tc['geodir_main_content_open_id'];
1938
+	}
1939
+	if (!empty($tc['geodir_main_content_open_class'])) {
1940
+		$class = $tc['geodir_main_content_open_class'];
1941
+	}
1942 1942
 
1943
-    $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
1943
+	$text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
1944 1944
 
1945
-    echo $text;
1945
+	echo $text;
1946 1946
 }
1947 1947
 
1948 1948
 // action for adding the primary div closing tag
@@ -1955,13 +1955,13 @@  discard block
 block discarded – undo
1955 1955
  */
1956 1956
 function geodir_action_main_content_close()
1957 1957
 {
1958
-    $tc = get_option('theme_compatibility_setting');
1959
-    if (!empty($tc['geodir_main_content_close_replace'])) {
1960
-        $text = $tc['geodir_main_content_close_replace'];
1961
-    } else {
1962
-        $text = '</main><!-- main ends here-->';
1963
-    }
1964
-    echo $text;
1958
+	$tc = get_option('theme_compatibility_setting');
1959
+	if (!empty($tc['geodir_main_content_close_replace'])) {
1960
+		$text = $tc['geodir_main_content_close_replace'];
1961
+	} else {
1962
+		$text = '</main><!-- main ends here-->';
1963
+	}
1964
+	echo $text;
1965 1965
 }
1966 1966
 
1967 1967
 /**
@@ -1973,14 +1973,14 @@  discard block
 block discarded – undo
1973 1973
  */
1974 1974
 function geodir_action_listings_content_inside()
1975 1975
 {
1976
-    global $gridview_columns;
1977
-    $listing_view = get_option('geodir_listing_view');
1978
-    if (strstr($listing_view, 'gridview')) {
1979
-        $gridview_columns = $listing_view;
1980
-        $listing_view_exp = explode('_', $listing_view);
1981
-        $listing_view = $listing_view_exp[0];
1982
-    }
1983
-    geodir_get_template_part('listing', 'listview');
1976
+	global $gridview_columns;
1977
+	$listing_view = get_option('geodir_listing_view');
1978
+	if (strstr($listing_view, 'gridview')) {
1979
+		$gridview_columns = $listing_view;
1980
+		$listing_view_exp = explode('_', $listing_view);
1981
+		$listing_view = $listing_view_exp[0];
1982
+	}
1983
+	geodir_get_template_part('listing', 'listview');
1984 1984
 }
1985 1985
 
1986 1986
 add_action('geodir_listings_content_inside', 'geodir_action_listings_content_inside', 10);
@@ -1996,47 +1996,47 @@  discard block
 block discarded – undo
1996 1996
  */
1997 1997
 function geodir_action_listings_content()
1998 1998
 {
1999
-    /**
2000
-     * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc.
2001
-     *
2002
-     * @since 1.0.0
2003
-     * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
2004
-     * @param string $id The id for the div. Usually 'geodir-main-content'.
2005
-     * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
2006
-     * @see 'geodir_main_content_close' Where the oposing closing tag is added.
2007
-     */
2008
-    do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
2009
-    $extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
2010
-    echo '<div class="clearfix '.$extra_class.'">';
2011
-    /**
2012
-     * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
2013
-     *
2014
-     * @since 1.0.0
2015
-     */
2016
-    do_action('geodir_before_listing');
2017
-    echo '</div>';
2018
-
2019
-    /**
2020
-     * This actions calls the listings list content. Used on listings pages and search and author pages.
2021
-     *
2022
-     * @since 1.0.0
2023
-     */
2024
-    do_action('geodir_listings_content_inside');
2025
-
2026
-    /**
2027
-     * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages.
2028
-     *
2029
-     * @since 1.0.0
2030
-     */
2031
-    do_action('geodir_after_listing');
2032
-
2033
-    /**
2034
-     * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc.
2035
-     *
2036
-     * @since 1.0.0
2037
-     * @see 'geodir_main_content_open' Where the oposing opening tag is added.
2038
-     */
2039
-    do_action('geodir_main_content_close', 'listings-page');
1999
+	/**
2000
+	 * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc.
2001
+	 *
2002
+	 * @since 1.0.0
2003
+	 * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
2004
+	 * @param string $id The id for the div. Usually 'geodir-main-content'.
2005
+	 * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
2006
+	 * @see 'geodir_main_content_close' Where the oposing closing tag is added.
2007
+	 */
2008
+	do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
2009
+	$extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
2010
+	echo '<div class="clearfix '.$extra_class.'">';
2011
+	/**
2012
+	 * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
2013
+	 *
2014
+	 * @since 1.0.0
2015
+	 */
2016
+	do_action('geodir_before_listing');
2017
+	echo '</div>';
2018
+
2019
+	/**
2020
+	 * This actions calls the listings list content. Used on listings pages and search and author pages.
2021
+	 *
2022
+	 * @since 1.0.0
2023
+	 */
2024
+	do_action('geodir_listings_content_inside');
2025
+
2026
+	/**
2027
+	 * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages.
2028
+	 *
2029
+	 * @since 1.0.0
2030
+	 */
2031
+	do_action('geodir_after_listing');
2032
+
2033
+	/**
2034
+	 * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc.
2035
+	 *
2036
+	 * @since 1.0.0
2037
+	 * @see 'geodir_main_content_open' Where the oposing opening tag is added.
2038
+	 */
2039
+	do_action('geodir_main_content_close', 'listings-page');
2040 2040
 }
2041 2041
 
2042 2042
 
@@ -2051,10 +2051,10 @@  discard block
 block discarded – undo
2051 2051
  */
2052 2052
 function geodir_action_sidebar_listings_bottom_section()
2053 2053
 {
2054
-    if (get_option('geodir_show_listing_bottom_section')) { ?>
2054
+	if (get_option('geodir_show_listing_bottom_section')) { ?>
2055 2055
         <div class="<?php
2056
-            /** This action is documented in geodirectory_template_actions.php */
2057
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
2056
+			/** This action is documented in geodirectory_template_actions.php */
2057
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
2058 2058
             <?php dynamic_sidebar('geodir_listing_bottom'); ?>
2059 2059
         </div><!-- clearfix ends here-->
2060 2060
     <?php }
@@ -2074,38 +2074,38 @@  discard block
 block discarded – undo
2074 2074
  */
2075 2075
 function geodir_action_add_listing_page_title()
2076 2076
 {
2077
-    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2078
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2079
-    /** This action is documented in geodirectory_template_actions.php */
2080
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2081
-    /** This action is documented in geodirectory_template_actions.php */
2082
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2083
-
2084
-    $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2085
-
2086
-    if(geodir_is_page('add-listing')){
2087
-        $gd_page = 'add-listing';
2088
-        if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2089
-            $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2090
-        }elseif(isset($listing_type)){
2091
-            $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2092
-        }
2077
+	if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2078
+		$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2079
+	/** This action is documented in geodirectory_template_actions.php */
2080
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2081
+	/** This action is documented in geodirectory_template_actions.php */
2082
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2083
+
2084
+	$title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2085
+
2086
+	if(geodir_is_page('add-listing')){
2087
+		$gd_page = 'add-listing';
2088
+		if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2089
+			$title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2090
+		}elseif(isset($listing_type)){
2091
+			$title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2092
+		}
2093 2093
 
2094
-    }
2094
+	}
2095 2095
 
2096 2096
 
2097
-    /**
2098
-     * Filter page title to replace variables.
2099
-     *
2100
-     * @since 1.5.4
2101
-     * @param string $title The page title including variables.
2102
-     * @param string $gd_page The GeoDirectory page type if any.
2103
-     */
2104
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2097
+	/**
2098
+	 * Filter page title to replace variables.
2099
+	 *
2100
+	 * @since 1.5.4
2101
+	 * @param string $title The page title including variables.
2102
+	 * @param string $gd_page The GeoDirectory page type if any.
2103
+	 */
2104
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2105 2105
 
2106
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2107
-    echo $title;
2108
-    echo '</h1></header>';
2106
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2107
+	echo $title;
2108
+	echo '</h1></header>';
2109 2109
 }
2110 2110
 
2111 2111
 add_action('geodir_add_listing_page_mandatory', 'geodir_action_add_listing_page_mandatory', 10);
@@ -2136,61 +2136,61 @@  discard block
 block discarded – undo
2136 2136
  */
2137 2137
 function geodir_action_add_listing_form()
2138 2138
 {
2139
-    global $cat_display, $post_cat, $current_user, $gd_session;
2140
-    $page_id = get_the_ID();
2141
-    $post = '';
2142
-    $title = '';
2143
-    $desc = '';
2144
-    $kw_tags = '';
2145
-    $required_msg = '';
2146
-    $submit_button = '';
2147
-
2148
-    $ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add';
2149
-
2150
-    $thumb_img_arr = array();
2151
-    $curImages = '';
2152
-
2153
-    if (isset($_REQUEST['backandedit'])) {
2154
-        global $post;
2155
-        $post = (object)$gd_session->get('listing');
2156
-        $listing_type = $post->listing_type;
2157
-        $title = $post->post_title;
2158
-        $desc = $post->post_desc;
2159
-        $post_cat = $post->post_category;
2160
-
2161
-        $kw_tags = $post->post_tags;
2162
-        $curImages = isset($post->post_images) ? $post->post_images : '';
2163
-    } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2164
-        global $post, $post_images;
2165
-
2166
-        $post = geodir_get_post_info($_REQUEST['pid']);
2167
-        $thumb_img_arr = geodir_get_images($post->ID);
2168
-        if ($thumb_img_arr) {
2169
-            foreach ($thumb_img_arr as $post_img) {
2170
-                $curImages .= $post_img->src . ',';
2171
-            }
2172
-        }
2139
+	global $cat_display, $post_cat, $current_user, $gd_session;
2140
+	$page_id = get_the_ID();
2141
+	$post = '';
2142
+	$title = '';
2143
+	$desc = '';
2144
+	$kw_tags = '';
2145
+	$required_msg = '';
2146
+	$submit_button = '';
2147
+
2148
+	$ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add';
2149
+
2150
+	$thumb_img_arr = array();
2151
+	$curImages = '';
2152
+
2153
+	if (isset($_REQUEST['backandedit'])) {
2154
+		global $post;
2155
+		$post = (object)$gd_session->get('listing');
2156
+		$listing_type = $post->listing_type;
2157
+		$title = $post->post_title;
2158
+		$desc = $post->post_desc;
2159
+		$post_cat = $post->post_category;
2160
+
2161
+		$kw_tags = $post->post_tags;
2162
+		$curImages = isset($post->post_images) ? $post->post_images : '';
2163
+	} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2164
+		global $post, $post_images;
2165
+
2166
+		$post = geodir_get_post_info($_REQUEST['pid']);
2167
+		$thumb_img_arr = geodir_get_images($post->ID);
2168
+		if ($thumb_img_arr) {
2169
+			foreach ($thumb_img_arr as $post_img) {
2170
+				$curImages .= $post_img->src . ',';
2171
+			}
2172
+		}
2173 2173
 
2174
-        $listing_type = $post->post_type;
2175
-        $title = $post->post_title;
2176
-        $desc = $post->post_content;
2177
-        $kw_tags = $post->post_tags;
2178
-        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2179
-    } else {
2180
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2181
-    }
2174
+		$listing_type = $post->post_type;
2175
+		$title = $post->post_title;
2176
+		$desc = $post->post_content;
2177
+		$kw_tags = $post->post_tags;
2178
+		$kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2179
+	} else {
2180
+		$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2181
+	}
2182 2182
 
2183
-    if ($current_user->ID != '0') {
2184
-        $user_login = true;
2185
-    }
2183
+	if ($current_user->ID != '0') {
2184
+		$user_login = true;
2185
+	}
2186 2186
 
2187
-    $post_type_info = geodir_get_posttype_info($listing_type);
2187
+	$post_type_info = geodir_get_posttype_info($listing_type);
2188 2188
 
2189
-    $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing','geodirectory');
2189
+	$cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing','geodirectory');
2190 2190
     
2191
-    $package_info = array();
2192
-    $package_info = geodir_post_package_info($package_info, $post);
2193
-    ?>
2191
+	$package_info = array();
2192
+	$package_info = geodir_post_package_info($package_info, $post);
2193
+	?>
2194 2194
     <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data">
2195 2195
         <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/>
2196 2196
         <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/>
@@ -2201,114 +2201,114 @@  discard block
 block discarded – undo
2201 2201
         <?php } if (isset($_REQUEST['backandedit'])) { ?>
2202 2202
             <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/>
2203 2203
         <?php
2204
-        } 
2205
-        /**
2206
-         * Called at the very top of the add listing page form for frontend.
2207
-         *
2208
-         * This is called just before the "Enter Listing Details" text.
2209
-         *
2210
-         * @since 1.0.0
2211
-         */
2212
-        do_action('geodir_before_detail_fields');
2213
-        ?>
2204
+		} 
2205
+		/**
2206
+		 * Called at the very top of the add listing page form for frontend.
2207
+		 *
2208
+		 * This is called just before the "Enter Listing Details" text.
2209
+		 *
2210
+		 * @since 1.0.0
2211
+		 */
2212
+		do_action('geodir_before_detail_fields');
2213
+		?>
2214 2214
         <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5>
2215 2215
         <?php
2216
-        /**
2217
-         * Called at the top of the add listing page form for frontend.
2218
-         *
2219
-         * This is called after the "Enter Listing Details" text.
2220
-         *
2221
-         * @since 1.0.0
2222
-         */
2223
-        do_action('geodir_before_main_form_fields');
2224
-        ?>
2216
+		/**
2217
+		 * Called at the top of the add listing page form for frontend.
2218
+		 *
2219
+		 * This is called after the "Enter Listing Details" text.
2220
+		 *
2221
+		 * @since 1.0.0
2222
+		 */
2223
+		do_action('geodir_before_main_form_fields');
2224
+		?>
2225 2225
         <div id="geodir_post_title_row" class="required_field geodir_form_row clearfix gd-fieldset-details">
2226 2226
             <label><?php
2227
-                /**
2228
-                 * Filter the add listing page title input label.
2229
-                 *
2230
-                 * @since 1.6.11
2231
-                 * @param string $title The title to be output.
2232
-                 * @param string $cpt_singular_name The singular title of the curent CPT.
2233
-                 * @param string $listing_type The CPT being requested. ie: gd_place.
2234
-                 */
2235
-                echo apply_filters('geodir_add_listing_title_label', sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span>*</span> </label>
2227
+				/**
2228
+				 * Filter the add listing page title input label.
2229
+				 *
2230
+				 * @since 1.6.11
2231
+				 * @param string $title The title to be output.
2232
+				 * @param string $cpt_singular_name The singular title of the curent CPT.
2233
+				 * @param string $listing_type The CPT being requested. ie: gd_place.
2234
+				 */
2235
+				echo apply_filters('geodir_add_listing_title_label', sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span>*</span> </label>
2236 2236
             <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield"
2237 2237
                    value="<?php echo esc_attr(stripslashes($title)); ?>"/>
2238 2238
             <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span>
2239 2239
         </div>
2240 2240
         <?php
2241
-        $show_editor = get_option('geodir_tiny_editor_on_add_listing');
2242
-        $show_editor = !empty($show_editor) && in_array($listing_type, $show_editor) ? true : false;
2243
-        /**
2244
-         * Filter whether to show or don't show the editor.
2245
-         *
2246
-         * @since 1.6.16
2247
-         * @param bool $show_editor If true the editor will be available for description field.
2248
-         * @param object $package_info The listing package.
2249
-         * @param string $listing_type The current post type.
2250
-         * @param object $post The current post object.
2251
-         */
2252
-        $show_editor = apply_filters('geodir_description_field_show_editor', $show_editor, $package_info, $listing_type, $post);
2253
-
2254
-        $desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc));
2255
-        $desc_limit = '';
2256
-        /**
2257
-         * Filter the add listing description field character limit number.
2258
-         *
2259
-         * @since 1.0.0
2260
-         * @param int $desc_limit The amount of characters to limit the description to.
2261
-         */
2262
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
2263
-        /**
2264
-         * Filter the add listing description field text.
2265
-         *
2266
-         * @since 1.0.0
2267
-         * @param string $desc The text for the description field.
2268
-         * @param int $desc_limit The character limit number if any.
2269
-         */
2270
-        $desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
2271
-        $desc_limit_msg = '';
2272
-        /**
2273
-         * Filter the add listing description limit message.
2274
-         *
2275
-         * This is the message shown if there is a limit applied to the amount of characters the description can use.
2276
-         *
2277
-         * @since 1.0.0
2278
-         * @param string $desc_limit_msg The limit message string if any.
2279
-         * @param int $desc_limit The character limit numer if any.
2280
-         */
2281
-        $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2241
+		$show_editor = get_option('geodir_tiny_editor_on_add_listing');
2242
+		$show_editor = !empty($show_editor) && in_array($listing_type, $show_editor) ? true : false;
2243
+		/**
2244
+		 * Filter whether to show or don't show the editor.
2245
+		 *
2246
+		 * @since 1.6.16
2247
+		 * @param bool $show_editor If true the editor will be available for description field.
2248
+		 * @param object $package_info The listing package.
2249
+		 * @param string $listing_type The current post type.
2250
+		 * @param object $post The current post object.
2251
+		 */
2252
+		$show_editor = apply_filters('geodir_description_field_show_editor', $show_editor, $package_info, $listing_type, $post);
2253
+
2254
+		$desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc));
2255
+		$desc_limit = '';
2256
+		/**
2257
+		 * Filter the add listing description field character limit number.
2258
+		 *
2259
+		 * @since 1.0.0
2260
+		 * @param int $desc_limit The amount of characters to limit the description to.
2261
+		 */
2262
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
2263
+		/**
2264
+		 * Filter the add listing description field text.
2265
+		 *
2266
+		 * @since 1.0.0
2267
+		 * @param string $desc The text for the description field.
2268
+		 * @param int $desc_limit The character limit number if any.
2269
+		 */
2270
+		$desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
2271
+		$desc_limit_msg = '';
2272
+		/**
2273
+		 * Filter the add listing description limit message.
2274
+		 *
2275
+		 * This is the message shown if there is a limit applied to the amount of characters the description can use.
2276
+		 *
2277
+		 * @since 1.0.0
2278
+		 * @param string $desc_limit_msg The limit message string if any.
2279
+		 * @param int $desc_limit The character limit numer if any.
2280
+		 */
2281
+		$desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2282 2282
         
2283
-        $desc_class = '';
2284
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2285
-            /**
2286
-             * Called on the add listing page form for frontend just before the description field.
2287
-             *
2288
-             * @since 1.0.0
2289
-             */
2290
-            do_action('geodir_before_description_field');
2283
+		$desc_class = '';
2284
+		if ($desc_limit === '' || (int)$desc_limit > 0) {
2285
+			/**
2286
+			 * Called on the add listing page form for frontend just before the description field.
2287
+			 *
2288
+			 * @since 1.0.0
2289
+			 */
2290
+			do_action('geodir_before_description_field');
2291 2291
             
2292
-            $desc_class = ' required_field';
2293
-        } else {
2294
-            $desc_class = ' hidden';
2295
-        }
2296
-        ?>
2292
+			$desc_class = ' required_field';
2293
+		} else {
2294
+			$desc_class = ' hidden';
2295
+		}
2296
+		?>
2297 2297
         <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>">
2298 2298
             <label><?php
2299
-                /**
2300
-                 * Filter the add listing page description input label.
2301
-                 *
2302
-                 * @since 1.6.11
2303
-                 * @param string $title The title to be output.
2304
-                 * @param string $cpt_singular_name The singular title of the curent CPT.
2305
-                 * @param string $listing_type The CPT being requested. ie: gd_place.
2306
-                 */
2307
-                echo apply_filters('geodir_add_listing_description_label',sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2299
+				/**
2300
+				 * Filter the add listing page description input label.
2301
+				 *
2302
+				 * @since 1.6.11
2303
+				 * @param string $title The title to be output.
2304
+				 * @param string $cpt_singular_name The singular title of the curent CPT.
2305
+				 * @param string $listing_type The CPT being requested. ie: gd_place.
2306
+				 */
2307
+				echo apply_filters('geodir_add_listing_description_label',sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2308 2308
             <?php
2309
-            if ($show_editor) {
2310
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2311
-            ?>
2309
+			if ($show_editor) {
2310
+				$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2311
+			?>
2312 2312
                 <div class="editor" field_id="post_desc" field_type="editor">
2313 2313
                     <?php wp_editor($desc, "post_desc", $editor_settings); ?>
2314 2314
                 </div>
@@ -2322,56 +2322,56 @@  discard block
 block discarded – undo
2322 2322
             <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span>
2323 2323
         </div>
2324 2324
         <?php
2325
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2326
-            /**
2327
-             * Called on the add listing page form for frontend just after the description field.
2328
-             *
2329
-             * @since 1.0.0
2330
-             */
2331
-            do_action('geodir_after_description_field');
2332
-        }
2325
+		if ($desc_limit === '' || (int)$desc_limit > 0) {
2326
+			/**
2327
+			 * Called on the add listing page form for frontend just after the description field.
2328
+			 *
2329
+			 * @since 1.0.0
2330
+			 */
2331
+			do_action('geodir_after_description_field');
2332
+		}
2333 2333
         
2334
-        $kw_tags = esc_attr(stripslashes($kw_tags));
2335
-        $kw_tags_count = TAGKW_TEXT_COUNT;
2336
-        $kw_tags_msg = TAGKW_MSG;
2337
-        /**
2338
-         * Filter the add listing tags character limit.
2339
-         *
2340
-         * @since 1.0.0
2341
-         * @param int $kw_tags_count The character count limit if any.
2342
-         */
2343
-        $kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
2344
-        /**
2345
-         * Filter the add listing tags field value.
2346
-         *
2347
-         * You can use the $_REQUEST values to check if this is a go back and edit value etc.
2348
-         *
2349
-         * @since 1.0.0
2350
-         * @param string $kw_tags The tag field value, usually a comma separated list of tags.
2351
-         * @param int $kw_tags_count The character count limit if any.
2352
-         */
2353
-        $kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
2354
-        /**
2355
-         * Filter the add listing tags field message text.
2356
-         *
2357
-         * @since 1.0.0
2358
-         * @param string $kw_tags_msg The message shown under the field.
2359
-         * @param int $kw_tags_count The character count limit if any.
2360
-         */
2361
-        $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2334
+		$kw_tags = esc_attr(stripslashes($kw_tags));
2335
+		$kw_tags_count = TAGKW_TEXT_COUNT;
2336
+		$kw_tags_msg = TAGKW_MSG;
2337
+		/**
2338
+		 * Filter the add listing tags character limit.
2339
+		 *
2340
+		 * @since 1.0.0
2341
+		 * @param int $kw_tags_count The character count limit if any.
2342
+		 */
2343
+		$kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
2344
+		/**
2345
+		 * Filter the add listing tags field value.
2346
+		 *
2347
+		 * You can use the $_REQUEST values to check if this is a go back and edit value etc.
2348
+		 *
2349
+		 * @since 1.0.0
2350
+		 * @param string $kw_tags The tag field value, usually a comma separated list of tags.
2351
+		 * @param int $kw_tags_count The character count limit if any.
2352
+		 */
2353
+		$kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
2354
+		/**
2355
+		 * Filter the add listing tags field message text.
2356
+		 *
2357
+		 * @since 1.0.0
2358
+		 * @param string $kw_tags_msg The message shown under the field.
2359
+		 * @param int $kw_tags_count The character count limit if any.
2360
+		 */
2361
+		$kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2362 2362
         
2363
-        $tags_class = '';
2364
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2365
-            /**
2366
-             * Called on the add listing page form for frontend just before the tags field.
2367
-             *
2368
-             * @since 1.0.0
2369
-             */
2370
-            do_action('geodir_before_listing_tags_field');
2371
-        } else {
2372
-            $tags_class = ' hidden';
2373
-        }
2374
-        ?>
2363
+		$tags_class = '';
2364
+		if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2365
+			/**
2366
+			 * Called on the add listing page form for frontend just before the tags field.
2367
+			 *
2368
+			 * @since 1.0.0
2369
+			 */
2370
+			do_action('geodir_before_listing_tags_field');
2371
+		} else {
2372
+			$tags_class = ' hidden';
2373
+		}
2374
+		?>
2375 2375
         <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>">
2376 2376
             <label><?php echo TAGKW_TEXT; ?></label>
2377 2377
             <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield"
@@ -2379,90 +2379,90 @@  discard block
 block discarded – undo
2379 2379
             <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span>
2380 2380
         </div>
2381 2381
         <?php
2382
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2383
-            /**
2384
-             * Called on the add listing page form for frontend just after the tags field.
2385
-             *
2386
-             * @since 1.0.0
2387
-             */
2388
-            do_action('geodir_after_listing_tags_field');
2389
-        }
2382
+		if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2383
+			/**
2384
+			 * Called on the add listing page form for frontend just after the tags field.
2385
+			 *
2386
+			 * @since 1.0.0
2387
+			 */
2388
+			do_action('geodir_after_listing_tags_field');
2389
+		}
2390 2390
         
2391
-        $package_info = array();
2392
-        $package_info = geodir_post_package_info($package_info, $post);
2391
+		$package_info = array();
2392
+		$package_info = geodir_post_package_info($package_info, $post);
2393 2393
         
2394
-        geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type);
2394
+		geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type);
2395 2395
         
2396
-        // adjust values here
2397
-        $id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
2396
+		// adjust values here
2397
+		$id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
2398 2398
 
2399
-        $multiple = true; // allow multiple files upload
2399
+		$multiple = true; // allow multiple files upload
2400 2400
 
2401
-        $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2401
+		$width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2402 2402
 
2403
-        $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2403
+		$height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2404 2404
 
2405
-        $thumb_img_arr = array();
2406
-        $totImg = 0;
2407
-        if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2408
-            $post = (object)$gd_session->get('listing');
2409
-            if (isset($post->post_images))
2410
-                $curImages = trim($post->post_images, ",");
2405
+		$thumb_img_arr = array();
2406
+		$totImg = 0;
2407
+		if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2408
+			$post = (object)$gd_session->get('listing');
2409
+			if (isset($post->post_images))
2410
+				$curImages = trim($post->post_images, ",");
2411 2411
 
2412 2412
 
2413
-            if ($curImages != '') {
2414
-                $curImages_array = explode(',', $curImages);
2415
-                $totImg = count($curImages_array);
2416
-            }
2413
+			if ($curImages != '') {
2414
+				$curImages_array = explode(',', $curImages);
2415
+				$totImg = count($curImages_array);
2416
+			}
2417 2417
 
2418
-            $listing_type = $post->listing_type;
2418
+			$listing_type = $post->listing_type;
2419 2419
 
2420
-        } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2421
-            $post = geodir_get_post_info((int)$_REQUEST['pid']);
2422
-            $listing_type = $post->post_type;
2423
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2420
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2421
+			$post = geodir_get_post_info((int)$_REQUEST['pid']);
2422
+			$listing_type = $post->post_type;
2423
+			$thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2424 2424
 
2425
-        } else {
2426
-            $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2427
-        }
2425
+		} else {
2426
+			$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2427
+		}
2428 2428
 
2429 2429
 
2430
-        if (!empty($thumb_img_arr)) {
2431
-            foreach ($thumb_img_arr as $img) {
2432
-                //$curImages = $img->src.",";
2433
-            }
2434
-
2435
-            $totImg = count((array)$thumb_img_arr);
2436
-        }
2430
+		if (!empty($thumb_img_arr)) {
2431
+			foreach ($thumb_img_arr as $img) {
2432
+				//$curImages = $img->src.",";
2433
+			}
2437 2434
 
2438
-        if ($curImages != '')
2439
-            $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2440
-        else
2441
-            $svalue = '';
2442
-
2443
-        $image_limit = isset($package_info->image_limit) ? $package_info->image_limit : '0';
2444
-        $show_image_input_box = ($image_limit != '0');
2445
-        /**
2446
-         * Filter to be able to show/hide the image upload section of the add listing form.
2447
-         *
2448
-         * @since 1.0.0
2449
-         * @param bool $show_image_input_box Set true to show. Set false to not show.
2450
-         * @param string $listing_type The custom post type slug.
2451
-         */
2452
-        $show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
2453
-        if ($show_image_input_box) {
2454
-            ?>
2435
+			$totImg = count((array)$thumb_img_arr);
2436
+		}
2437
+
2438
+		if ($curImages != '')
2439
+			$svalue = $curImages; // this will be initial value of the above form field. Image urls.
2440
+		else
2441
+			$svalue = '';
2442
+
2443
+		$image_limit = isset($package_info->image_limit) ? $package_info->image_limit : '0';
2444
+		$show_image_input_box = ($image_limit != '0');
2445
+		/**
2446
+		 * Filter to be able to show/hide the image upload section of the add listing form.
2447
+		 *
2448
+		 * @since 1.0.0
2449
+		 * @param bool $show_image_input_box Set true to show. Set false to not show.
2450
+		 * @param string $listing_type The custom post type slug.
2451
+		 */
2452
+		$show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
2453
+		if ($show_image_input_box) {
2454
+			?>
2455 2455
 
2456 2456
             <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?>
2457 2457
                 <?php if ($image_limit == 1) {
2458
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2459
-                } ?>
2458
+					echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2459
+				} ?>
2460 2460
                 <?php if ($image_limit > 1) {
2461
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2462
-                } ?>
2461
+					echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2462
+				} ?>
2463 2463
                 <?php if ($image_limit == '') {
2464
-                    echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2465
-                } ?>
2464
+					echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2465
+				} ?>
2466 2466
             </h5>
2467 2467
 
2468 2468
             <div class="geodir_form_row clearfix" id="<?php echo $id; ?>dropbox"
@@ -2500,12 +2500,12 @@  discard block
 block discarded – undo
2500 2500
         <?php } ?>
2501 2501
 
2502 2502
         <?php
2503
-        /**
2504
-         * Called on the add listing page form for frontend just after the image upload field.
2505
-         *
2506
-         * @since 1.0.0
2507
-         */
2508
-        do_action('geodir_after_main_form_fields');?>
2503
+		/**
2504
+		 * Called on the add listing page form for frontend just after the image upload field.
2505
+		 *
2506
+		 * @since 1.0.0
2507
+		 */
2508
+		do_action('geodir_after_main_form_fields');?>
2509 2509
 
2510 2510
 
2511 2511
         <!-- add captcha code -->
@@ -2534,7 +2534,7 @@  discard block
 block discarded – undo
2534 2534
 
2535 2535
     </form>
2536 2536
     <?php
2537
-    wp_reset_query();
2537
+	wp_reset_query();
2538 2538
 }
2539 2539
 
2540 2540
 /**
@@ -2545,7 +2545,7 @@  discard block
 block discarded – undo
2545 2545
  */
2546 2546
 function geodir_add_listing_sidebar_widget_area()
2547 2547
 {
2548
-    dynamic_sidebar('geodir_add_listing_sidebar');
2548
+	dynamic_sidebar('geodir_add_listing_sidebar');
2549 2549
 }
2550 2550
 
2551 2551
 add_action('geodir_add_listing_sidebar_inside', 'geodir_add_listing_sidebar_widget_area', 10);
@@ -2560,16 +2560,16 @@  discard block
 block discarded – undo
2560 2560
  */
2561 2561
 function geodir_action_add_listing_sidebar()
2562 2562
 {
2563
-    /** This action is documented in geodirectory_template_actions.php */
2564
-    do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
2565
-    /**
2566
-     * This is used to add the content to the add listing page sidebar.
2567
-     *
2568
-     * @since 1.0.0
2569
-     */
2570
-    do_action('geodir_add_listing_sidebar_inside');
2571
-    /** This action is documented in geodirectory_template_actions.php */
2572
-    do_action('geodir_sidebar_right_close', 'details-page');
2563
+	/** This action is documented in geodirectory_template_actions.php */
2564
+	do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
2565
+	/**
2566
+	 * This is used to add the content to the add listing page sidebar.
2567
+	 *
2568
+	 * @since 1.0.0
2569
+	 */
2570
+	do_action('geodir_add_listing_sidebar_inside');
2571
+	/** This action is documented in geodirectory_template_actions.php */
2572
+	do_action('geodir_sidebar_right_close', 'details-page');
2573 2573
 }
2574 2574
 
2575 2575
 ###############################################
@@ -2586,11 +2586,11 @@  discard block
 block discarded – undo
2586 2586
  */
2587 2587
 function geodir_action_geodir_sidebar_signup_top()
2588 2588
 {
2589
-    ?>
2589
+	?>
2590 2590
     <div
2591 2591
         class="<?php
2592
-        /** This action is documented in geodirectory_template_actions.php */
2593
-        echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2592
+		/** This action is documented in geodirectory_template_actions.php */
2593
+		echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2594 2594
         <?php dynamic_sidebar('Reg/Login Top Section');?>
2595 2595
     </div><!-- clearfix ends here-->
2596 2596
 <?php
@@ -2609,11 +2609,11 @@  discard block
 block discarded – undo
2609 2609
 function geodir_action_signup_forms()
2610 2610
 {
2611 2611
 
2612
-    global $user_login;
2612
+	global $user_login;
2613 2613
     
2614
-    $is_enable_signup = get_option( 'users_can_register' );
2614
+	$is_enable_signup = get_option( 'users_can_register' );
2615 2615
     
2616
-    ?>
2616
+	?>
2617 2617
     <script type="text/javascript">
2618 2618
         <?php if ( $user_login ) { ?>
2619 2619
         setTimeout(function () {
@@ -2649,67 +2649,67 @@  discard block
 block discarded – undo
2649 2649
         <?php } ?>
2650 2650
     </script><?php
2651 2651
 
2652
-    global $errors;
2653
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2654
-        $errors->add('claim_login', LOGIN_CLAIM);
2655
-
2656
-    if (!empty($errors)) {
2657
-        foreach ($errors as $errorsObj) {
2658
-            foreach ($errorsObj as $key => $val) {
2659
-                for ($i = 0; $i < count($val); $i++) {
2660
-                    echo "<div class=error_msg_fix>" . $val[$i] . '</div>';
2661
-                    $registration_error_msg = 1;
2662
-                }
2663
-            }
2664
-        }
2665
-    }
2652
+	global $errors;
2653
+	if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2654
+		$errors->add('claim_login', LOGIN_CLAIM);
2655
+
2656
+	if (!empty($errors)) {
2657
+		foreach ($errors as $errorsObj) {
2658
+			foreach ($errorsObj as $key => $val) {
2659
+				for ($i = 0; $i < count($val); $i++) {
2660
+					echo "<div class=error_msg_fix>" . $val[$i] . '</div>';
2661
+					$registration_error_msg = 1;
2662
+				}
2663
+			}
2664
+		}
2665
+	}
2666 2666
 
2667
-    if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
2668
-        ?>
2667
+	if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
2668
+		?>
2669 2669
 
2670 2670
         <div class="login_form">
2671 2671
             <?php
2672
-            /**
2673
-             * Contains login form template.
2674
-             *
2675
-             * @since 1.0.0
2676
-             */
2677
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2672
+			/**
2673
+			 * Contains login form template.
2674
+			 *
2675
+			 * @since 1.0.0
2676
+			 */
2677
+			include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2678 2678
         </div>
2679 2679
 
2680 2680
     <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up' && $is_enable_signup ) { ?>
2681 2681
 
2682 2682
         <div class="registration_form">
2683 2683
             <?php
2684
-            /**
2685
-             * Contains registration form template.
2686
-             *
2687
-             * @since 1.0.0
2688
-             */
2689
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2684
+			/**
2685
+			 * Contains registration form template.
2686
+			 *
2687
+			 * @since 1.0.0
2688
+			 */
2689
+			include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2690 2690
         </div>
2691 2691
 
2692 2692
     <?php } else { ?>
2693 2693
 
2694 2694
         <div class="login_form_l">
2695 2695
             <?php
2696
-            /**
2697
-             * Contains login form template.
2698
-             *
2699
-             * @since 1.0.0
2700
-             */
2701
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2696
+			/**
2697
+			 * Contains login form template.
2698
+			 *
2699
+			 * @since 1.0.0
2700
+			 */
2701
+			include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2702 2702
         </div>
2703 2703
         
2704 2704
         <?php if ( $is_enable_signup ) { ?>
2705 2705
             <div class="registration_form_r">
2706 2706
                 <?php
2707
-                /**
2708
-                 * Contains registration form template.
2709
-                 *
2710
-                 * @since 1.0.0
2711
-                 */
2712
-                include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2707
+				/**
2708
+				 * Contains registration form template.
2709
+				 *
2710
+				 * @since 1.0.0
2711
+				 */
2712
+				include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2713 2713
             </div>
2714 2714
         <?php } ?>
2715 2715
 
@@ -2741,66 +2741,66 @@  discard block
 block discarded – undo
2741 2741
  */
2742 2742
 function geodir_action_author_page_title()
2743 2743
 {
2744
-    global $term;
2744
+	global $term;
2745 2745
 
2746
-    $gd_post_type = geodir_get_current_posttype();
2747
-    $post_type_info = get_post_type_object($gd_post_type);
2746
+	$gd_post_type = geodir_get_current_posttype();
2747
+	$post_type_info = get_post_type_object($gd_post_type);
2748 2748
 
2749
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
2750
-    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2751
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2752
-    }
2749
+	$add_string_in_title = __('All', 'geodirectory') . ' ';
2750
+	if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2751
+		$add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2752
+	}
2753 2753
 
2754
-    $list_title = $add_string_in_title . $post_type_info->labels->name;
2755
-    $single_name = $post_type_info->labels->singular_name;
2754
+	$list_title = $add_string_in_title . $post_type_info->labels->name;
2755
+	$single_name = $post_type_info->labels->singular_name;
2756 2756
 
2757
-    $taxonomy = geodir_get_taxonomies($gd_post_type);
2757
+	$taxonomy = geodir_get_taxonomies($gd_post_type);
2758 2758
 
2759
-    if (!empty($term)) {
2760
-        $current_term = get_term_by('slug', $term, $taxonomy[0]);
2761
-        if (!empty($current_term))
2762
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2763
-    }
2759
+	if (!empty($term)) {
2760
+		$current_term = get_term_by('slug', $term, $taxonomy[0]);
2761
+		if (!empty($current_term))
2762
+			$list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2763
+	}
2764 2764
 
2765 2765
 
2766
-    if (is_search()) {
2767
-        $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2766
+	if (is_search()) {
2767
+		$list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2768 2768
 
2769
-    }
2770
-    /** This action is documented in geodirectory_template_actions.php */
2771
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2772
-    /** This action is documented in geodirectory_template_actions.php */
2773
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2769
+	}
2770
+	/** This action is documented in geodirectory_template_actions.php */
2771
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2772
+	/** This action is documented in geodirectory_template_actions.php */
2773
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2774 2774
 
2775
-    $title = $list_title;
2776
-    if(geodir_is_page('author')){
2777
-        $gd_page = 'author';
2778
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2779
-            $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2780
-        }else{
2781
-            $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2782
-        }
2775
+	$title = $list_title;
2776
+	if(geodir_is_page('author')){
2777
+		$gd_page = 'author';
2778
+		if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2779
+			$title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2780
+		}else{
2781
+			$title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2782
+		}
2783 2783
 
2784
-    }
2784
+	}
2785 2785
 
2786 2786
 
2787
-    /**
2788
-     * Filter page title to replace variables.
2789
-     *
2790
-     * @since 1.5.4
2791
-     * @param string $title The page title including variables.
2792
-     * @param string $gd_page The GeoDirectory page type if any.
2793
-     */
2794
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2787
+	/**
2788
+	 * Filter page title to replace variables.
2789
+	 *
2790
+	 * @since 1.5.4
2791
+	 * @param string $title The page title including variables.
2792
+	 * @param string $gd_page The GeoDirectory page type if any.
2793
+	 */
2794
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2795 2795
 
2796
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2797
-        /**
2798
-         * Filter the author page title text.
2799
-         *
2800
-         * @since 1.0.0
2801
-         * @param string $list_title The title for the page.
2802
-         */
2803
-        apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2796
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2797
+		/**
2798
+		 * Filter the author page title text.
2799
+		 *
2800
+		 * @since 1.0.0
2801
+		 * @param string $list_title The title for the page.
2802
+		 */
2803
+		apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2804 2804
 }
2805 2805
 
2806 2806
 
@@ -2818,11 +2818,11 @@  discard block
 block discarded – undo
2818 2818
  */
2819 2819
 function geodir_action_geodir_sidebar_author_top()
2820 2820
 {
2821
-    if (get_option('geodir_show_author_top_section')) { ?>
2821
+	if (get_option('geodir_show_author_top_section')) { ?>
2822 2822
         <div
2823 2823
             class="<?php
2824
-            /** This action is documented in geodirectory_template_actions.php */
2825
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
2824
+			/** This action is documented in geodirectory_template_actions.php */
2825
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
2826 2826
             <?php dynamic_sidebar('geodir_author_top'); ?>
2827 2827
         </div><!-- clearfix ends here-->
2828 2828
     <?php }
@@ -2838,7 +2838,7 @@  discard block
 block discarded – undo
2838 2838
  */
2839 2839
 function geodir_author_left_section()
2840 2840
 {
2841
-    if (get_option('geodir_show_author_left_section')) { ?>
2841
+	if (get_option('geodir_show_author_left_section')) { ?>
2842 2842
         <div class="geodir-content-left geodir-sidebar-wrap">
2843 2843
             <?php dynamic_sidebar('geodir_author_left_sidebar'); ?>
2844 2844
         </div><!-- end geodir-content-left -->
@@ -2859,19 +2859,19 @@  discard block
 block discarded – undo
2859 2859
  */
2860 2860
 function geodir_action_author_sidebar_left()
2861 2861
 {
2862
-    if (get_option('geodir_show_author_left_section')) {
2862
+	if (get_option('geodir_show_author_left_section')) {
2863 2863
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
2864
-        /** This action is documented in geodirectory_template_actions.php */
2865
-        do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
2866
-        /**
2867
-         * This is used to add the content to the author page left sidebar (if active).
2868
-         *
2869
-         * @since 1.0.0
2870
-         */
2871
-        do_action('geodir_author_sidebar_left_inside');
2872
-        /** This action is documented in geodirectory_template_actions.php */
2873
-        do_action('geodir_sidebar_left_close', 'author-page');
2874
-    }
2864
+		/** This action is documented in geodirectory_template_actions.php */
2865
+		do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
2866
+		/**
2867
+		 * This is used to add the content to the author page left sidebar (if active).
2868
+		 *
2869
+		 * @since 1.0.0
2870
+		 */
2871
+		do_action('geodir_author_sidebar_left_inside');
2872
+		/** This action is documented in geodirectory_template_actions.php */
2873
+		do_action('geodir_sidebar_left_close', 'author-page');
2874
+	}
2875 2875
 }
2876 2876
 
2877 2877
 /**
@@ -2884,7 +2884,7 @@  discard block
 block discarded – undo
2884 2884
  */
2885 2885
 function geodir_author_right_section()
2886 2886
 {
2887
-    if (get_option('geodir_show_author_right_section')) { ?>
2887
+	if (get_option('geodir_show_author_right_section')) { ?>
2888 2888
         <div class="geodir-content-right geodir-sidebar-wrap">
2889 2889
             <?php dynamic_sidebar('geodir_author_right_sidebar'); ?>
2890 2890
         </div><!-- end geodir-content-right -->
@@ -2904,18 +2904,18 @@  discard block
 block discarded – undo
2904 2904
  */
2905 2905
 function geodir_action_author_sidebar_right()
2906 2906
 {
2907
-    if (get_option('geodir_show_author_right_section')) {
2908
-        /** This action is documented in geodirectory_template_actions.php */
2909
-        do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
2910
-        /**
2911
-         * This is used to add the content to the author page right sidebar (if active).
2912
-         *
2913
-         * @since 1.0.0
2914
-         */
2915
-        do_action('geodir_author_sidebar_right_inside');
2916
-        /** This action is documented in geodirectory_template_actions.php */
2917
-        do_action('geodir_sidebar_right_close', 'author-page');
2918
-    }
2907
+	if (get_option('geodir_show_author_right_section')) {
2908
+		/** This action is documented in geodirectory_template_actions.php */
2909
+		do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
2910
+		/**
2911
+		 * This is used to add the content to the author page right sidebar (if active).
2912
+		 *
2913
+		 * @since 1.0.0
2914
+		 */
2915
+		do_action('geodir_author_sidebar_right_inside');
2916
+		/** This action is documented in geodirectory_template_actions.php */
2917
+		do_action('geodir_sidebar_right_close', 'author-page');
2918
+	}
2919 2919
 }
2920 2920
 
2921 2921
 /**
@@ -2927,14 +2927,14 @@  discard block
 block discarded – undo
2927 2927
  */
2928 2928
 function geodir_action_author_content_inside()
2929 2929
 {
2930
-    global $gridview_columns;
2931
-    $listing_view = get_option('geodir_author_view');
2932
-    if (strstr($listing_view, 'gridview')) {
2933
-        $gridview_columns = $listing_view;
2934
-        $listing_view_exp = explode('_', $listing_view);
2935
-        $listing_view = $listing_view_exp[0];
2936
-    }
2937
-    geodir_get_template_part('listing', 'listview');
2930
+	global $gridview_columns;
2931
+	$listing_view = get_option('geodir_author_view');
2932
+	if (strstr($listing_view, 'gridview')) {
2933
+		$gridview_columns = $listing_view;
2934
+		$listing_view_exp = explode('_', $listing_view);
2935
+		$listing_view = $listing_view_exp[0];
2936
+	}
2937
+	geodir_get_template_part('listing', 'listview');
2938 2938
 }
2939 2939
 
2940 2940
 add_action('geodir_author_content_inside', 'geodir_action_author_content_inside', 10);
@@ -2949,22 +2949,22 @@  discard block
 block discarded – undo
2949 2949
  */
2950 2950
 function geodir_action_author_content()
2951 2951
 {
2952
-    /** This action is documented in geodirectory_template_actions.php */
2953
-    do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
2954
-    echo '<div class="clearfix">';
2955
-    /** This action is documented in geodirectory_template_actions.php */
2956
-    do_action('geodir_before_listing');
2957
-    echo '</div>';
2958
-    /**
2959
-     * This is used to add the content to the author page main content.
2960
-     *
2961
-     * @since 1.0.0
2962
-     */
2963
-    do_action('geodir_author_content_inside');
2964
-    /** This action is documented in geodirectory_template_actions.php */
2965
-    do_action('geodir_after_listing');
2966
-    /** This action is documented in geodirectory_template_actions.php */
2967
-    do_action('geodir_main_content_close', 'author-page');
2952
+	/** This action is documented in geodirectory_template_actions.php */
2953
+	do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
2954
+	echo '<div class="clearfix">';
2955
+	/** This action is documented in geodirectory_template_actions.php */
2956
+	do_action('geodir_before_listing');
2957
+	echo '</div>';
2958
+	/**
2959
+	 * This is used to add the content to the author page main content.
2960
+	 *
2961
+	 * @since 1.0.0
2962
+	 */
2963
+	do_action('geodir_author_content_inside');
2964
+	/** This action is documented in geodirectory_template_actions.php */
2965
+	do_action('geodir_after_listing');
2966
+	/** This action is documented in geodirectory_template_actions.php */
2967
+	do_action('geodir_main_content_close', 'author-page');
2968 2968
 }
2969 2969
 
2970 2970
 add_action('geodir_sidebar_author_bottom_section', 'geodir_action_sidebar_author_bottom_section', 10);
@@ -2978,11 +2978,11 @@  discard block
 block discarded – undo
2978 2978
  */
2979 2979
 function geodir_action_sidebar_author_bottom_section()
2980 2980
 {
2981
-    if (get_option('geodir_show_author_bottom_section')) { ?>
2981
+	if (get_option('geodir_show_author_bottom_section')) { ?>
2982 2982
         <div
2983 2983
             class="<?php
2984
-            /** This action is documented in geodirectory_template_actions.php */
2985
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
2984
+			/** This action is documented in geodirectory_template_actions.php */
2985
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
2986 2986
             <?php dynamic_sidebar('geodir_author_bottom'); ?>
2987 2987
         </div><!-- clearfix ends here-->
2988 2988
     <?php }
@@ -3001,23 +3001,23 @@  discard block
 block discarded – undo
3001 3001
  */
3002 3002
 function geodir_action_search_page_title()
3003 3003
 {
3004
-    $gd_post_type = geodir_get_current_posttype();
3005
-    $post_type_info = get_post_type_object($gd_post_type);
3004
+	$gd_post_type = geodir_get_current_posttype();
3005
+	$post_type_info = get_post_type_object($gd_post_type);
3006 3006
 
3007
-    $pt_name = '';
3008
-    if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
3007
+	$pt_name = '';
3008
+	if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
3009 3009
 
3010
-    if (is_search()) {
3011
-        $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
3010
+	if (is_search()) {
3011
+		$list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
3012 3012
 
3013
-    }
3014
-    /** This action is documented in geodirectory_template_actions.php */
3015
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
3016
-    /** This action is documented in geodirectory_template_actions.php */
3017
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
3018
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
3019
-        /** This action is documented in geodirectory_template_actions.php */
3020
-        apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
3013
+	}
3014
+	/** This action is documented in geodirectory_template_actions.php */
3015
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
3016
+	/** This action is documented in geodirectory_template_actions.php */
3017
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
3018
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
3019
+		/** This action is documented in geodirectory_template_actions.php */
3020
+		apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
3021 3021
 }
3022 3022
 
3023 3023
 // action for adding the listings page top widget area
@@ -3033,11 +3033,11 @@  discard block
 block discarded – undo
3033 3033
  */
3034 3034
 function geodir_action_geodir_sidebar_search_top()
3035 3035
 {
3036
-    if (get_option('geodir_show_search_top_section')) { ?>
3036
+	if (get_option('geodir_show_search_top_section')) { ?>
3037 3037
         <div
3038 3038
             class="<?php
3039
-            /** This action is documented in geodirectory_template_actions.php */
3040
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
3039
+			/** This action is documented in geodirectory_template_actions.php */
3040
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
3041 3041
             <?php dynamic_sidebar('geodir_search_top'); ?>
3042 3042
         </div><!-- clearfix ends here-->
3043 3043
     <?php }
@@ -3053,7 +3053,7 @@  discard block
 block discarded – undo
3053 3053
  */
3054 3054
 function geodir_search_left_section()
3055 3055
 {
3056
-    if (get_option('geodir_show_search_left_section')) { ?>
3056
+	if (get_option('geodir_show_search_left_section')) { ?>
3057 3057
         <div class="geodir-content-left geodir-sidebar-wrap">
3058 3058
             <?php dynamic_sidebar('geodir_search_left_sidebar'); ?>
3059 3059
         </div><!-- end geodir-content-left -->
@@ -3073,19 +3073,19 @@  discard block
 block discarded – undo
3073 3073
  */
3074 3074
 function geodir_action_search_sidebar_left()
3075 3075
 {
3076
-    if (get_option('geodir_show_search_left_section')) {
3076
+	if (get_option('geodir_show_search_left_section')) {
3077 3077
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
3078
-        /** This action is documented in geodirectory_template_actions.php */
3079
-        do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3080
-        /**
3081
-         * This is used to add the content to the search page left sidebar (if active).
3082
-         *
3083
-         * @since 1.0.0
3084
-         */
3085
-        do_action('geodir_search_sidebar_left_inside');
3086
-        /** This action is documented in geodirectory_template_actions.php */
3087
-        do_action('geodir_sidebar_left_close', 'search-page');
3088
-    }
3078
+		/** This action is documented in geodirectory_template_actions.php */
3079
+		do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3080
+		/**
3081
+		 * This is used to add the content to the search page left sidebar (if active).
3082
+		 *
3083
+		 * @since 1.0.0
3084
+		 */
3085
+		do_action('geodir_search_sidebar_left_inside');
3086
+		/** This action is documented in geodirectory_template_actions.php */
3087
+		do_action('geodir_sidebar_left_close', 'search-page');
3088
+	}
3089 3089
 }
3090 3090
 
3091 3091
 /**
@@ -3098,7 +3098,7 @@  discard block
 block discarded – undo
3098 3098
  */
3099 3099
 function geodir_search_right_section()
3100 3100
 {
3101
-    if (get_option('geodir_show_search_right_section')) { ?>
3101
+	if (get_option('geodir_show_search_right_section')) { ?>
3102 3102
         <div class="geodir-content-right geodir-sidebar-wrap">
3103 3103
             <?php dynamic_sidebar('geodir_search_right_sidebar'); ?>
3104 3104
         </div><!-- end geodir-content-right -->
@@ -3118,18 +3118,18 @@  discard block
 block discarded – undo
3118 3118
  */
3119 3119
 function geodir_action_search_sidebar_right()
3120 3120
 {
3121
-    if (get_option('geodir_show_search_right_section')) {
3122
-        /** This action is documented in geodirectory_template_actions.php */
3123
-        do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3124
-        /**
3125
-         * This is used to add the content to the search page right sidebar (if active).
3126
-         *
3127
-         * @since 1.0.0
3128
-         */
3129
-        do_action('geodir_search_sidebar_right_inside');
3130
-        /** This action is documented in geodirectory_template_actions.php */
3131
-        do_action('geodir_sidebar_right_close', 'search-page');
3132
-    }
3121
+	if (get_option('geodir_show_search_right_section')) {
3122
+		/** This action is documented in geodirectory_template_actions.php */
3123
+		do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3124
+		/**
3125
+		 * This is used to add the content to the search page right sidebar (if active).
3126
+		 *
3127
+		 * @since 1.0.0
3128
+		 */
3129
+		do_action('geodir_search_sidebar_right_inside');
3130
+		/** This action is documented in geodirectory_template_actions.php */
3131
+		do_action('geodir_sidebar_right_close', 'search-page');
3132
+	}
3133 3133
 }
3134 3134
 
3135 3135
 
@@ -3144,11 +3144,11 @@  discard block
 block discarded – undo
3144 3144
  */
3145 3145
 function geodir_action_sidebar_search_bottom_section()
3146 3146
 {
3147
-    if (get_option('geodir_show_search_bottom_section')) { ?>
3147
+	if (get_option('geodir_show_search_bottom_section')) { ?>
3148 3148
         <div
3149 3149
             class="<?php
3150
-            /** This action is documented in geodirectory_template_actions.php */
3151
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
3150
+			/** This action is documented in geodirectory_template_actions.php */
3151
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
3152 3152
             <?php dynamic_sidebar('geodir_search_bottom'); ?>
3153 3153
         </div><!-- clearfix ends here-->
3154 3154
     <?php }
@@ -3163,14 +3163,14 @@  discard block
 block discarded – undo
3163 3163
  */
3164 3164
 function geodir_action_search_content_inside()
3165 3165
 {
3166
-    global $gridview_columns;
3167
-    $listing_view = get_option('geodir_search_view');
3168
-    if (strstr($listing_view, 'gridview')) {
3169
-        $gridview_columns = $listing_view;
3170
-        $listing_view_exp = explode('_', $listing_view);
3171
-        $listing_view = $listing_view_exp[0];
3172
-    }
3173
-    geodir_get_template_part('listing', 'listview');
3166
+	global $gridview_columns;
3167
+	$listing_view = get_option('geodir_search_view');
3168
+	if (strstr($listing_view, 'gridview')) {
3169
+		$gridview_columns = $listing_view;
3170
+		$listing_view_exp = explode('_', $listing_view);
3171
+		$listing_view = $listing_view_exp[0];
3172
+	}
3173
+	geodir_get_template_part('listing', 'listview');
3174 3174
 }
3175 3175
 
3176 3176
 add_action('geodir_search_content_inside', 'geodir_action_search_content_inside', 10);
@@ -3186,22 +3186,22 @@  discard block
 block discarded – undo
3186 3186
  */
3187 3187
 function geodir_action_search_content()
3188 3188
 {
3189
-    /** This action is documented in geodirectory_template_actions.php */
3190
-    do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
3191
-    echo '<div class="clearfix">';
3192
-    /** This action is documented in geodirectory_template_actions.php */
3193
-    do_action('geodir_before_listing');
3194
-    echo '</div>';
3195
-    /**
3196
-     * This is used to add the content to the search page main content.
3197
-     *
3198
-     * @since 1.0.0
3199
-     */
3200
-    do_action('geodir_search_content_inside');
3201
-    /** This action is documented in geodirectory_template_actions.php */
3202
-    do_action('geodir_after_listing');
3203
-    /** This action is documented in geodirectory_template_actions.php */
3204
-    do_action('geodir_main_content_close', 'search-page');
3189
+	/** This action is documented in geodirectory_template_actions.php */
3190
+	do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
3191
+	echo '<div class="clearfix">';
3192
+	/** This action is documented in geodirectory_template_actions.php */
3193
+	do_action('geodir_before_listing');
3194
+	echo '</div>';
3195
+	/**
3196
+	 * This is used to add the content to the search page main content.
3197
+	 *
3198
+	 * @since 1.0.0
3199
+	 */
3200
+	do_action('geodir_search_content_inside');
3201
+	/** This action is documented in geodirectory_template_actions.php */
3202
+	do_action('geodir_after_listing');
3203
+	/** This action is documented in geodirectory_template_actions.php */
3204
+	do_action('geodir_main_content_close', 'search-page');
3205 3205
 }
3206 3206
 
3207 3207
 ###############################################
@@ -3224,11 +3224,11 @@  discard block
 block discarded – undo
3224 3224
  */
3225 3225
 function geodir_action_geodir_sidebar_home_top()
3226 3226
 {
3227
-    if (get_option('geodir_show_home_top_section')) { ?>
3227
+	if (get_option('geodir_show_home_top_section')) { ?>
3228 3228
         <div
3229 3229
             class="<?php
3230
-            /** This action is documented in geodirectory_template_actions.php */
3231
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
3230
+			/** This action is documented in geodirectory_template_actions.php */
3231
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
3232 3232
             <?php dynamic_sidebar('geodir_home_top'); ?>
3233 3233
         </div><!-- clearfix ends here-->
3234 3234
     <?php }
@@ -3244,7 +3244,7 @@  discard block
 block discarded – undo
3244 3244
  */
3245 3245
 function geodir_home_left_section()
3246 3246
 {
3247
-    if (get_option('geodir_show_home_left_section')) { ?>
3247
+	if (get_option('geodir_show_home_left_section')) { ?>
3248 3248
         <div class="geodir-content-left geodir-sidebar-wrap">
3249 3249
             <?php dynamic_sidebar('geodir_home_left'); ?>
3250 3250
         </div><!-- end geodir-content-left -->
@@ -3266,19 +3266,19 @@  discard block
 block discarded – undo
3266 3266
  */
3267 3267
 function geodir_action_home_sidebar_left()
3268 3268
 {
3269
-    if (get_option('geodir_show_home_left_section')) {
3269
+	if (get_option('geodir_show_home_left_section')) {
3270 3270
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
3271
-        /** This action is documented in geodirectory_template_actions.php */
3272
-        do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3273
-        /**
3274
-         * This is used to add the content to the home page left sidebar (if active).
3275
-         *
3276
-         * @since 1.0.0
3277
-         */
3278
-        do_action('geodir_home_sidebar_left_inside');
3279
-        /** This action is documented in geodirectory_template_actions.php */
3280
-        do_action('geodir_sidebar_left_close', 'home-page');
3281
-    }
3271
+		/** This action is documented in geodirectory_template_actions.php */
3272
+		do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3273
+		/**
3274
+		 * This is used to add the content to the home page left sidebar (if active).
3275
+		 *
3276
+		 * @since 1.0.0
3277
+		 */
3278
+		do_action('geodir_home_sidebar_left_inside');
3279
+		/** This action is documented in geodirectory_template_actions.php */
3280
+		do_action('geodir_sidebar_left_close', 'home-page');
3281
+	}
3282 3282
 }
3283 3283
 
3284 3284
 /**
@@ -3291,7 +3291,7 @@  discard block
 block discarded – undo
3291 3291
  */
3292 3292
 function geodir_home_right_section()
3293 3293
 {
3294
-    if (get_option('geodir_show_home_right_section')) { ?>
3294
+	if (get_option('geodir_show_home_right_section')) { ?>
3295 3295
         <div class="geodir-content-right geodir-sidebar-wrap">
3296 3296
             <?php dynamic_sidebar('geodir_home_right'); ?>
3297 3297
         </div><!-- end geodir-content-right -->
@@ -3312,18 +3312,18 @@  discard block
 block discarded – undo
3312 3312
  */
3313 3313
 function geodir_action_home_sidebar_right()
3314 3314
 {
3315
-    if (get_option('geodir_show_home_right_section')) {
3316
-        /** This action is documented in geodirectory_template_actions.php */
3317
-        do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3318
-        /**
3319
-         * This is used to add the content to the home page right sidebar (if active).
3320
-         *
3321
-         * @since 1.0.0
3322
-         */
3323
-        do_action('geodir_home_sidebar_right_inside');
3324
-        /** This action is documented in geodirectory_template_actions.php */
3325
-        do_action('geodir_sidebar_right_close', 'home-page');
3326
-    }
3315
+	if (get_option('geodir_show_home_right_section')) {
3316
+		/** This action is documented in geodirectory_template_actions.php */
3317
+		do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3318
+		/**
3319
+		 * This is used to add the content to the home page right sidebar (if active).
3320
+		 *
3321
+		 * @since 1.0.0
3322
+		 */
3323
+		do_action('geodir_home_sidebar_right_inside');
3324
+		/** This action is documented in geodirectory_template_actions.php */
3325
+		do_action('geodir_sidebar_right_close', 'home-page');
3326
+	}
3327 3327
 }
3328 3328
 
3329 3329
 /**
@@ -3334,7 +3334,7 @@  discard block
 block discarded – undo
3334 3334
  */
3335 3335
 function geodir_action_home_content_inside()
3336 3336
 {
3337
-    dynamic_sidebar('geodir_home_content');
3337
+	dynamic_sidebar('geodir_home_content');
3338 3338
 }
3339 3339
 
3340 3340
 add_action('geodir_home_content_inside', 'geodir_action_home_content_inside', 10);
@@ -3349,28 +3349,28 @@  discard block
 block discarded – undo
3349 3349
  */
3350 3350
 function geodir_action_home_content()
3351 3351
 {
3352
-    /** This action is documented in geodirectory_template_actions.php */
3353
-    do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
3354
-    /**
3355
-     * This called before the home page main content.
3356
-     *
3357
-     * @since 1.0.0
3358
-     */
3359
-    do_action('geodir_before_home_content');
3360
-    /**
3361
-     * This is used to add the content to the home page main content.
3362
-     *
3363
-     * @since 1.0.0
3364
-     */
3365
-    do_action('geodir_home_content_inside');
3366
-    /**
3367
-     * This is called after the homepage main content.
3368
-     *
3369
-     * @since 1.0.0
3370
-     */
3371
-    do_action('geodir_after_home_content');
3372
-    /** This action is documented in geodirectory_template_actions.php */
3373
-    do_action('geodir_main_content_close', 'home-page');
3352
+	/** This action is documented in geodirectory_template_actions.php */
3353
+	do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
3354
+	/**
3355
+	 * This called before the home page main content.
3356
+	 *
3357
+	 * @since 1.0.0
3358
+	 */
3359
+	do_action('geodir_before_home_content');
3360
+	/**
3361
+	 * This is used to add the content to the home page main content.
3362
+	 *
3363
+	 * @since 1.0.0
3364
+	 */
3365
+	do_action('geodir_home_content_inside');
3366
+	/**
3367
+	 * This is called after the homepage main content.
3368
+	 *
3369
+	 * @since 1.0.0
3370
+	 */
3371
+	do_action('geodir_after_home_content');
3372
+	/** This action is documented in geodirectory_template_actions.php */
3373
+	do_action('geodir_main_content_close', 'home-page');
3374 3374
 }
3375 3375
 
3376 3376
 add_action('geodir_sidebar_location_bottom_section', 'geodir_action_sidebar_home_bottom_section', 10);
@@ -3385,11 +3385,11 @@  discard block
 block discarded – undo
3385 3385
  */
3386 3386
 function geodir_action_sidebar_home_bottom_section()
3387 3387
 {
3388
-    if (get_option('geodir_show_home_bottom_section')) { ?>
3388
+	if (get_option('geodir_show_home_bottom_section')) { ?>
3389 3389
         <div
3390 3390
             class="<?php
3391
-            /** This action is documented in geodirectory_template_actions.php */
3392
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
3391
+			/** This action is documented in geodirectory_template_actions.php */
3392
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
3393 3393
             <?php dynamic_sidebar('geodir_home_bottom'); ?>
3394 3394
         </div><!-- clearfix ends here-->
3395 3395
     <?php }
@@ -3417,13 +3417,13 @@  discard block
 block discarded – undo
3417 3417
  */
3418 3418
 function geodir_filter_listing_page_title($list_title)
3419 3419
 {
3420
-    if (is_search() && trim(get_search_query()) == '') {
3421
-        $gd_post_type = geodir_get_current_posttype();
3422
-        $post_type_info = get_post_type_object($gd_post_type);
3420
+	if (is_search() && trim(get_search_query()) == '') {
3421
+		$gd_post_type = geodir_get_current_posttype();
3422
+		$post_type_info = get_post_type_object($gd_post_type);
3423 3423
 
3424
-        $list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3425
-    }
3426
-    return $list_title;
3424
+		$list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3425
+	}
3426
+	return $list_title;
3427 3427
 }
3428 3428
 
3429 3429
 add_action('geodir_message_not_found_on_listing', 'geodir_display_message_not_found_on_listing');
@@ -3438,62 +3438,62 @@  discard block
 block discarded – undo
3438 3438
  * @param string $gd_page The geodirectory page type. Default null.
3439 3439
  */
3440 3440
 function geodir_add_page_content( $position = 'before', $gd_page = '' ) {
3441
-    global $post;
3442
-
3443
-    $gd_page_id = NULL;
3444
-    if ($gd_page == 'home-page' && geodir_is_page('home')) {
3445
-        $gd_page_id = geodir_home_page_id();
3446
-    } else if ($gd_page == 'details-page' && geodir_is_page('preview')) {
3447
-        $gd_page_id = geodir_preview_page_id();
3448
-    } else if ($gd_page == 'add-listing-page' && geodir_is_page('add-listing')) {
3449
-        $gd_page_id = geodir_add_listing_page_id();
3450
-    } else if ($gd_page == 'success-page' && geodir_is_page('listing-success')) {
3451
-        $gd_page_id = geodir_success_page_id();
3452
-    } else if ($gd_page == 'location-page' && geodir_is_page('location')) {
3453
-        $gd_page_id = geodir_location_page_id();
3454
-    } else if ($gd_page == 'info-page' && geodir_is_page('info')) {
3455
-        $gd_page_id = geodir_info_page_id();
3456
-    } else if ($gd_page == 'signup-page' && geodir_is_page('login')) {
3457
-        $gd_page_id = geodir_login_page_id();
3458
-    } else if ($gd_page == 'checkout-page' && geodir_is_page('checkout')) {
3459
-        $gd_page_id = geodir_payment_checkout_page_id();
3460
-    } else if ($gd_page == 'invoices-page' && geodir_is_page('invoices')) {
3461
-        $gd_page_id = geodir_payment_invoices_page_id();
3462
-    }
3463
-
3464
-    if (!$gd_page_id > 0) {
3465
-        return;
3466
-    }
3441
+	global $post;
3442
+
3443
+	$gd_page_id = NULL;
3444
+	if ($gd_page == 'home-page' && geodir_is_page('home')) {
3445
+		$gd_page_id = geodir_home_page_id();
3446
+	} else if ($gd_page == 'details-page' && geodir_is_page('preview')) {
3447
+		$gd_page_id = geodir_preview_page_id();
3448
+	} else if ($gd_page == 'add-listing-page' && geodir_is_page('add-listing')) {
3449
+		$gd_page_id = geodir_add_listing_page_id();
3450
+	} else if ($gd_page == 'success-page' && geodir_is_page('listing-success')) {
3451
+		$gd_page_id = geodir_success_page_id();
3452
+	} else if ($gd_page == 'location-page' && geodir_is_page('location')) {
3453
+		$gd_page_id = geodir_location_page_id();
3454
+	} else if ($gd_page == 'info-page' && geodir_is_page('info')) {
3455
+		$gd_page_id = geodir_info_page_id();
3456
+	} else if ($gd_page == 'signup-page' && geodir_is_page('login')) {
3457
+		$gd_page_id = geodir_login_page_id();
3458
+	} else if ($gd_page == 'checkout-page' && geodir_is_page('checkout')) {
3459
+		$gd_page_id = geodir_payment_checkout_page_id();
3460
+	} else if ($gd_page == 'invoices-page' && geodir_is_page('invoices')) {
3461
+		$gd_page_id = geodir_payment_invoices_page_id();
3462
+	}
3463
+
3464
+	if (!$gd_page_id > 0) {
3465
+		return;
3466
+	}
3467 3467
     
3468
-    $display = 'before';
3469
-    /**
3470
-     * Filter the position to display the page content.
3471
-     *
3472
-     * @since 1.6.3
3473
-     *
3474
-     * @param string $display Position to add the post content.
3475
-     * @param string $gd_page The geodirectory page type.
3476
-     */
3477
-    $display = apply_filters('geodir_add_page_content_position', $display, $gd_page);
3478
-
3479
-    if ($position !== $display) {
3480
-        return;
3481
-    }
3482
-
3483
-    $gd_post = $post;
3468
+	$display = 'before';
3469
+	/**
3470
+	 * Filter the position to display the page content.
3471
+	 *
3472
+	 * @since 1.6.3
3473
+	 *
3474
+	 * @param string $display Position to add the post content.
3475
+	 * @param string $gd_page The geodirectory page type.
3476
+	 */
3477
+	$display = apply_filters('geodir_add_page_content_position', $display, $gd_page);
3478
+
3479
+	if ($position !== $display) {
3480
+		return;
3481
+	}
3482
+
3483
+	$gd_post = $post;
3484 3484
     
3485
-    setup_postdata(get_post($gd_page_id));
3485
+	setup_postdata(get_post($gd_page_id));
3486 3486
 
3487
-    if (get_the_content()) {
3488
-        ?>
3487
+	if (get_the_content()) {
3488
+		?>
3489 3489
         <section class="entry-content clearfix" itemprop="articleBody"><?php the_content(); ?></section>
3490 3490
         <?php
3491
-    }
3491
+	}
3492 3492
 
3493
-    $post = $gd_post;
3494
-    if (!empty($gd_post) && is_object($gd_post)) {
3495
-        setup_postdata($gd_post);
3496
-    }
3493
+	$post = $gd_post;
3494
+	if (!empty($gd_post) && is_object($gd_post)) {
3495
+		setup_postdata($gd_post);
3496
+	}
3497 3497
 
3498 3498
 }
3499 3499
 add_action('geodir_add_page_content', 'geodir_add_page_content', 10, 2);
@@ -3514,13 +3514,13 @@  discard block
 block discarded – undo
3514 3514
  * @return string Filtered SQL JOIN clause.
3515 3515
  */
3516 3516
 function geodir_previous_next_post_join( $join, $in_same_term, $excluded_terms, $taxonomy, $post ) {
3517
-    global $plugin_prefix;
3517
+	global $plugin_prefix;
3518 3518
 
3519
-    if ( !empty($post->post_type) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3520
-        $join .= " INNER JOIN " . $plugin_prefix . $post->post_type . "_detail AS gd ON gd.post_id = p.ID";
3521
-    }
3519
+	if ( !empty($post->post_type) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3520
+		$join .= " INNER JOIN " . $plugin_prefix . $post->post_type . "_detail AS gd ON gd.post_id = p.ID";
3521
+	}
3522 3522
     
3523
-    return $join;
3523
+	return $join;
3524 3524
 }
3525 3525
 add_filter( 'get_previous_post_join', 'geodir_previous_next_post_join', 10, 5 );
3526 3526
 add_filter( 'get_next_post_join', 'geodir_previous_next_post_join', 10, 5 );
@@ -3542,31 +3542,31 @@  discard block
 block discarded – undo
3542 3542
  * @return string Filtered SQL WHERE clause.
3543 3543
  */
3544 3544
 function geodir_previous_next_post_where( $where, $in_same_term, $excluded_terms, $taxonomy, $post ) {
3545
-    global $wpdb, $plugin_prefix;
3545
+	global $wpdb, $plugin_prefix;
3546 3546
 
3547
-    if ( !empty($post->post_type) && ( !empty( $post->country_slug ) || !empty( $post->region_slug ) || !empty( $post->city_slug ) ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3548
-        $post_locations = '';
3549
-        $post_locations_var = array();
3547
+	if ( !empty($post->post_type) && ( !empty( $post->country_slug ) || !empty( $post->region_slug ) || !empty( $post->city_slug ) ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3548
+		$post_locations = '';
3549
+		$post_locations_var = array();
3550 3550
         
3551
-        if ( !empty( $post->country_slug ) ) {
3552
-            $post_locations .= " AND post_locations LIKE %s";
3553
-            $post_locations_var[] = "%,[" . $post->country_slug . "]";
3554
-        }
3555
-
3556
-        if ( !empty( $post->region_slug ) ) {
3557
-            $post_locations .= " AND post_locations LIKE %s";
3558
-            $post_locations_var[] = "%,[" . $post->region_slug . "],%";
3559
-        }
3560
-
3561
-        if ( !empty( $post->city_slug ) ) {
3562
-            $post_locations .= " AND post_locations LIKE %s";
3563
-            $post_locations_var[] = "[" . $post->city_slug . "],%";
3564
-        }
3551
+		if ( !empty( $post->country_slug ) ) {
3552
+			$post_locations .= " AND post_locations LIKE %s";
3553
+			$post_locations_var[] = "%,[" . $post->country_slug . "]";
3554
+		}
3555
+
3556
+		if ( !empty( $post->region_slug ) ) {
3557
+			$post_locations .= " AND post_locations LIKE %s";
3558
+			$post_locations_var[] = "%,[" . $post->region_slug . "],%";
3559
+		}
3560
+
3561
+		if ( !empty( $post->city_slug ) ) {
3562
+			$post_locations .= " AND post_locations LIKE %s";
3563
+			$post_locations_var[] = "[" . $post->city_slug . "],%";
3564
+		}
3565 3565
         
3566
-        $where .= $wpdb->prepare( $post_locations, $post_locations_var );
3567
-    }
3566
+		$where .= $wpdb->prepare( $post_locations, $post_locations_var );
3567
+	}
3568 3568
     
3569
-    return $where;
3569
+	return $where;
3570 3570
 }
3571 3571
 add_filter( 'get_previous_post_where', 'geodir_previous_next_post_where', 10, 5 );
3572 3572
 add_filter( 'get_next_post_where', 'geodir_previous_next_post_where', 10, 5 );
3573 3573
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
     //php
285 285
     if (!empty($tc['geodir_theme_compat_code'])) {
286
-        include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
286
+        include_once('geodirectory-functions/compatibility/'.$tc['geodir_theme_compat_code'].'.php');
287 287
     }
288 288
 
289 289
     //geodir_full_page_class
@@ -453,13 +453,13 @@  discard block
 block discarded – undo
453 453
 function geodir_action_wrapper_content_open($type = '', $id = '', $class = '')
454 454
 {
455 455
     if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
456
-        $width_css = 'style="width:' . $width . '%;"';
456
+        $width_css = 'style="width:'.$width.'%;"';
457 457
     } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
458
-        $width_css = 'style="width:' . $width . '%;"';
458
+        $width_css = 'style="width:'.$width.'%;"';
459 459
     } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
460
-        $width_css = 'style="width:' . $width . '%;"';
460
+        $width_css = 'style="width:'.$width.'%;"';
461 461
     } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
462
-        $width_css = 'style="width:' . $width . '%;"';
462
+        $width_css = 'style="width:'.$width.'%;"';
463 463
     } else {
464 464
         $width_css = '';
465 465
     }
@@ -573,13 +573,13 @@  discard block
 block discarded – undo
573 573
 function geodir_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')
574 574
 {
575 575
     if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
576
-        $width_css = 'style="width:' . $width . '%;"';
576
+        $width_css = 'style="width:'.$width.'%;"';
577 577
     } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
578
-        $width_css = 'style="width:' . $width . '%;"';
578
+        $width_css = 'style="width:'.$width.'%;"';
579 579
     } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
580
-        $width_css = 'style="width:' . $width . '%;"';
580
+        $width_css = 'style="width:'.$width.'%;"';
581 581
     } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
582
-        $width_css = 'style="width:' . $width . '%;"';
582
+        $width_css = 'style="width:'.$width.'%;"';
583 583
     } else {
584 584
         $width_css = '';
585 585
     }
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
         }
678 678
     }
679 679
 
680
-    $post = (object)$_REQUEST;
680
+    $post = (object) $_REQUEST;
681 681
 
682 682
 
683 683
     if (isset($post->video)) {
@@ -736,10 +736,10 @@  discard block
 block discarded – undo
736 736
 
737 737
     $json = '{';
738 738
     $json .= '"post_preview": "1",';
739
-    $json .= '"t": "' . $json_title . '",';
740
-    $json .= '"lt": "' . $post_latitude . '",';
741
-    $json .= '"ln": "' . $post_longitude . '",';
742
-    $json .= '"i":"' . $term_icon . '"';
739
+    $json .= '"t": "'.$json_title.'",';
740
+    $json .= '"lt": "'.$post_latitude.'",';
741
+    $json .= '"ln": "'.$post_longitude.'",';
742
+    $json .= '"i":"'.$term_icon.'"';
743 743
     $json .= '}';
744 744
 
745 745
     $post->marker_json = $json;
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
      * @param string $class The class to use. Default is 'entry-header'.
967 967
      */
968 968
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
969
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
969
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.stripslashes(get_the_title()).'</h1></header>';
970 970
 }
971 971
 
972 972
 
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
                     $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1021 1021
 
1022 1022
                     if ($image && $width && $height) {
1023
-                        $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1023
+                        $image = (object) array('src' => $image, 'width' => $width, 'height' => $height);
1024 1024
                     }
1025 1025
 
1026 1026
                     if (isset($image->src)) {
@@ -1032,9 +1032,9 @@  discard block
 block discarded – undo
1032 1032
 
1033 1033
                         $image_title = isset($image->title) ? $image->title : '';
1034 1034
 
1035
-                        $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1036
-                        $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1037
-                        $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1035
+                        $main_slides .= '<li><img src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:'.$spacer_height.'px;margin:0 auto;" />';
1036
+                        $main_slides .= '<img src="'.$image->src.'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:400px;margin:0 auto;" /></li>';
1037
+                        $nav_slides .= '<li><img src="'.$image->src.'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:48px;margin:0 auto;" /></li>';
1038 1038
                         $slides++;
1039 1039
                     }
1040 1040
                 }
@@ -1060,10 +1060,10 @@  discard block
 block discarded – undo
1060 1060
                 } else {
1061 1061
                     $spacer_height = ((400 - $image->height) / 2);
1062 1062
                 }
1063
-                $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1064
-                $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1065
-                $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1066
-                $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1063
+                $caption = ''; //(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1064
+                $main_slides .= '<li><img src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:'.$spacer_height.'px;margin:0 auto;" />';
1065
+                $main_slides .= '<img src="'.$image->src.'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1066
+                $nav_slides .= '<li><img src="'.$image->src.'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:48px;margin:0 auto;" /></li>';
1067 1067
                 $slides++;
1068 1068
             }
1069 1069
         }// endfore
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
  */
1099 1099
 function geodir_action_details_taxonomies()
1100 1100
 {
1101
-    global $preview, $post;?>
1101
+    global $preview, $post; ?>
1102 1102
     <p class="geodir_post_taxomomies clearfix">
1103 1103
     <?php
1104 1104
     $taxonomies = array();
@@ -1107,11 +1107,11 @@  discard block
 block discarded – undo
1107 1107
 
1108 1108
     if ($preview && !$is_backend_preview) {
1109 1109
         $post_type = $post->listing_type;
1110
-        $post_taxonomy = $post_type . 'category';
1110
+        $post_taxonomy = $post_type.'category';
1111 1111
         $post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1112 1112
     } else {
1113 1113
         $post_type = $post->post_type;
1114
-        $post_taxonomy = $post_type . 'category';
1114
+        $post_taxonomy = $post_type.'category';
1115 1115
     }
1116 1116
 //{	
1117 1117
     $post_type_info = get_post_type_object($post_type);
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
 
1120 1120
     if (!empty($post->post_tags)) {
1121 1121
 
1122
-        if (taxonomy_exists($post_type . '_tags')):
1122
+        if (taxonomy_exists($post_type.'_tags')):
1123 1123
             $links = array();
1124 1124
             $terms = array();
1125 1125
             // to limit post tags
@@ -1146,8 +1146,8 @@  discard block
 block discarded – undo
1146 1146
                 $post_term = trim($post_term);
1147 1147
 
1148 1148
                 $priority_location = false;
1149
-                if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1150
-                    $term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
1149
+                if ($insert_term = term_exists($post_term, $post_type.'_tags')) {
1150
+                    $term = get_term_by('id', $insert_term['term_id'], $post_type.'_tags');
1151 1151
                 } else {
1152 1152
                     $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1153 1153
                     $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
@@ -1157,10 +1157,10 @@  discard block
 block discarded – undo
1157 1157
                     $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1158 1158
                     if ($match_country || $match_region || $match_city) {
1159 1159
                         $priority_location = true;
1160
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1160
+                        $term = get_term_by('name', $post_term, $post_type.'_tags');
1161 1161
                     } else {
1162
-                        $insert_term = wp_insert_term($post_term, $post_type . '_tags');
1163
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1162
+                        $insert_term = wp_insert_term($post_term, $post_type.'_tags');
1163
+                        $term = get_term_by('name', $post_term, $post_type.'_tags');
1164 1164
                     }
1165 1165
                 }
1166 1166
 
@@ -1177,12 +1177,12 @@  discard block
 block discarded – undo
1177 1177
                          * @param string $tag_link The tag link html.
1178 1178
                          * @param object $term The tag term object.
1179 1179
                          */
1180
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1180
+                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
1181 1181
                         $links[] = $tag_link;
1182 1182
                     } else {
1183
-                        $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1183
+                        $tag_link = "<a href='".esc_attr(get_term_link($term->term_id, $term->taxonomy))."'>$term->name</a>";
1184 1184
                         /** This action is documented in geodirectory-template_actions.php */
1185
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1185
+                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
1186 1186
                         $links[] = $tag_link;
1187 1187
                     }
1188 1188
                     $terms[] = $term;
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
             if (!isset($listing_label)) {
1193 1193
                 $listing_label = '';
1194 1194
             }
1195
-            $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1195
+            $taxonomies[$post_type.'_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object) $terms);
1196 1196
         endif;
1197 1197
 
1198 1198
     }
@@ -1220,7 +1220,7 @@  discard block
 block discarded – undo
1220 1220
                     $term = get_term_by('id', $post_term, $post_taxonomy);
1221 1221
 
1222 1222
                     if (is_object($term)) {
1223
-                        $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1223
+                        $term_link = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>$term->name</a>";
1224 1224
                         /**
1225 1225
                          * Filter the category name on the details page.
1226 1226
                          *
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
                          * @param string $term_link The link html to the category.
1229 1229
                          * @param object $term The category term object.
1230 1230
                          */
1231
-                        $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1231
+                        $term_link = apply_filters('geodir_details_taxonomies_cat_link', $term_link, $term);
1232 1232
                         $links[] = $term_link;
1233 1233
                         $terms[] = $term;
1234 1234
                     }
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
         if (!isset($listing_label)) {
1247 1247
             $listing_label = '';
1248 1248
         }
1249
-        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1249
+        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object) $terms);
1250 1250
 
1251 1251
     }
1252 1252
 
@@ -1259,14 +1259,14 @@  discard block
 block discarded – undo
1259 1259
      * @param string $listing_label The post type label.
1260 1260
      * @param string $listing_label The post type label with ucwords function.
1261 1261
      */
1262
-    $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1262
+    $taxonomies = apply_filters('geodir_details_taxonomies_output', $taxonomies, $post_type, $listing_label, geodir_ucwords($listing_label));
1263 1263
 
1264 1264
     if (isset($taxonomies[$post_taxonomy])) {
1265
-        echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1265
+        echo '<span class="geodir-category">'.$taxonomies[$post_taxonomy].'</span>';
1266 1266
     }
1267 1267
 
1268
-    if (isset($taxonomies[$post_type . '_tags']))
1269
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1268
+    if (isset($taxonomies[$post_type.'_tags']))
1269
+        echo '<span class="geodir-tags">'.$taxonomies[$post_type.'_tags'].'</span>';
1270 1270
 
1271 1271
     ?>
1272 1272
     </p><?php
@@ -1287,11 +1287,11 @@  discard block
 block discarded – undo
1287 1287
  * @param object $post Optional. The post object or blank.
1288 1288
  * @package GeoDirectory
1289 1289
  */
1290
-function geodir_action_details_micordata($post='')
1290
+function geodir_action_details_micordata($post = '')
1291 1291
 {
1292 1292
 
1293 1293
     global $preview;
1294
-    if(empty($post)){global $post;}
1294
+    if (empty($post)) {global $post; }
1295 1295
     if ($preview || !geodir_is_page('detail')) {
1296 1296
         return;
1297 1297
     }
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
                 "description" => $review->comment_content,
1313 1313
                 "reviewRating" => array(
1314 1314
                     "@type" => "Rating",
1315
-                    "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1315
+                    "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1316 1316
                     "ratingValue" => geodir_get_commentoverall($review->comment_ID),
1317 1317
                     "worstRating" => "1"
1318 1318
                 )
@@ -1340,13 +1340,13 @@  discard block
 block discarded – undo
1340 1340
     }
1341 1341
     //print_r($post);
1342 1342
     // external links
1343
-    $external_links =  array();
1343
+    $external_links = array();
1344 1344
     $external_links[] = $post->geodir_website;
1345 1345
     $external_links[] = $post->geodir_twitter;
1346 1346
     $external_links[] = $post->geodir_facebook;
1347 1347
     $external_links = array_filter($external_links);
1348 1348
 
1349
-    if(!empty($external_links)){
1349
+    if (!empty($external_links)) {
1350 1350
         $external_links = array_values($external_links);
1351 1351
     }
1352 1352
 
@@ -1356,17 +1356,17 @@  discard block
 block discarded – undo
1356 1356
 
1357 1357
     // schema type
1358 1358
     $schema_type = 'LocalBusiness';
1359
-    if(isset($post->default_category) && $post->default_category){
1359
+    if (isset($post->default_category) && $post->default_category) {
1360 1360
         $cat_schema = geodir_get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1361
-        if($cat_schema){$schema_type = $cat_schema;}
1362
-        if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1361
+        if ($cat_schema) {$schema_type = $cat_schema; }
1362
+        if (!$schema_type && $post->post_type == 'gd_event') {$schema_type = 'Event'; }
1363 1363
     }
1364 1364
 
1365 1365
     $schema = array();
1366 1366
     $schema['@context'] = "https://schema.org";
1367 1367
     $schema['@type'] = $schema_type;
1368 1368
     $schema['name'] = $post->post_title;
1369
-    $schema['description'] = wp_strip_all_tags( $post->post_content, true );
1369
+    $schema['description'] = wp_strip_all_tags($post->post_content, true);
1370 1370
     $schema['telephone'] = $post->geodir_contact;
1371 1371
     $schema['url'] = $c_url;
1372 1372
     $schema['sameAs'] = $external_links;
@@ -1380,7 +1380,7 @@  discard block
 block discarded – undo
1380 1380
         "postalCode" => $post->post_zip
1381 1381
     );
1382 1382
 
1383
-    if($post->post_latitude && $post->post_longitude) {
1383
+    if ($post->post_latitude && $post->post_longitude) {
1384 1384
         $schema['geo'] = array(
1385 1385
             "@type" => "GeoCoordinates",
1386 1386
             "latitude" => $post->post_latitude,
@@ -1388,7 +1388,7 @@  discard block
 block discarded – undo
1388 1388
         );
1389 1389
     }
1390 1390
 
1391
-    if($post_avgratings) {
1391
+    if ($post_avgratings) {
1392 1392
         $schema['aggregateRating'] = array(
1393 1393
             "@type" => "AggregateRating",
1394 1394
             "ratingValue" => $post_avgratings,
@@ -1407,10 +1407,10 @@  discard block
 block discarded – undo
1407 1407
      * @param array $schema The array of schema data to be filtered.
1408 1408
      * @param object $post The post object.
1409 1409
      */
1410
-    $schema = apply_filters('geodir_details_schema', $schema,$post);
1410
+    $schema = apply_filters('geodir_details_schema', $schema, $post);
1411 1411
 
1412 1412
 
1413
-    echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1413
+    echo '<script type="application/ld+json">'.json_encode($schema).'</script>';
1414 1414
 
1415 1415
 
1416 1416
     $uploads = wp_upload_dir();
@@ -1423,7 +1423,7 @@  discard block
 block discarded – undo
1423 1423
      * @param string $facebook_og The open graph html to be filtered.
1424 1424
      * @param object $post The post object.
1425 1425
      */
1426
-    echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
1426
+    echo apply_filters('geodir_details_facebook_og', $facebook_og, $post);
1427 1427
 
1428 1428
 
1429 1429
 
@@ -1446,9 +1446,9 @@  discard block
 block discarded – undo
1446 1446
     ?>
1447 1447
     <div class="geodir-pos_navigation clearfix">
1448 1448
     <div
1449
-        class="geodir-post_left"><?php previous_post_link('%link', '' . __('Previous', 'geodirectory'), false) ?></div>
1449
+        class="geodir-post_left"><?php previous_post_link('%link', ''.__('Previous', 'geodirectory'), false) ?></div>
1450 1450
     <div
1451
-        class="geodir-post_right"><?php next_post_link('%link', __('Next', 'geodirectory') . '', false) ?></div>
1451
+        class="geodir-post_right"><?php next_post_link('%link', __('Next', 'geodirectory').'', false) ?></div>
1452 1452
     </div><?php
1453 1453
 }
1454 1454
 
@@ -1517,12 +1517,12 @@  discard block
 block discarded – undo
1517 1517
     $gd_post_type = geodir_get_current_posttype();
1518 1518
     $post_type_info = get_post_type_object($gd_post_type);
1519 1519
 
1520
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
1520
+    $add_string_in_title = __('All', 'geodirectory').' ';
1521 1521
     if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1522
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1522
+        $add_string_in_title = __('My Favorite', 'geodirectory').' ';
1523 1523
     }
1524 1524
 
1525
-    $list_title = $add_string_in_title . __($post_type_info->labels->name, 'geodirectory');
1525
+    $list_title = $add_string_in_title.__($post_type_info->labels->name, 'geodirectory');
1526 1526
     $single_name = $post_type_info->labels->singular_name;
1527 1527
 
1528 1528
     $taxonomy = geodir_get_taxonomies($gd_post_type, true);
@@ -1550,12 +1550,12 @@  discard block
 block discarded – undo
1550 1550
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
1551 1551
         if (!empty($current_term)) {
1552 1552
             $current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1553
-            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1553
+            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type.'category') {
1554 1554
                 $location_last_char = substr($location_name, -1);
1555 1555
                 $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1556
-                $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1556
+                $list_title .= __(' in', 'geodirectory').' '.$location_name.$location_name_attach.' '.$current_term_name;
1557 1557
             } else {
1558
-                $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1558
+                $list_title .= __(' in', 'geodirectory')." '".$current_term_name."'";
1559 1559
             }
1560 1560
         } else {
1561 1561
             if (count($taxonomy) > 1) {
@@ -1563,12 +1563,12 @@  discard block
 block discarded – undo
1563 1563
 
1564 1564
                 if (!empty($current_term)) {
1565 1565
                     $current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1566
-                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1566
+                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type.'category') {
1567 1567
                         $location_last_char = substr($location_name, -1);
1568 1568
                         $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1569
-                        $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1569
+                        $list_title .= __(' in', 'geodirectory').' '.$location_name.$location_name_attach.' '.$current_term_name;
1570 1570
                     } else {
1571
-                        $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1571
+                        $list_title .= __(' in', 'geodirectory')." '".$current_term_name."'";
1572 1572
                     }
1573 1573
                 }
1574 1574
             }
@@ -1596,7 +1596,7 @@  discard block
 block discarded – undo
1596 1596
                 $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1597 1597
             }
1598 1598
 
1599
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1599
+            $list_title .= __(' in', 'geodirectory')." '".$gd_city."'";
1600 1600
         } else if ($gd_region != '') {
1601 1601
             if ($gd_region_actual != '') {
1602 1602
                 $gd_region = $gd_region_actual;
@@ -1606,7 +1606,7 @@  discard block
 block discarded – undo
1606 1606
                 $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1607 1607
             }
1608 1608
 
1609
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1609
+            $list_title .= __(' in', 'geodirectory')." '".$gd_region."'";
1610 1610
         } else if ($gd_country != '') {
1611 1611
             if ($gd_country_actual != '') {
1612 1612
                 $gd_country = $gd_country_actual;
@@ -1616,12 +1616,12 @@  discard block
 block discarded – undo
1616 1616
                 $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1617 1617
             }
1618 1618
 
1619
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1619
+            $list_title .= __(' in', 'geodirectory')." '".$gd_country."'";
1620 1620
         }
1621 1621
     }
1622 1622
 
1623 1623
     if (is_search()) {
1624
-        $list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1624
+        $list_title = __('Search', 'geodirectory').' '.__(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
1625 1625
     }
1626 1626
     /** This action is documented in geodirectory_template_actions.php */
1627 1627
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
@@ -1631,26 +1631,26 @@  discard block
 block discarded – undo
1631 1631
 
1632 1632
     $title = $list_title;
1633 1633
     $gd_page = '';
1634
-    if(geodir_is_page('pt')){
1634
+    if (geodir_is_page('pt')) {
1635 1635
         $gd_page = 'pt';
1636
-        $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1636
+        $title = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1637 1637
     }
1638
-    elseif(geodir_is_page('listing')){
1638
+    elseif (geodir_is_page('listing')) {
1639 1639
         $gd_page = 'listing';
1640 1640
         global $wp_query;
1641 1641
         $current_term = $wp_query->get_queried_object();
1642
-        if (strpos($current_term->taxonomy,'_tags') !== false) {
1642
+        if (strpos($current_term->taxonomy, '_tags') !== false) {
1643 1643
             $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1644
-        }else{
1644
+        } else {
1645 1645
             $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1646 1646
         }
1647 1647
 
1648 1648
     }
1649
-    elseif(geodir_is_page('author')){
1649
+    elseif (geodir_is_page('author')) {
1650 1650
         $gd_page = 'author';
1651
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1651
+        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1652 1652
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1653
-        }else{
1653
+        } else {
1654 1654
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1655 1655
         }
1656 1656
 
@@ -1664,16 +1664,16 @@  discard block
 block discarded – undo
1664 1664
      * @param string $title The page title including variables.
1665 1665
      * @param string $gd_page The GeoDirectory page type if any.
1666 1666
      */
1667
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1667
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1668 1668
 
1669
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1669
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.
1670 1670
         /**
1671 1671
          * Filter the listing page title.
1672 1672
          *
1673 1673
          * @since 1.0.0
1674 1674
          * @param string $list_title The title for the category page.
1675 1675
          */
1676
-        apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1676
+        apply_filters('geodir_listing_page_title', $title).'</h1></header>';
1677 1677
 }
1678 1678
 
1679 1679
 add_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
@@ -1692,16 +1692,16 @@  discard block
 block discarded – undo
1692 1692
     $gd_post_type = geodir_get_current_posttype();
1693 1693
     if (isset($current_term->term_id) && $current_term->term_id != '') {
1694 1694
 
1695
-        $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1695
+        $term_desc = term_description($current_term->term_id, $gd_post_type.'_tags');
1696 1696
         $saved_data = stripslashes(geodir_get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1697 1697
         if ($term_desc && !$saved_data) {
1698 1698
             $saved_data = $term_desc;
1699 1699
         }
1700 1700
 
1701 1701
         // stop payment manager filtering content length
1702
-        $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1703
-        if ( false !== $filter_priority ) {
1704
-            remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1702
+        $filter_priority = has_filter('the_content', 'geodir_payments_the_content');
1703
+        if (false !== $filter_priority) {
1704
+            remove_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1705 1705
         }
1706 1706
 
1707 1707
         /**
@@ -1715,14 +1715,14 @@  discard block
 block discarded – undo
1715 1715
         $cat_description = apply_filters('the_content', $saved_data);
1716 1716
 
1717 1717
 
1718
-        if ( false !== $filter_priority ) {
1719
-            add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1718
+        if (false !== $filter_priority) {
1719
+            add_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1720 1720
         }
1721 1721
 
1722 1722
         if ($cat_description) {
1723 1723
             ?>
1724 1724
 
1725
-            <div class="term_description"><?php echo $cat_description;?></div> <?php
1725
+            <div class="term_description"><?php echo $cat_description; ?></div> <?php
1726 1726
         }
1727 1727
 
1728 1728
     }
@@ -1772,13 +1772,13 @@  discard block
 block discarded – undo
1772 1772
 function geodir_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')
1773 1773
 {
1774 1774
     if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1775
-        $width_css = 'style="width:' . $width . '%;"';
1775
+        $width_css = 'style="width:'.$width.'%;"';
1776 1776
     } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1777
-        $width_css = 'style="width:' . $width . '%;"';
1777
+        $width_css = 'style="width:'.$width.'%;"';
1778 1778
     } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1779
-        $width_css = 'style="width:' . $width . '%;"';
1779
+        $width_css = 'style="width:'.$width.'%;"';
1780 1780
     } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1781
-        $width_css = 'style="width:' . $width . '%;"';
1781
+        $width_css = 'style="width:'.$width.'%;"';
1782 1782
     } else {
1783 1783
         $width_css = '';
1784 1784
     }
@@ -2083,11 +2083,11 @@  discard block
 block discarded – undo
2083 2083
 
2084 2084
     $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2085 2085
 
2086
-    if(geodir_is_page('add-listing')){
2086
+    if (geodir_is_page('add-listing')) {
2087 2087
         $gd_page = 'add-listing';
2088
-        if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2088
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2089 2089
             $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2090
-        }elseif(isset($listing_type)){
2090
+        }elseif (isset($listing_type)) {
2091 2091
             $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2092 2092
         }
2093 2093
 
@@ -2101,9 +2101,9 @@  discard block
 block discarded – undo
2101 2101
      * @param string $title The page title including variables.
2102 2102
      * @param string $gd_page The GeoDirectory page type if any.
2103 2103
      */
2104
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2104
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2105 2105
 
2106
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2106
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">';
2107 2107
     echo $title;
2108 2108
     echo '</h1></header>';
2109 2109
 }
@@ -2117,7 +2117,7 @@  discard block
 block discarded – undo
2117 2117
  */
2118 2118
 function geodir_action_add_listing_page_mandatory()
2119 2119
 {?>
2120
-    <p class="geodir-note "><span class="geodir-required">*</span>&nbsp;<?php echo INDICATES_MANDATORY_FIELDS_TEXT;?></p>
2120
+    <p class="geodir-note "><span class="geodir-required">*</span>&nbsp;<?php echo INDICATES_MANDATORY_FIELDS_TEXT; ?></p>
2121 2121
 <?php
2122 2122
 }
2123 2123
 
@@ -2152,7 +2152,7 @@  discard block
 block discarded – undo
2152 2152
 
2153 2153
     if (isset($_REQUEST['backandedit'])) {
2154 2154
         global $post;
2155
-        $post = (object)$gd_session->get('listing');
2155
+        $post = (object) $gd_session->get('listing');
2156 2156
         $listing_type = $post->listing_type;
2157 2157
         $title = $post->post_title;
2158 2158
         $desc = $post->post_desc;
@@ -2167,7 +2167,7 @@  discard block
 block discarded – undo
2167 2167
         $thumb_img_arr = geodir_get_images($post->ID);
2168 2168
         if ($thumb_img_arr) {
2169 2169
             foreach ($thumb_img_arr as $post_img) {
2170
-                $curImages .= $post_img->src . ',';
2170
+                $curImages .= $post_img->src.',';
2171 2171
             }
2172 2172
         }
2173 2173
 
@@ -2175,7 +2175,7 @@  discard block
 block discarded – undo
2175 2175
         $title = $post->post_title;
2176 2176
         $desc = $post->post_content;
2177 2177
         $kw_tags = $post->post_tags;
2178
-        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2178
+        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type.'_tags', array('fields' => 'names')));
2179 2179
     } else {
2180 2180
         $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2181 2181
     }
@@ -2186,20 +2186,20 @@  discard block
 block discarded – undo
2186 2186
 
2187 2187
     $post_type_info = geodir_get_posttype_info($listing_type);
2188 2188
 
2189
-    $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing','geodirectory');
2189
+    $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing', 'geodirectory');
2190 2190
     
2191 2191
     $package_info = array();
2192 2192
     $package_info = geodir_post_package_info($package_info, $post);
2193 2193
     ?>
2194
-    <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data">
2195
-        <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/>
2196
-        <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/>
2194
+    <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id()); ?>" method="post" enctype="multipart/form-data">
2195
+        <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type); ?>"/>
2196
+        <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type); ?>"/>
2197 2197
         <?php if ($page_id) { ?>
2198
-        <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id;?>"/>
2198
+        <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id; ?>"/>
2199 2199
         <?php } if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { ?>
2200
-            <input type="hidden" name="pid" value="<?php echo sanitize_text_field($_REQUEST['pid']);?>"/>
2200
+            <input type="hidden" name="pid" value="<?php echo sanitize_text_field($_REQUEST['pid']); ?>"/>
2201 2201
         <?php } if (isset($_REQUEST['backandedit'])) { ?>
2202
-            <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/>
2202
+            <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']); ?>"/>
2203 2203
         <?php
2204 2204
         } 
2205 2205
         /**
@@ -2211,7 +2211,7 @@  discard block
 block discarded – undo
2211 2211
          */
2212 2212
         do_action('geodir_before_detail_fields');
2213 2213
         ?>
2214
-        <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5>
2214
+        <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT; ?></h5>
2215 2215
         <?php
2216 2216
         /**
2217 2217
          * Called at the top of the add listing page form for frontend.
@@ -2232,10 +2232,10 @@  discard block
 block discarded – undo
2232 2232
                  * @param string $cpt_singular_name The singular title of the curent CPT.
2233 2233
                  * @param string $listing_type The CPT being requested. ie: gd_place.
2234 2234
                  */
2235
-                echo apply_filters('geodir_add_listing_title_label', sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span>*</span> </label>
2235
+                echo apply_filters('geodir_add_listing_title_label', sprintf(__('%s Title', 'geodirectory'), $cpt_singular_name), $cpt_singular_name, $listing_type); ?><span>*</span> </label>
2236 2236
             <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield"
2237 2237
                    value="<?php echo esc_attr(stripslashes($title)); ?>"/>
2238
-            <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span>
2238
+            <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
2239 2239
         </div>
2240 2240
         <?php
2241 2241
         $show_editor = get_option('geodir_tiny_editor_on_add_listing');
@@ -2281,7 +2281,7 @@  discard block
 block discarded – undo
2281 2281
         $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2282 2282
         
2283 2283
         $desc_class = '';
2284
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2284
+        if ($desc_limit === '' || (int) $desc_limit > 0) {
2285 2285
             /**
2286 2286
              * Called on the add listing page form for frontend just before the description field.
2287 2287
              *
@@ -2294,7 +2294,7 @@  discard block
 block discarded – undo
2294 2294
             $desc_class = ' hidden';
2295 2295
         }
2296 2296
         ?>
2297
-        <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>">
2297
+        <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class; ?>">
2298 2298
             <label><?php
2299 2299
                 /**
2300 2300
                  * Filter the add listing page description input label.
@@ -2304,7 +2304,7 @@  discard block
 block discarded – undo
2304 2304
                  * @param string $cpt_singular_name The singular title of the curent CPT.
2305 2305
                  * @param string $listing_type The CPT being requested. ie: gd_place.
2306 2306
                  */
2307
-                echo apply_filters('geodir_add_listing_description_label',sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2307
+                echo apply_filters('geodir_add_listing_description_label', sprintf(__('%s Description', 'geodirectory'), $cpt_singular_name), $cpt_singular_name, $listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2308 2308
             <?php
2309 2309
             if ($show_editor) {
2310 2310
                 $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
@@ -2313,16 +2313,16 @@  discard block
 block discarded – undo
2313 2313
                     <?php wp_editor($desc, "post_desc", $editor_settings); ?>
2314 2314
                 </div>
2315 2315
             <?php if ($desc_limit != '') { ?>
2316
-                <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit;?>");</script>
2316
+                <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit; ?>");</script>
2317 2317
             <?php } } else { ?>
2318 2318
                 <textarea field_type="textarea" name="post_desc" id="post_desc" class="geodir_textarea" maxlength="<?php echo $desc_limit; ?>"><?php echo $desc; ?></textarea>
2319 2319
             <?php } if ($desc_limit_msg != '') { ?>
2320 2320
                 <span class="geodir_message_note"><?php echo $desc_limit_msg; ?></span>
2321 2321
             <?php } ?>
2322
-            <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span>
2322
+            <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory'); ?></span>
2323 2323
         </div>
2324 2324
         <?php
2325
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2325
+        if ($desc_limit === '' || (int) $desc_limit > 0) {
2326 2326
             /**
2327 2327
              * Called on the add listing page form for frontend just after the description field.
2328 2328
              *
@@ -2361,7 +2361,7 @@  discard block
 block discarded – undo
2361 2361
         $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2362 2362
         
2363 2363
         $tags_class = '';
2364
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2364
+        if ($kw_tags_count === '' || (int) $kw_tags_count > 0) {
2365 2365
             /**
2366 2366
              * Called on the add listing page form for frontend just before the tags field.
2367 2367
              *
@@ -2372,14 +2372,14 @@  discard block
 block discarded – undo
2372 2372
             $tags_class = ' hidden';
2373 2373
         }
2374 2374
         ?>
2375
-        <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>">
2375
+        <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class; ?>">
2376 2376
             <label><?php echo TAGKW_TEXT; ?></label>
2377 2377
             <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield"
2378
-                   maxlength="<?php echo $kw_tags_count;?>"/>
2379
-            <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span>
2378
+                   maxlength="<?php echo $kw_tags_count; ?>"/>
2379
+            <span class="geodir_message_note"><?php echo $kw_tags_msg; ?></span>
2380 2380
         </div>
2381 2381
         <?php
2382
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2382
+        if ($kw_tags_count === '' || (int) $kw_tags_count > 0) {
2383 2383
             /**
2384 2384
              * Called on the add listing page form for frontend just after the tags field.
2385 2385
              *
@@ -2405,7 +2405,7 @@  discard block
 block discarded – undo
2405 2405
         $thumb_img_arr = array();
2406 2406
         $totImg = 0;
2407 2407
         if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2408
-            $post = (object)$gd_session->get('listing');
2408
+            $post = (object) $gd_session->get('listing');
2409 2409
             if (isset($post->post_images))
2410 2410
                 $curImages = trim($post->post_images, ",");
2411 2411
 
@@ -2418,7 +2418,7 @@  discard block
 block discarded – undo
2418 2418
             $listing_type = $post->listing_type;
2419 2419
 
2420 2420
         } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2421
-            $post = geodir_get_post_info((int)$_REQUEST['pid']);
2421
+            $post = geodir_get_post_info((int) $_REQUEST['pid']);
2422 2422
             $listing_type = $post->post_type;
2423 2423
             $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2424 2424
 
@@ -2432,7 +2432,7 @@  discard block
 block discarded – undo
2432 2432
                 //$curImages = $img->src.",";
2433 2433
             }
2434 2434
 
2435
-            $totImg = count((array)$thumb_img_arr);
2435
+            $totImg = count((array) $thumb_img_arr);
2436 2436
         }
2437 2437
 
2438 2438
         if ($curImages != '')
@@ -2453,15 +2453,15 @@  discard block
 block discarded – undo
2453 2453
         if ($show_image_input_box) {
2454 2454
             ?>
2455 2455
 
2456
-            <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?>
2456
+            <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT; ?>
2457 2457
                 <?php if ($image_limit == 1) {
2458
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2458
+                    echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('image with this package', 'geodirectory').')</small>';
2459 2459
                 } ?>
2460 2460
                 <?php if ($image_limit > 1) {
2461
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2461
+                    echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('images with this package', 'geodirectory').')</small>';
2462 2462
                 } ?>
2463 2463
                 <?php if ($image_limit == '') {
2464
-                    echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2464
+                    echo '<br /><small>('.__('You can upload unlimited images with this package', 'geodirectory').')</small>';
2465 2465
                 } ?>
2466 2466
             </h5>
2467 2467
 
@@ -2476,11 +2476,11 @@  discard block
 block discarded – undo
2476 2476
                 <div
2477 2477
                     class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
2478 2478
                     id="<?php echo $id; ?>plupload-upload-ui">
2479
-                    <h4><?php _e('Drop files to upload', 'geodirectory');?></h4><br/>
2479
+                    <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4><br/>
2480 2480
                     <input id="<?php echo $id; ?>plupload-browse-button" type="button"
2481 2481
                            value="<?php esc_attr_e('Select Files', 'geodirectory'); ?>" class="geodir_button"/>
2482 2482
                     <span class="ajaxnonceplu"
2483
-                          id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span>
2483
+                          id="ajaxnonceplu<?php echo wp_create_nonce($id.'pluploadan'); ?>"></span>
2484 2484
                     <?php if ($width && $height): ?>
2485 2485
                         <span class="plupload-resize"></span>
2486 2486
                         <span class="plupload-width" id="plupload-width<?php echo $width; ?>"></span>
@@ -2493,7 +2493,7 @@  discard block
 block discarded – undo
2493 2493
                      id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;">
2494 2494
                 </div>
2495 2495
                 <span
2496
-                    id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory');?></span>
2496
+                    id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory'); ?></span>
2497 2497
                 <span id="<?php echo $id; ?>upload-error" style="display:none"></span>
2498 2498
             </div>
2499 2499
 
@@ -2505,7 +2505,7 @@  discard block
 block discarded – undo
2505 2505
          *
2506 2506
          * @since 1.0.0
2507 2507
          */
2508
-        do_action('geodir_after_main_form_fields');?>
2508
+        do_action('geodir_after_main_form_fields'); ?>
2509 2509
 
2510 2510
 
2511 2511
         <!-- add captcha code -->
@@ -2516,7 +2516,7 @@  discard block
 block discarded – undo
2516 2516
         </script>
2517 2517
         <noscript>
2518 2518
             <div>
2519
-                <label><?php _e('Type 64 into this box', 'geodirectory');?></label>
2519
+                <label><?php _e('Type 64 into this box', 'geodirectory'); ?></label>
2520 2520
                 <input type="text" id="geodir_spamblocker_top_form" name="geodir_spamblocker" value="" maxlength="10"/>
2521 2521
             </div>
2522 2522
         </noscript>
@@ -2526,10 +2526,10 @@  discard block
 block discarded – undo
2526 2526
         <!-- end captcha code -->
2527 2527
 
2528 2528
         <div id="geodir-add-listing-submit" class="geodir_form_row clear_both" style="padding:2px;text-align:center;">
2529
-            <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON;?>"
2530
-                   class="geodir_button" <?php echo $submit_button;?>/>
2529
+            <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON; ?>"
2530
+                   class="geodir_button" <?php echo $submit_button; ?>/>
2531 2531
             <span class="geodir_message_note"
2532
-                  style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory');?></span>
2532
+                  style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory'); ?></span>
2533 2533
         </div>
2534 2534
 
2535 2535
     </form>
@@ -2591,7 +2591,7 @@  discard block
 block discarded – undo
2591 2591
         class="<?php
2592 2592
         /** This action is documented in geodirectory_template_actions.php */
2593 2593
         echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2594
-        <?php dynamic_sidebar('Reg/Login Top Section');?>
2594
+        <?php dynamic_sidebar('Reg/Login Top Section'); ?>
2595 2595
     </div><!-- clearfix ends here-->
2596 2596
 <?php
2597 2597
 }
@@ -2611,11 +2611,11 @@  discard block
 block discarded – undo
2611 2611
 
2612 2612
     global $user_login;
2613 2613
     
2614
-    $is_enable_signup = get_option( 'users_can_register' );
2614
+    $is_enable_signup = get_option('users_can_register');
2615 2615
     
2616 2616
     ?>
2617 2617
     <script type="text/javascript">
2618
-        <?php if ( $user_login ) { ?>
2618
+        <?php if ($user_login) { ?>
2619 2619
         setTimeout(function () {
2620 2620
             try {
2621 2621
                 d = document.getElementById('user_pass');
@@ -2632,7 +2632,7 @@  discard block
 block discarded – undo
2632 2632
         <?php } ?>
2633 2633
     </script>
2634 2634
     <script type="text/javascript">
2635
-        <?php if ( $user_login ) { ?>
2635
+        <?php if ($user_login) { ?>
2636 2636
         setTimeout(function () {
2637 2637
             try {
2638 2638
                 d = document.getElementById('user_pass');
@@ -2657,7 +2657,7 @@  discard block
 block discarded – undo
2657 2657
         foreach ($errors as $errorsObj) {
2658 2658
             foreach ($errorsObj as $key => $val) {
2659 2659
                 for ($i = 0; $i < count($val); $i++) {
2660
-                    echo "<div class=error_msg_fix>" . $val[$i] . '</div>';
2660
+                    echo "<div class=error_msg_fix>".$val[$i].'</div>';
2661 2661
                     $registration_error_msg = 1;
2662 2662
                 }
2663 2663
             }
@@ -2674,10 +2674,10 @@  discard block
 block discarded – undo
2674 2674
              *
2675 2675
              * @since 1.0.0
2676 2676
              */
2677
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2677
+            include(geodir_plugin_path()."/geodirectory-templates/login_frm.php"); ?>
2678 2678
         </div>
2679 2679
 
2680
-    <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up' && $is_enable_signup ) { ?>
2680
+    <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up' && $is_enable_signup) { ?>
2681 2681
 
2682 2682
         <div class="registration_form">
2683 2683
             <?php
@@ -2686,7 +2686,7 @@  discard block
 block discarded – undo
2686 2686
              *
2687 2687
              * @since 1.0.0
2688 2688
              */
2689
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2689
+            include(geodir_plugin_path()."/geodirectory-templates/reg_frm.php"); ?>
2690 2690
         </div>
2691 2691
 
2692 2692
     <?php } else { ?>
@@ -2698,10 +2698,10 @@  discard block
 block discarded – undo
2698 2698
              *
2699 2699
              * @since 1.0.0
2700 2700
              */
2701
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2701
+            include(geodir_plugin_path()."/geodirectory-templates/login_frm.php"); ?>
2702 2702
         </div>
2703 2703
         
2704
-        <?php if ( $is_enable_signup ) { ?>
2704
+        <?php if ($is_enable_signup) { ?>
2705 2705
             <div class="registration_form_r">
2706 2706
                 <?php
2707 2707
                 /**
@@ -2709,7 +2709,7 @@  discard block
 block discarded – undo
2709 2709
                  *
2710 2710
                  * @since 1.0.0
2711 2711
                  */
2712
-                include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2712
+                include(geodir_plugin_path()."/geodirectory-templates/reg_frm.php"); ?>
2713 2713
             </div>
2714 2714
         <?php } ?>
2715 2715
 
@@ -2746,12 +2746,12 @@  discard block
 block discarded – undo
2746 2746
     $gd_post_type = geodir_get_current_posttype();
2747 2747
     $post_type_info = get_post_type_object($gd_post_type);
2748 2748
 
2749
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
2749
+    $add_string_in_title = __('All', 'geodirectory').' ';
2750 2750
     if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2751
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2751
+        $add_string_in_title = __('My Favorite', 'geodirectory').' ';
2752 2752
     }
2753 2753
 
2754
-    $list_title = $add_string_in_title . $post_type_info->labels->name;
2754
+    $list_title = $add_string_in_title.$post_type_info->labels->name;
2755 2755
     $single_name = $post_type_info->labels->singular_name;
2756 2756
 
2757 2757
     $taxonomy = geodir_get_taxonomies($gd_post_type);
@@ -2759,12 +2759,12 @@  discard block
 block discarded – undo
2759 2759
     if (!empty($term)) {
2760 2760
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
2761 2761
         if (!empty($current_term))
2762
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2762
+            $list_title .= __(' in', 'geodirectory')." '".geodir_ucwords($current_term->name)."'";
2763 2763
     }
2764 2764
 
2765 2765
 
2766 2766
     if (is_search()) {
2767
-        $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2767
+        $list_title = __('Search', 'geodirectory').' '.__($post_type_info->labels->name, 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
2768 2768
 
2769 2769
     }
2770 2770
     /** This action is documented in geodirectory_template_actions.php */
@@ -2773,11 +2773,11 @@  discard block
 block discarded – undo
2773 2773
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2774 2774
 
2775 2775
     $title = $list_title;
2776
-    if(geodir_is_page('author')){
2776
+    if (geodir_is_page('author')) {
2777 2777
         $gd_page = 'author';
2778
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2778
+        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2779 2779
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2780
-        }else{
2780
+        } else {
2781 2781
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2782 2782
         }
2783 2783
 
@@ -2791,16 +2791,16 @@  discard block
 block discarded – undo
2791 2791
      * @param string $title The page title including variables.
2792 2792
      * @param string $gd_page The GeoDirectory page type if any.
2793 2793
      */
2794
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2794
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2795 2795
 
2796
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2796
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.
2797 2797
         /**
2798 2798
          * Filter the author page title text.
2799 2799
          *
2800 2800
          * @since 1.0.0
2801 2801
          * @param string $list_title The title for the page.
2802 2802
          */
2803
-        apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2803
+        apply_filters('geodir_author_page_title_text', $title).'</h1></header>';
2804 2804
 }
2805 2805
 
2806 2806
 
@@ -3005,19 +3005,19 @@  discard block
 block discarded – undo
3005 3005
     $post_type_info = get_post_type_object($gd_post_type);
3006 3006
 
3007 3007
     $pt_name = '';
3008
-    if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
3008
+    if (isset($post_type_info->labels->name)) {$pt_name = $post_type_info->labels->name; }
3009 3009
 
3010 3010
     if (is_search()) {
3011
-        $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
3011
+        $list_title = __('Search', 'geodirectory').' '.__($pt_name, 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
3012 3012
 
3013 3013
     }
3014 3014
     /** This action is documented in geodirectory_template_actions.php */
3015 3015
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
3016 3016
     /** This action is documented in geodirectory_template_actions.php */
3017 3017
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
3018
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
3018
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.
3019 3019
         /** This action is documented in geodirectory_template_actions.php */
3020
-        apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
3020
+        apply_filters('geodir_listing_page_title', wptexturize($list_title)).'</h1></header>';
3021 3021
 }
3022 3022
 
3023 3023
 // action for adding the listings page top widget area
@@ -3421,7 +3421,7 @@  discard block
 block discarded – undo
3421 3421
         $gd_post_type = geodir_get_current_posttype();
3422 3422
         $post_type_info = get_post_type_object($gd_post_type);
3423 3423
 
3424
-        $list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3424
+        $list_title = __('Search', 'geodirectory').' '.__(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory').__(' :', 'geodirectory');
3425 3425
     }
3426 3426
     return $list_title;
3427 3427
 }
@@ -3437,7 +3437,7 @@  discard block
 block discarded – undo
3437 3437
  * @param string $position Position to add the post content. 'before' or 'after'. Default 'before'.
3438 3438
  * @param string $gd_page The geodirectory page type. Default null.
3439 3439
  */
3440
-function geodir_add_page_content( $position = 'before', $gd_page = '' ) {
3440
+function geodir_add_page_content($position = 'before', $gd_page = '') {
3441 3441
     global $post;
3442 3442
 
3443 3443
     $gd_page_id = NULL;
@@ -3513,17 +3513,17 @@  discard block
 block discarded – undo
3513 3513
  * @param WP_Post $post           WP_Post object.
3514 3514
  * @return string Filtered SQL JOIN clause.
3515 3515
  */
3516
-function geodir_previous_next_post_join( $join, $in_same_term, $excluded_terms, $taxonomy, $post ) {
3516
+function geodir_previous_next_post_join($join, $in_same_term, $excluded_terms, $taxonomy, $post) {
3517 3517
     global $plugin_prefix;
3518 3518
 
3519
-    if ( !empty($post->post_type) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3520
-        $join .= " INNER JOIN " . $plugin_prefix . $post->post_type . "_detail AS gd ON gd.post_id = p.ID";
3519
+    if (!empty($post->post_type) && in_array($post->post_type, geodir_get_posttypes())) {
3520
+        $join .= " INNER JOIN ".$plugin_prefix.$post->post_type."_detail AS gd ON gd.post_id = p.ID";
3521 3521
     }
3522 3522
     
3523 3523
     return $join;
3524 3524
 }
3525
-add_filter( 'get_previous_post_join', 'geodir_previous_next_post_join', 10, 5 );
3526
-add_filter( 'get_next_post_join', 'geodir_previous_next_post_join', 10, 5 );
3525
+add_filter('get_previous_post_join', 'geodir_previous_next_post_join', 10, 5);
3526
+add_filter('get_next_post_join', 'geodir_previous_next_post_join', 10, 5);
3527 3527
 
3528 3528
 /**
3529 3529
  * Filters the WHERE clause in the SQL for an adjacent post query.
@@ -3541,32 +3541,32 @@  discard block
 block discarded – undo
3541 3541
  * @param WP_Post $post          WP_Post object.
3542 3542
  * @return string Filtered SQL WHERE clause.
3543 3543
  */
3544
-function geodir_previous_next_post_where( $where, $in_same_term, $excluded_terms, $taxonomy, $post ) {
3544
+function geodir_previous_next_post_where($where, $in_same_term, $excluded_terms, $taxonomy, $post) {
3545 3545
     global $wpdb, $plugin_prefix;
3546 3546
 
3547
-    if ( !empty($post->post_type) && ( !empty( $post->country_slug ) || !empty( $post->region_slug ) || !empty( $post->city_slug ) ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3547
+    if (!empty($post->post_type) && (!empty($post->country_slug) || !empty($post->region_slug) || !empty($post->city_slug)) && in_array($post->post_type, geodir_get_posttypes())) {
3548 3548
         $post_locations = '';
3549 3549
         $post_locations_var = array();
3550 3550
         
3551
-        if ( !empty( $post->country_slug ) ) {
3551
+        if (!empty($post->country_slug)) {
3552 3552
             $post_locations .= " AND post_locations LIKE %s";
3553
-            $post_locations_var[] = "%,[" . $post->country_slug . "]";
3553
+            $post_locations_var[] = "%,[".$post->country_slug."]";
3554 3554
         }
3555 3555
 
3556
-        if ( !empty( $post->region_slug ) ) {
3556
+        if (!empty($post->region_slug)) {
3557 3557
             $post_locations .= " AND post_locations LIKE %s";
3558
-            $post_locations_var[] = "%,[" . $post->region_slug . "],%";
3558
+            $post_locations_var[] = "%,[".$post->region_slug."],%";
3559 3559
         }
3560 3560
 
3561
-        if ( !empty( $post->city_slug ) ) {
3561
+        if (!empty($post->city_slug)) {
3562 3562
             $post_locations .= " AND post_locations LIKE %s";
3563
-            $post_locations_var[] = "[" . $post->city_slug . "],%";
3563
+            $post_locations_var[] = "[".$post->city_slug."],%";
3564 3564
         }
3565 3565
         
3566
-        $where .= $wpdb->prepare( $post_locations, $post_locations_var );
3566
+        $where .= $wpdb->prepare($post_locations, $post_locations_var);
3567 3567
     }
3568 3568
     
3569 3569
     return $where;
3570 3570
 }
3571
-add_filter( 'get_previous_post_where', 'geodir_previous_next_post_where', 10, 5 );
3572
-add_filter( 'get_next_post_where', 'geodir_previous_next_post_where', 10, 5 );
3573 3571
\ No newline at end of file
3572
+add_filter('get_previous_post_where', 'geodir_previous_next_post_where', 10, 5);
3573
+add_filter('get_next_post_where', 'geodir_previous_next_post_where', 10, 5);
3574 3574
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +31 added lines, -24 removed lines patch added patch discarded remove patch
@@ -715,8 +715,9 @@  discard block
 block discarded – undo
715 715
 
716 716
                         if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
717 717
                             if ($term_icon_url = geodir_get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
718
-                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
719
-                                    $term_icon = $term_icon_url['src'];
718
+                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '') {
719
+                                                                    $term_icon = $term_icon_url['src'];
720
+                                }
720 721
                                 break;
721 722
                             }
722 723
                         }
@@ -1265,8 +1266,9 @@  discard block
 block discarded – undo
1265 1266
         echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1266 1267
     }
1267 1268
 
1268
-    if (isset($taxonomies[$post_type . '_tags']))
1269
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1269
+    if (isset($taxonomies[$post_type . '_tags'])) {
1270
+            echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1271
+    }
1270 1272
 
1271 1273
     ?>
1272 1274
     </p><?php
@@ -1634,23 +1636,21 @@  discard block
 block discarded – undo
1634 1636
     if(geodir_is_page('pt')){
1635 1637
         $gd_page = 'pt';
1636 1638
         $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1637
-    }
1638
-    elseif(geodir_is_page('listing')){
1639
+    } elseif(geodir_is_page('listing')){
1639 1640
         $gd_page = 'listing';
1640 1641
         global $wp_query;
1641 1642
         $current_term = $wp_query->get_queried_object();
1642 1643
         if (strpos($current_term->taxonomy,'_tags') !== false) {
1643 1644
             $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1644
-        }else{
1645
+        } else{
1645 1646
             $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1646 1647
         }
1647 1648
 
1648
-    }
1649
-    elseif(geodir_is_page('author')){
1649
+    } elseif(geodir_is_page('author')){
1650 1650
         $gd_page = 'author';
1651 1651
         if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1652 1652
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1653
-        }else{
1653
+        } else{
1654 1654
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1655 1655
         }
1656 1656
 
@@ -2074,8 +2074,9 @@  discard block
 block discarded – undo
2074 2074
  */
2075 2075
 function geodir_action_add_listing_page_title()
2076 2076
 {
2077
-    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2078
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2077
+    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '') {
2078
+            $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2079
+    }
2079 2080
     /** This action is documented in geodirectory_template_actions.php */
2080 2081
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2081 2082
     /** This action is documented in geodirectory_template_actions.php */
@@ -2087,7 +2088,7 @@  discard block
 block discarded – undo
2087 2088
         $gd_page = 'add-listing';
2088 2089
         if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2089 2090
             $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2090
-        }elseif(isset($listing_type)){
2091
+        } elseif(isset($listing_type)){
2091 2092
             $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2092 2093
         }
2093 2094
 
@@ -2406,8 +2407,9 @@  discard block
 block discarded – undo
2406 2407
         $totImg = 0;
2407 2408
         if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2408 2409
             $post = (object)$gd_session->get('listing');
2409
-            if (isset($post->post_images))
2410
-                $curImages = trim($post->post_images, ",");
2410
+            if (isset($post->post_images)) {
2411
+                            $curImages = trim($post->post_images, ",");
2412
+            }
2411 2413
 
2412 2414
 
2413 2415
             if ($curImages != '') {
@@ -2435,10 +2437,13 @@  discard block
 block discarded – undo
2435 2437
             $totImg = count((array)$thumb_img_arr);
2436 2438
         }
2437 2439
 
2438
-        if ($curImages != '')
2439
-            $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2440
-        else
2441
-            $svalue = '';
2440
+        if ($curImages != '') {
2441
+                    $svalue = $curImages;
2442
+        }
2443
+        // this will be initial value of the above form field. Image urls.
2444
+        else {
2445
+                    $svalue = '';
2446
+        }
2442 2447
 
2443 2448
         $image_limit = isset($package_info->image_limit) ? $package_info->image_limit : '0';
2444 2449
         $show_image_input_box = ($image_limit != '0');
@@ -2650,8 +2655,9 @@  discard block
 block discarded – undo
2650 2655
     </script><?php
2651 2656
 
2652 2657
     global $errors;
2653
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2654
-        $errors->add('claim_login', LOGIN_CLAIM);
2658
+    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim') {
2659
+            $errors->add('claim_login', LOGIN_CLAIM);
2660
+    }
2655 2661
 
2656 2662
     if (!empty($errors)) {
2657 2663
         foreach ($errors as $errorsObj) {
@@ -2758,8 +2764,9 @@  discard block
 block discarded – undo
2758 2764
 
2759 2765
     if (!empty($term)) {
2760 2766
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
2761
-        if (!empty($current_term))
2762
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2767
+        if (!empty($current_term)) {
2768
+                    $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2769
+        }
2763 2770
     }
2764 2771
 
2765 2772
 
@@ -2777,7 +2784,7 @@  discard block
 block discarded – undo
2777 2784
         $gd_page = 'author';
2778 2785
         if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2779 2786
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2780
-        }else{
2787
+        } else{
2781 2788
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2782 2789
         }
2783 2790
 
Please login to merge, or discard this patch.
geodirectory-functions/cat-meta-functions/cat_meta.php 3 patches
Indentation   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -11,142 +11,142 @@  discard block
 block discarded – undo
11 11
 //include the main class file
12 12
 require_once("Tax-meta-class.php");
13 13
 if (is_admin()) {
14
-    /*
14
+	/*
15 15
      * prefix of meta keys, optional
16 16
      * use underscore (_) at the beginning to make keys hidden, for example $prefix = '_ba_';
17 17
      *  you also can make prefix empty to disable it
18 18
      *
19 19
      */
20 20
 
21
-    $prefix = 'ct_';
22
-    /*
21
+	$prefix = 'ct_';
22
+	/*
23 23
      * configure your meta box
24 24
      */
25 25
 
26
-    $config = array(
27
-        'id' => 'demo_meta_box',                    // meta box id, unique per meta box
28
-        'title' => __('Demo Meta Box', 'geodirectory'),                    // meta box title
29
-        'pages' => geodir_get_taxonomies(),            // taxonomy name, accept categories, post_tag and custom taxonomies
30
-        'context' => 'normal',                        // where the meta box appear: normal (default), advanced, side; optional
31
-        'fields' => array(),                        // list of meta fields (can be added by field arrays)
32
-        'local_images' => false,                    // Use local or hosted images (meta box images for add/remove)
33
-        'use_with_theme' => true                    //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).
34
-    );
26
+	$config = array(
27
+		'id' => 'demo_meta_box',                    // meta box id, unique per meta box
28
+		'title' => __('Demo Meta Box', 'geodirectory'),                    // meta box title
29
+		'pages' => geodir_get_taxonomies(),            // taxonomy name, accept categories, post_tag and custom taxonomies
30
+		'context' => 'normal',                        // where the meta box appear: normal (default), advanced, side; optional
31
+		'fields' => array(),                        // list of meta fields (can be added by field arrays)
32
+		'local_images' => false,                    // Use local or hosted images (meta box images for add/remove)
33
+		'use_with_theme' => true                    //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).
34
+	);
35 35
 
36 36
 
37
-    /*
37
+	/*
38 38
      * Initiate your meta box
39 39
      */
40
-    $my_meta = new Geodir_Tax_Meta_Class($config);
41
-    $my_meta->addWysiwyg($prefix . 'cat_top_desc', array('name' => __('Category Top Description', 'geodirectory'), 'desc' => __('This will appear at the top of the category listing.', 'geodirectory')));
42
-    $my_meta->addImage($prefix . 'cat_default_img', array('name' => __('Default Listing Image', 'geodirectory'), 'desc' => __('Choose a default "no image"', 'geodirectory')));
43
-    $my_meta->addImage($prefix . 'cat_icon', array('name' => __('Category Icon', 'geodirectory'), 'desc' => __('Choose a category icon', 'geodirectory'), 'validate_func' => '!empty'));
44
-    /*$my_meta->addCheckbox($prefix.'pointless',array('name'=> __('<b>Exclude</b> Rating sort option','geodirectory'),'style'=>'hidden'));*/// hidden setting to trick WPML
45
-
46
-    $my_meta->addSelect($prefix . 'cat_schema',
47
-    /*
40
+	$my_meta = new Geodir_Tax_Meta_Class($config);
41
+	$my_meta->addWysiwyg($prefix . 'cat_top_desc', array('name' => __('Category Top Description', 'geodirectory'), 'desc' => __('This will appear at the top of the category listing.', 'geodirectory')));
42
+	$my_meta->addImage($prefix . 'cat_default_img', array('name' => __('Default Listing Image', 'geodirectory'), 'desc' => __('Choose a default "no image"', 'geodirectory')));
43
+	$my_meta->addImage($prefix . 'cat_icon', array('name' => __('Category Icon', 'geodirectory'), 'desc' => __('Choose a category icon', 'geodirectory'), 'validate_func' => '!empty'));
44
+	/*$my_meta->addCheckbox($prefix.'pointless',array('name'=> __('<b>Exclude</b> Rating sort option','geodirectory'),'style'=>'hidden'));*/// hidden setting to trick WPML
45
+
46
+	$my_meta->addSelect($prefix . 'cat_schema',
47
+	/*
48 48
      * Allows you to add/filter the cat schema types.
49 49
      *
50 50
      * @since 1.5.7
51 51
      */
52
-        apply_filters('geodir_cat_schemas',array(
53
-            '' => __('Default (LocalBusiness)', 'geodirectory'),
54
-            'AccountingService' => 'AccountingService',
55
-            'Attorney' => 'Attorney',
56
-            'AutoBodyShop' => 'AutoBodyShop',
57
-            'AutoDealer' => 'AutoDealer',
58
-            'AutoPartsStore' => 'AutoPartsStore',
59
-            'AutoRental' => 'AutoRental',
60
-            'AutoRepair' => 'AutoRepair',
61
-            'AutoWash' => 'AutoWash',
62
-            'Bakery' => 'Bakery',
63
-            'BarOrPub' => 'BarOrPub',
64
-            'BeautySalon' => 'BeautySalon',
65
-            'BedAndBreakfast' => 'BedAndBreakfast',
66
-            'BikeStore' => 'BikeStore',
67
-            'BookStore' => 'BookStore',
68
-            'CafeOrCoffeeShop' => 'CafeOrCoffeeShop',
69
-            'Campground' => 'Campground',
70
-            'ChildCare' => 'ChildCare',
71
-            'ClothingStore' => 'ClothingStore',
72
-            'ComputerStore' => 'ComputerStore',
73
-            'DaySpa' => 'DaySpa',
74
-            'Dentist' => 'Dentist',
75
-            'DryCleaningOrLaundry' => 'DryCleaningOrLaundry',
76
-            'Electrician' => 'Electrician',
77
-            'ElectronicsStore' => 'ElectronicsStore',
78
-            'EmergencyService' => 'EmergencyService',
79
-            'EntertainmentBusiness' => 'EntertainmentBusiness',
80
-            'Event' => 'Event',
81
-            'EventVenue' => 'EventVenue',
82
-            'ExerciseGym' => 'ExerciseGym',
83
-            'FinancialService' => 'FinancialService',
84
-            'Florist' => 'Florist',
85
-            'FoodEstablishment' => 'FoodEstablishment',
86
-            'FurnitureStore' => 'FurnitureStore',
87
-            'GardenStore' => 'GardenStore',
88
-            'GeneralContractor' => 'GeneralContractor',
89
-            'GolfCourse' => 'GolfCourse',
90
-            'HairSalon' => 'HairSalon',
91
-            'HardwareStore' => 'HardwareStore',
92
-            'HealthAndBeautyBusiness' => 'HealthAndBeautyBusiness',
93
-            'HobbyShop' => 'HobbyShop',
94
-            'HomeAndConstructionBusiness' => 'HomeAndConstructionBusiness',
95
-            'HomeGoodsStore' => 'HomeGoodsStore',
96
-            'Hospital' => 'Hospital',
97
-            'Hostel' => 'Hostel',
98
-            'Hotel' => 'Hotel',
99
-            'HousePainter' => 'HousePainter',
100
-            'HVACBusiness' => 'HVACBusiness',
101
-            'InsuranceAgency' => 'InsuranceAgency',
102
-            'JewelryStore' => 'JewelryStore',
103
-            'LiquorStore' => 'LiquorStore',
104
-            'Locksmith' => 'Locksmith',
105
-            'LodgingBusiness' => 'LodgingBusiness',
106
-            'MedicalClinic' => 'MedicalClinic',
107
-            'MensClothingStore' => 'MensClothingStore',
108
-            'MobilePhoneStore' => 'MobilePhoneStore',
109
-            'Motel' => 'Motel',
110
-            'MotorcycleDealer' => 'MotorcycleDealer',
111
-            'MotorcycleRepair' => 'MotorcycleRepair',
112
-            'MovingCompany' => 'MovingCompany',
113
-            'MusicStore' => 'MusicStore',
114
-            'NailSalon' => 'NailSalon',
115
-            'NightClub' => 'NightClub',
116
-            'Notary' => 'Notary',
117
-            'OfficeEquipmentStore' => 'OfficeEquipmentStore',
118
-            'Optician' => 'Optician',
119
-            'PetStore' => 'PetStore',
120
-            'Physician' => 'Physician',
121
-            'Plumber' => 'Plumber',
122
-            'ProfessionalService' => 'ProfessionalService',
123
-            'RealEstateAgent' => 'RealEstateAgent',
124
-            'Residence' => 'Residence',
125
-            'Restaurant' => 'Restaurant',
126
-            'RoofingContractor' => 'RoofingContractor',
127
-            'RVPark' => 'RVPark',
128
-            'School' => 'School',
129
-            'SelfStorage' => 'SelfStorage',
130
-            'ShoeStore' => 'ShoeStore',
131
-            'SkiResort' => 'SkiResort',
132
-            'SportingGoodsStore' => 'SportingGoodsStore',
133
-            'SportsClub' => 'SportsClub',
134
-            'Store' => 'Store',
135
-            'TattooParlor' => 'TattooParlor',
136
-            'Taxi' => 'Taxi',
137
-            'TennisComplex' => 'TennisComplex',
138
-            'TireShop' => 'TireShop',
139
-            'TouristAttraction' => 'TouristAttraction',
140
-            'ToyStore' => 'ToyStore',
141
-            'TravelAgency' => 'TravelAgency',
142
-            //'VacationRentals' => 'VacationRentals', // Not recognised by google yet
143
-            'VeterinaryCare' => 'VeterinaryCare',
144
-            'WholesaleStore' => 'WholesaleStore',
145
-            'Winery' => 'Winery'
146
-        )),
147
-        array('name' => __('Schema Type', 'geodirectory'), 'desc' => __('Select the Schema to use for this category', 'geodirectory') . "", 'std' => array('selectkey2')));
148
-
149
-    /*$my_meta->addSelect($prefix.'cat_sort',array(''=>__('Default' , 'geodirectory'),
52
+		apply_filters('geodir_cat_schemas',array(
53
+			'' => __('Default (LocalBusiness)', 'geodirectory'),
54
+			'AccountingService' => 'AccountingService',
55
+			'Attorney' => 'Attorney',
56
+			'AutoBodyShop' => 'AutoBodyShop',
57
+			'AutoDealer' => 'AutoDealer',
58
+			'AutoPartsStore' => 'AutoPartsStore',
59
+			'AutoRental' => 'AutoRental',
60
+			'AutoRepair' => 'AutoRepair',
61
+			'AutoWash' => 'AutoWash',
62
+			'Bakery' => 'Bakery',
63
+			'BarOrPub' => 'BarOrPub',
64
+			'BeautySalon' => 'BeautySalon',
65
+			'BedAndBreakfast' => 'BedAndBreakfast',
66
+			'BikeStore' => 'BikeStore',
67
+			'BookStore' => 'BookStore',
68
+			'CafeOrCoffeeShop' => 'CafeOrCoffeeShop',
69
+			'Campground' => 'Campground',
70
+			'ChildCare' => 'ChildCare',
71
+			'ClothingStore' => 'ClothingStore',
72
+			'ComputerStore' => 'ComputerStore',
73
+			'DaySpa' => 'DaySpa',
74
+			'Dentist' => 'Dentist',
75
+			'DryCleaningOrLaundry' => 'DryCleaningOrLaundry',
76
+			'Electrician' => 'Electrician',
77
+			'ElectronicsStore' => 'ElectronicsStore',
78
+			'EmergencyService' => 'EmergencyService',
79
+			'EntertainmentBusiness' => 'EntertainmentBusiness',
80
+			'Event' => 'Event',
81
+			'EventVenue' => 'EventVenue',
82
+			'ExerciseGym' => 'ExerciseGym',
83
+			'FinancialService' => 'FinancialService',
84
+			'Florist' => 'Florist',
85
+			'FoodEstablishment' => 'FoodEstablishment',
86
+			'FurnitureStore' => 'FurnitureStore',
87
+			'GardenStore' => 'GardenStore',
88
+			'GeneralContractor' => 'GeneralContractor',
89
+			'GolfCourse' => 'GolfCourse',
90
+			'HairSalon' => 'HairSalon',
91
+			'HardwareStore' => 'HardwareStore',
92
+			'HealthAndBeautyBusiness' => 'HealthAndBeautyBusiness',
93
+			'HobbyShop' => 'HobbyShop',
94
+			'HomeAndConstructionBusiness' => 'HomeAndConstructionBusiness',
95
+			'HomeGoodsStore' => 'HomeGoodsStore',
96
+			'Hospital' => 'Hospital',
97
+			'Hostel' => 'Hostel',
98
+			'Hotel' => 'Hotel',
99
+			'HousePainter' => 'HousePainter',
100
+			'HVACBusiness' => 'HVACBusiness',
101
+			'InsuranceAgency' => 'InsuranceAgency',
102
+			'JewelryStore' => 'JewelryStore',
103
+			'LiquorStore' => 'LiquorStore',
104
+			'Locksmith' => 'Locksmith',
105
+			'LodgingBusiness' => 'LodgingBusiness',
106
+			'MedicalClinic' => 'MedicalClinic',
107
+			'MensClothingStore' => 'MensClothingStore',
108
+			'MobilePhoneStore' => 'MobilePhoneStore',
109
+			'Motel' => 'Motel',
110
+			'MotorcycleDealer' => 'MotorcycleDealer',
111
+			'MotorcycleRepair' => 'MotorcycleRepair',
112
+			'MovingCompany' => 'MovingCompany',
113
+			'MusicStore' => 'MusicStore',
114
+			'NailSalon' => 'NailSalon',
115
+			'NightClub' => 'NightClub',
116
+			'Notary' => 'Notary',
117
+			'OfficeEquipmentStore' => 'OfficeEquipmentStore',
118
+			'Optician' => 'Optician',
119
+			'PetStore' => 'PetStore',
120
+			'Physician' => 'Physician',
121
+			'Plumber' => 'Plumber',
122
+			'ProfessionalService' => 'ProfessionalService',
123
+			'RealEstateAgent' => 'RealEstateAgent',
124
+			'Residence' => 'Residence',
125
+			'Restaurant' => 'Restaurant',
126
+			'RoofingContractor' => 'RoofingContractor',
127
+			'RVPark' => 'RVPark',
128
+			'School' => 'School',
129
+			'SelfStorage' => 'SelfStorage',
130
+			'ShoeStore' => 'ShoeStore',
131
+			'SkiResort' => 'SkiResort',
132
+			'SportingGoodsStore' => 'SportingGoodsStore',
133
+			'SportsClub' => 'SportsClub',
134
+			'Store' => 'Store',
135
+			'TattooParlor' => 'TattooParlor',
136
+			'Taxi' => 'Taxi',
137
+			'TennisComplex' => 'TennisComplex',
138
+			'TireShop' => 'TireShop',
139
+			'TouristAttraction' => 'TouristAttraction',
140
+			'ToyStore' => 'ToyStore',
141
+			'TravelAgency' => 'TravelAgency',
142
+			//'VacationRentals' => 'VacationRentals', // Not recognised by google yet
143
+			'VeterinaryCare' => 'VeterinaryCare',
144
+			'WholesaleStore' => 'WholesaleStore',
145
+			'Winery' => 'Winery'
146
+		)),
147
+		array('name' => __('Schema Type', 'geodirectory'), 'desc' => __('Select the Schema to use for this category', 'geodirectory') . "", 'std' => array('selectkey2')));
148
+
149
+	/*$my_meta->addSelect($prefix.'cat_sort',array(''=>__('Default' , 'geodirectory'),
150 150
     'random'=>__('Random','geodirectory'),
151 151
     'az'=>__('Alphabetical' , 'geodirectory'),
152 152
     'newest'=>__('Newest','geodirectory'),
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
     'low_review'=>__('Lowest Reviews','geodirectory')),
158 158
     array('name'=> __('Sort By','geodirectory'),'desc' => __('Select the default sort option.' ,'geodirectory'), 'std'=> array('selectkey2')));*/
159 159
 
160
-    // Show options for placecategories only
161
-    /*	if(isset($_REQUEST['taxonomy']) && in_array($_REQUEST['taxonomy'],$config['pages']) ){
160
+	// Show options for placecategories only
161
+	/*	if(isset($_REQUEST['taxonomy']) && in_array($_REQUEST['taxonomy'],$config['pages']) ){
162 162
         // Exclude sort options
163 163
         $my_meta->addCheckbox($prefix.'cat_exclude_rating',array('name'=> __('<b>Exclude</b> Rating sort option','geodirectory')));
164 164
         $my_meta->addCheckbox($prefix.'cat_exclude_reviews',array('name'=> __('<b>Exclude</b> Reviews sort option','geodirectory')));
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 
171 171
         }*/
172 172
 
173
-    //Finish Meta Box Declaration
174
-    $my_meta->Finish();
173
+	//Finish Meta Box Declaration
174
+	$my_meta->Finish();
175 175
 }
176 176
 
177 177
 
@@ -180,87 +180,87 @@  discard block
 block discarded – undo
180 180
 ##############################################################
181 181
 $gd_taxonomies = geodir_get_taxonomies();
182 182
 if (!empty($gd_taxonomies)) {
183
-    foreach ($gd_taxonomies as $gd_taxonomy) {
183
+	foreach ($gd_taxonomies as $gd_taxonomy) {
184 184
 
185
-        add_filter('manage_edit-' . $gd_taxonomy . '_columns', 'addCat_column', 10, 2);
186
-        add_action('manage_' . $gd_taxonomy . '_custom_column', 'manage_category_custom_fields', 10, 3);
185
+		add_filter('manage_edit-' . $gd_taxonomy . '_columns', 'addCat_column', 10, 2);
186
+		add_action('manage_' . $gd_taxonomy . '_custom_column', 'manage_category_custom_fields', 10, 3);
187 187
 
188
-    }
188
+	}
189 189
 }
190 190
 
191 191
 function addCat_column($columns)
192 192
 {
193
-    if (isset($columns['description']) && $posts = $columns['description']) {
194
-        unset($columns['description']);
195
-    }
196
-
197
-    $columns['cat_icon'] = 'Icon';
198
-    $columns['cat_default_img'] = __('Default Image', 'geodirectory');
199
-    $columns['cat_ID_num'] = __('Cat ID', 'geodirectory');
200
-    return $columns;
193
+	if (isset($columns['description']) && $posts = $columns['description']) {
194
+		unset($columns['description']);
195
+	}
196
+
197
+	$columns['cat_icon'] = 'Icon';
198
+	$columns['cat_default_img'] = __('Default Image', 'geodirectory');
199
+	$columns['cat_ID_num'] = __('Cat ID', 'geodirectory');
200
+	return $columns;
201 201
 }
202 202
 
203 203
 #############################################################
204 204
 function manage_category_custom_fields($deprecated, $column_name, $term_id)
205 205
 {
206
-    if ($column_name == 'cat_ID_num')
207
-        echo $term_id;
206
+	if ($column_name == 'cat_ID_num')
207
+		echo $term_id;
208 208
 
209
-    if ($column_name == 'cat_icon') {
210
-        $term_icon_url = geodir_get_tax_meta($term_id, 'ct_cat_icon');
209
+	if ($column_name == 'cat_icon') {
210
+		$term_icon_url = geodir_get_tax_meta($term_id, 'ct_cat_icon');
211 211
 
212
-        if ($term_icon_url != '') {
213
-            $file_info = pathinfo($term_icon_url['src']);
212
+		if ($term_icon_url != '') {
213
+			$file_info = pathinfo($term_icon_url['src']);
214 214
 
215
-            if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
216
-                $sub_dir = $file_info['dirname'];
217
-            } else {
218
-                $sub_dir = '';
219
-            }
215
+			if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
216
+				$sub_dir = $file_info['dirname'];
217
+			} else {
218
+				$sub_dir = '';
219
+			}
220 220
 
221
-            $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
222
-            $uploads_baseurl = $uploads['baseurl'];
223
-            $uploads_path = $uploads['path'];
221
+			$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
222
+			$uploads_baseurl = $uploads['baseurl'];
223
+			$uploads_path = $uploads['path'];
224 224
 
225
-            $file_name = $file_info['basename'];
225
+			$file_name = $file_info['basename'];
226 226
 
227
-            if (strpos($sub_dir, 'https://') !== false) {
228
-                $uploads['baseurl'] = str_replace('http://', 'https://', $uploads['baseurl']);
229
-            } else {
230
-                $uploads['baseurl'] = str_replace('https://', 'http://', $uploads['baseurl']);
231
-            }
232
-            $sub_dir = str_replace($uploads['baseurl'], '', $sub_dir);
227
+			if (strpos($sub_dir, 'https://') !== false) {
228
+				$uploads['baseurl'] = str_replace('http://', 'https://', $uploads['baseurl']);
229
+			} else {
230
+				$uploads['baseurl'] = str_replace('https://', 'http://', $uploads['baseurl']);
231
+			}
232
+			$sub_dir = str_replace($uploads['baseurl'], '', $sub_dir);
233 233
 
234
-            $uploads_url = $uploads_baseurl . $sub_dir;
234
+			$uploads_url = $uploads_baseurl . $sub_dir;
235 235
 
236
-            $term_icon_url['src'] = $uploads_url . '/' . $file_name;
237
-            echo '<img src="' . $term_icon_url['src'] . '" />';
238
-        }
239
-    }
236
+			$term_icon_url['src'] = $uploads_url . '/' . $file_name;
237
+			echo '<img src="' . $term_icon_url['src'] . '" />';
238
+		}
239
+	}
240 240
 
241
-    if ($column_name == 'cat_default_img') {
242
-        $cat_default_img = geodir_get_tax_meta($term_id, 'ct_cat_default_img');
243
-        if ($cat_default_img != '')
244
-            echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>';
241
+	if ($column_name == 'cat_default_img') {
242
+		$cat_default_img = geodir_get_tax_meta($term_id, 'ct_cat_default_img');
243
+		if ($cat_default_img != '')
244
+			echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>';
245 245
 
246
-    }
246
+	}
247 247
 }
248 248
 
249 249
 function geodir_get_default_catimage($term_id, $post_type = 'gd_place')
250 250
 {
251 251
 
252
-    if ($cat_default_img = geodir_get_tax_meta($term_id, 'ct_cat_default_img', '', $post_type))
253
-        return $cat_default_img;
254
-    else
255
-        return false;
252
+	if ($cat_default_img = geodir_get_tax_meta($term_id, 'ct_cat_default_img', '', $post_type))
253
+		return $cat_default_img;
254
+	else
255
+		return false;
256 256
 }
257 257
 
258 258
 //Clear custom fields
259 259
 add_action('in_admin_footer', 'geodir_tax_meta_clear_custom_field');
260 260
 function geodir_tax_meta_clear_custom_field()
261 261
 {
262
-    if (isset($_REQUEST['taxonomy']) && !empty($_REQUEST['taxonomy'])):
263
-        ?>
262
+	if (isset($_REQUEST['taxonomy']) && !empty($_REQUEST['taxonomy'])):
263
+		?>
264 264
         <script type="text/javascript">
265 265
             jQuery(document).ready(function () {
266 266
                 jQuery('#addtag #submit').click(function () {
@@ -281,5 +281,5 @@  discard block
 block discarded – undo
281 281
             });
282 282
         </script>
283 283
     <?php
284
-    endif;
284
+	endif;
285 285
 }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
      */
25 25
 
26 26
     $config = array(
27
-        'id' => 'demo_meta_box',                    // meta box id, unique per meta box
28
-        'title' => __('Demo Meta Box', 'geodirectory'),                    // meta box title
29
-        'pages' => geodir_get_taxonomies(),            // taxonomy name, accept categories, post_tag and custom taxonomies
30
-        'context' => 'normal',                        // where the meta box appear: normal (default), advanced, side; optional
31
-        'fields' => array(),                        // list of meta fields (can be added by field arrays)
32
-        'local_images' => false,                    // Use local or hosted images (meta box images for add/remove)
27
+        'id' => 'demo_meta_box', // meta box id, unique per meta box
28
+        'title' => __('Demo Meta Box', 'geodirectory'), // meta box title
29
+        'pages' => geodir_get_taxonomies(), // taxonomy name, accept categories, post_tag and custom taxonomies
30
+        'context' => 'normal', // where the meta box appear: normal (default), advanced, side; optional
31
+        'fields' => array(), // list of meta fields (can be added by field arrays)
32
+        'local_images' => false, // Use local or hosted images (meta box images for add/remove)
33 33
         'use_with_theme' => true                    //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).
34 34
     );
35 35
 
@@ -38,18 +38,18 @@  discard block
 block discarded – undo
38 38
      * Initiate your meta box
39 39
      */
40 40
     $my_meta = new Geodir_Tax_Meta_Class($config);
41
-    $my_meta->addWysiwyg($prefix . 'cat_top_desc', array('name' => __('Category Top Description', 'geodirectory'), 'desc' => __('This will appear at the top of the category listing.', 'geodirectory')));
42
-    $my_meta->addImage($prefix . 'cat_default_img', array('name' => __('Default Listing Image', 'geodirectory'), 'desc' => __('Choose a default "no image"', 'geodirectory')));
43
-    $my_meta->addImage($prefix . 'cat_icon', array('name' => __('Category Icon', 'geodirectory'), 'desc' => __('Choose a category icon', 'geodirectory'), 'validate_func' => '!empty'));
41
+    $my_meta->addWysiwyg($prefix.'cat_top_desc', array('name' => __('Category Top Description', 'geodirectory'), 'desc' => __('This will appear at the top of the category listing.', 'geodirectory')));
42
+    $my_meta->addImage($prefix.'cat_default_img', array('name' => __('Default Listing Image', 'geodirectory'), 'desc' => __('Choose a default "no image"', 'geodirectory')));
43
+    $my_meta->addImage($prefix.'cat_icon', array('name' => __('Category Icon', 'geodirectory'), 'desc' => __('Choose a category icon', 'geodirectory'), 'validate_func' => '!empty'));
44 44
     /*$my_meta->addCheckbox($prefix.'pointless',array('name'=> __('<b>Exclude</b> Rating sort option','geodirectory'),'style'=>'hidden'));*/// hidden setting to trick WPML
45 45
 
46
-    $my_meta->addSelect($prefix . 'cat_schema',
46
+    $my_meta->addSelect($prefix.'cat_schema',
47 47
     /*
48 48
      * Allows you to add/filter the cat schema types.
49 49
      *
50 50
      * @since 1.5.7
51 51
      */
52
-        apply_filters('geodir_cat_schemas',array(
52
+        apply_filters('geodir_cat_schemas', array(
53 53
             '' => __('Default (LocalBusiness)', 'geodirectory'),
54 54
             'AccountingService' => 'AccountingService',
55 55
             'Attorney' => 'Attorney',
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
             'WholesaleStore' => 'WholesaleStore',
145 145
             'Winery' => 'Winery'
146 146
         )),
147
-        array('name' => __('Schema Type', 'geodirectory'), 'desc' => __('Select the Schema to use for this category', 'geodirectory') . "", 'std' => array('selectkey2')));
147
+        array('name' => __('Schema Type', 'geodirectory'), 'desc' => __('Select the Schema to use for this category', 'geodirectory')."", 'std' => array('selectkey2')));
148 148
 
149 149
     /*$my_meta->addSelect($prefix.'cat_sort',array(''=>__('Default' , 'geodirectory'),
150 150
     'random'=>__('Random','geodirectory'),
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
 if (!empty($gd_taxonomies)) {
183 183
     foreach ($gd_taxonomies as $gd_taxonomy) {
184 184
 
185
-        add_filter('manage_edit-' . $gd_taxonomy . '_columns', 'addCat_column', 10, 2);
186
-        add_action('manage_' . $gd_taxonomy . '_custom_column', 'manage_category_custom_fields', 10, 3);
185
+        add_filter('manage_edit-'.$gd_taxonomy.'_columns', 'addCat_column', 10, 2);
186
+        add_action('manage_'.$gd_taxonomy.'_custom_column', 'manage_category_custom_fields', 10, 3);
187 187
 
188 188
     }
189 189
 }
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         if ($term_icon_url != '') {
213 213
             $file_info = pathinfo($term_icon_url['src']);
214 214
 
215
-            if (isset($file_info['dirname'] ) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
215
+            if (isset($file_info['dirname']) && $file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
216 216
                 $sub_dir = $file_info['dirname'];
217 217
             } else {
218 218
                 $sub_dir = '';
@@ -231,17 +231,17 @@  discard block
 block discarded – undo
231 231
             }
232 232
             $sub_dir = str_replace($uploads['baseurl'], '', $sub_dir);
233 233
 
234
-            $uploads_url = $uploads_baseurl . $sub_dir;
234
+            $uploads_url = $uploads_baseurl.$sub_dir;
235 235
 
236
-            $term_icon_url['src'] = $uploads_url . '/' . $file_name;
237
-            echo '<img src="' . $term_icon_url['src'] . '" />';
236
+            $term_icon_url['src'] = $uploads_url.'/'.$file_name;
237
+            echo '<img src="'.$term_icon_url['src'].'" />';
238 238
         }
239 239
     }
240 240
 
241 241
     if ($column_name == 'cat_default_img') {
242 242
         $cat_default_img = geodir_get_tax_meta($term_id, 'ct_cat_default_img');
243 243
         if ($cat_default_img != '')
244
-            echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>';
244
+            echo '<img src="'.$cat_default_img['src'].'" style="max-height:60px;max-width:60px;"/>';
245 245
 
246 246
     }
247 247
 }
@@ -272,8 +272,8 @@  discard block
 block discarded – undo
272 272
                             jQuery("#addtag iframe").contents().find("body").html('');
273 273
                             jQuery('#addtag [rel="ct_cat_default_img"]').removeClass('at-delete_image_button').addClass('at-upload_image_button');
274 274
                             jQuery('#addtag [rel="ct_cat_icon"]').removeClass('at-delete_image_button').addClass('at-upload_image_button');
275
-                            jQuery('#addtag [rel="ct_cat_default_img"]').val('<?php _e('Upload Image','geodirectory');?>');
276
-                            jQuery('#addtag [rel="ct_cat_icon"]').val('<?php _e('Upload Image','geodirectory');?>');
275
+                            jQuery('#addtag [rel="ct_cat_default_img"]').val('<?php _e('Upload Image', 'geodirectory'); ?>');
276
+                            jQuery('#addtag [rel="ct_cat_icon"]').val('<?php _e('Upload Image', 'geodirectory'); ?>');
277 277
                         }
278 278
                     }, 1000);
279 279
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -9 removed lines patch added patch discarded remove patch
@@ -203,8 +203,9 @@  discard block
 block discarded – undo
203 203
 #############################################################
204 204
 function manage_category_custom_fields($deprecated, $column_name, $term_id)
205 205
 {
206
-    if ($column_name == 'cat_ID_num')
207
-        echo $term_id;
206
+    if ($column_name == 'cat_ID_num') {
207
+            echo $term_id;
208
+    }
208 209
 
209 210
     if ($column_name == 'cat_icon') {
210 211
         $term_icon_url = geodir_get_tax_meta($term_id, 'ct_cat_icon');
@@ -240,8 +241,9 @@  discard block
 block discarded – undo
240 241
 
241 242
     if ($column_name == 'cat_default_img') {
242 243
         $cat_default_img = geodir_get_tax_meta($term_id, 'ct_cat_default_img');
243
-        if ($cat_default_img != '')
244
-            echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>';
244
+        if ($cat_default_img != '') {
245
+                    echo '<img src="' . $cat_default_img['src'] . '" style="max-height:60px;max-width:60px;"/>';
246
+        }
245 247
 
246 248
     }
247 249
 }
@@ -249,11 +251,12 @@  discard block
 block discarded – undo
249 251
 function geodir_get_default_catimage($term_id, $post_type = 'gd_place')
250 252
 {
251 253
 
252
-    if ($cat_default_img = geodir_get_tax_meta($term_id, 'ct_cat_default_img', '', $post_type))
253
-        return $cat_default_img;
254
-    else
255
-        return false;
256
-}
254
+    if ($cat_default_img = geodir_get_tax_meta($term_id, 'ct_cat_default_img', '', $post_type)) {
255
+            return $cat_default_img;
256
+    } else {
257
+            return false;
258
+    }
259
+    }
257 260
 
258 261
 //Clear custom fields
259 262
 add_action('in_admin_footer', 'geodir_tax_meta_clear_custom_field');
Please login to merge, or discard this patch.
geodirectory-functions/post_functions.php 2 patches
Indentation   +2264 added lines, -2264 removed lines patch added patch discarded remove patch
@@ -20,492 +20,492 @@  discard block
 block discarded – undo
20 20
 function geodir_set_postcat_structure($post_id, $taxonomy, $default_cat = '', $category_str = '')
21 21
 {
22 22
 
23
-    $post_cat_ids = geodir_get_post_meta($post_id, $taxonomy);
24
-    if (!empty($post_cat_ids))
25
-        $post_cat_array = explode(",", trim($post_cat_ids, ","));
26
-
27
-    if (!isset($default_cat) || empty($default_cat)) {
28
-        $default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : '';
29
-    }else{
30
-        if(!is_int($default_cat)){
31
-            $category = get_term_by('name', $default_cat, $taxonomy);
32
-            if(isset($category->term_id)){
33
-                $default_cat =  $category->term_id;
34
-            }
35
-        }
23
+	$post_cat_ids = geodir_get_post_meta($post_id, $taxonomy);
24
+	if (!empty($post_cat_ids))
25
+		$post_cat_array = explode(",", trim($post_cat_ids, ","));
26
+
27
+	if (!isset($default_cat) || empty($default_cat)) {
28
+		$default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : '';
29
+	}else{
30
+		if(!is_int($default_cat)){
31
+			$category = get_term_by('name', $default_cat, $taxonomy);
32
+			if(isset($category->term_id)){
33
+				$default_cat =  $category->term_id;
34
+			}
35
+		}
36 36
 
37
-    }
37
+	}
38 38
 
39 39
 
40
-    geodir_save_post_meta($post_id, 'default_category', $default_cat);
40
+	geodir_save_post_meta($post_id, 'default_category', $default_cat);
41 41
 
42
-    if (isset($category_str) && empty($category_str)) {
42
+	if (isset($category_str) && empty($category_str)) {
43 43
 
44
-        $post_cat_str = '';
45
-        $post_categories = array();
46
-        if (isset($post_cat_array) && is_array($post_cat_array) && !empty($post_cat_array)) {
47
-            $post_cat_str = implode(",y:#", $post_cat_array);
48
-            $post_cat_str .= ",y:";
49
-            $post_cat_str = substr_replace($post_cat_str, ',y,d:', strpos($post_cat_str, ',y:'), strlen(',y:'));
50
-        }
51
-        $post_categories[$taxonomy] = $post_cat_str;
52
-        $category_str = $post_categories;
53
-    }
44
+		$post_cat_str = '';
45
+		$post_categories = array();
46
+		if (isset($post_cat_array) && is_array($post_cat_array) && !empty($post_cat_array)) {
47
+			$post_cat_str = implode(",y:#", $post_cat_array);
48
+			$post_cat_str .= ",y:";
49
+			$post_cat_str = substr_replace($post_cat_str, ',y,d:', strpos($post_cat_str, ',y:'), strlen(',y:'));
50
+		}
51
+		$post_categories[$taxonomy] = $post_cat_str;
52
+		$category_str = $post_categories;
53
+	}
54 54
 
55
-    $change_cat_str = $category_str[$taxonomy];
55
+	$change_cat_str = $category_str[$taxonomy];
56 56
 
57
-    $default_pos = strpos($change_cat_str, 'd:');
57
+	$default_pos = strpos($change_cat_str, 'd:');
58 58
 
59
-    if ($default_pos === false) {
59
+	if ($default_pos === false) {
60 60
 
61
-        $change_cat_str = str_replace($default_cat . ',y:', $default_cat . ',y,d:', $change_cat_str);
61
+		$change_cat_str = str_replace($default_cat . ',y:', $default_cat . ',y,d:', $change_cat_str);
62 62
 
63
-    }
63
+	}
64 64
 
65
-    $category_str[$taxonomy] = $change_cat_str;
65
+	$category_str[$taxonomy] = $change_cat_str;
66 66
 
67
-    update_post_meta($post_id, 'post_categories', $category_str);
67
+	update_post_meta($post_id, 'post_categories', $category_str);
68 68
 
69 69
 }
70 70
 
71 71
 
72 72
 if (!function_exists('geodir_save_listing')) {
73
-    /**
74
-     * Saves listing in the database using given information.
75
-     *
76
-     * @since 1.0.0
77
-     * @since 1.5.4 New parameter $wp_error added.
78
-     * @since 1.6.18 Admin use only date field should not lost value if saved by user - FIXED
79
-     * @package GeoDirectory
80
-     * @global object $wpdb WordPress Database object.
81
-     * @global object $post The current post object.
82
-     * @global object $current_user Current user object.
83
-     * @global object $gd_session GeoDirectory Session object.
84
-     * @param array $request_info {
85
-     *    Array of request info arguments.
86
-     *
87
-     *    @type string $action                                  Ajax action name.
88
-     *    @type string $geodir_ajax                             Ajax type.
89
-     *    @type string $ajax_action                             Ajax action.
90
-     *    @type string $listing_type                            Listing type.
91
-     *    @type string $pid                                     Default Post ID.
92
-     *    @type string $preview                                 Todo Desc needed.
93
-     *    @type string $add_listing_page_id                     Add listing page ID.
94
-     *    @type string $post_title                              Listing title.
95
-     *    @type string $post_desc                               Listing Description.
96
-     *    @type string $post_tags                               Listing tags.
97
-     *    @type array  $cat_limit                               Category limit.
98
-     *    @type array  $post_category                           Category IDs.
99
-     *    @type array  $post_category_str                       Category string.
100
-     *    @type string $post_default_category                   Default category ID.
101
-     *    @type string $post_address                            Listing address.
102
-     *    @type string $geodir_location_add_listing_country_val Add listing country value.
103
-     *    @type string $post_country                            Listing country.
104
-     *    @type string $geodir_location_add_listing_region_val  Add listing region value.
105
-     *    @type string $post_region                             Listing region.
106
-     *    @type string $geodir_location_add_listing_city_val    Add listing city value.
107
-     *    @type string $post_city                               Listing city.
108
-     *    @type string $post_zip                                Listing zip.
109
-     *    @type string $post_latitude                           Listing latitude.
110
-     *    @type string $post_longitude                          Listing longitude.
111
-     *    @type string $post_mapview                            Listing mapview. Default "ROADMAP".
112
-     *    @type string $post_mapzoom                            Listing mapzoom Default "9".
113
-     *    @type string $geodir_timing                           Business timing info.
114
-     *    @type string $geodir_contact                          Contact number.
115
-     *    @type string $geodir_email                            Business contact email.
116
-     *    @type string $geodir_website                          Business website.
117
-     *    @type string $geodir_twitter                          Twitter link.
118
-     *    @type string $geodir_facebook                         Facebook link.
119
-     *    @type string $geodir_video                            Video link.
120
-     *    @type string $geodir_special_offers                   Special offers.
121
-     *    @type string $post_images                             Post image urls.
122
-     *    @type string $post_imagesimage_limit                  Post images limit.
123
-     *    @type string $post_imagestotImg                       Todo Desc needed.
124
-     *    @type string $geodir_accept_term_condition            Has accepted terms and conditions?.
125
-     *    @type string $geodir_spamblocker                      Todo Desc needed.
126
-     *    @type string $geodir_filled_by_spam_bot               Todo Desc needed.
127
-     *
128
-     * }
129
-     * @param bool $dummy Optional. Is this a dummy listing? Default false.
130
-     * @param bool $wp_error Optional. Allow return of WP_Error on failure. Default false.
131
-     * @return int|string|WP_Error Created post id or WP_Error on failure.
132
-     */
133
-    function geodir_save_listing($request_info = array(), $dummy = false, $wp_error = false)
134
-    {
135
-        global $wpdb, $current_user, $gd_session;
136
-
137
-        $last_post_id = '';
138
-
139
-        if ($gd_session->get('listing') && !$dummy) {
140
-            $request_info = array();
141
-            $request_session = $gd_session->get('listing');
142
-            $request_info = array_merge($_REQUEST, $request_session);
143
-        } else if (!$gd_session->get('listing') && !$dummy) {
144
-            global $post;
73
+	/**
74
+	 * Saves listing in the database using given information.
75
+	 *
76
+	 * @since 1.0.0
77
+	 * @since 1.5.4 New parameter $wp_error added.
78
+	 * @since 1.6.18 Admin use only date field should not lost value if saved by user - FIXED
79
+	 * @package GeoDirectory
80
+	 * @global object $wpdb WordPress Database object.
81
+	 * @global object $post The current post object.
82
+	 * @global object $current_user Current user object.
83
+	 * @global object $gd_session GeoDirectory Session object.
84
+	 * @param array $request_info {
85
+	 *    Array of request info arguments.
86
+	 *
87
+	 *    @type string $action                                  Ajax action name.
88
+	 *    @type string $geodir_ajax                             Ajax type.
89
+	 *    @type string $ajax_action                             Ajax action.
90
+	 *    @type string $listing_type                            Listing type.
91
+	 *    @type string $pid                                     Default Post ID.
92
+	 *    @type string $preview                                 Todo Desc needed.
93
+	 *    @type string $add_listing_page_id                     Add listing page ID.
94
+	 *    @type string $post_title                              Listing title.
95
+	 *    @type string $post_desc                               Listing Description.
96
+	 *    @type string $post_tags                               Listing tags.
97
+	 *    @type array  $cat_limit                               Category limit.
98
+	 *    @type array  $post_category                           Category IDs.
99
+	 *    @type array  $post_category_str                       Category string.
100
+	 *    @type string $post_default_category                   Default category ID.
101
+	 *    @type string $post_address                            Listing address.
102
+	 *    @type string $geodir_location_add_listing_country_val Add listing country value.
103
+	 *    @type string $post_country                            Listing country.
104
+	 *    @type string $geodir_location_add_listing_region_val  Add listing region value.
105
+	 *    @type string $post_region                             Listing region.
106
+	 *    @type string $geodir_location_add_listing_city_val    Add listing city value.
107
+	 *    @type string $post_city                               Listing city.
108
+	 *    @type string $post_zip                                Listing zip.
109
+	 *    @type string $post_latitude                           Listing latitude.
110
+	 *    @type string $post_longitude                          Listing longitude.
111
+	 *    @type string $post_mapview                            Listing mapview. Default "ROADMAP".
112
+	 *    @type string $post_mapzoom                            Listing mapzoom Default "9".
113
+	 *    @type string $geodir_timing                           Business timing info.
114
+	 *    @type string $geodir_contact                          Contact number.
115
+	 *    @type string $geodir_email                            Business contact email.
116
+	 *    @type string $geodir_website                          Business website.
117
+	 *    @type string $geodir_twitter                          Twitter link.
118
+	 *    @type string $geodir_facebook                         Facebook link.
119
+	 *    @type string $geodir_video                            Video link.
120
+	 *    @type string $geodir_special_offers                   Special offers.
121
+	 *    @type string $post_images                             Post image urls.
122
+	 *    @type string $post_imagesimage_limit                  Post images limit.
123
+	 *    @type string $post_imagestotImg                       Todo Desc needed.
124
+	 *    @type string $geodir_accept_term_condition            Has accepted terms and conditions?.
125
+	 *    @type string $geodir_spamblocker                      Todo Desc needed.
126
+	 *    @type string $geodir_filled_by_spam_bot               Todo Desc needed.
127
+	 *
128
+	 * }
129
+	 * @param bool $dummy Optional. Is this a dummy listing? Default false.
130
+	 * @param bool $wp_error Optional. Allow return of WP_Error on failure. Default false.
131
+	 * @return int|string|WP_Error Created post id or WP_Error on failure.
132
+	 */
133
+	function geodir_save_listing($request_info = array(), $dummy = false, $wp_error = false)
134
+	{
135
+		global $wpdb, $current_user, $gd_session;
136
+
137
+		$last_post_id = '';
138
+
139
+		if ($gd_session->get('listing') && !$dummy) {
140
+			$request_info = array();
141
+			$request_session = $gd_session->get('listing');
142
+			$request_info = array_merge($_REQUEST, $request_session);
143
+		} else if (!$gd_session->get('listing') && !$dummy) {
144
+			global $post;
145 145
             
146
-            $gd_post = $post;
147
-            if (!empty($gd_post) && is_array($gd_post)) {
148
-                $gd_post = (object)$post;
146
+			$gd_post = $post;
147
+			if (!empty($gd_post) && is_array($gd_post)) {
148
+				$gd_post = (object)$post;
149 149
                 
150
-                // Fix WPML duplicate.
151
-                if (geodir_is_wpml() && !empty($request_info['action']) && $request_info['action'] == 'editpost' && !empty($request_info['icl_trid']) && !isset($post['post_date'])) {
152
-                    return false;
153
-                }
154
-            }
150
+				// Fix WPML duplicate.
151
+				if (geodir_is_wpml() && !empty($request_info['action']) && $request_info['action'] == 'editpost' && !empty($request_info['icl_trid']) && !isset($post['post_date'])) {
152
+					return false;
153
+				}
154
+			}
155 155
             
156
-            $request_info['pid'] = !empty($gd_post->ID) ? $gd_post->ID : (!empty($request_info['post_id']) ? $request_info['post_id'] : NULL);
157
-            $request_info['post_title'] = $request_info['post_title'];
158
-            $request_info['listing_type'] = !empty($gd_post->post_type) ? $gd_post->post_type : (!empty($request_info['post_type']) ? $request_info['post_type'] : get_post_type($request_info['pid']));
159
-            $request_info['post_desc'] = $request_info['content'];
160
-        } else if (!$dummy) {
161
-            return false;
162
-        }
163
-
164
-        /**
165
-         * Filter the request_info array.
166
-         *
167
-         * You can use this filter to modify request_info array.
168
-         *
169
-         * @since 1.0.0
170
-         * @package GeoDirectory
171
-         * @param array $request_info See {@see geodir_save_listing()} for accepted args.
172
-         */
173
-        $request_info = apply_filters('geodir_action_get_request_info', $request_info);
174
-
175
-        // Check if we need to save post location as new location
176
-        $location_result = geodir_get_default_location();
177
-
178
-        if ($location_result->location_id > 0) {
179
-            if (isset($request_info['post_city']) && isset($request_info['post_region'])) {
180
-                $request_info['post_location'] = array(
181
-                    'city' => $request_info['post_city'],
182
-                    'region' => isset($request_info['post_region']) ? $request_info['post_region'] : '',
183
-                    'country' => isset($request_info['post_country']) ? $request_info['post_country'] : '',
184
-                    'geo_lat' => isset($request_info['post_latitude']) ? $request_info['post_latitude'] : '',
185
-                    'geo_lng' => isset($request_info['post_longitude']) ? $request_info['post_longitude'] : ''
186
-                );
187
-
188
-                $post_location_info = $request_info['post_location'];
189
-
190
-                if ($location_id = geodir_add_new_location($post_location_info)) {
191
-                    $post_location_id = $location_id;
192
-                }
193
-            } else {
194
-                $post_location_id = $location_result->location_id;
195
-            }
196
-        } else {
197
-            $post_location_id = $location_result->location_id;
198
-        }
199
-
200
-        if ($dummy) {
201
-            $post_status = 'publish';
202
-        } else {
203
-            $post_status = geodir_new_post_default_status();
204
-        }
205
-
206
-        if (isset($request_info['pid']) && $request_info['pid'] != '') {
207
-            $post_status = get_post_status($request_info['pid']);
208
-        }
209
-
210
-        /* fix change of slug on every title edit */
211
-        if (!isset($request_info['post_name'])) {
212
-            $request_info['post_name'] = $request_info['post_title'];
213
-
214
-            if (!empty($request_info['pid'])) {
215
-                $post_info = get_post($request_info['pid']);
216
-
217
-                if (!empty($post_info) && isset($post_info->post_name)) {
218
-                    $request_info['post_name'] = $post_info->post_name;
219
-                }
220
-            }
221
-        }
222
-
223
-        $post = array(
224
-            'post_content' => $request_info['post_desc'],
225
-            'post_status' => $post_status,
226
-            'post_title' => $request_info['post_title'],
227
-            'post_name' => $request_info['post_name'],
228
-            'post_type' => $request_info['listing_type']
229
-        );
230
-
231
-        /**
232
-         * Called before a listing is saved to the database.
233
-         *
234
-         * @since 1.0.0
235
-         * @param object $post The post object.
236
-         */
237
-        do_action_ref_array('geodir_before_save_listing', $post);
156
+			$request_info['pid'] = !empty($gd_post->ID) ? $gd_post->ID : (!empty($request_info['post_id']) ? $request_info['post_id'] : NULL);
157
+			$request_info['post_title'] = $request_info['post_title'];
158
+			$request_info['listing_type'] = !empty($gd_post->post_type) ? $gd_post->post_type : (!empty($request_info['post_type']) ? $request_info['post_type'] : get_post_type($request_info['pid']));
159
+			$request_info['post_desc'] = $request_info['content'];
160
+		} else if (!$dummy) {
161
+			return false;
162
+		}
163
+
164
+		/**
165
+		 * Filter the request_info array.
166
+		 *
167
+		 * You can use this filter to modify request_info array.
168
+		 *
169
+		 * @since 1.0.0
170
+		 * @package GeoDirectory
171
+		 * @param array $request_info See {@see geodir_save_listing()} for accepted args.
172
+		 */
173
+		$request_info = apply_filters('geodir_action_get_request_info', $request_info);
174
+
175
+		// Check if we need to save post location as new location
176
+		$location_result = geodir_get_default_location();
177
+
178
+		if ($location_result->location_id > 0) {
179
+			if (isset($request_info['post_city']) && isset($request_info['post_region'])) {
180
+				$request_info['post_location'] = array(
181
+					'city' => $request_info['post_city'],
182
+					'region' => isset($request_info['post_region']) ? $request_info['post_region'] : '',
183
+					'country' => isset($request_info['post_country']) ? $request_info['post_country'] : '',
184
+					'geo_lat' => isset($request_info['post_latitude']) ? $request_info['post_latitude'] : '',
185
+					'geo_lng' => isset($request_info['post_longitude']) ? $request_info['post_longitude'] : ''
186
+				);
187
+
188
+				$post_location_info = $request_info['post_location'];
189
+
190
+				if ($location_id = geodir_add_new_location($post_location_info)) {
191
+					$post_location_id = $location_id;
192
+				}
193
+			} else {
194
+				$post_location_id = $location_result->location_id;
195
+			}
196
+		} else {
197
+			$post_location_id = $location_result->location_id;
198
+		}
238 199
 
239
-        $send_post_submit_mail = false;
200
+		if ($dummy) {
201
+			$post_status = 'publish';
202
+		} else {
203
+			$post_status = geodir_new_post_default_status();
204
+		}
240 205
 
241
-        // unhook this function so it doesn't loop infinitely
242
-        remove_action('save_post', 'geodir_post_information_save',10,2);
206
+		if (isset($request_info['pid']) && $request_info['pid'] != '') {
207
+			$post_status = get_post_status($request_info['pid']);
208
+		}
243 209
 
244
-        if (isset($request_info['pid']) && $request_info['pid'] != '') {
245
-            $post['ID'] = $request_info['pid'];
210
+		/* fix change of slug on every title edit */
211
+		if (!isset($request_info['post_name'])) {
212
+			$request_info['post_name'] = $request_info['post_title'];
246 213
 
247
-            $last_post_id = wp_update_post($post, $wp_error);
248
-        } else {
249
-            $last_post_id = wp_insert_post($post, $wp_error);
214
+			if (!empty($request_info['pid'])) {
215
+				$post_info = get_post($request_info['pid']);
250 216
 
251
-            if (!$dummy && $last_post_id) {
252
-                $send_post_submit_mail = true; // we move post_submit email from here so the rest of the variables are added to the db first(was breaking permalink in email)
253
-                //geodir_sendEmail('','',$current_user->user_email,$current_user->display_name,'','',$request_info,'post_submit',$last_post_id,$current_user->ID);
254
-            }
255
-        }
217
+				if (!empty($post_info) && isset($post_info->post_name)) {
218
+					$request_info['post_name'] = $post_info->post_name;
219
+				}
220
+			}
221
+		}
222
+
223
+		$post = array(
224
+			'post_content' => $request_info['post_desc'],
225
+			'post_status' => $post_status,
226
+			'post_title' => $request_info['post_title'],
227
+			'post_name' => $request_info['post_name'],
228
+			'post_type' => $request_info['listing_type']
229
+		);
230
+
231
+		/**
232
+		 * Called before a listing is saved to the database.
233
+		 *
234
+		 * @since 1.0.0
235
+		 * @param object $post The post object.
236
+		 */
237
+		do_action_ref_array('geodir_before_save_listing', $post);
238
+
239
+		$send_post_submit_mail = false;
240
+
241
+		// unhook this function so it doesn't loop infinitely
242
+		remove_action('save_post', 'geodir_post_information_save',10,2);
243
+
244
+		if (isset($request_info['pid']) && $request_info['pid'] != '') {
245
+			$post['ID'] = $request_info['pid'];
246
+
247
+			$last_post_id = wp_update_post($post, $wp_error);
248
+		} else {
249
+			$last_post_id = wp_insert_post($post, $wp_error);
250
+
251
+			if (!$dummy && $last_post_id) {
252
+				$send_post_submit_mail = true; // we move post_submit email from here so the rest of the variables are added to the db first(was breaking permalink in email)
253
+				//geodir_sendEmail('','',$current_user->user_email,$current_user->display_name,'','',$request_info,'post_submit',$last_post_id,$current_user->ID);
254
+			}
255
+		}
256 256
 
257
-        if ($wp_error && is_wp_error($last_post_id)) {
258
-            return $last_post_id; // Return WP_Error on save failure.
259
-        }
257
+		if ($wp_error && is_wp_error($last_post_id)) {
258
+			return $last_post_id; // Return WP_Error on save failure.
259
+		}
260 260
 
261
-        if (!$last_post_id) {
262
-            return false; // Save failure.
263
-        }
261
+		if (!$last_post_id) {
262
+			return false; // Save failure.
263
+		}
264 264
 
265
-        // re-hook this function
266
-        add_action('save_post', 'geodir_post_information_save',10,2);
265
+		// re-hook this function
266
+		add_action('save_post', 'geodir_post_information_save',10,2);
267 267
 
268
-        $post_tags = '';
269
-        if (!isset($request_info['post_tags'])) {
268
+		$post_tags = '';
269
+		if (!isset($request_info['post_tags'])) {
270 270
 
271
-            $post_type = $request_info['listing_type'];
272
-            $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names')));
271
+			$post_type = $request_info['listing_type'];
272
+			$post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names')));
273 273
 
274
-        }
274
+		}
275 275
 
276
-        $gd_post_info = array(
277
-            "post_title" => $request_info['post_title'],
278
-            "post_tags" => isset($request_info['post_tags']) ? $request_info['post_tags'] : $post_tags,
279
-            "post_status" => $post_status,
280
-            "post_location_id" => $post_location_id,
281
-            "claimed" => isset($request_info['claimed']) ? $request_info['claimed'] : '',
282
-            "businesses" => isset($request_info['a_businesses']) ? $request_info['a_businesses'] : '',
283
-            "submit_time" => time(),
284
-            "submit_ip" => $_SERVER['REMOTE_ADDR'],
285
-        );
276
+		$gd_post_info = array(
277
+			"post_title" => $request_info['post_title'],
278
+			"post_tags" => isset($request_info['post_tags']) ? $request_info['post_tags'] : $post_tags,
279
+			"post_status" => $post_status,
280
+			"post_location_id" => $post_location_id,
281
+			"claimed" => isset($request_info['claimed']) ? $request_info['claimed'] : '',
282
+			"businesses" => isset($request_info['a_businesses']) ? $request_info['a_businesses'] : '',
283
+			"submit_time" => time(),
284
+			"submit_ip" => $_SERVER['REMOTE_ADDR'],
285
+		);
286 286
 
287
-        $payment_info = array();
288
-        $package_info = array();
287
+		$payment_info = array();
288
+		$package_info = array();
289 289
 
290
-        $package_info = (array)geodir_post_package_info($package_info, $post);
290
+		$package_info = (array)geodir_post_package_info($package_info, $post);
291 291
 
292
-        $post_package_id = geodir_get_post_meta($last_post_id, 'package_id');
292
+		$post_package_id = geodir_get_post_meta($last_post_id, 'package_id');
293 293
 
294
-        if (!empty($package_info) && !$post_package_id) {
295
-            if (isset($package_info['days']) && $package_info['days'] != 0) {
296
-                $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['days'] . " days"));
297
-            } else {
298
-                $payment_info['expire_date'] = 'Never';
299
-            }
294
+		if (!empty($package_info) && !$post_package_id) {
295
+			if (isset($package_info['days']) && $package_info['days'] != 0) {
296
+				$payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['days'] . " days"));
297
+			} else {
298
+				$payment_info['expire_date'] = 'Never';
299
+			}
300 300
 
301
-            $payment_info['package_id'] = $package_info['pid'];
302
-            $payment_info['alive_days'] = $package_info['days'];
303
-            $payment_info['is_featured'] = $package_info['is_featured'];
301
+			$payment_info['package_id'] = $package_info['pid'];
302
+			$payment_info['alive_days'] = $package_info['days'];
303
+			$payment_info['is_featured'] = $package_info['is_featured'];
304 304
 
305
-            $gd_post_info = array_merge($gd_post_info, $payment_info);
306
-        }
305
+			$gd_post_info = array_merge($gd_post_info, $payment_info);
306
+		}
307 307
 
308
-        $custom_metaboxes = geodir_post_custom_fields('', 'all', $request_info['listing_type']);
308
+		$custom_metaboxes = geodir_post_custom_fields('', 'all', $request_info['listing_type']);
309 309
 
310
-        foreach ($custom_metaboxes as $key => $val):
310
+		foreach ($custom_metaboxes as $key => $val):
311 311
 
312
-            $name = $val['name'];
313
-            $type = $val['type'];
314
-            $extrafields = $val['extra_fields'];
312
+			$name = $val['name'];
313
+			$type = $val['type'];
314
+			$extrafields = $val['extra_fields'];
315 315
 
316
-            if (trim($type) == 'address') {
317
-                $prefix = $name . '_';
318
-                $address = $prefix . 'address';
316
+			if (trim($type) == 'address') {
317
+				$prefix = $name . '_';
318
+				$address = $prefix . 'address';
319 319
 
320
-                if (isset($request_info[$address]) && $request_info[$address] != '') {
321
-                    $gd_post_info[$address] = wp_slash($request_info[$address]);
322
-                }
320
+				if (isset($request_info[$address]) && $request_info[$address] != '') {
321
+					$gd_post_info[$address] = wp_slash($request_info[$address]);
322
+				}
323 323
 
324
-                if ($extrafields != '') {
325
-                    $extrafields = unserialize($extrafields);
324
+				if ($extrafields != '') {
325
+					$extrafields = unserialize($extrafields);
326 326
 
327 327
 
328
-                    if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') {
328
+					if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') {
329 329
 
330
-                        $location_result = geodir_get_default_location();
330
+						$location_result = geodir_get_default_location();
331 331
 
332
-                        $gd_post_info[$prefix . 'city'] = $location_result->city;
333
-                        $gd_post_info[$prefix . 'region'] = $location_result->region;
334
-                        $gd_post_info[$prefix . 'country'] = $location_result->country;
332
+						$gd_post_info[$prefix . 'city'] = $location_result->city;
333
+						$gd_post_info[$prefix . 'region'] = $location_result->region;
334
+						$gd_post_info[$prefix . 'country'] = $location_result->country;
335 335
 
336
-                        $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
336
+						$gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
337 337
 
338
-                    } else {
338
+					} else {
339 339
 
340
-                        $gd_post_info[$prefix . 'city'] = $request_info[$prefix . 'city'];
341
-                        $gd_post_info[$prefix . 'region'] = $request_info[$prefix . 'region'];
342
-                        $gd_post_info[$prefix . 'country'] = $request_info[$prefix . 'country'];
340
+						$gd_post_info[$prefix . 'city'] = $request_info[$prefix . 'city'];
341
+						$gd_post_info[$prefix . 'region'] = $request_info[$prefix . 'region'];
342
+						$gd_post_info[$prefix . 'country'] = $request_info[$prefix . 'country'];
343 343
 
344
-                        //----------set post locations when import dummy data-------
345
-                        $location_result = geodir_get_default_location();
344
+						//----------set post locations when import dummy data-------
345
+						$location_result = geodir_get_default_location();
346 346
 
347
-                        $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
348
-                        //-----------------------------------------------------------------
347
+						$gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
348
+						//-----------------------------------------------------------------
349 349
 
350
-                    }
350
+					}
351 351
 
352 352
 
353
-                    if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix . 'zip'])) {
354
-                        $gd_post_info[$prefix . 'zip'] = $request_info[$prefix . 'zip'];
355
-                    }
353
+					if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix . 'zip'])) {
354
+						$gd_post_info[$prefix . 'zip'] = $request_info[$prefix . 'zip'];
355
+					}
356 356
 
357 357
 
358
-                    if (isset($extrafields['show_map']) && $extrafields['show_map']) {
358
+					if (isset($extrafields['show_map']) && $extrafields['show_map']) {
359 359
 
360
-                        if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') {
361
-                            $gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude'];
362
-                        }
360
+						if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') {
361
+							$gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude'];
362
+						}
363 363
 
364
-                        if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') {
365
-                            $gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude'];
366
-                        }
364
+						if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') {
365
+							$gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude'];
366
+						}
367 367
 
368
-                        if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') {
369
-                            $gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview'];
370
-                        }
368
+						if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') {
369
+							$gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview'];
370
+						}
371 371
 
372
-                        if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') {
373
-                            $gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom'];
374
-                        }
372
+						if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') {
373
+							$gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom'];
374
+						}
375 375
 
376
-                    }
376
+					}
377 377
 
378
-                    // show lat lng
379
-                    if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix . 'latlng'])) {
380
-                        $gd_post_info[$prefix . 'latlng'] = $request_info[$prefix . 'latlng'];
381
-                    }
382
-                }
378
+					// show lat lng
379
+					if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix . 'latlng'])) {
380
+						$gd_post_info[$prefix . 'latlng'] = $request_info[$prefix . 'latlng'];
381
+					}
382
+				}
383 383
 
384
-            } elseif (trim($type) == 'file') {
385
-                if (isset($request_info[$name])) {
386
-                    $request_files = array();
387
-                    if ($request_info[$name] != '')
388
-                        $request_files = explode(",", $request_info[$name]);
384
+			} elseif (trim($type) == 'file') {
385
+				if (isset($request_info[$name])) {
386
+					$request_files = array();
387
+					if ($request_info[$name] != '')
388
+						$request_files = explode(",", $request_info[$name]);
389 389
 
390
-                    $extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL;
391
-                    geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields);
392
-                }
393
-            } elseif (trim($type) == 'datepicker') {
394
-                if (isset($request_info[$name])) {
395
-                    $datetime = '';
390
+					$extrafields = $extrafields != '' ? maybe_unserialize($extrafields) : NULL;
391
+					geodir_save_post_file_fields($last_post_id, $name, $request_files, $extrafields);
392
+				}
393
+			} elseif (trim($type) == 'datepicker') {
394
+				if (isset($request_info[$name])) {
395
+					$datetime = '';
396 396
                     
397
-                    if (!empty($request_info[$name])) {
398
-                        $date_format = geodir_default_date_format();
399
-                        if (isset($val['extra_fields']) && $val['extra_fields'] != '') {
400
-                            $extra_fields = unserialize($val['extra_fields']);
401
-                            $date_format = isset($extra_fields['date_format']) && $extra_fields['date_format'] != '' ? $extra_fields['date_format'] : $date_format;
402
-                        }
403
-
404
-                        // check if we need to change the format or not
405
-                        $date_format_len = strlen(str_replace(' ', '', $date_format));
406
-                        if($date_format_len>5){// if greater then 5 then it's the old style format.
397
+					if (!empty($request_info[$name])) {
398
+						$date_format = geodir_default_date_format();
399
+						if (isset($val['extra_fields']) && $val['extra_fields'] != '') {
400
+							$extra_fields = unserialize($val['extra_fields']);
401
+							$date_format = isset($extra_fields['date_format']) && $extra_fields['date_format'] != '' ? $extra_fields['date_format'] : $date_format;
402
+						}
407 403
 
408
-                            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
409
-                            $replace = array('d','j','l','m','n','F','Y');//PHP date format
404
+						// check if we need to change the format or not
405
+						$date_format_len = strlen(str_replace(' ', '', $date_format));
406
+						if($date_format_len>5){// if greater then 5 then it's the old style format.
410 407
 
411
-                            $date_format = str_replace($search, $replace, $date_format);
408
+							$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
409
+							$replace = array('d','j','l','m','n','F','Y');//PHP date format
412 410
 
413
-                            $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name];
411
+							$date_format = str_replace($search, $replace, $date_format);
414 412
 
415
-                        }else{
416
-                            $post_htmlvar_value = $request_info[$name];
417
-                        }
413
+							$post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name];
418 414
 
419
-                        $post_htmlvar_value = geodir_date($post_htmlvar_value, 'Y-m-d', $date_format); // save as sql format Y-m-d
420
-                        $datetime = geodir_maybe_untranslate_date($post_htmlvar_value); // maybe untranslate date string if it was translated
421
-                    }
415
+						}else{
416
+							$post_htmlvar_value = $request_info[$name];
417
+						}
422 418
 
423
-                    $gd_post_info[$name] = $datetime;
424
-                }
425
-            } else if ($type == 'multiselect') {
426
-                if (isset($request_info[$name])) {
427
-                    $gd_post_info[$name] = $request_info[$name];
428
-                } else {
429
-                    if (isset($request_info['gd_field_' . $name])) {
430
-                        $gd_post_info[$name] = ''; /* fix de-select for multiselect */
431
-                    }
432
-                }
433
-            } else if (isset($request_info[$name])) {
434
-                $gd_post_info[$name] = $request_info[$name];
435
-            }
419
+						$post_htmlvar_value = geodir_date($post_htmlvar_value, 'Y-m-d', $date_format); // save as sql format Y-m-d
420
+						$datetime = geodir_maybe_untranslate_date($post_htmlvar_value); // maybe untranslate date string if it was translated
421
+					}
422
+
423
+					$gd_post_info[$name] = $datetime;
424
+				}
425
+			} else if ($type == 'multiselect') {
426
+				if (isset($request_info[$name])) {
427
+					$gd_post_info[$name] = $request_info[$name];
428
+				} else {
429
+					if (isset($request_info['gd_field_' . $name])) {
430
+						$gd_post_info[$name] = ''; /* fix de-select for multiselect */
431
+					}
432
+				}
433
+			} else if (isset($request_info[$name])) {
434
+				$gd_post_info[$name] = $request_info[$name];
435
+			}
436 436
 
437
-        endforeach;
437
+		endforeach;
438 438
 
439
-        if (isset($request_info['post_dummy']) && $request_info['post_dummy'] != '') {
440
-            $gd_post_info['post_dummy'] = $request_info['post_dummy'];
441
-        }
439
+		if (isset($request_info['post_dummy']) && $request_info['post_dummy'] != '') {
440
+			$gd_post_info['post_dummy'] = $request_info['post_dummy'];
441
+		}
442 442
 
443
-        // Save post detail info in detail table
444
-        if (!empty($gd_post_info)) {
445
-            geodir_save_post_info($last_post_id, $gd_post_info);
446
-        }
443
+		// Save post detail info in detail table
444
+		if (!empty($gd_post_info)) {
445
+			geodir_save_post_info($last_post_id, $gd_post_info);
446
+		}
447 447
 
448 448
 
449
-        // Set categories to the listing
450
-        if (isset($request_info['post_category']) && !empty($request_info['post_category'])) {
451
-            $post_category = array();
449
+		// Set categories to the listing
450
+		if (isset($request_info['post_category']) && !empty($request_info['post_category'])) {
451
+			$post_category = array();
452 452
 
453
-            foreach ($request_info['post_category'] as $taxonomy => $cat) {
453
+			foreach ($request_info['post_category'] as $taxonomy => $cat) {
454 454
 
455
-                if ($dummy)
456
-                    $post_category = $cat;
457
-                else {
455
+				if ($dummy)
456
+					$post_category = $cat;
457
+				else {
458 458
 
459
-                    if (!is_array($cat) && strstr($cat, ','))
460
-                        $cat = explode(',', $cat);
459
+					if (!is_array($cat) && strstr($cat, ','))
460
+						$cat = explode(',', $cat);
461 461
 
462
-                    if (!empty($cat) && is_array($cat))
463
-                        $post_category = array_map('intval', $cat);
464
-                }
462
+					if (!empty($cat) && is_array($cat))
463
+						$post_category = array_map('intval', $cat);
464
+				}
465 465
 
466
-                wp_set_object_terms($last_post_id, $post_category, $taxonomy);
467
-            }
466
+				wp_set_object_terms($last_post_id, $post_category, $taxonomy);
467
+			}
468 468
 
469
-            $post_default_category = isset($request_info['post_default_category']) ? $request_info['post_default_category'] : '';
469
+			$post_default_category = isset($request_info['post_default_category']) ? $request_info['post_default_category'] : '';
470 470
 
471
-            $post_category_str = isset($request_info['post_category_str']) ? $request_info['post_category_str'] : '';
472
-            geodir_set_postcat_structure($last_post_id, $taxonomy, $post_default_category, $post_category_str);
471
+			$post_category_str = isset($request_info['post_category_str']) ? $request_info['post_category_str'] : '';
472
+			geodir_set_postcat_structure($last_post_id, $taxonomy, $post_default_category, $post_category_str);
473 473
 
474
-        }
474
+		}
475 475
 
476
-        $post_tags = '';
477
-        // Set tags to the listing
478
-        if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
479
-            $post_tags = explode(",", $request_info['post_tags']);
480
-        } elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
481
-            if ($dummy)
482
-                $post_tags = $request_info['post_tags'];
483
-        } else {
484
-            if ($dummy)
485
-                $post_tags = array($request_info['post_title']);
486
-        }
476
+		$post_tags = '';
477
+		// Set tags to the listing
478
+		if (isset($request_info['post_tags']) && !is_array($request_info['post_tags']) && !empty($request_info['post_tags'])) {
479
+			$post_tags = explode(",", $request_info['post_tags']);
480
+		} elseif (isset($request_info['post_tags']) && is_array($request_info['post_tags'])) {
481
+			if ($dummy)
482
+				$post_tags = $request_info['post_tags'];
483
+		} else {
484
+			if ($dummy)
485
+				$post_tags = array($request_info['post_title']);
486
+		}
487 487
 
488
-        if (is_array($post_tags)) {
489
-            $taxonomy = $request_info['listing_type'] . '_tags';
490
-            wp_set_object_terms($last_post_id, $post_tags, $taxonomy);
491
-        }
488
+		if (is_array($post_tags)) {
489
+			$taxonomy = $request_info['listing_type'] . '_tags';
490
+			wp_set_object_terms($last_post_id, $post_tags, $taxonomy);
491
+		}
492 492
 
493 493
 
494
-        // Insert attachment
494
+		// Insert attachment
495 495
 
496
-        if (isset($request_info['post_images']) && !is_wp_error($last_post_id)) {
497
-            if (!$dummy) {
498
-                $tmpimgArr = trim($request_info['post_images'], ",");
499
-                $tmpimgArr = explode(",", $tmpimgArr);
500
-                geodir_save_post_images($last_post_id, $tmpimgArr, $dummy);
501
-            } else{
502
-                geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy);
503
-            }
496
+		if (isset($request_info['post_images']) && !is_wp_error($last_post_id)) {
497
+			if (!$dummy) {
498
+				$tmpimgArr = trim($request_info['post_images'], ",");
499
+				$tmpimgArr = explode(",", $tmpimgArr);
500
+				geodir_save_post_images($last_post_id, $tmpimgArr, $dummy);
501
+			} else{
502
+				geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy);
503
+			}
504 504
 
505 505
 
506
-        } elseif (!isset($request_info['post_images']) || $request_info['post_images'] == '') {
506
+		} elseif (!isset($request_info['post_images']) || $request_info['post_images'] == '') {
507 507
 
508
-            /* Delete Attachments
508
+			/* Delete Attachments
509 509
 			$postcurr_images = geodir_get_images($last_post_id);
510 510
 
511 511
 			$wpdb->query(
@@ -521,34 +521,34 @@  discard block
 block discarded – undo
521 521
 			geodir_save_post_info($last_post_id, $gd_post_featured_img);
522 522
 			*/
523 523
 
524
-        }
524
+		}
525 525
 
526
-        geodir_remove_temp_images();
527
-        geodir_set_wp_featured_image($last_post_id);
526
+		geodir_remove_temp_images();
527
+		geodir_set_wp_featured_image($last_post_id);
528 528
 
529
-        /**
530
-         * Called after a listing is saved to the database and before any email have been sent.
531
-         *
532
-         * @since 1.0.0
533
-         * @param int $last_post_id The saved post ID.
534
-         * @param array $request_info The post details in an array.
535
-         * @see 'geodir_after_save_listinginfo'
536
-         */
537
-        do_action('geodir_after_save_listing', $last_post_id, $request_info);
529
+		/**
530
+		 * Called after a listing is saved to the database and before any email have been sent.
531
+		 *
532
+		 * @since 1.0.0
533
+		 * @param int $last_post_id The saved post ID.
534
+		 * @param array $request_info The post details in an array.
535
+		 * @see 'geodir_after_save_listinginfo'
536
+		 */
537
+		do_action('geodir_after_save_listing', $last_post_id, $request_info);
538 538
 
539
-        //die;
539
+		//die;
540 540
 
541
-        if ($send_post_submit_mail) { // if new post send out email
542
-            $to_name = geodir_get_client_name($current_user->ID);
543
-            geodir_sendEmail('', '', $current_user->user_email, $to_name, '', '', $request_info, 'post_submit', $last_post_id, $current_user->ID);
544
-        }
545
-        /*
541
+		if ($send_post_submit_mail) { // if new post send out email
542
+			$to_name = geodir_get_client_name($current_user->ID);
543
+			geodir_sendEmail('', '', $current_user->user_email, $to_name, '', '', $request_info, 'post_submit', $last_post_id, $current_user->ID);
544
+		}
545
+		/*
546 546
          * Unset the session so we don't loop.
547 547
          */
548
-        $gd_session->un_set('listing');
549
-        return $last_post_id;
548
+		$gd_session->un_set('listing');
549
+		return $last_post_id;
550 550
 
551
-    }
551
+	}
552 552
 
553 553
 }
554 554
 
@@ -567,599 +567,599 @@  discard block
 block discarded – undo
567 567
 function geodir_get_post_info($post_id = '')
568 568
 {
569 569
 
570
-    global $wpdb, $plugin_prefix, $post, $post_info;
570
+	global $wpdb, $plugin_prefix, $post, $post_info;
571 571
 
572
-    if ($post_id == '' && !empty($post))
573
-        $post_id = $post->ID;
572
+	if ($post_id == '' && !empty($post))
573
+		$post_id = $post->ID;
574 574
 
575
-    $post_type = get_post_type($post_id);
575
+	$post_type = get_post_type($post_id);
576 576
 
577
-    $all_postypes = geodir_get_posttypes();
577
+	$all_postypes = geodir_get_posttypes();
578 578
 
579
-    if (!in_array($post_type, $all_postypes))
580
-        return false;
579
+	if (!in_array($post_type, $all_postypes))
580
+		return false;
581 581
 
582
-    $table = $plugin_prefix . $post_type . '_detail';
582
+	$table = $plugin_prefix . $post_type . '_detail';
583 583
 
584
-    /**
585
-     * Apply Filter to change Post info
586
-     *
587
-     * You can use this filter to change Post info.
588
-     *
589
-     * @since 1.0.0
590
-     * @package GeoDirectory
591
-     */
592
-    $query = apply_filters('geodir_post_info_query', $wpdb->prepare("SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd
584
+	/**
585
+	 * Apply Filter to change Post info
586
+	 *
587
+	 * You can use this filter to change Post info.
588
+	 *
589
+	 * @since 1.0.0
590
+	 * @package GeoDirectory
591
+	 */
592
+	$query = apply_filters('geodir_post_info_query', $wpdb->prepare("SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd
593 593
 			  WHERE p.ID = pd.post_id
594 594
 			  AND pd.post_id = %d", $post_id));
595 595
 
596
-    $post_detail = $wpdb->get_row($query);
596
+	$post_detail = $wpdb->get_row($query);
597 597
 
598
-    return (!empty($post_detail)) ? $post_info = $post_detail : $post_info = false;
598
+	return (!empty($post_detail)) ? $post_info = $post_detail : $post_info = false;
599 599
 
600 600
 }
601 601
 
602 602
 
603 603
 if (!function_exists('geodir_save_post_info')) {
604
-    /**
605
-     * Saves post detail info in detail table.
606
-     *
607
-     * @since 1.0.0
608
-     * @package GeoDirectory
609
-     * @global object $wpdb WordPress Database object.
610
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
611
-     * @param int $post_id The post ID.
612
-     * @param array $postinfo_array {
613
-     *    Post info that needs to be saved in detail table.
614
-     *
615
-     *    @type string $post_title              Listing title.
616
-     *    @type string $post_tags               Listing tags.
617
-     *    @type string $post_status             Listing post status.
618
-     *    @type string $post_location_id        Listing location ID.
619
-     *    @type string $claimed                 Todo Desc needed.
620
-     *    @type string $businesses              Todo Desc needed.
621
-     *    @type int    $submit_time             Submitted time in unix timestamp.
622
-     *    @type string $submit_ip               Submitted IP.
623
-     *    @type string $expire_date             Listing expiration date.
624
-     *    @type int    $package_id              Listing package ID.
625
-     *    @type int    $alive_days              Todo Desc needed.
626
-     *    @type int    $is_featured             Is this a featured listing?.
627
-     *    @type string $post_address            Listing address.
628
-     *    @type string $post_city               Listing city.
629
-     *    @type string $post_region             Listing region.
630
-     *    @type string $post_country            Listing country.
631
-     *    @type string $post_locations          Listing locations.
632
-     *    @type string $post_zip                Listing zip.
633
-     *    @type string $post_latitude           Listing latitude.
634
-     *    @type string $post_longitude          Listing longitude.
635
-     *    @type string $post_mapview            Listing mapview. Default "ROADMAP".
636
-     *    @type string $post_mapzoom            Listing mapzoom Default "9".
637
-     *    @type string $geodir_timing           Business timing info.
638
-     *    @type string $geodir_contact          Contact number.
639
-     *    @type string $geodir_email            Business contact email.
640
-     *    @type string $geodir_website          Business website.
641
-     *    @type string $geodir_twitter          Twitter link.
642
-     *    @type string $geodir_facebook         Facebook link.
643
-     *    @type string $geodir_video            Video link.
644
-     *    @type string $geodir_special_offers   Special offers.
645
-     *
646
-     * }
647
-     * @return bool
648
-     */
649
-    function geodir_save_post_info($post_id, $postinfo_array = array())
650
-    {
651
-        global $wpdb, $plugin_prefix;
652
-
653
-        $post_type = get_post_type($post_id);
654
-
655
-        $table = $plugin_prefix . $post_type . '_detail';
656
-
657
-        /**
658
-         * Filter to change Post info
659
-         *
660
-         * You can use this filter to change Post info.
661
-         *
662
-         * @since 1.0.0
663
-         * @package GeoDirectory
664
-         * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
665
-         * @param int $post_id The post ID.
666
-         */
667
-        $postmeta = apply_filters('geodir_listinginfo_request', $postinfo_array, $post_id);
604
+	/**
605
+	 * Saves post detail info in detail table.
606
+	 *
607
+	 * @since 1.0.0
608
+	 * @package GeoDirectory
609
+	 * @global object $wpdb WordPress Database object.
610
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
611
+	 * @param int $post_id The post ID.
612
+	 * @param array $postinfo_array {
613
+	 *    Post info that needs to be saved in detail table.
614
+	 *
615
+	 *    @type string $post_title              Listing title.
616
+	 *    @type string $post_tags               Listing tags.
617
+	 *    @type string $post_status             Listing post status.
618
+	 *    @type string $post_location_id        Listing location ID.
619
+	 *    @type string $claimed                 Todo Desc needed.
620
+	 *    @type string $businesses              Todo Desc needed.
621
+	 *    @type int    $submit_time             Submitted time in unix timestamp.
622
+	 *    @type string $submit_ip               Submitted IP.
623
+	 *    @type string $expire_date             Listing expiration date.
624
+	 *    @type int    $package_id              Listing package ID.
625
+	 *    @type int    $alive_days              Todo Desc needed.
626
+	 *    @type int    $is_featured             Is this a featured listing?.
627
+	 *    @type string $post_address            Listing address.
628
+	 *    @type string $post_city               Listing city.
629
+	 *    @type string $post_region             Listing region.
630
+	 *    @type string $post_country            Listing country.
631
+	 *    @type string $post_locations          Listing locations.
632
+	 *    @type string $post_zip                Listing zip.
633
+	 *    @type string $post_latitude           Listing latitude.
634
+	 *    @type string $post_longitude          Listing longitude.
635
+	 *    @type string $post_mapview            Listing mapview. Default "ROADMAP".
636
+	 *    @type string $post_mapzoom            Listing mapzoom Default "9".
637
+	 *    @type string $geodir_timing           Business timing info.
638
+	 *    @type string $geodir_contact          Contact number.
639
+	 *    @type string $geodir_email            Business contact email.
640
+	 *    @type string $geodir_website          Business website.
641
+	 *    @type string $geodir_twitter          Twitter link.
642
+	 *    @type string $geodir_facebook         Facebook link.
643
+	 *    @type string $geodir_video            Video link.
644
+	 *    @type string $geodir_special_offers   Special offers.
645
+	 *
646
+	 * }
647
+	 * @return bool
648
+	 */
649
+	function geodir_save_post_info($post_id, $postinfo_array = array())
650
+	{
651
+		global $wpdb, $plugin_prefix;
652
+
653
+		$post_type = get_post_type($post_id);
654
+
655
+		$table = $plugin_prefix . $post_type . '_detail';
656
+
657
+		/**
658
+		 * Filter to change Post info
659
+		 *
660
+		 * You can use this filter to change Post info.
661
+		 *
662
+		 * @since 1.0.0
663
+		 * @package GeoDirectory
664
+		 * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
665
+		 * @param int $post_id The post ID.
666
+		 */
667
+		$postmeta = apply_filters('geodir_listinginfo_request', $postinfo_array, $post_id);
668
+
669
+		$query_string_escaped = '';
670
+		$query_string_array = array();
671
+
672
+		if (!empty($postmeta) && $post_id) {
673
+
674
+			$columns = $wpdb->get_col("show columns from $table");
675
+			foreach ($postmeta as $mkey => $mval) {
676
+				if(in_array($mkey,$columns)) {
677
+					if (is_array($mval)) {
678
+						$mval = implode(",", $mval);
679
+					}
680
+					$query_string_escaped .= " $mkey = %s, "; // we can set the key here as we check if the column exists above
681
+					$query_string_array[] = stripslashes($mval); // we strip slashes as we are using wpdb prepare
668 682
 
669
-        $query_string_escaped = '';
670
-        $query_string_array = array();
683
+				}
684
+			}
671 685
 
672
-        if (!empty($postmeta) && $post_id) {
686
+			$query_string_escaped = trim($query_string_escaped, ", ");
673 687
 
674
-            $columns = $wpdb->get_col("show columns from $table");
675
-            foreach ($postmeta as $mkey => $mval) {
676
-                if(in_array($mkey,$columns)) {
677
-                    if (is_array($mval)) {
678
-                        $mval = implode(",", $mval);
679
-                    }
680
-                    $query_string_escaped .= " $mkey = %s, "; // we can set the key here as we check if the column exists above
681
-                    $query_string_array[] = stripslashes($mval); // we strip slashes as we are using wpdb prepare
688
+			if (empty($query_string_array) || trim($query_string_escaped) == '') {
689
+				return false;
690
+			}
682 691
 
683
-                }
684
-            }
692
+			$query_string_array = str_replace(array("'%", "%'"), array("'%%", "%%'"), $query_string_array);
685 693
 
686
-            $query_string_escaped = trim($query_string_escaped, ", ");
687 694
 
688
-            if (empty($query_string_array) || trim($query_string_escaped) == '') {
689
-                return false;
690
-            }
695
+			/**
696
+			 * Called before saving the listing info.
697
+			 *
698
+			 * @since 1.0.0
699
+			 * @package GeoDirectory
700
+			 * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
701
+			 * @param int $post_id The post ID.
702
+			 */
703
+			do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id);
691 704
 
692
-            $query_string_array = str_replace(array("'%", "%'"), array("'%%", "%%'"), $query_string_array);
705
+			if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
693 706
 
707
+				$query_string_array[] = $post_id;
708
+				$wpdb->query(
709
+					$wpdb->prepare(
710
+						"UPDATE " . $table . " SET " . $query_string_escaped . " where post_id =%d",
711
+						$query_string_array
712
+					)
713
+				);
694 714
 
695
-            /**
696
-             * Called before saving the listing info.
697
-             *
698
-             * @since 1.0.0
699
-             * @package GeoDirectory
700
-             * @param array $postinfo_array See {@see geodir_save_post_info()} for accepted args.
701
-             * @param int $post_id The post ID.
702
-             */
703
-            do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id);
704 715
 
705
-            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
716
+			} else {
706 717
 
707
-                $query_string_array[] = $post_id;
708
-                $wpdb->query(
709
-                    $wpdb->prepare(
710
-                        "UPDATE " . $table . " SET " . $query_string_escaped . " where post_id =%d",
711
-                        $query_string_array
712
-                    )
713
-                );
718
+				array_unshift($query_string_array, $post_id);
719
+				$wpdb->query(
720
+					$wpdb->prepare(
721
+						"INSERT INTO " . $table . " SET post_id = %d," . $query_string_escaped,
722
+						$query_string_array
723
+					)
724
+				);
725
+                
726
+			}
714 727
 
728
+			/**
729
+			 * Called after saving the listing info.
730
+			 *
731
+			 * @since 1.0.0
732
+			 * @package GeoDirectory
733
+			 * @param array $postinfo_array Post info that needs to be saved in detail table.
734
+			 * @param int $post_id The post ID.
735
+			 * @see 'geodir_after_save_listing'
736
+			 */
737
+			do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
738
+
739
+			return true;
740
+		} else
741
+			return false;
715 742
 
716
-            } else {
743
+	}
744
+}
717 745
 
718
-                array_unshift($query_string_array, $post_id);
719
-                $wpdb->query(
720
-                    $wpdb->prepare(
721
-                        "INSERT INTO " . $table . " SET post_id = %d," . $query_string_escaped,
722
-                        $query_string_array
723
-                    )
724
-                );
725
-                
726
-            }
727 746
 
728
-            /**
729
-             * Called after saving the listing info.
730
-             *
731
-             * @since 1.0.0
732
-             * @package GeoDirectory
733
-             * @param array $postinfo_array Post info that needs to be saved in detail table.
734
-             * @param int $post_id The post ID.
735
-             * @see 'geodir_after_save_listing'
736
-             */
737
-            do_action('geodir_after_save_listinginfo', $postinfo_array, $post_id);
747
+if (!function_exists('geodir_save_post_meta')) {
748
+	/**
749
+	 * Save or update post custom fields.
750
+	 *
751
+	 * @since 1.0.0
752
+	 * @package GeoDirectory
753
+	 * @global object $wpdb WordPress Database object.
754
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
755
+	 * @param int $post_id The post ID.
756
+	 * @param string $postmeta Detail table column name.
757
+	 * @param string $meta_value Detail table column value.
758
+	 * @return void|bool
759
+	 */
760
+	function geodir_save_post_meta($post_id, $postmeta = '', $meta_value = '')
761
+	{
762
+
763
+		global $wpdb, $plugin_prefix;
764
+
765
+		$post_type = get_post_type($post_id);
766
+
767
+		$table = $plugin_prefix . $post_type . '_detail';
768
+
769
+		if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) {
770
+
771
+			if (is_array($meta_value)) {
772
+				$meta_value = implode(",", $meta_value);
773
+			}
738 774
 
739
-            return true;
740
-        } else
741
-            return false;
775
+			if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
742 776
 
743
-    }
744
-}
777
+				$wpdb->query(
778
+					$wpdb->prepare(
779
+						"UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d",
780
+						array($post_id)
781
+					)
782
+				);
745 783
 
784
+			} else {
746 785
 
747
-if (!function_exists('geodir_save_post_meta')) {
748
-    /**
749
-     * Save or update post custom fields.
750
-     *
751
-     * @since 1.0.0
752
-     * @package GeoDirectory
753
-     * @global object $wpdb WordPress Database object.
754
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
755
-     * @param int $post_id The post ID.
756
-     * @param string $postmeta Detail table column name.
757
-     * @param string $meta_value Detail table column value.
758
-     * @return void|bool
759
-     */
760
-    function geodir_save_post_meta($post_id, $postmeta = '', $meta_value = '')
761
-    {
762
-
763
-        global $wpdb, $plugin_prefix;
764
-
765
-        $post_type = get_post_type($post_id);
766
-
767
-        $table = $plugin_prefix . $post_type . '_detail';
768
-
769
-        if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) {
770
-
771
-            if (is_array($meta_value)) {
772
-                $meta_value = implode(",", $meta_value);
773
-            }
774
-
775
-            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
776
-
777
-                $wpdb->query(
778
-                    $wpdb->prepare(
779
-                        "UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d",
780
-                        array($post_id)
781
-                    )
782
-                );
783
-
784
-            } else {
785
-
786
-                $wpdb->query(
787
-                    $wpdb->prepare(
788
-                        "INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'",
789
-                        array($post_id)
790
-                    )
791
-                );
792
-            }
793
-
794
-
795
-        } else
796
-            return false;
797
-    }
786
+				$wpdb->query(
787
+					$wpdb->prepare(
788
+						"INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'",
789
+						array($post_id)
790
+					)
791
+				);
792
+			}
793
+
794
+
795
+		} else
796
+			return false;
797
+	}
798 798
 }
799 799
 
800 800
 if (!function_exists('geodir_delete_post_meta')) {
801
-    /**
802
-     * Delete post custom fields.
803
-     *
804
-     * @since 1.0.0
805
-     * @package GeoDirectory
806
-     * @global object $wpdb WordPress Database object.
807
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
808
-     * @param int $post_id The post ID.
809
-     * @param string $postmeta Detail table column name.
810
-     * @todo check if this is depreciated
811
-     * @todo Fix unknown variable mval
812
-     * @return bool
813
-     */
814
-    function geodir_delete_post_meta($post_id, $postmeta)
815
-    {
816
-
817
-        global $wpdb, $plugin_prefix;
818
-
819
-        $post_type = get_post_type($post_id);
820
-
821
-        $table = $plugin_prefix . $post_type . '_detail';
822
-
823
-        if (is_array($postmeta) && !empty($postmeta) && $post_id) {
824
-            $post_meta_set_query = '';
825
-
826
-            foreach ($postmeta as $mkey) {
827
-                if ($mval != '')
828
-                    $post_meta_set_query .= $mkey . " = '', ";
829
-            }
830
-
831
-            $post_meta_set_query = trim($post_meta_set_query, ", ");
801
+	/**
802
+	 * Delete post custom fields.
803
+	 *
804
+	 * @since 1.0.0
805
+	 * @package GeoDirectory
806
+	 * @global object $wpdb WordPress Database object.
807
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
808
+	 * @param int $post_id The post ID.
809
+	 * @param string $postmeta Detail table column name.
810
+	 * @todo check if this is depreciated
811
+	 * @todo Fix unknown variable mval
812
+	 * @return bool
813
+	 */
814
+	function geodir_delete_post_meta($post_id, $postmeta)
815
+	{
816
+
817
+		global $wpdb, $plugin_prefix;
818
+
819
+		$post_type = get_post_type($post_id);
820
+
821
+		$table = $plugin_prefix . $post_type . '_detail';
822
+
823
+		if (is_array($postmeta) && !empty($postmeta) && $post_id) {
824
+			$post_meta_set_query = '';
825
+
826
+			foreach ($postmeta as $mkey) {
827
+				if ($mval != '')
828
+					$post_meta_set_query .= $mkey . " = '', ";
829
+			}
830
+
831
+			$post_meta_set_query = trim($post_meta_set_query, ", ");
832 832
             
833
-            if (empty($post_meta_set_query) || trim($post_meta_set_query) == '') {
834
-                return false;
835
-            }
836
-
837
-            if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
838
-
839
-                $wpdb->query(
840
-                    $wpdb->prepare(
841
-                        "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d",
842
-                        array($post_id)
843
-                    )
844
-                );
845
-
846
-                return true;
847
-            }
848
-
849
-        } elseif ($postmeta != '' && $post_id) {
850
-            if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
851
-
852
-                $wpdb->query(
853
-                    $wpdb->prepare(
854
-                        "UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d",
855
-                        array($post_id)
856
-                    )
857
-                );
858
-
859
-                return true;
860
-            }
861
-
862
-        } else
863
-            return false;
864
-    }
833
+			if (empty($post_meta_set_query) || trim($post_meta_set_query) == '') {
834
+				return false;
835
+			}
836
+
837
+			if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
838
+
839
+				$wpdb->query(
840
+					$wpdb->prepare(
841
+						"UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d",
842
+						array($post_id)
843
+					)
844
+				);
845
+
846
+				return true;
847
+			}
848
+
849
+		} elseif ($postmeta != '' && $post_id) {
850
+			if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
851
+
852
+				$wpdb->query(
853
+					$wpdb->prepare(
854
+						"UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d",
855
+						array($post_id)
856
+					)
857
+				);
858
+
859
+				return true;
860
+			}
861
+
862
+		} else
863
+			return false;
864
+	}
865 865
 }
866 866
 
867 867
 
868 868
 if (!function_exists('geodir_get_post_meta')) {
869
-    /**
870
-     * Get post custom meta.
871
-     *
872
-     * @since 1.0.0
873
-     * @package GeoDirectory
874
-     * @global object $wpdb WordPress Database object.
875
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
876
-     * @param int $post_id The post ID.
877
-     * @param string $meta_key The meta key to retrieve.
878
-     * @param bool $single Optional. Whether to return a single value. Default false.
879
-     * @todo single variable not yet implemented.
880
-     * @return bool|mixed|null|string Will be an array if $single is false. Will be value of meta data field if $single is true.
881
-     */
882
-    function geodir_get_post_meta($post_id, $meta_key, $single = false)
883
-    {
884
-        if (!$post_id) {
885
-            return false;
886
-        }
887
-        global $wpdb, $plugin_prefix;
888
-
889
-        $all_postypes = geodir_get_posttypes();
890
-
891
-        $post_type = get_post_type($post_id);
892
-
893
-        if (!in_array($post_type, $all_postypes))
894
-            return false;
895
-
896
-        $table = $plugin_prefix . $post_type . '_detail';
897
-
898
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') {
899
-            $meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)));
900
-            if ($meta_value && $meta_value !== '') {
901
-                return maybe_serialize($meta_value);
902
-            } else
903
-                return $meta_value;
904
-        } else {
905
-            return false;
906
-        }
907
-    }
869
+	/**
870
+	 * Get post custom meta.
871
+	 *
872
+	 * @since 1.0.0
873
+	 * @package GeoDirectory
874
+	 * @global object $wpdb WordPress Database object.
875
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
876
+	 * @param int $post_id The post ID.
877
+	 * @param string $meta_key The meta key to retrieve.
878
+	 * @param bool $single Optional. Whether to return a single value. Default false.
879
+	 * @todo single variable not yet implemented.
880
+	 * @return bool|mixed|null|string Will be an array if $single is false. Will be value of meta data field if $single is true.
881
+	 */
882
+	function geodir_get_post_meta($post_id, $meta_key, $single = false)
883
+	{
884
+		if (!$post_id) {
885
+			return false;
886
+		}
887
+		global $wpdb, $plugin_prefix;
888
+
889
+		$all_postypes = geodir_get_posttypes();
890
+
891
+		$post_type = get_post_type($post_id);
892
+
893
+		if (!in_array($post_type, $all_postypes))
894
+			return false;
895
+
896
+		$table = $plugin_prefix . $post_type . '_detail';
897
+
898
+		if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') {
899
+			$meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)));
900
+			if ($meta_value && $meta_value !== '') {
901
+				return maybe_serialize($meta_value);
902
+			} else
903
+				return $meta_value;
904
+		} else {
905
+			return false;
906
+		}
907
+	}
908 908
 }
909 909
 
910 910
 
911 911
 if (!function_exists('geodir_save_post_images')) {
912
-    /**
913
-     * Save post attachments.
914
-     *
915
-     * @since 1.0.0
916
-     * @package GeoDirectory
917
-     * @global object $wpdb WordPress Database object.
918
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
919
-     * @global object $current_user Current user object.
920
-     * @param int $post_id The post ID.
921
-     * @param array $post_image Post image urls as an array.
922
-     * @param bool $dummy Optional. Is this a dummy listing? Default false.
923
-     */
924
-    function geodir_save_post_images($post_id = 0, $post_image = array(), $dummy = false)
925
-    {
912
+	/**
913
+	 * Save post attachments.
914
+	 *
915
+	 * @since 1.0.0
916
+	 * @package GeoDirectory
917
+	 * @global object $wpdb WordPress Database object.
918
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
919
+	 * @global object $current_user Current user object.
920
+	 * @param int $post_id The post ID.
921
+	 * @param array $post_image Post image urls as an array.
922
+	 * @param bool $dummy Optional. Is this a dummy listing? Default false.
923
+	 */
924
+	function geodir_save_post_images($post_id = 0, $post_image = array(), $dummy = false)
925
+	{
926 926
 
927 927
 
928
-        global $wpdb, $plugin_prefix, $current_user;
928
+		global $wpdb, $plugin_prefix, $current_user;
929 929
 
930
-        $post_type = get_post_type($post_id);
930
+		$post_type = get_post_type($post_id);
931 931
 
932
-        $table = $plugin_prefix . $post_type . '_detail';
932
+		$table = $plugin_prefix . $post_type . '_detail';
933 933
 
934
-        $post_images = geodir_get_images($post_id);
934
+		$post_images = geodir_get_images($post_id);
935 935
 
936
-        $wpdb->query(
937
-            $wpdb->prepare(
938
-                "UPDATE " . $table . " SET featured_image = '' where post_id =%d",
939
-                array($post_id)
940
-            )
941
-        );
936
+		$wpdb->query(
937
+			$wpdb->prepare(
938
+				"UPDATE " . $table . " SET featured_image = '' where post_id =%d",
939
+				array($post_id)
940
+			)
941
+		);
942 942
 
943
-        $invalid_files = $post_images;
944
-        $valid_file_ids = array();
945
-        $valid_files_condition = '';
946
-        $geodir_uploaddir = '';
943
+		$invalid_files = $post_images;
944
+		$valid_file_ids = array();
945
+		$valid_files_condition = '';
946
+		$geodir_uploaddir = '';
947 947
 
948
-        $remove_files = array();
948
+		$remove_files = array();
949 949
 
950
-        if (!empty($post_image)) {
950
+		if (!empty($post_image)) {
951 951
 
952
-            $uploads = wp_upload_dir();
953
-            $uploads_dir = $uploads['path'];
952
+			$uploads = wp_upload_dir();
953
+			$uploads_dir = $uploads['path'];
954 954
 
955
-            $geodir_uploadpath = $uploads['path'];
956
-            $geodir_uploadurl = $uploads['url'];
957
-            $sub_dir = isset($uploads['subdir']) ? $uploads['subdir'] : '';
955
+			$geodir_uploadpath = $uploads['path'];
956
+			$geodir_uploadurl = $uploads['url'];
957
+			$sub_dir = isset($uploads['subdir']) ? $uploads['subdir'] : '';
958 958
 
959
-            $invalid_files = array();
960
-            $postcurr_images = array();
959
+			$invalid_files = array();
960
+			$postcurr_images = array();
961 961
 
962
-            for ($m = 0; $m < count($post_image); $m++) {
963
-                $menu_order = $m + 1;
962
+			for ($m = 0; $m < count($post_image); $m++) {
963
+				$menu_order = $m + 1;
964 964
 
965
-                $file_path = '';
966
-                /* --------- start ------- */
965
+				$file_path = '';
966
+				/* --------- start ------- */
967 967
 
968
-                $split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
968
+				$split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
969 969
 
970
-                $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
970
+				$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
971 971
 
972 972
 
973
-                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE file=%s AND post_id = %d", array($split_img_file_path, $post_id)))) {
973
+				if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE file=%s AND post_id = %d", array($split_img_file_path, $post_id)))) {
974 974
 
975
-                    /* --------- end ------- */
976
-                    $curr_img_url = $post_image[$m];
975
+					/* --------- end ------- */
976
+					$curr_img_url = $post_image[$m];
977 977
 
978
-                    $image_name_arr = explode('/', $curr_img_url);
978
+					$image_name_arr = explode('/', $curr_img_url);
979 979
 
980
-                    $count_image_name_arr = count($image_name_arr) - 2;
980
+					$count_image_name_arr = count($image_name_arr) - 2;
981 981
 
982
-                    $count_image_name_arr = ($count_image_name_arr >= 0) ? $count_image_name_arr : 0;
982
+					$count_image_name_arr = ($count_image_name_arr >= 0) ? $count_image_name_arr : 0;
983 983
 
984
-                    $curr_img_dir = $image_name_arr[$count_image_name_arr];
984
+					$curr_img_dir = $image_name_arr[$count_image_name_arr];
985 985
 
986
-                    $filename = end($image_name_arr);
987
-                    if (strpos($filename, '?') !== false) {
988
-                        list($filename) = explode('?', $filename);
989
-                    }
986
+					$filename = end($image_name_arr);
987
+					if (strpos($filename, '?') !== false) {
988
+						list($filename) = explode('?', $filename);
989
+					}
990 990
 
991
-                    $curr_img_dir = str_replace($uploads['baseurl'], "", $curr_img_url);
992
-                    $curr_img_dir = str_replace($filename, "", $curr_img_dir);
991
+					$curr_img_dir = str_replace($uploads['baseurl'], "", $curr_img_url);
992
+					$curr_img_dir = str_replace($filename, "", $curr_img_dir);
993 993
 
994
-                    $img_name_arr = explode('.', $filename);
994
+					$img_name_arr = explode('.', $filename);
995 995
 
996
-                    $file_title = isset($img_name_arr[0]) ? $img_name_arr[0] : $filename;
997
-                    if (!empty($img_name_arr) && count($img_name_arr) > 2) {
998
-                        $new_img_name_arr = $img_name_arr;
999
-                        if (isset($new_img_name_arr[count($img_name_arr) - 1])) {
1000
-                            unset($new_img_name_arr[count($img_name_arr) - 1]);
1001
-                            $file_title = implode('.', $new_img_name_arr);
1002
-                        }
1003
-                    }
1004
-                    $file_title = sanitize_file_name($file_title);
1005
-                    $file_name = sanitize_file_name($filename);
996
+					$file_title = isset($img_name_arr[0]) ? $img_name_arr[0] : $filename;
997
+					if (!empty($img_name_arr) && count($img_name_arr) > 2) {
998
+						$new_img_name_arr = $img_name_arr;
999
+						if (isset($new_img_name_arr[count($img_name_arr) - 1])) {
1000
+							unset($new_img_name_arr[count($img_name_arr) - 1]);
1001
+							$file_title = implode('.', $new_img_name_arr);
1002
+						}
1003
+					}
1004
+					$file_title = sanitize_file_name($file_title);
1005
+					$file_name = sanitize_file_name($filename);
1006 1006
 
1007
-                    $arr_file_type = wp_check_filetype($filename);
1007
+					$arr_file_type = wp_check_filetype($filename);
1008 1008
 
1009
-                    $uploaded_file_type = $arr_file_type['type'];
1009
+					$uploaded_file_type = $arr_file_type['type'];
1010 1010
 
1011
-                    // Set an array containing a list of acceptable formats
1012
-                    $allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png');
1011
+					// Set an array containing a list of acceptable formats
1012
+					$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png');
1013 1013
 
1014
-                    // If the uploaded file is the right format
1015
-                    if (in_array($uploaded_file_type, $allowed_file_types)) {
1016
-                        if (!function_exists('wp_handle_upload')) {
1017
-                            require_once(ABSPATH . 'wp-admin/includes/file.php');
1018
-                        }
1014
+					// If the uploaded file is the right format
1015
+					if (in_array($uploaded_file_type, $allowed_file_types)) {
1016
+						if (!function_exists('wp_handle_upload')) {
1017
+							require_once(ABSPATH . 'wp-admin/includes/file.php');
1018
+						}
1019 1019
 
1020
-                        if (!is_dir($geodir_uploadpath)) {
1021
-                            mkdir($geodir_uploadpath);
1022
-                        }
1020
+						if (!is_dir($geodir_uploadpath)) {
1021
+							mkdir($geodir_uploadpath);
1022
+						}
1023 1023
 
1024
-                        $external_img = false;
1025
-                        if (strpos( str_replace( array('http://','https://'),'',$curr_img_url ), str_replace(array('http://','https://'),'',$uploads['baseurl'] ) ) !== false) {
1026
-                        } else {
1027
-                            $external_img = true;
1028
-                        }
1024
+						$external_img = false;
1025
+						if (strpos( str_replace( array('http://','https://'),'',$curr_img_url ), str_replace(array('http://','https://'),'',$uploads['baseurl'] ) ) !== false) {
1026
+						} else {
1027
+							$external_img = true;
1028
+						}
1029 1029
 
1030
-                        if ($dummy || $external_img) {
1031
-                            $uploaded_file = array();
1032
-                            $uploaded = (array)fetch_remote_file($curr_img_url);
1030
+						if ($dummy || $external_img) {
1031
+							$uploaded_file = array();
1032
+							$uploaded = (array)fetch_remote_file($curr_img_url);
1033 1033
 
1034
-                            if (isset($uploaded['error']) && empty($uploaded['error'])) {
1035
-                                $new_name = basename($uploaded['file']);
1036
-                                $uploaded_file = $uploaded;
1037
-                            }else{
1038
-                                print_r($uploaded);exit;
1039
-                            }
1040
-                            $external_img = false;
1041
-                        } else {
1042
-                            $new_name = $post_id . '_' . $file_name;
1034
+							if (isset($uploaded['error']) && empty($uploaded['error'])) {
1035
+								$new_name = basename($uploaded['file']);
1036
+								$uploaded_file = $uploaded;
1037
+							}else{
1038
+								print_r($uploaded);exit;
1039
+							}
1040
+							$external_img = false;
1041
+						} else {
1042
+							$new_name = $post_id . '_' . $file_name;
1043 1043
 
1044
-                            if ($curr_img_dir == $sub_dir) {
1045
-                                $img_path = $geodir_uploadpath . '/' . $filename;
1046
-                                $img_url = $geodir_uploadurl . '/' . $filename;
1047
-                            } else {
1048
-                                $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1049
-                                $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1050
-                            }
1044
+							if ($curr_img_dir == $sub_dir) {
1045
+								$img_path = $geodir_uploadpath . '/' . $filename;
1046
+								$img_url = $geodir_uploadurl . '/' . $filename;
1047
+							} else {
1048
+								$img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1049
+								$img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1050
+							}
1051 1051
 
1052
-                            $uploaded_file = '';
1052
+							$uploaded_file = '';
1053 1053
 
1054
-                            if (file_exists($img_path)) {
1055
-                                $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1056
-                                $file_path = '';
1057
-                            } else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) {
1058
-                                $uploaded_file = true;
1059
-                                $file_path = $curr_img_dir . '/' . $filename;
1060
-                            }
1054
+							if (file_exists($img_path)) {
1055
+								$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1056
+								$file_path = '';
1057
+							} else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) {
1058
+								$uploaded_file = true;
1059
+								$file_path = $curr_img_dir . '/' . $filename;
1060
+							}
1061 1061
 
1062
-                            if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))
1063
-                                unlink($img_path);
1064
-                        }
1062
+							if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))
1063
+								unlink($img_path);
1064
+						}
1065 1065
 
1066
-                        if (!empty($uploaded_file)) {
1067
-                            if (!isset($file_path) || !$file_path) {
1068
-                                $file_path = $sub_dir . '/' . $new_name;
1069
-                            }
1066
+						if (!empty($uploaded_file)) {
1067
+							if (!isset($file_path) || !$file_path) {
1068
+								$file_path = $sub_dir . '/' . $new_name;
1069
+							}
1070 1070
 
1071
-                            $postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
1071
+							$postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
1072 1072
 
1073
-                            if ($menu_order == 1) {
1073
+							if ($menu_order == 1) {
1074 1074
 
1075
-                                $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
1075
+								$wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
1076 1076
 
1077
-                            }
1077
+							}
1078 1078
 
1079
-                            // Set up options array to add this file as an attachment
1080
-                            $attachment = array();
1081
-                            $attachment['post_id'] = $post_id;
1082
-                            $attachment['title'] = $file_title;
1083
-                            $attachment['content'] = '';
1084
-                            $attachment['file'] = $file_path;
1085
-                            $attachment['mime_type'] = $uploaded_file_type;
1086
-                            $attachment['menu_order'] = $menu_order;
1087
-                            $attachment['is_featured'] = 0;
1079
+							// Set up options array to add this file as an attachment
1080
+							$attachment = array();
1081
+							$attachment['post_id'] = $post_id;
1082
+							$attachment['title'] = $file_title;
1083
+							$attachment['content'] = '';
1084
+							$attachment['file'] = $file_path;
1085
+							$attachment['mime_type'] = $uploaded_file_type;
1086
+							$attachment['menu_order'] = $menu_order;
1087
+							$attachment['is_featured'] = 0;
1088 1088
 
1089
-                            $attachment_set = '';
1089
+							$attachment_set = '';
1090 1090
 
1091
-                            foreach ($attachment as $key => $val) {
1092
-                                if ($val != '')
1093
-                                    $attachment_set .= $key . " = '" . $val . "', ";
1094
-                            }
1091
+							foreach ($attachment as $key => $val) {
1092
+								if ($val != '')
1093
+									$attachment_set .= $key . " = '" . $val . "', ";
1094
+							}
1095 1095
 
1096
-                            $attachment_set = trim($attachment_set, ", ");
1096
+							$attachment_set = trim($attachment_set, ", ");
1097
+
1098
+							$wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
1097 1099
 
1098
-                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
1100
+							$valid_file_ids[] = $wpdb->insert_id;
1101
+						}
1099 1102
 
1100
-                            $valid_file_ids[] = $wpdb->insert_id;
1101
-                        }
1103
+					}
1102 1104
 
1103
-                    }
1104 1105
 
1106
+				} else {
1107
+					$valid_file_ids[] = $find_image;
1105 1108
 
1106
-                } else {
1107
-                    $valid_file_ids[] = $find_image;
1108
-
1109
-                    $postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
1109
+					$postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
1110 1110
 
1111
-                    $wpdb->query(
1112
-                        $wpdb->prepare(
1113
-                            "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d",
1114
-                            array($menu_order, $split_img_path[1], $post_id)
1115
-                        )
1116
-                    );
1111
+					$wpdb->query(
1112
+						$wpdb->prepare(
1113
+							"UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d",
1114
+							array($menu_order, $split_img_path[1], $post_id)
1115
+						)
1116
+					);
1117 1117
 
1118
-                    if ($menu_order == 1)
1119
-                        $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1118
+					if ($menu_order == 1)
1119
+						$wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1120 1120
 
1121
-                }
1121
+				}
1122 1122
 
1123 1123
 
1124
-            }
1124
+			}
1125 1125
 
1126
-            if (!empty($valid_file_ids)) {
1126
+			if (!empty($valid_file_ids)) {
1127 1127
 
1128
-                $remove_files = $valid_file_ids;
1128
+				$remove_files = $valid_file_ids;
1129 1129
 
1130
-                $remove_files_length = count($remove_files);
1131
-                $remove_files_format = array_fill(0, $remove_files_length, '%d');
1132
-                $format = implode(',', $remove_files_format);
1133
-                $valid_files_condition = " ID NOT IN ($format) AND ";
1130
+				$remove_files_length = count($remove_files);
1131
+				$remove_files_format = array_fill(0, $remove_files_length, '%d');
1132
+				$format = implode(',', $remove_files_format);
1133
+				$valid_files_condition = " ID NOT IN ($format) AND ";
1134 1134
 
1135
-            }
1135
+			}
1136 1136
 
1137
-            //Get and remove all old images of post from database to set by new order
1137
+			//Get and remove all old images of post from database to set by new order
1138 1138
 
1139
-            if (!empty($post_images)) {
1139
+			if (!empty($post_images)) {
1140 1140
 
1141
-                foreach ($post_images as $img) {
1141
+				foreach ($post_images as $img) {
1142 1142
 
1143
-                    if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
1143
+					if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
1144 1144
 
1145
-                        $invalid_files[] = (object)array('src' => $img->src);
1145
+						$invalid_files[] = (object)array('src' => $img->src);
1146 1146
 
1147
-                    }
1147
+					}
1148 1148
 
1149
-                }
1149
+				}
1150 1150
 
1151
-            }
1151
+			}
1152 1152
 
1153
-            $invalid_files = (object)$invalid_files;
1154
-        }
1153
+			$invalid_files = (object)$invalid_files;
1154
+		}
1155 1155
 
1156
-        $remove_files[] = $post_id;
1156
+		$remove_files[] = $post_id;
1157 1157
 
1158
-        $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
1158
+		$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
1159 1159
 
1160
-        if (!empty($invalid_files))
1161
-            geodir_remove_attachments($invalid_files);
1162
-    }
1160
+		if (!empty($invalid_files))
1161
+			geodir_remove_attachments($invalid_files);
1162
+	}
1163 1163
 
1164 1164
 }
1165 1165
 
@@ -1173,12 +1173,12 @@  discard block
 block discarded – undo
1173 1173
 function geodir_remove_temp_images()
1174 1174
 {
1175 1175
 
1176
-    global $current_user;
1176
+	global $current_user;
1177 1177
 
1178
-    $uploads = wp_upload_dir();
1179
-    $uploads_dir = $uploads['path'];
1178
+	$uploads = wp_upload_dir();
1179
+	$uploads_dir = $uploads['path'];
1180 1180
 
1181
-    /*	if(is_dir($uploads_dir.'/temp_'.$current_user->data->ID)){
1181
+	/*	if(is_dir($uploads_dir.'/temp_'.$current_user->data->ID)){
1182 1182
 
1183 1183
 			$dirPath = $uploads_dir.'/temp_'.$current_user->data->ID;
1184 1184
 			if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
@@ -1195,8 +1195,8 @@  discard block
 block discarded – undo
1195 1195
 			rmdir($dirPath);
1196 1196
 	}	*/
1197 1197
 
1198
-    $dirname = $uploads_dir . '/temp_' . $current_user->ID;
1199
-    geodir_delete_directory($dirname);
1198
+	$dirname = $uploads_dir . '/temp_' . $current_user->ID;
1199
+	geodir_delete_directory($dirname);
1200 1200
 }
1201 1201
 
1202 1202
 
@@ -1210,131 +1210,131 @@  discard block
 block discarded – undo
1210 1210
  */
1211 1211
 function geodir_delete_directory($dirname)
1212 1212
 {
1213
-    $dir_handle = '';
1214
-    if (is_dir($dirname))
1215
-        $dir_handle = opendir($dirname);
1216
-    if (!$dir_handle)
1217
-        return false;
1218
-    while ($file = readdir($dir_handle)) {
1219
-        if ($file != "." && $file != "..") {
1220
-            if (!is_dir($dirname . "/" . $file))
1221
-                unlink($dirname . "/" . $file);
1222
-            else
1223
-                geodir_delete_directory($dirname . '/' . $file);
1224
-        }
1225
-    }
1226
-    closedir($dir_handle);
1227
-    rmdir($dirname);
1228
-    return true;
1213
+	$dir_handle = '';
1214
+	if (is_dir($dirname))
1215
+		$dir_handle = opendir($dirname);
1216
+	if (!$dir_handle)
1217
+		return false;
1218
+	while ($file = readdir($dir_handle)) {
1219
+		if ($file != "." && $file != "..") {
1220
+			if (!is_dir($dirname . "/" . $file))
1221
+				unlink($dirname . "/" . $file);
1222
+			else
1223
+				geodir_delete_directory($dirname . '/' . $file);
1224
+		}
1225
+	}
1226
+	closedir($dir_handle);
1227
+	rmdir($dirname);
1228
+	return true;
1229 1229
 
1230 1230
 }
1231 1231
 
1232 1232
 
1233 1233
 if (!function_exists('geodir_remove_attachments')) {
1234
-    /**
1235
-     * Remove post attachments.
1236
-     *
1237
-     * @since 1.0.0
1238
-     * @package GeoDirectory
1239
-     * @param array $postcurr_images Array of image objects.
1240
-     */
1241
-    function geodir_remove_attachments($postcurr_images = array())
1242
-    {
1243
-        // Unlink all past images of post
1244
-        if (!empty($postcurr_images)) {
1245
-
1246
-            $uploads = wp_upload_dir();
1247
-            $uploads_dir = $uploads['path'];
1248
-
1249
-            foreach ($postcurr_images as $postimg) {
1250
-                $image_name_arr = explode('/', $postimg->src);
1251
-                $filename = end($image_name_arr);
1252
-                if (file_exists($uploads_dir . '/' . $filename))
1253
-                    unlink($uploads_dir . '/' . $filename);
1254
-            }
1255
-
1256
-        } // endif
1257
-        // Unlink all past images of post end
1258
-    }
1234
+	/**
1235
+	 * Remove post attachments.
1236
+	 *
1237
+	 * @since 1.0.0
1238
+	 * @package GeoDirectory
1239
+	 * @param array $postcurr_images Array of image objects.
1240
+	 */
1241
+	function geodir_remove_attachments($postcurr_images = array())
1242
+	{
1243
+		// Unlink all past images of post
1244
+		if (!empty($postcurr_images)) {
1245
+
1246
+			$uploads = wp_upload_dir();
1247
+			$uploads_dir = $uploads['path'];
1248
+
1249
+			foreach ($postcurr_images as $postimg) {
1250
+				$image_name_arr = explode('/', $postimg->src);
1251
+				$filename = end($image_name_arr);
1252
+				if (file_exists($uploads_dir . '/' . $filename))
1253
+					unlink($uploads_dir . '/' . $filename);
1254
+			}
1255
+
1256
+		} // endif
1257
+		// Unlink all past images of post end
1258
+	}
1259 1259
 }
1260 1260
 
1261 1261
 if (!function_exists('geodir_get_featured_image')) {
1262
-    /**
1263
-     * Gets the post featured image.
1264
-     *
1265
-     * @since 1.0.0
1266
-     * @package GeoDirectory
1267
-     * @global object $wpdb WordPress Database object.
1268
-     * @global object $post The current post object.
1269
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1270
-     * @param int|string $post_id The post ID.
1271
-     * @param string $size Optional. Thumbnail size. Default: thumbnail.
1272
-     * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1273
-     * @param bool|string $file Optional. The file path from which you want to get the image details. Default: false.
1274
-     * @return bool|object Image details as an object.
1275
-     */
1276
-    function geodir_get_featured_image($post_id = '', $size = '', $no_image = false, $file = false)
1277
-    {
1278
-
1279
-        /*$img_arr['src'] = get_the_post_thumbnail_url( $post_id,  'medium');//medium/thumbnail
1262
+	/**
1263
+	 * Gets the post featured image.
1264
+	 *
1265
+	 * @since 1.0.0
1266
+	 * @package GeoDirectory
1267
+	 * @global object $wpdb WordPress Database object.
1268
+	 * @global object $post The current post object.
1269
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1270
+	 * @param int|string $post_id The post ID.
1271
+	 * @param string $size Optional. Thumbnail size. Default: thumbnail.
1272
+	 * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1273
+	 * @param bool|string $file Optional. The file path from which you want to get the image details. Default: false.
1274
+	 * @return bool|object Image details as an object.
1275
+	 */
1276
+	function geodir_get_featured_image($post_id = '', $size = '', $no_image = false, $file = false)
1277
+	{
1278
+
1279
+		/*$img_arr['src'] = get_the_post_thumbnail_url( $post_id,  'medium');//medium/thumbnail
1280 1280
         $img_arr['path'] = '';
1281 1281
         $img_arr['width'] = '';
1282 1282
         $img_arr['height'] = '';
1283 1283
         $img_arr['title'] = '';
1284 1284
         return (object)$img_arr;*/
1285
-        global $wpdb, $plugin_prefix, $post;
1285
+		global $wpdb, $plugin_prefix, $post;
1286
+
1287
+		if (isset($post->ID) && isset($post->post_type) && $post->ID == $post_id) {
1288
+			$post_type = $post->post_type;
1289
+		} else {
1290
+			$post_type = get_post_type($post_id);
1291
+		}
1292
+
1293
+		if (!in_array($post_type, geodir_get_posttypes())) {
1294
+			return false;// if not a GD CPT return;
1295
+		}
1296
+
1297
+
1298
+		/**
1299
+		 * Filter to force the list images to be smaller.
1300
+		 * @since 1.6.18
1301
+		 */
1302
+		if( $size=='list-thumb' && apply_filters('geodir_use_small_list_img',false) ){
1303
+			$fimg = get_the_post_thumbnail_url($post_id,'medium');
1304
+			if($fimg){
1305
+				$uploads = wp_upload_dir(); 
1306
+				$uploads_baseurl = $uploads['baseurl'];
1307
+				$file = str_replace($uploads_baseurl,'',$fimg);
1308
+			}
1309
+		}
1310
+
1311
+		$table = $plugin_prefix . $post_type . '_detail';
1286 1312
 
1287
-        if (isset($post->ID) && isset($post->post_type) && $post->ID == $post_id) {
1288
-            $post_type = $post->post_type;
1289
-        } else {
1290
-            $post_type = get_post_type($post_id);
1291
-        }
1313
+		if (!$file) {
1314
+			if (isset($post->featured_image)) {
1315
+				$file = $post->featured_image;
1316
+			} else {
1317
+				$file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id)));
1318
+			}
1319
+		}
1320
+
1321
+		if ($file != NULL && $file != '' && (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
1322
+			$img_arr = array();
1292 1323
 
1293
-        if (!in_array($post_type, geodir_get_posttypes())) {
1294
-            return false;// if not a GD CPT return;
1295
-        }
1324
+			$file_info = pathinfo($file);
1325
+			$sub_dir = '';
1326
+			if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
1327
+				$sub_dir = stripslashes_deep($file_info['dirname']);
1328
+			}
1296 1329
 
1330
+			$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1331
+			$uploads_baseurl = $uploads['baseurl'];
1332
+			$uploads_path = $uploads['path'];
1297 1333
 
1298
-        /**
1299
-         * Filter to force the list images to be smaller.
1300
-         * @since 1.6.18
1301
-         */
1302
-        if( $size=='list-thumb' && apply_filters('geodir_use_small_list_img',false) ){
1303
-            $fimg = get_the_post_thumbnail_url($post_id,'medium');
1304
-            if($fimg){
1305
-                $uploads = wp_upload_dir(); 
1306
-                $uploads_baseurl = $uploads['baseurl'];
1307
-                $file = str_replace($uploads_baseurl,'',$fimg);
1308
-            }
1309
-        }
1310
-
1311
-        $table = $plugin_prefix . $post_type . '_detail';
1312
-
1313
-        if (!$file) {
1314
-            if (isset($post->featured_image)) {
1315
-                $file = $post->featured_image;
1316
-            } else {
1317
-                $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id)));
1318
-            }
1319
-        }
1320
-
1321
-        if ($file != NULL && $file != '' && (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
1322
-            $img_arr = array();
1323
-
1324
-            $file_info = pathinfo($file);
1325
-            $sub_dir = '';
1326
-            if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
1327
-                $sub_dir = stripslashes_deep($file_info['dirname']);
1328
-            }
1329
-
1330
-            $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1331
-            $uploads_baseurl = $uploads['baseurl'];
1332
-            $uploads_path = $uploads['path'];
1333
-
1334
-            $file_name = $file_info['basename'];
1335
-
1336
-            $uploads_url = $uploads_baseurl . $sub_dir;
1337
-            /*
1334
+			$file_name = $file_info['basename'];
1335
+
1336
+			$uploads_url = $uploads_baseurl . $sub_dir;
1337
+			/*
1338 1338
              * Allows the filter of image src for such things as CDN change.
1339 1339
              *
1340 1340
              * @since 1.5.7
@@ -1343,158 +1343,158 @@  discard block
 block discarded – undo
1343 1343
              * @param string $uploads_url The server upload directory url.
1344 1344
              * @param string $uploads_baseurl The uploads dir base url.
1345 1345
              */
1346
-            $img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1347
-            $img_arr['path'] = $uploads_path . '/' . $file_name;
1348
-            $width = 0;
1349
-            $height = 0;
1350
-            if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1351
-                $imagesize = getimagesize($img_arr['path']);
1352
-                $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1353
-                $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1354
-            }
1355
-            $img_arr['width'] = $width;
1356
-            $img_arr['height'] = $height;
1357
-            $img_arr['title'] = '';
1358
-        } elseif ($post_images = geodir_get_images($post_id, $size, $no_image, 1)) {
1359
-            foreach ($post_images as $image) {
1360
-                return $image;
1361
-            }
1362
-        } else if ($no_image) {
1363
-            $img_arr = array();
1364
-
1365
-            $default_img = '';
1366
-            if (isset($post->default_category) && $post->default_category) {
1367
-                $default_cat = $post->default_category;
1368
-            } else {
1369
-                $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1370
-            }
1371
-
1372
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1373
-                $default_img = $default_catimg['src'];
1374
-            elseif ($no_image) {
1375
-                $default_img = get_option('geodir_listing_no_img');
1376
-            }
1377
-
1378
-            if (!empty($default_img)) {
1379
-                $uploads = wp_upload_dir(); // Array of key => value pairs
1380
-                $uploads_baseurl = $uploads['baseurl'];
1381
-                $uploads_path = $uploads['path'];
1382
-
1383
-                $img_arr = array();
1384
-
1385
-                $file_info = pathinfo($default_img);
1386
-
1387
-                $file_name = $file_info['basename'];
1388
-
1389
-                $img_arr['src'] = $default_img;
1390
-                $img_arr['path'] = $uploads_path . '/' . $file_name;
1391
-
1392
-                $width = 0;
1393
-                $height = 0;
1394
-                if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1395
-                    $imagesize = getimagesize($img_arr['path']);
1396
-                    $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1397
-                    $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1398
-                }
1399
-                $img_arr['width'] = $width;
1400
-                $img_arr['height'] = $height;
1401
-
1402
-                $img_arr['title'] = ''; // add the title to the array
1403
-            }
1404
-        }
1405
-
1406
-        if (!empty($img_arr))
1407
-            return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1408
-        else
1409
-            return false;
1410
-    }
1346
+			$img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1347
+			$img_arr['path'] = $uploads_path . '/' . $file_name;
1348
+			$width = 0;
1349
+			$height = 0;
1350
+			if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1351
+				$imagesize = getimagesize($img_arr['path']);
1352
+				$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1353
+				$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1354
+			}
1355
+			$img_arr['width'] = $width;
1356
+			$img_arr['height'] = $height;
1357
+			$img_arr['title'] = '';
1358
+		} elseif ($post_images = geodir_get_images($post_id, $size, $no_image, 1)) {
1359
+			foreach ($post_images as $image) {
1360
+				return $image;
1361
+			}
1362
+		} else if ($no_image) {
1363
+			$img_arr = array();
1364
+
1365
+			$default_img = '';
1366
+			if (isset($post->default_category) && $post->default_category) {
1367
+				$default_cat = $post->default_category;
1368
+			} else {
1369
+				$default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1370
+			}
1371
+
1372
+			if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1373
+				$default_img = $default_catimg['src'];
1374
+			elseif ($no_image) {
1375
+				$default_img = get_option('geodir_listing_no_img');
1376
+			}
1377
+
1378
+			if (!empty($default_img)) {
1379
+				$uploads = wp_upload_dir(); // Array of key => value pairs
1380
+				$uploads_baseurl = $uploads['baseurl'];
1381
+				$uploads_path = $uploads['path'];
1382
+
1383
+				$img_arr = array();
1384
+
1385
+				$file_info = pathinfo($default_img);
1386
+
1387
+				$file_name = $file_info['basename'];
1388
+
1389
+				$img_arr['src'] = $default_img;
1390
+				$img_arr['path'] = $uploads_path . '/' . $file_name;
1391
+
1392
+				$width = 0;
1393
+				$height = 0;
1394
+				if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1395
+					$imagesize = getimagesize($img_arr['path']);
1396
+					$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1397
+					$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1398
+				}
1399
+				$img_arr['width'] = $width;
1400
+				$img_arr['height'] = $height;
1401
+
1402
+				$img_arr['title'] = ''; // add the title to the array
1403
+			}
1404
+		}
1405
+
1406
+		if (!empty($img_arr))
1407
+			return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1408
+		else
1409
+			return false;
1410
+	}
1411 1411
 }
1412 1412
 
1413 1413
 if (!function_exists('geodir_show_featured_image')) {
1414
-    /**
1415
-     * Gets the post featured image.
1416
-     *
1417
-     * @since 1.0.0
1418
-     * @package GeoDirectory
1419
-     * @param int|string $post_id The post ID.
1420
-     * @param string $size Optional. Thumbnail size. Default: thumbnail.
1421
-     * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1422
-     * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1423
-     * @param bool|string $fimage Optional. The file path from which you want to get the image details. Default: false.
1424
-     * @return bool|string Returns image html.
1425
-     */
1426
-    function geodir_show_featured_image($post_id = '', $size = 'thumbnail', $no_image = false, $echo = true, $fimage = false)
1427
-    {
1428
-        $image = geodir_get_featured_image($post_id, $size, $no_image, $fimage);
1429
-
1430
-        $html = geodir_show_image($image, $size, $no_image, false);
1431
-
1432
-        if (!empty($html) && $echo) {
1433
-            echo $html;
1434
-        } elseif (!empty($html)) {
1435
-            return $html;
1436
-        } else
1437
-            return false;
1438
-    }
1414
+	/**
1415
+	 * Gets the post featured image.
1416
+	 *
1417
+	 * @since 1.0.0
1418
+	 * @package GeoDirectory
1419
+	 * @param int|string $post_id The post ID.
1420
+	 * @param string $size Optional. Thumbnail size. Default: thumbnail.
1421
+	 * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1422
+	 * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1423
+	 * @param bool|string $fimage Optional. The file path from which you want to get the image details. Default: false.
1424
+	 * @return bool|string Returns image html.
1425
+	 */
1426
+	function geodir_show_featured_image($post_id = '', $size = 'thumbnail', $no_image = false, $echo = true, $fimage = false)
1427
+	{
1428
+		$image = geodir_get_featured_image($post_id, $size, $no_image, $fimage);
1429
+
1430
+		$html = geodir_show_image($image, $size, $no_image, false);
1431
+
1432
+		if (!empty($html) && $echo) {
1433
+			echo $html;
1434
+		} elseif (!empty($html)) {
1435
+			return $html;
1436
+		} else
1437
+			return false;
1438
+	}
1439 1439
 }
1440 1440
 
1441 1441
 if (!function_exists('geodir_get_images')) {
1442
-    /**
1443
-     * Gets the post images.
1444
-     *
1445
-     * @since 1.0.0
1446
-     * @package GeoDirectory
1447
-     * @global object $wpdb WordPress Database object.
1448
-     * @param int $post_id The post ID.
1449
-     * @param string $img_size Optional. Thumbnail size.
1450
-     * @param bool $no_images Optional. Do you want to return the default image when no image is available? Default: false.
1451
-     * @param bool $add_featured Optional. Do you want to include featured images too? Default: true.
1452
-     * @param int|string $limit Optional. Number of images.
1453
-     * @return array|bool Returns images as an array. Each item is an object.
1454
-     */
1455
-    function geodir_get_images($post_id = 0, $img_size = '', $no_images = false, $add_featured = true, $limit = '')
1456
-    {
1457
-        global $wpdb;
1458
-        if ($limit) {
1459
-            $limit_q = " LIMIT $limit ";
1460
-        } else {
1461
-            $limit_q = '';
1462
-        }
1463
-        $not_featured = '';
1464
-        $sub_dir = '';
1465
-        if (!$add_featured)
1466
-            $not_featured = " AND is_featured = 0 ";
1467
-
1468
-        $arrImages = $wpdb->get_results(
1469
-            $wpdb->prepare(
1470
-                "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d" . $not_featured . " ORDER BY menu_order ASC, ID DESC $limit_q ",
1471
-                array('%image%', $post_id)
1472
-            )
1473
-        );
1474
-
1475
-        $counter = 0;
1476
-        $return_arr = array();
1477
-
1478
-        if (!empty($arrImages)) {
1479
-            foreach ($arrImages as $attechment) {
1480
-
1481
-                $img_arr = array();
1482
-                $img_arr['id'] = $attechment->ID;
1483
-                $img_arr['user_id'] = isset($attechment->user_id) ? $attechment->user_id : 0;
1484
-
1485
-                $file_info = pathinfo($attechment->file);
1486
-
1487
-                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1488
-                    $sub_dir = stripslashes_deep($file_info['dirname']);
1489
-
1490
-                $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1491
-                $uploads_baseurl = $uploads['baseurl'];
1492
-                $uploads_path = $uploads['path'];
1493
-
1494
-                $file_name = $file_info['basename'];
1495
-
1496
-                $uploads_url = $uploads_baseurl . $sub_dir;
1497
-                /*
1442
+	/**
1443
+	 * Gets the post images.
1444
+	 *
1445
+	 * @since 1.0.0
1446
+	 * @package GeoDirectory
1447
+	 * @global object $wpdb WordPress Database object.
1448
+	 * @param int $post_id The post ID.
1449
+	 * @param string $img_size Optional. Thumbnail size.
1450
+	 * @param bool $no_images Optional. Do you want to return the default image when no image is available? Default: false.
1451
+	 * @param bool $add_featured Optional. Do you want to include featured images too? Default: true.
1452
+	 * @param int|string $limit Optional. Number of images.
1453
+	 * @return array|bool Returns images as an array. Each item is an object.
1454
+	 */
1455
+	function geodir_get_images($post_id = 0, $img_size = '', $no_images = false, $add_featured = true, $limit = '')
1456
+	{
1457
+		global $wpdb;
1458
+		if ($limit) {
1459
+			$limit_q = " LIMIT $limit ";
1460
+		} else {
1461
+			$limit_q = '';
1462
+		}
1463
+		$not_featured = '';
1464
+		$sub_dir = '';
1465
+		if (!$add_featured)
1466
+			$not_featured = " AND is_featured = 0 ";
1467
+
1468
+		$arrImages = $wpdb->get_results(
1469
+			$wpdb->prepare(
1470
+				"SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d" . $not_featured . " ORDER BY menu_order ASC, ID DESC $limit_q ",
1471
+				array('%image%', $post_id)
1472
+			)
1473
+		);
1474
+
1475
+		$counter = 0;
1476
+		$return_arr = array();
1477
+
1478
+		if (!empty($arrImages)) {
1479
+			foreach ($arrImages as $attechment) {
1480
+
1481
+				$img_arr = array();
1482
+				$img_arr['id'] = $attechment->ID;
1483
+				$img_arr['user_id'] = isset($attechment->user_id) ? $attechment->user_id : 0;
1484
+
1485
+				$file_info = pathinfo($attechment->file);
1486
+
1487
+				if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
1488
+					$sub_dir = stripslashes_deep($file_info['dirname']);
1489
+
1490
+				$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
1491
+				$uploads_baseurl = $uploads['baseurl'];
1492
+				$uploads_path = $uploads['path'];
1493
+
1494
+				$file_name = $file_info['basename'];
1495
+
1496
+				$uploads_url = $uploads_baseurl . $sub_dir;
1497
+				/*
1498 1498
                 * Allows the filter of image src for such things as CDN change.
1499 1499
                 *
1500 1500
                 * @since 1.5.7
@@ -1503,520 +1503,520 @@  discard block
 block discarded – undo
1503 1503
                 * @param string $uploads_url The server upload directory url.
1504 1504
                 * @param string $uploads_baseurl The uploads dir base url.
1505 1505
                 */
1506
-                $img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1507
-                $img_arr['path'] = $uploads_path . '/' . $file_name;
1508
-                $width = 0;
1509
-                $height = 0;
1510
-                if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1511
-                    $imagesize = getimagesize($img_arr['path']);
1512
-                    $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1513
-                    $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1514
-                }
1515
-                $img_arr['width'] = $width;
1516
-                $img_arr['height'] = $height;
1517
-
1518
-                $img_arr['file'] = $file_name; // add the title to the array
1519
-                $img_arr['title'] = $attechment->title; // add the title to the array
1520
-                $img_arr['caption'] = isset($attechment->caption) ? $attechment->caption : ''; // add the caption to the array
1521
-                $img_arr['content'] = $attechment->content; // add the description to the array
1522
-                $img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1.
1523
-
1524
-                $return_arr[] = (object)$img_arr;
1525
-
1526
-                $counter++;
1527
-            }
1528
-            return (object)$return_arr;
1529
-        } else if ($no_images) {
1530
-            $default_img = '';
1531
-            $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1532
-            $post_type = get_post_type($post_id);
1533
-            if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1534
-                $default_img = $default_catimg['src'];
1535
-            elseif ($no_images) {
1536
-                $default_img = get_option('geodir_listing_no_img');
1537
-            }
1538
-
1539
-            if (!empty($default_img)) {
1540
-                $uploads = wp_upload_dir(); // Array of key => value pairs
1506
+				$img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1507
+				$img_arr['path'] = $uploads_path . '/' . $file_name;
1508
+				$width = 0;
1509
+				$height = 0;
1510
+				if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
1511
+					$imagesize = getimagesize($img_arr['path']);
1512
+					$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1513
+					$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1514
+				}
1515
+				$img_arr['width'] = $width;
1516
+				$img_arr['height'] = $height;
1517
+
1518
+				$img_arr['file'] = $file_name; // add the title to the array
1519
+				$img_arr['title'] = $attechment->title; // add the title to the array
1520
+				$img_arr['caption'] = isset($attechment->caption) ? $attechment->caption : ''; // add the caption to the array
1521
+				$img_arr['content'] = $attechment->content; // add the description to the array
1522
+				$img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1.
1523
+
1524
+				$return_arr[] = (object)$img_arr;
1525
+
1526
+				$counter++;
1527
+			}
1528
+			return (object)$return_arr;
1529
+		} else if ($no_images) {
1530
+			$default_img = '';
1531
+			$default_cat = geodir_get_post_meta($post_id, 'default_category', true);
1532
+			$post_type = get_post_type($post_id);
1533
+			if ($default_catimg = geodir_get_default_catimage($default_cat, $post_type))
1534
+				$default_img = $default_catimg['src'];
1535
+			elseif ($no_images) {
1536
+				$default_img = get_option('geodir_listing_no_img');
1537
+			}
1538
+
1539
+			if (!empty($default_img)) {
1540
+				$uploads = wp_upload_dir(); // Array of key => value pairs
1541 1541
                 
1542
-                $image_path = $default_img;
1543
-                if (!path_is_absolute($image_path)) {
1544
-                    $image_path = str_replace($uploads['baseurl'], $uploads['basedir'], $image_path);
1545
-                }
1546
-
1547
-                $file_info = pathinfo($default_img);
1548
-                $file_name = $file_info['basename'];
1549
-
1550
-                $width = '';
1551
-                $height = '';
1552
-                if (is_file($image_path) && file_exists($image_path)) {
1553
-                    $imagesize = getimagesize($image_path);
1554
-                    $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1555
-                    $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1556
-                }
1542
+				$image_path = $default_img;
1543
+				if (!path_is_absolute($image_path)) {
1544
+					$image_path = str_replace($uploads['baseurl'], $uploads['basedir'], $image_path);
1545
+				}
1546
+
1547
+				$file_info = pathinfo($default_img);
1548
+				$file_name = $file_info['basename'];
1549
+
1550
+				$width = '';
1551
+				$height = '';
1552
+				if (is_file($image_path) && file_exists($image_path)) {
1553
+					$imagesize = getimagesize($image_path);
1554
+					$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1555
+					$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1556
+				}
1557 1557
                 
1558
-                $img_arr = array();
1559
-                $img_arr['src'] = $default_img;
1560
-                $img_arr['path'] = $image_path;
1561
-                $img_arr['width'] = $width;
1562
-                $img_arr['height'] = $height;
1563
-                $img_arr['file'] = $file_name; // add the title to the array
1564
-                $img_arr['title'] = $file_info['filename']; // add the title to the array
1565
-                $img_arr['content'] = $file_info['filename']; // add the description to the array
1566
-
1567
-                $return_arr[] = (object)$img_arr;
1568
-
1569
-                return $return_arr;
1570
-            } else
1571
-                return false;
1572
-        }
1573
-    }
1558
+				$img_arr = array();
1559
+				$img_arr['src'] = $default_img;
1560
+				$img_arr['path'] = $image_path;
1561
+				$img_arr['width'] = $width;
1562
+				$img_arr['height'] = $height;
1563
+				$img_arr['file'] = $file_name; // add the title to the array
1564
+				$img_arr['title'] = $file_info['filename']; // add the title to the array
1565
+				$img_arr['content'] = $file_info['filename']; // add the description to the array
1566
+
1567
+				$return_arr[] = (object)$img_arr;
1568
+
1569
+				return $return_arr;
1570
+			} else
1571
+				return false;
1572
+		}
1573
+	}
1574 1574
 }
1575 1575
 
1576 1576
 if (!function_exists('geodir_show_image')) {
1577
-    /**
1578
-     * Show image using image details.
1579
-     *
1580
-     * @since 1.0.0
1581
-     * @package GeoDirectory
1582
-     * @param array|object $request Image info either as an array or object.
1583
-     * @param string $size Optional. Thumbnail size. Default: thumbnail.
1584
-     * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1585
-     * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1586
-     * @return bool|string Returns image html.
1587
-     */
1588
-    function geodir_show_image($request = array(), $size = 'thumbnail', $no_image = false, $echo = true)
1589
-    {
1590
-        $image = new stdClass();
1591
-
1592
-        $html = '';
1593
-        if (!empty($request)) {
1594
-            if (!is_object($request)){
1595
-                $request = (object)$request;
1596
-            }
1597
-
1598
-            if (isset($request->src) && !isset($request->path)) {
1599
-                $request->path = $request->src;
1600
-            }
1601
-
1602
-            /*
1577
+	/**
1578
+	 * Show image using image details.
1579
+	 *
1580
+	 * @since 1.0.0
1581
+	 * @package GeoDirectory
1582
+	 * @param array|object $request Image info either as an array or object.
1583
+	 * @param string $size Optional. Thumbnail size. Default: thumbnail.
1584
+	 * @param bool $no_image Optional. Do you want to return the default image when no image is available? Default: false.
1585
+	 * @param bool $echo Optional. Do you want to print it instead of returning it? Default: true.
1586
+	 * @return bool|string Returns image html.
1587
+	 */
1588
+	function geodir_show_image($request = array(), $size = 'thumbnail', $no_image = false, $echo = true)
1589
+	{
1590
+		$image = new stdClass();
1591
+
1592
+		$html = '';
1593
+		if (!empty($request)) {
1594
+			if (!is_object($request)){
1595
+				$request = (object)$request;
1596
+			}
1597
+
1598
+			if (isset($request->src) && !isset($request->path)) {
1599
+				$request->path = $request->src;
1600
+			}
1601
+
1602
+			/*
1603 1603
              * getimagesize() works faster from path than url so we try and get path if we can.
1604 1604
              */
1605
-            $upload_dir = wp_upload_dir();
1606
-            $img_no_http = str_replace(array("http://", "https://"), "", $request->path);
1607
-            $upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
1608
-            if (strpos($img_no_http, $upload_no_http) !== false) {
1609
-                $request->path = str_replace( $img_no_http,$upload_dir['basedir'], $request->path);
1610
-            }
1605
+			$upload_dir = wp_upload_dir();
1606
+			$img_no_http = str_replace(array("http://", "https://"), "", $request->path);
1607
+			$upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
1608
+			if (strpos($img_no_http, $upload_no_http) !== false) {
1609
+				$request->path = str_replace( $img_no_http,$upload_dir['basedir'], $request->path);
1610
+			}
1611 1611
             
1612
-            $width = 0;
1613
-            $height = 0;
1614
-            if (is_file($request->path) && file_exists($request->path)) {
1615
-                $imagesize = getimagesize($request->path);
1616
-                $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1617
-                $height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1618
-            }
1619
-
1620
-            $image->src = $request->src;
1621
-            $image->width = $width;
1622
-            $image->height = $height;
1623
-
1624
-            $max_size = (object)geodir_get_imagesize($size);
1625
-
1626
-            if (!is_wp_error($max_size)) {
1627
-                if ($image->width) {
1628
-                    if ($image->height >= $image->width) {
1629
-                        $width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2);
1630
-                    } else if ($image->width < ($max_size->h)) {
1631
-                        $width_per = round((($image->width / $max_size->w) * 100), 2);
1632
-                    } else
1633
-                        $width_per = 100;
1634
-                }
1635
-
1636
-                if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
1637
-                    $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '"  /></div>';
1638
-                } else {
1639
-                    if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
1640
-                        $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1641
-                    }else{
1642
-                        //$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1643
-                        //$html = '<div data-src="'.$image->src.'" class="geodir_thumbnail" ></div>';
1644
-                        $html = '<div data-src="'.str_replace(' ','%20',$image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>';
1645
-
1646
-                    }
1647
-
1648
-                }
1649
-            }
1650
-        }
1651
-
1652
-        if (!empty($html) && $echo) {
1653
-            echo $html;
1654
-        } elseif (!empty($html)) {
1655
-            return $html;
1656
-        } else
1657
-            return false;
1658
-    }
1659
-}
1612
+			$width = 0;
1613
+			$height = 0;
1614
+			if (is_file($request->path) && file_exists($request->path)) {
1615
+				$imagesize = getimagesize($request->path);
1616
+				$width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : '';
1617
+				$height = !empty($imagesize) && isset($imagesize[1]) ? $imagesize[1] : '';
1618
+			}
1660 1619
 
1661
-if (!function_exists('geodir_set_post_terms')) {
1662
-    /**
1663
-     * Set post Categories.
1664
-     *
1665
-     * @since 1.0.0
1666
-     * @package GeoDirectory
1667
-     * @global object $wpdb WordPress Database object.
1668
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
1669
-     * @param int $post_id The post ID.
1670
-     * @param array $terms An array of term objects.
1671
-     * @param array $tt_ids An array of term taxonomy IDs.
1672
-     * @param string $taxonomy Taxonomy slug.
1673
-     */
1674
-    function geodir_set_post_terms($post_id, $terms, $tt_ids, $taxonomy)
1675
-    {
1676
-        global $wpdb, $plugin_prefix;
1620
+			$image->src = $request->src;
1621
+			$image->width = $width;
1622
+			$image->height = $height;
1677 1623
 
1678
-        $post_type = get_post_type($post_id);
1624
+			$max_size = (object)geodir_get_imagesize($size);
1679 1625
 
1680
-        $table = $plugin_prefix . $post_type . '_detail';
1626
+			if (!is_wp_error($max_size)) {
1627
+				if ($image->width) {
1628
+					if ($image->height >= $image->width) {
1629
+						$width_per = round(((($image->width * ($max_size->h / $image->height)) / $max_size->w) * 100), 2);
1630
+					} else if ($image->width < ($max_size->h)) {
1631
+						$width_per = round((($image->width / $max_size->w) * 100), 2);
1632
+					} else
1633
+						$width_per = 100;
1634
+				}
1635
+
1636
+				if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
1637
+					$html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '"  /></div>';
1638
+				} else {
1639
+					if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
1640
+						$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1641
+					}else{
1642
+						//$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1643
+						//$html = '<div data-src="'.$image->src.'" class="geodir_thumbnail" ></div>';
1644
+						$html = '<div data-src="'.str_replace(' ','%20',$image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>';
1645
+
1646
+					}
1681 1647
 
1682
-        if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) {
1648
+				}
1649
+			}
1650
+		}
1651
+
1652
+		if (!empty($html) && $echo) {
1653
+			echo $html;
1654
+		} elseif (!empty($html)) {
1655
+			return $html;
1656
+		} else
1657
+			return false;
1658
+	}
1659
+}
1683 1660
 
1684
-            if ($taxonomy == $post_type . '_tags') {
1685
-                if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
1686
-                    geodir_save_post_meta($post_id, 'post_tags', $terms);
1687
-                }
1688
-            } elseif ($taxonomy == $post_type . 'category') {
1689
-                $srcharr = array('"', '\\');
1690
-                $replarr = array("&quot;", '');
1661
+if (!function_exists('geodir_set_post_terms')) {
1662
+	/**
1663
+	 * Set post Categories.
1664
+	 *
1665
+	 * @since 1.0.0
1666
+	 * @package GeoDirectory
1667
+	 * @global object $wpdb WordPress Database object.
1668
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
1669
+	 * @param int $post_id The post ID.
1670
+	 * @param array $terms An array of term objects.
1671
+	 * @param array $tt_ids An array of term taxonomy IDs.
1672
+	 * @param string $taxonomy Taxonomy slug.
1673
+	 */
1674
+	function geodir_set_post_terms($post_id, $terms, $tt_ids, $taxonomy)
1675
+	{
1676
+		global $wpdb, $plugin_prefix;
1677
+
1678
+		$post_type = get_post_type($post_id);
1679
+
1680
+		$table = $plugin_prefix . $post_type . '_detail';
1681
+
1682
+		if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) {
1683
+
1684
+			if ($taxonomy == $post_type . '_tags') {
1685
+				if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
1686
+					geodir_save_post_meta($post_id, 'post_tags', $terms);
1687
+				}
1688
+			} elseif ($taxonomy == $post_type . 'category') {
1689
+				$srcharr = array('"', '\\');
1690
+				$replarr = array("&quot;", '');
1691 1691
 
1692
-                $post_obj = get_post($post_id);
1692
+				$post_obj = get_post($post_id);
1693 1693
 
1694
-                $cat_ids = array('0');
1695
-                if (is_array($tt_ids))
1696
-                    $cat_ids = $tt_ids;
1694
+				$cat_ids = array('0');
1695
+				if (is_array($tt_ids))
1696
+					$cat_ids = $tt_ids;
1697 1697
 
1698 1698
 
1699
-                if (!empty($cat_ids)) {
1700
-                    $cat_ids_array = $cat_ids;
1701
-                    $cat_ids_length = count($cat_ids_array);
1702
-                    $cat_ids_format = array_fill(0, $cat_ids_length, '%d');
1703
-                    $format = implode(',', $cat_ids_format);
1699
+				if (!empty($cat_ids)) {
1700
+					$cat_ids_array = $cat_ids;
1701
+					$cat_ids_length = count($cat_ids_array);
1702
+					$cat_ids_format = array_fill(0, $cat_ids_length, '%d');
1703
+					$format = implode(',', $cat_ids_format);
1704 1704
 
1705
-                    $cat_ids_array_del = $cat_ids_array;
1706
-                    $cat_ids_array_del[] = $post_id;
1705
+					$cat_ids_array_del = $cat_ids_array;
1706
+					$cat_ids_array_del[] = $post_id;
1707 1707
 
1708
-                    $wpdb->get_var(
1709
-                        $wpdb->prepare(
1710
-                            "DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ",
1711
-                            $cat_ids_array_del
1712
-                        )
1713
-                    );
1708
+					$wpdb->get_var(
1709
+						$wpdb->prepare(
1710
+							"DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ",
1711
+							$cat_ids_array_del
1712
+						)
1713
+					);
1714 1714
 
1715 1715
 
1716
-                    $post_term = $wpdb->get_col(
1717
-                        $wpdb->prepare(
1718
-                            "SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id",
1719
-                            $cat_ids_array
1720
-                        )
1721
-                    );
1716
+					$post_term = $wpdb->get_col(
1717
+						$wpdb->prepare(
1718
+							"SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id",
1719
+							$cat_ids_array
1720
+						)
1721
+					);
1722 1722
 
1723
-                }
1723
+				}
1724 1724
 
1725
-                $post_marker_json = '';
1725
+				$post_marker_json = '';
1726 1726
 
1727
-                if (!empty($post_term)):
1727
+				if (!empty($post_term)):
1728 1728
 
1729
-                    foreach ($post_term as $cat_id):
1729
+					foreach ($post_term as $cat_id):
1730 1730
 
1731
-                        $term_icon_url = geodir_get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type);
1732
-                        $term_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : '';
1731
+						$term_icon_url = geodir_get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type);
1732
+						$term_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : '';
1733 1733
 
1734
-                        $post_title = $post_obj->title;
1735
-                        $title = str_replace($srcharr, $replarr, $post_title);
1734
+						$post_title = $post_obj->title;
1735
+						$title = str_replace($srcharr, $replarr, $post_title);
1736 1736
 
1737
-                        $lat = geodir_get_post_meta($post_id, 'post_latitude', true);
1738
-                        $lng = geodir_get_post_meta($post_id, 'post_longitude', true);
1737
+						$lat = geodir_get_post_meta($post_id, 'post_latitude', true);
1738
+						$lng = geodir_get_post_meta($post_id, 'post_longitude', true);
1739 1739
 
1740
-                        $timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
1741
-                        $timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true);
1740
+						$timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
1741
+						$timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true);
1742 1742
 
1743
-                        $json = '{';
1744
-                        $json .= '"id":"' . $post_id . '",';
1745
-                        $json .= '"lat_pos": "' . $lat . '",';
1746
-                        $json .= '"long_pos": "' . $lng . '",';
1747
-                        $json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",';
1748
-                        $json .= '"icon":"' . $term_icon . '",';
1749
-                        $json .= '"group":"catgroup' . $cat_id . '"';
1750
-                        $json .= '}';
1743
+						$json = '{';
1744
+						$json .= '"id":"' . $post_id . '",';
1745
+						$json .= '"lat_pos": "' . $lat . '",';
1746
+						$json .= '"long_pos": "' . $lng . '",';
1747
+						$json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",';
1748
+						$json .= '"icon":"' . $term_icon . '",';
1749
+						$json .= '"group":"catgroup' . $cat_id . '"';
1750
+						$json .= '}';
1751 1751
 
1752 1752
 
1753
-                        if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true))
1754
-                            $post_marker_json = $json;
1753
+						if ($cat_id == geodir_get_post_meta($post_id, 'default_category', true))
1754
+							$post_marker_json = $json;
1755 1755
 
1756 1756
 
1757
-                        if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . GEODIR_ICON_TABLE . " WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
1757
+						if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . GEODIR_ICON_TABLE . " WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
1758 1758
 
1759
-                            $json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET
1759
+							$json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET
1760 1760
 										post_title = %s,
1761 1761
 										json = %s
1762 1762
 										WHERE post_id = %d AND cat_id = %d ",
1763
-                                array($post_title, $json, $post_id, $cat_id));
1763
+								array($post_title, $json, $post_id, $cat_id));
1764 1764
 
1765
-                        } else {
1765
+						} else {
1766 1766
 
1767
-                            $json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET
1767
+							$json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET
1768 1768
 										post_id = %d,
1769 1769
 										post_title = %s,
1770 1770
 										cat_id = %d,
1771 1771
 										json = %s",
1772
-                                array($post_id, $post_title, $cat_id, $json));
1772
+								array($post_id, $post_title, $cat_id, $json));
1773 1773
 
1774
-                        }
1774
+						}
1775 1775
 
1776
-                        $wpdb->query($json_query);
1776
+						$wpdb->query($json_query);
1777 1777
 
1778
-                    endforeach;
1778
+					endforeach;
1779 1779
 
1780
-                endif;
1780
+				endif;
1781 1781
 
1782
-                if (!empty($post_term) && is_array($post_term)) {
1783
-                    $categories = implode(',', $post_term);
1782
+				if (!empty($post_term) && is_array($post_term)) {
1783
+					$categories = implode(',', $post_term);
1784 1784
 
1785
-                    if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';
1785
+					if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';
1786 1786
 
1787
-                    if (empty($post_marker_json))
1788
-                        $post_marker_json = isset($json) ? $json : '';
1787
+					if (empty($post_marker_json))
1788
+						$post_marker_json = isset($json) ? $json : '';
1789 1789
 
1790
-                    if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
1790
+					if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
1791 1791
 
1792
-                        $wpdb->query(
1793
-                            $wpdb->prepare(
1794
-                                "UPDATE " . $table . " SET
1792
+						$wpdb->query(
1793
+							$wpdb->prepare(
1794
+								"UPDATE " . $table . " SET
1795 1795
 								" . $taxonomy . " = %s,
1796 1796
 								marker_json = %s
1797 1797
 								where post_id = %d",
1798
-                                array($categories, $post_marker_json, $post_id)
1799
-                            )
1800
-                        );
1798
+								array($categories, $post_marker_json, $post_id)
1799
+							)
1800
+						);
1801 1801
 
1802
-                        if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'inline-save') {
1802
+						if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'inline-save') {
1803 1803
 
1804
-                            $categories = trim($categories, ',');
1804
+							$categories = trim($categories, ',');
1805 1805
 
1806
-                            if ($categories) {
1806
+							if ($categories) {
1807 1807
 
1808
-                                $categories = explode(',', $categories);
1808
+								$categories = explode(',', $categories);
1809 1809
 
1810
-                                $default_category = geodir_get_post_meta($post_id, 'default_category', true);
1810
+								$default_category = geodir_get_post_meta($post_id, 'default_category', true);
1811 1811
 
1812
-                                if (!in_array($default_category, $categories)) {
1812
+								if (!in_array($default_category, $categories)) {
1813 1813
 
1814
-                                    $wpdb->query(
1815
-                                        $wpdb->prepare(
1816
-                                            "UPDATE " . $table . " SET
1814
+									$wpdb->query(
1815
+										$wpdb->prepare(
1816
+											"UPDATE " . $table . " SET
1817 1817
 											default_category = %s
1818 1818
 											where post_id = %d",
1819
-                                            array($categories[0], $post_id)
1820
-                                        )
1821
-                                    );
1819
+											array($categories[0], $post_id)
1820
+										)
1821
+									);
1822 1822
 
1823
-                                    $default_category = $categories[0];
1823
+									$default_category = $categories[0];
1824 1824
 
1825
-                                }
1825
+								}
1826 1826
 
1827
-                                if ($default_category == '')
1828
-                                    $default_category = $categories[0];
1827
+								if ($default_category == '')
1828
+									$default_category = $categories[0];
1829 1829
 
1830
-                                geodir_set_postcat_structure($post_id, $taxonomy, $default_category, '');
1830
+								geodir_set_postcat_structure($post_id, $taxonomy, $default_category, '');
1831 1831
 
1832
-                            }
1832
+							}
1833 1833
 
1834
-                        }
1834
+						}
1835 1835
 
1836 1836
 
1837
-                    } else {
1837
+					} else {
1838 1838
 
1839
-                        $wpdb->query(
1840
-                            $wpdb->prepare(
1841
-                                "INSERT INTO " . $table . " SET
1839
+						$wpdb->query(
1840
+							$wpdb->prepare(
1841
+								"INSERT INTO " . $table . " SET
1842 1842
 								post_id = %d,
1843 1843
 								" . $taxonomy . " = %s,
1844 1844
 								marker_json = %s ",
1845 1845
 
1846
-                                array($post_id, $categories, $post_marker_json)
1847
-                            )
1848
-                        );
1849
-                    }
1850
-                }
1851
-            }
1852
-        }
1853
-    }
1846
+								array($post_id, $categories, $post_marker_json)
1847
+							)
1848
+						);
1849
+					}
1850
+				}
1851
+			}
1852
+		}
1853
+	}
1854 1854
 }
1855 1855
 
1856 1856
 if (!function_exists('geodir_get_infowindow_html')) {
1857
-    /**
1858
-     * Set post Map Marker info html.
1859
-     *
1860
-     * @since 1.0.0
1861
-     * @since 1.5.4 Modified to add new action "geodir_infowindow_meta_before".
1862
-     * @since 1.6.16 Changes for disable review stars for certain post type.
1863
-     * @since 1.6.18 Fix: Map marker not showing custom fields in bubble info.
1864
-     * @package GeoDirectory
1865
-     * @global array $geodir_addon_list List of active GeoDirectory extensions.
1866
-     * @global object $gd_session GeoDirectory Session object.
1867
-     * @param object $postinfo_obj The post details object.
1868
-     * @param string $post_preview Is this a post preview?.
1869
-     * @global object $post WordPress Post object.
1870
-     * @return mixed|string|void
1871
-     */
1872
-    function geodir_get_infowindow_html($postinfo_obj, $post_preview = '') {
1873
-        global $preview, $post, $gd_session;
1874
-        $srcharr = array("'", "/", "-", '"', '\\');
1875
-        $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
1876
-
1877
-        if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1878
-            $ID = '';
1879
-            $plink = '';
1880
-
1881
-            if (isset($postinfo_obj->pid)) {
1882
-                $ID = $postinfo_obj->pid;
1883
-                $plink = get_permalink($ID);
1884
-            }
1885
-
1886
-            $title = str_replace($srcharr, $replarr, ($postinfo_obj->post_title));
1887
-            $lat = $postinfo_obj->post_latitude;
1888
-            $lng = $postinfo_obj->post_longitude;
1889
-        } else {
1890
-            $ID = $postinfo_obj->post_id;
1891
-            $title = str_replace($srcharr, $replarr, htmlentities($postinfo_obj->post_title, ENT_COMPAT, 'UTF-8')); // fix by Stiofan
1892
-            $title = wp_specialchars_decode($title); // Fixed #post-320722 on 2016-12-08
1893
-            $plink = get_permalink($ID);
1894
-            $lat = htmlentities(geodir_get_post_meta($ID, 'post_latitude', true));
1895
-            $lng = htmlentities(geodir_get_post_meta($ID, 'post_longitude', true));
1896
-        }
1857
+	/**
1858
+	 * Set post Map Marker info html.
1859
+	 *
1860
+	 * @since 1.0.0
1861
+	 * @since 1.5.4 Modified to add new action "geodir_infowindow_meta_before".
1862
+	 * @since 1.6.16 Changes for disable review stars for certain post type.
1863
+	 * @since 1.6.18 Fix: Map marker not showing custom fields in bubble info.
1864
+	 * @package GeoDirectory
1865
+	 * @global array $geodir_addon_list List of active GeoDirectory extensions.
1866
+	 * @global object $gd_session GeoDirectory Session object.
1867
+	 * @param object $postinfo_obj The post details object.
1868
+	 * @param string $post_preview Is this a post preview?.
1869
+	 * @global object $post WordPress Post object.
1870
+	 * @return mixed|string|void
1871
+	 */
1872
+	function geodir_get_infowindow_html($postinfo_obj, $post_preview = '') {
1873
+		global $preview, $post, $gd_session;
1874
+		$srcharr = array("'", "/", "-", '"', '\\');
1875
+		$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
1876
+
1877
+		if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1878
+			$ID = '';
1879
+			$plink = '';
1880
+
1881
+			if (isset($postinfo_obj->pid)) {
1882
+				$ID = $postinfo_obj->pid;
1883
+				$plink = get_permalink($ID);
1884
+			}
1885
+
1886
+			$title = str_replace($srcharr, $replarr, ($postinfo_obj->post_title));
1887
+			$lat = $postinfo_obj->post_latitude;
1888
+			$lng = $postinfo_obj->post_longitude;
1889
+		} else {
1890
+			$ID = $postinfo_obj->post_id;
1891
+			$title = str_replace($srcharr, $replarr, htmlentities($postinfo_obj->post_title, ENT_COMPAT, 'UTF-8')); // fix by Stiofan
1892
+			$title = wp_specialchars_decode($title); // Fixed #post-320722 on 2016-12-08
1893
+			$plink = get_permalink($ID);
1894
+			$lat = htmlentities(geodir_get_post_meta($ID, 'post_latitude', true));
1895
+			$lng = htmlentities(geodir_get_post_meta($ID, 'post_longitude', true));
1896
+		}
1897 1897
         
1898
-        // Some theme overwrites global gd listing $post
1899
-        if (!empty($ID) && (!empty($post->ID) && $post->ID != $ID) || empty($post)) {
1900
-            $post = geodir_get_post_info($ID);
1901
-        }
1898
+		// Some theme overwrites global gd listing $post
1899
+		if (!empty($ID) && (!empty($post->ID) && $post->ID != $ID) || empty($post)) {
1900
+			$post = geodir_get_post_info($ID);
1901
+		}
1902 1902
         
1903
-        $post_type = $ID ? get_post_type($ID) : '';
1904
-
1905
-        // filter field as per price package
1906
-        global $geodir_addon_list;
1907
-        if ($post_type && defined('GEODIRPAYMENT_VERSION')) {
1908
-            $package_id = isset($postinfo_obj->package_id) && $postinfo_obj->package_id ? $postinfo_obj->package_id : NULL;
1909
-            $field_name = 'geodir_contact';
1910
-            if (!check_field_visibility($package_id, $field_name, $post_type)) {
1911
-                $contact = '';
1912
-            }
1913
-
1914
-            $field_name = 'geodir_timing';
1915
-            if (!check_field_visibility($package_id, $field_name, $post_type)) {
1916
-                $timing = '';
1917
-            }
1918
-        }
1919
-
1920
-        if ($lat && $lng) {
1921
-            ob_start(); ?>
1903
+		$post_type = $ID ? get_post_type($ID) : '';
1904
+
1905
+		// filter field as per price package
1906
+		global $geodir_addon_list;
1907
+		if ($post_type && defined('GEODIRPAYMENT_VERSION')) {
1908
+			$package_id = isset($postinfo_obj->package_id) && $postinfo_obj->package_id ? $postinfo_obj->package_id : NULL;
1909
+			$field_name = 'geodir_contact';
1910
+			if (!check_field_visibility($package_id, $field_name, $post_type)) {
1911
+				$contact = '';
1912
+			}
1913
+
1914
+			$field_name = 'geodir_timing';
1915
+			if (!check_field_visibility($package_id, $field_name, $post_type)) {
1916
+				$timing = '';
1917
+			}
1918
+		}
1919
+
1920
+		if ($lat && $lng) {
1921
+			ob_start(); ?>
1922 1922
             <div class="gd-bubble" style="">
1923 1923
                 <div class="gd-bubble-inside">
1924 1924
                     <?php
1925
-                    $comment_count = '';
1926
-                    $rating_star = '';
1927
-                    if ($ID != '' && $post_type != '' && !geodir_cpt_has_rating_disabled($post_type)) {
1928
-                        $rating_star = '';
1929
-                        $comment_count = geodir_get_review_count_total($ID);
1930
-
1931
-                        if (!$preview) {
1932
-                            $post_avgratings = geodir_get_post_rating($ID);
1933
-
1934
-                            $rating_star = geodir_get_rating_stars($post_avgratings, $ID, false);
1935
-
1936
-                            /**
1937
-                             * Filter to change rating stars
1938
-                             *
1939
-                             * You can use this filter to change Rating stars.
1940
-                             *
1941
-                             * @since 1.0.0
1942
-                             * @package GeoDirectory
1943
-                             * @param string $rating_star Rating stars.
1944
-                             * @param float $post_avgratings Average ratings of the post.
1945
-                             * @param int $ID The post ID.
1946
-                             */
1947
-                            $rating_star = apply_filters('geodir_review_rating_stars_on_infowindow', $rating_star, $post_avgratings, $ID);
1948
-                        }
1949
-                    }
1950
-                    ?>
1925
+					$comment_count = '';
1926
+					$rating_star = '';
1927
+					if ($ID != '' && $post_type != '' && !geodir_cpt_has_rating_disabled($post_type)) {
1928
+						$rating_star = '';
1929
+						$comment_count = geodir_get_review_count_total($ID);
1930
+
1931
+						if (!$preview) {
1932
+							$post_avgratings = geodir_get_post_rating($ID);
1933
+
1934
+							$rating_star = geodir_get_rating_stars($post_avgratings, $ID, false);
1935
+
1936
+							/**
1937
+							 * Filter to change rating stars
1938
+							 *
1939
+							 * You can use this filter to change Rating stars.
1940
+							 *
1941
+							 * @since 1.0.0
1942
+							 * @package GeoDirectory
1943
+							 * @param string $rating_star Rating stars.
1944
+							 * @param float $post_avgratings Average ratings of the post.
1945
+							 * @param int $ID The post ID.
1946
+							 */
1947
+							$rating_star = apply_filters('geodir_review_rating_stars_on_infowindow', $rating_star, $post_avgratings, $ID);
1948
+						}
1949
+					}
1950
+					?>
1951 1951
                     <div class="geodir-bubble_desc">
1952 1952
                         <h4>
1953 1953
                             <a href="<?php if ($plink != '') {
1954
-                                echo $plink;
1955
-                            } else {
1956
-                                echo 'javascript:void(0);';
1957
-                            } ?>"><?php echo $title; ?></a>
1954
+								echo $plink;
1955
+							} else {
1956
+								echo 'javascript:void(0);';
1957
+							} ?>"><?php echo $title; ?></a>
1958 1958
                         </h4>
1959 1959
                         <?php
1960
-                        if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1961
-                            $post_images = array();
1962
-                            if (!empty($postinfo_obj->post_images)) {
1963
-                                $post_images = explode(",", $postinfo_obj->post_images);
1964
-                            }
1965
-
1966
-                            if (!empty($post_images)) {
1967
-                                ?>
1960
+						if ($gd_session->get('listing') && isset($post_preview) && $post_preview != '') {
1961
+							$post_images = array();
1962
+							if (!empty($postinfo_obj->post_images)) {
1963
+								$post_images = explode(",", $postinfo_obj->post_images);
1964
+							}
1965
+
1966
+							if (!empty($post_images)) {
1967
+								?>
1968 1968
                                 <div class="geodir-bubble_image"><a href="<?php if ($plink != '') {
1969
-                                        echo $plink;
1970
-                                    } else {
1971
-                                        echo 'javascript:void(0);';
1972
-                                    } ?>"><img alt="bubble image" style="max-height:50px;"
1969
+										echo $plink;
1970
+									} else {
1971
+										echo 'javascript:void(0);';
1972
+									} ?>"><img alt="bubble image" style="max-height:50px;"
1973 1973
                                                src="<?php echo $post_images[0]; ?>"/></a></div>
1974 1974
                             <?php
1975
-                            }else{
1976
-                                echo '<div class="geodir-bubble_image"></div>';
1977
-                            }
1978
-                        } else {
1979
-                            if ($image = geodir_show_featured_image($ID, 'widget-thumb', true, false, $postinfo_obj->featured_image)) {
1980
-                                ?>
1975
+							}else{
1976
+								echo '<div class="geodir-bubble_image"></div>';
1977
+							}
1978
+						} else {
1979
+							if ($image = geodir_show_featured_image($ID, 'widget-thumb', true, false, $postinfo_obj->featured_image)) {
1980
+								?>
1981 1981
                                 <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div>
1982 1982
                             <?php
1983
-                            }else{
1984
-                                echo '<div class="geodir-bubble_image"></div>';
1985
-                            }
1986
-                        }
1987
-                        ?>
1983
+							}else{
1984
+								echo '<div class="geodir-bubble_image"></div>';
1985
+							}
1986
+						}
1987
+						?>
1988 1988
                         <div class="geodir-bubble-meta-side">
1989 1989
                             <?php
1990
-                            /**
1991
-                             * Fires before the meta info in the map info window.
1992
-                             *
1993
-                             * This can be used to add more info to the map info window before the normal meta info.
1994
-                             *
1995
-                             * @since 1.5.4
1996
-                             * @param int $ID The post id.
1997
-                             * @param object $postinfo_obj The posts info as an object.
1998
-                             * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1999
-                             */
2000
-                            do_action('geodir_infowindow_meta_before', $ID, $postinfo_obj, $post_preview);
2001
-
2002
-                            echo geodir_show_listing_info('mapbubble');
2003
-
2004
-                            /**
2005
-                             * Fires after the meta info in the map info window.
2006
-                             *
2007
-                             * This can be used to add more info to the map info window after the normal meta info.
2008
-                             *
2009
-                             * @since 1.4.2
2010
-                             * @param object $postinfo_obj The posts info as an object.
2011
-                             * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
2012
-                             */
2013
-                            do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
2014
-                            ?>
1990
+							/**
1991
+							 * Fires before the meta info in the map info window.
1992
+							 *
1993
+							 * This can be used to add more info to the map info window before the normal meta info.
1994
+							 *
1995
+							 * @since 1.5.4
1996
+							 * @param int $ID The post id.
1997
+							 * @param object $postinfo_obj The posts info as an object.
1998
+							 * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1999
+							 */
2000
+							do_action('geodir_infowindow_meta_before', $ID, $postinfo_obj, $post_preview);
2001
+
2002
+							echo geodir_show_listing_info('mapbubble');
2003
+
2004
+							/**
2005
+							 * Fires after the meta info in the map info window.
2006
+							 *
2007
+							 * This can be used to add more info to the map info window after the normal meta info.
2008
+							 *
2009
+							 * @since 1.4.2
2010
+							 * @param object $postinfo_obj The posts info as an object.
2011
+							 * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
2012
+							 */
2013
+							do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
2014
+							?>
2015 2015
                         </div>
2016 2016
                         <?php
2017
-                        if ($ID) {
2018
-                            $post_author = isset($postinfo_obj->post_author) ? $postinfo_obj->post_author : get_post_field('post_author', $ID);
2019
-                            ?>
2017
+						if ($ID) {
2018
+							$post_author = isset($postinfo_obj->post_author) ? $postinfo_obj->post_author : get_post_field('post_author', $ID);
2019
+							?>
2020 2020
                             <div class="geodir-bubble-meta-fade"></div>
2021 2021
                             <div class="geodir-bubble-meta-bottom">
2022 2022
                                 <?php if ($rating_star != '') { ?>
@@ -2032,69 +2032,69 @@  discard block
 block discarded – undo
2032 2032
                 </div>
2033 2033
             </div>
2034 2034
             <?php
2035
-            $html = ob_get_clean();
2036
-            /**
2037
-             * Filter to change infowindow html
2038
-             *
2039
-             * You can use this filter to change infowindow html.
2040
-             *
2041
-             * @since 1.0.0
2042
-             * @package GeoDirectory
2043
-             * @param string $html Infowindow html.
2044
-             * @param object $postinfo_obj The Post object.
2045
-             * @param bool|string $post_preview Is this a post preview?
2046
-             */
2047
-            $html = apply_filters('geodir_custom_infowindow_html', $html, $postinfo_obj, $post_preview);
2048
-            return $html;
2049
-        }
2050
-    }
2035
+			$html = ob_get_clean();
2036
+			/**
2037
+			 * Filter to change infowindow html
2038
+			 *
2039
+			 * You can use this filter to change infowindow html.
2040
+			 *
2041
+			 * @since 1.0.0
2042
+			 * @package GeoDirectory
2043
+			 * @param string $html Infowindow html.
2044
+			 * @param object $postinfo_obj The Post object.
2045
+			 * @param bool|string $post_preview Is this a post preview?
2046
+			 */
2047
+			$html = apply_filters('geodir_custom_infowindow_html', $html, $postinfo_obj, $post_preview);
2048
+			return $html;
2049
+		}
2050
+	}
2051 2051
 }
2052 2052
 
2053 2053
 
2054 2054
 if (!function_exists('geodir_new_post_default_status')) {
2055
-    /**
2056
-     * Default post status for new posts.
2057
-     *
2058
-     * @since 1.0.0
2059
-     * @package GeoDirectory
2060
-     * @return string Returns the default post status for new posts. Ex: draft, publish etc.
2061
-     */
2062
-    function geodir_new_post_default_status()
2063
-    {
2064
-        if (get_option('geodir_new_post_default_status'))
2065
-            return get_option('geodir_new_post_default_status');
2066
-        else
2067
-            return 'publish';
2068
-
2069
-    }
2055
+	/**
2056
+	 * Default post status for new posts.
2057
+	 *
2058
+	 * @since 1.0.0
2059
+	 * @package GeoDirectory
2060
+	 * @return string Returns the default post status for new posts. Ex: draft, publish etc.
2061
+	 */
2062
+	function geodir_new_post_default_status()
2063
+	{
2064
+		if (get_option('geodir_new_post_default_status'))
2065
+			return get_option('geodir_new_post_default_status');
2066
+		else
2067
+			return 'publish';
2068
+
2069
+	}
2070 2070
 }
2071 2071
 
2072 2072
 if (!function_exists('geodir_change_post_status')) {
2073
-    /**
2074
-     * Change post status of a post.
2075
-     *
2076
-     * @global object $wpdb WordPress Database object.
2077
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2078
-     * @param int|string $post_id The post ID.
2079
-     * @param string $status New post status. Ex: draft, publish etc.
2080
-     */
2081
-    function geodir_change_post_status($post_id = '', $status = '')
2082
-    {
2083
-        global $wpdb, $plugin_prefix;
2084
-
2085
-        $post_type = get_post_type($post_id);
2086
-
2087
-        $table = $plugin_prefix . $post_type . '_detail';
2088
-
2089
-        $wpdb->query(
2090
-            $wpdb->prepare(
2091
-                "UPDATE " . $table . " SET post_status=%s WHERE post_id=%d",
2092
-                array($status, $post_id)
2093
-            )
2094
-        );
2095
-
2096
-
2097
-    }
2073
+	/**
2074
+	 * Change post status of a post.
2075
+	 *
2076
+	 * @global object $wpdb WordPress Database object.
2077
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2078
+	 * @param int|string $post_id The post ID.
2079
+	 * @param string $status New post status. Ex: draft, publish etc.
2080
+	 */
2081
+	function geodir_change_post_status($post_id = '', $status = '')
2082
+	{
2083
+		global $wpdb, $plugin_prefix;
2084
+
2085
+		$post_type = get_post_type($post_id);
2086
+
2087
+		$table = $plugin_prefix . $post_type . '_detail';
2088
+
2089
+		$wpdb->query(
2090
+			$wpdb->prepare(
2091
+				"UPDATE " . $table . " SET post_status=%s WHERE post_id=%d",
2092
+				array($status, $post_id)
2093
+			)
2094
+		);
2095
+
2096
+
2097
+	}
2098 2098
 }
2099 2099
 
2100 2100
 /**
@@ -2108,13 +2108,13 @@  discard block
 block discarded – undo
2108 2108
  */
2109 2109
 function geodir_set_post_status($pid, $status)
2110 2110
 {
2111
-    if ($pid) {
2112
-        global $wpdb;
2113
-        $my_post = array();
2114
-        $my_post['post_status'] = $status;
2115
-        $my_post['ID'] = $pid;
2116
-        $last_postid = wp_update_post($my_post);
2117
-    }
2111
+	if ($pid) {
2112
+		global $wpdb;
2113
+		$my_post = array();
2114
+		$my_post['post_status'] = $status;
2115
+		$my_post['ID'] = $pid;
2116
+		$last_postid = wp_update_post($my_post);
2117
+	}
2118 2118
 }
2119 2119
 
2120 2120
 
@@ -2130,384 +2130,384 @@  discard block
 block discarded – undo
2130 2130
  */
2131 2131
 function geodir_update_poststatus($new_status, $old_status, $post)
2132 2132
 {
2133
-    global $wpdb;
2133
+	global $wpdb;
2134 2134
 
2135
-    $geodir_posttypes = geodir_get_posttypes();
2135
+	$geodir_posttypes = geodir_get_posttypes();
2136 2136
 
2137
-    if (!wp_is_post_revision($post->ID) && in_array($post->post_type, $geodir_posttypes)) {
2137
+	if (!wp_is_post_revision($post->ID) && in_array($post->post_type, $geodir_posttypes)) {
2138 2138
 
2139
-        geodir_change_post_status($post->ID, $new_status);
2140
-    }
2139
+		geodir_change_post_status($post->ID, $new_status);
2140
+	}
2141 2141
 }
2142 2142
 
2143 2143
 
2144 2144
 if (!function_exists('geodir_update_listing_info')) {
2145
-    /**
2146
-     * Update post info.
2147
-     *
2148
-     * @since 1.0.0
2149
-     * @package GeoDirectory
2150
-     * @global object $wpdb WordPress Database object.
2151
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2152
-     * @param int $updatingpost The updating post ID.
2153
-     * @param int $temppost The temporary post ID.
2154
-     * @todo fix post_id variable
2155
-     */
2156
-    function geodir_update_listing_info($updatingpost, $temppost)
2157
-    {
2158
-
2159
-        global $wpdb, $plugin_prefix;
2160
-
2161
-        $post_type = get_post_type($post_id);
2162
-
2163
-        $table = $plugin_prefix . $post_type . '_detail';
2164
-
2165
-        $wpdb->query(
2166
-            $wpdb->prepare(
2167
-                "UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d",
2168
-                array($updatingpost, $temppost)
2169
-            )
2170
-        );
2171
-
2172
-        $wpdb->query(
2173
-            $wpdb->prepare(
2174
-                "UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2175
-                array($updatingpost, $temppost)
2176
-            )
2177
-        );
2178
-
2179
-        /* Update Attachments*/
2180
-
2181
-        $wpdb->query(
2182
-            $wpdb->prepare(
2183
-                "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2184
-                array($updatingpost, $temppost)
2185
-            )
2186
-        );
2187
-
2188
-    }
2145
+	/**
2146
+	 * Update post info.
2147
+	 *
2148
+	 * @since 1.0.0
2149
+	 * @package GeoDirectory
2150
+	 * @global object $wpdb WordPress Database object.
2151
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2152
+	 * @param int $updatingpost The updating post ID.
2153
+	 * @param int $temppost The temporary post ID.
2154
+	 * @todo fix post_id variable
2155
+	 */
2156
+	function geodir_update_listing_info($updatingpost, $temppost)
2157
+	{
2158
+
2159
+		global $wpdb, $plugin_prefix;
2160
+
2161
+		$post_type = get_post_type($post_id);
2162
+
2163
+		$table = $plugin_prefix . $post_type . '_detail';
2164
+
2165
+		$wpdb->query(
2166
+			$wpdb->prepare(
2167
+				"UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d",
2168
+				array($updatingpost, $temppost)
2169
+			)
2170
+		);
2171
+
2172
+		$wpdb->query(
2173
+			$wpdb->prepare(
2174
+				"UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2175
+				array($updatingpost, $temppost)
2176
+			)
2177
+		);
2178
+
2179
+		/* Update Attachments*/
2180
+
2181
+		$wpdb->query(
2182
+			$wpdb->prepare(
2183
+				"UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2184
+				array($updatingpost, $temppost)
2185
+			)
2186
+		);
2187
+
2188
+	}
2189 2189
 }
2190 2190
 
2191 2191
 
2192 2192
 if (!function_exists('geodir_delete_listing_info')) {
2193
-    /**
2194
-     * Delete Listing info from details table for the given post id.
2195
-     *
2196
-     * @since 1.0.0
2197
-     * @package GeoDirectory
2198
-     * @global object $wpdb WordPress Database object.
2199
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
2200
-     * @param int $deleted_postid The post ID.
2201
-     * @param bool $force Optional. Do you want to force delete it? Default: false.
2202
-     * @return bool|void
2203
-     */
2204
-    function geodir_delete_listing_info($deleted_postid, $force = false)
2205
-    {
2206
-        global $wpdb, $plugin_prefix;
2207
-
2208
-        // check for multisite deletions
2209
-        if (strpos($plugin_prefix, $wpdb->prefix) !== false) {
2210
-        } else {
2211
-            return;
2212
-        }
2213
-
2214
-        $post_type = get_post_type($deleted_postid);
2215
-
2216
-        $all_postypes = geodir_get_posttypes();
2217
-
2218
-        if (!in_array($post_type, $all_postypes))
2219
-            return false;
2220
-
2221
-        $table = $plugin_prefix . $post_type . '_detail';
2222
-
2223
-        /* Delete custom post meta*/
2224
-        $wpdb->query(
2225
-            $wpdb->prepare(
2226
-                "DELETE FROM " . $table . " WHERE `post_id` = %d",
2227
-                array($deleted_postid)
2228
-            )
2229
-        );
2230
-
2231
-        /* Delete post map icons*/
2232
-
2233
-        $wpdb->query(
2234
-            $wpdb->prepare(
2235
-                "DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d",
2236
-                array($deleted_postid)
2237
-            )
2238
-        );
2239
-
2240
-        /* Delete Attachments*/
2241
-        $postcurr_images = geodir_get_images($deleted_postid);
2242
-
2243
-        $wpdb->query(
2244
-            $wpdb->prepare(
2245
-                "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d",
2246
-                array($deleted_postid)
2247
-            )
2248
-        );
2249
-        geodir_remove_attachments($postcurr_images);
2250
-
2251
-    }
2193
+	/**
2194
+	 * Delete Listing info from details table for the given post id.
2195
+	 *
2196
+	 * @since 1.0.0
2197
+	 * @package GeoDirectory
2198
+	 * @global object $wpdb WordPress Database object.
2199
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
2200
+	 * @param int $deleted_postid The post ID.
2201
+	 * @param bool $force Optional. Do you want to force delete it? Default: false.
2202
+	 * @return bool|void
2203
+	 */
2204
+	function geodir_delete_listing_info($deleted_postid, $force = false)
2205
+	{
2206
+		global $wpdb, $plugin_prefix;
2207
+
2208
+		// check for multisite deletions
2209
+		if (strpos($plugin_prefix, $wpdb->prefix) !== false) {
2210
+		} else {
2211
+			return;
2212
+		}
2213
+
2214
+		$post_type = get_post_type($deleted_postid);
2215
+
2216
+		$all_postypes = geodir_get_posttypes();
2217
+
2218
+		if (!in_array($post_type, $all_postypes))
2219
+			return false;
2220
+
2221
+		$table = $plugin_prefix . $post_type . '_detail';
2222
+
2223
+		/* Delete custom post meta*/
2224
+		$wpdb->query(
2225
+			$wpdb->prepare(
2226
+				"DELETE FROM " . $table . " WHERE `post_id` = %d",
2227
+				array($deleted_postid)
2228
+			)
2229
+		);
2230
+
2231
+		/* Delete post map icons*/
2232
+
2233
+		$wpdb->query(
2234
+			$wpdb->prepare(
2235
+				"DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d",
2236
+				array($deleted_postid)
2237
+			)
2238
+		);
2239
+
2240
+		/* Delete Attachments*/
2241
+		$postcurr_images = geodir_get_images($deleted_postid);
2242
+
2243
+		$wpdb->query(
2244
+			$wpdb->prepare(
2245
+				"DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d",
2246
+				array($deleted_postid)
2247
+			)
2248
+		);
2249
+		geodir_remove_attachments($postcurr_images);
2250
+
2251
+	}
2252 2252
 }
2253 2253
 
2254 2254
 
2255 2255
 if (!function_exists('geodir_add_to_favorite')) {
2256
-    /**
2257
-     * This function would add listing to favorite listing.
2258
-     *
2259
-     * @since 1.0.0
2260
-     * @package GeoDirectory
2261
-     * @global object $current_user Current user object.
2262
-     * @param int $post_id The post ID.
2263
-     */
2264
-    function geodir_add_to_favorite($post_id)
2265
-    {
2266
-
2267
-        global $current_user;
2268
-
2269
-        /**
2270
-         * Filter to modify "Unfavorite" text
2271
-         *
2272
-         * You can use this filter to rename "Unfavorite" text to something else.
2273
-         *
2274
-         * @since 1.0.0
2275
-         * @package GeoDirectory
2276
-         */
2277
-        $remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2278
-
2279
-        /**
2280
-         * Filter to modify "Remove from Favorites" text
2281
-         *
2282
-         * You can use this filter to rename "Remove from Favorites" text to something else.
2283
-         *
2284
-         * @since 1.0.0
2285
-         * @package GeoDirectory
2286
-         */
2287
-        $unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2288
-
2289
-        /**
2290
-         * Filter to modify "fa fa-heart" icon
2291
-         *
2292
-         * You can use this filter to change "fa fa-heart" icon to something else.
2293
-         *
2294
-         * @since 1.0.0
2295
-         * @package GeoDirectory
2296
-         */
2297
-        $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2298
-
2299
-        $user_meta_data = array();
2300
-        $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2301
-
2302
-        if (empty($user_meta_data) || (!empty($user_meta_data) && !in_array($post_id, $user_meta_data))) {
2303
-            $user_meta_data[] = $post_id;
2304
-        }
2305
-
2306
-        update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2307
-
2308
-        /**
2309
-         * Called before adding the post from favourites.
2310
-         *
2311
-         * @since 1.0.0
2312
-         * @package GeoDirectory
2313
-         * @param int $post_id The post ID.
2314
-         */
2315
-        do_action('geodir_before_add_from_favorite', $post_id);
2316
-
2317
-        echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>';
2318
-
2319
-        /**
2320
-         * Called after adding the post from favourites.
2321
-         *
2322
-         * @since 1.0.0
2323
-         * @package GeoDirectory
2324
-         * @param int $post_id The post ID.
2325
-         */
2326
-        do_action('geodir_after_add_from_favorite', $post_id);
2256
+	/**
2257
+	 * This function would add listing to favorite listing.
2258
+	 *
2259
+	 * @since 1.0.0
2260
+	 * @package GeoDirectory
2261
+	 * @global object $current_user Current user object.
2262
+	 * @param int $post_id The post ID.
2263
+	 */
2264
+	function geodir_add_to_favorite($post_id)
2265
+	{
2266
+
2267
+		global $current_user;
2268
+
2269
+		/**
2270
+		 * Filter to modify "Unfavorite" text
2271
+		 *
2272
+		 * You can use this filter to rename "Unfavorite" text to something else.
2273
+		 *
2274
+		 * @since 1.0.0
2275
+		 * @package GeoDirectory
2276
+		 */
2277
+		$remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2278
+
2279
+		/**
2280
+		 * Filter to modify "Remove from Favorites" text
2281
+		 *
2282
+		 * You can use this filter to rename "Remove from Favorites" text to something else.
2283
+		 *
2284
+		 * @since 1.0.0
2285
+		 * @package GeoDirectory
2286
+		 */
2287
+		$unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2288
+
2289
+		/**
2290
+		 * Filter to modify "fa fa-heart" icon
2291
+		 *
2292
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2293
+		 *
2294
+		 * @since 1.0.0
2295
+		 * @package GeoDirectory
2296
+		 */
2297
+		$favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2298
+
2299
+		$user_meta_data = array();
2300
+		$user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2301
+
2302
+		if (empty($user_meta_data) || (!empty($user_meta_data) && !in_array($post_id, $user_meta_data))) {
2303
+			$user_meta_data[] = $post_id;
2304
+		}
2305
+
2306
+		update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2307
+
2308
+		/**
2309
+		 * Called before adding the post from favourites.
2310
+		 *
2311
+		 * @since 1.0.0
2312
+		 * @package GeoDirectory
2313
+		 * @param int $post_id The post ID.
2314
+		 */
2315
+		do_action('geodir_before_add_from_favorite', $post_id);
2316
+
2317
+		echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>';
2318
+
2319
+		/**
2320
+		 * Called after adding the post from favourites.
2321
+		 *
2322
+		 * @since 1.0.0
2323
+		 * @package GeoDirectory
2324
+		 * @param int $post_id The post ID.
2325
+		 */
2326
+		do_action('geodir_after_add_from_favorite', $post_id);
2327 2327
 
2328
-    }
2328
+	}
2329 2329
 }
2330 2330
 
2331 2331
 if (!function_exists('geodir_remove_from_favorite')) {
2332
-    /**
2333
-     * This function would remove the favourited property earlier.
2334
-     *
2335
-     * @since 1.0.0
2336
-     * @package GeoDirectory
2337
-     * @global object $current_user Current user object.
2338
-     * @param int $post_id The post ID.
2339
-     */
2340
-    function geodir_remove_from_favorite($post_id)
2341
-    {
2342
-        global $current_user;
2343
-
2344
-        /**
2345
-         * Filter to modify "Add to Favorites" text
2346
-         *
2347
-         * You can use this filter to rename "Add to Favorites" text to something else.
2348
-         *
2349
-         * @since 1.0.0
2350
-         * @package GeoDirectory
2351
-         */
2352
-        $add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2353
-
2354
-        /**
2355
-         * Filter to modify "Favourite" text
2356
-         *
2357
-         * You can use this filter to rename "Favourite" text to something else.
2358
-         *
2359
-         * @since 1.0.0
2360
-         * @package GeoDirectory
2361
-         */
2362
-        $favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2363
-
2364
-        /**
2365
-         * Filter to modify "fa fa-heart" icon
2366
-         *
2367
-         * You can use this filter to change "fa fa-heart" icon to something else.
2368
-         *
2369
-         * @since 1.0.0
2370
-         * @package GeoDirectory
2371
-         */
2372
-        $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2373
-
2374
-        $user_meta_data = array();
2375
-        $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2376
-
2377
-        if (!empty($user_meta_data)) {
2378
-
2379
-            if (($key = array_search($post_id, $user_meta_data)) !== false) {
2380
-                unset($user_meta_data[$key]);
2381
-            }
2332
+	/**
2333
+	 * This function would remove the favourited property earlier.
2334
+	 *
2335
+	 * @since 1.0.0
2336
+	 * @package GeoDirectory
2337
+	 * @global object $current_user Current user object.
2338
+	 * @param int $post_id The post ID.
2339
+	 */
2340
+	function geodir_remove_from_favorite($post_id)
2341
+	{
2342
+		global $current_user;
2343
+
2344
+		/**
2345
+		 * Filter to modify "Add to Favorites" text
2346
+		 *
2347
+		 * You can use this filter to rename "Add to Favorites" text to something else.
2348
+		 *
2349
+		 * @since 1.0.0
2350
+		 * @package GeoDirectory
2351
+		 */
2352
+		$add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2353
+
2354
+		/**
2355
+		 * Filter to modify "Favourite" text
2356
+		 *
2357
+		 * You can use this filter to rename "Favourite" text to something else.
2358
+		 *
2359
+		 * @since 1.0.0
2360
+		 * @package GeoDirectory
2361
+		 */
2362
+		$favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2363
+
2364
+		/**
2365
+		 * Filter to modify "fa fa-heart" icon
2366
+		 *
2367
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2368
+		 *
2369
+		 * @since 1.0.0
2370
+		 * @package GeoDirectory
2371
+		 */
2372
+		$favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2373
+
2374
+		$user_meta_data = array();
2375
+		$user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2376
+
2377
+		if (!empty($user_meta_data)) {
2378
+
2379
+			if (($key = array_search($post_id, $user_meta_data)) !== false) {
2380
+				unset($user_meta_data[$key]);
2381
+			}
2382 2382
 
2383
-        }
2383
+		}
2384 2384
 
2385
-        update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2385
+		update_user_meta($current_user->data->ID, 'gd_user_favourite_post', $user_meta_data);
2386 2386
 
2387
-        /**
2388
-         * Called before removing the post from favourites.
2389
-         *
2390
-         * @since 1.0.0
2391
-         * @package GeoDirectory
2392
-         * @param int $post_id The post ID.
2393
-         */
2394
-        do_action('geodir_before_remove_from_favorite', $post_id);
2387
+		/**
2388
+		 * Called before removing the post from favourites.
2389
+		 *
2390
+		 * @since 1.0.0
2391
+		 * @package GeoDirectory
2392
+		 * @param int $post_id The post ID.
2393
+		 */
2394
+		do_action('geodir_before_remove_from_favorite', $post_id);
2395 2395
 
2396
-        echo '<a href="javascript:void(0);"  title="' . $add_favourite_text . '" class="geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>';
2396
+		echo '<a href="javascript:void(0);"  title="' . $add_favourite_text . '" class="geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>';
2397 2397
 
2398
-        /**
2399
-         * Called after removing the post from favourites.
2400
-         *
2401
-         * @since 1.0.0
2402
-         * @package GeoDirectory
2403
-         * @param int $post_id The post ID.
2404
-         */
2405
-        do_action('geodir_after_remove_from_favorite', $post_id);
2398
+		/**
2399
+		 * Called after removing the post from favourites.
2400
+		 *
2401
+		 * @since 1.0.0
2402
+		 * @package GeoDirectory
2403
+		 * @param int $post_id The post ID.
2404
+		 */
2405
+		do_action('geodir_after_remove_from_favorite', $post_id);
2406 2406
 
2407
-    }
2407
+	}
2408 2408
 }
2409 2409
 
2410 2410
 if (!function_exists('geodir_favourite_html')) {
2411
-    /**
2412
-     * This function would display the html content for add to favorite or remove from favorite.
2413
-     *
2414
-     * @since 1.0.0
2415
-     * @package GeoDirectory
2416
-     * @global object $current_user Current user object.
2417
-     * @global object $post The current post object.
2418
-     * @param int $user_id The user ID.
2419
-     * @param int $post_id The post ID.
2420
-     */
2421
-    function geodir_favourite_html($user_id, $post_id)
2422
-    {
2423
-
2424
-        global $current_user, $post;
2425
-
2426
-        /**
2427
-         * Filter to modify "Add to Favorites" text
2428
-         *
2429
-         * You can use this filter to rename "Add to Favorites" text to something else.
2430
-         *
2431
-         * @since 1.0.0
2432
-         * @package GeoDirectory
2433
-         */
2434
-        $add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2435
-
2436
-        /**
2437
-         * Filter to modify "Favourite" text
2438
-         *
2439
-         * You can use this filter to rename "Favourite" text to something else.
2440
-         *
2441
-         * @since 1.0.0
2442
-         * @package GeoDirectory
2443
-         */
2444
-        $favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2445
-
2446
-        /**
2447
-         * Filter to modify "Unfavorite" text
2448
-         *
2449
-         * You can use this filter to rename "Unfavorite" text to something else.
2450
-         *
2451
-         * @since 1.0.0
2452
-         * @package GeoDirectory
2453
-         */
2454
-        $remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2455
-
2456
-        /**
2457
-         * Filter to modify "Remove from Favorites" text
2458
-         *
2459
-         * You can use this filter to rename "Remove from Favorites" text to something else.
2460
-         *
2461
-         * @since 1.0.0
2462
-         * @package GeoDirectory
2463
-         */
2464
-        $unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2465
-
2466
-        /**
2467
-         * Filter to modify "fa fa-heart" icon
2468
-         *
2469
-         * You can use this filter to change "fa fa-heart" icon to something else.
2470
-         *
2471
-         * @since 1.0.0
2472
-         * @package GeoDirectory
2473
-         */
2474
-        $favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2475
-
2476
-        /**
2477
-         * Filter to modify "fa fa-heart" icon for "remove from favorites" link
2478
-         *
2479
-         * You can use this filter to change "fa fa-heart" icon to something else.
2480
-         *
2481
-         * @since 1.0.0
2482
-         * @package GeoDirectory
2483
-         */
2484
-        $unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
2485
-
2486
-        $user_meta_data = '';
2487
-        if (isset($current_user->data->ID))
2488
-            $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2489
-
2490
-        if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2491
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
2411
+	/**
2412
+	 * This function would display the html content for add to favorite or remove from favorite.
2413
+	 *
2414
+	 * @since 1.0.0
2415
+	 * @package GeoDirectory
2416
+	 * @global object $current_user Current user object.
2417
+	 * @global object $post The current post object.
2418
+	 * @param int $user_id The user ID.
2419
+	 * @param int $post_id The post ID.
2420
+	 */
2421
+	function geodir_favourite_html($user_id, $post_id)
2422
+	{
2423
+
2424
+		global $current_user, $post;
2425
+
2426
+		/**
2427
+		 * Filter to modify "Add to Favorites" text
2428
+		 *
2429
+		 * You can use this filter to rename "Add to Favorites" text to something else.
2430
+		 *
2431
+		 * @since 1.0.0
2432
+		 * @package GeoDirectory
2433
+		 */
2434
+		$add_favourite_text = apply_filters('geodir_add_favourite_text', ADD_FAVOURITE_TEXT);
2435
+
2436
+		/**
2437
+		 * Filter to modify "Favourite" text
2438
+		 *
2439
+		 * You can use this filter to rename "Favourite" text to something else.
2440
+		 *
2441
+		 * @since 1.0.0
2442
+		 * @package GeoDirectory
2443
+		 */
2444
+		$favourite_text = apply_filters('geodir_favourite_text', FAVOURITE_TEXT);
2445
+
2446
+		/**
2447
+		 * Filter to modify "Unfavorite" text
2448
+		 *
2449
+		 * You can use this filter to rename "Unfavorite" text to something else.
2450
+		 *
2451
+		 * @since 1.0.0
2452
+		 * @package GeoDirectory
2453
+		 */
2454
+		$remove_favourite_text = apply_filters('geodir_remove_favourite_text', REMOVE_FAVOURITE_TEXT);
2455
+
2456
+		/**
2457
+		 * Filter to modify "Remove from Favorites" text
2458
+		 *
2459
+		 * You can use this filter to rename "Remove from Favorites" text to something else.
2460
+		 *
2461
+		 * @since 1.0.0
2462
+		 * @package GeoDirectory
2463
+		 */
2464
+		$unfavourite_text = apply_filters('geodir_unfavourite_text', UNFAVOURITE_TEXT);
2465
+
2466
+		/**
2467
+		 * Filter to modify "fa fa-heart" icon
2468
+		 *
2469
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2470
+		 *
2471
+		 * @since 1.0.0
2472
+		 * @package GeoDirectory
2473
+		 */
2474
+		$favourite_icon = apply_filters('geodir_favourite_icon', 'fa fa-heart');
2475
+
2476
+		/**
2477
+		 * Filter to modify "fa fa-heart" icon for "remove from favorites" link
2478
+		 *
2479
+		 * You can use this filter to change "fa fa-heart" icon to something else.
2480
+		 *
2481
+		 * @since 1.0.0
2482
+		 * @package GeoDirectory
2483
+		 */
2484
+		$unfavourite_icon = apply_filters('geodir_unfavourite_icon', 'fa fa-heart');
2485
+
2486
+		$user_meta_data = '';
2487
+		if (isset($current_user->data->ID))
2488
+			$user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2489
+
2490
+		if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2491
+			?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
2492 2492
                 class="geodir-removetofav-icon" href="javascript:void(0);"
2493 2493
                 onclick="javascript:addToFavourite(<?php echo $post_id;?>,'remove');"
2494 2494
                 title="<?php echo $remove_favourite_text;?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text;?>
2495 2495
             </a>   </span><?php
2496 2496
 
2497
-        } else {
2497
+		} else {
2498 2498
 
2499
-            if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
2500
-                $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';
2501
-            } else
2502
-                $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2499
+			if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
2500
+				$script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';
2501
+			} else
2502
+				$script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2503 2503
 
2504
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2504
+			?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2505 2505
                                                                                         href="javascript:void(0);"
2506 2506
                                                                                         onclick="<?php echo $script_text;?>"
2507 2507
                                                                                         title="<?php echo $add_favourite_text;?>"><i
2508 2508
                     class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text;?></a></span>
2509 2509
         <?php }
2510
-    }
2510
+	}
2511 2511
 }
2512 2512
 
2513 2513
 
@@ -2524,54 +2524,54 @@  discard block
 block discarded – undo
2524 2524
 function geodir_get_cat_postcount($term = array())
2525 2525
 {
2526 2526
 
2527
-    if (!empty($term)) {
2527
+	if (!empty($term)) {
2528 2528
 
2529
-        global $wpdb, $plugin_prefix;
2529
+		global $wpdb, $plugin_prefix;
2530 2530
 
2531
-        $where = '';
2532
-        $join = '';
2533
-        if (get_query_var('gd_country') != '' || get_query_var('gd_region') != '' || get_query_var('gd_city') != '') {
2534
-            $taxonomy_obj = get_taxonomy($term->taxonomy);
2531
+		$where = '';
2532
+		$join = '';
2533
+		if (get_query_var('gd_country') != '' || get_query_var('gd_region') != '' || get_query_var('gd_city') != '') {
2534
+			$taxonomy_obj = get_taxonomy($term->taxonomy);
2535 2535
 
2536
-            $post_type = $taxonomy_obj->object_type[0];
2536
+			$post_type = $taxonomy_obj->object_type[0];
2537 2537
 
2538
-            $table = $plugin_prefix . $post_type . '_detail';
2538
+			$table = $plugin_prefix . $post_type . '_detail';
2539 2539
 
2540
-            /**
2541
-             * Filter to modify the 'join' query
2542
-             *
2543
-             * @since 1.0.0
2544
-             * @package GeoDirectory
2545
-             * @param object|array $term category / term object that need to be processed.
2546
-             * @param string $join The join query.
2547
-             */
2548
-            $join = apply_filters('geodir_cat_post_count_join', $join, $term);
2540
+			/**
2541
+			 * Filter to modify the 'join' query
2542
+			 *
2543
+			 * @since 1.0.0
2544
+			 * @package GeoDirectory
2545
+			 * @param object|array $term category / term object that need to be processed.
2546
+			 * @param string $join The join query.
2547
+			 */
2548
+			$join = apply_filters('geodir_cat_post_count_join', $join, $term);
2549 2549
 
2550
-            /**
2551
-             * Filter to modify the 'where' query
2552
-             *
2553
-             * @since 1.0.0
2554
-             * @package GeoDirectory
2555
-             * @param object|array $term category / term object that need to be processed.
2556
-             * @param string $where The where query.
2557
-             */
2558
-            $where = apply_filters('geodir_cat_post_count_where', $where, $term);
2550
+			/**
2551
+			 * Filter to modify the 'where' query
2552
+			 *
2553
+			 * @since 1.0.0
2554
+			 * @package GeoDirectory
2555
+			 * @param object|array $term category / term object that need to be processed.
2556
+			 * @param string $where The where query.
2557
+			 */
2558
+			$where = apply_filters('geodir_cat_post_count_where', $where, $term);
2559 2559
 
2560
-            $count_query = "SELECT count(post_id) FROM
2560
+			$count_query = "SELECT count(post_id) FROM
2561 2561
 							" . $table . " as pd " . $join . "
2562 2562
 							WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
2563 2563
 
2564
-            $cat_post_count = $wpdb->get_var($count_query);
2565
-            if (empty($cat_post_count) || is_wp_error($cat_post_count))
2566
-                $cat_post_count = 0;
2564
+			$cat_post_count = $wpdb->get_var($count_query);
2565
+			if (empty($cat_post_count) || is_wp_error($cat_post_count))
2566
+				$cat_post_count = 0;
2567 2567
 
2568
-            return $cat_post_count;
2568
+			return $cat_post_count;
2569 2569
 
2570
-        } else
2570
+		} else
2571 2571
 
2572
-            return $term->count;
2573
-    }
2574
-    return false;
2572
+			return $term->count;
2573
+	}
2574
+	return false;
2575 2575
 
2576 2576
 }
2577 2577
 
@@ -2584,17 +2584,17 @@  discard block
 block discarded – undo
2584 2584
  */
2585 2585
 function geodir_allow_post_type_frontend()
2586 2586
 {
2587
-    $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2587
+	$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
2588 2588
 
2589
-    if (!is_admin() && isset($_REQUEST['listing_type'])
2590
-        && !empty($geodir_allow_posttype_frontend)
2591
-        && !in_array($_REQUEST['listing_type'], $geodir_allow_posttype_frontend)
2592
-    ) {
2589
+	if (!is_admin() && isset($_REQUEST['listing_type'])
2590
+		&& !empty($geodir_allow_posttype_frontend)
2591
+		&& !in_array($_REQUEST['listing_type'], $geodir_allow_posttype_frontend)
2592
+	) {
2593 2593
 
2594
-        wp_redirect(home_url());
2595
-        exit;
2594
+		wp_redirect(home_url());
2595
+		exit;
2596 2596
 
2597
-    }
2597
+	}
2598 2598
 
2599 2599
 }
2600 2600
 
@@ -2611,20 +2611,20 @@  discard block
 block discarded – undo
2611 2611
  */
2612 2612
 function geodir_excerpt_length($length)
2613 2613
 {
2614
-    global $wp_query, $geodir_is_widget_listing;
2614
+	global $wp_query, $geodir_is_widget_listing;
2615 2615
 	if ($geodir_is_widget_listing) {
2616 2616
 		return $length;
2617 2617
 	}
2618 2618
 	
2619
-    if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
2620
-        $length = get_option('geodir_desc_word_limit');
2621
-    elseif (get_query_var('excerpt_length'))
2622
-        $length = get_query_var('excerpt_length');
2619
+	if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
2620
+		$length = get_option('geodir_desc_word_limit');
2621
+	elseif (get_query_var('excerpt_length'))
2622
+		$length = get_query_var('excerpt_length');
2623 2623
 
2624
-    if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
2625
-        $length = get_option('geodir_author_desc_word_limit');
2624
+	if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
2625
+		$length = get_option('geodir_author_desc_word_limit');
2626 2626
 
2627
-    return $length;
2627
+	return $length;
2628 2628
 }
2629 2629
 
2630 2630
 /**
@@ -2639,13 +2639,13 @@  discard block
 block discarded – undo
2639 2639
  */
2640 2640
 function geodir_excerpt_more($more)
2641 2641
 {
2642
-    global $post;
2643
-    $all_postypes = geodir_get_posttypes();
2644
-    if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
2645
-        return ' <a href="' . get_permalink($post->ID) . '">' . READ_MORE_TXT . '</a>';
2646
-    }
2642
+	global $post;
2643
+	$all_postypes = geodir_get_posttypes();
2644
+	if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
2645
+		return ' <a href="' . get_permalink($post->ID) . '">' . READ_MORE_TXT . '</a>';
2646
+	}
2647 2647
 
2648
-    return $more;
2648
+	return $more;
2649 2649
 }
2650 2650
 
2651 2651
 
@@ -2662,63 +2662,63 @@  discard block
 block discarded – undo
2662 2662
  */
2663 2663
 function geodir_update_markers_oncatedit($term_id, $tt_id, $taxonomy)
2664 2664
 {
2665
-    global $plugin_prefix, $wpdb;
2665
+	global $plugin_prefix, $wpdb;
2666 2666
 
2667
-    $gd_taxonomies = geodir_get_taxonomies();
2667
+	$gd_taxonomies = geodir_get_taxonomies();
2668 2668
 
2669
-    if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
2669
+	if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
2670 2670
 
2671
-        $geodir_post_type = geodir_get_taxonomy_posttype($taxonomy);
2672
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
2671
+		$geodir_post_type = geodir_get_taxonomy_posttype($taxonomy);
2672
+		$table = $plugin_prefix . $geodir_post_type . '_detail';
2673 2673
 
2674
-        $path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']);
2675
-        $term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png';
2674
+		$path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']);
2675
+		$term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png';
2676 2676
 
2677
-        $posts = $wpdb->get_results(
2678
-            $wpdb->prepare(
2679
-                "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ",
2680
-                array($term_id, $taxonomy)
2681
-            )
2682
-        );
2677
+		$posts = $wpdb->get_results(
2678
+			$wpdb->prepare(
2679
+				"SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ",
2680
+				array($term_id, $taxonomy)
2681
+			)
2682
+		);
2683 2683
 
2684
-        if (!empty($posts)):
2685
-            foreach ($posts as $post_obj) {
2684
+		if (!empty($posts)):
2685
+			foreach ($posts as $post_obj) {
2686 2686
 
2687
-                $lat = $post_obj->post_latitude;
2688
-                $lng = $post_obj->post_longitude;
2687
+				$lat = $post_obj->post_latitude;
2688
+				$lng = $post_obj->post_longitude;
2689 2689
 
2690
-                $json = '{';
2691
-                $json .= '"id":"' . $post_obj->post_id . '",';
2692
-                $json .= '"lat_pos": "' . $lat . '",';
2693
-                $json .= '"long_pos": "' . $lng . '",';
2694
-                $json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",';
2695
-                $json .= '"icon":"' . $term_icon . '",';
2696
-                $json .= '"group":"catgroup' . $term_id . '"';
2697
-                $json .= '}';
2690
+				$json = '{';
2691
+				$json .= '"id":"' . $post_obj->post_id . '",';
2692
+				$json .= '"lat_pos": "' . $lat . '",';
2693
+				$json .= '"long_pos": "' . $lng . '",';
2694
+				$json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",';
2695
+				$json .= '"icon":"' . $term_icon . '",';
2696
+				$json .= '"group":"catgroup' . $term_id . '"';
2697
+				$json .= '}';
2698 2698
 
2699
-                if ($post_obj->default_category == $term_id) {
2699
+				if ($post_obj->default_category == $term_id) {
2700 2700
 
2701
-                    $wpdb->query(
2702
-                        $wpdb->prepare(
2703
-                            "UPDATE " . $table . " SET marker_json = %s where post_id = %d",
2704
-                            array($json, $post_obj->post_id)
2705
-                        )
2706
-                    );
2707
-                }
2701
+					$wpdb->query(
2702
+						$wpdb->prepare(
2703
+							"UPDATE " . $table . " SET marker_json = %s where post_id = %d",
2704
+							array($json, $post_obj->post_id)
2705
+						)
2706
+					);
2707
+				}
2708 2708
 
2709
-                $wpdb->query(
2710
-                    $wpdb->prepare(
2711
-                        "UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d",
2712
-                        array($json, $post_obj->post_id, $term_id)
2713
-                    )
2714
-                );
2709
+				$wpdb->query(
2710
+					$wpdb->prepare(
2711
+						"UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d",
2712
+						array($json, $post_obj->post_id, $term_id)
2713
+					)
2714
+				);
2715 2715
 
2716
-            }
2716
+			}
2717 2717
 
2718 2718
 
2719
-        endif;
2719
+		endif;
2720 2720
 
2721
-    }
2721
+	}
2722 2722
 
2723 2723
 }
2724 2724
 
@@ -2732,14 +2732,14 @@  discard block
 block discarded – undo
2732 2732
  */
2733 2733
 function geodir_get_listing_author($listing_id = '')
2734 2734
 {
2735
-    if ($listing_id == '') {
2736
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2737
-            $listing_id = $_REQUEST['pid'];
2738
-        }
2739
-    }
2740
-    $listing = get_post(strip_tags($listing_id));
2741
-    $listing_author_id = $listing->post_author;
2742
-    return $listing_author_id;
2735
+	if ($listing_id == '') {
2736
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2737
+			$listing_id = $_REQUEST['pid'];
2738
+		}
2739
+	}
2740
+	$listing = get_post(strip_tags($listing_id));
2741
+	$listing_author_id = $listing->post_author;
2742
+	return $listing_author_id;
2743 2743
 }
2744 2744
 
2745 2745
 
@@ -2754,11 +2754,11 @@  discard block
 block discarded – undo
2754 2754
  */
2755 2755
 function geodir_lisiting_belong_to_user($listing_id, $user_id)
2756 2756
 {
2757
-    $listing_author_id = geodir_get_listing_author($listing_id);
2758
-    if ($listing_author_id == $user_id)
2759
-        return true;
2760
-    else
2761
-        return false;
2757
+	$listing_author_id = geodir_get_listing_author($listing_id);
2758
+	if ($listing_author_id == $user_id)
2759
+		return true;
2760
+	else
2761
+		return false;
2762 2762
 
2763 2763
 }
2764 2764
 
@@ -2774,17 +2774,17 @@  discard block
 block discarded – undo
2774 2774
  */
2775 2775
 function geodir_listing_belong_to_current_user($listing_id = '', $exclude_admin = true)
2776 2776
 {
2777
-    global $current_user;
2778
-    if ($exclude_admin) {
2779
-        foreach ($current_user->caps as $key => $caps) {
2780
-            if (geodir_strtolower($key) == 'administrator') {
2781
-                return true;
2782
-                break;
2783
-            }
2784
-        }
2785
-    }
2786
-
2787
-    return geodir_lisiting_belong_to_user($listing_id, $current_user->ID);
2777
+	global $current_user;
2778
+	if ($exclude_admin) {
2779
+		foreach ($current_user->caps as $key => $caps) {
2780
+			if (geodir_strtolower($key) == 'administrator') {
2781
+				return true;
2782
+				break;
2783
+			}
2784
+		}
2785
+	}
2786
+
2787
+	return geodir_lisiting_belong_to_user($listing_id, $current_user->ID);
2788 2788
 }
2789 2789
 
2790 2790
 
@@ -2800,17 +2800,17 @@  discard block
 block discarded – undo
2800 2800
 function geodir_only_supportable_attachments_remove($file)
2801 2801
 {
2802 2802
 
2803
-    global $wpdb;
2803
+	global $wpdb;
2804 2804
 
2805
-    $matches = array();
2805
+	$matches = array();
2806 2806
 
2807
-    $pattern = '/-\d+x\d+\./';
2808
-    preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE);
2807
+	$pattern = '/-\d+x\d+\./';
2808
+	preg_match($pattern, $file, $matches, PREG_OFFSET_CAPTURE);
2809 2809
 
2810
-    if (empty($matches))
2811
-        return '';
2812
-    else
2813
-        return $file;
2810
+	if (empty($matches))
2811
+		return '';
2812
+	else
2813
+		return $file;
2814 2814
 
2815 2815
 }
2816 2816
 
@@ -2827,78 +2827,78 @@  discard block
 block discarded – undo
2827 2827
 function geodir_set_wp_featured_image($post_id)
2828 2828
 {
2829 2829
 
2830
-    global $wpdb, $plugin_prefix;
2831
-    $uploads = wp_upload_dir();
2830
+	global $wpdb, $plugin_prefix;
2831
+	$uploads = wp_upload_dir();
2832 2832
 //	print_r($uploads ) ;
2833
-    $post_first_image = $wpdb->get_results(
2834
-        $wpdb->prepare(
2835
-            "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1  ", array($post_id)
2836
-        )
2837
-    );
2838
-
2839
-    $old_attachment_name = '';
2840
-    $post_thumbnail_id = '';
2841
-    if (has_post_thumbnail($post_id)) {
2833
+	$post_first_image = $wpdb->get_results(
2834
+		$wpdb->prepare(
2835
+			"SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1  ", array($post_id)
2836
+		)
2837
+	);
2842 2838
 
2843
-        if (has_post_thumbnail($post_id)) {
2839
+	$old_attachment_name = '';
2840
+	$post_thumbnail_id = '';
2841
+	if (has_post_thumbnail($post_id)) {
2844 2842
 
2845
-            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2843
+		if (has_post_thumbnail($post_id)) {
2846 2844
 
2847
-            $old_attachment_name = basename(get_attached_file($post_thumbnail_id));
2845
+			$post_thumbnail_id = get_post_thumbnail_id($post_id);
2848 2846
 
2849
-        }
2850
-    }
2847
+			$old_attachment_name = basename(get_attached_file($post_thumbnail_id));
2851 2848
 
2852
-    if (!empty($post_first_image)) {
2849
+		}
2850
+	}
2853 2851
 
2854
-        $post_type = get_post_type($post_id);
2852
+	if (!empty($post_first_image)) {
2855 2853
 
2856
-        $table_name = $plugin_prefix . $post_type . '_detail';
2854
+		$post_type = get_post_type($post_id);
2857 2855
 
2858
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id);
2856
+		$table_name = $plugin_prefix . $post_type . '_detail';
2859 2857
 
2860
-        $new_attachment_name = basename($post_first_image[0]->file);
2858
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id);
2861 2859
 
2862
-        if (geodir_strtolower($new_attachment_name) != geodir_strtolower($old_attachment_name)) {
2860
+		$new_attachment_name = basename($post_first_image[0]->file);
2863 2861
 
2864
-            if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) {
2862
+		if (geodir_strtolower($new_attachment_name) != geodir_strtolower($old_attachment_name)) {
2865 2863
 
2866
-                add_filter('wp_delete_file', 'geodir_only_supportable_attachments_remove');
2864
+			if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete')) {
2867 2865
 
2868
-                wp_delete_attachment($post_thumbnail_id);
2866
+				add_filter('wp_delete_file', 'geodir_only_supportable_attachments_remove');
2869 2867
 
2870
-            }
2871
-            $filename = $uploads['basedir'] . $post_first_image[0]->file;
2868
+				wp_delete_attachment($post_thumbnail_id);
2872 2869
 
2873
-            $attachment = array(
2874
-                'post_mime_type' => $post_first_image[0]->mime_type,
2875
-                'guid' => $uploads['baseurl'] . $post_first_image[0]->file,
2876
-                'post_parent' => $post_id,
2877
-                'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title),
2878
-                'post_content' => ''
2879
-            );
2870
+			}
2871
+			$filename = $uploads['basedir'] . $post_first_image[0]->file;
2872
+
2873
+			$attachment = array(
2874
+				'post_mime_type' => $post_first_image[0]->mime_type,
2875
+				'guid' => $uploads['baseurl'] . $post_first_image[0]->file,
2876
+				'post_parent' => $post_id,
2877
+				'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title),
2878
+				'post_content' => ''
2879
+			);
2880 2880
 
2881 2881
 
2882
-            $id = wp_insert_attachment($attachment, $filename, $post_id);
2882
+			$id = wp_insert_attachment($attachment, $filename, $post_id);
2883 2883
 
2884
-            if (!is_wp_error($id)) {
2884
+			if (!is_wp_error($id)) {
2885 2885
 
2886
-                set_post_thumbnail($post_id, $id);
2886
+				set_post_thumbnail($post_id, $id);
2887 2887
 
2888
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
2889
-                wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
2888
+				require_once(ABSPATH . 'wp-admin/includes/image.php');
2889
+				wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
2890 2890
 
2891
-            }
2891
+			}
2892 2892
 
2893
-        }
2893
+		}
2894 2894
 
2895
-    } else {
2896
-        //set_post_thumbnail($post_id,-1);
2895
+	} else {
2896
+		//set_post_thumbnail($post_id,-1);
2897 2897
 
2898
-        if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete'))
2899
-            wp_delete_attachment($post_thumbnail_id);
2898
+		if (has_post_thumbnail($post_id) && $post_thumbnail_id != '' && (!isset($_REQUEST['action']) || $_REQUEST['action'] != 'delete'))
2899
+			wp_delete_attachment($post_thumbnail_id);
2900 2900
 
2901
-    }
2901
+	}
2902 2902
 }
2903 2903
 
2904 2904
 
@@ -2913,53 +2913,53 @@  discard block
 block discarded – undo
2913 2913
  */
2914 2914
 function gd_copy_original_translation()
2915 2915
 {
2916
-    if (function_exists('icl_object_id')) {
2917
-        global $wpdb, $table_prefix, $plugin_prefix;
2918
-        $post_id = absint($_POST['post_id']);
2919
-        $upload_dir = wp_upload_dir();
2920
-        $post_type = get_post_type($_POST['post_id']);
2921
-        $table = $plugin_prefix . $post_type . '_detail';
2922
-
2923
-        $post_arr = $wpdb->get_results($wpdb->prepare(
2924
-            "SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1",
2925
-            array($post_id)
2926
-        )
2927
-            , ARRAY_A);
2928
-
2929
-        $arrImages = $wpdb->get_results(
2930
-            $wpdb->prepare(
2931
-                "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ",
2932
-                array('%image%', $post_id)
2933
-            )
2934
-        );
2935
-        if ($arrImages) {
2936
-            $image_arr = array();
2937
-            foreach ($arrImages as $img) {
2938
-                $image_arr[] = $upload_dir['baseurl'] . $img->file;
2939
-            }
2940
-            $comma_separated = implode(",", $image_arr);
2941
-            $post_arr[0]['post_images'] = $comma_separated;
2942
-        }
2943
-
2944
-
2945
-        $cats = $post_arr[0][$post_arr[0]['post_type'] . 'category'];
2946
-        $cat_arr = array_filter(explode(",", $cats));
2947
-        $trans_cat = array();
2948
-        foreach ($cat_arr as $cat) {
2949
-            $trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'] . 'category', false);
2950
-        }
2951
-
2952
-
2953
-        $post_arr[0]['categories'] = array_filter($trans_cat);
2916
+	if (function_exists('icl_object_id')) {
2917
+		global $wpdb, $table_prefix, $plugin_prefix;
2918
+		$post_id = absint($_POST['post_id']);
2919
+		$upload_dir = wp_upload_dir();
2920
+		$post_type = get_post_type($_POST['post_id']);
2921
+		$table = $plugin_prefix . $post_type . '_detail';
2922
+
2923
+		$post_arr = $wpdb->get_results($wpdb->prepare(
2924
+			"SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1",
2925
+			array($post_id)
2926
+		)
2927
+			, ARRAY_A);
2928
+
2929
+		$arrImages = $wpdb->get_results(
2930
+			$wpdb->prepare(
2931
+				"SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ",
2932
+				array('%image%', $post_id)
2933
+			)
2934
+		);
2935
+		if ($arrImages) {
2936
+			$image_arr = array();
2937
+			foreach ($arrImages as $img) {
2938
+				$image_arr[] = $upload_dir['baseurl'] . $img->file;
2939
+			}
2940
+			$comma_separated = implode(",", $image_arr);
2941
+			$post_arr[0]['post_images'] = $comma_separated;
2942
+		}
2943
+
2944
+
2945
+		$cats = $post_arr[0][$post_arr[0]['post_type'] . 'category'];
2946
+		$cat_arr = array_filter(explode(",", $cats));
2947
+		$trans_cat = array();
2948
+		foreach ($cat_arr as $cat) {
2949
+			$trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'] . 'category', false);
2950
+		}
2951
+
2952
+
2953
+		$post_arr[0]['categories'] = array_filter($trans_cat);
2954 2954
 //print_r($image_arr);
2955
-        //print_r($arrImages);
2956
-        //echo $_REQUEST['lang'];
2955
+		//print_r($arrImages);
2956
+		//echo $_REQUEST['lang'];
2957 2957
 //print_r($post_arr);
2958 2958
 //print_r($trans_cat);
2959
-        echo json_encode($post_arr[0]);
2959
+		echo json_encode($post_arr[0]);
2960 2960
 
2961
-    }
2962
-    die();
2961
+	}
2962
+	die();
2963 2963
 }
2964 2964
 
2965 2965
 
@@ -2979,54 +2979,54 @@  discard block
 block discarded – undo
2979 2979
 function geodir_get_custom_fields_type($listing_type = '')
2980 2980
 {
2981 2981
 
2982
-    global $wpdb;
2982
+	global $wpdb;
2983 2983
 
2984
-    if ($listing_type == '')
2985
-        $listing_type = 'gd_place';
2984
+	if ($listing_type == '')
2985
+		$listing_type = 'gd_place';
2986 2986
 
2987
-    $fields_info = array();
2987
+	$fields_info = array();
2988 2988
 
2989
-    $get_data = $wpdb->get_results(
2990
-        $wpdb->prepare(
2991
-            "SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'",
2992
-            array($listing_type)
2993
-        )
2994
-    );
2989
+	$get_data = $wpdb->get_results(
2990
+		$wpdb->prepare(
2991
+			"SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'",
2992
+			array($listing_type)
2993
+		)
2994
+	);
2995 2995
 
2996
-    if (!empty($get_data)) {
2996
+	if (!empty($get_data)) {
2997 2997
 
2998
-        foreach ($get_data as $data) {
2998
+		foreach ($get_data as $data) {
2999 2999
 
3000
-            if ($data->field_type == 'address') {
3000
+			if ($data->field_type == 'address') {
3001 3001
 
3002
-                $extra_fields = unserialize($data->extra_fields);
3002
+				$extra_fields = unserialize($data->extra_fields);
3003 3003
 
3004
-                $prefix = $data->htmlvar_name . '_';
3004
+				$prefix = $data->htmlvar_name . '_';
3005 3005
 
3006
-                $fields_info[$prefix . 'address'] = $data->field_type;
3006
+				$fields_info[$prefix . 'address'] = $data->field_type;
3007 3007
 
3008
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])
3009
-                    $fields_info[$prefix . 'zip'] = $data->field_type;
3008
+				if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])
3009
+					$fields_info[$prefix . 'zip'] = $data->field_type;
3010 3010
 
3011
-            } else {
3011
+			} else {
3012 3012
 
3013
-                $fields_info[$data->htmlvar_name] = $data->field_type;
3013
+				$fields_info[$data->htmlvar_name] = $data->field_type;
3014 3014
 
3015
-            }
3015
+			}
3016 3016
 
3017
-        }
3017
+		}
3018 3018
 
3019
-    }
3019
+	}
3020 3020
 
3021
-    /**
3022
-     * Filter to modify custom fields info using listing post type.
3023
-     *
3024
-     * @since 1.0.0
3025
-     * @package GeoDirectory
3026
-     * @return array $fields_info Custom fields info.
3027
-     * @param string $listing_type The listing post type.
3028
-     */
3029
-    return apply_filters('geodir_get_custom_fields_type', $fields_info, $listing_type);
3021
+	/**
3022
+	 * Filter to modify custom fields info using listing post type.
3023
+	 *
3024
+	 * @since 1.0.0
3025
+	 * @package GeoDirectory
3026
+	 * @return array $fields_info Custom fields info.
3027
+	 * @param string $listing_type The listing post type.
3028
+	 */
3029
+	return apply_filters('geodir_get_custom_fields_type', $fields_info, $listing_type);
3030 3030
 }
3031 3031
 
3032 3032
 
@@ -3041,58 +3041,58 @@  discard block
 block discarded – undo
3041 3041
  */
3042 3042
 function geodir_function_post_updated($post_ID, $post_after, $post_before)
3043 3043
 {
3044
-    $post_type = get_post_type($post_ID);
3044
+	$post_type = get_post_type($post_ID);
3045 3045
 
3046
-    if ($post_type != '' && in_array($post_type, geodir_get_posttypes())) {
3047
-        // send notification to client when post moves from draft to publish
3048
-        if (!empty($post_after->post_status) && $post_after->post_status == 'publish' && !empty($post_before->post_status) && ($post_before->post_status == 'draft' || $post_before->post_status == 'auto-draft')) {
3049
-            $post_author_id = !empty($post_after->post_author) ? $post_after->post_author : NULL;
3050
-            $post_author_data = get_userdata($post_author_id);
3046
+	if ($post_type != '' && in_array($post_type, geodir_get_posttypes())) {
3047
+		// send notification to client when post moves from draft to publish
3048
+		if (!empty($post_after->post_status) && $post_after->post_status == 'publish' && !empty($post_before->post_status) && ($post_before->post_status == 'draft' || $post_before->post_status == 'auto-draft')) {
3049
+			$post_author_id = !empty($post_after->post_author) ? $post_after->post_author : NULL;
3050
+			$post_author_data = get_userdata($post_author_id);
3051 3051
 
3052
-            $to_name = geodir_get_client_name($post_author_id);
3052
+			$to_name = geodir_get_client_name($post_author_id);
3053 3053
 
3054
-            $from_email = geodir_get_site_email_id();
3055
-            $from_name = get_site_emailName();
3056
-            $to_email = $post_author_data->user_email;
3054
+			$from_email = geodir_get_site_email_id();
3055
+			$from_name = get_site_emailName();
3056
+			$to_email = $post_author_data->user_email;
3057 3057
 
3058
-            if (!is_email($to_email) && !empty($post_author_data->user_email)) {
3059
-                $to_email = $post_author_data->user_email;
3060
-            }
3058
+			if (!is_email($to_email) && !empty($post_author_data->user_email)) {
3059
+				$to_email = $post_author_data->user_email;
3060
+			}
3061 3061
 
3062
-            $message_type = 'listing_published';
3062
+			$message_type = 'listing_published';
3063 3063
 
3064
-            if (get_option('geodir_post_published_email_subject') == '') {
3065
-                update_option('geodir_post_published_email_subject', __('Listing Published Successfully', 'geodirectory'));
3066
-            }
3064
+			if (get_option('geodir_post_published_email_subject') == '') {
3065
+				update_option('geodir_post_published_email_subject', __('Listing Published Successfully', 'geodirectory'));
3066
+			}
3067 3067
 
3068
-            if (get_option('geodir_post_published_email_content') == '') {
3069
-                update_option('geodir_post_published_email_content', __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", 'geodirectory'));
3070
-            }
3068
+			if (get_option('geodir_post_published_email_content') == '') {
3069
+				update_option('geodir_post_published_email_content', __("<p>Dear [#client_name#],</p><p>Your listing [#listing_link#] has been published. This email is just for your information.</p><p>[#listing_link#]</p><br><p>Thank you for your contribution.</p><p>[#site_name#]</p>", 'geodirectory'));
3070
+			}
3071 3071
 
3072
-            /**
3073
-             * Called before sending the email when listing gets published.
3074
-             *
3075
-             * @since 1.0.0
3076
-             * @package GeoDirectory
3077
-             * @param object $post_after The post object after update.
3078
-             * @param object $post_before The post object before update.
3079
-             */
3080
-            do_action('geodir_before_listing_published_email', $post_after, $post_before);
3081
-            if (is_email($to_email)) {
3082
-                geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
3083
-            }
3072
+			/**
3073
+			 * Called before sending the email when listing gets published.
3074
+			 *
3075
+			 * @since 1.0.0
3076
+			 * @package GeoDirectory
3077
+			 * @param object $post_after The post object after update.
3078
+			 * @param object $post_before The post object before update.
3079
+			 */
3080
+			do_action('geodir_before_listing_published_email', $post_after, $post_before);
3081
+			if (is_email($to_email)) {
3082
+				geodir_sendEmail($from_email, $from_name, $to_email, $to_name, '', '', '', $message_type, $post_ID);
3083
+			}
3084 3084
 
3085
-            /**
3086
-             * Called after sending the email when listing gets published.
3087
-             *
3088
-             * @since 1.0.0
3089
-             * @package GeoDirectory
3090
-             * @param object $post_after The post object after update.
3091
-             * @param object $post_before The post object before update.
3092
-             */
3093
-            do_action('geodir_after_listing_published_email', $post_after, $post_before);
3094
-        }
3095
-    }
3085
+			/**
3086
+			 * Called after sending the email when listing gets published.
3087
+			 *
3088
+			 * @since 1.0.0
3089
+			 * @package GeoDirectory
3090
+			 * @param object $post_after The post object after update.
3091
+			 * @param object $post_before The post object before update.
3092
+			 */
3093
+			do_action('geodir_after_listing_published_email', $post_after, $post_before);
3094
+		}
3095
+	}
3096 3096
 }
3097 3097
 
3098 3098
 add_action('wp_head', 'geodir_fb_like_thumbnail');
@@ -3106,14 +3106,14 @@  discard block
 block discarded – undo
3106 3106
  */
3107 3107
 function geodir_fb_like_thumbnail(){
3108 3108
 
3109
-    // return if not a single post
3110
-    if(!is_single()){return;}
3109
+	// return if not a single post
3110
+	if(!is_single()){return;}
3111 3111
 
3112
-    global $post;
3113
-    if(isset($post->featured_image) && $post->featured_image){
3114
-        $upload_dir = wp_upload_dir();
3115
-        $thumb = $upload_dir['baseurl'].$post->featured_image;
3116
-        echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n";
3112
+	global $post;
3113
+	if(isset($post->featured_image) && $post->featured_image){
3114
+		$upload_dir = wp_upload_dir();
3115
+		$thumb = $upload_dir['baseurl'].$post->featured_image;
3116
+		echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n";
3117 3117
 
3118
-    }
3118
+	}
3119 3119
 }
3120 3120
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +208 added lines, -208 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 
27 27
     if (!isset($default_cat) || empty($default_cat)) {
28 28
         $default_cat = isset($post_cat_array[0]) ? $post_cat_array[0] : '';
29
-    }else{
30
-        if(!is_int($default_cat)){
29
+    } else {
30
+        if (!is_int($default_cat)) {
31 31
             $category = get_term_by('name', $default_cat, $taxonomy);
32
-            if(isset($category->term_id)){
33
-                $default_cat =  $category->term_id;
32
+            if (isset($category->term_id)) {
33
+                $default_cat = $category->term_id;
34 34
             }
35 35
         }
36 36
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
     if ($default_pos === false) {
60 60
 
61
-        $change_cat_str = str_replace($default_cat . ',y:', $default_cat . ',y,d:', $change_cat_str);
61
+        $change_cat_str = str_replace($default_cat.',y:', $default_cat.',y,d:', $change_cat_str);
62 62
 
63 63
     }
64 64
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
             
146 146
             $gd_post = $post;
147 147
             if (!empty($gd_post) && is_array($gd_post)) {
148
-                $gd_post = (object)$post;
148
+                $gd_post = (object) $post;
149 149
                 
150 150
                 // Fix WPML duplicate.
151 151
                 if (geodir_is_wpml() && !empty($request_info['action']) && $request_info['action'] == 'editpost' && !empty($request_info['icl_trid']) && !isset($post['post_date'])) {
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
         $send_post_submit_mail = false;
240 240
 
241 241
         // unhook this function so it doesn't loop infinitely
242
-        remove_action('save_post', 'geodir_post_information_save',10,2);
242
+        remove_action('save_post', 'geodir_post_information_save', 10, 2);
243 243
 
244 244
         if (isset($request_info['pid']) && $request_info['pid'] != '') {
245 245
             $post['ID'] = $request_info['pid'];
@@ -263,13 +263,13 @@  discard block
 block discarded – undo
263 263
         }
264 264
 
265 265
         // re-hook this function
266
-        add_action('save_post', 'geodir_post_information_save',10,2);
266
+        add_action('save_post', 'geodir_post_information_save', 10, 2);
267 267
 
268 268
         $post_tags = '';
269 269
         if (!isset($request_info['post_tags'])) {
270 270
 
271 271
             $post_type = $request_info['listing_type'];
272
-            $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type . '_tags', array('fields' => 'names')));
272
+            $post_tags = implode(",", wp_get_object_terms($last_post_id, $post_type.'_tags', array('fields' => 'names')));
273 273
 
274 274
         }
275 275
 
@@ -287,13 +287,13 @@  discard block
 block discarded – undo
287 287
         $payment_info = array();
288 288
         $package_info = array();
289 289
 
290
-        $package_info = (array)geodir_post_package_info($package_info, $post);
290
+        $package_info = (array) geodir_post_package_info($package_info, $post);
291 291
 
292 292
         $post_package_id = geodir_get_post_meta($last_post_id, 'package_id');
293 293
 
294 294
         if (!empty($package_info) && !$post_package_id) {
295 295
             if (isset($package_info['days']) && $package_info['days'] != 0) {
296
-                $payment_info['expire_date'] = date('Y-m-d', strtotime("+" . $package_info['days'] . " days"));
296
+                $payment_info['expire_date'] = date('Y-m-d', strtotime("+".$package_info['days']." days"));
297 297
             } else {
298 298
                 $payment_info['expire_date'] = 'Never';
299 299
             }
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
             $extrafields = $val['extra_fields'];
315 315
 
316 316
             if (trim($type) == 'address') {
317
-                $prefix = $name . '_';
318
-                $address = $prefix . 'address';
317
+                $prefix = $name.'_';
318
+                $address = $prefix.'address';
319 319
 
320 320
                 if (isset($request_info[$address]) && $request_info[$address] != '') {
321 321
                     $gd_post_info[$address] = wp_slash($request_info[$address]);
@@ -325,59 +325,59 @@  discard block
 block discarded – undo
325 325
                     $extrafields = unserialize($extrafields);
326 326
 
327 327
 
328
-                    if (!isset($request_info[$prefix . 'city']) || $request_info[$prefix . 'city'] == '') {
328
+                    if (!isset($request_info[$prefix.'city']) || $request_info[$prefix.'city'] == '') {
329 329
 
330 330
                         $location_result = geodir_get_default_location();
331 331
 
332
-                        $gd_post_info[$prefix . 'city'] = $location_result->city;
333
-                        $gd_post_info[$prefix . 'region'] = $location_result->region;
334
-                        $gd_post_info[$prefix . 'country'] = $location_result->country;
332
+                        $gd_post_info[$prefix.'city'] = $location_result->city;
333
+                        $gd_post_info[$prefix.'region'] = $location_result->region;
334
+                        $gd_post_info[$prefix.'country'] = $location_result->country;
335 335
 
336
-                        $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
336
+                        $gd_post_info['post_locations'] = '['.$location_result->city_slug.'],['.$location_result->region_slug.'],['.$location_result->country_slug.']'; // set all overall post location
337 337
 
338 338
                     } else {
339 339
 
340
-                        $gd_post_info[$prefix . 'city'] = $request_info[$prefix . 'city'];
341
-                        $gd_post_info[$prefix . 'region'] = $request_info[$prefix . 'region'];
342
-                        $gd_post_info[$prefix . 'country'] = $request_info[$prefix . 'country'];
340
+                        $gd_post_info[$prefix.'city'] = $request_info[$prefix.'city'];
341
+                        $gd_post_info[$prefix.'region'] = $request_info[$prefix.'region'];
342
+                        $gd_post_info[$prefix.'country'] = $request_info[$prefix.'country'];
343 343
 
344 344
                         //----------set post locations when import dummy data-------
345 345
                         $location_result = geodir_get_default_location();
346 346
 
347
-                        $gd_post_info['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // set all overall post location
347
+                        $gd_post_info['post_locations'] = '['.$location_result->city_slug.'],['.$location_result->region_slug.'],['.$location_result->country_slug.']'; // set all overall post location
348 348
                         //-----------------------------------------------------------------
349 349
 
350 350
                     }
351 351
 
352 352
 
353
-                    if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix . 'zip'])) {
354
-                        $gd_post_info[$prefix . 'zip'] = $request_info[$prefix . 'zip'];
353
+                    if (isset($extrafields['show_zip']) && $extrafields['show_zip'] && isset($request_info[$prefix.'zip'])) {
354
+                        $gd_post_info[$prefix.'zip'] = $request_info[$prefix.'zip'];
355 355
                     }
356 356
 
357 357
 
358 358
                     if (isset($extrafields['show_map']) && $extrafields['show_map']) {
359 359
 
360
-                        if (isset($request_info[$prefix . 'latitude']) && $request_info[$prefix . 'latitude'] != '') {
361
-                            $gd_post_info[$prefix . 'latitude'] = $request_info[$prefix . 'latitude'];
360
+                        if (isset($request_info[$prefix.'latitude']) && $request_info[$prefix.'latitude'] != '') {
361
+                            $gd_post_info[$prefix.'latitude'] = $request_info[$prefix.'latitude'];
362 362
                         }
363 363
 
364
-                        if (isset($request_info[$prefix . 'longitude']) && $request_info[$prefix . 'longitude'] != '') {
365
-                            $gd_post_info[$prefix . 'longitude'] = $request_info[$prefix . 'longitude'];
364
+                        if (isset($request_info[$prefix.'longitude']) && $request_info[$prefix.'longitude'] != '') {
365
+                            $gd_post_info[$prefix.'longitude'] = $request_info[$prefix.'longitude'];
366 366
                         }
367 367
 
368
-                        if (isset($request_info[$prefix . 'mapview']) && $request_info[$prefix . 'mapview'] != '') {
369
-                            $gd_post_info[$prefix . 'mapview'] = $request_info[$prefix . 'mapview'];
368
+                        if (isset($request_info[$prefix.'mapview']) && $request_info[$prefix.'mapview'] != '') {
369
+                            $gd_post_info[$prefix.'mapview'] = $request_info[$prefix.'mapview'];
370 370
                         }
371 371
 
372
-                        if (isset($request_info[$prefix . 'mapzoom']) && $request_info[$prefix . 'mapzoom'] != '') {
373
-                            $gd_post_info[$prefix . 'mapzoom'] = $request_info[$prefix . 'mapzoom'];
372
+                        if (isset($request_info[$prefix.'mapzoom']) && $request_info[$prefix.'mapzoom'] != '') {
373
+                            $gd_post_info[$prefix.'mapzoom'] = $request_info[$prefix.'mapzoom'];
374 374
                         }
375 375
 
376 376
                     }
377 377
 
378 378
                     // show lat lng
379
-                    if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix . 'latlng'])) {
380
-                        $gd_post_info[$prefix . 'latlng'] = $request_info[$prefix . 'latlng'];
379
+                    if (isset($extrafields['show_latlng']) && $extrafields['show_latlng'] && isset($request_info[$prefix.'latlng'])) {
380
+                        $gd_post_info[$prefix.'latlng'] = $request_info[$prefix.'latlng'];
381 381
                     }
382 382
                 }
383 383
 
@@ -403,16 +403,16 @@  discard block
 block discarded – undo
403 403
 
404 404
                         // check if we need to change the format or not
405 405
                         $date_format_len = strlen(str_replace(' ', '', $date_format));
406
-                        if($date_format_len>5){// if greater then 5 then it's the old style format.
406
+                        if ($date_format_len > 5) {// if greater then 5 then it's the old style format.
407 407
 
408
-                            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
409
-                            $replace = array('d','j','l','m','n','F','Y');//PHP date format
408
+                            $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
409
+                            $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
410 410
 
411 411
                             $date_format = str_replace($search, $replace, $date_format);
412 412
 
413 413
                             $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $request_info[$name]) : $request_info[$name];
414 414
 
415
-                        }else{
415
+                        } else {
416 416
                             $post_htmlvar_value = $request_info[$name];
417 417
                         }
418 418
 
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
                 if (isset($request_info[$name])) {
427 427
                     $gd_post_info[$name] = $request_info[$name];
428 428
                 } else {
429
-                    if (isset($request_info['gd_field_' . $name])) {
429
+                    if (isset($request_info['gd_field_'.$name])) {
430 430
                         $gd_post_info[$name] = ''; /* fix de-select for multiselect */
431 431
                     }
432 432
                 }
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
         }
487 487
 
488 488
         if (is_array($post_tags)) {
489
-            $taxonomy = $request_info['listing_type'] . '_tags';
489
+            $taxonomy = $request_info['listing_type'].'_tags';
490 490
             wp_set_object_terms($last_post_id, $post_tags, $taxonomy);
491 491
         }
492 492
 
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
                 $tmpimgArr = trim($request_info['post_images'], ",");
499 499
                 $tmpimgArr = explode(",", $tmpimgArr);
500 500
                 geodir_save_post_images($last_post_id, $tmpimgArr, $dummy);
501
-            } else{
501
+            } else {
502 502
                 geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy);
503 503
             }
504 504
 
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
     if (!in_array($post_type, $all_postypes))
580 580
         return false;
581 581
 
582
-    $table = $plugin_prefix . $post_type . '_detail';
582
+    $table = $plugin_prefix.$post_type.'_detail';
583 583
 
584 584
     /**
585 585
      * Apply Filter to change Post info
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
      * @since 1.0.0
590 590
      * @package GeoDirectory
591 591
      */
592
-    $query = apply_filters('geodir_post_info_query', $wpdb->prepare("SELECT p.*,pd.* FROM " . $wpdb->posts . " p," . $table . " pd
592
+    $query = apply_filters('geodir_post_info_query', $wpdb->prepare("SELECT p.*,pd.* FROM ".$wpdb->posts." p,".$table." pd
593 593
 			  WHERE p.ID = pd.post_id
594 594
 			  AND pd.post_id = %d", $post_id));
595 595
 
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 
653 653
         $post_type = get_post_type($post_id);
654 654
 
655
-        $table = $plugin_prefix . $post_type . '_detail';
655
+        $table = $plugin_prefix.$post_type.'_detail';
656 656
 
657 657
         /**
658 658
          * Filter to change Post info
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 
674 674
             $columns = $wpdb->get_col("show columns from $table");
675 675
             foreach ($postmeta as $mkey => $mval) {
676
-                if(in_array($mkey,$columns)) {
676
+                if (in_array($mkey, $columns)) {
677 677
                     if (is_array($mval)) {
678 678
                         $mval = implode(",", $mval);
679 679
                     }
@@ -702,12 +702,12 @@  discard block
 block discarded – undo
702 702
              */
703 703
             do_action('geodir_before_save_listinginfo', $postinfo_array, $post_id);
704 704
 
705
-            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
705
+            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".$table." where post_id = %d", array($post_id)))) {
706 706
 
707 707
                 $query_string_array[] = $post_id;
708 708
                 $wpdb->query(
709 709
                     $wpdb->prepare(
710
-                        "UPDATE " . $table . " SET " . $query_string_escaped . " where post_id =%d",
710
+                        "UPDATE ".$table." SET ".$query_string_escaped." where post_id =%d",
711 711
                         $query_string_array
712 712
                     )
713 713
                 );
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
                 array_unshift($query_string_array, $post_id);
719 719
                 $wpdb->query(
720 720
                     $wpdb->prepare(
721
-                        "INSERT INTO " . $table . " SET post_id = %d," . $query_string_escaped,
721
+                        "INSERT INTO ".$table." SET post_id = %d,".$query_string_escaped,
722 722
                         $query_string_array
723 723
                     )
724 724
                 );
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 
765 765
         $post_type = get_post_type($post_id);
766 766
 
767
-        $table = $plugin_prefix . $post_type . '_detail';
767
+        $table = $plugin_prefix.$post_type.'_detail';
768 768
 
769 769
         if ($postmeta != '' && geodir_column_exist($table, $postmeta) && $post_id) {
770 770
 
@@ -772,11 +772,11 @@  discard block
 block discarded – undo
772 772
                 $meta_value = implode(",", $meta_value);
773 773
             }
774 774
 
775
-            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
775
+            if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".$table." where post_id = %d", array($post_id)))) {
776 776
 
777 777
                 $wpdb->query(
778 778
                     $wpdb->prepare(
779
-                        "UPDATE " . $table . " SET " . $postmeta . " = '" . $meta_value . "' where post_id =%d",
779
+                        "UPDATE ".$table." SET ".$postmeta." = '".$meta_value."' where post_id =%d",
780 780
                         array($post_id)
781 781
                     )
782 782
                 );
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 
786 786
                 $wpdb->query(
787 787
                     $wpdb->prepare(
788
-                        "INSERT INTO " . $table . " SET post_id = %d, " . $postmeta . " = '" . $meta_value . "'",
788
+                        "INSERT INTO ".$table." SET post_id = %d, ".$postmeta." = '".$meta_value."'",
789 789
                         array($post_id)
790 790
                     )
791 791
                 );
@@ -818,14 +818,14 @@  discard block
 block discarded – undo
818 818
 
819 819
         $post_type = get_post_type($post_id);
820 820
 
821
-        $table = $plugin_prefix . $post_type . '_detail';
821
+        $table = $plugin_prefix.$post_type.'_detail';
822 822
 
823 823
         if (is_array($postmeta) && !empty($postmeta) && $post_id) {
824 824
             $post_meta_set_query = '';
825 825
 
826 826
             foreach ($postmeta as $mkey) {
827 827
                 if ($mval != '')
828
-                    $post_meta_set_query .= $mkey . " = '', ";
828
+                    $post_meta_set_query .= $mkey." = '', ";
829 829
             }
830 830
 
831 831
             $post_meta_set_query = trim($post_meta_set_query, ", ");
@@ -834,11 +834,11 @@  discard block
 block discarded – undo
834 834
                 return false;
835 835
             }
836 836
 
837
-            if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
837
+            if ($wpdb->get_var("SHOW COLUMNS FROM ".$table." WHERE field = '".$postmeta."'") != '') {
838 838
 
839 839
                 $wpdb->query(
840 840
                     $wpdb->prepare(
841
-                        "UPDATE " . $table . " SET " . $post_meta_set_query . " where post_id = %d",
841
+                        "UPDATE ".$table." SET ".$post_meta_set_query." where post_id = %d",
842 842
                         array($post_id)
843 843
                     )
844 844
                 );
@@ -847,11 +847,11 @@  discard block
 block discarded – undo
847 847
             }
848 848
 
849 849
         } elseif ($postmeta != '' && $post_id) {
850
-            if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $postmeta . "'") != '') {
850
+            if ($wpdb->get_var("SHOW COLUMNS FROM ".$table." WHERE field = '".$postmeta."'") != '') {
851 851
 
852 852
                 $wpdb->query(
853 853
                     $wpdb->prepare(
854
-                        "UPDATE " . $table . " SET " . $postmeta . "= '' where post_id = %d",
854
+                        "UPDATE ".$table." SET ".$postmeta."= '' where post_id = %d",
855 855
                         array($post_id)
856 856
                     )
857 857
                 );
@@ -893,10 +893,10 @@  discard block
 block discarded – undo
893 893
         if (!in_array($post_type, $all_postypes))
894 894
             return false;
895 895
 
896
-        $table = $plugin_prefix . $post_type . '_detail';
896
+        $table = $plugin_prefix.$post_type.'_detail';
897 897
 
898
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $table . " WHERE field = '" . $meta_key . "'") != '') {
899
-            $meta_value = $wpdb->get_var($wpdb->prepare("SELECT " . $meta_key . " from " . $table . " where post_id = %d", array($post_id)));
898
+        if ($wpdb->get_var("SHOW COLUMNS FROM ".$table." WHERE field = '".$meta_key."'") != '') {
899
+            $meta_value = $wpdb->get_var($wpdb->prepare("SELECT ".$meta_key." from ".$table." where post_id = %d", array($post_id)));
900 900
             if ($meta_value && $meta_value !== '') {
901 901
                 return maybe_serialize($meta_value);
902 902
             } else
@@ -929,13 +929,13 @@  discard block
 block discarded – undo
929 929
 
930 930
         $post_type = get_post_type($post_id);
931 931
 
932
-        $table = $plugin_prefix . $post_type . '_detail';
932
+        $table = $plugin_prefix.$post_type.'_detail';
933 933
 
934 934
         $post_images = geodir_get_images($post_id);
935 935
 
936 936
         $wpdb->query(
937 937
             $wpdb->prepare(
938
-                "UPDATE " . $table . " SET featured_image = '' where post_id =%d",
938
+                "UPDATE ".$table." SET featured_image = '' where post_id =%d",
939 939
                 array($post_id)
940 940
             )
941 941
         );
@@ -965,12 +965,12 @@  discard block
 block discarded – undo
965 965
                 $file_path = '';
966 966
                 /* --------- start ------- */
967 967
 
968
-                $split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
968
+                $split_img_path = explode(str_replace(array('http://', 'https://'), '', $uploads['baseurl']), str_replace(array('http://', 'https://'), '', $post_image[$m]));
969 969
 
970 970
                 $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
971 971
 
972 972
 
973
-                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE file=%s AND post_id = %d", array($split_img_file_path, $post_id)))) {
973
+                if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT ID FROM ".GEODIR_ATTACHMENT_TABLE." WHERE file=%s AND post_id = %d", array($split_img_file_path, $post_id)))) {
974 974
 
975 975
                     /* --------- end ------- */
976 976
                     $curr_img_url = $post_image[$m];
@@ -1014,7 +1014,7 @@  discard block
 block discarded – undo
1014 1014
                     // If the uploaded file is the right format
1015 1015
                     if (in_array($uploaded_file_type, $allowed_file_types)) {
1016 1016
                         if (!function_exists('wp_handle_upload')) {
1017
-                            require_once(ABSPATH . 'wp-admin/includes/file.php');
1017
+                            require_once(ABSPATH.'wp-admin/includes/file.php');
1018 1018
                         }
1019 1019
 
1020 1020
                         if (!is_dir($geodir_uploadpath)) {
@@ -1022,41 +1022,41 @@  discard block
 block discarded – undo
1022 1022
                         }
1023 1023
 
1024 1024
                         $external_img = false;
1025
-                        if (strpos( str_replace( array('http://','https://'),'',$curr_img_url ), str_replace(array('http://','https://'),'',$uploads['baseurl'] ) ) !== false) {
1025
+                        if (strpos(str_replace(array('http://', 'https://'), '', $curr_img_url), str_replace(array('http://', 'https://'), '', $uploads['baseurl'])) !== false) {
1026 1026
                         } else {
1027 1027
                             $external_img = true;
1028 1028
                         }
1029 1029
 
1030 1030
                         if ($dummy || $external_img) {
1031 1031
                             $uploaded_file = array();
1032
-                            $uploaded = (array)fetch_remote_file($curr_img_url);
1032
+                            $uploaded = (array) fetch_remote_file($curr_img_url);
1033 1033
 
1034 1034
                             if (isset($uploaded['error']) && empty($uploaded['error'])) {
1035 1035
                                 $new_name = basename($uploaded['file']);
1036 1036
                                 $uploaded_file = $uploaded;
1037
-                            }else{
1038
-                                print_r($uploaded);exit;
1037
+                            } else {
1038
+                                print_r($uploaded); exit;
1039 1039
                             }
1040 1040
                             $external_img = false;
1041 1041
                         } else {
1042
-                            $new_name = $post_id . '_' . $file_name;
1042
+                            $new_name = $post_id.'_'.$file_name;
1043 1043
 
1044 1044
                             if ($curr_img_dir == $sub_dir) {
1045
-                                $img_path = $geodir_uploadpath . '/' . $filename;
1046
-                                $img_url = $geodir_uploadurl . '/' . $filename;
1045
+                                $img_path = $geodir_uploadpath.'/'.$filename;
1046
+                                $img_url = $geodir_uploadurl.'/'.$filename;
1047 1047
                             } else {
1048
-                                $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
1049
-                                $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
1048
+                                $img_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename;
1049
+                                $img_url = $uploads['url'].'/temp_'.$current_user->data->ID.'/'.$filename;
1050 1050
                             }
1051 1051
 
1052 1052
                             $uploaded_file = '';
1053 1053
 
1054 1054
                             if (file_exists($img_path)) {
1055
-                                $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
1055
+                                $uploaded_file = copy($img_path, $geodir_uploadpath.'/'.$new_name);
1056 1056
                                 $file_path = '';
1057
-                            } else if (file_exists($uploads['basedir'] . $curr_img_dir . $filename)) {
1057
+                            } else if (file_exists($uploads['basedir'].$curr_img_dir.$filename)) {
1058 1058
                                 $uploaded_file = true;
1059
-                                $file_path = $curr_img_dir . '/' . $filename;
1059
+                                $file_path = $curr_img_dir.'/'.$filename;
1060 1060
                             }
1061 1061
 
1062 1062
                             if ($curr_img_dir != $geodir_uploaddir && file_exists($img_path))
@@ -1065,14 +1065,14 @@  discard block
 block discarded – undo
1065 1065
 
1066 1066
                         if (!empty($uploaded_file)) {
1067 1067
                             if (!isset($file_path) || !$file_path) {
1068
-                                $file_path = $sub_dir . '/' . $new_name;
1068
+                                $file_path = $sub_dir.'/'.$new_name;
1069 1069
                             }
1070 1070
 
1071
-                            $postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
1071
+                            $postcurr_images[] = str_replace(array('http://', 'https://'), '', $uploads['baseurl'].$file_path);
1072 1072
 
1073 1073
                             if ($menu_order == 1) {
1074 1074
 
1075
-                                $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
1075
+                                $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($file_path, $post_id)));
1076 1076
 
1077 1077
                             }
1078 1078
 
@@ -1090,12 +1090,12 @@  discard block
 block discarded – undo
1090 1090
 
1091 1091
                             foreach ($attachment as $key => $val) {
1092 1092
                                 if ($val != '')
1093
-                                    $attachment_set .= $key . " = '" . $val . "', ";
1093
+                                    $attachment_set .= $key." = '".$val."', ";
1094 1094
                             }
1095 1095
 
1096 1096
                             $attachment_set = trim($attachment_set, ", ");
1097 1097
 
1098
-                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
1098
+                            $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
1099 1099
 
1100 1100
                             $valid_file_ids[] = $wpdb->insert_id;
1101 1101
                         }
@@ -1106,17 +1106,17 @@  discard block
 block discarded – undo
1106 1106
                 } else {
1107 1107
                     $valid_file_ids[] = $find_image;
1108 1108
 
1109
-                    $postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
1109
+                    $postcurr_images[] = str_replace(array('http://', 'https://'), '', $post_image[$m]);
1110 1110
 
1111 1111
                     $wpdb->query(
1112 1112
                         $wpdb->prepare(
1113
-                            "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d where file =%s AND post_id =%d",
1113
+                            "UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order = %d where file =%s AND post_id =%d",
1114 1114
                             array($menu_order, $split_img_path[1], $post_id)
1115 1115
                         )
1116 1116
                     );
1117 1117
 
1118 1118
                     if ($menu_order == 1)
1119
-                        $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1119
+                        $wpdb->query($wpdb->prepare("UPDATE ".$table." SET featured_image = %s where post_id =%d", array($split_img_path[1], $post_id)));
1120 1120
 
1121 1121
                 }
1122 1122
 
@@ -1140,9 +1140,9 @@  discard block
 block discarded – undo
1140 1140
 
1141 1141
                 foreach ($post_images as $img) {
1142 1142
 
1143
-                    if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
1143
+                    if (!in_array(str_replace(array('http://', 'https://'), '', $img->src), $postcurr_images)) {
1144 1144
 
1145
-                        $invalid_files[] = (object)array('src' => $img->src);
1145
+                        $invalid_files[] = (object) array('src' => $img->src);
1146 1146
 
1147 1147
                     }
1148 1148
 
@@ -1150,12 +1150,12 @@  discard block
 block discarded – undo
1150 1150
 
1151 1151
             }
1152 1152
 
1153
-            $invalid_files = (object)$invalid_files;
1153
+            $invalid_files = (object) $invalid_files;
1154 1154
         }
1155 1155
 
1156 1156
         $remove_files[] = $post_id;
1157 1157
 
1158
-        $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE " . $valid_files_condition . " post_id = %d", $remove_files));
1158
+        $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ".$valid_files_condition." post_id = %d", $remove_files));
1159 1159
 
1160 1160
         if (!empty($invalid_files))
1161 1161
             geodir_remove_attachments($invalid_files);
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
 			rmdir($dirPath);
1196 1196
 	}	*/
1197 1197
 
1198
-    $dirname = $uploads_dir . '/temp_' . $current_user->ID;
1198
+    $dirname = $uploads_dir.'/temp_'.$current_user->ID;
1199 1199
     geodir_delete_directory($dirname);
1200 1200
 }
1201 1201
 
@@ -1217,10 +1217,10 @@  discard block
 block discarded – undo
1217 1217
         return false;
1218 1218
     while ($file = readdir($dir_handle)) {
1219 1219
         if ($file != "." && $file != "..") {
1220
-            if (!is_dir($dirname . "/" . $file))
1221
-                unlink($dirname . "/" . $file);
1220
+            if (!is_dir($dirname."/".$file))
1221
+                unlink($dirname."/".$file);
1222 1222
             else
1223
-                geodir_delete_directory($dirname . '/' . $file);
1223
+                geodir_delete_directory($dirname.'/'.$file);
1224 1224
         }
1225 1225
     }
1226 1226
     closedir($dir_handle);
@@ -1249,8 +1249,8 @@  discard block
 block discarded – undo
1249 1249
             foreach ($postcurr_images as $postimg) {
1250 1250
                 $image_name_arr = explode('/', $postimg->src);
1251 1251
                 $filename = end($image_name_arr);
1252
-                if (file_exists($uploads_dir . '/' . $filename))
1253
-                    unlink($uploads_dir . '/' . $filename);
1252
+                if (file_exists($uploads_dir.'/'.$filename))
1253
+                    unlink($uploads_dir.'/'.$filename);
1254 1254
             }
1255 1255
 
1256 1256
         } // endif
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
         }
1292 1292
 
1293 1293
         if (!in_array($post_type, geodir_get_posttypes())) {
1294
-            return false;// if not a GD CPT return;
1294
+            return false; // if not a GD CPT return;
1295 1295
         }
1296 1296
 
1297 1297
 
@@ -1299,22 +1299,22 @@  discard block
 block discarded – undo
1299 1299
          * Filter to force the list images to be smaller.
1300 1300
          * @since 1.6.18
1301 1301
          */
1302
-        if( $size=='list-thumb' && apply_filters('geodir_use_small_list_img',false) ){
1303
-            $fimg = get_the_post_thumbnail_url($post_id,'medium');
1304
-            if($fimg){
1302
+        if ($size == 'list-thumb' && apply_filters('geodir_use_small_list_img', false)) {
1303
+            $fimg = get_the_post_thumbnail_url($post_id, 'medium');
1304
+            if ($fimg) {
1305 1305
                 $uploads = wp_upload_dir(); 
1306 1306
                 $uploads_baseurl = $uploads['baseurl'];
1307
-                $file = str_replace($uploads_baseurl,'',$fimg);
1307
+                $file = str_replace($uploads_baseurl, '', $fimg);
1308 1308
             }
1309 1309
         }
1310 1310
 
1311
-        $table = $plugin_prefix . $post_type . '_detail';
1311
+        $table = $plugin_prefix.$post_type.'_detail';
1312 1312
 
1313 1313
         if (!$file) {
1314 1314
             if (isset($post->featured_image)) {
1315 1315
                 $file = $post->featured_image;
1316 1316
             } else {
1317
-                $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM " . $table . " WHERE post_id = %d", array($post_id)));
1317
+                $file = $wpdb->get_var($wpdb->prepare("SELECT featured_image FROM ".$table." WHERE post_id = %d", array($post_id)));
1318 1318
             }
1319 1319
         }
1320 1320
 
@@ -1333,7 +1333,7 @@  discard block
 block discarded – undo
1333 1333
 
1334 1334
             $file_name = $file_info['basename'];
1335 1335
 
1336
-            $uploads_url = $uploads_baseurl . $sub_dir;
1336
+            $uploads_url = $uploads_baseurl.$sub_dir;
1337 1337
             /*
1338 1338
              * Allows the filter of image src for such things as CDN change.
1339 1339
              *
@@ -1343,8 +1343,8 @@  discard block
 block discarded – undo
1343 1343
              * @param string $uploads_url The server upload directory url.
1344 1344
              * @param string $uploads_baseurl The uploads dir base url.
1345 1345
              */
1346
-            $img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1347
-            $img_arr['path'] = $uploads_path . '/' . $file_name;
1346
+            $img_arr['src'] = apply_filters('geodir_get_featured_image_src', $uploads_url.'/'.$file_name, $file_name, $uploads_url, $uploads_baseurl);
1347
+            $img_arr['path'] = $uploads_path.'/'.$file_name;
1348 1348
             $width = 0;
1349 1349
             $height = 0;
1350 1350
             if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
@@ -1387,7 +1387,7 @@  discard block
 block discarded – undo
1387 1387
                 $file_name = $file_info['basename'];
1388 1388
 
1389 1389
                 $img_arr['src'] = $default_img;
1390
-                $img_arr['path'] = $uploads_path . '/' . $file_name;
1390
+                $img_arr['path'] = $uploads_path.'/'.$file_name;
1391 1391
 
1392 1392
                 $width = 0;
1393 1393
                 $height = 0;
@@ -1404,7 +1404,7 @@  discard block
 block discarded – undo
1404 1404
         }
1405 1405
 
1406 1406
         if (!empty($img_arr))
1407
-            return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1407
+            return (object) $img_arr; //return (object)array( 'src' => $file_url, 'path' => $file_path );
1408 1408
         else
1409 1409
             return false;
1410 1410
     }
@@ -1467,7 +1467,7 @@  discard block
 block discarded – undo
1467 1467
 
1468 1468
         $arrImages = $wpdb->get_results(
1469 1469
             $wpdb->prepare(
1470
-                "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d" . $not_featured . " ORDER BY menu_order ASC, ID DESC $limit_q ",
1470
+                "SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d".$not_featured." ORDER BY menu_order ASC, ID DESC $limit_q ",
1471 1471
                 array('%image%', $post_id)
1472 1472
             )
1473 1473
         );
@@ -1493,7 +1493,7 @@  discard block
 block discarded – undo
1493 1493
 
1494 1494
                 $file_name = $file_info['basename'];
1495 1495
 
1496
-                $uploads_url = $uploads_baseurl . $sub_dir;
1496
+                $uploads_url = $uploads_baseurl.$sub_dir;
1497 1497
                 /*
1498 1498
                 * Allows the filter of image src for such things as CDN change.
1499 1499
                 *
@@ -1503,8 +1503,8 @@  discard block
 block discarded – undo
1503 1503
                 * @param string $uploads_url The server upload directory url.
1504 1504
                 * @param string $uploads_baseurl The uploads dir base url.
1505 1505
                 */
1506
-                $img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1507
-                $img_arr['path'] = $uploads_path . '/' . $file_name;
1506
+                $img_arr['src'] = apply_filters('geodir_get_images_src', $uploads_url.'/'.$file_name, $file_name, $uploads_url, $uploads_baseurl);
1507
+                $img_arr['path'] = $uploads_path.'/'.$file_name;
1508 1508
                 $width = 0;
1509 1509
                 $height = 0;
1510 1510
                 if (is_file($img_arr['path']) && file_exists($img_arr['path'])) {
@@ -1521,11 +1521,11 @@  discard block
 block discarded – undo
1521 1521
                 $img_arr['content'] = $attechment->content; // add the description to the array
1522 1522
                 $img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1.
1523 1523
 
1524
-                $return_arr[] = (object)$img_arr;
1524
+                $return_arr[] = (object) $img_arr;
1525 1525
 
1526 1526
                 $counter++;
1527 1527
             }
1528
-            return (object)$return_arr;
1528
+            return (object) $return_arr;
1529 1529
         } else if ($no_images) {
1530 1530
             $default_img = '';
1531 1531
             $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
@@ -1564,7 +1564,7 @@  discard block
 block discarded – undo
1564 1564
                 $img_arr['title'] = $file_info['filename']; // add the title to the array
1565 1565
                 $img_arr['content'] = $file_info['filename']; // add the description to the array
1566 1566
 
1567
-                $return_arr[] = (object)$img_arr;
1567
+                $return_arr[] = (object) $img_arr;
1568 1568
 
1569 1569
                 return $return_arr;
1570 1570
             } else
@@ -1591,8 +1591,8 @@  discard block
 block discarded – undo
1591 1591
 
1592 1592
         $html = '';
1593 1593
         if (!empty($request)) {
1594
-            if (!is_object($request)){
1595
-                $request = (object)$request;
1594
+            if (!is_object($request)) {
1595
+                $request = (object) $request;
1596 1596
             }
1597 1597
 
1598 1598
             if (isset($request->src) && !isset($request->path)) {
@@ -1606,7 +1606,7 @@  discard block
 block discarded – undo
1606 1606
             $img_no_http = str_replace(array("http://", "https://"), "", $request->path);
1607 1607
             $upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
1608 1608
             if (strpos($img_no_http, $upload_no_http) !== false) {
1609
-                $request->path = str_replace( $img_no_http,$upload_dir['basedir'], $request->path);
1609
+                $request->path = str_replace($img_no_http, $upload_dir['basedir'], $request->path);
1610 1610
             }
1611 1611
             
1612 1612
             $width = 0;
@@ -1621,7 +1621,7 @@  discard block
 block discarded – undo
1621 1621
             $image->width = $width;
1622 1622
             $image->height = $height;
1623 1623
 
1624
-            $max_size = (object)geodir_get_imagesize($size);
1624
+            $max_size = (object) geodir_get_imagesize($size);
1625 1625
 
1626 1626
             if (!is_wp_error($max_size)) {
1627 1627
                 if ($image->width) {
@@ -1633,15 +1633,15 @@  discard block
 block discarded – undo
1633 1633
                         $width_per = 100;
1634 1634
                 }
1635 1635
 
1636
-                if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
1637
-                    $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '"  /></div>';
1636
+                if (is_admin() && !isset($_REQUEST['geodir_ajax'])) {
1637
+                    $html = '<div class="geodir_thumbnail"><img style="max-height:'.$max_size->h.'px;" alt="place image" src="'.$image->src.'"  /></div>';
1638 1638
                 } else {
1639
-                    if($size=='widget-thumb' || !get_option('geodir_lazy_load',1)){
1640
-                        $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1641
-                    }else{
1639
+                    if ($size == 'widget-thumb' || !get_option('geodir_lazy_load', 1)) {
1640
+                        $html = '<div class="geodir_thumbnail" style="background-image:url(\''.$image->src.'\');"></div>';
1641
+                    } else {
1642 1642
                         //$html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1643 1643
                         //$html = '<div data-src="'.$image->src.'" class="geodir_thumbnail" ></div>';
1644
-                        $html = '<div data-src="'.str_replace(' ','%20',$image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>';
1644
+                        $html = '<div data-src="'.str_replace(' ', '%20', $image->src).'" class="geodir_thumbnail geodir_lazy_load_thumbnail" ></div>';
1645 1645
 
1646 1646
                     }
1647 1647
 
@@ -1677,15 +1677,15 @@  discard block
 block discarded – undo
1677 1677
 
1678 1678
         $post_type = get_post_type($post_id);
1679 1679
 
1680
-        $table = $plugin_prefix . $post_type . '_detail';
1680
+        $table = $plugin_prefix.$post_type.'_detail';
1681 1681
 
1682 1682
         if (in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_id)) {
1683 1683
 
1684
-            if ($taxonomy == $post_type . '_tags') {
1684
+            if ($taxonomy == $post_type.'_tags') {
1685 1685
                 if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
1686 1686
                     geodir_save_post_meta($post_id, 'post_tags', $terms);
1687 1687
                 }
1688
-            } elseif ($taxonomy == $post_type . 'category') {
1688
+            } elseif ($taxonomy == $post_type.'category') {
1689 1689
                 $srcharr = array('"', '\\');
1690 1690
                 $replarr = array("&quot;", '');
1691 1691
 
@@ -1707,7 +1707,7 @@  discard block
 block discarded – undo
1707 1707
 
1708 1708
                     $wpdb->get_var(
1709 1709
                         $wpdb->prepare(
1710
-                            "DELETE from " . GEODIR_ICON_TABLE . " WHERE cat_id NOT IN ($format) AND post_id = %d ",
1710
+                            "DELETE from ".GEODIR_ICON_TABLE." WHERE cat_id NOT IN ($format) AND post_id = %d ",
1711 1711
                             $cat_ids_array_del
1712 1712
                         )
1713 1713
                     );
@@ -1715,7 +1715,7 @@  discard block
 block discarded – undo
1715 1715
 
1716 1716
                     $post_term = $wpdb->get_col(
1717 1717
                         $wpdb->prepare(
1718
-                            "SELECT term_id FROM " . $wpdb->term_taxonomy . " WHERE term_taxonomy_id IN($format) GROUP BY term_id",
1718
+                            "SELECT term_id FROM ".$wpdb->term_taxonomy." WHERE term_taxonomy_id IN($format) GROUP BY term_id",
1719 1719
                             $cat_ids_array
1720 1720
                         )
1721 1721
                     );
@@ -1737,16 +1737,16 @@  discard block
 block discarded – undo
1737 1737
                         $lat = geodir_get_post_meta($post_id, 'post_latitude', true);
1738 1738
                         $lng = geodir_get_post_meta($post_id, 'post_longitude', true);
1739 1739
 
1740
-                        $timing = ' - ' . date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
1741
-                        $timing .= ' - ' . geodir_get_post_meta($post_id, 'st_time', true);
1740
+                        $timing = ' - '.date('D M j, Y', strtotime(geodir_get_post_meta($post_id, 'st_date', true)));
1741
+                        $timing .= ' - '.geodir_get_post_meta($post_id, 'st_time', true);
1742 1742
 
1743 1743
                         $json = '{';
1744
-                        $json .= '"id":"' . $post_id . '",';
1745
-                        $json .= '"lat_pos": "' . $lat . '",';
1746
-                        $json .= '"long_pos": "' . $lng . '",';
1747
-                        $json .= '"marker_id":"' . $post_id . '_' . $cat_id . '",';
1748
-                        $json .= '"icon":"' . $term_icon . '",';
1749
-                        $json .= '"group":"catgroup' . $cat_id . '"';
1744
+                        $json .= '"id":"'.$post_id.'",';
1745
+                        $json .= '"lat_pos": "'.$lat.'",';
1746
+                        $json .= '"long_pos": "'.$lng.'",';
1747
+                        $json .= '"marker_id":"'.$post_id.'_'.$cat_id.'",';
1748
+                        $json .= '"icon":"'.$term_icon.'",';
1749
+                        $json .= '"group":"catgroup'.$cat_id.'"';
1750 1750
                         $json .= '}';
1751 1751
 
1752 1752
 
@@ -1754,9 +1754,9 @@  discard block
 block discarded – undo
1754 1754
                             $post_marker_json = $json;
1755 1755
 
1756 1756
 
1757
-                        if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . GEODIR_ICON_TABLE . " WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
1757
+                        if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".GEODIR_ICON_TABLE." WHERE post_id = %d AND cat_id = %d", array($post_id, $cat_id)))) {
1758 1758
 
1759
-                            $json_query = $wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET
1759
+                            $json_query = $wpdb->prepare("UPDATE ".GEODIR_ICON_TABLE." SET
1760 1760
 										post_title = %s,
1761 1761
 										json = %s
1762 1762
 										WHERE post_id = %d AND cat_id = %d ",
@@ -1764,7 +1764,7 @@  discard block
 block discarded – undo
1764 1764
 
1765 1765
                         } else {
1766 1766
 
1767
-                            $json_query = $wpdb->prepare("INSERT INTO " . GEODIR_ICON_TABLE . " SET
1767
+                            $json_query = $wpdb->prepare("INSERT INTO ".GEODIR_ICON_TABLE." SET
1768 1768
 										post_id = %d,
1769 1769
 										post_title = %s,
1770 1770
 										cat_id = %d,
@@ -1782,17 +1782,17 @@  discard block
 block discarded – undo
1782 1782
                 if (!empty($post_term) && is_array($post_term)) {
1783 1783
                     $categories = implode(',', $post_term);
1784 1784
 
1785
-                    if ($categories != '' && $categories != 0) $categories = ',' . $categories . ',';
1785
+                    if ($categories != '' && $categories != 0) $categories = ','.$categories.',';
1786 1786
 
1787 1787
                     if (empty($post_marker_json))
1788 1788
                         $post_marker_json = isset($json) ? $json : '';
1789 1789
 
1790
-                    if ($wpdb->get_var($wpdb->prepare("SELECT post_id from " . $table . " where post_id = %d", array($post_id)))) {
1790
+                    if ($wpdb->get_var($wpdb->prepare("SELECT post_id from ".$table." where post_id = %d", array($post_id)))) {
1791 1791
 
1792 1792
                         $wpdb->query(
1793 1793
                             $wpdb->prepare(
1794
-                                "UPDATE " . $table . " SET
1795
-								" . $taxonomy . " = %s,
1794
+                                "UPDATE ".$table." SET
1795
+								" . $taxonomy." = %s,
1796 1796
 								marker_json = %s
1797 1797
 								where post_id = %d",
1798 1798
                                 array($categories, $post_marker_json, $post_id)
@@ -1813,7 +1813,7 @@  discard block
 block discarded – undo
1813 1813
 
1814 1814
                                     $wpdb->query(
1815 1815
                                         $wpdb->prepare(
1816
-                                            "UPDATE " . $table . " SET
1816
+                                            "UPDATE ".$table." SET
1817 1817
 											default_category = %s
1818 1818
 											where post_id = %d",
1819 1819
                                             array($categories[0], $post_id)
@@ -1838,9 +1838,9 @@  discard block
 block discarded – undo
1838 1838
 
1839 1839
                         $wpdb->query(
1840 1840
                             $wpdb->prepare(
1841
-                                "INSERT INTO " . $table . " SET
1841
+                                "INSERT INTO ".$table." SET
1842 1842
 								post_id = %d,
1843
-								" . $taxonomy . " = %s,
1843
+								" . $taxonomy." = %s,
1844 1844
 								marker_json = %s ",
1845 1845
 
1846 1846
                                 array($post_id, $categories, $post_marker_json)
@@ -1972,7 +1972,7 @@  discard block
 block discarded – undo
1972 1972
                                     } ?>"><img alt="bubble image" style="max-height:50px;"
1973 1973
                                                src="<?php echo $post_images[0]; ?>"/></a></div>
1974 1974
                             <?php
1975
-                            }else{
1975
+                            } else {
1976 1976
                                 echo '<div class="geodir-bubble_image"></div>';
1977 1977
                             }
1978 1978
                         } else {
@@ -1980,7 +1980,7 @@  discard block
 block discarded – undo
1980 1980
                                 ?>
1981 1981
                                 <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div>
1982 1982
                             <?php
1983
-                            }else{
1983
+                            } else {
1984 1984
                                 echo '<div class="geodir-bubble_image"></div>';
1985 1985
                             }
1986 1986
                         }
@@ -2010,7 +2010,7 @@  discard block
 block discarded – undo
2010 2010
                              * @param object $postinfo_obj The posts info as an object.
2011 2011
                              * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
2012 2012
                              */
2013
-                            do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
2013
+                            do_action('geodir_infowindow_meta_after', $postinfo_obj, $post_preview);
2014 2014
                             ?>
2015 2015
                         </div>
2016 2016
                         <?php
@@ -2020,9 +2020,9 @@  discard block
 block discarded – undo
2020 2020
                             <div class="geodir-bubble-meta-fade"></div>
2021 2021
                             <div class="geodir-bubble-meta-bottom">
2022 2022
                                 <?php if ($rating_star != '') { ?>
2023
-                                <span class="geodir-bubble-rating"><?php echo $rating_star;?></span>
2023
+                                <span class="geodir-bubble-rating"><?php echo $rating_star; ?></span>
2024 2024
                                 <?php } ?>
2025
-                                <span class="geodir-bubble-fav"><?php echo geodir_favourite_html($post_author, $ID);?></span>
2025
+                                <span class="geodir-bubble-fav"><?php echo geodir_favourite_html($post_author, $ID); ?></span>
2026 2026
                                 <span class="geodir-bubble-reviews">
2027 2027
                                     <a href="<?php echo get_comments_link($ID); ?>" class="geodir-pcomments"><i class="fa fa-comments"></i> <?php echo get_comments_number($ID); ?></a>
2028 2028
                                 </span>
@@ -2084,11 +2084,11 @@  discard block
 block discarded – undo
2084 2084
 
2085 2085
         $post_type = get_post_type($post_id);
2086 2086
 
2087
-        $table = $plugin_prefix . $post_type . '_detail';
2087
+        $table = $plugin_prefix.$post_type.'_detail';
2088 2088
 
2089 2089
         $wpdb->query(
2090 2090
             $wpdb->prepare(
2091
-                "UPDATE " . $table . " SET post_status=%s WHERE post_id=%d",
2091
+                "UPDATE ".$table." SET post_status=%s WHERE post_id=%d",
2092 2092
                 array($status, $post_id)
2093 2093
             )
2094 2094
         );
@@ -2160,18 +2160,18 @@  discard block
 block discarded – undo
2160 2160
 
2161 2161
         $post_type = get_post_type($post_id);
2162 2162
 
2163
-        $table = $plugin_prefix . $post_type . '_detail';
2163
+        $table = $plugin_prefix.$post_type.'_detail';
2164 2164
 
2165 2165
         $wpdb->query(
2166 2166
             $wpdb->prepare(
2167
-                "UPDATE " . $table . " SET `post_id` = %d WHERE `post_id` = %d",
2167
+                "UPDATE ".$table." SET `post_id` = %d WHERE `post_id` = %d",
2168 2168
                 array($updatingpost, $temppost)
2169 2169
             )
2170 2170
         );
2171 2171
 
2172 2172
         $wpdb->query(
2173 2173
             $wpdb->prepare(
2174
-                "UPDATE " . GEODIR_ICON_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2174
+                "UPDATE ".GEODIR_ICON_TABLE." SET `post_id` = %d WHERE `post_id` = %d",
2175 2175
                 array($updatingpost, $temppost)
2176 2176
             )
2177 2177
         );
@@ -2180,7 +2180,7 @@  discard block
 block discarded – undo
2180 2180
 
2181 2181
         $wpdb->query(
2182 2182
             $wpdb->prepare(
2183
-                "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET `post_id` = %d WHERE `post_id` = %d",
2183
+                "UPDATE ".GEODIR_ATTACHMENT_TABLE." SET `post_id` = %d WHERE `post_id` = %d",
2184 2184
                 array($updatingpost, $temppost)
2185 2185
             )
2186 2186
         );
@@ -2218,12 +2218,12 @@  discard block
 block discarded – undo
2218 2218
         if (!in_array($post_type, $all_postypes))
2219 2219
             return false;
2220 2220
 
2221
-        $table = $plugin_prefix . $post_type . '_detail';
2221
+        $table = $plugin_prefix.$post_type.'_detail';
2222 2222
 
2223 2223
         /* Delete custom post meta*/
2224 2224
         $wpdb->query(
2225 2225
             $wpdb->prepare(
2226
-                "DELETE FROM " . $table . " WHERE `post_id` = %d",
2226
+                "DELETE FROM ".$table." WHERE `post_id` = %d",
2227 2227
                 array($deleted_postid)
2228 2228
             )
2229 2229
         );
@@ -2232,7 +2232,7 @@  discard block
 block discarded – undo
2232 2232
 
2233 2233
         $wpdb->query(
2234 2234
             $wpdb->prepare(
2235
-                "DELETE FROM " . GEODIR_ICON_TABLE . " WHERE `post_id` = %d",
2235
+                "DELETE FROM ".GEODIR_ICON_TABLE." WHERE `post_id` = %d",
2236 2236
                 array($deleted_postid)
2237 2237
             )
2238 2238
         );
@@ -2242,7 +2242,7 @@  discard block
 block discarded – undo
2242 2242
 
2243 2243
         $wpdb->query(
2244 2244
             $wpdb->prepare(
2245
-                "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE `post_id` = %d",
2245
+                "DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE `post_id` = %d",
2246 2246
                 array($deleted_postid)
2247 2247
             )
2248 2248
         );
@@ -2314,7 +2314,7 @@  discard block
 block discarded – undo
2314 2314
          */
2315 2315
         do_action('geodir_before_add_from_favorite', $post_id);
2316 2316
 
2317
-        echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>';
2317
+        echo '<a href="javascript:void(0);" title="'.$remove_favourite_text.'" class="geodir-removetofav-icon" onclick="javascript:addToFavourite(\''.$post_id.'\',\'remove\');"><i class="'.$favourite_icon.'"></i> '.$unfavourite_text.'</a>';
2318 2318
 
2319 2319
         /**
2320 2320
          * Called after adding the post from favourites.
@@ -2393,7 +2393,7 @@  discard block
 block discarded – undo
2393 2393
          */
2394 2394
         do_action('geodir_before_remove_from_favorite', $post_id);
2395 2395
 
2396
-        echo '<a href="javascript:void(0);"  title="' . $add_favourite_text . '" class="geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>';
2396
+        echo '<a href="javascript:void(0);"  title="'.$add_favourite_text.'" class="geodir-addtofav-icon" onclick="javascript:addToFavourite(\''.$post_id.'\',\'add\');"><i class="'.$favourite_icon.'"></i> '.$favourite_text.'</a>';
2397 2397
 
2398 2398
         /**
2399 2399
          * Called after removing the post from favourites.
@@ -2488,24 +2488,24 @@  discard block
 block discarded – undo
2488 2488
             $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2489 2489
 
2490 2490
         if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2491
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
2491
+            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id; ?>"  ><a
2492 2492
                 class="geodir-removetofav-icon" href="javascript:void(0);"
2493
-                onclick="javascript:addToFavourite(<?php echo $post_id;?>,'remove');"
2494
-                title="<?php echo $remove_favourite_text;?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text;?>
2493
+                onclick="javascript:addToFavourite(<?php echo $post_id; ?>,'remove');"
2494
+                title="<?php echo $remove_favourite_text; ?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text; ?>
2495 2495
             </a>   </span><?php
2496 2496
 
2497 2497
         } else {
2498 2498
 
2499 2499
             if (!isset($current_user->data->ID) || $current_user->data->ID == '') {
2500
-                $script_text = 'javascript:window.location.href=\'' . geodir_login_url() . '\'';
2500
+                $script_text = 'javascript:window.location.href=\''.geodir_login_url().'\'';
2501 2501
             } else
2502
-                $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2502
+                $script_text = 'javascript:addToFavourite('.$post_id.',\'add\')';
2503 2503
 
2504
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2504
+            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id; ?>"><a class="geodir-addtofav-icon"
2505 2505
                                                                                         href="javascript:void(0);"
2506
-                                                                                        onclick="<?php echo $script_text;?>"
2507
-                                                                                        title="<?php echo $add_favourite_text;?>"><i
2508
-                    class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text;?></a></span>
2506
+                                                                                        onclick="<?php echo $script_text; ?>"
2507
+                                                                                        title="<?php echo $add_favourite_text; ?>"><i
2508
+                    class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text; ?></a></span>
2509 2509
         <?php }
2510 2510
     }
2511 2511
 }
@@ -2535,7 +2535,7 @@  discard block
 block discarded – undo
2535 2535
 
2536 2536
             $post_type = $taxonomy_obj->object_type[0];
2537 2537
 
2538
-            $table = $plugin_prefix . $post_type . '_detail';
2538
+            $table = $plugin_prefix.$post_type.'_detail';
2539 2539
 
2540 2540
             /**
2541 2541
              * Filter to modify the 'join' query
@@ -2558,8 +2558,8 @@  discard block
 block discarded – undo
2558 2558
             $where = apply_filters('geodir_cat_post_count_where', $where, $term);
2559 2559
 
2560 2560
             $count_query = "SELECT count(post_id) FROM
2561
-							" . $table . " as pd " . $join . "
2562
-							WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id . "'," . $term->taxonomy . ") " . $where;
2561
+							" . $table." as pd ".$join."
2562
+							WHERE pd.post_status='publish' AND FIND_IN_SET('" . $term->term_id."',".$term->taxonomy.") ".$where;
2563 2563
 
2564 2564
             $cat_post_count = $wpdb->get_var($count_query);
2565 2565
             if (empty($cat_post_count) || is_wp_error($cat_post_count))
@@ -2642,7 +2642,7 @@  discard block
 block discarded – undo
2642 2642
     global $post;
2643 2643
     $all_postypes = geodir_get_posttypes();
2644 2644
     if (is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
2645
-        return ' <a href="' . get_permalink($post->ID) . '">' . READ_MORE_TXT . '</a>';
2645
+        return ' <a href="'.get_permalink($post->ID).'">'.READ_MORE_TXT.'</a>';
2646 2646
     }
2647 2647
 
2648 2648
     return $more;
@@ -2669,14 +2669,14 @@  discard block
 block discarded – undo
2669 2669
     if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
2670 2670
 
2671 2671
         $geodir_post_type = geodir_get_taxonomy_posttype($taxonomy);
2672
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
2672
+        $table = $plugin_prefix.$geodir_post_type.'_detail';
2673 2673
 
2674 2674
         $path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']);
2675
-        $term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png';
2675
+        $term_icon = $path_parts['dirname'].'/cat_icon_'.$term_id.'.png';
2676 2676
 
2677 2677
         $posts = $wpdb->get_results(
2678 2678
             $wpdb->prepare(
2679
-                "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ",
2679
+                "SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM ".$table." WHERE FIND_IN_SET(%s,%1\$s ) ",
2680 2680
                 array($term_id, $taxonomy)
2681 2681
             )
2682 2682
         );
@@ -2688,19 +2688,19 @@  discard block
 block discarded – undo
2688 2688
                 $lng = $post_obj->post_longitude;
2689 2689
 
2690 2690
                 $json = '{';
2691
-                $json .= '"id":"' . $post_obj->post_id . '",';
2692
-                $json .= '"lat_pos": "' . $lat . '",';
2693
-                $json .= '"long_pos": "' . $lng . '",';
2694
-                $json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",';
2695
-                $json .= '"icon":"' . $term_icon . '",';
2696
-                $json .= '"group":"catgroup' . $term_id . '"';
2691
+                $json .= '"id":"'.$post_obj->post_id.'",';
2692
+                $json .= '"lat_pos": "'.$lat.'",';
2693
+                $json .= '"long_pos": "'.$lng.'",';
2694
+                $json .= '"marker_id":"'.$post_obj->post_id.'_'.$term_id.'",';
2695
+                $json .= '"icon":"'.$term_icon.'",';
2696
+                $json .= '"group":"catgroup'.$term_id.'"';
2697 2697
                 $json .= '}';
2698 2698
 
2699 2699
                 if ($post_obj->default_category == $term_id) {
2700 2700
 
2701 2701
                     $wpdb->query(
2702 2702
                         $wpdb->prepare(
2703
-                            "UPDATE " . $table . " SET marker_json = %s where post_id = %d",
2703
+                            "UPDATE ".$table." SET marker_json = %s where post_id = %d",
2704 2704
                             array($json, $post_obj->post_id)
2705 2705
                         )
2706 2706
                     );
@@ -2708,7 +2708,7 @@  discard block
 block discarded – undo
2708 2708
 
2709 2709
                 $wpdb->query(
2710 2710
                     $wpdb->prepare(
2711
-                        "UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d",
2711
+                        "UPDATE ".GEODIR_ICON_TABLE." SET json = %s WHERE post_id = %d AND cat_id = %d",
2712 2712
                         array($json, $post_obj->post_id, $term_id)
2713 2713
                     )
2714 2714
                 );
@@ -2832,7 +2832,7 @@  discard block
 block discarded – undo
2832 2832
 //	print_r($uploads ) ;
2833 2833
     $post_first_image = $wpdb->get_results(
2834 2834
         $wpdb->prepare(
2835
-            "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d and menu_order = 1  ", array($post_id)
2835
+            "SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d and menu_order = 1  ", array($post_id)
2836 2836
         )
2837 2837
     );
2838 2838
 
@@ -2853,9 +2853,9 @@  discard block
 block discarded – undo
2853 2853
 
2854 2854
         $post_type = get_post_type($post_id);
2855 2855
 
2856
-        $table_name = $plugin_prefix . $post_type . '_detail';
2856
+        $table_name = $plugin_prefix.$post_type.'_detail';
2857 2857
 
2858
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='" . $post_first_image[0]->file . "' WHERE post_id =" . $post_id);
2858
+        $wpdb->query("UPDATE ".$table_name." SET featured_image='".$post_first_image[0]->file."' WHERE post_id =".$post_id);
2859 2859
 
2860 2860
         $new_attachment_name = basename($post_first_image[0]->file);
2861 2861
 
@@ -2868,11 +2868,11 @@  discard block
 block discarded – undo
2868 2868
                 wp_delete_attachment($post_thumbnail_id);
2869 2869
 
2870 2870
             }
2871
-            $filename = $uploads['basedir'] . $post_first_image[0]->file;
2871
+            $filename = $uploads['basedir'].$post_first_image[0]->file;
2872 2872
 
2873 2873
             $attachment = array(
2874 2874
                 'post_mime_type' => $post_first_image[0]->mime_type,
2875
-                'guid' => $uploads['baseurl'] . $post_first_image[0]->file,
2875
+                'guid' => $uploads['baseurl'].$post_first_image[0]->file,
2876 2876
                 'post_parent' => $post_id,
2877 2877
                 'post_title' => preg_replace('/\.[^.]+$/', '', $post_first_image[0]->title),
2878 2878
                 'post_content' => ''
@@ -2885,7 +2885,7 @@  discard block
 block discarded – undo
2885 2885
 
2886 2886
                 set_post_thumbnail($post_id, $id);
2887 2887
 
2888
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
2888
+                require_once(ABSPATH.'wp-admin/includes/image.php');
2889 2889
                 wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
2890 2890
 
2891 2891
             }
@@ -2918,35 +2918,35 @@  discard block
 block discarded – undo
2918 2918
         $post_id = absint($_POST['post_id']);
2919 2919
         $upload_dir = wp_upload_dir();
2920 2920
         $post_type = get_post_type($_POST['post_id']);
2921
-        $table = $plugin_prefix . $post_type . '_detail';
2921
+        $table = $plugin_prefix.$post_type.'_detail';
2922 2922
 
2923 2923
         $post_arr = $wpdb->get_results($wpdb->prepare(
2924
-            "SELECT * FROM $wpdb->posts p JOIN " . $table . " gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1",
2924
+            "SELECT * FROM $wpdb->posts p JOIN ".$table." gd ON gd.post_id=p.ID WHERE p.ID=%d LIMIT 1",
2925 2925
             array($post_id)
2926 2926
         )
2927 2927
             , ARRAY_A);
2928 2928
 
2929 2929
         $arrImages = $wpdb->get_results(
2930 2930
             $wpdb->prepare(
2931
-                "SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ",
2931
+                "SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC, ID DESC ",
2932 2932
                 array('%image%', $post_id)
2933 2933
             )
2934 2934
         );
2935 2935
         if ($arrImages) {
2936 2936
             $image_arr = array();
2937 2937
             foreach ($arrImages as $img) {
2938
-                $image_arr[] = $upload_dir['baseurl'] . $img->file;
2938
+                $image_arr[] = $upload_dir['baseurl'].$img->file;
2939 2939
             }
2940 2940
             $comma_separated = implode(",", $image_arr);
2941 2941
             $post_arr[0]['post_images'] = $comma_separated;
2942 2942
         }
2943 2943
 
2944 2944
 
2945
-        $cats = $post_arr[0][$post_arr[0]['post_type'] . 'category'];
2945
+        $cats = $post_arr[0][$post_arr[0]['post_type'].'category'];
2946 2946
         $cat_arr = array_filter(explode(",", $cats));
2947 2947
         $trans_cat = array();
2948 2948
         foreach ($cat_arr as $cat) {
2949
-            $trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'] . 'category', false);
2949
+            $trans_cat[] = icl_object_id($cat, $post_arr[0]['post_type'].'category', false);
2950 2950
         }
2951 2951
 
2952 2952
 
@@ -2988,7 +2988,7 @@  discard block
 block discarded – undo
2988 2988
 
2989 2989
     $get_data = $wpdb->get_results(
2990 2990
         $wpdb->prepare(
2991
-            "SELECT htmlvar_name, field_type, extra_fields FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1'",
2991
+            "SELECT htmlvar_name, field_type, extra_fields FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND is_active='1'",
2992 2992
             array($listing_type)
2993 2993
         )
2994 2994
     );
@@ -3001,12 +3001,12 @@  discard block
 block discarded – undo
3001 3001
 
3002 3002
                 $extra_fields = unserialize($data->extra_fields);
3003 3003
 
3004
-                $prefix = $data->htmlvar_name . '_';
3004
+                $prefix = $data->htmlvar_name.'_';
3005 3005
 
3006
-                $fields_info[$prefix . 'address'] = $data->field_type;
3006
+                $fields_info[$prefix.'address'] = $data->field_type;
3007 3007
 
3008 3008
                 if (isset($extra_fields['show_zip']) && $extra_fields['show_zip'])
3009
-                    $fields_info[$prefix . 'zip'] = $data->field_type;
3009
+                    $fields_info[$prefix.'zip'] = $data->field_type;
3010 3010
 
3011 3011
             } else {
3012 3012
 
@@ -3104,13 +3104,13 @@  discard block
 block discarded – undo
3104 3104
  * @since 1.4.9
3105 3105
  * @package GeoDirectory
3106 3106
  */
3107
-function geodir_fb_like_thumbnail(){
3107
+function geodir_fb_like_thumbnail() {
3108 3108
 
3109 3109
     // return if not a single post
3110
-    if(!is_single()){return;}
3110
+    if (!is_single()) {return; }
3111 3111
 
3112 3112
     global $post;
3113
-    if(isset($post->featured_image) && $post->featured_image){
3113
+    if (isset($post->featured_image) && $post->featured_image) {
3114 3114
         $upload_dir = wp_upload_dir();
3115 3115
         $thumb = $upload_dir['baseurl'].$post->featured_image;
3116 3116
         echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n";
Please login to merge, or discard this patch.
geodirectory-functions/custom_functions.php 2 patches
Indentation   +298 added lines, -298 removed lines patch added patch discarded remove patch
@@ -2363,10 +2363,10 @@  discard block
 block discarded – undo
2363 2363
 	?>
2364 2364
 	<input class="search_text" name="s"
2365 2365
 	       value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) {
2366
-		       echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2367
-	       } else {
2368
-		       echo $default_search_for_text;
2369
-	       } ?>" type="text"
2366
+			   echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2367
+		   } else {
2368
+			   echo $default_search_for_text;
2369
+		   } ?>" type="text"
2370 2370
 	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}"
2371 2371
 	       onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}"
2372 2372
 	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);">
@@ -2493,11 +2493,11 @@  discard block
 block discarded – undo
2493 2493
  * @return True if WPML is active else False.
2494 2494
  */
2495 2495
 function geodir_is_wpml() {
2496
-    if (function_exists('icl_object_id')) {
2497
-        return true;
2498
-    }
2496
+	if (function_exists('icl_object_id')) {
2497
+		return true;
2498
+	}
2499 2499
 
2500
-    return false;
2500
+	return false;
2501 2501
 }
2502 2502
 
2503 2503
 /**
@@ -2512,9 +2512,9 @@  discard block
 block discarded – undo
2512 2512
  * @return Language code.
2513 2513
  */
2514 2514
 function geodir_get_language_for_element($element_id, $element_type) {
2515
-    global $sitepress;
2515
+	global $sitepress;
2516 2516
 
2517
-    return $sitepress->get_language_for_element($element_id, $element_type);
2517
+	return $sitepress->get_language_for_element($element_id, $element_type);
2518 2518
 }
2519 2519
 
2520 2520
 /**
@@ -2531,31 +2531,31 @@  discard block
 block discarded – undo
2531 2531
  *                         Added to fix duplicate translation for front end.
2532 2532
  */
2533 2533
 function geodir_icl_make_duplicate($master_post_id, $lang, $postarr, $tr_post_id, $after_save = false) {
2534
-    global $sitepress;
2534
+	global $sitepress;
2535 2535
     
2536
-    $post_type = get_post_type($master_post_id);
2537
-    $icl_ajx_action = !empty($_REQUEST['icl_ajx_action']) && $_REQUEST['icl_ajx_action'] == 'make_duplicates' ? true : false;
2538
-    if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpml_duplicate_dashboard' && !empty($_REQUEST['duplicate_post_ids'])) {
2539
-        $icl_ajx_action = true;
2540
-    }
2536
+	$post_type = get_post_type($master_post_id);
2537
+	$icl_ajx_action = !empty($_REQUEST['icl_ajx_action']) && $_REQUEST['icl_ajx_action'] == 'make_duplicates' ? true : false;
2538
+	if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpml_duplicate_dashboard' && !empty($_REQUEST['duplicate_post_ids'])) {
2539
+		$icl_ajx_action = true;
2540
+	}
2541 2541
     
2542
-    if (in_array($post_type, geodir_get_posttypes())) {
2543
-        if ($icl_ajx_action || $after_save) {
2544
-            // Duplicate post details
2545
-            geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang);
2542
+	if (in_array($post_type, geodir_get_posttypes())) {
2543
+		if ($icl_ajx_action || $after_save) {
2544
+			// Duplicate post details
2545
+			geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang);
2546 2546
             
2547
-            // Duplicate taxonomies
2548
-            geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang);
2547
+			// Duplicate taxonomies
2548
+			geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang);
2549 2549
             
2550
-            // Duplicate post images
2551
-            geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang);
2552
-        }
2550
+			// Duplicate post images
2551
+			geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang);
2552
+		}
2553 2553
         
2554
-        // Sync post reviews
2555
-        if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2556
-            geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang);
2557
-        }
2558
-    }
2554
+		// Sync post reviews
2555
+		if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2556
+			geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang);
2557
+		}
2558
+	}
2559 2559
 }
2560 2560
 add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 );
2561 2561
 
@@ -2569,18 +2569,18 @@  discard block
 block discarded – undo
2569 2569
  * @param array $request_info The post details in an array.
2570 2570
  */
2571 2571
 function geodir_wpml_duplicate_listing($post_id, $request_info) {
2572
-    global $sitepress;
2572
+	global $sitepress;
2573 2573
     
2574
-    $icl_ajx_action = !empty($_REQUEST['icl_ajx_action']) && $_REQUEST['icl_ajx_action'] == 'make_duplicates' ? true : false;
2575
-    if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpml_duplicate_dashboard' && !empty($_REQUEST['duplicate_post_ids'])) {
2576
-        $icl_ajx_action = true;
2577
-    }
2574
+	$icl_ajx_action = !empty($_REQUEST['icl_ajx_action']) && $_REQUEST['icl_ajx_action'] == 'make_duplicates' ? true : false;
2575
+	if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpml_duplicate_dashboard' && !empty($_REQUEST['duplicate_post_ids'])) {
2576
+		$icl_ajx_action = true;
2577
+	}
2578 2578
     
2579
-    if (!$icl_ajx_action && in_array(get_post_type($post_id), geodir_get_posttypes()) && $post_duplicates = $sitepress->get_duplicates($post_id)) {
2580
-        foreach ($post_duplicates as $lang => $dup_post_id) {
2581
-            geodir_icl_make_duplicate($post_id, $lang, $request_info, $dup_post_id, true);
2582
-        }
2583
-    }
2579
+	if (!$icl_ajx_action && in_array(get_post_type($post_id), geodir_get_posttypes()) && $post_duplicates = $sitepress->get_duplicates($post_id)) {
2580
+		foreach ($post_duplicates as $lang => $dup_post_id) {
2581
+			geodir_icl_make_duplicate($post_id, $lang, $request_info, $dup_post_id, true);
2582
+		}
2583
+	}
2584 2584
 }
2585 2585
 
2586 2586
 /**
@@ -2596,17 +2596,17 @@  discard block
 block discarded – undo
2596 2596
  * @return bool True for success, False for fail.
2597 2597
  */
2598 2598
 function geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang) {
2599
-    global $wpdb;
2599
+	global $wpdb;
2600 2600
 
2601
-    $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2601
+	$reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2602 2602
 
2603
-    if (!empty($reviews)) {
2604
-        foreach ($reviews as $review) {
2605
-            geodir_wpml_duplicate_post_review($review['comment_id'], $master_post_id, $tr_post_id, $lang);
2606
-        }
2607
-    }
2603
+	if (!empty($reviews)) {
2604
+		foreach ($reviews as $review) {
2605
+			geodir_wpml_duplicate_post_review($review['comment_id'], $master_post_id, $tr_post_id, $lang);
2606
+		}
2607
+	}
2608 2608
 
2609
-    return false;
2609
+	return false;
2610 2610
 }
2611 2611
 
2612 2612
 /**
@@ -2623,22 +2623,22 @@  discard block
 block discarded – undo
2623 2623
  * @return bool True for success, False for fail.
2624 2624
  */
2625 2625
 function geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang) {
2626
-    global $wpdb, $plugin_prefix;
2626
+	global $wpdb, $plugin_prefix;
2627 2627
 
2628
-    $post_type = get_post_type($master_post_id);
2629
-    $post_table = $plugin_prefix . $post_type . '_detail';
2628
+	$post_type = get_post_type($master_post_id);
2629
+	$post_table = $plugin_prefix . $post_type . '_detail';
2630 2630
 
2631
-    $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
2632
-    $data = (array)$wpdb->get_row($query);
2631
+	$query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
2632
+	$data = (array)$wpdb->get_row($query);
2633 2633
 
2634
-    if ( !empty( $data ) ) {
2635
-        $data['post_id'] = $tr_post_id;
2636
-        unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category']);
2637
-        $wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
2638
-        return true;
2639
-    }
2634
+	if ( !empty( $data ) ) {
2635
+		$data['post_id'] = $tr_post_id;
2636
+		unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category']);
2637
+		$wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
2638
+		return true;
2639
+	}
2640 2640
 
2641
-    return false;
2641
+	return false;
2642 2642
 }
2643 2643
 
2644 2644
 /**
@@ -2655,40 +2655,40 @@  discard block
 block discarded – undo
2655 2655
  * @return bool True for success, False for fail.
2656 2656
  */
2657 2657
 function geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang) {
2658
-    global $sitepress, $wpdb;
2659
-    $post_type = get_post_type($master_post_id);
2658
+	global $sitepress, $wpdb;
2659
+	$post_type = get_post_type($master_post_id);
2660 2660
 
2661
-    remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
2661
+	remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
2662 2662
 
2663
-    $taxonomies = get_object_taxonomies($post_type);
2664
-    foreach ($taxonomies as $taxonomy) {
2665
-        $terms = get_the_terms($master_post_id, $taxonomy);
2666
-        $terms_array = array();
2663
+	$taxonomies = get_object_taxonomies($post_type);
2664
+	foreach ($taxonomies as $taxonomy) {
2665
+		$terms = get_the_terms($master_post_id, $taxonomy);
2666
+		$terms_array = array();
2667 2667
         
2668
-        if ($terms) {
2669
-            foreach ($terms as $term) {
2670
-                $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
2668
+		if ($terms) {
2669
+			foreach ($terms as $term) {
2670
+				$tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
2671 2671
                 
2672
-                if (!is_null($tr_id)){
2673
-                    // not using get_term - unfiltered get_term
2674
-                    $translated_term = $wpdb->get_row($wpdb->prepare("
2672
+				if (!is_null($tr_id)){
2673
+					// not using get_term - unfiltered get_term
2674
+					$translated_term = $wpdb->get_row($wpdb->prepare("
2675 2675
                         SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
2676 2676
 
2677
-                    $terms_array[] = $translated_term->term_id;
2678
-                }
2679
-            }
2677
+					$terms_array[] = $translated_term->term_id;
2678
+				}
2679
+			}
2680 2680
 
2681
-            if (!is_taxonomy_hierarchical($taxonomy)){
2682
-                $terms_array = array_unique( array_map( 'intval', $terms_array ) );
2683
-            }
2681
+			if (!is_taxonomy_hierarchical($taxonomy)){
2682
+				$terms_array = array_unique( array_map( 'intval', $terms_array ) );
2683
+			}
2684 2684
 
2685
-            wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
2685
+			wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
2686 2686
             
2687
-            if ($taxonomy == $post_type . 'category') {
2688
-                geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
2689
-            }
2690
-        }
2691
-    }
2687
+			if ($taxonomy == $post_type . 'category') {
2688
+				geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
2689
+			}
2690
+		}
2691
+	}
2692 2692
 }
2693 2693
 
2694 2694
 /**
@@ -2704,29 +2704,29 @@  discard block
 block discarded – undo
2704 2704
  * @return bool True for success, False for fail.
2705 2705
  */
2706 2706
 function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) {
2707
-    global $wpdb;
2707
+	global $wpdb;
2708 2708
 
2709
-    $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2710
-    $wpdb->query($query);
2709
+	$query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2710
+	$wpdb->query($query);
2711 2711
 
2712
-    $query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2713
-    $post_images = $wpdb->get_results($query);
2712
+	$query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2713
+	$post_images = $wpdb->get_results($query);
2714 2714
 
2715
-    if ( !empty( $post_images ) ) {
2716
-        foreach ( $post_images as $post_image) {
2717
-            $image_data = (array)$post_image;
2718
-            unset($image_data['ID']);
2719
-            $image_data['post_id'] = $tr_post_id;
2715
+	if ( !empty( $post_images ) ) {
2716
+		foreach ( $post_images as $post_image) {
2717
+			$image_data = (array)$post_image;
2718
+			unset($image_data['ID']);
2719
+			$image_data['post_id'] = $tr_post_id;
2720 2720
             
2721
-            $wpdb->insert(GEODIR_ATTACHMENT_TABLE, $image_data);
2721
+			$wpdb->insert(GEODIR_ATTACHMENT_TABLE, $image_data);
2722 2722
             
2723
-            geodir_set_wp_featured_image($tr_post_id);
2724
-        }
2723
+			geodir_set_wp_featured_image($tr_post_id);
2724
+		}
2725 2725
         
2726
-        return true;
2727
-    }
2726
+		return true;
2727
+	}
2728 2728
 
2729
-    return false;
2729
+	return false;
2730 2730
 }
2731 2731
 
2732 2732
 
@@ -2745,73 +2745,73 @@  discard block
 block discarded – undo
2745 2745
  * @return bool True for success, False for fail.
2746 2746
  */
2747 2747
 function geodir_wpml_duplicate_post_review($master_comment_id, $master_post_id, $tr_post_id, $lang) {
2748
-    global $wpdb, $plugin_prefix, $sitepress;
2749
-
2750
-    $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2751
-
2752
-    if (empty($review)) {
2753
-        return false;
2754
-    }
2755
-    if ($review['post_id'] != $master_post_id) {
2756
-        $wpdb->query($wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2757
-        geodir_update_postrating($master_post_id, $post_type);
2758
-    }
2759
-
2760
-    $tr_comment_id = geodir_wpml_duplicate_comment_exists($tr_post_id, $master_comment_id);
2761
-
2762
-    if (empty($tr_comment_id)) {
2763
-        return false;
2764
-    }
2765
-
2766
-    $post_type = get_post_type($master_post_id);
2767
-    $post_table = $plugin_prefix . $post_type . '_detail';
2768
-
2769
-    $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM " . $post_table . " WHERE post_id = %d", $tr_post_id), ARRAY_A);
2770
-    if (empty($translated_post)) {
2771
-        return false;
2772
-    }
2773
-
2774
-    $review['comment_id'] = $tr_comment_id;
2775
-    $review['post_id'] = $tr_post_id;
2776
-    $review['post_title'] = $translated_post['post_title'];
2777
-    $review['post_city'] = $translated_post['post_city'];
2778
-    $review['post_region'] = $translated_post['post_region'];
2779
-    $review['post_country'] = $translated_post['post_country'];
2780
-    $review['post_latitude'] = $translated_post['post_latitude'];
2781
-    $review['post_longitude'] = $translated_post['post_longitude'];
2782
-
2783
-    if (isset($review['id'])) {
2784
-        unset($review['id']);
2785
-    }
2786
-
2787
-    $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2788
-
2789
-    if ($tr_review_id) { // update review
2790
-        $wpdb->update(GEODIR_REVIEW_TABLE, $review, array('id' => $tr_review_id));
2791
-    } else { // insert review
2792
-        $wpdb->insert(GEODIR_REVIEW_TABLE, $review);
2793
-        $tr_review_id = $wpdb->insert_id;
2794
-    }
2795
-
2796
-    if ($tr_post_id) {
2797
-        geodir_update_postrating($tr_post_id, $post_type);
2748
+	global $wpdb, $plugin_prefix, $sitepress;
2749
+
2750
+	$review = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2751
+
2752
+	if (empty($review)) {
2753
+		return false;
2754
+	}
2755
+	if ($review['post_id'] != $master_post_id) {
2756
+		$wpdb->query($wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2757
+		geodir_update_postrating($master_post_id, $post_type);
2758
+	}
2759
+
2760
+	$tr_comment_id = geodir_wpml_duplicate_comment_exists($tr_post_id, $master_comment_id);
2761
+
2762
+	if (empty($tr_comment_id)) {
2763
+		return false;
2764
+	}
2765
+
2766
+	$post_type = get_post_type($master_post_id);
2767
+	$post_table = $plugin_prefix . $post_type . '_detail';
2768
+
2769
+	$translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM " . $post_table . " WHERE post_id = %d", $tr_post_id), ARRAY_A);
2770
+	if (empty($translated_post)) {
2771
+		return false;
2772
+	}
2773
+
2774
+	$review['comment_id'] = $tr_comment_id;
2775
+	$review['post_id'] = $tr_post_id;
2776
+	$review['post_title'] = $translated_post['post_title'];
2777
+	$review['post_city'] = $translated_post['post_city'];
2778
+	$review['post_region'] = $translated_post['post_region'];
2779
+	$review['post_country'] = $translated_post['post_country'];
2780
+	$review['post_latitude'] = $translated_post['post_latitude'];
2781
+	$review['post_longitude'] = $translated_post['post_longitude'];
2782
+
2783
+	if (isset($review['id'])) {
2784
+		unset($review['id']);
2785
+	}
2786
+
2787
+	$tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2788
+
2789
+	if ($tr_review_id) { // update review
2790
+		$wpdb->update(GEODIR_REVIEW_TABLE, $review, array('id' => $tr_review_id));
2791
+	} else { // insert review
2792
+		$wpdb->insert(GEODIR_REVIEW_TABLE, $review);
2793
+		$tr_review_id = $wpdb->insert_id;
2794
+	}
2795
+
2796
+	if ($tr_post_id) {
2797
+		geodir_update_postrating($tr_post_id, $post_type);
2798 2798
         
2799
-        if (defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_review') && $sitepress->get_setting('sync_comments_on_duplicates')) {
2800
-            $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id = %d", array($tr_comment_id)));
2801
-            $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2802
-
2803
-            if (!empty($likes)) {
2804
-                foreach ($likes as $like) {
2805
-                    unset($like['like_id']);
2806
-                    $like['comment_id'] = $tr_comment_id;
2799
+		if (defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_review') && $sitepress->get_setting('sync_comments_on_duplicates')) {
2800
+			$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id = %d", array($tr_comment_id)));
2801
+			$likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2802
+
2803
+			if (!empty($likes)) {
2804
+				foreach ($likes as $like) {
2805
+					unset($like['like_id']);
2806
+					$like['comment_id'] = $tr_comment_id;
2807 2807
                     
2808
-                    $wpdb->insert(GEODIR_COMMENTS_REVIEWS_TABLE, $like);
2809
-                }
2810
-            }
2811
-        }
2812
-    }
2808
+					$wpdb->insert(GEODIR_COMMENTS_REVIEWS_TABLE, $like);
2809
+				}
2810
+			}
2811
+		}
2812
+	}
2813 2813
 
2814
-    return $tr_review_id;
2814
+	return $tr_review_id;
2815 2815
 }
2816 2816
 
2817 2817
 /**
@@ -2826,36 +2826,36 @@  discard block
 block discarded – undo
2826 2826
  * @param int $comment_id The Comment ID.
2827 2827
  */
2828 2828
 function gepdir_wpml_sync_comment($comment_id) {
2829
-    global $wpdb, $sitepress, $gd_wpml_posttypes;
2830
-
2831
-    if (empty($gd_post_types)) {
2832
-        $gd_wpml_posttypes = geodir_get_posttypes();
2833
-    }
2834
-
2835
-    $comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->comments} WHERE comment_ID=%d", $comment_id), ARRAY_A);
2836
-    if (empty($comment)) {
2837
-        return;
2838
-    }
2839
-
2840
-    $post_id = $comment['comment_post_ID'];
2841
-    $post_type = $post_id ? get_post_type($post_id) : NULL;
2842
-
2843
-    if (!($post_type && in_array($post_type, $gd_wpml_posttypes))) {
2844
-        return;
2845
-    }
2846
-
2847
-    $post_duplicates = $sitepress->get_duplicates($post_id);
2848
-    if (empty($post_duplicates)) {
2849
-        return;
2850
-    }
2851
-
2852
-    foreach ($post_duplicates as $lang => $dup_post_id) {
2853
-        if (empty($comment['comment_parent'])) {
2854
-            geodir_wpml_duplicate_post_review($comment_id, $post_id, $dup_post_id, $lang);
2855
-        }
2856
-    }
2829
+	global $wpdb, $sitepress, $gd_wpml_posttypes;
2830
+
2831
+	if (empty($gd_post_types)) {
2832
+		$gd_wpml_posttypes = geodir_get_posttypes();
2833
+	}
2834
+
2835
+	$comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->comments} WHERE comment_ID=%d", $comment_id), ARRAY_A);
2836
+	if (empty($comment)) {
2837
+		return;
2838
+	}
2839
+
2840
+	$post_id = $comment['comment_post_ID'];
2841
+	$post_type = $post_id ? get_post_type($post_id) : NULL;
2842
+
2843
+	if (!($post_type && in_array($post_type, $gd_wpml_posttypes))) {
2844
+		return;
2845
+	}
2846
+
2847
+	$post_duplicates = $sitepress->get_duplicates($post_id);
2848
+	if (empty($post_duplicates)) {
2849
+		return;
2850
+	}
2851
+
2852
+	foreach ($post_duplicates as $lang => $dup_post_id) {
2853
+		if (empty($comment['comment_parent'])) {
2854
+			geodir_wpml_duplicate_post_review($comment_id, $post_id, $dup_post_id, $lang);
2855
+		}
2856
+	}
2857 2857
     
2858
-    return true;
2858
+	return true;
2859 2859
 }
2860 2860
 
2861 2861
 /**
@@ -2870,11 +2870,11 @@  discard block
 block discarded – undo
2870 2870
  * @return int The duplicate comment ID.
2871 2871
  */
2872 2872
 function geodir_wpml_duplicate_comment_exists($dup_post_id, $original_cid) {
2873
-    global $wpdb;
2873
+	global $wpdb;
2874 2874
 
2875
-    $duplicate = $wpdb->get_var(
2876
-        $wpdb->prepare(
2877
-            "   SELECT comm.comment_ID
2875
+	$duplicate = $wpdb->get_var(
2876
+		$wpdb->prepare(
2877
+			"   SELECT comm.comment_ID
2878 2878
                 FROM {$wpdb->comments} comm
2879 2879
                 JOIN {$wpdb->commentmeta} cm
2880 2880
                     ON comm.comment_ID = cm.comment_id
@@ -2882,12 +2882,12 @@  discard block
 block discarded – undo
2882 2882
                     AND cm.meta_key = '_icl_duplicate_of'
2883 2883
                     AND cm.meta_value = %d
2884 2884
                 LIMIT 1",
2885
-            $dup_post_id,
2886
-            $original_cid
2887
-        )
2888
-    );
2885
+			$dup_post_id,
2886
+			$original_cid
2887
+		)
2888
+	);
2889 2889
 
2890
-    return $duplicate;
2890
+	return $duplicate;
2891 2891
 }
2892 2892
 
2893 2893
 /**
@@ -2959,7 +2959,7 @@  discard block
 block discarded – undo
2959 2959
  * @return bool True if Yoast SEO disabled on GD pages.
2960 2960
  */
2961 2961
 function geodir_disable_yoast_seo_metas() {
2962
-    return (bool)get_option( 'geodir_disable_yoast_meta' );
2962
+	return (bool)get_option( 'geodir_disable_yoast_meta' );
2963 2963
 }
2964 2964
 
2965 2965
 /**
@@ -2971,39 +2971,39 @@  discard block
 block discarded – undo
2971 2971
  * @return bool True if allowed.
2972 2972
  */
2973 2973
 function geodir_wpml_allowed_to_duplicate( $post_id ) {
2974
-    $allowed = false;
2974
+	$allowed = false;
2975 2975
     
2976
-    if ( !geodir_is_wpml() || empty( $post_id ) ) {
2977
-        return $allowed;
2978
-    }
2976
+	if ( !geodir_is_wpml() || empty( $post_id ) ) {
2977
+		return $allowed;
2978
+	}
2979 2979
     
2980
-    $user_id = (int)get_current_user_id();
2980
+	$user_id = (int)get_current_user_id();
2981 2981
     
2982
-    if ( empty( $user_id ) ) {
2983
-        return $allowed;
2984
-    }
2982
+	if ( empty( $user_id ) ) {
2983
+		return $allowed;
2984
+	}
2985 2985
     
2986
-    $post_type = get_post_type( $post_id );
2987
-    if ( !is_post_type_translated( $post_type ) || get_post_meta( $post_id, '_icl_lang_duplicate_of', true ) ) {
2988
-        return $allowed;
2989
-    }
2986
+	$post_type = get_post_type( $post_id );
2987
+	if ( !is_post_type_translated( $post_type ) || get_post_meta( $post_id, '_icl_lang_duplicate_of', true ) ) {
2988
+		return $allowed;
2989
+	}
2990 2990
     
2991
-    if ( geodir_listing_belong_to_current_user( $post_id ) ) {
2992
-        $allowed = true;
2993
-    }
2991
+	if ( geodir_listing_belong_to_current_user( $post_id ) ) {
2992
+		$allowed = true;
2993
+	}
2994 2994
     
2995
-    $disable_cpts = get_option( 'geodir_wpml_disable_duplicate' );
2996
-    if ( $allowed && !empty( $disable_cpts ) && in_array( $post_type, $disable_cpts ) ) {
2997
-        $allowed = false;
2998
-    }
2995
+	$disable_cpts = get_option( 'geodir_wpml_disable_duplicate' );
2996
+	if ( $allowed && !empty( $disable_cpts ) && in_array( $post_type, $disable_cpts ) ) {
2997
+		$allowed = false;
2998
+	}
2999 2999
     
3000
-    /**
3001
-     * Filter the user allowed to duplicate listing or not for WPML.
3002
-     *
3003
-     * @param bool $allowed True if allowed.
3004
-     * @param int $post_id The post ID.
3005
-     */
3006
-    return apply_filters( 'geodir_wpml_allowed_to_duplicate', $allowed, $post_id );
3000
+	/**
3001
+	 * Filter the user allowed to duplicate listing or not for WPML.
3002
+	 *
3003
+	 * @param bool $allowed True if allowed.
3004
+	 * @param int $post_id The post ID.
3005
+	 */
3006
+	return apply_filters( 'geodir_wpml_allowed_to_duplicate', $allowed, $post_id );
3007 3007
 }
3008 3008
 
3009 3009
 /**
@@ -3019,71 +3019,71 @@  discard block
 block discarded – undo
3019 3019
  * @return string Filtered html of the geodir_edit_post_link() function.
3020 3020
  */
3021 3021
 function geodir_wpml_frontend_duplicate_listing( $content_html ) {
3022
-    global $post, $preview, $sitepress;
3022
+	global $post, $preview, $sitepress;
3023 3023
     
3024
-    if ( !empty( $post->ID ) && !$preview && geodir_is_page( 'detail' ) && geodir_wpml_allowed_to_duplicate( $post->ID ) ) {
3025
-        $post_id = $post->ID;
3026
-        $element_type = 'post_' . get_post_type( $post_id );
3027
-        $original_post_id = $sitepress->get_original_element_id( $post_id, $element_type );
3024
+	if ( !empty( $post->ID ) && !$preview && geodir_is_page( 'detail' ) && geodir_wpml_allowed_to_duplicate( $post->ID ) ) {
3025
+		$post_id = $post->ID;
3026
+		$element_type = 'post_' . get_post_type( $post_id );
3027
+		$original_post_id = $sitepress->get_original_element_id( $post_id, $element_type );
3028 3028
         
3029
-        if ( $original_post_id == $post_id ) {
3030
-            $wpml_languages = $sitepress->get_active_languages();
3031
-            $post_language = $sitepress->get_language_for_element( $post_id, $element_type );
3029
+		if ( $original_post_id == $post_id ) {
3030
+			$wpml_languages = $sitepress->get_active_languages();
3031
+			$post_language = $sitepress->get_language_for_element( $post_id, $element_type );
3032 3032
             
3033
-            if ( !empty( $wpml_languages ) && isset( $wpml_languages[ $post_language ] ) ) {
3034
-                unset( $wpml_languages[ $post_language ] );
3035
-            }
3033
+			if ( !empty( $wpml_languages ) && isset( $wpml_languages[ $post_language ] ) ) {
3034
+				unset( $wpml_languages[ $post_language ] );
3035
+			}
3036 3036
             
3037
-            if ( !empty( $wpml_languages ) ) {
3038
-                $trid  = $sitepress->get_element_trid( $post_id, $element_type );
3039
-                $element_translations = $sitepress->get_element_translations( $trid, $element_type );
3040
-                $duplicates = $sitepress->get_duplicates( $post_id );
3037
+			if ( !empty( $wpml_languages ) ) {
3038
+				$trid  = $sitepress->get_element_trid( $post_id, $element_type );
3039
+				$element_translations = $sitepress->get_element_translations( $trid, $element_type );
3040
+				$duplicates = $sitepress->get_duplicates( $post_id );
3041 3041
                 
3042
-                $wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">' . __( 'Translate Listing', 'geodirectory' ) . '</h3>';
3043
-                $wpml_content .= '<table class="gd-duplicate-table" style="width:100%;margin:0"><tbody>';
3044
-                $wpml_content .= '<tr style="border-bottom:solid 1px #efefef"><th style="padding:0 2px 2px 2px">' . __( 'Language', 'geodirectory' ) . '</th><th style="width:25px;"></th><th style="width:5em;text-align:center">' . __( 'Translate', 'geodirectory' ) . '</th></tr>';
3042
+				$wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">' . __( 'Translate Listing', 'geodirectory' ) . '</h3>';
3043
+				$wpml_content .= '<table class="gd-duplicate-table" style="width:100%;margin:0"><tbody>';
3044
+				$wpml_content .= '<tr style="border-bottom:solid 1px #efefef"><th style="padding:0 2px 2px 2px">' . __( 'Language', 'geodirectory' ) . '</th><th style="width:25px;"></th><th style="width:5em;text-align:center">' . __( 'Translate', 'geodirectory' ) . '</th></tr>';
3045 3045
                 
3046
-                $needs_translation = false;
3046
+				$needs_translation = false;
3047 3047
                 
3048
-                foreach ( $wpml_languages as $lang_code => $lang ) {
3049
-                    $duplicates_text = '';
3050
-                    $translated = false;
3048
+				foreach ( $wpml_languages as $lang_code => $lang ) {
3049
+					$duplicates_text = '';
3050
+					$translated = false;
3051 3051
                     
3052
-                    if ( !empty( $element_translations ) && isset( $element_translations[$lang_code] ) ) {
3053
-                        $translated = true;
3052
+					if ( !empty( $element_translations ) && isset( $element_translations[$lang_code] ) ) {
3053
+						$translated = true;
3054 3054
                         
3055
-                        if ( !empty( $duplicates ) && isset( $duplicates[$lang_code] ) ) {
3056
-                            $duplicates_text = ' ' . __( '(duplicate)', 'geodirectory' );
3057
-                        }
3058
-                    } else {
3059
-                        $needs_translation = true;
3060
-                    }
3055
+						if ( !empty( $duplicates ) && isset( $duplicates[$lang_code] ) ) {
3056
+							$duplicates_text = ' ' . __( '(duplicate)', 'geodirectory' );
3057
+						}
3058
+					} else {
3059
+						$needs_translation = true;
3060
+					}
3061 3061
                     
3062
-                    $wpml_content .= '<tr><td style="padding:4px">' . $lang['english_name'] . $duplicates_text . '</td><td>&nbsp;</td><td style="text-align:center;">';
3062
+					$wpml_content .= '<tr><td style="padding:4px">' . $lang['english_name'] . $duplicates_text . '</td><td>&nbsp;</td><td style="text-align:center;">';
3063 3063
                     
3064
-                    if ( $translated ) {
3065
-                        $wpml_content .= '<i class="fa fa-check" style="color:orange"></i>';
3066
-                    } else {
3067
-                        $wpml_content .= '<input name="gd_icl_dup[]" value="' . $lang_code . '" title="' . esc_attr__( 'Create duplicate', 'geodirectory' ) . '" type="checkbox">';
3068
-                    }
3064
+					if ( $translated ) {
3065
+						$wpml_content .= '<i class="fa fa-check" style="color:orange"></i>';
3066
+					} else {
3067
+						$wpml_content .= '<input name="gd_icl_dup[]" value="' . $lang_code . '" title="' . esc_attr__( 'Create duplicate', 'geodirectory' ) . '" type="checkbox">';
3068
+					}
3069 3069
                     
3070
-                    $wpml_content .= '</td></tr>';
3071
-                }
3070
+					$wpml_content .= '</td></tr>';
3071
+				}
3072 3072
                 
3073
-                if ( $needs_translation ) {
3074
-                    $nonce = wp_create_nonce( 'geodir_duplicate_nonce' );
3075
-                    $wpml_content .= '<tr><td>&nbsp;</td><td style="vertical-align:middle;padding-top:13px"><i style="display:none" class="fa fa-spin fa-refresh"></i></td><td style="padding:15px 3px 3px 3px;text-align:right"><button data-nonce="' . esc_attr( $nonce ) . '" data-post-id="' . $post_id . '" id="gd_make_duplicates" class="button-secondary">' . __( 'Duplicate', 'geodirectory' ) . '</button></td></tr>';
3076
-                }
3073
+				if ( $needs_translation ) {
3074
+					$nonce = wp_create_nonce( 'geodir_duplicate_nonce' );
3075
+					$wpml_content .= '<tr><td>&nbsp;</td><td style="vertical-align:middle;padding-top:13px"><i style="display:none" class="fa fa-spin fa-refresh"></i></td><td style="padding:15px 3px 3px 3px;text-align:right"><button data-nonce="' . esc_attr( $nonce ) . '" data-post-id="' . $post_id . '" id="gd_make_duplicates" class="button-secondary">' . __( 'Duplicate', 'geodirectory' ) . '</button></td></tr>';
3076
+				}
3077 3077
                 
3078
-                $wpml_content .= '</tbody></table>';
3079
-                $wpml_content .= '</div>';
3078
+				$wpml_content .= '</tbody></table>';
3079
+				$wpml_content .= '</div>';
3080 3080
                 
3081
-                $content_html .= $wpml_content;
3082
-            }
3083
-        }
3084
-    }
3081
+				$content_html .= $wpml_content;
3082
+			}
3083
+		}
3084
+	}
3085 3085
     
3086
-    return $content_html;
3086
+	return $content_html;
3087 3087
 }
3088 3088
 
3089 3089
 /**
@@ -3095,26 +3095,26 @@  discard block
 block discarded – undo
3095 3095
  * @return array Filtered GD design settings array..
3096 3096
  */
3097 3097
 function geodir_wpml_duplicate_settings( $settings = array() ) {
3098
-    $new_settings = array();
3098
+	$new_settings = array();
3099 3099
     
3100
-    foreach ( $settings as $key => $setting ) {
3100
+	foreach ( $settings as $key => $setting ) {
3101 3101
         
3102
-        if ( isset( $setting['type'] ) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings' ) {
3103
-            $new_settings[] = array(
3104
-                'name' => __('Disable WPML duplicate translation', 'geodirectory'),
3105
-                'desc' => __('Select post types to disable front end WPML duplicate translation. For selected post types the WPML duplicate option will be disabled from listing detail page sidebar.', 'geodirectory'),
3106
-                'tip' => '',
3107
-                'id' => 'geodir_wpml_disable_duplicate',
3108
-                'css' => 'min-width:300px;',
3109
-                'std' => '',
3110
-                'type' => 'multiselect',
3111
-                'placeholder_text' => __('Select post types', 'geodirectory'),
3112
-                'class' => 'chosen_select',
3113
-                'options' => array_unique(geodir_post_type_setting_fun())
3114
-            );
3115
-        }
3116
-        $new_settings[] = $setting;
3117
-    }
3102
+		if ( isset( $setting['type'] ) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings' ) {
3103
+			$new_settings[] = array(
3104
+				'name' => __('Disable WPML duplicate translation', 'geodirectory'),
3105
+				'desc' => __('Select post types to disable front end WPML duplicate translation. For selected post types the WPML duplicate option will be disabled from listing detail page sidebar.', 'geodirectory'),
3106
+				'tip' => '',
3107
+				'id' => 'geodir_wpml_disable_duplicate',
3108
+				'css' => 'min-width:300px;',
3109
+				'std' => '',
3110
+				'type' => 'multiselect',
3111
+				'placeholder_text' => __('Select post types', 'geodirectory'),
3112
+				'class' => 'chosen_select',
3113
+				'options' => array_unique(geodir_post_type_setting_fun())
3114
+			);
3115
+		}
3116
+		$new_settings[] = $setting;
3117
+	}
3118 3118
     
3119
-    return $new_settings;
3119
+	return $new_settings;
3120 3120
 }
3121 3121
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +706 added lines, -706 removed lines patch added patch discarded remove patch
@@ -52,31 +52,31 @@  discard block
 block discarded – undo
52 52
 				jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefourth', 'gridview_onefifth', 600);
53 53
 			}
54 54
 
55
-			jQuery.post("<?php echo geodir_get_ajax_url();?>&gd_listing_view=" + val, function (data) {
55
+			jQuery.post("<?php echo geodir_get_ajax_url(); ?>&gd_listing_view=" + val, function (data) {
56 56
 				//alert(data );
57 57
 			});
58 58
 		}
59 59
 	</script>
60 60
 	<div class="geodir-list-view-select">
61 61
 		<select name="gd_list_view" id="gd_list_view" onchange="geodir_list_view_select(this);">
62
-			<?php $listing_view = (int) $gd_session->get( 'gd_listing_view' ); ?>
63
-			<option value=""><?php _e( 'View:', 'geodirectory' ); ?></option>
62
+			<?php $listing_view = (int) $gd_session->get('gd_listing_view'); ?>
63
+			<option value=""><?php _e('View:', 'geodirectory'); ?></option>
64 64
 			<option
65
-				value="1" <?php selected( 1, $listing_view ); ?>><?php _e( 'View: List', 'geodirectory' ); ?></option>
65
+				value="1" <?php selected(1, $listing_view); ?>><?php _e('View: List', 'geodirectory'); ?></option>
66 66
 			<option
67
-				value="2" <?php selected( 2, $listing_view ); ?>><?php _e( 'View: Grid 2', 'geodirectory' ); ?></option>
67
+				value="2" <?php selected(2, $listing_view); ?>><?php _e('View: Grid 2', 'geodirectory'); ?></option>
68 68
 			<option
69
-				value="3" <?php selected( 3, $listing_view ); ?>><?php _e( 'View: Grid 3', 'geodirectory' ); ?></option>
69
+				value="3" <?php selected(3, $listing_view); ?>><?php _e('View: Grid 3', 'geodirectory'); ?></option>
70 70
 			<option
71
-				value="4" <?php selected( 4, $listing_view ); ?>><?php _e( 'View: Grid 4', 'geodirectory' ); ?></option>
71
+				value="4" <?php selected(4, $listing_view); ?>><?php _e('View: Grid 4', 'geodirectory'); ?></option>
72 72
 			<option
73
-				value="5" <?php selected( 5, $listing_view ); ?>><?php _e( 'View: Grid 5', 'geodirectory' ); ?></option>
73
+				value="5" <?php selected(5, $listing_view); ?>><?php _e('View: Grid 5', 'geodirectory'); ?></option>
74 74
 		</select>
75 75
 	</div>
76 76
 	<?php
77 77
 }
78 78
 
79
-add_action( 'geodir_before_listing', 'geodir_list_view_select', 100 );
79
+add_action('geodir_before_listing', 'geodir_list_view_select', 100);
80 80
 
81 81
 /**
82 82
  * Limit the listing excerpt.
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
  * @global object $post          The current post object.
92 92
  * @return string The modified excerpt.
93 93
  */
94
-function geodir_max_excerpt( $charlength ) {
94
+function geodir_max_excerpt($charlength) {
95 95
 	global $post;
96
-	if ( $charlength == '0' ) {
96
+	if ($charlength == '0') {
97 97
 		return;
98 98
 	}
99 99
 	$out = '';
@@ -101,46 +101,46 @@  discard block
 block discarded – undo
101 101
 	$temp_post = $post;
102 102
 	$excerpt   = get_the_excerpt();
103 103
 
104
-	$charlength ++;
105
-	$excerpt_more = function_exists( 'geodirf_excerpt_more' ) ? geodirf_excerpt_more( '' ) : geodir_excerpt_more( '' );
106
-	if ( geodir_utf8_strlen( $excerpt ) > $charlength ) {
107
-		if ( geodir_utf8_strlen( $excerpt_more ) > 0 && geodir_utf8_strpos( $excerpt, $excerpt_more ) !== false ) {
108
-			$excut = - ( geodir_utf8_strlen( $excerpt_more ) );
109
-			$subex = geodir_utf8_substr( $excerpt, 0, $excut );
110
-			if ( $charlength > 0 && geodir_utf8_strlen( $subex ) > $charlength ) {
111
-				$subex = geodir_utf8_substr( $subex, 0, $charlength );
104
+	$charlength++;
105
+	$excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more('');
106
+	if (geodir_utf8_strlen($excerpt) > $charlength) {
107
+		if (geodir_utf8_strlen($excerpt_more) > 0 && geodir_utf8_strpos($excerpt, $excerpt_more) !== false) {
108
+			$excut = - (geodir_utf8_strlen($excerpt_more));
109
+			$subex = geodir_utf8_substr($excerpt, 0, $excut);
110
+			if ($charlength > 0 && geodir_utf8_strlen($subex) > $charlength) {
111
+				$subex = geodir_utf8_substr($subex, 0, $charlength);
112 112
 			}
113 113
 			$out .= $subex;
114 114
 		} else {
115
-			$subex   = geodir_utf8_substr( $excerpt, 0, $charlength - 5 );
116
-			$exwords = explode( ' ', $subex );
117
-			$excut   = - ( geodir_utf8_strlen( $exwords[ count( $exwords ) - 1 ] ) );
118
-			if ( $excut < 0 ) {
119
-				$out .= geodir_utf8_substr( $subex, 0, $excut );
115
+			$subex   = geodir_utf8_substr($excerpt, 0, $charlength - 5);
116
+			$exwords = explode(' ', $subex);
117
+			$excut   = - (geodir_utf8_strlen($exwords[count($exwords) - 1]));
118
+			if ($excut < 0) {
119
+				$out .= geodir_utf8_substr($subex, 0, $excut);
120 120
 			} else {
121 121
 				$out .= $subex;
122 122
 			}
123 123
 		}
124
-		$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
124
+		$out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">';
125 125
 		/**
126 126
 		 * Filter excerpt read more text.
127 127
 		 *
128 128
 		 * @since 1.0.0
129 129
 		 */
130
-		$out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) );
130
+		$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
131 131
 		$out .= '</a>';
132 132
 
133 133
 	} else {
134
-		if ( geodir_utf8_strlen( $excerpt_more ) > 0 && geodir_utf8_strpos( $excerpt, $excerpt_more ) !== false ) {
135
-			$excut = - ( geodir_utf8_strlen( $excerpt_more ) );
136
-			$out .= geodir_utf8_substr( $excerpt, 0, $excut );
137
-			$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
134
+		if (geodir_utf8_strlen($excerpt_more) > 0 && geodir_utf8_strpos($excerpt, $excerpt_more) !== false) {
135
+			$excut = - (geodir_utf8_strlen($excerpt_more));
136
+			$out .= geodir_utf8_substr($excerpt, 0, $excut);
137
+			$out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">';
138 138
 			/**
139 139
 			 * Filter excerpt read more text.
140 140
 			 *
141 141
 			 * @since 1.0.0
142 142
 			 */
143
-			$out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) );
143
+			$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
144 144
 			$out .= '</a>';
145 145
 		} else {
146 146
 			$out .= $excerpt;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
  *
164 164
  * @return object Returns filtered package info as an object.
165 165
  */
166
-function geodir_post_package_info( $package_info, $post = '', $post_type = '' ) {
166
+function geodir_post_package_info($package_info, $post = '', $post_type = '') {
167 167
 	$package_info['pid']              = 0;
168 168
 	$package_info['days']             = 0;
169 169
 	$package_info['amount']           = 0;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 * @param object|string $post  The post object.
193 193
 	 * @param string $post_type    The post type.
194 194
 	 */
195
-	return (object) apply_filters( 'geodir_post_package_info', $package_info, $post, $post_type );
195
+	return (object) apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
196 196
 
197 197
 }
198 198
 
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
  *
221 221
  * }
222 222
  */
223
-function geodir_send_inquiry( $request ) {
223
+function geodir_send_inquiry($request) {
224 224
 	global $wpdb;
225 225
 
226 226
 	// strip slashes from text
227
-	$request = ! empty( $request ) ? stripslashes_deep( $request ) : $request;
227
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
228 228
 
229 229
 	$yourname      = $request['inq_name'];
230 230
 	$youremail     = $request['inq_email'];
@@ -235,26 +235,26 @@  discard block
 block discarded – undo
235 235
 	$author_id  = '';
236 236
 	$post_title = '';
237 237
 
238
-	if ( $request['pid'] ) {
238
+	if ($request['pid']) {
239 239
 
240 240
 		$productinfosql = $wpdb->prepare(
241 241
 			"select ID,post_author,post_title from $wpdb->posts where ID =%d",
242
-			array( $request['pid'] )
242
+			array($request['pid'])
243 243
 		);
244
-		$productinfo    = $wpdb->get_row( $productinfosql );
244
+		$productinfo = $wpdb->get_row($productinfosql);
245 245
 
246 246
 		$author_id  = $productinfo->post_author;
247 247
 		$post_title = $productinfo->post_title;
248 248
 	}
249 249
 
250
-	$post_title = '<a href="' . get_permalink( $pid ) . '">' . $post_title . '</a>';
250
+	$post_title = '<a href="'.get_permalink($pid).'">'.$post_title.'</a>';
251 251
 
252
-	$user_info = get_userdata( $author_id );
253
-	$to_email  = geodir_get_post_meta( $pid, 'geodir_email', true );
254
-	$to_name   = geodir_get_client_name( $author_id );
252
+	$user_info = get_userdata($author_id);
253
+	$to_email  = geodir_get_post_meta($pid, 'geodir_email', true);
254
+	$to_name   = geodir_get_client_name($author_id);
255 255
 
256
-	if ( $to_email == '' ) {
257
-		$to_email = get_option( 'admin_email' );
256
+	if ($to_email == '') {
257
+		$to_email = get_option('admin_email');
258 258
 	}
259 259
 
260 260
 	/**
@@ -275,10 +275,10 @@  discard block
 block discarded – undo
275 275
 	 * }
276 276
 	 * @param string $type     The form type, default: `Enquiry`.
277 277
 	 */
278
-	do_action( 'geodir_after_send_enquiry', $request, 'Enquiry' );
278
+	do_action('geodir_after_send_enquiry', $request, 'Enquiry');
279 279
 
280 280
 	$client_message = $frnd_comments;
281
-	$client_message .= '<br>' . __( 'From :', 'geodirectory' ) . ' ' . $yourname . '<br>' . __( 'Phone :', 'geodirectory' ) . ' ' . $inq_phone . '<br>' . __( 'Email :', 'geodirectory' ) . ' ' . $youremail . '<br><br>' . __( 'Sent from', 'geodirectory' ) . ' - <b><a href="' . trailingslashit( home_url() ) . '">' . get_option( 'blogname' ) . '</a></b>.';
281
+	$client_message .= '<br>'.__('From :', 'geodirectory').' '.$yourname.'<br>'.__('Phone :', 'geodirectory').' '.$inq_phone.'<br>'.__('Email :', 'geodirectory').' '.$youremail.'<br><br>'.__('Sent from', 'geodirectory').' - <b><a href="'.trailingslashit(home_url()).'">'.get_option('blogname').'</a></b>.';
282 282
 	/**
283 283
 	 * Filter client message text.
284 284
 	 *
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 *
287 287
 	 * @param string $client_message Client message text.
288 288
 	 */
289
-	$client_message = apply_filters( 'geodir_inquiry_email_msg', $client_message );
289
+	$client_message = apply_filters('geodir_inquiry_email_msg', $client_message);
290 290
 
291 291
 	/**
292 292
 	 * Called before the send enquiry email is sent.
@@ -305,12 +305,12 @@  discard block
 block discarded – undo
305 305
 	 *
306 306
 	 * }
307 307
 	 */
308
-	do_action( 'geodir_before_send_enquiry_email', $request );
309
-	if ( $to_email ) {
308
+	do_action('geodir_before_send_enquiry_email', $request);
309
+	if ($to_email) {
310 310
 		// strip slashes message
311
-		$client_message = stripslashes_deep( $client_message );
311
+		$client_message = stripslashes_deep($client_message);
312 312
 
313
-		geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid'] );//To client email
313
+		geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']); //To client email
314 314
 	}
315 315
 
316 316
 	/**
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
 	 *
331 331
 	 * }
332 332
 	 */
333
-	do_action( 'geodir_after_send_enquiry_email', $request );
334
-	$url = get_permalink( $pid );
335
-	if ( strstr( $url, '?' ) ) {
336
-		$url = $url . "&send_inquiry=success";
333
+	do_action('geodir_after_send_enquiry_email', $request);
334
+	$url = get_permalink($pid);
335
+	if (strstr($url, '?')) {
336
+		$url = $url."&send_inquiry=success";
337 337
 	} else {
338
-		$url = $url . "?send_inquiry=success";
338
+		$url = $url."?send_inquiry=success";
339 339
 	}
340 340
 	/**
341 341
 	 * Filter redirect url after the send enquiry email is sent.
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
 	 *
345 345
 	 * @param string $url Redirect url.
346 346
 	 */
347
-	$url = apply_filters( 'geodir_send_enquiry_after_submit_redirect', $url );
348
-	wp_redirect( $url );
347
+	$url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url);
348
+	wp_redirect($url);
349 349
 	gd_die();
350 350
 
351 351
 }
@@ -374,11 +374,11 @@  discard block
 block discarded – undo
374 374
  * }
375 375
  * @global object $wpdb        WordPress Database object.
376 376
  */
377
-function geodir_send_friend( $request ) {
377
+function geodir_send_friend($request) {
378 378
 	global $wpdb;
379 379
 
380 380
 	// strip slashes from text
381
-	$request = ! empty( $request ) ? stripslashes_deep( $request ) : $request;
381
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
382 382
 
383 383
 	$yourname      = $request['yourname'];
384 384
 	$youremail     = $request['youremail'];
@@ -387,13 +387,13 @@  discard block
 block discarded – undo
387 387
 	$pid           = $request['pid'];
388 388
 	$to_email      = $request['to_email'];
389 389
 	$to_name       = $request['to_name'];
390
-	if ( $request['pid'] ) {
390
+	if ($request['pid']) {
391 391
 		$productinfosql = $wpdb->prepare(
392 392
 			"select ID,post_title from $wpdb->posts where ID =%d",
393
-			array( $request['pid'] )
393
+			array($request['pid'])
394 394
 		);
395
-		$productinfo    = $wpdb->get_results( $productinfosql );
396
-		foreach ( $productinfo as $productinfoObj ) {
395
+		$productinfo = $wpdb->get_results($productinfosql);
396
+		foreach ($productinfo as $productinfoObj) {
397 397
 			$post_title = $productinfoObj->post_title;
398 398
 		}
399 399
 	}
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
 	 *
418 418
 	 * }
419 419
 	 */
420
-	do_action( 'geodir_before_send_to_friend_email', $request );
421
-	geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid'] );//To client email
420
+	do_action('geodir_before_send_to_friend_email', $request);
421
+	geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']); //To client email
422 422
 
423 423
 	/**
424 424
 	 * Called after the send to friend email is sent.
@@ -439,13 +439,13 @@  discard block
 block discarded – undo
439 439
 	 *
440 440
 	 * }
441 441
 	 */
442
-	do_action( 'geodir_after_send_to_friend_email', $request );
442
+	do_action('geodir_after_send_to_friend_email', $request);
443 443
 
444
-	$url = get_permalink( $pid );
445
-	if ( strstr( $url, '?' ) ) {
446
-		$url = $url . "&sendtofrnd=success";
444
+	$url = get_permalink($pid);
445
+	if (strstr($url, '?')) {
446
+		$url = $url."&sendtofrnd=success";
447 447
 	} else {
448
-		$url = $url . "?sendtofrnd=success";
448
+		$url = $url."?sendtofrnd=success";
449 449
 	}
450 450
 	/**
451 451
 	 * Filter redirect url after the send to friend email is sent.
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	 *
455 455
 	 * @param string $url Redirect url.
456 456
 	 */
457
-	$url = apply_filters( 'geodir_send_to_friend_after_submit_redirect', $url );
458
-	wp_redirect( $url );
457
+	$url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url);
458
+	wp_redirect($url);
459 459
 	gd_die();
460 460
 }
461 461
 
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
  *
470 470
  * @param string $hash_key
471 471
  */
472
-function geodir_before_tab_content( $hash_key ) {
473
-	switch ( $hash_key ) {
472
+function geodir_before_tab_content($hash_key) {
473
+	switch ($hash_key) {
474 474
 		case 'post_info' :
475 475
 			echo '<div class="geodir-company_info field-group">';
476 476
 			break;
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 			 *
481 481
 			 * @since 1.0.0
482 482
 			 */
483
-			echo ' <div id="' . apply_filters( 'geodir_post_gallery_id', 'geodir-post-gallery' ) . '" class="clearfix" >';
483
+			echo ' <div id="'.apply_filters('geodir_post_gallery_id', 'geodir-post-gallery').'" class="clearfix" >';
484 484
 			break;
485 485
 		case 'reviews' :
486 486
 			echo '<div id="reviews-wrap" class="clearfix"> ';
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
  *
505 505
  * @param string $hash_key
506 506
  */
507
-function geodir_after_tab_content( $hash_key ) {
508
-	switch ( $hash_key ) {
507
+function geodir_after_tab_content($hash_key) {
508
+	switch ($hash_key) {
509 509
 		case 'post_info' :
510 510
 			echo '</div>';
511 511
 			break;
@@ -536,25 +536,25 @@  discard block
 block discarded – undo
536 536
  * @global object $wpdb     WordPress Database object.
537 537
  * @return bool|null|string Returns default sort results, when the post type is valid. Otherwise returns false.
538 538
  */
539
-function geodir_get_posts_default_sort( $post_type ) {
539
+function geodir_get_posts_default_sort($post_type) {
540 540
 
541 541
 	global $wpdb;
542 542
 
543
-	if ( $post_type != '' ) {
543
+	if ($post_type != '') {
544 544
 
545 545
 		$all_postypes = geodir_get_posttypes();
546 546
 
547
-		if ( ! in_array( $post_type, $all_postypes ) ) {
547
+		if (!in_array($post_type, $all_postypes)) {
548 548
 			return false;
549 549
 		}
550 550
 
551
-		$sort_field_info = $wpdb->get_var( $wpdb->prepare( "select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where	post_type= %s and is_active=%d and is_default=%d", array(
551
+		$sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where	post_type= %s and is_active=%d and is_default=%d", array(
552 552
 			$post_type,
553 553
 			1,
554 554
 			1
555
-		) ) );
555
+		)));
556 556
 
557
-		if ( ! empty( $sort_field_info ) ) {
557
+		if (!empty($sort_field_info)) {
558 558
 			return $sort_field_info;
559 559
 		}
560 560
 
@@ -574,20 +574,20 @@  discard block
 block discarded – undo
574 574
  * @global object $wpdb     WordPress Database object.
575 575
  * @return bool|mixed|void Returns sort results, when the post type is valid. Otherwise returns false.
576 576
  */
577
-function geodir_get_sort_options( $post_type ) {
577
+function geodir_get_sort_options($post_type) {
578 578
 	global $wpdb;
579 579
 
580
-	if ( $post_type != '' ) {
580
+	if ($post_type != '') {
581 581
 		$all_postypes = geodir_get_posttypes();
582 582
 
583
-		if ( ! in_array( $post_type, $all_postypes ) ) {
583
+		if (!in_array($post_type, $all_postypes)) {
584 584
 			return false;
585 585
 		}
586 586
 
587
-		$sort_field_info = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array(
587
+		$sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array(
588 588
 			$post_type,
589 589
 			1
590
-		) ) );
590
+		)));
591 591
 
592 592
 		/**
593 593
 		 * Filter post sort options.
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 		 * @param array $sort_field_info Unfiltered sort field array.
598 598
 		 * @param string $post_type      Post type.
599 599
 		 */
600
-		return apply_filters( 'geodir_get_sort_options', $sort_field_info, $post_type );
600
+		return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type);
601 601
 	}
602 602
 
603 603
 }
@@ -618,63 +618,63 @@  discard block
 block discarded – undo
618 618
 	 *
619 619
 	 * @since 1.4.4
620 620
 	 */
621
-	if ( is_search() ) {
621
+	if (is_search()) {
622 622
 		return;
623 623
 	}
624 624
 
625 625
 	$sort_by = '';
626 626
 
627
-	if ( isset( $_REQUEST['sort_by'] ) ) {
627
+	if (isset($_REQUEST['sort_by'])) {
628 628
 		$sort_by = $_REQUEST['sort_by'];
629 629
 	}
630 630
 
631 631
 	$gd_post_type = geodir_get_current_posttype();
632 632
 
633
-	$sort_options = geodir_get_sort_options( $gd_post_type );
633
+	$sort_options = geodir_get_sort_options($gd_post_type);
634 634
 
635 635
 
636 636
 	$sort_field_options = '';
637 637
 
638
-	if ( ! empty( $sort_options ) ) {
639
-		foreach ( $sort_options as $sort ) {
640
-			$sort = stripslashes_deep( $sort ); // strip slashes
638
+	if (!empty($sort_options)) {
639
+		foreach ($sort_options as $sort) {
640
+			$sort = stripslashes_deep($sort); // strip slashes
641 641
 
642
-			$label = __( $sort->site_title, 'geodirectory' );
642
+			$label = __($sort->site_title, 'geodirectory');
643 643
 
644
-			if ( $sort->field_type == 'random' ) {
644
+			if ($sort->field_type == 'random') {
645 645
 				$key = $sort->field_type;
646
-				( $sort_by == $key || ( $sort->is_default == '1' && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
647
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
646
+				($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
647
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
648 648
 			}
649 649
 
650
-			if ( $sort->htmlvar_name == 'comment_count' ) {
650
+			if ($sort->htmlvar_name == 'comment_count') {
651 651
 				$sort->htmlvar_name = 'rating_count';
652 652
 			}
653 653
 
654
-			if ( $sort->sort_asc ) {
655
-				$key   = $sort->htmlvar_name . '_asc';
654
+			if ($sort->sort_asc) {
655
+				$key   = $sort->htmlvar_name.'_asc';
656 656
 				$label = $sort->site_title;
657
-				if ( $sort->asc_title ) {
657
+				if ($sort->asc_title) {
658 658
 					$label = $sort->asc_title;
659 659
 				}
660
-				( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
661
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
660
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
661
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
662 662
 			}
663 663
 
664
-			if ( $sort->sort_desc ) {
665
-				$key   = $sort->htmlvar_name . '_desc';
664
+			if ($sort->sort_desc) {
665
+				$key   = $sort->htmlvar_name.'_desc';
666 666
 				$label = $sort->site_title;
667
-				if ( $sort->desc_title ) {
667
+				if ($sort->desc_title) {
668 668
 					$label = $sort->desc_title;
669 669
 				}
670
-				( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
671
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
670
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
671
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
672 672
 			}
673 673
 
674 674
 		}
675 675
 	}
676 676
 
677
-	if ( $sort_field_options != '' ) {
677
+	if ($sort_field_options != '') {
678 678
 
679 679
 		?>
680 680
 
@@ -683,9 +683,9 @@  discard block
 block discarded – undo
683 683
 			<select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;">
684 684
 
685 685
 				<option
686
-					value="<?php echo esc_url( add_query_arg( 'sort_by', '' ) ); ?>" <?php if ( $sort_by == '' ) {
686
+					value="<?php echo esc_url(add_query_arg('sort_by', '')); ?>" <?php if ($sort_by == '') {
687 687
 					echo 'selected="selected"';
688
-				} ?>><?php _e( 'Sort By', 'geodirectory' ); ?></option><?php
688
+				} ?>><?php _e('Sort By', 'geodirectory'); ?></option><?php
689 689
 
690 690
 				echo $sort_field_options; ?>
691 691
 
@@ -713,9 +713,9 @@  discard block
 block discarded – undo
713 713
  *
714 714
  * @return string Returns the section title.
715 715
  */
716
-function geodir_advance_customfields_heading( $title, $field_type ) {
716
+function geodir_advance_customfields_heading($title, $field_type) {
717 717
 
718
-	if ( in_array( $field_type, array( 'multiselect', 'textarea', 'taxonomy' ) ) ) {
718
+	if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) {
719 719
 		$title = '';
720 720
 	}
721 721
 
@@ -737,19 +737,19 @@  discard block
 block discarded – undo
737 737
  * @global object $gd_session       GeoDirectory Session object.
738 738
  * @return string Returns related posts html.
739 739
  */
740
-function geodir_related_posts_display( $request ) {
741
-	if ( ! empty( $request ) ) {
742
-		$before_title = ( isset( $request['before_title'] ) && ! empty( $request['before_title'] ) ) ? $request['before_title'] : '';
743
-		$after_title  = ( isset( $request['after_title'] ) && ! empty( $request['after_title'] ) ) ? $request['after_title'] : '';
744
-
745
-		$title               = ( isset( $request['title'] ) && ! empty( $request['title'] ) ) ? $request['title'] : __( 'Related Listings', 'geodirectory' );
746
-		$post_number         = ( isset( $request['post_number'] ) && ! empty( $request['post_number'] ) ) ? $request['post_number'] : '5';
747
-		$relate_to           = ( isset( $request['relate_to'] ) && ! empty( $request['relate_to'] ) ) ? $request['relate_to'] : 'category';
748
-		$layout              = ( isset( $request['layout'] ) && ! empty( $request['layout'] ) ) ? $request['layout'] : 'gridview_onehalf';
749
-		$add_location_filter = ( isset( $request['add_location_filter'] ) && ! empty( $request['add_location_filter'] ) ) ? $request['add_location_filter'] : '0';
750
-		$listing_width       = ( isset( $request['listing_width'] ) && ! empty( $request['listing_width'] ) ) ? $request['listing_width'] : '';
751
-		$list_sort           = ( isset( $request['list_sort'] ) && ! empty( $request['list_sort'] ) ) ? $request['list_sort'] : 'latest';
752
-		$character_count     = ( isset( $request['character_count'] ) && ! empty( $request['character_count'] ) ) ? $request['character_count'] : '';
740
+function geodir_related_posts_display($request) {
741
+	if (!empty($request)) {
742
+		$before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : '';
743
+		$after_title  = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : '';
744
+
745
+		$title               = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory');
746
+		$post_number         = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5';
747
+		$relate_to           = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category';
748
+		$layout              = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf';
749
+		$add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0';
750
+		$listing_width       = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : '';
751
+		$list_sort           = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest';
752
+		$character_count     = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : '';
753 753
 
754 754
 		global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon;
755 755
 		$related_parent_lat   = !empty($post->post_latitude) ? $post->post_latitude : '';
@@ -757,10 +757,10 @@  discard block
 block discarded – undo
757 757
 		$arr_detail_page_tabs = geodir_detail_page_tabs_list();
758 758
 
759 759
 		$related_listing_array = array();
760
-		if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
761
-			$related_listing_array = get_option( 'geodir_add_related_listing_posttypes' );
760
+		if (get_option('geodir_add_related_listing_posttypes')) {
761
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
762 762
 		}
763
-		if ( isset($post->post_type) && in_array( $post->post_type, $related_listing_array ) ) {
763
+		if (isset($post->post_type) && in_array($post->post_type, $related_listing_array)) {
764 764
 			$arr_detail_page_tabs['related_listing']['is_display'] = true;
765 765
 		}
766 766
 
@@ -772,90 +772,90 @@  discard block
 block discarded – undo
772 772
 		$tax_field         = 'id';
773 773
 		$category          = array();
774 774
 
775
-		if ( isset( $_REQUEST['backandedit'] ) ) {
776
-			$post      = (object) $gd_session->get( 'listing' );
775
+		if (isset($_REQUEST['backandedit'])) {
776
+			$post      = (object) $gd_session->get('listing');
777 777
 			$post_type = $post->listing_type;
778
-			if ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
778
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
779 779
 				$post_id = $_REQUEST['pid'];
780 780
 			}
781
-		} elseif ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
782
-			$post      = geodir_get_post_info( $_REQUEST['pid'] );
781
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
782
+			$post      = geodir_get_post_info($_REQUEST['pid']);
783 783
 			$post_type = $post->post_type;
784 784
 			$post_id   = $_REQUEST['pid'];
785
-		} elseif ( isset( $post->post_type ) && $post->post_type != '' ) {
785
+		} elseif (isset($post->post_type) && $post->post_type != '') {
786 786
 			$post_type = $post->post_type;
787 787
 			$post_id   = $post->ID;
788 788
 		}
789 789
 
790
-		if ( $relate_to == 'category' ) {
790
+		if ($relate_to == 'category') {
791 791
 
792
-			$category_taxonomy = $post_type . $relate_to;
793
-			if ( isset( $post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '' ) {
794
-				$category = explode( ',', trim( $post->{$category_taxonomy}, ',' ) );
792
+			$category_taxonomy = $post_type.$relate_to;
793
+			if (isset($post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '') {
794
+				$category = explode(',', trim($post->{$category_taxonomy}, ','));
795 795
 			}
796 796
 
797
-		} elseif ( $relate_to == 'tags' ) {
797
+		} elseif ($relate_to == 'tags') {
798 798
 
799
-			$category_taxonomy = $post_type . '_' . $relate_to;
800
-			if ( $post->post_tags != '' ) {
801
-				$category = explode( ',', trim( $post->post_tags, ',' ) );
799
+			$category_taxonomy = $post_type.'_'.$relate_to;
800
+			if ($post->post_tags != '') {
801
+				$category = explode(',', trim($post->post_tags, ','));
802 802
 			}
803 803
 			$tax_field = 'name';
804 804
 		}
805 805
 
806 806
 		/* --- return false in invalid request --- */
807
-		if ( empty( $category ) ) {
807
+		if (empty($category)) {
808 808
 			return false;
809 809
 		}
810 810
 
811 811
 		$all_postypes = geodir_get_posttypes();
812 812
 
813
-		if ( ! in_array( $post_type, $all_postypes ) ) {
813
+		if (!in_array($post_type, $all_postypes)) {
814 814
 			return false;
815 815
 		}
816 816
 
817 817
 		/* --- return false in invalid request --- */
818 818
 
819 819
 		$location_url = '';
820
-		if ( $add_location_filter != '0' ) {
820
+		if ($add_location_filter != '0') {
821 821
 			$location_url             = array();
822
-			$geodir_show_location_url = get_option( 'geodir_show_location_url' );
822
+			$geodir_show_location_url = get_option('geodir_show_location_url');
823 823
 
824
-			$gd_city = get_query_var( 'gd_city' );
824
+			$gd_city = get_query_var('gd_city');
825 825
 
826
-			if ( $gd_city ) {
827
-				$gd_country = get_query_var( 'gd_country' );
828
-				$gd_region  = get_query_var( 'gd_region' );
826
+			if ($gd_city) {
827
+				$gd_country = get_query_var('gd_country');
828
+				$gd_region  = get_query_var('gd_region');
829 829
 			} else {
830 830
 				$location = geodir_get_default_location();
831 831
 
832
-				$gd_country = isset( $location->country_slug ) ? $location->country_slug : '';
833
-				$gd_region  = isset( $location->region_slug ) ? $location->region_slug : '';
834
-				$gd_city    = isset( $location->city_slug ) ? $location->city_slug : '';
832
+				$gd_country = isset($location->country_slug) ? $location->country_slug : '';
833
+				$gd_region  = isset($location->region_slug) ? $location->region_slug : '';
834
+				$gd_city    = isset($location->city_slug) ? $location->city_slug : '';
835 835
 			}
836 836
 
837
-			if ( $geodir_show_location_url == 'all' ) {
837
+			if ($geodir_show_location_url == 'all') {
838 838
 				$location_url[] = $gd_country;
839 839
 				$location_url[] = $gd_region;
840
-			} else if ( $geodir_show_location_url == 'country_city' ) {
840
+			} else if ($geodir_show_location_url == 'country_city') {
841 841
 				$location_url[] = $gd_country;
842
-			} else if ( $geodir_show_location_url == 'region_city' ) {
842
+			} else if ($geodir_show_location_url == 'region_city') {
843 843
 				$location_url[] = $gd_region;
844 844
 			}
845 845
 
846 846
 			$location_url[] = $gd_city;
847 847
 
848
-			$location_url = implode( '/', $location_url );
848
+			$location_url = implode('/', $location_url);
849 849
 		}
850 850
 
851 851
 
852
-		if ( ! empty( $category ) ) {
852
+		if (!empty($category)) {
853 853
 			global $geodir_add_location_url;
854 854
 			$geodir_add_location_url = '0';
855
-			if ( $add_location_filter != '0' ) {
855
+			if ($add_location_filter != '0') {
856 856
 				$geodir_add_location_url = '1';
857 857
 			}
858
-			$viewall_url             = get_term_link( (int) $category[0], $post_type . $category_taxonomy );
858
+			$viewall_url             = get_term_link((int) $category[0], $post_type.$category_taxonomy);
859 859
 			$geodir_add_location_url = null;
860 860
 		}
861 861
 		ob_start();
@@ -865,24 +865,24 @@  discard block
 block discarded – undo
865 865
 		<div class="geodir_locations geodir_location_listing">
866 866
 
867 867
 			<?php
868
-			if ( isset( $request['is_widget'] ) && $request['is_widget'] == '1' ) {
868
+			if (isset($request['is_widget']) && $request['is_widget'] == '1') {
869 869
 				/** geodir_before_title filter Documented in geodirectory_widgets.php */
870
-				$before_title = isset( $before_title ) ? $before_title : apply_filters( 'geodir_before_title', '<h3 class="widget-title">' );
870
+				$before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
871 871
 				/** geodir_after_title filter Documented in geodirectory_widgets.php */
872
-				$after_title = isset( $after_title ) ? $after_title : apply_filters( 'geodir_after_title', '</h3>' );
872
+				$after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
873 873
 				?>
874 874
 				<div class="location_list_heading clearfix">
875
-					<?php echo $before_title . $title . $after_title; ?>
875
+					<?php echo $before_title.$title.$after_title; ?>
876 876
 				</div>
877 877
 				<?php
878 878
 			}
879 879
 			$query_args = array(
880 880
 				'posts_per_page'   => $post_number,
881 881
 				'is_geodir_loop'   => true,
882
-				'gd_location'      => ( $add_location_filter ) ? true : false,
882
+				'gd_location'      => ($add_location_filter) ? true : false,
883 883
 				'post_type'        => $post_type,
884 884
 				'order_by'         => $list_sort,
885
-				'post__not_in'     => array( $post_id ),
885
+				'post__not_in'     => array($post_id),
886 886
 				'excerpt_length'   => $character_count,
887 887
 				'related_listings' => $is_display
888 888
 			);
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
 				'terms'    => $category
894 894
 			);
895 895
 
896
-			$query_args['tax_query'] = array( $tax_query );
896
+			$query_args['tax_query'] = array($tax_query);
897 897
 
898 898
 			global $gridview_columns, $post;
899 899
 
@@ -905,21 +905,21 @@  discard block
 block discarded – undo
905 905
 			 * @param array $query_args The query array.
906 906
 			 * @param array $request Related posts request array.
907 907
 			 */
908
-			$query_args = apply_filters( 'geodir_related_posts_widget_query_args', $query_args, $request );
908
+			$query_args = apply_filters('geodir_related_posts_widget_query_args', $query_args, $request);
909 909
 
910
-			query_posts( $query_args );
910
+			query_posts($query_args);
911 911
 
912
-			if ( strstr( $layout, 'gridview' ) ) {
913
-				$listing_view_exp = explode( '_', $layout );
912
+			if (strstr($layout, 'gridview')) {
913
+				$listing_view_exp = explode('_', $layout);
914 914
 				$gridview_columns = $layout;
915 915
 				$layout           = $listing_view_exp[0];
916
-			} else if ( $layout == 'list' ) {
916
+			} else if ($layout == 'list') {
917 917
 				$gridview_columns = '';
918 918
 			}
919 919
 			$related_posts = true;
920 920
 
921 921
 			$related_nearest = false;
922
-			if ( $list_sort == 'nearest' ) {
922
+			if ($list_sort == 'nearest') {
923 923
 				$related_nearest = true;
924 924
 			}
925 925
 
@@ -929,14 +929,14 @@  discard block
 block discarded – undo
929 929
 			 *
930 930
 			 * @since 1.0.0
931 931
 			 */
932
-			$template = apply_filters( "geodir_template_part-related-listing-listview", geodir_locate_template( 'listing-listview' ) );
932
+			$template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
933 933
 
934 934
 			/**
935 935
 			 * Includes related listing listview template.
936 936
 			 *
937 937
 			 * @since 1.0.0
938 938
 			 */
939
-			include( $template );
939
+			include($template);
940 940
 
941 941
 			wp_reset_query();
942 942
 			$post            = $origi_post;
@@ -964,12 +964,12 @@  discard block
 block discarded – undo
964 964
 function geodir_category_count_script() {
965 965
 	global $geodir_post_category_str;
966 966
 
967
-	if ( ! empty( $geodir_post_category_str ) ) {
968
-		$geodir_post_category_str = serialize( $geodir_post_category_str );
967
+	if (!empty($geodir_post_category_str)) {
968
+		$geodir_post_category_str = serialize($geodir_post_category_str);
969 969
 	}
970 970
 
971
-	$all_var['post_category_array'] = html_entity_decode( (string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8' );
972
-	$script                         = "var post_category_array = " . json_encode( $all_var ) . ';';
971
+	$all_var['post_category_array'] = html_entity_decode((string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8');
972
+	$script                         = "var post_category_array = ".json_encode($all_var).';';
973 973
 	echo '<script>';
974 974
 	echo $script;
975 975
 	echo '</script>';
@@ -984,8 +984,8 @@  discard block
 block discarded – undo
984 984
  * @return string Returns the default language.
985 985
  */
986 986
 function geodir_get_map_default_language() {
987
-	$geodir_default_map_language = get_option( 'geodir_default_map_language' );
988
-	if ( empty( $geodir_default_map_language ) ) {
987
+	$geodir_default_map_language = get_option('geodir_default_map_language');
988
+	if (empty($geodir_default_map_language)) {
989 989
 		$geodir_default_map_language = 'en';
990 990
 	}
991 991
 
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
 	 *
997 997
 	 * @param string $geodir_default_map_language Default map language.
998 998
 	 */
999
-	return apply_filters( 'geodir_default_map_language', $geodir_default_map_language );
999
+	return apply_filters('geodir_default_map_language', $geodir_default_map_language);
1000 1000
 }
1001 1001
 
1002 1002
 /**
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
  * @return string Returns the api key.
1008 1008
  */
1009 1009
 function geodir_get_map_api_key() {
1010
-	$key = get_option( 'geodir_google_api_key' );
1010
+	$key = get_option('geodir_google_api_key');
1011 1011
 
1012 1012
 	/**
1013 1013
 	 * Filter Google maps api key.
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
 	 *
1017 1017
 	 * @param string $key Google maps api key.
1018 1018
 	 */
1019
-	return apply_filters( 'geodir_google_api_key', $key );
1019
+	return apply_filters('geodir_google_api_key', $key);
1020 1020
 }
1021 1021
 
1022 1022
 
@@ -1036,20 +1036,20 @@  discard block
 block discarded – undo
1036 1036
 	global $wp, $post, $wp_query, $wpdb, $geodir_addon_list;
1037 1037
 
1038 1038
 	$is_geodir_page = geodir_is_geodir_page();
1039
-	if ( ! $is_geodir_page ) {
1039
+	if (!$is_geodir_page) {
1040 1040
 		return;
1041 1041
 	}// if non GD page, bail
1042 1042
 
1043 1043
 	$use_gd_meta = true;
1044
-	if ( ( class_exists( 'WPSEO_Frontend' ) || class_exists( 'All_in_One_SEO_Pack' ) ) && !geodir_disable_yoast_seo_metas() ) {
1044
+	if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
1045 1045
 		$use_gd_meta = false;
1046 1046
 
1047
-		if ( geodir_is_page( 'search' ) ) {
1047
+		if (geodir_is_page('search')) {
1048 1048
 			$use_gd_meta = true;
1049 1049
 		}
1050 1050
 	}
1051 1051
 
1052
-	if ( ! $use_gd_meta ) {
1052
+	if (!$use_gd_meta) {
1053 1053
 		return;
1054 1054
 	}// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active.
1055 1055
 
@@ -1057,170 +1057,170 @@  discard block
 block discarded – undo
1057 1057
 
1058 1058
 	$all_postypes = geodir_get_posttypes();
1059 1059
 
1060
-	$geodir_taxonomies = geodir_get_taxonomies( '', true );
1060
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1061 1061
 
1062 1062
 	$meta_desc = '';
1063 1063
 	$meta_key  = '';
1064
-	if ( isset( $current_term->ID ) && $current_term->ID == geodir_location_page_id() ) {
1064
+	if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
1065 1065
 		/**
1066 1066
 		 * Filter SEO meta location description.
1067 1067
 		 *
1068 1068
 		 * @since 1.0.0
1069 1069
 		 */
1070
-		$meta_desc = apply_filters( 'geodir_seo_meta_location_description', '' );
1070
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', '');
1071 1071
 		$meta_desc .= '';
1072 1072
 	}
1073
-	if ( have_posts() && is_single() OR is_page() ) {
1074
-		while ( have_posts() ) {
1073
+	if (have_posts() && is_single() OR is_page()) {
1074
+		while (have_posts()) {
1075 1075
 			the_post();
1076 1076
 
1077
-			if ( has_excerpt() ) {
1078
-				$out_excerpt = strip_tags( strip_shortcodes( get_the_excerpt() ) );
1079
-				if ( empty( $out_excerpt ) ) {
1080
-					$out_excerpt = strip_tags( do_shortcode( get_the_excerpt() ) );
1077
+			if (has_excerpt()) {
1078
+				$out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt()));
1079
+				if (empty($out_excerpt)) {
1080
+					$out_excerpt = strip_tags(do_shortcode(get_the_excerpt()));
1081 1081
 				}
1082
-				$out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $out_excerpt );
1082
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
1083 1083
 			} else {
1084
-				$out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $post->post_content );
1085
-				$out_excerpt = strip_tags( strip_shortcodes( $out_excerpt ) );
1086
-				if ( empty( $out_excerpt ) ) {
1087
-					$out_excerpt = strip_tags( do_shortcode( $out_excerpt ) ); // parse short code from content
1084
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
1085
+				$out_excerpt = strip_tags(strip_shortcodes($out_excerpt));
1086
+				if (empty($out_excerpt)) {
1087
+					$out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content
1088 1088
 				}
1089
-				$out_excerpt = trim( wp_trim_words( $out_excerpt, 35, '' ), '.!?,;:-' );
1089
+				$out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-');
1090 1090
 			}
1091 1091
 
1092 1092
 			$meta_desc .= $out_excerpt;
1093 1093
 		}
1094
-	} elseif ( ( is_category() || is_tag() ) && isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
1095
-		if ( is_category() ) {
1096
-			$meta_desc .= __( "Posts related to Category:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_cat_title( "", false ) );
1097
-		} elseif ( is_tag() ) {
1098
-			$meta_desc .= __( "Posts related to Tag:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_tag_title( "", false ) );
1094
+	} elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1095
+		if (is_category()) {
1096
+			$meta_desc .= __("Posts related to Category:", 'geodirectory')." ".geodir_utf8_ucfirst(single_cat_title("", false));
1097
+		} elseif (is_tag()) {
1098
+			$meta_desc .= __("Posts related to Tag:", 'geodirectory')." ".geodir_utf8_ucfirst(single_tag_title("", false));
1099 1099
 		}
1100
-	} elseif ( isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
1101
-		$meta_desc .= isset( $current_term->description ) ? $current_term->description : '';
1100
+	} elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1101
+		$meta_desc .= isset($current_term->description) ? $current_term->description : '';
1102 1102
 	}
1103 1103
 
1104 1104
 
1105 1105
 	$geodir_post_type       = geodir_get_current_posttype();
1106
-	$geodir_post_type_info  = get_post_type_object( $geodir_post_type );
1107
-	$geodir_is_page_listing = geodir_is_page( 'listing' ) ? true : false;
1108
-
1109
-	$category_taxonomy = geodir_get_taxonomies( $geodir_post_type );
1110
-	$tag_taxonomy      = geodir_get_taxonomies( $geodir_post_type, true );
1111
-
1112
-	$geodir_is_category = isset( $category_taxonomy[0] ) && get_query_var( $category_taxonomy[0] ) ? get_query_var( $category_taxonomy[0] ) : false;
1113
-	$geodir_is_tag      = isset( $tag_taxonomy[0] ) && get_query_var( $tag_taxonomy[0] ) ? true : false;
1114
-
1115
-	$geodir_is_search        = geodir_is_page( 'search' ) ? true : false;
1116
-	$geodir_is_location      = geodir_is_page( 'location' ) ? true : false;
1117
-	$geodir_location_manager = isset( $geodir_addon_list['geodir_location_manager'] ) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1118
-	$godir_location_terms    = geodir_get_current_location_terms( 'query_vars' );
1119
-	$gd_city                 = $geodir_location_manager && isset( $godir_location_terms['gd_city'] ) ? $godir_location_terms['gd_city'] : null;
1120
-	$gd_region               = $geodir_location_manager && isset( $godir_location_terms['gd_region'] ) ? $godir_location_terms['gd_region'] : null;
1121
-	$gd_country              = $geodir_location_manager && isset( $godir_location_terms['gd_country'] ) ? $godir_location_terms['gd_country'] : null;
1122
-	$replace_location        = __( 'Everywhere', 'geodirectory' );
1106
+	$geodir_post_type_info  = get_post_type_object($geodir_post_type);
1107
+	$geodir_is_page_listing = geodir_is_page('listing') ? true : false;
1108
+
1109
+	$category_taxonomy = geodir_get_taxonomies($geodir_post_type);
1110
+	$tag_taxonomy      = geodir_get_taxonomies($geodir_post_type, true);
1111
+
1112
+	$geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false;
1113
+	$geodir_is_tag      = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false;
1114
+
1115
+	$geodir_is_search        = geodir_is_page('search') ? true : false;
1116
+	$geodir_is_location      = geodir_is_page('location') ? true : false;
1117
+	$geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1118
+	$godir_location_terms    = geodir_get_current_location_terms('query_vars');
1119
+	$gd_city                 = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : null;
1120
+	$gd_region               = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : null;
1121
+	$gd_country              = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : null;
1122
+	$replace_location        = __('Everywhere', 'geodirectory');
1123 1123
 	$location_id             = null;
1124
-	if ( $geodir_location_manager ) {
1125
-		$sql           = $wpdb->prepare( "SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array( $gd_city ) );
1126
-		$location_id   = (int) $wpdb->get_var( $sql );
1124
+	if ($geodir_location_manager) {
1125
+		$sql           = $wpdb->prepare("SELECT location_id FROM ".POST_LOCATION_TABLE." WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
1126
+		$location_id   = (int) $wpdb->get_var($sql);
1127 1127
 		$location_type = geodir_what_is_current_location();
1128
-		if ( $location_type == 'city' ) {
1129
-			$replace_location = geodir_get_current_location( array( 'what' => 'city', 'echo' => false ) );
1130
-		} elseif ( $location_type == 'region' ) {
1131
-			$replace_location = geodir_get_current_location( array( 'what' => 'region', 'echo' => false ) );
1132
-		} elseif ( $location_type == 'country' ) {
1133
-			$replace_location = geodir_get_current_location( array( 'what' => 'country', 'echo' => false ) );
1134
-			$replace_location = __( $replace_location, 'geodirectory' );
1128
+		if ($location_type == 'city') {
1129
+			$replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
1130
+		} elseif ($location_type == 'region') {
1131
+			$replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
1132
+		} elseif ($location_type == 'country') {
1133
+			$replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
1134
+			$replace_location = __($replace_location, 'geodirectory');
1135 1135
 		}
1136
-		$country          = get_query_var( 'gd_country' );
1137
-		$region           = get_query_var( 'gd_region' );
1138
-		$city             = get_query_var( 'gd_city' );
1136
+		$country          = get_query_var('gd_country');
1137
+		$region           = get_query_var('gd_region');
1138
+		$city             = get_query_var('gd_city');
1139 1139
 		$current_location = '';
1140
-		if ( $country != '' ) {
1141
-			$current_location = get_actual_location_name( 'country', $country, true );
1140
+		if ($country != '') {
1141
+			$current_location = get_actual_location_name('country', $country, true);
1142 1142
 		}
1143
-		if ( $region != '' ) {
1144
-			$current_location = get_actual_location_name( 'region', $region );
1143
+		if ($region != '') {
1144
+			$current_location = get_actual_location_name('region', $region);
1145 1145
 		}
1146
-		if ( $city != '' ) {
1147
-			$current_location = get_actual_location_name( 'city', $city );
1146
+		if ($city != '') {
1147
+			$current_location = get_actual_location_name('city', $city);
1148 1148
 		}
1149 1149
 		$replace_location = $current_location != '' ? $current_location : $replace_location;
1150 1150
 	}
1151 1151
 
1152 1152
 	$geodir_meta_keys = '';
1153 1153
 	$geodir_meta_desc = '';
1154
-	if ( $is_geodir_page && ! empty( $geodir_post_type_info ) ) {
1155
-		if ( $geodir_is_page_listing || $geodir_is_search || geodir_is_page( 'add-listing' ) ) {
1156
-			$geodir_meta_keys = isset( $geodir_post_type_info->seo['meta_keyword'] ) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1154
+	if ($is_geodir_page && !empty($geodir_post_type_info)) {
1155
+		if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
1156
+			$geodir_meta_keys = isset($geodir_post_type_info->seo['meta_keyword']) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1157 1157
 
1158
-			$geodir_meta_desc = isset( $geodir_post_type_info->description ) ? $geodir_post_type_info->description : $geodir_meta_desc;
1159
-			$geodir_meta_desc = isset( $geodir_post_type_info->seo['meta_description'] ) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1158
+			$geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc;
1159
+			$geodir_meta_desc = isset($geodir_post_type_info->seo['meta_description']) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1160 1160
 
1161
-			if ( $geodir_is_category ) {
1162
-				$category = $geodir_is_category ? get_term_by( 'slug', $geodir_is_category, $category_taxonomy[0] ) : null;
1163
-				if ( isset( $category->term_id ) && ! empty( $category->term_id ) ) {
1161
+			if ($geodir_is_category) {
1162
+				$category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : null;
1163
+				if (isset($category->term_id) && !empty($category->term_id)) {
1164 1164
 					$category_id   = $category->term_id;
1165
-					$category_desc = trim( $category->description ) != '' ? trim( $category->description ) : geodir_get_tax_meta( $category_id, 'ct_cat_top_desc', false, $geodir_post_type );
1166
-					if ( $location_id ) {
1167
-						$option_name    = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id;
1168
-						$cat_loc_option = get_option( $option_name );
1169
-
1170
-						$gd_cat_loc_default = ! empty( $cat_loc_option ) && isset( $cat_loc_option['gd_cat_loc_default'] ) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1171
-						if ( ! $gd_cat_loc_default ) {
1172
-							$option_name   = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id;
1173
-							$option        = get_option( $option_name );
1174
-							$category_desc = isset( $option['gd_cat_loc_desc'] ) && trim( $option['gd_cat_loc_desc'] ) != '' ? trim( $option['gd_cat_loc_desc'] ) : $category_desc;
1165
+					$category_desc = trim($category->description) != '' ? trim($category->description) : geodir_get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type);
1166
+					if ($location_id) {
1167
+						$option_name    = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id;
1168
+						$cat_loc_option = get_option($option_name);
1169
+
1170
+						$gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1171
+						if (!$gd_cat_loc_default) {
1172
+							$option_name   = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id.'_'.$location_id;
1173
+							$option        = get_option($option_name);
1174
+							$category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc;
1175 1175
 						}
1176 1176
 					}
1177
-					$geodir_meta_desc = __( "Posts related to Category:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_cat_title( "", false ) ) . '. ' . $category_desc;
1177
+					$geodir_meta_desc = __("Posts related to Category:", 'geodirectory')." ".geodir_utf8_ucfirst(single_cat_title("", false)).'. '.$category_desc;
1178 1178
 				}
1179
-			} else if ( $geodir_is_tag ) {
1180
-				$geodir_meta_desc = __( "Posts related to Tag:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_tag_title( "", false ) ) . '. ' . $geodir_meta_desc;
1179
+			} else if ($geodir_is_tag) {
1180
+				$geodir_meta_desc = __("Posts related to Tag:", 'geodirectory')." ".geodir_utf8_ucfirst(single_tag_title("", false)).'. '.$geodir_meta_desc;
1181 1181
 			}
1182 1182
 		}
1183 1183
 	}
1184 1184
 
1185 1185
 
1186 1186
 	$gd_page = '';
1187
-	if ( geodir_is_page( 'home' ) ) {
1187
+	if (geodir_is_page('home')) {
1188 1188
 		$gd_page   = 'home';
1189
-		$meta_desc = ( get_option( 'geodir_meta_desc_homepage' ) ) ? get_option( 'geodir_meta_desc_homepage' ) : $meta_desc;
1190
-	} elseif ( geodir_is_page( 'detail' ) ) {
1189
+		$meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1190
+	} elseif (geodir_is_page('detail')) {
1191 1191
 		$gd_page   = 'detail';
1192
-		$meta_desc = ( get_option( 'geodir_meta_desc_detail' ) ) ? get_option( 'geodir_meta_desc_detail' ) : $meta_desc;
1193
-	} elseif ( geodir_is_page( 'pt' ) ) {
1192
+		$meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1193
+	} elseif (geodir_is_page('pt')) {
1194 1194
 		$gd_page   = 'pt';
1195
-		$meta_desc = ( get_option( 'geodir_meta_desc_pt' ) ) ? get_option( 'geodir_meta_desc_pt' ) : $meta_desc;
1196
-	} elseif ( geodir_is_page( 'listing' ) ) {
1195
+		$meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1196
+	} elseif (geodir_is_page('listing')) {
1197 1197
 		$gd_page   = 'listing';
1198
-		$meta_desc = ( get_option( 'geodir_meta_desc_listing' ) ) ? get_option( 'geodir_meta_desc_listing' ) : $meta_desc;
1199
-	} elseif ( geodir_is_page( 'location' ) ) {
1198
+		$meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1199
+	} elseif (geodir_is_page('location')) {
1200 1200
 		$gd_page   = 'location';
1201
-		$meta_desc = ( get_option( 'geodir_meta_desc_location' ) ) ? get_option( 'geodir_meta_desc_location' ) : $meta_desc;
1202
-		$meta_desc = apply_filters( 'geodir_seo_meta_location_description', $meta_desc );
1201
+		$meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1202
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1203 1203
 
1204
-	} elseif ( geodir_is_page( 'search' ) ) {
1204
+	} elseif (geodir_is_page('search')) {
1205 1205
 		$gd_page   = 'search';
1206
-		$meta_desc = ( get_option( 'geodir_meta_desc_search' ) ) ? get_option( 'geodir_meta_desc_search' ) : $meta_desc;
1207
-	} elseif ( geodir_is_page( 'add-listing' ) ) {
1206
+		$meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1207
+	} elseif (geodir_is_page('add-listing')) {
1208 1208
 		$gd_page   = 'add-listing';
1209
-		$meta_desc = ( get_option( 'geodir_meta_desc_add-listing' ) ) ? get_option( 'geodir_meta_desc_add-listing' ) : $meta_desc;
1210
-	} elseif ( geodir_is_page( 'author' ) ) {
1209
+		$meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1210
+	} elseif (geodir_is_page('author')) {
1211 1211
 		$gd_page   = 'author';
1212
-		$meta_desc = ( get_option( 'geodir_meta_desc_author' ) ) ? get_option( 'geodir_meta_desc_author' ) : $meta_desc;
1213
-	} elseif ( geodir_is_page( 'login' ) ) {
1212
+		$meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1213
+	} elseif (geodir_is_page('login')) {
1214 1214
 		$gd_page   = 'login';
1215
-		$meta_desc = ( get_option( 'geodir_meta_desc_login' ) ) ? get_option( 'geodir_meta_desc_login' ) : $meta_desc;
1216
-	} elseif ( geodir_is_page( 'listing-success' ) ) {
1215
+		$meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1216
+	} elseif (geodir_is_page('listing-success')) {
1217 1217
 		$gd_page   = 'listing-success';
1218
-		$meta_desc = ( get_option( 'geodir_meta_desc_listing-success' ) ) ? get_option( 'geodir_meta_desc_listing-success' ) : $meta_desc;
1218
+		$meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1219 1219
 	}
1220 1220
 
1221 1221
 
1222
-	if ( $meta_desc ) {
1223
-		$meta_desc = stripslashes_deep( $meta_desc );
1222
+	if ($meta_desc) {
1223
+		$meta_desc = stripslashes_deep($meta_desc);
1224 1224
 		/**
1225 1225
 		 * Filter page description to replace variables.
1226 1226
 		 *
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 		 * @param string $title   The page description including variables.
1230 1230
 		 * @param string $gd_page The GeoDirectory page type if any.
1231 1231
 		 */
1232
-		$meta_desc = apply_filters( 'geodir_seo_meta_description_pre', __( $meta_desc, 'geodirectory' ), $gd_page, '' );
1232
+		$meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'), $gd_page, '');
1233 1233
 
1234 1234
 		/**
1235 1235
 		 * Filter SEO meta description.
@@ -1238,49 +1238,49 @@  discard block
 block discarded – undo
1238 1238
 		 *
1239 1239
 		 * @param string $meta_desc Meta description content.
1240 1240
 		 */
1241
-		echo apply_filters( 'geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc );
1241
+		echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="'.$meta_desc.'" />', $meta_desc);
1242 1242
 	}
1243 1243
 
1244 1244
 	// meta keywords
1245
-	if ( isset( $post->post_type ) && in_array( $post->post_type, $all_postypes ) ) {
1246
-		$place_tags = wp_get_post_terms( $post->ID, $post->post_type . '_tags', array( "fields" => "names" ) );
1247
-		$place_cats = wp_get_post_terms( $post->ID, $post->post_type . 'category', array( "fields" => "names" ) );
1245
+	if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
1246
+		$place_tags = wp_get_post_terms($post->ID, $post->post_type.'_tags', array("fields" => "names"));
1247
+		$place_cats = wp_get_post_terms($post->ID, $post->post_type.'category', array("fields" => "names"));
1248 1248
 
1249
-		$meta_key .= implode( ", ", array_merge( (array) $place_cats, (array) $place_tags ) );
1249
+		$meta_key .= implode(", ", array_merge((array) $place_cats, (array) $place_tags));
1250 1250
 	} else {
1251 1251
 		$posttags = get_the_tags();
1252
-		if ( $posttags ) {
1253
-			foreach ( $posttags as $tag ) {
1254
-				$meta_key .= $tag->name . ' ';
1252
+		if ($posttags) {
1253
+			foreach ($posttags as $tag) {
1254
+				$meta_key .= $tag->name.' ';
1255 1255
 			}
1256 1256
 		} else {
1257
-			$tags = get_tags( array( 'orderby' => 'count', 'order' => 'DESC' ) );
1257
+			$tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
1258 1258
 			$xt   = 1;
1259 1259
 
1260
-			foreach ( $tags as $tag ) {
1261
-				if ( $xt <= 20 ) {
1262
-					$meta_key .= $tag->name . ", ";
1260
+			foreach ($tags as $tag) {
1261
+				if ($xt <= 20) {
1262
+					$meta_key .= $tag->name.", ";
1263 1263
 				}
1264 1264
 
1265
-				$xt ++;
1265
+				$xt++;
1266 1266
 			}
1267 1267
 		}
1268 1268
 	}
1269 1269
 
1270
-	$meta_key         = $meta_key != '' ? rtrim( trim( $meta_key ), "," ) : $meta_key;
1271
-	$geodir_meta_keys = $geodir_meta_keys != '' ? ( $meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys ) : $meta_key;
1272
-	if ( $geodir_meta_keys != '' ) {
1273
-		$geodir_meta_keys = strip_tags( $geodir_meta_keys );
1274
-		$geodir_meta_keys = esc_html( $geodir_meta_keys );
1275
-		$geodir_meta_keys = geodir_strtolower( $geodir_meta_keys );
1276
-		$geodir_meta_keys = wp_html_excerpt( $geodir_meta_keys, 1000, '' );
1277
-		$geodir_meta_keys = str_replace( '%location%', $replace_location, $geodir_meta_keys );
1270
+	$meta_key         = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key;
1271
+	$geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key.', '.$geodir_meta_keys : $geodir_meta_keys) : $meta_key;
1272
+	if ($geodir_meta_keys != '') {
1273
+		$geodir_meta_keys = strip_tags($geodir_meta_keys);
1274
+		$geodir_meta_keys = esc_html($geodir_meta_keys);
1275
+		$geodir_meta_keys = geodir_strtolower($geodir_meta_keys);
1276
+		$geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, '');
1277
+		$geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
1278 1278
 
1279
-		$meta_key = rtrim( trim( $geodir_meta_keys ), "," );
1279
+		$meta_key = rtrim(trim($geodir_meta_keys), ",");
1280 1280
 	}
1281 1281
 
1282
-	if ( $meta_key ) {
1283
-		$meta_key = stripslashes_deep( $meta_key );
1282
+	if ($meta_key) {
1283
+		$meta_key = stripslashes_deep($meta_key);
1284 1284
 		/**
1285 1285
 		 * Filter SEO meta keywords.
1286 1286
 		 *
@@ -1288,7 +1288,7 @@  discard block
 block discarded – undo
1288 1288
 		 *
1289 1289
 		 * @param string $meta_desc Meta keywords.
1290 1290
 		 */
1291
-		echo apply_filters( 'geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key );
1291
+		echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="'.$meta_key.'" />', $meta_key);
1292 1292
 	}
1293 1293
 
1294 1294
 }
@@ -1308,8 +1308,8 @@  discard block
 block discarded – undo
1308 1308
 
1309 1309
 	$geodir_detail_page_tabs_array = geodir_detail_page_tabs_array();
1310 1310
 
1311
-	foreach ( $geodir_detail_page_tabs_array as $key => $tabs_obj ) {
1312
-		$geodir_detail_page_tabs_key_value_array[ $key ] = $tabs_obj['heading_text'];
1311
+	foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
1312
+		$geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text'];
1313 1313
 	}
1314 1314
 
1315 1315
 	return $geodir_detail_page_tabs_key_value_array;
@@ -1331,57 +1331,57 @@  discard block
 block discarded – undo
1331 1331
 	 * @since 1.0.0
1332 1332
 	 */
1333 1333
 	$arr_tabs['post_profile'] = array(
1334
-		'heading_text'  => __( 'Profile', 'geodirectory' ),
1334
+		'heading_text'  => __('Profile', 'geodirectory'),
1335 1335
 		'is_active_tab' => true,
1336
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_profile' ),
1336
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
1337 1337
 		'tab_content'   => ''
1338 1338
 	);
1339
-	$arr_tabs['post_info']    = array(
1340
-		'heading_text'  => __( 'More Info', 'geodirectory' ),
1339
+	$arr_tabs['post_info'] = array(
1340
+		'heading_text'  => __('More Info', 'geodirectory'),
1341 1341
 		'is_active_tab' => false,
1342
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_info' ),
1342
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
1343 1343
 		'tab_content'   => ''
1344 1344
 	);
1345 1345
 
1346 1346
 	$arr_tabs['post_images'] = array(
1347
-		'heading_text'  => __( 'Photos', 'geodirectory' ),
1347
+		'heading_text'  => __('Photos', 'geodirectory'),
1348 1348
 		'is_active_tab' => false,
1349
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_images' ),
1349
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
1350 1350
 		'tab_content'   => ''
1351 1351
 	);
1352 1352
 
1353 1353
 	$arr_tabs['post_video'] = array(
1354
-		'heading_text'  => __( 'Video', 'geodirectory' ),
1354
+		'heading_text'  => __('Video', 'geodirectory'),
1355 1355
 		'is_active_tab' => false,
1356
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_video' ),
1356
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
1357 1357
 		'tab_content'   => ''
1358 1358
 	);
1359 1359
 
1360 1360
 	$arr_tabs['special_offers'] = array(
1361
-		'heading_text'  => __( 'Special Offers', 'geodirectory' ),
1361
+		'heading_text'  => __('Special Offers', 'geodirectory'),
1362 1362
 		'is_active_tab' => false,
1363
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'special_offers' ),
1363
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
1364 1364
 		'tab_content'   => ''
1365 1365
 	);
1366 1366
 
1367 1367
 	$arr_tabs['post_map'] = array(
1368
-		'heading_text'  => __( 'Map', 'geodirectory' ),
1368
+		'heading_text'  => __('Map', 'geodirectory'),
1369 1369
 		'is_active_tab' => false,
1370
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_map' ),
1370
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
1371 1371
 		'tab_content'   => ''
1372 1372
 	);
1373 1373
 
1374 1374
 	$arr_tabs['reviews'] = array(
1375
-		'heading_text'  => __( 'Reviews', 'geodirectory' ),
1375
+		'heading_text'  => __('Reviews', 'geodirectory'),
1376 1376
 		'is_active_tab' => false,
1377
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'reviews' ),
1377
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
1378 1378
 		'tab_content'   => 'review display'
1379 1379
 	);
1380 1380
 
1381 1381
 	$arr_tabs['related_listing'] = array(
1382
-		'heading_text'  => __( 'Related Listing', 'geodirectory' ),
1382
+		'heading_text'  => __('Related Listing', 'geodirectory'),
1383 1383
 		'is_active_tab' => false,
1384
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'related_listing' ),
1384
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
1385 1385
 		'tab_content'   => ''
1386 1386
 	);
1387 1387
 
@@ -1390,7 +1390,7 @@  discard block
 block discarded – undo
1390 1390
 	 *
1391 1391
 	 * @since 1.0.0
1392 1392
 	 */
1393
-	return apply_filters( 'geodir_detail_page_tab_list_extend', $arr_tabs );
1393
+	return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
1394 1394
 
1395 1395
 
1396 1396
 }
@@ -1404,13 +1404,13 @@  discard block
 block discarded – undo
1404 1404
  * @return mixed|array Tabs array.
1405 1405
  */
1406 1406
 function geodir_detail_page_tabs_list() {
1407
-	$tabs_excluded = get_option( 'geodir_detail_page_tabs_excluded' );
1407
+	$tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
1408 1408
 	$tabs_array    = geodir_detail_page_tabs_array();
1409 1409
 
1410
-	if ( ! empty( $tabs_excluded ) ) {
1411
-		foreach ( $tabs_excluded as $tab ) {
1412
-			if ( array_key_exists( $tab, $tabs_array ) ) {
1413
-				unset( $tabs_array[ $tab ] );
1410
+	if (!empty($tabs_excluded)) {
1411
+		foreach ($tabs_excluded as $tab) {
1412
+			if (array_key_exists($tab, $tabs_array)) {
1413
+				unset($tabs_array[$tab]);
1414 1414
 			}
1415 1415
 		}
1416 1416
 	}
@@ -1434,58 +1434,58 @@  discard block
 block discarded – undo
1434 1434
 function geodir_show_detail_page_tabs() {
1435 1435
 	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields, $preview;
1436 1436
 
1437
-	$post_id            = ! empty( $post ) && isset( $post->ID ) ? (int) $post->ID : 0;
1438
-	$request_post_id    = ! empty( $_REQUEST['p'] ) ? (int) $_REQUEST['p'] : 0;
1439
-	$is_backend_preview = ( is_single() && ! empty( $_REQUEST['post_type'] ) && ! empty( $_REQUEST['preview'] ) && ! empty( $_REQUEST['p'] ) ) && is_super_admin() ? true : false; // skip if preview from backend
1437
+	$post_id            = !empty($post) && isset($post->ID) ? (int) $post->ID : 0;
1438
+	$request_post_id    = !empty($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;
1439
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
1440 1440
 
1441
-	if ( $is_backend_preview && ! $post_id > 0 && $request_post_id > 0 ) {
1442
-		$post = geodir_get_post_info( $request_post_id );
1443
-		setup_postdata( $post );
1441
+	if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
1442
+		$post = geodir_get_post_info($request_post_id);
1443
+		setup_postdata($post);
1444 1444
 	}
1445 1445
 
1446
-	$geodir_post_detail_fields = geodir_show_listing_info( 'moreinfo' );
1446
+	$geodir_post_detail_fields = geodir_show_listing_info('moreinfo');
1447 1447
 
1448 1448
 
1449
-	if ( geodir_is_page( 'detail' ) ) {
1450
-		$video                 = geodir_get_video( $post->ID );
1451
-		$special_offers        = geodir_get_special_offers( $post->ID );
1449
+	if (geodir_is_page('detail')) {
1450
+		$video                 = geodir_get_video($post->ID);
1451
+		$special_offers        = geodir_get_special_offers($post->ID);
1452 1452
 		$related_listing_array = array();
1453
-		if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
1454
-			$related_listing_array = get_option( 'geodir_add_related_listing_posttypes' );
1453
+		if (get_option('geodir_add_related_listing_posttypes')) {
1454
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
1455 1455
 		}
1456 1456
 
1457 1457
 
1458
-		$excluded_tabs = get_option( 'geodir_detail_page_tabs_excluded' );
1459
-		if ( ! $excluded_tabs ) {
1458
+		$excluded_tabs = get_option('geodir_detail_page_tabs_excluded');
1459
+		if (!$excluded_tabs) {
1460 1460
 			$excluded_tabs = array();
1461 1461
 		}
1462 1462
 
1463 1463
 		$related_listing = '';
1464
-		if ( in_array( $post->post_type, $related_listing_array ) && ! in_array( 'related_listing', $excluded_tabs ) ) {
1464
+		if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) {
1465 1465
 			$request = array(
1466
-				'post_number'         => get_option( 'geodir_related_post_count' ),
1467
-				'relate_to'           => get_option( 'geodir_related_post_relate_to' ),
1468
-				'layout'              => get_option( 'geodir_related_post_listing_view' ),
1469
-				'add_location_filter' => get_option( 'geodir_related_post_location_filter' ),
1470
-				'list_sort'           => get_option( 'geodir_related_post_sortby' ),
1471
-				'character_count'     => get_option( 'geodir_related_post_excerpt' )
1466
+				'post_number'         => get_option('geodir_related_post_count'),
1467
+				'relate_to'           => get_option('geodir_related_post_relate_to'),
1468
+				'layout'              => get_option('geodir_related_post_listing_view'),
1469
+				'add_location_filter' => get_option('geodir_related_post_location_filter'),
1470
+				'list_sort'           => get_option('geodir_related_post_sortby'),
1471
+				'character_count'     => get_option('geodir_related_post_excerpt')
1472 1472
 			);
1473 1473
 
1474
-			if ( $post->post_type == 'gd_event' && defined( 'GDEVENTS_VERSION' ) ) {
1475
-				$related_listing = geodir_get_detail_page_related_events( $request );
1474
+			if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
1475
+				$related_listing = geodir_get_detail_page_related_events($request);
1476 1476
 			} else {
1477
-				$related_listing = geodir_related_posts_display( $request );
1477
+				$related_listing = geodir_related_posts_display($request);
1478 1478
 			}
1479 1479
 
1480 1480
 		}
1481 1481
 
1482
-		$post_images = geodir_get_images( $post->ID, 'thumbnail' );
1482
+		$post_images = geodir_get_images($post->ID, 'thumbnail');
1483 1483
 		$thumb_image = '';
1484
-		if ( ! empty( $post_images ) ) {
1485
-			foreach ( $post_images as $image ) {
1486
-				$caption = ( ! empty( $image->caption ) ) ? $image->caption : '';
1487
-				$thumb_image .= '<a href="' . $image->src . '" title="' . $caption . '">';
1488
-				$thumb_image .= geodir_show_image( $image, 'thumbnail', true, false );
1484
+		if (!empty($post_images)) {
1485
+			foreach ($post_images as $image) {
1486
+				$caption = (!empty($image->caption)) ? $image->caption : '';
1487
+				$thumb_image .= '<a href="'.$image->src.'" title="'.$caption.'">';
1488
+				$thumb_image .= geodir_show_image($image, 'thumbnail', true, false);
1489 1489
 				$thumb_image .= '</a>';
1490 1490
 			}
1491 1491
 		}
@@ -1494,11 +1494,11 @@  discard block
 block discarded – undo
1494 1494
 		$map_args['map_canvas_name'] = 'detail_page_map_canvas';
1495 1495
 		$map_args['width']           = '600';
1496 1496
 		$map_args['height']          = '300';
1497
-		if ( $post->post_mapzoom ) {
1498
-			$map_args['zoom'] = '' . $post->post_mapzoom . '';
1497
+		if ($post->post_mapzoom) {
1498
+			$map_args['zoom'] = ''.$post->post_mapzoom.'';
1499 1499
 		}
1500 1500
 		$map_args['autozoom']                 = false;
1501
-		$map_args['scrollwheel']              = ( get_option( 'geodir_add_listing_mouse_scroll' ) ) ? 0 : 1;
1501
+		$map_args['scrollwheel']              = (get_option('geodir_add_listing_mouse_scroll')) ? 0 : 1;
1502 1502
 		$map_args['child_collapse']           = '0';
1503 1503
 		$map_args['enable_cat_filters']       = false;
1504 1504
 		$map_args['enable_text_search']       = false;
@@ -1507,43 +1507,43 @@  discard block
 block discarded – undo
1507 1507
 		$map_args['enable_jason_on_load']     = true;
1508 1508
 		$map_args['enable_map_direction']     = true;
1509 1509
 		$map_args['map_class_name']           = 'geodir-map-detail-page';
1510
-		$map_args['maptype']                  = ( ! empty( $post->post_mapview ) ) ? $post->post_mapview : 'ROADMAP';
1511
-	} else if ( geodir_is_page( 'preview' ) ) {
1512
-		$video          = isset( $post->geodir_video ) ? $post->geodir_video : '';
1513
-		$special_offers = isset( $post->geodir_special_offers ) ? $post->geodir_special_offers : '';
1510
+		$map_args['maptype']                  = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP';
1511
+	} else if (geodir_is_page('preview')) {
1512
+		$video          = isset($post->geodir_video) ? $post->geodir_video : '';
1513
+		$special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : '';
1514 1514
 
1515
-		if ( isset( $post->post_images ) ) {
1516
-			$post->post_images = trim( $post->post_images, "," );
1515
+		if (isset($post->post_images)) {
1516
+			$post->post_images = trim($post->post_images, ",");
1517 1517
 		}
1518 1518
 
1519
-		if ( isset( $post->post_images ) && ! empty( $post->post_images ) ) {
1520
-			$post_images = explode( ",", $post->post_images );
1519
+		if (isset($post->post_images) && !empty($post->post_images)) {
1520
+			$post_images = explode(",", $post->post_images);
1521 1521
 		}
1522 1522
 
1523 1523
 		$thumb_image = '';
1524
-		if ( ! empty( $post_images ) ) {
1525
-			foreach ( $post_images as $image ) {
1526
-				if ( $image != '' ) {
1527
-					$thumb_image .= '<a href="' . $image . '">';
1528
-					$thumb_image .= geodir_show_image( array( 'src' => $image ), 'thumbnail', true, false );
1524
+		if (!empty($post_images)) {
1525
+			foreach ($post_images as $image) {
1526
+				if ($image != '') {
1527
+					$thumb_image .= '<a href="'.$image.'">';
1528
+					$thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
1529 1529
 					$thumb_image .= '</a>';
1530 1530
 				}
1531 1531
 			}
1532 1532
 		}
1533 1533
 
1534 1534
 		global $map_jason;
1535
-		$marker_json      = $post->marker_json != '' ? json_decode( $post->marker_json, true ) : array();
1536
-		$marker_icon      = ( ! empty( $marker_json ) && ! empty( $marker_json['i'] ) ) ? $marker_json['i'] : '';
1537
-		$icon_size        = geodir_get_marker_size( $marker_icon );
1535
+		$marker_json      = $post->marker_json != '' ? json_decode($post->marker_json, true) : array();
1536
+		$marker_icon      = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : '';
1537
+		$icon_size        = geodir_get_marker_size($marker_icon);
1538 1538
 		$marker_json['w'] = $icon_size['w'];
1539 1539
 		$marker_json['h'] = $icon_size['h'];
1540
-		$map_jason[]      = json_encode( $marker_json );
1540
+		$map_jason[]      = json_encode($marker_json);
1541 1541
 
1542
-		$address_latitude  = isset( $post->post_latitude ) ? $post->post_latitude : '';
1543
-		$address_longitude = isset( $post->post_longitude ) ? $post->post_longitude : '';
1544
-		$mapview           = isset( $post->post_mapview ) ? $post->post_mapview : '';
1545
-		$mapzoom           = isset( $post->post_mapzoom ) ? $post->post_mapzoom : '';
1546
-		if ( ! $mapzoom ) {
1542
+		$address_latitude  = isset($post->post_latitude) ? $post->post_latitude : '';
1543
+		$address_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
1544
+		$mapview           = isset($post->post_mapview) ? $post->post_mapview : '';
1545
+		$mapzoom           = isset($post->post_mapzoom) ? $post->post_mapzoom : '';
1546
+		if (!$mapzoom) {
1547 1547
 			$mapzoom = 12;
1548 1548
 		}
1549 1549
 
@@ -1566,37 +1566,37 @@  discard block
 block discarded – undo
1566 1566
 		$map_args['map_class_name']           = 'geodir-map-preview-page';
1567 1567
 	}
1568 1568
 
1569
-	$arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user
1569
+	$arr_detail_page_tabs = geodir_detail_page_tabs_list(); // get this sooner so we can get the active tab for the user
1570 1570
 
1571 1571
 	$active_tab       = '';
1572 1572
 	$active_tab_name  = '';
1573 1573
 	$default_tab      = '';
1574 1574
 	$default_tab_name = '';
1575
-	foreach ( $arr_detail_page_tabs as $tab_index => $tabs ) {
1576
-		if ( isset( $tabs['is_active_tab'] ) && $tabs['is_active_tab'] && ! empty( $tabs['is_display'] ) && isset( $tabs['heading_text'] ) && $tabs['heading_text'] ) {
1575
+	foreach ($arr_detail_page_tabs as $tab_index => $tabs) {
1576
+		if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
1577 1577
 			$active_tab      = $tab_index;
1578
-			$active_tab_name = __( $tabs['heading_text'], 'geodirectory' );
1578
+			$active_tab_name = __($tabs['heading_text'], 'geodirectory');
1579 1579
 		}
1580 1580
 
1581
-		if ( $default_tab === '' && ! empty( $tabs['is_display'] ) && ! empty( $tabs['heading_text'] ) ) {
1581
+		if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
1582 1582
 			$default_tab      = $tab_index;
1583
-			$default_tab_name = __( $tabs['heading_text'], 'geodirectory' );
1583
+			$default_tab_name = __($tabs['heading_text'], 'geodirectory');
1584 1584
 		}
1585 1585
 	}
1586 1586
 
1587
-	if ( $active_tab === '' && $default_tab !== '' ) { // Make first tab as a active tab if not any tab is active.
1588
-		if ( isset( $arr_detail_page_tabs[ $active_tab ] ) && isset( $arr_detail_page_tabs[ $active_tab ]['is_active_tab'] ) ) {
1589
-			$arr_detail_page_tabs[ $active_tab ]['is_active_tab'] = false;
1587
+	if ($active_tab === '' && $default_tab !== '') { // Make first tab as a active tab if not any tab is active.
1588
+		if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
1589
+			$arr_detail_page_tabs[$active_tab]['is_active_tab'] = false;
1590 1590
 		}
1591 1591
 
1592
-		$arr_detail_page_tabs[ $default_tab ]['is_active_tab'] = true;
1592
+		$arr_detail_page_tabs[$default_tab]['is_active_tab'] = true;
1593 1593
 		$active_tab                                            = $default_tab;
1594 1594
 		$active_tab_name                                       = $default_tab_name;
1595 1595
 	}
1596
-	$tab_list = ( get_option( 'geodir_disable_tabs', false ) ) ? true : false;
1596
+	$tab_list = (get_option('geodir_disable_tabs', false)) ? true : false;
1597 1597
 	?>
1598 1598
 	<div class="geodir-tabs" id="gd-tabs" style="position:relative;">
1599
-		<?php if ( ! $tab_list ){ ?>
1599
+		<?php if (!$tab_list) { ?>
1600 1600
 		<div id="geodir-tab-mobile-menu">
1601 1601
 			<i class="fa fa-bars"></i>
1602 1602
 			<span class="geodir-mobile-active-tab"><?php echo $active_tab_name; ?></span>
@@ -1611,26 +1611,26 @@  discard block
 block discarded – undo
1611 1611
 			 * @since 1.0.0
1612 1612
 			 * @see   'geodir_after_tab_list'
1613 1613
 			 */
1614
-			do_action( 'geodir_before_tab_list' ); ?>
1614
+			do_action('geodir_before_tab_list'); ?>
1615 1615
 			<?php
1616 1616
 
1617
-			foreach ( $arr_detail_page_tabs as $tab_index => $detail_page_tab ) {
1618
-				if ( $detail_page_tab['is_display'] ) {
1617
+			foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
1618
+				if ($detail_page_tab['is_display']) {
1619 1619
 
1620
-					if ( ! $tab_list ) {
1620
+					if (!$tab_list) {
1621 1621
 						?>
1622 1622
 						<dt></dt> <!-- added to comply with validation -->
1623
-						<dd <?php if ( $detail_page_tab['is_active_tab'] ){ ?>class="geodir-tab-active"<?php } ?> ><a
1623
+						<dd <?php if ($detail_page_tab['is_active_tab']) { ?>class="geodir-tab-active"<?php } ?> ><a
1624 1624
 								data-tab="#<?php echo $tab_index; ?>"
1625
-								data-status="enable"><?php _e( $detail_page_tab['heading_text'], 'geodirectory' ); ?></a>
1625
+								data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a>
1626 1626
 						</dd>
1627 1627
 						<?php
1628 1628
 					}
1629 1629
 					ob_start() // start tab content buffering
1630 1630
 					?>
1631 1631
 					<li id="<?php echo $tab_index; ?>Tab">
1632
-						<?php if ( $tab_list ) {
1633
-							$tab_title = '<span class="gd-tab-list-title" ><a href="#' . $tab_index . '">' . __( $detail_page_tab['heading_text'], 'geodirectory' ) . '</a></span><hr />';
1632
+						<?php if ($tab_list) {
1633
+							$tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'], 'geodirectory').'</a></span><hr />';
1634 1634
 							/**
1635 1635
 							 * Filter the tab list title html.
1636 1636
 							 *
@@ -1640,7 +1640,7 @@  discard block
 block discarded – undo
1640 1640
 							 * @param string $tab_index      The tab index type.
1641 1641
 							 * @param array $detail_page_tab The array of values including title text.
1642 1642
 							 */
1643
-							echo apply_filters( 'geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab );
1643
+							echo apply_filters('geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab);
1644 1644
 						} ?>
1645 1645
 						<div id="<?php echo $tab_index; ?>" class="hash-offset"></div>
1646 1646
 						<?php
@@ -1651,7 +1651,7 @@  discard block
 block discarded – undo
1651 1651
 						 *
1652 1652
 						 * @param string $tab_index The tab name ID.
1653 1653
 						 */
1654
-						do_action( 'geodir_before_tab_content', $tab_index );
1654
+						do_action('geodir_before_tab_content', $tab_index);
1655 1655
 
1656 1656
 						/**
1657 1657
 						 * Called before the details tab content is output per tab.
@@ -1661,21 +1661,21 @@  discard block
 block discarded – undo
1661 1661
 						 * @since 1.0.0
1662 1662
 						 * @todo  do we need this if we have the hook above? 'geodir_before_tab_content'
1663 1663
 						 */
1664
-						do_action( 'geodir_before_' . $tab_index . '_tab_content' );
1664
+						do_action('geodir_before_'.$tab_index.'_tab_content');
1665 1665
 						/// write a code to generate content of each tab
1666
-						switch ( $tab_index ) {
1666
+						switch ($tab_index) {
1667 1667
 							case 'post_profile':
1668 1668
 								/**
1669 1669
 								 * Called before the listing description content on the details page tab.
1670 1670
 								 *
1671 1671
 								 * @since 1.0.0
1672 1672
 								 */
1673
-								do_action( 'geodir_before_description_on_listing_detail' );
1674
-								if ( geodir_is_page( 'detail' ) ) {
1673
+								do_action('geodir_before_description_on_listing_detail');
1674
+								if (geodir_is_page('detail')) {
1675 1675
 									the_content();
1676 1676
 								} else {
1677 1677
 									/** This action is documented in geodirectory_template_actions.php */
1678
-									echo apply_filters( 'the_content', stripslashes( $post->post_desc ) );
1678
+									echo apply_filters('the_content', stripslashes($post->post_desc));
1679 1679
 								}
1680 1680
 
1681 1681
 								/**
@@ -1683,7 +1683,7 @@  discard block
 block discarded – undo
1683 1683
 								 *
1684 1684
 								 * @since 1.0.0
1685 1685
 								 */
1686
-								do_action( 'geodir_after_description_on_listing_detail' );
1686
+								do_action('geodir_after_description_on_listing_detail');
1687 1687
 								break;
1688 1688
 							case 'post_info':
1689 1689
 								echo $geodir_post_detail_fields;
@@ -1693,32 +1693,32 @@  discard block
 block discarded – undo
1693 1693
 								break;
1694 1694
 							case 'post_video':
1695 1695
 								// some browsers hide $_POST data if used for embeds so we replace with a placeholder
1696
-								if ( $preview ) {
1697
-									if ( $video ) {
1698
-										echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />" . __( 'Video Preview Placeholder', 'geodirectory' ) . "</p></span>";
1696
+								if ($preview) {
1697
+									if ($video) {
1698
+										echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />".__('Video Preview Placeholder', 'geodirectory')."</p></span>";
1699 1699
 									}
1700 1700
 								} else {
1701 1701
 
1702 1702
 									// stop payment manager filtering content length
1703
-									$filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1704
-									if ( false !== $filter_priority ) {
1705
-										remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1703
+									$filter_priority = has_filter('the_content', 'geodir_payments_the_content');
1704
+									if (false !== $filter_priority) {
1705
+										remove_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1706 1706
 									}
1707 1707
 
1708 1708
 									/** This action is documented in geodirectory_template_actions.php */
1709
-									echo apply_filters( 'the_content', stripslashes( $video ) );// we apply the_content filter so oembed works also;
1709
+									echo apply_filters('the_content', stripslashes($video)); // we apply the_content filter so oembed works also;
1710 1710
 
1711
-									if ( false !== $filter_priority ) {
1712
-										add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1711
+									if (false !== $filter_priority) {
1712
+										add_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1713 1713
 									}
1714 1714
 								}
1715 1715
 								break;
1716 1716
 							case 'special_offers':
1717
-								echo apply_filters( 'gd_special_offers_content', wpautop( stripslashes( $special_offers ) ) );
1717
+								echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
1718 1718
 
1719 1719
 								break;
1720 1720
 							case 'post_map':
1721
-								geodir_draw_map( $map_args );
1721
+								geodir_draw_map($map_args);
1722 1722
 								break;
1723 1723
 							case 'reviews':
1724 1724
 								comments_template();
@@ -1727,7 +1727,7 @@  discard block
 block discarded – undo
1727 1727
 								echo $related_listing;
1728 1728
 								break;
1729 1729
 							default: {
1730
-								if ( ( isset( $post->{$tab_index} ) || ( ! isset( $post->{$tab_index} ) && ( strpos( $tab_index, 'gd_tab_' ) !== false || $tab_index == 'link_business' ) ) ) && ! empty( $detail_page_tab['tab_content'] ) ) {
1730
+								if ((isset($post->{$tab_index} ) || (!isset($post->{$tab_index} ) && (strpos($tab_index, 'gd_tab_') !== false || $tab_index == 'link_business'))) && !empty($detail_page_tab['tab_content'])) {
1731 1731
 									echo $detail_page_tab['tab_content'];
1732 1732
 								}
1733 1733
 							}
@@ -1739,7 +1739,7 @@  discard block
 block discarded – undo
1739 1739
 						 *
1740 1740
 						 * @since 1.0.0
1741 1741
 						 */
1742
-						do_action( 'geodir_after_tab_content', $tab_index );
1742
+						do_action('geodir_after_tab_content', $tab_index);
1743 1743
 
1744 1744
 						/**
1745 1745
 						 * Called after the details tab content is output per tab.
@@ -1749,7 +1749,7 @@  discard block
 block discarded – undo
1749 1749
 						 * @since 1.0.0
1750 1750
 						 * @todo  do we need this if we have the hook above? 'geodir_after_tab_content'
1751 1751
 						 */
1752
-						do_action( 'geodir_after_' . $tab_index . '_tab_content' );
1752
+						do_action('geodir_after_'.$tab_index.'_tab_content');
1753 1753
 						?> </li>
1754 1754
 					<?php
1755 1755
 					/**
@@ -1757,7 +1757,7 @@  discard block
 block discarded – undo
1757 1757
 					 *
1758 1758
 					 * @since 1.0.0
1759 1759
 					 */
1760
-					$arr_detail_page_tabs[ $tab_index ]['tab_content'] = apply_filters( "geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean() );
1760
+					$arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_".$detail_page_tab['tab_content']."_tab_content", ob_get_clean());
1761 1761
 				} // end of if for is_display
1762 1762
 			}// end of foreach
1763 1763
 
@@ -1767,14 +1767,14 @@  discard block
 block discarded – undo
1767 1767
 			 * @since 1.0.0
1768 1768
 			 * @see   'geodir_before_tab_list'
1769 1769
 			 */
1770
-			do_action( 'geodir_after_tab_list' );
1770
+			do_action('geodir_after_tab_list');
1771 1771
 			?>
1772
-			<?php if ( ! $tab_list ){ ?></dl><?php } ?>
1773
-		<ul class="geodir-tabs-content entry-content <?php if ( $tab_list ) { ?>geodir-tabs-list<?php } ?>"
1772
+			<?php if (!$tab_list) { ?></dl><?php } ?>
1773
+		<ul class="geodir-tabs-content entry-content <?php if ($tab_list) { ?>geodir-tabs-list<?php } ?>"
1774 1774
 		    style="position:relative;">
1775 1775
 			<?php
1776
-			foreach ( $arr_detail_page_tabs as $detail_page_tab ) {
1777
-				if ( $detail_page_tab['is_display'] && ! empty( $detail_page_tab['tab_content'] ) ) {
1776
+			foreach ($arr_detail_page_tabs as $detail_page_tab) {
1777
+				if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
1778 1778
 					echo $detail_page_tab['tab_content'];
1779 1779
 				}// end of if
1780 1780
 			}// end of foreach
@@ -1784,11 +1784,11 @@  discard block
 block discarded – undo
1784 1784
 			 *
1785 1785
 			 * @since 1.0.0
1786 1786
 			 */
1787
-			do_action( 'geodir_add_tab_content' ); ?>
1787
+			do_action('geodir_add_tab_content'); ?>
1788 1788
 		</ul>
1789 1789
 		<!--gd-tabs-content ul end-->
1790 1790
 	</div>
1791
-	<?php if ( ! $tab_list ) { ?>
1791
+	<?php if (!$tab_list) { ?>
1792 1792
 		<script>
1793 1793
 			if (window.location.hash && window.location.hash.indexOf('&') === -1 && jQuery(window.location.hash + 'Tab').length) {
1794 1794
 				hashVal = window.location.hash;
@@ -1820,31 +1820,31 @@  discard block
 block discarded – undo
1820 1820
  *
1821 1821
  * @return mixed Image file.
1822 1822
  */
1823
-function geodir_exif( $file ) {
1824
-	if ( empty( $file ) || ! is_array( $file ) ) {
1823
+function geodir_exif($file) {
1824
+	if (empty($file) || !is_array($file)) {
1825 1825
 		return $file;
1826 1826
 	}
1827 1827
 
1828
-	$file_path = ! empty( $file['tmp_name'] ) ? sanitize_text_field( $file['tmp_name'] ) : '';
1829
-	if ( ! ( $file_path && file_exists( $file_path ) ) ) {
1828
+	$file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : '';
1829
+	if (!($file_path && file_exists($file_path))) {
1830 1830
 		return $file;
1831 1831
 	}
1832 1832
 	$file['file'] = $file_path;
1833 1833
 
1834
-	if ( ! file_is_valid_image( $file_path ) ) {
1834
+	if (!file_is_valid_image($file_path)) {
1835 1835
 		return $file; // Bail if file is not an image.
1836 1836
 	}
1837 1837
 
1838
-	if ( ! function_exists( 'wp_get_image_editor' ) ) {
1838
+	if (!function_exists('wp_get_image_editor')) {
1839 1839
 		return $file;
1840 1840
 	}
1841 1841
 
1842 1842
 	$mime_type = $file['type'];
1843 1843
 	$exif      = array();
1844
-	if ( $mime_type == 'image/jpeg' && function_exists( 'exif_read_data' ) ) {
1844
+	if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
1845 1845
 		try {
1846
-			$exif = exif_read_data( $file_path );
1847
-		} catch ( Exception $e ) {
1846
+			$exif = exif_read_data($file_path);
1847
+		} catch (Exception $e) {
1848 1848
 			$exif = array();
1849 1849
 		}
1850 1850
 	}
@@ -1853,13 +1853,13 @@  discard block
 block discarded – undo
1853 1853
 	$flip        = false;
1854 1854
 	$modify      = false;
1855 1855
 	$orientation = 0;
1856
-	if ( ! empty( $exif ) && isset( $exif['Orientation'] ) ) {
1857
-		switch ( (int) $exif['Orientation'] ) {
1856
+	if (!empty($exif) && isset($exif['Orientation'])) {
1857
+		switch ((int) $exif['Orientation']) {
1858 1858
 			case 1:
1859 1859
 				// do nothing
1860 1860
 				break;
1861 1861
 			case 2:
1862
-				$flip   = array( false, true );
1862
+				$flip   = array(false, true);
1863 1863
 				$modify = true;
1864 1864
 				break;
1865 1865
 			case 3:
@@ -1868,13 +1868,13 @@  discard block
 block discarded – undo
1868 1868
 				$modify      = true;
1869 1869
 				break;
1870 1870
 			case 4:
1871
-				$flip   = array( true, false );
1871
+				$flip   = array(true, false);
1872 1872
 				$modify = true;
1873 1873
 				break;
1874 1874
 			case 5:
1875 1875
 				$orientation = - 90;
1876 1876
 				$rotate      = true;
1877
-				$flip        = array( false, true );
1877
+				$flip        = array(false, true);
1878 1878
 				$modify      = true;
1879 1879
 				break;
1880 1880
 			case 6:
@@ -1885,7 +1885,7 @@  discard block
 block discarded – undo
1885 1885
 			case 7:
1886 1886
 				$orientation = - 270;
1887 1887
 				$rotate      = true;
1888
-				$flip        = array( false, true );
1888
+				$flip        = array(false, true);
1889 1889
 				$modify      = true;
1890 1890
 				break;
1891 1891
 			case 8:
@@ -1911,31 +1911,31 @@  discard block
 block discarded – undo
1911 1911
 	 * @param int|null $quality Image Compression quality between 1-100% scale. Default null.
1912 1912
 	 * @param string $quality   Image mime type.
1913 1913
 	 */
1914
-	$quality = apply_filters( 'geodir_image_upload_set_quality', $quality, $mime_type );
1915
-	if ( $quality !== null ) {
1914
+	$quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
1915
+	if ($quality !== null) {
1916 1916
 		$modify = true;
1917 1917
 	}
1918 1918
 
1919
-	if ( ! $modify ) {
1919
+	if (!$modify) {
1920 1920
 		return $file; // no change
1921 1921
 	}
1922 1922
 
1923
-	$image = wp_get_image_editor( $file_path );
1924
-	if ( ! is_wp_error( $image ) ) {
1925
-		if ( $rotate ) {
1926
-			$image->rotate( $orientation );
1923
+	$image = wp_get_image_editor($file_path);
1924
+	if (!is_wp_error($image)) {
1925
+		if ($rotate) {
1926
+			$image->rotate($orientation);
1927 1927
 		}
1928 1928
 
1929
-		if ( ! empty( $flip ) ) {
1930
-			$image->flip( $flip[0], $flip[1] );
1929
+		if (!empty($flip)) {
1930
+			$image->flip($flip[0], $flip[1]);
1931 1931
 		}
1932 1932
 
1933
-		if ( $quality !== null ) {
1934
-			$image->set_quality( (int) $quality );
1933
+		if ($quality !== null) {
1934
+			$image->set_quality((int) $quality);
1935 1935
 		}
1936 1936
 
1937
-		$result = $image->save( $file_path );
1938
-		if ( ! is_wp_error( $result ) ) {
1937
+		$result = $image->save($file_path);
1938
+		if (!is_wp_error($result)) {
1939 1939
 			$file['file']     = $result['path'];
1940 1940
 			$file['tmp_name'] = $result['path'];
1941 1941
 		}
@@ -1962,7 +1962,7 @@  discard block
 block discarded – undo
1962 1962
  *
1963 1963
  * @return string Returns the recent reviews html.
1964 1964
  */
1965
-function geodir_get_recent_reviews( $g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false ) {
1965
+function geodir_get_recent_reviews($g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false) {
1966 1966
 	global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session;
1967 1967
 	$tablecomments = $wpdb->comments;
1968 1968
 	$tableposts    = $wpdb->posts;
@@ -1972,28 +1972,28 @@  discard block
 block discarded – undo
1972 1972
 	$region_filter  = '';
1973 1973
 	$country_filter = '';
1974 1974
 
1975
-	if ( $gd_session->get( 'gd_multi_location' ) ) {
1976
-		if ( $gd_ses_country = $gd_session->get( 'gd_country' ) ) {
1977
-			$country_filter = $wpdb->prepare( " AND r.post_country=%s ", str_replace( "-", " ", $gd_ses_country ) );
1975
+	if ($gd_session->get('gd_multi_location')) {
1976
+		if ($gd_ses_country = $gd_session->get('gd_country')) {
1977
+			$country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
1978 1978
 		}
1979 1979
 
1980
-		if ( $gd_ses_region = $gd_session->get( 'gd_region' ) ) {
1981
-			$region_filter = $wpdb->prepare( " AND r.post_region=%s ", str_replace( "-", " ", $gd_ses_region ) );
1980
+		if ($gd_ses_region = $gd_session->get('gd_region')) {
1981
+			$region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
1982 1982
 		}
1983 1983
 
1984
-		if ( $gd_ses_city = $gd_session->get( 'gd_city' ) ) {
1985
-			$city_filter = $wpdb->prepare( " AND r.post_city=%s ", str_replace( "-", " ", $gd_ses_city ) );
1984
+		if ($gd_ses_city = $gd_session->get('gd_city')) {
1985
+			$city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
1986 1986
 		}
1987 1987
 	}
1988 1988
 
1989 1989
 	$review_table = GEODIR_REVIEW_TABLE;
1990 1990
 	$request      = "SELECT r.id as ID, r.post_type, r.comment_id as comment_ID, r.post_date as comment_date,r.overall_rating, r.user_id, r.post_id FROM $review_table as r WHERE r.post_status = 1 AND r.status =1 AND r.overall_rating>=1 $country_filter $region_filter $city_filter ORDER BY r.post_date DESC, r.id DESC LIMIT $no_comments";
1991 1991
 
1992
-	$comments = $wpdb->get_results( $request );
1992
+	$comments = $wpdb->get_results($request);
1993 1993
 
1994
-	foreach ( $comments as $comment ) {
1994
+	foreach ($comments as $comment) {
1995 1995
 		// Set the extra comment info needed.
1996
-		$comment_extra = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID" );
1996
+		$comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
1997 1997
 		//echo "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID";
1998 1998
 		$comment->comment_content      = $comment_extra->comment_content;
1999 1999
 		$comment->comment_author       = $comment_extra->comment_author;
@@ -2001,75 +2001,75 @@  discard block
 block discarded – undo
2001 2001
 
2002 2002
 		$comment_id      = '';
2003 2003
 		$comment_id      = $comment->comment_ID;
2004
-		$comment_content = strip_tags( $comment->comment_content );
2004
+		$comment_content = strip_tags($comment->comment_content);
2005 2005
 
2006
-		$comment_content = preg_replace( '#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content );
2006
+		$comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
2007 2007
 
2008
-		$permalink            = get_permalink( $comment->ID ) . "#comment-" . $comment->comment_ID;
2008
+		$permalink            = get_permalink($comment->ID)."#comment-".$comment->comment_ID;
2009 2009
 		$comment_author_email = $comment->comment_author_email;
2010 2010
 		$comment_post_ID      = $comment->post_id;
2011 2011
 
2012 2012
 		$na = true;
2013
-		if ( function_exists( 'icl_object_id' ) && icl_object_id( $comment_post_ID, $comment->post_type, true ) ) {
2014
-			$comment_post_ID2 = icl_object_id( $comment_post_ID, $comment->post_type, false );
2015
-			if ( $comment_post_ID == $comment_post_ID2 ) {
2013
+		if (function_exists('icl_object_id') && icl_object_id($comment_post_ID, $comment->post_type, true)) {
2014
+			$comment_post_ID2 = icl_object_id($comment_post_ID, $comment->post_type, false);
2015
+			if ($comment_post_ID == $comment_post_ID2) {
2016 2016
 			} else {
2017 2017
 				$na = false;
2018 2018
 			}
2019 2019
 		}
2020 2020
 
2021
-		$post_title        = get_the_title( $comment_post_ID );
2022
-		$permalink         = get_permalink( $comment_post_ID );
2023
-		$comment_permalink = $permalink . "#comment-" . $comment->comment_ID;
2024
-		$read_more         = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __( 'Read more', 'geodirectory' ) . '</a>';
2021
+		$post_title        = get_the_title($comment_post_ID);
2022
+		$permalink         = get_permalink($comment_post_ID);
2023
+		$comment_permalink = $permalink."#comment-".$comment->comment_ID;
2024
+		$read_more         = '<a class="comment_excerpt" href="'.$comment_permalink.'">'.__('Read more', 'geodirectory').'</a>';
2025 2025
 
2026
-		$comment_content_length = strlen( $comment_content );
2027
-		if ( $comment_content_length > $comment_lenth ) {
2028
-			$comment_excerpt = geodir_utf8_substr( $comment_content, 0, $comment_lenth ) . '... ' . $read_more;
2026
+		$comment_content_length = strlen($comment_content);
2027
+		if ($comment_content_length > $comment_lenth) {
2028
+			$comment_excerpt = geodir_utf8_substr($comment_content, 0, $comment_lenth).'... '.$read_more;
2029 2029
 		} else {
2030 2030
 			$comment_excerpt = $comment_content;
2031 2031
 		}
2032 2032
 
2033
-		if ( $comment->user_id ) {
2034
-			$user_profile_url = get_author_posts_url( $comment->user_id );
2033
+		if ($comment->user_id) {
2034
+			$user_profile_url = get_author_posts_url($comment->user_id);
2035 2035
 		} else {
2036 2036
 			$user_profile_url = '';
2037 2037
 		}
2038 2038
 
2039
-		if ( $comment_id && $na ) {
2039
+		if ($comment_id && $na) {
2040 2040
 			$comments_echo .= '<li class="clearfix">';
2041
-			$comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">";
2042
-			if ( function_exists( 'get_avatar' ) ) {
2043
-				if ( ! isset( $comment->comment_type ) ) {
2044
-					if ( $user_profile_url ) {
2045
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2041
+			$comments_echo .= "<span class=\"li".$comment_id." geodir_reviewer_image\">";
2042
+			if (function_exists('get_avatar')) {
2043
+				if (!isset($comment->comment_type)) {
2044
+					if ($user_profile_url) {
2045
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2046 2046
 					}
2047
-					$comments_echo .= get_avatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2048
-					if ( $user_profile_url ) {
2047
+					$comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2048
+					if ($user_profile_url) {
2049 2049
 						$comments_echo .= '</a>';
2050 2050
 					}
2051
-				} elseif ( ( isset( $comment->comment_type ) && $comment->comment_type == 'trackback' ) || ( isset( $comment->comment_type ) && $comment->comment_type == 'pingback' ) ) {
2052
-					if ( $user_profile_url ) {
2053
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2051
+				} elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
2052
+					if ($user_profile_url) {
2053
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2054 2054
 					}
2055
-					$comments_echo .= get_avatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2055
+					$comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2056 2056
 				}
2057
-			} elseif ( function_exists( 'gravatar' ) ) {
2058
-				if ( $user_profile_url ) {
2059
-					$comments_echo .= '<a href="' . $user_profile_url . '">';
2057
+			} elseif (function_exists('gravatar')) {
2058
+				if ($user_profile_url) {
2059
+					$comments_echo .= '<a href="'.$user_profile_url.'">';
2060 2060
 				}
2061 2061
 				$comments_echo .= "<img src=\"";
2062
-				if ( '' == $comment->comment_type ) {
2063
-					$comments_echo .= gravatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2064
-					if ( $user_profile_url ) {
2062
+				if ('' == $comment->comment_type) {
2063
+					$comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2064
+					if ($user_profile_url) {
2065 2065
 						$comments_echo .= '</a>';
2066 2066
 					}
2067
-				} elseif ( ( 'trackback' == $comment->comment_type ) || ( 'pingback' == $comment->comment_type ) ) {
2068
-					if ( $user_profile_url ) {
2069
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2067
+				} elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
2068
+					if ($user_profile_url) {
2069
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2070 2070
 					}
2071
-					$comments_echo .= gravatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2072
-					if ( $user_profile_url ) {
2071
+					$comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2072
+					if ($user_profile_url) {
2073 2073
 						$comments_echo .= '</a>';
2074 2074
 					}
2075 2075
 				}
@@ -2079,17 +2079,17 @@  discard block
 block discarded – undo
2079 2079
 			$comments_echo .= "</span>\n";
2080 2080
 
2081 2081
 			$comments_echo .= '<span class="geodir_reviewer_content">';
2082
-			if ( $comment->user_id ) {
2083
-				$comments_echo .= '<a href="' . get_author_posts_url( $comment->user_id ) . '">';
2082
+			if ($comment->user_id) {
2083
+				$comments_echo .= '<a href="'.get_author_posts_url($comment->user_id).'">';
2084 2084
 			}
2085
-			$comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> ';
2086
-			if ( $comment->user_id ) {
2085
+			$comments_echo .= '<span class="geodir_reviewer_author">'.$comment->comment_author.'</span> ';
2086
+			if ($comment->user_id) {
2087 2087
 				$comments_echo .= '</a>';
2088 2088
 			}
2089
-			$comments_echo .= '<span class="geodir_reviewer_reviewed">' . __( 'reviewed', 'geodirectory' ) . '</span> ';
2090
-			$comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>';
2091
-			$comments_echo .= geodir_get_rating_stars( $comment->overall_rating, $comment_post_ID );
2092
-			$comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . '';
2089
+			$comments_echo .= '<span class="geodir_reviewer_reviewed">'.__('reviewed', 'geodirectory').'</span> ';
2090
+			$comments_echo .= '<a href="'.$permalink.'" class="geodir_reviewer_title">'.$post_title.'</a>';
2091
+			$comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID);
2092
+			$comments_echo .= '<p class="geodir_reviewer_text">'.$comment_excerpt.'';
2093 2093
 			//echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
2094 2094
 			$comments_echo .= '</p>';
2095 2095
 
@@ -2109,25 +2109,25 @@  discard block
 block discarded – undo
2109 2109
  * @return array Returns post categories as an array.
2110 2110
  */
2111 2111
 function geodir_home_map_cats_key_value_array() {
2112
-	$post_types = geodir_get_posttypes( 'object' );
2112
+	$post_types = geodir_get_posttypes('object');
2113 2113
 
2114 2114
 	$return = array();
2115
-	if ( ! empty( $post_types ) ) {
2116
-		foreach ( $post_types as $key => $post_type ) {
2117
-			$cpt_name       = __( $post_type->labels->singular_name, 'geodirectory' );
2118
-			$post_type_name = sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name );
2119
-			$taxonomies     = geodir_get_taxonomies( $key );
2120
-			$cat_taxonomy   = ! empty( $taxonomies[0] ) ? $taxonomies[0] : null;
2121
-			$cat_terms      = $cat_taxonomy ? get_terms( $cat_taxonomy ) : null;
2122
-
2123
-			if ( ! empty( $cat_terms ) ) {
2124
-				$return[ 'optgroup_start-' . $key ] = $post_type_name;
2125
-
2126
-				foreach ( $cat_terms as $cat_term ) {
2127
-					$return[ $key . '_' . $cat_term->term_id ] = $cat_term->name;
2115
+	if (!empty($post_types)) {
2116
+		foreach ($post_types as $key => $post_type) {
2117
+			$cpt_name       = __($post_type->labels->singular_name, 'geodirectory');
2118
+			$post_type_name = sprintf(__('%s Categories', 'geodirectory'), $cpt_name);
2119
+			$taxonomies     = geodir_get_taxonomies($key);
2120
+			$cat_taxonomy   = !empty($taxonomies[0]) ? $taxonomies[0] : null;
2121
+			$cat_terms      = $cat_taxonomy ? get_terms($cat_taxonomy) : null;
2122
+
2123
+			if (!empty($cat_terms)) {
2124
+				$return['optgroup_start-'.$key] = $post_type_name;
2125
+
2126
+				foreach ($cat_terms as $cat_term) {
2127
+					$return[$key.'_'.$cat_term->term_id] = $cat_term->name;
2128 2128
 				}
2129 2129
 
2130
-				$return[ 'optgroup_end-' . $key ] = $post_type_name;
2130
+				$return['optgroup_end-'.$key] = $post_type_name;
2131 2131
 			}
2132 2132
 		}
2133 2133
 	}
@@ -2143,14 +2143,14 @@  discard block
 block discarded – undo
2143 2143
  * @package GeoDirectory
2144 2144
  */
2145 2145
 function geodir_twitter_tweet_button() {
2146
-	if ( isset( $_GET['gde'] ) ) {
2147
-		$link = '?url=' . urlencode( geodir_curPageURL() );
2146
+	if (isset($_GET['gde'])) {
2147
+		$link = '?url='.urlencode(geodir_curPageURL());
2148 2148
 	} else {
2149 2149
 		$link = '';
2150 2150
 	}
2151 2151
 	?>
2152 2152
 	<a href="http://twitter.com/share<?php echo $link; ?>"
2153
-	   class="twitter-share-button"><?php _e( 'Tweet', 'geodirectory' ); ?></a>
2153
+	   class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
2154 2154
 	<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
2155 2155
 	<?php
2156 2156
 }
@@ -2167,10 +2167,10 @@  discard block
 block discarded – undo
2167 2167
 function geodir_fb_like_button() {
2168 2168
 	global $post;
2169 2169
 	?>
2170
-	<iframe <?php if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) ) {
2170
+	<iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
2171 2171
 		echo 'allowtransparency="true"';
2172 2172
 	} ?> class="facebook"
2173
-	     src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode( get_permalink( $post->ID ) ); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
2173
+	     src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
2174 2174
 	     style="border:none; overflow:hidden; width:100px; height:20px"></iframe>
2175 2175
 	<?php
2176 2176
 }
@@ -2201,7 +2201,7 @@  discard block
 block discarded – undo
2201 2201
 
2202 2202
 
2203 2203
 function geodir_listing_bounce_map_pin_on_hover() {
2204
-	if ( get_option( 'geodir_listing_hover_bounce_map_pin', true ) ) {
2204
+	if (get_option('geodir_listing_hover_bounce_map_pin', true)) {
2205 2205
 		?>
2206 2206
 		<script>
2207 2207
 			jQuery(function ($) {
@@ -2224,44 +2224,44 @@  discard block
 block discarded – undo
2224 2224
 	}
2225 2225
 }
2226 2226
 
2227
-add_action( 'geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10 );
2227
+add_action('geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10);
2228 2228
 
2229
-add_action( 'geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1 );
2230
-function geodir_output_favourite_html_listings( $post_id ) {
2231
-	geodir_favourite_html( '', $post_id );
2229
+add_action('geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1);
2230
+function geodir_output_favourite_html_listings($post_id) {
2231
+	geodir_favourite_html('', $post_id);
2232 2232
 }
2233 2233
 
2234
-add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2 );
2235
-function geodir_output_pinpoint_html_listings( $post_id, $post ) {
2234
+add_action('geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2);
2235
+function geodir_output_pinpoint_html_listings($post_id, $post) {
2236 2236
 	global $wp_query;
2237 2237
 
2238 2238
 	$show_pin_point = $wp_query->is_main_query();
2239 2239
 
2240
-	if ( ! empty( $show_pin_point ) && is_active_widget( false, "", "geodir_map_v3_listing_map" ) ) {
2241
-		$term_icon_url = geodir_get_tax_meta( $post->default_category, 'ct_cat_icon', false, $post->post_type );
2242
-		$marker_icon   = isset( $term_icon_url['src'] ) ? $term_icon_url['src'] : get_option( 'geodir_default_marker_icon' );
2240
+	if (!empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
2241
+		$term_icon_url = geodir_get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type);
2242
+		$marker_icon   = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
2243 2243
 		?>
2244 2244
 		<span class="geodir-pinpoint"
2245
-		      style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters( 'geodir_listing_listview_pinpoint_inner_content', '', 'listing' ); ?></span>
2245
+		      style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters('geodir_listing_listview_pinpoint_inner_content', '', 'listing'); ?></span>
2246 2246
 		<a class="geodir-pinpoint-link" href="javascript:void(0)"
2247 2247
 		   onclick="if(typeof openMarker=='function'){openMarker('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"
2248 2248
 		   onmouseover="if(typeof animate_marker=='function'){animate_marker('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"
2249
-		   onmouseout="if(typeof stop_marker_animation=='function'){stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"><?php _e( 'Pinpoint', 'geodirectory' ); ?></a>
2249
+		   onmouseout="if(typeof stop_marker_animation=='function'){stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"><?php _e('Pinpoint', 'geodirectory'); ?></a>
2250 2250
 		<?php
2251 2251
 	}
2252 2252
 }
2253 2253
 
2254 2254
 function geodir_search_form_submit_button() {
2255 2255
 
2256
-	$new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true;
2256
+	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2257 2257
 
2258
-	if ( $new_style ) {
2258
+	if ($new_style) {
2259 2259
 		$default_search_button_label = '<i class="fa fa-search" aria-hidden="true"></i>';
2260
-	}else{
2260
+	} else {
2261 2261
 		$default_search_button_label = 'Search';
2262 2262
 	}
2263
-	if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) {
2264
-		$default_search_button_label = __( get_option( 'geodir_search_button_label' ), 'geodirectory' );
2263
+	if (get_option('geodir_search_button_label') && get_option('geodir_search_button_label') != 'Search') {
2264
+		$default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
2265 2265
 	}
2266 2266
 
2267 2267
 	/**
@@ -2273,78 +2273,78 @@  discard block
 block discarded – undo
2273 2273
 	 *
2274 2274
 	 * @param string $default_search_button_label The current search button text.
2275 2275
 	 */
2276
-	$default_search_button_label = apply_filters( 'geodir_search_default_search_button_text', $default_search_button_label );
2276
+	$default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);
2277 2277
 
2278 2278
 	$fa_class = '';
2279
-	if ( strpos( $default_search_button_label, '&#' ) !== false ) {
2279
+	if (strpos($default_search_button_label, '&#') !== false) {
2280 2280
 		$fa_class = 'fa';
2281 2281
 	}
2282 2282
 
2283 2283
 
2284
-	if ( $new_style ) {
2284
+	if ($new_style) {
2285 2285
 	?>
2286
-		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e( $default_search_button_label ,'geodirectory'); ?></button>
2287
-<?php }else{?>
2288
-		<input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>"
2286
+		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e($default_search_button_label, 'geodirectory'); ?></button>
2287
+<?php } else {?>
2288
+		<input type="button" value="<?php esc_attr_e($default_search_button_label); ?>"
2289 2289
 	       class="geodir_submit_search <?php echo $fa_class; ?>"/>
2290 2290
 	<?php }
2291 2291
 }
2292 2292
 
2293
-add_action( 'geodir_before_search_button', 'geodir_search_form_submit_button', 5000 );
2293
+add_action('geodir_before_search_button', 'geodir_search_form_submit_button', 5000);
2294 2294
 
2295 2295
 function geodir_search_form_post_type_input() {
2296 2296
 	global $geodir_search_post_type;
2297
-	$post_types     = apply_filters( 'geodir_search_form_post_types', geodir_get_posttypes( 'object' ) );
2297
+	$post_types     = apply_filters('geodir_search_form_post_types', geodir_get_posttypes('object'));
2298 2298
 	$curr_post_type = $geodir_search_post_type;
2299 2299
 
2300
-	if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2300
+	if (!empty($post_types) && count((array) $post_types) > 1) {
2301 2301
 
2302
-		foreach ( $post_types as $post_type => $info ){
2302
+		foreach ($post_types as $post_type => $info) {
2303 2303
 			global $wpdb;
2304
-			$has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
2305
-			if ( ! $has_posts ) {
2304
+			$has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
2305
+			if (!$has_posts) {
2306 2306
 				unset($post_types->{$post_type});
2307 2307
 			}
2308 2308
 		}
2309 2309
 
2310
-		if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2310
+		if (!empty($post_types) && count((array) $post_types) > 1) {
2311 2311
 
2312
-			$new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true;
2313
-			if ( $new_style ) {
2312
+			$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2313
+			if ($new_style) {
2314 2314
 				echo "<div class='gd-search-input-wrapper gd-search-field-cpt'>";
2315 2315
 			}
2316 2316
 			?>
2317 2317
 			<select name="stype" class="search_by_post">
2318
-				<?php foreach ( $post_types as $post_type => $info ):
2318
+				<?php foreach ($post_types as $post_type => $info):
2319 2319
 					global $wpdb;
2320 2320
 					?>
2321 2321
 
2322
-					<option data-label="<?php echo get_post_type_archive_link( $post_type ); ?>"
2323
-					        value="<?php echo $post_type; ?>" <?php if ( isset( $_REQUEST['stype'] ) ) {
2324
-						if ( $post_type == $_REQUEST['stype'] ) {
2322
+					<option data-label="<?php echo get_post_type_archive_link($post_type); ?>"
2323
+					        value="<?php echo $post_type; ?>" <?php if (isset($_REQUEST['stype'])) {
2324
+						if ($post_type == $_REQUEST['stype']) {
2325 2325
 							echo 'selected="selected"';
2326 2326
 						}
2327
-					} elseif ( $curr_post_type == $post_type ) {
2327
+					} elseif ($curr_post_type == $post_type) {
2328 2328
 						echo 'selected="selected"';
2329
-					} ?>><?php _e( geodir_utf8_ucfirst( $info->labels->name ), 'geodirectory' ); ?></option>
2329
+					} ?>><?php _e(geodir_utf8_ucfirst($info->labels->name), 'geodirectory'); ?></option>
2330 2330
 
2331 2331
 				<?php endforeach; ?>
2332 2332
 			</select>
2333 2333
 			<?php
2334
-			if ( $new_style ) {
2334
+			if ($new_style) {
2335 2335
 				echo "</div>";
2336 2336
 			}
2337
-		}else{
2338
-			if(! empty( $post_types )){
2339
-				$pt_arr = (array)$post_types;
2340
-				echo '<input type="hidden" name="stype" value="' . key( $pt_arr  ) . '"  />';
2341
-			}else{
2337
+		} else {
2338
+			if (!empty($post_types)) {
2339
+				$pt_arr = (array) $post_types;
2340
+				echo '<input type="hidden" name="stype" value="'.key($pt_arr).'"  />';
2341
+			} else {
2342 2342
 				echo '<input type="hidden" name="stype" value="gd_place"  />';
2343 2343
 			}
2344 2344
 
2345 2345
 		}
2346 2346
 
2347
-	}elseif ( ! empty( $post_types ) ) {
2347
+	}elseif (!empty($post_types)) {
2348 2348
 		echo '<input type="hidden" name="stype" value="gd_place"  />';
2349 2349
 	}
2350 2350
 }
@@ -2352,26 +2352,26 @@  discard block
 block discarded – undo
2352 2352
 function geodir_search_form_search_input() {
2353 2353
 
2354 2354
 	$default_search_for_text = SEARCH_FOR_TEXT;
2355
-	if ( get_option( 'geodir_search_field_default_text' ) ) {
2356
-		$default_search_for_text = __( get_option( 'geodir_search_field_default_text' ), 'geodirectory' );
2355
+	if (get_option('geodir_search_field_default_text')) {
2356
+		$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
2357 2357
 	}
2358 2358
 
2359 2359
 	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2360
-	if($new_style){
2360
+	if ($new_style) {
2361 2361
 		echo "<div class='gd-search-input-wrapper gd-search-field-search'>";
2362 2362
 	}
2363 2363
 	?>
2364 2364
 	<input class="search_text" name="s"
2365
-	       value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) {
2366
-		       echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2365
+	       value="<?php if (isset($_REQUEST['s']) && trim($_REQUEST['s']) != '') {
2366
+		       echo esc_attr(stripslashes_deep($_REQUEST['s']));
2367 2367
 	       } else {
2368 2368
 		       echo $default_search_for_text;
2369 2369
 	       } ?>" type="text"
2370
-	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}"
2371
-	       onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}"
2370
+	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql($default_search_for_text); ?>';}"
2371
+	       onfocus="if (this.value == '<?php echo esc_sql($default_search_for_text); ?>') {this.value = '';}"
2372 2372
 	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);">
2373 2373
 	<?php
2374
-	if($new_style){
2374
+	if ($new_style) {
2375 2375
 		echo "</div>";
2376 2376
 	}
2377 2377
 }
@@ -2379,12 +2379,12 @@  discard block
 block discarded – undo
2379 2379
 function geodir_search_form_near_input() {
2380 2380
 
2381 2381
 	$default_near_text = NEAR_TEXT;
2382
-	if ( get_option( 'geodir_near_field_default_text' ) ) {
2383
-		$default_near_text = __( get_option( 'geodir_near_field_default_text' ), 'geodirectory' );
2382
+	if (get_option('geodir_near_field_default_text')) {
2383
+		$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
2384 2384
 	}
2385 2385
 
2386
-	if ( isset( $_REQUEST['snear'] ) && $_REQUEST['snear'] != '' ) {
2387
-		$near = esc_attr( stripslashes_deep( $_REQUEST['snear'] ) );
2386
+	if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') {
2387
+		$near = esc_attr(stripslashes_deep($_REQUEST['snear']));
2388 2388
 	} else {
2389 2389
 		$near = $default_near_text;
2390 2390
 	}
@@ -2398,7 +2398,7 @@  discard block
 block discarded – undo
2398 2398
 	 * @since 1.6.9
2399 2399
 	 * @param string $curr_post_type The current post type.
2400 2400
 	 */
2401
-	$near_input_extra = apply_filters('geodir_near_input_extra','',$curr_post_type);
2401
+	$near_input_extra = apply_filters('geodir_near_input_extra', '', $curr_post_type);
2402 2402
 
2403 2403
 
2404 2404
 	/**
@@ -2411,7 +2411,7 @@  discard block
 block discarded – undo
2411 2411
 	 * @param string $near              The current near value.
2412 2412
 	 * @param string $default_near_text The default near value.
2413 2413
 	 */
2414
-	$near = apply_filters( 'geodir_search_near_text', $near, $default_near_text );
2414
+	$near = apply_filters('geodir_search_near_text', $near, $default_near_text);
2415 2415
 	/**
2416 2416
 	 * Filter the default "Near" text value for the search form.
2417 2417
 	 *
@@ -2422,7 +2422,7 @@  discard block
 block discarded – undo
2422 2422
 	 * @param string $near              The current near value.
2423 2423
 	 * @param string $default_near_text The default near value.
2424 2424
 	 */
2425
-	$default_near_text = apply_filters( 'geodir_search_default_near_text', $default_near_text, $near );
2425
+	$default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near);
2426 2426
 	/**
2427 2427
 	 * Filter the class for the near search input.
2428 2428
 	 *
@@ -2430,10 +2430,10 @@  discard block
 block discarded – undo
2430 2430
 	 *
2431 2431
 	 * @param string $class The class for the HTML near input, default is blank.
2432 2432
 	 */
2433
-	$near_class = apply_filters( 'geodir_search_near_class', '' );
2433
+	$near_class = apply_filters('geodir_search_near_class', '');
2434 2434
 
2435 2435
 	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2436
-	if($new_style){
2436
+	if ($new_style) {
2437 2437
 		echo "<div class='gd-search-input-wrapper gd-search-field-near' $near_input_extra>";
2438 2438
 		
2439 2439
 		do_action('geodir_before_near_input');
@@ -2441,30 +2441,30 @@  discard block
 block discarded – undo
2441 2441
 
2442 2442
 	?>
2443 2443
 	<input name="snear" class="snear <?php echo $near_class; ?>" type="text" value="<?php echo $near; ?>"
2444
-	       onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql( $near ); ?>' != '' ? '<?php echo esc_sql( $near ); ?>' : '<?php echo $default_near_text; ?>');}"
2445
-	       onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql( $near ); ?>') {this.value = '';}"
2446
-	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra;?>/>
2444
+	       onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql($near); ?>' != '' ? '<?php echo esc_sql($near); ?>' : '<?php echo $default_near_text; ?>');}"
2445
+	       onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql($near); ?>') {this.value = '';}"
2446
+	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra; ?>/>
2447 2447
 	<?php
2448
-	if($new_style){
2448
+	if ($new_style) {
2449 2449
 		do_action('geodir_after_near_input');
2450 2450
 
2451 2451
 		echo "</div>";
2452 2452
 	}
2453 2453
 }
2454 2454
 
2455
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10 );
2456
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_search_input', 20 );
2457
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_near_input', 30 );
2455
+add_action('geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10);
2456
+add_action('geodir_search_form_inputs', 'geodir_search_form_search_input', 20);
2457
+add_action('geodir_search_form_inputs', 'geodir_search_form_near_input', 30);
2458 2458
 
2459
-function geodir_get_search_post_type($pt=''){
2459
+function geodir_get_search_post_type($pt = '') {
2460 2460
 	global $geodir_search_post_type;
2461 2461
 
2462
-	if($pt!=''){return $geodir_search_post_type = $pt;}
2463
-	if(!empty($geodir_search_post_type)){ return $geodir_search_post_type;}
2462
+	if ($pt != '') {return $geodir_search_post_type = $pt; }
2463
+	if (!empty($geodir_search_post_type)) { return $geodir_search_post_type; }
2464 2464
 
2465 2465
 	$geodir_search_post_type = geodir_get_current_posttype();
2466 2466
 
2467
-	if(!$geodir_search_post_type) {
2467
+	if (!$geodir_search_post_type) {
2468 2468
 		$geodir_search_post_type = geodir_get_default_posttype();
2469 2469
 	}
2470 2470
 
@@ -2472,7 +2472,7 @@  discard block
 block discarded – undo
2472 2472
 	return $geodir_search_post_type;
2473 2473
 }
2474 2474
 
2475
-function geodir_search_form(){
2475
+function geodir_search_form() {
2476 2476
 
2477 2477
 	geodir_get_search_post_type();
2478 2478
 
@@ -2482,8 +2482,8 @@  discard block
 block discarded – undo
2482 2482
 	die();
2483 2483
 }
2484 2484
 
2485
-add_action( 'wp_ajax_geodir_search_form', 'geodir_search_form' );
2486
-add_action( 'wp_ajax_nopriv_geodir_search_form', 'geodir_search_form' );
2485
+add_action('wp_ajax_geodir_search_form', 'geodir_search_form');
2486
+add_action('wp_ajax_nopriv_geodir_search_form', 'geodir_search_form');
2487 2487
 
2488 2488
 /**
2489 2489
  * Check wpml active or not.
@@ -2557,7 +2557,7 @@  discard block
 block discarded – undo
2557 2557
         }
2558 2558
     }
2559 2559
 }
2560
-add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 );
2560
+add_filter('icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4);
2561 2561
 
2562 2562
 /**
2563 2563
  * Duplicate post listing manually after listing saved.
@@ -2598,7 +2598,7 @@  discard block
 block discarded – undo
2598 2598
 function geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang) {
2599 2599
     global $wpdb;
2600 2600
 
2601
-    $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2601
+    $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM ".GEODIR_REVIEW_TABLE." WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2602 2602
 
2603 2603
     if (!empty($reviews)) {
2604 2604
         foreach ($reviews as $review) {
@@ -2626,14 +2626,14 @@  discard block
 block discarded – undo
2626 2626
     global $wpdb, $plugin_prefix;
2627 2627
 
2628 2628
     $post_type = get_post_type($master_post_id);
2629
-    $post_table = $plugin_prefix . $post_type . '_detail';
2629
+    $post_table = $plugin_prefix.$post_type.'_detail';
2630 2630
 
2631
-    $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
2632
-    $data = (array)$wpdb->get_row($query);
2631
+    $query = $wpdb->prepare("SELECT * FROM ".$post_table." WHERE post_id = %d", array($master_post_id));
2632
+    $data = (array) $wpdb->get_row($query);
2633 2633
 
2634
-    if ( !empty( $data ) ) {
2634
+    if (!empty($data)) {
2635 2635
         $data['post_id'] = $tr_post_id;
2636
-        unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category']);
2636
+        unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type.'category']);
2637 2637
         $wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
2638 2638
         return true;
2639 2639
     }
@@ -2658,7 +2658,7 @@  discard block
 block discarded – undo
2658 2658
     global $sitepress, $wpdb;
2659 2659
     $post_type = get_post_type($master_post_id);
2660 2660
 
2661
-    remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
2661
+    remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language
2662 2662
 
2663 2663
     $taxonomies = get_object_taxonomies($post_type);
2664 2664
     foreach ($taxonomies as $taxonomy) {
@@ -2667,9 +2667,9 @@  discard block
 block discarded – undo
2667 2667
         
2668 2668
         if ($terms) {
2669 2669
             foreach ($terms as $term) {
2670
-                $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
2670
+                $tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang);
2671 2671
                 
2672
-                if (!is_null($tr_id)){
2672
+                if (!is_null($tr_id)) {
2673 2673
                     // not using get_term - unfiltered get_term
2674 2674
                     $translated_term = $wpdb->get_row($wpdb->prepare("
2675 2675
                         SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
@@ -2678,14 +2678,14 @@  discard block
 block discarded – undo
2678 2678
                 }
2679 2679
             }
2680 2680
 
2681
-            if (!is_taxonomy_hierarchical($taxonomy)){
2682
-                $terms_array = array_unique( array_map( 'intval', $terms_array ) );
2681
+            if (!is_taxonomy_hierarchical($taxonomy)) {
2682
+                $terms_array = array_unique(array_map('intval', $terms_array));
2683 2683
             }
2684 2684
 
2685 2685
             wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
2686 2686
             
2687
-            if ($taxonomy == $post_type . 'category') {
2688
-                geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
2687
+            if ($taxonomy == $post_type.'category') {
2688
+                geodir_set_postcat_structure($tr_post_id, $post_type.'category');
2689 2689
             }
2690 2690
         }
2691 2691
     }
@@ -2706,15 +2706,15 @@  discard block
 block discarded – undo
2706 2706
 function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) {
2707 2707
     global $wpdb;
2708 2708
 
2709
-    $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2709
+    $query = $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2710 2710
     $wpdb->query($query);
2711 2711
 
2712
-    $query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2712
+    $query = $wpdb->prepare("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2713 2713
     $post_images = $wpdb->get_results($query);
2714 2714
 
2715
-    if ( !empty( $post_images ) ) {
2716
-        foreach ( $post_images as $post_image) {
2717
-            $image_data = (array)$post_image;
2715
+    if (!empty($post_images)) {
2716
+        foreach ($post_images as $post_image) {
2717
+            $image_data = (array) $post_image;
2718 2718
             unset($image_data['ID']);
2719 2719
             $image_data['post_id'] = $tr_post_id;
2720 2720
             
@@ -2747,13 +2747,13 @@  discard block
 block discarded – undo
2747 2747
 function geodir_wpml_duplicate_post_review($master_comment_id, $master_post_id, $tr_post_id, $lang) {
2748 2748
     global $wpdb, $plugin_prefix, $sitepress;
2749 2749
 
2750
-    $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2750
+    $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2751 2751
 
2752 2752
     if (empty($review)) {
2753 2753
         return false;
2754 2754
     }
2755 2755
     if ($review['post_id'] != $master_post_id) {
2756
-        $wpdb->query($wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2756
+        $wpdb->query($wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2757 2757
         geodir_update_postrating($master_post_id, $post_type);
2758 2758
     }
2759 2759
 
@@ -2764,9 +2764,9 @@  discard block
 block discarded – undo
2764 2764
     }
2765 2765
 
2766 2766
     $post_type = get_post_type($master_post_id);
2767
-    $post_table = $plugin_prefix . $post_type . '_detail';
2767
+    $post_table = $plugin_prefix.$post_type.'_detail';
2768 2768
 
2769
-    $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM " . $post_table . " WHERE post_id = %d", $tr_post_id), ARRAY_A);
2769
+    $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM ".$post_table." WHERE post_id = %d", $tr_post_id), ARRAY_A);
2770 2770
     if (empty($translated_post)) {
2771 2771
         return false;
2772 2772
     }
@@ -2784,7 +2784,7 @@  discard block
 block discarded – undo
2784 2784
         unset($review['id']);
2785 2785
     }
2786 2786
 
2787
-    $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2787
+    $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2788 2788
 
2789 2789
     if ($tr_review_id) { // update review
2790 2790
         $wpdb->update(GEODIR_REVIEW_TABLE, $review, array('id' => $tr_review_id));
@@ -2797,8 +2797,8 @@  discard block
 block discarded – undo
2797 2797
         geodir_update_postrating($tr_post_id, $post_type);
2798 2798
         
2799 2799
         if (defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_review') && $sitepress->get_setting('sync_comments_on_duplicates')) {
2800
-            $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id = %d", array($tr_comment_id)));
2801
-            $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2800
+            $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id = %d", array($tr_comment_id)));
2801
+            $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2802 2802
 
2803 2803
             if (!empty($likes)) {
2804 2804
                 foreach ($likes as $like) {
@@ -2900,7 +2900,7 @@  discard block
 block discarded – undo
2900 2900
  * @return bool True if review star disabled, otherwise false.
2901 2901
  */ 
2902 2902
 function geodir_rating_disabled_post_types() {
2903
-	$post_types = get_option( 'geodir_disable_rating_cpt' );
2903
+	$post_types = get_option('geodir_disable_rating_cpt');
2904 2904
 	
2905 2905
 	/**
2906 2906
 	 * Filter the post types array which have rating disabled.
@@ -2909,7 +2909,7 @@  discard block
 block discarded – undo
2909 2909
 	 *
2910 2910
 	 * @param array $post_types Array of post types which have rating starts disabled.
2911 2911
 	 */
2912
-	return apply_filters( 'geodir_rating_disabled_post_types', $post_types );
2912
+	return apply_filters('geodir_rating_disabled_post_types', $post_types);
2913 2913
 }
2914 2914
 
2915 2915
 /**
@@ -2921,30 +2921,30 @@  discard block
 block discarded – undo
2921 2921
  * @param bool $taxonomy Whether $post_type is taxonomy or not.
2922 2922
  * @return bool True if review star disabled, otherwise false.
2923 2923
  */ 
2924
-function geodir_cpt_has_rating_disabled( $post_type = '', $taxonomy = false ) {
2924
+function geodir_cpt_has_rating_disabled($post_type = '', $taxonomy = false) {
2925 2925
 	$post_types = geodir_rating_disabled_post_types();
2926 2926
 	
2927
-	if ( empty( $post_types ) ) {
2927
+	if (empty($post_types)) {
2928 2928
 		return false;
2929 2929
 	}
2930 2930
 	
2931
-	if ( is_int( $post_type ) ) {
2932
-		$post_type = get_post_type( $post_type );
2931
+	if (is_int($post_type)) {
2932
+		$post_type = get_post_type($post_type);
2933 2933
 	}
2934 2934
 	
2935
-	if ( $taxonomy && !empty( $post_types ) ) {
2935
+	if ($taxonomy && !empty($post_types)) {
2936 2936
 		$posttypes = array();
2937 2937
 		
2938
-		foreach ( $post_types as $posttype ) {
2939
-			$posttypes[] = $posttype . 'category';
2940
-			$posttypes[] = $posttype . '_tags';
2938
+		foreach ($post_types as $posttype) {
2939
+			$posttypes[] = $posttype.'category';
2940
+			$posttypes[] = $posttype.'_tags';
2941 2941
 		}
2942 2942
 		
2943 2943
 		$post_types = $posttypes;
2944 2944
 	}
2945 2945
 
2946 2946
 	$return = false;
2947
-	if ( $post_type != '' && !empty( $post_types ) && in_array( $post_type, $post_types ) ) {
2947
+	if ($post_type != '' && !empty($post_types) && in_array($post_type, $post_types)) {
2948 2948
 		$return = true;
2949 2949
 	}
2950 2950
 
@@ -2959,7 +2959,7 @@  discard block
 block discarded – undo
2959 2959
  * @return bool True if Yoast SEO disabled on GD pages.
2960 2960
  */
2961 2961
 function geodir_disable_yoast_seo_metas() {
2962
-    return (bool)get_option( 'geodir_disable_yoast_meta' );
2962
+    return (bool) get_option('geodir_disable_yoast_meta');
2963 2963
 }
2964 2964
 
2965 2965
 /**
@@ -2970,30 +2970,30 @@  discard block
 block discarded – undo
2970 2970
  * @param int $post_id The post ID.
2971 2971
  * @return bool True if allowed.
2972 2972
  */
2973
-function geodir_wpml_allowed_to_duplicate( $post_id ) {
2973
+function geodir_wpml_allowed_to_duplicate($post_id) {
2974 2974
     $allowed = false;
2975 2975
     
2976
-    if ( !geodir_is_wpml() || empty( $post_id ) ) {
2976
+    if (!geodir_is_wpml() || empty($post_id)) {
2977 2977
         return $allowed;
2978 2978
     }
2979 2979
     
2980
-    $user_id = (int)get_current_user_id();
2980
+    $user_id = (int) get_current_user_id();
2981 2981
     
2982
-    if ( empty( $user_id ) ) {
2982
+    if (empty($user_id)) {
2983 2983
         return $allowed;
2984 2984
     }
2985 2985
     
2986
-    $post_type = get_post_type( $post_id );
2987
-    if ( !is_post_type_translated( $post_type ) || get_post_meta( $post_id, '_icl_lang_duplicate_of', true ) ) {
2986
+    $post_type = get_post_type($post_id);
2987
+    if (!is_post_type_translated($post_type) || get_post_meta($post_id, '_icl_lang_duplicate_of', true)) {
2988 2988
         return $allowed;
2989 2989
     }
2990 2990
     
2991
-    if ( geodir_listing_belong_to_current_user( $post_id ) ) {
2991
+    if (geodir_listing_belong_to_current_user($post_id)) {
2992 2992
         $allowed = true;
2993 2993
     }
2994 2994
     
2995
-    $disable_cpts = get_option( 'geodir_wpml_disable_duplicate' );
2996
-    if ( $allowed && !empty( $disable_cpts ) && in_array( $post_type, $disable_cpts ) ) {
2995
+    $disable_cpts = get_option('geodir_wpml_disable_duplicate');
2996
+    if ($allowed && !empty($disable_cpts) && in_array($post_type, $disable_cpts)) {
2997 2997
         $allowed = false;
2998 2998
     }
2999 2999
     
@@ -3003,7 +3003,7 @@  discard block
 block discarded – undo
3003 3003
      * @param bool $allowed True if allowed.
3004 3004
      * @param int $post_id The post ID.
3005 3005
      */
3006
-    return apply_filters( 'geodir_wpml_allowed_to_duplicate', $allowed, $post_id );
3006
+    return apply_filters('geodir_wpml_allowed_to_duplicate', $allowed, $post_id);
3007 3007
 }
3008 3008
 
3009 3009
 /**
@@ -3018,61 +3018,61 @@  discard block
 block discarded – undo
3018 3018
  * @param string $content_html The output html of the geodir_edit_post_link() function.
3019 3019
  * @return string Filtered html of the geodir_edit_post_link() function.
3020 3020
  */
3021
-function geodir_wpml_frontend_duplicate_listing( $content_html ) {
3021
+function geodir_wpml_frontend_duplicate_listing($content_html) {
3022 3022
     global $post, $preview, $sitepress;
3023 3023
     
3024
-    if ( !empty( $post->ID ) && !$preview && geodir_is_page( 'detail' ) && geodir_wpml_allowed_to_duplicate( $post->ID ) ) {
3024
+    if (!empty($post->ID) && !$preview && geodir_is_page('detail') && geodir_wpml_allowed_to_duplicate($post->ID)) {
3025 3025
         $post_id = $post->ID;
3026
-        $element_type = 'post_' . get_post_type( $post_id );
3027
-        $original_post_id = $sitepress->get_original_element_id( $post_id, $element_type );
3026
+        $element_type = 'post_'.get_post_type($post_id);
3027
+        $original_post_id = $sitepress->get_original_element_id($post_id, $element_type);
3028 3028
         
3029
-        if ( $original_post_id == $post_id ) {
3029
+        if ($original_post_id == $post_id) {
3030 3030
             $wpml_languages = $sitepress->get_active_languages();
3031
-            $post_language = $sitepress->get_language_for_element( $post_id, $element_type );
3031
+            $post_language = $sitepress->get_language_for_element($post_id, $element_type);
3032 3032
             
3033
-            if ( !empty( $wpml_languages ) && isset( $wpml_languages[ $post_language ] ) ) {
3034
-                unset( $wpml_languages[ $post_language ] );
3033
+            if (!empty($wpml_languages) && isset($wpml_languages[$post_language])) {
3034
+                unset($wpml_languages[$post_language]);
3035 3035
             }
3036 3036
             
3037
-            if ( !empty( $wpml_languages ) ) {
3038
-                $trid  = $sitepress->get_element_trid( $post_id, $element_type );
3039
-                $element_translations = $sitepress->get_element_translations( $trid, $element_type );
3040
-                $duplicates = $sitepress->get_duplicates( $post_id );
3037
+            if (!empty($wpml_languages)) {
3038
+                $trid = $sitepress->get_element_trid($post_id, $element_type);
3039
+                $element_translations = $sitepress->get_element_translations($trid, $element_type);
3040
+                $duplicates = $sitepress->get_duplicates($post_id);
3041 3041
                 
3042
-                $wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">' . __( 'Translate Listing', 'geodirectory' ) . '</h3>';
3042
+                $wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">'.__('Translate Listing', 'geodirectory').'</h3>';
3043 3043
                 $wpml_content .= '<table class="gd-duplicate-table" style="width:100%;margin:0"><tbody>';
3044
-                $wpml_content .= '<tr style="border-bottom:solid 1px #efefef"><th style="padding:0 2px 2px 2px">' . __( 'Language', 'geodirectory' ) . '</th><th style="width:25px;"></th><th style="width:5em;text-align:center">' . __( 'Translate', 'geodirectory' ) . '</th></tr>';
3044
+                $wpml_content .= '<tr style="border-bottom:solid 1px #efefef"><th style="padding:0 2px 2px 2px">'.__('Language', 'geodirectory').'</th><th style="width:25px;"></th><th style="width:5em;text-align:center">'.__('Translate', 'geodirectory').'</th></tr>';
3045 3045
                 
3046 3046
                 $needs_translation = false;
3047 3047
                 
3048
-                foreach ( $wpml_languages as $lang_code => $lang ) {
3048
+                foreach ($wpml_languages as $lang_code => $lang) {
3049 3049
                     $duplicates_text = '';
3050 3050
                     $translated = false;
3051 3051
                     
3052
-                    if ( !empty( $element_translations ) && isset( $element_translations[$lang_code] ) ) {
3052
+                    if (!empty($element_translations) && isset($element_translations[$lang_code])) {
3053 3053
                         $translated = true;
3054 3054
                         
3055
-                        if ( !empty( $duplicates ) && isset( $duplicates[$lang_code] ) ) {
3056
-                            $duplicates_text = ' ' . __( '(duplicate)', 'geodirectory' );
3055
+                        if (!empty($duplicates) && isset($duplicates[$lang_code])) {
3056
+                            $duplicates_text = ' '.__('(duplicate)', 'geodirectory');
3057 3057
                         }
3058 3058
                     } else {
3059 3059
                         $needs_translation = true;
3060 3060
                     }
3061 3061
                     
3062
-                    $wpml_content .= '<tr><td style="padding:4px">' . $lang['english_name'] . $duplicates_text . '</td><td>&nbsp;</td><td style="text-align:center;">';
3062
+                    $wpml_content .= '<tr><td style="padding:4px">'.$lang['english_name'].$duplicates_text.'</td><td>&nbsp;</td><td style="text-align:center;">';
3063 3063
                     
3064
-                    if ( $translated ) {
3064
+                    if ($translated) {
3065 3065
                         $wpml_content .= '<i class="fa fa-check" style="color:orange"></i>';
3066 3066
                     } else {
3067
-                        $wpml_content .= '<input name="gd_icl_dup[]" value="' . $lang_code . '" title="' . esc_attr__( 'Create duplicate', 'geodirectory' ) . '" type="checkbox">';
3067
+                        $wpml_content .= '<input name="gd_icl_dup[]" value="'.$lang_code.'" title="'.esc_attr__('Create duplicate', 'geodirectory').'" type="checkbox">';
3068 3068
                     }
3069 3069
                     
3070 3070
                     $wpml_content .= '</td></tr>';
3071 3071
                 }
3072 3072
                 
3073
-                if ( $needs_translation ) {
3074
-                    $nonce = wp_create_nonce( 'geodir_duplicate_nonce' );
3075
-                    $wpml_content .= '<tr><td>&nbsp;</td><td style="vertical-align:middle;padding-top:13px"><i style="display:none" class="fa fa-spin fa-refresh"></i></td><td style="padding:15px 3px 3px 3px;text-align:right"><button data-nonce="' . esc_attr( $nonce ) . '" data-post-id="' . $post_id . '" id="gd_make_duplicates" class="button-secondary">' . __( 'Duplicate', 'geodirectory' ) . '</button></td></tr>';
3073
+                if ($needs_translation) {
3074
+                    $nonce = wp_create_nonce('geodir_duplicate_nonce');
3075
+                    $wpml_content .= '<tr><td>&nbsp;</td><td style="vertical-align:middle;padding-top:13px"><i style="display:none" class="fa fa-spin fa-refresh"></i></td><td style="padding:15px 3px 3px 3px;text-align:right"><button data-nonce="'.esc_attr($nonce).'" data-post-id="'.$post_id.'" id="gd_make_duplicates" class="button-secondary">'.__('Duplicate', 'geodirectory').'</button></td></tr>';
3076 3076
                 }
3077 3077
                 
3078 3078
                 $wpml_content .= '</tbody></table>';
@@ -3094,12 +3094,12 @@  discard block
 block discarded – undo
3094 3094
  * @param array $settings GD design settings array.
3095 3095
  * @return array Filtered GD design settings array..
3096 3096
  */
3097
-function geodir_wpml_duplicate_settings( $settings = array() ) {
3097
+function geodir_wpml_duplicate_settings($settings = array()) {
3098 3098
     $new_settings = array();
3099 3099
     
3100
-    foreach ( $settings as $key => $setting ) {
3100
+    foreach ($settings as $key => $setting) {
3101 3101
         
3102
-        if ( isset( $setting['type'] ) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings' ) {
3102
+        if (isset($setting['type']) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings') {
3103 3103
             $new_settings[] = array(
3104 3104
                 'name' => __('Disable WPML duplicate translation', 'geodirectory'),
3105 3105
                 'desc' => __('Select post types to disable front end WPML duplicate translation. For selected post types the WPML duplicate option will be disabled from listing detail page sidebar.', 'geodirectory'),
Please login to merge, or discard this patch.
geodirectory-functions/taxonomy_functions.php 1 patch
Indentation   +1252 added lines, -1252 removed lines patch added patch discarded remove patch
@@ -33,265 +33,265 @@  discard block
 block discarded – undo
33 33
  */
34 34
 function geodir_add_nav_menu_items()
35 35
 {
36
-    $items = '';
37
-    // apply filter to add more navigations // -Filter-Location-Manager
38
-
39
-    if (get_option('geodir_show_listing_nav')) {
40
-
41
-        $menu_class = '';
42
-        if (geodir_is_page('listing'))
43
-            $menu_class = 'current-menu-item';
44
-
45
-
46
-        //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
47
-        $post_types = geodir_get_posttypes('object');
48
-        $show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav');
49
-        if (!empty($post_types)) {
50
-            foreach ($post_types as $post_type => $args) {
51
-                if (!empty($show_post_type_main_nav)) {
52
-                    if (in_array($post_type, $show_post_type_main_nav)) {
53
-                        if (get_post_type_archive_link($post_type)) {
54
-                            $menu_class = '';
55
-                            if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
-                                $menu_class = 'current-menu-item';
57
-                            /**
58
-                             * Filter the menu li class.
59
-                             *
60
-                             * @since 1.0.0
61
-                             * @param string $menu_class The menu HTML class.
62
-                             */
63
-                            $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
64
-                            /**
65
-                             * Filter the menu a class.
66
-                             *
67
-                             * @since 1.0.0
68
-                             */
69
-                            $a_class = apply_filters('geodir_menu_a_class', '');
70
-                            $items .= '<li class="' . $li_class . '">
36
+	$items = '';
37
+	// apply filter to add more navigations // -Filter-Location-Manager
38
+
39
+	if (get_option('geodir_show_listing_nav')) {
40
+
41
+		$menu_class = '';
42
+		if (geodir_is_page('listing'))
43
+			$menu_class = 'current-menu-item';
44
+
45
+
46
+		//SHOW LISTING OF POST TYPE IN MAIN NAVIGATION
47
+		$post_types = geodir_get_posttypes('object');
48
+		$show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav');
49
+		if (!empty($post_types)) {
50
+			foreach ($post_types as $post_type => $args) {
51
+				if (!empty($show_post_type_main_nav)) {
52
+					if (in_array($post_type, $show_post_type_main_nav)) {
53
+						if (get_post_type_archive_link($post_type)) {
54
+							$menu_class = '';
55
+							if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
56
+								$menu_class = 'current-menu-item';
57
+							/**
58
+							 * Filter the menu li class.
59
+							 *
60
+							 * @since 1.0.0
61
+							 * @param string $menu_class The menu HTML class.
62
+							 */
63
+							$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
64
+							/**
65
+							 * Filter the menu a class.
66
+							 *
67
+							 * @since 1.0.0
68
+							 */
69
+							$a_class = apply_filters('geodir_menu_a_class', '');
70
+							$items .= '<li class="' . $li_class . '">
71 71
 									<a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '">
72 72
 										' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . '
73 73
 									</a>
74 74
 								</li>';
75
-                        }
76
-                    }
77
-                }
78
-            }
79
-        }
80
-        //END LISTING OF POST TYPE IN MAIN NAVIGATION
81
-
82
-        $view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
83
-        $is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false;
84
-        if ($is_listing_sub_meny_exists) {
85
-            /**
86
-             * Filter the menu li class.
87
-             *
88
-             * @since 1.0.0
89
-             * @param string $menu_class The menu HTML class.
90
-             */
91
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
92
-            /**
93
-             * Filter the sub menu li class.
94
-             *
95
-             * @since 1.0.0
96
-             * @param string $menu_class The menu HTML class.
97
-             */
98
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
99
-            /**
100
-             * Filter the sub menu ul class.
101
-             *
102
-             * @since 1.0.0
103
-             */
104
-            $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
105
-            /**
106
-             * Filter the menu a class.
107
-             *
108
-             * @since 1.0.0
109
-             */
110
-            $a_class = apply_filters('geodir_menu_a_class', '');
111
-            /**
112
-             * Filter the sub menu a class.
113
-             *
114
-             * @since 1.0.0
115
-             */
116
-            $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
-            $items .= '<li class="' . $li_class . '">
75
+						}
76
+					}
77
+				}
78
+			}
79
+		}
80
+		//END LISTING OF POST TYPE IN MAIN NAVIGATION
81
+
82
+		$view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
83
+		$is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false;
84
+		if ($is_listing_sub_meny_exists) {
85
+			/**
86
+			 * Filter the menu li class.
87
+			 *
88
+			 * @since 1.0.0
89
+			 * @param string $menu_class The menu HTML class.
90
+			 */
91
+			$li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
92
+			/**
93
+			 * Filter the sub menu li class.
94
+			 *
95
+			 * @since 1.0.0
96
+			 * @param string $menu_class The menu HTML class.
97
+			 */
98
+			$sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
99
+			/**
100
+			 * Filter the sub menu ul class.
101
+			 *
102
+			 * @since 1.0.0
103
+			 */
104
+			$sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
105
+			/**
106
+			 * Filter the menu a class.
107
+			 *
108
+			 * @since 1.0.0
109
+			 */
110
+			$a_class = apply_filters('geodir_menu_a_class', '');
111
+			/**
112
+			 * Filter the sub menu a class.
113
+			 *
114
+			 * @since 1.0.0
115
+			 */
116
+			$sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
117
+			$items .= '<li class="' . $li_class . '">
118 118
 					<a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a>
119 119
 					<ul class="' . $sub_ul_class . '">';
120
-            $post_types = geodir_get_posttypes('object');
120
+			$post_types = geodir_get_posttypes('object');
121 121
 
122
-            $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
122
+			$show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
123 123
 
124
-            if (!empty($post_types)) {
125
-                global $geodir_add_location_url;
126
-                $geodir_add_location_url = true;
127
-                foreach ($post_types as $post_type => $args) {
128
-                    if (!empty($show_listing_post_types)) {
129
-                        if (in_array($post_type, $show_listing_post_types)) {
130
-                            if (get_post_type_archive_link($post_type)) {
124
+			if (!empty($post_types)) {
125
+				global $geodir_add_location_url;
126
+				$geodir_add_location_url = true;
127
+				foreach ($post_types as $post_type => $args) {
128
+					if (!empty($show_listing_post_types)) {
129
+						if (in_array($post_type, $show_listing_post_types)) {
130
+							if (get_post_type_archive_link($post_type)) {
131 131
 
132
-                                $menu_class = '';
133
-                                if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
-                                    $menu_class = 'current-menu-item';
132
+								$menu_class = '';
133
+								if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
134
+									$menu_class = 'current-menu-item';
135 135
 
136
-                                $items .= '<li class="' . $sub_li_class . '">
136
+								$items .= '<li class="' . $sub_li_class . '">
137 137
 														<a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '">
138 138
 															' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . '
139 139
 														</a>
140 140
 													</li>';
141
-                            }
142
-                        }
143
-                    }
144
-                }
145
-                $geodir_add_location_url = NULL;
146
-            }
141
+							}
142
+						}
143
+					}
144
+				}
145
+				$geodir_add_location_url = NULL;
146
+			}
147 147
 
148
-            $items .= '	</ul> ';
149
-            /**
150
-             * Filter called after the sub menu closing ul tag for dynamic added menu items.
151
-             *
152
-             * @since 1.5.9
153
-             */
154
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
155
-            $items .= '</li>';
156
-        }
157
-    }
158
-
159
-    if (get_option('geodir_show_addlisting_nav')) {
160
-
161
-        $menu_class = '';
162
-        if (geodir_is_page('add-listing'))
163
-            $menu_class = 'current-menu-item';
164
-
165
-        //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
166
-        $post_types = geodir_get_posttypes('object');
167
-        $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
168
-        $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
169
-
170
-        if (!empty($post_types)) {
171
-            foreach ($post_types as $post_type => $args) {
172
-                if (!empty($geodir_allow_posttype_frontend)) {
173
-                    if (in_array($post_type, $geodir_allow_posttype_frontend)) {
174
-                        if (!empty($show_add_listing_post_types_main_nav)) {
175
-                            if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
176
-                                if (geodir_get_addlisting_link($post_type)) {
177
-
178
-                                    $menu_class = '';
179
-                                    if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
180
-                                        $menu_class = 'current-menu-item';
181
-                                    /**
182
-                                     * Filter the menu li class.
183
-                                     *
184
-                                     * @since 1.0.0
185
-                                     * @param string $menu_class The menu HTML class.
186
-                                     */
187
-                                    $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
188
-                                    /**
189
-                                     * Filter the menu a class.
190
-                                     *
191
-                                     * @since 1.0.0
192
-                                     */
193
-                                    $a_class = apply_filters('geodir_menu_a_class', '');
194
-                                    $cpt_name = __($args->labels->singular_name, 'geodirectory');
195
-                                    $items .= '<li class="' . $li_class . '">
148
+			$items .= '	</ul> ';
149
+			/**
150
+			 * Filter called after the sub menu closing ul tag for dynamic added menu items.
151
+			 *
152
+			 * @since 1.5.9
153
+			 */
154
+			$items .= apply_filters('geodir_menu_after_sub_ul','');
155
+			$items .= '</li>';
156
+		}
157
+	}
158
+
159
+	if (get_option('geodir_show_addlisting_nav')) {
160
+
161
+		$menu_class = '';
162
+		if (geodir_is_page('add-listing'))
163
+			$menu_class = 'current-menu-item';
164
+
165
+		//SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
166
+		$post_types = geodir_get_posttypes('object');
167
+		$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
168
+		$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
169
+
170
+		if (!empty($post_types)) {
171
+			foreach ($post_types as $post_type => $args) {
172
+				if (!empty($geodir_allow_posttype_frontend)) {
173
+					if (in_array($post_type, $geodir_allow_posttype_frontend)) {
174
+						if (!empty($show_add_listing_post_types_main_nav)) {
175
+							if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
176
+								if (geodir_get_addlisting_link($post_type)) {
177
+
178
+									$menu_class = '';
179
+									if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
180
+										$menu_class = 'current-menu-item';
181
+									/**
182
+									 * Filter the menu li class.
183
+									 *
184
+									 * @since 1.0.0
185
+									 * @param string $menu_class The menu HTML class.
186
+									 */
187
+									$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
188
+									/**
189
+									 * Filter the menu a class.
190
+									 *
191
+									 * @since 1.0.0
192
+									 */
193
+									$a_class = apply_filters('geodir_menu_a_class', '');
194
+									$cpt_name = __($args->labels->singular_name, 'geodirectory');
195
+									$items .= '<li class="' . $li_class . '">
196 196
 											<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '">
197 197
 												' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
198 198
 											</a>
199 199
 										</li>';
200
-                                }
201
-                            }
202
-                        }
203
-                    }
204
-                }
205
-            }
206
-        }
207
-        //END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
208
-    }
209
-
210
-    $view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
211
-    $is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false;
212
-    if ($is_add_listing_sub_meny_exists) {
213
-
214
-        if (get_option('geodir_show_addlisting_nav')) {
215
-            /**
216
-             * Filter the menu li class.
217
-             *
218
-             * @since 1.0.0
219
-             * @param string $menu_class The menu HTML class.
220
-             */
221
-            $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
222
-            /**
223
-             * Filter the sub menu li class.
224
-             *
225
-             * @since 1.0.0
226
-             * @param string $menu_class The menu HTML class.
227
-             */
228
-            $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
229
-            /**
230
-             * Filter the sub menu ul class.
231
-             *
232
-             * @since 1.0.0
233
-             */
234
-            $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
235
-            /**
236
-             * Filter the menu a class.
237
-             *
238
-             * @since 1.0.0
239
-             */
240
-            $a_class = apply_filters('geodir_menu_a_class', '');
241
-            /**
242
-             * Filter the sub menu a class.
243
-             *
244
-             * @since 1.0.0
245
-             */
246
-            $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
247
-            $items .= '<li  class="' . $li_class . '">
200
+								}
201
+							}
202
+						}
203
+					}
204
+				}
205
+			}
206
+		}
207
+		//END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION
208
+	}
209
+
210
+	$view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
211
+	$is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false;
212
+	if ($is_add_listing_sub_meny_exists) {
213
+
214
+		if (get_option('geodir_show_addlisting_nav')) {
215
+			/**
216
+			 * Filter the menu li class.
217
+			 *
218
+			 * @since 1.0.0
219
+			 * @param string $menu_class The menu HTML class.
220
+			 */
221
+			$li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
222
+			/**
223
+			 * Filter the sub menu li class.
224
+			 *
225
+			 * @since 1.0.0
226
+			 * @param string $menu_class The menu HTML class.
227
+			 */
228
+			$sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
229
+			/**
230
+			 * Filter the sub menu ul class.
231
+			 *
232
+			 * @since 1.0.0
233
+			 */
234
+			$sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
235
+			/**
236
+			 * Filter the menu a class.
237
+			 *
238
+			 * @since 1.0.0
239
+			 */
240
+			$a_class = apply_filters('geodir_menu_a_class', '');
241
+			/**
242
+			 * Filter the sub menu a class.
243
+			 *
244
+			 * @since 1.0.0
245
+			 */
246
+			$sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
247
+			$items .= '<li  class="' . $li_class . '">
248 248
 					<a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a>
249 249
 					<ul class="' . $sub_ul_class . '">';
250 250
 
251
-            $post_types = geodir_get_posttypes('object');
252
-
253
-            $show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
254
-
255
-            if (!empty($post_types)) {
256
-                foreach ($post_types as $post_type => $args) {
257
-                    if (!empty($geodir_allow_posttype_frontend)) {
258
-                        if (in_array($post_type, $geodir_allow_posttype_frontend)) {
259
-                            if (!empty($show_add_listing_post_types)) {
260
-                                if (in_array($post_type, $show_add_listing_post_types)) {
261
-                                    if (geodir_get_addlisting_link($post_type)) {
262
-
263
-                                        $menu_class = '';
264
-                                        if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
265
-                                            $menu_class = 'current-menu-item';
266
-                                        /**
267
-                                         * Filter the menu li class.
268
-                                         *
269
-                                         * @since 1.0.0
270
-                                         * @param string $menu_class The menu HTML class.
271
-                                         */
272
-                                        $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
273
-                                        $cpt_name = __($args->labels->singular_name, 'geodirectory');
274
-                                        $items .= '<li class="' . $sub_li_class . '">
251
+			$post_types = geodir_get_posttypes('object');
252
+
253
+			$show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
254
+
255
+			if (!empty($post_types)) {
256
+				foreach ($post_types as $post_type => $args) {
257
+					if (!empty($geodir_allow_posttype_frontend)) {
258
+						if (in_array($post_type, $geodir_allow_posttype_frontend)) {
259
+							if (!empty($show_add_listing_post_types)) {
260
+								if (in_array($post_type, $show_add_listing_post_types)) {
261
+									if (geodir_get_addlisting_link($post_type)) {
262
+
263
+										$menu_class = '';
264
+										if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
265
+											$menu_class = 'current-menu-item';
266
+										/**
267
+										 * Filter the menu li class.
268
+										 *
269
+										 * @since 1.0.0
270
+										 * @param string $menu_class The menu HTML class.
271
+										 */
272
+										$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
273
+										$cpt_name = __($args->labels->singular_name, 'geodirectory');
274
+										$items .= '<li class="' . $sub_li_class . '">
275 275
 														<a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '">
276 276
 															' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
277 277
 														</a>
278 278
 													</li>';
279
-                                    }
280
-                                }
281
-                            }
282
-                        }
283
-                    }
284
-                }
285
-            }
279
+									}
280
+								}
281
+							}
282
+						}
283
+					}
284
+				}
285
+			}
286 286
 
287
-            $items .= '	</ul> ';
288
-            $items .= apply_filters('geodir_menu_after_sub_ul','');
289
-            $items .= '</li>';
287
+			$items .= '	</ul> ';
288
+			$items .= apply_filters('geodir_menu_after_sub_ul','');
289
+			$items .= '</li>';
290 290
 
291
-        }
292
-    }
293
-    // apply filter to add more navigations // -Filter-Location-Manager
294
-    return $items;
291
+		}
292
+	}
293
+	// apply filter to add more navigations // -Filter-Location-Manager
294
+	return $items;
295 295
 }
296 296
 
297 297
 
@@ -309,20 +309,20 @@  discard block
 block discarded – undo
309 309
  */
310 310
 function geodir_pagemenu_items($menu, $args)
311 311
 {
312
-    $locations = get_nav_menu_locations();
313
-    $geodir_theme_location = get_option('geodir_theme_location_nav');
314
-    $geodir_theme_location_nav = array();
315
-    if (empty($locations) && empty($geodir_theme_location)) {
316
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
317
-        $geodir_theme_location_nav[] = $args['theme_location'];
318
-        update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
319
-    }
320
-    //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
312
+	$locations = get_nav_menu_locations();
313
+	$geodir_theme_location = get_option('geodir_theme_location_nav');
314
+	$geodir_theme_location_nav = array();
315
+	if (empty($locations) && empty($geodir_theme_location)) {
316
+		$menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
317
+		$geodir_theme_location_nav[] = $args['theme_location'];
318
+		update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
319
+	}
320
+	//else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet.
321 321
 //		$menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
322
-    else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
-        $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
322
+	else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location))
323
+		$menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
324 324
 
325
-    return $menu;
325
+	return $menu;
326 326
 
327 327
 }
328 328
 
@@ -342,18 +342,18 @@  discard block
 block discarded – undo
342 342
 function geodir_menu_items($items, $args)
343 343
 {
344 344
 
345
-    $location = $args->theme_location;
345
+	$location = $args->theme_location;
346 346
 
347
-    $geodir_theme_location = get_option('geodir_theme_location_nav');
347
+	$geodir_theme_location = get_option('geodir_theme_location_nav');
348 348
 
349
-    if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
349
+	if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
350 350
 
351
-        $items = $items . geodir_add_nav_menu_items();
352
-        return $items;
351
+		$items = $items . geodir_add_nav_menu_items();
352
+		return $items;
353 353
 
354
-    } else {
355
-        return $items;
356
-    }
354
+	} else {
355
+		return $items;
356
+	}
357 357
 }
358 358
 
359 359
 /**
@@ -368,25 +368,25 @@  discard block
 block discarded – undo
368 368
  */
369 369
 function geodir_get_category_all_array()
370 370
 {
371
-    global $wpdb;
372
-    $return_array = array();
373
-
374
-    $taxonomies = geodir_get_taxonomies();
375
-    $taxonomies = implode("','", $taxonomies);
376
-    $taxonomies = "'" . $taxonomies . "'";
377
-
378
-    $pn_categories = $wpdb->get_results(
379
-        $wpdb->prepare(
380
-            "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy,  $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name",
381
-            array($wpdb->terms . term_id)
382
-        )
383
-    );
384
-
385
-    foreach ($pn_categories as $pn_categories_obj) {
386
-        $return_array[] = array("id" => $pn_categories_obj->cat_ID,
387
-            "title" => $pn_categories_obj->name,);
388
-    }
389
-    return $return_array;
371
+	global $wpdb;
372
+	$return_array = array();
373
+
374
+	$taxonomies = geodir_get_taxonomies();
375
+	$taxonomies = implode("','", $taxonomies);
376
+	$taxonomies = "'" . $taxonomies . "'";
377
+
378
+	$pn_categories = $wpdb->get_results(
379
+		$wpdb->prepare(
380
+			"SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy,  $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name",
381
+			array($wpdb->terms . term_id)
382
+		)
383
+	);
384
+
385
+	foreach ($pn_categories as $pn_categories_obj) {
386
+		$return_array[] = array("id" => $pn_categories_obj->cat_ID,
387
+			"title" => $pn_categories_obj->name,);
388
+	}
389
+	return $return_array;
390 390
 }
391 391
 
392 392
 
@@ -402,49 +402,49 @@  discard block
 block discarded – undo
402 402
  * @return string The post type.
403 403
  */
404 404
 function geodir_get_current_posttype() {
405
-    global $wp_query, $post, $geodir_post_type;
405
+	global $wp_query, $post, $geodir_post_type;
406 406
 
407
-    $geodir_post_type = get_query_var('post_type');
407
+	$geodir_post_type = get_query_var('post_type');
408 408
 
409
-    if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
410
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
411
-            $geodir_post_type = get_post_type((int)$_REQUEST['pid']);
412
-        elseif (isset($_REQUEST['listing_type']))
413
-            $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
414
-    }
409
+	if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
410
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
411
+			$geodir_post_type = get_post_type((int)$_REQUEST['pid']);
412
+		elseif (isset($_REQUEST['listing_type']))
413
+			$geodir_post_type = sanitize_text_field($_REQUEST['listing_type']);
414
+	}
415 415
 
416
-    if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
417
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
416
+	if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
417
+		$geodir_post_type = sanitize_text_field($_REQUEST['stype']);
418 418
 
419
-    if (is_tax())
420
-        $geodir_post_type = geodir_get_taxonomy_posttype();
419
+	if (is_tax())
420
+		$geodir_post_type = geodir_get_taxonomy_posttype();
421 421
 
422
-    // Retrive post type for map marker html ajax request on preview page.
423
-    if (empty($geodir_post_type) && defined('DOING_AJAX') && !empty($post)) {
424
-        if (!empty($post->post_type)) {
425
-            $geodir_post_type = $post->post_type;
426
-        } else if (!empty($post->listing_type)) {
427
-            $geodir_post_type = $post->listing_type;
428
-        }
429
-    }
422
+	// Retrive post type for map marker html ajax request on preview page.
423
+	if (empty($geodir_post_type) && defined('DOING_AJAX') && !empty($post)) {
424
+		if (!empty($post->post_type)) {
425
+			$geodir_post_type = $post->post_type;
426
+		} else if (!empty($post->listing_type)) {
427
+			$geodir_post_type = $post->listing_type;
428
+		}
429
+	}
430 430
 
431
-    $all_postypes = geodir_get_posttypes();
432
-    $all_postypes = stripslashes_deep($all_postypes);
431
+	$all_postypes = geodir_get_posttypes();
432
+	$all_postypes = stripslashes_deep($all_postypes);
433 433
 
434
-    if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
435
-        $geodir_post_type = '';
434
+	if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes))
435
+		$geodir_post_type = '';
436 436
 
437
-    if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
438
-        $geodir_post_type = sanitize_text_field($_REQUEST['stype']);
439
-    }
437
+	if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
438
+		$geodir_post_type = sanitize_text_field($_REQUEST['stype']);
439
+	}
440 440
 
441 441
 
442
-    /**
443
-     * Filter the default CPT return.
444
-     *
445
-     * @since 1.6.9
446
-     */
447
-    return apply_filters('geodir_get_current_posttype',$geodir_post_type);
442
+	/**
443
+	 * Filter the default CPT return.
444
+	 *
445
+	 * @since 1.6.9
446
+	 */
447
+	return apply_filters('geodir_get_current_posttype',$geodir_post_type);
448 448
 }
449 449
 
450 450
 /**
@@ -458,22 +458,22 @@  discard block
 block discarded – undo
458 458
  */
459 459
 function geodir_get_default_posttype()
460 460
 {
461
-    $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) );
462
-
463
-    $stype = false;
464
-    foreach ( $post_types as $post_type => $info ) {
465
-        global $wpdb;
466
-        $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
467
-        if ( $has_posts ) {
468
-            $stype = $post_type; break;
469
-        }
470
-    }
471
-
472
-    if(!$stype){
473
-        $stype = 'gd_place';
474
-    }
475
-
476
-    return $stype;
461
+	$post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) );
462
+
463
+	$stype = false;
464
+	foreach ( $post_types as $post_type => $info ) {
465
+		global $wpdb;
466
+		$has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
467
+		if ( $has_posts ) {
468
+			$stype = $post_type; break;
469
+		}
470
+	}
471
+
472
+	if(!$stype){
473
+		$stype = 'gd_place';
474
+	}
475
+
476
+	return $stype;
477 477
 }
478 478
 
479 479
 /**
@@ -487,21 +487,21 @@  discard block
 block discarded – undo
487 487
  */
488 488
 function geodir_get_posttypes($output = 'names')
489 489
 {
490
-    $post_types = array();
491
-    $post_types = get_option('geodir_post_types');
492
-    $post_types = stripslashes_deep($post_types);
493
-    if (!empty($post_types)) {
494
-        switch ($output):
495
-            case 'object':
496
-            case 'Object':
497
-                $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
498
-                break;
499
-            case 'array':
500
-            case 'Array':
501
-                $post_types = (array)$post_types;
502
-                break;
490
+	$post_types = array();
491
+	$post_types = get_option('geodir_post_types');
492
+	$post_types = stripslashes_deep($post_types);
493
+	if (!empty($post_types)) {
494
+		switch ($output):
495
+			case 'object':
496
+			case 'Object':
497
+				$post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types;
498
+				break;
499
+			case 'array':
500
+			case 'Array':
501
+				$post_types = (array)$post_types;
502
+				break;
503 503
 			case 'options':
504
-                $post_types = (array)$post_types;
504
+				$post_types = (array)$post_types;
505 505
 				
506 506
 				$options = array();
507 507
 				if (!empty($post_types)) {
@@ -510,17 +510,17 @@  discard block
 block discarded – undo
510 510
 					}
511 511
 				}
512 512
 				$post_types = $options;
513
-                break;
514
-            default:
515
-                $post_types = array_keys($post_types);
516
-                break;
517
-        endswitch;
518
-    }
519
-
520
-    if (!empty($post_types))
521
-        return $post_types;
522
-    else
523
-        return array();
513
+				break;
514
+			default:
515
+				$post_types = array_keys($post_types);
516
+				break;
517
+		endswitch;
518
+	}
519
+
520
+	if (!empty($post_types))
521
+		return $post_types;
522
+	else
523
+		return array();
524 524
 }
525 525
 
526 526
 /**
@@ -533,108 +533,108 @@  discard block
 block discarded – undo
533 533
  */
534 534
 function geodir_get_posttype_info($post_type = '')
535 535
 {
536
-    $post_types = array();
537
-    $post_types = get_option('geodir_post_types');
538
-    $post_types = stripslashes_deep($post_types);
539
-    if (!empty($post_types) && $post_type != '') {
540
-        return $post_types[$post_type];
541
-    } else
542
-        return false;
536
+	$post_types = array();
537
+	$post_types = get_option('geodir_post_types');
538
+	$post_types = stripslashes_deep($post_types);
539
+	if (!empty($post_types) && $post_type != '') {
540
+		return $post_types[$post_type];
541
+	} else
542
+		return false;
543 543
 }
544 544
 
545 545
 if (!function_exists('geodir_get_taxonomies')) {
546
-    /**
547
-     * Get all custom taxonomies.
548
-     *
549
-     * @since 1.0.0
550
-     * @package GeoDirectory
551
-     * @param string $post_type The post type.
552
-     * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
553
-     * @return array|bool Taxonomies on success. false on failure.
554
-     */
555
-    function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false)
556
-    {
546
+	/**
547
+	 * Get all custom taxonomies.
548
+	 *
549
+	 * @since 1.0.0
550
+	 * @package GeoDirectory
551
+	 * @param string $post_type The post type.
552
+	 * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
553
+	 * @return array|bool Taxonomies on success. false on failure.
554
+	 */
555
+	function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false)
556
+	{
557 557
 
558
-        $taxonomies = array();
559
-        $gd_taxonomies = array();
558
+		$taxonomies = array();
559
+		$gd_taxonomies = array();
560 560
 
561
-        if ($taxonomies = get_option('geodir_taxonomies')) {
561
+		if ($taxonomies = get_option('geodir_taxonomies')) {
562 562
 
563 563
 
564
-            $gd_taxonomies = array_keys($taxonomies);
564
+			$gd_taxonomies = array_keys($taxonomies);
565 565
 
566 566
 
567
-            if ($post_type != '')
568
-                $gd_taxonomies = array();
567
+			if ($post_type != '')
568
+				$gd_taxonomies = array();
569 569
 
570
-            $i = 0;
571
-            foreach ($taxonomies as $taxonomy => $args) {
570
+			$i = 0;
571
+			foreach ($taxonomies as $taxonomy => $args) {
572 572
 
573
-                if ($post_type != '' && $args['object_type'] == $post_type)
574
-                    $gd_taxonomies[] = $taxonomy;
573
+				if ($post_type != '' && $args['object_type'] == $post_type)
574
+					$gd_taxonomies[] = $taxonomy;
575 575
 
576
-                if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
577
-                    if (array_search($taxonomy, $gd_taxonomies) !== false)
578
-                        unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
579
-                }
576
+				if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
577
+					if (array_search($taxonomy, $gd_taxonomies) !== false)
578
+						unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]);
579
+				}
580 580
 
581
-            }
581
+			}
582 582
 
583
-            $gd_taxonomies = array_values($gd_taxonomies);
584
-        }
585
-
586
-        /**
587
-         * Filter the taxonomies.
588
-         *
589
-         * @since 1.0.0
590
-         * @param array $gd_taxonomies The taxonomy array.
591
-         */
592
-        $taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
593
-
594
-        if (!empty($taxonomies)) {
595
-            return $taxonomies;
596
-        } else {
597
-            return false;
598
-        }
599
-    }
583
+			$gd_taxonomies = array_values($gd_taxonomies);
584
+		}
585
+
586
+		/**
587
+		 * Filter the taxonomies.
588
+		 *
589
+		 * @since 1.0.0
590
+		 * @param array $gd_taxonomies The taxonomy array.
591
+		 */
592
+		$taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
593
+
594
+		if (!empty($taxonomies)) {
595
+			return $taxonomies;
596
+		} else {
597
+			return false;
598
+		}
599
+	}
600 600
 }
601 601
 
602 602
 if (!function_exists(' geodir_get_categories_dl')) {
603
-    /**
604
-     * Get categories dropdown HTML.
605
-     *
606
-     * @since 1.0.0
607
-     * @package GeoDirectory
608
-     * @param string $post_type The post type.
609
-     * @param string $selected The selected value.
610
-     * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
611
-     * @param bool $echo Prints the HTML when set to true. Default: true.
612
-     * @return void|string Dropdown HTML.
613
-     */
614
-    function  geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true)
615
-    {
616
-
617
-        $html = '';
618
-        $taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies);
619
-
620
-        $categories = get_terms($taxonomies);
621
-
622
-        $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
623
-
624
-        foreach ($categories as $category_obj) {
625
-            $select_opt = '';
626
-            if ($selected == $category_obj->term_id) {
627
-                $select_opt = 'selected="selected"';
628
-            }
629
-            $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
630
-                . geodir_utf8_ucfirst($category_obj->name) . '</option>';
631
-        }
632
-
633
-        if ($echo)
634
-            echo $html;
635
-        else
636
-            return $html;
637
-    }
603
+	/**
604
+	 * Get categories dropdown HTML.
605
+	 *
606
+	 * @since 1.0.0
607
+	 * @package GeoDirectory
608
+	 * @param string $post_type The post type.
609
+	 * @param string $selected The selected value.
610
+	 * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false.
611
+	 * @param bool $echo Prints the HTML when set to true. Default: true.
612
+	 * @return void|string Dropdown HTML.
613
+	 */
614
+	function  geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true)
615
+	{
616
+
617
+		$html = '';
618
+		$taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies);
619
+
620
+		$categories = get_terms($taxonomies);
621
+
622
+		$html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
623
+
624
+		foreach ($categories as $category_obj) {
625
+			$select_opt = '';
626
+			if ($selected == $category_obj->term_id) {
627
+				$select_opt = 'selected="selected"';
628
+			}
629
+			$html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">'
630
+				. geodir_utf8_ucfirst($category_obj->name) . '</option>';
631
+		}
632
+
633
+		if ($echo)
634
+			echo $html;
635
+		else
636
+			return $html;
637
+	}
638 638
 }
639 639
 
640 640
 
@@ -649,28 +649,28 @@  discard block
 block discarded – undo
649 649
 function geodir_get_listing_slug($object_type = '')
650 650
 {
651 651
 
652
-    $listing_slug = '';
652
+	$listing_slug = '';
653 653
 
654
-    $post_types = get_option('geodir_post_types');
655
-    $taxonomies = get_option('geodir_taxonomies');
654
+	$post_types = get_option('geodir_post_types');
655
+	$taxonomies = get_option('geodir_taxonomies');
656 656
 
657 657
 
658
-    if ($object_type != '') {
659
-        if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
658
+	if ($object_type != '') {
659
+		if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
660 660
 
661
-            $object_info = $post_types[$object_type];
662
-            $listing_slug = $object_info['listing_slug'];
663
-        } elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
664
-            $object_info = $taxonomies[$object_type];
665
-            $listing_slug = $object_info['listing_slug'];
666
-        }
661
+			$object_info = $post_types[$object_type];
662
+			$listing_slug = $object_info['listing_slug'];
663
+		} elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
664
+			$object_info = $taxonomies[$object_type];
665
+			$listing_slug = $object_info['listing_slug'];
666
+		}
667 667
 
668
-    }
668
+	}
669 669
 
670
-    if (!empty($listing_slug))
671
-        return $listing_slug;
672
-    else
673
-        return false;
670
+	if (!empty($listing_slug))
671
+		return $listing_slug;
672
+	else
673
+		return false;
674 674
 }
675 675
 
676 676
 
@@ -685,212 +685,212 @@  discard block
 block discarded – undo
685 685
  */
686 686
 function geodir_get_taxonomy_posttype($taxonomy = '')
687 687
 {
688
-    global $wp_query;
689
-
690
-    $post_type = array();
691
-    $taxonomies = array();
692
-
693
-    if (!empty($taxonomy)) {
694
-        $taxonomies[] = $taxonomy;
695
-    } elseif (isset($wp_query->tax_query->queries)) {
696
-        $tax_arr = $wp_query->tax_query->queries;
697
-        //if tax query has 'relation' set then it will break wp_list_pluck so we remove it
698
-        if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
699
-        $taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
700
-    }
701
-
702
-    if (!empty($taxonomies)) {
703
-        foreach (geodir_get_posttypes() as $pt) {
704
-            $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
705
-            if (array_intersect($taxonomies, $object_taxonomies))
706
-                $post_type[] = $pt;
707
-        }
708
-    }
709
-
710
-    if (!empty($post_type))
711
-        return $post_type[0];
712
-    else
713
-        return false;
688
+	global $wp_query;
689
+
690
+	$post_type = array();
691
+	$taxonomies = array();
692
+
693
+	if (!empty($taxonomy)) {
694
+		$taxonomies[] = $taxonomy;
695
+	} elseif (isset($wp_query->tax_query->queries)) {
696
+		$tax_arr = $wp_query->tax_query->queries;
697
+		//if tax query has 'relation' set then it will break wp_list_pluck so we remove it
698
+		if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
699
+		$taxonomies = wp_list_pluck($tax_arr, 'taxonomy');
700
+	}
701
+
702
+	if (!empty($taxonomies)) {
703
+		foreach (geodir_get_posttypes() as $pt) {
704
+			$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
705
+			if (array_intersect($taxonomies, $object_taxonomies))
706
+				$post_type[] = $pt;
707
+		}
708
+	}
709
+
710
+	if (!empty($post_type))
711
+		return $post_type[0];
712
+	else
713
+		return false;
714 714
 }
715 715
 
716 716
 if (!function_exists('geodir_custom_taxonomy_walker')) {
717
-    /**
718
-     * Custom taxonomy walker function.
719
-     *
720
-     * @since 1.0.0
721
-     * @package GeoDirectory
722
-     * @param string $cat_taxonomy The taxonomy name.
723
-     * @param int $cat_parent The parent term ID.
724
-     * @param bool $hide_empty Hide empty taxonomies? Default: false.
725
-     * @param int $pading CSS padding in pixels.
726
-     * @return string|void taxonomy HTML.
727
-     */
728
-    function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0)
729
-    {
730
-        global $cat_display, $post_cat, $exclude_cats;
731
-
732
-        $search_terms = trim($post_cat, ",");
733
-
734
-        $search_terms = explode(",", $search_terms);
735
-
736
-        $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
737
-
738
-        $display = '';
739
-        $onchange = '';
740
-        $term_check = '';
741
-        $main_list_class = '';
742
-        $out = '';
743
-        //If there are terms, start displaying
744
-        if (count($cat_terms) > 0) {
745
-            //Displaying as a list
746
-            $p = $pading * 20;
747
-            $pading++;
748
-
749
-
750
-            if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
751
-                if ($cat_parent == 0) {
752
-                    $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
753
-                    $main_list_class = 'class="main_list_selecter"';
754
-                } else {
755
-                    //$display = 'display:none';
756
-                    $list_class = 'sub_list gd-sub-cats-list';
757
-                }
758
-            }
717
+	/**
718
+	 * Custom taxonomy walker function.
719
+	 *
720
+	 * @since 1.0.0
721
+	 * @package GeoDirectory
722
+	 * @param string $cat_taxonomy The taxonomy name.
723
+	 * @param int $cat_parent The parent term ID.
724
+	 * @param bool $hide_empty Hide empty taxonomies? Default: false.
725
+	 * @param int $pading CSS padding in pixels.
726
+	 * @return string|void taxonomy HTML.
727
+	 */
728
+	function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0)
729
+	{
730
+		global $cat_display, $post_cat, $exclude_cats;
731
+
732
+		$search_terms = trim($post_cat, ",");
733
+
734
+		$search_terms = explode(",", $search_terms);
735
+
736
+		$cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
737
+
738
+		$display = '';
739
+		$onchange = '';
740
+		$term_check = '';
741
+		$main_list_class = '';
742
+		$out = '';
743
+		//If there are terms, start displaying
744
+		if (count($cat_terms) > 0) {
745
+			//Displaying as a list
746
+			$p = $pading * 20;
747
+			$pading++;
748
+
749
+
750
+			if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
751
+				if ($cat_parent == 0) {
752
+					$list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display;
753
+					$main_list_class = 'class="main_list_selecter"';
754
+				} else {
755
+					//$display = 'display:none';
756
+					$list_class = 'sub_list gd-sub-cats-list';
757
+				}
758
+			}
759 759
 
760
-            if ($cat_display == 'checkbox' || $cat_display == 'radio') {
761
-                $p = 0;
762
-                $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
763
-            }
760
+			if ($cat_display == 'checkbox' || $cat_display == 'radio') {
761
+				$p = 0;
762
+				$out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">';
763
+			}
764 764
 
765
-            foreach ($cat_terms as $cat_term) {
765
+			foreach ($cat_terms as $cat_term) {
766 766
 
767
-                $checked = '';
767
+				$checked = '';
768 768
 
769
-                if (in_array($cat_term->term_id, $search_terms)) {
770
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
771
-                        $checked = 'selected="selected"';
772
-                    else
773
-                        $checked = 'checked="checked"';
774
-                }
769
+				if (in_array($cat_term->term_id, $search_terms)) {
770
+					if ($cat_display == 'select' || $cat_display == 'multiselect')
771
+						$checked = 'selected="selected"';
772
+					else
773
+						$checked = 'checked="checked"';
774
+				}
775 775
 
776
-                if ($cat_display == 'radio')
777
-                    $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>';
778
-                elseif ($cat_display == 'select' || $cat_display == 'multiselect')
779
-                    $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>';
776
+				if ($cat_display == 'radio')
777
+					$out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>';
778
+				elseif ($cat_display == 'select' || $cat_display == 'multiselect')
779
+					$out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>';
780 780
 
781
-                else {
782
-                    $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>';
783
-                }
781
+				else {
782
+					$out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>';
783
+				}
784 784
 
785
-                // Call recurson to print sub cats
786
-                $out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading);
785
+				// Call recurson to print sub cats
786
+				$out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading);
787 787
 
788
-            }
788
+			}
789 789
 
790
-            if ($cat_display == 'checkbox' || $cat_display == 'radio')
791
-                $out .= '</div>';
790
+			if ($cat_display == 'checkbox' || $cat_display == 'radio')
791
+				$out .= '</div>';
792 792
 
793
-            return $out;
794
-        }
795
-        return;
796
-    }
793
+			return $out;
794
+		}
795
+		return;
796
+	}
797 797
 }
798 798
 
799 799
 if (!function_exists('geodir_custom_taxonomy_walker2')) {
800
-    /**
801
-     * Custom taxonomy walker function.
802
-     *
803
-     * @since 1.0.0
804
-     * @package GeoDirectory
805
-     * @global object $post WordPress Post object.
806
-     * @global object $gd_session GeoDirectory Session object.
807
-     * @param string $cat_taxonomy The taxonomy name.
808
-     * @param string $cat_limit Number of categories to display.
809
-     */
810
-    function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '')
811
-    {
812
-        $post_category = '';
813
-        $post_category_str = '';
814
-        global $exclude_cats, $gd_session;
815
-
816
-        $cat_exclude = '';
817
-        if (is_array($exclude_cats) && !empty($exclude_cats))
818
-            $cat_exclude = serialize($exclude_cats);
819
-
820
-        if (isset($_REQUEST['backandedit'])) {
821
-            $post = (object)$gd_session->get('listing');
822
-
823
-            if (!is_array($post->post_category[$cat_taxonomy]))
824
-                $post_category = $post->post_category[$cat_taxonomy];
825
-
826
-            $post_categories = $post->post_category_str;
827
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
828
-                $post_category_str = $post_categories[$cat_taxonomy];
829
-
830
-        } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
831
-            global $post;
832
-
833
-            $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true);
834
-            if (empty($post_category) && isset($post->{$cat_taxonomy})) {
835
-                $post_category = $post->{$cat_taxonomy};
836
-            }
800
+	/**
801
+	 * Custom taxonomy walker function.
802
+	 *
803
+	 * @since 1.0.0
804
+	 * @package GeoDirectory
805
+	 * @global object $post WordPress Post object.
806
+	 * @global object $gd_session GeoDirectory Session object.
807
+	 * @param string $cat_taxonomy The taxonomy name.
808
+	 * @param string $cat_limit Number of categories to display.
809
+	 */
810
+	function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '')
811
+	{
812
+		$post_category = '';
813
+		$post_category_str = '';
814
+		global $exclude_cats, $gd_session;
815
+
816
+		$cat_exclude = '';
817
+		if (is_array($exclude_cats) && !empty($exclude_cats))
818
+			$cat_exclude = serialize($exclude_cats);
819
+
820
+		if (isset($_REQUEST['backandedit'])) {
821
+			$post = (object)$gd_session->get('listing');
822
+
823
+			if (!is_array($post->post_category[$cat_taxonomy]))
824
+				$post_category = $post->post_category[$cat_taxonomy];
825
+
826
+			$post_categories = $post->post_category_str;
827
+			if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories))
828
+				$post_category_str = $post_categories[$cat_taxonomy];
829
+
830
+		} elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
831
+			global $post;
832
+
833
+			$post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true);
834
+			if (empty($post_category) && isset($post->{$cat_taxonomy})) {
835
+				$post_category = $post->{$cat_taxonomy};
836
+			}
837 837
 
838
-            $post_categories = get_post_meta($post->ID, 'post_categories', true);
838
+			$post_categories = get_post_meta($post->ID, 'post_categories', true);
839 839
 
840
-            if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
841
-                foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
842
-                    if (is_numeric($cat_part)) {
843
-                        $cat_part_arr[] = $cat_part;
844
-                    }
845
-                }
846
-                if (is_array($cat_part_arr)) {
847
-                    $post_category = implode(',', $cat_part_arr);
848
-                }
849
-            }
840
+			if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
841
+				foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
842
+					if (is_numeric($cat_part)) {
843
+						$cat_part_arr[] = $cat_part;
844
+					}
845
+				}
846
+				if (is_array($cat_part_arr)) {
847
+					$post_category = implode(',', $cat_part_arr);
848
+				}
849
+			}
850 850
 
851
-            if (!empty($post_category)) {
852
-                $cat1 = array_filter(explode(',', $post_category));
853
-                $post_category = ',' . implode(',', $cat1) . ',';
851
+			if (!empty($post_category)) {
852
+				$cat1 = array_filter(explode(',', $post_category));
853
+				$post_category = ',' . implode(',', $cat1) . ',';
854 854
 
855
-            }
855
+			}
856 856
 
857
-            if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
857
+			if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
858 858
 
859
-                $post_category_upd = explode(',', $post_category);
860
-                $post_category_change = '';
861
-                foreach ($post_category_upd as $cat) {
859
+				$post_category_upd = explode(',', $post_category);
860
+				$post_category_change = '';
861
+				foreach ($post_category_upd as $cat) {
862 862
 
863
-                    if (!in_array($cat, $exclude_cats) && $cat != '') {
864
-                        $post_category_change .= ',' . $cat;
865
-                    }
866
-                }
867
-                $post_category = $post_category_change;
868
-            }
863
+					if (!in_array($cat, $exclude_cats) && $cat != '') {
864
+						$post_category_change .= ',' . $cat;
865
+					}
866
+				}
867
+				$post_category = $post_category_change;
868
+			}
869 869
 
870 870
 
871
-            if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
872
-                $post_category_str = $post_categories[$cat_taxonomy];
873
-            }
874
-        }
871
+			if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
872
+				$post_category_str = $post_categories[$cat_taxonomy];
873
+			}
874
+		}
875 875
 
876
-        echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
876
+		echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']"  />';
877 877
 
878
-        echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
878
+		echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']"  />';
879 879
 
880
-        echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
880
+		echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']"  />';
881 881
 
882 882
 
883
-        ?>
883
+		?>
884 884
         <div class="cat_sublist">
885 885
             <?php
886 886
 
887
-            $post_id = isset($post->ID) ? $post->ID : '';
887
+			$post_id = isset($post->ID) ? $post->ID : '';
888 888
 
889
-            if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
889
+			if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
890 890
 
891
-                geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories);
892
-            }
893
-            ?>
891
+				geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories);
892
+			}
893
+			?>
894 894
         </div>
895 895
         <script type="text/javascript">
896 896
 
@@ -1013,22 +1013,22 @@  discard block
 block discarded – undo
1013 1013
 
1014 1014
         </script>
1015 1015
         <?php
1016
-        if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
1017
-            $post_cat_str = $post_categories[$cat_taxonomy];
1018
-            $post_cat_array = explode("#", $post_cat_str);
1019
-            if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
1020
-                $style = "display:none;";
1021
-        }
1022
-        ?>
1016
+		if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
1017
+			$post_cat_str = $post_categories[$cat_taxonomy];
1018
+			$post_cat_array = explode("#", $post_cat_str);
1019
+			if (count($post_cat_array) >= $cat_limit && $cat_limit != 0)
1020
+				$style = "display:none;";
1021
+		}
1022
+		?>
1023 1023
         <div class="main_cat_list" style=" <?php if (isset($style)) {
1024
-            echo $style;
1025
-        }?> ">
1024
+			echo $style;
1025
+		}?> ">
1026 1026
             <?php geodir_get_catlist($cat_taxonomy, 0);  // print main categories list
1027
-            ?>
1027
+			?>
1028 1028
         </div>
1029 1029
     <?php
1030 1030
 
1031
-    }
1031
+	}
1032 1032
 }
1033 1033
 
1034 1034
 /**
@@ -1045,23 +1045,23 @@  discard block
 block discarded – undo
1045 1045
  */
1046 1046
 function geodir_addpost_categories_html($request_taxonomy, $parrent, $selected = false, $main_selected = true, $default = false, $exclude = '')
1047 1047
 {
1048
-    global $exclude_cats;
1048
+	global $exclude_cats;
1049 1049
 
1050
-    if ($exclude != '') {
1051
-        $exclude_cats = maybe_unserialize(base64_decode($exclude));
1050
+	if ($exclude != '') {
1051
+		$exclude_cats = maybe_unserialize(base64_decode($exclude));
1052 1052
 
1053
-        if(is_array( $exclude_cats)){
1054
-            $exclude_cats = array_map( 'intval', $exclude_cats );
1055
-        }else{
1056
-            $exclude_cats = intval($exclude_cats);
1057
-        }
1053
+		if(is_array( $exclude_cats)){
1054
+			$exclude_cats = array_map( 'intval', $exclude_cats );
1055
+		}else{
1056
+			$exclude_cats = intval($exclude_cats);
1057
+		}
1058 1058
 
1059
-    }
1059
+	}
1060 1060
 
1061
-    if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) ||
1062
-        (!is_array($exclude_cats) || empty($exclude_cats))
1063
-    ) {
1064
-        ?>
1061
+	if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) ||
1062
+		(!is_array($exclude_cats) || empty($exclude_cats))
1063
+	) {
1064
+		?>
1065 1065
 
1066 1066
         <?php $main_cat = get_term($parrent, $request_taxonomy); ?>
1067 1067
 
@@ -1090,8 +1090,8 @@  discard block
 block discarded – undo
1090 1090
 
1091 1091
             <br/>
1092 1092
             <?php
1093
-            $cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
1094
-            if (!empty($cat_terms)) { ?>
1093
+			$cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
1094
+			if (!empty($cat_terms)) { ?>
1095 1095
                 <span> <?php printf(__('Add listing in category', 'geodirectory')); ?></span>
1096 1096
                 <?php geodir_get_catlist($request_taxonomy, $parrent, $selected) ?>
1097 1097
             <?php } ?>
@@ -1113,53 +1113,53 @@  discard block
 block discarded – undo
1113 1113
 function geodir_editpost_categories_html($request_taxonomy, $request_postid, $post_categories)
1114 1114
 {
1115 1115
 
1116
-    if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
1117
-        $post_cat_str = $post_categories[$request_taxonomy];
1118
-        $post_cat_array = explode("#", $post_cat_str);
1119
-        if (is_array($post_cat_array)) {
1120
-            $post_cat_array = array_unique( $post_cat_array );
1116
+	if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
1117
+		$post_cat_str = $post_categories[$request_taxonomy];
1118
+		$post_cat_array = explode("#", $post_cat_str);
1119
+		if (is_array($post_cat_array)) {
1120
+			$post_cat_array = array_unique( $post_cat_array );
1121 1121
 
1122 1122
 			foreach ($post_cat_array as $post_cat_html) {
1123 1123
 
1124
-                $post_cat_info = explode(":", $post_cat_html);
1125
-                $post_maincat_str = $post_cat_info[0];
1124
+				$post_cat_info = explode(":", $post_cat_html);
1125
+				$post_maincat_str = $post_cat_info[0];
1126 1126
 
1127
-                if (!empty($post_maincat_str)) {
1128
-                    $post_maincat_info = explode(",", $post_maincat_str);
1129
-                    $post_maincat_id = $post_maincat_info[0];
1130
-                    ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1131
-                    (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1132
-                }
1133
-                $post_sub_catid = '';
1134
-                if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1135
-                    $post_sub_catid = (int)$post_cat_info[1];
1136
-                }
1127
+				if (!empty($post_maincat_str)) {
1128
+					$post_maincat_info = explode(",", $post_maincat_str);
1129
+					$post_maincat_id = $post_maincat_info[0];
1130
+					($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1131
+					(end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1132
+				}
1133
+				$post_sub_catid = '';
1134
+				if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1135
+					$post_sub_catid = (int)$post_cat_info[1];
1136
+				}
1137 1137
 
1138
-                geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1138
+				geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1139 1139
 
1140
-            }
1141
-        } else {
1140
+			}
1141
+		} else {
1142 1142
 
1143
-            $post_cat_info = explode(":", $post_cat_str);
1144
-            $post_maincat_str = $post_cat_info[0];
1143
+			$post_cat_info = explode(":", $post_cat_str);
1144
+			$post_maincat_str = $post_cat_info[0];
1145 1145
 
1146
-            $post_sub_catid = '';
1146
+			$post_sub_catid = '';
1147 1147
 
1148
-            if (!empty($post_maincat_str)) {
1149
-                $post_maincat_info = explode(",", $post_maincat_str);
1150
-                $post_maincat_id = $post_maincat_info[0];
1151
-                ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1152
-                (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1153
-            }
1148
+			if (!empty($post_maincat_str)) {
1149
+				$post_maincat_info = explode(",", $post_maincat_str);
1150
+				$post_maincat_id = $post_maincat_info[0];
1151
+				($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false;
1152
+				(end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false;
1153
+			}
1154 1154
 
1155
-            if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1156
-                $post_sub_catid = (int)$post_cat_info[1];
1157
-            }
1155
+			if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
1156
+				$post_sub_catid = (int)$post_cat_info[1];
1157
+			}
1158 1158
 
1159
-            geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1159
+			geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default);
1160 1160
 
1161
-        }
1162
-    }
1161
+		}
1162
+	}
1163 1163
 }
1164 1164
 
1165 1165
 /**
@@ -1173,35 +1173,35 @@  discard block
 block discarded – undo
1173 1173
  */
1174 1174
 function geodir_get_catlist($cat_taxonomy, $parrent = 0, $selected = false)
1175 1175
 {
1176
-    global $exclude_cats;
1176
+	global $exclude_cats;
1177 1177
 
1178
-    $cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
1178
+	$cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
1179 1179
 
1180
-    if (!empty($cat_terms)) {
1181
-        $onchange = '';
1182
-        $onchange = ' onchange="show_subcatlist(this.value, this)" ';
1180
+	if (!empty($cat_terms)) {
1181
+		$onchange = '';
1182
+		$onchange = ' onchange="show_subcatlist(this.value, this)" ';
1183 1183
 
1184
-        $option_selected = '';
1185
-        if (!$selected)
1186
-            $option_slected = ' selected="selected" ';
1184
+		$option_selected = '';
1185
+		if (!$selected)
1186
+			$option_slected = ' selected="selected" ';
1187 1187
 
1188
-        echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1188
+		echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >';
1189 1189
 
1190
-        echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1190
+		echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
1191 1191
 
1192
-        foreach ($cat_terms as $cat_term) {
1193
-            $option_selected = '';
1194
-            if ($selected == $cat_term->term_id)
1195
-                $option_selected = ' selected="selected" ';
1192
+		foreach ($cat_terms as $cat_term) {
1193
+			$option_selected = '';
1194
+			if ($selected == $cat_term->term_id)
1195
+				$option_selected = ' selected="selected" ';
1196 1196
 
1197
-            // Count child terms
1198
-            $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1199
-            $has_child = !empty( $child_terms ) ? 't' : 'f';
1197
+			// Count child terms
1198
+			$child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) );
1199
+			$has_child = !empty( $child_terms ) ? 't' : 'f';
1200 1200
 
1201
-            echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . geodir_utf8_ucfirst($cat_term->name) . '</option>';
1202
-        }
1203
-        echo '</select>';
1204
-    }
1201
+			echo '<option  ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . geodir_utf8_ucfirst($cat_term->name) . '</option>';
1202
+		}
1203
+		echo '</select>';
1204
+	}
1205 1205
 }
1206 1206
 
1207 1207
 /**
@@ -1217,28 +1217,28 @@  discard block
 block discarded – undo
1217 1217
  */
1218 1218
 function geodir_custom_update_messages($messages)
1219 1219
 {
1220
-    global $post, $post_ID;
1221
-
1222
-    $post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
1223
-
1224
-    foreach ($post_types as $post_type => $post_object) {
1225
-
1226
-        $messages[$post_type] = array(
1227
-            0 => '', // Unused. Messages start at index 1.
1228
-            1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1229
-            2 => __('Custom field updated.', 'geodirectory'),
1230
-            3 => __('Custom field deleted.', 'geodirectory'),
1231
-            4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1232
-            5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1233
-            6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1234
-            7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1235
-            8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1236
-            9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1237
-            10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1238
-        );
1239
-    }
1240
-
1241
-    return $messages;
1220
+	global $post, $post_ID;
1221
+
1222
+	$post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
1223
+
1224
+	foreach ($post_types as $post_type => $post_object) {
1225
+
1226
+		$messages[$post_type] = array(
1227
+			0 => '', // Unused. Messages start at index 1.
1228
+			1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1229
+			2 => __('Custom field updated.', 'geodirectory'),
1230
+			3 => __('Custom field deleted.', 'geodirectory'),
1231
+			4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
1232
+			5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
1233
+			6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1234
+			7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
1235
+			8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1236
+			9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
1237
+			10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
1238
+		);
1239
+	}
1240
+
1241
+	return $messages;
1242 1242
 }
1243 1243
 
1244 1244
 
@@ -1253,182 +1253,182 @@  discard block
 block discarded – undo
1253 1253
 function geodir_register_defaults()
1254 1254
 {
1255 1255
 
1256
-    global $wpdb;
1257
-
1258
-    $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1259
-
1260
-    if (!$listing_slug = get_option('geodir_listing_prefix'))
1261
-        $listing_slug = 'places';
1262
-
1263
-    /**
1264
-     * Taxonomies
1265
-     **/
1266
-    //if ( ! taxonomy_exists('gd_place_tags') )
1267
-    {
1268
-
1269
-        $gd_placetags = array();
1270
-        $gd_placetags['object_type'] = 'gd_place';
1271
-        $gd_placetags['listing_slug'] = $listing_slug . '/tags';
1272
-        $gd_placetags['args'] = array(
1273
-            'public' => true,
1274
-            'hierarchical' => false,
1275
-            'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1276
-            'query_var' => true,
1277
-
1278
-            'labels' => array(
1279
-                'name' => __('Place Tags', 'geodirectory'),
1280
-                'singular_name' => __('Place Tag', 'geodirectory'),
1281
-                'search_items' => __('Search Place Tags', 'geodirectory'),
1282
-                'popular_items' => __('Popular Place Tags', 'geodirectory'),
1283
-                'all_items' => __('All Place Tags', 'geodirectory'),
1284
-                'edit_item' => __('Edit Place Tag', 'geodirectory'),
1285
-                'update_item' => __('Update Place Tag', 'geodirectory'),
1286
-                'add_new_item' => __('Add New Place Tag', 'geodirectory'),
1287
-                'new_item_name' => __('New Place Tag Name', 'geodirectory'),
1288
-                'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
1289
-                'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
1290
-                'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
1291
-            ),
1292
-        );
1293
-
1294
-
1295
-        $geodir_taxonomies = get_option('geodir_taxonomies');
1296
-        $geodir_taxonomies['gd_place_tags'] = $gd_placetags;
1297
-        update_option('geodir_taxonomies', $geodir_taxonomies);
1298
-
1299
-
1300
-        // Update post types and delete tmp options
1301
-        flush_rewrite_rules();
1302
-
1303
-    }
1304
-
1305
-    //if ( ! taxonomy_exists('gd_placecategory') )
1306
-    {
1307
-
1308
-        $gd_placecategory = array();
1309
-        $gd_placecategory['object_type'] = 'gd_place';
1310
-        $gd_placecategory['listing_slug'] = $listing_slug;
1311
-        $gd_placecategory['args'] = array(
1312
-            'public' => true,
1313
-            'hierarchical' => true,
1314
-            'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1315
-            'query_var' => true,
1316
-            'labels' => array(
1317
-                'name' => __('Place Categories', 'geodirectory'),
1318
-                'singular_name' => __('Place Category', 'geodirectory'),
1319
-                'search_items' => __('Search Place Categories', 'geodirectory'),
1320
-                'popular_items' => __('Popular Place Categories', 'geodirectory'),
1321
-                'all_items' => __('All Place Categories', 'geodirectory'),
1322
-                'edit_item' => __('Edit Place Category', 'geodirectory'),
1323
-                'update_item' => __('Update Place Category', 'geodirectory'),
1324
-                'add_new_item' => __('Add New Place Category', 'geodirectory'),
1325
-                'new_item_name' => __('New Place Category', 'geodirectory'),
1326
-                'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
1327
-            ),
1328
-        );
1329
-
1330
-
1331
-        $geodir_taxonomies = get_option('geodir_taxonomies');
1332
-        $geodir_taxonomies['gd_placecategory'] = $gd_placecategory;
1333
-        update_option('geodir_taxonomies', $geodir_taxonomies);
1334
-
1335
-
1336
-        flush_rewrite_rules();
1337
-    }
1338
-
1339
-    /**
1340
-     * Post Types
1341
-     **/
1342
-
1343
-    //if ( ! post_type_exists('gd_place') )
1344
-    {
1345
-
1346
-        $labels = array(
1347
-            'name' => __('Places', 'geodirectory'),
1348
-            'singular_name' => __('Place', 'geodirectory'),
1349
-            'add_new' => __('Add New', 'geodirectory'),
1350
-            'add_new_item' => __('Add New Place', 'geodirectory'),
1351
-            'edit_item' => __('Edit Place', 'geodirectory'),
1352
-            'new_item' => __('New Place', 'geodirectory'),
1353
-            'view_item' => __('View Place', 'geodirectory'),
1354
-            'search_items' => __('Search Places', 'geodirectory'),
1355
-            'not_found' => __('No Place Found', 'geodirectory'),
1356
-            'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
1357
-
1358
-        $place_default = array(
1359
-            'labels' => $labels,
1360
-            'can_export' => true,
1361
-            'capability_type' => 'post',
1362
-            'description' => 'Place post type.',
1363
-            'has_archive' => $listing_slug,
1364
-            'hierarchical' => false,
1365
-            'map_meta_cap' => true,
1366
-            'menu_icon' => $menu_icon,
1367
-            'public' => true,
1368
-            'query_var' => true,
1369
-            'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1370
-            'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1371
-            'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1372
-
1373
-        //Update custom post types
1374
-        $geodir_post_types = get_option('geodir_post_types');
1375
-        $geodir_post_types['gd_place'] = $place_default;
1376
-        update_option('geodir_post_types', $geodir_post_types);
1377
-
1378
-        // Update post types and delete tmp options
1379
-        flush_rewrite_rules();
1380
-    }
1381
-
1382
-
1383
-    geodir_register_taxonomies();
1384
-    geodir_register_post_types();
1385
-
1386
-    //die;
1256
+	global $wpdb;
1257
+
1258
+	$menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico';
1259
+
1260
+	if (!$listing_slug = get_option('geodir_listing_prefix'))
1261
+		$listing_slug = 'places';
1262
+
1263
+	/**
1264
+	 * Taxonomies
1265
+	 **/
1266
+	//if ( ! taxonomy_exists('gd_place_tags') )
1267
+	{
1268
+
1269
+		$gd_placetags = array();
1270
+		$gd_placetags['object_type'] = 'gd_place';
1271
+		$gd_placetags['listing_slug'] = $listing_slug . '/tags';
1272
+		$gd_placetags['args'] = array(
1273
+			'public' => true,
1274
+			'hierarchical' => false,
1275
+			'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
1276
+			'query_var' => true,
1277
+
1278
+			'labels' => array(
1279
+				'name' => __('Place Tags', 'geodirectory'),
1280
+				'singular_name' => __('Place Tag', 'geodirectory'),
1281
+				'search_items' => __('Search Place Tags', 'geodirectory'),
1282
+				'popular_items' => __('Popular Place Tags', 'geodirectory'),
1283
+				'all_items' => __('All Place Tags', 'geodirectory'),
1284
+				'edit_item' => __('Edit Place Tag', 'geodirectory'),
1285
+				'update_item' => __('Update Place Tag', 'geodirectory'),
1286
+				'add_new_item' => __('Add New Place Tag', 'geodirectory'),
1287
+				'new_item_name' => __('New Place Tag Name', 'geodirectory'),
1288
+				'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
1289
+				'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
1290
+				'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
1291
+			),
1292
+		);
1293
+
1294
+
1295
+		$geodir_taxonomies = get_option('geodir_taxonomies');
1296
+		$geodir_taxonomies['gd_place_tags'] = $gd_placetags;
1297
+		update_option('geodir_taxonomies', $geodir_taxonomies);
1298
+
1299
+
1300
+		// Update post types and delete tmp options
1301
+		flush_rewrite_rules();
1302
+
1303
+	}
1304
+
1305
+	//if ( ! taxonomy_exists('gd_placecategory') )
1306
+	{
1307
+
1308
+		$gd_placecategory = array();
1309
+		$gd_placecategory['object_type'] = 'gd_place';
1310
+		$gd_placecategory['listing_slug'] = $listing_slug;
1311
+		$gd_placecategory['args'] = array(
1312
+			'public' => true,
1313
+			'hierarchical' => true,
1314
+			'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
1315
+			'query_var' => true,
1316
+			'labels' => array(
1317
+				'name' => __('Place Categories', 'geodirectory'),
1318
+				'singular_name' => __('Place Category', 'geodirectory'),
1319
+				'search_items' => __('Search Place Categories', 'geodirectory'),
1320
+				'popular_items' => __('Popular Place Categories', 'geodirectory'),
1321
+				'all_items' => __('All Place Categories', 'geodirectory'),
1322
+				'edit_item' => __('Edit Place Category', 'geodirectory'),
1323
+				'update_item' => __('Update Place Category', 'geodirectory'),
1324
+				'add_new_item' => __('Add New Place Category', 'geodirectory'),
1325
+				'new_item_name' => __('New Place Category', 'geodirectory'),
1326
+				'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
1327
+			),
1328
+		);
1329
+
1330
+
1331
+		$geodir_taxonomies = get_option('geodir_taxonomies');
1332
+		$geodir_taxonomies['gd_placecategory'] = $gd_placecategory;
1333
+		update_option('geodir_taxonomies', $geodir_taxonomies);
1334
+
1335
+
1336
+		flush_rewrite_rules();
1337
+	}
1338
+
1339
+	/**
1340
+	 * Post Types
1341
+	 **/
1342
+
1343
+	//if ( ! post_type_exists('gd_place') )
1344
+	{
1345
+
1346
+		$labels = array(
1347
+			'name' => __('Places', 'geodirectory'),
1348
+			'singular_name' => __('Place', 'geodirectory'),
1349
+			'add_new' => __('Add New', 'geodirectory'),
1350
+			'add_new_item' => __('Add New Place', 'geodirectory'),
1351
+			'edit_item' => __('Edit Place', 'geodirectory'),
1352
+			'new_item' => __('New Place', 'geodirectory'),
1353
+			'view_item' => __('View Place', 'geodirectory'),
1354
+			'search_items' => __('Search Places', 'geodirectory'),
1355
+			'not_found' => __('No Place Found', 'geodirectory'),
1356
+			'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
1357
+
1358
+		$place_default = array(
1359
+			'labels' => $labels,
1360
+			'can_export' => true,
1361
+			'capability_type' => 'post',
1362
+			'description' => 'Place post type.',
1363
+			'has_archive' => $listing_slug,
1364
+			'hierarchical' => false,
1365
+			'map_meta_cap' => true,
1366
+			'menu_icon' => $menu_icon,
1367
+			'public' => true,
1368
+			'query_var' => true,
1369
+			'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
1370
+			'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
1371
+			'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
1372
+
1373
+		//Update custom post types
1374
+		$geodir_post_types = get_option('geodir_post_types');
1375
+		$geodir_post_types['gd_place'] = $place_default;
1376
+		update_option('geodir_post_types', $geodir_post_types);
1377
+
1378
+		// Update post types and delete tmp options
1379
+		flush_rewrite_rules();
1380
+	}
1381
+
1382
+
1383
+	geodir_register_taxonomies();
1384
+	geodir_register_post_types();
1385
+
1386
+	//die;
1387 1387
 
1388 1388
 }
1389 1389
 
1390 1390
 $gd_wpml_get_languages = "";
1391 1391
 function gd_wpml_get_lang_from_url($url) {
1392
-    global $sitepress, $gd_wpml_get_languages;
1392
+	global $sitepress, $gd_wpml_get_languages;
1393 1393
     
1394
-    if (geodir_is_wpml()) {
1395
-        return $sitepress->get_language_from_url($url);
1396
-    }
1394
+	if (geodir_is_wpml()) {
1395
+		return $sitepress->get_language_from_url($url);
1396
+	}
1397 1397
     
1398
-    if (isset($_REQUEST['lang']) && $_REQUEST['lang']) {
1399
-        return $_REQUEST['lang'];
1400
-    }
1398
+	if (isset($_REQUEST['lang']) && $_REQUEST['lang']) {
1399
+		return $_REQUEST['lang'];
1400
+	}
1401 1401
 
1402
-    $url = str_replace(array("http://","https://"),"",$url);
1402
+	$url = str_replace(array("http://","https://"),"",$url);
1403 1403
 
1404
-    // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
1405
-    $site_url = str_replace(array("http://","https://"),"",site_url());
1404
+	// site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
1405
+	$site_url = str_replace(array("http://","https://"),"",site_url());
1406 1406
 
1407
-    $url = str_replace($site_url,"",$url);
1407
+	$url = str_replace($site_url,"",$url);
1408 1408
 
1409
-    $segments = explode('/', trim($url, '/'));
1409
+	$segments = explode('/', trim($url, '/'));
1410 1410
 
1411
-    if ($gd_wpml_get_languages) {
1412
-        $langs = $gd_wpml_get_languages;
1413
-    } else {
1414
-        $gd_wpml_get_languages = $sitepress->get_active_languages();
1415
-    }
1411
+	if ($gd_wpml_get_languages) {
1412
+		$langs = $gd_wpml_get_languages;
1413
+	} else {
1414
+		$gd_wpml_get_languages = $sitepress->get_active_languages();
1415
+	}
1416 1416
 
1417
-    if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
1418
-        return $segments[0];
1419
-    }
1417
+	if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
1418
+		return $segments[0];
1419
+	}
1420 1420
 
1421
-    return false;
1421
+	return false;
1422 1422
 }
1423 1423
 
1424 1424
 function gd_wpml_slug_translation_turned_on($post_type) {
1425 1425
 
1426
-    global $sitepress;
1427
-    $settings = $sitepress->get_settings();
1428
-    return isset($settings['posts_slug_translation']['types'][$post_type])
1429
-    && $settings['posts_slug_translation']['types'][$post_type]
1430
-    && isset($settings['posts_slug_translation']['on'])
1431
-    && $settings['posts_slug_translation']['on'];
1426
+	global $sitepress;
1427
+	$settings = $sitepress->get_settings();
1428
+	return isset($settings['posts_slug_translation']['types'][$post_type])
1429
+	&& $settings['posts_slug_translation']['types'][$post_type]
1430
+	&& isset($settings['posts_slug_translation']['on'])
1431
+	&& $settings['posts_slug_translation']['on'];
1432 1432
 }
1433 1433
 
1434 1434
 
@@ -1455,158 +1455,158 @@  discard block
 block discarded – undo
1455 1455
  */
1456 1456
 function geodir_listing_permalink_structure($post_link, $post_obj, $leavename, $sample)
1457 1457
 {
1458
-    //echo $post_link."<br />".$sample ;
1458
+	//echo $post_link."<br />".$sample ;
1459 1459
 
1460 1460
 
1461
-    global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache;
1462
-    if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
1463
-    } elseif (isset($post_obj->post_status) && $post_obj->post_status == 'auto-draft') {
1464
-        return $post_link;
1465
-    } else {
1466
-        $orig_post = $post;
1467
-        $post = $post_obj;
1468
-    }
1461
+	global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache;
1462
+	if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
1463
+	} elseif (isset($post_obj->post_status) && $post_obj->post_status == 'auto-draft') {
1464
+		return $post_link;
1465
+	} else {
1466
+		$orig_post = $post;
1467
+		$post = $post_obj;
1468
+	}
1469 1469
 
1470
-    if (in_array($post->post_type, geodir_get_posttypes())) {
1470
+	if (in_array($post->post_type, geodir_get_posttypes())) {
1471 1471
 
1472
-        // if we dont have a GD post then try to grab it
1473
-        if(!isset($post->default_category)){
1474
-            $gd_post = geodir_get_post_info($post->ID);
1475
-            if(!empty($gd_post)){
1476
-                $post = $gd_post;
1477
-            }
1478
-        }
1472
+		// if we dont have a GD post then try to grab it
1473
+		if(!isset($post->default_category)){
1474
+			$gd_post = geodir_get_post_info($post->ID);
1475
+			if(!empty($gd_post)){
1476
+				$post = $gd_post;
1477
+			}
1478
+		}
1479 1479
 
1480 1480
 
1481
-        $post_types = get_option('geodir_post_types');
1482
-        $slug = $post_types[$post->post_type]['rewrite']['slug'];
1481
+		$post_types = get_option('geodir_post_types');
1482
+		$slug = $post_types[$post->post_type]['rewrite']['slug'];
1483 1483
 
1484
-        // Alter the CPT slug if WPML is set to do so
1485
-        if(function_exists('icl_object_id')){
1486
-            if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1484
+		// Alter the CPT slug if WPML is set to do so
1485
+		if(function_exists('icl_object_id')){
1486
+			if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
1487 1487
 
1488
-                $org_slug = $slug;
1489
-                $slug = apply_filters( 'wpml_translate_single_string',
1490
-                    $slug,
1491
-                    'WordPress',
1492
-                    'URL slug: ' . $slug,
1493
-                    $language_code);
1488
+				$org_slug = $slug;
1489
+				$slug = apply_filters( 'wpml_translate_single_string',
1490
+					$slug,
1491
+					'WordPress',
1492
+					'URL slug: ' . $slug,
1493
+					$language_code);
1494 1494
 
1495
-                if(!$slug){$slug = $org_slug;}
1495
+				if(!$slug){$slug = $org_slug;}
1496 1496
 
1497
-            }
1498
-        }
1497
+			}
1498
+		}
1499 1499
 
1500
-        if (function_exists('geodir_location_geo_home_link')) {
1501
-            remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
1502
-        }
1500
+		if (function_exists('geodir_location_geo_home_link')) {
1501
+			remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
1502
+		}
1503 1503
         
1504
-        // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz.
1505
-        $site_url = trailingslashit(get_bloginfo('url'));
1504
+		// Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz.
1505
+		$site_url = trailingslashit(get_bloginfo('url'));
1506 1506
         
1507
-        if (function_exists('geodir_location_geo_home_link')) {
1508
-            add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
1509
-        }
1510
-
1511
-        $fix_url = strpos($post_link, $site_url) === 0 ? true : false;
1512
-        if ($fix_url) {
1513
-            $post_link = str_replace($site_url, '', $post_link);
1514
-        }
1515
-
1516
-        $post_link = trailingslashit(
1517
-            preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1518
-        );
1519
-
1520
-        if ($fix_url) {
1521
-            $post_link = $site_url . $post_link;
1522
-        }
1523
-
1524
-        if (isset($comment_post_cache[$post->ID])) {
1525
-            $post = $comment_post_cache[$post->ID];
1526
-        }
1527
-        if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
1528
-            $post_id = $post->ID;
1529
-            if (isset($orig_post)) {
1530
-                $post = $orig_post;
1531
-            }
1532
-            return $gd_permalink_cache[$post_id];
1533
-        }
1507
+		if (function_exists('geodir_location_geo_home_link')) {
1508
+			add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
1509
+		}
1534 1510
 
1535
-        if (!isset($post->post_locations)) {
1536
-            $post_type = $post->post_type;
1537
-            $ID = $post->ID;
1538
-            $post2 = $wpdb->get_row(
1539
-                $wpdb->prepare(
1540
-                    "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1541
-                    array($post->ID)
1542
-                )
1543
-            );
1511
+		$fix_url = strpos($post_link, $site_url) === 0 ? true : false;
1512
+		if ($fix_url) {
1513
+			$post_link = str_replace($site_url, '', $post_link);
1514
+		}
1544 1515
 
1545
-            $post = (object)array_merge((array)$post, (array)$post2);
1516
+		$post_link = trailingslashit(
1517
+			preg_replace(  "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 )
1518
+		);
1546 1519
 
1547
-            $comment_post_cache[$post->ID] = $post;
1548
-        }
1520
+		if ($fix_url) {
1521
+			$post_link = $site_url . $post_link;
1522
+		}
1549 1523
 
1524
+		if (isset($comment_post_cache[$post->ID])) {
1525
+			$post = $comment_post_cache[$post->ID];
1526
+		}
1527
+		if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
1528
+			$post_id = $post->ID;
1529
+			if (isset($orig_post)) {
1530
+				$post = $orig_post;
1531
+			}
1532
+			return $gd_permalink_cache[$post_id];
1533
+		}
1550 1534
 
1535
+		if (!isset($post->post_locations)) {
1536
+			$post_type = $post->post_type;
1537
+			$ID = $post->ID;
1538
+			$post2 = $wpdb->get_row(
1539
+				$wpdb->prepare(
1540
+					"SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1541
+					array($post->ID)
1542
+				)
1543
+			);
1551 1544
 
1552
-        if (false !== strpos($post_link, '%gd_taxonomy%')) {
1545
+			$post = (object)array_merge((array)$post, (array)$post2);
1553 1546
 
1554
-            if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1555
-                $location_request = '';
1547
+			$comment_post_cache[$post->ID] = $post;
1548
+		}
1556 1549
 
1557 1550
 
1558
-                if (!empty($post->post_locations)) {
1559
-                    $geodir_arr_locations = explode(',', $post->post_locations);
1560
-                    if (count($geodir_arr_locations) == 3) {
1561
-                        $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1562
-                        $post->city_slug = str_replace(']', '', $post->city_slug);
1563
-                        $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1564
-                        $post->region_slug = str_replace(']', '', $post->region_slug);
1565
-                        $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1566
-                        $post->country_slug = str_replace(']', '', $post->country_slug);
1567 1551
 
1568
-                        $post_location = (object)array('country_slug' => $post->country_slug,
1569
-                            'region_slug' => $post->region_slug,
1570
-                            'city_slug' => $post->city_slug
1571
-                        );
1552
+		if (false !== strpos($post_link, '%gd_taxonomy%')) {
1572 1553
 
1573
-                    } else
1574
-                        $post_location = geodir_get_location();
1554
+			if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
1555
+				$location_request = '';
1575 1556
 
1576 1557
 
1577
-                } else {
1558
+				if (!empty($post->post_locations)) {
1559
+					$geodir_arr_locations = explode(',', $post->post_locations);
1560
+					if (count($geodir_arr_locations) == 3) {
1561
+						$post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1562
+						$post->city_slug = str_replace(']', '', $post->city_slug);
1563
+						$post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1564
+						$post->region_slug = str_replace(']', '', $post->region_slug);
1565
+						$post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1566
+						$post->country_slug = str_replace(']', '', $post->country_slug);
1578 1567
 
1579
-                    $post_location_sql = $wpdb->get_results(
1580
-                        $wpdb->prepare(
1581
-                            "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1582
-                            array($post->ID)
1583
-                        )
1584
-                    );
1585
-
1586
-                    if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
1587
-
1588
-                        $geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
1589
-                        if (count($geodir_arr_locations) == 3) {
1590
-                            $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1591
-                            $post->city_slug = str_replace(']', '', $post->city_slug);
1592
-                            $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1593
-                            $post->region_slug = str_replace(']', '', $post->region_slug);
1594
-                            $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1595
-                            $post->country_slug = str_replace(']', '', $post->country_slug);
1596
-
1597
-                            $post_location = (object)array('country_slug' => $post->country_slug,
1598
-                                'region_slug' => $post->region_slug,
1599
-                                'city_slug' => $post->city_slug
1600
-                            );
1568
+						$post_location = (object)array('country_slug' => $post->country_slug,
1569
+							'region_slug' => $post->region_slug,
1570
+							'city_slug' => $post->city_slug
1571
+						);
1572
+
1573
+					} else
1574
+						$post_location = geodir_get_location();
1601 1575
 
1602
-                        }
1603
-                    } else
1604
-                        $post_location = geodir_get_location();
1605
-                }
1606 1576
 
1577
+				} else {
1607 1578
 
1608
-                if (!empty($post_location)) {
1609
-                    $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : '';
1579
+					$post_location_sql = $wpdb->get_results(
1580
+						$wpdb->prepare(
1581
+							"SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ",
1582
+							array($post->ID)
1583
+						)
1584
+					);
1585
+
1586
+					if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
1587
+
1588
+						$geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
1589
+						if (count($geodir_arr_locations) == 3) {
1590
+							$post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
1591
+							$post->city_slug = str_replace(']', '', $post->city_slug);
1592
+							$post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
1593
+							$post->region_slug = str_replace(']', '', $post->region_slug);
1594
+							$post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
1595
+							$post->country_slug = str_replace(']', '', $post->country_slug);
1596
+
1597
+							$post_location = (object)array('country_slug' => $post->country_slug,
1598
+								'region_slug' => $post->region_slug,
1599
+								'city_slug' => $post->city_slug
1600
+							);
1601
+
1602
+						}
1603
+					} else
1604
+						$post_location = geodir_get_location();
1605
+				}
1606
+
1607
+
1608
+				if (!empty($post_location)) {
1609
+					$country_slug = isset($post_location->country_slug) ? $post_location->country_slug : '';
1610 1610
 					$region_slug = isset($post_location->region_slug) ? $post_location->region_slug : '';
1611 1611
 					$city_slug = isset($post_location->city_slug) ? $post_location->city_slug : '';
1612 1612
 					
@@ -1624,89 +1624,89 @@  discard block
 block discarded – undo
1624 1624
 					$location_slug[] = $city_slug;
1625 1625
 					
1626 1626
 					$location_request .= implode('/', $location_slug) . '/';
1627
-                }
1628
-            }
1627
+				}
1628
+			}
1629 1629
 
1630
-            if (get_option('geodir_add_categories_url')) {
1630
+			if (get_option('geodir_add_categories_url')) {
1631 1631
 
1632
-                $term_request = '';
1633
-                $taxonomies = geodir_get_taxonomies($post->post_type);
1632
+				$term_request = '';
1633
+				$taxonomies = geodir_get_taxonomies($post->post_type);
1634 1634
 
1635
-                $taxonomies = end($taxonomies);
1635
+				$taxonomies = end($taxonomies);
1636 1636
 
1637
-                if (!empty($post->default_category)) {
1638
-                    $post_terms = $post->default_category;
1639
-                } else {
1640
-                    $post_terms = '';
1641
-
1642
-                    if(isset($_POST['post_default_category']) && $_POST['post_default_category']){
1643
-                        $post_terms = absint($_POST['post_default_category']);
1644
-                    }elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]){
1645
-                        $post_terms = explode(",", trim($_POST['post_category'][$taxonomies], ","));
1646
-                        $post_terms = absint($post_terms[0]);
1647
-                    }elseif (isset($post->{$taxonomies})) {
1648
-                        $post_terms = explode(",", trim($post->{$taxonomies}, ","));
1649
-                        $post_terms = $post_terms[0];
1650
-                    }
1637
+				if (!empty($post->default_category)) {
1638
+					$post_terms = $post->default_category;
1639
+				} else {
1640
+					$post_terms = '';
1641
+
1642
+					if(isset($_POST['post_default_category']) && $_POST['post_default_category']){
1643
+						$post_terms = absint($_POST['post_default_category']);
1644
+					}elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]){
1645
+						$post_terms = explode(",", trim($_POST['post_category'][$taxonomies], ","));
1646
+						$post_terms = absint($post_terms[0]);
1647
+					}elseif (isset($post->{$taxonomies})) {
1648
+						$post_terms = explode(",", trim($post->{$taxonomies}, ","));
1649
+						$post_terms = $post_terms[0];
1650
+					}
1651 1651
 
1652
-                    if (!$post_terms)
1653
-                        $post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1652
+					if (!$post_terms)
1653
+						$post_terms = geodir_get_post_meta($post->ID, 'default_category', true);
1654 1654
 
1655
-                    if (!$post_terms) {
1656
-                        $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
1655
+					if (!$post_terms) {
1656
+						$post_terms = geodir_get_post_meta($post->ID, $taxonomies, true);
1657 1657
 
1658
-                        if ($post_terms) {
1659
-                            $post_terms = explode(",", trim($post_terms, ","));
1660
-                            $post_terms = $post_terms[0];
1661
-                        }
1662
-                    }
1663
-                }
1658
+						if ($post_terms) {
1659
+							$post_terms = explode(",", trim($post_terms, ","));
1660
+							$post_terms = $post_terms[0];
1661
+						}
1662
+					}
1663
+				}
1664 1664
 
1665
-                $term = get_term_by('id', $post_terms, $taxonomies);
1665
+				$term = get_term_by('id', $post_terms, $taxonomies);
1666 1666
 
1667
-                if (!empty($term))
1668
-                    $term_request = $term->slug;
1669
-                //$term_request = $term->slug.'/';
1670
-            }
1667
+				if (!empty($term))
1668
+					$term_request = $term->slug;
1669
+				//$term_request = $term->slug.'/';
1670
+			}
1671 1671
 
1672
-            $request_term = '';
1673
-            $listingurl_separator = '';
1674
-            //$detailurl_separator = get_option('geodir_detailurl_separator');
1675
-            $detailurl_separator = '';
1676
-            if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
1677
-                $request_term = $location_request;
1678
-                //$listingurl_separator = get_option('geodir_listingurl_separator');
1679
-                //$request_term .= $listingurl_separator.'/'.$term_request;
1680
-                $request_term .= $term_request;
1672
+			$request_term = '';
1673
+			$listingurl_separator = '';
1674
+			//$detailurl_separator = get_option('geodir_detailurl_separator');
1675
+			$detailurl_separator = '';
1676
+			if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
1677
+				$request_term = $location_request;
1678
+				//$listingurl_separator = get_option('geodir_listingurl_separator');
1679
+				//$request_term .= $listingurl_separator.'/'.$term_request;
1680
+				$request_term .= $term_request;
1681 1681
 
1682
-            } else {
1683
-                if (isset($location_request) && $location_request != '') $request_term = $location_request;
1682
+			} else {
1683
+				if (isset($location_request) && $location_request != '') $request_term = $location_request;
1684 1684
 
1685
-                if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1686
-            }
1687
-            $request_term = trim($request_term, '/');
1685
+				if (isset($term_request) && $term_request != '') $request_term .= $term_request;
1686
+			}
1687
+			$request_term = trim($request_term, '/');
1688 1688
             
1689
-            // Fix with WPML the location terms added twice when CPT slug is translated.
1690
-            if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/' . $request_term . $detailurl_separator) !== false) {
1691
-                $post_link = str_replace('%gd_taxonomy%/', '', $post_link);
1692
-            }
1689
+			// Fix with WPML the location terms added twice when CPT slug is translated.
1690
+			if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/' . $request_term . $detailurl_separator) !== false) {
1691
+				$post_link = str_replace('%gd_taxonomy%/', '', $post_link);
1692
+			}
1693 1693
             
1694
-            if (!empty($request_term))
1695
-                $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1696
-            else
1697
-                $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1698
-            //echo $post_link ;
1699
-        }
1700
-        // temp cache the permalink
1701
-        if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
1702
-            $gd_permalink_cache[$post->ID] = $post_link;
1703
-        }
1704
-    }
1705
-    if (isset($orig_post)) {
1706
-        $post = $orig_post;
1707
-    }
1708
-
1709
-    return $post_link;
1694
+			if (!empty($request_term))
1695
+				$post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1696
+			else
1697
+				$post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
1698
+			//echo $post_link ;
1699
+		}
1700
+		// temp cache the permalink
1701
+		if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
1702
+			$gd_permalink_cache[$post->ID] = $post_link;
1703
+		}
1704
+	}
1705
+	if (isset($orig_post)) {
1706
+		$post = $orig_post;
1707
+	}
1708
+
1709
+	return $post_link;
1710 1710
 }
1711 1711
 
1712 1712
 /**
@@ -1722,99 +1722,99 @@  discard block
 block discarded – undo
1722 1722
  * @return string The term link.
1723 1723
  */
1724 1724
 function geodir_term_link($termlink, $term, $taxonomy) {
1725
-    $geodir_taxonomies = geodir_get_taxonomies('', true);
1725
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1726 1726
 
1727
-    if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
1728
-        global $geodir_add_location_url, $gd_session;
1729
-        $include_location = false;
1730
-        $request_term = array();
1731
-        $add_location_url = get_option('geodir_add_location_url');
1732
-        $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1727
+	if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
1728
+		global $geodir_add_location_url, $gd_session;
1729
+		$include_location = false;
1730
+		$request_term = array();
1731
+		$add_location_url = get_option('geodir_add_location_url');
1732
+		$location_manager = defined('POST_LOCATION_TABLE') ? true : false;
1733 1733
 
1734
-        $listing_slug = geodir_get_listing_slug($taxonomy);
1734
+		$listing_slug = geodir_get_listing_slug($taxonomy);
1735 1735
 
1736
-        if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
1737
-            if ($geodir_add_location_url && $add_location_url) {
1738
-                $include_location = true;
1739
-            }
1740
-        } elseif ($add_location_url && $gd_session->get('gd_multi_location') == 1) {
1741
-            $include_location = true;
1742
-        } elseif ($add_location_url && $location_manager && geodir_is_page('detail')) {
1743
-            $include_location = true;
1744
-        }
1745
-
1746
-        if ($include_location) {
1747
-            global $post;
1736
+		if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
1737
+			if ($geodir_add_location_url && $add_location_url) {
1738
+				$include_location = true;
1739
+			}
1740
+		} elseif ($add_location_url && $gd_session->get('gd_multi_location') == 1) {
1741
+			$include_location = true;
1742
+		} elseif ($add_location_url && $location_manager && geodir_is_page('detail')) {
1743
+			$include_location = true;
1744
+		}
1745
+
1746
+		if ($include_location) {
1747
+			global $post;
1748 1748
             
1749
-            $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1749
+			$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
1750 1750
             
1751
-            if (geodir_is_page('detail') && isset($post->country_slug)) {
1752
-                $location_terms = array(
1753
-                    'gd_country' => $post->country_slug,
1754
-                    'gd_region' => $post->region_slug,
1755
-                    'gd_city' => $post->city_slug
1756
-                );
1751
+			if (geodir_is_page('detail') && isset($post->country_slug)) {
1752
+				$location_terms = array(
1753
+					'gd_country' => $post->country_slug,
1754
+					'gd_region' => $post->region_slug,
1755
+					'gd_city' => $post->city_slug
1756
+				);
1757 1757
                 
1758
-                if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1759
-                    $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1760
-                }
1761
-            } else {
1762
-                $location_terms = geodir_get_current_location_terms('query_vars');
1763
-            }
1758
+				if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
1759
+					$location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood;
1760
+				}
1761
+			} else {
1762
+				$location_terms = geodir_get_current_location_terms('query_vars');
1763
+			}
1764 1764
 
1765
-            $geodir_show_location_url = get_option('geodir_show_location_url');
1766
-            $location_terms = geodir_remove_location_terms($location_terms);
1765
+			$geodir_show_location_url = get_option('geodir_show_location_url');
1766
+			$location_terms = geodir_remove_location_terms($location_terms);
1767 1767
 
1768
-            if (!empty($location_terms)) {
1769
-                $url_separator = '';
1768
+			if (!empty($location_terms)) {
1769
+				$url_separator = '';
1770 1770
 
1771
-                if (get_option('permalink_structure') != '') {
1772
-                    $old_listing_slug = '/' . $listing_slug . '/';
1773
-                    $request_term = implode("/", $location_terms);
1774
-                    $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1771
+				if (get_option('permalink_structure') != '') {
1772
+					$old_listing_slug = '/' . $listing_slug . '/';
1773
+					$request_term = implode("/", $location_terms);
1774
+					$new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/';
1775 1775
 
1776
-                    $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1777
-                } else {
1778
-                    $termlink = geodir_getlink($termlink, $request_term);
1779
-                }
1780
-            }
1781
-        }
1776
+					$termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug));
1777
+				} else {
1778
+					$termlink = geodir_getlink($termlink, $request_term);
1779
+				}
1780
+			}
1781
+		}
1782 1782
 
1783
-        // Alter the CPT slug is WPML is set to do so
1784
-        /* we can replace this with the below function
1783
+		// Alter the CPT slug is WPML is set to do so
1784
+		/* we can replace this with the below function
1785 1785
         if(function_exists('icl_object_id')){
1786 1786
             global $sitepress;
1787 1787
             $post_type = str_replace("category","",$taxonomy);
1788 1788
             $termlink = $sitepress->post_type_archive_link_filter( $termlink, $post_type);
1789 1789
         }*/
1790 1790
 
1791
-        // Alter the CPT slug if WPML is set to do so
1792
-        if (function_exists('icl_object_id')) {
1793
-            $post_types = get_option('geodir_post_types');
1794
-            $post_type = str_replace("category","",$taxonomy);
1795
-            $post_type = str_replace("_tags","",$post_type);
1796
-            $slug = $post_types[$post_type]['rewrite']['slug'];
1797
-            if (gd_wpml_slug_translation_turned_on($post_type)) {
1798
-                global $sitepress;
1799
-                $default_lang = $sitepress->get_default_language();
1800
-                $language_code = gd_wpml_get_lang_from_url($termlink);
1801
-                if (!$language_code ) {
1802
-                    $language_code  = $default_lang;
1803
-                }
1791
+		// Alter the CPT slug if WPML is set to do so
1792
+		if (function_exists('icl_object_id')) {
1793
+			$post_types = get_option('geodir_post_types');
1794
+			$post_type = str_replace("category","",$taxonomy);
1795
+			$post_type = str_replace("_tags","",$post_type);
1796
+			$slug = $post_types[$post_type]['rewrite']['slug'];
1797
+			if (gd_wpml_slug_translation_turned_on($post_type)) {
1798
+				global $sitepress;
1799
+				$default_lang = $sitepress->get_default_language();
1800
+				$language_code = gd_wpml_get_lang_from_url($termlink);
1801
+				if (!$language_code ) {
1802
+					$language_code  = $default_lang;
1803
+				}
1804 1804
 
1805
-                $org_slug = $slug;
1806
-                $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code);
1805
+				$org_slug = $slug;
1806
+				$slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code);
1807 1807
 
1808
-                if (!$slug) {
1809
-                    $slug = $org_slug;
1810
-                }
1808
+				if (!$slug) {
1809
+					$slug = $org_slug;
1810
+				}
1811 1811
 
1812
-                $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug  ,$termlink, 1));
1813
-            }
1814
-        }
1815
-    }
1812
+				$termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug  ,$termlink, 1));
1813
+			}
1814
+		}
1815
+	}
1816 1816
     
1817
-    return $termlink;
1817
+	return $termlink;
1818 1818
 }
1819 1819
 
1820 1820
 /**
@@ -1840,14 +1840,14 @@  discard block
 block discarded – undo
1840 1840
 	if (in_array($post_type, geodir_get_posttypes())) {
1841 1841
 		if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
1842 1842
 			if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
1843
-                $location_terms = array(
1844
-                    'gd_country' => $post->country_slug,
1845
-                    'gd_region' => $post->region_slug,
1846
-                    'gd_city' => $post->city_slug
1847
-                );
1848
-            } else {
1849
-                $location_terms = geodir_get_current_location_terms('query_vars');
1850
-            }
1843
+				$location_terms = array(
1844
+					'gd_country' => $post->country_slug,
1845
+					'gd_region' => $post->region_slug,
1846
+					'gd_city' => $post->city_slug
1847
+				);
1848
+			} else {
1849
+				$location_terms = geodir_get_current_location_terms('query_vars');
1850
+			}
1851 1851
 			
1852 1852
 			$location_terms = geodir_remove_location_terms($location_terms);
1853 1853
 			
@@ -1879,17 +1879,17 @@  discard block
 block discarded – undo
1879 1879
  * @return void|string Label.
1880 1880
  */
1881 1881
 function get_post_type_singular_label($post_type, $echo = false, $translate = false) {
1882
-    $obj_post_type = get_post_type_object($post_type);
1883
-    if (!is_object($obj_post_type)) {
1884
-        return;
1885
-    }
1882
+	$obj_post_type = get_post_type_object($post_type);
1883
+	if (!is_object($obj_post_type)) {
1884
+		return;
1885
+	}
1886 1886
     
1887
-    $label = $translate ? __($obj_post_type->labels->singular_name, 'geodirectory') : $obj_post_type->labels->singular_name;
1887
+	$label = $translate ? __($obj_post_type->labels->singular_name, 'geodirectory') : $obj_post_type->labels->singular_name;
1888 1888
     
1889
-    if ($echo)
1890
-        echo $label;
1891
-    else
1892
-        return $label;
1889
+	if ($echo)
1890
+		echo $label;
1891
+	else
1892
+		return $label;
1893 1893
 }
1894 1894
 
1895 1895
 /**
@@ -1904,19 +1904,19 @@  discard block
 block discarded – undo
1904 1904
  * @return void|string Label.
1905 1905
  */
1906 1906
 function get_post_type_plural_label($post_type, $echo = false, $translate = false) {
1907
-    $all_postypes = geodir_get_posttypes();
1907
+	$all_postypes = geodir_get_posttypes();
1908 1908
 
1909
-    if (!in_array($post_type, $all_postypes))
1910
-        return false;
1909
+	if (!in_array($post_type, $all_postypes))
1910
+		return false;
1911 1911
 
1912
-    $obj_post_type = get_post_type_object($post_type);
1912
+	$obj_post_type = get_post_type_object($post_type);
1913 1913
     
1914
-    $label = $translate ? __($obj_post_type->labels->name, 'geodirectory') : $obj_post_type->labels->name;
1914
+	$label = $translate ? __($obj_post_type->labels->name, 'geodirectory') : $obj_post_type->labels->name;
1915 1915
     
1916
-    if ($echo)
1917
-        echo $label;
1918
-    else
1919
-        return $label;
1916
+	if ($echo)
1917
+		echo $label;
1918
+	else
1919
+		return $label;
1920 1920
 }
1921 1921
 
1922 1922
 /**
@@ -1934,51 +1934,51 @@  discard block
 block discarded – undo
1934 1934
  */
1935 1935
 function geodir_term_exists($term, $taxonomy = '', $parent = 0)
1936 1936
 {
1937
-    global $wpdb;
1938
-
1939
-    $select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
1940
-    $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1941
-
1942
-    if (is_int($term)) {
1943
-        if (0 == $term)
1944
-            return 0;
1945
-        $where = 't.term_id = %d';
1946
-        if (!empty($taxonomy))
1947
-            return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1948
-        else
1949
-            return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1950
-    }
1937
+	global $wpdb;
1938
+
1939
+	$select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
1940
+	$tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1941
+
1942
+	if (is_int($term)) {
1943
+		if (0 == $term)
1944
+			return 0;
1945
+		$where = 't.term_id = %d';
1946
+		if (!empty($taxonomy))
1947
+			return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
1948
+		else
1949
+			return $wpdb->get_var($wpdb->prepare($select . $where, $term));
1950
+	}
1951 1951
 
1952
-    $term = trim(wp_unslash($term));
1952
+	$term = trim(wp_unslash($term));
1953 1953
 
1954
-    if ('' === $slug = sanitize_title($term))
1955
-        return 0;
1954
+	if ('' === $slug = sanitize_title($term))
1955
+		return 0;
1956 1956
 
1957
-    $where = 't.slug = %s';
1957
+	$where = 't.slug = %s';
1958 1958
 
1959
-    $where_fields = array($slug);
1960
-    if (!empty($taxonomy)) {
1961
-        $parent = (int)$parent;
1962
-        if ($parent > 0) {
1963
-            $where_fields[] = $parent;
1964
-            $else_where_fields[] = $parent;
1965
-            $where .= ' AND tt.parent = %d';
1959
+	$where_fields = array($slug);
1960
+	if (!empty($taxonomy)) {
1961
+		$parent = (int)$parent;
1962
+		if ($parent > 0) {
1963
+			$where_fields[] = $parent;
1964
+			$else_where_fields[] = $parent;
1965
+			$where .= ' AND tt.parent = %d';
1966 1966
 
1967
-        }
1967
+		}
1968 1968
 
1969
-        $where_fields[] = $taxonomy;
1969
+		$where_fields[] = $taxonomy;
1970 1970
 
1971 1971
 
1972
-        if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1973
-            return $result;
1972
+		if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
1973
+			return $result;
1974 1974
 
1975
-        return false;
1976
-    }
1975
+		return false;
1976
+	}
1977 1977
 
1978
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1979
-        return $result;
1978
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
1979
+		return $result;
1980 1980
 
1981
-    return false;
1981
+	return false;
1982 1982
 }
1983 1983
 
1984 1984
 /**
@@ -1990,7 +1990,7 @@  discard block
 block discarded – undo
1990 1990
 function geodir_get_term_icon_rebuild()
1991 1991
 {
1992 1992
 
1993
-    update_option('gd_term_icons', '');
1993
+	update_option('gd_term_icons', '');
1994 1994
 
1995 1995
 }
1996 1996
 
@@ -2008,61 +2008,61 @@  discard block
 block discarded – undo
2008 2008
  */
2009 2009
 function geodir_get_term_icon($term_id = false, $rebuild = false)
2010 2010
 {
2011
-    global $wpdb;
2012
-    if (!$rebuild) {
2013
-        $terms_icons = get_option('gd_term_icons');
2014
-    } else {
2015
-        $terms_icons = array();
2016
-    }
2017
-
2018
-    if (empty($terms_icons)) {
2019
-        $terms_icons = array();
2020
-        $default_icon_url = get_option('geodir_default_marker_icon');
2021
-        $taxonomy = geodir_get_taxonomies();
2022
-        $post_types = geodir_get_posttypes();
2023
-        $tax_arr = array();
2024
-        foreach ($post_types as $post_type) {
2025
-            $tax_arr[] = "'" . $post_type . "category'";
2026
-        }
2027
-        $tax_c = implode(',', $tax_arr);
2028
-        $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
2029
-        //$terms = get_terms( $taxonomy );
2030
-
2031
-        if($terms) {
2032
-            foreach ($terms as $term) {
2033
-                $post_type = str_replace("category", "", $term->taxonomy);
2034
-                $a_terms[$post_type][] = $term;
2011
+	global $wpdb;
2012
+	if (!$rebuild) {
2013
+		$terms_icons = get_option('gd_term_icons');
2014
+	} else {
2015
+		$terms_icons = array();
2016
+	}
2035 2017
 
2036
-            }
2037
-        }
2018
+	if (empty($terms_icons)) {
2019
+		$terms_icons = array();
2020
+		$default_icon_url = get_option('geodir_default_marker_icon');
2021
+		$taxonomy = geodir_get_taxonomies();
2022
+		$post_types = geodir_get_posttypes();
2023
+		$tax_arr = array();
2024
+		foreach ($post_types as $post_type) {
2025
+			$tax_arr[] = "'" . $post_type . "category'";
2026
+		}
2027
+		$tax_c = implode(',', $tax_arr);
2028
+		$terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
2029
+		//$terms = get_terms( $taxonomy );
2038 2030
 
2039
-        if($a_terms) {
2040
-            foreach ($a_terms as $pt => $t2) {
2031
+		if($terms) {
2032
+			foreach ($terms as $term) {
2033
+				$post_type = str_replace("category", "", $term->taxonomy);
2034
+				$a_terms[$post_type][] = $term;
2041 2035
 
2042
-                foreach ($t2 as $term) {
2043
-                    $term_icon = geodir_get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt);
2044
-                    if ($term_icon) {
2045
-                        $term_icon_url = $term_icon["src"];
2046
-                    } else {
2047
-                        $term_icon_url = $default_icon_url;
2048
-                    }
2049
-                    $terms_icons[$term->term_id] = $term_icon_url;
2050
-                }
2051
-            }
2052
-        }
2036
+			}
2037
+		}
2053 2038
 
2054
-        update_option('gd_term_icons', $terms_icons);
2055
-    }
2039
+		if($a_terms) {
2040
+			foreach ($a_terms as $pt => $t2) {
2056 2041
 
2057
-    if ($term_id && isset($terms_icons[$term_id])) {
2058
-        return $terms_icons[$term_id];
2059
-    } elseif ($term_id && !isset($terms_icons[$term_id])) {
2060
-        return get_option('geodir_default_marker_icon');
2061
-    }
2042
+				foreach ($t2 as $term) {
2043
+					$term_icon = geodir_get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt);
2044
+					if ($term_icon) {
2045
+						$term_icon_url = $term_icon["src"];
2046
+					} else {
2047
+						$term_icon_url = $default_icon_url;
2048
+					}
2049
+					$terms_icons[$term->term_id] = $term_icon_url;
2050
+				}
2051
+			}
2052
+		}
2053
+
2054
+		update_option('gd_term_icons', $terms_icons);
2055
+	}
2062 2056
 
2063
-    if (is_ssl()) {
2064
-        $terms_icons = str_replace("http:","https:",$terms_icons );
2065
-    }
2057
+	if ($term_id && isset($terms_icons[$term_id])) {
2058
+		return $terms_icons[$term_id];
2059
+	} elseif ($term_id && !isset($terms_icons[$term_id])) {
2060
+		return get_option('geodir_default_marker_icon');
2061
+	}
2062
+
2063
+	if (is_ssl()) {
2064
+		$terms_icons = str_replace("http:","https:",$terms_icons );
2065
+	}
2066 2066
 
2067
-    return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
2067
+	return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
2068 2068
 }
2069 2069
\ No newline at end of file
Please login to merge, or discard this patch.