@@ -17,370 +17,370 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | function geodir_custom_fields_predefined($post_type=''){ |
| 19 | 19 | |
| 20 | - $custom_fields = array(); |
|
| 21 | - |
|
| 22 | - |
|
| 23 | - // price |
|
| 24 | - $custom_fields['price'] = array( // The key value should be unique and not contain any spaces. |
|
| 25 | - 'field_type' => 'text', |
|
| 26 | - 'class' => 'gd-price', |
|
| 27 | - 'icon' => 'fa fa-usd', |
|
| 28 | - 'name' => __('Price', 'geodirectory'), |
|
| 29 | - 'description' => __('Adds a input for a price field. This will let you filter and sort by price.', 'geodirectory'), |
|
| 30 | - 'defaults' => array( |
|
| 31 | - 'data_type' => 'FLOAT', |
|
| 32 | - 'decimal_point' => '2', |
|
| 33 | - 'admin_title' => 'Price', |
|
| 34 | - 'site_title' => 'Price', |
|
| 35 | - 'admin_desc' => 'Enter the price in $ (no currency symbol)', |
|
| 36 | - 'htmlvar_name' => 'price', |
|
| 37 | - 'is_active' => true, |
|
| 38 | - 'for_admin_use' => false, |
|
| 39 | - 'default_value' => '', |
|
| 40 | - 'show_in' => '[detail],[listing]', |
|
| 41 | - 'is_required' => false, |
|
| 42 | - 'validation_pattern' => '\d+(\.\d{2})?', |
|
| 43 | - 'validation_msg' => 'Please enter number and decimal only ie: 100.50', |
|
| 44 | - 'required_msg' => '', |
|
| 45 | - 'field_icon' => 'fa fa-usd', |
|
| 46 | - 'css_class' => '', |
|
| 47 | - 'cat_sort' => true, |
|
| 48 | - 'cat_filter' => true, |
|
| 49 | - 'extra_fields' => array( |
|
| 50 | - 'is_price' => 1, |
|
| 51 | - 'thousand_separator' => 'comma', |
|
| 52 | - 'decimal_separator' => 'period', |
|
| 53 | - 'decimal_display' => 'if', |
|
| 54 | - 'currency_symbol' => '$', |
|
| 55 | - 'currency_symbol_placement' => 'left' |
|
| 56 | - ) |
|
| 57 | - ) |
|
| 58 | - ); |
|
| 59 | - |
|
| 60 | - // property status |
|
| 61 | - $custom_fields['property_status'] = array( // The key value should be unique and not contain any spaces. |
|
| 62 | - 'field_type' => 'select', |
|
| 63 | - 'class' => 'gd-property-status', |
|
| 64 | - 'icon' => 'fa fa-home', |
|
| 65 | - 'name' => __('Property Status', 'geodirectory'), |
|
| 66 | - 'description' => __('Adds a select input to be able to set the status of a property ie: For Sale, For Rent', 'geodirectory'), |
|
| 67 | - 'defaults' => array( |
|
| 68 | - 'data_type' => 'VARCHAR', |
|
| 69 | - 'admin_title' => 'Property Status', |
|
| 70 | - 'site_title' => 'Property Status', |
|
| 71 | - 'admin_desc' => 'Enter the status of the property.', |
|
| 72 | - 'htmlvar_name' => 'property_status', |
|
| 73 | - 'is_active' => true, |
|
| 74 | - 'for_admin_use' => false, |
|
| 75 | - 'default_value' => '', |
|
| 76 | - 'show_in' => '[detail],[listing]', |
|
| 77 | - 'is_required' => true, |
|
| 78 | - 'option_values' => __('Select Status/,For Sale,For Rent,Sold,Let','geodirectory'), |
|
| 79 | - 'validation_pattern' => '', |
|
| 80 | - 'validation_msg' => '', |
|
| 81 | - 'required_msg' => '', |
|
| 82 | - 'field_icon' => 'fa fa-home', |
|
| 83 | - 'css_class' => '', |
|
| 84 | - 'cat_sort' => true, |
|
| 85 | - 'cat_filter' => true |
|
| 86 | - ) |
|
| 87 | - ); |
|
| 88 | - |
|
| 89 | - // property furnishing |
|
| 90 | - $custom_fields['property_furnishing'] = array( // The key value should be unique and not contain any spaces. |
|
| 91 | - 'field_type' => 'select', |
|
| 92 | - 'class' => 'gd-property-furnishing', |
|
| 93 | - 'icon' => 'fa fa-home', |
|
| 94 | - 'name' => __('Property Furnishing', 'geodirectory'), |
|
| 95 | - 'description' => __('Adds a select input to be able to set the furnishing status of a property ie: Unfurnished, Furnished', 'geodirectory'), |
|
| 96 | - 'defaults' => array( |
|
| 97 | - 'data_type' => 'VARCHAR', |
|
| 98 | - 'admin_title' => 'Furnishing', |
|
| 99 | - 'site_title' => 'Furnishing', |
|
| 100 | - 'admin_desc' => 'Enter the furnishing status of the property.', |
|
| 101 | - 'htmlvar_name' => 'property_furnishing', |
|
| 102 | - 'is_active' => true, |
|
| 103 | - 'for_admin_use' => false, |
|
| 104 | - 'default_value' => '', |
|
| 105 | - 'show_in' => '[detail],[listing]', |
|
| 106 | - 'is_required' => true, |
|
| 107 | - 'option_values' => __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'), |
|
| 108 | - 'validation_pattern' => '', |
|
| 109 | - 'validation_msg' => '', |
|
| 110 | - 'required_msg' => '', |
|
| 111 | - 'field_icon' => 'fa fa-th-large', |
|
| 112 | - 'css_class' => '', |
|
| 113 | - 'cat_sort' => true, |
|
| 114 | - 'cat_filter' => true |
|
| 115 | - ) |
|
| 116 | - ); |
|
| 117 | - |
|
| 118 | - // property type |
|
| 119 | - $custom_fields['property_type'] = array( // The key value should be unique and not contain any spaces. |
|
| 120 | - 'field_type' => 'select', |
|
| 121 | - 'class' => 'gd-property-type', |
|
| 122 | - 'icon' => 'fa fa-home', |
|
| 123 | - 'name' => __('Property Type', 'geodirectory'), |
|
| 124 | - 'description' => __('Adds a select input for the property type ie: Detached house, Apartment', 'geodirectory'), |
|
| 125 | - 'defaults' => array( |
|
| 126 | - 'data_type' => 'VARCHAR', |
|
| 127 | - 'admin_title' => 'Property Type', |
|
| 128 | - 'site_title' => 'Property Type', |
|
| 129 | - 'admin_desc' => 'Select the property type.', |
|
| 130 | - 'htmlvar_name' => 'property_type', |
|
| 131 | - 'is_active' => true, |
|
| 132 | - 'for_admin_use' => false, |
|
| 133 | - 'default_value' => '', |
|
| 134 | - 'show_in' => '[detail],[listing]', |
|
| 135 | - 'is_required' => true, |
|
| 136 | - 'option_values' => __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage','geodirectory'), |
|
| 137 | - 'validation_pattern' => '', |
|
| 138 | - 'validation_msg' => '', |
|
| 139 | - 'required_msg' => '', |
|
| 140 | - 'field_icon' => 'fa fa-home', |
|
| 141 | - 'css_class' => '', |
|
| 142 | - 'cat_sort' => true, |
|
| 143 | - 'cat_filter' => true |
|
| 144 | - ) |
|
| 145 | - ); |
|
| 146 | - |
|
| 147 | - // property bedrooms |
|
| 148 | - $custom_fields['property_bedrooms'] = array( // The key value should be unique and not contain any spaces. |
|
| 149 | - 'field_type' => 'select', |
|
| 150 | - 'class' => 'gd-property-bedrooms', |
|
| 151 | - 'icon' => 'fa fa-home', |
|
| 152 | - 'name' => __('Property Bedrooms', 'geodirectory'), |
|
| 153 | - 'description' => __('Adds a select input for the number of bedrooms.', 'geodirectory'), |
|
| 154 | - 'defaults' => array( |
|
| 155 | - 'data_type' => 'VARCHAR', |
|
| 156 | - 'admin_title' => 'Property Bedrooms', |
|
| 157 | - 'site_title' => 'Bedrooms', |
|
| 158 | - 'admin_desc' => 'Select the number of bedrooms', |
|
| 159 | - 'htmlvar_name' => 'property_bedrooms', |
|
| 160 | - 'is_active' => true, |
|
| 161 | - 'for_admin_use' => false, |
|
| 162 | - 'default_value' => '', |
|
| 163 | - 'show_in' => '[detail],[listing]', |
|
| 164 | - 'is_required' => true, |
|
| 165 | - 'option_values' => __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'), |
|
| 166 | - 'validation_pattern' => '', |
|
| 167 | - 'validation_msg' => '', |
|
| 168 | - 'required_msg' => '', |
|
| 169 | - 'field_icon' => 'fa fa-bed', |
|
| 170 | - 'css_class' => '', |
|
| 171 | - 'cat_sort' => true, |
|
| 172 | - 'cat_filter' => true |
|
| 173 | - ) |
|
| 174 | - ); |
|
| 175 | - |
|
| 176 | - // property bathrooms |
|
| 177 | - $custom_fields['property_bathrooms'] = array( // The key value should be unique and not contain any spaces. |
|
| 178 | - 'field_type' => 'select', |
|
| 179 | - 'class' => 'gd-property-bathrooms', |
|
| 180 | - 'icon' => 'fa fa-home', |
|
| 181 | - 'name' => __('Property Bathrooms', 'geodirectory'), |
|
| 182 | - 'description' => __('Adds a select input for the number of bathrooms.', 'geodirectory'), |
|
| 183 | - 'defaults' => array( |
|
| 184 | - 'data_type' => 'VARCHAR', |
|
| 185 | - 'admin_title' => 'Property Bathrooms', |
|
| 186 | - 'site_title' => 'Bathrooms', |
|
| 187 | - 'admin_desc' => 'Select the number of bathrooms', |
|
| 188 | - 'htmlvar_name' => 'property_bathrooms', |
|
| 189 | - 'is_active' => true, |
|
| 190 | - 'for_admin_use' => false, |
|
| 191 | - 'default_value' => '', |
|
| 192 | - 'show_in' => '[detail],[listing]', |
|
| 193 | - 'is_required' => true, |
|
| 194 | - 'option_values' => __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'), |
|
| 195 | - 'validation_pattern' => '', |
|
| 196 | - 'validation_msg' => '', |
|
| 197 | - 'required_msg' => '', |
|
| 198 | - 'field_icon' => 'fa fa-bold', |
|
| 199 | - 'css_class' => '', |
|
| 200 | - 'cat_sort' => true, |
|
| 201 | - 'cat_filter' => true |
|
| 202 | - ) |
|
| 203 | - ); |
|
| 204 | - |
|
| 205 | - // property area |
|
| 206 | - $custom_fields['property_area'] = array( // The key value should be unique and not contain any spaces. |
|
| 207 | - 'field_type' => 'text', |
|
| 208 | - 'class' => 'gd-area', |
|
| 209 | - 'icon' => 'fa fa-home', |
|
| 210 | - 'name' => __('Property Area', 'geodirectory'), |
|
| 211 | - 'description' => __('Adds a input for the property area.', 'geodirectory'), |
|
| 212 | - 'defaults' => array( |
|
| 213 | - 'data_type' => 'FLOAT', |
|
| 214 | - 'admin_title' => 'Property Area', |
|
| 215 | - 'site_title' => 'Area (Sq Ft)', |
|
| 216 | - 'admin_desc' => 'Enter the Sq Ft value for the property', |
|
| 217 | - 'htmlvar_name' => 'property_area', |
|
| 218 | - 'is_active' => true, |
|
| 219 | - 'for_admin_use' => false, |
|
| 220 | - 'default_value' => '', |
|
| 221 | - 'show_in' => '[detail],[listing]', |
|
| 222 | - 'is_required' => false, |
|
| 223 | - 'validation_pattern' => '\d+(\.\d{2})?', |
|
| 224 | - 'validation_msg' => 'Please enter the property area in numbers only: 1500', |
|
| 225 | - 'required_msg' => '', |
|
| 226 | - 'field_icon' => 'fa fa-area-chart', |
|
| 227 | - 'css_class' => '', |
|
| 228 | - 'cat_sort' => true, |
|
| 229 | - 'cat_filter' => true |
|
| 230 | - ) |
|
| 231 | - ); |
|
| 232 | - |
|
| 233 | - // property features |
|
| 234 | - $custom_fields['property_features'] = array( // The key value should be unique and not contain any spaces. |
|
| 235 | - 'field_type' => 'multiselect', |
|
| 236 | - 'class' => 'gd-property-features', |
|
| 237 | - 'icon' => 'fa fa-home', |
|
| 238 | - 'name' => __('Property Features', 'geodirectory'), |
|
| 239 | - 'description' => __('Adds a select input for the property features.', 'geodirectory'), |
|
| 240 | - 'defaults' => array( |
|
| 241 | - 'data_type' => 'VARCHAR', |
|
| 242 | - 'admin_title' => 'Property Features', |
|
| 243 | - 'site_title' => 'Features', |
|
| 244 | - 'admin_desc' => 'Select the property features.', |
|
| 245 | - 'htmlvar_name' => 'property_features', |
|
| 246 | - 'is_active' => true, |
|
| 247 | - 'for_admin_use' => false, |
|
| 248 | - 'default_value' => '', |
|
| 249 | - 'show_in' => '[detail],[listing]', |
|
| 250 | - 'is_required' => true, |
|
| 251 | - 'option_values' => __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'), |
|
| 252 | - 'validation_pattern' => '', |
|
| 253 | - 'validation_msg' => '', |
|
| 254 | - 'required_msg' => '', |
|
| 255 | - 'field_icon' => 'fa fa-plus-square', |
|
| 256 | - 'css_class' => '', |
|
| 257 | - 'cat_sort' => true, |
|
| 258 | - 'cat_filter' => true |
|
| 259 | - ) |
|
| 260 | - ); |
|
| 261 | - |
|
| 262 | - // Twitter feed |
|
| 263 | - $custom_fields['twitter_feed'] = array( // The key value should be unique and not contain any spaces. |
|
| 264 | - 'field_type' => 'text', |
|
| 265 | - 'class' => 'gd-twitter', |
|
| 266 | - 'icon' => 'fa fa-twitter', |
|
| 267 | - 'name' => __('Twitter feed', 'geodirectory'), |
|
| 268 | - 'description' => __('Adds a input for twitter username and outputs feed.', 'geodirectory'), |
|
| 269 | - 'defaults' => array( |
|
| 270 | - 'data_type' => 'VARCHAR', |
|
| 271 | - 'admin_title' => 'Twitter', |
|
| 272 | - 'site_title' => 'Twitter', |
|
| 273 | - 'admin_desc' => 'Enter your Twitter username', |
|
| 274 | - 'htmlvar_name' => 'twitterusername', |
|
| 275 | - 'is_active' => true, |
|
| 276 | - 'for_admin_use' => false, |
|
| 277 | - 'default_value' => '', |
|
| 278 | - 'show_in' => '[detail],[owntab]', |
|
| 279 | - 'is_required' => false, |
|
| 280 | - 'validation_pattern' => '^[A-Za-z0-9_]{1,32}$', |
|
| 281 | - 'validation_msg' => 'Please enter a valid twitter username.', |
|
| 282 | - 'required_msg' => '', |
|
| 283 | - 'field_icon' => 'fa fa-twitter', |
|
| 284 | - 'css_class' => '', |
|
| 285 | - 'cat_sort' => false, |
|
| 286 | - 'cat_filter' => false |
|
| 287 | - ) |
|
| 288 | - ); |
|
| 289 | - |
|
| 290 | - // Get directions link |
|
| 291 | - $custom_fields['get_directions'] = array( // The key value should be unique and not contain any spaces. |
|
| 292 | - 'field_type' => 'text', |
|
| 293 | - 'class' => 'gd-get-directions', |
|
| 294 | - 'icon' => 'fa fa-location-arrow', |
|
| 295 | - 'name' => __('Get Directions Link', 'geodirectory'), |
|
| 296 | - 'description' => __('Adds a input for twitter username and outputs feed.', 'geodirectory'), |
|
| 297 | - 'defaults' => array( |
|
| 298 | - 'data_type' => 'VARCHAR', |
|
| 299 | - 'admin_title' => 'Get Directions', |
|
| 300 | - 'site_title' => 'Get Directions', |
|
| 301 | - 'admin_desc' => '', |
|
| 302 | - 'htmlvar_name' => 'get_directions', |
|
| 303 | - 'is_active' => true, |
|
| 304 | - 'for_admin_use' => true, |
|
| 305 | - 'default_value' => 'Get Directions', |
|
| 306 | - 'show_in' => '[detail],[listing]', |
|
| 307 | - 'is_required' => false, |
|
| 308 | - 'validation_pattern' => '', |
|
| 309 | - 'validation_msg' => '', |
|
| 310 | - 'required_msg' => '', |
|
| 311 | - 'field_icon' => 'fa fa-location-arrow', |
|
| 312 | - 'css_class' => '', |
|
| 313 | - 'cat_sort' => false, |
|
| 314 | - 'cat_filter' => false |
|
| 315 | - ) |
|
| 316 | - ); |
|
| 317 | - |
|
| 318 | - |
|
| 319 | - // JOB TYPE CF |
|
| 320 | - |
|
| 321 | - // job type |
|
| 322 | - $custom_fields['job_type'] = array( // The key value should be unique and not contain any spaces. |
|
| 323 | - 'field_type' => 'select', |
|
| 324 | - 'class' => 'gd-job-type', |
|
| 325 | - 'icon' => 'fa fa-briefcase', |
|
| 326 | - 'name' => __('Job Type', 'geodirectory'), |
|
| 327 | - 'description' => __('Adds a select input to be able to set the type of a job ie: Full Time, Part Time', 'geodirectory'), |
|
| 328 | - 'defaults' => array( |
|
| 329 | - 'data_type' => 'VARCHAR', |
|
| 330 | - 'admin_title' => 'Job Type', |
|
| 331 | - 'site_title' => 'Job Type', |
|
| 332 | - 'admin_desc' => 'Select the type of job.', |
|
| 333 | - 'htmlvar_name' => 'job_type', |
|
| 334 | - 'is_active' => true, |
|
| 335 | - 'for_admin_use' => false, |
|
| 336 | - 'default_value' => '', |
|
| 337 | - 'show_in' => '[detail],[listing]', |
|
| 338 | - 'is_required' => true, |
|
| 339 | - 'option_values' => __('Select Type/,Freelance,Full Time,Internship,Part Time,Temporary,Other','geodirectory'), |
|
| 340 | - 'validation_pattern' => '', |
|
| 341 | - 'validation_msg' => '', |
|
| 342 | - 'required_msg' => '', |
|
| 343 | - 'field_icon' => 'fa fa-briefcase', |
|
| 344 | - 'css_class' => '', |
|
| 345 | - 'cat_sort' => true, |
|
| 346 | - 'cat_filter' => true |
|
| 347 | - ) |
|
| 348 | - ); |
|
| 349 | - |
|
| 350 | - // job sector |
|
| 351 | - $custom_fields['job_sector'] = array( // The key value should be unique and not contain any spaces. |
|
| 352 | - 'field_type' => 'select', |
|
| 353 | - 'class' => 'gd-job-type', |
|
| 354 | - 'icon' => 'fa fa-briefcase', |
|
| 355 | - 'name' => __('Job Sector', 'geodirectory'), |
|
| 356 | - 'description' => __('Adds a select input to be able to set the type of a job Sector ie: Private Sector,Public Sector', 'geodirectory'), |
|
| 357 | - 'defaults' => array( |
|
| 358 | - 'data_type' => 'VARCHAR', |
|
| 359 | - 'admin_title' => 'Job Sector', |
|
| 360 | - 'site_title' => 'Job Sector', |
|
| 361 | - 'admin_desc' => 'Select the job sector.', |
|
| 362 | - 'htmlvar_name' => 'job_sector', |
|
| 363 | - 'is_active' => true, |
|
| 364 | - 'for_admin_use' => false, |
|
| 365 | - 'default_value' => '', |
|
| 366 | - 'show_in' => '[detail]', |
|
| 367 | - 'is_required' => true, |
|
| 368 | - 'option_values' => __('Select Sector/,Private Sector,Public Sector,Agencies','geodirectory'), |
|
| 369 | - 'validation_pattern' => '', |
|
| 370 | - 'validation_msg' => '', |
|
| 371 | - 'required_msg' => '', |
|
| 372 | - 'field_icon' => 'fa fa-briefcase', |
|
| 373 | - 'css_class' => '', |
|
| 374 | - 'cat_sort' => true, |
|
| 375 | - 'cat_filter' => true |
|
| 376 | - ) |
|
| 377 | - ); |
|
| 378 | - |
|
| 379 | - |
|
| 380 | - /** |
|
| 381 | - * @see `geodir_custom_fields` |
|
| 382 | - */ |
|
| 383 | - return apply_filters('geodir_custom_fields_predefined',$custom_fields,$post_type); |
|
| 20 | + $custom_fields = array(); |
|
| 21 | + |
|
| 22 | + |
|
| 23 | + // price |
|
| 24 | + $custom_fields['price'] = array( // The key value should be unique and not contain any spaces. |
|
| 25 | + 'field_type' => 'text', |
|
| 26 | + 'class' => 'gd-price', |
|
| 27 | + 'icon' => 'fa fa-usd', |
|
| 28 | + 'name' => __('Price', 'geodirectory'), |
|
| 29 | + 'description' => __('Adds a input for a price field. This will let you filter and sort by price.', 'geodirectory'), |
|
| 30 | + 'defaults' => array( |
|
| 31 | + 'data_type' => 'FLOAT', |
|
| 32 | + 'decimal_point' => '2', |
|
| 33 | + 'admin_title' => 'Price', |
|
| 34 | + 'site_title' => 'Price', |
|
| 35 | + 'admin_desc' => 'Enter the price in $ (no currency symbol)', |
|
| 36 | + 'htmlvar_name' => 'price', |
|
| 37 | + 'is_active' => true, |
|
| 38 | + 'for_admin_use' => false, |
|
| 39 | + 'default_value' => '', |
|
| 40 | + 'show_in' => '[detail],[listing]', |
|
| 41 | + 'is_required' => false, |
|
| 42 | + 'validation_pattern' => '\d+(\.\d{2})?', |
|
| 43 | + 'validation_msg' => 'Please enter number and decimal only ie: 100.50', |
|
| 44 | + 'required_msg' => '', |
|
| 45 | + 'field_icon' => 'fa fa-usd', |
|
| 46 | + 'css_class' => '', |
|
| 47 | + 'cat_sort' => true, |
|
| 48 | + 'cat_filter' => true, |
|
| 49 | + 'extra_fields' => array( |
|
| 50 | + 'is_price' => 1, |
|
| 51 | + 'thousand_separator' => 'comma', |
|
| 52 | + 'decimal_separator' => 'period', |
|
| 53 | + 'decimal_display' => 'if', |
|
| 54 | + 'currency_symbol' => '$', |
|
| 55 | + 'currency_symbol_placement' => 'left' |
|
| 56 | + ) |
|
| 57 | + ) |
|
| 58 | + ); |
|
| 59 | + |
|
| 60 | + // property status |
|
| 61 | + $custom_fields['property_status'] = array( // The key value should be unique and not contain any spaces. |
|
| 62 | + 'field_type' => 'select', |
|
| 63 | + 'class' => 'gd-property-status', |
|
| 64 | + 'icon' => 'fa fa-home', |
|
| 65 | + 'name' => __('Property Status', 'geodirectory'), |
|
| 66 | + 'description' => __('Adds a select input to be able to set the status of a property ie: For Sale, For Rent', 'geodirectory'), |
|
| 67 | + 'defaults' => array( |
|
| 68 | + 'data_type' => 'VARCHAR', |
|
| 69 | + 'admin_title' => 'Property Status', |
|
| 70 | + 'site_title' => 'Property Status', |
|
| 71 | + 'admin_desc' => 'Enter the status of the property.', |
|
| 72 | + 'htmlvar_name' => 'property_status', |
|
| 73 | + 'is_active' => true, |
|
| 74 | + 'for_admin_use' => false, |
|
| 75 | + 'default_value' => '', |
|
| 76 | + 'show_in' => '[detail],[listing]', |
|
| 77 | + 'is_required' => true, |
|
| 78 | + 'option_values' => __('Select Status/,For Sale,For Rent,Sold,Let','geodirectory'), |
|
| 79 | + 'validation_pattern' => '', |
|
| 80 | + 'validation_msg' => '', |
|
| 81 | + 'required_msg' => '', |
|
| 82 | + 'field_icon' => 'fa fa-home', |
|
| 83 | + 'css_class' => '', |
|
| 84 | + 'cat_sort' => true, |
|
| 85 | + 'cat_filter' => true |
|
| 86 | + ) |
|
| 87 | + ); |
|
| 88 | + |
|
| 89 | + // property furnishing |
|
| 90 | + $custom_fields['property_furnishing'] = array( // The key value should be unique and not contain any spaces. |
|
| 91 | + 'field_type' => 'select', |
|
| 92 | + 'class' => 'gd-property-furnishing', |
|
| 93 | + 'icon' => 'fa fa-home', |
|
| 94 | + 'name' => __('Property Furnishing', 'geodirectory'), |
|
| 95 | + 'description' => __('Adds a select input to be able to set the furnishing status of a property ie: Unfurnished, Furnished', 'geodirectory'), |
|
| 96 | + 'defaults' => array( |
|
| 97 | + 'data_type' => 'VARCHAR', |
|
| 98 | + 'admin_title' => 'Furnishing', |
|
| 99 | + 'site_title' => 'Furnishing', |
|
| 100 | + 'admin_desc' => 'Enter the furnishing status of the property.', |
|
| 101 | + 'htmlvar_name' => 'property_furnishing', |
|
| 102 | + 'is_active' => true, |
|
| 103 | + 'for_admin_use' => false, |
|
| 104 | + 'default_value' => '', |
|
| 105 | + 'show_in' => '[detail],[listing]', |
|
| 106 | + 'is_required' => true, |
|
| 107 | + 'option_values' => __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'), |
|
| 108 | + 'validation_pattern' => '', |
|
| 109 | + 'validation_msg' => '', |
|
| 110 | + 'required_msg' => '', |
|
| 111 | + 'field_icon' => 'fa fa-th-large', |
|
| 112 | + 'css_class' => '', |
|
| 113 | + 'cat_sort' => true, |
|
| 114 | + 'cat_filter' => true |
|
| 115 | + ) |
|
| 116 | + ); |
|
| 117 | + |
|
| 118 | + // property type |
|
| 119 | + $custom_fields['property_type'] = array( // The key value should be unique and not contain any spaces. |
|
| 120 | + 'field_type' => 'select', |
|
| 121 | + 'class' => 'gd-property-type', |
|
| 122 | + 'icon' => 'fa fa-home', |
|
| 123 | + 'name' => __('Property Type', 'geodirectory'), |
|
| 124 | + 'description' => __('Adds a select input for the property type ie: Detached house, Apartment', 'geodirectory'), |
|
| 125 | + 'defaults' => array( |
|
| 126 | + 'data_type' => 'VARCHAR', |
|
| 127 | + 'admin_title' => 'Property Type', |
|
| 128 | + 'site_title' => 'Property Type', |
|
| 129 | + 'admin_desc' => 'Select the property type.', |
|
| 130 | + 'htmlvar_name' => 'property_type', |
|
| 131 | + 'is_active' => true, |
|
| 132 | + 'for_admin_use' => false, |
|
| 133 | + 'default_value' => '', |
|
| 134 | + 'show_in' => '[detail],[listing]', |
|
| 135 | + 'is_required' => true, |
|
| 136 | + 'option_values' => __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage','geodirectory'), |
|
| 137 | + 'validation_pattern' => '', |
|
| 138 | + 'validation_msg' => '', |
|
| 139 | + 'required_msg' => '', |
|
| 140 | + 'field_icon' => 'fa fa-home', |
|
| 141 | + 'css_class' => '', |
|
| 142 | + 'cat_sort' => true, |
|
| 143 | + 'cat_filter' => true |
|
| 144 | + ) |
|
| 145 | + ); |
|
| 146 | + |
|
| 147 | + // property bedrooms |
|
| 148 | + $custom_fields['property_bedrooms'] = array( // The key value should be unique and not contain any spaces. |
|
| 149 | + 'field_type' => 'select', |
|
| 150 | + 'class' => 'gd-property-bedrooms', |
|
| 151 | + 'icon' => 'fa fa-home', |
|
| 152 | + 'name' => __('Property Bedrooms', 'geodirectory'), |
|
| 153 | + 'description' => __('Adds a select input for the number of bedrooms.', 'geodirectory'), |
|
| 154 | + 'defaults' => array( |
|
| 155 | + 'data_type' => 'VARCHAR', |
|
| 156 | + 'admin_title' => 'Property Bedrooms', |
|
| 157 | + 'site_title' => 'Bedrooms', |
|
| 158 | + 'admin_desc' => 'Select the number of bedrooms', |
|
| 159 | + 'htmlvar_name' => 'property_bedrooms', |
|
| 160 | + 'is_active' => true, |
|
| 161 | + 'for_admin_use' => false, |
|
| 162 | + 'default_value' => '', |
|
| 163 | + 'show_in' => '[detail],[listing]', |
|
| 164 | + 'is_required' => true, |
|
| 165 | + 'option_values' => __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'), |
|
| 166 | + 'validation_pattern' => '', |
|
| 167 | + 'validation_msg' => '', |
|
| 168 | + 'required_msg' => '', |
|
| 169 | + 'field_icon' => 'fa fa-bed', |
|
| 170 | + 'css_class' => '', |
|
| 171 | + 'cat_sort' => true, |
|
| 172 | + 'cat_filter' => true |
|
| 173 | + ) |
|
| 174 | + ); |
|
| 175 | + |
|
| 176 | + // property bathrooms |
|
| 177 | + $custom_fields['property_bathrooms'] = array( // The key value should be unique and not contain any spaces. |
|
| 178 | + 'field_type' => 'select', |
|
| 179 | + 'class' => 'gd-property-bathrooms', |
|
| 180 | + 'icon' => 'fa fa-home', |
|
| 181 | + 'name' => __('Property Bathrooms', 'geodirectory'), |
|
| 182 | + 'description' => __('Adds a select input for the number of bathrooms.', 'geodirectory'), |
|
| 183 | + 'defaults' => array( |
|
| 184 | + 'data_type' => 'VARCHAR', |
|
| 185 | + 'admin_title' => 'Property Bathrooms', |
|
| 186 | + 'site_title' => 'Bathrooms', |
|
| 187 | + 'admin_desc' => 'Select the number of bathrooms', |
|
| 188 | + 'htmlvar_name' => 'property_bathrooms', |
|
| 189 | + 'is_active' => true, |
|
| 190 | + 'for_admin_use' => false, |
|
| 191 | + 'default_value' => '', |
|
| 192 | + 'show_in' => '[detail],[listing]', |
|
| 193 | + 'is_required' => true, |
|
| 194 | + 'option_values' => __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'), |
|
| 195 | + 'validation_pattern' => '', |
|
| 196 | + 'validation_msg' => '', |
|
| 197 | + 'required_msg' => '', |
|
| 198 | + 'field_icon' => 'fa fa-bold', |
|
| 199 | + 'css_class' => '', |
|
| 200 | + 'cat_sort' => true, |
|
| 201 | + 'cat_filter' => true |
|
| 202 | + ) |
|
| 203 | + ); |
|
| 204 | + |
|
| 205 | + // property area |
|
| 206 | + $custom_fields['property_area'] = array( // The key value should be unique and not contain any spaces. |
|
| 207 | + 'field_type' => 'text', |
|
| 208 | + 'class' => 'gd-area', |
|
| 209 | + 'icon' => 'fa fa-home', |
|
| 210 | + 'name' => __('Property Area', 'geodirectory'), |
|
| 211 | + 'description' => __('Adds a input for the property area.', 'geodirectory'), |
|
| 212 | + 'defaults' => array( |
|
| 213 | + 'data_type' => 'FLOAT', |
|
| 214 | + 'admin_title' => 'Property Area', |
|
| 215 | + 'site_title' => 'Area (Sq Ft)', |
|
| 216 | + 'admin_desc' => 'Enter the Sq Ft value for the property', |
|
| 217 | + 'htmlvar_name' => 'property_area', |
|
| 218 | + 'is_active' => true, |
|
| 219 | + 'for_admin_use' => false, |
|
| 220 | + 'default_value' => '', |
|
| 221 | + 'show_in' => '[detail],[listing]', |
|
| 222 | + 'is_required' => false, |
|
| 223 | + 'validation_pattern' => '\d+(\.\d{2})?', |
|
| 224 | + 'validation_msg' => 'Please enter the property area in numbers only: 1500', |
|
| 225 | + 'required_msg' => '', |
|
| 226 | + 'field_icon' => 'fa fa-area-chart', |
|
| 227 | + 'css_class' => '', |
|
| 228 | + 'cat_sort' => true, |
|
| 229 | + 'cat_filter' => true |
|
| 230 | + ) |
|
| 231 | + ); |
|
| 232 | + |
|
| 233 | + // property features |
|
| 234 | + $custom_fields['property_features'] = array( // The key value should be unique and not contain any spaces. |
|
| 235 | + 'field_type' => 'multiselect', |
|
| 236 | + 'class' => 'gd-property-features', |
|
| 237 | + 'icon' => 'fa fa-home', |
|
| 238 | + 'name' => __('Property Features', 'geodirectory'), |
|
| 239 | + 'description' => __('Adds a select input for the property features.', 'geodirectory'), |
|
| 240 | + 'defaults' => array( |
|
| 241 | + 'data_type' => 'VARCHAR', |
|
| 242 | + 'admin_title' => 'Property Features', |
|
| 243 | + 'site_title' => 'Features', |
|
| 244 | + 'admin_desc' => 'Select the property features.', |
|
| 245 | + 'htmlvar_name' => 'property_features', |
|
| 246 | + 'is_active' => true, |
|
| 247 | + 'for_admin_use' => false, |
|
| 248 | + 'default_value' => '', |
|
| 249 | + 'show_in' => '[detail],[listing]', |
|
| 250 | + 'is_required' => true, |
|
| 251 | + 'option_values' => __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'), |
|
| 252 | + 'validation_pattern' => '', |
|
| 253 | + 'validation_msg' => '', |
|
| 254 | + 'required_msg' => '', |
|
| 255 | + 'field_icon' => 'fa fa-plus-square', |
|
| 256 | + 'css_class' => '', |
|
| 257 | + 'cat_sort' => true, |
|
| 258 | + 'cat_filter' => true |
|
| 259 | + ) |
|
| 260 | + ); |
|
| 261 | + |
|
| 262 | + // Twitter feed |
|
| 263 | + $custom_fields['twitter_feed'] = array( // The key value should be unique and not contain any spaces. |
|
| 264 | + 'field_type' => 'text', |
|
| 265 | + 'class' => 'gd-twitter', |
|
| 266 | + 'icon' => 'fa fa-twitter', |
|
| 267 | + 'name' => __('Twitter feed', 'geodirectory'), |
|
| 268 | + 'description' => __('Adds a input for twitter username and outputs feed.', 'geodirectory'), |
|
| 269 | + 'defaults' => array( |
|
| 270 | + 'data_type' => 'VARCHAR', |
|
| 271 | + 'admin_title' => 'Twitter', |
|
| 272 | + 'site_title' => 'Twitter', |
|
| 273 | + 'admin_desc' => 'Enter your Twitter username', |
|
| 274 | + 'htmlvar_name' => 'twitterusername', |
|
| 275 | + 'is_active' => true, |
|
| 276 | + 'for_admin_use' => false, |
|
| 277 | + 'default_value' => '', |
|
| 278 | + 'show_in' => '[detail],[owntab]', |
|
| 279 | + 'is_required' => false, |
|
| 280 | + 'validation_pattern' => '^[A-Za-z0-9_]{1,32}$', |
|
| 281 | + 'validation_msg' => 'Please enter a valid twitter username.', |
|
| 282 | + 'required_msg' => '', |
|
| 283 | + 'field_icon' => 'fa fa-twitter', |
|
| 284 | + 'css_class' => '', |
|
| 285 | + 'cat_sort' => false, |
|
| 286 | + 'cat_filter' => false |
|
| 287 | + ) |
|
| 288 | + ); |
|
| 289 | + |
|
| 290 | + // Get directions link |
|
| 291 | + $custom_fields['get_directions'] = array( // The key value should be unique and not contain any spaces. |
|
| 292 | + 'field_type' => 'text', |
|
| 293 | + 'class' => 'gd-get-directions', |
|
| 294 | + 'icon' => 'fa fa-location-arrow', |
|
| 295 | + 'name' => __('Get Directions Link', 'geodirectory'), |
|
| 296 | + 'description' => __('Adds a input for twitter username and outputs feed.', 'geodirectory'), |
|
| 297 | + 'defaults' => array( |
|
| 298 | + 'data_type' => 'VARCHAR', |
|
| 299 | + 'admin_title' => 'Get Directions', |
|
| 300 | + 'site_title' => 'Get Directions', |
|
| 301 | + 'admin_desc' => '', |
|
| 302 | + 'htmlvar_name' => 'get_directions', |
|
| 303 | + 'is_active' => true, |
|
| 304 | + 'for_admin_use' => true, |
|
| 305 | + 'default_value' => 'Get Directions', |
|
| 306 | + 'show_in' => '[detail],[listing]', |
|
| 307 | + 'is_required' => false, |
|
| 308 | + 'validation_pattern' => '', |
|
| 309 | + 'validation_msg' => '', |
|
| 310 | + 'required_msg' => '', |
|
| 311 | + 'field_icon' => 'fa fa-location-arrow', |
|
| 312 | + 'css_class' => '', |
|
| 313 | + 'cat_sort' => false, |
|
| 314 | + 'cat_filter' => false |
|
| 315 | + ) |
|
| 316 | + ); |
|
| 317 | + |
|
| 318 | + |
|
| 319 | + // JOB TYPE CF |
|
| 320 | + |
|
| 321 | + // job type |
|
| 322 | + $custom_fields['job_type'] = array( // The key value should be unique and not contain any spaces. |
|
| 323 | + 'field_type' => 'select', |
|
| 324 | + 'class' => 'gd-job-type', |
|
| 325 | + 'icon' => 'fa fa-briefcase', |
|
| 326 | + 'name' => __('Job Type', 'geodirectory'), |
|
| 327 | + 'description' => __('Adds a select input to be able to set the type of a job ie: Full Time, Part Time', 'geodirectory'), |
|
| 328 | + 'defaults' => array( |
|
| 329 | + 'data_type' => 'VARCHAR', |
|
| 330 | + 'admin_title' => 'Job Type', |
|
| 331 | + 'site_title' => 'Job Type', |
|
| 332 | + 'admin_desc' => 'Select the type of job.', |
|
| 333 | + 'htmlvar_name' => 'job_type', |
|
| 334 | + 'is_active' => true, |
|
| 335 | + 'for_admin_use' => false, |
|
| 336 | + 'default_value' => '', |
|
| 337 | + 'show_in' => '[detail],[listing]', |
|
| 338 | + 'is_required' => true, |
|
| 339 | + 'option_values' => __('Select Type/,Freelance,Full Time,Internship,Part Time,Temporary,Other','geodirectory'), |
|
| 340 | + 'validation_pattern' => '', |
|
| 341 | + 'validation_msg' => '', |
|
| 342 | + 'required_msg' => '', |
|
| 343 | + 'field_icon' => 'fa fa-briefcase', |
|
| 344 | + 'css_class' => '', |
|
| 345 | + 'cat_sort' => true, |
|
| 346 | + 'cat_filter' => true |
|
| 347 | + ) |
|
| 348 | + ); |
|
| 349 | + |
|
| 350 | + // job sector |
|
| 351 | + $custom_fields['job_sector'] = array( // The key value should be unique and not contain any spaces. |
|
| 352 | + 'field_type' => 'select', |
|
| 353 | + 'class' => 'gd-job-type', |
|
| 354 | + 'icon' => 'fa fa-briefcase', |
|
| 355 | + 'name' => __('Job Sector', 'geodirectory'), |
|
| 356 | + 'description' => __('Adds a select input to be able to set the type of a job Sector ie: Private Sector,Public Sector', 'geodirectory'), |
|
| 357 | + 'defaults' => array( |
|
| 358 | + 'data_type' => 'VARCHAR', |
|
| 359 | + 'admin_title' => 'Job Sector', |
|
| 360 | + 'site_title' => 'Job Sector', |
|
| 361 | + 'admin_desc' => 'Select the job sector.', |
|
| 362 | + 'htmlvar_name' => 'job_sector', |
|
| 363 | + 'is_active' => true, |
|
| 364 | + 'for_admin_use' => false, |
|
| 365 | + 'default_value' => '', |
|
| 366 | + 'show_in' => '[detail]', |
|
| 367 | + 'is_required' => true, |
|
| 368 | + 'option_values' => __('Select Sector/,Private Sector,Public Sector,Agencies','geodirectory'), |
|
| 369 | + 'validation_pattern' => '', |
|
| 370 | + 'validation_msg' => '', |
|
| 371 | + 'required_msg' => '', |
|
| 372 | + 'field_icon' => 'fa fa-briefcase', |
|
| 373 | + 'css_class' => '', |
|
| 374 | + 'cat_sort' => true, |
|
| 375 | + 'cat_filter' => true |
|
| 376 | + ) |
|
| 377 | + ); |
|
| 378 | + |
|
| 379 | + |
|
| 380 | + /** |
|
| 381 | + * @see `geodir_custom_fields` |
|
| 382 | + */ |
|
| 383 | + return apply_filters('geodir_custom_fields_predefined',$custom_fields,$post_type); |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | |
@@ -395,32 +395,32 @@ discard block |
||
| 395 | 395 | * @return string The html to output. |
| 396 | 396 | */ |
| 397 | 397 | function geodir_predefined_custom_field_output_twitter_feed($html,$location,$cf){ |
| 398 | - global $post; |
|
| 398 | + global $post; |
|
| 399 | 399 | |
| 400 | 400 | |
| 401 | - if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ): |
|
| 401 | + if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ): |
|
| 402 | 402 | |
| 403 | - $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text"; |
|
| 403 | + $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text"; |
|
| 404 | 404 | |
| 405 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 406 | - if (strpos($field_icon, 'http') !== false) { |
|
| 407 | - $field_icon_af = ''; |
|
| 408 | - } elseif ($field_icon == '') { |
|
| 409 | - $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : ""; |
|
| 410 | - } else { |
|
| 411 | - $field_icon_af = $field_icon; |
|
| 412 | - $field_icon = ''; |
|
| 413 | - } |
|
| 405 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 406 | + if (strpos($field_icon, 'http') !== false) { |
|
| 407 | + $field_icon_af = ''; |
|
| 408 | + } elseif ($field_icon == '') { |
|
| 409 | + $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : ""; |
|
| 410 | + } else { |
|
| 411 | + $field_icon_af = $field_icon; |
|
| 412 | + $field_icon = ''; |
|
| 413 | + } |
|
| 414 | 414 | |
| 415 | 415 | |
| 416 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">'; |
|
| 416 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">'; |
|
| 417 | 417 | |
| 418 | - $html .= '<a class="twitter-timeline" data-height="600" data-dnt="true" href="https://twitter.com/'.$post->{$cf['htmlvar_name']}.'">Tweets by '.$post->{$cf['htmlvar_name']}.'</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>'; |
|
| 419 | - $html .= '</div>'; |
|
| 418 | + $html .= '<a class="twitter-timeline" data-height="600" data-dnt="true" href="https://twitter.com/'.$post->{$cf['htmlvar_name']}.'">Tweets by '.$post->{$cf['htmlvar_name']}.'</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>'; |
|
| 419 | + $html .= '</div>'; |
|
| 420 | 420 | |
| 421 | - endif; |
|
| 421 | + endif; |
|
| 422 | 422 | |
| 423 | - return $html; |
|
| 423 | + return $html; |
|
| 424 | 424 | } |
| 425 | 425 | add_filter('geodir_custom_field_output_text_key_twitter_feed','geodir_predefined_custom_field_output_twitter_feed',10,3); |
| 426 | 426 | |
@@ -435,36 +435,36 @@ discard block |
||
| 435 | 435 | * @return string The html to output. |
| 436 | 436 | */ |
| 437 | 437 | function geodir_predefined_custom_field_output_get_directions($html,$location,$cf) { |
| 438 | - global $post; |
|
| 438 | + global $post; |
|
| 439 | 439 | |
| 440 | 440 | |
| 441 | - if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){ |
|
| 441 | + if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){ |
|
| 442 | 442 | |
| 443 | - $field_icon = geodir_field_icon_proccess( $cf ); |
|
| 444 | - if ( strpos( $field_icon, 'http' ) !== false ) { |
|
| 445 | - $field_icon_af = ''; |
|
| 446 | - } elseif ( $field_icon == '' ) { |
|
| 447 | - $field_icon_af = '<i class="fa fa-location-arrow"></i>'; |
|
| 448 | - } else { |
|
| 449 | - $field_icon_af = $field_icon; |
|
| 450 | - $field_icon = ''; |
|
| 451 | - } |
|
| 443 | + $field_icon = geodir_field_icon_proccess( $cf ); |
|
| 444 | + if ( strpos( $field_icon, 'http' ) !== false ) { |
|
| 445 | + $field_icon_af = ''; |
|
| 446 | + } elseif ( $field_icon == '' ) { |
|
| 447 | + $field_icon_af = '<i class="fa fa-location-arrow"></i>'; |
|
| 448 | + } else { |
|
| 449 | + $field_icon_af = $field_icon; |
|
| 450 | + $field_icon = ''; |
|
| 451 | + } |
|
| 452 | 452 | |
| 453 | - $link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' ); |
|
| 453 | + $link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' ); |
|
| 454 | 454 | |
| 455 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">'; |
|
| 455 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">'; |
|
| 456 | 456 | |
| 457 | - if(isset( $cf['field_icon'] ) && $cf['field_icon']){ |
|
| 458 | - $html .= $field_icon_af; |
|
| 459 | - } |
|
| 457 | + if(isset( $cf['field_icon'] ) && $cf['field_icon']){ |
|
| 458 | + $html .= $field_icon_af; |
|
| 459 | + } |
|
| 460 | 460 | |
| 461 | - $html .= '<a href="https://www.google.com/maps/dir//\'' . $post->post_latitude . ',' . $post->post_longitude . '\'/" target="_blank" >' . $link_text . '</a>'; |
|
| 462 | - $html .= '</div>'; |
|
| 461 | + $html .= '<a href="https://www.google.com/maps/dir//\'' . $post->post_latitude . ',' . $post->post_longitude . '\'/" target="_blank" >' . $link_text . '</a>'; |
|
| 462 | + $html .= '</div>'; |
|
| 463 | 463 | |
| 464 | - }else{ |
|
| 465 | - $html =''; |
|
| 466 | - } |
|
| 464 | + }else{ |
|
| 465 | + $html =''; |
|
| 466 | + } |
|
| 467 | 467 | |
| 468 | - return $html; |
|
| 468 | + return $html; |
|
| 469 | 469 | } |
| 470 | 470 | add_filter('geodir_custom_field_output_text_key_get_directions','geodir_predefined_custom_field_output_get_directions',10,3); |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * @package GeoDirectory |
| 16 | 16 | * @see `geodir_custom_field_save` for array details. |
| 17 | 17 | */ |
| 18 | -function geodir_custom_fields_predefined($post_type=''){ |
|
| 18 | +function geodir_custom_fields_predefined($post_type = '') { |
|
| 19 | 19 | |
| 20 | 20 | $custom_fields = array(); |
| 21 | 21 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | 'default_value' => '', |
| 76 | 76 | 'show_in' => '[detail],[listing]', |
| 77 | 77 | 'is_required' => true, |
| 78 | - 'option_values' => __('Select Status/,For Sale,For Rent,Sold,Let','geodirectory'), |
|
| 78 | + 'option_values' => __('Select Status/,For Sale,For Rent,Sold,Let', 'geodirectory'), |
|
| 79 | 79 | 'validation_pattern' => '', |
| 80 | 80 | 'validation_msg' => '', |
| 81 | 81 | 'required_msg' => '', |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | 'default_value' => '', |
| 105 | 105 | 'show_in' => '[detail],[listing]', |
| 106 | 106 | 'is_required' => true, |
| 107 | - 'option_values' => __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional','geodirectory'), |
|
| 107 | + 'option_values' => __('Select Status/,Unfurnished,Furnished,Partially furnished,Optional', 'geodirectory'), |
|
| 108 | 108 | 'validation_pattern' => '', |
| 109 | 109 | 'validation_msg' => '', |
| 110 | 110 | 'required_msg' => '', |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | 'default_value' => '', |
| 134 | 134 | 'show_in' => '[detail],[listing]', |
| 135 | 135 | 'is_required' => true, |
| 136 | - 'option_values' => __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage','geodirectory'), |
|
| 136 | + 'option_values' => __('Select Type/,Detached house,Semi-detached house,Apartment,Bungalow,Semi-detached bungalow,Chalet,Town House,End-terrace house,Terrace house,Cottage', 'geodirectory'), |
|
| 137 | 137 | 'validation_pattern' => '', |
| 138 | 138 | 'validation_msg' => '', |
| 139 | 139 | 'required_msg' => '', |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | 'default_value' => '', |
| 163 | 163 | 'show_in' => '[detail],[listing]', |
| 164 | 164 | 'is_required' => true, |
| 165 | - 'option_values' => __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'), |
|
| 165 | + 'option_values' => __('Select Bedrooms/,1,2,3,4,5,6,7,8,9,10', 'geodirectory'), |
|
| 166 | 166 | 'validation_pattern' => '', |
| 167 | 167 | 'validation_msg' => '', |
| 168 | 168 | 'required_msg' => '', |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | 'default_value' => '', |
| 192 | 192 | 'show_in' => '[detail],[listing]', |
| 193 | 193 | 'is_required' => true, |
| 194 | - 'option_values' => __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10','geodirectory'), |
|
| 194 | + 'option_values' => __('Select Bathrooms/,1,2,3,4,5,6,7,8,9,10', 'geodirectory'), |
|
| 195 | 195 | 'validation_pattern' => '', |
| 196 | 196 | 'validation_msg' => '', |
| 197 | 197 | 'required_msg' => '', |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | 'default_value' => '', |
| 249 | 249 | 'show_in' => '[detail],[listing]', |
| 250 | 250 | 'is_required' => true, |
| 251 | - 'option_values' => __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace','geodirectory'), |
|
| 251 | + 'option_values' => __('Select Features/,Gas Central Heating,Oil Central Heating,Double Glazing,Triple Glazing,Front Garden,Garage,Private driveway,Off Road Parking,Fireplace', 'geodirectory'), |
|
| 252 | 252 | 'validation_pattern' => '', |
| 253 | 253 | 'validation_msg' => '', |
| 254 | 254 | 'required_msg' => '', |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | 'default_value' => '', |
| 337 | 337 | 'show_in' => '[detail],[listing]', |
| 338 | 338 | 'is_required' => true, |
| 339 | - 'option_values' => __('Select Type/,Freelance,Full Time,Internship,Part Time,Temporary,Other','geodirectory'), |
|
| 339 | + 'option_values' => __('Select Type/,Freelance,Full Time,Internship,Part Time,Temporary,Other', 'geodirectory'), |
|
| 340 | 340 | 'validation_pattern' => '', |
| 341 | 341 | 'validation_msg' => '', |
| 342 | 342 | 'required_msg' => '', |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | 'default_value' => '', |
| 366 | 366 | 'show_in' => '[detail]', |
| 367 | 367 | 'is_required' => true, |
| 368 | - 'option_values' => __('Select Sector/,Private Sector,Public Sector,Agencies','geodirectory'), |
|
| 368 | + 'option_values' => __('Select Sector/,Private Sector,Public Sector,Agencies', 'geodirectory'), |
|
| 369 | 369 | 'validation_pattern' => '', |
| 370 | 370 | 'validation_msg' => '', |
| 371 | 371 | 'required_msg' => '', |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | /** |
| 381 | 381 | * @see `geodir_custom_fields` |
| 382 | 382 | */ |
| 383 | - return apply_filters('geodir_custom_fields_predefined',$custom_fields,$post_type); |
|
| 383 | + return apply_filters('geodir_custom_fields_predefined', $custom_fields, $post_type); |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | |
@@ -394,11 +394,11 @@ discard block |
||
| 394 | 394 | * @since 1.6.9 |
| 395 | 395 | * @return string The html to output. |
| 396 | 396 | */ |
| 397 | -function geodir_predefined_custom_field_output_twitter_feed($html,$location,$cf){ |
|
| 397 | +function geodir_predefined_custom_field_output_twitter_feed($html, $location, $cf) { |
|
| 398 | 398 | global $post; |
| 399 | 399 | |
| 400 | 400 | |
| 401 | - if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ): |
|
| 401 | + if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''): |
|
| 402 | 402 | |
| 403 | 403 | $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text"; |
| 404 | 404 | |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | |
| 416 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">'; |
|
| 416 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;">'; |
|
| 417 | 417 | |
| 418 | 418 | $html .= '<a class="twitter-timeline" data-height="600" data-dnt="true" href="https://twitter.com/'.$post->{$cf['htmlvar_name']}.'">Tweets by '.$post->{$cf['htmlvar_name']}.'</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>'; |
| 419 | 419 | $html .= '</div>'; |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | |
| 423 | 423 | return $html; |
| 424 | 424 | } |
| 425 | -add_filter('geodir_custom_field_output_text_key_twitter_feed','geodir_predefined_custom_field_output_twitter_feed',10,3); |
|
| 425 | +add_filter('geodir_custom_field_output_text_key_twitter_feed', 'geodir_predefined_custom_field_output_twitter_feed', 10, 3); |
|
| 426 | 426 | |
| 427 | 427 | /** |
| 428 | 428 | * Filter the get_directions custom field output to show a link. |
@@ -434,37 +434,37 @@ discard block |
||
| 434 | 434 | * @since 1.6.9 |
| 435 | 435 | * @return string The html to output. |
| 436 | 436 | */ |
| 437 | -function geodir_predefined_custom_field_output_get_directions($html,$location,$cf) { |
|
| 437 | +function geodir_predefined_custom_field_output_get_directions($html, $location, $cf) { |
|
| 438 | 438 | global $post; |
| 439 | 439 | |
| 440 | 440 | |
| 441 | - if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){ |
|
| 441 | + if (isset($post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset($post->post_latitude) && $post->post_latitude) { |
|
| 442 | 442 | |
| 443 | - $field_icon = geodir_field_icon_proccess( $cf ); |
|
| 444 | - if ( strpos( $field_icon, 'http' ) !== false ) { |
|
| 443 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 444 | + if (strpos($field_icon, 'http') !== false) { |
|
| 445 | 445 | $field_icon_af = ''; |
| 446 | - } elseif ( $field_icon == '' ) { |
|
| 446 | + } elseif ($field_icon == '') { |
|
| 447 | 447 | $field_icon_af = '<i class="fa fa-location-arrow"></i>'; |
| 448 | 448 | } else { |
| 449 | 449 | $field_icon_af = $field_icon; |
| 450 | 450 | $field_icon = ''; |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | - $link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' ); |
|
| 453 | + $link_text = isset($post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __('Get Directions', 'geodirectory'); |
|
| 454 | 454 | |
| 455 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">'; |
|
| 455 | + $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;">'; |
|
| 456 | 456 | |
| 457 | - if(isset( $cf['field_icon'] ) && $cf['field_icon']){ |
|
| 457 | + if (isset($cf['field_icon']) && $cf['field_icon']) { |
|
| 458 | 458 | $html .= $field_icon_af; |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | - $html .= '<a href="https://www.google.com/maps/dir//\'' . $post->post_latitude . ',' . $post->post_longitude . '\'/" target="_blank" >' . $link_text . '</a>'; |
|
| 461 | + $html .= '<a href="https://www.google.com/maps/dir//\''.$post->post_latitude.','.$post->post_longitude.'\'/" target="_blank" >'.$link_text.'</a>'; |
|
| 462 | 462 | $html .= '</div>'; |
| 463 | 463 | |
| 464 | - }else{ |
|
| 465 | - $html =''; |
|
| 464 | + } else { |
|
| 465 | + $html = ''; |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | return $html; |
| 469 | 469 | } |
| 470 | -add_filter('geodir_custom_field_output_text_key_get_directions','geodir_predefined_custom_field_output_get_directions',10,3); |
|
| 470 | +add_filter('geodir_custom_field_output_text_key_get_directions', 'geodir_predefined_custom_field_output_get_directions', 10, 3); |
|
@@ -52,31 +52,31 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 ( mb_strlen( $excerpt ) > $charlength ) {
|
|
| 107 | - if ( mb_strlen( $excerpt_more ) > 0 && mb_strpos( $excerpt, $excerpt_more ) !== false ) {
|
|
| 108 | - $excut = - ( mb_strlen( $excerpt_more ) ); |
|
| 109 | - $subex = mb_substr( $excerpt, 0, $excut ); |
|
| 110 | - if ( $charlength > 0 && mb_strlen( $subex ) > $charlength ) {
|
|
| 111 | - $subex = mb_substr( $subex, 0, $charlength ); |
|
| 104 | + $charlength++; |
|
| 105 | + $excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more('');
|
|
| 106 | + if (mb_strlen($excerpt) > $charlength) {
|
|
| 107 | + if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
|
|
| 108 | + $excut = - (mb_strlen($excerpt_more)); |
|
| 109 | + $subex = mb_substr($excerpt, 0, $excut); |
|
| 110 | + if ($charlength > 0 && mb_strlen($subex) > $charlength) {
|
|
| 111 | + $subex = mb_substr($subex, 0, $charlength); |
|
| 112 | 112 | } |
| 113 | 113 | $out .= $subex; |
| 114 | 114 | } else {
|
| 115 | - $subex = mb_substr( $excerpt, 0, $charlength - 5 ); |
|
| 116 | - $exwords = explode( ' ', $subex ); |
|
| 117 | - $excut = - ( mb_strlen( $exwords[ count( $exwords ) - 1 ] ) ); |
|
| 118 | - if ( $excut < 0 ) {
|
|
| 119 | - $out .= mb_substr( $subex, 0, $excut ); |
|
| 115 | + $subex = mb_substr($excerpt, 0, $charlength - 5); |
|
| 116 | + $exwords = explode(' ', $subex);
|
|
| 117 | + $excut = - (mb_strlen($exwords[count($exwords) - 1])); |
|
| 118 | + if ($excut < 0) {
|
|
| 119 | + $out .= mb_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 ( mb_strlen( $excerpt_more ) > 0 && mb_strpos( $excerpt, $excerpt_more ) !== false ) {
|
|
| 135 | - $excut = - ( mb_strlen( $excerpt_more ) ); |
|
| 136 | - $out .= mb_substr( $excerpt, 0, $excut ); |
|
| 137 | - $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">'; |
|
| 134 | + if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
|
|
| 135 | + $excut = - (mb_strlen($excerpt_more)); |
|
| 136 | + $out .= mb_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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 = $post->post_latitude; |
@@ -757,10 +757,10 @@ discard block |
||
| 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 ( in_array( $post->post_type, $related_listing_array ) ) {
|
|
| 763 | + if (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 |
||
| 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 |
||
| 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,24 +893,24 @@ discard block |
||
| 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 | |
| 900 | 900 | |
| 901 | - query_posts( $query_args ); |
|
| 901 | + query_posts($query_args); |
|
| 902 | 902 | |
| 903 | - if ( strstr( $layout, 'gridview' ) ) {
|
|
| 904 | - $listing_view_exp = explode( '_', $layout ); |
|
| 903 | + if (strstr($layout, 'gridview')) {
|
|
| 904 | + $listing_view_exp = explode('_', $layout);
|
|
| 905 | 905 | $gridview_columns = $layout; |
| 906 | 906 | $layout = $listing_view_exp[0]; |
| 907 | - } else if ( $layout == 'list' ) {
|
|
| 907 | + } else if ($layout == 'list') {
|
|
| 908 | 908 | $gridview_columns = ''; |
| 909 | 909 | } |
| 910 | 910 | $related_posts = true; |
| 911 | 911 | |
| 912 | 912 | $related_nearest = false; |
| 913 | - if ( $list_sort == 'nearest' ) {
|
|
| 913 | + if ($list_sort == 'nearest') {
|
|
| 914 | 914 | $related_nearest = true; |
| 915 | 915 | } |
| 916 | 916 | |
@@ -920,14 +920,14 @@ discard block |
||
| 920 | 920 | * |
| 921 | 921 | * @since 1.0.0 |
| 922 | 922 | */ |
| 923 | - $template = apply_filters( "geodir_template_part-related-listing-listview", geodir_locate_template( 'listing-listview' ) ); |
|
| 923 | + $template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
|
|
| 924 | 924 | |
| 925 | 925 | /** |
| 926 | 926 | * Includes related listing listview template. |
| 927 | 927 | * |
| 928 | 928 | * @since 1.0.0 |
| 929 | 929 | */ |
| 930 | - include( $template ); |
|
| 930 | + include($template); |
|
| 931 | 931 | |
| 932 | 932 | wp_reset_query(); |
| 933 | 933 | $post = $origi_post; |
@@ -955,12 +955,12 @@ discard block |
||
| 955 | 955 | function geodir_category_count_script() {
|
| 956 | 956 | global $geodir_post_category_str; |
| 957 | 957 | |
| 958 | - if ( ! empty( $geodir_post_category_str ) ) {
|
|
| 959 | - $geodir_post_category_str = serialize( $geodir_post_category_str ); |
|
| 958 | + if (!empty($geodir_post_category_str)) {
|
|
| 959 | + $geodir_post_category_str = serialize($geodir_post_category_str); |
|
| 960 | 960 | } |
| 961 | 961 | |
| 962 | - $all_var['post_category_array'] = html_entity_decode( (string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8' ); |
|
| 963 | - $script = "var post_category_array = " . json_encode( $all_var ) . ';'; |
|
| 962 | + $all_var['post_category_array'] = html_entity_decode((string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8'); |
|
| 963 | + $script = "var post_category_array = ".json_encode($all_var).';'; |
|
| 964 | 964 | echo '<script>'; |
| 965 | 965 | echo $script; |
| 966 | 966 | echo '</script>'; |
@@ -975,8 +975,8 @@ discard block |
||
| 975 | 975 | * @return string Returns the default language. |
| 976 | 976 | */ |
| 977 | 977 | function geodir_get_map_default_language() {
|
| 978 | - $geodir_default_map_language = get_option( 'geodir_default_map_language' ); |
|
| 979 | - if ( empty( $geodir_default_map_language ) ) {
|
|
| 978 | + $geodir_default_map_language = get_option('geodir_default_map_language');
|
|
| 979 | + if (empty($geodir_default_map_language)) {
|
|
| 980 | 980 | $geodir_default_map_language = 'en'; |
| 981 | 981 | } |
| 982 | 982 | |
@@ -987,7 +987,7 @@ discard block |
||
| 987 | 987 | * |
| 988 | 988 | * @param string $geodir_default_map_language Default map language. |
| 989 | 989 | */ |
| 990 | - return apply_filters( 'geodir_default_map_language', $geodir_default_map_language ); |
|
| 990 | + return apply_filters('geodir_default_map_language', $geodir_default_map_language);
|
|
| 991 | 991 | } |
| 992 | 992 | |
| 993 | 993 | /** |
@@ -998,7 +998,7 @@ discard block |
||
| 998 | 998 | * @return string Returns the api key. |
| 999 | 999 | */ |
| 1000 | 1000 | function geodir_get_map_api_key() {
|
| 1001 | - $key = get_option( 'geodir_google_api_key' ); |
|
| 1001 | + $key = get_option('geodir_google_api_key');
|
|
| 1002 | 1002 | |
| 1003 | 1003 | /** |
| 1004 | 1004 | * Filter Google maps api key. |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | * |
| 1008 | 1008 | * @param string $key Google maps api key. |
| 1009 | 1009 | */ |
| 1010 | - return apply_filters( 'geodir_google_api_key', $key ); |
|
| 1010 | + return apply_filters('geodir_google_api_key', $key);
|
|
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | 1013 | |
@@ -1026,20 +1026,20 @@ discard block |
||
| 1026 | 1026 | global $wp, $post, $wp_query, $wpdb, $geodir_addon_list; |
| 1027 | 1027 | |
| 1028 | 1028 | $is_geodir_page = geodir_is_geodir_page(); |
| 1029 | - if ( ! $is_geodir_page ) {
|
|
| 1029 | + if (!$is_geodir_page) {
|
|
| 1030 | 1030 | return; |
| 1031 | 1031 | }// if non GD page, bail |
| 1032 | 1032 | |
| 1033 | 1033 | $use_gd_meta = true; |
| 1034 | - if ( class_exists( 'WPSEO_Frontend' ) || class_exists( 'All_in_One_SEO_Pack' ) ) {
|
|
| 1034 | + if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
|
|
| 1035 | 1035 | $use_gd_meta = false; |
| 1036 | 1036 | |
| 1037 | - if ( geodir_is_page( 'search' ) ) {
|
|
| 1037 | + if (geodir_is_page('search')) {
|
|
| 1038 | 1038 | $use_gd_meta = true; |
| 1039 | 1039 | } |
| 1040 | 1040 | } |
| 1041 | 1041 | |
| 1042 | - if ( ! $use_gd_meta ) {
|
|
| 1042 | + if (!$use_gd_meta) {
|
|
| 1043 | 1043 | return; |
| 1044 | 1044 | }// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active. |
| 1045 | 1045 | |
@@ -1047,170 +1047,170 @@ discard block |
||
| 1047 | 1047 | |
| 1048 | 1048 | $all_postypes = geodir_get_posttypes(); |
| 1049 | 1049 | |
| 1050 | - $geodir_taxonomies = geodir_get_taxonomies( '', true ); |
|
| 1050 | + $geodir_taxonomies = geodir_get_taxonomies('', true);
|
|
| 1051 | 1051 | |
| 1052 | 1052 | $meta_desc = ''; |
| 1053 | 1053 | $meta_key = ''; |
| 1054 | - if ( isset( $current_term->ID ) && $current_term->ID == geodir_location_page_id() ) {
|
|
| 1054 | + if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
|
|
| 1055 | 1055 | /** |
| 1056 | 1056 | * Filter SEO meta location description. |
| 1057 | 1057 | * |
| 1058 | 1058 | * @since 1.0.0 |
| 1059 | 1059 | */ |
| 1060 | - $meta_desc = apply_filters( 'geodir_seo_meta_location_description', '' ); |
|
| 1060 | + $meta_desc = apply_filters('geodir_seo_meta_location_description', '');
|
|
| 1061 | 1061 | $meta_desc .= ''; |
| 1062 | 1062 | } |
| 1063 | - if ( have_posts() && is_single() OR is_page() ) {
|
|
| 1064 | - while ( have_posts() ) {
|
|
| 1063 | + if (have_posts() && is_single() OR is_page()) {
|
|
| 1064 | + while (have_posts()) {
|
|
| 1065 | 1065 | the_post(); |
| 1066 | 1066 | |
| 1067 | - if ( has_excerpt() ) {
|
|
| 1068 | - $out_excerpt = strip_tags( strip_shortcodes( get_the_excerpt() ) ); |
|
| 1069 | - if ( empty( $out_excerpt ) ) {
|
|
| 1070 | - $out_excerpt = strip_tags( do_shortcode( get_the_excerpt() ) ); |
|
| 1067 | + if (has_excerpt()) {
|
|
| 1068 | + $out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt())); |
|
| 1069 | + if (empty($out_excerpt)) {
|
|
| 1070 | + $out_excerpt = strip_tags(do_shortcode(get_the_excerpt())); |
|
| 1071 | 1071 | } |
| 1072 | - $out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $out_excerpt ); |
|
| 1072 | + $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
|
|
| 1073 | 1073 | } else {
|
| 1074 | - $out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $post->post_content ); |
|
| 1075 | - $out_excerpt = strip_tags( strip_shortcodes( $out_excerpt ) ); |
|
| 1076 | - if ( empty( $out_excerpt ) ) {
|
|
| 1077 | - $out_excerpt = strip_tags( do_shortcode( $out_excerpt ) ); // parse short code from content |
|
| 1074 | + $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
|
|
| 1075 | + $out_excerpt = strip_tags(strip_shortcodes($out_excerpt)); |
|
| 1076 | + if (empty($out_excerpt)) {
|
|
| 1077 | + $out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content |
|
| 1078 | 1078 | } |
| 1079 | - $out_excerpt = trim( wp_trim_words( $out_excerpt, 35, '' ), '.!?,;:-' ); |
|
| 1079 | + $out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-'); |
|
| 1080 | 1080 | } |
| 1081 | 1081 | |
| 1082 | 1082 | $meta_desc .= $out_excerpt; |
| 1083 | 1083 | } |
| 1084 | - } elseif ( ( is_category() || is_tag() ) && isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
|
|
| 1085 | - if ( is_category() ) {
|
|
| 1086 | - $meta_desc .= __( "Posts related to Category:", 'geodirectory' ) . " " . ucfirst( single_cat_title( "", false ) ); |
|
| 1087 | - } elseif ( is_tag() ) {
|
|
| 1088 | - $meta_desc .= __( "Posts related to Tag:", 'geodirectory' ) . " " . ucfirst( single_tag_title( "", false ) ); |
|
| 1084 | + } elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
|
|
| 1085 | + if (is_category()) {
|
|
| 1086 | + $meta_desc .= __("Posts related to Category:", 'geodirectory')." ".ucfirst(single_cat_title("", false));
|
|
| 1087 | + } elseif (is_tag()) {
|
|
| 1088 | + $meta_desc .= __("Posts related to Tag:", 'geodirectory')." ".ucfirst(single_tag_title("", false));
|
|
| 1089 | 1089 | } |
| 1090 | - } elseif ( isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
|
|
| 1091 | - $meta_desc .= isset( $current_term->description ) ? $current_term->description : ''; |
|
| 1090 | + } elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
|
|
| 1091 | + $meta_desc .= isset($current_term->description) ? $current_term->description : ''; |
|
| 1092 | 1092 | } |
| 1093 | 1093 | |
| 1094 | 1094 | |
| 1095 | 1095 | $geodir_post_type = geodir_get_current_posttype(); |
| 1096 | - $geodir_post_type_info = get_post_type_object( $geodir_post_type ); |
|
| 1097 | - $geodir_is_page_listing = geodir_is_page( 'listing' ) ? true : false; |
|
| 1098 | - |
|
| 1099 | - $category_taxonomy = geodir_get_taxonomies( $geodir_post_type ); |
|
| 1100 | - $tag_taxonomy = geodir_get_taxonomies( $geodir_post_type, true ); |
|
| 1101 | - |
|
| 1102 | - $geodir_is_category = isset( $category_taxonomy[0] ) && get_query_var( $category_taxonomy[0] ) ? get_query_var( $category_taxonomy[0] ) : false; |
|
| 1103 | - $geodir_is_tag = isset( $tag_taxonomy[0] ) && get_query_var( $tag_taxonomy[0] ) ? true : false; |
|
| 1104 | - |
|
| 1105 | - $geodir_is_search = geodir_is_page( 'search' ) ? true : false; |
|
| 1106 | - $geodir_is_location = geodir_is_page( 'location' ) ? true : false; |
|
| 1107 | - $geodir_location_manager = isset( $geodir_addon_list['geodir_location_manager'] ) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false; |
|
| 1108 | - $godir_location_terms = geodir_get_current_location_terms( 'query_vars' ); |
|
| 1109 | - $gd_city = $geodir_location_manager && isset( $godir_location_terms['gd_city'] ) ? $godir_location_terms['gd_city'] : null; |
|
| 1110 | - $gd_region = $geodir_location_manager && isset( $godir_location_terms['gd_region'] ) ? $godir_location_terms['gd_region'] : null; |
|
| 1111 | - $gd_country = $geodir_location_manager && isset( $godir_location_terms['gd_country'] ) ? $godir_location_terms['gd_country'] : null; |
|
| 1112 | - $replace_location = __( 'Everywhere', 'geodirectory' ); |
|
| 1096 | + $geodir_post_type_info = get_post_type_object($geodir_post_type); |
|
| 1097 | + $geodir_is_page_listing = geodir_is_page('listing') ? true : false;
|
|
| 1098 | + |
|
| 1099 | + $category_taxonomy = geodir_get_taxonomies($geodir_post_type); |
|
| 1100 | + $tag_taxonomy = geodir_get_taxonomies($geodir_post_type, true); |
|
| 1101 | + |
|
| 1102 | + $geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false; |
|
| 1103 | + $geodir_is_tag = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false; |
|
| 1104 | + |
|
| 1105 | + $geodir_is_search = geodir_is_page('search') ? true : false;
|
|
| 1106 | + $geodir_is_location = geodir_is_page('location') ? true : false;
|
|
| 1107 | + $geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false; |
|
| 1108 | + $godir_location_terms = geodir_get_current_location_terms('query_vars');
|
|
| 1109 | + $gd_city = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : null; |
|
| 1110 | + $gd_region = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : null; |
|
| 1111 | + $gd_country = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : null; |
|
| 1112 | + $replace_location = __('Everywhere', 'geodirectory');
|
|
| 1113 | 1113 | $location_id = null; |
| 1114 | - if ( $geodir_location_manager ) {
|
|
| 1115 | - $sql = $wpdb->prepare( "SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array( $gd_city ) ); |
|
| 1116 | - $location_id = (int) $wpdb->get_var( $sql ); |
|
| 1114 | + if ($geodir_location_manager) {
|
|
| 1115 | + $sql = $wpdb->prepare("SELECT location_id FROM ".POST_LOCATION_TABLE." WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
|
|
| 1116 | + $location_id = (int) $wpdb->get_var($sql); |
|
| 1117 | 1117 | $location_type = geodir_what_is_current_location(); |
| 1118 | - if ( $location_type == 'city' ) {
|
|
| 1119 | - $replace_location = geodir_get_current_location( array( 'what' => 'city', 'echo' => false ) ); |
|
| 1120 | - } elseif ( $location_type == 'region' ) {
|
|
| 1121 | - $replace_location = geodir_get_current_location( array( 'what' => 'region', 'echo' => false ) ); |
|
| 1122 | - } elseif ( $location_type == 'country' ) {
|
|
| 1123 | - $replace_location = geodir_get_current_location( array( 'what' => 'country', 'echo' => false ) ); |
|
| 1124 | - $replace_location = __( $replace_location, 'geodirectory' ); |
|
| 1118 | + if ($location_type == 'city') {
|
|
| 1119 | + $replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
|
|
| 1120 | + } elseif ($location_type == 'region') {
|
|
| 1121 | + $replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
|
|
| 1122 | + } elseif ($location_type == 'country') {
|
|
| 1123 | + $replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
|
|
| 1124 | + $replace_location = __($replace_location, 'geodirectory'); |
|
| 1125 | 1125 | } |
| 1126 | - $country = get_query_var( 'gd_country' ); |
|
| 1127 | - $region = get_query_var( 'gd_region' ); |
|
| 1128 | - $city = get_query_var( 'gd_city' ); |
|
| 1126 | + $country = get_query_var('gd_country');
|
|
| 1127 | + $region = get_query_var('gd_region');
|
|
| 1128 | + $city = get_query_var('gd_city');
|
|
| 1129 | 1129 | $current_location = ''; |
| 1130 | - if ( $country != '' ) {
|
|
| 1131 | - $current_location = get_actual_location_name( 'country', $country, true ); |
|
| 1130 | + if ($country != '') {
|
|
| 1131 | + $current_location = get_actual_location_name('country', $country, true);
|
|
| 1132 | 1132 | } |
| 1133 | - if ( $region != '' ) {
|
|
| 1134 | - $current_location = get_actual_location_name( 'region', $region ); |
|
| 1133 | + if ($region != '') {
|
|
| 1134 | + $current_location = get_actual_location_name('region', $region);
|
|
| 1135 | 1135 | } |
| 1136 | - if ( $city != '' ) {
|
|
| 1137 | - $current_location = get_actual_location_name( 'city', $city ); |
|
| 1136 | + if ($city != '') {
|
|
| 1137 | + $current_location = get_actual_location_name('city', $city);
|
|
| 1138 | 1138 | } |
| 1139 | 1139 | $replace_location = $current_location != '' ? $current_location : $replace_location; |
| 1140 | 1140 | } |
| 1141 | 1141 | |
| 1142 | 1142 | $geodir_meta_keys = ''; |
| 1143 | 1143 | $geodir_meta_desc = ''; |
| 1144 | - if ( $is_geodir_page && ! empty( $geodir_post_type_info ) ) {
|
|
| 1145 | - if ( $geodir_is_page_listing || $geodir_is_search || geodir_is_page( 'add-listing' ) ) {
|
|
| 1146 | - $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; |
|
| 1144 | + if ($is_geodir_page && !empty($geodir_post_type_info)) {
|
|
| 1145 | + if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
|
|
| 1146 | + $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; |
|
| 1147 | 1147 | |
| 1148 | - $geodir_meta_desc = isset( $geodir_post_type_info->description ) ? $geodir_post_type_info->description : $geodir_meta_desc; |
|
| 1149 | - $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; |
|
| 1148 | + $geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc; |
|
| 1149 | + $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; |
|
| 1150 | 1150 | |
| 1151 | - if ( $geodir_is_category ) {
|
|
| 1152 | - $category = $geodir_is_category ? get_term_by( 'slug', $geodir_is_category, $category_taxonomy[0] ) : null; |
|
| 1153 | - if ( isset( $category->term_id ) && ! empty( $category->term_id ) ) {
|
|
| 1151 | + if ($geodir_is_category) {
|
|
| 1152 | + $category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : null;
|
|
| 1153 | + if (isset($category->term_id) && !empty($category->term_id)) {
|
|
| 1154 | 1154 | $category_id = $category->term_id; |
| 1155 | - $category_desc = trim( $category->description ) != '' ? trim( $category->description ) : get_tax_meta( $category_id, 'ct_cat_top_desc', false, $geodir_post_type ); |
|
| 1156 | - if ( $location_id ) {
|
|
| 1157 | - $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id; |
|
| 1158 | - $cat_loc_option = get_option( $option_name ); |
|
| 1159 | - |
|
| 1160 | - $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; |
|
| 1161 | - if ( ! $gd_cat_loc_default ) {
|
|
| 1162 | - $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id; |
|
| 1163 | - $option = get_option( $option_name ); |
|
| 1164 | - $category_desc = isset( $option['gd_cat_loc_desc'] ) && trim( $option['gd_cat_loc_desc'] ) != '' ? trim( $option['gd_cat_loc_desc'] ) : $category_desc; |
|
| 1155 | + $category_desc = trim($category->description) != '' ? trim($category->description) : get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type); |
|
| 1156 | + if ($location_id) {
|
|
| 1157 | + $option_name = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id; |
|
| 1158 | + $cat_loc_option = get_option($option_name); |
|
| 1159 | + |
|
| 1160 | + $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; |
|
| 1161 | + if (!$gd_cat_loc_default) {
|
|
| 1162 | + $option_name = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id.'_'.$location_id; |
|
| 1163 | + $option = get_option($option_name); |
|
| 1164 | + $category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc; |
|
| 1165 | 1165 | } |
| 1166 | 1166 | } |
| 1167 | - $geodir_meta_desc = __( "Posts related to Category:", 'geodirectory' ) . " " . ucfirst( single_cat_title( "", false ) ) . '. ' . $category_desc; |
|
| 1167 | + $geodir_meta_desc = __("Posts related to Category:", 'geodirectory')." ".ucfirst(single_cat_title("", false)).'. '.$category_desc;
|
|
| 1168 | 1168 | } |
| 1169 | - } else if ( $geodir_is_tag ) {
|
|
| 1170 | - $geodir_meta_desc = __( "Posts related to Tag:", 'geodirectory' ) . " " . ucfirst( single_tag_title( "", false ) ) . '. ' . $geodir_meta_desc; |
|
| 1169 | + } else if ($geodir_is_tag) {
|
|
| 1170 | + $geodir_meta_desc = __("Posts related to Tag:", 'geodirectory')." ".ucfirst(single_tag_title("", false)).'. '.$geodir_meta_desc;
|
|
| 1171 | 1171 | } |
| 1172 | 1172 | } |
| 1173 | 1173 | } |
| 1174 | 1174 | |
| 1175 | 1175 | |
| 1176 | 1176 | $gd_page = ''; |
| 1177 | - if ( geodir_is_page( 'home' ) ) {
|
|
| 1177 | + if (geodir_is_page('home')) {
|
|
| 1178 | 1178 | $gd_page = 'home'; |
| 1179 | - $meta_desc = ( get_option( 'geodir_meta_desc_homepage' ) ) ? get_option( 'geodir_meta_desc_homepage' ) : $meta_desc; |
|
| 1180 | - } elseif ( geodir_is_page( 'detail' ) ) {
|
|
| 1179 | + $meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
|
|
| 1180 | + } elseif (geodir_is_page('detail')) {
|
|
| 1181 | 1181 | $gd_page = 'detail'; |
| 1182 | - $meta_desc = ( get_option( 'geodir_meta_desc_detail' ) ) ? get_option( 'geodir_meta_desc_detail' ) : $meta_desc; |
|
| 1183 | - } elseif ( geodir_is_page( 'pt' ) ) {
|
|
| 1182 | + $meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
|
|
| 1183 | + } elseif (geodir_is_page('pt')) {
|
|
| 1184 | 1184 | $gd_page = 'pt'; |
| 1185 | - $meta_desc = ( get_option( 'geodir_meta_desc_pt' ) ) ? get_option( 'geodir_meta_desc_pt' ) : $meta_desc; |
|
| 1186 | - } elseif ( geodir_is_page( 'listing' ) ) {
|
|
| 1185 | + $meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
|
|
| 1186 | + } elseif (geodir_is_page('listing')) {
|
|
| 1187 | 1187 | $gd_page = 'listing'; |
| 1188 | - $meta_desc = ( get_option( 'geodir_meta_desc_listing' ) ) ? get_option( 'geodir_meta_desc_listing' ) : $meta_desc; |
|
| 1189 | - } elseif ( geodir_is_page( 'location' ) ) {
|
|
| 1188 | + $meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
|
|
| 1189 | + } elseif (geodir_is_page('location')) {
|
|
| 1190 | 1190 | $gd_page = 'location'; |
| 1191 | - $meta_desc = ( get_option( 'geodir_meta_desc_location' ) ) ? get_option( 'geodir_meta_desc_location' ) : $meta_desc; |
|
| 1192 | - $meta_desc = apply_filters( 'geodir_seo_meta_location_description', $meta_desc ); |
|
| 1191 | + $meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
|
|
| 1192 | + $meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
|
|
| 1193 | 1193 | |
| 1194 | - } elseif ( geodir_is_page( 'search' ) ) {
|
|
| 1194 | + } elseif (geodir_is_page('search')) {
|
|
| 1195 | 1195 | $gd_page = 'search'; |
| 1196 | - $meta_desc = ( get_option( 'geodir_meta_desc_search' ) ) ? get_option( 'geodir_meta_desc_search' ) : $meta_desc; |
|
| 1197 | - } elseif ( geodir_is_page( 'add-listing' ) ) {
|
|
| 1196 | + $meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
|
|
| 1197 | + } elseif (geodir_is_page('add-listing')) {
|
|
| 1198 | 1198 | $gd_page = 'add-listing'; |
| 1199 | - $meta_desc = ( get_option( 'geodir_meta_desc_add-listing' ) ) ? get_option( 'geodir_meta_desc_add-listing' ) : $meta_desc; |
|
| 1200 | - } elseif ( geodir_is_page( 'author' ) ) {
|
|
| 1199 | + $meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
|
|
| 1200 | + } elseif (geodir_is_page('author')) {
|
|
| 1201 | 1201 | $gd_page = 'author'; |
| 1202 | - $meta_desc = ( get_option( 'geodir_meta_desc_author' ) ) ? get_option( 'geodir_meta_desc_author' ) : $meta_desc; |
|
| 1203 | - } elseif ( geodir_is_page( 'login' ) ) {
|
|
| 1202 | + $meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
|
|
| 1203 | + } elseif (geodir_is_page('login')) {
|
|
| 1204 | 1204 | $gd_page = 'login'; |
| 1205 | - $meta_desc = ( get_option( 'geodir_meta_desc_login' ) ) ? get_option( 'geodir_meta_desc_login' ) : $meta_desc; |
|
| 1206 | - } elseif ( geodir_is_page( 'listing-success' ) ) {
|
|
| 1205 | + $meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
|
|
| 1206 | + } elseif (geodir_is_page('listing-success')) {
|
|
| 1207 | 1207 | $gd_page = 'listing-success'; |
| 1208 | - $meta_desc = ( get_option( 'geodir_meta_desc_listing-success' ) ) ? get_option( 'geodir_meta_desc_listing-success' ) : $meta_desc; |
|
| 1208 | + $meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
|
|
| 1209 | 1209 | } |
| 1210 | 1210 | |
| 1211 | 1211 | |
| 1212 | - if ( $meta_desc ) {
|
|
| 1213 | - $meta_desc = stripslashes_deep( $meta_desc ); |
|
| 1212 | + if ($meta_desc) {
|
|
| 1213 | + $meta_desc = stripslashes_deep($meta_desc); |
|
| 1214 | 1214 | /** |
| 1215 | 1215 | * Filter page description to replace variables. |
| 1216 | 1216 | * |
@@ -1219,7 +1219,7 @@ discard block |
||
| 1219 | 1219 | * @param string $title The page description including variables. |
| 1220 | 1220 | * @param string $gd_page The GeoDirectory page type if any. |
| 1221 | 1221 | */ |
| 1222 | - $meta_desc = apply_filters( 'geodir_seo_meta_description_pre', __( $meta_desc, 'geodirectory' ), $gd_page, '' ); |
|
| 1222 | + $meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'), $gd_page, '');
|
|
| 1223 | 1223 | |
| 1224 | 1224 | /** |
| 1225 | 1225 | * Filter SEO meta description. |
@@ -1228,49 +1228,49 @@ discard block |
||
| 1228 | 1228 | * |
| 1229 | 1229 | * @param string $meta_desc Meta description content. |
| 1230 | 1230 | */ |
| 1231 | - echo apply_filters( 'geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc ); |
|
| 1231 | + echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="'.$meta_desc.'" />', $meta_desc);
|
|
| 1232 | 1232 | } |
| 1233 | 1233 | |
| 1234 | 1234 | // meta keywords |
| 1235 | - if ( isset( $post->post_type ) && in_array( $post->post_type, $all_postypes ) ) {
|
|
| 1236 | - $place_tags = wp_get_post_terms( $post->ID, $post->post_type . '_tags', array( "fields" => "names" ) ); |
|
| 1237 | - $place_cats = wp_get_post_terms( $post->ID, $post->post_type . 'category', array( "fields" => "names" ) ); |
|
| 1235 | + if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
|
|
| 1236 | + $place_tags = wp_get_post_terms($post->ID, $post->post_type.'_tags', array("fields" => "names"));
|
|
| 1237 | + $place_cats = wp_get_post_terms($post->ID, $post->post_type.'category', array("fields" => "names"));
|
|
| 1238 | 1238 | |
| 1239 | - $meta_key .= implode( ", ", array_merge( (array) $place_cats, (array) $place_tags ) ); |
|
| 1239 | + $meta_key .= implode(", ", array_merge((array) $place_cats, (array) $place_tags));
|
|
| 1240 | 1240 | } else {
|
| 1241 | 1241 | $posttags = get_the_tags(); |
| 1242 | - if ( $posttags ) {
|
|
| 1243 | - foreach ( $posttags as $tag ) {
|
|
| 1244 | - $meta_key .= $tag->name . ' '; |
|
| 1242 | + if ($posttags) {
|
|
| 1243 | + foreach ($posttags as $tag) {
|
|
| 1244 | + $meta_key .= $tag->name.' '; |
|
| 1245 | 1245 | } |
| 1246 | 1246 | } else {
|
| 1247 | - $tags = get_tags( array( 'orderby' => 'count', 'order' => 'DESC' ) ); |
|
| 1247 | + $tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
|
|
| 1248 | 1248 | $xt = 1; |
| 1249 | 1249 | |
| 1250 | - foreach ( $tags as $tag ) {
|
|
| 1251 | - if ( $xt <= 20 ) {
|
|
| 1252 | - $meta_key .= $tag->name . ", "; |
|
| 1250 | + foreach ($tags as $tag) {
|
|
| 1251 | + if ($xt <= 20) {
|
|
| 1252 | + $meta_key .= $tag->name.", "; |
|
| 1253 | 1253 | } |
| 1254 | 1254 | |
| 1255 | - $xt ++; |
|
| 1255 | + $xt++; |
|
| 1256 | 1256 | } |
| 1257 | 1257 | } |
| 1258 | 1258 | } |
| 1259 | 1259 | |
| 1260 | - $meta_key = $meta_key != '' ? rtrim( trim( $meta_key ), "," ) : $meta_key; |
|
| 1261 | - $geodir_meta_keys = $geodir_meta_keys != '' ? ( $meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys ) : $meta_key; |
|
| 1262 | - if ( $geodir_meta_keys != '' ) {
|
|
| 1263 | - $geodir_meta_keys = strip_tags( $geodir_meta_keys ); |
|
| 1264 | - $geodir_meta_keys = esc_html( $geodir_meta_keys ); |
|
| 1265 | - $geodir_meta_keys = geodir_strtolower( $geodir_meta_keys ); |
|
| 1266 | - $geodir_meta_keys = wp_html_excerpt( $geodir_meta_keys, 1000, '' ); |
|
| 1267 | - $geodir_meta_keys = str_replace( '%location%', $replace_location, $geodir_meta_keys ); |
|
| 1260 | + $meta_key = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key; |
|
| 1261 | + $geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key.', '.$geodir_meta_keys : $geodir_meta_keys) : $meta_key; |
|
| 1262 | + if ($geodir_meta_keys != '') {
|
|
| 1263 | + $geodir_meta_keys = strip_tags($geodir_meta_keys); |
|
| 1264 | + $geodir_meta_keys = esc_html($geodir_meta_keys); |
|
| 1265 | + $geodir_meta_keys = geodir_strtolower($geodir_meta_keys); |
|
| 1266 | + $geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, ''); |
|
| 1267 | + $geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
|
|
| 1268 | 1268 | |
| 1269 | - $meta_key = rtrim( trim( $geodir_meta_keys ), "," ); |
|
| 1269 | + $meta_key = rtrim(trim($geodir_meta_keys), ","); |
|
| 1270 | 1270 | } |
| 1271 | 1271 | |
| 1272 | - if ( $meta_key ) {
|
|
| 1273 | - $meta_key = stripslashes_deep( $meta_key ); |
|
| 1272 | + if ($meta_key) {
|
|
| 1273 | + $meta_key = stripslashes_deep($meta_key); |
|
| 1274 | 1274 | /** |
| 1275 | 1275 | * Filter SEO meta keywords. |
| 1276 | 1276 | * |
@@ -1278,7 +1278,7 @@ discard block |
||
| 1278 | 1278 | * |
| 1279 | 1279 | * @param string $meta_desc Meta keywords. |
| 1280 | 1280 | */ |
| 1281 | - echo apply_filters( 'geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key ); |
|
| 1281 | + echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="'.$meta_key.'" />', $meta_key);
|
|
| 1282 | 1282 | } |
| 1283 | 1283 | |
| 1284 | 1284 | } |
@@ -1298,8 +1298,8 @@ discard block |
||
| 1298 | 1298 | |
| 1299 | 1299 | $geodir_detail_page_tabs_array = geodir_detail_page_tabs_array(); |
| 1300 | 1300 | |
| 1301 | - foreach ( $geodir_detail_page_tabs_array as $key => $tabs_obj ) {
|
|
| 1302 | - $geodir_detail_page_tabs_key_value_array[ $key ] = $tabs_obj['heading_text']; |
|
| 1301 | + foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
|
|
| 1302 | + $geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text']; |
|
| 1303 | 1303 | } |
| 1304 | 1304 | |
| 1305 | 1305 | return $geodir_detail_page_tabs_key_value_array; |
@@ -1321,57 +1321,57 @@ discard block |
||
| 1321 | 1321 | * @since 1.0.0 |
| 1322 | 1322 | */ |
| 1323 | 1323 | $arr_tabs['post_profile'] = array( |
| 1324 | - 'heading_text' => __( 'Profile', 'geodirectory' ), |
|
| 1324 | + 'heading_text' => __('Profile', 'geodirectory'),
|
|
| 1325 | 1325 | 'is_active_tab' => true, |
| 1326 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_profile' ), |
|
| 1326 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
|
|
| 1327 | 1327 | 'tab_content' => '' |
| 1328 | 1328 | ); |
| 1329 | - $arr_tabs['post_info'] = array( |
|
| 1330 | - 'heading_text' => __( 'More Info', 'geodirectory' ), |
|
| 1329 | + $arr_tabs['post_info'] = array( |
|
| 1330 | + 'heading_text' => __('More Info', 'geodirectory'),
|
|
| 1331 | 1331 | 'is_active_tab' => false, |
| 1332 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_info' ), |
|
| 1332 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
|
|
| 1333 | 1333 | 'tab_content' => '' |
| 1334 | 1334 | ); |
| 1335 | 1335 | |
| 1336 | 1336 | $arr_tabs['post_images'] = array( |
| 1337 | - 'heading_text' => __( 'Photo', 'geodirectory' ), |
|
| 1337 | + 'heading_text' => __('Photo', 'geodirectory'),
|
|
| 1338 | 1338 | 'is_active_tab' => false, |
| 1339 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_images' ), |
|
| 1339 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
|
|
| 1340 | 1340 | 'tab_content' => '' |
| 1341 | 1341 | ); |
| 1342 | 1342 | |
| 1343 | 1343 | $arr_tabs['post_video'] = array( |
| 1344 | - 'heading_text' => __( 'Video', 'geodirectory' ), |
|
| 1344 | + 'heading_text' => __('Video', 'geodirectory'),
|
|
| 1345 | 1345 | 'is_active_tab' => false, |
| 1346 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_video' ), |
|
| 1346 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
|
|
| 1347 | 1347 | 'tab_content' => '' |
| 1348 | 1348 | ); |
| 1349 | 1349 | |
| 1350 | 1350 | $arr_tabs['special_offers'] = array( |
| 1351 | - 'heading_text' => __( 'Special Offers', 'geodirectory' ), |
|
| 1351 | + 'heading_text' => __('Special Offers', 'geodirectory'),
|
|
| 1352 | 1352 | 'is_active_tab' => false, |
| 1353 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'special_offers' ), |
|
| 1353 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
|
|
| 1354 | 1354 | 'tab_content' => '' |
| 1355 | 1355 | ); |
| 1356 | 1356 | |
| 1357 | 1357 | $arr_tabs['post_map'] = array( |
| 1358 | - 'heading_text' => __( 'Map', 'geodirectory' ), |
|
| 1358 | + 'heading_text' => __('Map', 'geodirectory'),
|
|
| 1359 | 1359 | 'is_active_tab' => false, |
| 1360 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_map' ), |
|
| 1360 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
|
|
| 1361 | 1361 | 'tab_content' => '' |
| 1362 | 1362 | ); |
| 1363 | 1363 | |
| 1364 | 1364 | $arr_tabs['reviews'] = array( |
| 1365 | - 'heading_text' => __( 'Reviews', 'geodirectory' ), |
|
| 1365 | + 'heading_text' => __('Reviews', 'geodirectory'),
|
|
| 1366 | 1366 | 'is_active_tab' => false, |
| 1367 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'reviews' ), |
|
| 1367 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
|
|
| 1368 | 1368 | 'tab_content' => 'review display' |
| 1369 | 1369 | ); |
| 1370 | 1370 | |
| 1371 | 1371 | $arr_tabs['related_listing'] = array( |
| 1372 | - 'heading_text' => __( 'Related Listing', 'geodirectory' ), |
|
| 1372 | + 'heading_text' => __('Related Listing', 'geodirectory'),
|
|
| 1373 | 1373 | 'is_active_tab' => false, |
| 1374 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'related_listing' ), |
|
| 1374 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
|
|
| 1375 | 1375 | 'tab_content' => '' |
| 1376 | 1376 | ); |
| 1377 | 1377 | |
@@ -1380,7 +1380,7 @@ discard block |
||
| 1380 | 1380 | * |
| 1381 | 1381 | * @since 1.0.0 |
| 1382 | 1382 | */ |
| 1383 | - return apply_filters( 'geodir_detail_page_tab_list_extend', $arr_tabs ); |
|
| 1383 | + return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
|
|
| 1384 | 1384 | |
| 1385 | 1385 | |
| 1386 | 1386 | } |
@@ -1394,13 +1394,13 @@ discard block |
||
| 1394 | 1394 | * @return mixed|array Tabs array. |
| 1395 | 1395 | */ |
| 1396 | 1396 | function geodir_detail_page_tabs_list() {
|
| 1397 | - $tabs_excluded = get_option( 'geodir_detail_page_tabs_excluded' ); |
|
| 1397 | + $tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
|
|
| 1398 | 1398 | $tabs_array = geodir_detail_page_tabs_array(); |
| 1399 | 1399 | |
| 1400 | - if ( ! empty( $tabs_excluded ) ) {
|
|
| 1401 | - foreach ( $tabs_excluded as $tab ) {
|
|
| 1402 | - if ( array_key_exists( $tab, $tabs_array ) ) {
|
|
| 1403 | - unset( $tabs_array[ $tab ] ); |
|
| 1400 | + if (!empty($tabs_excluded)) {
|
|
| 1401 | + foreach ($tabs_excluded as $tab) {
|
|
| 1402 | + if (array_key_exists($tab, $tabs_array)) {
|
|
| 1403 | + unset($tabs_array[$tab]); |
|
| 1404 | 1404 | } |
| 1405 | 1405 | } |
| 1406 | 1406 | } |
@@ -1424,58 +1424,58 @@ discard block |
||
| 1424 | 1424 | function geodir_show_detail_page_tabs() {
|
| 1425 | 1425 | global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields, $preview; |
| 1426 | 1426 | |
| 1427 | - $post_id = ! empty( $post ) && isset( $post->ID ) ? (int) $post->ID : 0; |
|
| 1428 | - $request_post_id = ! empty( $_REQUEST['p'] ) ? (int) $_REQUEST['p'] : 0; |
|
| 1429 | - $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 |
|
| 1427 | + $post_id = !empty($post) && isset($post->ID) ? (int) $post->ID : 0; |
|
| 1428 | + $request_post_id = !empty($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0; |
|
| 1429 | + $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 |
|
| 1430 | 1430 | |
| 1431 | - if ( $is_backend_preview && ! $post_id > 0 && $request_post_id > 0 ) {
|
|
| 1432 | - $post = geodir_get_post_info( $request_post_id ); |
|
| 1433 | - setup_postdata( $post ); |
|
| 1431 | + if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
|
|
| 1432 | + $post = geodir_get_post_info($request_post_id); |
|
| 1433 | + setup_postdata($post); |
|
| 1434 | 1434 | } |
| 1435 | 1435 | |
| 1436 | - $geodir_post_detail_fields = geodir_show_listing_info( 'moreinfo' ); |
|
| 1436 | + $geodir_post_detail_fields = geodir_show_listing_info('moreinfo');
|
|
| 1437 | 1437 | |
| 1438 | 1438 | |
| 1439 | - if ( geodir_is_page( 'detail' ) ) {
|
|
| 1440 | - $video = geodir_get_video( $post->ID ); |
|
| 1441 | - $special_offers = geodir_get_special_offers( $post->ID ); |
|
| 1439 | + if (geodir_is_page('detail')) {
|
|
| 1440 | + $video = geodir_get_video($post->ID); |
|
| 1441 | + $special_offers = geodir_get_special_offers($post->ID); |
|
| 1442 | 1442 | $related_listing_array = array(); |
| 1443 | - if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
|
|
| 1444 | - $related_listing_array = get_option( 'geodir_add_related_listing_posttypes' ); |
|
| 1443 | + if (get_option('geodir_add_related_listing_posttypes')) {
|
|
| 1444 | + $related_listing_array = get_option('geodir_add_related_listing_posttypes');
|
|
| 1445 | 1445 | } |
| 1446 | 1446 | |
| 1447 | 1447 | |
| 1448 | - $excluded_tabs = get_option( 'geodir_detail_page_tabs_excluded' ); |
|
| 1449 | - if ( ! $excluded_tabs ) {
|
|
| 1448 | + $excluded_tabs = get_option('geodir_detail_page_tabs_excluded');
|
|
| 1449 | + if (!$excluded_tabs) {
|
|
| 1450 | 1450 | $excluded_tabs = array(); |
| 1451 | 1451 | } |
| 1452 | 1452 | |
| 1453 | 1453 | $related_listing = ''; |
| 1454 | - if ( in_array( $post->post_type, $related_listing_array ) && ! in_array( 'related_listing', $excluded_tabs ) ) {
|
|
| 1454 | + if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) {
|
|
| 1455 | 1455 | $request = array( |
| 1456 | - 'post_number' => get_option( 'geodir_related_post_count' ), |
|
| 1457 | - 'relate_to' => get_option( 'geodir_related_post_relate_to' ), |
|
| 1458 | - 'layout' => get_option( 'geodir_related_post_listing_view' ), |
|
| 1459 | - 'add_location_filter' => get_option( 'geodir_related_post_location_filter' ), |
|
| 1460 | - 'list_sort' => get_option( 'geodir_related_post_sortby' ), |
|
| 1461 | - 'character_count' => get_option( 'geodir_related_post_excerpt' ) |
|
| 1456 | + 'post_number' => get_option('geodir_related_post_count'),
|
|
| 1457 | + 'relate_to' => get_option('geodir_related_post_relate_to'),
|
|
| 1458 | + 'layout' => get_option('geodir_related_post_listing_view'),
|
|
| 1459 | + 'add_location_filter' => get_option('geodir_related_post_location_filter'),
|
|
| 1460 | + 'list_sort' => get_option('geodir_related_post_sortby'),
|
|
| 1461 | + 'character_count' => get_option('geodir_related_post_excerpt')
|
|
| 1462 | 1462 | ); |
| 1463 | 1463 | |
| 1464 | - if ( $post->post_type == 'gd_event' && defined( 'GDEVENTS_VERSION' ) ) {
|
|
| 1465 | - $related_listing = geodir_get_detail_page_related_events( $request ); |
|
| 1464 | + if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
|
|
| 1465 | + $related_listing = geodir_get_detail_page_related_events($request); |
|
| 1466 | 1466 | } else {
|
| 1467 | - $related_listing = geodir_related_posts_display( $request ); |
|
| 1467 | + $related_listing = geodir_related_posts_display($request); |
|
| 1468 | 1468 | } |
| 1469 | 1469 | |
| 1470 | 1470 | } |
| 1471 | 1471 | |
| 1472 | - $post_images = geodir_get_images( $post->ID, 'thumbnail' ); |
|
| 1472 | + $post_images = geodir_get_images($post->ID, 'thumbnail'); |
|
| 1473 | 1473 | $thumb_image = ''; |
| 1474 | - if ( ! empty( $post_images ) ) {
|
|
| 1475 | - foreach ( $post_images as $image ) {
|
|
| 1476 | - $caption = ( ! empty( $image->caption ) ) ? $image->caption : ''; |
|
| 1477 | - $thumb_image .= '<a href="' . $image->src . '" title="' . $caption . '">'; |
|
| 1478 | - $thumb_image .= geodir_show_image( $image, 'thumbnail', true, false ); |
|
| 1474 | + if (!empty($post_images)) {
|
|
| 1475 | + foreach ($post_images as $image) {
|
|
| 1476 | + $caption = (!empty($image->caption)) ? $image->caption : ''; |
|
| 1477 | + $thumb_image .= '<a href="'.$image->src.'" title="'.$caption.'">'; |
|
| 1478 | + $thumb_image .= geodir_show_image($image, 'thumbnail', true, false); |
|
| 1479 | 1479 | $thumb_image .= '</a>'; |
| 1480 | 1480 | } |
| 1481 | 1481 | } |
@@ -1484,11 +1484,11 @@ discard block |
||
| 1484 | 1484 | $map_args['map_canvas_name'] = 'detail_page_map_canvas'; |
| 1485 | 1485 | $map_args['width'] = '600'; |
| 1486 | 1486 | $map_args['height'] = '300'; |
| 1487 | - if ( $post->post_mapzoom ) {
|
|
| 1488 | - $map_args['zoom'] = '' . $post->post_mapzoom . ''; |
|
| 1487 | + if ($post->post_mapzoom) {
|
|
| 1488 | + $map_args['zoom'] = ''.$post->post_mapzoom.''; |
|
| 1489 | 1489 | } |
| 1490 | 1490 | $map_args['autozoom'] = false; |
| 1491 | - $map_args['scrollwheel'] = ( get_option( 'geodir_add_listing_mouse_scroll' ) ) ? 0 : 1; |
|
| 1491 | + $map_args['scrollwheel'] = (get_option('geodir_add_listing_mouse_scroll')) ? 0 : 1;
|
|
| 1492 | 1492 | $map_args['child_collapse'] = '0'; |
| 1493 | 1493 | $map_args['enable_cat_filters'] = false; |
| 1494 | 1494 | $map_args['enable_text_search'] = false; |
@@ -1497,43 +1497,43 @@ discard block |
||
| 1497 | 1497 | $map_args['enable_jason_on_load'] = true; |
| 1498 | 1498 | $map_args['enable_map_direction'] = true; |
| 1499 | 1499 | $map_args['map_class_name'] = 'geodir-map-detail-page'; |
| 1500 | - $map_args['maptype'] = ( ! empty( $post->post_mapview ) ) ? $post->post_mapview : 'ROADMAP'; |
|
| 1501 | - } else if ( geodir_is_page( 'preview' ) ) {
|
|
| 1502 | - $video = isset( $post->geodir_video ) ? $post->geodir_video : ''; |
|
| 1503 | - $special_offers = isset( $post->geodir_special_offers ) ? $post->geodir_special_offers : ''; |
|
| 1500 | + $map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP'; |
|
| 1501 | + } else if (geodir_is_page('preview')) {
|
|
| 1502 | + $video = isset($post->geodir_video) ? $post->geodir_video : ''; |
|
| 1503 | + $special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : ''; |
|
| 1504 | 1504 | |
| 1505 | - if ( isset( $post->post_images ) ) {
|
|
| 1506 | - $post->post_images = trim( $post->post_images, "," ); |
|
| 1505 | + if (isset($post->post_images)) {
|
|
| 1506 | + $post->post_images = trim($post->post_images, ","); |
|
| 1507 | 1507 | } |
| 1508 | 1508 | |
| 1509 | - if ( isset( $post->post_images ) && ! empty( $post->post_images ) ) {
|
|
| 1510 | - $post_images = explode( ",", $post->post_images ); |
|
| 1509 | + if (isset($post->post_images) && !empty($post->post_images)) {
|
|
| 1510 | + $post_images = explode(",", $post->post_images);
|
|
| 1511 | 1511 | } |
| 1512 | 1512 | |
| 1513 | 1513 | $thumb_image = ''; |
| 1514 | - if ( ! empty( $post_images ) ) {
|
|
| 1515 | - foreach ( $post_images as $image ) {
|
|
| 1516 | - if ( $image != '' ) {
|
|
| 1517 | - $thumb_image .= '<a href="' . $image . '">'; |
|
| 1518 | - $thumb_image .= geodir_show_image( array( 'src' => $image ), 'thumbnail', true, false ); |
|
| 1514 | + if (!empty($post_images)) {
|
|
| 1515 | + foreach ($post_images as $image) {
|
|
| 1516 | + if ($image != '') {
|
|
| 1517 | + $thumb_image .= '<a href="'.$image.'">'; |
|
| 1518 | + $thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
|
|
| 1519 | 1519 | $thumb_image .= '</a>'; |
| 1520 | 1520 | } |
| 1521 | 1521 | } |
| 1522 | 1522 | } |
| 1523 | 1523 | |
| 1524 | 1524 | global $map_jason; |
| 1525 | - $marker_json = $post->marker_json != '' ? json_decode( $post->marker_json, true ) : array(); |
|
| 1526 | - $marker_icon = ( ! empty( $marker_json ) && ! empty( $marker_json['i'] ) ) ? $marker_json['i'] : ''; |
|
| 1527 | - $icon_size = geodir_get_marker_size( $marker_icon ); |
|
| 1525 | + $marker_json = $post->marker_json != '' ? json_decode($post->marker_json, true) : array(); |
|
| 1526 | + $marker_icon = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : ''; |
|
| 1527 | + $icon_size = geodir_get_marker_size($marker_icon); |
|
| 1528 | 1528 | $marker_json['w'] = $icon_size['w']; |
| 1529 | 1529 | $marker_json['h'] = $icon_size['h']; |
| 1530 | - $map_jason[] = json_encode( $marker_json ); |
|
| 1530 | + $map_jason[] = json_encode($marker_json); |
|
| 1531 | 1531 | |
| 1532 | - $address_latitude = isset( $post->post_latitude ) ? $post->post_latitude : ''; |
|
| 1533 | - $address_longitude = isset( $post->post_longitude ) ? $post->post_longitude : ''; |
|
| 1534 | - $mapview = isset( $post->post_mapview ) ? $post->post_mapview : ''; |
|
| 1535 | - $mapzoom = isset( $post->post_mapzoom ) ? $post->post_mapzoom : ''; |
|
| 1536 | - if ( ! $mapzoom ) {
|
|
| 1532 | + $address_latitude = isset($post->post_latitude) ? $post->post_latitude : ''; |
|
| 1533 | + $address_longitude = isset($post->post_longitude) ? $post->post_longitude : ''; |
|
| 1534 | + $mapview = isset($post->post_mapview) ? $post->post_mapview : ''; |
|
| 1535 | + $mapzoom = isset($post->post_mapzoom) ? $post->post_mapzoom : ''; |
|
| 1536 | + if (!$mapzoom) {
|
|
| 1537 | 1537 | $mapzoom = 12; |
| 1538 | 1538 | } |
| 1539 | 1539 | |
@@ -1556,37 +1556,37 @@ discard block |
||
| 1556 | 1556 | $map_args['map_class_name'] = 'geodir-map-preview-page'; |
| 1557 | 1557 | } |
| 1558 | 1558 | |
| 1559 | - $arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user |
|
| 1559 | + $arr_detail_page_tabs = geodir_detail_page_tabs_list(); // get this sooner so we can get the active tab for the user |
|
| 1560 | 1560 | |
| 1561 | 1561 | $active_tab = ''; |
| 1562 | 1562 | $active_tab_name = ''; |
| 1563 | 1563 | $default_tab = ''; |
| 1564 | 1564 | $default_tab_name = ''; |
| 1565 | - foreach ( $arr_detail_page_tabs as $tab_index => $tabs ) {
|
|
| 1566 | - if ( isset( $tabs['is_active_tab'] ) && $tabs['is_active_tab'] && ! empty( $tabs['is_display'] ) && isset( $tabs['heading_text'] ) && $tabs['heading_text'] ) {
|
|
| 1565 | + foreach ($arr_detail_page_tabs as $tab_index => $tabs) {
|
|
| 1566 | + if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
|
|
| 1567 | 1567 | $active_tab = $tab_index; |
| 1568 | - $active_tab_name = __( $tabs['heading_text'], 'geodirectory' ); |
|
| 1568 | + $active_tab_name = __($tabs['heading_text'], 'geodirectory'); |
|
| 1569 | 1569 | } |
| 1570 | 1570 | |
| 1571 | - if ( $default_tab === '' && ! empty( $tabs['is_display'] ) && ! empty( $tabs['heading_text'] ) ) {
|
|
| 1571 | + if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
|
|
| 1572 | 1572 | $default_tab = $tab_index; |
| 1573 | - $default_tab_name = __( $tabs['heading_text'], 'geodirectory' ); |
|
| 1573 | + $default_tab_name = __($tabs['heading_text'], 'geodirectory'); |
|
| 1574 | 1574 | } |
| 1575 | 1575 | } |
| 1576 | 1576 | |
| 1577 | - if ( $active_tab === '' && $default_tab !== '' ) { // Make first tab acs a active tab if not any tab is active.
|
|
| 1578 | - if ( isset( $arr_detail_page_tabs[ $active_tab ] ) && isset( $arr_detail_page_tabs[ $active_tab ]['is_active_tab'] ) ) {
|
|
| 1579 | - $arr_detail_page_tabs[ $active_tab ]['is_active_tab'] = false; |
|
| 1577 | + if ($active_tab === '' && $default_tab !== '') { // Make first tab acs a active tab if not any tab is active.
|
|
| 1578 | + if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
|
|
| 1579 | + $arr_detail_page_tabs[$active_tab]['is_active_tab'] = false; |
|
| 1580 | 1580 | } |
| 1581 | 1581 | |
| 1582 | - $arr_detail_page_tabs[ $default_tab ]['is_active_tab'] = true; |
|
| 1582 | + $arr_detail_page_tabs[$default_tab]['is_active_tab'] = true; |
|
| 1583 | 1583 | $active_tab = $default_tab; |
| 1584 | 1584 | $active_tab_name = $default_tab_name; |
| 1585 | 1585 | } |
| 1586 | - $tab_list = ( get_option( 'geodir_disable_tabs', false ) ) ? true : false; |
|
| 1586 | + $tab_list = (get_option('geodir_disable_tabs', false)) ? true : false;
|
|
| 1587 | 1587 | ?> |
| 1588 | 1588 | <div class="geodir-tabs" id="gd-tabs" style="position:relative;"> |
| 1589 | - <?php if ( ! $tab_list ){ ?>
|
|
| 1589 | + <?php if (!$tab_list) { ?>
|
|
| 1590 | 1590 | <div id="geodir-tab-mobile-menu"> |
| 1591 | 1591 | <i class="fa fa-bars"></i> |
| 1592 | 1592 | <span class="geodir-mobile-active-tab"><?php echo $active_tab_name; ?></span> |
@@ -1601,26 +1601,26 @@ discard block |
||
| 1601 | 1601 | * @since 1.0.0 |
| 1602 | 1602 | * @see 'geodir_after_tab_list' |
| 1603 | 1603 | */ |
| 1604 | - do_action( 'geodir_before_tab_list' ); ?> |
|
| 1604 | + do_action('geodir_before_tab_list'); ?>
|
|
| 1605 | 1605 | <?php |
| 1606 | 1606 | |
| 1607 | - foreach ( $arr_detail_page_tabs as $tab_index => $detail_page_tab ) {
|
|
| 1608 | - if ( $detail_page_tab['is_display'] ) {
|
|
| 1607 | + foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
|
|
| 1608 | + if ($detail_page_tab['is_display']) {
|
|
| 1609 | 1609 | |
| 1610 | - if ( ! $tab_list ) {
|
|
| 1610 | + if (!$tab_list) {
|
|
| 1611 | 1611 | ?> |
| 1612 | 1612 | <dt></dt> <!-- added to comply with validation --> |
| 1613 | - <dd <?php if ( $detail_page_tab['is_active_tab'] ){ ?>class="geodir-tab-active"<?php } ?> ><a
|
|
| 1613 | + <dd <?php if ($detail_page_tab['is_active_tab']) { ?>class="geodir-tab-active"<?php } ?> ><a
|
|
| 1614 | 1614 | data-tab="#<?php echo $tab_index; ?>" |
| 1615 | - data-status="enable"><?php _e( $detail_page_tab['heading_text'], 'geodirectory' ); ?></a> |
|
| 1615 | + data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a> |
|
| 1616 | 1616 | </dd> |
| 1617 | 1617 | <?php |
| 1618 | 1618 | } |
| 1619 | 1619 | ob_start() // start tab content buffering |
| 1620 | 1620 | ?> |
| 1621 | 1621 | <li id="<?php echo $tab_index; ?>Tab"> |
| 1622 | - <?php if ( $tab_list ) {
|
|
| 1623 | - $tab_title = '<span class="gd-tab-list-title" ><a href="#' . $tab_index . '">' . __( $detail_page_tab['heading_text'], 'geodirectory' ) . '</a></span><hr />'; |
|
| 1622 | + <?php if ($tab_list) {
|
|
| 1623 | + $tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'], 'geodirectory').'</a></span><hr />'; |
|
| 1624 | 1624 | /** |
| 1625 | 1625 | * Filter the tab list title html. |
| 1626 | 1626 | * |
@@ -1630,7 +1630,7 @@ discard block |
||
| 1630 | 1630 | * @param string $tab_index The tab index type. |
| 1631 | 1631 | * @param array $detail_page_tab The array of values including title text. |
| 1632 | 1632 | */ |
| 1633 | - echo apply_filters( 'geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab ); |
|
| 1633 | + echo apply_filters('geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab);
|
|
| 1634 | 1634 | } ?> |
| 1635 | 1635 | <div id="<?php echo $tab_index; ?>" class="hash-offset"></div> |
| 1636 | 1636 | <?php |
@@ -1641,7 +1641,7 @@ discard block |
||
| 1641 | 1641 | * |
| 1642 | 1642 | * @param string $tab_index The tab name ID. |
| 1643 | 1643 | */ |
| 1644 | - do_action( 'geodir_before_tab_content', $tab_index ); |
|
| 1644 | + do_action('geodir_before_tab_content', $tab_index);
|
|
| 1645 | 1645 | |
| 1646 | 1646 | /** |
| 1647 | 1647 | * Called before the details tab content is output per tab. |
@@ -1651,21 +1651,21 @@ discard block |
||
| 1651 | 1651 | * @since 1.0.0 |
| 1652 | 1652 | * @todo do we need this if we have the hook above? 'geodir_before_tab_content' |
| 1653 | 1653 | */ |
| 1654 | - do_action( 'geodir_before_' . $tab_index . '_tab_content' ); |
|
| 1654 | + do_action('geodir_before_'.$tab_index.'_tab_content');
|
|
| 1655 | 1655 | /// write a code to generate content of each tab |
| 1656 | - switch ( $tab_index ) {
|
|
| 1656 | + switch ($tab_index) {
|
|
| 1657 | 1657 | case 'post_profile': |
| 1658 | 1658 | /** |
| 1659 | 1659 | * Called before the listing description content on the details page tab. |
| 1660 | 1660 | * |
| 1661 | 1661 | * @since 1.0.0 |
| 1662 | 1662 | */ |
| 1663 | - do_action( 'geodir_before_description_on_listing_detail' ); |
|
| 1664 | - if ( geodir_is_page( 'detail' ) ) {
|
|
| 1663 | + do_action('geodir_before_description_on_listing_detail');
|
|
| 1664 | + if (geodir_is_page('detail')) {
|
|
| 1665 | 1665 | the_content(); |
| 1666 | 1666 | } else {
|
| 1667 | 1667 | /** This action is documented in geodirectory_template_actions.php */ |
| 1668 | - echo apply_filters( 'the_content', stripslashes( $post->post_desc ) ); |
|
| 1668 | + echo apply_filters('the_content', stripslashes($post->post_desc));
|
|
| 1669 | 1669 | } |
| 1670 | 1670 | |
| 1671 | 1671 | /** |
@@ -1673,7 +1673,7 @@ discard block |
||
| 1673 | 1673 | * |
| 1674 | 1674 | * @since 1.0.0 |
| 1675 | 1675 | */ |
| 1676 | - do_action( 'geodir_after_description_on_listing_detail' ); |
|
| 1676 | + do_action('geodir_after_description_on_listing_detail');
|
|
| 1677 | 1677 | break; |
| 1678 | 1678 | case 'post_info': |
| 1679 | 1679 | echo $geodir_post_detail_fields; |
@@ -1683,32 +1683,32 @@ discard block |
||
| 1683 | 1683 | break; |
| 1684 | 1684 | case 'post_video': |
| 1685 | 1685 | // some browsers hide $_POST data if used for embeds so we repalce with a placeholder |
| 1686 | - if ( $preview ) {
|
|
| 1687 | - if ( $video ) {
|
|
| 1688 | - 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>"; |
|
| 1686 | + if ($preview) {
|
|
| 1687 | + if ($video) {
|
|
| 1688 | + 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>";
|
|
| 1689 | 1689 | } |
| 1690 | 1690 | } else {
|
| 1691 | 1691 | |
| 1692 | 1692 | // stop payment manager filtering content length |
| 1693 | - $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' ); |
|
| 1694 | - if ( false !== $filter_priority ) {
|
|
| 1695 | - remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority ); |
|
| 1693 | + $filter_priority = has_filter('the_content', 'geodir_payments_the_content');
|
|
| 1694 | + if (false !== $filter_priority) {
|
|
| 1695 | + remove_filter('the_content', 'geodir_payments_the_content', $filter_priority);
|
|
| 1696 | 1696 | } |
| 1697 | 1697 | |
| 1698 | 1698 | /** This action is documented in geodirectory_template_actions.php */ |
| 1699 | - echo apply_filters( 'the_content', stripslashes( $video ) );// we apply the_content filter so oembed works also; |
|
| 1699 | + echo apply_filters('the_content', stripslashes($video)); // we apply the_content filter so oembed works also;
|
|
| 1700 | 1700 | |
| 1701 | - if ( false !== $filter_priority ) {
|
|
| 1702 | - add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority ); |
|
| 1701 | + if (false !== $filter_priority) {
|
|
| 1702 | + add_filter('the_content', 'geodir_payments_the_content', $filter_priority);
|
|
| 1703 | 1703 | } |
| 1704 | 1704 | } |
| 1705 | 1705 | break; |
| 1706 | 1706 | case 'special_offers': |
| 1707 | - echo apply_filters( 'gd_special_offers_content', wpautop( stripslashes( $special_offers ) ) ); |
|
| 1707 | + echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
|
|
| 1708 | 1708 | |
| 1709 | 1709 | break; |
| 1710 | 1710 | case 'post_map': |
| 1711 | - geodir_draw_map( $map_args ); |
|
| 1711 | + geodir_draw_map($map_args); |
|
| 1712 | 1712 | break; |
| 1713 | 1713 | case 'reviews': |
| 1714 | 1714 | comments_template(); |
@@ -1717,7 +1717,7 @@ discard block |
||
| 1717 | 1717 | echo $related_listing; |
| 1718 | 1718 | break; |
| 1719 | 1719 | default: {
|
| 1720 | - 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'] ) ) {
|
|
| 1720 | + 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'])) {
|
|
| 1721 | 1721 | echo $detail_page_tab['tab_content']; |
| 1722 | 1722 | } |
| 1723 | 1723 | } |
@@ -1729,7 +1729,7 @@ discard block |
||
| 1729 | 1729 | * |
| 1730 | 1730 | * @since 1.0.0 |
| 1731 | 1731 | */ |
| 1732 | - do_action( 'geodir_after_tab_content', $tab_index ); |
|
| 1732 | + do_action('geodir_after_tab_content', $tab_index);
|
|
| 1733 | 1733 | |
| 1734 | 1734 | /** |
| 1735 | 1735 | * Called after the details tab content is output per tab. |
@@ -1739,7 +1739,7 @@ discard block |
||
| 1739 | 1739 | * @since 1.0.0 |
| 1740 | 1740 | * @todo do we need this if we have the hook above? 'geodir_after_tab_content' |
| 1741 | 1741 | */ |
| 1742 | - do_action( 'geodir_after_' . $tab_index . '_tab_content' ); |
|
| 1742 | + do_action('geodir_after_'.$tab_index.'_tab_content');
|
|
| 1743 | 1743 | ?> </li> |
| 1744 | 1744 | <?php |
| 1745 | 1745 | /** |
@@ -1747,7 +1747,7 @@ discard block |
||
| 1747 | 1747 | * |
| 1748 | 1748 | * @since 1.0.0 |
| 1749 | 1749 | */ |
| 1750 | - $arr_detail_page_tabs[ $tab_index ]['tab_content'] = apply_filters( "geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean() ); |
|
| 1750 | + $arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_".$detail_page_tab['tab_content']."_tab_content", ob_get_clean());
|
|
| 1751 | 1751 | } // end of if for is_display |
| 1752 | 1752 | }// end of foreach |
| 1753 | 1753 | |
@@ -1757,14 +1757,14 @@ discard block |
||
| 1757 | 1757 | * @since 1.0.0 |
| 1758 | 1758 | * @see 'geodir_before_tab_list' |
| 1759 | 1759 | */ |
| 1760 | - do_action( 'geodir_after_tab_list' ); |
|
| 1760 | + do_action('geodir_after_tab_list');
|
|
| 1761 | 1761 | ?> |
| 1762 | - <?php if ( ! $tab_list ){ ?></dl><?php } ?>
|
|
| 1763 | - <ul class="geodir-tabs-content entry-content <?php if ( $tab_list ) { ?>geodir-tabs-list<?php } ?>"
|
|
| 1762 | + <?php if (!$tab_list) { ?></dl><?php } ?>
|
|
| 1763 | + <ul class="geodir-tabs-content entry-content <?php if ($tab_list) { ?>geodir-tabs-list<?php } ?>"
|
|
| 1764 | 1764 | style="position:relative;"> |
| 1765 | 1765 | <?php |
| 1766 | - foreach ( $arr_detail_page_tabs as $detail_page_tab ) {
|
|
| 1767 | - if ( $detail_page_tab['is_display'] && ! empty( $detail_page_tab['tab_content'] ) ) {
|
|
| 1766 | + foreach ($arr_detail_page_tabs as $detail_page_tab) {
|
|
| 1767 | + if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
|
|
| 1768 | 1768 | echo $detail_page_tab['tab_content']; |
| 1769 | 1769 | }// end of if |
| 1770 | 1770 | }// end of foreach |
@@ -1774,11 +1774,11 @@ discard block |
||
| 1774 | 1774 | * |
| 1775 | 1775 | * @since 1.0.0 |
| 1776 | 1776 | */ |
| 1777 | - do_action( 'geodir_add_tab_content' ); ?> |
|
| 1777 | + do_action('geodir_add_tab_content'); ?>
|
|
| 1778 | 1778 | </ul> |
| 1779 | 1779 | <!--gd-tabs-content ul end--> |
| 1780 | 1780 | </div> |
| 1781 | - <?php if ( ! $tab_list ) { ?>
|
|
| 1781 | + <?php if (!$tab_list) { ?>
|
|
| 1782 | 1782 | <script> |
| 1783 | 1783 | if (window.location.hash && window.location.hash.indexOf('&') === -1 && jQuery(window.location.hash + 'Tab').length) {
|
| 1784 | 1784 | hashVal = window.location.hash; |
@@ -1810,31 +1810,31 @@ discard block |
||
| 1810 | 1810 | * |
| 1811 | 1811 | * @return mixed Image file. |
| 1812 | 1812 | */ |
| 1813 | -function geodir_exif( $file ) {
|
|
| 1814 | - if ( empty( $file ) || ! is_array( $file ) ) {
|
|
| 1813 | +function geodir_exif($file) {
|
|
| 1814 | + if (empty($file) || !is_array($file)) {
|
|
| 1815 | 1815 | return $file; |
| 1816 | 1816 | } |
| 1817 | 1817 | |
| 1818 | - $file_path = ! empty( $file['tmp_name'] ) ? sanitize_text_field( $file['tmp_name'] ) : ''; |
|
| 1819 | - if ( ! ( $file_path && file_exists( $file_path ) ) ) {
|
|
| 1818 | + $file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : ''; |
|
| 1819 | + if (!($file_path && file_exists($file_path))) {
|
|
| 1820 | 1820 | return $file; |
| 1821 | 1821 | } |
| 1822 | 1822 | $file['file'] = $file_path; |
| 1823 | 1823 | |
| 1824 | - if ( ! file_is_valid_image( $file_path ) ) {
|
|
| 1824 | + if (!file_is_valid_image($file_path)) {
|
|
| 1825 | 1825 | return $file; // Bail if file is not an image. |
| 1826 | 1826 | } |
| 1827 | 1827 | |
| 1828 | - if ( ! function_exists( 'wp_get_image_editor' ) ) {
|
|
| 1828 | + if (!function_exists('wp_get_image_editor')) {
|
|
| 1829 | 1829 | return $file; |
| 1830 | 1830 | } |
| 1831 | 1831 | |
| 1832 | 1832 | $mime_type = $file['type']; |
| 1833 | 1833 | $exif = array(); |
| 1834 | - if ( $mime_type == 'image/jpeg' && function_exists( 'exif_read_data' ) ) {
|
|
| 1834 | + if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
|
|
| 1835 | 1835 | try {
|
| 1836 | - $exif = exif_read_data( $file_path ); |
|
| 1837 | - } catch ( Exception $e ) {
|
|
| 1836 | + $exif = exif_read_data($file_path); |
|
| 1837 | + } catch (Exception $e) {
|
|
| 1838 | 1838 | $exif = array(); |
| 1839 | 1839 | } |
| 1840 | 1840 | } |
@@ -1843,13 +1843,13 @@ discard block |
||
| 1843 | 1843 | $flip = false; |
| 1844 | 1844 | $modify = false; |
| 1845 | 1845 | $orientation = 0; |
| 1846 | - if ( ! empty( $exif ) && isset( $exif['Orientation'] ) ) {
|
|
| 1847 | - switch ( (int) $exif['Orientation'] ) {
|
|
| 1846 | + if (!empty($exif) && isset($exif['Orientation'])) {
|
|
| 1847 | + switch ((int) $exif['Orientation']) {
|
|
| 1848 | 1848 | case 1: |
| 1849 | 1849 | // do nothing |
| 1850 | 1850 | break; |
| 1851 | 1851 | case 2: |
| 1852 | - $flip = array( false, true ); |
|
| 1852 | + $flip = array(false, true); |
|
| 1853 | 1853 | $modify = true; |
| 1854 | 1854 | break; |
| 1855 | 1855 | case 3: |
@@ -1858,13 +1858,13 @@ discard block |
||
| 1858 | 1858 | $modify = true; |
| 1859 | 1859 | break; |
| 1860 | 1860 | case 4: |
| 1861 | - $flip = array( true, false ); |
|
| 1861 | + $flip = array(true, false); |
|
| 1862 | 1862 | $modify = true; |
| 1863 | 1863 | break; |
| 1864 | 1864 | case 5: |
| 1865 | 1865 | $orientation = - 90; |
| 1866 | 1866 | $rotate = true; |
| 1867 | - $flip = array( false, true ); |
|
| 1867 | + $flip = array(false, true); |
|
| 1868 | 1868 | $modify = true; |
| 1869 | 1869 | break; |
| 1870 | 1870 | case 6: |
@@ -1875,7 +1875,7 @@ discard block |
||
| 1875 | 1875 | case 7: |
| 1876 | 1876 | $orientation = - 270; |
| 1877 | 1877 | $rotate = true; |
| 1878 | - $flip = array( false, true ); |
|
| 1878 | + $flip = array(false, true); |
|
| 1879 | 1879 | $modify = true; |
| 1880 | 1880 | break; |
| 1881 | 1881 | case 8: |
@@ -1901,31 +1901,31 @@ discard block |
||
| 1901 | 1901 | * @param int|null $quality Image Compression quality between 1-100% scale. Default null. |
| 1902 | 1902 | * @param string $quality Image mime type. |
| 1903 | 1903 | */ |
| 1904 | - $quality = apply_filters( 'geodir_image_upload_set_quality', $quality, $mime_type ); |
|
| 1905 | - if ( $quality !== null ) {
|
|
| 1904 | + $quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
|
|
| 1905 | + if ($quality !== null) {
|
|
| 1906 | 1906 | $modify = true; |
| 1907 | 1907 | } |
| 1908 | 1908 | |
| 1909 | - if ( ! $modify ) {
|
|
| 1909 | + if (!$modify) {
|
|
| 1910 | 1910 | return $file; // no change |
| 1911 | 1911 | } |
| 1912 | 1912 | |
| 1913 | - $image = wp_get_image_editor( $file_path ); |
|
| 1914 | - if ( ! is_wp_error( $image ) ) {
|
|
| 1915 | - if ( $rotate ) {
|
|
| 1916 | - $image->rotate( $orientation ); |
|
| 1913 | + $image = wp_get_image_editor($file_path); |
|
| 1914 | + if (!is_wp_error($image)) {
|
|
| 1915 | + if ($rotate) {
|
|
| 1916 | + $image->rotate($orientation); |
|
| 1917 | 1917 | } |
| 1918 | 1918 | |
| 1919 | - if ( ! empty( $flip ) ) {
|
|
| 1920 | - $image->flip( $flip[0], $flip[1] ); |
|
| 1919 | + if (!empty($flip)) {
|
|
| 1920 | + $image->flip($flip[0], $flip[1]); |
|
| 1921 | 1921 | } |
| 1922 | 1922 | |
| 1923 | - if ( $quality !== null ) {
|
|
| 1924 | - $image->set_quality( (int) $quality ); |
|
| 1923 | + if ($quality !== null) {
|
|
| 1924 | + $image->set_quality((int) $quality); |
|
| 1925 | 1925 | } |
| 1926 | 1926 | |
| 1927 | - $result = $image->save( $file_path ); |
|
| 1928 | - if ( ! is_wp_error( $result ) ) {
|
|
| 1927 | + $result = $image->save($file_path); |
|
| 1928 | + if (!is_wp_error($result)) {
|
|
| 1929 | 1929 | $file['file'] = $result['path']; |
| 1930 | 1930 | $file['tmp_name'] = $result['path']; |
| 1931 | 1931 | } |
@@ -1952,7 +1952,7 @@ discard block |
||
| 1952 | 1952 | * |
| 1953 | 1953 | * @return string Returns the recent reviews html. |
| 1954 | 1954 | */ |
| 1955 | -function geodir_get_recent_reviews( $g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false ) {
|
|
| 1955 | +function geodir_get_recent_reviews($g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false) {
|
|
| 1956 | 1956 | global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session; |
| 1957 | 1957 | $tablecomments = $wpdb->comments; |
| 1958 | 1958 | $tableposts = $wpdb->posts; |
@@ -1962,28 +1962,28 @@ discard block |
||
| 1962 | 1962 | $region_filter = ''; |
| 1963 | 1963 | $country_filter = ''; |
| 1964 | 1964 | |
| 1965 | - if ( $gd_session->get( 'gd_multi_location' ) ) {
|
|
| 1966 | - if ( $gd_ses_country = $gd_session->get( 'gd_country' ) ) {
|
|
| 1967 | - $country_filter = $wpdb->prepare( " AND r.post_country=%s ", str_replace( "-", " ", $gd_ses_country ) ); |
|
| 1965 | + if ($gd_session->get('gd_multi_location')) {
|
|
| 1966 | + if ($gd_ses_country = $gd_session->get('gd_country')) {
|
|
| 1967 | + $country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
|
|
| 1968 | 1968 | } |
| 1969 | 1969 | |
| 1970 | - if ( $gd_ses_region = $gd_session->get( 'gd_region' ) ) {
|
|
| 1971 | - $region_filter = $wpdb->prepare( " AND r.post_region=%s ", str_replace( "-", " ", $gd_ses_region ) ); |
|
| 1970 | + if ($gd_ses_region = $gd_session->get('gd_region')) {
|
|
| 1971 | + $region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
|
|
| 1972 | 1972 | } |
| 1973 | 1973 | |
| 1974 | - if ( $gd_ses_city = $gd_session->get( 'gd_city' ) ) {
|
|
| 1975 | - $city_filter = $wpdb->prepare( " AND r.post_city=%s ", str_replace( "-", " ", $gd_ses_city ) ); |
|
| 1974 | + if ($gd_ses_city = $gd_session->get('gd_city')) {
|
|
| 1975 | + $city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
|
|
| 1976 | 1976 | } |
| 1977 | 1977 | } |
| 1978 | 1978 | |
| 1979 | 1979 | $review_table = GEODIR_REVIEW_TABLE; |
| 1980 | 1980 | $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"; |
| 1981 | 1981 | |
| 1982 | - $comments = $wpdb->get_results( $request ); |
|
| 1982 | + $comments = $wpdb->get_results($request); |
|
| 1983 | 1983 | |
| 1984 | - foreach ( $comments as $comment ) {
|
|
| 1984 | + foreach ($comments as $comment) {
|
|
| 1985 | 1985 | // Set the extra comment info needed. |
| 1986 | - $comment_extra = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID" ); |
|
| 1986 | + $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
|
|
| 1987 | 1987 | //echo "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID"; |
| 1988 | 1988 | $comment->comment_content = $comment_extra->comment_content; |
| 1989 | 1989 | $comment->comment_author = $comment_extra->comment_author; |
@@ -1991,75 +1991,75 @@ discard block |
||
| 1991 | 1991 | |
| 1992 | 1992 | $comment_id = ''; |
| 1993 | 1993 | $comment_id = $comment->comment_ID; |
| 1994 | - $comment_content = strip_tags( $comment->comment_content ); |
|
| 1994 | + $comment_content = strip_tags($comment->comment_content); |
|
| 1995 | 1995 | |
| 1996 | - $comment_content = preg_replace( '#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content ); |
|
| 1996 | + $comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
|
|
| 1997 | 1997 | |
| 1998 | - $permalink = get_permalink( $comment->ID ) . "#comment-" . $comment->comment_ID; |
|
| 1998 | + $permalink = get_permalink($comment->ID)."#comment-".$comment->comment_ID; |
|
| 1999 | 1999 | $comment_author_email = $comment->comment_author_email; |
| 2000 | 2000 | $comment_post_ID = $comment->post_id; |
| 2001 | 2001 | |
| 2002 | 2002 | $na = true; |
| 2003 | - if ( function_exists( 'icl_object_id' ) && icl_object_id( $comment_post_ID, $comment->post_type, true ) ) {
|
|
| 2004 | - $comment_post_ID2 = icl_object_id( $comment_post_ID, $comment->post_type, false ); |
|
| 2005 | - if ( $comment_post_ID == $comment_post_ID2 ) {
|
|
| 2003 | + if (function_exists('icl_object_id') && icl_object_id($comment_post_ID, $comment->post_type, true)) {
|
|
| 2004 | + $comment_post_ID2 = icl_object_id($comment_post_ID, $comment->post_type, false); |
|
| 2005 | + if ($comment_post_ID == $comment_post_ID2) {
|
|
| 2006 | 2006 | } else {
|
| 2007 | 2007 | $na = false; |
| 2008 | 2008 | } |
| 2009 | 2009 | } |
| 2010 | 2010 | |
| 2011 | - $post_title = get_the_title( $comment_post_ID ); |
|
| 2012 | - $permalink = get_permalink( $comment_post_ID ); |
|
| 2013 | - $comment_permalink = $permalink . "#comment-" . $comment->comment_ID; |
|
| 2014 | - $read_more = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __( 'Read more', 'geodirectory' ) . '</a>'; |
|
| 2011 | + $post_title = get_the_title($comment_post_ID); |
|
| 2012 | + $permalink = get_permalink($comment_post_ID); |
|
| 2013 | + $comment_permalink = $permalink."#comment-".$comment->comment_ID; |
|
| 2014 | + $read_more = '<a class="comment_excerpt" href="'.$comment_permalink.'">'.__('Read more', 'geodirectory').'</a>';
|
|
| 2015 | 2015 | |
| 2016 | - $comment_content_length = strlen( $comment_content ); |
|
| 2017 | - if ( $comment_content_length > $comment_lenth ) {
|
|
| 2018 | - $comment_excerpt = mb_substr( $comment_content, 0, $comment_lenth ) . '... ' . $read_more; |
|
| 2016 | + $comment_content_length = strlen($comment_content); |
|
| 2017 | + if ($comment_content_length > $comment_lenth) {
|
|
| 2018 | + $comment_excerpt = mb_substr($comment_content, 0, $comment_lenth).'... '.$read_more; |
|
| 2019 | 2019 | } else {
|
| 2020 | 2020 | $comment_excerpt = $comment_content; |
| 2021 | 2021 | } |
| 2022 | 2022 | |
| 2023 | - if ( $comment->user_id ) {
|
|
| 2024 | - $user_profile_url = get_author_posts_url( $comment->user_id ); |
|
| 2023 | + if ($comment->user_id) {
|
|
| 2024 | + $user_profile_url = get_author_posts_url($comment->user_id); |
|
| 2025 | 2025 | } else {
|
| 2026 | 2026 | $user_profile_url = ''; |
| 2027 | 2027 | } |
| 2028 | 2028 | |
| 2029 | - if ( $comment_id && $na ) {
|
|
| 2029 | + if ($comment_id && $na) {
|
|
| 2030 | 2030 | $comments_echo .= '<li class="clearfix">'; |
| 2031 | - $comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">"; |
|
| 2032 | - if ( function_exists( 'get_avatar' ) ) {
|
|
| 2033 | - if ( ! isset( $comment->comment_type ) ) {
|
|
| 2034 | - if ( $user_profile_url ) {
|
|
| 2035 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 2031 | + $comments_echo .= "<span class=\"li".$comment_id." geodir_reviewer_image\">"; |
|
| 2032 | + if (function_exists('get_avatar')) {
|
|
| 2033 | + if (!isset($comment->comment_type)) {
|
|
| 2034 | + if ($user_profile_url) {
|
|
| 2035 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
| 2036 | 2036 | } |
| 2037 | - $comments_echo .= get_avatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' ); |
|
| 2038 | - if ( $user_profile_url ) {
|
|
| 2037 | + $comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
| 2038 | + if ($user_profile_url) {
|
|
| 2039 | 2039 | $comments_echo .= '</a>'; |
| 2040 | 2040 | } |
| 2041 | - } elseif ( ( isset( $comment->comment_type ) && $comment->comment_type == 'trackback' ) || ( isset( $comment->comment_type ) && $comment->comment_type == 'pingback' ) ) {
|
|
| 2042 | - if ( $user_profile_url ) {
|
|
| 2043 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 2041 | + } elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
|
|
| 2042 | + if ($user_profile_url) {
|
|
| 2043 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
| 2044 | 2044 | } |
| 2045 | - $comments_echo .= get_avatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' ); |
|
| 2045 | + $comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
| 2046 | 2046 | } |
| 2047 | - } elseif ( function_exists( 'gravatar' ) ) {
|
|
| 2048 | - if ( $user_profile_url ) {
|
|
| 2049 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 2047 | + } elseif (function_exists('gravatar')) {
|
|
| 2048 | + if ($user_profile_url) {
|
|
| 2049 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
| 2050 | 2050 | } |
| 2051 | 2051 | $comments_echo .= "<img src=\""; |
| 2052 | - if ( '' == $comment->comment_type ) {
|
|
| 2053 | - $comments_echo .= gravatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' ); |
|
| 2054 | - if ( $user_profile_url ) {
|
|
| 2052 | + if ('' == $comment->comment_type) {
|
|
| 2053 | + $comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
| 2054 | + if ($user_profile_url) {
|
|
| 2055 | 2055 | $comments_echo .= '</a>'; |
| 2056 | 2056 | } |
| 2057 | - } elseif ( ( 'trackback' == $comment->comment_type ) || ( 'pingback' == $comment->comment_type ) ) {
|
|
| 2058 | - if ( $user_profile_url ) {
|
|
| 2059 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 2057 | + } elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
|
|
| 2058 | + if ($user_profile_url) {
|
|
| 2059 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
| 2060 | 2060 | } |
| 2061 | - $comments_echo .= gravatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' ); |
|
| 2062 | - if ( $user_profile_url ) {
|
|
| 2061 | + $comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
| 2062 | + if ($user_profile_url) {
|
|
| 2063 | 2063 | $comments_echo .= '</a>'; |
| 2064 | 2064 | } |
| 2065 | 2065 | } |
@@ -2069,17 +2069,17 @@ discard block |
||
| 2069 | 2069 | $comments_echo .= "</span>\n"; |
| 2070 | 2070 | |
| 2071 | 2071 | $comments_echo .= '<span class="geodir_reviewer_content">'; |
| 2072 | - if ( $comment->user_id ) {
|
|
| 2073 | - $comments_echo .= '<a href="' . get_author_posts_url( $comment->user_id ) . '">'; |
|
| 2072 | + if ($comment->user_id) {
|
|
| 2073 | + $comments_echo .= '<a href="'.get_author_posts_url($comment->user_id).'">'; |
|
| 2074 | 2074 | } |
| 2075 | - $comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> '; |
|
| 2076 | - if ( $comment->user_id ) {
|
|
| 2075 | + $comments_echo .= '<span class="geodir_reviewer_author">'.$comment->comment_author.'</span> '; |
|
| 2076 | + if ($comment->user_id) {
|
|
| 2077 | 2077 | $comments_echo .= '</a>'; |
| 2078 | 2078 | } |
| 2079 | - $comments_echo .= '<span class="geodir_reviewer_reviewed">' . __( 'reviewed', 'geodirectory' ) . '</span> '; |
|
| 2080 | - $comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>'; |
|
| 2081 | - $comments_echo .= geodir_get_rating_stars( $comment->overall_rating, $comment_post_ID ); |
|
| 2082 | - $comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . ''; |
|
| 2079 | + $comments_echo .= '<span class="geodir_reviewer_reviewed">'.__('reviewed', 'geodirectory').'</span> ';
|
|
| 2080 | + $comments_echo .= '<a href="'.$permalink.'" class="geodir_reviewer_title">'.$post_title.'</a>'; |
|
| 2081 | + $comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID); |
|
| 2082 | + $comments_echo .= '<p class="geodir_reviewer_text">'.$comment_excerpt.''; |
|
| 2083 | 2083 | //echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
|
| 2084 | 2084 | $comments_echo .= '</p>'; |
| 2085 | 2085 | |
@@ -2099,25 +2099,25 @@ discard block |
||
| 2099 | 2099 | * @return array Returns post categories as an array. |
| 2100 | 2100 | */ |
| 2101 | 2101 | function geodir_home_map_cats_key_value_array() {
|
| 2102 | - $post_types = geodir_get_posttypes( 'object' ); |
|
| 2102 | + $post_types = geodir_get_posttypes('object');
|
|
| 2103 | 2103 | |
| 2104 | 2104 | $return = array(); |
| 2105 | - if ( ! empty( $post_types ) ) {
|
|
| 2106 | - foreach ( $post_types as $key => $post_type ) {
|
|
| 2107 | - $cpt_name = __( $post_type->labels->singular_name, 'geodirectory' ); |
|
| 2108 | - $post_type_name = sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name ); |
|
| 2109 | - $taxonomies = geodir_get_taxonomies( $key ); |
|
| 2110 | - $cat_taxonomy = ! empty( $taxonomies[0] ) ? $taxonomies[0] : null; |
|
| 2111 | - $cat_terms = $cat_taxonomy ? get_terms( $cat_taxonomy ) : null; |
|
| 2112 | - |
|
| 2113 | - if ( ! empty( $cat_terms ) ) {
|
|
| 2114 | - $return[ 'optgroup_start-' . $key ] = $post_type_name; |
|
| 2115 | - |
|
| 2116 | - foreach ( $cat_terms as $cat_term ) {
|
|
| 2117 | - $return[ $key . '_' . $cat_term->term_id ] = $cat_term->name; |
|
| 2105 | + if (!empty($post_types)) {
|
|
| 2106 | + foreach ($post_types as $key => $post_type) {
|
|
| 2107 | + $cpt_name = __($post_type->labels->singular_name, 'geodirectory'); |
|
| 2108 | + $post_type_name = sprintf(__('%s Categories', 'geodirectory'), $cpt_name);
|
|
| 2109 | + $taxonomies = geodir_get_taxonomies($key); |
|
| 2110 | + $cat_taxonomy = !empty($taxonomies[0]) ? $taxonomies[0] : null; |
|
| 2111 | + $cat_terms = $cat_taxonomy ? get_terms($cat_taxonomy) : null; |
|
| 2112 | + |
|
| 2113 | + if (!empty($cat_terms)) {
|
|
| 2114 | + $return['optgroup_start-'.$key] = $post_type_name; |
|
| 2115 | + |
|
| 2116 | + foreach ($cat_terms as $cat_term) {
|
|
| 2117 | + $return[$key.'_'.$cat_term->term_id] = $cat_term->name; |
|
| 2118 | 2118 | } |
| 2119 | 2119 | |
| 2120 | - $return[ 'optgroup_end-' . $key ] = $post_type_name; |
|
| 2120 | + $return['optgroup_end-'.$key] = $post_type_name; |
|
| 2121 | 2121 | } |
| 2122 | 2122 | } |
| 2123 | 2123 | } |
@@ -2133,14 +2133,14 @@ discard block |
||
| 2133 | 2133 | * @package GeoDirectory |
| 2134 | 2134 | */ |
| 2135 | 2135 | function geodir_twitter_tweet_button() {
|
| 2136 | - if ( isset( $_GET['gde'] ) ) {
|
|
| 2137 | - $link = '?url=' . urlencode( geodir_curPageURL() ); |
|
| 2136 | + if (isset($_GET['gde'])) {
|
|
| 2137 | + $link = '?url='.urlencode(geodir_curPageURL()); |
|
| 2138 | 2138 | } else {
|
| 2139 | 2139 | $link = ''; |
| 2140 | 2140 | } |
| 2141 | 2141 | ?> |
| 2142 | 2142 | <a href="http://twitter.com/share<?php echo $link; ?>" |
| 2143 | - class="twitter-share-button"><?php _e( 'Tweet', 'geodirectory' ); ?></a> |
|
| 2143 | + class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
|
|
| 2144 | 2144 | <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script> |
| 2145 | 2145 | <?php |
| 2146 | 2146 | } |
@@ -2157,10 +2157,10 @@ discard block |
||
| 2157 | 2157 | function geodir_fb_like_button() {
|
| 2158 | 2158 | global $post; |
| 2159 | 2159 | ?> |
| 2160 | - <iframe <?php if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) ) {
|
|
| 2160 | + <iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
|
|
| 2161 | 2161 | echo 'allowtransparency="true"'; |
| 2162 | 2162 | } ?> class="facebook" |
| 2163 | - src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode( get_permalink( $post->ID ) ); ?>&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light" |
|
| 2163 | + src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light" |
|
| 2164 | 2164 | style="border:none; overflow:hidden; width:100px; height:20px"></iframe> |
| 2165 | 2165 | <?php |
| 2166 | 2166 | } |
@@ -2214,10 +2214,10 @@ discard block |
||
| 2214 | 2214 | stWidget.addEntry({
|
| 2215 | 2215 | "service": "sharethis", |
| 2216 | 2216 | "element": document.getElementById('st_sharethis'),
|
| 2217 | - "url": "<?php echo geodir_curPageURL();?>", |
|
| 2218 | - "title": "<?php echo $post->post_title;?>", |
|
| 2217 | + "url": "<?php echo geodir_curPageURL(); ?>", |
|
| 2218 | + "title": "<?php echo $post->post_title; ?>", |
|
| 2219 | 2219 | "type": "chicklet", |
| 2220 | - "text": "<?php _e( 'Share', 'geodirectory' );?>" |
|
| 2220 | + "text": "<?php _e('Share', 'geodirectory'); ?>"
|
|
| 2221 | 2221 | }); |
| 2222 | 2222 | </script> |
| 2223 | 2223 | </div> |
@@ -2225,7 +2225,7 @@ discard block |
||
| 2225 | 2225 | } |
| 2226 | 2226 | |
| 2227 | 2227 | function geodir_listing_bounce_map_pin_on_hover() {
|
| 2228 | - if ( get_option( 'geodir_listing_hover_bounce_map_pin', true ) ) {
|
|
| 2228 | + if (get_option('geodir_listing_hover_bounce_map_pin', true)) {
|
|
| 2229 | 2229 | ?> |
| 2230 | 2230 | <script> |
| 2231 | 2231 | jQuery(function ($) {
|
@@ -2248,44 +2248,44 @@ discard block |
||
| 2248 | 2248 | } |
| 2249 | 2249 | } |
| 2250 | 2250 | |
| 2251 | -add_action( 'geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10 ); |
|
| 2251 | +add_action('geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10);
|
|
| 2252 | 2252 | |
| 2253 | -add_action( 'geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1 ); |
|
| 2254 | -function geodir_output_favourite_html_listings( $post_id ) {
|
|
| 2255 | - geodir_favourite_html( '', $post_id ); |
|
| 2253 | +add_action('geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1);
|
|
| 2254 | +function geodir_output_favourite_html_listings($post_id) {
|
|
| 2255 | + geodir_favourite_html('', $post_id);
|
|
| 2256 | 2256 | } |
| 2257 | 2257 | |
| 2258 | -add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2 ); |
|
| 2259 | -function geodir_output_pinpoint_html_listings( $post_id, $post ) {
|
|
| 2258 | +add_action('geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2);
|
|
| 2259 | +function geodir_output_pinpoint_html_listings($post_id, $post) {
|
|
| 2260 | 2260 | global $wp_query; |
| 2261 | 2261 | |
| 2262 | 2262 | $show_pin_point = $wp_query->is_main_query(); |
| 2263 | 2263 | |
| 2264 | - if ( ! empty( $show_pin_point ) && is_active_widget( false, "", "geodir_map_v3_listing_map" ) ) {
|
|
| 2265 | - $term_icon_url = get_tax_meta( $post->default_category, 'ct_cat_icon', false, $post->post_type ); |
|
| 2266 | - $marker_icon = isset( $term_icon_url['src'] ) ? $term_icon_url['src'] : get_option( 'geodir_default_marker_icon' ); |
|
| 2264 | + if (!empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
|
|
| 2265 | + $term_icon_url = get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type); |
|
| 2266 | + $marker_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
|
|
| 2267 | 2267 | ?> |
| 2268 | 2268 | <span class="geodir-pinpoint" |
| 2269 | - 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>
|
|
| 2269 | + 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>
|
|
| 2270 | 2270 | <a class="geodir-pinpoint-link" href="javascript:void(0)" |
| 2271 | 2271 | onclick="openMarker('listing_map_canvas' ,'<?php echo $post->ID; ?>')"
|
| 2272 | 2272 | onmouseover="animate_marker('listing_map_canvas' ,'<?php echo $post->ID; ?>')"
|
| 2273 | - onmouseout="stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')"><?php _e( 'Pinpoint', 'geodirectory' ); ?></a>
|
|
| 2273 | + onmouseout="stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')"><?php _e('Pinpoint', 'geodirectory'); ?></a>
|
|
| 2274 | 2274 | <?php |
| 2275 | 2275 | } |
| 2276 | 2276 | } |
| 2277 | 2277 | |
| 2278 | 2278 | function geodir_search_form_submit_button() {
|
| 2279 | 2279 | |
| 2280 | - $new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true; |
|
| 2280 | + $new_style = get_option('geodir_show_search_old_search_from') ? false : true;
|
|
| 2281 | 2281 | |
| 2282 | - if ( $new_style ) {
|
|
| 2282 | + if ($new_style) {
|
|
| 2283 | 2283 | $default_search_button_label = '<i class="fa fa-search" aria-hidden="true"></i>'; |
| 2284 | - }else{
|
|
| 2284 | + } else {
|
|
| 2285 | 2285 | $default_search_button_label = 'Search'; |
| 2286 | 2286 | } |
| 2287 | - if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) {
|
|
| 2288 | - $default_search_button_label = __( get_option( 'geodir_search_button_label' ), 'geodirectory' ); |
|
| 2287 | + if (get_option('geodir_search_button_label') && get_option('geodir_search_button_label') != 'Search') {
|
|
| 2288 | + $default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
|
|
| 2289 | 2289 | } |
| 2290 | 2290 | |
| 2291 | 2291 | /** |
@@ -2297,78 +2297,78 @@ discard block |
||
| 2297 | 2297 | * |
| 2298 | 2298 | * @param string $default_search_button_label The current search button text. |
| 2299 | 2299 | */ |
| 2300 | - $default_search_button_label = apply_filters( 'geodir_search_default_search_button_text', $default_search_button_label ); |
|
| 2300 | + $default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);
|
|
| 2301 | 2301 | |
| 2302 | 2302 | $fa_class = ''; |
| 2303 | - if ( strpos( $default_search_button_label, '&#' ) !== false ) {
|
|
| 2303 | + if (strpos($default_search_button_label, '&#') !== false) {
|
|
| 2304 | 2304 | $fa_class = 'fa'; |
| 2305 | 2305 | } |
| 2306 | 2306 | |
| 2307 | 2307 | |
| 2308 | - if ( $new_style ) {
|
|
| 2308 | + if ($new_style) {
|
|
| 2309 | 2309 | ?> |
| 2310 | - <button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e( $default_search_button_label ,'geodirectory'); ?></button> |
|
| 2311 | -<?php }else{?>
|
|
| 2312 | - <input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>" |
|
| 2310 | + <button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e($default_search_button_label, 'geodirectory'); ?></button> |
|
| 2311 | +<?php } else {?>
|
|
| 2312 | + <input type="button" value="<?php esc_attr_e($default_search_button_label); ?>" |
|
| 2313 | 2313 | class="geodir_submit_search <?php echo $fa_class; ?>"/> |
| 2314 | 2314 | <?php } |
| 2315 | 2315 | } |
| 2316 | 2316 | |
| 2317 | -add_action( 'geodir_before_search_button', 'geodir_search_form_submit_button', 5000 ); |
|
| 2317 | +add_action('geodir_before_search_button', 'geodir_search_form_submit_button', 5000);
|
|
| 2318 | 2318 | |
| 2319 | 2319 | function geodir_search_form_post_type_input() {
|
| 2320 | 2320 | global $geodir_search_post_type; |
| 2321 | - $post_types = apply_filters( 'geodir_search_form_post_types', geodir_get_posttypes( 'object' ) ); |
|
| 2321 | + $post_types = apply_filters('geodir_search_form_post_types', geodir_get_posttypes('object'));
|
|
| 2322 | 2322 | $curr_post_type = $geodir_search_post_type; |
| 2323 | 2323 | |
| 2324 | - if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
|
|
| 2324 | + if (!empty($post_types) && count((array) $post_types) > 1) {
|
|
| 2325 | 2325 | |
| 2326 | - foreach ( $post_types as $post_type => $info ){
|
|
| 2326 | + foreach ($post_types as $post_type => $info) {
|
|
| 2327 | 2327 | global $wpdb; |
| 2328 | - $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) ); |
|
| 2329 | - if ( ! $has_posts ) {
|
|
| 2328 | + $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
|
|
| 2329 | + if (!$has_posts) {
|
|
| 2330 | 2330 | unset($post_types->{$post_type});
|
| 2331 | 2331 | } |
| 2332 | 2332 | } |
| 2333 | 2333 | |
| 2334 | - if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
|
|
| 2334 | + if (!empty($post_types) && count((array) $post_types) > 1) {
|
|
| 2335 | 2335 | |
| 2336 | - $new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true; |
|
| 2337 | - if ( $new_style ) {
|
|
| 2336 | + $new_style = get_option('geodir_show_search_old_search_from') ? false : true;
|
|
| 2337 | + if ($new_style) {
|
|
| 2338 | 2338 | echo "<div class='gd-search-input-wrapper gd-search-field-cpt'>"; |
| 2339 | 2339 | } |
| 2340 | 2340 | ?> |
| 2341 | 2341 | <select name="stype" class="search_by_post"> |
| 2342 | - <?php foreach ( $post_types as $post_type => $info ): |
|
| 2342 | + <?php foreach ($post_types as $post_type => $info): |
|
| 2343 | 2343 | global $wpdb; |
| 2344 | 2344 | ?> |
| 2345 | 2345 | |
| 2346 | - <option data-label="<?php echo get_post_type_archive_link( $post_type ); ?>" |
|
| 2347 | - value="<?php echo $post_type; ?>" <?php if ( isset( $_REQUEST['stype'] ) ) {
|
|
| 2348 | - if ( $post_type == $_REQUEST['stype'] ) {
|
|
| 2346 | + <option data-label="<?php echo get_post_type_archive_link($post_type); ?>" |
|
| 2347 | + value="<?php echo $post_type; ?>" <?php if (isset($_REQUEST['stype'])) {
|
|
| 2348 | + if ($post_type == $_REQUEST['stype']) {
|
|
| 2349 | 2349 | echo 'selected="selected"'; |
| 2350 | 2350 | } |
| 2351 | - } elseif ( $curr_post_type == $post_type ) {
|
|
| 2351 | + } elseif ($curr_post_type == $post_type) {
|
|
| 2352 | 2352 | echo 'selected="selected"'; |
| 2353 | - } ?>><?php _e( ucfirst( $info->labels->name ), 'geodirectory' ); ?></option> |
|
| 2353 | + } ?>><?php _e(ucfirst($info->labels->name), 'geodirectory'); ?></option> |
|
| 2354 | 2354 | |
| 2355 | 2355 | <?php endforeach; ?> |
| 2356 | 2356 | </select> |
| 2357 | 2357 | <?php |
| 2358 | - if ( $new_style ) {
|
|
| 2358 | + if ($new_style) {
|
|
| 2359 | 2359 | echo "</div>"; |
| 2360 | 2360 | } |
| 2361 | - }else{
|
|
| 2362 | - if(! empty( $post_types )){
|
|
| 2363 | - $pt_arr = (array)$post_types; |
|
| 2364 | - echo '<input type="hidden" name="stype" value="' . key( $pt_arr ) . '" />'; |
|
| 2365 | - }else{
|
|
| 2361 | + } else {
|
|
| 2362 | + if (!empty($post_types)) {
|
|
| 2363 | + $pt_arr = (array) $post_types; |
|
| 2364 | + echo '<input type="hidden" name="stype" value="'.key($pt_arr).'" />'; |
|
| 2365 | + } else {
|
|
| 2366 | 2366 | echo '<input type="hidden" name="stype" value="gd_place" />'; |
| 2367 | 2367 | } |
| 2368 | 2368 | |
| 2369 | 2369 | } |
| 2370 | 2370 | |
| 2371 | - }elseif ( ! empty( $post_types ) ) {
|
|
| 2371 | + }elseif (!empty($post_types)) {
|
|
| 2372 | 2372 | echo '<input type="hidden" name="stype" value="gd_place" />'; |
| 2373 | 2373 | } |
| 2374 | 2374 | } |
@@ -2376,26 +2376,26 @@ discard block |
||
| 2376 | 2376 | function geodir_search_form_search_input() {
|
| 2377 | 2377 | |
| 2378 | 2378 | $default_search_for_text = SEARCH_FOR_TEXT; |
| 2379 | - if ( get_option( 'geodir_search_field_default_text' ) ) {
|
|
| 2380 | - $default_search_for_text = __( get_option( 'geodir_search_field_default_text' ), 'geodirectory' ); |
|
| 2379 | + if (get_option('geodir_search_field_default_text')) {
|
|
| 2380 | + $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
|
|
| 2381 | 2381 | } |
| 2382 | 2382 | |
| 2383 | 2383 | $new_style = get_option('geodir_show_search_old_search_from') ? false : true;
|
| 2384 | - if($new_style){
|
|
| 2384 | + if ($new_style) {
|
|
| 2385 | 2385 | echo "<div class='gd-search-input-wrapper gd-search-field-search'>"; |
| 2386 | 2386 | } |
| 2387 | 2387 | ?> |
| 2388 | 2388 | <input class="search_text" name="s" |
| 2389 | - value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) {
|
|
| 2390 | - echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) ); |
|
| 2389 | + value="<?php if (isset($_REQUEST['s']) && trim($_REQUEST['s']) != '') {
|
|
| 2390 | + echo esc_attr(stripslashes_deep($_REQUEST['s'])); |
|
| 2391 | 2391 | } else {
|
| 2392 | 2392 | echo $default_search_for_text; |
| 2393 | 2393 | } ?>" type="text" |
| 2394 | - onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}"
|
|
| 2395 | - onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}"
|
|
| 2394 | + onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql($default_search_for_text); ?>';}"
|
|
| 2395 | + onfocus="if (this.value == '<?php echo esc_sql($default_search_for_text); ?>') {this.value = '';}"
|
|
| 2396 | 2396 | onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);"> |
| 2397 | 2397 | <?php |
| 2398 | - if($new_style){
|
|
| 2398 | + if ($new_style) {
|
|
| 2399 | 2399 | echo "</div>"; |
| 2400 | 2400 | } |
| 2401 | 2401 | } |
@@ -2403,12 +2403,12 @@ discard block |
||
| 2403 | 2403 | function geodir_search_form_near_input() {
|
| 2404 | 2404 | |
| 2405 | 2405 | $default_near_text = NEAR_TEXT; |
| 2406 | - if ( get_option( 'geodir_near_field_default_text' ) ) {
|
|
| 2407 | - $default_near_text = __( get_option( 'geodir_near_field_default_text' ), 'geodirectory' ); |
|
| 2406 | + if (get_option('geodir_near_field_default_text')) {
|
|
| 2407 | + $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
|
|
| 2408 | 2408 | } |
| 2409 | 2409 | |
| 2410 | - if ( isset( $_REQUEST['snear'] ) && $_REQUEST['snear'] != '' ) {
|
|
| 2411 | - $near = esc_attr( stripslashes_deep( $_REQUEST['snear'] ) ); |
|
| 2410 | + if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') {
|
|
| 2411 | + $near = esc_attr(stripslashes_deep($_REQUEST['snear'])); |
|
| 2412 | 2412 | } else {
|
| 2413 | 2413 | $near = $default_near_text; |
| 2414 | 2414 | } |
@@ -2422,7 +2422,7 @@ discard block |
||
| 2422 | 2422 | * @since 1.6.9 |
| 2423 | 2423 | * @param string $curr_post_type The current post type. |
| 2424 | 2424 | */ |
| 2425 | - $near_input_extra = apply_filters('geodir_near_input_extra','',$curr_post_type);
|
|
| 2425 | + $near_input_extra = apply_filters('geodir_near_input_extra', '', $curr_post_type);
|
|
| 2426 | 2426 | |
| 2427 | 2427 | |
| 2428 | 2428 | /** |
@@ -2435,7 +2435,7 @@ discard block |
||
| 2435 | 2435 | * @param string $near The current near value. |
| 2436 | 2436 | * @param string $default_near_text The default near value. |
| 2437 | 2437 | */ |
| 2438 | - $near = apply_filters( 'geodir_search_near_text', $near, $default_near_text ); |
|
| 2438 | + $near = apply_filters('geodir_search_near_text', $near, $default_near_text);
|
|
| 2439 | 2439 | /** |
| 2440 | 2440 | * Filter the default "Near" text value for the search form. |
| 2441 | 2441 | * |
@@ -2446,7 +2446,7 @@ discard block |
||
| 2446 | 2446 | * @param string $near The current near value. |
| 2447 | 2447 | * @param string $default_near_text The default near value. |
| 2448 | 2448 | */ |
| 2449 | - $default_near_text = apply_filters( 'geodir_search_default_near_text', $default_near_text, $near ); |
|
| 2449 | + $default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near);
|
|
| 2450 | 2450 | /** |
| 2451 | 2451 | * Filter the class for the near search input. |
| 2452 | 2452 | * |
@@ -2454,10 +2454,10 @@ discard block |
||
| 2454 | 2454 | * |
| 2455 | 2455 | * @param string $class The class for the HTML near input, default is blank. |
| 2456 | 2456 | */ |
| 2457 | - $near_class = apply_filters( 'geodir_search_near_class', '' ); |
|
| 2457 | + $near_class = apply_filters('geodir_search_near_class', '');
|
|
| 2458 | 2458 | |
| 2459 | 2459 | $new_style = get_option('geodir_show_search_old_search_from') ? false : true;
|
| 2460 | - if($new_style){
|
|
| 2460 | + if ($new_style) {
|
|
| 2461 | 2461 | echo "<div class='gd-search-input-wrapper gd-search-field-near' $near_input_extra>"; |
| 2462 | 2462 | |
| 2463 | 2463 | do_action('geodir_before_near_input');
|
@@ -2465,30 +2465,30 @@ discard block |
||
| 2465 | 2465 | |
| 2466 | 2466 | ?> |
| 2467 | 2467 | <input name="snear" class="snear <?php echo $near_class; ?>" type="text" value="<?php echo $near; ?>" |
| 2468 | - onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql( $near ); ?>' != '' ? '<?php echo esc_sql( $near ); ?>' : '<?php echo $default_near_text; ?>');}"
|
|
| 2469 | - onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql( $near ); ?>') {this.value = '';}"
|
|
| 2470 | - onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra;?>/> |
|
| 2468 | + onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql($near); ?>' != '' ? '<?php echo esc_sql($near); ?>' : '<?php echo $default_near_text; ?>');}"
|
|
| 2469 | + onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql($near); ?>') {this.value = '';}"
|
|
| 2470 | + onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra; ?>/> |
|
| 2471 | 2471 | <?php |
| 2472 | - if($new_style){
|
|
| 2472 | + if ($new_style) {
|
|
| 2473 | 2473 | do_action('geodir_after_near_input');
|
| 2474 | 2474 | |
| 2475 | 2475 | echo "</div>"; |
| 2476 | 2476 | } |
| 2477 | 2477 | } |
| 2478 | 2478 | |
| 2479 | -add_action( 'geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10 ); |
|
| 2480 | -add_action( 'geodir_search_form_inputs', 'geodir_search_form_search_input', 20 ); |
|
| 2481 | -add_action( 'geodir_search_form_inputs', 'geodir_search_form_near_input', 30 ); |
|
| 2479 | +add_action('geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10);
|
|
| 2480 | +add_action('geodir_search_form_inputs', 'geodir_search_form_search_input', 20);
|
|
| 2481 | +add_action('geodir_search_form_inputs', 'geodir_search_form_near_input', 30);
|
|
| 2482 | 2482 | |
| 2483 | -function geodir_get_search_post_type($pt=''){
|
|
| 2483 | +function geodir_get_search_post_type($pt = '') {
|
|
| 2484 | 2484 | global $geodir_search_post_type; |
| 2485 | 2485 | |
| 2486 | - if($pt!=''){return $geodir_search_post_type = $pt;}
|
|
| 2487 | - if(!empty($geodir_search_post_type)){ return $geodir_search_post_type;}
|
|
| 2486 | + if ($pt != '') {return $geodir_search_post_type = $pt; }
|
|
| 2487 | + if (!empty($geodir_search_post_type)) { return $geodir_search_post_type; }
|
|
| 2488 | 2488 | |
| 2489 | 2489 | $geodir_search_post_type = geodir_get_current_posttype(); |
| 2490 | 2490 | |
| 2491 | - if(!$geodir_search_post_type) {
|
|
| 2491 | + if (!$geodir_search_post_type) {
|
|
| 2492 | 2492 | $geodir_search_post_type = geodir_get_default_posttype(); |
| 2493 | 2493 | } |
| 2494 | 2494 | |
@@ -2496,7 +2496,7 @@ discard block |
||
| 2496 | 2496 | return $geodir_search_post_type; |
| 2497 | 2497 | } |
| 2498 | 2498 | |
| 2499 | -function geodir_search_form(){
|
|
| 2499 | +function geodir_search_form() {
|
|
| 2500 | 2500 | |
| 2501 | 2501 | geodir_get_search_post_type(); |
| 2502 | 2502 | |
@@ -2506,5 +2506,5 @@ discard block |
||
| 2506 | 2506 | die(); |
| 2507 | 2507 | } |
| 2508 | 2508 | |
| 2509 | -add_action( 'wp_ajax_geodir_search_form', 'geodir_search_form' ); |
|
| 2510 | -add_action( 'wp_ajax_nopriv_geodir_search_form', 'geodir_search_form' ); |
|
| 2511 | 2509 | \ No newline at end of file |
| 2510 | +add_action('wp_ajax_geodir_search_form', 'geodir_search_form');
|
|
| 2511 | +add_action('wp_ajax_nopriv_geodir_search_form', 'geodir_search_form'); |
|
| 2512 | 2512 | \ No newline at end of file |
@@ -21,84 +21,84 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | function geodir_cf_checkbox($html,$location,$cf,$p=''){ |
| 23 | 23 | |
| 24 | - // check we have the post value |
|
| 25 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 26 | - else{ global $post;} |
|
| 27 | - |
|
| 28 | - if(!is_array($cf) && $cf!=''){ |
|
| 29 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 30 | - if(!$cf){return NULL;} |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - $html_var = $cf['htmlvar_name']; |
|
| 34 | - |
|
| 35 | - // Check if there is a location specific filter. |
|
| 36 | - if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){ |
|
| 37 | - /** |
|
| 38 | - * Filter the checkbox html by location. |
|
| 39 | - * |
|
| 40 | - * @param string $html The html to filter. |
|
| 41 | - * @param array $cf The custom field array. |
|
| 42 | - * @since 1.6.6 |
|
| 43 | - */ |
|
| 44 | - $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf); |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - // Check if there is a custom field specific filter. |
|
| 48 | - if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){ |
|
| 49 | - /** |
|
| 50 | - * Filter the checkbox html by individual custom field. |
|
| 51 | - * |
|
| 52 | - * @param string $html The html to filter. |
|
| 53 | - * @param string $location The location to output the html. |
|
| 54 | - * @param array $cf The custom field array. |
|
| 55 | - * @since 1.6.6 |
|
| 56 | - */ |
|
| 57 | - $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf); |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - // Check if there is a custom field key specific filter. |
|
| 61 | - if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){ |
|
| 62 | - /** |
|
| 63 | - * Filter the checkbox html by field type key. |
|
| 64 | - * |
|
| 65 | - * @param string $html The html to filter. |
|
| 66 | - * @param string $location The location to output the html. |
|
| 67 | - * @param array $cf The custom field array. |
|
| 68 | - * @since 1.6.6 |
|
| 69 | - */ |
|
| 70 | - $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - // If not html then we run the standard output. |
|
| 74 | - if(empty($html)){ |
|
| 75 | - |
|
| 76 | - if ( (int) $post->{$html_var} == 1 ): |
|
| 77 | - |
|
| 78 | - if ( $post->{$html_var} == '1' ): |
|
| 79 | - $html_val = __( 'Yes', 'geodirectory' ); |
|
| 80 | - else: |
|
| 81 | - $html_val = __( 'No', 'geodirectory' ); |
|
| 82 | - endif; |
|
| 83 | - |
|
| 84 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 85 | - if (strpos($field_icon, 'http') !== false) { |
|
| 86 | - $field_icon_af = ''; |
|
| 87 | - } elseif ($field_icon == '') { |
|
| 88 | - $field_icon_af = ''; |
|
| 89 | - } else { |
|
| 90 | - $field_icon_af = $field_icon; |
|
| 91 | - $field_icon = ''; |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af; |
|
| 95 | - $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : ''; |
|
| 96 | - $html .= '</span>' . $html_val . '</div>'; |
|
| 97 | - endif; |
|
| 98 | - |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - return $html; |
|
| 24 | + // check we have the post value |
|
| 25 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 26 | + else{ global $post;} |
|
| 27 | + |
|
| 28 | + if(!is_array($cf) && $cf!=''){ |
|
| 29 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 30 | + if(!$cf){return NULL;} |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + $html_var = $cf['htmlvar_name']; |
|
| 34 | + |
|
| 35 | + // Check if there is a location specific filter. |
|
| 36 | + if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){ |
|
| 37 | + /** |
|
| 38 | + * Filter the checkbox html by location. |
|
| 39 | + * |
|
| 40 | + * @param string $html The html to filter. |
|
| 41 | + * @param array $cf The custom field array. |
|
| 42 | + * @since 1.6.6 |
|
| 43 | + */ |
|
| 44 | + $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf); |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + // Check if there is a custom field specific filter. |
|
| 48 | + if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){ |
|
| 49 | + /** |
|
| 50 | + * Filter the checkbox html by individual custom field. |
|
| 51 | + * |
|
| 52 | + * @param string $html The html to filter. |
|
| 53 | + * @param string $location The location to output the html. |
|
| 54 | + * @param array $cf The custom field array. |
|
| 55 | + * @since 1.6.6 |
|
| 56 | + */ |
|
| 57 | + $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf); |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + // Check if there is a custom field key specific filter. |
|
| 61 | + if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){ |
|
| 62 | + /** |
|
| 63 | + * Filter the checkbox html by field type key. |
|
| 64 | + * |
|
| 65 | + * @param string $html The html to filter. |
|
| 66 | + * @param string $location The location to output the html. |
|
| 67 | + * @param array $cf The custom field array. |
|
| 68 | + * @since 1.6.6 |
|
| 69 | + */ |
|
| 70 | + $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + // If not html then we run the standard output. |
|
| 74 | + if(empty($html)){ |
|
| 75 | + |
|
| 76 | + if ( (int) $post->{$html_var} == 1 ): |
|
| 77 | + |
|
| 78 | + if ( $post->{$html_var} == '1' ): |
|
| 79 | + $html_val = __( 'Yes', 'geodirectory' ); |
|
| 80 | + else: |
|
| 81 | + $html_val = __( 'No', 'geodirectory' ); |
|
| 82 | + endif; |
|
| 83 | + |
|
| 84 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 85 | + if (strpos($field_icon, 'http') !== false) { |
|
| 86 | + $field_icon_af = ''; |
|
| 87 | + } elseif ($field_icon == '') { |
|
| 88 | + $field_icon_af = ''; |
|
| 89 | + } else { |
|
| 90 | + $field_icon_af = $field_icon; |
|
| 91 | + $field_icon = ''; |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af; |
|
| 95 | + $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : ''; |
|
| 96 | + $html .= '</span>' . $html_val . '</div>'; |
|
| 97 | + endif; |
|
| 98 | + |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + return $html; |
|
| 102 | 102 | } |
| 103 | 103 | add_filter('geodir_custom_field_output_checkbox','geodir_cf_checkbox',10,3); |
| 104 | 104 | |
@@ -115,71 +115,71 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | function geodir_cf_fieldset($html,$location,$cf,$p=''){ |
| 117 | 117 | |
| 118 | - // check we have the post value |
|
| 119 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 120 | - else{ global $post;} |
|
| 121 | - |
|
| 122 | - if(!is_array($cf) && $cf!=''){ |
|
| 123 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 124 | - if(!$cf){return NULL;} |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - $html_var = $cf['htmlvar_name']; |
|
| 128 | - |
|
| 129 | - // Check if there is a location specific filter. |
|
| 130 | - if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){ |
|
| 131 | - /** |
|
| 132 | - * Filter the fieldset html by location. |
|
| 133 | - * |
|
| 134 | - * @param string $html The html to filter. |
|
| 135 | - * @param array $cf The custom field array. |
|
| 136 | - * @since 1.6.6 |
|
| 137 | - */ |
|
| 138 | - $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf); |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - // Check if there is a custom field specific filter. |
|
| 142 | - if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){ |
|
| 143 | - /** |
|
| 144 | - * Filter the fieldset html by individual custom field. |
|
| 145 | - * |
|
| 146 | - * @param string $html The html to filter. |
|
| 147 | - * @param string $location The location to output the html. |
|
| 148 | - * @param array $cf The custom field array. |
|
| 149 | - * @since 1.6.6 |
|
| 150 | - */ |
|
| 151 | - $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf); |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - // Check if there is a custom field key specific filter. |
|
| 155 | - if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){ |
|
| 156 | - /** |
|
| 157 | - * Filter the fieldset html by field type key. |
|
| 158 | - * |
|
| 159 | - * @param string $html The html to filter. |
|
| 160 | - * @param string $location The location to output the html. |
|
| 161 | - * @param array $cf The custom field array. |
|
| 162 | - * @since 1.6.6 |
|
| 163 | - */ |
|
| 164 | - $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - // If not html then we run the standard output. |
|
| 168 | - if(empty($html)){ |
|
| 169 | - |
|
| 170 | - global $field_set_start; |
|
| 171 | - $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']); |
|
| 172 | - |
|
| 173 | - if ($field_set_start == 1) { |
|
| 174 | - $html = ''; |
|
| 175 | - } else { |
|
| 176 | - $html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>'; |
|
| 177 | - //$field_set_start = 1; |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - } |
|
| 181 | - |
|
| 182 | - return $html; |
|
| 118 | + // check we have the post value |
|
| 119 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 120 | + else{ global $post;} |
|
| 121 | + |
|
| 122 | + if(!is_array($cf) && $cf!=''){ |
|
| 123 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 124 | + if(!$cf){return NULL;} |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + $html_var = $cf['htmlvar_name']; |
|
| 128 | + |
|
| 129 | + // Check if there is a location specific filter. |
|
| 130 | + if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){ |
|
| 131 | + /** |
|
| 132 | + * Filter the fieldset html by location. |
|
| 133 | + * |
|
| 134 | + * @param string $html The html to filter. |
|
| 135 | + * @param array $cf The custom field array. |
|
| 136 | + * @since 1.6.6 |
|
| 137 | + */ |
|
| 138 | + $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf); |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + // Check if there is a custom field specific filter. |
|
| 142 | + if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){ |
|
| 143 | + /** |
|
| 144 | + * Filter the fieldset html by individual custom field. |
|
| 145 | + * |
|
| 146 | + * @param string $html The html to filter. |
|
| 147 | + * @param string $location The location to output the html. |
|
| 148 | + * @param array $cf The custom field array. |
|
| 149 | + * @since 1.6.6 |
|
| 150 | + */ |
|
| 151 | + $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf); |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + // Check if there is a custom field key specific filter. |
|
| 155 | + if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){ |
|
| 156 | + /** |
|
| 157 | + * Filter the fieldset html by field type key. |
|
| 158 | + * |
|
| 159 | + * @param string $html The html to filter. |
|
| 160 | + * @param string $location The location to output the html. |
|
| 161 | + * @param array $cf The custom field array. |
|
| 162 | + * @since 1.6.6 |
|
| 163 | + */ |
|
| 164 | + $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + // If not html then we run the standard output. |
|
| 168 | + if(empty($html)){ |
|
| 169 | + |
|
| 170 | + global $field_set_start; |
|
| 171 | + $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']); |
|
| 172 | + |
|
| 173 | + if ($field_set_start == 1) { |
|
| 174 | + $html = ''; |
|
| 175 | + } else { |
|
| 176 | + $html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>'; |
|
| 177 | + //$field_set_start = 1; |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + } |
|
| 181 | + |
|
| 182 | + return $html; |
|
| 183 | 183 | } |
| 184 | 184 | add_filter('geodir_custom_field_output_fieldset','geodir_cf_fieldset',10,3); |
| 185 | 185 | |
@@ -196,106 +196,106 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | function geodir_cf_url($html,$location,$cf,$p=''){ |
| 198 | 198 | |
| 199 | - // check we have the post value |
|
| 200 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 201 | - else{ global $post;} |
|
| 202 | - |
|
| 203 | - if(!is_array($cf) && $cf!=''){ |
|
| 204 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 205 | - if(!$cf){return NULL;} |
|
| 206 | - } |
|
| 207 | - |
|
| 208 | - $html_var = $cf['htmlvar_name']; |
|
| 209 | - |
|
| 210 | - // Check if there is a location specific filter. |
|
| 211 | - if(has_filter("geodir_custom_field_output_url_loc_{$location}")){ |
|
| 212 | - /** |
|
| 213 | - * Filter the url html by location. |
|
| 214 | - * |
|
| 215 | - * @param string $html The html to filter. |
|
| 216 | - * @param array $cf The custom field array. |
|
| 217 | - * @since 1.6.6 |
|
| 218 | - */ |
|
| 219 | - $html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf); |
|
| 220 | - } |
|
| 221 | - |
|
| 222 | - // Check if there is a custom field specific filter. |
|
| 223 | - if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){ |
|
| 224 | - /** |
|
| 225 | - * Filter the url html by individual custom field. |
|
| 226 | - * |
|
| 227 | - * @param string $html The html to filter. |
|
| 228 | - * @param string $location The location to output the html. |
|
| 229 | - * @param array $cf The custom field array. |
|
| 230 | - * @since 1.6.6 |
|
| 231 | - */ |
|
| 232 | - $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf); |
|
| 233 | - } |
|
| 234 | - |
|
| 235 | - // Check if there is a custom field key specific filter. |
|
| 236 | - if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){ |
|
| 237 | - /** |
|
| 238 | - * Filter the url html by field type key. |
|
| 239 | - * |
|
| 240 | - * @param string $html The html to filter. |
|
| 241 | - * @param string $location The location to output the html. |
|
| 242 | - * @param array $cf The custom field array. |
|
| 243 | - * @since 1.6.6 |
|
| 244 | - */ |
|
| 245 | - $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - // If not html then we run the standard output. |
|
| 249 | - if(empty($html)){ |
|
| 250 | - |
|
| 251 | - if ($post->{$cf['htmlvar_name']}): |
|
| 252 | - |
|
| 253 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 254 | - if (strpos($field_icon, 'http') !== false) { |
|
| 255 | - $field_icon_af = ''; |
|
| 256 | - } elseif ($field_icon == '') { |
|
| 257 | - |
|
| 258 | - if ($cf['name'] == 'geodir_facebook') { |
|
| 259 | - $field_icon_af = '<i class="fa fa-facebook-square"></i>'; |
|
| 260 | - } elseif ($cf['name'] == 'geodir_twitter') { |
|
| 261 | - $field_icon_af = '<i class="fa fa-twitter-square"></i>'; |
|
| 262 | - } else { |
|
| 263 | - $field_icon_af = '<i class="fa fa-link"></i>'; |
|
| 264 | - } |
|
| 265 | - |
|
| 266 | - } else { |
|
| 267 | - $field_icon_af = $field_icon; |
|
| 268 | - $field_icon = ''; |
|
| 269 | - } |
|
| 270 | - |
|
| 271 | - $a_url = geodir_parse_custom_field_url($post->{$cf['htmlvar_name']}); |
|
| 272 | - |
|
| 273 | - |
|
| 274 | - $website = !empty($a_url['url']) ? $a_url['url'] : ''; |
|
| 275 | - $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title']; |
|
| 276 | - if(!empty($cf['default_value'])){$title = $cf['default_value'];} |
|
| 277 | - $title = $title != '' ? __(stripslashes($title), 'geodirectory') : ''; |
|
| 278 | - |
|
| 279 | - |
|
| 280 | - |
|
| 281 | - // all search engines that use the nofollow value exclude links that use it from their ranking calculation |
|
| 282 | - $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"'; |
|
| 283 | - /** |
|
| 284 | - * Filter custom field website name. |
|
| 285 | - * |
|
| 286 | - * @since 1.0.0 |
|
| 287 | - * |
|
| 288 | - * @param string $title Website Title. |
|
| 289 | - * @param string $website Website URL. |
|
| 290 | - * @param int $post->ID Post ID. |
|
| 291 | - */ |
|
| 292 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>'; |
|
| 293 | - |
|
| 294 | - endif; |
|
| 295 | - |
|
| 296 | - } |
|
| 297 | - |
|
| 298 | - return $html; |
|
| 199 | + // check we have the post value |
|
| 200 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 201 | + else{ global $post;} |
|
| 202 | + |
|
| 203 | + if(!is_array($cf) && $cf!=''){ |
|
| 204 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 205 | + if(!$cf){return NULL;} |
|
| 206 | + } |
|
| 207 | + |
|
| 208 | + $html_var = $cf['htmlvar_name']; |
|
| 209 | + |
|
| 210 | + // Check if there is a location specific filter. |
|
| 211 | + if(has_filter("geodir_custom_field_output_url_loc_{$location}")){ |
|
| 212 | + /** |
|
| 213 | + * Filter the url html by location. |
|
| 214 | + * |
|
| 215 | + * @param string $html The html to filter. |
|
| 216 | + * @param array $cf The custom field array. |
|
| 217 | + * @since 1.6.6 |
|
| 218 | + */ |
|
| 219 | + $html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf); |
|
| 220 | + } |
|
| 221 | + |
|
| 222 | + // Check if there is a custom field specific filter. |
|
| 223 | + if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){ |
|
| 224 | + /** |
|
| 225 | + * Filter the url html by individual custom field. |
|
| 226 | + * |
|
| 227 | + * @param string $html The html to filter. |
|
| 228 | + * @param string $location The location to output the html. |
|
| 229 | + * @param array $cf The custom field array. |
|
| 230 | + * @since 1.6.6 |
|
| 231 | + */ |
|
| 232 | + $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf); |
|
| 233 | + } |
|
| 234 | + |
|
| 235 | + // Check if there is a custom field key specific filter. |
|
| 236 | + if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){ |
|
| 237 | + /** |
|
| 238 | + * Filter the url html by field type key. |
|
| 239 | + * |
|
| 240 | + * @param string $html The html to filter. |
|
| 241 | + * @param string $location The location to output the html. |
|
| 242 | + * @param array $cf The custom field array. |
|
| 243 | + * @since 1.6.6 |
|
| 244 | + */ |
|
| 245 | + $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + // If not html then we run the standard output. |
|
| 249 | + if(empty($html)){ |
|
| 250 | + |
|
| 251 | + if ($post->{$cf['htmlvar_name']}): |
|
| 252 | + |
|
| 253 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 254 | + if (strpos($field_icon, 'http') !== false) { |
|
| 255 | + $field_icon_af = ''; |
|
| 256 | + } elseif ($field_icon == '') { |
|
| 257 | + |
|
| 258 | + if ($cf['name'] == 'geodir_facebook') { |
|
| 259 | + $field_icon_af = '<i class="fa fa-facebook-square"></i>'; |
|
| 260 | + } elseif ($cf['name'] == 'geodir_twitter') { |
|
| 261 | + $field_icon_af = '<i class="fa fa-twitter-square"></i>'; |
|
| 262 | + } else { |
|
| 263 | + $field_icon_af = '<i class="fa fa-link"></i>'; |
|
| 264 | + } |
|
| 265 | + |
|
| 266 | + } else { |
|
| 267 | + $field_icon_af = $field_icon; |
|
| 268 | + $field_icon = ''; |
|
| 269 | + } |
|
| 270 | + |
|
| 271 | + $a_url = geodir_parse_custom_field_url($post->{$cf['htmlvar_name']}); |
|
| 272 | + |
|
| 273 | + |
|
| 274 | + $website = !empty($a_url['url']) ? $a_url['url'] : ''; |
|
| 275 | + $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title']; |
|
| 276 | + if(!empty($cf['default_value'])){$title = $cf['default_value'];} |
|
| 277 | + $title = $title != '' ? __(stripslashes($title), 'geodirectory') : ''; |
|
| 278 | + |
|
| 279 | + |
|
| 280 | + |
|
| 281 | + // all search engines that use the nofollow value exclude links that use it from their ranking calculation |
|
| 282 | + $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"'; |
|
| 283 | + /** |
|
| 284 | + * Filter custom field website name. |
|
| 285 | + * |
|
| 286 | + * @since 1.0.0 |
|
| 287 | + * |
|
| 288 | + * @param string $title Website Title. |
|
| 289 | + * @param string $website Website URL. |
|
| 290 | + * @param int $post->ID Post ID. |
|
| 291 | + */ |
|
| 292 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>'; |
|
| 293 | + |
|
| 294 | + endif; |
|
| 295 | + |
|
| 296 | + } |
|
| 297 | + |
|
| 298 | + return $html; |
|
| 299 | 299 | } |
| 300 | 300 | add_filter('geodir_custom_field_output_url','geodir_cf_url',10,3); |
| 301 | 301 | |
@@ -312,80 +312,80 @@ discard block |
||
| 312 | 312 | */ |
| 313 | 313 | function geodir_cf_phone($html,$location,$cf,$p=''){ |
| 314 | 314 | |
| 315 | - // check we have the post value |
|
| 316 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 317 | - else{ global $post;} |
|
| 318 | - |
|
| 319 | - if(!is_array($cf) && $cf!=''){ |
|
| 320 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 321 | - if(!$cf){return NULL;} |
|
| 322 | - } |
|
| 323 | - |
|
| 324 | - $html_var = $cf['htmlvar_name']; |
|
| 325 | - |
|
| 326 | - // Check if there is a location specific filter. |
|
| 327 | - if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){ |
|
| 328 | - /** |
|
| 329 | - * Filter the phone html by location. |
|
| 330 | - * |
|
| 331 | - * @param string $html The html to filter. |
|
| 332 | - * @param array $cf The custom field array. |
|
| 333 | - * @since 1.6.6 |
|
| 334 | - */ |
|
| 335 | - $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf); |
|
| 336 | - } |
|
| 337 | - |
|
| 338 | - // Check if there is a custom field specific filter. |
|
| 339 | - if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){ |
|
| 340 | - /** |
|
| 341 | - * Filter the phone html by individual custom field. |
|
| 342 | - * |
|
| 343 | - * @param string $html The html to filter. |
|
| 344 | - * @param string $location The location to output the html. |
|
| 345 | - * @param array $cf The custom field array. |
|
| 346 | - * @since 1.6.6 |
|
| 347 | - */ |
|
| 348 | - $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf); |
|
| 349 | - } |
|
| 350 | - |
|
| 351 | - // Check if there is a custom field key specific filter. |
|
| 352 | - if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){ |
|
| 353 | - /** |
|
| 354 | - * Filter the phone html by field type key. |
|
| 355 | - * |
|
| 356 | - * @param string $html The html to filter. |
|
| 357 | - * @param string $location The location to output the html. |
|
| 358 | - * @param array $cf The custom field array. |
|
| 359 | - * @since 1.6.6 |
|
| 360 | - */ |
|
| 361 | - $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 362 | - } |
|
| 363 | - |
|
| 364 | - // If not html then we run the standard output. |
|
| 365 | - if(empty($html)){ |
|
| 366 | - |
|
| 367 | - if ($post->{$cf['htmlvar_name']}): |
|
| 368 | - |
|
| 369 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 370 | - if (strpos($field_icon, 'http') !== false) { |
|
| 371 | - $field_icon_af = ''; |
|
| 372 | - } elseif ($field_icon == '') { |
|
| 373 | - $field_icon_af = '<i class="fa fa-phone"></i>'; |
|
| 374 | - } else { |
|
| 375 | - $field_icon_af = $field_icon; |
|
| 376 | - $field_icon = ''; |
|
| 377 | - } |
|
| 378 | - |
|
| 379 | - |
|
| 380 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af . |
|
| 381 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 382 | - $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>'; |
|
| 383 | - |
|
| 384 | - endif; |
|
| 385 | - |
|
| 386 | - } |
|
| 387 | - |
|
| 388 | - return $html; |
|
| 315 | + // check we have the post value |
|
| 316 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 317 | + else{ global $post;} |
|
| 318 | + |
|
| 319 | + if(!is_array($cf) && $cf!=''){ |
|
| 320 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 321 | + if(!$cf){return NULL;} |
|
| 322 | + } |
|
| 323 | + |
|
| 324 | + $html_var = $cf['htmlvar_name']; |
|
| 325 | + |
|
| 326 | + // Check if there is a location specific filter. |
|
| 327 | + if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){ |
|
| 328 | + /** |
|
| 329 | + * Filter the phone html by location. |
|
| 330 | + * |
|
| 331 | + * @param string $html The html to filter. |
|
| 332 | + * @param array $cf The custom field array. |
|
| 333 | + * @since 1.6.6 |
|
| 334 | + */ |
|
| 335 | + $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf); |
|
| 336 | + } |
|
| 337 | + |
|
| 338 | + // Check if there is a custom field specific filter. |
|
| 339 | + if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){ |
|
| 340 | + /** |
|
| 341 | + * Filter the phone html by individual custom field. |
|
| 342 | + * |
|
| 343 | + * @param string $html The html to filter. |
|
| 344 | + * @param string $location The location to output the html. |
|
| 345 | + * @param array $cf The custom field array. |
|
| 346 | + * @since 1.6.6 |
|
| 347 | + */ |
|
| 348 | + $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf); |
|
| 349 | + } |
|
| 350 | + |
|
| 351 | + // Check if there is a custom field key specific filter. |
|
| 352 | + if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){ |
|
| 353 | + /** |
|
| 354 | + * Filter the phone html by field type key. |
|
| 355 | + * |
|
| 356 | + * @param string $html The html to filter. |
|
| 357 | + * @param string $location The location to output the html. |
|
| 358 | + * @param array $cf The custom field array. |
|
| 359 | + * @since 1.6.6 |
|
| 360 | + */ |
|
| 361 | + $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 362 | + } |
|
| 363 | + |
|
| 364 | + // If not html then we run the standard output. |
|
| 365 | + if(empty($html)){ |
|
| 366 | + |
|
| 367 | + if ($post->{$cf['htmlvar_name']}): |
|
| 368 | + |
|
| 369 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 370 | + if (strpos($field_icon, 'http') !== false) { |
|
| 371 | + $field_icon_af = ''; |
|
| 372 | + } elseif ($field_icon == '') { |
|
| 373 | + $field_icon_af = '<i class="fa fa-phone"></i>'; |
|
| 374 | + } else { |
|
| 375 | + $field_icon_af = $field_icon; |
|
| 376 | + $field_icon = ''; |
|
| 377 | + } |
|
| 378 | + |
|
| 379 | + |
|
| 380 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af . |
|
| 381 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 382 | + $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>'; |
|
| 383 | + |
|
| 384 | + endif; |
|
| 385 | + |
|
| 386 | + } |
|
| 387 | + |
|
| 388 | + return $html; |
|
| 389 | 389 | } |
| 390 | 390 | add_filter('geodir_custom_field_output_phone','geodir_cf_phone',10,3); |
| 391 | 391 | |
@@ -402,85 +402,85 @@ discard block |
||
| 402 | 402 | */ |
| 403 | 403 | function geodir_cf_time($html,$location,$cf,$p=''){ |
| 404 | 404 | |
| 405 | - // check we have the post value |
|
| 406 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 407 | - else{ global $post;} |
|
| 408 | - |
|
| 409 | - if(!is_array($cf) && $cf!=''){ |
|
| 410 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 411 | - if(!$cf){return NULL;} |
|
| 412 | - } |
|
| 413 | - |
|
| 414 | - $html_var = $cf['htmlvar_name']; |
|
| 415 | - |
|
| 416 | - // Check if there is a location specific filter. |
|
| 417 | - if(has_filter("geodir_custom_field_output_time_loc_{$location}")){ |
|
| 418 | - /** |
|
| 419 | - * Filter the time html by location. |
|
| 420 | - * |
|
| 421 | - * @param string $html The html to filter. |
|
| 422 | - * @param array $cf The custom field array. |
|
| 423 | - * @since 1.6.6 |
|
| 424 | - */ |
|
| 425 | - $html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf); |
|
| 426 | - } |
|
| 427 | - |
|
| 428 | - // Check if there is a custom field specific filter. |
|
| 429 | - if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){ |
|
| 430 | - /** |
|
| 431 | - * Filter the time html by individual custom field. |
|
| 432 | - * |
|
| 433 | - * @param string $html The html to filter. |
|
| 434 | - * @param string $location The location to output the html. |
|
| 435 | - * @param array $cf The custom field array. |
|
| 436 | - * @since 1.6.6 |
|
| 437 | - */ |
|
| 438 | - $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf); |
|
| 439 | - } |
|
| 440 | - |
|
| 441 | - // Check if there is a custom field key specific filter. |
|
| 442 | - if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){ |
|
| 443 | - /** |
|
| 444 | - * Filter the time html by field type key. |
|
| 445 | - * |
|
| 446 | - * @param string $html The html to filter. |
|
| 447 | - * @param string $location The location to output the html. |
|
| 448 | - * @param array $cf The custom field array. |
|
| 449 | - * @since 1.6.6 |
|
| 450 | - */ |
|
| 451 | - $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 452 | - } |
|
| 453 | - |
|
| 454 | - // If not html then we run the standard output. |
|
| 455 | - if(empty($html)){ |
|
| 456 | - |
|
| 457 | - if ($post->{$cf['htmlvar_name']}): |
|
| 458 | - |
|
| 459 | - $value = ''; |
|
| 460 | - if ($post->{$cf['htmlvar_name']} != '') |
|
| 461 | - //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']})); |
|
| 462 | - $value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']})); |
|
| 463 | - |
|
| 464 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 465 | - if (strpos($field_icon, 'http') !== false) { |
|
| 466 | - $field_icon_af = ''; |
|
| 467 | - } elseif ($field_icon == '') { |
|
| 468 | - $field_icon_af = '<i class="fa fa-clock-o"></i>'; |
|
| 469 | - } else { |
|
| 470 | - $field_icon_af = $field_icon; |
|
| 471 | - $field_icon = ''; |
|
| 472 | - } |
|
| 473 | - |
|
| 474 | - |
|
| 475 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af; |
|
| 476 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 477 | - $html .= '</span>' . $value . '</div>'; |
|
| 478 | - |
|
| 479 | - endif; |
|
| 480 | - |
|
| 481 | - } |
|
| 482 | - |
|
| 483 | - return $html; |
|
| 405 | + // check we have the post value |
|
| 406 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 407 | + else{ global $post;} |
|
| 408 | + |
|
| 409 | + if(!is_array($cf) && $cf!=''){ |
|
| 410 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 411 | + if(!$cf){return NULL;} |
|
| 412 | + } |
|
| 413 | + |
|
| 414 | + $html_var = $cf['htmlvar_name']; |
|
| 415 | + |
|
| 416 | + // Check if there is a location specific filter. |
|
| 417 | + if(has_filter("geodir_custom_field_output_time_loc_{$location}")){ |
|
| 418 | + /** |
|
| 419 | + * Filter the time html by location. |
|
| 420 | + * |
|
| 421 | + * @param string $html The html to filter. |
|
| 422 | + * @param array $cf The custom field array. |
|
| 423 | + * @since 1.6.6 |
|
| 424 | + */ |
|
| 425 | + $html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf); |
|
| 426 | + } |
|
| 427 | + |
|
| 428 | + // Check if there is a custom field specific filter. |
|
| 429 | + if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){ |
|
| 430 | + /** |
|
| 431 | + * Filter the time html by individual custom field. |
|
| 432 | + * |
|
| 433 | + * @param string $html The html to filter. |
|
| 434 | + * @param string $location The location to output the html. |
|
| 435 | + * @param array $cf The custom field array. |
|
| 436 | + * @since 1.6.6 |
|
| 437 | + */ |
|
| 438 | + $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf); |
|
| 439 | + } |
|
| 440 | + |
|
| 441 | + // Check if there is a custom field key specific filter. |
|
| 442 | + if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){ |
|
| 443 | + /** |
|
| 444 | + * Filter the time html by field type key. |
|
| 445 | + * |
|
| 446 | + * @param string $html The html to filter. |
|
| 447 | + * @param string $location The location to output the html. |
|
| 448 | + * @param array $cf The custom field array. |
|
| 449 | + * @since 1.6.6 |
|
| 450 | + */ |
|
| 451 | + $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 452 | + } |
|
| 453 | + |
|
| 454 | + // If not html then we run the standard output. |
|
| 455 | + if(empty($html)){ |
|
| 456 | + |
|
| 457 | + if ($post->{$cf['htmlvar_name']}): |
|
| 458 | + |
|
| 459 | + $value = ''; |
|
| 460 | + if ($post->{$cf['htmlvar_name']} != '') |
|
| 461 | + //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']})); |
|
| 462 | + $value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']})); |
|
| 463 | + |
|
| 464 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 465 | + if (strpos($field_icon, 'http') !== false) { |
|
| 466 | + $field_icon_af = ''; |
|
| 467 | + } elseif ($field_icon == '') { |
|
| 468 | + $field_icon_af = '<i class="fa fa-clock-o"></i>'; |
|
| 469 | + } else { |
|
| 470 | + $field_icon_af = $field_icon; |
|
| 471 | + $field_icon = ''; |
|
| 472 | + } |
|
| 473 | + |
|
| 474 | + |
|
| 475 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af; |
|
| 476 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ' '; |
|
| 477 | + $html .= '</span>' . $value . '</div>'; |
|
| 478 | + |
|
| 479 | + endif; |
|
| 480 | + |
|
| 481 | + } |
|
| 482 | + |
|
| 483 | + return $html; |
|
| 484 | 484 | } |
| 485 | 485 | add_filter('geodir_custom_field_output_time','geodir_cf_time',10,3); |
| 486 | 486 | |
@@ -496,111 +496,111 @@ discard block |
||
| 496 | 496 | * @return string The html to output for the custom field. |
| 497 | 497 | */ |
| 498 | 498 | function geodir_cf_datepicker($html,$location,$cf,$p=''){ |
| 499 | - global $preview; |
|
| 500 | - // check we have the post value |
|
| 501 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 502 | - else{ global $post;} |
|
| 503 | - |
|
| 504 | - if(!is_array($cf) && $cf!=''){ |
|
| 505 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 506 | - if(!$cf){return NULL;} |
|
| 507 | - } |
|
| 508 | - |
|
| 509 | - $html_var = $cf['htmlvar_name']; |
|
| 510 | - |
|
| 511 | - // Check if there is a location specific filter. |
|
| 512 | - if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){ |
|
| 513 | - /** |
|
| 514 | - * Filter the datepicker html by location. |
|
| 515 | - * |
|
| 516 | - * @param string $html The html to filter. |
|
| 517 | - * @param array $cf The custom field array. |
|
| 518 | - * @since 1.6.6 |
|
| 519 | - */ |
|
| 520 | - $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf); |
|
| 521 | - } |
|
| 522 | - |
|
| 523 | - // Check if there is a custom field specific filter. |
|
| 524 | - if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){ |
|
| 525 | - /** |
|
| 526 | - * Filter the datepicker html by individual custom field. |
|
| 527 | - * |
|
| 528 | - * @param string $html The html to filter. |
|
| 529 | - * @param string $location The location to output the html. |
|
| 530 | - * @param array $cf The custom field array. |
|
| 531 | - * @since 1.6.6 |
|
| 532 | - */ |
|
| 533 | - $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf); |
|
| 534 | - } |
|
| 535 | - |
|
| 536 | - // Check if there is a custom field key specific filter. |
|
| 537 | - if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){ |
|
| 538 | - /** |
|
| 539 | - * Filter the datepicker html by field type key. |
|
| 540 | - * |
|
| 541 | - * @param string $html The html to filter. |
|
| 542 | - * @param string $location The location to output the html. |
|
| 543 | - * @param array $cf The custom field array. |
|
| 544 | - * @since 1.6.6 |
|
| 545 | - */ |
|
| 546 | - $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 547 | - } |
|
| 548 | - |
|
| 549 | - // If not html then we run the standard output. |
|
| 550 | - if(empty($html)){ |
|
| 551 | - |
|
| 552 | - if ($post->{$cf['htmlvar_name']}): |
|
| 553 | - |
|
| 554 | - $date_format = geodir_default_date_format(); |
|
| 555 | - if ($cf['extra_fields'] != '') { |
|
| 556 | - $date_format = stripslashes_deep(unserialize($cf['extra_fields'])); |
|
| 557 | - $date_format = $date_format['date_format']; |
|
| 558 | - } |
|
| 559 | - // check if we need to change the format or not |
|
| 560 | - $date_format_len = strlen(str_replace(' ', '', $date_format)); |
|
| 561 | - if($date_format_len>5){// if greater then 4 then it's the old style format. |
|
| 562 | - |
|
| 563 | - $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format |
|
| 564 | - $replace = array('d','j','l','m','n','F','Y');//PHP date format |
|
| 565 | - |
|
| 566 | - $date_format = str_replace($search, $replace, $date_format); |
|
| 567 | - |
|
| 568 | - $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format |
|
| 569 | - }else{ |
|
| 570 | - $post_htmlvar_value = $post->{$cf['htmlvar_name']}; |
|
| 571 | - } |
|
| 572 | - |
|
| 573 | - if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") { |
|
| 574 | - $date_format_from = $preview ? $date_format : 'Y-m-d'; |
|
| 575 | - $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d |
|
| 576 | - //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value; |
|
| 577 | - //$value = date_i18n($date_format, strtotime($post_htmlvar_value)); |
|
| 578 | - }else{ |
|
| 579 | - return ''; |
|
| 580 | - } |
|
| 581 | - |
|
| 582 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 583 | - |
|
| 584 | - if (strpos($field_icon, 'http') !== false) { |
|
| 585 | - $field_icon_af = ''; |
|
| 586 | - } elseif ($field_icon == '') { |
|
| 587 | - $field_icon_af = '<i class="fa fa-calendar"></i>'; |
|
| 588 | - } else { |
|
| 589 | - $field_icon_af = $field_icon; |
|
| 590 | - $field_icon = ''; |
|
| 591 | - } |
|
| 592 | - |
|
| 593 | - |
|
| 594 | - |
|
| 595 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af; |
|
| 596 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 597 | - $html .= '</span>' . $value . '</div>'; |
|
| 598 | - |
|
| 599 | - endif; |
|
| 600 | - |
|
| 601 | - } |
|
| 602 | - |
|
| 603 | - return $html; |
|
| 499 | + global $preview; |
|
| 500 | + // check we have the post value |
|
| 501 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 502 | + else{ global $post;} |
|
| 503 | + |
|
| 504 | + if(!is_array($cf) && $cf!=''){ |
|
| 505 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 506 | + if(!$cf){return NULL;} |
|
| 507 | + } |
|
| 508 | + |
|
| 509 | + $html_var = $cf['htmlvar_name']; |
|
| 510 | + |
|
| 511 | + // Check if there is a location specific filter. |
|
| 512 | + if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){ |
|
| 513 | + /** |
|
| 514 | + * Filter the datepicker html by location. |
|
| 515 | + * |
|
| 516 | + * @param string $html The html to filter. |
|
| 517 | + * @param array $cf The custom field array. |
|
| 518 | + * @since 1.6.6 |
|
| 519 | + */ |
|
| 520 | + $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf); |
|
| 521 | + } |
|
| 522 | + |
|
| 523 | + // Check if there is a custom field specific filter. |
|
| 524 | + if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){ |
|
| 525 | + /** |
|
| 526 | + * Filter the datepicker html by individual custom field. |
|
| 527 | + * |
|
| 528 | + * @param string $html The html to filter. |
|
| 529 | + * @param string $location The location to output the html. |
|
| 530 | + * @param array $cf The custom field array. |
|
| 531 | + * @since 1.6.6 |
|
| 532 | + */ |
|
| 533 | + $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf); |
|
| 534 | + } |
|
| 535 | + |
|
| 536 | + // Check if there is a custom field key specific filter. |
|
| 537 | + if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){ |
|
| 538 | + /** |
|
| 539 | + * Filter the datepicker html by field type key. |
|
| 540 | + * |
|
| 541 | + * @param string $html The html to filter. |
|
| 542 | + * @param string $location The location to output the html. |
|
| 543 | + * @param array $cf The custom field array. |
|
| 544 | + * @since 1.6.6 |
|
| 545 | + */ |
|
| 546 | + $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 547 | + } |
|
| 548 | + |
|
| 549 | + // If not html then we run the standard output. |
|
| 550 | + if(empty($html)){ |
|
| 551 | + |
|
| 552 | + if ($post->{$cf['htmlvar_name']}): |
|
| 553 | + |
|
| 554 | + $date_format = geodir_default_date_format(); |
|
| 555 | + if ($cf['extra_fields'] != '') { |
|
| 556 | + $date_format = stripslashes_deep(unserialize($cf['extra_fields'])); |
|
| 557 | + $date_format = $date_format['date_format']; |
|
| 558 | + } |
|
| 559 | + // check if we need to change the format or not |
|
| 560 | + $date_format_len = strlen(str_replace(' ', '', $date_format)); |
|
| 561 | + if($date_format_len>5){// if greater then 4 then it's the old style format. |
|
| 562 | + |
|
| 563 | + $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format |
|
| 564 | + $replace = array('d','j','l','m','n','F','Y');//PHP date format |
|
| 565 | + |
|
| 566 | + $date_format = str_replace($search, $replace, $date_format); |
|
| 567 | + |
|
| 568 | + $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format |
|
| 569 | + }else{ |
|
| 570 | + $post_htmlvar_value = $post->{$cf['htmlvar_name']}; |
|
| 571 | + } |
|
| 572 | + |
|
| 573 | + if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") { |
|
| 574 | + $date_format_from = $preview ? $date_format : 'Y-m-d'; |
|
| 575 | + $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d |
|
| 576 | + //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value; |
|
| 577 | + //$value = date_i18n($date_format, strtotime($post_htmlvar_value)); |
|
| 578 | + }else{ |
|
| 579 | + return ''; |
|
| 580 | + } |
|
| 581 | + |
|
| 582 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 583 | + |
|
| 584 | + if (strpos($field_icon, 'http') !== false) { |
|
| 585 | + $field_icon_af = ''; |
|
| 586 | + } elseif ($field_icon == '') { |
|
| 587 | + $field_icon_af = '<i class="fa fa-calendar"></i>'; |
|
| 588 | + } else { |
|
| 589 | + $field_icon_af = $field_icon; |
|
| 590 | + $field_icon = ''; |
|
| 591 | + } |
|
| 592 | + |
|
| 593 | + |
|
| 594 | + |
|
| 595 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af; |
|
| 596 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 597 | + $html .= '</span>' . $value . '</div>'; |
|
| 598 | + |
|
| 599 | + endif; |
|
| 600 | + |
|
| 601 | + } |
|
| 602 | + |
|
| 603 | + return $html; |
|
| 604 | 604 | } |
| 605 | 605 | add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3); |
| 606 | 606 | |
@@ -617,96 +617,96 @@ discard block |
||
| 617 | 617 | */ |
| 618 | 618 | function geodir_cf_text($html,$location,$cf,$p=''){ |
| 619 | 619 | |
| 620 | - // check we have the post value |
|
| 621 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 622 | - else{ global $post;} |
|
| 623 | - |
|
| 624 | - if(!is_array($cf) && $cf!=''){ |
|
| 625 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 626 | - if(!$cf){return NULL;} |
|
| 627 | - } |
|
| 628 | - |
|
| 629 | - $html_var = $cf['htmlvar_name']; |
|
| 630 | - |
|
| 631 | - // Check if there is a location specific filter. |
|
| 632 | - if(has_filter("geodir_custom_field_output_text_loc_{$location}")){ |
|
| 633 | - /** |
|
| 634 | - * Filter the text html by location. |
|
| 635 | - * |
|
| 636 | - * @param string $html The html to filter. |
|
| 637 | - * @param array $cf The custom field array. |
|
| 638 | - * @since 1.6.6 |
|
| 639 | - */ |
|
| 640 | - $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf); |
|
| 641 | - } |
|
| 642 | - |
|
| 643 | - // Check if there is a custom field specific filter. |
|
| 644 | - if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){ |
|
| 645 | - /** |
|
| 646 | - * Filter the text html by individual custom field. |
|
| 647 | - * |
|
| 648 | - * @param string $html The html to filter. |
|
| 649 | - * @param string $location The location to output the html. |
|
| 650 | - * @param array $cf The custom field array. |
|
| 651 | - * @since 1.6.6 |
|
| 652 | - */ |
|
| 653 | - $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf); |
|
| 654 | - } |
|
| 655 | - |
|
| 656 | - // Check if there is a custom field key specific filter. |
|
| 657 | - if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){ |
|
| 658 | - /** |
|
| 659 | - * Filter the text html by field type key. |
|
| 660 | - * |
|
| 661 | - * @param string $html The html to filter. |
|
| 662 | - * @param string $location The location to output the html. |
|
| 663 | - * @param array $cf The custom field array. |
|
| 664 | - * @since 1.6.6 |
|
| 665 | - */ |
|
| 666 | - $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 667 | - } |
|
| 620 | + // check we have the post value |
|
| 621 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 622 | + else{ global $post;} |
|
| 623 | + |
|
| 624 | + if(!is_array($cf) && $cf!=''){ |
|
| 625 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 626 | + if(!$cf){return NULL;} |
|
| 627 | + } |
|
| 628 | + |
|
| 629 | + $html_var = $cf['htmlvar_name']; |
|
| 630 | + |
|
| 631 | + // Check if there is a location specific filter. |
|
| 632 | + if(has_filter("geodir_custom_field_output_text_loc_{$location}")){ |
|
| 633 | + /** |
|
| 634 | + * Filter the text html by location. |
|
| 635 | + * |
|
| 636 | + * @param string $html The html to filter. |
|
| 637 | + * @param array $cf The custom field array. |
|
| 638 | + * @since 1.6.6 |
|
| 639 | + */ |
|
| 640 | + $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf); |
|
| 641 | + } |
|
| 642 | + |
|
| 643 | + // Check if there is a custom field specific filter. |
|
| 644 | + if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){ |
|
| 645 | + /** |
|
| 646 | + * Filter the text html by individual custom field. |
|
| 647 | + * |
|
| 648 | + * @param string $html The html to filter. |
|
| 649 | + * @param string $location The location to output the html. |
|
| 650 | + * @param array $cf The custom field array. |
|
| 651 | + * @since 1.6.6 |
|
| 652 | + */ |
|
| 653 | + $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf); |
|
| 654 | + } |
|
| 655 | + |
|
| 656 | + // Check if there is a custom field key specific filter. |
|
| 657 | + if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){ |
|
| 658 | + /** |
|
| 659 | + * Filter the text html by field type key. |
|
| 660 | + * |
|
| 661 | + * @param string $html The html to filter. |
|
| 662 | + * @param string $location The location to output the html. |
|
| 663 | + * @param array $cf The custom field array. |
|
| 664 | + * @since 1.6.6 |
|
| 665 | + */ |
|
| 666 | + $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 667 | + } |
|
| 668 | 668 | |
| 669 | 669 | |
| 670 | 670 | |
| 671 | - // If not html then we run the standard output. |
|
| 672 | - if(empty($html)){ |
|
| 671 | + // If not html then we run the standard output. |
|
| 672 | + if(empty($html)){ |
|
| 673 | 673 | |
| 674 | - if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ): |
|
| 674 | + if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ): |
|
| 675 | 675 | |
| 676 | - $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text"; |
|
| 676 | + $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text"; |
|
| 677 | 677 | |
| 678 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 679 | - if (strpos($field_icon, 'http') !== false) { |
|
| 680 | - $field_icon_af = ''; |
|
| 681 | - } elseif ($field_icon == '') { |
|
| 682 | - $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : ""; |
|
| 683 | - } else { |
|
| 684 | - $field_icon_af = $field_icon; |
|
| 685 | - $field_icon = ''; |
|
| 686 | - } |
|
| 678 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 679 | + if (strpos($field_icon, 'http') !== false) { |
|
| 680 | + $field_icon_af = ''; |
|
| 681 | + } elseif ($field_icon == '') { |
|
| 682 | + $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : ""; |
|
| 683 | + } else { |
|
| 684 | + $field_icon_af = $field_icon; |
|
| 685 | + $field_icon = ''; |
|
| 686 | + } |
|
| 687 | 687 | |
| 688 | 688 | |
| 689 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af; |
|
| 690 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 691 | - $html .= '</span>'; |
|
| 689 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af; |
|
| 690 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 691 | + $html .= '</span>'; |
|
| 692 | 692 | |
| 693 | - $value = $post->{$cf['htmlvar_name']}; |
|
| 694 | - if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){ |
|
| 695 | - $extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields'])); |
|
| 696 | - if(isset($extra_fields['is_price']) && $extra_fields['is_price']){ |
|
| 697 | - $value = geodir_currency_format_number($value,$cf); |
|
| 698 | - } |
|
| 699 | - } |
|
| 693 | + $value = $post->{$cf['htmlvar_name']}; |
|
| 694 | + if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){ |
|
| 695 | + $extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields'])); |
|
| 696 | + if(isset($extra_fields['is_price']) && $extra_fields['is_price']){ |
|
| 697 | + $value = geodir_currency_format_number($value,$cf); |
|
| 698 | + } |
|
| 699 | + } |
|
| 700 | 700 | |
| 701 | 701 | |
| 702 | - $html .= $value; |
|
| 703 | - $html .= '</div>'; |
|
| 702 | + $html .= $value; |
|
| 703 | + $html .= '</div>'; |
|
| 704 | 704 | |
| 705 | - endif; |
|
| 705 | + endif; |
|
| 706 | 706 | |
| 707 | - } |
|
| 707 | + } |
|
| 708 | 708 | |
| 709 | - return $html; |
|
| 709 | + return $html; |
|
| 710 | 710 | } |
| 711 | 711 | add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3); |
| 712 | 712 | |
@@ -723,98 +723,98 @@ discard block |
||
| 723 | 723 | */ |
| 724 | 724 | function geodir_cf_radio($html,$location,$cf,$p=''){ |
| 725 | 725 | |
| 726 | - // check we have the post value |
|
| 727 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 728 | - else{ global $post;} |
|
| 729 | - |
|
| 730 | - if(!is_array($cf) && $cf!=''){ |
|
| 731 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 732 | - if(!$cf){return NULL;} |
|
| 733 | - } |
|
| 734 | - |
|
| 735 | - $html_var = $cf['htmlvar_name']; |
|
| 736 | - |
|
| 737 | - // Check if there is a location specific filter. |
|
| 738 | - if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){ |
|
| 739 | - /** |
|
| 740 | - * Filter the radio html by location. |
|
| 741 | - * |
|
| 742 | - * @param string $html The html to filter. |
|
| 743 | - * @param array $cf The custom field array. |
|
| 744 | - * @since 1.6.6 |
|
| 745 | - */ |
|
| 746 | - $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf); |
|
| 747 | - } |
|
| 748 | - |
|
| 749 | - // Check if there is a custom field specific filter. |
|
| 750 | - if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){ |
|
| 751 | - /** |
|
| 752 | - * Filter the radio html by individual custom field. |
|
| 753 | - * |
|
| 754 | - * @param string $html The html to filter. |
|
| 755 | - * @param string $location The location to output the html. |
|
| 756 | - * @param array $cf The custom field array. |
|
| 757 | - * @since 1.6.6 |
|
| 758 | - */ |
|
| 759 | - $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf); |
|
| 760 | - } |
|
| 761 | - |
|
| 762 | - // Check if there is a custom field key specific filter. |
|
| 763 | - if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){ |
|
| 764 | - /** |
|
| 765 | - * Filter the radio html by field type key. |
|
| 766 | - * |
|
| 767 | - * @param string $html The html to filter. |
|
| 768 | - * @param string $location The location to output the html. |
|
| 769 | - * @param array $cf The custom field array. |
|
| 770 | - * @since 1.6.6 |
|
| 771 | - */ |
|
| 772 | - $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 773 | - } |
|
| 774 | - |
|
| 775 | - // If not html then we run the standard output. |
|
| 776 | - if(empty($html)){ |
|
| 777 | - |
|
| 778 | - $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : ''; |
|
| 779 | - if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''): |
|
| 780 | - |
|
| 781 | - if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') { |
|
| 782 | - $html_val = __('No', 'geodirectory'); |
|
| 783 | - } else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') { |
|
| 784 | - $html_val = __('Yes', 'geodirectory'); |
|
| 785 | - } else { |
|
| 786 | - if (!empty($cf['option_values'])) { |
|
| 787 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true); |
|
| 788 | - |
|
| 789 | - if (!empty($cf_option_values)) { |
|
| 790 | - foreach ($cf_option_values as $cf_option_value) { |
|
| 791 | - if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) { |
|
| 792 | - $html_val = $cf_option_value['label']; |
|
| 793 | - } |
|
| 794 | - } |
|
| 795 | - } |
|
| 796 | - } |
|
| 797 | - } |
|
| 798 | - |
|
| 799 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 800 | - if (strpos($field_icon, 'http') !== false) { |
|
| 801 | - $field_icon_af = ''; |
|
| 802 | - } elseif ($field_icon == '') { |
|
| 803 | - $field_icon_af = ''; |
|
| 804 | - } else { |
|
| 805 | - $field_icon_af = $field_icon; |
|
| 806 | - $field_icon = ''; |
|
| 807 | - } |
|
| 808 | - |
|
| 809 | - |
|
| 810 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af; |
|
| 811 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 812 | - $html .= '</span>' . $html_val . '</div>'; |
|
| 813 | - endif; |
|
| 814 | - |
|
| 815 | - } |
|
| 816 | - |
|
| 817 | - return $html; |
|
| 726 | + // check we have the post value |
|
| 727 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 728 | + else{ global $post;} |
|
| 729 | + |
|
| 730 | + if(!is_array($cf) && $cf!=''){ |
|
| 731 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 732 | + if(!$cf){return NULL;} |
|
| 733 | + } |
|
| 734 | + |
|
| 735 | + $html_var = $cf['htmlvar_name']; |
|
| 736 | + |
|
| 737 | + // Check if there is a location specific filter. |
|
| 738 | + if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){ |
|
| 739 | + /** |
|
| 740 | + * Filter the radio html by location. |
|
| 741 | + * |
|
| 742 | + * @param string $html The html to filter. |
|
| 743 | + * @param array $cf The custom field array. |
|
| 744 | + * @since 1.6.6 |
|
| 745 | + */ |
|
| 746 | + $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf); |
|
| 747 | + } |
|
| 748 | + |
|
| 749 | + // Check if there is a custom field specific filter. |
|
| 750 | + if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){ |
|
| 751 | + /** |
|
| 752 | + * Filter the radio html by individual custom field. |
|
| 753 | + * |
|
| 754 | + * @param string $html The html to filter. |
|
| 755 | + * @param string $location The location to output the html. |
|
| 756 | + * @param array $cf The custom field array. |
|
| 757 | + * @since 1.6.6 |
|
| 758 | + */ |
|
| 759 | + $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf); |
|
| 760 | + } |
|
| 761 | + |
|
| 762 | + // Check if there is a custom field key specific filter. |
|
| 763 | + if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){ |
|
| 764 | + /** |
|
| 765 | + * Filter the radio html by field type key. |
|
| 766 | + * |
|
| 767 | + * @param string $html The html to filter. |
|
| 768 | + * @param string $location The location to output the html. |
|
| 769 | + * @param array $cf The custom field array. |
|
| 770 | + * @since 1.6.6 |
|
| 771 | + */ |
|
| 772 | + $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 773 | + } |
|
| 774 | + |
|
| 775 | + // If not html then we run the standard output. |
|
| 776 | + if(empty($html)){ |
|
| 777 | + |
|
| 778 | + $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : ''; |
|
| 779 | + if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''): |
|
| 780 | + |
|
| 781 | + if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') { |
|
| 782 | + $html_val = __('No', 'geodirectory'); |
|
| 783 | + } else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') { |
|
| 784 | + $html_val = __('Yes', 'geodirectory'); |
|
| 785 | + } else { |
|
| 786 | + if (!empty($cf['option_values'])) { |
|
| 787 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true); |
|
| 788 | + |
|
| 789 | + if (!empty($cf_option_values)) { |
|
| 790 | + foreach ($cf_option_values as $cf_option_value) { |
|
| 791 | + if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) { |
|
| 792 | + $html_val = $cf_option_value['label']; |
|
| 793 | + } |
|
| 794 | + } |
|
| 795 | + } |
|
| 796 | + } |
|
| 797 | + } |
|
| 798 | + |
|
| 799 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 800 | + if (strpos($field_icon, 'http') !== false) { |
|
| 801 | + $field_icon_af = ''; |
|
| 802 | + } elseif ($field_icon == '') { |
|
| 803 | + $field_icon_af = ''; |
|
| 804 | + } else { |
|
| 805 | + $field_icon_af = $field_icon; |
|
| 806 | + $field_icon = ''; |
|
| 807 | + } |
|
| 808 | + |
|
| 809 | + |
|
| 810 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af; |
|
| 811 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 812 | + $html .= '</span>' . $html_val . '</div>'; |
|
| 813 | + endif; |
|
| 814 | + |
|
| 815 | + } |
|
| 816 | + |
|
| 817 | + return $html; |
|
| 818 | 818 | } |
| 819 | 819 | add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3); |
| 820 | 820 | |
@@ -831,92 +831,92 @@ discard block |
||
| 831 | 831 | */ |
| 832 | 832 | function geodir_cf_select($html,$location,$cf,$p=''){ |
| 833 | 833 | |
| 834 | - // check we have the post value |
|
| 835 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 836 | - else{ global $post;} |
|
| 837 | - |
|
| 838 | - if(!is_array($cf) && $cf!=''){ |
|
| 839 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 840 | - if(!$cf){return NULL;} |
|
| 841 | - } |
|
| 842 | - |
|
| 843 | - $html_var = $cf['htmlvar_name']; |
|
| 844 | - |
|
| 845 | - // Check if there is a location specific filter. |
|
| 846 | - if(has_filter("geodir_custom_field_output_select_loc_{$location}")){ |
|
| 847 | - /** |
|
| 848 | - * Filter the select html by location. |
|
| 849 | - * |
|
| 850 | - * @param string $html The html to filter. |
|
| 851 | - * @param array $cf The custom field array. |
|
| 852 | - * @since 1.6.6 |
|
| 853 | - */ |
|
| 854 | - $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf); |
|
| 855 | - } |
|
| 856 | - |
|
| 857 | - // Check if there is a custom field specific filter. |
|
| 858 | - if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){ |
|
| 859 | - /** |
|
| 860 | - * Filter the select html by individual custom field. |
|
| 861 | - * |
|
| 862 | - * @param string $html The html to filter. |
|
| 863 | - * @param string $location The location to output the html. |
|
| 864 | - * @param array $cf The custom field array. |
|
| 865 | - * @since 1.6.6 |
|
| 866 | - */ |
|
| 867 | - $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf); |
|
| 868 | - } |
|
| 869 | - |
|
| 870 | - // Check if there is a custom field key specific filter. |
|
| 871 | - if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){ |
|
| 872 | - /** |
|
| 873 | - * Filter the select html by field type key. |
|
| 874 | - * |
|
| 875 | - * @param string $html The html to filter. |
|
| 876 | - * @param string $location The location to output the html. |
|
| 877 | - * @param array $cf The custom field array. |
|
| 878 | - * @since 1.6.6 |
|
| 879 | - */ |
|
| 880 | - $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 881 | - } |
|
| 882 | - |
|
| 883 | - // If not html then we run the standard output. |
|
| 884 | - if(empty($html)){ |
|
| 885 | - |
|
| 886 | - if ($post->{$cf['htmlvar_name']}): |
|
| 887 | - $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory'); |
|
| 888 | - |
|
| 889 | - if (!empty($cf['option_values'])) { |
|
| 890 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true); |
|
| 891 | - |
|
| 892 | - if (!empty($cf_option_values)) { |
|
| 893 | - foreach ($cf_option_values as $cf_option_value) { |
|
| 894 | - if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) { |
|
| 895 | - //$field_value = $cf_option_value['label']; // no longer needed here. |
|
| 896 | - } |
|
| 897 | - } |
|
| 898 | - } |
|
| 899 | - } |
|
| 900 | - |
|
| 901 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 902 | - if (strpos($field_icon, 'http') !== false) { |
|
| 903 | - $field_icon_af = ''; |
|
| 904 | - } elseif ($field_icon == '') { |
|
| 905 | - $field_icon_af = ''; |
|
| 906 | - } else { |
|
| 907 | - $field_icon_af = $field_icon; |
|
| 908 | - $field_icon = ''; |
|
| 909 | - } |
|
| 910 | - |
|
| 911 | - |
|
| 912 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 913 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 914 | - $html .= '</span>' . $field_value . '</div>'; |
|
| 915 | - endif; |
|
| 916 | - |
|
| 917 | - } |
|
| 918 | - |
|
| 919 | - return $html; |
|
| 834 | + // check we have the post value |
|
| 835 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 836 | + else{ global $post;} |
|
| 837 | + |
|
| 838 | + if(!is_array($cf) && $cf!=''){ |
|
| 839 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 840 | + if(!$cf){return NULL;} |
|
| 841 | + } |
|
| 842 | + |
|
| 843 | + $html_var = $cf['htmlvar_name']; |
|
| 844 | + |
|
| 845 | + // Check if there is a location specific filter. |
|
| 846 | + if(has_filter("geodir_custom_field_output_select_loc_{$location}")){ |
|
| 847 | + /** |
|
| 848 | + * Filter the select html by location. |
|
| 849 | + * |
|
| 850 | + * @param string $html The html to filter. |
|
| 851 | + * @param array $cf The custom field array. |
|
| 852 | + * @since 1.6.6 |
|
| 853 | + */ |
|
| 854 | + $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf); |
|
| 855 | + } |
|
| 856 | + |
|
| 857 | + // Check if there is a custom field specific filter. |
|
| 858 | + if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){ |
|
| 859 | + /** |
|
| 860 | + * Filter the select html by individual custom field. |
|
| 861 | + * |
|
| 862 | + * @param string $html The html to filter. |
|
| 863 | + * @param string $location The location to output the html. |
|
| 864 | + * @param array $cf The custom field array. |
|
| 865 | + * @since 1.6.6 |
|
| 866 | + */ |
|
| 867 | + $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf); |
|
| 868 | + } |
|
| 869 | + |
|
| 870 | + // Check if there is a custom field key specific filter. |
|
| 871 | + if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){ |
|
| 872 | + /** |
|
| 873 | + * Filter the select html by field type key. |
|
| 874 | + * |
|
| 875 | + * @param string $html The html to filter. |
|
| 876 | + * @param string $location The location to output the html. |
|
| 877 | + * @param array $cf The custom field array. |
|
| 878 | + * @since 1.6.6 |
|
| 879 | + */ |
|
| 880 | + $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 881 | + } |
|
| 882 | + |
|
| 883 | + // If not html then we run the standard output. |
|
| 884 | + if(empty($html)){ |
|
| 885 | + |
|
| 886 | + if ($post->{$cf['htmlvar_name']}): |
|
| 887 | + $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory'); |
|
| 888 | + |
|
| 889 | + if (!empty($cf['option_values'])) { |
|
| 890 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true); |
|
| 891 | + |
|
| 892 | + if (!empty($cf_option_values)) { |
|
| 893 | + foreach ($cf_option_values as $cf_option_value) { |
|
| 894 | + if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) { |
|
| 895 | + //$field_value = $cf_option_value['label']; // no longer needed here. |
|
| 896 | + } |
|
| 897 | + } |
|
| 898 | + } |
|
| 899 | + } |
|
| 900 | + |
|
| 901 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 902 | + if (strpos($field_icon, 'http') !== false) { |
|
| 903 | + $field_icon_af = ''; |
|
| 904 | + } elseif ($field_icon == '') { |
|
| 905 | + $field_icon_af = ''; |
|
| 906 | + } else { |
|
| 907 | + $field_icon_af = $field_icon; |
|
| 908 | + $field_icon = ''; |
|
| 909 | + } |
|
| 910 | + |
|
| 911 | + |
|
| 912 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 913 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 914 | + $html .= '</span>' . $field_value . '</div>'; |
|
| 915 | + endif; |
|
| 916 | + |
|
| 917 | + } |
|
| 918 | + |
|
| 919 | + return $html; |
|
| 920 | 920 | } |
| 921 | 921 | add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3); |
| 922 | 922 | |
@@ -933,117 +933,117 @@ discard block |
||
| 933 | 933 | */ |
| 934 | 934 | function geodir_cf_multiselect($html,$location,$cf,$p=''){ |
| 935 | 935 | |
| 936 | - // check we have the post value |
|
| 937 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 938 | - else{ global $post;} |
|
| 939 | - |
|
| 940 | - if(!is_array($cf) && $cf!=''){ |
|
| 941 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 942 | - if(!$cf){return NULL;} |
|
| 943 | - } |
|
| 944 | - |
|
| 945 | - $html_var = $cf['htmlvar_name']; |
|
| 946 | - |
|
| 947 | - // Check if there is a location specific filter. |
|
| 948 | - if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){ |
|
| 949 | - /** |
|
| 950 | - * Filter the multiselect html by location. |
|
| 951 | - * |
|
| 952 | - * @param string $html The html to filter. |
|
| 953 | - * @param array $cf The custom field array. |
|
| 954 | - * @since 1.6.6 |
|
| 955 | - */ |
|
| 956 | - $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf); |
|
| 957 | - } |
|
| 958 | - |
|
| 959 | - // Check if there is a custom field specific filter. |
|
| 960 | - if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){ |
|
| 961 | - /** |
|
| 962 | - * Filter the multiselect html by individual custom field. |
|
| 963 | - * |
|
| 964 | - * @param string $html The html to filter. |
|
| 965 | - * @param string $location The location to output the html. |
|
| 966 | - * @param array $cf The custom field array. |
|
| 967 | - * @since 1.6.6 |
|
| 968 | - */ |
|
| 969 | - $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf); |
|
| 970 | - } |
|
| 971 | - |
|
| 972 | - // Check if there is a custom field key specific filter. |
|
| 973 | - if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){ |
|
| 974 | - /** |
|
| 975 | - * Filter the multiselect html by field type key. |
|
| 976 | - * |
|
| 977 | - * @param string $html The html to filter. |
|
| 978 | - * @param string $location The location to output the html. |
|
| 979 | - * @param array $cf The custom field array. |
|
| 980 | - * @since 1.6.6 |
|
| 981 | - */ |
|
| 982 | - $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 983 | - } |
|
| 984 | - |
|
| 985 | - // If not html then we run the standard output. |
|
| 986 | - if(empty($html)){ |
|
| 987 | - |
|
| 988 | - |
|
| 989 | - if (!empty($post->{$cf['htmlvar_name']})): |
|
| 990 | - |
|
| 991 | - if (is_array($post->{$cf['htmlvar_name']})) { |
|
| 992 | - $post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']}); |
|
| 993 | - } |
|
| 994 | - |
|
| 995 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 996 | - if (strpos($field_icon, 'http') !== false) { |
|
| 997 | - $field_icon_af = ''; |
|
| 998 | - } elseif ($field_icon == '') { |
|
| 999 | - $field_icon_af = ''; |
|
| 1000 | - } else { |
|
| 1001 | - $field_icon_af = $field_icon; |
|
| 1002 | - $field_icon = ''; |
|
| 1003 | - } |
|
| 1004 | - |
|
| 1005 | - $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ",")); |
|
| 1006 | - |
|
| 1007 | - if(is_array($field_values)){ |
|
| 1008 | - $field_values = array_map('trim', $field_values); |
|
| 1009 | - } |
|
| 1010 | - |
|
| 1011 | - $option_values = array(); |
|
| 1012 | - if (!empty($cf['option_values'])) { |
|
| 1013 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true); |
|
| 1014 | - |
|
| 1015 | - if (!empty($cf_option_values)) { |
|
| 1016 | - foreach ($cf_option_values as $cf_option_value) { |
|
| 1017 | - if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) { |
|
| 1018 | - $option_values[] = $cf_option_value['label']; |
|
| 1019 | - } |
|
| 1020 | - } |
|
| 1021 | - } |
|
| 1022 | - } |
|
| 1023 | - |
|
| 1024 | - |
|
| 1025 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1026 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1027 | - $html .= '</span>'; |
|
| 1028 | - |
|
| 1029 | - if (count($option_values) > 1) { |
|
| 1030 | - $html .= '<ul>'; |
|
| 1031 | - |
|
| 1032 | - foreach ($option_values as $val) { |
|
| 1033 | - $html .= '<li>' . $val . '</li>'; |
|
| 1034 | - } |
|
| 1035 | - |
|
| 1036 | - $html .= '</ul>'; |
|
| 1037 | - } else { |
|
| 1038 | - $html .= $post->{$cf['htmlvar_name']}; |
|
| 1039 | - } |
|
| 1040 | - |
|
| 1041 | - $html .= '</div>'; |
|
| 1042 | - endif; |
|
| 1043 | - |
|
| 1044 | - } |
|
| 1045 | - |
|
| 1046 | - return $html; |
|
| 936 | + // check we have the post value |
|
| 937 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 938 | + else{ global $post;} |
|
| 939 | + |
|
| 940 | + if(!is_array($cf) && $cf!=''){ |
|
| 941 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 942 | + if(!$cf){return NULL;} |
|
| 943 | + } |
|
| 944 | + |
|
| 945 | + $html_var = $cf['htmlvar_name']; |
|
| 946 | + |
|
| 947 | + // Check if there is a location specific filter. |
|
| 948 | + if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){ |
|
| 949 | + /** |
|
| 950 | + * Filter the multiselect html by location. |
|
| 951 | + * |
|
| 952 | + * @param string $html The html to filter. |
|
| 953 | + * @param array $cf The custom field array. |
|
| 954 | + * @since 1.6.6 |
|
| 955 | + */ |
|
| 956 | + $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf); |
|
| 957 | + } |
|
| 958 | + |
|
| 959 | + // Check if there is a custom field specific filter. |
|
| 960 | + if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){ |
|
| 961 | + /** |
|
| 962 | + * Filter the multiselect html by individual custom field. |
|
| 963 | + * |
|
| 964 | + * @param string $html The html to filter. |
|
| 965 | + * @param string $location The location to output the html. |
|
| 966 | + * @param array $cf The custom field array. |
|
| 967 | + * @since 1.6.6 |
|
| 968 | + */ |
|
| 969 | + $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf); |
|
| 970 | + } |
|
| 971 | + |
|
| 972 | + // Check if there is a custom field key specific filter. |
|
| 973 | + if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){ |
|
| 974 | + /** |
|
| 975 | + * Filter the multiselect html by field type key. |
|
| 976 | + * |
|
| 977 | + * @param string $html The html to filter. |
|
| 978 | + * @param string $location The location to output the html. |
|
| 979 | + * @param array $cf The custom field array. |
|
| 980 | + * @since 1.6.6 |
|
| 981 | + */ |
|
| 982 | + $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 983 | + } |
|
| 984 | + |
|
| 985 | + // If not html then we run the standard output. |
|
| 986 | + if(empty($html)){ |
|
| 987 | + |
|
| 988 | + |
|
| 989 | + if (!empty($post->{$cf['htmlvar_name']})): |
|
| 990 | + |
|
| 991 | + if (is_array($post->{$cf['htmlvar_name']})) { |
|
| 992 | + $post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']}); |
|
| 993 | + } |
|
| 994 | + |
|
| 995 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 996 | + if (strpos($field_icon, 'http') !== false) { |
|
| 997 | + $field_icon_af = ''; |
|
| 998 | + } elseif ($field_icon == '') { |
|
| 999 | + $field_icon_af = ''; |
|
| 1000 | + } else { |
|
| 1001 | + $field_icon_af = $field_icon; |
|
| 1002 | + $field_icon = ''; |
|
| 1003 | + } |
|
| 1004 | + |
|
| 1005 | + $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ",")); |
|
| 1006 | + |
|
| 1007 | + if(is_array($field_values)){ |
|
| 1008 | + $field_values = array_map('trim', $field_values); |
|
| 1009 | + } |
|
| 1010 | + |
|
| 1011 | + $option_values = array(); |
|
| 1012 | + if (!empty($cf['option_values'])) { |
|
| 1013 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true); |
|
| 1014 | + |
|
| 1015 | + if (!empty($cf_option_values)) { |
|
| 1016 | + foreach ($cf_option_values as $cf_option_value) { |
|
| 1017 | + if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) { |
|
| 1018 | + $option_values[] = $cf_option_value['label']; |
|
| 1019 | + } |
|
| 1020 | + } |
|
| 1021 | + } |
|
| 1022 | + } |
|
| 1023 | + |
|
| 1024 | + |
|
| 1025 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1026 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1027 | + $html .= '</span>'; |
|
| 1028 | + |
|
| 1029 | + if (count($option_values) > 1) { |
|
| 1030 | + $html .= '<ul>'; |
|
| 1031 | + |
|
| 1032 | + foreach ($option_values as $val) { |
|
| 1033 | + $html .= '<li>' . $val . '</li>'; |
|
| 1034 | + } |
|
| 1035 | + |
|
| 1036 | + $html .= '</ul>'; |
|
| 1037 | + } else { |
|
| 1038 | + $html .= $post->{$cf['htmlvar_name']}; |
|
| 1039 | + } |
|
| 1040 | + |
|
| 1041 | + $html .= '</div>'; |
|
| 1042 | + endif; |
|
| 1043 | + |
|
| 1044 | + } |
|
| 1045 | + |
|
| 1046 | + return $html; |
|
| 1047 | 1047 | } |
| 1048 | 1048 | add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3); |
| 1049 | 1049 | |
@@ -1060,153 +1060,153 @@ discard block |
||
| 1060 | 1060 | */ |
| 1061 | 1061 | function geodir_cf_email($html,$location,$cf,$p=''){ |
| 1062 | 1062 | |
| 1063 | - // check we have the post value |
|
| 1064 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1065 | - else{ global $post;} |
|
| 1066 | - |
|
| 1067 | - if(!is_array($cf) && $cf!=''){ |
|
| 1068 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1069 | - if(!$cf){return NULL;} |
|
| 1070 | - } |
|
| 1071 | - |
|
| 1072 | - $html_var = $cf['htmlvar_name']; |
|
| 1073 | - |
|
| 1074 | - // Check if there is a location specific filter. |
|
| 1075 | - if(has_filter("geodir_custom_field_output_email_loc_{$location}")){ |
|
| 1076 | - /** |
|
| 1077 | - * Filter the email html by location. |
|
| 1078 | - * |
|
| 1079 | - * @param string $html The html to filter. |
|
| 1080 | - * @param array $cf The custom field array. |
|
| 1081 | - * @since 1.6.6 |
|
| 1082 | - */ |
|
| 1083 | - $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf); |
|
| 1084 | - } |
|
| 1085 | - |
|
| 1086 | - // Check if there is a custom field specific filter. |
|
| 1087 | - if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){ |
|
| 1088 | - /** |
|
| 1089 | - * Filter the email html by individual custom field. |
|
| 1090 | - * |
|
| 1091 | - * @param string $html The html to filter. |
|
| 1092 | - * @param string $location The location to output the html. |
|
| 1093 | - * @param array $cf The custom field array. |
|
| 1094 | - * @since 1.6.6 |
|
| 1095 | - */ |
|
| 1096 | - $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf); |
|
| 1097 | - } |
|
| 1098 | - |
|
| 1099 | - // Check if there is a custom field key specific filter. |
|
| 1100 | - if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){ |
|
| 1101 | - /** |
|
| 1102 | - * Filter the email html by field type key. |
|
| 1103 | - * |
|
| 1104 | - * @param string $html The html to filter. |
|
| 1105 | - * @param string $location The location to output the html. |
|
| 1106 | - * @param array $cf The custom field array. |
|
| 1107 | - * @since 1.6.6 |
|
| 1108 | - */ |
|
| 1109 | - $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1110 | - } |
|
| 1111 | - |
|
| 1112 | - // If not html then we run the standard output. |
|
| 1113 | - if(empty($html)){ |
|
| 1114 | - |
|
| 1115 | - global $preview; |
|
| 1116 | - if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) { |
|
| 1117 | - return ''; // Remove Send Enquiry | Send To Friend from listings page |
|
| 1118 | - } |
|
| 1119 | - |
|
| 1120 | - $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type); |
|
| 1121 | - |
|
| 1122 | - if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) { |
|
| 1123 | - global $send_to_friend; |
|
| 1124 | - $send_to_friend = true; |
|
| 1125 | - $b_send_inquiry = ''; |
|
| 1126 | - $b_sendtofriend = ''; |
|
| 1127 | - |
|
| 1128 | - $html = ''; |
|
| 1129 | - if (!$preview) { |
|
| 1130 | - $b_send_inquiry = 'b_send_inquiry'; |
|
| 1131 | - $b_sendtofriend = 'b_sendtofriend'; |
|
| 1132 | - $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>'; |
|
| 1133 | - } |
|
| 1134 | - |
|
| 1135 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1136 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1137 | - $field_icon_af = ''; |
|
| 1138 | - } elseif ($field_icon == '') { |
|
| 1139 | - $field_icon_af = '<i class="fa fa-envelope"></i>'; |
|
| 1140 | - } else { |
|
| 1141 | - $field_icon_af = $field_icon; |
|
| 1142 | - $field_icon = ''; |
|
| 1143 | - } |
|
| 1144 | - |
|
| 1145 | - $html .= '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1146 | - $seperator = ''; |
|
| 1147 | - if ($post->{$cf['htmlvar_name']}) { |
|
| 1148 | - $html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>'; |
|
| 1149 | - $seperator = ' | '; |
|
| 1150 | - } |
|
| 1151 | - |
|
| 1152 | - if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) { |
|
| 1153 | - $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>'; |
|
| 1154 | - } |
|
| 1155 | - |
|
| 1156 | - $html .= '</span></div>'; |
|
| 1157 | - |
|
| 1158 | - |
|
| 1159 | - if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') { |
|
| 1160 | - $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>'; |
|
| 1161 | - } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') { |
|
| 1162 | - $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>'; |
|
| 1163 | - } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') { |
|
| 1164 | - $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>'; |
|
| 1165 | - } |
|
| 1166 | - |
|
| 1167 | - /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/ |
|
| 1168 | - |
|
| 1169 | - } else { |
|
| 1170 | - |
|
| 1171 | - if ($post->{$cf['htmlvar_name']}) { |
|
| 1172 | - |
|
| 1173 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1174 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1175 | - $field_icon_af = ''; |
|
| 1176 | - } elseif ($field_icon == '') { |
|
| 1177 | - $field_icon_af = '<i class="fa fa-envelope"></i>'; |
|
| 1178 | - } else { |
|
| 1179 | - $field_icon_af = $field_icon; |
|
| 1180 | - $field_icon = ''; |
|
| 1181 | - } |
|
| 1182 | - |
|
| 1183 | - |
|
| 1184 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1185 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1186 | - $html .= '</span><span class="geodir-email-address-output">'; |
|
| 1187 | - $email = $post->{$cf['htmlvar_name']} ; |
|
| 1188 | - if($e_split = explode('@',$email)){ |
|
| 1189 | - /** |
|
| 1190 | - * Filter email custom field name output. |
|
| 1191 | - * |
|
| 1192 | - * @since 1.5.3 |
|
| 1193 | - * |
|
| 1194 | - * @param string $email The email string being output. |
|
| 1195 | - * @param array $cf Custom field variables array. |
|
| 1196 | - */ |
|
| 1197 | - $email_name = apply_filters('geodir_email_field_name_output',$email,$cf); |
|
| 1198 | - $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>"; |
|
| 1199 | - }else{ |
|
| 1200 | - $html .= $email; |
|
| 1201 | - } |
|
| 1202 | - $html .= '</span></div>'; |
|
| 1203 | - } |
|
| 1204 | - |
|
| 1205 | - } |
|
| 1206 | - |
|
| 1207 | - } |
|
| 1208 | - |
|
| 1209 | - return $html; |
|
| 1063 | + // check we have the post value |
|
| 1064 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1065 | + else{ global $post;} |
|
| 1066 | + |
|
| 1067 | + if(!is_array($cf) && $cf!=''){ |
|
| 1068 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1069 | + if(!$cf){return NULL;} |
|
| 1070 | + } |
|
| 1071 | + |
|
| 1072 | + $html_var = $cf['htmlvar_name']; |
|
| 1073 | + |
|
| 1074 | + // Check if there is a location specific filter. |
|
| 1075 | + if(has_filter("geodir_custom_field_output_email_loc_{$location}")){ |
|
| 1076 | + /** |
|
| 1077 | + * Filter the email html by location. |
|
| 1078 | + * |
|
| 1079 | + * @param string $html The html to filter. |
|
| 1080 | + * @param array $cf The custom field array. |
|
| 1081 | + * @since 1.6.6 |
|
| 1082 | + */ |
|
| 1083 | + $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf); |
|
| 1084 | + } |
|
| 1085 | + |
|
| 1086 | + // Check if there is a custom field specific filter. |
|
| 1087 | + if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){ |
|
| 1088 | + /** |
|
| 1089 | + * Filter the email html by individual custom field. |
|
| 1090 | + * |
|
| 1091 | + * @param string $html The html to filter. |
|
| 1092 | + * @param string $location The location to output the html. |
|
| 1093 | + * @param array $cf The custom field array. |
|
| 1094 | + * @since 1.6.6 |
|
| 1095 | + */ |
|
| 1096 | + $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf); |
|
| 1097 | + } |
|
| 1098 | + |
|
| 1099 | + // Check if there is a custom field key specific filter. |
|
| 1100 | + if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){ |
|
| 1101 | + /** |
|
| 1102 | + * Filter the email html by field type key. |
|
| 1103 | + * |
|
| 1104 | + * @param string $html The html to filter. |
|
| 1105 | + * @param string $location The location to output the html. |
|
| 1106 | + * @param array $cf The custom field array. |
|
| 1107 | + * @since 1.6.6 |
|
| 1108 | + */ |
|
| 1109 | + $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1110 | + } |
|
| 1111 | + |
|
| 1112 | + // If not html then we run the standard output. |
|
| 1113 | + if(empty($html)){ |
|
| 1114 | + |
|
| 1115 | + global $preview; |
|
| 1116 | + if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) { |
|
| 1117 | + return ''; // Remove Send Enquiry | Send To Friend from listings page |
|
| 1118 | + } |
|
| 1119 | + |
|
| 1120 | + $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type); |
|
| 1121 | + |
|
| 1122 | + if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) { |
|
| 1123 | + global $send_to_friend; |
|
| 1124 | + $send_to_friend = true; |
|
| 1125 | + $b_send_inquiry = ''; |
|
| 1126 | + $b_sendtofriend = ''; |
|
| 1127 | + |
|
| 1128 | + $html = ''; |
|
| 1129 | + if (!$preview) { |
|
| 1130 | + $b_send_inquiry = 'b_send_inquiry'; |
|
| 1131 | + $b_sendtofriend = 'b_sendtofriend'; |
|
| 1132 | + $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>'; |
|
| 1133 | + } |
|
| 1134 | + |
|
| 1135 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1136 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1137 | + $field_icon_af = ''; |
|
| 1138 | + } elseif ($field_icon == '') { |
|
| 1139 | + $field_icon_af = '<i class="fa fa-envelope"></i>'; |
|
| 1140 | + } else { |
|
| 1141 | + $field_icon_af = $field_icon; |
|
| 1142 | + $field_icon = ''; |
|
| 1143 | + } |
|
| 1144 | + |
|
| 1145 | + $html .= '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1146 | + $seperator = ''; |
|
| 1147 | + if ($post->{$cf['htmlvar_name']}) { |
|
| 1148 | + $html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>'; |
|
| 1149 | + $seperator = ' | '; |
|
| 1150 | + } |
|
| 1151 | + |
|
| 1152 | + if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) { |
|
| 1153 | + $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>'; |
|
| 1154 | + } |
|
| 1155 | + |
|
| 1156 | + $html .= '</span></div>'; |
|
| 1157 | + |
|
| 1158 | + |
|
| 1159 | + if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') { |
|
| 1160 | + $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>'; |
|
| 1161 | + } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') { |
|
| 1162 | + $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>'; |
|
| 1163 | + } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') { |
|
| 1164 | + $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>'; |
|
| 1165 | + } |
|
| 1166 | + |
|
| 1167 | + /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/ |
|
| 1168 | + |
|
| 1169 | + } else { |
|
| 1170 | + |
|
| 1171 | + if ($post->{$cf['htmlvar_name']}) { |
|
| 1172 | + |
|
| 1173 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1174 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1175 | + $field_icon_af = ''; |
|
| 1176 | + } elseif ($field_icon == '') { |
|
| 1177 | + $field_icon_af = '<i class="fa fa-envelope"></i>'; |
|
| 1178 | + } else { |
|
| 1179 | + $field_icon_af = $field_icon; |
|
| 1180 | + $field_icon = ''; |
|
| 1181 | + } |
|
| 1182 | + |
|
| 1183 | + |
|
| 1184 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1185 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1186 | + $html .= '</span><span class="geodir-email-address-output">'; |
|
| 1187 | + $email = $post->{$cf['htmlvar_name']} ; |
|
| 1188 | + if($e_split = explode('@',$email)){ |
|
| 1189 | + /** |
|
| 1190 | + * Filter email custom field name output. |
|
| 1191 | + * |
|
| 1192 | + * @since 1.5.3 |
|
| 1193 | + * |
|
| 1194 | + * @param string $email The email string being output. |
|
| 1195 | + * @param array $cf Custom field variables array. |
|
| 1196 | + */ |
|
| 1197 | + $email_name = apply_filters('geodir_email_field_name_output',$email,$cf); |
|
| 1198 | + $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>"; |
|
| 1199 | + }else{ |
|
| 1200 | + $html .= $email; |
|
| 1201 | + } |
|
| 1202 | + $html .= '</span></div>'; |
|
| 1203 | + } |
|
| 1204 | + |
|
| 1205 | + } |
|
| 1206 | + |
|
| 1207 | + } |
|
| 1208 | + |
|
| 1209 | + return $html; |
|
| 1210 | 1210 | } |
| 1211 | 1211 | add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3); |
| 1212 | 1212 | |
@@ -1223,130 +1223,130 @@ discard block |
||
| 1223 | 1223 | */ |
| 1224 | 1224 | function geodir_cf_file($html,$location,$cf,$p=''){ |
| 1225 | 1225 | |
| 1226 | - // check we have the post value |
|
| 1227 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1228 | - else{ global $post;} |
|
| 1229 | - |
|
| 1230 | - if(!is_array($cf) && $cf!=''){ |
|
| 1231 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1232 | - if(!$cf){return NULL;} |
|
| 1233 | - } |
|
| 1234 | - |
|
| 1235 | - $html_var = $cf['htmlvar_name']; |
|
| 1236 | - |
|
| 1237 | - // Check if there is a location specific filter. |
|
| 1238 | - if(has_filter("geodir_custom_field_output_file_loc_{$location}")){ |
|
| 1239 | - /** |
|
| 1240 | - * Filter the file html by location. |
|
| 1241 | - * |
|
| 1242 | - * @param string $html The html to filter. |
|
| 1243 | - * @param array $cf The custom field array. |
|
| 1244 | - * @since 1.6.6 |
|
| 1245 | - */ |
|
| 1246 | - $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf); |
|
| 1247 | - } |
|
| 1248 | - |
|
| 1249 | - // Check if there is a custom field specific filter. |
|
| 1250 | - if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){ |
|
| 1251 | - /** |
|
| 1252 | - * Filter the file html by individual custom field. |
|
| 1253 | - * |
|
| 1254 | - * @param string $html The html to filter. |
|
| 1255 | - * @param string $location The location to output the html. |
|
| 1256 | - * @param array $cf The custom field array. |
|
| 1257 | - * @since 1.6.6 |
|
| 1258 | - */ |
|
| 1259 | - $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf); |
|
| 1260 | - } |
|
| 1261 | - |
|
| 1262 | - // Check if there is a custom field key specific filter. |
|
| 1263 | - if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){ |
|
| 1264 | - /** |
|
| 1265 | - * Filter the file html by field type key. |
|
| 1266 | - * |
|
| 1267 | - * @param string $html The html to filter. |
|
| 1268 | - * @param string $location The location to output the html. |
|
| 1269 | - * @param array $cf The custom field array. |
|
| 1270 | - * @since 1.6.6 |
|
| 1271 | - */ |
|
| 1272 | - $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1273 | - } |
|
| 1274 | - |
|
| 1275 | - // If not html then we run the standard output. |
|
| 1276 | - if(empty($html)){ |
|
| 1277 | - |
|
| 1278 | - if (!empty($post->{$cf['htmlvar_name']})): |
|
| 1279 | - |
|
| 1280 | - $files = explode(",", $post->{$cf['htmlvar_name']}); |
|
| 1281 | - if (!empty($files)): |
|
| 1282 | - |
|
| 1283 | - $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL; |
|
| 1284 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : ''; |
|
| 1285 | - |
|
| 1286 | - $file_paths = ''; |
|
| 1287 | - foreach ($files as $file) { |
|
| 1288 | - if (!empty($file)) { |
|
| 1289 | - |
|
| 1290 | - // $filetype = wp_check_filetype($file); |
|
| 1291 | - |
|
| 1292 | - $image_name_arr = explode('/', $file); |
|
| 1293 | - $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
| 1294 | - $filename = end($image_name_arr); |
|
| 1295 | - $img_name_arr = explode('.', $filename); |
|
| 1296 | - |
|
| 1297 | - $arr_file_type = wp_check_filetype($filename); |
|
| 1298 | - if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) { |
|
| 1299 | - continue; |
|
| 1300 | - } |
|
| 1301 | - |
|
| 1302 | - $uploaded_file_type = $arr_file_type['type']; |
|
| 1303 | - $uploaded_file_ext = $arr_file_type['ext']; |
|
| 1304 | - |
|
| 1305 | - if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) { |
|
| 1306 | - continue; // Invalid file type. |
|
| 1307 | - } |
|
| 1308 | - |
|
| 1309 | - //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain'); |
|
| 1310 | - $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon'); |
|
| 1311 | - |
|
| 1312 | - // If the uploaded file is image |
|
| 1313 | - if (in_array($uploaded_file_type, $image_file_types)) { |
|
| 1314 | - $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">'; |
|
| 1315 | - $file_paths .= '<a href="'.$file.'">'; |
|
| 1316 | - $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false); |
|
| 1317 | - $file_paths .= '</a>'; |
|
| 1318 | - //$file_paths .= '<img src="'.$file.'" />'; |
|
| 1319 | - $file_paths .= '</div>'; |
|
| 1320 | - } else { |
|
| 1321 | - $ext_path = '_' . $html_var . '_'; |
|
| 1322 | - $filename = explode($ext_path, $filename); |
|
| 1323 | - $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>'; |
|
| 1324 | - } |
|
| 1325 | - } |
|
| 1326 | - } |
|
| 1327 | - |
|
| 1328 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1329 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1330 | - $field_icon_af = ''; |
|
| 1331 | - } elseif ($field_icon == '') { |
|
| 1332 | - $field_icon_af = ''; |
|
| 1333 | - } else { |
|
| 1334 | - $field_icon_af = $field_icon; |
|
| 1335 | - $field_icon = ''; |
|
| 1336 | - } |
|
| 1337 | - |
|
| 1338 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1339 | - $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">'; |
|
| 1340 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1341 | - $html .= '</span>'; |
|
| 1342 | - $html .= $file_paths . '</div></div>'; |
|
| 1343 | - |
|
| 1344 | - endif; |
|
| 1345 | - endif; |
|
| 1346 | - |
|
| 1347 | - } |
|
| 1348 | - |
|
| 1349 | - return $html; |
|
| 1226 | + // check we have the post value |
|
| 1227 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1228 | + else{ global $post;} |
|
| 1229 | + |
|
| 1230 | + if(!is_array($cf) && $cf!=''){ |
|
| 1231 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1232 | + if(!$cf){return NULL;} |
|
| 1233 | + } |
|
| 1234 | + |
|
| 1235 | + $html_var = $cf['htmlvar_name']; |
|
| 1236 | + |
|
| 1237 | + // Check if there is a location specific filter. |
|
| 1238 | + if(has_filter("geodir_custom_field_output_file_loc_{$location}")){ |
|
| 1239 | + /** |
|
| 1240 | + * Filter the file html by location. |
|
| 1241 | + * |
|
| 1242 | + * @param string $html The html to filter. |
|
| 1243 | + * @param array $cf The custom field array. |
|
| 1244 | + * @since 1.6.6 |
|
| 1245 | + */ |
|
| 1246 | + $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf); |
|
| 1247 | + } |
|
| 1248 | + |
|
| 1249 | + // Check if there is a custom field specific filter. |
|
| 1250 | + if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){ |
|
| 1251 | + /** |
|
| 1252 | + * Filter the file html by individual custom field. |
|
| 1253 | + * |
|
| 1254 | + * @param string $html The html to filter. |
|
| 1255 | + * @param string $location The location to output the html. |
|
| 1256 | + * @param array $cf The custom field array. |
|
| 1257 | + * @since 1.6.6 |
|
| 1258 | + */ |
|
| 1259 | + $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf); |
|
| 1260 | + } |
|
| 1261 | + |
|
| 1262 | + // Check if there is a custom field key specific filter. |
|
| 1263 | + if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){ |
|
| 1264 | + /** |
|
| 1265 | + * Filter the file html by field type key. |
|
| 1266 | + * |
|
| 1267 | + * @param string $html The html to filter. |
|
| 1268 | + * @param string $location The location to output the html. |
|
| 1269 | + * @param array $cf The custom field array. |
|
| 1270 | + * @since 1.6.6 |
|
| 1271 | + */ |
|
| 1272 | + $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1273 | + } |
|
| 1274 | + |
|
| 1275 | + // If not html then we run the standard output. |
|
| 1276 | + if(empty($html)){ |
|
| 1277 | + |
|
| 1278 | + if (!empty($post->{$cf['htmlvar_name']})): |
|
| 1279 | + |
|
| 1280 | + $files = explode(",", $post->{$cf['htmlvar_name']}); |
|
| 1281 | + if (!empty($files)): |
|
| 1282 | + |
|
| 1283 | + $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL; |
|
| 1284 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : ''; |
|
| 1285 | + |
|
| 1286 | + $file_paths = ''; |
|
| 1287 | + foreach ($files as $file) { |
|
| 1288 | + if (!empty($file)) { |
|
| 1289 | + |
|
| 1290 | + // $filetype = wp_check_filetype($file); |
|
| 1291 | + |
|
| 1292 | + $image_name_arr = explode('/', $file); |
|
| 1293 | + $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
| 1294 | + $filename = end($image_name_arr); |
|
| 1295 | + $img_name_arr = explode('.', $filename); |
|
| 1296 | + |
|
| 1297 | + $arr_file_type = wp_check_filetype($filename); |
|
| 1298 | + if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) { |
|
| 1299 | + continue; |
|
| 1300 | + } |
|
| 1301 | + |
|
| 1302 | + $uploaded_file_type = $arr_file_type['type']; |
|
| 1303 | + $uploaded_file_ext = $arr_file_type['ext']; |
|
| 1304 | + |
|
| 1305 | + if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) { |
|
| 1306 | + continue; // Invalid file type. |
|
| 1307 | + } |
|
| 1308 | + |
|
| 1309 | + //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain'); |
|
| 1310 | + $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon'); |
|
| 1311 | + |
|
| 1312 | + // If the uploaded file is image |
|
| 1313 | + if (in_array($uploaded_file_type, $image_file_types)) { |
|
| 1314 | + $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">'; |
|
| 1315 | + $file_paths .= '<a href="'.$file.'">'; |
|
| 1316 | + $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false); |
|
| 1317 | + $file_paths .= '</a>'; |
|
| 1318 | + //$file_paths .= '<img src="'.$file.'" />'; |
|
| 1319 | + $file_paths .= '</div>'; |
|
| 1320 | + } else { |
|
| 1321 | + $ext_path = '_' . $html_var . '_'; |
|
| 1322 | + $filename = explode($ext_path, $filename); |
|
| 1323 | + $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>'; |
|
| 1324 | + } |
|
| 1325 | + } |
|
| 1326 | + } |
|
| 1327 | + |
|
| 1328 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1329 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1330 | + $field_icon_af = ''; |
|
| 1331 | + } elseif ($field_icon == '') { |
|
| 1332 | + $field_icon_af = ''; |
|
| 1333 | + } else { |
|
| 1334 | + $field_icon_af = $field_icon; |
|
| 1335 | + $field_icon = ''; |
|
| 1336 | + } |
|
| 1337 | + |
|
| 1338 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1339 | + $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">'; |
|
| 1340 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1341 | + $html .= '</span>'; |
|
| 1342 | + $html .= $file_paths . '</div></div>'; |
|
| 1343 | + |
|
| 1344 | + endif; |
|
| 1345 | + endif; |
|
| 1346 | + |
|
| 1347 | + } |
|
| 1348 | + |
|
| 1349 | + return $html; |
|
| 1350 | 1350 | } |
| 1351 | 1351 | add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3); |
| 1352 | 1352 | |
@@ -1364,80 +1364,80 @@ discard block |
||
| 1364 | 1364 | */ |
| 1365 | 1365 | function geodir_cf_textarea($html,$location,$cf,$p=''){ |
| 1366 | 1366 | |
| 1367 | - // check we have the post value |
|
| 1368 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1369 | - else{ global $post;} |
|
| 1370 | - |
|
| 1371 | - if(!is_array($cf) && $cf!=''){ |
|
| 1372 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1373 | - if(!$cf){return NULL;} |
|
| 1374 | - } |
|
| 1375 | - |
|
| 1376 | - $html_var = $cf['htmlvar_name']; |
|
| 1377 | - |
|
| 1378 | - // Check if there is a location specific filter. |
|
| 1379 | - if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){ |
|
| 1380 | - /** |
|
| 1381 | - * Filter the textarea html by location. |
|
| 1382 | - * |
|
| 1383 | - * @param string $html The html to filter. |
|
| 1384 | - * @param array $cf The custom field array. |
|
| 1385 | - * @since 1.6.6 |
|
| 1386 | - */ |
|
| 1387 | - $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf); |
|
| 1388 | - } |
|
| 1389 | - |
|
| 1390 | - // Check if there is a custom field specific filter. |
|
| 1391 | - if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){ |
|
| 1392 | - /** |
|
| 1393 | - * Filter the textarea html by individual custom field. |
|
| 1394 | - * |
|
| 1395 | - * @param string $html The html to filter. |
|
| 1396 | - * @param string $location The location to output the html. |
|
| 1397 | - * @param array $cf The custom field array. |
|
| 1398 | - * @since 1.6.6 |
|
| 1399 | - */ |
|
| 1400 | - $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf); |
|
| 1401 | - } |
|
| 1402 | - |
|
| 1403 | - // Check if there is a custom field key specific filter. |
|
| 1404 | - if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){ |
|
| 1405 | - /** |
|
| 1406 | - * Filter the textarea html by field type key. |
|
| 1407 | - * |
|
| 1408 | - * @param string $html The html to filter. |
|
| 1409 | - * @param string $location The location to output the html. |
|
| 1410 | - * @param array $cf The custom field array. |
|
| 1411 | - * @since 1.6.6 |
|
| 1412 | - */ |
|
| 1413 | - $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1414 | - } |
|
| 1415 | - |
|
| 1416 | - // If not html then we run the standard output. |
|
| 1417 | - if(empty($html)){ |
|
| 1418 | - |
|
| 1419 | - if (!empty($post->{$cf['htmlvar_name']})) { |
|
| 1420 | - |
|
| 1421 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1422 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1423 | - $field_icon_af = ''; |
|
| 1424 | - } elseif ($field_icon == '') { |
|
| 1425 | - $field_icon_af = ''; |
|
| 1426 | - } else { |
|
| 1427 | - $field_icon_af = $field_icon; |
|
| 1428 | - $field_icon = ''; |
|
| 1429 | - } |
|
| 1430 | - |
|
| 1431 | - |
|
| 1432 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1433 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1434 | - $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
| 1435 | - |
|
| 1436 | - } |
|
| 1437 | - |
|
| 1438 | - } |
|
| 1439 | - |
|
| 1440 | - return $html; |
|
| 1367 | + // check we have the post value |
|
| 1368 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1369 | + else{ global $post;} |
|
| 1370 | + |
|
| 1371 | + if(!is_array($cf) && $cf!=''){ |
|
| 1372 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1373 | + if(!$cf){return NULL;} |
|
| 1374 | + } |
|
| 1375 | + |
|
| 1376 | + $html_var = $cf['htmlvar_name']; |
|
| 1377 | + |
|
| 1378 | + // Check if there is a location specific filter. |
|
| 1379 | + if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){ |
|
| 1380 | + /** |
|
| 1381 | + * Filter the textarea html by location. |
|
| 1382 | + * |
|
| 1383 | + * @param string $html The html to filter. |
|
| 1384 | + * @param array $cf The custom field array. |
|
| 1385 | + * @since 1.6.6 |
|
| 1386 | + */ |
|
| 1387 | + $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf); |
|
| 1388 | + } |
|
| 1389 | + |
|
| 1390 | + // Check if there is a custom field specific filter. |
|
| 1391 | + if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){ |
|
| 1392 | + /** |
|
| 1393 | + * Filter the textarea html by individual custom field. |
|
| 1394 | + * |
|
| 1395 | + * @param string $html The html to filter. |
|
| 1396 | + * @param string $location The location to output the html. |
|
| 1397 | + * @param array $cf The custom field array. |
|
| 1398 | + * @since 1.6.6 |
|
| 1399 | + */ |
|
| 1400 | + $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf); |
|
| 1401 | + } |
|
| 1402 | + |
|
| 1403 | + // Check if there is a custom field key specific filter. |
|
| 1404 | + if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){ |
|
| 1405 | + /** |
|
| 1406 | + * Filter the textarea html by field type key. |
|
| 1407 | + * |
|
| 1408 | + * @param string $html The html to filter. |
|
| 1409 | + * @param string $location The location to output the html. |
|
| 1410 | + * @param array $cf The custom field array. |
|
| 1411 | + * @since 1.6.6 |
|
| 1412 | + */ |
|
| 1413 | + $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1414 | + } |
|
| 1415 | + |
|
| 1416 | + // If not html then we run the standard output. |
|
| 1417 | + if(empty($html)){ |
|
| 1418 | + |
|
| 1419 | + if (!empty($post->{$cf['htmlvar_name']})) { |
|
| 1420 | + |
|
| 1421 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1422 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1423 | + $field_icon_af = ''; |
|
| 1424 | + } elseif ($field_icon == '') { |
|
| 1425 | + $field_icon_af = ''; |
|
| 1426 | + } else { |
|
| 1427 | + $field_icon_af = $field_icon; |
|
| 1428 | + $field_icon = ''; |
|
| 1429 | + } |
|
| 1430 | + |
|
| 1431 | + |
|
| 1432 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1433 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1434 | + $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
| 1435 | + |
|
| 1436 | + } |
|
| 1437 | + |
|
| 1438 | + } |
|
| 1439 | + |
|
| 1440 | + return $html; |
|
| 1441 | 1441 | } |
| 1442 | 1442 | add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3); |
| 1443 | 1443 | |
@@ -1455,79 +1455,79 @@ discard block |
||
| 1455 | 1455 | */ |
| 1456 | 1456 | function geodir_cf_html($html,$location,$cf,$p=''){ |
| 1457 | 1457 | |
| 1458 | - // check we have the post value |
|
| 1459 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1460 | - else{ global $post;} |
|
| 1461 | - |
|
| 1462 | - if(!is_array($cf) && $cf!=''){ |
|
| 1463 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1464 | - if(!$cf){return NULL;} |
|
| 1465 | - } |
|
| 1466 | - |
|
| 1467 | - $html_var = $cf['htmlvar_name']; |
|
| 1468 | - |
|
| 1469 | - // Check if there is a location specific filter. |
|
| 1470 | - if(has_filter("geodir_custom_field_output_html_loc_{$location}")){ |
|
| 1471 | - /** |
|
| 1472 | - * Filter the html html by location. |
|
| 1473 | - * |
|
| 1474 | - * @param string $html The html to filter. |
|
| 1475 | - * @param array $cf The custom field array. |
|
| 1476 | - * @since 1.6.6 |
|
| 1477 | - */ |
|
| 1478 | - $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf); |
|
| 1479 | - } |
|
| 1480 | - |
|
| 1481 | - // Check if there is a custom field specific filter. |
|
| 1482 | - if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){ |
|
| 1483 | - /** |
|
| 1484 | - * Filter the html html by individual custom field. |
|
| 1485 | - * |
|
| 1486 | - * @param string $html The html to filter. |
|
| 1487 | - * @param string $location The location to output the html. |
|
| 1488 | - * @param array $cf The custom field array. |
|
| 1489 | - * @since 1.6.6 |
|
| 1490 | - */ |
|
| 1491 | - $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf); |
|
| 1492 | - } |
|
| 1493 | - |
|
| 1494 | - // Check if there is a custom field key specific filter. |
|
| 1495 | - if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){ |
|
| 1496 | - /** |
|
| 1497 | - * Filter the html html by field type key. |
|
| 1498 | - * |
|
| 1499 | - * @param string $html The html to filter. |
|
| 1500 | - * @param string $location The location to output the html. |
|
| 1501 | - * @param array $cf The custom field array. |
|
| 1502 | - * @since 1.6.6 |
|
| 1503 | - */ |
|
| 1504 | - $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1505 | - } |
|
| 1506 | - |
|
| 1507 | - // If not html then we run the standard output. |
|
| 1508 | - if(empty($html)){ |
|
| 1509 | - |
|
| 1510 | - if (!empty($post->{$cf['htmlvar_name']})) { |
|
| 1511 | - |
|
| 1512 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1513 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1514 | - $field_icon_af = ''; |
|
| 1515 | - } elseif ($field_icon == '') { |
|
| 1516 | - $field_icon_af = ''; |
|
| 1517 | - } else { |
|
| 1518 | - $field_icon_af = $field_icon; |
|
| 1519 | - $field_icon = ''; |
|
| 1520 | - } |
|
| 1521 | - |
|
| 1522 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1523 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1524 | - $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
| 1525 | - |
|
| 1526 | - } |
|
| 1527 | - |
|
| 1528 | - } |
|
| 1529 | - |
|
| 1530 | - return $html; |
|
| 1458 | + // check we have the post value |
|
| 1459 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1460 | + else{ global $post;} |
|
| 1461 | + |
|
| 1462 | + if(!is_array($cf) && $cf!=''){ |
|
| 1463 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1464 | + if(!$cf){return NULL;} |
|
| 1465 | + } |
|
| 1466 | + |
|
| 1467 | + $html_var = $cf['htmlvar_name']; |
|
| 1468 | + |
|
| 1469 | + // Check if there is a location specific filter. |
|
| 1470 | + if(has_filter("geodir_custom_field_output_html_loc_{$location}")){ |
|
| 1471 | + /** |
|
| 1472 | + * Filter the html html by location. |
|
| 1473 | + * |
|
| 1474 | + * @param string $html The html to filter. |
|
| 1475 | + * @param array $cf The custom field array. |
|
| 1476 | + * @since 1.6.6 |
|
| 1477 | + */ |
|
| 1478 | + $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf); |
|
| 1479 | + } |
|
| 1480 | + |
|
| 1481 | + // Check if there is a custom field specific filter. |
|
| 1482 | + if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){ |
|
| 1483 | + /** |
|
| 1484 | + * Filter the html html by individual custom field. |
|
| 1485 | + * |
|
| 1486 | + * @param string $html The html to filter. |
|
| 1487 | + * @param string $location The location to output the html. |
|
| 1488 | + * @param array $cf The custom field array. |
|
| 1489 | + * @since 1.6.6 |
|
| 1490 | + */ |
|
| 1491 | + $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf); |
|
| 1492 | + } |
|
| 1493 | + |
|
| 1494 | + // Check if there is a custom field key specific filter. |
|
| 1495 | + if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){ |
|
| 1496 | + /** |
|
| 1497 | + * Filter the html html by field type key. |
|
| 1498 | + * |
|
| 1499 | + * @param string $html The html to filter. |
|
| 1500 | + * @param string $location The location to output the html. |
|
| 1501 | + * @param array $cf The custom field array. |
|
| 1502 | + * @since 1.6.6 |
|
| 1503 | + */ |
|
| 1504 | + $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1505 | + } |
|
| 1506 | + |
|
| 1507 | + // If not html then we run the standard output. |
|
| 1508 | + if(empty($html)){ |
|
| 1509 | + |
|
| 1510 | + if (!empty($post->{$cf['htmlvar_name']})) { |
|
| 1511 | + |
|
| 1512 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1513 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1514 | + $field_icon_af = ''; |
|
| 1515 | + } elseif ($field_icon == '') { |
|
| 1516 | + $field_icon_af = ''; |
|
| 1517 | + } else { |
|
| 1518 | + $field_icon_af = $field_icon; |
|
| 1519 | + $field_icon = ''; |
|
| 1520 | + } |
|
| 1521 | + |
|
| 1522 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1523 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1524 | + $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>'; |
|
| 1525 | + |
|
| 1526 | + } |
|
| 1527 | + |
|
| 1528 | + } |
|
| 1529 | + |
|
| 1530 | + return $html; |
|
| 1531 | 1531 | } |
| 1532 | 1532 | add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3); |
| 1533 | 1533 | |
@@ -1545,113 +1545,113 @@ discard block |
||
| 1545 | 1545 | */ |
| 1546 | 1546 | function geodir_cf_taxonomy($html,$location,$cf,$p=''){ |
| 1547 | 1547 | |
| 1548 | - // check we have the post value |
|
| 1549 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1550 | - else{ global $post;} |
|
| 1551 | - |
|
| 1552 | - if(!is_array($cf) && $cf!=''){ |
|
| 1553 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1554 | - if(!$cf){return NULL;} |
|
| 1555 | - } |
|
| 1556 | - |
|
| 1557 | - $html_var = $cf['htmlvar_name']; |
|
| 1558 | - |
|
| 1559 | - // Check if there is a location specific filter. |
|
| 1560 | - if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){ |
|
| 1561 | - /** |
|
| 1562 | - * Filter the taxonomy html by location. |
|
| 1563 | - * |
|
| 1564 | - * @param string $html The html to filter. |
|
| 1565 | - * @param array $cf The custom field array. |
|
| 1566 | - * @since 1.6.6 |
|
| 1567 | - */ |
|
| 1568 | - $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf); |
|
| 1569 | - } |
|
| 1570 | - |
|
| 1571 | - // Check if there is a custom field specific filter. |
|
| 1572 | - if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){ |
|
| 1573 | - /** |
|
| 1574 | - * Filter the taxonomy html by individual custom field. |
|
| 1575 | - * |
|
| 1576 | - * @param string $html The html to filter. |
|
| 1577 | - * @param string $location The location to output the html. |
|
| 1578 | - * @param array $cf The custom field array. |
|
| 1579 | - * @since 1.6.6 |
|
| 1580 | - */ |
|
| 1581 | - $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf); |
|
| 1582 | - } |
|
| 1583 | - |
|
| 1584 | - // Check if there is a custom field key specific filter. |
|
| 1585 | - if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){ |
|
| 1586 | - /** |
|
| 1587 | - * Filter the taxonomy html by field type key. |
|
| 1588 | - * |
|
| 1589 | - * @param string $html The html to filter. |
|
| 1590 | - * @param string $location The location to output the html. |
|
| 1591 | - * @param array $cf The custom field array. |
|
| 1592 | - * @since 1.6.6 |
|
| 1593 | - */ |
|
| 1594 | - $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1595 | - } |
|
| 1596 | - |
|
| 1597 | - // If not html then we run the standard output. |
|
| 1598 | - if(empty($html)){ |
|
| 1599 | - |
|
| 1600 | - if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) { |
|
| 1601 | - $post_taxonomy = $post->post_type . 'category'; |
|
| 1602 | - $field_value = $post->{$html_var}; |
|
| 1603 | - $links = array(); |
|
| 1604 | - $terms = array(); |
|
| 1605 | - $termsOrdered = array(); |
|
| 1606 | - if (!is_array($field_value)) { |
|
| 1607 | - $field_value = explode(",", trim($field_value, ",")); |
|
| 1608 | - } |
|
| 1609 | - |
|
| 1610 | - $field_value = array_unique($field_value); |
|
| 1611 | - |
|
| 1612 | - if (!empty($field_value)) { |
|
| 1613 | - foreach ($field_value as $term) { |
|
| 1614 | - $term = trim($term); |
|
| 1615 | - |
|
| 1616 | - if ($term != '') { |
|
| 1617 | - $term = get_term_by('id', $term, $html_var); |
|
| 1618 | - if (is_object($term)) { |
|
| 1619 | - $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>"; |
|
| 1620 | - $terms[] = $term; |
|
| 1621 | - } |
|
| 1622 | - } |
|
| 1623 | - } |
|
| 1624 | - if (!empty($links)) { |
|
| 1625 | - // order alphabetically |
|
| 1626 | - asort($links); |
|
| 1627 | - foreach (array_keys($links) as $key) { |
|
| 1628 | - $termsOrdered[$key] = $terms[$key]; |
|
| 1629 | - } |
|
| 1630 | - $terms = $termsOrdered; |
|
| 1631 | - } |
|
| 1632 | - } |
|
| 1633 | - $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : ''; |
|
| 1634 | - |
|
| 1635 | - if ($html_value != '') { |
|
| 1636 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 1637 | - if (strpos($field_icon, 'http') !== false) { |
|
| 1638 | - $field_icon_af = ''; |
|
| 1639 | - } else if ($field_icon == '') { |
|
| 1640 | - $field_icon_af = ''; |
|
| 1641 | - } else { |
|
| 1642 | - $field_icon_af = $field_icon; |
|
| 1643 | - $field_icon = ''; |
|
| 1644 | - } |
|
| 1645 | - |
|
| 1646 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1647 | - $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1648 | - $html .= '</span> ' . $html_value . '</div>'; |
|
| 1649 | - } |
|
| 1650 | - } |
|
| 1651 | - |
|
| 1652 | - } |
|
| 1653 | - |
|
| 1654 | - return $html; |
|
| 1548 | + // check we have the post value |
|
| 1549 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1550 | + else{ global $post;} |
|
| 1551 | + |
|
| 1552 | + if(!is_array($cf) && $cf!=''){ |
|
| 1553 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1554 | + if(!$cf){return NULL;} |
|
| 1555 | + } |
|
| 1556 | + |
|
| 1557 | + $html_var = $cf['htmlvar_name']; |
|
| 1558 | + |
|
| 1559 | + // Check if there is a location specific filter. |
|
| 1560 | + if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){ |
|
| 1561 | + /** |
|
| 1562 | + * Filter the taxonomy html by location. |
|
| 1563 | + * |
|
| 1564 | + * @param string $html The html to filter. |
|
| 1565 | + * @param array $cf The custom field array. |
|
| 1566 | + * @since 1.6.6 |
|
| 1567 | + */ |
|
| 1568 | + $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf); |
|
| 1569 | + } |
|
| 1570 | + |
|
| 1571 | + // Check if there is a custom field specific filter. |
|
| 1572 | + if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){ |
|
| 1573 | + /** |
|
| 1574 | + * Filter the taxonomy html by individual custom field. |
|
| 1575 | + * |
|
| 1576 | + * @param string $html The html to filter. |
|
| 1577 | + * @param string $location The location to output the html. |
|
| 1578 | + * @param array $cf The custom field array. |
|
| 1579 | + * @since 1.6.6 |
|
| 1580 | + */ |
|
| 1581 | + $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf); |
|
| 1582 | + } |
|
| 1583 | + |
|
| 1584 | + // Check if there is a custom field key specific filter. |
|
| 1585 | + if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){ |
|
| 1586 | + /** |
|
| 1587 | + * Filter the taxonomy html by field type key. |
|
| 1588 | + * |
|
| 1589 | + * @param string $html The html to filter. |
|
| 1590 | + * @param string $location The location to output the html. |
|
| 1591 | + * @param array $cf The custom field array. |
|
| 1592 | + * @since 1.6.6 |
|
| 1593 | + */ |
|
| 1594 | + $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1595 | + } |
|
| 1596 | + |
|
| 1597 | + // If not html then we run the standard output. |
|
| 1598 | + if(empty($html)){ |
|
| 1599 | + |
|
| 1600 | + if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) { |
|
| 1601 | + $post_taxonomy = $post->post_type . 'category'; |
|
| 1602 | + $field_value = $post->{$html_var}; |
|
| 1603 | + $links = array(); |
|
| 1604 | + $terms = array(); |
|
| 1605 | + $termsOrdered = array(); |
|
| 1606 | + if (!is_array($field_value)) { |
|
| 1607 | + $field_value = explode(",", trim($field_value, ",")); |
|
| 1608 | + } |
|
| 1609 | + |
|
| 1610 | + $field_value = array_unique($field_value); |
|
| 1611 | + |
|
| 1612 | + if (!empty($field_value)) { |
|
| 1613 | + foreach ($field_value as $term) { |
|
| 1614 | + $term = trim($term); |
|
| 1615 | + |
|
| 1616 | + if ($term != '') { |
|
| 1617 | + $term = get_term_by('id', $term, $html_var); |
|
| 1618 | + if (is_object($term)) { |
|
| 1619 | + $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>"; |
|
| 1620 | + $terms[] = $term; |
|
| 1621 | + } |
|
| 1622 | + } |
|
| 1623 | + } |
|
| 1624 | + if (!empty($links)) { |
|
| 1625 | + // order alphabetically |
|
| 1626 | + asort($links); |
|
| 1627 | + foreach (array_keys($links) as $key) { |
|
| 1628 | + $termsOrdered[$key] = $terms[$key]; |
|
| 1629 | + } |
|
| 1630 | + $terms = $termsOrdered; |
|
| 1631 | + } |
|
| 1632 | + } |
|
| 1633 | + $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : ''; |
|
| 1634 | + |
|
| 1635 | + if ($html_value != '') { |
|
| 1636 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 1637 | + if (strpos($field_icon, 'http') !== false) { |
|
| 1638 | + $field_icon_af = ''; |
|
| 1639 | + } else if ($field_icon == '') { |
|
| 1640 | + $field_icon_af = ''; |
|
| 1641 | + } else { |
|
| 1642 | + $field_icon_af = $field_icon; |
|
| 1643 | + $field_icon = ''; |
|
| 1644 | + } |
|
| 1645 | + |
|
| 1646 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1647 | + $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : ''; |
|
| 1648 | + $html .= '</span> ' . $html_value . '</div>'; |
|
| 1649 | + } |
|
| 1650 | + } |
|
| 1651 | + |
|
| 1652 | + } |
|
| 1653 | + |
|
| 1654 | + return $html; |
|
| 1655 | 1655 | } |
| 1656 | 1656 | add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3); |
| 1657 | 1657 | |
@@ -1668,161 +1668,161 @@ discard block |
||
| 1668 | 1668 | */ |
| 1669 | 1669 | function geodir_cf_address($html,$location,$cf,$p=''){ |
| 1670 | 1670 | |
| 1671 | - // check we have the post value |
|
| 1672 | - if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1673 | - else{ global $post;} |
|
| 1674 | - |
|
| 1675 | - if(!is_array($cf) && $cf!=''){ |
|
| 1676 | - $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1677 | - if(!$cf){return NULL;} |
|
| 1678 | - } |
|
| 1679 | - |
|
| 1680 | - $html_var = $cf['htmlvar_name']; |
|
| 1681 | - |
|
| 1682 | - // Check if there is a location specific filter. |
|
| 1683 | - if(has_filter("geodir_custom_field_output_address_loc_{$location}")){ |
|
| 1684 | - /** |
|
| 1685 | - * Filter the address html by location. |
|
| 1686 | - * |
|
| 1687 | - * @param string $html The html to filter. |
|
| 1688 | - * @param array $cf The custom field array. |
|
| 1689 | - * @since 1.6.6 |
|
| 1690 | - */ |
|
| 1691 | - $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf); |
|
| 1692 | - } |
|
| 1693 | - |
|
| 1694 | - // Check if there is a custom field specific filter. |
|
| 1695 | - if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){ |
|
| 1696 | - /** |
|
| 1697 | - * Filter the address html by individual custom field. |
|
| 1698 | - * |
|
| 1699 | - * @param string $html The html to filter. |
|
| 1700 | - * @param string $location The location to output the html. |
|
| 1701 | - * @param array $cf The custom field array. |
|
| 1702 | - * @since 1.6.6 |
|
| 1703 | - */ |
|
| 1704 | - $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf); |
|
| 1705 | - } |
|
| 1706 | - |
|
| 1707 | - // Check if there is a custom field key specific filter. |
|
| 1708 | - if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){ |
|
| 1709 | - /** |
|
| 1710 | - * Filter the address html by field type key. |
|
| 1711 | - * |
|
| 1712 | - * @param string $html The html to filter. |
|
| 1713 | - * @param string $location The location to output the html. |
|
| 1714 | - * @param array $cf The custom field array. |
|
| 1715 | - * @since 1.6.6 |
|
| 1716 | - */ |
|
| 1717 | - $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1718 | - } |
|
| 1719 | - |
|
| 1720 | - // If not html then we run the standard output. |
|
| 1721 | - if(empty($html)){ |
|
| 1722 | - |
|
| 1723 | - global $preview; |
|
| 1724 | - $html_var = $cf['htmlvar_name'] . '_address'; |
|
| 1725 | - |
|
| 1726 | - if ($cf['extra_fields']) { |
|
| 1727 | - |
|
| 1728 | - $extra_fields = stripslashes_deep(unserialize($cf['extra_fields'])); |
|
| 1729 | - |
|
| 1730 | - $addition_fields = ''; |
|
| 1731 | - |
|
| 1732 | - if (!empty($extra_fields)) { |
|
| 1733 | - |
|
| 1734 | - $show_city_in_address = false; |
|
| 1735 | - if (isset($extra_fields['show_city']) && $extra_fields['show_city']) { |
|
| 1736 | - $show_city_in_address = true; |
|
| 1737 | - } |
|
| 1738 | - /** |
|
| 1739 | - * Filter "show city in address" value. |
|
| 1740 | - * |
|
| 1741 | - * @since 1.0.0 |
|
| 1742 | - */ |
|
| 1743 | - $show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address); |
|
| 1744 | - |
|
| 1745 | - |
|
| 1746 | - $show_region_in_address = false; |
|
| 1747 | - if (isset($extra_fields['show_region']) && $extra_fields['show_region']) { |
|
| 1748 | - $show_region_in_address = true; |
|
| 1749 | - } |
|
| 1750 | - /** |
|
| 1751 | - * Filter "show region in address" value. |
|
| 1752 | - * |
|
| 1753 | - * @since 1.6.6 |
|
| 1754 | - */ |
|
| 1755 | - $show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address); |
|
| 1756 | - |
|
| 1757 | - $show_country_in_address = false; |
|
| 1758 | - if (isset($extra_fields['show_country']) && $extra_fields['show_country']) { |
|
| 1759 | - $show_country_in_address = true; |
|
| 1760 | - } |
|
| 1761 | - /** |
|
| 1762 | - * Filter "show country in address" value. |
|
| 1763 | - * |
|
| 1764 | - * @since 1.6.6 |
|
| 1765 | - */ |
|
| 1766 | - $show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address); |
|
| 1767 | - |
|
| 1768 | - $show_zip_in_address = false; |
|
| 1769 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { |
|
| 1770 | - $show_zip_in_address = true; |
|
| 1771 | - } |
|
| 1772 | - /** |
|
| 1773 | - * Filter "show zip in address" value. |
|
| 1774 | - * |
|
| 1775 | - * @since 1.6.6 |
|
| 1776 | - */ |
|
| 1777 | - $show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address); |
|
| 1778 | - |
|
| 1779 | - |
|
| 1780 | - } |
|
| 1781 | - |
|
| 1782 | - } |
|
| 1783 | - |
|
| 1784 | - |
|
| 1785 | - if ($post->{$html_var}) { |
|
| 1786 | - |
|
| 1787 | - $field_icon = geodir_field_icon_proccess( $cf ); |
|
| 1788 | - if ( strpos( $field_icon, 'http' ) !== false ) { |
|
| 1789 | - $field_icon_af = ''; |
|
| 1790 | - } elseif ( $field_icon == '' ) { |
|
| 1791 | - $field_icon_af = '<i class="fa fa-home"></i>'; |
|
| 1792 | - } else { |
|
| 1793 | - $field_icon_af = $field_icon; |
|
| 1794 | - $field_icon = ''; |
|
| 1795 | - } |
|
| 1671 | + // check we have the post value |
|
| 1672 | + if(is_int($p)){$post = geodir_get_post_info($p);} |
|
| 1673 | + else{ global $post;} |
|
| 1674 | + |
|
| 1675 | + if(!is_array($cf) && $cf!=''){ |
|
| 1676 | + $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type); |
|
| 1677 | + if(!$cf){return NULL;} |
|
| 1678 | + } |
|
| 1679 | + |
|
| 1680 | + $html_var = $cf['htmlvar_name']; |
|
| 1681 | + |
|
| 1682 | + // Check if there is a location specific filter. |
|
| 1683 | + if(has_filter("geodir_custom_field_output_address_loc_{$location}")){ |
|
| 1684 | + /** |
|
| 1685 | + * Filter the address html by location. |
|
| 1686 | + * |
|
| 1687 | + * @param string $html The html to filter. |
|
| 1688 | + * @param array $cf The custom field array. |
|
| 1689 | + * @since 1.6.6 |
|
| 1690 | + */ |
|
| 1691 | + $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf); |
|
| 1692 | + } |
|
| 1693 | + |
|
| 1694 | + // Check if there is a custom field specific filter. |
|
| 1695 | + if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){ |
|
| 1696 | + /** |
|
| 1697 | + * Filter the address html by individual custom field. |
|
| 1698 | + * |
|
| 1699 | + * @param string $html The html to filter. |
|
| 1700 | + * @param string $location The location to output the html. |
|
| 1701 | + * @param array $cf The custom field array. |
|
| 1702 | + * @since 1.6.6 |
|
| 1703 | + */ |
|
| 1704 | + $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf); |
|
| 1705 | + } |
|
| 1706 | + |
|
| 1707 | + // Check if there is a custom field key specific filter. |
|
| 1708 | + if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){ |
|
| 1709 | + /** |
|
| 1710 | + * Filter the address html by field type key. |
|
| 1711 | + * |
|
| 1712 | + * @param string $html The html to filter. |
|
| 1713 | + * @param string $location The location to output the html. |
|
| 1714 | + * @param array $cf The custom field array. |
|
| 1715 | + * @since 1.6.6 |
|
| 1716 | + */ |
|
| 1717 | + $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf); |
|
| 1718 | + } |
|
| 1719 | + |
|
| 1720 | + // If not html then we run the standard output. |
|
| 1721 | + if(empty($html)){ |
|
| 1722 | + |
|
| 1723 | + global $preview; |
|
| 1724 | + $html_var = $cf['htmlvar_name'] . '_address'; |
|
| 1725 | + |
|
| 1726 | + if ($cf['extra_fields']) { |
|
| 1727 | + |
|
| 1728 | + $extra_fields = stripslashes_deep(unserialize($cf['extra_fields'])); |
|
| 1729 | + |
|
| 1730 | + $addition_fields = ''; |
|
| 1731 | + |
|
| 1732 | + if (!empty($extra_fields)) { |
|
| 1733 | + |
|
| 1734 | + $show_city_in_address = false; |
|
| 1735 | + if (isset($extra_fields['show_city']) && $extra_fields['show_city']) { |
|
| 1736 | + $show_city_in_address = true; |
|
| 1737 | + } |
|
| 1738 | + /** |
|
| 1739 | + * Filter "show city in address" value. |
|
| 1740 | + * |
|
| 1741 | + * @since 1.0.0 |
|
| 1742 | + */ |
|
| 1743 | + $show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address); |
|
| 1744 | + |
|
| 1745 | + |
|
| 1746 | + $show_region_in_address = false; |
|
| 1747 | + if (isset($extra_fields['show_region']) && $extra_fields['show_region']) { |
|
| 1748 | + $show_region_in_address = true; |
|
| 1749 | + } |
|
| 1750 | + /** |
|
| 1751 | + * Filter "show region in address" value. |
|
| 1752 | + * |
|
| 1753 | + * @since 1.6.6 |
|
| 1754 | + */ |
|
| 1755 | + $show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address); |
|
| 1756 | + |
|
| 1757 | + $show_country_in_address = false; |
|
| 1758 | + if (isset($extra_fields['show_country']) && $extra_fields['show_country']) { |
|
| 1759 | + $show_country_in_address = true; |
|
| 1760 | + } |
|
| 1761 | + /** |
|
| 1762 | + * Filter "show country in address" value. |
|
| 1763 | + * |
|
| 1764 | + * @since 1.6.6 |
|
| 1765 | + */ |
|
| 1766 | + $show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address); |
|
| 1767 | + |
|
| 1768 | + $show_zip_in_address = false; |
|
| 1769 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { |
|
| 1770 | + $show_zip_in_address = true; |
|
| 1771 | + } |
|
| 1772 | + /** |
|
| 1773 | + * Filter "show zip in address" value. |
|
| 1774 | + * |
|
| 1775 | + * @since 1.6.6 |
|
| 1776 | + */ |
|
| 1777 | + $show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address); |
|
| 1778 | + |
|
| 1779 | + |
|
| 1780 | + } |
|
| 1781 | + |
|
| 1782 | + } |
|
| 1783 | + |
|
| 1784 | + |
|
| 1785 | + if ($post->{$html_var}) { |
|
| 1786 | + |
|
| 1787 | + $field_icon = geodir_field_icon_proccess( $cf ); |
|
| 1788 | + if ( strpos( $field_icon, 'http' ) !== false ) { |
|
| 1789 | + $field_icon_af = ''; |
|
| 1790 | + } elseif ( $field_icon == '' ) { |
|
| 1791 | + $field_icon_af = '<i class="fa fa-home"></i>'; |
|
| 1792 | + } else { |
|
| 1793 | + $field_icon_af = $field_icon; |
|
| 1794 | + $field_icon = ''; |
|
| 1795 | + } |
|
| 1796 | 1796 | |
| 1797 | 1797 | |
| 1798 | 1798 | |
| 1799 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;" itemscope itemtype="https://schema.org/PostalAddress">'; |
|
| 1800 | - $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1801 | - $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : ' '; |
|
| 1802 | - $html .= '</span>'; |
|
| 1799 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;" itemscope itemtype="https://schema.org/PostalAddress">'; |
|
| 1800 | + $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af; |
|
| 1801 | + $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : ' '; |
|
| 1802 | + $html .= '</span>'; |
|
| 1803 | 1803 | |
| 1804 | - if ( isset($post->post_address) ) { |
|
| 1805 | - $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>'; |
|
| 1806 | - } |
|
| 1807 | - if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) { |
|
| 1808 | - $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>'; |
|
| 1809 | - } |
|
| 1810 | - if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) { |
|
| 1811 | - $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>'; |
|
| 1812 | - } |
|
| 1813 | - if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) { |
|
| 1814 | - $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>'; |
|
| 1815 | - } |
|
| 1816 | - if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) { |
|
| 1817 | - $html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>'; |
|
| 1818 | - } |
|
| 1819 | - $html .= '</div>'; |
|
| 1804 | + if ( isset($post->post_address) ) { |
|
| 1805 | + $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>'; |
|
| 1806 | + } |
|
| 1807 | + if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) { |
|
| 1808 | + $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>'; |
|
| 1809 | + } |
|
| 1810 | + if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) { |
|
| 1811 | + $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>'; |
|
| 1812 | + } |
|
| 1813 | + if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) { |
|
| 1814 | + $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>'; |
|
| 1815 | + } |
|
| 1816 | + if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) { |
|
| 1817 | + $html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>'; |
|
| 1818 | + } |
|
| 1819 | + $html .= '</div>'; |
|
| 1820 | 1820 | |
| 1821 | - } |
|
| 1821 | + } |
|
| 1822 | 1822 | |
| 1823 | - } |
|
| 1823 | + } |
|
| 1824 | 1824 | |
| 1825 | 1825 | |
| 1826 | - return $html; |
|
| 1826 | + return $html; |
|
| 1827 | 1827 | } |
| 1828 | 1828 | add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3); |
| 1829 | 1829 | \ No newline at end of file |
@@ -19,35 +19,35 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | function geodir_cfi_fieldset($html,$cf){ |
| 21 | 21 | |
| 22 | - $html_var = $cf['htmlvar_name']; |
|
| 23 | - |
|
| 24 | - // Check if there is a custom field specific filter. |
|
| 25 | - if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){ |
|
| 26 | - /** |
|
| 27 | - * Filter the fieldset html by individual custom field. |
|
| 28 | - * |
|
| 29 | - * @param string $html The html to filter. |
|
| 30 | - * @param array $cf The custom field array. |
|
| 31 | - * @since 1.6.6 |
|
| 32 | - */ |
|
| 33 | - $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf); |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - // If no html then we run the standard output. |
|
| 37 | - if(empty($html)) { |
|
| 38 | - |
|
| 39 | - ob_start(); // Start buffering; |
|
| 40 | - ?> |
|
| 22 | + $html_var = $cf['htmlvar_name']; |
|
| 23 | + |
|
| 24 | + // Check if there is a custom field specific filter. |
|
| 25 | + if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){ |
|
| 26 | + /** |
|
| 27 | + * Filter the fieldset html by individual custom field. |
|
| 28 | + * |
|
| 29 | + * @param string $html The html to filter. |
|
| 30 | + * @param array $cf The custom field array. |
|
| 31 | + * @since 1.6.6 |
|
| 32 | + */ |
|
| 33 | + $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf); |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + // If no html then we run the standard output. |
|
| 37 | + if(empty($html)) { |
|
| 38 | + |
|
| 39 | + ob_start(); // Start buffering; |
|
| 40 | + ?> |
|
| 41 | 41 | <h5 id="geodir_fieldset_<?php echo (int) $cf['id']; ?>" class="geodir-fieldset-row" |
| 42 | 42 | gd-fieldset="<?php echo (int) $cf['id']; ?>"><?php echo $cf['site_title']; ?> |
| 43 | 43 | <?php if ( $cf['desc'] != '' ) { |
| 44 | - echo '<small>( ' . $cf['desc'] . ' )</small>'; |
|
| 45 | - } ?></h5> |
|
| 44 | + echo '<small>( ' . $cf['desc'] . ' )</small>'; |
|
| 45 | + } ?></h5> |
|
| 46 | 46 | <?php |
| 47 | - $html = ob_get_clean(); |
|
| 48 | - } |
|
| 47 | + $html = ob_get_clean(); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - return $html; |
|
| 50 | + return $html; |
|
| 51 | 51 | } |
| 52 | 52 | add_filter('geodir_custom_field_input_fieldset','geodir_cfi_fieldset',10,2); |
| 53 | 53 | |
@@ -64,47 +64,47 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | function geodir_cfi_text($html,$cf){ |
| 66 | 66 | |
| 67 | - $html_var = $cf['htmlvar_name']; |
|
| 68 | - |
|
| 69 | - // Check if there is a custom field specific filter. |
|
| 70 | - if(has_filter("geodir_custom_field_input_text_{$html_var}")){ |
|
| 71 | - /** |
|
| 72 | - * Filter the text html by individual custom field. |
|
| 73 | - * |
|
| 74 | - * @param string $html The html to filter. |
|
| 75 | - * @param array $cf The custom field array. |
|
| 76 | - * @since 1.6.6 |
|
| 77 | - */ |
|
| 78 | - $html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf); |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - // If no html then we run the standard output. |
|
| 82 | - if(empty($html)) { |
|
| 83 | - |
|
| 84 | - ob_start(); // Start buffering; |
|
| 85 | - |
|
| 86 | - $value = geodir_get_cf_value($cf); |
|
| 87 | - $type = $cf['type']; |
|
| 88 | - //number and float validation $validation_pattern |
|
| 89 | - if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';} |
|
| 90 | - elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';} |
|
| 91 | - |
|
| 92 | - //validation |
|
| 93 | - if(isset($cf['validation_pattern']) && $cf['validation_pattern']){ |
|
| 94 | - $validation = 'pattern="'.$cf['validation_pattern'].'"'; |
|
| 95 | - }else{$validation='';} |
|
| 96 | - |
|
| 97 | - // validation message |
|
| 98 | - if(isset($cf['validation_msg']) && $cf['validation_msg']){ |
|
| 99 | - $validation_msg = 'title="'.$cf['validation_msg'].'"'; |
|
| 100 | - }else{$validation_msg='';} |
|
| 101 | - ?> |
|
| 67 | + $html_var = $cf['htmlvar_name']; |
|
| 68 | + |
|
| 69 | + // Check if there is a custom field specific filter. |
|
| 70 | + if(has_filter("geodir_custom_field_input_text_{$html_var}")){ |
|
| 71 | + /** |
|
| 72 | + * Filter the text html by individual custom field. |
|
| 73 | + * |
|
| 74 | + * @param string $html The html to filter. |
|
| 75 | + * @param array $cf The custom field array. |
|
| 76 | + * @since 1.6.6 |
|
| 77 | + */ |
|
| 78 | + $html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf); |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + // If no html then we run the standard output. |
|
| 82 | + if(empty($html)) { |
|
| 83 | + |
|
| 84 | + ob_start(); // Start buffering; |
|
| 85 | + |
|
| 86 | + $value = geodir_get_cf_value($cf); |
|
| 87 | + $type = $cf['type']; |
|
| 88 | + //number and float validation $validation_pattern |
|
| 89 | + if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';} |
|
| 90 | + elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';} |
|
| 91 | + |
|
| 92 | + //validation |
|
| 93 | + if(isset($cf['validation_pattern']) && $cf['validation_pattern']){ |
|
| 94 | + $validation = 'pattern="'.$cf['validation_pattern'].'"'; |
|
| 95 | + }else{$validation='';} |
|
| 96 | + |
|
| 97 | + // validation message |
|
| 98 | + if(isset($cf['validation_msg']) && $cf['validation_msg']){ |
|
| 99 | + $validation_msg = 'title="'.$cf['validation_msg'].'"'; |
|
| 100 | + }else{$validation_msg='';} |
|
| 101 | + ?> |
|
| 102 | 102 | |
| 103 | 103 | <div id="<?php echo $cf['name'];?>_row" |
| 104 | 104 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 105 | 105 | <label> |
| 106 | 106 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 107 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 107 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 108 | 108 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 109 | 109 | </label> |
| 110 | 110 | <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
@@ -116,10 +116,10 @@ discard block |
||
| 116 | 116 | </div> |
| 117 | 117 | |
| 118 | 118 | <?php |
| 119 | - $html = ob_get_clean(); |
|
| 120 | - } |
|
| 119 | + $html = ob_get_clean(); |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - return $html; |
|
| 122 | + return $html; |
|
| 123 | 123 | } |
| 124 | 124 | add_filter('geodir_custom_field_input_text','geodir_cfi_text',10,2); |
| 125 | 125 | |
@@ -135,35 +135,35 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | function geodir_cfi_email($html,$cf){ |
| 137 | 137 | |
| 138 | - $html_var = $cf['htmlvar_name']; |
|
| 138 | + $html_var = $cf['htmlvar_name']; |
|
| 139 | 139 | |
| 140 | - // Check if there is a custom field specific filter. |
|
| 141 | - if(has_filter("geodir_custom_field_input_email_{$html_var}")){ |
|
| 142 | - /** |
|
| 143 | - * Filter the email html by individual custom field. |
|
| 144 | - * |
|
| 145 | - * @param string $html The html to filter. |
|
| 146 | - * @param array $cf The custom field array. |
|
| 147 | - * @since 1.6.6 |
|
| 148 | - */ |
|
| 149 | - $html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf); |
|
| 150 | - } |
|
| 140 | + // Check if there is a custom field specific filter. |
|
| 141 | + if(has_filter("geodir_custom_field_input_email_{$html_var}")){ |
|
| 142 | + /** |
|
| 143 | + * Filter the email html by individual custom field. |
|
| 144 | + * |
|
| 145 | + * @param string $html The html to filter. |
|
| 146 | + * @param array $cf The custom field array. |
|
| 147 | + * @since 1.6.6 |
|
| 148 | + */ |
|
| 149 | + $html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf); |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - // If no html then we run the standard output. |
|
| 153 | - if(empty($html)) { |
|
| 152 | + // If no html then we run the standard output. |
|
| 153 | + if(empty($html)) { |
|
| 154 | 154 | |
| 155 | - ob_start(); // Start buffering; |
|
| 156 | - $value = geodir_get_cf_value($cf); |
|
| 155 | + ob_start(); // Start buffering; |
|
| 156 | + $value = geodir_get_cf_value($cf); |
|
| 157 | 157 | |
| 158 | - if ($value == $cf['default']) { |
|
| 159 | - $value = ''; |
|
| 160 | - }?> |
|
| 158 | + if ($value == $cf['default']) { |
|
| 159 | + $value = ''; |
|
| 160 | + }?> |
|
| 161 | 161 | |
| 162 | 162 | <div id="<?php echo $cf['name'];?>_row" |
| 163 | 163 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 164 | 164 | <label> |
| 165 | 165 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 166 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 166 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 167 | 167 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 168 | 168 | </label> |
| 169 | 169 | <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
@@ -175,10 +175,10 @@ discard block |
||
| 175 | 175 | </div> |
| 176 | 176 | |
| 177 | 177 | <?php |
| 178 | - $html = ob_get_clean(); |
|
| 179 | - } |
|
| 178 | + $html = ob_get_clean(); |
|
| 179 | + } |
|
| 180 | 180 | |
| 181 | - return $html; |
|
| 181 | + return $html; |
|
| 182 | 182 | } |
| 183 | 183 | add_filter('geodir_custom_field_input_email','geodir_cfi_email',10,2); |
| 184 | 184 | |
@@ -195,35 +195,35 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | function geodir_cfi_phone($html,$cf){ |
| 197 | 197 | |
| 198 | - $html_var = $cf['htmlvar_name']; |
|
| 198 | + $html_var = $cf['htmlvar_name']; |
|
| 199 | 199 | |
| 200 | - // Check if there is a custom field specific filter. |
|
| 201 | - if(has_filter("geodir_custom_field_input_phone_{$html_var}")){ |
|
| 202 | - /** |
|
| 203 | - * Filter the phone html by individual custom field. |
|
| 204 | - * |
|
| 205 | - * @param string $html The html to filter. |
|
| 206 | - * @param array $cf The custom field array. |
|
| 207 | - * @since 1.6.6 |
|
| 208 | - */ |
|
| 209 | - $html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf); |
|
| 210 | - } |
|
| 200 | + // Check if there is a custom field specific filter. |
|
| 201 | + if(has_filter("geodir_custom_field_input_phone_{$html_var}")){ |
|
| 202 | + /** |
|
| 203 | + * Filter the phone html by individual custom field. |
|
| 204 | + * |
|
| 205 | + * @param string $html The html to filter. |
|
| 206 | + * @param array $cf The custom field array. |
|
| 207 | + * @since 1.6.6 |
|
| 208 | + */ |
|
| 209 | + $html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf); |
|
| 210 | + } |
|
| 211 | 211 | |
| 212 | - // If no html then we run the standard output. |
|
| 213 | - if(empty($html)) { |
|
| 212 | + // If no html then we run the standard output. |
|
| 213 | + if(empty($html)) { |
|
| 214 | 214 | |
| 215 | - ob_start(); // Start buffering; |
|
| 216 | - $value = geodir_get_cf_value($cf); |
|
| 215 | + ob_start(); // Start buffering; |
|
| 216 | + $value = geodir_get_cf_value($cf); |
|
| 217 | 217 | |
| 218 | - if ($value == $cf['default']) { |
|
| 219 | - $value = ''; |
|
| 220 | - }?> |
|
| 218 | + if ($value == $cf['default']) { |
|
| 219 | + $value = ''; |
|
| 220 | + }?> |
|
| 221 | 221 | |
| 222 | 222 | <div id="<?php echo $cf['name'];?>_row" |
| 223 | 223 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 224 | 224 | <label> |
| 225 | 225 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 226 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 226 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 227 | 227 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 228 | 228 | </label> |
| 229 | 229 | <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
@@ -235,10 +235,10 @@ discard block |
||
| 235 | 235 | </div> |
| 236 | 236 | |
| 237 | 237 | <?php |
| 238 | - $html = ob_get_clean(); |
|
| 239 | - } |
|
| 238 | + $html = ob_get_clean(); |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | - return $html; |
|
| 241 | + return $html; |
|
| 242 | 242 | } |
| 243 | 243 | add_filter('geodir_custom_field_input_phone','geodir_cfi_phone',10,2); |
| 244 | 244 | |
@@ -255,35 +255,35 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | function geodir_cfi_url($html,$cf){ |
| 257 | 257 | |
| 258 | - $html_var = $cf['htmlvar_name']; |
|
| 258 | + $html_var = $cf['htmlvar_name']; |
|
| 259 | 259 | |
| 260 | - // Check if there is a custom field specific filter. |
|
| 261 | - if(has_filter("geodir_custom_field_input_url_{$html_var}")){ |
|
| 262 | - /** |
|
| 263 | - * Filter the url html by individual custom field. |
|
| 264 | - * |
|
| 265 | - * @param string $html The html to filter. |
|
| 266 | - * @param array $cf The custom field array. |
|
| 267 | - * @since 1.6.6 |
|
| 268 | - */ |
|
| 269 | - $html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf); |
|
| 270 | - } |
|
| 260 | + // Check if there is a custom field specific filter. |
|
| 261 | + if(has_filter("geodir_custom_field_input_url_{$html_var}")){ |
|
| 262 | + /** |
|
| 263 | + * Filter the url html by individual custom field. |
|
| 264 | + * |
|
| 265 | + * @param string $html The html to filter. |
|
| 266 | + * @param array $cf The custom field array. |
|
| 267 | + * @since 1.6.6 |
|
| 268 | + */ |
|
| 269 | + $html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf); |
|
| 270 | + } |
|
| 271 | 271 | |
| 272 | - // If no html then we run the standard output. |
|
| 273 | - if(empty($html)) { |
|
| 272 | + // If no html then we run the standard output. |
|
| 273 | + if(empty($html)) { |
|
| 274 | 274 | |
| 275 | - ob_start(); // Start buffering; |
|
| 276 | - $value = geodir_get_cf_value($cf); |
|
| 275 | + ob_start(); // Start buffering; |
|
| 276 | + $value = geodir_get_cf_value($cf); |
|
| 277 | 277 | |
| 278 | - if ($value == $cf['default']) { |
|
| 279 | - $value = ''; |
|
| 280 | - }?> |
|
| 278 | + if ($value == $cf['default']) { |
|
| 279 | + $value = ''; |
|
| 280 | + }?> |
|
| 281 | 281 | |
| 282 | 282 | <div id="<?php echo $cf['name'];?>_row" |
| 283 | 283 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 284 | 284 | <label> |
| 285 | 285 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 286 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 286 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 287 | 287 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 288 | 288 | </label> |
| 289 | 289 | <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
@@ -298,10 +298,10 @@ discard block |
||
| 298 | 298 | </div> |
| 299 | 299 | |
| 300 | 300 | <?php |
| 301 | - $html = ob_get_clean(); |
|
| 302 | - } |
|
| 301 | + $html = ob_get_clean(); |
|
| 302 | + } |
|
| 303 | 303 | |
| 304 | - return $html; |
|
| 304 | + return $html; |
|
| 305 | 305 | } |
| 306 | 306 | add_filter('geodir_custom_field_input_url','geodir_cfi_url',10,2); |
| 307 | 307 | |
@@ -317,48 +317,48 @@ discard block |
||
| 317 | 317 | */ |
| 318 | 318 | function geodir_cfi_radio($html,$cf){ |
| 319 | 319 | |
| 320 | - $html_var = $cf['htmlvar_name']; |
|
| 320 | + $html_var = $cf['htmlvar_name']; |
|
| 321 | 321 | |
| 322 | - // Check if there is a custom field specific filter. |
|
| 323 | - if(has_filter("geodir_custom_field_input_radio_{$html_var}")){ |
|
| 324 | - /** |
|
| 325 | - * Filter the radio html by individual custom field. |
|
| 326 | - * |
|
| 327 | - * @param string $html The html to filter. |
|
| 328 | - * @param array $cf The custom field array. |
|
| 329 | - * @since 1.6.6 |
|
| 330 | - */ |
|
| 331 | - $html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf); |
|
| 332 | - } |
|
| 322 | + // Check if there is a custom field specific filter. |
|
| 323 | + if(has_filter("geodir_custom_field_input_radio_{$html_var}")){ |
|
| 324 | + /** |
|
| 325 | + * Filter the radio html by individual custom field. |
|
| 326 | + * |
|
| 327 | + * @param string $html The html to filter. |
|
| 328 | + * @param array $cf The custom field array. |
|
| 329 | + * @since 1.6.6 |
|
| 330 | + */ |
|
| 331 | + $html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf); |
|
| 332 | + } |
|
| 333 | 333 | |
| 334 | - // If no html then we run the standard output. |
|
| 335 | - if(empty($html)) { |
|
| 334 | + // If no html then we run the standard output. |
|
| 335 | + if(empty($html)) { |
|
| 336 | 336 | |
| 337 | - ob_start(); // Start buffering; |
|
| 338 | - $value = geodir_get_cf_value($cf); |
|
| 337 | + ob_start(); // Start buffering; |
|
| 338 | + $value = geodir_get_cf_value($cf); |
|
| 339 | 339 | |
| 340 | - ?> |
|
| 340 | + ?> |
|
| 341 | 341 | <div id="<?php echo $cf['name'];?>_row" |
| 342 | 342 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 343 | 343 | <label> |
| 344 | 344 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 345 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 345 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 346 | 346 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 347 | 347 | </label> |
| 348 | 348 | <?php if ($cf['option_values']) { |
| 349 | - $option_values = geodir_string_values_to_options($cf['option_values'], true); |
|
| 349 | + $option_values = geodir_string_values_to_options($cf['option_values'], true); |
|
| 350 | 350 | |
| 351 | - if (!empty($option_values)) { |
|
| 352 | - foreach ($option_values as $option_value) { |
|
| 353 | - if (empty($option_value['optgroup'])) { |
|
| 354 | - ?> |
|
| 351 | + if (!empty($option_values)) { |
|
| 352 | + foreach ($option_values as $option_value) { |
|
| 353 | + if (empty($option_value['optgroup'])) { |
|
| 354 | + ?> |
|
| 355 | 355 | <span class="gd-radios"><input name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="radio" /><?php echo $option_value['label']; ?></span> |
| 356 | 356 | <?php |
| 357 | - } |
|
| 358 | - } |
|
| 359 | - } |
|
| 360 | - } |
|
| 361 | - ?> |
|
| 357 | + } |
|
| 358 | + } |
|
| 359 | + } |
|
| 360 | + } |
|
| 361 | + ?> |
|
| 362 | 362 | <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
| 363 | 363 | <?php if ($cf['is_required']) { ?> |
| 364 | 364 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
@@ -366,10 +366,10 @@ discard block |
||
| 366 | 366 | </div> |
| 367 | 367 | |
| 368 | 368 | <?php |
| 369 | - $html = ob_get_clean(); |
|
| 370 | - } |
|
| 369 | + $html = ob_get_clean(); |
|
| 370 | + } |
|
| 371 | 371 | |
| 372 | - return $html; |
|
| 372 | + return $html; |
|
| 373 | 373 | } |
| 374 | 374 | add_filter('geodir_custom_field_input_radio','geodir_cfi_radio',10,2); |
| 375 | 375 | |
@@ -385,46 +385,46 @@ discard block |
||
| 385 | 385 | */ |
| 386 | 386 | function geodir_cfi_checkbox($html,$cf){ |
| 387 | 387 | |
| 388 | - $html_var = $cf['htmlvar_name']; |
|
| 388 | + $html_var = $cf['htmlvar_name']; |
|
| 389 | 389 | |
| 390 | - // Check if there is a custom field specific filter. |
|
| 391 | - if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){ |
|
| 392 | - /** |
|
| 393 | - * Filter the checkbox html by individual custom field. |
|
| 394 | - * |
|
| 395 | - * @param string $html The html to filter. |
|
| 396 | - * @param array $cf The custom field array. |
|
| 397 | - * @since 1.6.6 |
|
| 398 | - */ |
|
| 399 | - $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf); |
|
| 400 | - } |
|
| 390 | + // Check if there is a custom field specific filter. |
|
| 391 | + if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){ |
|
| 392 | + /** |
|
| 393 | + * Filter the checkbox html by individual custom field. |
|
| 394 | + * |
|
| 395 | + * @param string $html The html to filter. |
|
| 396 | + * @param array $cf The custom field array. |
|
| 397 | + * @since 1.6.6 |
|
| 398 | + */ |
|
| 399 | + $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf); |
|
| 400 | + } |
|
| 401 | 401 | |
| 402 | - // If no html then we run the standard output. |
|
| 403 | - if(empty($html)) { |
|
| 402 | + // If no html then we run the standard output. |
|
| 403 | + if(empty($html)) { |
|
| 404 | 404 | |
| 405 | - ob_start(); // Start buffering; |
|
| 406 | - $value = geodir_get_cf_value($cf); |
|
| 405 | + ob_start(); // Start buffering; |
|
| 406 | + $value = geodir_get_cf_value($cf); |
|
| 407 | 407 | |
| 408 | 408 | |
| 409 | - if ($value == '' && $cf['default']) { |
|
| 410 | - $value = '1'; |
|
| 411 | - } |
|
| 412 | - ?> |
|
| 409 | + if ($value == '' && $cf['default']) { |
|
| 410 | + $value = '1'; |
|
| 411 | + } |
|
| 412 | + ?> |
|
| 413 | 413 | |
| 414 | 414 | <div id="<?php echo $cf['name'];?>_row" |
| 415 | 415 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 416 | 416 | <label> |
| 417 | 417 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 418 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 418 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 419 | 419 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 420 | 420 | </label> |
| 421 | 421 | <?php if ($value != '1') { |
| 422 | - $value = '0'; |
|
| 423 | - }?> |
|
| 422 | + $value = '0'; |
|
| 423 | + }?> |
|
| 424 | 424 | <input type="hidden" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" value="<?php echo esc_attr($value);?>"/> |
| 425 | 425 | <input <?php if ($value == '1') { |
| 426 | - echo 'checked="checked"'; |
|
| 427 | - }?> value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox" |
|
| 426 | + echo 'checked="checked"'; |
|
| 427 | + }?> value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox" |
|
| 428 | 428 | onchange="if(this.checked){jQuery('#<?php echo $cf['name'];?>').val('1');} else{ jQuery('#<?php echo $cf['name'];?>').val('0');}"/> |
| 429 | 429 | <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
| 430 | 430 | <?php if ($cf['is_required']) { ?> |
@@ -433,10 +433,10 @@ discard block |
||
| 433 | 433 | </div> |
| 434 | 434 | |
| 435 | 435 | <?php |
| 436 | - $html = ob_get_clean(); |
|
| 437 | - } |
|
| 436 | + $html = ob_get_clean(); |
|
| 437 | + } |
|
| 438 | 438 | |
| 439 | - return $html; |
|
| 439 | + return $html; |
|
| 440 | 440 | } |
| 441 | 441 | add_filter('geodir_custom_field_input_checkbox','geodir_cfi_checkbox',10,2); |
| 442 | 442 | |
@@ -452,52 +452,52 @@ discard block |
||
| 452 | 452 | */ |
| 453 | 453 | function geodir_cfi_textarea($html,$cf){ |
| 454 | 454 | |
| 455 | - $html_var = $cf['htmlvar_name']; |
|
| 455 | + $html_var = $cf['htmlvar_name']; |
|
| 456 | 456 | |
| 457 | - // Check if there is a custom field specific filter. |
|
| 458 | - if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){ |
|
| 459 | - /** |
|
| 460 | - * Filter the textarea html by individual custom field. |
|
| 461 | - * |
|
| 462 | - * @param string $html The html to filter. |
|
| 463 | - * @param array $cf The custom field array. |
|
| 464 | - * @since 1.6.6 |
|
| 465 | - */ |
|
| 466 | - $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf); |
|
| 467 | - } |
|
| 457 | + // Check if there is a custom field specific filter. |
|
| 458 | + if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){ |
|
| 459 | + /** |
|
| 460 | + * Filter the textarea html by individual custom field. |
|
| 461 | + * |
|
| 462 | + * @param string $html The html to filter. |
|
| 463 | + * @param array $cf The custom field array. |
|
| 464 | + * @since 1.6.6 |
|
| 465 | + */ |
|
| 466 | + $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf); |
|
| 467 | + } |
|
| 468 | 468 | |
| 469 | - // If no html then we run the standard output. |
|
| 470 | - if(empty($html)) { |
|
| 469 | + // If no html then we run the standard output. |
|
| 470 | + if(empty($html)) { |
|
| 471 | 471 | |
| 472 | - ob_start(); // Start buffering; |
|
| 473 | - $value = geodir_get_cf_value($cf); |
|
| 472 | + ob_start(); // Start buffering; |
|
| 473 | + $value = geodir_get_cf_value($cf); |
|
| 474 | 474 | |
| 475 | - $extra_fields = unserialize($cf['extra_fields']); |
|
| 476 | - ?> |
|
| 475 | + $extra_fields = unserialize($cf['extra_fields']); |
|
| 476 | + ?> |
|
| 477 | 477 | |
| 478 | 478 | <div id="<?php echo $cf['name'];?>_row" |
| 479 | 479 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 480 | 480 | <label> |
| 481 | 481 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 482 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 482 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 483 | 483 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 484 | 484 | </label><?php |
| 485 | 485 | |
| 486 | 486 | |
| 487 | - if (is_array($extra_fields) && in_array('1', $extra_fields)) { |
|
| 487 | + if (is_array($extra_fields) && in_array('1', $extra_fields)) { |
|
| 488 | 488 | |
| 489 | - $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?> |
|
| 489 | + $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?> |
|
| 490 | 490 | |
| 491 | 491 | <div class="editor" field_id="<?php echo $cf['name'];?>" field_type="editor"> |
| 492 | 492 | <?php wp_editor(stripslashes($value), $cf['name'], $editor_settings); ?> |
| 493 | 493 | </div><?php |
| 494 | 494 | |
| 495 | - } else { |
|
| 495 | + } else { |
|
| 496 | 496 | |
| 497 | - ?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>" |
|
| 497 | + ?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>" |
|
| 498 | 498 | id="<?php echo $cf['name'];?>"><?php echo stripslashes($value);?></textarea><?php |
| 499 | 499 | |
| 500 | - }?> |
|
| 500 | + }?> |
|
| 501 | 501 | |
| 502 | 502 | |
| 503 | 503 | <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
@@ -507,10 +507,10 @@ discard block |
||
| 507 | 507 | </div> |
| 508 | 508 | |
| 509 | 509 | <?php |
| 510 | - $html = ob_get_clean(); |
|
| 511 | - } |
|
| 510 | + $html = ob_get_clean(); |
|
| 511 | + } |
|
| 512 | 512 | |
| 513 | - return $html; |
|
| 513 | + return $html; |
|
| 514 | 514 | } |
| 515 | 515 | add_filter('geodir_custom_field_input_textarea','geodir_cfi_textarea',10,2); |
| 516 | 516 | |
@@ -526,53 +526,53 @@ discard block |
||
| 526 | 526 | */ |
| 527 | 527 | function geodir_cfi_select($html,$cf){ |
| 528 | 528 | |
| 529 | - $html_var = $cf['htmlvar_name']; |
|
| 529 | + $html_var = $cf['htmlvar_name']; |
|
| 530 | 530 | |
| 531 | - // Check if there is a custom field specific filter. |
|
| 532 | - if(has_filter("geodir_custom_field_input_select_{$html_var}")){ |
|
| 533 | - /** |
|
| 534 | - * Filter the select html by individual custom field. |
|
| 535 | - * |
|
| 536 | - * @param string $html The html to filter. |
|
| 537 | - * @param array $cf The custom field array. |
|
| 538 | - * @since 1.6.6 |
|
| 539 | - */ |
|
| 540 | - $html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf); |
|
| 541 | - } |
|
| 531 | + // Check if there is a custom field specific filter. |
|
| 532 | + if(has_filter("geodir_custom_field_input_select_{$html_var}")){ |
|
| 533 | + /** |
|
| 534 | + * Filter the select html by individual custom field. |
|
| 535 | + * |
|
| 536 | + * @param string $html The html to filter. |
|
| 537 | + * @param array $cf The custom field array. |
|
| 538 | + * @since 1.6.6 |
|
| 539 | + */ |
|
| 540 | + $html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf); |
|
| 541 | + } |
|
| 542 | 542 | |
| 543 | - // If no html then we run the standard output. |
|
| 544 | - if(empty($html)) { |
|
| 543 | + // If no html then we run the standard output. |
|
| 544 | + if(empty($html)) { |
|
| 545 | 545 | |
| 546 | - ob_start(); // Start buffering; |
|
| 547 | - $value = geodir_get_cf_value($cf); |
|
| 546 | + ob_start(); // Start buffering; |
|
| 547 | + $value = geodir_get_cf_value($cf); |
|
| 548 | 548 | |
| 549 | - ?> |
|
| 549 | + ?> |
|
| 550 | 550 | <div id="<?php echo $cf['name'];?>_row" |
| 551 | 551 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details"> |
| 552 | 552 | <label> |
| 553 | 553 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 554 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 554 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 555 | 555 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 556 | 556 | </label> |
| 557 | 557 | <?php |
| 558 | - $option_values_arr = geodir_string_values_to_options($cf['option_values'], true); |
|
| 559 | - $select_options = ''; |
|
| 560 | - if (!empty($option_values_arr)) { |
|
| 561 | - foreach ($option_values_arr as $option_row) { |
|
| 562 | - if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) { |
|
| 563 | - $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 564 | - |
|
| 565 | - $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
| 566 | - } else { |
|
| 567 | - $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 568 | - $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
|
| 569 | - $selected = $option_value == $value ? 'selected="selected"' : ''; |
|
| 570 | - |
|
| 571 | - $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
| 572 | - } |
|
| 573 | - } |
|
| 574 | - } |
|
| 575 | - ?> |
|
| 558 | + $option_values_arr = geodir_string_values_to_options($cf['option_values'], true); |
|
| 559 | + $select_options = ''; |
|
| 560 | + if (!empty($option_values_arr)) { |
|
| 561 | + foreach ($option_values_arr as $option_row) { |
|
| 562 | + if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) { |
|
| 563 | + $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 564 | + |
|
| 565 | + $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
| 566 | + } else { |
|
| 567 | + $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 568 | + $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
|
| 569 | + $selected = $option_value == $value ? 'selected="selected"' : ''; |
|
| 570 | + |
|
| 571 | + $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
| 572 | + } |
|
| 573 | + } |
|
| 574 | + } |
|
| 575 | + ?> |
|
| 576 | 576 | <select field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
| 577 | 577 | class="geodir_textfield textfield_x chosen_select" |
| 578 | 578 | data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '…';?>" |
@@ -584,10 +584,10 @@ discard block |
||
| 584 | 584 | </div> |
| 585 | 585 | |
| 586 | 586 | <?php |
| 587 | - $html = ob_get_clean(); |
|
| 588 | - } |
|
| 587 | + $html = ob_get_clean(); |
|
| 588 | + } |
|
| 589 | 589 | |
| 590 | - return $html; |
|
| 590 | + return $html; |
|
| 591 | 591 | } |
| 592 | 592 | add_filter('geodir_custom_field_input_select','geodir_cfi_select',10,2); |
| 593 | 593 | |
@@ -603,36 +603,36 @@ discard block |
||
| 603 | 603 | */ |
| 604 | 604 | function geodir_cfi_multiselect($html,$cf){ |
| 605 | 605 | |
| 606 | - $html_var = $cf['htmlvar_name']; |
|
| 607 | - |
|
| 608 | - // Check if there is a custom field specific filter. |
|
| 609 | - if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){ |
|
| 610 | - /** |
|
| 611 | - * Filter the multiselect html by individual custom field. |
|
| 612 | - * |
|
| 613 | - * @param string $html The html to filter. |
|
| 614 | - * @param array $cf The custom field array. |
|
| 615 | - * @since 1.6.6 |
|
| 616 | - */ |
|
| 617 | - $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf); |
|
| 618 | - } |
|
| 619 | - |
|
| 620 | - // If no html then we run the standard output. |
|
| 621 | - if(empty($html)) { |
|
| 622 | - |
|
| 623 | - ob_start(); // Start buffering; |
|
| 624 | - $value = geodir_get_cf_value($cf); |
|
| 625 | - |
|
| 626 | - $multi_display = 'select'; |
|
| 627 | - if (!empty($cf['extra_fields'])) { |
|
| 628 | - $multi_display = unserialize($cf['extra_fields']); |
|
| 629 | - } |
|
| 630 | - ?> |
|
| 606 | + $html_var = $cf['htmlvar_name']; |
|
| 607 | + |
|
| 608 | + // Check if there is a custom field specific filter. |
|
| 609 | + if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){ |
|
| 610 | + /** |
|
| 611 | + * Filter the multiselect html by individual custom field. |
|
| 612 | + * |
|
| 613 | + * @param string $html The html to filter. |
|
| 614 | + * @param array $cf The custom field array. |
|
| 615 | + * @since 1.6.6 |
|
| 616 | + */ |
|
| 617 | + $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf); |
|
| 618 | + } |
|
| 619 | + |
|
| 620 | + // If no html then we run the standard output. |
|
| 621 | + if(empty($html)) { |
|
| 622 | + |
|
| 623 | + ob_start(); // Start buffering; |
|
| 624 | + $value = geodir_get_cf_value($cf); |
|
| 625 | + |
|
| 626 | + $multi_display = 'select'; |
|
| 627 | + if (!empty($cf['extra_fields'])) { |
|
| 628 | + $multi_display = unserialize($cf['extra_fields']); |
|
| 629 | + } |
|
| 630 | + ?> |
|
| 631 | 631 | <div id="<?php echo $cf['name']; ?>_row" |
| 632 | 632 | class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
| 633 | 633 | <label> |
| 634 | 634 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 635 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 635 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 636 | 636 | <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
| 637 | 637 | </label> |
| 638 | 638 | <input type="hidden" name="gd_field_<?php echo $cf['name']; ?>" value="1"/> |
@@ -643,55 +643,55 @@ discard block |
||
| 643 | 643 | data-placeholder="<?php _e('Select', 'geodirectory'); ?>" |
| 644 | 644 | option-ajaxchosen="false"> |
| 645 | 645 | <?php |
| 646 | - } else { |
|
| 647 | - echo '<ul class="gd_multi_choice">'; |
|
| 648 | - } |
|
| 649 | - |
|
| 650 | - $option_values_arr = geodir_string_values_to_options($cf['option_values'], true); |
|
| 651 | - $select_options = ''; |
|
| 652 | - if (!empty($option_values_arr)) { |
|
| 653 | - foreach ($option_values_arr as $option_row) { |
|
| 654 | - if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) { |
|
| 655 | - $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 656 | - |
|
| 657 | - if ($multi_display == 'select') { |
|
| 658 | - $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
| 659 | - } else { |
|
| 660 | - $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : ''; |
|
| 661 | - } |
|
| 662 | - } else { |
|
| 663 | - $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 664 | - $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
|
| 665 | - $selected = $option_value == $value ? 'selected="selected"' : ''; |
|
| 666 | - $selected = ''; |
|
| 667 | - $checked = ''; |
|
| 668 | - |
|
| 669 | - if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) { |
|
| 670 | - if (!is_array($value)) { |
|
| 671 | - $value_array = explode(',', $value); |
|
| 672 | - } else { |
|
| 673 | - $value_array = $value; |
|
| 674 | - } |
|
| 675 | - |
|
| 676 | - if (is_array($value_array)) { |
|
| 677 | - if (in_array($option_value, $value_array)) { |
|
| 678 | - $selected = 'selected="selected"'; |
|
| 679 | - $checked = 'checked="checked"'; |
|
| 680 | - } |
|
| 681 | - } |
|
| 682 | - } |
|
| 683 | - |
|
| 684 | - if ($multi_display == 'select') { |
|
| 685 | - $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
| 686 | - } else { |
|
| 687 | - $select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" /> ' . $option_label . ' </li>'; |
|
| 688 | - } |
|
| 689 | - } |
|
| 690 | - } |
|
| 691 | - } |
|
| 692 | - echo $select_options; |
|
| 693 | - |
|
| 694 | - if ($multi_display == 'select') { ?></select></div> |
|
| 646 | + } else { |
|
| 647 | + echo '<ul class="gd_multi_choice">'; |
|
| 648 | + } |
|
| 649 | + |
|
| 650 | + $option_values_arr = geodir_string_values_to_options($cf['option_values'], true); |
|
| 651 | + $select_options = ''; |
|
| 652 | + if (!empty($option_values_arr)) { |
|
| 653 | + foreach ($option_values_arr as $option_row) { |
|
| 654 | + if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) { |
|
| 655 | + $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 656 | + |
|
| 657 | + if ($multi_display == 'select') { |
|
| 658 | + $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
| 659 | + } else { |
|
| 660 | + $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : ''; |
|
| 661 | + } |
|
| 662 | + } else { |
|
| 663 | + $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 664 | + $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
|
| 665 | + $selected = $option_value == $value ? 'selected="selected"' : ''; |
|
| 666 | + $selected = ''; |
|
| 667 | + $checked = ''; |
|
| 668 | + |
|
| 669 | + if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) { |
|
| 670 | + if (!is_array($value)) { |
|
| 671 | + $value_array = explode(',', $value); |
|
| 672 | + } else { |
|
| 673 | + $value_array = $value; |
|
| 674 | + } |
|
| 675 | + |
|
| 676 | + if (is_array($value_array)) { |
|
| 677 | + if (in_array($option_value, $value_array)) { |
|
| 678 | + $selected = 'selected="selected"'; |
|
| 679 | + $checked = 'checked="checked"'; |
|
| 680 | + } |
|
| 681 | + } |
|
| 682 | + } |
|
| 683 | + |
|
| 684 | + if ($multi_display == 'select') { |
|
| 685 | + $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
| 686 | + } else { |
|
| 687 | + $select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" /> ' . $option_label . ' </li>'; |
|
| 688 | + } |
|
| 689 | + } |
|
| 690 | + } |
|
| 691 | + } |
|
| 692 | + echo $select_options; |
|
| 693 | + |
|
| 694 | + if ($multi_display == 'select') { ?></select></div> |
|
| 695 | 695 | <?php } else { ?></ul><?php } ?> |
| 696 | 696 | <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
| 697 | 697 | <?php if ($cf['is_required']) { ?> |
@@ -699,10 +699,10 @@ discard block |
||
| 699 | 699 | <?php } ?> |
| 700 | 700 | </div> |
| 701 | 701 | <?php |
| 702 | - $html = ob_get_clean(); |
|
| 703 | - } |
|
| 702 | + $html = ob_get_clean(); |
|
| 703 | + } |
|
| 704 | 704 | |
| 705 | - return $html; |
|
| 705 | + return $html; |
|
| 706 | 706 | } |
| 707 | 707 | add_filter('geodir_custom_field_input_multiselect','geodir_cfi_multiselect',10,2); |
| 708 | 708 | |
@@ -718,32 +718,32 @@ discard block |
||
| 718 | 718 | */ |
| 719 | 719 | function geodir_cfi_html($html,$cf){ |
| 720 | 720 | |
| 721 | - $html_var = $cf['htmlvar_name']; |
|
| 721 | + $html_var = $cf['htmlvar_name']; |
|
| 722 | 722 | |
| 723 | - // Check if there is a custom field specific filter. |
|
| 724 | - if(has_filter("geodir_custom_field_input_html_{$html_var}")){ |
|
| 725 | - /** |
|
| 726 | - * Filter the html html by individual custom field. |
|
| 727 | - * |
|
| 728 | - * @param string $html The html to filter. |
|
| 729 | - * @param array $cf The custom field array. |
|
| 730 | - * @since 1.6.6 |
|
| 731 | - */ |
|
| 732 | - $html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf); |
|
| 733 | - } |
|
| 723 | + // Check if there is a custom field specific filter. |
|
| 724 | + if(has_filter("geodir_custom_field_input_html_{$html_var}")){ |
|
| 725 | + /** |
|
| 726 | + * Filter the html html by individual custom field. |
|
| 727 | + * |
|
| 728 | + * @param string $html The html to filter. |
|
| 729 | + * @param array $cf The custom field array. |
|
| 730 | + * @since 1.6.6 |
|
| 731 | + */ |
|
| 732 | + $html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf); |
|
| 733 | + } |
|
| 734 | 734 | |
| 735 | - // If no html then we run the standard output. |
|
| 736 | - if(empty($html)) { |
|
| 735 | + // If no html then we run the standard output. |
|
| 736 | + if(empty($html)) { |
|
| 737 | 737 | |
| 738 | - ob_start(); // Start buffering; |
|
| 739 | - $value = geodir_get_cf_value($cf); |
|
| 740 | - ?> |
|
| 738 | + ob_start(); // Start buffering; |
|
| 739 | + $value = geodir_get_cf_value($cf); |
|
| 740 | + ?> |
|
| 741 | 741 | |
| 742 | 742 | <div id="<?php echo $cf['name']; ?>_row" |
| 743 | 743 | class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
| 744 | 744 | <label> |
| 745 | 745 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 746 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 746 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 747 | 747 | <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
| 748 | 748 | </label> |
| 749 | 749 | |
@@ -761,10 +761,10 @@ discard block |
||
| 761 | 761 | </div> |
| 762 | 762 | |
| 763 | 763 | <?php |
| 764 | - $html = ob_get_clean(); |
|
| 765 | - } |
|
| 764 | + $html = ob_get_clean(); |
|
| 765 | + } |
|
| 766 | 766 | |
| 767 | - return $html; |
|
| 767 | + return $html; |
|
| 768 | 768 | } |
| 769 | 769 | add_filter('geodir_custom_field_input_html','geodir_cfi_html',10,2); |
| 770 | 770 | |
@@ -781,68 +781,68 @@ discard block |
||
| 781 | 781 | */ |
| 782 | 782 | function geodir_cfi_datepicker($html,$cf){ |
| 783 | 783 | |
| 784 | - $html_var = $cf['htmlvar_name']; |
|
| 784 | + $html_var = $cf['htmlvar_name']; |
|
| 785 | 785 | |
| 786 | - // Check if there is a custom field specific filter. |
|
| 787 | - if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){ |
|
| 788 | - /** |
|
| 789 | - * Filter the datepicker html by individual custom field. |
|
| 790 | - * |
|
| 791 | - * @param string $html The html to filter. |
|
| 792 | - * @param array $cf The custom field array. |
|
| 793 | - * @since 1.6.6 |
|
| 794 | - */ |
|
| 795 | - $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf); |
|
| 796 | - } |
|
| 786 | + // Check if there is a custom field specific filter. |
|
| 787 | + if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){ |
|
| 788 | + /** |
|
| 789 | + * Filter the datepicker html by individual custom field. |
|
| 790 | + * |
|
| 791 | + * @param string $html The html to filter. |
|
| 792 | + * @param array $cf The custom field array. |
|
| 793 | + * @since 1.6.6 |
|
| 794 | + */ |
|
| 795 | + $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf); |
|
| 796 | + } |
|
| 797 | 797 | |
| 798 | - // If no html then we run the standard output. |
|
| 799 | - if(empty($html)) { |
|
| 798 | + // If no html then we run the standard output. |
|
| 799 | + if(empty($html)) { |
|
| 800 | 800 | |
| 801 | - ob_start(); // Start buffering; |
|
| 802 | - $value = geodir_get_cf_value($cf); |
|
| 801 | + ob_start(); // Start buffering; |
|
| 802 | + $value = geodir_get_cf_value($cf); |
|
| 803 | 803 | |
| 804 | - $extra_fields = unserialize($cf['extra_fields']); |
|
| 805 | - $name = $cf['name']; |
|
| 804 | + $extra_fields = unserialize($cf['extra_fields']); |
|
| 805 | + $name = $cf['name']; |
|
| 806 | 806 | |
| 807 | - if ($extra_fields['date_format'] == '') |
|
| 808 | - $extra_fields['date_format'] = 'yy-mm-dd'; |
|
| 807 | + if ($extra_fields['date_format'] == '') |
|
| 808 | + $extra_fields['date_format'] = 'yy-mm-dd'; |
|
| 809 | 809 | |
| 810 | - $date_format = $extra_fields['date_format']; |
|
| 811 | - $jquery_date_format = $date_format; |
|
| 810 | + $date_format = $extra_fields['date_format']; |
|
| 811 | + $jquery_date_format = $date_format; |
|
| 812 | 812 | |
| 813 | 813 | |
| 814 | - // check if we need to change the format or not |
|
| 815 | - $date_format_len = strlen(str_replace(' ', '', $date_format)); |
|
| 816 | - if($date_format_len>5){// if greater then 5 then it's the old style format. |
|
| 814 | + // check if we need to change the format or not |
|
| 815 | + $date_format_len = strlen(str_replace(' ', '', $date_format)); |
|
| 816 | + if($date_format_len>5){// if greater then 5 then it's the old style format. |
|
| 817 | 817 | |
| 818 | - $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format |
|
| 819 | - $replace = array('d','j','l','m','n','F','Y');//PHP date format |
|
| 818 | + $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format |
|
| 819 | + $replace = array('d','j','l','m','n','F','Y');//PHP date format |
|
| 820 | 820 | |
| 821 | - $date_format = str_replace($search, $replace, $date_format); |
|
| 822 | - }else{ |
|
| 823 | - $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format ); |
|
| 824 | - } |
|
| 821 | + $date_format = str_replace($search, $replace, $date_format); |
|
| 822 | + }else{ |
|
| 823 | + $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format ); |
|
| 824 | + } |
|
| 825 | 825 | |
| 826 | - if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty |
|
| 827 | - if($value && !isset($_REQUEST['backandedit'])) { |
|
| 828 | - //$time = strtotime($value); |
|
| 829 | - //$value = date_i18n($date_format, $time); |
|
| 830 | - } |
|
| 831 | - $value = geodir_date($value, 'Y-m-d', $date_format); |
|
| 826 | + if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty |
|
| 827 | + if($value && !isset($_REQUEST['backandedit'])) { |
|
| 828 | + //$time = strtotime($value); |
|
| 829 | + //$value = date_i18n($date_format, $time); |
|
| 830 | + } |
|
| 831 | + $value = geodir_date($value, 'Y-m-d', $date_format); |
|
| 832 | 832 | |
| 833 | - ?> |
|
| 833 | + ?> |
|
| 834 | 834 | <script type="text/javascript"> |
| 835 | 835 | |
| 836 | 836 | jQuery(function () { |
| 837 | 837 | |
| 838 | 838 | jQuery("#<?php echo $cf['name'];?>").datepicker({changeMonth: true, changeYear: true <?php |
| 839 | - /** |
|
| 840 | - * Used to add extra option to datepicker per custom field. |
|
| 841 | - * |
|
| 842 | - * @since 1.5.7 |
|
| 843 | - * @param string $name The custom field name. |
|
| 844 | - */ |
|
| 845 | - echo apply_filters("gd_datepicker_extra_{$name}",'');?>}); |
|
| 839 | + /** |
|
| 840 | + * Used to add extra option to datepicker per custom field. |
|
| 841 | + * |
|
| 842 | + * @since 1.5.7 |
|
| 843 | + * @param string $name The custom field name. |
|
| 844 | + */ |
|
| 845 | + echo apply_filters("gd_datepicker_extra_{$name}",'');?>}); |
|
| 846 | 846 | |
| 847 | 847 | jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format;?>'); |
| 848 | 848 | |
@@ -858,7 +858,7 @@ discard block |
||
| 858 | 858 | <label> |
| 859 | 859 | |
| 860 | 860 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 861 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 861 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 862 | 862 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 863 | 863 | </label> |
| 864 | 864 | |
@@ -872,10 +872,10 @@ discard block |
||
| 872 | 872 | </div> |
| 873 | 873 | |
| 874 | 874 | <?php |
| 875 | - $html = ob_get_clean(); |
|
| 876 | - } |
|
| 875 | + $html = ob_get_clean(); |
|
| 876 | + } |
|
| 877 | 877 | |
| 878 | - return $html; |
|
| 878 | + return $html; |
|
| 879 | 879 | } |
| 880 | 880 | add_filter('geodir_custom_field_input_datepicker','geodir_cfi_datepicker',10,2); |
| 881 | 881 | |
@@ -891,31 +891,31 @@ discard block |
||
| 891 | 891 | */ |
| 892 | 892 | function geodir_cfi_time($html,$cf){ |
| 893 | 893 | |
| 894 | - $html_var = $cf['htmlvar_name']; |
|
| 894 | + $html_var = $cf['htmlvar_name']; |
|
| 895 | 895 | |
| 896 | - // Check if there is a custom field specific filter. |
|
| 897 | - if(has_filter("geodir_custom_field_input_time_{$html_var}")){ |
|
| 898 | - /** |
|
| 899 | - * Filter the time html by individual custom field. |
|
| 900 | - * |
|
| 901 | - * @param string $html The html to filter. |
|
| 902 | - * @param array $cf The custom field array. |
|
| 903 | - * @since 1.6.6 |
|
| 904 | - */ |
|
| 905 | - $html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf); |
|
| 906 | - } |
|
| 896 | + // Check if there is a custom field specific filter. |
|
| 897 | + if(has_filter("geodir_custom_field_input_time_{$html_var}")){ |
|
| 898 | + /** |
|
| 899 | + * Filter the time html by individual custom field. |
|
| 900 | + * |
|
| 901 | + * @param string $html The html to filter. |
|
| 902 | + * @param array $cf The custom field array. |
|
| 903 | + * @since 1.6.6 |
|
| 904 | + */ |
|
| 905 | + $html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf); |
|
| 906 | + } |
|
| 907 | 907 | |
| 908 | - // If no html then we run the standard output. |
|
| 909 | - if(empty($html)) { |
|
| 908 | + // If no html then we run the standard output. |
|
| 909 | + if(empty($html)) { |
|
| 910 | 910 | |
| 911 | - ob_start(); // Start buffering; |
|
| 912 | - $value = geodir_get_cf_value($cf); |
|
| 911 | + ob_start(); // Start buffering; |
|
| 912 | + $value = geodir_get_cf_value($cf); |
|
| 913 | 913 | |
| 914 | - $name = $cf['name']; |
|
| 914 | + $name = $cf['name']; |
|
| 915 | 915 | |
| 916 | - if ($value != '') |
|
| 917 | - $value = date('H:i', strtotime($value)); |
|
| 918 | - ?> |
|
| 916 | + if ($value != '') |
|
| 917 | + $value = date('H:i', strtotime($value)); |
|
| 918 | + ?> |
|
| 919 | 919 | <script type="text/javascript"> |
| 920 | 920 | jQuery(document).ready(function () { |
| 921 | 921 | |
@@ -931,7 +931,7 @@ discard block |
||
| 931 | 931 | <label> |
| 932 | 932 | |
| 933 | 933 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 934 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 934 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 935 | 935 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 936 | 936 | </label> |
| 937 | 937 | <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>" |
@@ -943,10 +943,10 @@ discard block |
||
| 943 | 943 | <?php } ?> |
| 944 | 944 | </div> |
| 945 | 945 | <?php |
| 946 | - $html = ob_get_clean(); |
|
| 947 | - } |
|
| 946 | + $html = ob_get_clean(); |
|
| 947 | + } |
|
| 948 | 948 | |
| 949 | - return $html; |
|
| 949 | + return $html; |
|
| 950 | 950 | } |
| 951 | 951 | add_filter('geodir_custom_field_input_time','geodir_cfi_time',10,2); |
| 952 | 952 | |
@@ -962,100 +962,100 @@ discard block |
||
| 962 | 962 | */ |
| 963 | 963 | function geodir_cfi_address($html,$cf){ |
| 964 | 964 | |
| 965 | - $html_var = $cf['htmlvar_name']; |
|
| 966 | - |
|
| 967 | - // Check if there is a custom field specific filter. |
|
| 968 | - if(has_filter("geodir_custom_field_input_address_{$html_var}")){ |
|
| 969 | - /** |
|
| 970 | - * Filter the address html by individual custom field. |
|
| 971 | - * |
|
| 972 | - * @param string $html The html to filter. |
|
| 973 | - * @param array $cf The custom field array. |
|
| 974 | - * @since 1.6.6 |
|
| 975 | - */ |
|
| 976 | - $html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf); |
|
| 977 | - } |
|
| 978 | - |
|
| 979 | - // If no html then we run the standard output. |
|
| 980 | - if(empty($html)) { |
|
| 981 | - |
|
| 982 | - global $gd_session; |
|
| 983 | - ob_start(); // Start buffering; |
|
| 984 | - $value = geodir_get_cf_value($cf); |
|
| 985 | - $name = $cf['name']; |
|
| 986 | - $type = $cf['type']; |
|
| 987 | - $admin_desc = $cf['desc']; |
|
| 988 | - $is_required = $cf['is_required']; |
|
| 989 | - $required_msg = $cf['required_msg']; |
|
| 990 | - $site_title = $cf['site_title']; |
|
| 991 | - $is_admin = $cf['is_admin']; |
|
| 992 | - $extra_fields = stripslashes_deep(unserialize($cf['extra_fields'])); |
|
| 993 | - $prefix = $name . '_'; |
|
| 994 | - |
|
| 995 | - ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address'); |
|
| 996 | - ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code '); |
|
| 997 | - ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map'); |
|
| 998 | - ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview'); |
|
| 999 | - |
|
| 1000 | - $address = ''; |
|
| 1001 | - $zip = ''; |
|
| 1002 | - $mapview = ''; |
|
| 1003 | - $mapzoom = ''; |
|
| 1004 | - $lat = ''; |
|
| 1005 | - $lng = ''; |
|
| 1006 | - |
|
| 1007 | - if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) { |
|
| 1008 | - $post = $gd_ses_listing; |
|
| 1009 | - $address = $post[$prefix . 'address']; |
|
| 1010 | - $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : ''; |
|
| 1011 | - $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : ''; |
|
| 1012 | - $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : ''; |
|
| 1013 | - $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : ''; |
|
| 1014 | - $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : ''; |
|
| 1015 | - } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) { |
|
| 1016 | - $post_info = (array)$post_info; |
|
| 1017 | - |
|
| 1018 | - $address = $post_info[$prefix . 'address']; |
|
| 1019 | - $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : ''; |
|
| 1020 | - $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : ''; |
|
| 1021 | - $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : ''; |
|
| 1022 | - $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : ''; |
|
| 1023 | - $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : ''; |
|
| 1024 | - } |
|
| 1025 | - |
|
| 1026 | - $location = geodir_get_default_location(); |
|
| 1027 | - if (empty($city)) $city = isset($location->city) ? $location->city : ''; |
|
| 1028 | - if (empty($region)) $region = isset($location->region) ? $location->region : ''; |
|
| 1029 | - if (empty($country)) $country = isset($location->country) ? $location->country : ''; |
|
| 1030 | - |
|
| 1031 | - $lat_lng_blank = false; |
|
| 1032 | - if (empty($lat) && empty($lng)) { |
|
| 1033 | - $lat_lng_blank = true; |
|
| 1034 | - } |
|
| 1035 | - |
|
| 1036 | - if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : ''; |
|
| 1037 | - if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : ''; |
|
| 1038 | - |
|
| 1039 | - /** |
|
| 1040 | - * Filter the default latitude. |
|
| 1041 | - * |
|
| 1042 | - * @since 1.0.0 |
|
| 1043 | - * |
|
| 1044 | - * @param float $lat Default latitude. |
|
| 1045 | - * @param bool $is_admin For admin use only?. |
|
| 1046 | - */ |
|
| 1047 | - $lat = apply_filters('geodir_default_latitude', $lat, $is_admin); |
|
| 1048 | - /** |
|
| 1049 | - * Filter the default longitude. |
|
| 1050 | - * |
|
| 1051 | - * @since 1.0.0 |
|
| 1052 | - * |
|
| 1053 | - * @param float $lat Default longitude. |
|
| 1054 | - * @param bool $is_admin For admin use only?. |
|
| 1055 | - */ |
|
| 1056 | - $lng = apply_filters('geodir_default_longitude', $lng, $is_admin); |
|
| 1057 | - |
|
| 1058 | - ?> |
|
| 965 | + $html_var = $cf['htmlvar_name']; |
|
| 966 | + |
|
| 967 | + // Check if there is a custom field specific filter. |
|
| 968 | + if(has_filter("geodir_custom_field_input_address_{$html_var}")){ |
|
| 969 | + /** |
|
| 970 | + * Filter the address html by individual custom field. |
|
| 971 | + * |
|
| 972 | + * @param string $html The html to filter. |
|
| 973 | + * @param array $cf The custom field array. |
|
| 974 | + * @since 1.6.6 |
|
| 975 | + */ |
|
| 976 | + $html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf); |
|
| 977 | + } |
|
| 978 | + |
|
| 979 | + // If no html then we run the standard output. |
|
| 980 | + if(empty($html)) { |
|
| 981 | + |
|
| 982 | + global $gd_session; |
|
| 983 | + ob_start(); // Start buffering; |
|
| 984 | + $value = geodir_get_cf_value($cf); |
|
| 985 | + $name = $cf['name']; |
|
| 986 | + $type = $cf['type']; |
|
| 987 | + $admin_desc = $cf['desc']; |
|
| 988 | + $is_required = $cf['is_required']; |
|
| 989 | + $required_msg = $cf['required_msg']; |
|
| 990 | + $site_title = $cf['site_title']; |
|
| 991 | + $is_admin = $cf['is_admin']; |
|
| 992 | + $extra_fields = stripslashes_deep(unserialize($cf['extra_fields'])); |
|
| 993 | + $prefix = $name . '_'; |
|
| 994 | + |
|
| 995 | + ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address'); |
|
| 996 | + ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code '); |
|
| 997 | + ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map'); |
|
| 998 | + ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview'); |
|
| 999 | + |
|
| 1000 | + $address = ''; |
|
| 1001 | + $zip = ''; |
|
| 1002 | + $mapview = ''; |
|
| 1003 | + $mapzoom = ''; |
|
| 1004 | + $lat = ''; |
|
| 1005 | + $lng = ''; |
|
| 1006 | + |
|
| 1007 | + if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) { |
|
| 1008 | + $post = $gd_ses_listing; |
|
| 1009 | + $address = $post[$prefix . 'address']; |
|
| 1010 | + $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : ''; |
|
| 1011 | + $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : ''; |
|
| 1012 | + $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : ''; |
|
| 1013 | + $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : ''; |
|
| 1014 | + $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : ''; |
|
| 1015 | + } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) { |
|
| 1016 | + $post_info = (array)$post_info; |
|
| 1017 | + |
|
| 1018 | + $address = $post_info[$prefix . 'address']; |
|
| 1019 | + $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : ''; |
|
| 1020 | + $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : ''; |
|
| 1021 | + $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : ''; |
|
| 1022 | + $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : ''; |
|
| 1023 | + $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : ''; |
|
| 1024 | + } |
|
| 1025 | + |
|
| 1026 | + $location = geodir_get_default_location(); |
|
| 1027 | + if (empty($city)) $city = isset($location->city) ? $location->city : ''; |
|
| 1028 | + if (empty($region)) $region = isset($location->region) ? $location->region : ''; |
|
| 1029 | + if (empty($country)) $country = isset($location->country) ? $location->country : ''; |
|
| 1030 | + |
|
| 1031 | + $lat_lng_blank = false; |
|
| 1032 | + if (empty($lat) && empty($lng)) { |
|
| 1033 | + $lat_lng_blank = true; |
|
| 1034 | + } |
|
| 1035 | + |
|
| 1036 | + if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : ''; |
|
| 1037 | + if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : ''; |
|
| 1038 | + |
|
| 1039 | + /** |
|
| 1040 | + * Filter the default latitude. |
|
| 1041 | + * |
|
| 1042 | + * @since 1.0.0 |
|
| 1043 | + * |
|
| 1044 | + * @param float $lat Default latitude. |
|
| 1045 | + * @param bool $is_admin For admin use only?. |
|
| 1046 | + */ |
|
| 1047 | + $lat = apply_filters('geodir_default_latitude', $lat, $is_admin); |
|
| 1048 | + /** |
|
| 1049 | + * Filter the default longitude. |
|
| 1050 | + * |
|
| 1051 | + * @since 1.0.0 |
|
| 1052 | + * |
|
| 1053 | + * @param float $lat Default longitude. |
|
| 1054 | + * @param bool $is_admin For admin use only?. |
|
| 1055 | + */ |
|
| 1056 | + $lng = apply_filters('geodir_default_longitude', $lng, $is_admin); |
|
| 1057 | + |
|
| 1058 | + ?> |
|
| 1059 | 1059 | |
| 1060 | 1060 | <div id="geodir_<?php echo $prefix . 'address';?>_row" |
| 1061 | 1061 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
@@ -1074,17 +1074,17 @@ discard block |
||
| 1074 | 1074 | |
| 1075 | 1075 | |
| 1076 | 1076 | <?php |
| 1077 | - /** |
|
| 1078 | - * Called after the address input on the add listings. |
|
| 1079 | - * |
|
| 1080 | - * This is used by the location manage to add further locations info etc. |
|
| 1081 | - * |
|
| 1082 | - * @since 1.0.0 |
|
| 1083 | - * @param array $cf The array of setting for the custom field. {@see geodir_custom_field_save()}. |
|
| 1084 | - */ |
|
| 1085 | - do_action('geodir_address_extra_listing_fields', $cf); |
|
| 1086 | - |
|
| 1087 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?> |
|
| 1077 | + /** |
|
| 1078 | + * Called after the address input on the add listings. |
|
| 1079 | + * |
|
| 1080 | + * This is used by the location manage to add further locations info etc. |
|
| 1081 | + * |
|
| 1082 | + * @since 1.0.0 |
|
| 1083 | + * @param array $cf The array of setting for the custom field. {@see geodir_custom_field_save()}. |
|
| 1084 | + */ |
|
| 1085 | + do_action('geodir_address_extra_listing_fields', $cf); |
|
| 1086 | + |
|
| 1087 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?> |
|
| 1088 | 1088 | |
| 1089 | 1089 | <div id="geodir_<?php echo $prefix . 'zip'; ?>_row" |
| 1090 | 1090 | class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix gd-fieldset-details"> |
@@ -1105,22 +1105,22 @@ discard block |
||
| 1105 | 1105 | |
| 1106 | 1106 | <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details"> |
| 1107 | 1107 | <?php |
| 1108 | - /** |
|
| 1109 | - * Contains add listing page map functions. |
|
| 1110 | - * |
|
| 1111 | - * @since 1.0.0 |
|
| 1112 | - */ |
|
| 1113 | - include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php"); |
|
| 1114 | - if ($lat_lng_blank) { |
|
| 1115 | - $lat = ''; |
|
| 1116 | - $lng = ''; |
|
| 1117 | - } |
|
| 1118 | - ?> |
|
| 1108 | + /** |
|
| 1109 | + * Contains add listing page map functions. |
|
| 1110 | + * |
|
| 1111 | + * @since 1.0.0 |
|
| 1112 | + */ |
|
| 1113 | + include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php"); |
|
| 1114 | + if ($lat_lng_blank) { |
|
| 1115 | + $lat = ''; |
|
| 1116 | + $lng = ''; |
|
| 1117 | + } |
|
| 1118 | + ?> |
|
| 1119 | 1119 | <span class="geodir_message_note"><?php echo GET_MAP_MSG; ?></span> |
| 1120 | 1120 | </div> |
| 1121 | 1121 | <?php |
| 1122 | - /* show lat lng */ |
|
| 1123 | - $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?> |
|
| 1122 | + /* show lat lng */ |
|
| 1123 | + $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?> |
|
| 1124 | 1124 | <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row" |
| 1125 | 1125 | class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>> |
| 1126 | 1126 | <label> |
@@ -1161,27 +1161,27 @@ discard block |
||
| 1161 | 1161 | class="gd-checkbox" |
| 1162 | 1162 | name="<?php echo $prefix . 'mapview'; ?>" |
| 1163 | 1163 | id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') { |
| 1164 | - echo 'checked="checked"'; |
|
| 1165 | - } ?> value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span> |
|
| 1164 | + echo 'checked="checked"'; |
|
| 1165 | + } ?> value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span> |
|
| 1166 | 1166 | <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio" |
| 1167 | 1167 | class="gd-checkbox" |
| 1168 | 1168 | name="<?php echo $prefix . 'mapview'; ?>" |
| 1169 | 1169 | id="map_view1" <?php if ($mapview == 'SATELLITE') { |
| 1170 | - echo 'checked="checked"'; |
|
| 1171 | - } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span> |
|
| 1170 | + echo 'checked="checked"'; |
|
| 1171 | + } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span> |
|
| 1172 | 1172 | |
| 1173 | 1173 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio" |
| 1174 | 1174 | class="gd-checkbox" |
| 1175 | 1175 | name="<?php echo $prefix . 'mapview'; ?>" |
| 1176 | 1176 | id="map_view2" <?php if ($mapview == 'HYBRID') { |
| 1177 | - echo 'checked="checked"'; |
|
| 1178 | - } ?> value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span> |
|
| 1177 | + echo 'checked="checked"'; |
|
| 1178 | + } ?> value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span> |
|
| 1179 | 1179 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio" |
| 1180 | 1180 | class="gd-checkbox" |
| 1181 | 1181 | name="<?php echo $prefix . 'mapview'; ?>" |
| 1182 | 1182 | id="map_view3" <?php if ($mapview == 'TERRAIN') { |
| 1183 | - echo 'checked="checked"'; |
|
| 1184 | - } ?> value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span> |
|
| 1183 | + echo 'checked="checked"'; |
|
| 1184 | + } ?> value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span> |
|
| 1185 | 1185 | |
| 1186 | 1186 | |
| 1187 | 1187 | </div> |
@@ -1189,14 +1189,14 @@ discard block |
||
| 1189 | 1189 | |
| 1190 | 1190 | <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?> |
| 1191 | 1191 | <input type="hidden" value="<?php if (isset($mapzoom)) { |
| 1192 | - echo esc_attr($mapzoom); |
|
| 1193 | - } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/> |
|
| 1192 | + echo esc_attr($mapzoom); |
|
| 1193 | + } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/> |
|
| 1194 | 1194 | <?php } |
| 1195 | 1195 | |
| 1196 | - $html = ob_get_clean(); |
|
| 1197 | - } |
|
| 1196 | + $html = ob_get_clean(); |
|
| 1197 | + } |
|
| 1198 | 1198 | |
| 1199 | - return $html; |
|
| 1199 | + return $html; |
|
| 1200 | 1200 | } |
| 1201 | 1201 | add_filter('geodir_custom_field_input_address','geodir_cfi_address',10,2); |
| 1202 | 1202 | |
@@ -1213,137 +1213,137 @@ discard block |
||
| 1213 | 1213 | */ |
| 1214 | 1214 | function geodir_cfi_taxonomy($html,$cf){ |
| 1215 | 1215 | |
| 1216 | - $html_var = $cf['htmlvar_name']; |
|
| 1217 | - |
|
| 1218 | - // Check if there is a custom field specific filter. |
|
| 1219 | - if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){ |
|
| 1220 | - /** |
|
| 1221 | - * Filter the taxonomy html by individual custom field. |
|
| 1222 | - * |
|
| 1223 | - * @param string $html The html to filter. |
|
| 1224 | - * @param array $cf The custom field array. |
|
| 1225 | - * @since 1.6.6 |
|
| 1226 | - */ |
|
| 1227 | - $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf); |
|
| 1228 | - } |
|
| 1229 | - |
|
| 1230 | - // If no html then we run the standard output. |
|
| 1231 | - if(empty($html)) { |
|
| 1232 | - |
|
| 1233 | - ob_start(); // Start buffering; |
|
| 1234 | - $value = geodir_get_cf_value($cf); |
|
| 1235 | - |
|
| 1236 | - $name = $cf['name']; |
|
| 1237 | - $site_title = $cf['site_title']; |
|
| 1238 | - $admin_desc = $cf['desc']; |
|
| 1239 | - $is_required = $cf['is_required']; |
|
| 1240 | - $is_admin = $cf['is_admin']; |
|
| 1241 | - $required_msg = $cf['required_msg']; |
|
| 1242 | - |
|
| 1243 | - if ($value == $cf['default']) { |
|
| 1244 | - $value = ''; |
|
| 1245 | - } ?> |
|
| 1216 | + $html_var = $cf['htmlvar_name']; |
|
| 1217 | + |
|
| 1218 | + // Check if there is a custom field specific filter. |
|
| 1219 | + if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){ |
|
| 1220 | + /** |
|
| 1221 | + * Filter the taxonomy html by individual custom field. |
|
| 1222 | + * |
|
| 1223 | + * @param string $html The html to filter. |
|
| 1224 | + * @param array $cf The custom field array. |
|
| 1225 | + * @since 1.6.6 |
|
| 1226 | + */ |
|
| 1227 | + $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf); |
|
| 1228 | + } |
|
| 1229 | + |
|
| 1230 | + // If no html then we run the standard output. |
|
| 1231 | + if(empty($html)) { |
|
| 1232 | + |
|
| 1233 | + ob_start(); // Start buffering; |
|
| 1234 | + $value = geodir_get_cf_value($cf); |
|
| 1235 | + |
|
| 1236 | + $name = $cf['name']; |
|
| 1237 | + $site_title = $cf['site_title']; |
|
| 1238 | + $admin_desc = $cf['desc']; |
|
| 1239 | + $is_required = $cf['is_required']; |
|
| 1240 | + $is_admin = $cf['is_admin']; |
|
| 1241 | + $required_msg = $cf['required_msg']; |
|
| 1242 | + |
|
| 1243 | + if ($value == $cf['default']) { |
|
| 1244 | + $value = ''; |
|
| 1245 | + } ?> |
|
| 1246 | 1246 | <div id="<?php echo $name;?>_row" |
| 1247 | 1247 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 1248 | 1248 | <label> |
| 1249 | 1249 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1250 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1250 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1251 | 1251 | <?php if ($is_required) echo '<span>*</span>';?> |
| 1252 | 1252 | </label> |
| 1253 | 1253 | |
| 1254 | 1254 | <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;"> |
| 1255 | 1255 | <?php |
| 1256 | - global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats; |
|
| 1256 | + global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats; |
|
| 1257 | 1257 | |
| 1258 | - $exclude_cats = array(); |
|
| 1258 | + $exclude_cats = array(); |
|
| 1259 | 1259 | |
| 1260 | - if ($is_admin == '1') { |
|
| 1260 | + if ($is_admin == '1') { |
|
| 1261 | 1261 | |
| 1262 | - $post_type = get_post_type(); |
|
| 1262 | + $post_type = get_post_type(); |
|
| 1263 | 1263 | |
| 1264 | - $package_info = array(); |
|
| 1264 | + $package_info = array(); |
|
| 1265 | 1265 | |
| 1266 | - $package_info = (array)geodir_post_package_info($package_info, $post, $post_type); |
|
| 1266 | + $package_info = (array)geodir_post_package_info($package_info, $post, $post_type); |
|
| 1267 | 1267 | |
| 1268 | - if (!empty($package_info)) { |
|
| 1268 | + if (!empty($package_info)) { |
|
| 1269 | 1269 | |
| 1270 | - if (isset($package_info['cat']) && $package_info['cat'] != '') { |
|
| 1270 | + if (isset($package_info['cat']) && $package_info['cat'] != '') { |
|
| 1271 | 1271 | |
| 1272 | - $exclude_cats = explode(',', $package_info['cat']); |
|
| 1272 | + $exclude_cats = explode(',', $package_info['cat']); |
|
| 1273 | 1273 | |
| 1274 | - } |
|
| 1275 | - } |
|
| 1276 | - } |
|
| 1274 | + } |
|
| 1275 | + } |
|
| 1276 | + } |
|
| 1277 | 1277 | |
| 1278 | - $cat_display = unserialize($cf['extra_fields']); |
|
| 1278 | + $cat_display = unserialize($cf['extra_fields']); |
|
| 1279 | 1279 | |
| 1280 | - if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) { |
|
| 1280 | + if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) { |
|
| 1281 | 1281 | |
| 1282 | - $post_cat = implode(",", $post_cat[$name]); |
|
| 1282 | + $post_cat = implode(",", $post_cat[$name]); |
|
| 1283 | 1283 | |
| 1284 | - } else { |
|
| 1285 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 1286 | - $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true); |
|
| 1287 | - } |
|
| 1284 | + } else { |
|
| 1285 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 1286 | + $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true); |
|
| 1287 | + } |
|
| 1288 | 1288 | |
| 1289 | 1289 | |
| 1290 | - global $geodir_addon_list; |
|
| 1291 | - if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') { |
|
| 1290 | + global $geodir_addon_list; |
|
| 1291 | + if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') { |
|
| 1292 | 1292 | |
| 1293 | - $catadd_limit = $wpdb->get_var( |
|
| 1294 | - $wpdb->prepare( |
|
| 1295 | - "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d", |
|
| 1296 | - array($package_id) |
|
| 1297 | - ) |
|
| 1298 | - ); |
|
| 1293 | + $catadd_limit = $wpdb->get_var( |
|
| 1294 | + $wpdb->prepare( |
|
| 1295 | + "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d", |
|
| 1296 | + array($package_id) |
|
| 1297 | + ) |
|
| 1298 | + ); |
|
| 1299 | 1299 | |
| 1300 | 1300 | |
| 1301 | - } else { |
|
| 1302 | - $catadd_limit = 0; |
|
| 1303 | - } |
|
| 1301 | + } else { |
|
| 1302 | + $catadd_limit = 0; |
|
| 1303 | + } |
|
| 1304 | 1304 | |
| 1305 | 1305 | |
| 1306 | - if ($cat_display != '' && $cat_display != 'ajax_chained') { |
|
| 1306 | + if ($cat_display != '' && $cat_display != 'ajax_chained') { |
|
| 1307 | 1307 | |
| 1308 | - $required_limit_msg = ''; |
|
| 1309 | - if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') { |
|
| 1308 | + $required_limit_msg = ''; |
|
| 1309 | + if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') { |
|
| 1310 | 1310 | |
| 1311 | - $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory'); |
|
| 1311 | + $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory'); |
|
| 1312 | 1312 | |
| 1313 | - } else { |
|
| 1314 | - $required_limit_msg = $required_msg; |
|
| 1315 | - } |
|
| 1313 | + } else { |
|
| 1314 | + $required_limit_msg = $required_msg; |
|
| 1315 | + } |
|
| 1316 | 1316 | |
| 1317 | - echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']" />'; |
|
| 1317 | + echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']" />'; |
|
| 1318 | 1318 | |
| 1319 | 1319 | |
| 1320 | - if ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
| 1320 | + if ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
| 1321 | 1321 | |
| 1322 | - $cat_display == ''; |
|
| 1323 | - $multiple = ''; |
|
| 1324 | - if ($cat_display == 'multiselect') |
|
| 1325 | - $multiple = 'multiple="multiple"'; |
|
| 1322 | + $cat_display == ''; |
|
| 1323 | + $multiple = ''; |
|
| 1324 | + if ($cat_display == 'multiselect') |
|
| 1325 | + $multiple = 'multiple="multiple"'; |
|
| 1326 | 1326 | |
| 1327 | - echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">'; |
|
| 1327 | + echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">'; |
|
| 1328 | 1328 | |
| 1329 | 1329 | |
| 1330 | - if ($cat_display == 'select') |
|
| 1331 | - echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>'; |
|
| 1330 | + if ($cat_display == 'select') |
|
| 1331 | + echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>'; |
|
| 1332 | 1332 | |
| 1333 | - } |
|
| 1333 | + } |
|
| 1334 | 1334 | |
| 1335 | - echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0); |
|
| 1335 | + echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0); |
|
| 1336 | 1336 | |
| 1337 | - if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 1338 | - echo '</select>'; |
|
| 1337 | + if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 1338 | + echo '</select>'; |
|
| 1339 | 1339 | |
| 1340 | - } else { |
|
| 1340 | + } else { |
|
| 1341 | 1341 | |
| 1342 | - echo geodir_custom_taxonomy_walker2($name, $catadd_limit); |
|
| 1342 | + echo geodir_custom_taxonomy_walker2($name, $catadd_limit); |
|
| 1343 | 1343 | |
| 1344 | - } |
|
| 1344 | + } |
|
| 1345 | 1345 | |
| 1346 | - ?> |
|
| 1346 | + ?> |
|
| 1347 | 1347 | </div> |
| 1348 | 1348 | |
| 1349 | 1349 | <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
@@ -1353,10 +1353,10 @@ discard block |
||
| 1353 | 1353 | </div> |
| 1354 | 1354 | |
| 1355 | 1355 | <?php |
| 1356 | - $html = ob_get_clean(); |
|
| 1357 | - } |
|
| 1356 | + $html = ob_get_clean(); |
|
| 1357 | + } |
|
| 1358 | 1358 | |
| 1359 | - return $html; |
|
| 1359 | + return $html; |
|
| 1360 | 1360 | } |
| 1361 | 1361 | add_filter('geodir_custom_field_input_taxonomy','geodir_cfi_taxonomy',10,2); |
| 1362 | 1362 | |
@@ -1372,74 +1372,74 @@ discard block |
||
| 1372 | 1372 | */ |
| 1373 | 1373 | function geodir_cfi_file($html,$cf){ |
| 1374 | 1374 | |
| 1375 | - $html_var = $cf['htmlvar_name']; |
|
| 1375 | + $html_var = $cf['htmlvar_name']; |
|
| 1376 | 1376 | |
| 1377 | - // Check if there is a custom field specific filter. |
|
| 1378 | - if(has_filter("geodir_custom_field_input_file_{$html_var}")){ |
|
| 1379 | - /** |
|
| 1380 | - * Filter the file html by individual custom field. |
|
| 1381 | - * |
|
| 1382 | - * @param string $html The html to filter. |
|
| 1383 | - * @param array $cf The custom field array. |
|
| 1384 | - * @since 1.6.6 |
|
| 1385 | - */ |
|
| 1386 | - $html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf); |
|
| 1387 | - } |
|
| 1377 | + // Check if there is a custom field specific filter. |
|
| 1378 | + if(has_filter("geodir_custom_field_input_file_{$html_var}")){ |
|
| 1379 | + /** |
|
| 1380 | + * Filter the file html by individual custom field. |
|
| 1381 | + * |
|
| 1382 | + * @param string $html The html to filter. |
|
| 1383 | + * @param array $cf The custom field array. |
|
| 1384 | + * @since 1.6.6 |
|
| 1385 | + */ |
|
| 1386 | + $html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf); |
|
| 1387 | + } |
|
| 1388 | 1388 | |
| 1389 | - // If no html then we run the standard output. |
|
| 1390 | - if(empty($html)) { |
|
| 1389 | + // If no html then we run the standard output. |
|
| 1390 | + if(empty($html)) { |
|
| 1391 | 1391 | |
| 1392 | - ob_start(); // Start buffering; |
|
| 1393 | - $value = geodir_get_cf_value($cf); |
|
| 1392 | + ob_start(); // Start buffering; |
|
| 1393 | + $value = geodir_get_cf_value($cf); |
|
| 1394 | 1394 | |
| 1395 | - $name = $cf['name']; |
|
| 1396 | - $site_title = $cf['site_title']; |
|
| 1397 | - $admin_desc = $cf['desc']; |
|
| 1398 | - $is_required = $cf['is_required']; |
|
| 1399 | - $required_msg = $cf['required_msg']; |
|
| 1400 | - $extra_fields = unserialize($cf['extra_fields']); |
|
| 1395 | + $name = $cf['name']; |
|
| 1396 | + $site_title = $cf['site_title']; |
|
| 1397 | + $admin_desc = $cf['desc']; |
|
| 1398 | + $is_required = $cf['is_required']; |
|
| 1399 | + $required_msg = $cf['required_msg']; |
|
| 1400 | + $extra_fields = unserialize($cf['extra_fields']); |
|
| 1401 | 1401 | |
| 1402 | 1402 | |
| 1403 | - // adjust values here |
|
| 1404 | - $file_id = $name; // 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 |
|
| 1403 | + // adjust values here |
|
| 1404 | + $file_id = $name; // 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 |
|
| 1405 | 1405 | |
| 1406 | - if ($value != '') { |
|
| 1406 | + if ($value != '') { |
|
| 1407 | 1407 | |
| 1408 | - $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls. |
|
| 1408 | + $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls. |
|
| 1409 | 1409 | |
| 1410 | - } else |
|
| 1411 | - $file_value = ''; |
|
| 1410 | + } else |
|
| 1411 | + $file_value = ''; |
|
| 1412 | 1412 | |
| 1413 | - if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) |
|
| 1414 | - $file_multiple = true; // allow multiple files upload |
|
| 1415 | - else |
|
| 1416 | - $file_multiple = false; |
|
| 1413 | + if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) |
|
| 1414 | + $file_multiple = true; // allow multiple files upload |
|
| 1415 | + else |
|
| 1416 | + $file_multiple = false; |
|
| 1417 | 1417 | |
| 1418 | - if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) |
|
| 1419 | - $file_image_limit = $extra_fields['image_limit']; |
|
| 1420 | - else |
|
| 1421 | - $file_image_limit = 1; |
|
| 1418 | + if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) |
|
| 1419 | + $file_image_limit = $extra_fields['image_limit']; |
|
| 1420 | + else |
|
| 1421 | + $file_image_limit = 1; |
|
| 1422 | 1422 | |
| 1423 | - $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) |
|
| 1423 | + $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) |
|
| 1424 | 1424 | |
| 1425 | - $file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels) |
|
| 1425 | + $file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels) |
|
| 1426 | 1426 | |
| 1427 | - if (!empty($file_value)) { |
|
| 1428 | - $curImages = explode(',', $file_value); |
|
| 1429 | - if (!empty($curImages)) |
|
| 1430 | - $file_totImg = count($curImages); |
|
| 1431 | - } |
|
| 1427 | + if (!empty($file_value)) { |
|
| 1428 | + $curImages = explode(',', $file_value); |
|
| 1429 | + if (!empty($curImages)) |
|
| 1430 | + $file_totImg = count($curImages); |
|
| 1431 | + } |
|
| 1432 | 1432 | |
| 1433 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : ''; |
|
| 1434 | - $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : ''; |
|
| 1433 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : ''; |
|
| 1434 | + $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : ''; |
|
| 1435 | 1435 | |
| 1436 | - ?> |
|
| 1436 | + ?> |
|
| 1437 | 1437 | <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?> |
| 1438 | 1438 | <?php if($file_image_limit!=0 && $file_image_limit==1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('image with this package').')</small>';} ?> |
| 1439 | 1439 | <?php if($file_image_limit!=0 && $file_image_limit>1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('images with this package').')</small>';} ?> |
| 1440 | 1440 | <?php if($file_image_limit==0){echo '<br /><small>('.__('You can upload unlimited images with this package').')</small>';} ?> |
| 1441 | 1441 | </h5> <?php */ |
| 1442 | - ?> |
|
| 1442 | + ?> |
|
| 1443 | 1443 | |
| 1444 | 1444 | <div id="<?php echo $name;?>_row" |
| 1445 | 1445 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
@@ -1447,7 +1447,7 @@ discard block |
||
| 1447 | 1447 | <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;"> |
| 1448 | 1448 | <label |
| 1449 | 1449 | style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory'); |
| 1450 | - echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label> |
|
| 1450 | + echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label> |
|
| 1451 | 1451 | <input class="geodir-custom-file-upload" field_type="file" type="hidden" |
| 1452 | 1452 | name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>" |
| 1453 | 1453 | value="<?php echo esc_attr($file_value); ?>"/> |
@@ -1459,17 +1459,17 @@ discard block |
||
| 1459 | 1459 | <?php } ?> |
| 1460 | 1460 | <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg" |
| 1461 | 1461 | value="<?php if (isset($file_totImg)) { |
| 1462 | - echo esc_attr($file_totImg); |
|
| 1463 | - } else { |
|
| 1464 | - echo '0'; |
|
| 1465 | - } ?>"/> |
|
| 1462 | + echo esc_attr($file_totImg); |
|
| 1463 | + } else { |
|
| 1464 | + echo '0'; |
|
| 1465 | + } ?>"/> |
|
| 1466 | 1466 | |
| 1467 | 1467 | <div style="float:left; width:55%;"> |
| 1468 | 1468 | <div |
| 1469 | 1469 | class="plupload-upload-uic hide-if-no-js <?php if ($file_multiple): ?>plupload-upload-uic-multiple<?php endif; ?>" |
| 1470 | 1470 | id="<?php echo $file_id; ?>plupload-upload-ui" style="float:left; width:30%;"> |
| 1471 | 1471 | <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */ |
| 1472 | - ?> |
|
| 1472 | + ?> |
|
| 1473 | 1473 | <input id="<?php echo $file_id; ?>plupload-browse-button" type="button" |
| 1474 | 1474 | value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>" |
| 1475 | 1475 | class="geodir_button" style="margin-top:10px;"/> |
@@ -1488,7 +1488,7 @@ discard block |
||
| 1488 | 1488 | style=" clear:inherit; margin-top:0; margin-left:15px; padding-top:10px; float:left; width:50%;"> |
| 1489 | 1489 | </div> |
| 1490 | 1490 | <?php /*?><span id="upload-msg" ><?php _e('Please drag & drop the images to rearrange the order');?></span><?php */ |
| 1491 | - ?> |
|
| 1491 | + ?> |
|
| 1492 | 1492 | |
| 1493 | 1493 | <span id="<?php echo $file_id; ?>upload-error" style="display:none"></span> |
| 1494 | 1494 | |
@@ -1502,9 +1502,9 @@ discard block |
||
| 1502 | 1502 | |
| 1503 | 1503 | |
| 1504 | 1504 | <?php |
| 1505 | - $html = ob_get_clean(); |
|
| 1506 | - } |
|
| 1505 | + $html = ob_get_clean(); |
|
| 1506 | + } |
|
| 1507 | 1507 | |
| 1508 | - return $html; |
|
| 1508 | + return $html; |
|
| 1509 | 1509 | } |
| 1510 | 1510 | add_filter('geodir_custom_field_input_file','geodir_cfi_file',10,2); |
| 1511 | 1511 | \ No newline at end of file |
@@ -11,11 +11,11 @@ |
||
| 11 | 11 | // Page titles translatable CPT names |
| 12 | 12 | function geodir_kelo_title_translation( $args) { |
| 13 | 13 | |
| 14 | - if(function_exists('geodir_is_geodir_page')){ |
|
| 15 | - $args['title'] = __($args['title'],'geodirectory'); |
|
| 16 | - } |
|
| 14 | + if(function_exists('geodir_is_geodir_page')){ |
|
| 15 | + $args['title'] = __($args['title'],'geodirectory'); |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - return $args; |
|
| 18 | + return $args; |
|
| 19 | 19 | } |
| 20 | 20 | add_filter( 'kleo_title_args', 'geodir_kelo_title_translation', 10, 1 ); |
| 21 | 21 | |
@@ -9,14 +9,14 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | // Page titles translatable CPT names |
| 12 | -function geodir_kelo_title_translation( $args) { |
|
| 12 | +function geodir_kelo_title_translation($args) { |
|
| 13 | 13 | |
| 14 | - if(function_exists('geodir_is_geodir_page')){ |
|
| 15 | - $args['title'] = __($args['title'],'geodirectory'); |
|
| 14 | + if (function_exists('geodir_is_geodir_page')) { |
|
| 15 | + $args['title'] = __($args['title'], 'geodirectory'); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | return $args; |
| 19 | 19 | } |
| 20 | -add_filter( 'kleo_title_args', 'geodir_kelo_title_translation', 10, 1 ); |
|
| 20 | +add_filter('kleo_title_args', 'geodir_kelo_title_translation', 10, 1); |
|
| 21 | 21 | |
| 22 | 22 | |
@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | function geodir_init_map_jason() |
| 17 | 17 | {
|
| 18 | - global $map_jason; |
|
| 19 | - $map_jason = array(); |
|
| 18 | + global $map_jason; |
|
| 19 | + $map_jason = array(); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -28,8 +28,8 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | function geodir_init_map_canvas_array() |
| 30 | 30 | {
|
| 31 | - global $map_canvas_arr; |
|
| 32 | - $map_canvas_arr = array(); |
|
| 31 | + global $map_canvas_arr; |
|
| 32 | + $map_canvas_arr = array(); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | |
@@ -50,50 +50,50 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | function create_marker_jason_of_posts($post) |
| 52 | 52 | {
|
| 53 | - global $wpdb, $map_jason, $add_post_in_marker_array, $geodir_cat_icons, $gd_marker_sizes; |
|
| 53 | + global $wpdb, $map_jason, $add_post_in_marker_array, $geodir_cat_icons, $gd_marker_sizes; |
|
| 54 | 54 | |
| 55 | - if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array) && $post->marker_json != '') {
|
|
| 55 | + if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array) && $post->marker_json != '') {
|
|
| 56 | 56 | |
| 57 | - if(isset($map_jason[$post->ID])){return null;}
|
|
| 57 | + if(isset($map_jason[$post->ID])){return null;}
|
|
| 58 | 58 | |
| 59 | - $srcharr = array("'", "/", "-", '"', '\\');
|
|
| 60 | - $replarr = array("′", "⁄", "–", "“", '');
|
|
| 59 | + $srcharr = array("'", "/", "-", '"', '\\');
|
|
| 60 | + $replarr = array("′", "⁄", "–", "“", '');
|
|
| 61 | 61 | |
| 62 | 62 | |
| 63 | - $geodir_cat_icons = geodir_get_term_icon(); |
|
| 64 | - $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$post->default_category]) ? $geodir_cat_icons[$post->default_category] : ''; |
|
| 63 | + $geodir_cat_icons = geodir_get_term_icon(); |
|
| 64 | + $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$post->default_category]) ? $geodir_cat_icons[$post->default_category] : ''; |
|
| 65 | 65 | |
| 66 | - $post_title = $post->post_title; |
|
| 67 | - $title = str_replace($srcharr, $replarr, $post_title); |
|
| 66 | + $post_title = $post->post_title; |
|
| 67 | + $title = str_replace($srcharr, $replarr, $post_title); |
|
| 68 | 68 | |
| 69 | - if (is_ssl()) {
|
|
| 70 | - $icon = str_replace("http:","https:",$icon );
|
|
| 71 | - } |
|
| 69 | + if (is_ssl()) {
|
|
| 70 | + $icon = str_replace("http:","https:",$icon );
|
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - if ($icon != '') {
|
|
| 74 | - $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes; |
|
| 73 | + if ($icon != '') {
|
|
| 74 | + $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes; |
|
| 75 | 75 | |
| 76 | - if (isset($gd_marker_sizes[$icon])) {
|
|
| 77 | - $icon_size = $gd_marker_sizes[$icon]; |
|
| 78 | - } else {
|
|
| 79 | - $icon_size = geodir_get_marker_size($icon); |
|
| 80 | - $gd_marker_sizes[$icon] = $icon_size; |
|
| 81 | - } |
|
| 82 | - } else {
|
|
| 83 | - $icon_size = array('w' => 36, 'h' => 45);
|
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - $post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"}';
|
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * Filter the json data when creating output for post json marker.. |
|
| 90 | - * |
|
| 91 | - * @since 1.5.7 |
|
| 92 | - * @param string $post_json JSON representation of the post marker info. |
|
| 93 | - * @param object $post The post object. |
|
| 94 | - */ |
|
| 95 | - $map_jason[$post->ID] = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
|
|
| 96 | - } |
|
| 76 | + if (isset($gd_marker_sizes[$icon])) {
|
|
| 77 | + $icon_size = $gd_marker_sizes[$icon]; |
|
| 78 | + } else {
|
|
| 79 | + $icon_size = geodir_get_marker_size($icon); |
|
| 80 | + $gd_marker_sizes[$icon] = $icon_size; |
|
| 81 | + } |
|
| 82 | + } else {
|
|
| 83 | + $icon_size = array('w' => 36, 'h' => 45);
|
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + $post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"}';
|
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * Filter the json data when creating output for post json marker.. |
|
| 90 | + * |
|
| 91 | + * @since 1.5.7 |
|
| 92 | + * @param string $post_json JSON representation of the post marker info. |
|
| 93 | + * @param object $post The post object. |
|
| 94 | + */ |
|
| 95 | + $map_jason[$post->ID] = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
|
|
| 96 | + } |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -106,66 +106,66 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | function send_marker_jason_to_js() |
| 108 | 108 | {
|
| 109 | - global $map_jason, $map_canvas_arr; |
|
| 110 | - |
|
| 111 | - if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) {
|
|
| 112 | - foreach ($map_canvas_arr as $canvas => $jason) {
|
|
| 113 | - if (is_array($map_jason) && !empty($map_jason)) {
|
|
| 114 | - |
|
| 115 | - // on details page only show the main marker on the map |
|
| 116 | - if(geodir_is_page('detail')){
|
|
| 117 | - global $post; |
|
| 118 | - if(isset($map_jason[$post->ID])){
|
|
| 119 | - $map_jason = array($map_jason[$post->ID]); |
|
| 120 | - } |
|
| 121 | - } |
|
| 122 | - $canvas_jason = $canvas . "_jason"; |
|
| 123 | - $map_canvas_arr[$canvas] = array_unique($map_jason); |
|
| 124 | - unset($cat_content_info); |
|
| 125 | - $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
|
|
| 126 | - $totalcount = count(array_unique($map_jason)); |
|
| 127 | - if (!empty($cat_content_info)) {
|
|
| 128 | - $json_content = substr(implode(',', $cat_content_info), 1);
|
|
| 129 | - $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
|
|
| 130 | - $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
|
|
| 131 | - } else {
|
|
| 132 | - $canvas_jason = '[{"totalcount":"0"}]';
|
|
| 133 | - } |
|
| 134 | - $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
|
| 135 | - |
|
| 136 | - /** |
|
| 137 | - * Filter the send_marker_jason_to_js() function map canvas json args. |
|
| 138 | - * |
|
| 139 | - * You can use this filter to modify map canvas json args. |
|
| 140 | - * |
|
| 141 | - * @since 1.0.0 |
|
| 142 | - * @package GeoDirectory |
|
| 143 | - * @param string $canvas Map canvas array key. |
|
| 144 | - * @param array $map_canvas_jason_args Map canvas args. |
|
| 145 | - */ |
|
| 146 | - $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
|
|
| 147 | - |
|
| 148 | - wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
|
|
| 149 | - } else {
|
|
| 150 | - $canvas_jason = '[{"totalcount":"0"}]';
|
|
| 151 | - $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * Filter the send_marker_jason_to_js() function map canvas json args. |
|
| 155 | - * |
|
| 156 | - * You can use this filter to modify map canvas json args. |
|
| 157 | - * |
|
| 158 | - * @since 1.0.0 |
|
| 159 | - * @package GeoDirectory |
|
| 160 | - * @param string $canvas Map canvas array key. |
|
| 161 | - * @param array $map_canvas_jason_args Map canvas args. |
|
| 162 | - */ |
|
| 163 | - $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
|
|
| 164 | - wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
|
|
| 165 | - } |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - } |
|
| 109 | + global $map_jason, $map_canvas_arr; |
|
| 110 | + |
|
| 111 | + if (is_array($map_canvas_arr) && !empty($map_canvas_arr)) {
|
|
| 112 | + foreach ($map_canvas_arr as $canvas => $jason) {
|
|
| 113 | + if (is_array($map_jason) && !empty($map_jason)) {
|
|
| 114 | + |
|
| 115 | + // on details page only show the main marker on the map |
|
| 116 | + if(geodir_is_page('detail')){
|
|
| 117 | + global $post; |
|
| 118 | + if(isset($map_jason[$post->ID])){
|
|
| 119 | + $map_jason = array($map_jason[$post->ID]); |
|
| 120 | + } |
|
| 121 | + } |
|
| 122 | + $canvas_jason = $canvas . "_jason"; |
|
| 123 | + $map_canvas_arr[$canvas] = array_unique($map_jason); |
|
| 124 | + unset($cat_content_info); |
|
| 125 | + $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
|
|
| 126 | + $totalcount = count(array_unique($map_jason)); |
|
| 127 | + if (!empty($cat_content_info)) {
|
|
| 128 | + $json_content = substr(implode(',', $cat_content_info), 1);
|
|
| 129 | + $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
|
|
| 130 | + $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
|
|
| 131 | + } else {
|
|
| 132 | + $canvas_jason = '[{"totalcount":"0"}]';
|
|
| 133 | + } |
|
| 134 | + $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
|
| 135 | + |
|
| 136 | + /** |
|
| 137 | + * Filter the send_marker_jason_to_js() function map canvas json args. |
|
| 138 | + * |
|
| 139 | + * You can use this filter to modify map canvas json args. |
|
| 140 | + * |
|
| 141 | + * @since 1.0.0 |
|
| 142 | + * @package GeoDirectory |
|
| 143 | + * @param string $canvas Map canvas array key. |
|
| 144 | + * @param array $map_canvas_jason_args Map canvas args. |
|
| 145 | + */ |
|
| 146 | + $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
|
|
| 147 | + |
|
| 148 | + wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
|
|
| 149 | + } else {
|
|
| 150 | + $canvas_jason = '[{"totalcount":"0"}]';
|
|
| 151 | + $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * Filter the send_marker_jason_to_js() function map canvas json args. |
|
| 155 | + * |
|
| 156 | + * You can use this filter to modify map canvas json args. |
|
| 157 | + * |
|
| 158 | + * @since 1.0.0 |
|
| 159 | + * @package GeoDirectory |
|
| 160 | + * @param string $canvas Map canvas array key. |
|
| 161 | + * @param array $map_canvas_jason_args Map canvas args. |
|
| 162 | + */ |
|
| 163 | + $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
|
|
| 164 | + wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
|
|
| 165 | + } |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + } |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -184,99 +184,99 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | function home_map_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = true, $pading = 0, $map_canvas_name = '', $child_collapse, $is_home_map = false) |
| 186 | 186 | {
|
| 187 | - global $cat_count, $geodir_cat_icons; |
|
| 187 | + global $cat_count, $geodir_cat_icons; |
|
| 188 | 188 | |
| 189 | - $exclude_categories = get_option('geodir_exclude_cat_on_map');
|
|
| 190 | - $exclude_categories_new = get_option('geodir_exclude_cat_on_map_upgrade');
|
|
| 189 | + $exclude_categories = get_option('geodir_exclude_cat_on_map');
|
|
| 190 | + $exclude_categories_new = get_option('geodir_exclude_cat_on_map_upgrade');
|
|
| 191 | 191 | |
| 192 | - // check if exclude categories saved before fix of categories identical names |
|
| 193 | - if ($exclude_categories_new) {
|
|
| 194 | - $gd_cat_taxonomy = isset($cat_taxonomy[0]) ? $cat_taxonomy[0] : ''; |
|
| 195 | - $exclude_categories = !empty($exclude_categories[$gd_cat_taxonomy]) && is_array($exclude_categories[$gd_cat_taxonomy]) ? array_unique($exclude_categories[$gd_cat_taxonomy]) : array(); |
|
| 196 | - } |
|
| 192 | + // check if exclude categories saved before fix of categories identical names |
|
| 193 | + if ($exclude_categories_new) {
|
|
| 194 | + $gd_cat_taxonomy = isset($cat_taxonomy[0]) ? $cat_taxonomy[0] : ''; |
|
| 195 | + $exclude_categories = !empty($exclude_categories[$gd_cat_taxonomy]) && is_array($exclude_categories[$gd_cat_taxonomy]) ? array_unique($exclude_categories[$gd_cat_taxonomy]) : array(); |
|
| 196 | + } |
|
| 197 | 197 | |
| 198 | - $exclude_cat_str = implode(',', $exclude_categories);
|
|
| 198 | + $exclude_cat_str = implode(',', $exclude_categories);
|
|
| 199 | 199 | |
| 200 | - if ($exclude_cat_str == '') {
|
|
| 201 | - $exclude_cat_str = '0'; |
|
| 202 | - } |
|
| 200 | + if ($exclude_cat_str == '') {
|
|
| 201 | + $exclude_cat_str = '0'; |
|
| 202 | + } |
|
| 203 | 203 | |
| 204 | - $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'exclude' => $exclude_cat_str, 'hide_empty ' => $hide_empty));
|
|
| 204 | + $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'exclude' => $exclude_cat_str, 'hide_empty ' => $hide_empty));
|
|
| 205 | 205 | |
| 206 | - if ($hide_empty) {
|
|
| 207 | - $cat_terms = geodir_filter_empty_terms($cat_terms); |
|
| 208 | - } |
|
| 206 | + if ($hide_empty) {
|
|
| 207 | + $cat_terms = geodir_filter_empty_terms($cat_terms); |
|
| 208 | + } |
|
| 209 | 209 | |
| 210 | - $main_list_class = ''; |
|
| 211 | - //If there are terms, start displaying |
|
| 212 | - if (count($cat_terms) > 0) {
|
|
| 213 | - //Displaying as a list |
|
| 214 | - $p = $pading * 15; |
|
| 215 | - $pading++; |
|
| 210 | + $main_list_class = ''; |
|
| 211 | + //If there are terms, start displaying |
|
| 212 | + if (count($cat_terms) > 0) {
|
|
| 213 | + //Displaying as a list |
|
| 214 | + $p = $pading * 15; |
|
| 215 | + $pading++; |
|
| 216 | 216 | |
| 217 | - if ($cat_parent == 0) {
|
|
| 218 | - $list_class = 'main_list'; |
|
| 219 | - $display = ''; |
|
| 220 | - } else {
|
|
| 221 | - $list_class = 'sub_list'; |
|
| 222 | - $display = !$child_collapse ? '' : 'display:none'; |
|
| 223 | - } |
|
| 217 | + if ($cat_parent == 0) {
|
|
| 218 | + $list_class = 'main_list'; |
|
| 219 | + $display = ''; |
|
| 220 | + } else {
|
|
| 221 | + $list_class = 'sub_list'; |
|
| 222 | + $display = !$child_collapse ? '' : 'display:none'; |
|
| 223 | + } |
|
| 224 | 224 | |
| 225 | 225 | |
| 226 | - $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
| 226 | + $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
| 227 | 227 | |
| 228 | - $geodir_cat_icons = geodir_get_term_icon(); |
|
| 228 | + $geodir_cat_icons = geodir_get_term_icon(); |
|
| 229 | 229 | |
| 230 | - $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') : 'gd_place';
|
|
| 231 | - $post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : $geodir_default_map_search_pt; |
|
| 232 | - foreach ($cat_terms as $cat_term): |
|
| 230 | + $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') : 'gd_place';
|
|
| 231 | + $post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : $geodir_default_map_search_pt; |
|
| 232 | + foreach ($cat_terms as $cat_term): |
|
| 233 | 233 | |
| 234 | 234 | |
| 235 | 235 | |
| 236 | - $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$cat_term->term_id]) ? $geodir_cat_icons[$cat_term->term_id] : ''; |
|
| 236 | + $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$cat_term->term_id]) ? $geodir_cat_icons[$cat_term->term_id] : ''; |
|
| 237 | 237 | |
| 238 | - if (!in_array($cat_term->term_id, $exclude_categories)): |
|
| 239 | - //Secret sauce. Function calls itself to display child elements, if any |
|
| 240 | - $checked = 'checked="checked"'; |
|
| 238 | + if (!in_array($cat_term->term_id, $exclude_categories)): |
|
| 239 | + //Secret sauce. Function calls itself to display child elements, if any |
|
| 240 | + $checked = 'checked="checked"'; |
|
| 241 | 241 | |
| 242 | - // Untick the category by default on home map |
|
| 243 | - if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
|
|
| 244 | - if (function_exists('icl_object_id')) { // if WPML
|
|
| 245 | - global $sitepress; |
|
| 246 | - $default_lang = $sitepress->get_default_language(); |
|
| 247 | - $term_id = icl_object_id($cat_term->term_id, $post_type.'category', true, $default_lang); |
|
| 248 | - }else{
|
|
| 249 | - $term_id = $cat_term->term_id; |
|
| 250 | - } |
|
| 251 | - if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
|
|
| 252 | - $checked = ''; |
|
| 253 | - } |
|
| 254 | - } |
|
| 242 | + // Untick the category by default on home map |
|
| 243 | + if ($is_home_map && $geodir_home_map_untick = get_option('geodir_home_map_untick')) {
|
|
| 244 | + if (function_exists('icl_object_id')) { // if WPML
|
|
| 245 | + global $sitepress; |
|
| 246 | + $default_lang = $sitepress->get_default_language(); |
|
| 247 | + $term_id = icl_object_id($cat_term->term_id, $post_type.'category', true, $default_lang); |
|
| 248 | + }else{
|
|
| 249 | + $term_id = $cat_term->term_id; |
|
| 250 | + } |
|
| 251 | + if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
|
|
| 252 | + $checked = ''; |
|
| 253 | + } |
|
| 254 | + } |
|
| 255 | 255 | |
| 256 | - $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"'; |
|
| 257 | - $term_check .= ' name="' . $map_canvas_name . '_cat[]" '; |
|
| 258 | - $term_check .= ' title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">'; |
|
| 259 | - $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>'; |
|
| 260 | - $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>'; |
|
| 256 | + $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"'; |
|
| 257 | + $term_check .= ' name="' . $map_canvas_name . '_cat[]" '; |
|
| 258 | + $term_check .= ' title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">'; |
|
| 259 | + $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>'; |
|
| 260 | + $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>'; |
|
| 261 | 261 | |
| 262 | - endif; |
|
| 262 | + endif; |
|
| 263 | 263 | |
| 264 | 264 | |
| 265 | - // get sub category by recursion |
|
| 266 | - $out .= home_map_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading, $map_canvas_name, $child_collapse, $is_home_map); |
|
| 265 | + // get sub category by recursion |
|
| 266 | + $out .= home_map_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading, $map_canvas_name, $child_collapse, $is_home_map); |
|
| 267 | 267 | |
| 268 | - $out .= '</li>'; |
|
| 268 | + $out .= '</li>'; |
|
| 269 | 269 | |
| 270 | - endforeach; |
|
| 270 | + endforeach; |
|
| 271 | 271 | |
| 272 | - $out .= '</ul>'; |
|
| 272 | + $out .= '</ul>'; |
|
| 273 | 273 | |
| 274 | - return $out; |
|
| 275 | - } else {
|
|
| 276 | - if ($cat_parent == 0) |
|
| 277 | - return _e('No category', 'geodirectory');
|
|
| 278 | - } |
|
| 279 | - return; |
|
| 274 | + return $out; |
|
| 275 | + } else {
|
|
| 276 | + if ($cat_parent == 0) |
|
| 277 | + return _e('No category', 'geodirectory');
|
|
| 278 | + } |
|
| 279 | + return; |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | /** |
@@ -288,19 +288,19 @@ discard block |
||
| 288 | 288 | * @return string The map API provider name. |
| 289 | 289 | */ |
| 290 | 290 | function geodir_map_name() {
|
| 291 | - $geodir_map_name = get_option('geodir_load_map', 'google');
|
|
| 291 | + $geodir_map_name = get_option('geodir_load_map', 'google');
|
|
| 292 | 292 | |
| 293 | - if (!in_array($geodir_map_name, array('none', 'auto', 'google', 'osm'))) {
|
|
| 294 | - $geodir_map_name = 'auto'; |
|
| 295 | - } |
|
| 296 | - |
|
| 297 | - /** |
|
| 298 | - * Filter the map JS API provider name. |
|
| 299 | - * |
|
| 300 | - * @since 1.6.1 |
|
| 301 | - * @param string $geodir_map_name The map API provider name. |
|
| 302 | - */ |
|
| 303 | - return apply_filters('geodir_map_name', $geodir_map_name);
|
|
| 293 | + if (!in_array($geodir_map_name, array('none', 'auto', 'google', 'osm'))) {
|
|
| 294 | + $geodir_map_name = 'auto'; |
|
| 295 | + } |
|
| 296 | + |
|
| 297 | + /** |
|
| 298 | + * Filter the map JS API provider name. |
|
| 299 | + * |
|
| 300 | + * @since 1.6.1 |
|
| 301 | + * @param string $geodir_map_name The map API provider name. |
|
| 302 | + */ |
|
| 303 | + return apply_filters('geodir_map_name', $geodir_map_name);
|
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | /** |
@@ -316,48 +316,48 @@ discard block |
||
| 316 | 316 | * @return array The icon size. |
| 317 | 317 | */ |
| 318 | 318 | function geodir_get_marker_size($icon, $default_size = array('w' => 36, 'h' => 45)) {
|
| 319 | - global $gd_marker_sizes; |
|
| 319 | + global $gd_marker_sizes; |
|
| 320 | 320 | |
| 321 | - if (empty($gd_marker_sizes)) {
|
|
| 322 | - $gd_marker_sizes = array(); |
|
| 323 | - } |
|
| 321 | + if (empty($gd_marker_sizes)) {
|
|
| 322 | + $gd_marker_sizes = array(); |
|
| 323 | + } |
|
| 324 | 324 | |
| 325 | - if (!empty($gd_marker_sizes[$icon])) {
|
|
| 326 | - return $gd_marker_sizes[$icon]; |
|
| 327 | - } |
|
| 325 | + if (!empty($gd_marker_sizes[$icon])) {
|
|
| 326 | + return $gd_marker_sizes[$icon]; |
|
| 327 | + } |
|
| 328 | 328 | |
| 329 | - if (empty($icon)) {
|
|
| 330 | - $gd_marker_sizes[$icon] = $default_size; |
|
| 329 | + if (empty($icon)) {
|
|
| 330 | + $gd_marker_sizes[$icon] = $default_size; |
|
| 331 | 331 | |
| 332 | - return $default_size; |
|
| 333 | - } |
|
| 332 | + return $default_size; |
|
| 333 | + } |
|
| 334 | 334 | |
| 335 | - $icon_url = $icon; |
|
| 335 | + $icon_url = $icon; |
|
| 336 | 336 | |
| 337 | - $uploads = wp_upload_dir(); // Array of key => value pairs |
|
| 337 | + $uploads = wp_upload_dir(); // Array of key => value pairs |
|
| 338 | 338 | |
| 339 | - if (!path_is_absolute($icon)) {
|
|
| 340 | - $icon = str_replace($uploads['baseurl'], $uploads['basedir'], $icon); |
|
| 341 | - } |
|
| 339 | + if (!path_is_absolute($icon)) {
|
|
| 340 | + $icon = str_replace($uploads['baseurl'], $uploads['basedir'], $icon); |
|
| 341 | + } |
|
| 342 | 342 | |
| 343 | - if (!path_is_absolute($icon) && strpos($icon, WP_CONTENT_URL) !== false) {
|
|
| 344 | - $icon = str_replace(WP_CONTENT_URL, WP_CONTENT_DIR, $icon); |
|
| 345 | - } |
|
| 343 | + if (!path_is_absolute($icon) && strpos($icon, WP_CONTENT_URL) !== false) {
|
|
| 344 | + $icon = str_replace(WP_CONTENT_URL, WP_CONTENT_DIR, $icon); |
|
| 345 | + } |
|
| 346 | 346 | |
| 347 | - $sizes = array(); |
|
| 348 | - if (is_file($icon) && file_exists($icon)) {
|
|
| 349 | - $size = getimagesize(trim($icon)); |
|
| 347 | + $sizes = array(); |
|
| 348 | + if (is_file($icon) && file_exists($icon)) {
|
|
| 349 | + $size = getimagesize(trim($icon)); |
|
| 350 | 350 | |
| 351 | - if (!empty($size[0]) && !empty($size[1])) {
|
|
| 352 | - $sizes = array('w' => $size[0], 'h' => $size[1]);
|
|
| 353 | - } |
|
| 354 | - } |
|
| 351 | + if (!empty($size[0]) && !empty($size[1])) {
|
|
| 352 | + $sizes = array('w' => $size[0], 'h' => $size[1]);
|
|
| 353 | + } |
|
| 354 | + } |
|
| 355 | 355 | |
| 356 | - $sizes = !empty($sizes) ? $sizes : $default_size; |
|
| 356 | + $sizes = !empty($sizes) ? $sizes : $default_size; |
|
| 357 | 357 | |
| 358 | - $gd_marker_sizes[$icon_url] = $sizes; |
|
| 358 | + $gd_marker_sizes[$icon_url] = $sizes; |
|
| 359 | 359 | |
| 360 | - return $sizes; |
|
| 360 | + return $sizes; |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | add_action('wp_footer', 'geodir_map_load_script', 10);
|
@@ -369,8 +369,8 @@ discard block |
||
| 369 | 369 | * @package GeoDirectory |
| 370 | 370 | */ |
| 371 | 371 | function geodir_map_load_script() {
|
| 372 | - if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
|
|
| 373 | - $plugin_url = geodir_plugin_url(); |
|
| 372 | + if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
|
|
| 373 | + $plugin_url = geodir_plugin_url(); |
|
| 374 | 374 | ?> |
| 375 | 375 | <script type="text/javascript"> |
| 376 | 376 | if (!(window.google && typeof google.maps !== 'undefined')) {
|
@@ -384,5 +384,5 @@ discard block |
||
| 384 | 384 | } |
| 385 | 385 | </script> |
| 386 | 386 | <?php |
| 387 | - } |
|
| 387 | + } |
|
| 388 | 388 | } |
| 389 | 389 | \ No newline at end of file |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | if (!empty($post) && isset($post->ID) && $post->ID > 0 && (is_main_query() || $add_post_in_marker_array) && $post->marker_json != '') {
|
| 56 | 56 | |
| 57 | - if(isset($map_jason[$post->ID])){return null;}
|
|
| 57 | + if (isset($map_jason[$post->ID])) {return null; }
|
|
| 58 | 58 | |
| 59 | 59 | $srcharr = array("'", "/", "-", '"', '\\');
|
| 60 | 60 | $replarr = array("′", "⁄", "–", "“", '');
|
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $title = str_replace($srcharr, $replarr, $post_title); |
| 68 | 68 | |
| 69 | 69 | if (is_ssl()) {
|
| 70 | - $icon = str_replace("http:","https:",$icon );
|
|
| 70 | + $icon = str_replace("http:", "https:", $icon);
|
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | if ($icon != '') {
|
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $icon_size = array('w' => 36, 'h' => 45);
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - $post_json = '{"id":"' . $post->ID . '","t": "' . $title . '","lt": "' . $post->post_latitude . '","ln": "' . $post->post_longitude . '","mk_id":"' . $post->ID . '_' . $post->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"}';
|
|
| 86 | + $post_json = '{"id":"'.$post->ID.'","t": "'.$title.'","lt": "'.$post->post_latitude.'","ln": "'.$post->post_longitude.'","mk_id":"'.$post->ID.'_'.$post->default_category.'","i":"'.$icon.'","w":"'.$icon_size['w'].'","h":"'.$icon_size['h'].'"}';
|
|
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | 89 | * Filter the json data when creating output for post json marker.. |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * @param string $post_json JSON representation of the post marker info. |
| 93 | 93 | * @param object $post The post object. |
| 94 | 94 | */ |
| 95 | - $map_jason[$post->ID] = apply_filters('geodir_create_marker_jason_of_posts',$post_json, $post);
|
|
| 95 | + $map_jason[$post->ID] = apply_filters('geodir_create_marker_jason_of_posts', $post_json, $post);
|
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | if (is_array($map_jason) && !empty($map_jason)) {
|
| 114 | 114 | |
| 115 | 115 | // on details page only show the main marker on the map |
| 116 | - if(geodir_is_page('detail')){
|
|
| 116 | + if (geodir_is_page('detail')) {
|
|
| 117 | 117 | global $post; |
| 118 | - if(isset($map_jason[$post->ID])){
|
|
| 118 | + if (isset($map_jason[$post->ID])) {
|
|
| 119 | 119 | $map_jason = array($map_jason[$post->ID]); |
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | - $canvas_jason = $canvas . "_jason"; |
|
| 122 | + $canvas_jason = $canvas."_jason"; |
|
| 123 | 123 | $map_canvas_arr[$canvas] = array_unique($map_jason); |
| 124 | 124 | unset($cat_content_info); |
| 125 | 125 | $cat_content_info[] = implode(',', $map_canvas_arr[$canvas]);
|
@@ -127,11 +127,11 @@ discard block |
||
| 127 | 127 | if (!empty($cat_content_info)) {
|
| 128 | 128 | $json_content = substr(implode(',', $cat_content_info), 1);
|
| 129 | 129 | $json_content = htmlentities($json_content, ENT_QUOTES, get_option('blog_charset')); // Quotes in csv title import break maps - FIXED by kiran on 2nd March, 2016
|
| 130 | - $canvas_jason = '[{"totalcount":"' . $totalcount . '",' . $json_content . ']';
|
|
| 130 | + $canvas_jason = '[{"totalcount":"'.$totalcount.'",'.$json_content.']';
|
|
| 131 | 131 | } else {
|
| 132 | 132 | $canvas_jason = '[{"totalcount":"0"}]';
|
| 133 | 133 | } |
| 134 | - $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
|
| 134 | + $map_canvas_jason_args = array($canvas.'_jason' => $canvas_jason); |
|
| 135 | 135 | |
| 136 | 136 | /** |
| 137 | 137 | * Filter the send_marker_jason_to_js() function map canvas json args. |
@@ -143,12 +143,12 @@ discard block |
||
| 143 | 143 | * @param string $canvas Map canvas array key. |
| 144 | 144 | * @param array $map_canvas_jason_args Map canvas args. |
| 145 | 145 | */ |
| 146 | - $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
|
|
| 146 | + $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_'.$canvas, $map_canvas_jason_args);
|
|
| 147 | 147 | |
| 148 | - wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
|
|
| 148 | + wp_localize_script('geodir-map-widget', $canvas.'_jason_args', $map_canvas_jason_args);
|
|
| 149 | 149 | } else {
|
| 150 | 150 | $canvas_jason = '[{"totalcount":"0"}]';
|
| 151 | - $map_canvas_jason_args = array($canvas . '_jason' => $canvas_jason); |
|
| 151 | + $map_canvas_jason_args = array($canvas.'_jason' => $canvas_jason); |
|
| 152 | 152 | |
| 153 | 153 | /** |
| 154 | 154 | * Filter the send_marker_jason_to_js() function map canvas json args. |
@@ -160,8 +160,8 @@ discard block |
||
| 160 | 160 | * @param string $canvas Map canvas array key. |
| 161 | 161 | * @param array $map_canvas_jason_args Map canvas args. |
| 162 | 162 | */ |
| 163 | - $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_' . $canvas, $map_canvas_jason_args);
|
|
| 164 | - wp_localize_script('geodir-map-widget', $canvas . '_jason_args', $map_canvas_jason_args);
|
|
| 163 | + $map_canvas_jason_args = apply_filters('geodir_map_canvas_jason_'.$canvas, $map_canvas_jason_args);
|
|
| 164 | + wp_localize_script('geodir-map-widget', $canvas.'_jason_args', $map_canvas_jason_args);
|
|
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | |
@@ -223,11 +223,11 @@ discard block |
||
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | |
| 226 | - $out = '<ul class="treeview ' . $list_class . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
| 226 | + $out = '<ul class="treeview '.$list_class.'" style="margin-left:'.$p.'px;'.$display.';">'; |
|
| 227 | 227 | |
| 228 | 228 | $geodir_cat_icons = geodir_get_term_icon(); |
| 229 | 229 | |
| 230 | - $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') : 'gd_place';
|
|
| 230 | + $geodir_default_map_search_pt = (get_option('geodir_default_map_search_pt')) ? get_option('geodir_default_map_search_pt') : 'gd_place';
|
|
| 231 | 231 | $post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : $geodir_default_map_search_pt; |
| 232 | 232 | foreach ($cat_terms as $cat_term): |
| 233 | 233 | |
@@ -245,19 +245,19 @@ discard block |
||
| 245 | 245 | global $sitepress; |
| 246 | 246 | $default_lang = $sitepress->get_default_language(); |
| 247 | 247 | $term_id = icl_object_id($cat_term->term_id, $post_type.'category', true, $default_lang); |
| 248 | - }else{
|
|
| 248 | + } else {
|
|
| 249 | 249 | $term_id = $cat_term->term_id; |
| 250 | 250 | } |
| 251 | - if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
|
|
| 251 | + if (!empty($geodir_home_map_untick) && in_array($post_type.'_'.$term_id, $geodir_home_map_untick)) {
|
|
| 252 | 252 | $checked = ''; |
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - $term_check = '<input type="checkbox" ' . $checked . ' id="' .$map_canvas_name.'_tick_cat_'. $cat_term->term_id . '" class="group_selector ' . $main_list_class . '"'; |
|
| 257 | - $term_check .= ' name="' . $map_canvas_name . '_cat[]" '; |
|
| 258 | - $term_check .= ' title="' . esc_attr(ucfirst($cat_term->name)) . '" value="' . $cat_term->term_id . '" onclick="javascript:build_map_ajax_search_param(\'' . $map_canvas_name . '\',false, this)">'; |
|
| 259 | - $term_img = '<img height="15" width="15" alt="' . $cat_term->taxonomy . '" src="' . $icon . '" title="' . ucfirst($cat_term->name) . '"/>'; |
|
| 260 | - $out .= '<li>' . $term_check . '<label for="' . $map_canvas_name.'_tick_cat_'. $cat_term->term_id . '">' . $term_img . ucfirst($cat_term->name) . '</label><i class="fa fa-long-arrow-down"></i>'; |
|
| 256 | + $term_check = '<input type="checkbox" '.$checked.' id="'.$map_canvas_name.'_tick_cat_'.$cat_term->term_id.'" class="group_selector '.$main_list_class.'"'; |
|
| 257 | + $term_check .= ' name="'.$map_canvas_name.'_cat[]" '; |
|
| 258 | + $term_check .= ' title="'.esc_attr(ucfirst($cat_term->name)).'" value="'.$cat_term->term_id.'" onclick="javascript:build_map_ajax_search_param(\''.$map_canvas_name.'\',false, this)">'; |
|
| 259 | + $term_img = '<img height="15" width="15" alt="'.$cat_term->taxonomy.'" src="'.$icon.'" title="'.ucfirst($cat_term->name).'"/>'; |
|
| 260 | + $out .= '<li>'.$term_check.'<label for="'.$map_canvas_name.'_tick_cat_'.$cat_term->term_id.'">'.$term_img.ucfirst($cat_term->name).'</label><i class="fa fa-long-arrow-down"></i>'; |
|
| 261 | 261 | |
| 262 | 262 | endif; |
| 263 | 263 | |
@@ -369,18 +369,18 @@ discard block |
||
| 369 | 369 | * @package GeoDirectory |
| 370 | 370 | */ |
| 371 | 371 | function geodir_map_load_script() {
|
| 372 | - if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is( 'geodirectory-googlemap-script', 'done')) {
|
|
| 372 | + if (in_array(geodir_map_name(), array('auto', 'google')) && wp_script_is('geodirectory-googlemap-script', 'done')) {
|
|
| 373 | 373 | $plugin_url = geodir_plugin_url(); |
| 374 | 374 | ?> |
| 375 | 375 | <script type="text/javascript"> |
| 376 | 376 | if (!(window.google && typeof google.maps !== 'undefined')) {
|
| 377 | - var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-style-css");css.setAttribute("href","<?php echo $plugin_url;?>/geodirectory-assets/leaflet/leaflet.css?ver=<?php echo GEODIRECTORY_VERSION;?>");
|
|
| 377 | + var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-style-css");css.setAttribute("href","<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/leaflet.css?ver=<?php echo GEODIRECTORY_VERSION; ?>");
|
|
| 378 | 378 | document.getElementsByTagName("head")[0].appendChild(css);
|
| 379 | - var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-routing-style");css.setAttribute("href","<?php echo $plugin_url;?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css?ver=<?php echo GEODIRECTORY_VERSION;?>");
|
|
| 379 | + var css = document.createElement("link");css.setAttribute("rel","stylesheet");css.setAttribute("type","text/css");css.setAttribute("media","all");css.setAttribute("id","geodirectory-leaflet-routing-style");css.setAttribute("href","<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css?ver=<?php echo GEODIRECTORY_VERSION; ?>");
|
|
| 380 | 380 | document.getElementsByTagName("head")[0].appendChild(css);
|
| 381 | - document.write('<' + 'script id="geodirectory-leaflet-script" src="<?php echo $plugin_url;?>/geodirectory-assets/leaflet/leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
|
|
| 382 | - document.write('<' + 'script id="geodirectory-leaflet-geo-script" src="<?php echo $plugin_url;?>/geodirectory-assets/leaflet/osm.geocode.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
|
|
| 383 | - document.write('<' + 'script id="geodirectory-leaflet-routing-script" src="<?php echo $plugin_url;?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js?ver=<?php echo GEODIRECTORY_VERSION;?>" type="text/javascript"><' + '/script>');
|
|
| 381 | + document.write('<' + 'script id="geodirectory-leaflet-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/leaflet.min.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
|
|
| 382 | + document.write('<' + 'script id="geodirectory-leaflet-geo-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/osm.geocode.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
|
|
| 383 | + document.write('<' + 'script id="geodirectory-leaflet-routing-script" src="<?php echo $plugin_url; ?>/geodirectory-assets/leaflet/routing/leaflet-routing-machine.js?ver=<?php echo GEODIRECTORY_VERSION; ?>" type="text/javascript"><' + '/script>');
|
|
| 384 | 384 | } |
| 385 | 385 | </script> |
| 386 | 386 | <?php |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | global $sitepress; |
| 246 | 246 | $default_lang = $sitepress->get_default_language(); |
| 247 | 247 | $term_id = icl_object_id($cat_term->term_id, $post_type.'category', true, $default_lang); |
| 248 | - }else{
|
|
| 248 | + } else{
|
|
| 249 | 249 | $term_id = $cat_term->term_id; |
| 250 | 250 | } |
| 251 | 251 | if (!empty($geodir_home_map_untick) && in_array($post_type . '_' . $term_id, $geodir_home_map_untick)) {
|
@@ -273,8 +273,9 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | return $out; |
| 275 | 275 | } else {
|
| 276 | - if ($cat_parent == 0) |
|
| 277 | - return _e('No category', 'geodirectory');
|
|
| 276 | + if ($cat_parent == 0) { |
|
| 277 | + return _e('No category', 'geodirectory'); |
|
| 278 | + } |
|
| 278 | 279 | } |
| 279 | 280 | return; |
| 280 | 281 | } |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | $cf = (isset($cf_arr[$field_type_key])) ? $cf_arr[$field_type_key] : ''; |
| 40 | 40 | |
| 41 | 41 | |
| 42 | -if(isset($field_info->extra_fields)){$extra_fields = $field_info->extra_fields;}
|
|
| 42 | +if (isset($field_info->extra_fields)) {$extra_fields = $field_info->extra_fields; }
|
|
| 43 | 43 | $field_info = stripslashes_deep($field_info); // strip slashes from labels |
| 44 | -if(isset($field_info->extra_fields)){$field_info->extra_fields = $extra_fields;}
|
|
| 44 | +if (isset($field_info->extra_fields)) {$field_info->extra_fields = $extra_fields; }
|
|
| 45 | 45 | |
| 46 | 46 | |
| 47 | -$nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 47 | +$nonce = wp_create_nonce('custom_fields_'.$result_str);
|
|
| 48 | 48 | |
| 49 | 49 | $field_admin_title = ''; |
| 50 | 50 | if (isset($field_info->admin_title)) |
@@ -69,15 +69,15 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
|
| 71 | 71 | $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
| 72 | -}elseif(isset($cf['icon']) && $cf['icon']){
|
|
| 72 | +}elseif (isset($cf['icon']) && $cf['icon']) {
|
|
| 73 | 73 | $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
|
| 74 | -}else{
|
|
| 74 | +} else {
|
|
| 75 | 75 | $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | -if(isset($cf['name']) && $cf['name']){
|
|
| 78 | +if (isset($cf['name']) && $cf['name']) {
|
|
| 79 | 79 | $field_type_name = $cf['name']; |
| 80 | -}else{
|
|
| 80 | +} else {
|
|
| 81 | 81 | $field_type_name = $field_type; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
|
| 89 | 89 | <?php |
| 90 | 90 | |
| 91 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 91 | + $nonce = wp_create_nonce('custom_fields_'.$result_str);
|
|
| 92 | 92 | ?> |
| 93 | 93 | |
| 94 | 94 | <?php if ($default): ?> |
@@ -103,12 +103,12 @@ discard block |
||
| 103 | 103 | <i class="fa fa-long-arrow-left " aria-hidden="true"></i> |
| 104 | 104 | <i class="fa fa-long-arrow-right " aria-hidden="true"></i> |
| 105 | 105 | <b style="cursor:pointer;" |
| 106 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
|
|
| 106 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory').' '.$field_admin_title); ?></b>
|
|
| 107 | 107 | <?php |
| 108 | 108 | } else {echo $field_icon;
|
| 109 | 109 | ?> |
| 110 | 110 | <b style="cursor:pointer;" |
| 111 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b>
|
|
| 111 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(' '.$field_admin_title.' ('.$field_type_name.')'); ?></b>
|
|
| 112 | 112 | <?php |
| 113 | 113 | } |
| 114 | 114 | ?> |
@@ -131,43 +131,43 @@ discard block |
||
| 131 | 131 | } ?>"/> |
| 132 | 132 | <input type="hidden" name="is_active" id="is_active" value="1"/> |
| 133 | 133 | |
| 134 | - <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?> |
|
| 135 | - <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" /> |
|
| 136 | - <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" /> |
|
| 137 | - <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : '';?>" /> |
|
| 134 | + <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : ''; ?>" /><?php // show in sidebar value?> |
|
| 135 | + <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" /> |
|
| 136 | + <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" /> |
|
| 137 | + <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : ''; ?>" /> |
|
| 138 | 138 | |
| 139 | 139 | <ul class="widefat post fixed" border="0" style="width:100%;"> |
| 140 | 140 | |
| 141 | 141 | <?php |
| 142 | 142 | |
| 143 | 143 | // data_type |
| 144 | - if(has_filter("geodir_cfa_data_type_{$field_type}")){
|
|
| 144 | + if (has_filter("geodir_cfa_data_type_{$field_type}")) {
|
|
| 145 | 145 | |
| 146 | - echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 146 | + echo apply_filters("geodir_cfa_data_type_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 147 | 147 | |
| 148 | - }else{
|
|
| 148 | + } else {
|
|
| 149 | 149 | $value = ''; |
| 150 | 150 | if (isset($field_info->data_type)) {
|
| 151 | 151 | $value = esc_attr($field_info->data_type); |
| 152 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 152 | + }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) {
|
|
| 153 | 153 | $value = $cf['defaults']['data_type']; |
| 154 | 154 | } |
| 155 | 155 | ?> |
| 156 | - <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/> |
|
| 156 | + <input type="hidden" name="data_type" id="data_type" value="<?php echo $value; ?>"/> |
|
| 157 | 157 | <?php |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | |
| 161 | 161 | // admin_title |
| 162 | - if(has_filter("geodir_cfa_admin_title_{$field_type}")){
|
|
| 162 | + if (has_filter("geodir_cfa_admin_title_{$field_type}")) {
|
|
| 163 | 163 | |
| 164 | - echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 164 | + echo apply_filters("geodir_cfa_admin_title_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 165 | 165 | |
| 166 | - }else{
|
|
| 166 | + } else {
|
|
| 167 | 167 | $value = ''; |
| 168 | 168 | if (isset($field_info->admin_title)) {
|
| 169 | 169 | $value = esc_attr($field_info->admin_title); |
| 170 | - }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
|
|
| 170 | + }elseif (isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']) {
|
|
| 171 | 171 | $value = $cf['defaults']['admin_title']; |
| 172 | 172 | } |
| 173 | 173 | ?> |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | </label> |
| 181 | 181 | <div class="gd-cf-input-wrap"> |
| 182 | 182 | <input type="text" name="admin_title" id="admin_title" |
| 183 | - value="<?php echo $value;?>"/> |
|
| 183 | + value="<?php echo $value; ?>"/> |
|
| 184 | 184 | </div> |
| 185 | 185 | </li> |
| 186 | 186 | <?php |
@@ -188,15 +188,15 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | |
| 190 | 190 | // site_title |
| 191 | - if(has_filter("geodir_cfa_site_title_{$field_type}")){
|
|
| 191 | + if (has_filter("geodir_cfa_site_title_{$field_type}")) {
|
|
| 192 | 192 | |
| 193 | - echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 193 | + echo apply_filters("geodir_cfa_site_title_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 194 | 194 | |
| 195 | - }else{
|
|
| 195 | + } else {
|
|
| 196 | 196 | $value = ''; |
| 197 | 197 | if (isset($field_info->site_title)) {
|
| 198 | 198 | $value = esc_attr($field_info->site_title); |
| 199 | - }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
|
|
| 199 | + }elseif (isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']) {
|
|
| 200 | 200 | $value = $cf['defaults']['site_title']; |
| 201 | 201 | } |
| 202 | 202 | ?> |
@@ -216,15 +216,15 @@ discard block |
||
| 216 | 216 | |
| 217 | 217 | |
| 218 | 218 | // admin_desc |
| 219 | - if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
|
|
| 219 | + if (has_filter("geodir_cfa_admin_desc_{$field_type}")) {
|
|
| 220 | 220 | |
| 221 | - echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 221 | + echo apply_filters("geodir_cfa_admin_desc_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 222 | 222 | |
| 223 | - }else{
|
|
| 223 | + } else {
|
|
| 224 | 224 | $value = ''; |
| 225 | 225 | if (isset($field_info->admin_desc)) {
|
| 226 | 226 | $value = esc_attr($field_info->admin_desc); |
| 227 | - }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
|
|
| 227 | + }elseif (isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']) {
|
|
| 228 | 228 | $value = $cf['defaults']['admin_desc']; |
| 229 | 229 | } |
| 230 | 230 | ?> |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | </div> |
| 236 | 236 | </label> |
| 237 | 237 | <div class="gd-cf-input-wrap"> |
| 238 | - <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value;?>"/> |
|
| 238 | + <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value; ?>"/> |
|
| 239 | 239 | </div> |
| 240 | 240 | </li> |
| 241 | 241 | <?php |
@@ -244,26 +244,26 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | |
| 246 | 246 | // htmlvar_name |
| 247 | - if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
|
|
| 247 | + if (has_filter("geodir_cfa_htmlvar_name_{$field_type}")) {
|
|
| 248 | 248 | |
| 249 | - echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 249 | + echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 250 | 250 | |
| 251 | - }else{
|
|
| 251 | + } else {
|
|
| 252 | 252 | $value = ''; |
| 253 | 253 | if (isset($field_info->htmlvar_name)) {
|
| 254 | 254 | $value = esc_attr($field_info->htmlvar_name); |
| 255 | - }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
|
|
| 255 | + }elseif (isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']) {
|
|
| 256 | 256 | $value = $cf['defaults']['htmlvar_name']; |
| 257 | 257 | } |
| 258 | 258 | ?> |
| 259 | 259 | <li> |
| 260 | - <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?>
|
|
| 260 | + <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory'); ?>
|
|
| 261 | 261 | <div class="gdcf-tooltip"> |
| 262 | 262 | <?php _e('This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.', 'geodirectory'); ?>
|
| 263 | 263 | </div> |
| 264 | 264 | </label> |
| 265 | 265 | <div class="gd-cf-input-wrap"> |
| 266 | - <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>"
|
|
| 266 | + <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory'); ?>"
|
|
| 267 | 267 | value="<?php if ($value) {
|
| 268 | 268 | echo preg_replace('/geodir_/', '', $value, 1);
|
| 269 | 269 | }?>" <?php if ($default) {
|
@@ -276,15 +276,15 @@ discard block |
||
| 276 | 276 | |
| 277 | 277 | |
| 278 | 278 | // is_active |
| 279 | - if(has_filter("geodir_cfa_is_active_{$field_type}")){
|
|
| 279 | + if (has_filter("geodir_cfa_is_active_{$field_type}")) {
|
|
| 280 | 280 | |
| 281 | - echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 281 | + echo apply_filters("geodir_cfa_is_active_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 282 | 282 | |
| 283 | - }else{
|
|
| 283 | + } else {
|
|
| 284 | 284 | $value = ''; |
| 285 | 285 | if (isset($field_info->is_active)) {
|
| 286 | 286 | $value = esc_attr($field_info->is_active); |
| 287 | - }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
|
|
| 287 | + }elseif (isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']) {
|
|
| 288 | 288 | $value = $cf['defaults']['is_active']; |
| 289 | 289 | } |
| 290 | 290 | ?> |
@@ -296,17 +296,17 @@ discard block |
||
| 296 | 296 | </label> |
| 297 | 297 | <div class="gd-cf-input-wrap gd-switch"> |
| 298 | 298 | |
| 299 | - <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
|
| 299 | + <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled" value="1" |
|
| 300 | 300 | <?php if ($value == '1') {
|
| 301 | 301 | echo 'checked'; |
| 302 | 302 | } ?>/> |
| 303 | - <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 303 | + <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 304 | 304 | |
| 305 | - <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
|
| 305 | + <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0" |
|
| 306 | 306 | <?php if ($value == '0' || !$value) {
|
| 307 | 307 | echo 'checked'; |
| 308 | 308 | } ?>/> |
| 309 | - <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 309 | + <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 310 | 310 | |
| 311 | 311 | </div> |
| 312 | 312 | </li> |
@@ -315,15 +315,15 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | |
| 317 | 317 | // for_admin_use |
| 318 | - if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
|
|
| 318 | + if (has_filter("geodir_cfa_for_admin_use_{$field_type}")) {
|
|
| 319 | 319 | |
| 320 | - echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 320 | + echo apply_filters("geodir_cfa_for_admin_use_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 321 | 321 | |
| 322 | - }else{
|
|
| 322 | + } else {
|
|
| 323 | 323 | $value = ''; |
| 324 | 324 | if (isset($field_info->for_admin_use)) {
|
| 325 | 325 | $value = esc_attr($field_info->for_admin_use); |
| 326 | - }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
|
|
| 326 | + }elseif (isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']) {
|
|
| 327 | 327 | $value = $cf['defaults']['for_admin_use']; |
| 328 | 328 | } |
| 329 | 329 | ?> |
@@ -335,17 +335,17 @@ discard block |
||
| 335 | 335 | </label> |
| 336 | 336 | <div class="gd-cf-input-wrap gd-switch"> |
| 337 | 337 | |
| 338 | - <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled" value="1" |
|
| 338 | + <input type="radio" id="for_admin_use_yes<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-enabled" value="1" |
|
| 339 | 339 | <?php if ($value == '1') {
|
| 340 | 340 | echo 'checked'; |
| 341 | 341 | } ?>/> |
| 342 | - <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 342 | + <label for="for_admin_use_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 343 | 343 | |
| 344 | - <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0" |
|
| 344 | + <input type="radio" id="for_admin_use_no<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-disabled" value="0" |
|
| 345 | 345 | <?php if ($value == '0' || !$value) {
|
| 346 | 346 | echo 'checked'; |
| 347 | 347 | } ?>/> |
| 348 | - <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 348 | + <label for="for_admin_use_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 349 | 349 | |
| 350 | 350 | </div> |
| 351 | 351 | </li> |
@@ -354,20 +354,20 @@ discard block |
||
| 354 | 354 | |
| 355 | 355 | |
| 356 | 356 | // default_value |
| 357 | - if(has_filter("geodir_cfa_default_value_{$field_type}")){
|
|
| 357 | + if (has_filter("geodir_cfa_default_value_{$field_type}")) {
|
|
| 358 | 358 | |
| 359 | - echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 359 | + echo apply_filters("geodir_cfa_default_value_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 360 | 360 | |
| 361 | - }else{
|
|
| 361 | + } else {
|
|
| 362 | 362 | $value = ''; |
| 363 | 363 | if (isset($field_info->default_value)) {
|
| 364 | 364 | $value = esc_attr($field_info->default_value); |
| 365 | - }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
|
|
| 365 | + }elseif (isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']) {
|
|
| 366 | 366 | $value = $cf['defaults']['default_value']; |
| 367 | 367 | } |
| 368 | 368 | ?> |
| 369 | 369 | <li> |
| 370 | - <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
|
|
| 370 | + <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory'); ?>
|
|
| 371 | 371 | <div class="gdcf-tooltip"> |
| 372 | 372 | <?php |
| 373 | 373 | if ($field_type == 'checkbox') {
|
@@ -384,12 +384,12 @@ discard block |
||
| 384 | 384 | <?php if ($field_type == 'checkbox') { ?>
|
| 385 | 385 | <select name="default_value" id="default_value"> |
| 386 | 386 | <option value=""><?php _e('Unchecked', 'geodirectory'); ?></option>
|
| 387 | - <option value="1" <?php selected(true, (int)$value === 1);?>><?php _e('Checked', 'geodirectory'); ?></option>
|
|
| 387 | + <option value="1" <?php selected(true, (int) $value === 1); ?>><?php _e('Checked', 'geodirectory'); ?></option>
|
|
| 388 | 388 | </select> |
| 389 | 389 | <?php } else if ($field_type == 'email') { ?>
|
| 390 | - <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory') ;?>" id="default_value" value="<?php echo esc_attr($value);?>" /><br/>
|
|
| 390 | + <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory'); ?>" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/>
|
|
| 391 | 391 | <?php } else { ?>
|
| 392 | - <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value);?>" /><br/> |
|
| 392 | + <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/> |
|
| 393 | 393 | <?php } ?> |
| 394 | 394 | </div> |
| 395 | 395 | </li> |
@@ -398,15 +398,15 @@ discard block |
||
| 398 | 398 | |
| 399 | 399 | |
| 400 | 400 | // show_in |
| 401 | - if(has_filter("geodir_cfa_show_in_{$field_type}")){
|
|
| 401 | + if (has_filter("geodir_cfa_show_in_{$field_type}")) {
|
|
| 402 | 402 | |
| 403 | - echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 403 | + echo apply_filters("geodir_cfa_show_in_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 404 | 404 | |
| 405 | - }else{
|
|
| 405 | + } else {
|
|
| 406 | 406 | $value = ''; |
| 407 | 407 | if (isset($field_info->show_in)) {
|
| 408 | 408 | $value = esc_attr($field_info->show_in); |
| 409 | - }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
|
|
| 409 | + }elseif (isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']) {
|
|
| 410 | 410 | $value = esc_attr($cf['defaults']['show_in']); |
| 411 | 411 | } |
| 412 | 412 | ?> |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | * @param object $field_info The field being displayed info. |
| 440 | 440 | * @param string $field_info The type of field. |
| 441 | 441 | */ |
| 442 | - $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
|
|
| 442 | + $show_in_locations = apply_filters('geodir_show_in_locations', $show_in_locations, $field_info, $field_type);
|
|
| 443 | 443 | |
| 444 | 444 | |
| 445 | 445 | // remove some locations for some field types |
@@ -447,11 +447,11 @@ discard block |
||
| 447 | 447 | // don't show new tab option for some types |
| 448 | 448 | |
| 449 | 449 | if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
|
| 450 | - }else{
|
|
| 450 | + } else {
|
|
| 451 | 451 | unset($show_in_locations['[owntab]']); |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - if(!$display_on_listing){
|
|
| 454 | + if (!$display_on_listing) {
|
|
| 455 | 455 | unset($show_in_locations['[listings]']); |
| 456 | 456 | } |
| 457 | 457 | |
@@ -465,17 +465,17 @@ discard block |
||
| 465 | 465 | option-ajaxchosen="false"> |
| 466 | 466 | <?php |
| 467 | 467 | |
| 468 | - $show_in_values = explode(',',$value);
|
|
| 468 | + $show_in_values = explode(',', $value);
|
|
| 469 | 469 | |
| 470 | - foreach( $show_in_locations as $key => $val){
|
|
| 470 | + foreach ($show_in_locations as $key => $val) {
|
|
| 471 | 471 | $selected = ''; |
| 472 | 472 | |
| 473 | - if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
|
|
| 473 | + if (is_array($show_in_values) && in_array($key, $show_in_values)) {
|
|
| 474 | 474 | $selected = 'selected'; |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | ?> |
| 478 | - <option value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option> |
|
| 478 | + <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $val; ?></option> |
|
| 479 | 479 | <?php |
| 480 | 480 | } |
| 481 | 481 | ?> |
@@ -487,9 +487,9 @@ discard block |
||
| 487 | 487 | |
| 488 | 488 | |
| 489 | 489 | // advanced_editor |
| 490 | - if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
|
|
| 490 | + if (has_filter("geodir_cfa_advanced_editor_{$field_type}")) {
|
|
| 491 | 491 | |
| 492 | - echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 492 | + echo apply_filters("geodir_cfa_advanced_editor_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 493 | 493 | |
| 494 | 494 | } |
| 495 | 495 | |
@@ -500,10 +500,10 @@ discard block |
||
| 500 | 500 | |
| 501 | 501 | |
| 502 | 502 | <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?> |
| 503 | - <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels);} ?>"/>
|
|
| 503 | + <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels); } ?>"/>
|
|
| 504 | 504 | |
| 505 | 505 | <?php // we dont need to show the sort order ?> |
| 506 | - <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order);} ?>"/>
|
|
| 506 | + <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order); } ?>"/>
|
|
| 507 | 507 | |
| 508 | 508 | |
| 509 | 509 | |
@@ -556,15 +556,15 @@ discard block |
||
| 556 | 556 | <?php |
| 557 | 557 | |
| 558 | 558 | // is_required |
| 559 | - if(has_filter("geodir_cfa_is_required_{$field_type}")){
|
|
| 559 | + if (has_filter("geodir_cfa_is_required_{$field_type}")) {
|
|
| 560 | 560 | |
| 561 | - echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 561 | + echo apply_filters("geodir_cfa_is_required_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 562 | 562 | |
| 563 | - }else{
|
|
| 563 | + } else {
|
|
| 564 | 564 | $value = ''; |
| 565 | 565 | if (isset($field_info->is_required)) {
|
| 566 | 566 | $value = esc_attr($field_info->is_required); |
| 567 | - }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
|
|
| 567 | + }elseif (isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']) {
|
|
| 568 | 568 | $value = $cf['defaults']['is_required']; |
| 569 | 569 | } |
| 570 | 570 | ?> |
@@ -577,17 +577,17 @@ discard block |
||
| 577 | 577 | |
| 578 | 578 | <div class="gd-cf-input-wrap gd-switch"> |
| 579 | 579 | |
| 580 | - <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled" value="1" |
|
| 580 | + <input type="radio" id="is_required_yes<?php echo $radio_id; ?>" name="is_required" class="gdri-enabled" value="1" |
|
| 581 | 581 | <?php if ($value == '1') {
|
| 582 | 582 | echo 'checked'; |
| 583 | 583 | } ?>/> |
| 584 | - <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 584 | + <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 585 | 585 | |
| 586 | - <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0" |
|
| 586 | + <input type="radio" id="is_required_no<?php echo $radio_id; ?>" name="is_required" class="gdri-disabled" value="0" |
|
| 587 | 587 | <?php if ($value == '0' || !$value) {
|
| 588 | 588 | echo 'checked'; |
| 589 | 589 | } ?>/> |
| 590 | - <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 590 | + <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 591 | 591 | |
| 592 | 592 | </div> |
| 593 | 593 | |
@@ -597,19 +597,19 @@ discard block |
||
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | // required_msg |
| 600 | - if(has_filter("geodir_cfa_required_msg_{$field_type}")){
|
|
| 600 | + if (has_filter("geodir_cfa_required_msg_{$field_type}")) {
|
|
| 601 | 601 | |
| 602 | - echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 602 | + echo apply_filters("geodir_cfa_required_msg_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 603 | 603 | |
| 604 | - }else{
|
|
| 604 | + } else {
|
|
| 605 | 605 | $value = ''; |
| 606 | 606 | if (isset($field_info->required_msg)) {
|
| 607 | 607 | $value = esc_attr($field_info->required_msg); |
| 608 | - }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
|
|
| 608 | + }elseif (isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']) {
|
|
| 609 | 609 | $value = $cf['defaults']['required_msg']; |
| 610 | 610 | } |
| 611 | 611 | ?> |
| 612 | - <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>>
|
|
| 612 | + <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'"; }?>>
|
|
| 613 | 613 | <label for="required_msg" class="gd-cf-tooltip-wrap"> |
| 614 | 614 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
|
| 615 | 615 | <div class="gdcf-tooltip"> |
@@ -626,31 +626,31 @@ discard block |
||
| 626 | 626 | |
| 627 | 627 | |
| 628 | 628 | // required_msg |
| 629 | - if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
|
|
| 629 | + if (has_filter("geodir_cfa_validation_pattern_{$field_type}")) {
|
|
| 630 | 630 | |
| 631 | - echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 631 | + echo apply_filters("geodir_cfa_validation_pattern_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 632 | 632 | |
| 633 | 633 | } |
| 634 | 634 | |
| 635 | 635 | |
| 636 | 636 | // extra_fields |
| 637 | - if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
|
|
| 637 | + if (has_filter("geodir_cfa_extra_fields_{$field_type}")) {
|
|
| 638 | 638 | |
| 639 | - echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 639 | + echo apply_filters("geodir_cfa_extra_fields_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 640 | 640 | |
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | |
| 644 | 644 | // field_icon |
| 645 | - if(has_filter("geodir_cfa_field_icon_{$field_type}")){
|
|
| 645 | + if (has_filter("geodir_cfa_field_icon_{$field_type}")) {
|
|
| 646 | 646 | |
| 647 | - echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 647 | + echo apply_filters("geodir_cfa_field_icon_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 648 | 648 | |
| 649 | - }else{
|
|
| 649 | + } else {
|
|
| 650 | 650 | $value = ''; |
| 651 | 651 | if (isset($field_info->field_icon)) {
|
| 652 | 652 | $value = esc_attr($field_info->field_icon); |
| 653 | - }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
|
|
| 653 | + }elseif (isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']) {
|
|
| 654 | 654 | $value = $cf['defaults']['field_icon']; |
| 655 | 655 | } |
| 656 | 656 | ?> |
@@ -661,12 +661,12 @@ discard block |
||
| 661 | 661 | <label for="field_icon" class="gd-cf-tooltip-wrap"> |
| 662 | 662 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Upload icon :', 'geodirectory'); ?>
|
| 663 | 663 | <div class="gdcf-tooltip"> |
| 664 | - <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory');?>
|
|
| 664 | + <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory'); ?>
|
|
| 665 | 665 | </div> |
| 666 | 666 | </label> |
| 667 | 667 | <div class="gd-cf-input-wrap"> |
| 668 | 668 | <input type="text" name="field_icon" id="field_icon" |
| 669 | - value="<?php echo $value;?>"/> |
|
| 669 | + value="<?php echo $value; ?>"/> |
|
| 670 | 670 | </div> |
| 671 | 671 | |
| 672 | 672 | </li> |
@@ -675,15 +675,15 @@ discard block |
||
| 675 | 675 | |
| 676 | 676 | |
| 677 | 677 | // css_class |
| 678 | - if(has_filter("geodir_cfa_css_class_{$field_type}")){
|
|
| 678 | + if (has_filter("geodir_cfa_css_class_{$field_type}")) {
|
|
| 679 | 679 | |
| 680 | - echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 680 | + echo apply_filters("geodir_cfa_css_class_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 681 | 681 | |
| 682 | - }else{
|
|
| 682 | + } else {
|
|
| 683 | 683 | $value = ''; |
| 684 | 684 | if (isset($field_info->css_class)) {
|
| 685 | 685 | $value = esc_attr($field_info->css_class); |
| 686 | - }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
|
|
| 686 | + }elseif (isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']) {
|
|
| 687 | 687 | $value = $cf['defaults']['css_class']; |
| 688 | 688 | } |
| 689 | 689 | ?> |
@@ -692,8 +692,8 @@ discard block |
||
| 692 | 692 | <label for="css_class" class="gd-cf-tooltip-wrap"> |
| 693 | 693 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Css class :', 'geodirectory'); ?>
|
| 694 | 694 | <div class="gdcf-tooltip"> |
| 695 | - <?php _e('Enter custom css class for field custom style.', 'geodirectory');?>
|
|
| 696 | - <?php if($field_type=='multiselect'){_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory');}?>
|
|
| 695 | + <?php _e('Enter custom css class for field custom style.', 'geodirectory'); ?>
|
|
| 696 | + <?php if ($field_type == 'multiselect') {_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory'); }?>
|
|
| 697 | 697 | </div> |
| 698 | 698 | </label> |
| 699 | 699 | <div class="gd-cf-input-wrap"> |
@@ -708,23 +708,23 @@ discard block |
||
| 708 | 708 | |
| 709 | 709 | |
| 710 | 710 | // cat_sort |
| 711 | - if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
|
|
| 711 | + if (has_filter("geodir_cfa_cat_sort_{$field_type}")) {
|
|
| 712 | 712 | |
| 713 | - echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 713 | + echo apply_filters("geodir_cfa_cat_sort_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 714 | 714 | |
| 715 | - }else{
|
|
| 715 | + } else {
|
|
| 716 | 716 | $value = ''; |
| 717 | - $hide_cat_sort =''; |
|
| 717 | + $hide_cat_sort = ''; |
|
| 718 | 718 | if (isset($field_info->cat_sort)) {
|
| 719 | 719 | $value = esc_attr($field_info->cat_sort); |
| 720 | - }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
|
|
| 720 | + }elseif (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']) {
|
|
| 721 | 721 | $value = $cf['defaults']['cat_sort']; |
| 722 | - $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
|
| 722 | + $hide_cat_sort = ($value === false) ? "style='display:none;'" : ''; |
|
| 723 | 723 | } |
| 724 | 724 | |
| 725 | - $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : ''; |
|
| 725 | + $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort'] === false) ? "style='display:none;'" : ''; |
|
| 726 | 726 | ?> |
| 727 | - <li <?php echo $hide_cat_sort ;?>> |
|
| 727 | + <li <?php echo $hide_cat_sort; ?>> |
|
| 728 | 728 | <h3><?php |
| 729 | 729 | /** |
| 730 | 730 | * Filter the section title. |
@@ -743,23 +743,23 @@ discard block |
||
| 743 | 743 | <label for="cat_sort" class="gd-cf-tooltip-wrap"> |
| 744 | 744 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
|
| 745 | 745 | <div class="gdcf-tooltip"> |
| 746 | - <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory');?>
|
|
| 746 | + <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory'); ?>
|
|
| 747 | 747 | </div> |
| 748 | 748 | </label> |
| 749 | 749 | |
| 750 | 750 | <div class="gd-cf-input-wrap gd-switch"> |
| 751 | 751 | |
| 752 | - <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled" value="1" |
|
| 752 | + <input type="radio" id="cat_sort_yes<?php echo $radio_id; ?>" name="cat_sort" class="gdri-enabled" value="1" |
|
| 753 | 753 | <?php if ($value == '1') {
|
| 754 | 754 | echo 'checked'; |
| 755 | 755 | } ?>/> |
| 756 | - <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 756 | + <label for="cat_sort_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 757 | 757 | |
| 758 | - <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0" |
|
| 758 | + <input type="radio" id="cat_sort_no<?php echo $radio_id; ?>" name="cat_sort" class="gdri-disabled" value="0" |
|
| 759 | 759 | <?php if (!$value) {
|
| 760 | 760 | echo 'checked'; |
| 761 | 761 | } ?>/> |
| 762 | - <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 762 | + <label for="cat_sort_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 763 | 763 | |
| 764 | 764 | </div> |
| 765 | 765 | </li> |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | * @param object $field_info The current fields info. |
| 787 | 787 | * @param array $cf The custom field settings |
| 788 | 788 | */ |
| 789 | - do_action('geodir_advance_custom_fields', $field_info,$cf);?>
|
|
| 789 | + do_action('geodir_advance_custom_fields', $field_info, $cf); ?>
|
|
| 790 | 790 | |
| 791 | 791 | |
| 792 | 792 | <?php endswitch; ?> |
@@ -798,10 +798,10 @@ discard block |
||
| 798 | 798 | <h3></h3> |
| 799 | 799 | </label> |
| 800 | 800 | <div class="gd-cf-input-wrap"> |
| 801 | - <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
|
|
| 801 | + <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
|
|
| 802 | 802 | onclick="save_field('<?php echo esc_attr($result_str); ?>')"/>
|
| 803 | 803 | <?php if (!$default): ?> |
| 804 | - <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
|
|
| 804 | + <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
|
|
| 805 | 805 | onclick="delete_field('<?php echo esc_attr($result_str); ?>', '<?php echo $nonce; ?>')"
|
| 806 | 806 | class="button"/></a> |
| 807 | 807 | <?php endif; ?> |
@@ -19,18 +19,18 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | function geodir_locate_template($template = '') |
| 21 | 21 | {
|
| 22 | - global $post_type, $wp, $post; |
|
| 23 | - $fields = array(); |
|
| 22 | + global $post_type, $wp, $post; |
|
| 23 | + $fields = array(); |
|
| 24 | 24 | |
| 25 | - switch ($template): |
|
| 26 | - case 'signup': |
|
| 27 | - return $template = locate_template(array("geodirectory/geodir-signup.php"));
|
|
| 28 | - break; |
|
| 29 | - case 'add-listing': |
|
| 25 | + switch ($template): |
|
| 26 | + case 'signup': |
|
| 27 | + return $template = locate_template(array("geodirectory/geodir-signup.php"));
|
|
| 28 | + break; |
|
| 29 | + case 'add-listing': |
|
| 30 | 30 | |
| 31 | - $sc_post_type = ''; |
|
| 31 | + $sc_post_type = ''; |
|
| 32 | 32 | if (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
|
| 33 | - $listing_page_id = $post->ID; |
|
| 33 | + $listing_page_id = $post->ID; |
|
| 34 | 34 | |
| 35 | 35 | $regex_pattern = get_shortcode_regex(); |
| 36 | 36 | preg_match('/'.$regex_pattern.'/s', $post->post_content, $regex_matches);
|
@@ -39,100 +39,100 @@ discard block |
||
| 39 | 39 | $shortcode_atts = shortcode_parse_atts($regex_matches[3]); |
| 40 | 40 | $sc_post_type = !empty($shortcode_atts) && isset($shortcode_atts['listing_type']) && !empty($shortcode_atts['listing_type']) ? $shortcode_atts['listing_type'] : ''; |
| 41 | 41 | } |
| 42 | - } else {
|
|
| 43 | - $listing_page_id = geodir_add_listing_page_id(); |
|
| 44 | - } |
|
| 42 | + } else {
|
|
| 43 | + $listing_page_id = geodir_add_listing_page_id(); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | 46 | $is_wpml = function_exists('icl_object_id') ? true : false;
|
| 47 | 47 | |
| 48 | - if ($listing_page_id != '' && (is_page($listing_page_id) || ($is_wpml && !empty($wp->query_vars['page_id']))) && isset($_REQUEST['listing_type']) |
|
| 49 | - && in_array($_REQUEST['listing_type'], geodir_get_posttypes()) |
|
| 50 | - ) |
|
| 51 | - $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 52 | - if (empty($post_type) && !isset($_REQUEST['pid'])) {
|
|
| 53 | - $pagename = $wp->query_vars['pagename']; |
|
| 54 | - $post_types = geodir_get_posttypes(); |
|
| 55 | - if (!empty($post_types)) |
|
| 56 | - $post_type = $post_types[0]; |
|
| 48 | + if ($listing_page_id != '' && (is_page($listing_page_id) || ($is_wpml && !empty($wp->query_vars['page_id']))) && isset($_REQUEST['listing_type']) |
|
| 49 | + && in_array($_REQUEST['listing_type'], geodir_get_posttypes()) |
|
| 50 | + ) |
|
| 51 | + $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 52 | + if (empty($post_type) && !isset($_REQUEST['pid'])) {
|
|
| 53 | + $pagename = $wp->query_vars['pagename']; |
|
| 54 | + $post_types = geodir_get_posttypes(); |
|
| 55 | + if (!empty($post_types)) |
|
| 56 | + $post_type = $post_types[0]; |
|
| 57 | 57 | |
| 58 | 58 | if($sc_post_type != '' ) |
| 59 | 59 | $post_type = $sc_post_type; |
| 60 | 60 | |
| 61 | - if ($is_wpml && !empty($wp->query_vars['page_id'])) {
|
|
| 61 | + if ($is_wpml && !empty($wp->query_vars['page_id'])) {
|
|
| 62 | 62 | wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
|
| 63 | 63 | } else {
|
| 64 | 64 | wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type); |
| 65 | 65 | } |
| 66 | - gd_die(); |
|
| 67 | - } |
|
| 68 | - return $template = locate_template(array("geodirectory/add-{$post_type}.php", "geodirectory/add-listing.php"));
|
|
| 69 | - break; |
|
| 70 | - case 'success': |
|
| 71 | - $success_page_id = geodir_success_page_id(); |
|
| 72 | - if ($success_page_id != '' && is_page($success_page_id) && isset($_REQUEST['listing_type']) |
|
| 73 | - && in_array($_REQUEST['listing_type'], geodir_get_posttypes()) |
|
| 74 | - ) |
|
| 75 | - $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 76 | - return $template = locate_template(array("geodirectory/{$post_type}-success.php", "geodirectory/listing-success.php"));
|
|
| 77 | - break; |
|
| 78 | - case 'detail': |
|
| 79 | - case 'preview': |
|
| 80 | - if (in_array(get_post_type(), geodir_get_posttypes())) |
|
| 81 | - $post_type = get_post_type(); |
|
| 82 | - return $template = locate_template(array("geodirectory/single-{$post_type}.php", "geodirectory/listing-detail.php"));
|
|
| 83 | - break; |
|
| 84 | - case 'listing': |
|
| 85 | - $templates = array(); |
|
| 86 | - if (is_post_type_archive() && in_array(get_post_type(), geodir_get_posttypes())) {
|
|
| 87 | - $post_type = get_post_type(); |
|
| 88 | - $templates[] = "geodirectory/archive-$post_type.php"; |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - |
|
| 92 | - if (is_tax() && geodir_get_taxonomy_posttype()) {
|
|
| 93 | - $query_obj = get_queried_object(); |
|
| 94 | - $curr_taxonomy = isset($query_obj->taxonomy) ? $query_obj->taxonomy : ''; |
|
| 95 | - $curr_term = isset($query_obj->slug) ? $query_obj->slug : ''; |
|
| 96 | - $templates[] = "geodirectory/taxonomy-$curr_taxonomy-$curr_term.php"; |
|
| 97 | - $templates[] = "geodirectory/taxonomy-$curr_taxonomy.php"; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - $templates[] = "geodirectory/geodir-listing.php"; |
|
| 101 | - |
|
| 102 | - return $template = locate_template($templates); |
|
| 103 | - break; |
|
| 104 | - case 'information': |
|
| 105 | - return $template = locate_template(array("geodirectory/geodir-information.php"));
|
|
| 106 | - break; |
|
| 107 | - case 'author': |
|
| 108 | - return $template = locate_template(array("geodirectory/geodir-author.php"));
|
|
| 109 | - break; |
|
| 110 | - case 'search': |
|
| 111 | - return $template = locate_template(array("geodirectory/geodir-search.php"));
|
|
| 112 | - break; |
|
| 113 | - case 'location': |
|
| 114 | - return $template = locate_template(array("geodirectory/geodir-location.php"));
|
|
| 115 | - break; |
|
| 116 | - case 'geodir-home': |
|
| 117 | - return $template = locate_template(array("geodirectory/geodir-home.php"));
|
|
| 118 | - break; |
|
| 119 | - case 'listing-listview': |
|
| 120 | - $template = locate_template(array("geodirectory/listing-listview.php"));
|
|
| 121 | - if (!$template) {
|
|
| 122 | - $template = geodir_plugin_path() . '/geodirectory-templates/listing-listview.php'; |
|
| 123 | - } |
|
| 124 | - return $template; |
|
| 125 | - break; |
|
| 126 | - case 'widget-listing-listview': |
|
| 127 | - $template = locate_template(array("geodirectory/widget-listing-listview.php"));
|
|
| 128 | - if (!$template) {
|
|
| 129 | - $template = geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php'; |
|
| 130 | - } |
|
| 131 | - return $template; |
|
| 132 | - break; |
|
| 133 | - endswitch; |
|
| 134 | - |
|
| 135 | - return false; |
|
| 66 | + gd_die(); |
|
| 67 | + } |
|
| 68 | + return $template = locate_template(array("geodirectory/add-{$post_type}.php", "geodirectory/add-listing.php"));
|
|
| 69 | + break; |
|
| 70 | + case 'success': |
|
| 71 | + $success_page_id = geodir_success_page_id(); |
|
| 72 | + if ($success_page_id != '' && is_page($success_page_id) && isset($_REQUEST['listing_type']) |
|
| 73 | + && in_array($_REQUEST['listing_type'], geodir_get_posttypes()) |
|
| 74 | + ) |
|
| 75 | + $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 76 | + return $template = locate_template(array("geodirectory/{$post_type}-success.php", "geodirectory/listing-success.php"));
|
|
| 77 | + break; |
|
| 78 | + case 'detail': |
|
| 79 | + case 'preview': |
|
| 80 | + if (in_array(get_post_type(), geodir_get_posttypes())) |
|
| 81 | + $post_type = get_post_type(); |
|
| 82 | + return $template = locate_template(array("geodirectory/single-{$post_type}.php", "geodirectory/listing-detail.php"));
|
|
| 83 | + break; |
|
| 84 | + case 'listing': |
|
| 85 | + $templates = array(); |
|
| 86 | + if (is_post_type_archive() && in_array(get_post_type(), geodir_get_posttypes())) {
|
|
| 87 | + $post_type = get_post_type(); |
|
| 88 | + $templates[] = "geodirectory/archive-$post_type.php"; |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + |
|
| 92 | + if (is_tax() && geodir_get_taxonomy_posttype()) {
|
|
| 93 | + $query_obj = get_queried_object(); |
|
| 94 | + $curr_taxonomy = isset($query_obj->taxonomy) ? $query_obj->taxonomy : ''; |
|
| 95 | + $curr_term = isset($query_obj->slug) ? $query_obj->slug : ''; |
|
| 96 | + $templates[] = "geodirectory/taxonomy-$curr_taxonomy-$curr_term.php"; |
|
| 97 | + $templates[] = "geodirectory/taxonomy-$curr_taxonomy.php"; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + $templates[] = "geodirectory/geodir-listing.php"; |
|
| 101 | + |
|
| 102 | + return $template = locate_template($templates); |
|
| 103 | + break; |
|
| 104 | + case 'information': |
|
| 105 | + return $template = locate_template(array("geodirectory/geodir-information.php"));
|
|
| 106 | + break; |
|
| 107 | + case 'author': |
|
| 108 | + return $template = locate_template(array("geodirectory/geodir-author.php"));
|
|
| 109 | + break; |
|
| 110 | + case 'search': |
|
| 111 | + return $template = locate_template(array("geodirectory/geodir-search.php"));
|
|
| 112 | + break; |
|
| 113 | + case 'location': |
|
| 114 | + return $template = locate_template(array("geodirectory/geodir-location.php"));
|
|
| 115 | + break; |
|
| 116 | + case 'geodir-home': |
|
| 117 | + return $template = locate_template(array("geodirectory/geodir-home.php"));
|
|
| 118 | + break; |
|
| 119 | + case 'listing-listview': |
|
| 120 | + $template = locate_template(array("geodirectory/listing-listview.php"));
|
|
| 121 | + if (!$template) {
|
|
| 122 | + $template = geodir_plugin_path() . '/geodirectory-templates/listing-listview.php'; |
|
| 123 | + } |
|
| 124 | + return $template; |
|
| 125 | + break; |
|
| 126 | + case 'widget-listing-listview': |
|
| 127 | + $template = locate_template(array("geodirectory/widget-listing-listview.php"));
|
|
| 128 | + if (!$template) {
|
|
| 129 | + $template = geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php'; |
|
| 130 | + } |
|
| 131 | + return $template; |
|
| 132 | + break; |
|
| 133 | + endswitch; |
|
| 134 | + |
|
| 135 | + return false; |
|
| 136 | 136 | |
| 137 | 137 | } |
| 138 | 138 | |
@@ -151,238 +151,238 @@ discard block |
||
| 151 | 151 | function geodir_template_loader($template) |
| 152 | 152 | {
|
| 153 | 153 | |
| 154 | - global $wp_query; |
|
| 155 | - |
|
| 156 | - /** |
|
| 157 | - * Filter the custom page list. |
|
| 158 | - * |
|
| 159 | - * @since 1.0.0 |
|
| 160 | - */ |
|
| 161 | - $geodir_custom_page_list = apply_filters('geodir_set_custom_pages', array(
|
|
| 162 | - 'geodir_signup_page' => |
|
| 163 | - apply_filters('geodir_set_custom_signup_page', false),
|
|
| 164 | - 'geodir_add_listing_page' => |
|
| 165 | - apply_filters('geodir_set_custom_add_listing_page', false),
|
|
| 166 | - 'geodir_preview_page' => |
|
| 167 | - apply_filters('geodir_set_custom_preview_page', false),
|
|
| 168 | - 'geodir_listing_success_page' => |
|
| 169 | - apply_filters('geodir_set_custom_listing_success_page', false),
|
|
| 170 | - 'geodir_listing_detail_page' => |
|
| 171 | - apply_filters('geodir_set_custom_listing_detail_page', false),
|
|
| 172 | - 'geodir_listing_page' => |
|
| 173 | - apply_filters('geodir_set_custom_listing_page', false),
|
|
| 174 | - 'geodir_search_page' => |
|
| 175 | - apply_filters('geodir_set_custom_search_page', false),
|
|
| 176 | - 'geodir_author_page' => |
|
| 177 | - apply_filters('geodir_set_custom_author_page', false),
|
|
| 178 | - 'geodir_home_map_page' => |
|
| 179 | - apply_filters('geodir_set_custom_home_map_page', false)
|
|
| 180 | - )); |
|
| 181 | - |
|
| 182 | - |
|
| 183 | - if (geodir_is_page('login') || $geodir_custom_page_list['geodir_signup_page']) {
|
|
| 184 | - |
|
| 185 | - $template = geodir_locate_template('signup');
|
|
| 186 | - |
|
| 187 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php'; |
|
| 188 | - |
|
| 189 | - /** |
|
| 190 | - * Filter the signup template path. |
|
| 191 | - * |
|
| 192 | - * @since 1.0.0 |
|
| 193 | - * @param string $template The template path. |
|
| 194 | - */ |
|
| 195 | - return $template = apply_filters('geodir_template_signup', $template);
|
|
| 196 | - } |
|
| 197 | - |
|
| 198 | - if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) {
|
|
| 199 | - if (!geodir_is_default_location_set()) {
|
|
| 200 | - global $information; |
|
| 201 | - $information = 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>');
|
|
| 202 | - |
|
| 203 | - $template = geodir_locate_template('information');
|
|
| 204 | - |
|
| 205 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php'; |
|
| 206 | - /** |
|
| 207 | - * Filter the information template path. |
|
| 208 | - * |
|
| 209 | - * @since 1.0.0 |
|
| 210 | - * @param string $template The template path. |
|
| 211 | - */ |
|
| 212 | - return $template = apply_filters('geodir_template_information', $template);
|
|
| 213 | - } |
|
| 214 | - // check if pid exists in the record if yes then check if this post belongs to the user who is logged in. |
|
| 215 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 216 | - global $information; |
|
| 217 | - $information = __('This listing does not belong to your account, please check the listing id carefully.', 'geodirectory');
|
|
| 218 | - $is_current_user_owner = geodir_listing_belong_to_current_user(); |
|
| 219 | - if (!$is_current_user_owner) {
|
|
| 220 | - $template = geodir_locate_template('information');
|
|
| 221 | - |
|
| 222 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php'; |
|
| 223 | - /** |
|
| 224 | - * Filter the information template path. |
|
| 225 | - * |
|
| 226 | - * @since 1.0.0 |
|
| 227 | - * @param string $template The template path. |
|
| 228 | - */ |
|
| 229 | - return $template = apply_filters('geodir_template_information', $template);
|
|
| 230 | - } |
|
| 231 | - |
|
| 232 | - |
|
| 233 | - } |
|
| 234 | - |
|
| 235 | - //geodir_is_login(true); |
|
| 236 | - global $current_user; |
|
| 237 | - if (!$current_user->ID) {
|
|
| 238 | - wp_redirect(geodir_login_url(array('redirect_add_listing'=>urlencode(geodir_curPageURL()))), 302);
|
|
| 239 | - exit; |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - $template = geodir_locate_template('add-listing');
|
|
| 243 | - |
|
| 244 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php'; |
|
| 245 | - /** |
|
| 246 | - * Filter the add listing template path. |
|
| 247 | - * |
|
| 248 | - * @since 1.0.0 |
|
| 249 | - * @param string $template The template path. |
|
| 250 | - */ |
|
| 251 | - return $template = apply_filters('geodir_template_add_listing', $template);
|
|
| 252 | - } |
|
| 253 | - |
|
| 254 | - |
|
| 255 | - if (geodir_is_page('preview') || $geodir_custom_page_list['geodir_preview_page']) {
|
|
| 256 | - global $preview; |
|
| 257 | - $preview = true; |
|
| 258 | - |
|
| 259 | - $template = geodir_locate_template('preview');
|
|
| 260 | - |
|
| 261 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php'; |
|
| 262 | - /** |
|
| 263 | - * Filter the preview template path. |
|
| 264 | - * |
|
| 265 | - * @since 1.0.0 |
|
| 266 | - * @param string $template The template path. |
|
| 267 | - */ |
|
| 268 | - return $template = apply_filters('geodir_template_preview', $template);
|
|
| 269 | - |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - |
|
| 273 | - if (geodir_is_page('listing-success') || $geodir_custom_page_list['geodir_listing_success_page']) {
|
|
| 274 | - |
|
| 275 | - $template = geodir_locate_template('success');
|
|
| 276 | - |
|
| 277 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php'; |
|
| 278 | - /** |
|
| 279 | - * Filter the success template path. |
|
| 280 | - * |
|
| 281 | - * @since 1.0.0 |
|
| 282 | - * @param string $template The template path. |
|
| 283 | - */ |
|
| 284 | - return $template = apply_filters('geodir_template_success', $template);
|
|
| 285 | - |
|
| 286 | - } |
|
| 287 | - |
|
| 288 | - if (geodir_is_page('detail') || $geodir_custom_page_list['geodir_listing_detail_page']) {
|
|
| 289 | - |
|
| 290 | - $template = geodir_locate_template('detail');
|
|
| 291 | - |
|
| 292 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php'; |
|
| 293 | - /** |
|
| 294 | - * Filter the detail template path. |
|
| 295 | - * |
|
| 296 | - * @since 1.0.0 |
|
| 297 | - * @param string $template The template path. |
|
| 298 | - */ |
|
| 299 | - return $template = apply_filters('geodir_template_detail', $template);
|
|
| 300 | - |
|
| 301 | - } |
|
| 302 | - |
|
| 303 | - if (geodir_is_page('listing') || $geodir_custom_page_list['geodir_listing_page']) {
|
|
| 304 | - |
|
| 305 | - $template = geodir_locate_template('listing');
|
|
| 306 | - |
|
| 307 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php'; |
|
| 308 | - /** |
|
| 309 | - * Filter the listing template path. |
|
| 310 | - * |
|
| 311 | - * @since 1.0.0 |
|
| 312 | - * @param string $template The template path. |
|
| 313 | - */ |
|
| 314 | - return $template = apply_filters('geodir_template_listing', $template);
|
|
| 154 | + global $wp_query; |
|
| 315 | 155 | |
| 316 | - } |
|
| 156 | + /** |
|
| 157 | + * Filter the custom page list. |
|
| 158 | + * |
|
| 159 | + * @since 1.0.0 |
|
| 160 | + */ |
|
| 161 | + $geodir_custom_page_list = apply_filters('geodir_set_custom_pages', array(
|
|
| 162 | + 'geodir_signup_page' => |
|
| 163 | + apply_filters('geodir_set_custom_signup_page', false),
|
|
| 164 | + 'geodir_add_listing_page' => |
|
| 165 | + apply_filters('geodir_set_custom_add_listing_page', false),
|
|
| 166 | + 'geodir_preview_page' => |
|
| 167 | + apply_filters('geodir_set_custom_preview_page', false),
|
|
| 168 | + 'geodir_listing_success_page' => |
|
| 169 | + apply_filters('geodir_set_custom_listing_success_page', false),
|
|
| 170 | + 'geodir_listing_detail_page' => |
|
| 171 | + apply_filters('geodir_set_custom_listing_detail_page', false),
|
|
| 172 | + 'geodir_listing_page' => |
|
| 173 | + apply_filters('geodir_set_custom_listing_page', false),
|
|
| 174 | + 'geodir_search_page' => |
|
| 175 | + apply_filters('geodir_set_custom_search_page', false),
|
|
| 176 | + 'geodir_author_page' => |
|
| 177 | + apply_filters('geodir_set_custom_author_page', false),
|
|
| 178 | + 'geodir_home_map_page' => |
|
| 179 | + apply_filters('geodir_set_custom_home_map_page', false)
|
|
| 180 | + )); |
|
| 181 | + |
|
| 182 | + |
|
| 183 | + if (geodir_is_page('login') || $geodir_custom_page_list['geodir_signup_page']) {
|
|
| 184 | + |
|
| 185 | + $template = geodir_locate_template('signup');
|
|
| 186 | + |
|
| 187 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php'; |
|
| 188 | + |
|
| 189 | + /** |
|
| 190 | + * Filter the signup template path. |
|
| 191 | + * |
|
| 192 | + * @since 1.0.0 |
|
| 193 | + * @param string $template The template path. |
|
| 194 | + */ |
|
| 195 | + return $template = apply_filters('geodir_template_signup', $template);
|
|
| 196 | + } |
|
| 317 | 197 | |
| 318 | - if (geodir_is_page('search') || $geodir_custom_page_list['geodir_search_page']) {
|
|
| 198 | + if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) {
|
|
| 199 | + if (!geodir_is_default_location_set()) {
|
|
| 200 | + global $information; |
|
| 201 | + $information = 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>');
|
|
| 202 | + |
|
| 203 | + $template = geodir_locate_template('information');
|
|
| 204 | + |
|
| 205 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php'; |
|
| 206 | + /** |
|
| 207 | + * Filter the information template path. |
|
| 208 | + * |
|
| 209 | + * @since 1.0.0 |
|
| 210 | + * @param string $template The template path. |
|
| 211 | + */ |
|
| 212 | + return $template = apply_filters('geodir_template_information', $template);
|
|
| 213 | + } |
|
| 214 | + // check if pid exists in the record if yes then check if this post belongs to the user who is logged in. |
|
| 215 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 216 | + global $information; |
|
| 217 | + $information = __('This listing does not belong to your account, please check the listing id carefully.', 'geodirectory');
|
|
| 218 | + $is_current_user_owner = geodir_listing_belong_to_current_user(); |
|
| 219 | + if (!$is_current_user_owner) {
|
|
| 220 | + $template = geodir_locate_template('information');
|
|
| 221 | + |
|
| 222 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php'; |
|
| 223 | + /** |
|
| 224 | + * Filter the information template path. |
|
| 225 | + * |
|
| 226 | + * @since 1.0.0 |
|
| 227 | + * @param string $template The template path. |
|
| 228 | + */ |
|
| 229 | + return $template = apply_filters('geodir_template_information', $template);
|
|
| 230 | + } |
|
| 319 | 231 | |
| 320 | - $template = geodir_locate_template('search');
|
|
| 321 | 232 | |
| 322 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php'; |
|
| 323 | - /** |
|
| 324 | - * Filter the search template path. |
|
| 325 | - * |
|
| 326 | - * @since 1.0.0 |
|
| 327 | - * @param string $template The template path. |
|
| 328 | - */ |
|
| 329 | - return $template = apply_filters('geodir_template_search', $template);
|
|
| 233 | + } |
|
| 234 | + |
|
| 235 | + //geodir_is_login(true); |
|
| 236 | + global $current_user; |
|
| 237 | + if (!$current_user->ID) {
|
|
| 238 | + wp_redirect(geodir_login_url(array('redirect_add_listing'=>urlencode(geodir_curPageURL()))), 302);
|
|
| 239 | + exit; |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + $template = geodir_locate_template('add-listing');
|
|
| 243 | + |
|
| 244 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php'; |
|
| 245 | + /** |
|
| 246 | + * Filter the add listing template path. |
|
| 247 | + * |
|
| 248 | + * @since 1.0.0 |
|
| 249 | + * @param string $template The template path. |
|
| 250 | + */ |
|
| 251 | + return $template = apply_filters('geodir_template_add_listing', $template);
|
|
| 252 | + } |
|
| 330 | 253 | |
| 331 | - } |
|
| 332 | 254 | |
| 333 | - if (geodir_is_page('author') || $geodir_custom_page_list['geodir_author_page']) {
|
|
| 255 | + if (geodir_is_page('preview') || $geodir_custom_page_list['geodir_preview_page']) {
|
|
| 256 | + global $preview; |
|
| 257 | + $preview = true; |
|
| 334 | 258 | |
| 335 | - $template = geodir_locate_template('author');
|
|
| 259 | + $template = geodir_locate_template('preview');
|
|
| 336 | 260 | |
| 337 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php'; |
|
| 338 | - /** |
|
| 339 | - * Filter the author template path. |
|
| 340 | - * |
|
| 341 | - * @since 1.0.0 |
|
| 342 | - * @param string $template The template path. |
|
| 343 | - */ |
|
| 344 | - return $template = apply_filters('geodir_template_author', $template);
|
|
| 261 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php'; |
|
| 262 | + /** |
|
| 263 | + * Filter the preview template path. |
|
| 264 | + * |
|
| 265 | + * @since 1.0.0 |
|
| 266 | + * @param string $template The template path. |
|
| 267 | + */ |
|
| 268 | + return $template = apply_filters('geodir_template_preview', $template);
|
|
| 345 | 269 | |
| 346 | - } |
|
| 270 | + } |
|
| 347 | 271 | |
| 348 | - if ( geodir_is_page('home') || geodir_is_page('location')) {
|
|
| 349 | 272 | |
| 350 | - global $post, $wp_query; |
|
| 273 | + if (geodir_is_page('listing-success') || $geodir_custom_page_list['geodir_listing_success_page']) {
|
|
| 351 | 274 | |
| 352 | - if (geodir_is_page('home') || ('page' == get_option('show_on_front') && isset($post->ID) && $post->ID == get_option('page_on_front'))
|
|
| 353 | - || (is_home() && !$wp_query->is_posts_page) |
|
| 354 | - ) {
|
|
| 275 | + $template = geodir_locate_template('success');
|
|
| 355 | 276 | |
| 356 | - $template = geodir_locate_template('geodir-home');
|
|
| 277 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php'; |
|
| 278 | + /** |
|
| 279 | + * Filter the success template path. |
|
| 280 | + * |
|
| 281 | + * @since 1.0.0 |
|
| 282 | + * @param string $template The template path. |
|
| 283 | + */ |
|
| 284 | + return $template = apply_filters('geodir_template_success', $template);
|
|
| 357 | 285 | |
| 358 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php'; |
|
| 359 | - /** |
|
| 360 | - * Filter the home page template path. |
|
| 361 | - * |
|
| 362 | - * @since 1.0.0 |
|
| 363 | - * @param string $template The template path. |
|
| 364 | - */ |
|
| 365 | - return $template = apply_filters('geodir_template_homepage', $template);
|
|
| 286 | + } |
|
| 366 | 287 | |
| 367 | - } elseif (geodir_is_page('location')) {
|
|
| 288 | + if (geodir_is_page('detail') || $geodir_custom_page_list['geodir_listing_detail_page']) {
|
|
| 368 | 289 | |
| 369 | - $template = geodir_locate_template('location');
|
|
| 290 | + $template = geodir_locate_template('detail');
|
|
| 370 | 291 | |
| 371 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php'; |
|
| 372 | - /** |
|
| 373 | - * Filter the location template path. |
|
| 374 | - * |
|
| 375 | - * @since 1.0.0 |
|
| 376 | - * @param string $template The template path. |
|
| 377 | - */ |
|
| 378 | - return $template = apply_filters('geodir_template_location', $template);
|
|
| 292 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php'; |
|
| 293 | + /** |
|
| 294 | + * Filter the detail template path. |
|
| 295 | + * |
|
| 296 | + * @since 1.0.0 |
|
| 297 | + * @param string $template The template path. |
|
| 298 | + */ |
|
| 299 | + return $template = apply_filters('geodir_template_detail', $template);
|
|
| 300 | + |
|
| 301 | + } |
|
| 302 | + |
|
| 303 | + if (geodir_is_page('listing') || $geodir_custom_page_list['geodir_listing_page']) {
|
|
| 304 | + |
|
| 305 | + $template = geodir_locate_template('listing');
|
|
| 306 | + |
|
| 307 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php'; |
|
| 308 | + /** |
|
| 309 | + * Filter the listing template path. |
|
| 310 | + * |
|
| 311 | + * @since 1.0.0 |
|
| 312 | + * @param string $template The template path. |
|
| 313 | + */ |
|
| 314 | + return $template = apply_filters('geodir_template_listing', $template);
|
|
| 315 | + |
|
| 316 | + } |
|
| 379 | 317 | |
| 380 | - } else |
|
| 381 | - return $template; |
|
| 318 | + if (geodir_is_page('search') || $geodir_custom_page_list['geodir_search_page']) {
|
|
| 382 | 319 | |
| 383 | - } |
|
| 320 | + $template = geodir_locate_template('search');
|
|
| 384 | 321 | |
| 385 | - return $template; |
|
| 322 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php'; |
|
| 323 | + /** |
|
| 324 | + * Filter the search template path. |
|
| 325 | + * |
|
| 326 | + * @since 1.0.0 |
|
| 327 | + * @param string $template The template path. |
|
| 328 | + */ |
|
| 329 | + return $template = apply_filters('geodir_template_search', $template);
|
|
| 330 | + |
|
| 331 | + } |
|
| 332 | + |
|
| 333 | + if (geodir_is_page('author') || $geodir_custom_page_list['geodir_author_page']) {
|
|
| 334 | + |
|
| 335 | + $template = geodir_locate_template('author');
|
|
| 336 | + |
|
| 337 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php'; |
|
| 338 | + /** |
|
| 339 | + * Filter the author template path. |
|
| 340 | + * |
|
| 341 | + * @since 1.0.0 |
|
| 342 | + * @param string $template The template path. |
|
| 343 | + */ |
|
| 344 | + return $template = apply_filters('geodir_template_author', $template);
|
|
| 345 | + |
|
| 346 | + } |
|
| 347 | + |
|
| 348 | + if ( geodir_is_page('home') || geodir_is_page('location')) {
|
|
| 349 | + |
|
| 350 | + global $post, $wp_query; |
|
| 351 | + |
|
| 352 | + if (geodir_is_page('home') || ('page' == get_option('show_on_front') && isset($post->ID) && $post->ID == get_option('page_on_front'))
|
|
| 353 | + || (is_home() && !$wp_query->is_posts_page) |
|
| 354 | + ) {
|
|
| 355 | + |
|
| 356 | + $template = geodir_locate_template('geodir-home');
|
|
| 357 | + |
|
| 358 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php'; |
|
| 359 | + /** |
|
| 360 | + * Filter the home page template path. |
|
| 361 | + * |
|
| 362 | + * @since 1.0.0 |
|
| 363 | + * @param string $template The template path. |
|
| 364 | + */ |
|
| 365 | + return $template = apply_filters('geodir_template_homepage', $template);
|
|
| 366 | + |
|
| 367 | + } elseif (geodir_is_page('location')) {
|
|
| 368 | + |
|
| 369 | + $template = geodir_locate_template('location');
|
|
| 370 | + |
|
| 371 | + if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php'; |
|
| 372 | + /** |
|
| 373 | + * Filter the location template path. |
|
| 374 | + * |
|
| 375 | + * @since 1.0.0 |
|
| 376 | + * @param string $template The template path. |
|
| 377 | + */ |
|
| 378 | + return $template = apply_filters('geodir_template_location', $template);
|
|
| 379 | + |
|
| 380 | + } else |
|
| 381 | + return $template; |
|
| 382 | + |
|
| 383 | + } |
|
| 384 | + |
|
| 385 | + return $template; |
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | /** |
@@ -397,44 +397,44 @@ discard block |
||
| 397 | 397 | */ |
| 398 | 398 | function geodir_get_template_part($slug = '', $name = NULL) |
| 399 | 399 | {
|
| 400 | - global $geodirectory, $post; |
|
| 401 | - /** |
|
| 402 | - * Called at the start for the geodir_get_template_part() function. |
|
| 403 | - * |
|
| 404 | - * Used dynamic hook name: geodir_get_template_part_{$slug}
|
|
| 405 | - * |
|
| 406 | - * @since 1.0.0 |
|
| 407 | - * @package GeoDirectory |
|
| 408 | - * @param string $slug The template slug. |
|
| 409 | - * @param string $name The template name. |
|
| 410 | - */ |
|
| 411 | - do_action("geodir_get_template_part_{$slug}", $slug, $name);
|
|
| 412 | - $templates = array(); |
|
| 413 | - $name = (string)$name; |
|
| 414 | - if ('' !== $name) {
|
|
| 415 | - $template_name = "{$slug}-{$name}.php";
|
|
| 416 | - |
|
| 417 | - } else {
|
|
| 418 | - $template_name = "{$slug}.php";
|
|
| 419 | - } |
|
| 420 | - |
|
| 421 | - if (!locate_template(array("geodirectory/" . $template_name))) :
|
|
| 422 | - /** |
|
| 423 | - * Filter the template part with slug and name. |
|
| 424 | - * |
|
| 425 | - * @since 1.0.0 |
|
| 426 | - * @param string $template_name The template name. |
|
| 427 | - */ |
|
| 428 | - $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name);
|
|
| 429 | - /** |
|
| 430 | - * Includes the template part with slug and name. |
|
| 431 | - * |
|
| 432 | - * @since 1.0.0 |
|
| 433 | - */ |
|
| 434 | - include($template); |
|
| 435 | - else: |
|
| 436 | - locate_template(array("geodirectory/" . $template_name), true, false);
|
|
| 437 | - endif; |
|
| 400 | + global $geodirectory, $post; |
|
| 401 | + /** |
|
| 402 | + * Called at the start for the geodir_get_template_part() function. |
|
| 403 | + * |
|
| 404 | + * Used dynamic hook name: geodir_get_template_part_{$slug}
|
|
| 405 | + * |
|
| 406 | + * @since 1.0.0 |
|
| 407 | + * @package GeoDirectory |
|
| 408 | + * @param string $slug The template slug. |
|
| 409 | + * @param string $name The template name. |
|
| 410 | + */ |
|
| 411 | + do_action("geodir_get_template_part_{$slug}", $slug, $name);
|
|
| 412 | + $templates = array(); |
|
| 413 | + $name = (string)$name; |
|
| 414 | + if ('' !== $name) {
|
|
| 415 | + $template_name = "{$slug}-{$name}.php";
|
|
| 416 | + |
|
| 417 | + } else {
|
|
| 418 | + $template_name = "{$slug}.php";
|
|
| 419 | + } |
|
| 420 | + |
|
| 421 | + if (!locate_template(array("geodirectory/" . $template_name))) :
|
|
| 422 | + /** |
|
| 423 | + * Filter the template part with slug and name. |
|
| 424 | + * |
|
| 425 | + * @since 1.0.0 |
|
| 426 | + * @param string $template_name The template name. |
|
| 427 | + */ |
|
| 428 | + $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name);
|
|
| 429 | + /** |
|
| 430 | + * Includes the template part with slug and name. |
|
| 431 | + * |
|
| 432 | + * @since 1.0.0 |
|
| 433 | + */ |
|
| 434 | + include($template); |
|
| 435 | + else: |
|
| 436 | + locate_template(array("geodirectory/" . $template_name), true, false);
|
|
| 437 | + endif; |
|
| 438 | 438 | |
| 439 | 439 | } |
| 440 | 440 | |
@@ -450,23 +450,23 @@ discard block |
||
| 450 | 450 | */ |
| 451 | 451 | function geodir_core_post_view_extra_class($class, $all_postypes = '') |
| 452 | 452 | {
|
| 453 | - global $post; |
|
| 453 | + global $post; |
|
| 454 | 454 | |
| 455 | - if (!$all_postypes) {
|
|
| 456 | - $all_postypes = geodir_get_posttypes(); |
|
| 457 | - } |
|
| 455 | + if (!$all_postypes) {
|
|
| 456 | + $all_postypes = geodir_get_posttypes(); |
|
| 457 | + } |
|
| 458 | 458 | |
| 459 | - $gdp_post_id = !empty($post) && isset($post->ID) ? $post->ID : NULL; |
|
| 460 | - $gdp_post_type = $gdp_post_id > 0 && isset($post->post_type) ? $post->post_type : NULL; |
|
| 461 | - $gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL; |
|
| 459 | + $gdp_post_id = !empty($post) && isset($post->ID) ? $post->ID : NULL; |
|
| 460 | + $gdp_post_type = $gdp_post_id > 0 && isset($post->post_type) ? $post->post_type : NULL; |
|
| 461 | + $gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL; |
|
| 462 | 462 | |
| 463 | - if ($gdp_post_id && $gdp_post_type) {
|
|
| 464 | - $append_class = 'gd-post-' . $gdp_post_type; |
|
| 465 | - $append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : ''; |
|
| 466 | - $class = $class != '' ? $class . ' ' . $append_class : $append_class; |
|
| 467 | - } |
|
| 463 | + if ($gdp_post_id && $gdp_post_type) {
|
|
| 464 | + $append_class = 'gd-post-' . $gdp_post_type; |
|
| 465 | + $append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : ''; |
|
| 466 | + $class = $class != '' ? $class . ' ' . $append_class : $append_class; |
|
| 467 | + } |
|
| 468 | 468 | |
| 469 | - return $class; |
|
| 469 | + return $class; |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | /** |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | * @param bool $favorite Listing Optional. Are favorite listings results? Default: false. |
| 481 | 481 | */ |
| 482 | 482 | function geodir_display_message_not_found_on_listing($template_listview = 'listing-listview', $favorite = false) {
|
| 483 | - if ($favorite) {
|
|
| 483 | + if ($favorite) {
|
|
| 484 | 484 | $message = __('No favorite listings found which match your selection.', 'geodirectory');
|
| 485 | 485 | } else {
|
| 486 | 486 | $message = __('No listings found which match your selection.', 'geodirectory');
|
@@ -55,13 +55,13 @@ discard block |
||
| 55 | 55 | if (!empty($post_types)) |
| 56 | 56 | $post_type = $post_types[0]; |
| 57 | 57 | |
| 58 | - if($sc_post_type != '' ) |
|
| 58 | + if ($sc_post_type != '') |
|
| 59 | 59 | $post_type = $sc_post_type; |
| 60 | 60 | |
| 61 | 61 | if ($is_wpml && !empty($wp->query_vars['page_id'])) {
|
| 62 | 62 | wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
|
| 63 | 63 | } else {
|
| 64 | - wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type); |
|
| 64 | + wp_redirect(trailingslashit(get_site_url()).$pagename.'/?listing_type='.$post_type); |
|
| 65 | 65 | } |
| 66 | 66 | gd_die(); |
| 67 | 67 | } |
@@ -119,14 +119,14 @@ discard block |
||
| 119 | 119 | case 'listing-listview': |
| 120 | 120 | $template = locate_template(array("geodirectory/listing-listview.php"));
|
| 121 | 121 | if (!$template) {
|
| 122 | - $template = geodir_plugin_path() . '/geodirectory-templates/listing-listview.php'; |
|
| 122 | + $template = geodir_plugin_path().'/geodirectory-templates/listing-listview.php'; |
|
| 123 | 123 | } |
| 124 | 124 | return $template; |
| 125 | 125 | break; |
| 126 | 126 | case 'widget-listing-listview': |
| 127 | 127 | $template = locate_template(array("geodirectory/widget-listing-listview.php"));
|
| 128 | 128 | if (!$template) {
|
| 129 | - $template = geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php'; |
|
| 129 | + $template = geodir_plugin_path().'/geodirectory-templates/widget-listing-listview.php'; |
|
| 130 | 130 | } |
| 131 | 131 | return $template; |
| 132 | 132 | break; |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | $template = geodir_locate_template('signup');
|
| 186 | 186 | |
| 187 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php'; |
|
| 187 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-signup.php'; |
|
| 188 | 188 | |
| 189 | 189 | /** |
| 190 | 190 | * Filter the signup template path. |
@@ -198,11 +198,11 @@ discard block |
||
| 198 | 198 | if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) {
|
| 199 | 199 | if (!geodir_is_default_location_set()) {
|
| 200 | 200 | global $information; |
| 201 | - $information = 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>');
|
|
| 201 | + $information = 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>');
|
|
| 202 | 202 | |
| 203 | 203 | $template = geodir_locate_template('information');
|
| 204 | 204 | |
| 205 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php'; |
|
| 205 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-information.php'; |
|
| 206 | 206 | /** |
| 207 | 207 | * Filter the information template path. |
| 208 | 208 | * |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | if (!$is_current_user_owner) {
|
| 220 | 220 | $template = geodir_locate_template('information');
|
| 221 | 221 | |
| 222 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php'; |
|
| 222 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-information.php'; |
|
| 223 | 223 | /** |
| 224 | 224 | * Filter the information template path. |
| 225 | 225 | * |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | $template = geodir_locate_template('add-listing');
|
| 243 | 243 | |
| 244 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php'; |
|
| 244 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/add-listing.php'; |
|
| 245 | 245 | /** |
| 246 | 246 | * Filter the add listing template path. |
| 247 | 247 | * |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | $template = geodir_locate_template('preview');
|
| 260 | 260 | |
| 261 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php'; |
|
| 261 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-detail.php'; |
|
| 262 | 262 | /** |
| 263 | 263 | * Filter the preview template path. |
| 264 | 264 | * |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | $template = geodir_locate_template('success');
|
| 276 | 276 | |
| 277 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php'; |
|
| 277 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-success.php'; |
|
| 278 | 278 | /** |
| 279 | 279 | * Filter the success template path. |
| 280 | 280 | * |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | |
| 290 | 290 | $template = geodir_locate_template('detail');
|
| 291 | 291 | |
| 292 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php'; |
|
| 292 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-detail.php'; |
|
| 293 | 293 | /** |
| 294 | 294 | * Filter the detail template path. |
| 295 | 295 | * |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | |
| 305 | 305 | $template = geodir_locate_template('listing');
|
| 306 | 306 | |
| 307 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php'; |
|
| 307 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-listing.php'; |
|
| 308 | 308 | /** |
| 309 | 309 | * Filter the listing template path. |
| 310 | 310 | * |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | $template = geodir_locate_template('search');
|
| 321 | 321 | |
| 322 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php'; |
|
| 322 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-search.php'; |
|
| 323 | 323 | /** |
| 324 | 324 | * Filter the search template path. |
| 325 | 325 | * |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | |
| 335 | 335 | $template = geodir_locate_template('author');
|
| 336 | 336 | |
| 337 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php'; |
|
| 337 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-author.php'; |
|
| 338 | 338 | /** |
| 339 | 339 | * Filter the author template path. |
| 340 | 340 | * |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | - if ( geodir_is_page('home') || geodir_is_page('location')) {
|
|
| 348 | + if (geodir_is_page('home') || geodir_is_page('location')) {
|
|
| 349 | 349 | |
| 350 | 350 | global $post, $wp_query; |
| 351 | 351 | |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | |
| 356 | 356 | $template = geodir_locate_template('geodir-home');
|
| 357 | 357 | |
| 358 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php'; |
|
| 358 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-home.php'; |
|
| 359 | 359 | /** |
| 360 | 360 | * Filter the home page template path. |
| 361 | 361 | * |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | |
| 369 | 369 | $template = geodir_locate_template('location');
|
| 370 | 370 | |
| 371 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php'; |
|
| 371 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-location.php'; |
|
| 372 | 372 | /** |
| 373 | 373 | * Filter the location template path. |
| 374 | 374 | * |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | */ |
| 411 | 411 | do_action("geodir_get_template_part_{$slug}", $slug, $name);
|
| 412 | 412 | $templates = array(); |
| 413 | - $name = (string)$name; |
|
| 413 | + $name = (string) $name; |
|
| 414 | 414 | if ('' !== $name) {
|
| 415 | 415 | $template_name = "{$slug}-{$name}.php";
|
| 416 | 416 | |
@@ -418,14 +418,14 @@ discard block |
||
| 418 | 418 | $template_name = "{$slug}.php";
|
| 419 | 419 | } |
| 420 | 420 | |
| 421 | - if (!locate_template(array("geodirectory/" . $template_name))) :
|
|
| 421 | + if (!locate_template(array("geodirectory/".$template_name))) :
|
|
| 422 | 422 | /** |
| 423 | 423 | * Filter the template part with slug and name. |
| 424 | 424 | * |
| 425 | 425 | * @since 1.0.0 |
| 426 | 426 | * @param string $template_name The template name. |
| 427 | 427 | */ |
| 428 | - $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name);
|
|
| 428 | + $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path().'/geodirectory-templates/'.$template_name);
|
|
| 429 | 429 | /** |
| 430 | 430 | * Includes the template part with slug and name. |
| 431 | 431 | * |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | */ |
| 434 | 434 | include($template); |
| 435 | 435 | else: |
| 436 | - locate_template(array("geodirectory/" . $template_name), true, false);
|
|
| 436 | + locate_template(array("geodirectory/".$template_name), true, false);
|
|
| 437 | 437 | endif; |
| 438 | 438 | |
| 439 | 439 | } |
@@ -461,9 +461,9 @@ discard block |
||
| 461 | 461 | $gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL; |
| 462 | 462 | |
| 463 | 463 | if ($gdp_post_id && $gdp_post_type) {
|
| 464 | - $append_class = 'gd-post-' . $gdp_post_type; |
|
| 464 | + $append_class = 'gd-post-'.$gdp_post_type; |
|
| 465 | 465 | $append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : ''; |
| 466 | - $class = $class != '' ? $class . ' ' . $append_class : $append_class; |
|
| 466 | + $class = $class != '' ? $class.' '.$append_class : $append_class; |
|
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | return $class; |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | */ |
| 496 | 496 | $message = apply_filters('geodir_message_listing_not_found', $message, $template_listview, $favorite);
|
| 497 | 497 | |
| 498 | - echo '<li class="no-listing">' . $message . '</li>'; |
|
| 498 | + echo '<li class="no-listing">'.$message.'</li>'; |
|
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | /** |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | function geodir_convert_listing_view_class($columns = '') {
|
| 525 | 525 | $class = ''; |
| 526 | 526 | |
| 527 | - switch ((int)$columns) {
|
|
| 527 | + switch ((int) $columns) {
|
|
| 528 | 528 | case 1: |
| 529 | 529 | $class = ''; |
| 530 | 530 | break; |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | $html .= '<option value=""></option>'; |
| 590 | 590 | if (!empty($star_texts) && is_array($star_texts)) {
|
| 591 | 591 | foreach ($star_texts as $i => $text) {
|
| 592 | - $html .= '<option ' . selected((int)($i + 1), (int)$default, false) . ' value="' . (int)($i + 1) . '">' . $text . '</option>'; |
|
| 592 | + $html .= '<option '.selected((int) ($i + 1), (int) $default, false).' value="'.(int) ($i + 1).'">'.$text.'</option>'; |
|
| 593 | 593 | } |
| 594 | 594 | } else {
|
| 595 | 595 | $html .= '<option value="1">1</option>'; |
@@ -618,14 +618,14 @@ discard block |
||
| 618 | 618 | function geodir_font_awesome_rating_stars_html($html, $rating, $star_count = 5) {
|
| 619 | 619 | if (get_option('geodir_reviewrating_enable_font_awesome') == '1') {
|
| 620 | 620 | $rating = min($rating, $star_count); |
| 621 | - $full_stars = floor( $rating ); |
|
| 622 | - $half_stars = ceil( $rating - $full_stars ); |
|
| 621 | + $full_stars = floor($rating); |
|
| 622 | + $half_stars = ceil($rating - $full_stars); |
|
| 623 | 623 | $empty_stars = $star_count - $full_stars - $half_stars; |
| 624 | 624 | |
| 625 | 625 | $html = '<div class="gd-star-rating gd-fa-star-rating">'; |
| 626 | - $html .= str_repeat( '<i class="fa fa-star gd-full-star"></i>', $full_stars ); |
|
| 627 | - $html .= str_repeat( '<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars ); |
|
| 628 | - $html .= str_repeat( '<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars); |
|
| 626 | + $html .= str_repeat('<i class="fa fa-star gd-full-star"></i>', $full_stars);
|
|
| 627 | + $html .= str_repeat('<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars);
|
|
| 628 | + $html .= str_repeat('<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars);
|
|
| 629 | 629 | $html .= '</div>'; |
| 630 | 630 | } |
| 631 | 631 | |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | $full_color = get_option('geodir_reviewrating_fa_full_rating_color', '#757575');
|
| 645 | 645 | if ($full_color != '#757575') {
|
| 646 | 646 | echo '<style type="text/css">.br-theme-fontawesome-stars .br-widget a.br-active:after,.br-theme-fontawesome-stars .br-widget a.br-selected:after, |
| 647 | - .gd-star-rating i.fa {color:' . stripslashes($full_color) . '!important;}</style>';
|
|
| 647 | + .gd-star-rating i.fa {color:' . stripslashes($full_color).'!important;}</style>';
|
|
| 648 | 648 | } |
| 649 | 649 | } |
| 650 | 650 | } |
| 651 | 651 | \ No newline at end of file |
@@ -10,52 +10,52 @@ discard block |
||
| 10 | 10 | global $wpdb, $table_prefix; |
| 11 | 11 | |
| 12 | 12 | if (!function_exists('geodir_column_exist')) {
|
| 13 | - /** |
|
| 14 | - * Check table column exist or not. |
|
| 15 | - * |
|
| 16 | - * @since 1.0.0 |
|
| 17 | - * @package GeoDirectory |
|
| 18 | - * @global object $wpdb WordPress Database object. |
|
| 19 | - * @param string $db The table name. |
|
| 20 | - * @param string $column The column name. |
|
| 21 | - * @return bool If column exists returns true. Otherwise false. |
|
| 22 | - */ |
|
| 23 | - function geodir_column_exist($db, $column) |
|
| 24 | - {
|
|
| 25 | - global $wpdb; |
|
| 26 | - $exists = false; |
|
| 27 | - $columns = $wpdb->get_col("show columns from $db");
|
|
| 28 | - foreach ($columns as $c) {
|
|
| 29 | - if ($c == $column) {
|
|
| 30 | - $exists = true; |
|
| 31 | - break; |
|
| 32 | - } |
|
| 33 | - } |
|
| 34 | - return $exists; |
|
| 35 | - } |
|
| 13 | + /** |
|
| 14 | + * Check table column exist or not. |
|
| 15 | + * |
|
| 16 | + * @since 1.0.0 |
|
| 17 | + * @package GeoDirectory |
|
| 18 | + * @global object $wpdb WordPress Database object. |
|
| 19 | + * @param string $db The table name. |
|
| 20 | + * @param string $column The column name. |
|
| 21 | + * @return bool If column exists returns true. Otherwise false. |
|
| 22 | + */ |
|
| 23 | + function geodir_column_exist($db, $column) |
|
| 24 | + {
|
|
| 25 | + global $wpdb; |
|
| 26 | + $exists = false; |
|
| 27 | + $columns = $wpdb->get_col("show columns from $db");
|
|
| 28 | + foreach ($columns as $c) {
|
|
| 29 | + if ($c == $column) {
|
|
| 30 | + $exists = true; |
|
| 31 | + break; |
|
| 32 | + } |
|
| 33 | + } |
|
| 34 | + return $exists; |
|
| 35 | + } |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | if (!function_exists('geodir_add_column_if_not_exist')) {
|
| 39 | - /** |
|
| 40 | - * Add column if table column not exist. |
|
| 41 | - * |
|
| 42 | - * @since 1.0.0 |
|
| 43 | - * @package GeoDirectory |
|
| 44 | - * @global object $wpdb WordPress Database object. |
|
| 45 | - * @param string $db The table name. |
|
| 46 | - * @param string $column The column name. |
|
| 47 | - * @param string $column_attr The column attributes. |
|
| 48 | - */ |
|
| 49 | - function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL") |
|
| 50 | - {
|
|
| 51 | - global $wpdb; |
|
| 52 | - $result = 0;// no rows affected |
|
| 53 | - if (!geodir_column_exist($db, $column)) {
|
|
| 54 | - if (!empty($db) && !empty($column)) |
|
| 55 | - $result = $wpdb->query("ALTER TABLE `$db` ADD `$column` $column_attr");
|
|
| 56 | - } |
|
| 57 | - return $result; |
|
| 58 | - } |
|
| 39 | + /** |
|
| 40 | + * Add column if table column not exist. |
|
| 41 | + * |
|
| 42 | + * @since 1.0.0 |
|
| 43 | + * @package GeoDirectory |
|
| 44 | + * @global object $wpdb WordPress Database object. |
|
| 45 | + * @param string $db The table name. |
|
| 46 | + * @param string $column The column name. |
|
| 47 | + * @param string $column_attr The column attributes. |
|
| 48 | + */ |
|
| 49 | + function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL") |
|
| 50 | + {
|
|
| 51 | + global $wpdb; |
|
| 52 | + $result = 0;// no rows affected |
|
| 53 | + if (!geodir_column_exist($db, $column)) {
|
|
| 54 | + if (!empty($db) && !empty($column)) |
|
| 55 | + $result = $wpdb->query("ALTER TABLE `$db` ADD `$column` $column_attr");
|
|
| 56 | + } |
|
| 57 | + return $result; |
|
| 58 | + } |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -72,706 +72,706 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | function geodir_post_custom_fields($package_id = '', $default = 'all', $post_type = 'gd_place', $fields_location = 'none') |
| 74 | 74 | {
|
| 75 | - global $wpdb, $geodir_post_custom_fields_cache; |
|
| 76 | - |
|
| 77 | - $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location; |
|
| 78 | - |
|
| 79 | - if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
|
|
| 80 | - return $geodir_post_custom_fields_cache[$cache_stored]; |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - $default_query = ''; |
|
| 84 | - |
|
| 85 | - if ($default == 'default') |
|
| 86 | - $default_query .= " and is_admin IN ('1') ";
|
|
| 87 | - elseif ($default == 'custom') |
|
| 88 | - $default_query .= " and is_admin = '0' "; |
|
| 89 | - |
|
| 90 | - if ($fields_location == 'none') {
|
|
| 91 | - } else{
|
|
| 92 | - $fields_location = esc_sql( $fields_location ); |
|
| 93 | - $default_query .= " and show_in LIKE '%%[$fields_location]%%' "; |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - $post_meta_info = $wpdb->get_results( |
|
| 97 | - $wpdb->prepare( |
|
| 98 | - "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
|
|
| 99 | - array($post_type) |
|
| 100 | - ) |
|
| 101 | - ); |
|
| 102 | - |
|
| 103 | - |
|
| 104 | - $return_arr = array(); |
|
| 105 | - if ($post_meta_info) {
|
|
| 106 | - |
|
| 107 | - foreach ($post_meta_info as $post_meta_info_obj) {
|
|
| 108 | - |
|
| 109 | - $custom_fields = array( |
|
| 110 | - "name" => $post_meta_info_obj->htmlvar_name, |
|
| 111 | - "label" => $post_meta_info_obj->clabels, |
|
| 112 | - "default" => $post_meta_info_obj->default_value, |
|
| 113 | - "type" => $post_meta_info_obj->field_type, |
|
| 114 | - "desc" => $post_meta_info_obj->admin_desc); |
|
| 115 | - |
|
| 116 | - if ($post_meta_info_obj->field_type) {
|
|
| 117 | - $options = explode(',', $post_meta_info_obj->option_values);
|
|
| 118 | - $custom_fields["options"] = $options; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - foreach ($post_meta_info_obj as $key => $val) {
|
|
| 122 | - $custom_fields[$key] = $val; |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - $pricearr = array(); |
|
| 126 | - $pricearr = explode(',', $post_meta_info_obj->packages);
|
|
| 127 | - |
|
| 128 | - if ($package_id != '' && in_array($package_id, $pricearr)) {
|
|
| 129 | - $return_arr[$post_meta_info_obj->sort_order] = $custom_fields; |
|
| 130 | - } elseif ($package_id == '') {
|
|
| 131 | - $return_arr[$post_meta_info_obj->sort_order] = $custom_fields; |
|
| 132 | - } |
|
| 133 | - } |
|
| 134 | - } |
|
| 135 | - $geodir_post_custom_fields_cache[$cache_stored] = $return_arr; |
|
| 136 | - |
|
| 137 | - if (has_filter('geodir_filter_geodir_post_custom_fields')) {
|
|
| 138 | - /** |
|
| 139 | - * Filter the post custom fields array. |
|
| 140 | - * |
|
| 141 | - * @since 1.0.0 |
|
| 142 | - * |
|
| 143 | - * @param array $return_arr Post custom fields array. |
|
| 144 | - * @param int|string $package_id The package ID. |
|
| 145 | - * @param string $post_type Optional. The wordpress post type. |
|
| 146 | - * @param string $fields_location Optional. Where exactly are you going to place this custom fields?. |
|
| 147 | - */ |
|
| 148 | - $return_arr = apply_filters('geodir_filter_geodir_post_custom_fields', $return_arr, $package_id, $post_type, $fields_location);
|
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - return $return_arr; |
|
| 75 | + global $wpdb, $geodir_post_custom_fields_cache; |
|
| 76 | + |
|
| 77 | + $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location; |
|
| 78 | + |
|
| 79 | + if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
|
|
| 80 | + return $geodir_post_custom_fields_cache[$cache_stored]; |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + $default_query = ''; |
|
| 84 | + |
|
| 85 | + if ($default == 'default') |
|
| 86 | + $default_query .= " and is_admin IN ('1') ";
|
|
| 87 | + elseif ($default == 'custom') |
|
| 88 | + $default_query .= " and is_admin = '0' "; |
|
| 89 | + |
|
| 90 | + if ($fields_location == 'none') {
|
|
| 91 | + } else{
|
|
| 92 | + $fields_location = esc_sql( $fields_location ); |
|
| 93 | + $default_query .= " and show_in LIKE '%%[$fields_location]%%' "; |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + $post_meta_info = $wpdb->get_results( |
|
| 97 | + $wpdb->prepare( |
|
| 98 | + "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
|
|
| 99 | + array($post_type) |
|
| 100 | + ) |
|
| 101 | + ); |
|
| 102 | + |
|
| 103 | + |
|
| 104 | + $return_arr = array(); |
|
| 105 | + if ($post_meta_info) {
|
|
| 106 | + |
|
| 107 | + foreach ($post_meta_info as $post_meta_info_obj) {
|
|
| 108 | + |
|
| 109 | + $custom_fields = array( |
|
| 110 | + "name" => $post_meta_info_obj->htmlvar_name, |
|
| 111 | + "label" => $post_meta_info_obj->clabels, |
|
| 112 | + "default" => $post_meta_info_obj->default_value, |
|
| 113 | + "type" => $post_meta_info_obj->field_type, |
|
| 114 | + "desc" => $post_meta_info_obj->admin_desc); |
|
| 115 | + |
|
| 116 | + if ($post_meta_info_obj->field_type) {
|
|
| 117 | + $options = explode(',', $post_meta_info_obj->option_values);
|
|
| 118 | + $custom_fields["options"] = $options; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + foreach ($post_meta_info_obj as $key => $val) {
|
|
| 122 | + $custom_fields[$key] = $val; |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + $pricearr = array(); |
|
| 126 | + $pricearr = explode(',', $post_meta_info_obj->packages);
|
|
| 127 | + |
|
| 128 | + if ($package_id != '' && in_array($package_id, $pricearr)) {
|
|
| 129 | + $return_arr[$post_meta_info_obj->sort_order] = $custom_fields; |
|
| 130 | + } elseif ($package_id == '') {
|
|
| 131 | + $return_arr[$post_meta_info_obj->sort_order] = $custom_fields; |
|
| 132 | + } |
|
| 133 | + } |
|
| 134 | + } |
|
| 135 | + $geodir_post_custom_fields_cache[$cache_stored] = $return_arr; |
|
| 136 | + |
|
| 137 | + if (has_filter('geodir_filter_geodir_post_custom_fields')) {
|
|
| 138 | + /** |
|
| 139 | + * Filter the post custom fields array. |
|
| 140 | + * |
|
| 141 | + * @since 1.0.0 |
|
| 142 | + * |
|
| 143 | + * @param array $return_arr Post custom fields array. |
|
| 144 | + * @param int|string $package_id The package ID. |
|
| 145 | + * @param string $post_type Optional. The wordpress post type. |
|
| 146 | + * @param string $fields_location Optional. Where exactly are you going to place this custom fields?. |
|
| 147 | + */ |
|
| 148 | + $return_arr = apply_filters('geodir_filter_geodir_post_custom_fields', $return_arr, $package_id, $post_type, $fields_location);
|
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + return $return_arr; |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - /** |
|
| 155 | - * Adds admin html for custom fields. |
|
| 156 | - * |
|
| 157 | - * @since 1.0.0 |
|
| 158 | - * @package GeoDirectory |
|
| 159 | - * @global object $wpdb WordPress Database object. |
|
| 160 | - * @param string $field_type The form field type. |
|
| 161 | - * @param object|int $result_str The custom field results object or row id. |
|
| 162 | - * @param string $field_ins_upd When set to "submit" displays form. |
|
| 163 | - * @param string $field_type_key The key of the custom field. |
|
| 164 | - */ |
|
| 165 | - function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='') |
|
| 166 | - {
|
|
| 167 | - global $wpdb; |
|
| 168 | - $cf = $result_str; |
|
| 169 | - if (!is_object($cf)) {
|
|
| 170 | - |
|
| 171 | - $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
|
|
| 172 | - |
|
| 173 | - } else {
|
|
| 174 | - $field_info = $cf; |
|
| 175 | - $result_str = $cf->id; |
|
| 176 | - } |
|
| 177 | - /** |
|
| 178 | - * Contains custom field html. |
|
| 179 | - * |
|
| 180 | - * @since 1.0.0 |
|
| 181 | - */ |
|
| 182 | - include('custom_field_html.php');
|
|
| 183 | - |
|
| 184 | - } |
|
| 154 | + /** |
|
| 155 | + * Adds admin html for custom fields. |
|
| 156 | + * |
|
| 157 | + * @since 1.0.0 |
|
| 158 | + * @package GeoDirectory |
|
| 159 | + * @global object $wpdb WordPress Database object. |
|
| 160 | + * @param string $field_type The form field type. |
|
| 161 | + * @param object|int $result_str The custom field results object or row id. |
|
| 162 | + * @param string $field_ins_upd When set to "submit" displays form. |
|
| 163 | + * @param string $field_type_key The key of the custom field. |
|
| 164 | + */ |
|
| 165 | + function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='') |
|
| 166 | + {
|
|
| 167 | + global $wpdb; |
|
| 168 | + $cf = $result_str; |
|
| 169 | + if (!is_object($cf)) {
|
|
| 170 | + |
|
| 171 | + $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
|
|
| 172 | + |
|
| 173 | + } else {
|
|
| 174 | + $field_info = $cf; |
|
| 175 | + $result_str = $cf->id; |
|
| 176 | + } |
|
| 177 | + /** |
|
| 178 | + * Contains custom field html. |
|
| 179 | + * |
|
| 180 | + * @since 1.0.0 |
|
| 181 | + */ |
|
| 182 | + include('custom_field_html.php');
|
|
| 183 | + |
|
| 184 | + } |
|
| 185 | 185 | |
| 186 | 186 | |
| 187 | 187 | if (!function_exists('geodir_custom_field_delete')) {
|
| 188 | - /** |
|
| 189 | - * Delete custom field using field id. |
|
| 190 | - * |
|
| 191 | - * @since 1.0.0 |
|
| 192 | - * @since 1.5.7 Delete field from sorting fields table when custom field deleted. |
|
| 193 | - * @package GeoDirectory |
|
| 194 | - * @global object $wpdb WordPress Database object. |
|
| 195 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 196 | - * @param string $field_id The custom field ID. |
|
| 197 | - * @return int|string If field deleted successfully, returns field id. Otherwise returns 0. |
|
| 198 | - */ |
|
| 199 | - function geodir_custom_field_delete($field_id = '') {
|
|
| 200 | - global $wpdb, $plugin_prefix; |
|
| 201 | - |
|
| 202 | - if ($field_id != '') {
|
|
| 203 | - $cf = trim($field_id, '_'); |
|
| 204 | - |
|
| 205 | - if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
|
|
| 206 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 207 | - |
|
| 208 | - $post_type = $field->post_type; |
|
| 209 | - $htmlvar_name = $field->htmlvar_name; |
|
| 210 | - |
|
| 211 | - if ($post_type != '' && $htmlvar_name != '') {
|
|
| 212 | - $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
|
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - /** |
|
| 216 | - * Called after a custom field is deleted. |
|
| 217 | - * |
|
| 218 | - * @since 1.0.0 |
|
| 219 | - * @param string $cf The fields ID. |
|
| 220 | - * @param string $field->htmlvar_name The html variable name for the field. |
|
| 221 | - * @param string $post_type The post type the field belongs to. |
|
| 222 | - */ |
|
| 223 | - do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
|
|
| 224 | - |
|
| 225 | - if ($field->field_type == 'address') {
|
|
| 226 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
|
|
| 227 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
|
|
| 228 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
|
|
| 229 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
|
|
| 230 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
|
|
| 231 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
|
|
| 232 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
|
|
| 233 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
|
|
| 234 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
|
|
| 235 | - } else {
|
|
| 236 | - if ($field->field_type != 'fieldset') {
|
|
| 237 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
|
|
| 238 | - } |
|
| 239 | - } |
|
| 240 | - |
|
| 241 | - return $field_id; |
|
| 242 | - } else |
|
| 243 | - return 0; |
|
| 244 | - } else |
|
| 245 | - return 0; |
|
| 246 | - } |
|
| 188 | + /** |
|
| 189 | + * Delete custom field using field id. |
|
| 190 | + * |
|
| 191 | + * @since 1.0.0 |
|
| 192 | + * @since 1.5.7 Delete field from sorting fields table when custom field deleted. |
|
| 193 | + * @package GeoDirectory |
|
| 194 | + * @global object $wpdb WordPress Database object. |
|
| 195 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 196 | + * @param string $field_id The custom field ID. |
|
| 197 | + * @return int|string If field deleted successfully, returns field id. Otherwise returns 0. |
|
| 198 | + */ |
|
| 199 | + function geodir_custom_field_delete($field_id = '') {
|
|
| 200 | + global $wpdb, $plugin_prefix; |
|
| 201 | + |
|
| 202 | + if ($field_id != '') {
|
|
| 203 | + $cf = trim($field_id, '_'); |
|
| 204 | + |
|
| 205 | + if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
|
|
| 206 | + $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 207 | + |
|
| 208 | + $post_type = $field->post_type; |
|
| 209 | + $htmlvar_name = $field->htmlvar_name; |
|
| 210 | + |
|
| 211 | + if ($post_type != '' && $htmlvar_name != '') {
|
|
| 212 | + $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
|
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + /** |
|
| 216 | + * Called after a custom field is deleted. |
|
| 217 | + * |
|
| 218 | + * @since 1.0.0 |
|
| 219 | + * @param string $cf The fields ID. |
|
| 220 | + * @param string $field->htmlvar_name The html variable name for the field. |
|
| 221 | + * @param string $post_type The post type the field belongs to. |
|
| 222 | + */ |
|
| 223 | + do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
|
|
| 224 | + |
|
| 225 | + if ($field->field_type == 'address') {
|
|
| 226 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
|
|
| 227 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
|
|
| 228 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
|
|
| 229 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
|
|
| 230 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
|
|
| 231 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
|
|
| 232 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
|
|
| 233 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
|
|
| 234 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
|
|
| 235 | + } else {
|
|
| 236 | + if ($field->field_type != 'fieldset') {
|
|
| 237 | + $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
|
|
| 238 | + } |
|
| 239 | + } |
|
| 240 | + |
|
| 241 | + return $field_id; |
|
| 242 | + } else |
|
| 243 | + return 0; |
|
| 244 | + } else |
|
| 245 | + return 0; |
|
| 246 | + } |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | if (!function_exists('geodir_custom_field_save')) {
|
| 250 | - /** |
|
| 251 | - * Save or Update custom fields into the database. |
|
| 252 | - * |
|
| 253 | - * @since 1.0.0 |
|
| 254 | - * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt. |
|
| 255 | - * @package GeoDirectory |
|
| 256 | - * @global object $wpdb WordPress Database object. |
|
| 257 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 258 | - * @param array $request_field {
|
|
| 259 | - * Attributes of the request field array. |
|
| 260 | - * |
|
| 261 | - * @type string $action Ajax Action name. Default "geodir_ajax_action". |
|
| 262 | - * @type string $manage_field_type Field type Default "custom_fields". |
|
| 263 | - * @type string $create_field Create field Default "true". |
|
| 264 | - * @type string $field_ins_upd Field ins upd Default "submit". |
|
| 265 | - * @type string $_wpnonce WP nonce value. |
|
| 266 | - * @type string $listing_type Listing type Example "gd_place". |
|
| 267 | - * @type string $field_type Field type Example "radio". |
|
| 268 | - * @type string $field_id Field id Example "12". |
|
| 269 | - * @type string $data_type Data type Example "VARCHAR". |
|
| 270 | - * @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere. |
|
| 271 | - * @type array $show_on_pkg Package list to display this field. |
|
| 272 | - * @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings. |
|
| 273 | - * @type string $site_title Section title which you wish to display in frontend. |
|
| 274 | - * @type string $admin_desc Section description which will appear in frontend. |
|
| 275 | - * @type string $htmlvar_name Html variable name. This should be a unique name. |
|
| 276 | - * @type string $clabels Section Title which will appear in backend. |
|
| 277 | - * @type string $default_value The default value (for "link" this will be used as the link text). |
|
| 278 | - * @type string $sort_order The display order of this field in backend. e.g. 5. |
|
| 279 | - * @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field. |
|
| 280 | - * @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field. |
|
| 281 | - * @type string $is_required Use "1" to set field as required. |
|
| 282 | - * @type string $required_msg Enter text for error message if field required and have not full fill requirement. |
|
| 283 | - * @type string $show_on_listing Want to show this on listing page?. |
|
| 284 | - * @type string $show_in What locations to show the custom field in. |
|
| 285 | - * @type string $show_on_detail Want to show this in More Info tab on detail page?. |
|
| 286 | - * @type string $show_as_tab Want to display this as a tab on detail page? If "1" then "Show on detail page?" must be Yes. |
|
| 287 | - * @type string $option_values Option Values should be separated by comma. |
|
| 288 | - * @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class. |
|
| 289 | - * @type string $css_class Enter custom css class for field custom style. |
|
| 290 | - * @type array $extra_fields An array of extra fields to store. |
|
| 291 | - * |
|
| 292 | - * } |
|
| 293 | - * @param bool $default Not yet implemented. |
|
| 294 | - * @return int|string If field is unique returns inserted row id. Otherwise returns error string. |
|
| 295 | - */ |
|
| 296 | - function geodir_custom_field_save($request_field = array(), $default = false) |
|
| 297 | - {
|
|
| 298 | - |
|
| 299 | - global $wpdb, $plugin_prefix; |
|
| 300 | - |
|
| 301 | - $old_html_variable = ''; |
|
| 302 | - |
|
| 303 | - $data_type = trim($request_field['data_type']); |
|
| 304 | - |
|
| 305 | - $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
|
| 306 | - |
|
| 307 | - // some servers fail if a POST value is VARCHAR so we change it. |
|
| 308 | - if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
|
|
| 309 | - $request_field['data_type'] = 'VARCHAR'; |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - $cf = trim($result_str, '_'); |
|
| 313 | - |
|
| 314 | - |
|
| 315 | - /*-------- check duplicate validation --------*/ |
|
| 316 | - |
|
| 317 | - $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 318 | - $post_type = $request_field['listing_type']; |
|
| 319 | - |
|
| 320 | - if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
|
|
| 321 | - $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name; |
|
| 322 | - } |
|
| 323 | - |
|
| 324 | - $check_html_variable = $wpdb->get_var( |
|
| 325 | - $wpdb->prepare( |
|
| 326 | - "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ", |
|
| 327 | - array($cf, $cehhtmlvar_name, $post_type) |
|
| 328 | - ) |
|
| 329 | - ); |
|
| 330 | - |
|
| 331 | - |
|
| 332 | - if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
|
|
| 333 | - |
|
| 334 | - if ($cf != '') {
|
|
| 335 | - |
|
| 336 | - $post_meta_info = $wpdb->get_row( |
|
| 337 | - $wpdb->prepare( |
|
| 338 | - "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d", |
|
| 339 | - array($cf) |
|
| 340 | - ) |
|
| 341 | - ); |
|
| 342 | - |
|
| 343 | - } |
|
| 344 | - |
|
| 345 | - if (!empty($post_meta_info)) {
|
|
| 346 | - $post_val = $post_meta_info; |
|
| 347 | - $old_html_variable = $post_val->htmlvar_name; |
|
| 348 | - |
|
| 349 | - } |
|
| 350 | - |
|
| 351 | - |
|
| 352 | - |
|
| 353 | - if ($post_type == '') $post_type = 'gd_place'; |
|
| 354 | - |
|
| 355 | - |
|
| 356 | - $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
| 357 | - |
|
| 358 | - $admin_title = $request_field['admin_title']; |
|
| 359 | - $site_title = $request_field['site_title']; |
|
| 360 | - $data_type = $request_field['data_type']; |
|
| 361 | - $field_type = $request_field['field_type']; |
|
| 362 | - $field_type_key = isset($request_field['field_type_key']) ? $request_field['field_type_key'] : $field_type; |
|
| 363 | - $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 364 | - $admin_desc = $request_field['admin_desc']; |
|
| 365 | - $clabels = $request_field['clabels']; |
|
| 366 | - $default_value = isset($request_field['default_value']) ? $request_field['default_value'] : ''; |
|
| 367 | - $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : ''; |
|
| 368 | - $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : ''; |
|
| 369 | - $is_required = isset($request_field['is_required']) ? $request_field['is_required'] : ''; |
|
| 370 | - $required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : ''; |
|
| 371 | - $css_class = isset($request_field['css_class']) ? $request_field['css_class'] : ''; |
|
| 372 | - $field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : ''; |
|
| 373 | - $show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : ''; |
|
| 374 | - $show_in = isset($request_field['show_in']) ? $request_field['show_in'] : ''; |
|
| 375 | - $show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : ''; |
|
| 376 | - $show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : ''; |
|
| 377 | - $decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type |
|
| 378 | - $decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : ''; |
|
| 379 | - $validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : ''; |
|
| 380 | - $validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : ''; |
|
| 381 | - $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : ''; |
|
| 250 | + /** |
|
| 251 | + * Save or Update custom fields into the database. |
|
| 252 | + * |
|
| 253 | + * @since 1.0.0 |
|
| 254 | + * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt. |
|
| 255 | + * @package GeoDirectory |
|
| 256 | + * @global object $wpdb WordPress Database object. |
|
| 257 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 258 | + * @param array $request_field {
|
|
| 259 | + * Attributes of the request field array. |
|
| 260 | + * |
|
| 261 | + * @type string $action Ajax Action name. Default "geodir_ajax_action". |
|
| 262 | + * @type string $manage_field_type Field type Default "custom_fields". |
|
| 263 | + * @type string $create_field Create field Default "true". |
|
| 264 | + * @type string $field_ins_upd Field ins upd Default "submit". |
|
| 265 | + * @type string $_wpnonce WP nonce value. |
|
| 266 | + * @type string $listing_type Listing type Example "gd_place". |
|
| 267 | + * @type string $field_type Field type Example "radio". |
|
| 268 | + * @type string $field_id Field id Example "12". |
|
| 269 | + * @type string $data_type Data type Example "VARCHAR". |
|
| 270 | + * @type string $is_active Either "1" or "0". If "0" is used then the field will not be displayed anywhere. |
|
| 271 | + * @type array $show_on_pkg Package list to display this field. |
|
| 272 | + * @type string $admin_title Personal comment, it would not be displayed anywhere except in custom field settings. |
|
| 273 | + * @type string $site_title Section title which you wish to display in frontend. |
|
| 274 | + * @type string $admin_desc Section description which will appear in frontend. |
|
| 275 | + * @type string $htmlvar_name Html variable name. This should be a unique name. |
|
| 276 | + * @type string $clabels Section Title which will appear in backend. |
|
| 277 | + * @type string $default_value The default value (for "link" this will be used as the link text). |
|
| 278 | + * @type string $sort_order The display order of this field in backend. e.g. 5. |
|
| 279 | + * @type string $is_default Either "1" or "0". If "0" is used then the field will be displayed as main form field or additional field. |
|
| 280 | + * @type string $for_admin_use Either "1" or "0". If "0" is used then only site admin can edit this field. |
|
| 281 | + * @type string $is_required Use "1" to set field as required. |
|
| 282 | + * @type string $required_msg Enter text for error message if field required and have not full fill requirement. |
|
| 283 | + * @type string $show_on_listing Want to show this on listing page?. |
|
| 284 | + * @type string $show_in What locations to show the custom field in. |
|
| 285 | + * @type string $show_on_detail Want to show this in More Info tab on detail page?. |
|
| 286 | + * @type string $show_as_tab Want to display this as a tab on detail page? If "1" then "Show on detail page?" must be Yes. |
|
| 287 | + * @type string $option_values Option Values should be separated by comma. |
|
| 288 | + * @type string $field_icon Upload icon using media and enter its url path, or enter font awesome class. |
|
| 289 | + * @type string $css_class Enter custom css class for field custom style. |
|
| 290 | + * @type array $extra_fields An array of extra fields to store. |
|
| 291 | + * |
|
| 292 | + * } |
|
| 293 | + * @param bool $default Not yet implemented. |
|
| 294 | + * @return int|string If field is unique returns inserted row id. Otherwise returns error string. |
|
| 295 | + */ |
|
| 296 | + function geodir_custom_field_save($request_field = array(), $default = false) |
|
| 297 | + {
|
|
| 298 | + |
|
| 299 | + global $wpdb, $plugin_prefix; |
|
| 300 | + |
|
| 301 | + $old_html_variable = ''; |
|
| 302 | + |
|
| 303 | + $data_type = trim($request_field['data_type']); |
|
| 304 | + |
|
| 305 | + $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
|
| 306 | + |
|
| 307 | + // some servers fail if a POST value is VARCHAR so we change it. |
|
| 308 | + if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
|
|
| 309 | + $request_field['data_type'] = 'VARCHAR'; |
|
| 310 | + } |
|
| 311 | + |
|
| 312 | + $cf = trim($result_str, '_'); |
|
| 313 | + |
|
| 314 | + |
|
| 315 | + /*-------- check duplicate validation --------*/ |
|
| 316 | + |
|
| 317 | + $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 318 | + $post_type = $request_field['listing_type']; |
|
| 319 | + |
|
| 320 | + if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
|
|
| 321 | + $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name; |
|
| 322 | + } |
|
| 323 | + |
|
| 324 | + $check_html_variable = $wpdb->get_var( |
|
| 325 | + $wpdb->prepare( |
|
| 326 | + "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ", |
|
| 327 | + array($cf, $cehhtmlvar_name, $post_type) |
|
| 328 | + ) |
|
| 329 | + ); |
|
| 330 | + |
|
| 331 | + |
|
| 332 | + if (!$check_html_variable || $request_field['field_type'] == 'fieldset') {
|
|
| 333 | + |
|
| 334 | + if ($cf != '') {
|
|
| 335 | + |
|
| 336 | + $post_meta_info = $wpdb->get_row( |
|
| 337 | + $wpdb->prepare( |
|
| 338 | + "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d", |
|
| 339 | + array($cf) |
|
| 340 | + ) |
|
| 341 | + ); |
|
| 342 | + |
|
| 343 | + } |
|
| 344 | + |
|
| 345 | + if (!empty($post_meta_info)) {
|
|
| 346 | + $post_val = $post_meta_info; |
|
| 347 | + $old_html_variable = $post_val->htmlvar_name; |
|
| 348 | + |
|
| 349 | + } |
|
| 350 | + |
|
| 351 | + |
|
| 352 | + |
|
| 353 | + if ($post_type == '') $post_type = 'gd_place'; |
|
| 354 | + |
|
| 355 | + |
|
| 356 | + $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
| 357 | + |
|
| 358 | + $admin_title = $request_field['admin_title']; |
|
| 359 | + $site_title = $request_field['site_title']; |
|
| 360 | + $data_type = $request_field['data_type']; |
|
| 361 | + $field_type = $request_field['field_type']; |
|
| 362 | + $field_type_key = isset($request_field['field_type_key']) ? $request_field['field_type_key'] : $field_type; |
|
| 363 | + $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 364 | + $admin_desc = $request_field['admin_desc']; |
|
| 365 | + $clabels = $request_field['clabels']; |
|
| 366 | + $default_value = isset($request_field['default_value']) ? $request_field['default_value'] : ''; |
|
| 367 | + $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : ''; |
|
| 368 | + $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : ''; |
|
| 369 | + $is_required = isset($request_field['is_required']) ? $request_field['is_required'] : ''; |
|
| 370 | + $required_msg = isset($request_field['required_msg']) ? $request_field['required_msg'] : ''; |
|
| 371 | + $css_class = isset($request_field['css_class']) ? $request_field['css_class'] : ''; |
|
| 372 | + $field_icon = isset($request_field['field_icon']) ? $request_field['field_icon'] : ''; |
|
| 373 | + $show_on_listing = isset($request_field['show_on_listing']) ? $request_field['show_on_listing'] : ''; |
|
| 374 | + $show_in = isset($request_field['show_in']) ? $request_field['show_in'] : ''; |
|
| 375 | + $show_on_detail = isset($request_field['show_on_detail']) ? $request_field['show_on_detail'] : ''; |
|
| 376 | + $show_as_tab = isset($request_field['show_as_tab']) ? $request_field['show_as_tab'] : ''; |
|
| 377 | + $decimal_point = isset($request_field['decimal_point']) ? trim($request_field['decimal_point']) : ''; // decimal point for DECIMAL data type |
|
| 378 | + $decimal_point = $decimal_point > 0 ? ($decimal_point > 10 ? 10 : $decimal_point) : ''; |
|
| 379 | + $validation_pattern = isset($request_field['validation_pattern']) ? $request_field['validation_pattern'] : ''; |
|
| 380 | + $validation_msg = isset($request_field['validation_msg']) ? $request_field['validation_msg'] : ''; |
|
| 381 | + $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : ''; |
|
| 382 | 382 | |
| 383 | 383 | |
| 384 | - if(is_array($show_in)){
|
|
| 385 | - $show_in = implode(",", $request_field['show_in']);
|
|
| 386 | - } |
|
| 384 | + if(is_array($show_in)){
|
|
| 385 | + $show_in = implode(",", $request_field['show_in']);
|
|
| 386 | + } |
|
| 387 | 387 | |
| 388 | - if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
|
|
| 389 | - $htmlvar_name = 'geodir_' . $htmlvar_name; |
|
| 390 | - } |
|
| 388 | + if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
|
|
| 389 | + $htmlvar_name = 'geodir_' . $htmlvar_name; |
|
| 390 | + } |
|
| 391 | 391 | |
| 392 | - $option_values = ''; |
|
| 393 | - if (isset($request_field['option_values'])) |
|
| 394 | - $option_values = $request_field['option_values']; |
|
| 392 | + $option_values = ''; |
|
| 393 | + if (isset($request_field['option_values'])) |
|
| 394 | + $option_values = $request_field['option_values']; |
|
| 395 | 395 | |
| 396 | - $cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0'; |
|
| 396 | + $cat_sort = isset($request_field['cat_sort']) ? $request_field['cat_sort'] : '0'; |
|
| 397 | 397 | |
| 398 | - $cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0'; |
|
| 398 | + $cat_filter = isset($request_field['cat_filter']) ? $request_field['cat_filter'] : '0'; |
|
| 399 | 399 | |
| 400 | - if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) |
|
| 401 | - $price_pkg = implode(",", $request_field['show_on_pkg']);
|
|
| 402 | - else {
|
|
| 403 | - $package_info = array(); |
|
| 400 | + if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) |
|
| 401 | + $price_pkg = implode(",", $request_field['show_on_pkg']);
|
|
| 402 | + else {
|
|
| 403 | + $package_info = array(); |
|
| 404 | 404 | |
| 405 | - $package_info = geodir_post_package_info($package_info, '', $post_type); |
|
| 406 | - $price_pkg = !empty($package_info->pid) ? $package_info->pid : ''; |
|
| 407 | - } |
|
| 405 | + $package_info = geodir_post_package_info($package_info, '', $post_type); |
|
| 406 | + $price_pkg = !empty($package_info->pid) ? $package_info->pid : ''; |
|
| 407 | + } |
|
| 408 | 408 | |
| 409 | 409 | |
| 410 | - if (isset($request_field['extra']) && !empty($request_field['extra'])) |
|
| 411 | - $extra_fields = $request_field['extra']; |
|
| 410 | + if (isset($request_field['extra']) && !empty($request_field['extra'])) |
|
| 411 | + $extra_fields = $request_field['extra']; |
|
| 412 | 412 | |
| 413 | - if (isset($request_field['is_default']) && $request_field['is_default'] != '') |
|
| 414 | - $is_default = $request_field['is_default']; |
|
| 415 | - else |
|
| 416 | - $is_default = '0'; |
|
| 413 | + if (isset($request_field['is_default']) && $request_field['is_default'] != '') |
|
| 414 | + $is_default = $request_field['is_default']; |
|
| 415 | + else |
|
| 416 | + $is_default = '0'; |
|
| 417 | 417 | |
| 418 | - if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') |
|
| 419 | - $is_admin = $request_field['is_admin']; |
|
| 420 | - else |
|
| 421 | - $is_admin = '0'; |
|
| 418 | + if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') |
|
| 419 | + $is_admin = $request_field['is_admin']; |
|
| 420 | + else |
|
| 421 | + $is_admin = '0'; |
|
| 422 | 422 | |
| 423 | 423 | |
| 424 | - if ($is_active == '') $is_active = 1; |
|
| 425 | - if ($is_required == '') $is_required = 0; |
|
| 424 | + if ($is_active == '') $is_active = 1; |
|
| 425 | + if ($is_required == '') $is_required = 0; |
|
| 426 | 426 | |
| 427 | 427 | |
| 428 | - if ($sort_order == '') {
|
|
| 428 | + if ($sort_order == '') {
|
|
| 429 | 429 | |
| 430 | - $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 430 | + $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 431 | 431 | |
| 432 | - $sort_order = (int)$last_order + 1; |
|
| 433 | - } |
|
| 432 | + $sort_order = (int)$last_order + 1; |
|
| 433 | + } |
|
| 434 | 434 | |
| 435 | - $default_value_add = ''; |
|
| 435 | + $default_value_add = ''; |
|
| 436 | 436 | |
| 437 | 437 | |
| 438 | - if (!empty($post_meta_info)) {
|
|
| 439 | - switch ($field_type): |
|
| 438 | + if (!empty($post_meta_info)) {
|
|
| 439 | + switch ($field_type): |
|
| 440 | 440 | |
| 441 | - case 'address': |
|
| 441 | + case 'address': |
|
| 442 | 442 | |
| 443 | - if ($htmlvar_name != '') {
|
|
| 444 | - $prefix = $htmlvar_name . '_'; |
|
| 445 | - } |
|
| 446 | - $old_prefix = $old_html_variable . '_'; |
|
| 443 | + if ($htmlvar_name != '') {
|
|
| 444 | + $prefix = $htmlvar_name . '_'; |
|
| 445 | + } |
|
| 446 | + $old_prefix = $old_html_variable . '_'; |
|
| 447 | 447 | |
| 448 | 448 | |
| 449 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL"; |
|
| 449 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL"; |
|
| 450 | 450 | |
| 451 | - if ($default_value != '') {
|
|
| 452 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 453 | - } |
|
| 451 | + if ($default_value != '') {
|
|
| 452 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 453 | + } |
|
| 454 | 454 | |
| 455 | - $wpdb->query($meta_field_add); |
|
| 455 | + $wpdb->query($meta_field_add); |
|
| 456 | 456 | |
| 457 | - if ($extra_fields != '') {
|
|
| 457 | + if ($extra_fields != '') {
|
|
| 458 | 458 | |
| 459 | - if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
|
| 459 | + if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
|
| 460 | 460 | |
| 461 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
|
|
| 462 | - if ($is_column) {
|
|
| 463 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL"; |
|
| 461 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
|
|
| 462 | + if ($is_column) {
|
|
| 463 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL"; |
|
| 464 | 464 | |
| 465 | - if ($default_value != '') {
|
|
| 466 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 467 | - } |
|
| 465 | + if ($default_value != '') {
|
|
| 466 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 467 | + } |
|
| 468 | 468 | |
| 469 | - $wpdb->query($meta_field_add); |
|
| 470 | - } else {
|
|
| 469 | + $wpdb->query($meta_field_add); |
|
| 470 | + } else {
|
|
| 471 | 471 | |
| 472 | - $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 473 | - if ($default_value != '') {
|
|
| 474 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 475 | - } |
|
| 476 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 472 | + $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 473 | + if ($default_value != '') {
|
|
| 474 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 475 | + } |
|
| 476 | + geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 477 | 477 | |
| 478 | - } |
|
| 478 | + } |
|
| 479 | 479 | |
| 480 | 480 | |
| 481 | - } |
|
| 481 | + } |
|
| 482 | 482 | |
| 483 | 483 | |
| 484 | - if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
|
| 484 | + if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
|
| 485 | 485 | |
| 486 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
|
|
| 486 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
|
|
| 487 | 487 | |
| 488 | - if ($is_column) {
|
|
| 489 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL"; |
|
| 488 | + if ($is_column) {
|
|
| 489 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL"; |
|
| 490 | 490 | |
| 491 | - if ($default_value != '') {
|
|
| 492 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 493 | - } |
|
| 491 | + if ($default_value != '') {
|
|
| 492 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 493 | + } |
|
| 494 | 494 | |
| 495 | - $wpdb->query($meta_field_add); |
|
| 496 | - } else {
|
|
| 497 | - $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 498 | - if ($default_value != '') {
|
|
| 499 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 500 | - } |
|
| 495 | + $wpdb->query($meta_field_add); |
|
| 496 | + } else {
|
|
| 497 | + $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 498 | + if ($default_value != '') {
|
|
| 499 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 500 | + } |
|
| 501 | 501 | |
| 502 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 503 | - } |
|
| 502 | + geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 503 | + } |
|
| 504 | 504 | |
| 505 | - } |
|
| 506 | - if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
|
| 505 | + } |
|
| 506 | + if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
|
| 507 | 507 | |
| 508 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
|
|
| 508 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
|
|
| 509 | 509 | |
| 510 | - if ($is_column) {
|
|
| 510 | + if ($is_column) {
|
|
| 511 | 511 | |
| 512 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL"; |
|
| 512 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL"; |
|
| 513 | 513 | |
| 514 | - if ($default_value != '') {
|
|
| 515 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 516 | - } |
|
| 514 | + if ($default_value != '') {
|
|
| 515 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 516 | + } |
|
| 517 | 517 | |
| 518 | - $wpdb->query($meta_field_add); |
|
| 519 | - } else {
|
|
| 518 | + $wpdb->query($meta_field_add); |
|
| 519 | + } else {
|
|
| 520 | 520 | |
| 521 | - $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 522 | - if ($default_value != '') {
|
|
| 523 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 524 | - } |
|
| 521 | + $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 522 | + if ($default_value != '') {
|
|
| 523 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 524 | + } |
|
| 525 | 525 | |
| 526 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 526 | + geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 527 | 527 | |
| 528 | - } |
|
| 528 | + } |
|
| 529 | 529 | |
| 530 | - } |
|
| 531 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
|
| 530 | + } |
|
| 531 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
|
| 532 | 532 | |
| 533 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
|
|
| 533 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
|
|
| 534 | 534 | |
| 535 | - if ($is_column) {
|
|
| 535 | + if ($is_column) {
|
|
| 536 | 536 | |
| 537 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL"; |
|
| 537 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL"; |
|
| 538 | 538 | |
| 539 | - if ($default_value != '') {
|
|
| 540 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 541 | - } |
|
| 539 | + if ($default_value != '') {
|
|
| 540 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 541 | + } |
|
| 542 | 542 | |
| 543 | - $wpdb->query($meta_field_add); |
|
| 544 | - } else {
|
|
| 543 | + $wpdb->query($meta_field_add); |
|
| 544 | + } else {
|
|
| 545 | 545 | |
| 546 | - $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 547 | - if ($default_value != '') {
|
|
| 548 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 549 | - } |
|
| 546 | + $meta_field_add = "VARCHAR( 50 ) NULL"; |
|
| 547 | + if ($default_value != '') {
|
|
| 548 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 549 | + } |
|
| 550 | 550 | |
| 551 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 551 | + geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 552 | 552 | |
| 553 | - } |
|
| 553 | + } |
|
| 554 | 554 | |
| 555 | - } |
|
| 556 | - if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
|
| 555 | + } |
|
| 556 | + if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
|
| 557 | 557 | |
| 558 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
|
|
| 559 | - if ($is_column) {
|
|
| 558 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
|
|
| 559 | + if ($is_column) {
|
|
| 560 | 560 | |
| 561 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 561 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 562 | 562 | |
| 563 | - if ($default_value != '') {
|
|
| 564 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 565 | - } |
|
| 563 | + if ($default_value != '') {
|
|
| 564 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 565 | + } |
|
| 566 | 566 | |
| 567 | - $wpdb->query($meta_field_add); |
|
| 568 | - } else {
|
|
| 567 | + $wpdb->query($meta_field_add); |
|
| 568 | + } else {
|
|
| 569 | 569 | |
| 570 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 571 | - $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 572 | - if ($default_value != '') {
|
|
| 573 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 574 | - } |
|
| 570 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 571 | + $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 572 | + if ($default_value != '') {
|
|
| 573 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 574 | + } |
|
| 575 | 575 | |
| 576 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 576 | + geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 577 | 577 | |
| 578 | - } |
|
| 578 | + } |
|
| 579 | 579 | |
| 580 | 580 | |
| 581 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
|
|
| 581 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
|
|
| 582 | 582 | |
| 583 | - if ($is_column) {
|
|
| 584 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 583 | + if ($is_column) {
|
|
| 584 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 585 | 585 | |
| 586 | - if ($default_value != '') {
|
|
| 587 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 588 | - } |
|
| 586 | + if ($default_value != '') {
|
|
| 587 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 588 | + } |
|
| 589 | 589 | |
| 590 | - $wpdb->query($meta_field_add); |
|
| 591 | - } else {
|
|
| 590 | + $wpdb->query($meta_field_add); |
|
| 591 | + } else {
|
|
| 592 | 592 | |
| 593 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 594 | - $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 595 | - if ($default_value != '') {
|
|
| 596 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 597 | - } |
|
| 593 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 594 | + $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 595 | + if ($default_value != '') {
|
|
| 596 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 597 | + } |
|
| 598 | 598 | |
| 599 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 600 | - } |
|
| 599 | + geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 600 | + } |
|
| 601 | 601 | |
| 602 | - } |
|
| 603 | - if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
|
| 602 | + } |
|
| 603 | + if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
|
| 604 | 604 | |
| 605 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
|
|
| 605 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
|
|
| 606 | 606 | |
| 607 | - if ($is_column) {
|
|
| 608 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 607 | + if ($is_column) {
|
|
| 608 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 609 | 609 | |
| 610 | - if ($default_value != '') {
|
|
| 611 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 612 | - } |
|
| 610 | + if ($default_value != '') {
|
|
| 611 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 612 | + } |
|
| 613 | 613 | |
| 614 | - $wpdb->query($meta_field_add); |
|
| 615 | - } else {
|
|
| 614 | + $wpdb->query($meta_field_add); |
|
| 615 | + } else {
|
|
| 616 | 616 | |
| 617 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 617 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 618 | 618 | |
| 619 | - $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 620 | - if ($default_value != '') {
|
|
| 621 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 622 | - } |
|
| 619 | + $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 620 | + if ($default_value != '') {
|
|
| 621 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 622 | + } |
|
| 623 | 623 | |
| 624 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 625 | - } |
|
| 624 | + geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 625 | + } |
|
| 626 | 626 | |
| 627 | 627 | |
| 628 | - } |
|
| 629 | - if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
|
| 628 | + } |
|
| 629 | + if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
|
| 630 | 630 | |
| 631 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
|
|
| 632 | - if ($is_column) {
|
|
| 633 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 631 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
|
|
| 632 | + if ($is_column) {
|
|
| 633 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 634 | 634 | |
| 635 | - if ($default_value != '') {
|
|
| 636 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 637 | - } |
|
| 635 | + if ($default_value != '') {
|
|
| 636 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 637 | + } |
|
| 638 | 638 | |
| 639 | - $wpdb->query($meta_field_add); |
|
| 639 | + $wpdb->query($meta_field_add); |
|
| 640 | 640 | |
| 641 | - } else {
|
|
| 641 | + } else {
|
|
| 642 | 642 | |
| 643 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 643 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 644 | 644 | |
| 645 | - $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 646 | - if ($default_value != '') {
|
|
| 647 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 648 | - } |
|
| 645 | + $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 646 | + if ($default_value != '') {
|
|
| 647 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 648 | + } |
|
| 649 | 649 | |
| 650 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 651 | - } |
|
| 650 | + geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 651 | + } |
|
| 652 | 652 | |
| 653 | - } |
|
| 654 | - // show lat lng |
|
| 655 | - if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
|
| 656 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
|
|
| 653 | + } |
|
| 654 | + // show lat lng |
|
| 655 | + if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
|
| 656 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
|
|
| 657 | 657 | |
| 658 | - if ($is_column) {
|
|
| 659 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 660 | - $meta_field_add .= " DEFAULT '1'"; |
|
| 658 | + if ($is_column) {
|
|
| 659 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 660 | + $meta_field_add .= " DEFAULT '1'"; |
|
| 661 | 661 | |
| 662 | - $wpdb->query($meta_field_add); |
|
| 663 | - } else {
|
|
| 664 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 662 | + $wpdb->query($meta_field_add); |
|
| 663 | + } else {
|
|
| 664 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 665 | 665 | |
| 666 | - $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 667 | - $meta_field_add .= " DEFAULT '1'"; |
|
| 666 | + $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 667 | + $meta_field_add .= " DEFAULT '1'"; |
|
| 668 | 668 | |
| 669 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 670 | - } |
|
| 669 | + geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 670 | + } |
|
| 671 | 671 | |
| 672 | - } |
|
| 673 | - }// end extra |
|
| 672 | + } |
|
| 673 | + }// end extra |
|
| 674 | 674 | |
| 675 | - break; |
|
| 675 | + break; |
|
| 676 | 676 | |
| 677 | - case 'checkbox': |
|
| 678 | - case 'multiselect': |
|
| 679 | - case 'select': |
|
| 680 | - case 'taxonomy': |
|
| 677 | + case 'checkbox': |
|
| 678 | + case 'multiselect': |
|
| 679 | + case 'select': |
|
| 680 | + case 'taxonomy': |
|
| 681 | 681 | |
| 682 | - $op_size = '500'; |
|
| 682 | + $op_size = '500'; |
|
| 683 | 683 | |
| 684 | - // only make the field as big as it needs to be. |
|
| 685 | - if(isset($option_values) && $option_values && $field_type=='select'){
|
|
| 686 | - $option_values_arr = explode(',',$option_values);
|
|
| 687 | - if(is_array($option_values_arr)){
|
|
| 688 | - $op_max = 0; |
|
| 689 | - foreach($option_values_arr as $op_val){
|
|
| 690 | - if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
|
|
| 691 | - } |
|
| 692 | - if($op_max){$op_size =$op_max; }
|
|
| 693 | - } |
|
| 694 | - }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
|
|
| 695 | - if(strlen($option_values)){
|
|
| 696 | - $op_size = strlen($option_values); |
|
| 697 | - } |
|
| 698 | - } |
|
| 684 | + // only make the field as big as it needs to be. |
|
| 685 | + if(isset($option_values) && $option_values && $field_type=='select'){
|
|
| 686 | + $option_values_arr = explode(',',$option_values);
|
|
| 687 | + if(is_array($option_values_arr)){
|
|
| 688 | + $op_max = 0; |
|
| 689 | + foreach($option_values_arr as $op_val){
|
|
| 690 | + if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
|
|
| 691 | + } |
|
| 692 | + if($op_max){$op_size =$op_max; }
|
|
| 693 | + } |
|
| 694 | + }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
|
|
| 695 | + if(strlen($option_values)){
|
|
| 696 | + $op_size = strlen($option_values); |
|
| 697 | + } |
|
| 698 | + } |
|
| 699 | 699 | |
| 700 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL"; |
|
| 700 | + $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL"; |
|
| 701 | 701 | |
| 702 | - if ($default_value != '') {
|
|
| 703 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 704 | - } |
|
| 702 | + if ($default_value != '') {
|
|
| 703 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 704 | + } |
|
| 705 | 705 | |
| 706 | - $alter_result = $wpdb->query($meta_field_add); |
|
| 707 | - if($alter_result===false){
|
|
| 708 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 709 | - } |
|
| 706 | + $alter_result = $wpdb->query($meta_field_add); |
|
| 707 | + if($alter_result===false){
|
|
| 708 | + return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 709 | + } |
|
| 710 | 710 | |
| 711 | - if (isset($request_field['cat_display_type'])) |
|
| 712 | - $extra_fields = $request_field['cat_display_type']; |
|
| 711 | + if (isset($request_field['cat_display_type'])) |
|
| 712 | + $extra_fields = $request_field['cat_display_type']; |
|
| 713 | 713 | |
| 714 | - if (isset($request_field['multi_display_type'])) |
|
| 715 | - $extra_fields = $request_field['multi_display_type']; |
|
| 714 | + if (isset($request_field['multi_display_type'])) |
|
| 715 | + $extra_fields = $request_field['multi_display_type']; |
|
| 716 | 716 | |
| 717 | 717 | |
| 718 | - break; |
|
| 718 | + break; |
|
| 719 | 719 | |
| 720 | - case 'textarea': |
|
| 721 | - case 'html': |
|
| 722 | - case 'url': |
|
| 723 | - case 'file': |
|
| 720 | + case 'textarea': |
|
| 721 | + case 'html': |
|
| 722 | + case 'url': |
|
| 723 | + case 'file': |
|
| 724 | 724 | |
| 725 | - $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
|
|
| 726 | - if($alter_result===false){
|
|
| 727 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 728 | - } |
|
| 729 | - if (isset($request_field['advanced_editor'])) |
|
| 730 | - $extra_fields = $request_field['advanced_editor']; |
|
| 731 | - |
|
| 732 | - break; |
|
| 725 | + $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
|
|
| 726 | + if($alter_result===false){
|
|
| 727 | + return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 728 | + } |
|
| 729 | + if (isset($request_field['advanced_editor'])) |
|
| 730 | + $extra_fields = $request_field['advanced_editor']; |
|
| 731 | + |
|
| 732 | + break; |
|
| 733 | 733 | |
| 734 | - case 'fieldset': |
|
| 735 | - // Nothing happened for fieldset |
|
| 736 | - break; |
|
| 734 | + case 'fieldset': |
|
| 735 | + // Nothing happened for fieldset |
|
| 736 | + break; |
|
| 737 | 737 | |
| 738 | - default: |
|
| 739 | - if ($data_type != 'VARCHAR' && $data_type != '') {
|
|
| 740 | - if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
|
| 741 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL"; |
|
| 742 | - } else {
|
|
| 743 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL"; |
|
| 744 | - } |
|
| 745 | - |
|
| 746 | - if (is_numeric($default_value) && $default_value != '') {
|
|
| 747 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 748 | - } |
|
| 749 | - } else {
|
|
| 750 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL"; |
|
| 751 | - if ($default_value != '') {
|
|
| 752 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 753 | - } |
|
| 754 | - } |
|
| 755 | - |
|
| 756 | - $alter_result = $wpdb->query($default_value_add); |
|
| 757 | - if($alter_result===false){
|
|
| 758 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 759 | - } |
|
| 760 | - break; |
|
| 761 | - endswitch; |
|
| 762 | - |
|
| 763 | - $extra_field_query = ''; |
|
| 764 | - if (!empty($extra_fields)) {
|
|
| 765 | - $extra_field_query = serialize($extra_fields); |
|
| 766 | - } |
|
| 767 | - |
|
| 768 | - $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : ''; |
|
| 769 | - |
|
| 770 | - $wpdb->query( |
|
| 771 | - |
|
| 772 | - $wpdb->prepare( |
|
| 773 | - |
|
| 774 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 738 | + default: |
|
| 739 | + if ($data_type != 'VARCHAR' && $data_type != '') {
|
|
| 740 | + if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
|
| 741 | + $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL"; |
|
| 742 | + } else {
|
|
| 743 | + $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL"; |
|
| 744 | + } |
|
| 745 | + |
|
| 746 | + if (is_numeric($default_value) && $default_value != '') {
|
|
| 747 | + $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 748 | + } |
|
| 749 | + } else {
|
|
| 750 | + $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL"; |
|
| 751 | + if ($default_value != '') {
|
|
| 752 | + $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 753 | + } |
|
| 754 | + } |
|
| 755 | + |
|
| 756 | + $alter_result = $wpdb->query($default_value_add); |
|
| 757 | + if($alter_result===false){
|
|
| 758 | + return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 759 | + } |
|
| 760 | + break; |
|
| 761 | + endswitch; |
|
| 762 | + |
|
| 763 | + $extra_field_query = ''; |
|
| 764 | + if (!empty($extra_fields)) {
|
|
| 765 | + $extra_field_query = serialize($extra_fields); |
|
| 766 | + } |
|
| 767 | + |
|
| 768 | + $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : ''; |
|
| 769 | + |
|
| 770 | + $wpdb->query( |
|
| 771 | + |
|
| 772 | + $wpdb->prepare( |
|
| 773 | + |
|
| 774 | + "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 775 | 775 | post_type = %s, |
| 776 | 776 | admin_title = %s, |
| 777 | 777 | site_title = %s, |
@@ -805,308 +805,308 @@ discard block |
||
| 805 | 805 | for_admin_use = %s |
| 806 | 806 | where id = %d", |
| 807 | 807 | |
| 808 | - array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf) |
|
| 809 | - ) |
|
| 808 | + array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf) |
|
| 809 | + ) |
|
| 810 | 810 | |
| 811 | - ); |
|
| 811 | + ); |
|
| 812 | 812 | |
| 813 | - $lastid = trim($cf); |
|
| 813 | + $lastid = trim($cf); |
|
| 814 | 814 | |
| 815 | 815 | |
| 816 | - $wpdb->query( |
|
| 817 | - $wpdb->prepare( |
|
| 818 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 816 | + $wpdb->query( |
|
| 817 | + $wpdb->prepare( |
|
| 818 | + "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 819 | 819 | site_title=%s |
| 820 | 820 | where post_type = %s and htmlvar_name = %s", |
| 821 | - array($site_title, $post_type, $htmlvar_name) |
|
| 822 | - ) |
|
| 823 | - ); |
|
| 824 | - |
|
| 825 | - |
|
| 826 | - if ($cat_sort == '') |
|
| 827 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 828 | - |
|
| 829 | - |
|
| 830 | - /** |
|
| 831 | - * Called after all custom fields are saved for a post. |
|
| 832 | - * |
|
| 833 | - * @since 1.0.0 |
|
| 834 | - * @param int $lastid The post ID. |
|
| 835 | - */ |
|
| 836 | - do_action('geodir_after_custom_fields_updated', $lastid);
|
|
| 837 | - |
|
| 838 | - } else {
|
|
| 839 | - |
|
| 840 | - switch ($field_type): |
|
| 841 | - |
|
| 842 | - case 'address': |
|
| 843 | - |
|
| 844 | - $data_type = ''; |
|
| 845 | - |
|
| 846 | - if ($htmlvar_name != '') {
|
|
| 847 | - $prefix = $htmlvar_name . '_'; |
|
| 848 | - } |
|
| 849 | - $old_prefix = $old_html_variable; |
|
| 850 | - |
|
| 851 | - //$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL"; |
|
| 852 | - |
|
| 853 | - $meta_field_add = "VARCHAR( 254 ) NULL"; |
|
| 854 | - if ($default_value != '') {
|
|
| 855 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 856 | - } |
|
| 857 | - |
|
| 858 | - geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add); |
|
| 859 | - //$wpdb->query($meta_field_add); |
|
| 860 | - |
|
| 861 | - |
|
| 862 | - if (!empty($extra_fields)) {
|
|
| 821 | + array($site_title, $post_type, $htmlvar_name) |
|
| 822 | + ) |
|
| 823 | + ); |
|
| 824 | + |
|
| 825 | + |
|
| 826 | + if ($cat_sort == '') |
|
| 827 | + $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 828 | + |
|
| 829 | + |
|
| 830 | + /** |
|
| 831 | + * Called after all custom fields are saved for a post. |
|
| 832 | + * |
|
| 833 | + * @since 1.0.0 |
|
| 834 | + * @param int $lastid The post ID. |
|
| 835 | + */ |
|
| 836 | + do_action('geodir_after_custom_fields_updated', $lastid);
|
|
| 837 | + |
|
| 838 | + } else {
|
|
| 839 | + |
|
| 840 | + switch ($field_type): |
|
| 841 | + |
|
| 842 | + case 'address': |
|
| 843 | + |
|
| 844 | + $data_type = ''; |
|
| 845 | + |
|
| 846 | + if ($htmlvar_name != '') {
|
|
| 847 | + $prefix = $htmlvar_name . '_'; |
|
| 848 | + } |
|
| 849 | + $old_prefix = $old_html_variable; |
|
| 850 | + |
|
| 851 | + //$meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."address` VARCHAR( 254 ) NULL"; |
|
| 852 | + |
|
| 853 | + $meta_field_add = "VARCHAR( 254 ) NULL"; |
|
| 854 | + if ($default_value != '') {
|
|
| 855 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 856 | + } |
|
| 857 | + |
|
| 858 | + geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add); |
|
| 859 | + //$wpdb->query($meta_field_add); |
|
| 860 | + |
|
| 861 | + |
|
| 862 | + if (!empty($extra_fields)) {
|
|
| 863 | 863 | |
| 864 | - if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
|
| 865 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL"; |
|
| 866 | - $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 867 | - if ($default_value != '') {
|
|
| 868 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 869 | - } |
|
| 870 | - |
|
| 871 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 872 | - //$wpdb->query($meta_field_add); |
|
| 873 | - } |
|
| 874 | - if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
|
| 875 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL"; |
|
| 876 | - $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 877 | - if ($default_value != '') {
|
|
| 878 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 879 | - } |
|
| 880 | - |
|
| 881 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 882 | - //$wpdb->query($meta_field_add); |
|
| 883 | - } |
|
| 884 | - if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
|
| 885 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL"; |
|
| 886 | - |
|
| 887 | - $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 888 | - if ($default_value != '') {
|
|
| 889 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 890 | - } |
|
| 891 | - |
|
| 892 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 893 | - //$wpdb->query($meta_field_add); |
|
| 894 | - } |
|
| 895 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
|
| 896 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL"; |
|
| 897 | - $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 898 | - if ($default_value != '') {
|
|
| 899 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 900 | - } |
|
| 901 | - |
|
| 902 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 903 | - //$wpdb->query($meta_field_add); |
|
| 904 | - } |
|
| 905 | - if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
|
| 906 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 907 | - $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 908 | - if ($default_value != '') {
|
|
| 909 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 910 | - } |
|
| 911 | - |
|
| 912 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 913 | - //$wpdb->query($meta_field_add); |
|
| 914 | - |
|
| 915 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 916 | - |
|
| 917 | - $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 918 | - if ($default_value != '') {
|
|
| 919 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 920 | - } |
|
| 921 | - |
|
| 922 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 923 | - |
|
| 924 | - //$wpdb->query($meta_field_add); |
|
| 925 | - } |
|
| 926 | - if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
|
| 927 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 928 | - |
|
| 929 | - $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 930 | - if ($default_value != '') {
|
|
| 931 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 932 | - } |
|
| 933 | - |
|
| 934 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 935 | - |
|
| 936 | - //$wpdb->query($meta_field_add); |
|
| 937 | - } |
|
| 938 | - if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
|
| 939 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 940 | - |
|
| 941 | - $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 942 | - if ($default_value != '') {
|
|
| 943 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 944 | - } |
|
| 945 | - |
|
| 946 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 947 | - |
|
| 948 | - //$wpdb->query($meta_field_add); |
|
| 949 | - } |
|
| 950 | - // show lat lng |
|
| 951 | - if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
|
| 952 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 953 | - |
|
| 954 | - $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 955 | - $meta_field_add .= " DEFAULT '1'"; |
|
| 956 | - |
|
| 957 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 958 | - //$wpdb->query($meta_field_add); |
|
| 959 | - } |
|
| 960 | - } |
|
| 961 | - |
|
| 962 | - break; |
|
| 963 | - |
|
| 964 | - case 'checkbox': |
|
| 965 | - $data_type = 'TINYINT'; |
|
| 966 | - |
|
| 967 | - $meta_field_add = $data_type . "( 1 ) NOT NULL "; |
|
| 968 | - if ((int)$default_value === 1) {
|
|
| 969 | - $meta_field_add .= " DEFAULT '1'"; |
|
| 970 | - } |
|
| 971 | - |
|
| 972 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 973 | - if ($add_result === false) {
|
|
| 974 | - return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 975 | - } |
|
| 976 | - break; |
|
| 977 | - case 'multiselect': |
|
| 978 | - case 'select': |
|
| 979 | - $data_type = 'VARCHAR'; |
|
| 980 | - $op_size = '500'; |
|
| 981 | - |
|
| 982 | - // only make the field as big as it needs to be. |
|
| 983 | - if (isset($option_values) && $option_values && $field_type == 'select') {
|
|
| 984 | - $option_values_arr = explode(',', $option_values);
|
|
| 985 | - |
|
| 986 | - if (is_array($option_values_arr)) {
|
|
| 987 | - $op_max = 0; |
|
| 988 | - |
|
| 989 | - foreach ($option_values_arr as $op_val) {
|
|
| 990 | - if (strlen($op_val) && strlen($op_val) > $op_max) {
|
|
| 991 | - $op_max = strlen($op_val); |
|
| 992 | - } |
|
| 993 | - } |
|
| 994 | - |
|
| 995 | - if ($op_max) {
|
|
| 996 | - $op_size = $op_max; |
|
| 997 | - } |
|
| 998 | - } |
|
| 999 | - } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
|
|
| 1000 | - if (strlen($option_values)) {
|
|
| 1001 | - $op_size = strlen($option_values); |
|
| 1002 | - } |
|
| 1003 | - |
|
| 1004 | - if (isset($request_field['multi_display_type'])) {
|
|
| 1005 | - $extra_fields = $request_field['multi_display_type']; |
|
| 1006 | - } |
|
| 1007 | - } |
|
| 1008 | - |
|
| 1009 | - $meta_field_add = $data_type . "( $op_size ) NULL "; |
|
| 1010 | - if ($default_value != '') {
|
|
| 1011 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1012 | - } |
|
| 1013 | - |
|
| 1014 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1015 | - if ($add_result === false) {
|
|
| 1016 | - return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1017 | - } |
|
| 1018 | - break; |
|
| 1019 | - case 'textarea': |
|
| 1020 | - case 'html': |
|
| 1021 | - case 'url': |
|
| 1022 | - case 'file': |
|
| 1023 | - |
|
| 1024 | - $data_type = 'TEXT'; |
|
| 1025 | - |
|
| 1026 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1027 | - |
|
| 1028 | - $meta_field_add = $data_type . " NULL "; |
|
| 1029 | - /*if($default_value != '') |
|
| 864 | + if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
|
| 865 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL"; |
|
| 866 | + $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 867 | + if ($default_value != '') {
|
|
| 868 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 869 | + } |
|
| 870 | + |
|
| 871 | + geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 872 | + //$wpdb->query($meta_field_add); |
|
| 873 | + } |
|
| 874 | + if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
|
| 875 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL"; |
|
| 876 | + $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 877 | + if ($default_value != '') {
|
|
| 878 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 879 | + } |
|
| 880 | + |
|
| 881 | + geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 882 | + //$wpdb->query($meta_field_add); |
|
| 883 | + } |
|
| 884 | + if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
|
| 885 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL"; |
|
| 886 | + |
|
| 887 | + $meta_field_add = "VARCHAR( 30 ) NULL"; |
|
| 888 | + if ($default_value != '') {
|
|
| 889 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 890 | + } |
|
| 891 | + |
|
| 892 | + geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 893 | + //$wpdb->query($meta_field_add); |
|
| 894 | + } |
|
| 895 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
|
| 896 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL"; |
|
| 897 | + $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 898 | + if ($default_value != '') {
|
|
| 899 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 900 | + } |
|
| 901 | + |
|
| 902 | + geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 903 | + //$wpdb->query($meta_field_add); |
|
| 904 | + } |
|
| 905 | + if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
|
| 906 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 907 | + $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 908 | + if ($default_value != '') {
|
|
| 909 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 910 | + } |
|
| 911 | + |
|
| 912 | + geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 913 | + //$wpdb->query($meta_field_add); |
|
| 914 | + |
|
| 915 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 916 | + |
|
| 917 | + $meta_field_add = "VARCHAR( 20 ) NULL"; |
|
| 918 | + if ($default_value != '') {
|
|
| 919 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 920 | + } |
|
| 921 | + |
|
| 922 | + geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 923 | + |
|
| 924 | + //$wpdb->query($meta_field_add); |
|
| 925 | + } |
|
| 926 | + if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
|
| 927 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 928 | + |
|
| 929 | + $meta_field_add = "VARCHAR( 15 ) NULL"; |
|
| 930 | + if ($default_value != '') {
|
|
| 931 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 932 | + } |
|
| 933 | + |
|
| 934 | + geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 935 | + |
|
| 936 | + //$wpdb->query($meta_field_add); |
|
| 937 | + } |
|
| 938 | + if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
|
| 939 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 940 | + |
|
| 941 | + $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 942 | + if ($default_value != '') {
|
|
| 943 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 944 | + } |
|
| 945 | + |
|
| 946 | + geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 947 | + |
|
| 948 | + //$wpdb->query($meta_field_add); |
|
| 949 | + } |
|
| 950 | + // show lat lng |
|
| 951 | + if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
|
| 952 | + $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 953 | + |
|
| 954 | + $meta_field_add = "VARCHAR( 3 ) NULL"; |
|
| 955 | + $meta_field_add .= " DEFAULT '1'"; |
|
| 956 | + |
|
| 957 | + geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 958 | + //$wpdb->query($meta_field_add); |
|
| 959 | + } |
|
| 960 | + } |
|
| 961 | + |
|
| 962 | + break; |
|
| 963 | + |
|
| 964 | + case 'checkbox': |
|
| 965 | + $data_type = 'TINYINT'; |
|
| 966 | + |
|
| 967 | + $meta_field_add = $data_type . "( 1 ) NOT NULL "; |
|
| 968 | + if ((int)$default_value === 1) {
|
|
| 969 | + $meta_field_add .= " DEFAULT '1'"; |
|
| 970 | + } |
|
| 971 | + |
|
| 972 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 973 | + if ($add_result === false) {
|
|
| 974 | + return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 975 | + } |
|
| 976 | + break; |
|
| 977 | + case 'multiselect': |
|
| 978 | + case 'select': |
|
| 979 | + $data_type = 'VARCHAR'; |
|
| 980 | + $op_size = '500'; |
|
| 981 | + |
|
| 982 | + // only make the field as big as it needs to be. |
|
| 983 | + if (isset($option_values) && $option_values && $field_type == 'select') {
|
|
| 984 | + $option_values_arr = explode(',', $option_values);
|
|
| 985 | + |
|
| 986 | + if (is_array($option_values_arr)) {
|
|
| 987 | + $op_max = 0; |
|
| 988 | + |
|
| 989 | + foreach ($option_values_arr as $op_val) {
|
|
| 990 | + if (strlen($op_val) && strlen($op_val) > $op_max) {
|
|
| 991 | + $op_max = strlen($op_val); |
|
| 992 | + } |
|
| 993 | + } |
|
| 994 | + |
|
| 995 | + if ($op_max) {
|
|
| 996 | + $op_size = $op_max; |
|
| 997 | + } |
|
| 998 | + } |
|
| 999 | + } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
|
|
| 1000 | + if (strlen($option_values)) {
|
|
| 1001 | + $op_size = strlen($option_values); |
|
| 1002 | + } |
|
| 1003 | + |
|
| 1004 | + if (isset($request_field['multi_display_type'])) {
|
|
| 1005 | + $extra_fields = $request_field['multi_display_type']; |
|
| 1006 | + } |
|
| 1007 | + } |
|
| 1008 | + |
|
| 1009 | + $meta_field_add = $data_type . "( $op_size ) NULL "; |
|
| 1010 | + if ($default_value != '') {
|
|
| 1011 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1012 | + } |
|
| 1013 | + |
|
| 1014 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1015 | + if ($add_result === false) {
|
|
| 1016 | + return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1017 | + } |
|
| 1018 | + break; |
|
| 1019 | + case 'textarea': |
|
| 1020 | + case 'html': |
|
| 1021 | + case 'url': |
|
| 1022 | + case 'file': |
|
| 1023 | + |
|
| 1024 | + $data_type = 'TEXT'; |
|
| 1025 | + |
|
| 1026 | + $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1027 | + |
|
| 1028 | + $meta_field_add = $data_type . " NULL "; |
|
| 1029 | + /*if($default_value != '') |
|
| 1030 | 1030 | { $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
|
| 1031 | 1031 | |
| 1032 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1033 | - if ($add_result === false) {
|
|
| 1034 | - return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1035 | - } |
|
| 1032 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1033 | + if ($add_result === false) {
|
|
| 1034 | + return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1035 | + } |
|
| 1036 | 1036 | |
| 1037 | - break; |
|
| 1037 | + break; |
|
| 1038 | 1038 | |
| 1039 | - case 'datepicker': |
|
| 1039 | + case 'datepicker': |
|
| 1040 | 1040 | |
| 1041 | - $data_type = 'DATE'; |
|
| 1041 | + $data_type = 'DATE'; |
|
| 1042 | 1042 | |
| 1043 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1043 | + $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1044 | 1044 | |
| 1045 | - $meta_field_add = $data_type . " NULL "; |
|
| 1045 | + $meta_field_add = $data_type . " NULL "; |
|
| 1046 | 1046 | |
| 1047 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1048 | - if ($add_result === false) {
|
|
| 1049 | - return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
|
|
| 1050 | - } |
|
| 1047 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1048 | + if ($add_result === false) {
|
|
| 1049 | + return __('Column creation failed, you may have too many columns or the default value must have in valid date format.', 'geodirectory');
|
|
| 1050 | + } |
|
| 1051 | 1051 | |
| 1052 | - break; |
|
| 1052 | + break; |
|
| 1053 | 1053 | |
| 1054 | - case 'time': |
|
| 1054 | + case 'time': |
|
| 1055 | 1055 | |
| 1056 | - $data_type = 'TIME'; |
|
| 1056 | + $data_type = 'TIME'; |
|
| 1057 | 1057 | |
| 1058 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1058 | + $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1059 | 1059 | |
| 1060 | - $meta_field_add = $data_type . " NULL "; |
|
| 1060 | + $meta_field_add = $data_type . " NULL "; |
|
| 1061 | 1061 | |
| 1062 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1063 | - if ($add_result === false) {
|
|
| 1064 | - return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
|
|
| 1065 | - } |
|
| 1062 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1063 | + if ($add_result === false) {
|
|
| 1064 | + return __('Column creation failed, you may have too many columns or the default value must have in valid time format.', 'geodirectory');
|
|
| 1065 | + } |
|
| 1066 | 1066 | |
| 1067 | - break; |
|
| 1067 | + break; |
|
| 1068 | 1068 | |
| 1069 | - default: |
|
| 1069 | + default: |
|
| 1070 | 1070 | |
| 1071 | - if ($data_type != 'VARCHAR' && $data_type != '') {
|
|
| 1072 | - $meta_field_add = $data_type . " NULL "; |
|
| 1071 | + if ($data_type != 'VARCHAR' && $data_type != '') {
|
|
| 1072 | + $meta_field_add = $data_type . " NULL "; |
|
| 1073 | 1073 | |
| 1074 | - if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
|
| 1075 | - $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL "; |
|
| 1076 | - } |
|
| 1074 | + if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
|
| 1075 | + $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL "; |
|
| 1076 | + } |
|
| 1077 | 1077 | |
| 1078 | - if (is_numeric($default_value) && $default_value != '') {
|
|
| 1079 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1080 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1081 | - } |
|
| 1082 | - } else {
|
|
| 1083 | - $meta_field_add = " VARCHAR( 254 ) NULL "; |
|
| 1078 | + if (is_numeric($default_value) && $default_value != '') {
|
|
| 1079 | + $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1080 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1081 | + } |
|
| 1082 | + } else {
|
|
| 1083 | + $meta_field_add = " VARCHAR( 254 ) NULL "; |
|
| 1084 | 1084 | |
| 1085 | - if ($default_value != '') {
|
|
| 1086 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1087 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1088 | - } |
|
| 1089 | - } |
|
| 1085 | + if ($default_value != '') {
|
|
| 1086 | + $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1087 | + $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1088 | + } |
|
| 1089 | + } |
|
| 1090 | 1090 | |
| 1091 | - $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1092 | - if ($add_result === false) {
|
|
| 1093 | - return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1094 | - } |
|
| 1095 | - break; |
|
| 1096 | - endswitch; |
|
| 1091 | + $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
|
| 1092 | + if ($add_result === false) {
|
|
| 1093 | + return __('Column creation failed, you may have too many columns or the default value does not match with field data type.', 'geodirectory');
|
|
| 1094 | + } |
|
| 1095 | + break; |
|
| 1096 | + endswitch; |
|
| 1097 | 1097 | |
| 1098 | - $extra_field_query = ''; |
|
| 1099 | - if (!empty($extra_fields)) {
|
|
| 1100 | - $extra_field_query = serialize($extra_fields); |
|
| 1101 | - } |
|
| 1098 | + $extra_field_query = ''; |
|
| 1099 | + if (!empty($extra_fields)) {
|
|
| 1100 | + $extra_field_query = serialize($extra_fields); |
|
| 1101 | + } |
|
| 1102 | 1102 | |
| 1103 | - $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : ''; |
|
| 1103 | + $decimal_point = $field_type == 'text' && $data_type == 'FLOAT' ? $decimal_point : ''; |
|
| 1104 | 1104 | |
| 1105 | - $wpdb->query( |
|
| 1105 | + $wpdb->query( |
|
| 1106 | 1106 | |
| 1107 | - $wpdb->prepare( |
|
| 1107 | + $wpdb->prepare( |
|
| 1108 | 1108 | |
| 1109 | - "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1109 | + "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1110 | 1110 | post_type = %s, |
| 1111 | 1111 | admin_title = %s, |
| 1112 | 1112 | site_title = %s, |
@@ -1139,26 +1139,26 @@ discard block |
||
| 1139 | 1139 | validation_msg = %s, |
| 1140 | 1140 | for_admin_use = %s ", |
| 1141 | 1141 | |
| 1142 | - array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use) |
|
| 1142 | + array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use) |
|
| 1143 | 1143 | |
| 1144 | - ) |
|
| 1144 | + ) |
|
| 1145 | 1145 | |
| 1146 | - ); |
|
| 1146 | + ); |
|
| 1147 | 1147 | |
| 1148 | - $lastid = $wpdb->insert_id; |
|
| 1148 | + $lastid = $wpdb->insert_id; |
|
| 1149 | 1149 | |
| 1150 | - $lastid = trim($lastid); |
|
| 1150 | + $lastid = trim($lastid); |
|
| 1151 | 1151 | |
| 1152 | - } |
|
| 1152 | + } |
|
| 1153 | 1153 | |
| 1154 | - return (int)$lastid; |
|
| 1154 | + return (int)$lastid; |
|
| 1155 | 1155 | |
| 1156 | 1156 | |
| 1157 | - } else {
|
|
| 1158 | - return 'HTML Variable Name should be a unique name'; |
|
| 1159 | - } |
|
| 1157 | + } else {
|
|
| 1158 | + return 'HTML Variable Name should be a unique name'; |
|
| 1159 | + } |
|
| 1160 | 1160 | |
| 1161 | - } |
|
| 1161 | + } |
|
| 1162 | 1162 | } |
| 1163 | 1163 | |
| 1164 | 1164 | /** |
@@ -1173,54 +1173,54 @@ discard block |
||
| 1173 | 1173 | function godir_set_field_order($field_ids = array()) |
| 1174 | 1174 | {
|
| 1175 | 1175 | |
| 1176 | - global $wpdb; |
|
| 1176 | + global $wpdb; |
|
| 1177 | 1177 | |
| 1178 | - $count = 0; |
|
| 1179 | - if (!empty($field_ids)): |
|
| 1180 | - $post_meta_info = false; |
|
| 1181 | - foreach ($field_ids as $id) {
|
|
| 1178 | + $count = 0; |
|
| 1179 | + if (!empty($field_ids)): |
|
| 1180 | + $post_meta_info = false; |
|
| 1181 | + foreach ($field_ids as $id) {
|
|
| 1182 | 1182 | |
| 1183 | - $cf = trim($id, '_'); |
|
| 1183 | + $cf = trim($id, '_'); |
|
| 1184 | 1184 | |
| 1185 | - $post_meta_info = $wpdb->query( |
|
| 1186 | - $wpdb->prepare( |
|
| 1187 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1185 | + $post_meta_info = $wpdb->query( |
|
| 1186 | + $wpdb->prepare( |
|
| 1187 | + "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1188 | 1188 | sort_order=%d |
| 1189 | 1189 | where id= %d", |
| 1190 | - array($count, $cf) |
|
| 1191 | - ) |
|
| 1192 | - ); |
|
| 1193 | - $count++; |
|
| 1194 | - } |
|
| 1195 | - |
|
| 1196 | - return $post_meta_info; |
|
| 1197 | - else: |
|
| 1198 | - return false; |
|
| 1199 | - endif; |
|
| 1190 | + array($count, $cf) |
|
| 1191 | + ) |
|
| 1192 | + ); |
|
| 1193 | + $count++; |
|
| 1194 | + } |
|
| 1195 | + |
|
| 1196 | + return $post_meta_info; |
|
| 1197 | + else: |
|
| 1198 | + return false; |
|
| 1199 | + endif; |
|
| 1200 | 1200 | } |
| 1201 | 1201 | |
| 1202 | 1202 | |
| 1203 | 1203 | function geodir_get_cf_value($cf){
|
| 1204 | - global $gd_session; |
|
| 1205 | - $value = ''; |
|
| 1206 | - if (is_admin()) {
|
|
| 1207 | - global $post,$gd_session; |
|
| 1208 | - |
|
| 1209 | - if (isset($_REQUEST['post'])) |
|
| 1210 | - $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1211 | - } |
|
| 1212 | - |
|
| 1213 | - if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
|
|
| 1214 | - $post = $gd_ses_listing; |
|
| 1215 | - $value = isset($post[$cf['name']]) ? $post[$cf['name']] : ''; |
|
| 1216 | - } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 1217 | - $value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true); |
|
| 1218 | - } else {
|
|
| 1219 | - if ($value == '') {
|
|
| 1220 | - $value = $cf['default']; |
|
| 1221 | - } |
|
| 1222 | - } |
|
| 1223 | - return $value; |
|
| 1204 | + global $gd_session; |
|
| 1205 | + $value = ''; |
|
| 1206 | + if (is_admin()) {
|
|
| 1207 | + global $post,$gd_session; |
|
| 1208 | + |
|
| 1209 | + if (isset($_REQUEST['post'])) |
|
| 1210 | + $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1211 | + } |
|
| 1212 | + |
|
| 1213 | + if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
|
|
| 1214 | + $post = $gd_ses_listing; |
|
| 1215 | + $value = isset($post[$cf['name']]) ? $post[$cf['name']] : ''; |
|
| 1216 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 1217 | + $value = geodir_get_post_meta($_REQUEST['pid'], $cf['name'], true); |
|
| 1218 | + } else {
|
|
| 1219 | + if ($value == '') {
|
|
| 1220 | + $value = $cf['default']; |
|
| 1221 | + } |
|
| 1222 | + } |
|
| 1223 | + return $value; |
|
| 1224 | 1224 | } |
| 1225 | 1225 | |
| 1226 | 1226 | /** |
@@ -1239,422 +1239,422 @@ discard block |
||
| 1239 | 1239 | * @param string $post_type Optional. The wordpress post type. |
| 1240 | 1240 | */ |
| 1241 | 1241 | function geodir_get_custom_fields_html($package_id = '', $default = 'custom', $post_type = 'gd_place') {
|
| 1242 | - global $is_default, $mapzoom, $gd_session; |
|
| 1242 | + global $is_default, $mapzoom, $gd_session; |
|
| 1243 | 1243 | |
| 1244 | - $listing_type = $post_type; |
|
| 1244 | + $listing_type = $post_type; |
|
| 1245 | 1245 | |
| 1246 | - $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type); |
|
| 1246 | + $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type); |
|
| 1247 | 1247 | |
| 1248 | - foreach ($custom_fields as $key => $val) {
|
|
| 1249 | - if(isset($val['extra_fields'])){$extra_fields = $val['extra_fields'];}
|
|
| 1250 | - $val = stripslashes_deep($val); // strip slashes from labels |
|
| 1251 | - if(isset($val['extra_fields'])){$val['extra_fields'] = $extra_fields;}
|
|
| 1248 | + foreach ($custom_fields as $key => $val) {
|
|
| 1249 | + if(isset($val['extra_fields'])){$extra_fields = $val['extra_fields'];}
|
|
| 1250 | + $val = stripslashes_deep($val); // strip slashes from labels |
|
| 1251 | + if(isset($val['extra_fields'])){$val['extra_fields'] = $extra_fields;}
|
|
| 1252 | 1252 | |
| 1253 | - $name = $val['name']; |
|
| 1254 | - $type = $val['type']; |
|
| 1255 | - $is_default = $val['is_default']; |
|
| 1253 | + $name = $val['name']; |
|
| 1254 | + $type = $val['type']; |
|
| 1255 | + $is_default = $val['is_default']; |
|
| 1256 | 1256 | |
| 1257 | - /* field available to site admin only for edit */ |
|
| 1258 | - $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false; |
|
| 1259 | - if ($for_admin_use && !is_super_admin()) {
|
|
| 1260 | - continue; |
|
| 1261 | - } |
|
| 1257 | + /* field available to site admin only for edit */ |
|
| 1258 | + $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false; |
|
| 1259 | + if ($for_admin_use && !is_super_admin()) {
|
|
| 1260 | + continue; |
|
| 1261 | + } |
|
| 1262 | 1262 | |
| 1263 | - if (is_admin()) {
|
|
| 1264 | - global $post; |
|
| 1263 | + if (is_admin()) {
|
|
| 1264 | + global $post; |
|
| 1265 | 1265 | |
| 1266 | - if (isset($_REQUEST['post'])) |
|
| 1267 | - $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1268 | - } |
|
| 1266 | + if (isset($_REQUEST['post'])) |
|
| 1267 | + $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1268 | + } |
|
| 1269 | 1269 | |
| 1270 | 1270 | |
| 1271 | 1271 | |
| 1272 | - /** |
|
| 1273 | - * Called before the custom fields info is output for submitting a post. |
|
| 1274 | - * |
|
| 1275 | - * Used dynamic hook type geodir_before_custom_form_field_$name. |
|
| 1276 | - * |
|
| 1277 | - * @since 1.0.0 |
|
| 1278 | - * @param string $listing_type The post post type. |
|
| 1279 | - * @param int $package_id The price package ID for the post. |
|
| 1280 | - * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
|
| 1281 | - * @see 'geodir_after_custom_form_field_$name' |
|
| 1282 | - */ |
|
| 1283 | - do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1284 | - |
|
| 1285 | - |
|
| 1286 | - $custom_field = $val; |
|
| 1287 | - $html =''; |
|
| 1288 | - /** |
|
| 1289 | - * Filter the output for custom fields. |
|
| 1290 | - * |
|
| 1291 | - * Here we can remove or add new functions depending on the field type. |
|
| 1292 | - * |
|
| 1293 | - * @param string $html The html to be filtered (blank). |
|
| 1294 | - * @param array $custom_field The custom field array values. |
|
| 1295 | - */ |
|
| 1296 | - echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
|
|
| 1297 | - |
|
| 1298 | - |
|
| 1299 | - |
|
| 1300 | - /** |
|
| 1301 | - * Called after the custom fields info is output for submitting a post. |
|
| 1302 | - * |
|
| 1303 | - * Used dynamic hook type geodir_after_custom_form_field_$name. |
|
| 1304 | - * |
|
| 1305 | - * @since 1.0.0 |
|
| 1306 | - * @param string $listing_type The post post type. |
|
| 1307 | - * @param int $package_id The price package ID for the post. |
|
| 1308 | - * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
|
| 1309 | - * @see 'geodir_before_custom_form_field_$name' |
|
| 1310 | - */ |
|
| 1311 | - do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1312 | - |
|
| 1313 | - } |
|
| 1272 | + /** |
|
| 1273 | + * Called before the custom fields info is output for submitting a post. |
|
| 1274 | + * |
|
| 1275 | + * Used dynamic hook type geodir_before_custom_form_field_$name. |
|
| 1276 | + * |
|
| 1277 | + * @since 1.0.0 |
|
| 1278 | + * @param string $listing_type The post post type. |
|
| 1279 | + * @param int $package_id The price package ID for the post. |
|
| 1280 | + * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
|
| 1281 | + * @see 'geodir_after_custom_form_field_$name' |
|
| 1282 | + */ |
|
| 1283 | + do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1284 | + |
|
| 1285 | + |
|
| 1286 | + $custom_field = $val; |
|
| 1287 | + $html =''; |
|
| 1288 | + /** |
|
| 1289 | + * Filter the output for custom fields. |
|
| 1290 | + * |
|
| 1291 | + * Here we can remove or add new functions depending on the field type. |
|
| 1292 | + * |
|
| 1293 | + * @param string $html The html to be filtered (blank). |
|
| 1294 | + * @param array $custom_field The custom field array values. |
|
| 1295 | + */ |
|
| 1296 | + echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
|
|
| 1297 | + |
|
| 1298 | + |
|
| 1299 | + |
|
| 1300 | + /** |
|
| 1301 | + * Called after the custom fields info is output for submitting a post. |
|
| 1302 | + * |
|
| 1303 | + * Used dynamic hook type geodir_after_custom_form_field_$name. |
|
| 1304 | + * |
|
| 1305 | + * @since 1.0.0 |
|
| 1306 | + * @param string $listing_type The post post type. |
|
| 1307 | + * @param int $package_id The price package ID for the post. |
|
| 1308 | + * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
|
| 1309 | + * @see 'geodir_before_custom_form_field_$name' |
|
| 1310 | + */ |
|
| 1311 | + do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1312 | + |
|
| 1313 | + } |
|
| 1314 | 1314 | |
| 1315 | 1315 | } |
| 1316 | 1316 | |
| 1317 | 1317 | |
| 1318 | 1318 | if (!function_exists('geodir_get_field_infoby')) {
|
| 1319 | - /** |
|
| 1320 | - * Get custom field using key and value. |
|
| 1321 | - * |
|
| 1322 | - * @since 1.0.0 |
|
| 1323 | - * @package GeoDirectory |
|
| 1324 | - * @global object $wpdb WordPress Database object. |
|
| 1325 | - * @param string $key The key you want to look for. |
|
| 1326 | - * @param string $value The value of the key you want to look for. |
|
| 1327 | - * @param string $geodir_post_type The post type. |
|
| 1328 | - * @return bool|mixed Returns field info when available. otherwise returns false. |
|
| 1329 | - */ |
|
| 1330 | - function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '') |
|
| 1331 | - {
|
|
| 1332 | - |
|
| 1333 | - global $wpdb; |
|
| 1334 | - |
|
| 1335 | - $filter = $wpdb->get_row( |
|
| 1336 | - $wpdb->prepare( |
|
| 1337 | - "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'", |
|
| 1338 | - array($geodir_post_type) |
|
| 1339 | - ) |
|
| 1340 | - ); |
|
| 1341 | - |
|
| 1342 | - if ($filter) {
|
|
| 1343 | - return $filter; |
|
| 1344 | - } else {
|
|
| 1345 | - return false; |
|
| 1346 | - } |
|
| 1347 | - |
|
| 1348 | - } |
|
| 1319 | + /** |
|
| 1320 | + * Get custom field using key and value. |
|
| 1321 | + * |
|
| 1322 | + * @since 1.0.0 |
|
| 1323 | + * @package GeoDirectory |
|
| 1324 | + * @global object $wpdb WordPress Database object. |
|
| 1325 | + * @param string $key The key you want to look for. |
|
| 1326 | + * @param string $value The value of the key you want to look for. |
|
| 1327 | + * @param string $geodir_post_type The post type. |
|
| 1328 | + * @return bool|mixed Returns field info when available. otherwise returns false. |
|
| 1329 | + */ |
|
| 1330 | + function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '') |
|
| 1331 | + {
|
|
| 1332 | + |
|
| 1333 | + global $wpdb; |
|
| 1334 | + |
|
| 1335 | + $filter = $wpdb->get_row( |
|
| 1336 | + $wpdb->prepare( |
|
| 1337 | + "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'", |
|
| 1338 | + array($geodir_post_type) |
|
| 1339 | + ) |
|
| 1340 | + ); |
|
| 1341 | + |
|
| 1342 | + if ($filter) {
|
|
| 1343 | + return $filter; |
|
| 1344 | + } else {
|
|
| 1345 | + return false; |
|
| 1346 | + } |
|
| 1347 | + |
|
| 1348 | + } |
|
| 1349 | 1349 | } |
| 1350 | 1350 | |
| 1351 | 1351 | |
| 1352 | 1352 | function geodir_field_icon_proccess($cf){
|
| 1353 | 1353 | |
| 1354 | 1354 | |
| 1355 | - if (strpos($cf['field_icon'], 'http') !== false) {
|
|
| 1356 | - $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 1357 | - } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
|
|
| 1358 | - $field_icon = '<i class="' . $cf['field_icon'] . '"></i>'; |
|
| 1359 | - }else{
|
|
| 1360 | - $field_icon = $cf['field_icon']; |
|
| 1361 | - } |
|
| 1355 | + if (strpos($cf['field_icon'], 'http') !== false) {
|
|
| 1356 | + $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 1357 | + } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
|
|
| 1358 | + $field_icon = '<i class="' . $cf['field_icon'] . '"></i>'; |
|
| 1359 | + }else{
|
|
| 1360 | + $field_icon = $cf['field_icon']; |
|
| 1361 | + } |
|
| 1362 | 1362 | |
| 1363 | - return $field_icon; |
|
| 1363 | + return $field_icon; |
|
| 1364 | 1364 | } |
| 1365 | 1365 | |
| 1366 | 1366 | if (!function_exists('geodir_show_listing_info')) {
|
| 1367 | - /** |
|
| 1368 | - * Show listing info depending on field location. |
|
| 1369 | - * |
|
| 1370 | - * @since 1.0.0 |
|
| 1371 | - * @since 1.5.7 Custom fields option values added to db translation. |
|
| 1372 | - * Changes to display url fields title. |
|
| 1373 | - * @package GeoDirectory |
|
| 1374 | - * @global object $wpdb WordPress Database object. |
|
| 1375 | - * @global object $post The current post object. |
|
| 1376 | - * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false. |
|
| 1377 | - * |
|
| 1378 | - * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc. |
|
| 1379 | - * @return string Returns listing info html. |
|
| 1380 | - */ |
|
| 1381 | - function geodir_show_listing_info($fields_location = '') {
|
|
| 1382 | - global $post, $preview, $wpdb, $send_to_friend; |
|
| 1383 | - |
|
| 1384 | - $package_info = array(); |
|
| 1385 | - |
|
| 1386 | - $package_info = geodir_post_package_info($package_info, $post); |
|
| 1387 | - $post_package_id = !empty($package_info->pid) ? $package_info->pid : ''; |
|
| 1388 | - $p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype(); |
|
| 1389 | - $send_to_friend = false; |
|
| 1390 | - |
|
| 1391 | - ob_start(); |
|
| 1392 | - $fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location); |
|
| 1393 | - |
|
| 1394 | - if (!empty($fields_info)) {
|
|
| 1395 | - $post = stripslashes_deep($post); // strip slashes |
|
| 1367 | + /** |
|
| 1368 | + * Show listing info depending on field location. |
|
| 1369 | + * |
|
| 1370 | + * @since 1.0.0 |
|
| 1371 | + * @since 1.5.7 Custom fields option values added to db translation. |
|
| 1372 | + * Changes to display url fields title. |
|
| 1373 | + * @package GeoDirectory |
|
| 1374 | + * @global object $wpdb WordPress Database object. |
|
| 1375 | + * @global object $post The current post object. |
|
| 1376 | + * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false. |
|
| 1377 | + * |
|
| 1378 | + * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc. |
|
| 1379 | + * @return string Returns listing info html. |
|
| 1380 | + */ |
|
| 1381 | + function geodir_show_listing_info($fields_location = '') {
|
|
| 1382 | + global $post, $preview, $wpdb, $send_to_friend; |
|
| 1383 | + |
|
| 1384 | + $package_info = array(); |
|
| 1385 | + |
|
| 1386 | + $package_info = geodir_post_package_info($package_info, $post); |
|
| 1387 | + $post_package_id = !empty($package_info->pid) ? $package_info->pid : ''; |
|
| 1388 | + $p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype(); |
|
| 1389 | + $send_to_friend = false; |
|
| 1390 | + |
|
| 1391 | + ob_start(); |
|
| 1392 | + $fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location); |
|
| 1393 | + |
|
| 1394 | + if (!empty($fields_info)) {
|
|
| 1395 | + $post = stripslashes_deep($post); // strip slashes |
|
| 1396 | 1396 | |
| 1397 | - //echo '<div class="geodir-company_info field-group">'; |
|
| 1398 | - global $field_set_start; |
|
| 1399 | - $field_set_start = 0; |
|
| 1400 | - |
|
| 1401 | - |
|
| 1402 | - |
|
| 1403 | - foreach ($fields_info as $type) {
|
|
| 1404 | - if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
|
|
| 1405 | - $type = stripslashes_deep($type); // strip slashes |
|
| 1406 | - if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
|
|
| 1407 | - $html = ''; |
|
| 1408 | - $field_icon = geodir_field_icon_proccess($type); |
|
| 1409 | - $filed_type = $type['type']; |
|
| 1410 | - $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : ''; |
|
| 1411 | - if($html_var=='post'){$html_var='post_address';}
|
|
| 1412 | - |
|
| 1413 | - /** |
|
| 1414 | - * Filter the output for custom fields. |
|
| 1415 | - * |
|
| 1416 | - * Here we can remove or add new functions depending on the field type. |
|
| 1417 | - * |
|
| 1418 | - * @param string $html The html to be filtered (blank). |
|
| 1419 | - * @param string $fields_location The location the field is to be show. |
|
| 1420 | - * @param array $type The array of field values. |
|
| 1421 | - */ |
|
| 1422 | - $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
|
|
| 1423 | - |
|
| 1424 | - $variables_array = array(); |
|
| 1425 | - |
|
| 1426 | - |
|
| 1427 | - if ($type['type'] != 'fieldset'): |
|
| 1428 | - $variables_array['post_id'] = $post->ID; |
|
| 1429 | - $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
|
| 1430 | - $variables_array['value'] = ''; |
|
| 1431 | - if (isset($post->{$type['htmlvar_name']}))
|
|
| 1432 | - $variables_array['value'] = $post->{$type['htmlvar_name']};
|
|
| 1433 | - endif; |
|
| 1434 | - |
|
| 1435 | - |
|
| 1436 | - if ($html): |
|
| 1437 | - |
|
| 1438 | - /** |
|
| 1439 | - * Called before a custom fields is output on the frontend. |
|
| 1440 | - * |
|
| 1441 | - * @since 1.0.0 |
|
| 1442 | - * @param string $html_var The HTML variable name for the field. |
|
| 1443 | - */ |
|
| 1444 | - do_action("geodir_before_show_{$html_var}");
|
|
| 1445 | - /** |
|
| 1446 | - * Filter custom field output. |
|
| 1447 | - * |
|
| 1448 | - * @since 1.0.0 |
|
| 1449 | - * |
|
| 1450 | - * @param string $html_var The HTML variable name for the field. |
|
| 1451 | - * @param string $html Custom field unfiltered HTML. |
|
| 1452 | - * @param array $variables_array Custom field variables array. |
|
| 1453 | - */ |
|
| 1454 | - if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
|
|
| 1455 | - |
|
| 1456 | - /** |
|
| 1457 | - * Called after a custom fields is output on the frontend. |
|
| 1458 | - * |
|
| 1459 | - * @since 1.0.0 |
|
| 1460 | - * @param string $html_var The HTML variable name for the field. |
|
| 1461 | - */ |
|
| 1462 | - do_action("geodir_after_show_{$html_var}");
|
|
| 1463 | - |
|
| 1464 | - endif; |
|
| 1465 | - |
|
| 1466 | - } |
|
| 1467 | - |
|
| 1468 | - //echo '</div>'; |
|
| 1469 | - |
|
| 1470 | - } |
|
| 1471 | - |
|
| 1472 | - |
|
| 1473 | - $html = ob_get_clean(); |
|
| 1474 | - |
|
| 1475 | - /** |
|
| 1476 | - * Filter the custom fields over all output. |
|
| 1477 | - * |
|
| 1478 | - * @param string $html The html of the custom fields. |
|
| 1479 | - * @param string $fields_location The location the fields are being output. |
|
| 1480 | - * @since 1.6.9 |
|
| 1481 | - */ |
|
| 1482 | - return apply_filters('geodir_show_listing_info',$html,$fields_location);
|
|
| 1483 | - |
|
| 1484 | - } |
|
| 1397 | + //echo '<div class="geodir-company_info field-group">'; |
|
| 1398 | + global $field_set_start; |
|
| 1399 | + $field_set_start = 0; |
|
| 1400 | + |
|
| 1401 | + |
|
| 1402 | + |
|
| 1403 | + foreach ($fields_info as $type) {
|
|
| 1404 | + if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
|
|
| 1405 | + $type = stripslashes_deep($type); // strip slashes |
|
| 1406 | + if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
|
|
| 1407 | + $html = ''; |
|
| 1408 | + $field_icon = geodir_field_icon_proccess($type); |
|
| 1409 | + $filed_type = $type['type']; |
|
| 1410 | + $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : ''; |
|
| 1411 | + if($html_var=='post'){$html_var='post_address';}
|
|
| 1412 | + |
|
| 1413 | + /** |
|
| 1414 | + * Filter the output for custom fields. |
|
| 1415 | + * |
|
| 1416 | + * Here we can remove or add new functions depending on the field type. |
|
| 1417 | + * |
|
| 1418 | + * @param string $html The html to be filtered (blank). |
|
| 1419 | + * @param string $fields_location The location the field is to be show. |
|
| 1420 | + * @param array $type The array of field values. |
|
| 1421 | + */ |
|
| 1422 | + $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
|
|
| 1423 | + |
|
| 1424 | + $variables_array = array(); |
|
| 1425 | + |
|
| 1426 | + |
|
| 1427 | + if ($type['type'] != 'fieldset'): |
|
| 1428 | + $variables_array['post_id'] = $post->ID; |
|
| 1429 | + $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
|
| 1430 | + $variables_array['value'] = ''; |
|
| 1431 | + if (isset($post->{$type['htmlvar_name']}))
|
|
| 1432 | + $variables_array['value'] = $post->{$type['htmlvar_name']};
|
|
| 1433 | + endif; |
|
| 1434 | + |
|
| 1435 | + |
|
| 1436 | + if ($html): |
|
| 1437 | + |
|
| 1438 | + /** |
|
| 1439 | + * Called before a custom fields is output on the frontend. |
|
| 1440 | + * |
|
| 1441 | + * @since 1.0.0 |
|
| 1442 | + * @param string $html_var The HTML variable name for the field. |
|
| 1443 | + */ |
|
| 1444 | + do_action("geodir_before_show_{$html_var}");
|
|
| 1445 | + /** |
|
| 1446 | + * Filter custom field output. |
|
| 1447 | + * |
|
| 1448 | + * @since 1.0.0 |
|
| 1449 | + * |
|
| 1450 | + * @param string $html_var The HTML variable name for the field. |
|
| 1451 | + * @param string $html Custom field unfiltered HTML. |
|
| 1452 | + * @param array $variables_array Custom field variables array. |
|
| 1453 | + */ |
|
| 1454 | + if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
|
|
| 1455 | + |
|
| 1456 | + /** |
|
| 1457 | + * Called after a custom fields is output on the frontend. |
|
| 1458 | + * |
|
| 1459 | + * @since 1.0.0 |
|
| 1460 | + * @param string $html_var The HTML variable name for the field. |
|
| 1461 | + */ |
|
| 1462 | + do_action("geodir_after_show_{$html_var}");
|
|
| 1463 | + |
|
| 1464 | + endif; |
|
| 1465 | + |
|
| 1466 | + } |
|
| 1467 | + |
|
| 1468 | + //echo '</div>'; |
|
| 1469 | + |
|
| 1470 | + } |
|
| 1471 | + |
|
| 1472 | + |
|
| 1473 | + $html = ob_get_clean(); |
|
| 1474 | + |
|
| 1475 | + /** |
|
| 1476 | + * Filter the custom fields over all output. |
|
| 1477 | + * |
|
| 1478 | + * @param string $html The html of the custom fields. |
|
| 1479 | + * @param string $fields_location The location the fields are being output. |
|
| 1480 | + * @since 1.6.9 |
|
| 1481 | + */ |
|
| 1482 | + return apply_filters('geodir_show_listing_info',$html,$fields_location);
|
|
| 1483 | + |
|
| 1484 | + } |
|
| 1485 | 1485 | } |
| 1486 | 1486 | |
| 1487 | 1487 | if (!function_exists('geodir_default_date_format')) {
|
| 1488 | - /** |
|
| 1489 | - * Returns default date format. |
|
| 1490 | - * |
|
| 1491 | - * @since 1.0.0 |
|
| 1492 | - * @package GeoDirectory |
|
| 1493 | - * @return mixed|string|void Returns default date format. |
|
| 1494 | - */ |
|
| 1495 | - function geodir_default_date_format() |
|
| 1496 | - {
|
|
| 1497 | - if ($format = get_option('date_format'))
|
|
| 1498 | - return $format; |
|
| 1499 | - else |
|
| 1500 | - return 'dd-mm-yy'; |
|
| 1501 | - } |
|
| 1488 | + /** |
|
| 1489 | + * Returns default date format. |
|
| 1490 | + * |
|
| 1491 | + * @since 1.0.0 |
|
| 1492 | + * @package GeoDirectory |
|
| 1493 | + * @return mixed|string|void Returns default date format. |
|
| 1494 | + */ |
|
| 1495 | + function geodir_default_date_format() |
|
| 1496 | + {
|
|
| 1497 | + if ($format = get_option('date_format'))
|
|
| 1498 | + return $format; |
|
| 1499 | + else |
|
| 1500 | + return 'dd-mm-yy'; |
|
| 1501 | + } |
|
| 1502 | 1502 | } |
| 1503 | 1503 | |
| 1504 | 1504 | if (!function_exists('geodir_get_formated_date')) {
|
| 1505 | - /** |
|
| 1506 | - * Returns formatted date. |
|
| 1507 | - * |
|
| 1508 | - * @since 1.0.0 |
|
| 1509 | - * @package GeoDirectory |
|
| 1510 | - * @param string $date Date string to convert. |
|
| 1511 | - * @return bool|int|string Returns formatted date. |
|
| 1512 | - */ |
|
| 1513 | - function geodir_get_formated_date($date) |
|
| 1514 | - {
|
|
| 1515 | - return mysql2date(get_option('date_format'), $date);
|
|
| 1516 | - } |
|
| 1505 | + /** |
|
| 1506 | + * Returns formatted date. |
|
| 1507 | + * |
|
| 1508 | + * @since 1.0.0 |
|
| 1509 | + * @package GeoDirectory |
|
| 1510 | + * @param string $date Date string to convert. |
|
| 1511 | + * @return bool|int|string Returns formatted date. |
|
| 1512 | + */ |
|
| 1513 | + function geodir_get_formated_date($date) |
|
| 1514 | + {
|
|
| 1515 | + return mysql2date(get_option('date_format'), $date);
|
|
| 1516 | + } |
|
| 1517 | 1517 | } |
| 1518 | 1518 | |
| 1519 | 1519 | if (!function_exists('geodir_get_formated_time')) {
|
| 1520 | - /** |
|
| 1521 | - * Returns formatted time. |
|
| 1522 | - * |
|
| 1523 | - * @since 1.0.0 |
|
| 1524 | - * @package GeoDirectory |
|
| 1525 | - * @param string $time Time string to convert. |
|
| 1526 | - * @return bool|int|string Returns formatted time. |
|
| 1527 | - */ |
|
| 1528 | - function geodir_get_formated_time($time) |
|
| 1529 | - {
|
|
| 1530 | - return mysql2date(get_option('time_format'), $time, $translate = true);
|
|
| 1531 | - } |
|
| 1520 | + /** |
|
| 1521 | + * Returns formatted time. |
|
| 1522 | + * |
|
| 1523 | + * @since 1.0.0 |
|
| 1524 | + * @package GeoDirectory |
|
| 1525 | + * @param string $time Time string to convert. |
|
| 1526 | + * @return bool|int|string Returns formatted time. |
|
| 1527 | + */ |
|
| 1528 | + function geodir_get_formated_time($time) |
|
| 1529 | + {
|
|
| 1530 | + return mysql2date(get_option('time_format'), $time, $translate = true);
|
|
| 1531 | + } |
|
| 1532 | 1532 | } |
| 1533 | 1533 | |
| 1534 | 1534 | |
| 1535 | 1535 | if (!function_exists('geodir_save_post_file_fields')) {
|
| 1536 | - /** |
|
| 1537 | - * Save post file fields |
|
| 1538 | - * |
|
| 1539 | - * @since 1.0.0 |
|
| 1540 | - * @since 1.4.7 Added `$extra_fields` parameter. |
|
| 1541 | - * @package GeoDirectory |
|
| 1542 | - * @global object $wpdb WordPress Database object. |
|
| 1543 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 1544 | - * @global object $current_user Current user object. |
|
| 1545 | - * @param int $post_id |
|
| 1546 | - * @param string $field_id |
|
| 1547 | - * @param array $post_image |
|
| 1548 | - * @param array $extra_fields Array of extra fields. |
|
| 1549 | - */ |
|
| 1550 | - function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array()) |
|
| 1551 | - {
|
|
| 1536 | + /** |
|
| 1537 | + * Save post file fields |
|
| 1538 | + * |
|
| 1539 | + * @since 1.0.0 |
|
| 1540 | + * @since 1.4.7 Added `$extra_fields` parameter. |
|
| 1541 | + * @package GeoDirectory |
|
| 1542 | + * @global object $wpdb WordPress Database object. |
|
| 1543 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 1544 | + * @global object $current_user Current user object. |
|
| 1545 | + * @param int $post_id |
|
| 1546 | + * @param string $field_id |
|
| 1547 | + * @param array $post_image |
|
| 1548 | + * @param array $extra_fields Array of extra fields. |
|
| 1549 | + */ |
|
| 1550 | + function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array()) |
|
| 1551 | + {
|
|
| 1552 | 1552 | |
| 1553 | - global $wpdb, $plugin_prefix, $current_user; |
|
| 1553 | + global $wpdb, $plugin_prefix, $current_user; |
|
| 1554 | 1554 | |
| 1555 | - $post_type = get_post_type($post_id); |
|
| 1556 | - //echo $field_id; exit; |
|
| 1557 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1555 | + $post_type = get_post_type($post_id); |
|
| 1556 | + //echo $field_id; exit; |
|
| 1557 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1558 | 1558 | |
| 1559 | - $postcurr_images = array(); |
|
| 1560 | - $postcurr_images = geodir_get_post_meta($post_id, $field_id, true); |
|
| 1561 | - $file_urls = ''; |
|
| 1559 | + $postcurr_images = array(); |
|
| 1560 | + $postcurr_images = geodir_get_post_meta($post_id, $field_id, true); |
|
| 1561 | + $file_urls = ''; |
|
| 1562 | 1562 | |
| 1563 | - if (!empty($post_image)) {
|
|
| 1563 | + if (!empty($post_image)) {
|
|
| 1564 | 1564 | |
| 1565 | - $invalid_files = array(); |
|
| 1565 | + $invalid_files = array(); |
|
| 1566 | 1566 | |
| 1567 | - //Get and remove all old images of post from database to set by new order |
|
| 1568 | - $geodir_uploaddir = ''; |
|
| 1569 | - $uploads = wp_upload_dir(); |
|
| 1570 | - $uploads_dir = $uploads['path']; |
|
| 1567 | + //Get and remove all old images of post from database to set by new order |
|
| 1568 | + $geodir_uploaddir = ''; |
|
| 1569 | + $uploads = wp_upload_dir(); |
|
| 1570 | + $uploads_dir = $uploads['path']; |
|
| 1571 | 1571 | |
| 1572 | - $geodir_uploadpath = $uploads['path']; |
|
| 1573 | - $geodir_uploadurl = $uploads['url']; |
|
| 1574 | - $sub_dir = $uploads['subdir']; |
|
| 1572 | + $geodir_uploadpath = $uploads['path']; |
|
| 1573 | + $geodir_uploadurl = $uploads['url']; |
|
| 1574 | + $sub_dir = $uploads['subdir']; |
|
| 1575 | 1575 | |
| 1576 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
|
|
| 1576 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
|
|
| 1577 | 1577 | |
| 1578 | - for ($m = 0; $m < count($post_image); $m++) {
|
|
| 1578 | + for ($m = 0; $m < count($post_image); $m++) {
|
|
| 1579 | 1579 | |
| 1580 | - /* --------- start ------- */ |
|
| 1580 | + /* --------- start ------- */ |
|
| 1581 | 1581 | |
| 1582 | - if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
|
|
| 1582 | + if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
|
|
| 1583 | 1583 | |
| 1584 | 1584 | |
| 1585 | - $curr_img_url = $post_image[$m]; |
|
| 1586 | - $image_name_arr = explode('/', $curr_img_url);
|
|
| 1587 | - $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
| 1588 | - $filename = end($image_name_arr); |
|
| 1589 | - $img_name_arr = explode('.', $filename);
|
|
| 1585 | + $curr_img_url = $post_image[$m]; |
|
| 1586 | + $image_name_arr = explode('/', $curr_img_url);
|
|
| 1587 | + $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
| 1588 | + $filename = end($image_name_arr); |
|
| 1589 | + $img_name_arr = explode('.', $filename);
|
|
| 1590 | 1590 | |
| 1591 | - $arr_file_type = wp_check_filetype($filename); |
|
| 1591 | + $arr_file_type = wp_check_filetype($filename); |
|
| 1592 | 1592 | |
| 1593 | - if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
|
|
| 1594 | - continue; |
|
| 1595 | - } |
|
| 1593 | + if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
|
|
| 1594 | + continue; |
|
| 1595 | + } |
|
| 1596 | 1596 | |
| 1597 | - $uploaded_file_type = $arr_file_type['type']; |
|
| 1598 | - $uploaded_file_ext = $arr_file_type['ext']; |
|
| 1597 | + $uploaded_file_type = $arr_file_type['type']; |
|
| 1598 | + $uploaded_file_ext = $arr_file_type['ext']; |
|
| 1599 | 1599 | |
| 1600 | - if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
|
|
| 1601 | - continue; // Invalid file type. |
|
| 1602 | - } |
|
| 1600 | + if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
|
|
| 1601 | + continue; // Invalid file type. |
|
| 1602 | + } |
|
| 1603 | 1603 | |
| 1604 | - // Set an array containing a list of acceptable formats |
|
| 1605 | - //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
|
|
| 1604 | + // Set an array containing a list of acceptable formats |
|
| 1605 | + //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
|
|
| 1606 | 1606 | |
| 1607 | - if (!function_exists('wp_handle_upload'))
|
|
| 1608 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1607 | + if (!function_exists('wp_handle_upload'))
|
|
| 1608 | + require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1609 | 1609 | |
| 1610 | - if (!is_dir($geodir_uploadpath)) |
|
| 1611 | - mkdir($geodir_uploadpath); |
|
| 1610 | + if (!is_dir($geodir_uploadpath)) |
|
| 1611 | + mkdir($geodir_uploadpath); |
|
| 1612 | 1612 | |
| 1613 | - $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
|
| 1614 | - $explode_sub_dir = explode("/", $sub_dir);
|
|
| 1615 | - if ($curr_img_dir == end($explode_sub_dir)) {
|
|
| 1616 | - $img_path = $geodir_uploadpath . '/' . $filename; |
|
| 1617 | - $img_url = $geodir_uploadurl . '/' . $filename; |
|
| 1618 | - } else {
|
|
| 1619 | - $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1620 | - $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1621 | - } |
|
| 1613 | + $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
|
| 1614 | + $explode_sub_dir = explode("/", $sub_dir);
|
|
| 1615 | + if ($curr_img_dir == end($explode_sub_dir)) {
|
|
| 1616 | + $img_path = $geodir_uploadpath . '/' . $filename; |
|
| 1617 | + $img_url = $geodir_uploadurl . '/' . $filename; |
|
| 1618 | + } else {
|
|
| 1619 | + $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1620 | + $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1621 | + } |
|
| 1622 | 1622 | |
| 1623 | - $uploaded_file = ''; |
|
| 1624 | - if (file_exists($img_path)) |
|
| 1625 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1623 | + $uploaded_file = ''; |
|
| 1624 | + if (file_exists($img_path)) |
|
| 1625 | + $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1626 | 1626 | |
| 1627 | - if ($curr_img_dir != $geodir_uploaddir) {
|
|
| 1628 | - if (file_exists($img_path)) |
|
| 1629 | - unlink($img_path); |
|
| 1630 | - } |
|
| 1627 | + if ($curr_img_dir != $geodir_uploaddir) {
|
|
| 1628 | + if (file_exists($img_path)) |
|
| 1629 | + unlink($img_path); |
|
| 1630 | + } |
|
| 1631 | 1631 | |
| 1632 | - if (!empty($uploaded_file)) |
|
| 1633 | - $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 1632 | + if (!empty($uploaded_file)) |
|
| 1633 | + $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 1634 | 1634 | |
| 1635 | - } else {
|
|
| 1636 | - $file_urls = $post_image[$m]; |
|
| 1637 | - } |
|
| 1638 | - } |
|
| 1635 | + } else {
|
|
| 1636 | + $file_urls = $post_image[$m]; |
|
| 1637 | + } |
|
| 1638 | + } |
|
| 1639 | 1639 | |
| 1640 | 1640 | |
| 1641 | - } |
|
| 1641 | + } |
|
| 1642 | 1642 | |
| 1643 | - //Remove all old attachments and temp images |
|
| 1644 | - if (!empty($postcurr_images)) {
|
|
| 1643 | + //Remove all old attachments and temp images |
|
| 1644 | + if (!empty($postcurr_images)) {
|
|
| 1645 | 1645 | |
| 1646 | - if ($file_urls != $postcurr_images) {
|
|
| 1647 | - $invalid_files[] = (object)array('src' => $postcurr_images);
|
|
| 1648 | - $invalid_files = (object)$invalid_files; |
|
| 1649 | - } |
|
| 1650 | - } |
|
| 1646 | + if ($file_urls != $postcurr_images) {
|
|
| 1647 | + $invalid_files[] = (object)array('src' => $postcurr_images);
|
|
| 1648 | + $invalid_files = (object)$invalid_files; |
|
| 1649 | + } |
|
| 1650 | + } |
|
| 1651 | 1651 | |
| 1652 | - geodir_save_post_meta($post_id, $field_id, $file_urls); |
|
| 1652 | + geodir_save_post_meta($post_id, $field_id, $file_urls); |
|
| 1653 | 1653 | |
| 1654 | - if (!empty($invalid_files)) |
|
| 1655 | - geodir_remove_attachments($invalid_files); |
|
| 1654 | + if (!empty($invalid_files)) |
|
| 1655 | + geodir_remove_attachments($invalid_files); |
|
| 1656 | 1656 | |
| 1657 | - } |
|
| 1657 | + } |
|
| 1658 | 1658 | } |
| 1659 | 1659 | |
| 1660 | 1660 | |
@@ -1669,76 +1669,76 @@ discard block |
||
| 1669 | 1669 | */ |
| 1670 | 1670 | function geodir_custom_upload_mimes($existing_mimes = array()) |
| 1671 | 1671 | {
|
| 1672 | - $existing_mimes['wif'] = 'text/plain'; |
|
| 1673 | - $existing_mimes['jpg|jpeg'] = 'image/jpeg'; |
|
| 1674 | - $existing_mimes['gif'] = 'image/gif'; |
|
| 1675 | - $existing_mimes['png'] = 'image/png'; |
|
| 1676 | - $existing_mimes['pdf'] = 'application/pdf'; |
|
| 1677 | - $existing_mimes['txt'] = 'text/text'; |
|
| 1678 | - $existing_mimes['csv'] = 'application/octet-stream'; |
|
| 1679 | - $existing_mimes['doc'] = 'application/msword'; |
|
| 1680 | - $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel'; |
|
| 1681 | - $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; |
|
| 1682 | - $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; |
|
| 1683 | - return $existing_mimes; |
|
| 1672 | + $existing_mimes['wif'] = 'text/plain'; |
|
| 1673 | + $existing_mimes['jpg|jpeg'] = 'image/jpeg'; |
|
| 1674 | + $existing_mimes['gif'] = 'image/gif'; |
|
| 1675 | + $existing_mimes['png'] = 'image/png'; |
|
| 1676 | + $existing_mimes['pdf'] = 'application/pdf'; |
|
| 1677 | + $existing_mimes['txt'] = 'text/text'; |
|
| 1678 | + $existing_mimes['csv'] = 'application/octet-stream'; |
|
| 1679 | + $existing_mimes['doc'] = 'application/msword'; |
|
| 1680 | + $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel'; |
|
| 1681 | + $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; |
|
| 1682 | + $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; |
|
| 1683 | + return $existing_mimes; |
|
| 1684 | 1684 | } |
| 1685 | 1685 | |
| 1686 | 1686 | if (!function_exists('geodir_plupload_action')) {
|
| 1687 | 1687 | |
| 1688 | - /** |
|
| 1689 | - * Get upload directory path details |
|
| 1690 | - * |
|
| 1691 | - * @since 1.0.0 |
|
| 1692 | - * @package GeoDirectory |
|
| 1693 | - * @global object $current_user Current user object. |
|
| 1694 | - * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'. |
|
| 1695 | - * @return mixed Returns upload directory details as an array. |
|
| 1696 | - */ |
|
| 1697 | - function geodir_upload_dir($upload) |
|
| 1698 | - {
|
|
| 1699 | - global $current_user; |
|
| 1700 | - $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID; |
|
| 1701 | - $upload['path'] = $upload['basedir'] . $upload['subdir']; |
|
| 1702 | - $upload['url'] = $upload['baseurl'] . $upload['subdir']; |
|
| 1703 | - return $upload; |
|
| 1704 | - } |
|
| 1705 | - |
|
| 1706 | - /** |
|
| 1707 | - * Handles place file and image upload. |
|
| 1708 | - * |
|
| 1709 | - * @since 1.0.0 |
|
| 1710 | - * @package GeoDirectory |
|
| 1711 | - */ |
|
| 1712 | - function geodir_plupload_action() |
|
| 1713 | - {
|
|
| 1714 | - // check ajax nonce |
|
| 1715 | - $imgid = $_POST["imgid"]; |
|
| 1716 | - |
|
| 1717 | - check_ajax_referer($imgid . 'pluploadan'); |
|
| 1718 | - |
|
| 1719 | - // handle custom file uploaddir |
|
| 1720 | - add_filter('upload_dir', 'geodir_upload_dir');
|
|
| 1721 | - |
|
| 1722 | - // change file orientation if needed |
|
| 1723 | - $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']); |
|
| 1724 | - |
|
| 1725 | - // handle file upload |
|
| 1726 | - $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
|
|
| 1727 | - // remove handle custom file uploaddir |
|
| 1728 | - remove_filter('upload_dir', 'geodir_upload_dir');
|
|
| 1729 | - |
|
| 1730 | - if(!isset($status['url']) && isset($status['error'])){
|
|
| 1731 | - print_r($status); |
|
| 1732 | - } |
|
| 1733 | - |
|
| 1734 | - // send the uploaded file url in response |
|
| 1735 | - if (isset($status['url'])) {
|
|
| 1736 | - echo $status['url']; |
|
| 1737 | - } else {
|
|
| 1738 | - echo 'x'; |
|
| 1739 | - } |
|
| 1740 | - exit; |
|
| 1741 | - } |
|
| 1688 | + /** |
|
| 1689 | + * Get upload directory path details |
|
| 1690 | + * |
|
| 1691 | + * @since 1.0.0 |
|
| 1692 | + * @package GeoDirectory |
|
| 1693 | + * @global object $current_user Current user object. |
|
| 1694 | + * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'. |
|
| 1695 | + * @return mixed Returns upload directory details as an array. |
|
| 1696 | + */ |
|
| 1697 | + function geodir_upload_dir($upload) |
|
| 1698 | + {
|
|
| 1699 | + global $current_user; |
|
| 1700 | + $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID; |
|
| 1701 | + $upload['path'] = $upload['basedir'] . $upload['subdir']; |
|
| 1702 | + $upload['url'] = $upload['baseurl'] . $upload['subdir']; |
|
| 1703 | + return $upload; |
|
| 1704 | + } |
|
| 1705 | + |
|
| 1706 | + /** |
|
| 1707 | + * Handles place file and image upload. |
|
| 1708 | + * |
|
| 1709 | + * @since 1.0.0 |
|
| 1710 | + * @package GeoDirectory |
|
| 1711 | + */ |
|
| 1712 | + function geodir_plupload_action() |
|
| 1713 | + {
|
|
| 1714 | + // check ajax nonce |
|
| 1715 | + $imgid = $_POST["imgid"]; |
|
| 1716 | + |
|
| 1717 | + check_ajax_referer($imgid . 'pluploadan'); |
|
| 1718 | + |
|
| 1719 | + // handle custom file uploaddir |
|
| 1720 | + add_filter('upload_dir', 'geodir_upload_dir');
|
|
| 1721 | + |
|
| 1722 | + // change file orientation if needed |
|
| 1723 | + $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']); |
|
| 1724 | + |
|
| 1725 | + // handle file upload |
|
| 1726 | + $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
|
|
| 1727 | + // remove handle custom file uploaddir |
|
| 1728 | + remove_filter('upload_dir', 'geodir_upload_dir');
|
|
| 1729 | + |
|
| 1730 | + if(!isset($status['url']) && isset($status['error'])){
|
|
| 1731 | + print_r($status); |
|
| 1732 | + } |
|
| 1733 | + |
|
| 1734 | + // send the uploaded file url in response |
|
| 1735 | + if (isset($status['url'])) {
|
|
| 1736 | + echo $status['url']; |
|
| 1737 | + } else {
|
|
| 1738 | + echo 'x'; |
|
| 1739 | + } |
|
| 1740 | + exit; |
|
| 1741 | + } |
|
| 1742 | 1742 | } |
| 1743 | 1743 | |
| 1744 | 1744 | /** |
@@ -1753,17 +1753,17 @@ discard block |
||
| 1753 | 1753 | */ |
| 1754 | 1754 | function geodir_get_video($post_id) |
| 1755 | 1755 | {
|
| 1756 | - global $wpdb, $plugin_prefix; |
|
| 1756 | + global $wpdb, $plugin_prefix; |
|
| 1757 | 1757 | |
| 1758 | - $post_type = get_post_type($post_id); |
|
| 1758 | + $post_type = get_post_type($post_id); |
|
| 1759 | 1759 | |
| 1760 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1760 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1761 | 1761 | |
| 1762 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1762 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1763 | 1763 | |
| 1764 | - if ($results) {
|
|
| 1765 | - return $results[0]->geodir_video; |
|
| 1766 | - } |
|
| 1764 | + if ($results) {
|
|
| 1765 | + return $results[0]->geodir_video; |
|
| 1766 | + } |
|
| 1767 | 1767 | |
| 1768 | 1768 | } |
| 1769 | 1769 | |
@@ -1779,40 +1779,40 @@ discard block |
||
| 1779 | 1779 | */ |
| 1780 | 1780 | function geodir_get_special_offers($post_id) |
| 1781 | 1781 | {
|
| 1782 | - global $wpdb, $plugin_prefix; |
|
| 1782 | + global $wpdb, $plugin_prefix; |
|
| 1783 | 1783 | |
| 1784 | - $post_type = get_post_type($post_id); |
|
| 1784 | + $post_type = get_post_type($post_id); |
|
| 1785 | 1785 | |
| 1786 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1786 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1787 | 1787 | |
| 1788 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1788 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1789 | 1789 | |
| 1790 | - if ($results) {
|
|
| 1791 | - return $results[0]->geodir_special_offers; |
|
| 1792 | - } |
|
| 1790 | + if ($results) {
|
|
| 1791 | + return $results[0]->geodir_special_offers; |
|
| 1792 | + } |
|
| 1793 | 1793 | |
| 1794 | 1794 | } |
| 1795 | 1795 | |
| 1796 | 1796 | if (!function_exists('geodir_max_upload_size')) {
|
| 1797 | - /** |
|
| 1798 | - * Get max upload file size |
|
| 1799 | - * |
|
| 1800 | - * @since 1.0.0 |
|
| 1801 | - * @package GeoDirectory |
|
| 1802 | - * @return mixed|void Returns max upload file size. |
|
| 1803 | - */ |
|
| 1804 | - function geodir_max_upload_size() |
|
| 1805 | - {
|
|
| 1806 | - $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
|
|
| 1807 | - |
|
| 1808 | - if ($max_filesize > 0 && $max_filesize < 1) {
|
|
| 1809 | - $max_filesize = (int)($max_filesize * 1024) . 'kb'; |
|
| 1810 | - } else {
|
|
| 1811 | - $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
|
| 1812 | - } |
|
| 1813 | - /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
| 1814 | - return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
|
|
| 1815 | - } |
|
| 1797 | + /** |
|
| 1798 | + * Get max upload file size |
|
| 1799 | + * |
|
| 1800 | + * @since 1.0.0 |
|
| 1801 | + * @package GeoDirectory |
|
| 1802 | + * @return mixed|void Returns max upload file size. |
|
| 1803 | + */ |
|
| 1804 | + function geodir_max_upload_size() |
|
| 1805 | + {
|
|
| 1806 | + $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
|
|
| 1807 | + |
|
| 1808 | + if ($max_filesize > 0 && $max_filesize < 1) {
|
|
| 1809 | + $max_filesize = (int)($max_filesize * 1024) . 'kb'; |
|
| 1810 | + } else {
|
|
| 1811 | + $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
|
| 1812 | + } |
|
| 1813 | + /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
| 1814 | + return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
|
|
| 1815 | + } |
|
| 1816 | 1816 | } |
| 1817 | 1817 | |
| 1818 | 1818 | |
@@ -1830,33 +1830,33 @@ discard block |
||
| 1830 | 1830 | */ |
| 1831 | 1831 | function geodir_add_custom_sort_options($fields, $post_type) |
| 1832 | 1832 | {
|
| 1833 | - global $wpdb; |
|
| 1833 | + global $wpdb; |
|
| 1834 | 1834 | |
| 1835 | - if ($post_type != '') {
|
|
| 1835 | + if ($post_type != '') {
|
|
| 1836 | 1836 | |
| 1837 | - $all_postypes = geodir_get_posttypes(); |
|
| 1837 | + $all_postypes = geodir_get_posttypes(); |
|
| 1838 | 1838 | |
| 1839 | - if (in_array($post_type, $all_postypes)) {
|
|
| 1839 | + if (in_array($post_type, $all_postypes)) {
|
|
| 1840 | 1840 | |
| 1841 | - $custom_fields = $wpdb->get_results( |
|
| 1842 | - $wpdb->prepare( |
|
| 1843 | - "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc", |
|
| 1844 | - array($post_type) |
|
| 1845 | - ), 'ARRAY_A' |
|
| 1846 | - ); |
|
| 1841 | + $custom_fields = $wpdb->get_results( |
|
| 1842 | + $wpdb->prepare( |
|
| 1843 | + "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc", |
|
| 1844 | + array($post_type) |
|
| 1845 | + ), 'ARRAY_A' |
|
| 1846 | + ); |
|
| 1847 | 1847 | |
| 1848 | - if (!empty($custom_fields)) {
|
|
| 1848 | + if (!empty($custom_fields)) {
|
|
| 1849 | 1849 | |
| 1850 | - foreach ($custom_fields as $val) {
|
|
| 1851 | - $fields[] = $val; |
|
| 1852 | - } |
|
| 1853 | - } |
|
| 1850 | + foreach ($custom_fields as $val) {
|
|
| 1851 | + $fields[] = $val; |
|
| 1852 | + } |
|
| 1853 | + } |
|
| 1854 | 1854 | |
| 1855 | - } |
|
| 1855 | + } |
|
| 1856 | 1856 | |
| 1857 | - } |
|
| 1857 | + } |
|
| 1858 | 1858 | |
| 1859 | - return $fields; |
|
| 1859 | + return $fields; |
|
| 1860 | 1860 | } |
| 1861 | 1861 | |
| 1862 | 1862 | |
@@ -1872,76 +1872,76 @@ discard block |
||
| 1872 | 1872 | function geodir_get_custom_sort_options($post_type = '') |
| 1873 | 1873 | {
|
| 1874 | 1874 | |
| 1875 | - global $wpdb; |
|
| 1876 | - |
|
| 1877 | - if ($post_type != '') {
|
|
| 1878 | - |
|
| 1879 | - $all_postypes = geodir_get_posttypes(); |
|
| 1880 | - |
|
| 1881 | - if (!in_array($post_type, $all_postypes)) |
|
| 1882 | - return false; |
|
| 1883 | - |
|
| 1884 | - $fields = array(); |
|
| 1885 | - |
|
| 1886 | - $fields[] = array( |
|
| 1887 | - 'post_type' => $post_type, |
|
| 1888 | - 'data_type' => '', |
|
| 1889 | - 'field_type' => 'random', |
|
| 1890 | - 'site_title' => 'Random', |
|
| 1891 | - 'htmlvar_name' => 'post_title', |
|
| 1892 | - 'field_icon' => 'fa fa-random', |
|
| 1893 | - 'description' => __('Random sort (not recommended for large sites)', 'geodirectory')
|
|
| 1894 | - ); |
|
| 1895 | - |
|
| 1896 | - $fields[] = array( |
|
| 1897 | - 'post_type' => $post_type, |
|
| 1898 | - 'data_type' => '', |
|
| 1899 | - 'field_type' => 'datetime', |
|
| 1900 | - 'site_title' => __('Add date', 'geodirectory'),
|
|
| 1901 | - 'htmlvar_name' => 'post_date', |
|
| 1902 | - 'field_icon' => 'fa fa-calendar', |
|
| 1903 | - 'description' => __('Sort by date added', 'geodirectory')
|
|
| 1904 | - ); |
|
| 1905 | - $fields[] = array( |
|
| 1906 | - 'post_type' => $post_type, |
|
| 1907 | - 'data_type' => '', |
|
| 1908 | - 'field_type' => 'bigint', |
|
| 1909 | - 'site_title' => __('Review', 'geodirectory'),
|
|
| 1910 | - 'htmlvar_name' => 'comment_count', |
|
| 1911 | - 'field_icon' => 'fa fa-commenting-o', |
|
| 1912 | - 'description' => __('Sort by the number of reviews', 'geodirectory')
|
|
| 1913 | - ); |
|
| 1914 | - $fields[] = array( |
|
| 1915 | - 'post_type' => $post_type, |
|
| 1916 | - 'data_type' => '', |
|
| 1917 | - 'field_type' => 'float', |
|
| 1918 | - 'site_title' => __('Rating', 'geodirectory'),
|
|
| 1919 | - 'htmlvar_name' => 'overall_rating', |
|
| 1920 | - 'field_icon' => 'fa fa-star-o', |
|
| 1921 | - 'description' => __('Sort by the overall rating value', 'geodirectory')
|
|
| 1922 | - ); |
|
| 1923 | - $fields[] = array( |
|
| 1924 | - 'post_type' => $post_type, |
|
| 1925 | - 'data_type' => '', |
|
| 1926 | - 'field_type' => 'text', |
|
| 1927 | - 'site_title' => __('Title', 'geodirectory'),
|
|
| 1928 | - 'htmlvar_name' => 'post_title', |
|
| 1929 | - 'field_icon' => 'fa fa-sort-alpha-desc', |
|
| 1930 | - 'description' => __('Sort alphabetically by title', 'geodirectory')
|
|
| 1931 | - ); |
|
| 1932 | - |
|
| 1933 | - /** |
|
| 1934 | - * Hook to add custom sort options. |
|
| 1935 | - * |
|
| 1936 | - * @since 1.0.0 |
|
| 1937 | - * @param array $fields Unmodified sort options array. |
|
| 1938 | - * @param string $post_type Post type. |
|
| 1939 | - */ |
|
| 1940 | - return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
|
|
| 1941 | - |
|
| 1942 | - } |
|
| 1943 | - |
|
| 1944 | - return false; |
|
| 1875 | + global $wpdb; |
|
| 1876 | + |
|
| 1877 | + if ($post_type != '') {
|
|
| 1878 | + |
|
| 1879 | + $all_postypes = geodir_get_posttypes(); |
|
| 1880 | + |
|
| 1881 | + if (!in_array($post_type, $all_postypes)) |
|
| 1882 | + return false; |
|
| 1883 | + |
|
| 1884 | + $fields = array(); |
|
| 1885 | + |
|
| 1886 | + $fields[] = array( |
|
| 1887 | + 'post_type' => $post_type, |
|
| 1888 | + 'data_type' => '', |
|
| 1889 | + 'field_type' => 'random', |
|
| 1890 | + 'site_title' => 'Random', |
|
| 1891 | + 'htmlvar_name' => 'post_title', |
|
| 1892 | + 'field_icon' => 'fa fa-random', |
|
| 1893 | + 'description' => __('Random sort (not recommended for large sites)', 'geodirectory')
|
|
| 1894 | + ); |
|
| 1895 | + |
|
| 1896 | + $fields[] = array( |
|
| 1897 | + 'post_type' => $post_type, |
|
| 1898 | + 'data_type' => '', |
|
| 1899 | + 'field_type' => 'datetime', |
|
| 1900 | + 'site_title' => __('Add date', 'geodirectory'),
|
|
| 1901 | + 'htmlvar_name' => 'post_date', |
|
| 1902 | + 'field_icon' => 'fa fa-calendar', |
|
| 1903 | + 'description' => __('Sort by date added', 'geodirectory')
|
|
| 1904 | + ); |
|
| 1905 | + $fields[] = array( |
|
| 1906 | + 'post_type' => $post_type, |
|
| 1907 | + 'data_type' => '', |
|
| 1908 | + 'field_type' => 'bigint', |
|
| 1909 | + 'site_title' => __('Review', 'geodirectory'),
|
|
| 1910 | + 'htmlvar_name' => 'comment_count', |
|
| 1911 | + 'field_icon' => 'fa fa-commenting-o', |
|
| 1912 | + 'description' => __('Sort by the number of reviews', 'geodirectory')
|
|
| 1913 | + ); |
|
| 1914 | + $fields[] = array( |
|
| 1915 | + 'post_type' => $post_type, |
|
| 1916 | + 'data_type' => '', |
|
| 1917 | + 'field_type' => 'float', |
|
| 1918 | + 'site_title' => __('Rating', 'geodirectory'),
|
|
| 1919 | + 'htmlvar_name' => 'overall_rating', |
|
| 1920 | + 'field_icon' => 'fa fa-star-o', |
|
| 1921 | + 'description' => __('Sort by the overall rating value', 'geodirectory')
|
|
| 1922 | + ); |
|
| 1923 | + $fields[] = array( |
|
| 1924 | + 'post_type' => $post_type, |
|
| 1925 | + 'data_type' => '', |
|
| 1926 | + 'field_type' => 'text', |
|
| 1927 | + 'site_title' => __('Title', 'geodirectory'),
|
|
| 1928 | + 'htmlvar_name' => 'post_title', |
|
| 1929 | + 'field_icon' => 'fa fa-sort-alpha-desc', |
|
| 1930 | + 'description' => __('Sort alphabetically by title', 'geodirectory')
|
|
| 1931 | + ); |
|
| 1932 | + |
|
| 1933 | + /** |
|
| 1934 | + * Hook to add custom sort options. |
|
| 1935 | + * |
|
| 1936 | + * @since 1.0.0 |
|
| 1937 | + * @param array $fields Unmodified sort options array. |
|
| 1938 | + * @param string $post_type Post type. |
|
| 1939 | + */ |
|
| 1940 | + return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
|
|
| 1941 | + |
|
| 1942 | + } |
|
| 1943 | + |
|
| 1944 | + return false; |
|
| 1945 | 1945 | } |
| 1946 | 1946 | |
| 1947 | 1947 | |
@@ -1957,117 +1957,117 @@ discard block |
||
| 1957 | 1957 | function godir_set_sort_field_order($field_ids = array()) |
| 1958 | 1958 | {
|
| 1959 | 1959 | |
| 1960 | - global $wpdb; |
|
| 1960 | + global $wpdb; |
|
| 1961 | 1961 | |
| 1962 | - $count = 0; |
|
| 1963 | - if (!empty($field_ids)): |
|
| 1964 | - foreach ($field_ids as $id) {
|
|
| 1962 | + $count = 0; |
|
| 1963 | + if (!empty($field_ids)): |
|
| 1964 | + foreach ($field_ids as $id) {
|
|
| 1965 | 1965 | |
| 1966 | - $cf = trim($id, '_'); |
|
| 1966 | + $cf = trim($id, '_'); |
|
| 1967 | 1967 | |
| 1968 | - $post_meta_info = $wpdb->query( |
|
| 1969 | - $wpdb->prepare( |
|
| 1970 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 1968 | + $post_meta_info = $wpdb->query( |
|
| 1969 | + $wpdb->prepare( |
|
| 1970 | + "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 1971 | 1971 | sort_order=%d |
| 1972 | 1972 | where id= %d", |
| 1973 | - array($count, $cf) |
|
| 1974 | - ) |
|
| 1975 | - ); |
|
| 1976 | - $count++; |
|
| 1977 | - } |
|
| 1978 | - |
|
| 1979 | - return $field_ids; |
|
| 1980 | - else: |
|
| 1981 | - return false; |
|
| 1982 | - endif; |
|
| 1973 | + array($count, $cf) |
|
| 1974 | + ) |
|
| 1975 | + ); |
|
| 1976 | + $count++; |
|
| 1977 | + } |
|
| 1978 | + |
|
| 1979 | + return $field_ids; |
|
| 1980 | + else: |
|
| 1981 | + return false; |
|
| 1982 | + endif; |
|
| 1983 | 1983 | } |
| 1984 | 1984 | |
| 1985 | 1985 | |
| 1986 | 1986 | if (!function_exists('geodir_custom_sort_field_save')) {
|
| 1987 | - /** |
|
| 1988 | - * Save or Update custom sort fields into the database. |
|
| 1989 | - * |
|
| 1990 | - * @since 1.0.0 |
|
| 1991 | - * @package GeoDirectory |
|
| 1992 | - * @global object $wpdb WordPress Database object. |
|
| 1993 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 1994 | - * @param array $request_field {
|
|
| 1995 | - * Attributes of the Request field. |
|
| 1996 | - * |
|
| 1997 | - * @type string $action Ajax action name. |
|
| 1998 | - * @type string $manage_field_type Manage field type Default "sorting_options". |
|
| 1999 | - * @type string $create_field Do you want to create this field?. |
|
| 2000 | - * @type string $field_ins_upd Field created or updated?. |
|
| 2001 | - * @type string $_wpnonce Nonce value. |
|
| 2002 | - * @type string $listing_type The Post type. |
|
| 2003 | - * @type string $field_type Field Type. |
|
| 2004 | - * @type string $field_id Field ID. |
|
| 2005 | - * @type string $data_type Data Type. |
|
| 2006 | - * @type string $htmlvar_name HTML variable name. |
|
| 2007 | - * @type string $site_title Section title which you wish to display in frontend. |
|
| 2008 | - * @type string $is_default Is this default sorting?. |
|
| 2009 | - * @type string $is_active If not active then the field will not be displayed anywhere. |
|
| 2010 | - * @type string $sort_order Sort Order. |
|
| 2011 | - * |
|
| 2012 | - * } |
|
| 2013 | - * @param bool $default Not yet implemented. |
|
| 2014 | - * @return int Returns the last affected db table row id. |
|
| 2015 | - */ |
|
| 2016 | - function geodir_custom_sort_field_save($request_field = array(), $default = false) |
|
| 2017 | - {
|
|
| 2018 | - |
|
| 2019 | - global $wpdb, $plugin_prefix; |
|
| 2020 | - |
|
| 2021 | - $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
|
| 2022 | - |
|
| 2023 | - $cf = trim($result_str, '_'); |
|
| 2024 | - |
|
| 2025 | - /*-------- check duplicate validation --------*/ |
|
| 2026 | - |
|
| 2027 | - $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : ''; |
|
| 2028 | - $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 2029 | - |
|
| 2030 | - $post_type = $request_field['listing_type']; |
|
| 2031 | - $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : ''; |
|
| 2032 | - $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : ''; |
|
| 2033 | - $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : ''; |
|
| 2034 | - $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 2035 | - $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0; |
|
| 2036 | - $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0; |
|
| 2037 | - $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : ''; |
|
| 2038 | - $asc = isset($request_field['asc']) ? $request_field['asc'] : 0; |
|
| 2039 | - $desc = isset($request_field['desc']) ? $request_field['desc'] : 0; |
|
| 2040 | - $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : ''; |
|
| 2041 | - $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : ''; |
|
| 2042 | - |
|
| 2043 | - $default_order = ''; |
|
| 2044 | - if ($is_default != '') {
|
|
| 2045 | - $default_order = $is_default; |
|
| 2046 | - $is_default = '1'; |
|
| 2047 | - } |
|
| 2048 | - |
|
| 2049 | - |
|
| 2050 | - $check_html_variable = $wpdb->get_var( |
|
| 2051 | - $wpdb->prepare( |
|
| 2052 | - "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 2053 | - array($cehhtmlvar_name, $post_type, $field_type) |
|
| 2054 | - ) |
|
| 2055 | - ); |
|
| 2056 | - |
|
| 2057 | - if ($is_default == 1) {
|
|
| 2058 | - |
|
| 2059 | - $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 2060 | - |
|
| 2061 | - } |
|
| 2062 | - |
|
| 2063 | - |
|
| 2064 | - if (!$check_html_variable) {
|
|
| 2065 | - |
|
| 2066 | - $wpdb->query( |
|
| 2067 | - |
|
| 2068 | - $wpdb->prepare( |
|
| 2069 | - |
|
| 2070 | - "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 1987 | + /** |
|
| 1988 | + * Save or Update custom sort fields into the database. |
|
| 1989 | + * |
|
| 1990 | + * @since 1.0.0 |
|
| 1991 | + * @package GeoDirectory |
|
| 1992 | + * @global object $wpdb WordPress Database object. |
|
| 1993 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 1994 | + * @param array $request_field {
|
|
| 1995 | + * Attributes of the Request field. |
|
| 1996 | + * |
|
| 1997 | + * @type string $action Ajax action name. |
|
| 1998 | + * @type string $manage_field_type Manage field type Default "sorting_options". |
|
| 1999 | + * @type string $create_field Do you want to create this field?. |
|
| 2000 | + * @type string $field_ins_upd Field created or updated?. |
|
| 2001 | + * @type string $_wpnonce Nonce value. |
|
| 2002 | + * @type string $listing_type The Post type. |
|
| 2003 | + * @type string $field_type Field Type. |
|
| 2004 | + * @type string $field_id Field ID. |
|
| 2005 | + * @type string $data_type Data Type. |
|
| 2006 | + * @type string $htmlvar_name HTML variable name. |
|
| 2007 | + * @type string $site_title Section title which you wish to display in frontend. |
|
| 2008 | + * @type string $is_default Is this default sorting?. |
|
| 2009 | + * @type string $is_active If not active then the field will not be displayed anywhere. |
|
| 2010 | + * @type string $sort_order Sort Order. |
|
| 2011 | + * |
|
| 2012 | + * } |
|
| 2013 | + * @param bool $default Not yet implemented. |
|
| 2014 | + * @return int Returns the last affected db table row id. |
|
| 2015 | + */ |
|
| 2016 | + function geodir_custom_sort_field_save($request_field = array(), $default = false) |
|
| 2017 | + {
|
|
| 2018 | + |
|
| 2019 | + global $wpdb, $plugin_prefix; |
|
| 2020 | + |
|
| 2021 | + $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
|
| 2022 | + |
|
| 2023 | + $cf = trim($result_str, '_'); |
|
| 2024 | + |
|
| 2025 | + /*-------- check duplicate validation --------*/ |
|
| 2026 | + |
|
| 2027 | + $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : ''; |
|
| 2028 | + $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 2029 | + |
|
| 2030 | + $post_type = $request_field['listing_type']; |
|
| 2031 | + $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : ''; |
|
| 2032 | + $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : ''; |
|
| 2033 | + $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : ''; |
|
| 2034 | + $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 2035 | + $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0; |
|
| 2036 | + $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0; |
|
| 2037 | + $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : ''; |
|
| 2038 | + $asc = isset($request_field['asc']) ? $request_field['asc'] : 0; |
|
| 2039 | + $desc = isset($request_field['desc']) ? $request_field['desc'] : 0; |
|
| 2040 | + $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : ''; |
|
| 2041 | + $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : ''; |
|
| 2042 | + |
|
| 2043 | + $default_order = ''; |
|
| 2044 | + if ($is_default != '') {
|
|
| 2045 | + $default_order = $is_default; |
|
| 2046 | + $is_default = '1'; |
|
| 2047 | + } |
|
| 2048 | + |
|
| 2049 | + |
|
| 2050 | + $check_html_variable = $wpdb->get_var( |
|
| 2051 | + $wpdb->prepare( |
|
| 2052 | + "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 2053 | + array($cehhtmlvar_name, $post_type, $field_type) |
|
| 2054 | + ) |
|
| 2055 | + ); |
|
| 2056 | + |
|
| 2057 | + if ($is_default == 1) {
|
|
| 2058 | + |
|
| 2059 | + $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 2060 | + |
|
| 2061 | + } |
|
| 2062 | + |
|
| 2063 | + |
|
| 2064 | + if (!$check_html_variable) {
|
|
| 2065 | + |
|
| 2066 | + $wpdb->query( |
|
| 2067 | + |
|
| 2068 | + $wpdb->prepare( |
|
| 2069 | + |
|
| 2070 | + "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2071 | 2071 | post_type = %s, |
| 2072 | 2072 | data_type = %s, |
| 2073 | 2073 | field_type = %s, |
@@ -2082,23 +2082,23 @@ discard block |
||
| 2082 | 2082 | asc_title = %s, |
| 2083 | 2083 | desc_title = %s", |
| 2084 | 2084 | |
| 2085 | - array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title) |
|
| 2086 | - ) |
|
| 2085 | + array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title) |
|
| 2086 | + ) |
|
| 2087 | 2087 | |
| 2088 | - ); |
|
| 2088 | + ); |
|
| 2089 | 2089 | |
| 2090 | 2090 | |
| 2091 | - $lastid = $wpdb->insert_id; |
|
| 2091 | + $lastid = $wpdb->insert_id; |
|
| 2092 | 2092 | |
| 2093 | - $lastid = trim($lastid); |
|
| 2093 | + $lastid = trim($lastid); |
|
| 2094 | 2094 | |
| 2095 | - } else {
|
|
| 2095 | + } else {
|
|
| 2096 | 2096 | |
| 2097 | - $wpdb->query( |
|
| 2097 | + $wpdb->query( |
|
| 2098 | 2098 | |
| 2099 | - $wpdb->prepare( |
|
| 2099 | + $wpdb->prepare( |
|
| 2100 | 2100 | |
| 2101 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2101 | + "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2102 | 2102 | post_type = %s, |
| 2103 | 2103 | data_type = %s, |
| 2104 | 2104 | field_type = %s, |
@@ -2114,123 +2114,123 @@ discard block |
||
| 2114 | 2114 | desc_title = %s |
| 2115 | 2115 | where id = %d", |
| 2116 | 2116 | |
| 2117 | - array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title, $cf) |
|
| 2118 | - ) |
|
| 2117 | + array($post_type, $data_type, $field_type, $site_title, $htmlvar_name, $sort_order, $is_active, $is_default, $default_order, $asc, $desc, $asc_title, $desc_title, $cf) |
|
| 2118 | + ) |
|
| 2119 | 2119 | |
| 2120 | - ); |
|
| 2120 | + ); |
|
| 2121 | 2121 | |
| 2122 | - $lastid = trim($cf); |
|
| 2122 | + $lastid = trim($cf); |
|
| 2123 | 2123 | |
| 2124 | - } |
|
| 2124 | + } |
|
| 2125 | 2125 | |
| 2126 | 2126 | |
| 2127 | - return (int)$lastid; |
|
| 2127 | + return (int)$lastid; |
|
| 2128 | 2128 | |
| 2129 | - } |
|
| 2129 | + } |
|
| 2130 | 2130 | } |
| 2131 | 2131 | |
| 2132 | 2132 | |
| 2133 | 2133 | if (!function_exists('geodir_custom_sort_field_delete')) {
|
| 2134 | - /** |
|
| 2135 | - * Delete a custom sort field using field id. |
|
| 2136 | - * @since 1.0.0 |
|
| 2137 | - * @package GeoDirectory |
|
| 2138 | - * @global object $wpdb WordPress Database object. |
|
| 2139 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 2140 | - * @param string $field_id The field ID. |
|
| 2141 | - * @return int|string Returns field id when successful deletion, else returns 0. |
|
| 2142 | - */ |
|
| 2143 | - function geodir_custom_sort_field_delete($field_id = '') |
|
| 2144 | - {
|
|
| 2145 | - |
|
| 2146 | - global $wpdb, $plugin_prefix; |
|
| 2147 | - if ($field_id != '') {
|
|
| 2148 | - $cf = trim($field_id, '_'); |
|
| 2149 | - |
|
| 2150 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 2151 | - |
|
| 2152 | - return $field_id; |
|
| 2153 | - |
|
| 2154 | - } else |
|
| 2155 | - return 0; |
|
| 2156 | - |
|
| 2157 | - } |
|
| 2134 | + /** |
|
| 2135 | + * Delete a custom sort field using field id. |
|
| 2136 | + * @since 1.0.0 |
|
| 2137 | + * @package GeoDirectory |
|
| 2138 | + * @global object $wpdb WordPress Database object. |
|
| 2139 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 2140 | + * @param string $field_id The field ID. |
|
| 2141 | + * @return int|string Returns field id when successful deletion, else returns 0. |
|
| 2142 | + */ |
|
| 2143 | + function geodir_custom_sort_field_delete($field_id = '') |
|
| 2144 | + {
|
|
| 2145 | + |
|
| 2146 | + global $wpdb, $plugin_prefix; |
|
| 2147 | + if ($field_id != '') {
|
|
| 2148 | + $cf = trim($field_id, '_'); |
|
| 2149 | + |
|
| 2150 | + $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 2151 | + |
|
| 2152 | + return $field_id; |
|
| 2153 | + |
|
| 2154 | + } else |
|
| 2155 | + return 0; |
|
| 2156 | + |
|
| 2157 | + } |
|
| 2158 | 2158 | } |
| 2159 | 2159 | |
| 2160 | 2160 | |
| 2161 | 2161 | if (!function_exists('geodir_custom_sort_field_adminhtml')) {
|
| 2162 | - /** |
|
| 2163 | - * Custom sort field admin html. |
|
| 2164 | - * |
|
| 2165 | - * @since 1.0.0 |
|
| 2166 | - * @package GeoDirectory |
|
| 2167 | - * @global object $wpdb WordPress Database object. |
|
| 2168 | - * @param string $field_type The form field type. |
|
| 2169 | - * @param object|int $result_str The custom field results object or row id. |
|
| 2170 | - * @param string $field_ins_upd When set to "submit" displays form. |
|
| 2171 | - * @param bool $default when set to true field will be for admin use only. |
|
| 2172 | - */ |
|
| 2173 | - function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='') |
|
| 2174 | - {
|
|
| 2175 | - global $wpdb; |
|
| 2176 | - $cf = $result_str; |
|
| 2177 | - if (!is_object($cf)) {
|
|
| 2178 | - $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
|
|
| 2179 | - } else {
|
|
| 2180 | - $field_info = $cf; |
|
| 2181 | - $result_str = $cf->id; |
|
| 2182 | - } |
|
| 2183 | - |
|
| 2184 | - $field_info = stripslashes_deep($field_info); // strip slashes |
|
| 2185 | - |
|
| 2186 | - if (!isset($field_info->post_type)) {
|
|
| 2187 | - $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2188 | - } else {
|
|
| 2189 | - $post_type = $field_info->post_type; |
|
| 2190 | - } |
|
| 2191 | - |
|
| 2192 | - |
|
| 2193 | - $htmlvar_name = isset($field_type_key) ? $field_type_key : ''; |
|
| 2194 | - |
|
| 2195 | - $site_title = ''; |
|
| 2196 | - if ($site_title == '') |
|
| 2197 | - $site_title = isset($field_info->site_title) ? $field_info->site_title : ''; |
|
| 2198 | - |
|
| 2199 | - if ($site_title == '') {
|
|
| 2200 | - $fields = geodir_get_custom_sort_options($post_type); |
|
| 2201 | - |
|
| 2202 | - foreach ($fields as $val) {
|
|
| 2203 | - $val = stripslashes_deep($val); // strip slashes |
|
| 2204 | - |
|
| 2205 | - if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
|
|
| 2206 | - $site_title = isset($val['site_title']) ? $val['site_title'] : ''; |
|
| 2207 | - } |
|
| 2208 | - } |
|
| 2209 | - } |
|
| 2210 | - |
|
| 2211 | - if ($htmlvar_name == '') |
|
| 2212 | - $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
|
| 2213 | - |
|
| 2214 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 2215 | - |
|
| 2216 | - $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
| 2217 | - $cso_arr = geodir_get_custom_sort_options($post_type); |
|
| 2218 | - |
|
| 2219 | - $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']); |
|
| 2220 | - foreach($cso_arr as $cso){
|
|
| 2221 | - if($cur_field_type==$cso['field_type']){
|
|
| 2222 | - |
|
| 2223 | - if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
|
|
| 2224 | - $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>'; |
|
| 2225 | - }elseif(isset($cso['field_icon']) && $cso['field_icon']){
|
|
| 2226 | - $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
|
|
| 2227 | - } |
|
| 2228 | - |
|
| 2229 | - } |
|
| 2230 | - } |
|
| 2231 | - |
|
| 2232 | - $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500); |
|
| 2233 | - ?> |
|
| 2162 | + /** |
|
| 2163 | + * Custom sort field admin html. |
|
| 2164 | + * |
|
| 2165 | + * @since 1.0.0 |
|
| 2166 | + * @package GeoDirectory |
|
| 2167 | + * @global object $wpdb WordPress Database object. |
|
| 2168 | + * @param string $field_type The form field type. |
|
| 2169 | + * @param object|int $result_str The custom field results object or row id. |
|
| 2170 | + * @param string $field_ins_upd When set to "submit" displays form. |
|
| 2171 | + * @param bool $default when set to true field will be for admin use only. |
|
| 2172 | + */ |
|
| 2173 | + function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='') |
|
| 2174 | + {
|
|
| 2175 | + global $wpdb; |
|
| 2176 | + $cf = $result_str; |
|
| 2177 | + if (!is_object($cf)) {
|
|
| 2178 | + $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
|
|
| 2179 | + } else {
|
|
| 2180 | + $field_info = $cf; |
|
| 2181 | + $result_str = $cf->id; |
|
| 2182 | + } |
|
| 2183 | + |
|
| 2184 | + $field_info = stripslashes_deep($field_info); // strip slashes |
|
| 2185 | + |
|
| 2186 | + if (!isset($field_info->post_type)) {
|
|
| 2187 | + $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2188 | + } else {
|
|
| 2189 | + $post_type = $field_info->post_type; |
|
| 2190 | + } |
|
| 2191 | + |
|
| 2192 | + |
|
| 2193 | + $htmlvar_name = isset($field_type_key) ? $field_type_key : ''; |
|
| 2194 | + |
|
| 2195 | + $site_title = ''; |
|
| 2196 | + if ($site_title == '') |
|
| 2197 | + $site_title = isset($field_info->site_title) ? $field_info->site_title : ''; |
|
| 2198 | + |
|
| 2199 | + if ($site_title == '') {
|
|
| 2200 | + $fields = geodir_get_custom_sort_options($post_type); |
|
| 2201 | + |
|
| 2202 | + foreach ($fields as $val) {
|
|
| 2203 | + $val = stripslashes_deep($val); // strip slashes |
|
| 2204 | + |
|
| 2205 | + if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
|
|
| 2206 | + $site_title = isset($val['site_title']) ? $val['site_title'] : ''; |
|
| 2207 | + } |
|
| 2208 | + } |
|
| 2209 | + } |
|
| 2210 | + |
|
| 2211 | + if ($htmlvar_name == '') |
|
| 2212 | + $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
|
| 2213 | + |
|
| 2214 | + $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 2215 | + |
|
| 2216 | + $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
| 2217 | + $cso_arr = geodir_get_custom_sort_options($post_type); |
|
| 2218 | + |
|
| 2219 | + $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']); |
|
| 2220 | + foreach($cso_arr as $cso){
|
|
| 2221 | + if($cur_field_type==$cso['field_type']){
|
|
| 2222 | + |
|
| 2223 | + if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
|
|
| 2224 | + $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>'; |
|
| 2225 | + }elseif(isset($cso['field_icon']) && $cso['field_icon']){
|
|
| 2226 | + $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
|
|
| 2227 | + } |
|
| 2228 | + |
|
| 2229 | + } |
|
| 2230 | + } |
|
| 2231 | + |
|
| 2232 | + $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500); |
|
| 2233 | + ?> |
|
| 2234 | 2234 | |
| 2235 | 2235 | <li class="text" id="licontainer_<?php echo $result_str;?>"> |
| 2236 | 2236 | <form><!-- we need to wrap in a form so we can use radio buttons with same name --> |
@@ -2239,7 +2239,7 @@ discard block |
||
| 2239 | 2239 | ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
|
| 2240 | 2240 | <?php |
| 2241 | 2241 | |
| 2242 | - ?> |
|
| 2242 | + ?> |
|
| 2243 | 2243 | |
| 2244 | 2244 | <div title="<?php _e('Click to remove field', 'geodirectory');?>"
|
| 2245 | 2245 | onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
|
@@ -2254,17 +2254,17 @@ discard block |
||
| 2254 | 2254 | |
| 2255 | 2255 | <div id="field_frm<?php echo $result_str;?>" class="field_frm" |
| 2256 | 2256 | style="display:<?php if ($field_ins_upd == 'submit') {
|
| 2257 | - echo 'block;'; |
|
| 2258 | - } else {
|
|
| 2259 | - echo 'none;'; |
|
| 2260 | - } ?>"> |
|
| 2257 | + echo 'block;'; |
|
| 2258 | + } else {
|
|
| 2259 | + echo 'none;'; |
|
| 2260 | + } ?>"> |
|
| 2261 | 2261 | <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/> |
| 2262 | 2262 | <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/> |
| 2263 | 2263 | <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/> |
| 2264 | 2264 | <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/> |
| 2265 | 2265 | <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
|
| 2266 | - echo $field_info->data_type; |
|
| 2267 | - }?>"/> |
|
| 2266 | + echo $field_info->data_type; |
|
| 2267 | + }?>"/> |
|
| 2268 | 2268 | <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/> |
| 2269 | 2269 | |
| 2270 | 2270 | |
@@ -2287,14 +2287,14 @@ discard block |
||
| 2287 | 2287 | |
| 2288 | 2288 | <input type="radio" id="asc_yes<?php echo $radio_id;?>" name="asc" class="gdri-enabled" value="1" |
| 2289 | 2289 | <?php if ($value == '1') {
|
| 2290 | - echo 'checked'; |
|
| 2291 | - } ?>/> |
|
| 2290 | + echo 'checked'; |
|
| 2291 | + } ?>/> |
|
| 2292 | 2292 | <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 2293 | 2293 | |
| 2294 | 2294 | <input type="radio" id="asc_no<?php echo $radio_id;?>" name="asc" class="gdri-disabled" value="0" |
| 2295 | 2295 | <?php if ($value == '0' || !$value) {
|
| 2296 | - echo 'checked'; |
|
| 2297 | - } ?>/> |
|
| 2296 | + echo 'checked'; |
|
| 2297 | + } ?>/> |
|
| 2298 | 2298 | <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 2299 | 2299 | |
| 2300 | 2300 | </div> |
@@ -2331,8 +2331,8 @@ discard block |
||
| 2331 | 2331 | |
| 2332 | 2332 | <input type="radio" name="is_default" |
| 2333 | 2333 | value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
|
| 2334 | - echo 'checked="checked"'; |
|
| 2335 | - } ?>/> |
|
| 2334 | + echo 'checked="checked"'; |
|
| 2335 | + } ?>/> |
|
| 2336 | 2336 | </div> |
| 2337 | 2337 | |
| 2338 | 2338 | </li> |
@@ -2352,14 +2352,14 @@ discard block |
||
| 2352 | 2352 | |
| 2353 | 2353 | <input type="radio" id="desc_yes<?php echo $radio_id;?>" name="desc" class="gdri-enabled" value="1" |
| 2354 | 2354 | <?php if ($value == '1') {
|
| 2355 | - echo 'checked'; |
|
| 2356 | - } ?>/> |
|
| 2355 | + echo 'checked'; |
|
| 2356 | + } ?>/> |
|
| 2357 | 2357 | <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 2358 | 2358 | |
| 2359 | 2359 | <input type="radio" id="desc_no<?php echo $radio_id;?>" name="desc" class="gdri-disabled" value="0" |
| 2360 | 2360 | <?php if ($value == '0' || !$value) {
|
| 2361 | - echo 'checked'; |
|
| 2362 | - } ?>/> |
|
| 2361 | + echo 'checked'; |
|
| 2362 | + } ?>/> |
|
| 2363 | 2363 | <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 2364 | 2364 | |
| 2365 | 2365 | </div> |
@@ -2395,8 +2395,8 @@ discard block |
||
| 2395 | 2395 | |
| 2396 | 2396 | <input type="radio" name="is_default" |
| 2397 | 2397 | value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
|
| 2398 | - echo 'checked="checked"'; |
|
| 2399 | - } ?>/> |
|
| 2398 | + echo 'checked="checked"'; |
|
| 2399 | + } ?>/> |
|
| 2400 | 2400 | </div> |
| 2401 | 2401 | |
| 2402 | 2402 | </li> |
@@ -2438,8 +2438,8 @@ discard block |
||
| 2438 | 2438 | |
| 2439 | 2439 | <input type="checkbox" name="is_default" |
| 2440 | 2440 | value="<?php echo $field_type; ?>" <?php if (isset($value) && $value == '1') {
|
| 2441 | - echo 'checked="checked"'; |
|
| 2442 | - } ?>/> |
|
| 2441 | + echo 'checked="checked"'; |
|
| 2442 | + } ?>/> |
|
| 2443 | 2443 | </div> |
| 2444 | 2444 | |
| 2445 | 2445 | |
@@ -2462,14 +2462,14 @@ discard block |
||
| 2462 | 2462 | |
| 2463 | 2463 | <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
| 2464 | 2464 | <?php if ($value == '1') {
|
| 2465 | - echo 'checked'; |
|
| 2466 | - } ?>/> |
|
| 2465 | + echo 'checked'; |
|
| 2466 | + } ?>/> |
|
| 2467 | 2467 | <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 2468 | 2468 | |
| 2469 | 2469 | <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
| 2470 | 2470 | <?php if ($value == '0' || !$value) {
|
| 2471 | - echo 'checked'; |
|
| 2472 | - } ?>/> |
|
| 2471 | + echo 'checked'; |
|
| 2472 | + } ?>/> |
|
| 2473 | 2473 | <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 2474 | 2474 | |
| 2475 | 2475 | </div> |
@@ -2479,8 +2479,8 @@ discard block |
||
| 2479 | 2479 | |
| 2480 | 2480 | <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" |
| 2481 | 2481 | value="<?php if (isset($field_info->sort_order)) {
|
| 2482 | - echo esc_attr($field_info->sort_order); |
|
| 2483 | - }?>" size="50"/> |
|
| 2482 | + echo esc_attr($field_info->sort_order); |
|
| 2483 | + }?>" size="50"/> |
|
| 2484 | 2484 | |
| 2485 | 2485 | |
| 2486 | 2486 | |
@@ -2504,38 +2504,38 @@ discard block |
||
| 2504 | 2504 | </form> |
| 2505 | 2505 | </li> <?php |
| 2506 | 2506 | |
| 2507 | - } |
|
| 2507 | + } |
|
| 2508 | 2508 | } |
| 2509 | 2509 | |
| 2510 | 2510 | if (!function_exists('check_field_visibility')) {
|
| 2511 | - /** |
|
| 2512 | - * Check field visibility as per price package. |
|
| 2513 | - * |
|
| 2514 | - * @since 1.0.0 |
|
| 2515 | - * @package GeoDirectory |
|
| 2516 | - * @global object $wpdb WordPress Database object. |
|
| 2517 | - * @global array $geodir_addon_list List of active GeoDirectory extensions. |
|
| 2518 | - * @param int|string $package_id The package ID. |
|
| 2519 | - * @param string $field_name The field name. |
|
| 2520 | - * @param string $post_type Optional. The wordpress post type. |
|
| 2521 | - * @return bool Returns true when field visible, otherwise false. |
|
| 2522 | - */ |
|
| 2523 | - function check_field_visibility($package_id, $field_name, $post_type) |
|
| 2524 | - {
|
|
| 2525 | - global $wpdb, $geodir_addon_list; |
|
| 2526 | - if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
|
|
| 2527 | - return true; |
|
| 2528 | - } |
|
| 2529 | - if (!$package_id || !$field_name || !$post_type) {
|
|
| 2530 | - return true; |
|
| 2531 | - } |
|
| 2532 | - $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
|
|
| 2533 | - |
|
| 2534 | - if ($wpdb->get_var($sql)) {
|
|
| 2535 | - return true; |
|
| 2536 | - } |
|
| 2537 | - return false; |
|
| 2538 | - } |
|
| 2511 | + /** |
|
| 2512 | + * Check field visibility as per price package. |
|
| 2513 | + * |
|
| 2514 | + * @since 1.0.0 |
|
| 2515 | + * @package GeoDirectory |
|
| 2516 | + * @global object $wpdb WordPress Database object. |
|
| 2517 | + * @global array $geodir_addon_list List of active GeoDirectory extensions. |
|
| 2518 | + * @param int|string $package_id The package ID. |
|
| 2519 | + * @param string $field_name The field name. |
|
| 2520 | + * @param string $post_type Optional. The wordpress post type. |
|
| 2521 | + * @return bool Returns true when field visible, otherwise false. |
|
| 2522 | + */ |
|
| 2523 | + function check_field_visibility($package_id, $field_name, $post_type) |
|
| 2524 | + {
|
|
| 2525 | + global $wpdb, $geodir_addon_list; |
|
| 2526 | + if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
|
|
| 2527 | + return true; |
|
| 2528 | + } |
|
| 2529 | + if (!$package_id || !$field_name || !$post_type) {
|
|
| 2530 | + return true; |
|
| 2531 | + } |
|
| 2532 | + $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
|
|
| 2533 | + |
|
| 2534 | + if ($wpdb->get_var($sql)) {
|
|
| 2535 | + return true; |
|
| 2536 | + } |
|
| 2537 | + return false; |
|
| 2538 | + } |
|
| 2539 | 2539 | } |
| 2540 | 2540 | |
| 2541 | 2541 | /** |
@@ -2551,43 +2551,43 @@ discard block |
||
| 2551 | 2551 | */ |
| 2552 | 2552 | function geodir_string_to_options($input = '', $translated = false) |
| 2553 | 2553 | {
|
| 2554 | - $return = array(); |
|
| 2555 | - if ($input != '') {
|
|
| 2556 | - $input = trim($input); |
|
| 2557 | - $input = rtrim($input, ","); |
|
| 2558 | - $input = ltrim($input, ","); |
|
| 2559 | - $input = trim($input); |
|
| 2560 | - } |
|
| 2561 | - |
|
| 2562 | - $input_arr = explode(',', $input);
|
|
| 2563 | - |
|
| 2564 | - if (!empty($input_arr)) {
|
|
| 2565 | - foreach ($input_arr as $input_str) {
|
|
| 2566 | - $input_str = trim($input_str); |
|
| 2567 | - |
|
| 2568 | - if (strpos($input_str, "/") !== false) {
|
|
| 2569 | - $input_str = explode("/", $input_str, 2);
|
|
| 2570 | - $label = trim($input_str[0]); |
|
| 2571 | - if ($translated && $label != '') {
|
|
| 2572 | - $label = __($label, 'geodirectory'); |
|
| 2573 | - } |
|
| 2574 | - $label = ucfirst($label); |
|
| 2575 | - $value = trim($input_str[1]); |
|
| 2576 | - } else {
|
|
| 2577 | - $value = $input_str; |
|
| 2578 | - if ($translated && $input_str != '') {
|
|
| 2579 | - $input_str = __($input_str, 'geodirectory'); |
|
| 2580 | - } |
|
| 2581 | - $label = ucfirst($input_str); |
|
| 2582 | - } |
|
| 2583 | - |
|
| 2584 | - if ($label != '') {
|
|
| 2585 | - $return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
|
|
| 2586 | - } |
|
| 2587 | - } |
|
| 2588 | - } |
|
| 2589 | - |
|
| 2590 | - return $return; |
|
| 2554 | + $return = array(); |
|
| 2555 | + if ($input != '') {
|
|
| 2556 | + $input = trim($input); |
|
| 2557 | + $input = rtrim($input, ","); |
|
| 2558 | + $input = ltrim($input, ","); |
|
| 2559 | + $input = trim($input); |
|
| 2560 | + } |
|
| 2561 | + |
|
| 2562 | + $input_arr = explode(',', $input);
|
|
| 2563 | + |
|
| 2564 | + if (!empty($input_arr)) {
|
|
| 2565 | + foreach ($input_arr as $input_str) {
|
|
| 2566 | + $input_str = trim($input_str); |
|
| 2567 | + |
|
| 2568 | + if (strpos($input_str, "/") !== false) {
|
|
| 2569 | + $input_str = explode("/", $input_str, 2);
|
|
| 2570 | + $label = trim($input_str[0]); |
|
| 2571 | + if ($translated && $label != '') {
|
|
| 2572 | + $label = __($label, 'geodirectory'); |
|
| 2573 | + } |
|
| 2574 | + $label = ucfirst($label); |
|
| 2575 | + $value = trim($input_str[1]); |
|
| 2576 | + } else {
|
|
| 2577 | + $value = $input_str; |
|
| 2578 | + if ($translated && $input_str != '') {
|
|
| 2579 | + $input_str = __($input_str, 'geodirectory'); |
|
| 2580 | + } |
|
| 2581 | + $label = ucfirst($input_str); |
|
| 2582 | + } |
|
| 2583 | + |
|
| 2584 | + if ($label != '') {
|
|
| 2585 | + $return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
|
|
| 2586 | + } |
|
| 2587 | + } |
|
| 2588 | + } |
|
| 2589 | + |
|
| 2590 | + return $return; |
|
| 2591 | 2591 | } |
| 2592 | 2592 | |
| 2593 | 2593 | /** |
@@ -2602,66 +2602,66 @@ discard block |
||
| 2602 | 2602 | */ |
| 2603 | 2603 | function geodir_string_values_to_options($option_values = '', $translated = false) |
| 2604 | 2604 | {
|
| 2605 | - $options = array(); |
|
| 2606 | - if ($option_values == '') {
|
|
| 2607 | - return NULL; |
|
| 2608 | - } |
|
| 2609 | - |
|
| 2610 | - if (strpos($option_values, "{/optgroup}") !== false) {
|
|
| 2611 | - $option_values_arr = explode("{/optgroup}", $option_values);
|
|
| 2612 | - |
|
| 2613 | - foreach ($option_values_arr as $optgroup) {
|
|
| 2614 | - if (strpos($optgroup, "{optgroup}") !== false) {
|
|
| 2615 | - $optgroup_arr = explode("{optgroup}", $optgroup);
|
|
| 2616 | - |
|
| 2617 | - $count = 0; |
|
| 2618 | - foreach ($optgroup_arr as $optgroup_str) {
|
|
| 2619 | - $count++; |
|
| 2620 | - $optgroup_str = trim($optgroup_str); |
|
| 2621 | - |
|
| 2622 | - $optgroup_label = ''; |
|
| 2623 | - if (strpos($optgroup_str, "|") !== false) {
|
|
| 2624 | - $optgroup_str_arr = explode("|", $optgroup_str, 2);
|
|
| 2625 | - $optgroup_label = trim($optgroup_str_arr[0]); |
|
| 2626 | - if ($translated && $optgroup_label != '') {
|
|
| 2627 | - $optgroup_label = __($optgroup_label, 'geodirectory'); |
|
| 2628 | - } |
|
| 2629 | - $optgroup_label = ucfirst($optgroup_label); |
|
| 2630 | - $optgroup_str = $optgroup_str_arr[1]; |
|
| 2631 | - } |
|
| 2632 | - |
|
| 2633 | - $optgroup3 = geodir_string_to_options($optgroup_str, $translated); |
|
| 2634 | - |
|
| 2635 | - if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
|
|
| 2636 | - $optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
|
|
| 2637 | - $optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
|
|
| 2638 | - $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end); |
|
| 2639 | - } |
|
| 2640 | - $options = array_merge($options, $optgroup3); |
|
| 2641 | - } |
|
| 2642 | - } else {
|
|
| 2643 | - $optgroup1 = geodir_string_to_options($optgroup, $translated); |
|
| 2644 | - $options = array_merge($options, $optgroup1); |
|
| 2645 | - } |
|
| 2646 | - } |
|
| 2647 | - } else {
|
|
| 2648 | - $options = geodir_string_to_options($option_values, $translated); |
|
| 2649 | - } |
|
| 2650 | - |
|
| 2651 | - return $options; |
|
| 2605 | + $options = array(); |
|
| 2606 | + if ($option_values == '') {
|
|
| 2607 | + return NULL; |
|
| 2608 | + } |
|
| 2609 | + |
|
| 2610 | + if (strpos($option_values, "{/optgroup}") !== false) {
|
|
| 2611 | + $option_values_arr = explode("{/optgroup}", $option_values);
|
|
| 2612 | + |
|
| 2613 | + foreach ($option_values_arr as $optgroup) {
|
|
| 2614 | + if (strpos($optgroup, "{optgroup}") !== false) {
|
|
| 2615 | + $optgroup_arr = explode("{optgroup}", $optgroup);
|
|
| 2616 | + |
|
| 2617 | + $count = 0; |
|
| 2618 | + foreach ($optgroup_arr as $optgroup_str) {
|
|
| 2619 | + $count++; |
|
| 2620 | + $optgroup_str = trim($optgroup_str); |
|
| 2621 | + |
|
| 2622 | + $optgroup_label = ''; |
|
| 2623 | + if (strpos($optgroup_str, "|") !== false) {
|
|
| 2624 | + $optgroup_str_arr = explode("|", $optgroup_str, 2);
|
|
| 2625 | + $optgroup_label = trim($optgroup_str_arr[0]); |
|
| 2626 | + if ($translated && $optgroup_label != '') {
|
|
| 2627 | + $optgroup_label = __($optgroup_label, 'geodirectory'); |
|
| 2628 | + } |
|
| 2629 | + $optgroup_label = ucfirst($optgroup_label); |
|
| 2630 | + $optgroup_str = $optgroup_str_arr[1]; |
|
| 2631 | + } |
|
| 2632 | + |
|
| 2633 | + $optgroup3 = geodir_string_to_options($optgroup_str, $translated); |
|
| 2634 | + |
|
| 2635 | + if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
|
|
| 2636 | + $optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
|
|
| 2637 | + $optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
|
|
| 2638 | + $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end); |
|
| 2639 | + } |
|
| 2640 | + $options = array_merge($options, $optgroup3); |
|
| 2641 | + } |
|
| 2642 | + } else {
|
|
| 2643 | + $optgroup1 = geodir_string_to_options($optgroup, $translated); |
|
| 2644 | + $options = array_merge($options, $optgroup1); |
|
| 2645 | + } |
|
| 2646 | + } |
|
| 2647 | + } else {
|
|
| 2648 | + $options = geodir_string_to_options($option_values, $translated); |
|
| 2649 | + } |
|
| 2650 | + |
|
| 2651 | + return $options; |
|
| 2652 | 2652 | } |
| 2653 | 2653 | |
| 2654 | 2654 | |
| 2655 | 2655 | function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
|
| 2656 | - ob_start(); |
|
| 2657 | - |
|
| 2658 | - $dt_value = ''; |
|
| 2659 | - if (isset($field_info->data_type)) {
|
|
| 2660 | - $dt_value = esc_attr($field_info->data_type); |
|
| 2661 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 2662 | - $dt_value = $cf['defaults']['data_type']; |
|
| 2663 | - } |
|
| 2664 | - ?> |
|
| 2656 | + ob_start(); |
|
| 2657 | + |
|
| 2658 | + $dt_value = ''; |
|
| 2659 | + if (isset($field_info->data_type)) {
|
|
| 2660 | + $dt_value = esc_attr($field_info->data_type); |
|
| 2661 | + }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 2662 | + $dt_value = $cf['defaults']['data_type']; |
|
| 2663 | + } |
|
| 2664 | + ?> |
|
| 2665 | 2665 | <li> |
| 2666 | 2666 | <label for="data_type"><?php _e('Field Data Type ? :', 'geodirectory'); ?></label>
|
| 2667 | 2667 | <div class="gd-cf-input-wrap"> |
@@ -2670,16 +2670,16 @@ discard block |
||
| 2670 | 2670 | onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');"> |
| 2671 | 2671 | <option |
| 2672 | 2672 | value="XVARCHAR" <?php if ($dt_value == 'VARCHAR') {
|
| 2673 | - echo 'selected="selected"'; |
|
| 2674 | - } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
|
|
| 2673 | + echo 'selected="selected"'; |
|
| 2674 | + } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
|
|
| 2675 | 2675 | <option |
| 2676 | 2676 | value="INT" <?php if ($dt_value == 'INT') {
|
| 2677 | - echo 'selected="selected"'; |
|
| 2678 | - } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
|
|
| 2677 | + echo 'selected="selected"'; |
|
| 2678 | + } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
|
|
| 2679 | 2679 | <option |
| 2680 | 2680 | value="FLOAT" <?php if ($dt_value == 'FLOAT') {
|
| 2681 | - echo 'selected="selected"'; |
|
| 2682 | - } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
|
|
| 2681 | + echo 'selected="selected"'; |
|
| 2682 | + } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
|
|
| 2683 | 2683 | </select> |
| 2684 | 2684 | <br/> <span><?php _e('Select Custom Field type', 'geodirectory'); ?></span>
|
| 2685 | 2685 | |
@@ -2687,13 +2687,13 @@ discard block |
||
| 2687 | 2687 | </li> |
| 2688 | 2688 | |
| 2689 | 2689 | <?php |
| 2690 | - $value = ''; |
|
| 2691 | - if (isset($field_info->decimal_point)) {
|
|
| 2692 | - $value = esc_attr($field_info->decimal_point); |
|
| 2693 | - }elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
|
|
| 2694 | - $value = $cf['defaults']['decimal_point']; |
|
| 2695 | - } |
|
| 2696 | - ?> |
|
| 2690 | + $value = ''; |
|
| 2691 | + if (isset($field_info->decimal_point)) {
|
|
| 2692 | + $value = esc_attr($field_info->decimal_point); |
|
| 2693 | + }elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
|
|
| 2694 | + $value = $cf['defaults']['decimal_point']; |
|
| 2695 | + } |
|
| 2696 | + ?> |
|
| 2697 | 2697 | |
| 2698 | 2698 | <li class="decimal-point-wrapper" |
| 2699 | 2699 | style="<?php echo ($dt_value == 'FLOAT') ? '' : 'display:none' ?>"> |
@@ -2702,7 +2702,7 @@ discard block |
||
| 2702 | 2702 | <select name="decimal_point" id="decimal_point"> |
| 2703 | 2703 | <option value=""><?php echo _e('Select', 'geodirectory'); ?></option>
|
| 2704 | 2704 | <?php for ($i = 1; $i <= 10; $i++) {
|
| 2705 | - $selected = $i == $value ? 'selected="selected"' : ''; ?> |
|
| 2705 | + $selected = $i == $value ? 'selected="selected"' : ''; ?> |
|
| 2706 | 2706 | <option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?></option> |
| 2707 | 2707 | <?php } ?> |
| 2708 | 2708 | </select> |
@@ -2711,8 +2711,8 @@ discard block |
||
| 2711 | 2711 | </li> |
| 2712 | 2712 | <?php |
| 2713 | 2713 | |
| 2714 | - $output = ob_get_clean(); |
|
| 2715 | - return $output; |
|
| 2714 | + $output = ob_get_clean(); |
|
| 2715 | + return $output; |
|
| 2716 | 2716 | } |
| 2717 | 2717 | add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
|
| 2718 | 2718 | |
@@ -2750,9 +2750,9 @@ discard block |
||
| 2750 | 2750 | |
| 2751 | 2751 | |
| 2752 | 2752 | function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
|
| 2753 | - if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
|
|
| 2754 | - ob_start(); |
|
| 2755 | - ?> |
|
| 2753 | + if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
|
|
| 2754 | + ob_start(); |
|
| 2755 | + ?> |
|
| 2756 | 2756 | <li> |
| 2757 | 2757 | <label for="advanced_editor" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show advanced editor :', 'geodirectory'); ?>
|
| 2758 | 2758 | <div class="gdcf-tooltip"> |
@@ -2763,13 +2763,13 @@ discard block |
||
| 2763 | 2763 | <div class="gd-cf-input-wrap"> |
| 2764 | 2764 | |
| 2765 | 2765 | <?php |
| 2766 | - $selected = ''; |
|
| 2767 | - if (isset($field_info->extra_fields)) |
|
| 2768 | - $advanced_editor = unserialize($field_info->extra_fields); |
|
| 2766 | + $selected = ''; |
|
| 2767 | + if (isset($field_info->extra_fields)) |
|
| 2768 | + $advanced_editor = unserialize($field_info->extra_fields); |
|
| 2769 | 2769 | |
| 2770 | - if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
|
|
| 2771 | - $selected = 'checked="checked"'; |
|
| 2772 | - ?> |
|
| 2770 | + if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
|
|
| 2771 | + $selected = 'checked="checked"'; |
|
| 2772 | + ?> |
|
| 2773 | 2773 | |
| 2774 | 2774 | <input type="checkbox" name="advanced_editor[]" id="advanced_editor" |
| 2775 | 2775 | value="1" <?php echo $selected; ?>/> |
@@ -2778,22 +2778,22 @@ discard block |
||
| 2778 | 2778 | </li> |
| 2779 | 2779 | <?php |
| 2780 | 2780 | |
| 2781 | - $output = ob_get_clean(); |
|
| 2782 | - return $output; |
|
| 2781 | + $output = ob_get_clean(); |
|
| 2782 | + return $output; |
|
| 2783 | 2783 | } |
| 2784 | 2784 | add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
|
| 2785 | 2785 | |
| 2786 | 2786 | |
| 2787 | 2787 | function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
|
| 2788 | - ob_start(); |
|
| 2789 | - |
|
| 2790 | - $value = ''; |
|
| 2791 | - if (isset($field_info->validation_pattern)) {
|
|
| 2792 | - $value = esc_attr($field_info->validation_pattern); |
|
| 2793 | - }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
|
|
| 2794 | - $value = esc_attr($cf['defaults']['validation_pattern']); |
|
| 2795 | - } |
|
| 2796 | - ?> |
|
| 2788 | + ob_start(); |
|
| 2789 | + |
|
| 2790 | + $value = ''; |
|
| 2791 | + if (isset($field_info->validation_pattern)) {
|
|
| 2792 | + $value = esc_attr($field_info->validation_pattern); |
|
| 2793 | + }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
|
|
| 2794 | + $value = esc_attr($cf['defaults']['validation_pattern']); |
|
| 2795 | + } |
|
| 2796 | + ?> |
|
| 2797 | 2797 | <li> |
| 2798 | 2798 | <label for="validation_pattern" class="gd-cf-tooltip-wrap"> |
| 2799 | 2799 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Pattern:', 'geodirectory'); ?>
|
@@ -2807,13 +2807,13 @@ discard block |
||
| 2807 | 2807 | </div> |
| 2808 | 2808 | </li> |
| 2809 | 2809 | <?php |
| 2810 | - $value = ''; |
|
| 2811 | - if (isset($field_info->validation_msg)) {
|
|
| 2812 | - $value = esc_attr($field_info->validation_msg); |
|
| 2813 | - }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
|
|
| 2814 | - $value = esc_attr($cf['defaults']['validation_msg']); |
|
| 2815 | - } |
|
| 2816 | - ?> |
|
| 2810 | + $value = ''; |
|
| 2811 | + if (isset($field_info->validation_msg)) {
|
|
| 2812 | + $value = esc_attr($field_info->validation_msg); |
|
| 2813 | + }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
|
|
| 2814 | + $value = esc_attr($cf['defaults']['validation_msg']); |
|
| 2815 | + } |
|
| 2816 | + ?> |
|
| 2817 | 2817 | <li> |
| 2818 | 2818 | <label for="validation_msg" class="gd-cf-tooltip-wrap"> |
| 2819 | 2819 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Message:', 'geodirectory'); ?>
|
@@ -2828,21 +2828,21 @@ discard block |
||
| 2828 | 2828 | </li> |
| 2829 | 2829 | <?php |
| 2830 | 2830 | |
| 2831 | - $output = ob_get_clean(); |
|
| 2832 | - return $output; |
|
| 2831 | + $output = ob_get_clean(); |
|
| 2832 | + return $output; |
|
| 2833 | 2833 | } |
| 2834 | 2834 | add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
|
| 2835 | 2835 | |
| 2836 | 2836 | |
| 2837 | 2837 | function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
|
| 2838 | - ob_start(); |
|
| 2839 | - global $post_type; |
|
| 2840 | - |
|
| 2841 | - if (!isset($field_info->post_type)) {
|
|
| 2842 | - $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2843 | - } else |
|
| 2844 | - $post_type = $field_info->post_type; |
|
| 2845 | - ?> |
|
| 2838 | + ob_start(); |
|
| 2839 | + global $post_type; |
|
| 2840 | + |
|
| 2841 | + if (!isset($field_info->post_type)) {
|
|
| 2842 | + $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2843 | + } else |
|
| 2844 | + $post_type = $field_info->post_type; |
|
| 2845 | + ?> |
|
| 2846 | 2846 | <li style="display: none;"> |
| 2847 | 2847 | <label for="htmlvar_name" class="gd-cf-tooltip-wrap"> |
| 2848 | 2848 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Select taxonomy:', 'geodirectory'); ?>
|
@@ -2853,15 +2853,15 @@ discard block |
||
| 2853 | 2853 | <div class="gd-cf-input-wrap"> |
| 2854 | 2854 | <select name="htmlvar_name" id="htmlvar_name"> |
| 2855 | 2855 | <?php |
| 2856 | - $gd_taxonomy = geodir_get_taxonomies($post_type); |
|
| 2856 | + $gd_taxonomy = geodir_get_taxonomies($post_type); |
|
| 2857 | 2857 | |
| 2858 | - foreach ($gd_taxonomy as $gd_tax) {
|
|
| 2859 | - ?> |
|
| 2858 | + foreach ($gd_taxonomy as $gd_tax) {
|
|
| 2859 | + ?> |
|
| 2860 | 2860 | <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
|
| 2861 | - echo 'selected="selected"'; |
|
| 2862 | - }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php |
|
| 2863 | - } |
|
| 2864 | - ?> |
|
| 2861 | + echo 'selected="selected"'; |
|
| 2862 | + }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php |
|
| 2863 | + } |
|
| 2864 | + ?> |
|
| 2865 | 2865 | </select> |
| 2866 | 2866 | </div> |
| 2867 | 2867 | </li> |
@@ -2877,49 +2877,49 @@ discard block |
||
| 2877 | 2877 | |
| 2878 | 2878 | <select name="cat_display_type" id="cat_display_type"> |
| 2879 | 2879 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
|
| 2880 | - echo 'selected="selected"'; |
|
| 2881 | - }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
|
|
| 2880 | + echo 'selected="selected"'; |
|
| 2881 | + }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
|
|
| 2882 | 2882 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
|
| 2883 | - echo 'selected="selected"'; |
|
| 2884 | - }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 2883 | + echo 'selected="selected"'; |
|
| 2884 | + }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 2885 | 2885 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
|
| 2886 | - echo 'selected="selected"'; |
|
| 2887 | - }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
|
|
| 2886 | + echo 'selected="selected"'; |
|
| 2887 | + }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
|
|
| 2888 | 2888 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
|
| 2889 | - echo 'selected="selected"'; |
|
| 2890 | - }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 2889 | + echo 'selected="selected"'; |
|
| 2890 | + }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 2891 | 2891 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
|
| 2892 | - echo 'selected="selected"'; |
|
| 2893 | - }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 2892 | + echo 'selected="selected"'; |
|
| 2893 | + }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 2894 | 2894 | </select> |
| 2895 | 2895 | </div> |
| 2896 | 2896 | </li> |
| 2897 | 2897 | <?php |
| 2898 | 2898 | |
| 2899 | - $output = ob_get_clean(); |
|
| 2900 | - return $output; |
|
| 2899 | + $output = ob_get_clean(); |
|
| 2900 | + return $output; |
|
| 2901 | 2901 | } |
| 2902 | 2902 | add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
|
| 2903 | 2903 | |
| 2904 | 2904 | |
| 2905 | 2905 | function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
|
| 2906 | 2906 | |
| 2907 | - ob_start(); |
|
| 2908 | - if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
|
| 2909 | - $address = stripslashes_deep(unserialize($field_info->extra_fields)); |
|
| 2910 | - } |
|
| 2907 | + ob_start(); |
|
| 2908 | + if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
|
| 2909 | + $address = stripslashes_deep(unserialize($field_info->extra_fields)); |
|
| 2910 | + } |
|
| 2911 | 2911 | |
| 2912 | - $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500); |
|
| 2913 | - ?> |
|
| 2912 | + $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500); |
|
| 2913 | + ?> |
|
| 2914 | 2914 | <?php |
| 2915 | - /** |
|
| 2916 | - * Called on the add custom fields settings page before the address field is output. |
|
| 2917 | - * |
|
| 2918 | - * @since 1.0.0 |
|
| 2919 | - * @param array $address The address settings array. |
|
| 2920 | - * @param object $field_info Extra fields info. |
|
| 2921 | - */ |
|
| 2922 | - do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
|
|
| 2915 | + /** |
|
| 2916 | + * Called on the add custom fields settings page before the address field is output. |
|
| 2917 | + * |
|
| 2918 | + * @since 1.0.0 |
|
| 2919 | + * @param array $address The address settings array. |
|
| 2920 | + * @param object $field_info Extra fields info. |
|
| 2921 | + */ |
|
| 2922 | + do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
|
|
| 2923 | 2923 | |
| 2924 | 2924 | <li> |
| 2925 | 2925 | <label for="show_zip" class="gd-cf-tooltip-wrap"> |
@@ -2932,14 +2932,14 @@ discard block |
||
| 2932 | 2932 | |
| 2933 | 2933 | <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled" value="1" |
| 2934 | 2934 | <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
|
| 2935 | - echo 'checked'; |
|
| 2936 | - } ?>/> |
|
| 2935 | + echo 'checked'; |
|
| 2936 | + } ?>/> |
|
| 2937 | 2937 | <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 2938 | 2938 | |
| 2939 | 2939 | <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0" |
| 2940 | 2940 | <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
|
| 2941 | - echo 'checked'; |
|
| 2942 | - } ?>/> |
|
| 2941 | + echo 'checked'; |
|
| 2942 | + } ?>/> |
|
| 2943 | 2943 | <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 2944 | 2944 | |
| 2945 | 2945 | |
@@ -2956,8 +2956,8 @@ discard block |
||
| 2956 | 2956 | <div class="gd-cf-input-wrap"> |
| 2957 | 2957 | <input type="text" name="extra[zip_lable]" id="zip_lable" |
| 2958 | 2958 | value="<?php if (isset($address['zip_lable'])) {
|
| 2959 | - echo esc_attr($address['zip_lable']); |
|
| 2960 | - }?>"/> |
|
| 2959 | + echo esc_attr($address['zip_lable']); |
|
| 2960 | + }?>"/> |
|
| 2961 | 2961 | </div> |
| 2962 | 2962 | </li> |
| 2963 | 2963 | |
@@ -2974,8 +2974,8 @@ discard block |
||
| 2974 | 2974 | <div class="gd-cf-input-wrap"> |
| 2975 | 2975 | <input type="text" name="extra[map_lable]" id="map_lable" |
| 2976 | 2976 | value="<?php if (isset($address['map_lable'])) {
|
| 2977 | - echo esc_attr($address['map_lable']); |
|
| 2978 | - }?>"/> |
|
| 2977 | + echo esc_attr($address['map_lable']); |
|
| 2978 | + }?>"/> |
|
| 2979 | 2979 | </div> |
| 2980 | 2980 | </li> |
| 2981 | 2981 | |
@@ -2990,14 +2990,14 @@ discard block |
||
| 2990 | 2990 | |
| 2991 | 2991 | <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled" value="1" |
| 2992 | 2992 | <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
|
| 2993 | - echo 'checked'; |
|
| 2994 | - } ?>/> |
|
| 2993 | + echo 'checked'; |
|
| 2994 | + } ?>/> |
|
| 2995 | 2995 | <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 2996 | 2996 | |
| 2997 | 2997 | <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0" |
| 2998 | 2998 | <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
|
| 2999 | - echo 'checked'; |
|
| 3000 | - } ?>/> |
|
| 2999 | + echo 'checked'; |
|
| 3000 | + } ?>/> |
|
| 3001 | 3001 | <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 3002 | 3002 | |
| 3003 | 3003 | </div> |
@@ -3014,14 +3014,14 @@ discard block |
||
| 3014 | 3014 | |
| 3015 | 3015 | <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled" value="1" |
| 3016 | 3016 | <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
|
| 3017 | - echo 'checked'; |
|
| 3018 | - } ?>/> |
|
| 3017 | + echo 'checked'; |
|
| 3018 | + } ?>/> |
|
| 3019 | 3019 | <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 3020 | 3020 | |
| 3021 | 3021 | <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0" |
| 3022 | 3022 | <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
|
| 3023 | - echo 'checked'; |
|
| 3024 | - } ?>/> |
|
| 3023 | + echo 'checked'; |
|
| 3024 | + } ?>/> |
|
| 3025 | 3025 | <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 3026 | 3026 | |
| 3027 | 3027 | </div> |
@@ -3038,8 +3038,8 @@ discard block |
||
| 3038 | 3038 | <div class="gd-cf-input-wrap"> |
| 3039 | 3039 | <input type="text" name="extra[mapview_lable]" id="mapview_lable" |
| 3040 | 3040 | value="<?php if (isset($address['mapview_lable'])) {
|
| 3041 | - echo esc_attr($address['mapview_lable']); |
|
| 3042 | - }?>"/> |
|
| 3041 | + echo esc_attr($address['mapview_lable']); |
|
| 3042 | + }?>"/> |
|
| 3043 | 3043 | </div> |
| 3044 | 3044 | </li> |
| 3045 | 3045 | <li> |
@@ -3053,29 +3053,29 @@ discard block |
||
| 3053 | 3053 | |
| 3054 | 3054 | <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled" value="1" |
| 3055 | 3055 | <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
|
| 3056 | - echo 'checked'; |
|
| 3057 | - } ?>/> |
|
| 3056 | + echo 'checked'; |
|
| 3057 | + } ?>/> |
|
| 3058 | 3058 | <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 3059 | 3059 | |
| 3060 | 3060 | <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0" |
| 3061 | 3061 | <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
|
| 3062 | - echo 'checked'; |
|
| 3063 | - } ?>/> |
|
| 3062 | + echo 'checked'; |
|
| 3063 | + } ?>/> |
|
| 3064 | 3064 | <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 3065 | 3065 | |
| 3066 | 3066 | </div> |
| 3067 | 3067 | </li> |
| 3068 | 3068 | <?php |
| 3069 | 3069 | |
| 3070 | - $html = ob_get_clean(); |
|
| 3071 | - return $output.$html; |
|
| 3070 | + $html = ob_get_clean(); |
|
| 3071 | + return $output.$html; |
|
| 3072 | 3072 | } |
| 3073 | 3073 | add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
|
| 3074 | 3074 | |
| 3075 | 3075 | |
| 3076 | 3076 | function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
|
| 3077 | - ob_start(); |
|
| 3078 | - ?> |
|
| 3077 | + ob_start(); |
|
| 3078 | + ?> |
|
| 3079 | 3079 | <li> |
| 3080 | 3080 | <label for="multi_display_type" class="gd-cf-tooltip-wrap"> |
| 3081 | 3081 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
|
@@ -3087,14 +3087,14 @@ discard block |
||
| 3087 | 3087 | |
| 3088 | 3088 | <select name="multi_display_type" id="multi_display_type"> |
| 3089 | 3089 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
|
| 3090 | - echo 'selected="selected"'; |
|
| 3091 | - }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 3090 | + echo 'selected="selected"'; |
|
| 3091 | + }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 3092 | 3092 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
|
| 3093 | - echo 'selected="selected"'; |
|
| 3094 | - }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 3093 | + echo 'selected="selected"'; |
|
| 3094 | + }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 3095 | 3095 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
|
| 3096 | - echo 'selected="selected"'; |
|
| 3097 | - }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 3096 | + echo 'selected="selected"'; |
|
| 3097 | + }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 3098 | 3098 | </select> |
| 3099 | 3099 | |
| 3100 | 3100 | <br/> |
@@ -3102,25 +3102,25 @@ discard block |
||
| 3102 | 3102 | </li> |
| 3103 | 3103 | <?php |
| 3104 | 3104 | |
| 3105 | - $html = ob_get_clean(); |
|
| 3106 | - return $output.$html; |
|
| 3105 | + $html = ob_get_clean(); |
|
| 3106 | + return $output.$html; |
|
| 3107 | 3107 | } |
| 3108 | 3108 | add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
|
| 3109 | 3109 | |
| 3110 | 3110 | |
| 3111 | 3111 | function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
|
| 3112 | 3112 | |
| 3113 | - ob_start(); |
|
| 3113 | + ob_start(); |
|
| 3114 | 3114 | |
| 3115 | - $value = ''; |
|
| 3116 | - if (isset($field_info->option_values)) {
|
|
| 3117 | - $value = esc_attr($field_info->option_values); |
|
| 3118 | - }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
|
|
| 3119 | - $value = esc_attr($cf['defaults']['option_values']); |
|
| 3120 | - } |
|
| 3115 | + $value = ''; |
|
| 3116 | + if (isset($field_info->option_values)) {
|
|
| 3117 | + $value = esc_attr($field_info->option_values); |
|
| 3118 | + }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
|
|
| 3119 | + $value = esc_attr($cf['defaults']['option_values']); |
|
| 3120 | + } |
|
| 3121 | 3121 | |
| 3122 | - $field_type = isset($field_info->field_type) ? $field_info->field_type : ''; |
|
| 3123 | - ?> |
|
| 3122 | + $field_type = isset($field_info->field_type) ? $field_info->field_type : ''; |
|
| 3123 | + ?> |
|
| 3124 | 3124 | <li> |
| 3125 | 3125 | <label for="option_values" class="gd-cf-tooltip-wrap"> |
| 3126 | 3126 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
|
@@ -3147,8 +3147,8 @@ discard block |
||
| 3147 | 3147 | </li> |
| 3148 | 3148 | <?php |
| 3149 | 3149 | |
| 3150 | - $html = ob_get_clean(); |
|
| 3151 | - return $output.$html; |
|
| 3150 | + $html = ob_get_clean(); |
|
| 3151 | + return $output.$html; |
|
| 3152 | 3152 | } |
| 3153 | 3153 | add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
|
| 3154 | 3154 | add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
|
@@ -3156,12 +3156,12 @@ discard block |
||
| 3156 | 3156 | |
| 3157 | 3157 | |
| 3158 | 3158 | function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
|
| 3159 | - ob_start(); |
|
| 3160 | - $extra = array(); |
|
| 3161 | - if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
|
| 3162 | - $extra = unserialize($field_info->extra_fields); |
|
| 3163 | - } |
|
| 3164 | - ?> |
|
| 3159 | + ob_start(); |
|
| 3160 | + $extra = array(); |
|
| 3161 | + if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
|
| 3162 | + $extra = unserialize($field_info->extra_fields); |
|
| 3163 | + } |
|
| 3164 | + ?> |
|
| 3165 | 3165 | <li> |
| 3166 | 3166 | <label for="date_format" class="gd-cf-tooltip-wrap"> |
| 3167 | 3167 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
|
@@ -3171,52 +3171,52 @@ discard block |
||
| 3171 | 3171 | </label> |
| 3172 | 3172 | <div class="gd-cf-input-wrap" style="overflow:inherit;"> |
| 3173 | 3173 | <?php |
| 3174 | - $date_formats = array( |
|
| 3175 | - 'm/d/Y', |
|
| 3176 | - 'd/m/Y', |
|
| 3177 | - 'Y/m/d', |
|
| 3178 | - 'm-d-Y', |
|
| 3179 | - 'd-m-Y', |
|
| 3180 | - 'Y-m-d', |
|
| 3181 | - 'F j, Y', |
|
| 3182 | - ); |
|
| 3183 | - /** |
|
| 3184 | - * Filter the custom field date format options. |
|
| 3185 | - * |
|
| 3186 | - * @since 1.6.5 |
|
| 3187 | - * @param array $date_formats The PHP date format array. |
|
| 3188 | - */ |
|
| 3189 | - $date_formats = apply_filters('geodir_date_formats',$date_formats);
|
|
| 3190 | - ?> |
|
| 3174 | + $date_formats = array( |
|
| 3175 | + 'm/d/Y', |
|
| 3176 | + 'd/m/Y', |
|
| 3177 | + 'Y/m/d', |
|
| 3178 | + 'm-d-Y', |
|
| 3179 | + 'd-m-Y', |
|
| 3180 | + 'Y-m-d', |
|
| 3181 | + 'F j, Y', |
|
| 3182 | + ); |
|
| 3183 | + /** |
|
| 3184 | + * Filter the custom field date format options. |
|
| 3185 | + * |
|
| 3186 | + * @since 1.6.5 |
|
| 3187 | + * @param array $date_formats The PHP date format array. |
|
| 3188 | + */ |
|
| 3189 | + $date_formats = apply_filters('geodir_date_formats',$date_formats);
|
|
| 3190 | + ?> |
|
| 3191 | 3191 | <select name="extra[date_format]" id="date_format"> |
| 3192 | 3192 | <?php |
| 3193 | - foreach($date_formats as $format){
|
|
| 3194 | - $selected = ''; |
|
| 3195 | - if(!empty($extra) && esc_attr($extra['date_format'])==$format){
|
|
| 3196 | - $selected = "selected='selected'"; |
|
| 3197 | - } |
|
| 3198 | - echo "<option $selected value='$format'>$format (".date_i18n( $format, time()).")</option>";
|
|
| 3199 | - } |
|
| 3200 | - ?> |
|
| 3193 | + foreach($date_formats as $format){
|
|
| 3194 | + $selected = ''; |
|
| 3195 | + if(!empty($extra) && esc_attr($extra['date_format'])==$format){
|
|
| 3196 | + $selected = "selected='selected'"; |
|
| 3197 | + } |
|
| 3198 | + echo "<option $selected value='$format'>$format (".date_i18n( $format, time()).")</option>";
|
|
| 3199 | + } |
|
| 3200 | + ?> |
|
| 3201 | 3201 | </select> |
| 3202 | 3202 | |
| 3203 | 3203 | </div> |
| 3204 | 3204 | </li> |
| 3205 | 3205 | <?php |
| 3206 | 3206 | |
| 3207 | - $html = ob_get_clean(); |
|
| 3208 | - return $output.$html; |
|
| 3207 | + $html = ob_get_clean(); |
|
| 3208 | + return $output.$html; |
|
| 3209 | 3209 | } |
| 3210 | 3210 | add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
|
| 3211 | 3211 | |
| 3212 | 3212 | |
| 3213 | 3213 | function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
|
| 3214 | - ob_start(); |
|
| 3215 | - $allowed_file_types = geodir_allowed_mime_types(); |
|
| 3214 | + ob_start(); |
|
| 3215 | + $allowed_file_types = geodir_allowed_mime_types(); |
|
| 3216 | 3216 | |
| 3217 | - $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : ''; |
|
| 3218 | - $gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
|
|
| 3219 | - ?> |
|
| 3217 | + $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : ''; |
|
| 3218 | + $gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
|
|
| 3219 | + ?> |
|
| 3220 | 3220 | <li> |
| 3221 | 3221 | <label for="gd_file_types" class="gd-cf-tooltip-wrap"> |
| 3222 | 3222 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
|
@@ -3239,33 +3239,33 @@ discard block |
||
| 3239 | 3239 | </li> |
| 3240 | 3240 | <?php |
| 3241 | 3241 | |
| 3242 | - $html = ob_get_clean(); |
|
| 3243 | - return $output.$html; |
|
| 3242 | + $html = ob_get_clean(); |
|
| 3243 | + return $output.$html; |
|
| 3244 | 3244 | } |
| 3245 | 3245 | add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
|
| 3246 | 3246 | |
| 3247 | 3247 | function geodir_cfa_extra_fields_text($output,$result_str,$cf,$field_info){
|
| 3248 | - ob_start(); |
|
| 3248 | + ob_start(); |
|
| 3249 | 3249 | |
| 3250 | - $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : ''; |
|
| 3250 | + $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : ''; |
|
| 3251 | 3251 | // print_r($cf);echo '###'; |
| 3252 | 3252 | |
| 3253 | 3253 | |
| 3254 | 3254 | |
| 3255 | - $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500); |
|
| 3255 | + $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500); |
|
| 3256 | 3256 | |
| 3257 | 3257 | |
| 3258 | - $value = ''; |
|
| 3259 | - if ($extra_fields && isset($extra_fields['is_price'])) {
|
|
| 3260 | - $value = esc_attr($extra_fields['is_price']); |
|
| 3261 | - }elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
|
|
| 3262 | - $value = esc_attr($cf['defaults']['extra_fields']['is_price']); |
|
| 3263 | - } |
|
| 3258 | + $value = ''; |
|
| 3259 | + if ($extra_fields && isset($extra_fields['is_price'])) {
|
|
| 3260 | + $value = esc_attr($extra_fields['is_price']); |
|
| 3261 | + }elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
|
|
| 3262 | + $value = esc_attr($cf['defaults']['extra_fields']['is_price']); |
|
| 3263 | + } |
|
| 3264 | 3264 | |
| 3265 | - $show_price_extra = ($value==1) ? 1 : 0; |
|
| 3265 | + $show_price_extra = ($value==1) ? 1 : 0; |
|
| 3266 | 3266 | |
| 3267 | - $show_price = (isset($field_info->data_type) && ($field_info->data_type=='INT' && $field_info->data_type=='FLOAT')) ? 1 : 0; |
|
| 3268 | - ?> |
|
| 3267 | + $show_price = (isset($field_info->data_type) && ($field_info->data_type=='INT' && $field_info->data_type=='FLOAT')) ? 1 : 0; |
|
| 3268 | + ?> |
|
| 3269 | 3269 | <li class="gdcf-price-extra-set" <?php if(!$show_price){ echo "style='display:none;'";}?>>
|
| 3270 | 3270 | <label for="is_price" class="gd-cf-tooltip-wrap"> |
| 3271 | 3271 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display as price? :', 'geodirectory'); ?>
|
@@ -3277,14 +3277,14 @@ discard block |
||
| 3277 | 3277 | |
| 3278 | 3278 | <input type="radio" id="is_price_yes<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-enabled" value="1" |
| 3279 | 3279 | <?php if ($value == '1') {
|
| 3280 | - echo 'checked'; |
|
| 3281 | - } ?>/> |
|
| 3280 | + echo 'checked'; |
|
| 3281 | + } ?>/> |
|
| 3282 | 3282 | <label onclick="show_hide_radio(this,'show','gdcf-price-extra');" for="is_price_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 3283 | 3283 | |
| 3284 | 3284 | <input type="radio" id="is_price_no<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-disabled" value="0" |
| 3285 | 3285 | <?php if ($value == '0' || !$value) {
|
| 3286 | - echo 'checked'; |
|
| 3287 | - } ?>/> |
|
| 3286 | + echo 'checked'; |
|
| 3287 | + } ?>/> |
|
| 3288 | 3288 | <label onclick="show_hide_radio(this,'hide','gdcf-price-extra');" for="is_price_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 3289 | 3289 | |
| 3290 | 3290 | </div> |
@@ -3292,13 +3292,13 @@ discard block |
||
| 3292 | 3292 | |
| 3293 | 3293 | <?php |
| 3294 | 3294 | |
| 3295 | - $value = ''; |
|
| 3296 | - if ($extra_fields && isset($extra_fields['thousand_separator'])) {
|
|
| 3297 | - $value = esc_attr($extra_fields['thousand_separator']); |
|
| 3298 | - }elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
|
|
| 3299 | - $value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']); |
|
| 3300 | - } |
|
| 3301 | - ?> |
|
| 3295 | + $value = ''; |
|
| 3296 | + if ($extra_fields && isset($extra_fields['thousand_separator'])) {
|
|
| 3297 | + $value = esc_attr($extra_fields['thousand_separator']); |
|
| 3298 | + }elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
|
|
| 3299 | + $value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']); |
|
| 3300 | + } |
|
| 3301 | + ?> |
|
| 3302 | 3302 | <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
| 3303 | 3303 | <label for="thousand_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Thousand separator :', 'geodirectory');?>
|
| 3304 | 3304 | <div class="gdcf-tooltip"> |
@@ -3319,13 +3319,13 @@ discard block |
||
| 3319 | 3319 | |
| 3320 | 3320 | <?php |
| 3321 | 3321 | |
| 3322 | - $value = ''; |
|
| 3323 | - if ($extra_fields && isset($extra_fields['decimal_separator'])) {
|
|
| 3324 | - $value = esc_attr($extra_fields['decimal_separator']); |
|
| 3325 | - }elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
|
|
| 3326 | - $value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']); |
|
| 3327 | - } |
|
| 3328 | - ?> |
|
| 3322 | + $value = ''; |
|
| 3323 | + if ($extra_fields && isset($extra_fields['decimal_separator'])) {
|
|
| 3324 | + $value = esc_attr($extra_fields['decimal_separator']); |
|
| 3325 | + }elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
|
|
| 3326 | + $value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']); |
|
| 3327 | + } |
|
| 3328 | + ?> |
|
| 3329 | 3329 | <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
| 3330 | 3330 | <label for="decimal_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal separator :', 'geodirectory');?>
|
| 3331 | 3331 | <div class="gdcf-tooltip"> |
@@ -3342,13 +3342,13 @@ discard block |
||
| 3342 | 3342 | |
| 3343 | 3343 | <?php |
| 3344 | 3344 | |
| 3345 | - $value = ''; |
|
| 3346 | - if ($extra_fields && isset($extra_fields['decimal_display'])) {
|
|
| 3347 | - $value = esc_attr($extra_fields['decimal_display']); |
|
| 3348 | - }elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
|
|
| 3349 | - $value = esc_attr($cf['defaults']['extra_fields']['decimal_display']); |
|
| 3350 | - } |
|
| 3351 | - ?> |
|
| 3345 | + $value = ''; |
|
| 3346 | + if ($extra_fields && isset($extra_fields['decimal_display'])) {
|
|
| 3347 | + $value = esc_attr($extra_fields['decimal_display']); |
|
| 3348 | + }elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
|
|
| 3349 | + $value = esc_attr($cf['defaults']['extra_fields']['decimal_display']); |
|
| 3350 | + } |
|
| 3351 | + ?> |
|
| 3352 | 3352 | <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
| 3353 | 3353 | <label for="decimal_display" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal display :', 'geodirectory');?>
|
| 3354 | 3354 | <div class="gdcf-tooltip"> |
@@ -3365,13 +3365,13 @@ discard block |
||
| 3365 | 3365 | |
| 3366 | 3366 | <?php |
| 3367 | 3367 | |
| 3368 | - $value = ''; |
|
| 3369 | - if ($extra_fields && isset($extra_fields['currency_symbol'])) {
|
|
| 3370 | - $value = esc_attr($extra_fields['currency_symbol']); |
|
| 3371 | - }elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
|
|
| 3372 | - $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']); |
|
| 3373 | - } |
|
| 3374 | - ?> |
|
| 3368 | + $value = ''; |
|
| 3369 | + if ($extra_fields && isset($extra_fields['currency_symbol'])) {
|
|
| 3370 | + $value = esc_attr($extra_fields['currency_symbol']); |
|
| 3371 | + }elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
|
|
| 3372 | + $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']); |
|
| 3373 | + } |
|
| 3374 | + ?> |
|
| 3375 | 3375 | <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
| 3376 | 3376 | <label for="currency_symbol" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol :', 'geodirectory');?>
|
| 3377 | 3377 | <div class="gdcf-tooltip"> |
@@ -3386,13 +3386,13 @@ discard block |
||
| 3386 | 3386 | |
| 3387 | 3387 | <?php |
| 3388 | 3388 | |
| 3389 | - $value = ''; |
|
| 3390 | - if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
|
|
| 3391 | - $value = esc_attr($extra_fields['currency_symbol_placement']); |
|
| 3392 | - }elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
|
|
| 3393 | - $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']); |
|
| 3394 | - } |
|
| 3395 | - ?> |
|
| 3389 | + $value = ''; |
|
| 3390 | + if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
|
|
| 3391 | + $value = esc_attr($extra_fields['currency_symbol_placement']); |
|
| 3392 | + }elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
|
|
| 3393 | + $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']); |
|
| 3394 | + } |
|
| 3395 | + ?> |
|
| 3396 | 3396 | <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
| 3397 | 3397 | <label for="currency_symbol_placement" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol placement :', 'geodirectory');?>
|
| 3398 | 3398 | <div class="gdcf-tooltip"> |
@@ -3410,225 +3410,225 @@ discard block |
||
| 3410 | 3410 | |
| 3411 | 3411 | <?php |
| 3412 | 3412 | |
| 3413 | - $html = ob_get_clean(); |
|
| 3414 | - return $output.$html; |
|
| 3413 | + $html = ob_get_clean(); |
|
| 3414 | + return $output.$html; |
|
| 3415 | 3415 | } |
| 3416 | 3416 | add_filter('geodir_cfa_extra_fields_text','geodir_cfa_extra_fields_text',10,4);
|
| 3417 | 3417 | |
| 3418 | 3418 | function geodir_default_custom_fields($post_type='gd_place',$package_id=''){
|
| 3419 | - $fields = array(); |
|
| 3420 | - $package = ($package_id=='') ? '' : array($package_id); |
|
| 3421 | - |
|
| 3422 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3423 | - 'data_type' => 'VARCHAR', |
|
| 3424 | - 'field_type' => 'taxonomy', |
|
| 3425 | - 'admin_title' => __('Category', 'geodirectory'),
|
|
| 3426 | - 'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
|
|
| 3427 | - 'site_title' => __('Category', 'geodirectory'),
|
|
| 3428 | - 'htmlvar_name' => $post_type.'category', |
|
| 3429 | - 'default_value' => '', |
|
| 3430 | - 'is_default' => '1', |
|
| 3431 | - 'is_admin' => '1', |
|
| 3432 | - 'is_required' => '1', |
|
| 3433 | - 'show_in' => '[detail]', |
|
| 3434 | - 'show_on_pkg' => $package, |
|
| 3435 | - 'clabels' => __('Category', 'geodirectory'));
|
|
| 3436 | - |
|
| 3437 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3438 | - 'data_type' => 'VARCHAR', |
|
| 3439 | - 'field_type' => 'address', |
|
| 3440 | - 'admin_title' => __('Address', 'geodirectory'),
|
|
| 3441 | - 'admin_desc' => ADDRESS_MSG, |
|
| 3442 | - 'site_title' => __('Address', 'geodirectory'),
|
|
| 3443 | - 'htmlvar_name' => 'post', |
|
| 3444 | - 'default_value' => '', |
|
| 3445 | - 'option_values' => '', |
|
| 3446 | - 'is_default' => '1', |
|
| 3447 | - 'is_admin' => '1', |
|
| 3448 | - 'is_required' => '1', |
|
| 3449 | - 'show_in' => '[detail],[mapbubble]', |
|
| 3450 | - 'show_on_pkg' => $package, |
|
| 3451 | - 'required_msg' => __('Address fields are required', 'geodirectory'),
|
|
| 3452 | - 'clabels' => __('Address', 'geodirectory'),
|
|
| 3453 | - 'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
|
|
| 3454 | - 'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
|
|
| 3455 | - 'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
|
|
| 3456 | - 'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
|
|
| 3457 | - 'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
|
|
| 3458 | - 'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
|
|
| 3459 | - 'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden', |
|
| 3460 | - 'show_latlng' => 1)); |
|
| 3461 | - |
|
| 3462 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3463 | - 'data_type' => 'VARCHAR', |
|
| 3464 | - 'field_type' => 'text', |
|
| 3465 | - 'admin_title' => __('Time', 'geodirectory'),
|
|
| 3466 | - 'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
|
|
| 3467 | - 'site_title' => __('Time', 'geodirectory'),
|
|
| 3468 | - 'htmlvar_name' => 'timing', |
|
| 3469 | - 'default_value' => '', |
|
| 3470 | - 'option_values' => '', |
|
| 3471 | - 'is_default' => '1', |
|
| 3472 | - 'is_admin' => '1', |
|
| 3473 | - 'show_in' => '[detail],[mapbubble]', |
|
| 3474 | - 'show_on_pkg' => $package, |
|
| 3475 | - 'clabels' => __('Time', 'geodirectory'));
|
|
| 3476 | - |
|
| 3477 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3478 | - 'data_type' => 'VARCHAR', |
|
| 3479 | - 'field_type' => 'phone', |
|
| 3480 | - 'admin_title' => __('Phone', 'geodirectory'),
|
|
| 3481 | - 'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
|
|
| 3482 | - 'site_title' => __('Phone', 'geodirectory'),
|
|
| 3483 | - 'htmlvar_name' => 'contact', |
|
| 3484 | - 'default_value' => '', |
|
| 3485 | - 'option_values' => '', |
|
| 3486 | - 'is_default' => '1', |
|
| 3487 | - 'is_admin' => '1', |
|
| 3488 | - 'show_in' => '[detail],[mapbubble]', |
|
| 3489 | - 'show_on_pkg' => $package, |
|
| 3490 | - 'clabels' => __('Phone', 'geodirectory'));
|
|
| 3491 | - |
|
| 3492 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3493 | - 'data_type' => 'VARCHAR', |
|
| 3494 | - 'field_type' => 'email', |
|
| 3495 | - 'admin_title' => __('Email', 'geodirectory'),
|
|
| 3496 | - 'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
|
|
| 3497 | - 'site_title' => __('Email', 'geodirectory'),
|
|
| 3498 | - 'htmlvar_name' => 'email', |
|
| 3499 | - 'default_value' => '', |
|
| 3500 | - 'option_values' => '', |
|
| 3501 | - 'is_default' => '1', |
|
| 3502 | - 'is_admin' => '1', |
|
| 3503 | - 'show_in' => '[detail]', |
|
| 3504 | - 'show_on_pkg' => $package, |
|
| 3505 | - 'clabels' => __('Email', 'geodirectory'));
|
|
| 3506 | - |
|
| 3507 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3508 | - 'data_type' => 'VARCHAR', |
|
| 3509 | - 'field_type' => 'url', |
|
| 3510 | - 'admin_title' => __('Website', 'geodirectory'),
|
|
| 3511 | - 'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
|
|
| 3512 | - 'site_title' => __('Website', 'geodirectory'),
|
|
| 3513 | - 'htmlvar_name' => 'website', |
|
| 3514 | - 'default_value' => '', |
|
| 3515 | - 'option_values' => '', |
|
| 3516 | - 'is_default' => '1', |
|
| 3517 | - 'is_admin' => '1', |
|
| 3518 | - 'show_in' => '[detail]', |
|
| 3519 | - 'show_on_pkg' => $package, |
|
| 3520 | - 'clabels' => __('Website', 'geodirectory'));
|
|
| 3521 | - |
|
| 3522 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3523 | - 'data_type' => 'VARCHAR', |
|
| 3524 | - 'field_type' => 'url', |
|
| 3525 | - 'admin_title' => __('Twitter', 'geodirectory'),
|
|
| 3526 | - 'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
|
|
| 3527 | - 'site_title' => __('Twitter', 'geodirectory'),
|
|
| 3528 | - 'htmlvar_name' => 'twitter', |
|
| 3529 | - 'default_value' => '', |
|
| 3530 | - 'option_values' => '', |
|
| 3531 | - 'is_default' => '1', |
|
| 3532 | - 'is_admin' => '1', |
|
| 3533 | - 'show_in' => '[detail]', |
|
| 3534 | - 'show_on_pkg' => $package, |
|
| 3535 | - 'clabels' => __('Twitter', 'geodirectory'));
|
|
| 3536 | - |
|
| 3537 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3538 | - 'data_type' => 'VARCHAR', |
|
| 3539 | - 'field_type' => 'url', |
|
| 3540 | - 'admin_title' => __('Facebook', 'geodirectory'),
|
|
| 3541 | - 'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
|
|
| 3542 | - 'site_title' => __('Facebook', 'geodirectory'),
|
|
| 3543 | - 'htmlvar_name' => 'facebook', |
|
| 3544 | - 'default_value' => '', |
|
| 3545 | - 'option_values' => '', |
|
| 3546 | - 'is_default' => '1', |
|
| 3547 | - 'is_admin' => '1', |
|
| 3548 | - 'show_in' => '[detail]', |
|
| 3549 | - 'show_on_pkg' => $package, |
|
| 3550 | - 'clabels' => __('Facebook', 'geodirectory'));
|
|
| 3551 | - |
|
| 3552 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3553 | - 'data_type' => 'TEXT', |
|
| 3554 | - 'field_type' => 'textarea', |
|
| 3555 | - 'admin_title' => __('Video', 'geodirectory'),
|
|
| 3556 | - 'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
|
|
| 3557 | - 'site_title' => __('Video', 'geodirectory'),
|
|
| 3558 | - 'htmlvar_name' => 'video', |
|
| 3559 | - 'default_value' => '', |
|
| 3560 | - 'option_values' => '', |
|
| 3561 | - 'is_default' => '0', |
|
| 3562 | - 'is_admin' => '1', |
|
| 3563 | - 'show_in' => '[owntab]', |
|
| 3564 | - 'show_on_pkg' => $package, |
|
| 3565 | - 'clabels' => __('Video', 'geodirectory'));
|
|
| 3566 | - |
|
| 3567 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3568 | - 'data_type' => 'TEXT', |
|
| 3569 | - 'field_type' => 'textarea', |
|
| 3570 | - 'admin_title' => __('Special Offers', 'geodirectory'),
|
|
| 3571 | - 'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
|
|
| 3572 | - 'site_title' => __('Special Offers', 'geodirectory'),
|
|
| 3573 | - 'htmlvar_name' => 'special_offers', |
|
| 3574 | - 'default_value' => '', |
|
| 3575 | - 'option_values' => '', |
|
| 3576 | - 'is_default' => '0', |
|
| 3577 | - 'is_admin' => '1', |
|
| 3578 | - 'show_in' => '[owntab]', |
|
| 3579 | - 'show_on_pkg' => $package, |
|
| 3580 | - 'clabels' => __('Special Offers', 'geodirectory'));
|
|
| 3581 | - |
|
| 3582 | - /** |
|
| 3583 | - * Filter the array of default custom fields DB table data. |
|
| 3584 | - * |
|
| 3585 | - * @since 1.6.6 |
|
| 3586 | - * @param string $fields The default custom fields as an array. |
|
| 3587 | - */ |
|
| 3588 | - $fields = apply_filters('geodir_default_custom_fields', $fields);
|
|
| 3589 | - |
|
| 3590 | - return $fields; |
|
| 3419 | + $fields = array(); |
|
| 3420 | + $package = ($package_id=='') ? '' : array($package_id); |
|
| 3421 | + |
|
| 3422 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3423 | + 'data_type' => 'VARCHAR', |
|
| 3424 | + 'field_type' => 'taxonomy', |
|
| 3425 | + 'admin_title' => __('Category', 'geodirectory'),
|
|
| 3426 | + 'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
|
|
| 3427 | + 'site_title' => __('Category', 'geodirectory'),
|
|
| 3428 | + 'htmlvar_name' => $post_type.'category', |
|
| 3429 | + 'default_value' => '', |
|
| 3430 | + 'is_default' => '1', |
|
| 3431 | + 'is_admin' => '1', |
|
| 3432 | + 'is_required' => '1', |
|
| 3433 | + 'show_in' => '[detail]', |
|
| 3434 | + 'show_on_pkg' => $package, |
|
| 3435 | + 'clabels' => __('Category', 'geodirectory'));
|
|
| 3436 | + |
|
| 3437 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3438 | + 'data_type' => 'VARCHAR', |
|
| 3439 | + 'field_type' => 'address', |
|
| 3440 | + 'admin_title' => __('Address', 'geodirectory'),
|
|
| 3441 | + 'admin_desc' => ADDRESS_MSG, |
|
| 3442 | + 'site_title' => __('Address', 'geodirectory'),
|
|
| 3443 | + 'htmlvar_name' => 'post', |
|
| 3444 | + 'default_value' => '', |
|
| 3445 | + 'option_values' => '', |
|
| 3446 | + 'is_default' => '1', |
|
| 3447 | + 'is_admin' => '1', |
|
| 3448 | + 'is_required' => '1', |
|
| 3449 | + 'show_in' => '[detail],[mapbubble]', |
|
| 3450 | + 'show_on_pkg' => $package, |
|
| 3451 | + 'required_msg' => __('Address fields are required', 'geodirectory'),
|
|
| 3452 | + 'clabels' => __('Address', 'geodirectory'),
|
|
| 3453 | + 'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
|
|
| 3454 | + 'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
|
|
| 3455 | + 'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
|
|
| 3456 | + 'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
|
|
| 3457 | + 'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
|
|
| 3458 | + 'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
|
|
| 3459 | + 'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden', |
|
| 3460 | + 'show_latlng' => 1)); |
|
| 3461 | + |
|
| 3462 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3463 | + 'data_type' => 'VARCHAR', |
|
| 3464 | + 'field_type' => 'text', |
|
| 3465 | + 'admin_title' => __('Time', 'geodirectory'),
|
|
| 3466 | + 'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
|
|
| 3467 | + 'site_title' => __('Time', 'geodirectory'),
|
|
| 3468 | + 'htmlvar_name' => 'timing', |
|
| 3469 | + 'default_value' => '', |
|
| 3470 | + 'option_values' => '', |
|
| 3471 | + 'is_default' => '1', |
|
| 3472 | + 'is_admin' => '1', |
|
| 3473 | + 'show_in' => '[detail],[mapbubble]', |
|
| 3474 | + 'show_on_pkg' => $package, |
|
| 3475 | + 'clabels' => __('Time', 'geodirectory'));
|
|
| 3476 | + |
|
| 3477 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3478 | + 'data_type' => 'VARCHAR', |
|
| 3479 | + 'field_type' => 'phone', |
|
| 3480 | + 'admin_title' => __('Phone', 'geodirectory'),
|
|
| 3481 | + 'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
|
|
| 3482 | + 'site_title' => __('Phone', 'geodirectory'),
|
|
| 3483 | + 'htmlvar_name' => 'contact', |
|
| 3484 | + 'default_value' => '', |
|
| 3485 | + 'option_values' => '', |
|
| 3486 | + 'is_default' => '1', |
|
| 3487 | + 'is_admin' => '1', |
|
| 3488 | + 'show_in' => '[detail],[mapbubble]', |
|
| 3489 | + 'show_on_pkg' => $package, |
|
| 3490 | + 'clabels' => __('Phone', 'geodirectory'));
|
|
| 3491 | + |
|
| 3492 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3493 | + 'data_type' => 'VARCHAR', |
|
| 3494 | + 'field_type' => 'email', |
|
| 3495 | + 'admin_title' => __('Email', 'geodirectory'),
|
|
| 3496 | + 'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
|
|
| 3497 | + 'site_title' => __('Email', 'geodirectory'),
|
|
| 3498 | + 'htmlvar_name' => 'email', |
|
| 3499 | + 'default_value' => '', |
|
| 3500 | + 'option_values' => '', |
|
| 3501 | + 'is_default' => '1', |
|
| 3502 | + 'is_admin' => '1', |
|
| 3503 | + 'show_in' => '[detail]', |
|
| 3504 | + 'show_on_pkg' => $package, |
|
| 3505 | + 'clabels' => __('Email', 'geodirectory'));
|
|
| 3506 | + |
|
| 3507 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3508 | + 'data_type' => 'VARCHAR', |
|
| 3509 | + 'field_type' => 'url', |
|
| 3510 | + 'admin_title' => __('Website', 'geodirectory'),
|
|
| 3511 | + 'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
|
|
| 3512 | + 'site_title' => __('Website', 'geodirectory'),
|
|
| 3513 | + 'htmlvar_name' => 'website', |
|
| 3514 | + 'default_value' => '', |
|
| 3515 | + 'option_values' => '', |
|
| 3516 | + 'is_default' => '1', |
|
| 3517 | + 'is_admin' => '1', |
|
| 3518 | + 'show_in' => '[detail]', |
|
| 3519 | + 'show_on_pkg' => $package, |
|
| 3520 | + 'clabels' => __('Website', 'geodirectory'));
|
|
| 3521 | + |
|
| 3522 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3523 | + 'data_type' => 'VARCHAR', |
|
| 3524 | + 'field_type' => 'url', |
|
| 3525 | + 'admin_title' => __('Twitter', 'geodirectory'),
|
|
| 3526 | + 'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
|
|
| 3527 | + 'site_title' => __('Twitter', 'geodirectory'),
|
|
| 3528 | + 'htmlvar_name' => 'twitter', |
|
| 3529 | + 'default_value' => '', |
|
| 3530 | + 'option_values' => '', |
|
| 3531 | + 'is_default' => '1', |
|
| 3532 | + 'is_admin' => '1', |
|
| 3533 | + 'show_in' => '[detail]', |
|
| 3534 | + 'show_on_pkg' => $package, |
|
| 3535 | + 'clabels' => __('Twitter', 'geodirectory'));
|
|
| 3536 | + |
|
| 3537 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3538 | + 'data_type' => 'VARCHAR', |
|
| 3539 | + 'field_type' => 'url', |
|
| 3540 | + 'admin_title' => __('Facebook', 'geodirectory'),
|
|
| 3541 | + 'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
|
|
| 3542 | + 'site_title' => __('Facebook', 'geodirectory'),
|
|
| 3543 | + 'htmlvar_name' => 'facebook', |
|
| 3544 | + 'default_value' => '', |
|
| 3545 | + 'option_values' => '', |
|
| 3546 | + 'is_default' => '1', |
|
| 3547 | + 'is_admin' => '1', |
|
| 3548 | + 'show_in' => '[detail]', |
|
| 3549 | + 'show_on_pkg' => $package, |
|
| 3550 | + 'clabels' => __('Facebook', 'geodirectory'));
|
|
| 3551 | + |
|
| 3552 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3553 | + 'data_type' => 'TEXT', |
|
| 3554 | + 'field_type' => 'textarea', |
|
| 3555 | + 'admin_title' => __('Video', 'geodirectory'),
|
|
| 3556 | + 'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
|
|
| 3557 | + 'site_title' => __('Video', 'geodirectory'),
|
|
| 3558 | + 'htmlvar_name' => 'video', |
|
| 3559 | + 'default_value' => '', |
|
| 3560 | + 'option_values' => '', |
|
| 3561 | + 'is_default' => '0', |
|
| 3562 | + 'is_admin' => '1', |
|
| 3563 | + 'show_in' => '[owntab]', |
|
| 3564 | + 'show_on_pkg' => $package, |
|
| 3565 | + 'clabels' => __('Video', 'geodirectory'));
|
|
| 3566 | + |
|
| 3567 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3568 | + 'data_type' => 'TEXT', |
|
| 3569 | + 'field_type' => 'textarea', |
|
| 3570 | + 'admin_title' => __('Special Offers', 'geodirectory'),
|
|
| 3571 | + 'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
|
|
| 3572 | + 'site_title' => __('Special Offers', 'geodirectory'),
|
|
| 3573 | + 'htmlvar_name' => 'special_offers', |
|
| 3574 | + 'default_value' => '', |
|
| 3575 | + 'option_values' => '', |
|
| 3576 | + 'is_default' => '0', |
|
| 3577 | + 'is_admin' => '1', |
|
| 3578 | + 'show_in' => '[owntab]', |
|
| 3579 | + 'show_on_pkg' => $package, |
|
| 3580 | + 'clabels' => __('Special Offers', 'geodirectory'));
|
|
| 3581 | + |
|
| 3582 | + /** |
|
| 3583 | + * Filter the array of default custom fields DB table data. |
|
| 3584 | + * |
|
| 3585 | + * @since 1.6.6 |
|
| 3586 | + * @param string $fields The default custom fields as an array. |
|
| 3587 | + */ |
|
| 3588 | + $fields = apply_filters('geodir_default_custom_fields', $fields);
|
|
| 3589 | + |
|
| 3590 | + return $fields; |
|
| 3591 | 3591 | } |
| 3592 | 3592 | |
| 3593 | 3593 | function geodir_currency_format_number($number='',$cf=''){
|
| 3594 | 3594 | |
| 3595 | - $cs = isset($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : ''; |
|
| 3595 | + $cs = isset($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : ''; |
|
| 3596 | 3596 | |
| 3597 | - $symbol = isset($cs['currency_symbol']) ? $cs['currency_symbol'] : '$'; |
|
| 3598 | - $decimals = isset($cf['decimal_point']) && $cf['decimal_point'] ? $cf['decimal_point'] : 2; |
|
| 3599 | - $decimal_display = isset($cf['decimal_display']) && $cf['decimal_display'] ? $cf['decimal_display'] : 'if'; |
|
| 3600 | - $decimalpoint = '.'; |
|
| 3597 | + $symbol = isset($cs['currency_symbol']) ? $cs['currency_symbol'] : '$'; |
|
| 3598 | + $decimals = isset($cf['decimal_point']) && $cf['decimal_point'] ? $cf['decimal_point'] : 2; |
|
| 3599 | + $decimal_display = isset($cf['decimal_display']) && $cf['decimal_display'] ? $cf['decimal_display'] : 'if'; |
|
| 3600 | + $decimalpoint = '.'; |
|
| 3601 | 3601 | |
| 3602 | - if(isset($cs['decimal_separator']) && $cs['decimal_separator']=='comma'){
|
|
| 3603 | - $decimalpoint = ','; |
|
| 3604 | - } |
|
| 3602 | + if(isset($cs['decimal_separator']) && $cs['decimal_separator']=='comma'){
|
|
| 3603 | + $decimalpoint = ','; |
|
| 3604 | + } |
|
| 3605 | 3605 | |
| 3606 | - $separator = ','; |
|
| 3606 | + $separator = ','; |
|
| 3607 | 3607 | |
| 3608 | - if(isset($cs['thousand_separator'])){
|
|
| 3609 | - if($cs['thousand_separator']=='comma'){$separator = ',';}
|
|
| 3610 | - if($cs['thousand_separator']=='slash'){$separator = '\\';}
|
|
| 3611 | - if($cs['thousand_separator']=='period'){$separator = '.';}
|
|
| 3612 | - if($cs['thousand_separator']=='space'){$separator = ' ';}
|
|
| 3613 | - if($cs['thousand_separator']=='none'){$separator = '';}
|
|
| 3614 | - } |
|
| 3608 | + if(isset($cs['thousand_separator'])){
|
|
| 3609 | + if($cs['thousand_separator']=='comma'){$separator = ',';}
|
|
| 3610 | + if($cs['thousand_separator']=='slash'){$separator = '\\';}
|
|
| 3611 | + if($cs['thousand_separator']=='period'){$separator = '.';}
|
|
| 3612 | + if($cs['thousand_separator']=='space'){$separator = ' ';}
|
|
| 3613 | + if($cs['thousand_separator']=='none'){$separator = '';}
|
|
| 3614 | + } |
|
| 3615 | 3615 | |
| 3616 | - $currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left'; |
|
| 3616 | + $currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left'; |
|
| 3617 | 3617 | |
| 3618 | - if($decimals>0 && $decimal_display=='if'){
|
|
| 3619 | - if(is_int($number) || floor( $number ) == $number) |
|
| 3620 | - $decimals = 0; |
|
| 3621 | - } |
|
| 3618 | + if($decimals>0 && $decimal_display=='if'){
|
|
| 3619 | + if(is_int($number) || floor( $number ) == $number) |
|
| 3620 | + $decimals = 0; |
|
| 3621 | + } |
|
| 3622 | 3622 | |
| 3623 | - $number = number_format($number,$decimals,$decimalpoint,$separator); |
|
| 3623 | + $number = number_format($number,$decimals,$decimalpoint,$separator); |
|
| 3624 | 3624 | |
| 3625 | 3625 | |
| 3626 | 3626 | |
| 3627 | - if($currency_symbol_placement=='left'){
|
|
| 3628 | - $number = $symbol . $number; |
|
| 3629 | - }else{
|
|
| 3630 | - $number = $number . $symbol; |
|
| 3631 | - } |
|
| 3627 | + if($currency_symbol_placement=='left'){
|
|
| 3628 | + $number = $symbol . $number; |
|
| 3629 | + }else{
|
|
| 3630 | + $number = $number . $symbol; |
|
| 3631 | + } |
|
| 3632 | 3632 | |
| 3633 | 3633 | |
| 3634 | 3634 | return $number; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL") |
| 50 | 50 | {
|
| 51 | 51 | global $wpdb; |
| 52 | - $result = 0;// no rows affected |
|
| 52 | + $result = 0; // no rows affected |
|
| 53 | 53 | if (!geodir_column_exist($db, $column)) {
|
| 54 | 54 | if (!empty($db) && !empty($column)) |
| 55 | 55 | $result = $wpdb->query("ALTER TABLE `$db` ADD `$column` $column_attr");
|
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | {
|
| 75 | 75 | global $wpdb, $geodir_post_custom_fields_cache; |
| 76 | 76 | |
| 77 | - $cache_stored = $post_type . '_' . $package_id . '_' . $default . '_' . $fields_location; |
|
| 77 | + $cache_stored = $post_type.'_'.$package_id.'_'.$default.'_'.$fields_location; |
|
| 78 | 78 | |
| 79 | 79 | if (array_key_exists($cache_stored, $geodir_post_custom_fields_cache)) {
|
| 80 | 80 | return $geodir_post_custom_fields_cache[$cache_stored]; |
@@ -88,14 +88,14 @@ discard block |
||
| 88 | 88 | $default_query .= " and is_admin = '0' "; |
| 89 | 89 | |
| 90 | 90 | if ($fields_location == 'none') {
|
| 91 | - } else{
|
|
| 92 | - $fields_location = esc_sql( $fields_location ); |
|
| 91 | + } else {
|
|
| 92 | + $fields_location = esc_sql($fields_location); |
|
| 93 | 93 | $default_query .= " and show_in LIKE '%%[$fields_location]%%' "; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $post_meta_info = $wpdb->get_results( |
| 97 | 97 | $wpdb->prepare( |
| 98 | - "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
|
|
| 98 | + "select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where is_active = '1' and post_type = %s {$default_query} order by sort_order asc,admin_title asc",
|
|
| 99 | 99 | array($post_type) |
| 100 | 100 | ) |
| 101 | 101 | ); |
@@ -162,13 +162,13 @@ discard block |
||
| 162 | 162 | * @param string $field_ins_upd When set to "submit" displays form. |
| 163 | 163 | * @param string $field_type_key The key of the custom field. |
| 164 | 164 | */ |
| 165 | - function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key ='') |
|
| 165 | + function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key = '') |
|
| 166 | 166 | {
|
| 167 | 167 | global $wpdb; |
| 168 | 168 | $cf = $result_str; |
| 169 | 169 | if (!is_object($cf)) {
|
| 170 | 170 | |
| 171 | - $field_info = $wpdb->get_row($wpdb->prepare("select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)));
|
|
| 171 | + $field_info = $wpdb->get_row($wpdb->prepare("select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d", array($cf)));
|
|
| 172 | 172 | |
| 173 | 173 | } else {
|
| 174 | 174 | $field_info = $cf; |
@@ -202,14 +202,14 @@ discard block |
||
| 202 | 202 | if ($field_id != '') {
|
| 203 | 203 | $cf = trim($field_id, '_'); |
| 204 | 204 | |
| 205 | - if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
|
|
| 206 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 205 | + if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d", array($cf)))) {
|
|
| 206 | + $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_FIELDS_TABLE." where id= %d ", array($cf)));
|
|
| 207 | 207 | |
| 208 | 208 | $post_type = $field->post_type; |
| 209 | 209 | $htmlvar_name = $field->htmlvar_name; |
| 210 | 210 | |
| 211 | 211 | if ($post_type != '' && $htmlvar_name != '') {
|
| 212 | - $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
|
|
| 212 | + $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
|
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | /** |
@@ -223,18 +223,18 @@ discard block |
||
| 223 | 223 | do_action('geodir_after_custom_field_deleted', $cf, $field->htmlvar_name, $post_type);
|
| 224 | 224 | |
| 225 | 225 | if ($field->field_type == 'address') {
|
| 226 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_address`");
|
|
| 227 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_city`");
|
|
| 228 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_region`");
|
|
| 229 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_country`");
|
|
| 230 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_zip`");
|
|
| 231 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_latitude`");
|
|
| 232 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_longitude`");
|
|
| 233 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapview`");
|
|
| 234 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "_mapzoom`");
|
|
| 226 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_address`");
|
|
| 227 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_city`");
|
|
| 228 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_region`");
|
|
| 229 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_country`");
|
|
| 230 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_zip`");
|
|
| 231 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_latitude`");
|
|
| 232 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_longitude`");
|
|
| 233 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_mapview`");
|
|
| 234 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."_mapzoom`");
|
|
| 235 | 235 | } else {
|
| 236 | 236 | if ($field->field_type != 'fieldset') {
|
| 237 | - $wpdb->query("ALTER TABLE " . $plugin_prefix . $post_type . "_detail DROP `" . $field->htmlvar_name . "`");
|
|
| 237 | + $wpdb->query("ALTER TABLE ".$plugin_prefix.$post_type."_detail DROP `".$field->htmlvar_name."`");
|
|
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
| 306 | 306 | |
| 307 | 307 | // some servers fail if a POST value is VARCHAR so we change it. |
| 308 | - if(isset($request_field['data_type']) && $request_field['data_type']=='XVARCHAR'){
|
|
| 308 | + if (isset($request_field['data_type']) && $request_field['data_type'] == 'XVARCHAR') {
|
|
| 309 | 309 | $request_field['data_type'] = 'VARCHAR'; |
| 310 | 310 | } |
| 311 | 311 | |
@@ -318,12 +318,12 @@ discard block |
||
| 318 | 318 | $post_type = $request_field['listing_type']; |
| 319 | 319 | |
| 320 | 320 | if ($request_field['field_type'] != 'address' && $request_field['field_type'] != 'taxonomy' && $request_field['field_type'] != 'fieldset') {
|
| 321 | - $cehhtmlvar_name = 'geodir_' . $cehhtmlvar_name; |
|
| 321 | + $cehhtmlvar_name = 'geodir_'.$cehhtmlvar_name; |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | $check_html_variable = $wpdb->get_var( |
| 325 | 325 | $wpdb->prepare( |
| 326 | - "select htmlvar_name from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id <> %d and htmlvar_name = %s and post_type = %s ", |
|
| 326 | + "select htmlvar_name from ".GEODIR_CUSTOM_FIELDS_TABLE." where id <> %d and htmlvar_name = %s and post_type = %s ", |
|
| 327 | 327 | array($cf, $cehhtmlvar_name, $post_type) |
| 328 | 328 | ) |
| 329 | 329 | ); |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | $post_meta_info = $wpdb->get_row( |
| 337 | 337 | $wpdb->prepare( |
| 338 | - "select * from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id = %d", |
|
| 338 | + "select * from ".GEODIR_CUSTOM_FIELDS_TABLE." where id = %d", |
|
| 339 | 339 | array($cf) |
| 340 | 340 | ) |
| 341 | 341 | ); |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | if ($post_type == '') $post_type = 'gd_place'; |
| 354 | 354 | |
| 355 | 355 | |
| 356 | - $detail_table = $plugin_prefix . $post_type . '_detail'; |
|
| 356 | + $detail_table = $plugin_prefix.$post_type.'_detail'; |
|
| 357 | 357 | |
| 358 | 358 | $admin_title = $request_field['admin_title']; |
| 359 | 359 | $site_title = $request_field['site_title']; |
@@ -381,12 +381,12 @@ discard block |
||
| 381 | 381 | $for_admin_use = isset($request_field['for_admin_use']) ? $request_field['for_admin_use'] : ''; |
| 382 | 382 | |
| 383 | 383 | |
| 384 | - if(is_array($show_in)){
|
|
| 384 | + if (is_array($show_in)) {
|
|
| 385 | 385 | $show_in = implode(",", $request_field['show_in']);
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | if ($field_type != 'address' && $field_type != 'taxonomy' && $field_type != 'fieldset') {
|
| 389 | - $htmlvar_name = 'geodir_' . $htmlvar_name; |
|
| 389 | + $htmlvar_name = 'geodir_'.$htmlvar_name; |
|
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | $option_values = ''; |
@@ -427,9 +427,9 @@ discard block |
||
| 427 | 427 | |
| 428 | 428 | if ($sort_order == '') {
|
| 429 | 429 | |
| 430 | - $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 430 | + $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM ".GEODIR_CUSTOM_FIELDS_TABLE);
|
|
| 431 | 431 | |
| 432 | - $sort_order = (int)$last_order + 1; |
|
| 432 | + $sort_order = (int) $last_order + 1; |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | $default_value_add = ''; |
@@ -441,15 +441,15 @@ discard block |
||
| 441 | 441 | case 'address': |
| 442 | 442 | |
| 443 | 443 | if ($htmlvar_name != '') {
|
| 444 | - $prefix = $htmlvar_name . '_'; |
|
| 444 | + $prefix = $htmlvar_name.'_'; |
|
| 445 | 445 | } |
| 446 | - $old_prefix = $old_html_variable . '_'; |
|
| 446 | + $old_prefix = $old_html_variable.'_'; |
|
| 447 | 447 | |
| 448 | 448 | |
| 449 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "address` `" . $prefix . "address` VARCHAR( 254 ) NULL"; |
|
| 449 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."address` `".$prefix."address` VARCHAR( 254 ) NULL"; |
|
| 450 | 450 | |
| 451 | 451 | if ($default_value != '') {
|
| 452 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 452 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | $wpdb->query($meta_field_add); |
@@ -458,12 +458,12 @@ discard block |
||
| 458 | 458 | |
| 459 | 459 | if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
| 460 | 460 | |
| 461 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "city'");
|
|
| 461 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."city'");
|
|
| 462 | 462 | if ($is_column) {
|
| 463 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "city` `" . $prefix . "city` VARCHAR( 50 ) NULL"; |
|
| 463 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."city` `".$prefix."city` VARCHAR( 50 ) NULL"; |
|
| 464 | 464 | |
| 465 | 465 | if ($default_value != '') {
|
| 466 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 466 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | $wpdb->query($meta_field_add); |
@@ -471,9 +471,9 @@ discard block |
||
| 471 | 471 | |
| 472 | 472 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 473 | 473 | if ($default_value != '') {
|
| 474 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 474 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 475 | 475 | } |
| 476 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 476 | + geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add); |
|
| 477 | 477 | |
| 478 | 478 | } |
| 479 | 479 | |
@@ -483,36 +483,36 @@ discard block |
||
| 483 | 483 | |
| 484 | 484 | if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
| 485 | 485 | |
| 486 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "region'");
|
|
| 486 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."region'");
|
|
| 487 | 487 | |
| 488 | 488 | if ($is_column) {
|
| 489 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "region` `" . $prefix . "region` VARCHAR( 50 ) NULL"; |
|
| 489 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."region` `".$prefix."region` VARCHAR( 50 ) NULL"; |
|
| 490 | 490 | |
| 491 | 491 | if ($default_value != '') {
|
| 492 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 492 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | $wpdb->query($meta_field_add); |
| 496 | 496 | } else {
|
| 497 | 497 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 498 | 498 | if ($default_value != '') {
|
| 499 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 499 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 502 | + geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add); |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | } |
| 506 | 506 | if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
| 507 | 507 | |
| 508 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "country'");
|
|
| 508 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."country'");
|
|
| 509 | 509 | |
| 510 | 510 | if ($is_column) {
|
| 511 | 511 | |
| 512 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "country` `" . $prefix . "country` VARCHAR( 50 ) NULL"; |
|
| 512 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."country` `".$prefix."country` VARCHAR( 50 ) NULL"; |
|
| 513 | 513 | |
| 514 | 514 | if ($default_value != '') {
|
| 515 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 515 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | $wpdb->query($meta_field_add); |
@@ -520,24 +520,24 @@ discard block |
||
| 520 | 520 | |
| 521 | 521 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 522 | 522 | if ($default_value != '') {
|
| 523 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 523 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 524 | 524 | } |
| 525 | 525 | |
| 526 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 526 | + geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add); |
|
| 527 | 527 | |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | } |
| 531 | 531 | if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
| 532 | 532 | |
| 533 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "zip'");
|
|
| 533 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."zip'");
|
|
| 534 | 534 | |
| 535 | 535 | if ($is_column) {
|
| 536 | 536 | |
| 537 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "zip` `" . $prefix . "zip` VARCHAR( 50 ) NULL"; |
|
| 537 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."zip` `".$prefix."zip` VARCHAR( 50 ) NULL"; |
|
| 538 | 538 | |
| 539 | 539 | if ($default_value != '') {
|
| 540 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 540 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 541 | 541 | } |
| 542 | 542 | |
| 543 | 543 | $wpdb->query($meta_field_add); |
@@ -545,128 +545,128 @@ discard block |
||
| 545 | 545 | |
| 546 | 546 | $meta_field_add = "VARCHAR( 50 ) NULL"; |
| 547 | 547 | if ($default_value != '') {
|
| 548 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 548 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 549 | 549 | } |
| 550 | 550 | |
| 551 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 551 | + geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add); |
|
| 552 | 552 | |
| 553 | 553 | } |
| 554 | 554 | |
| 555 | 555 | } |
| 556 | 556 | if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
| 557 | 557 | |
| 558 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latitude'");
|
|
| 558 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latitude'");
|
|
| 559 | 559 | if ($is_column) {
|
| 560 | 560 | |
| 561 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latitude` `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 561 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latitude` `".$prefix."latitude` VARCHAR( 20 ) NULL"; |
|
| 562 | 562 | |
| 563 | 563 | if ($default_value != '') {
|
| 564 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 564 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | $wpdb->query($meta_field_add); |
| 568 | 568 | } else {
|
| 569 | 569 | |
| 570 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 570 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL"; |
|
| 571 | 571 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 572 | 572 | if ($default_value != '') {
|
| 573 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 573 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 574 | 574 | } |
| 575 | 575 | |
| 576 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 576 | + geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add); |
|
| 577 | 577 | |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | |
| 581 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "longitude'");
|
|
| 581 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."longitude'");
|
|
| 582 | 582 | |
| 583 | 583 | if ($is_column) {
|
| 584 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "longitude` `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 584 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."longitude` `".$prefix."longitude` VARCHAR( 20 ) NULL"; |
|
| 585 | 585 | |
| 586 | 586 | if ($default_value != '') {
|
| 587 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 587 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | $wpdb->query($meta_field_add); |
| 591 | 591 | } else {
|
| 592 | 592 | |
| 593 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 593 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL"; |
|
| 594 | 594 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 595 | 595 | if ($default_value != '') {
|
| 596 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 596 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 597 | 597 | } |
| 598 | 598 | |
| 599 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 599 | + geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add); |
|
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | } |
| 603 | 603 | if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
| 604 | 604 | |
| 605 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapview'");
|
|
| 605 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapview'");
|
|
| 606 | 606 | |
| 607 | 607 | if ($is_column) {
|
| 608 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapview` `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 608 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapview` `".$prefix."mapview` VARCHAR( 15 ) NULL"; |
|
| 609 | 609 | |
| 610 | 610 | if ($default_value != '') {
|
| 611 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 611 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | $wpdb->query($meta_field_add); |
| 615 | 615 | } else {
|
| 616 | 616 | |
| 617 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 617 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL"; |
|
| 618 | 618 | |
| 619 | 619 | $meta_field_add = "VARCHAR( 15 ) NULL"; |
| 620 | 620 | if ($default_value != '') {
|
| 621 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 621 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 622 | 622 | } |
| 623 | 623 | |
| 624 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 624 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add); |
|
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | |
| 628 | 628 | } |
| 629 | 629 | if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
| 630 | 630 | |
| 631 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "mapzoom'");
|
|
| 631 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."mapzoom'");
|
|
| 632 | 632 | if ($is_column) {
|
| 633 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "mapzoom` `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 633 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."mapzoom` `".$prefix."mapzoom` VARCHAR( 3 ) NULL"; |
|
| 634 | 634 | |
| 635 | 635 | if ($default_value != '') {
|
| 636 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 636 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | $wpdb->query($meta_field_add); |
| 640 | 640 | |
| 641 | 641 | } else {
|
| 642 | 642 | |
| 643 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 643 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL"; |
|
| 644 | 644 | |
| 645 | 645 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 646 | 646 | if ($default_value != '') {
|
| 647 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 647 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 648 | 648 | } |
| 649 | 649 | |
| 650 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 650 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add); |
|
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | } |
| 654 | 654 | // show lat lng |
| 655 | 655 | if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
| 656 | - $is_column = $wpdb->get_var("SHOW COLUMNS FROM " . $detail_table . " where field='" . $old_prefix . "latlng'");
|
|
| 656 | + $is_column = $wpdb->get_var("SHOW COLUMNS FROM ".$detail_table." where field='".$old_prefix."latlng'");
|
|
| 657 | 657 | |
| 658 | 658 | if ($is_column) {
|
| 659 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_prefix . "latlng` `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 659 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_prefix."latlng` `".$prefix."latlng` VARCHAR( 3 ) NULL"; |
|
| 660 | 660 | $meta_field_add .= " DEFAULT '1'"; |
| 661 | 661 | |
| 662 | 662 | $wpdb->query($meta_field_add); |
| 663 | 663 | } else {
|
| 664 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 664 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL"; |
|
| 665 | 665 | |
| 666 | 666 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 667 | 667 | $meta_field_add .= " DEFAULT '1'"; |
| 668 | 668 | |
| 669 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 669 | + geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add); |
|
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | } |
@@ -682,30 +682,30 @@ discard block |
||
| 682 | 682 | $op_size = '500'; |
| 683 | 683 | |
| 684 | 684 | // only make the field as big as it needs to be. |
| 685 | - if(isset($option_values) && $option_values && $field_type=='select'){
|
|
| 686 | - $option_values_arr = explode(',',$option_values);
|
|
| 687 | - if(is_array($option_values_arr)){
|
|
| 685 | + if (isset($option_values) && $option_values && $field_type == 'select') {
|
|
| 686 | + $option_values_arr = explode(',', $option_values);
|
|
| 687 | + if (is_array($option_values_arr)) {
|
|
| 688 | 688 | $op_max = 0; |
| 689 | - foreach($option_values_arr as $op_val){
|
|
| 690 | - if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
|
|
| 689 | + foreach ($option_values_arr as $op_val) {
|
|
| 690 | + if (strlen($op_val) && strlen($op_val) > $op_max) {$op_max = strlen($op_val); }
|
|
| 691 | 691 | } |
| 692 | - if($op_max){$op_size =$op_max; }
|
|
| 692 | + if ($op_max) {$op_size = $op_max; }
|
|
| 693 | 693 | } |
| 694 | - }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
|
|
| 695 | - if(strlen($option_values)){
|
|
| 696 | - $op_size = strlen($option_values); |
|
| 694 | + }elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
|
|
| 695 | + if (strlen($option_values)) {
|
|
| 696 | + $op_size = strlen($option_values); |
|
| 697 | 697 | } |
| 698 | 698 | } |
| 699 | 699 | |
| 700 | - $meta_field_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL"; |
|
| 700 | + $meta_field_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."`VARCHAR( $op_size ) NULL"; |
|
| 701 | 701 | |
| 702 | 702 | if ($default_value != '') {
|
| 703 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 703 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 704 | 704 | } |
| 705 | 705 | |
| 706 | 706 | $alter_result = $wpdb->query($meta_field_add); |
| 707 | - if($alter_result===false){
|
|
| 708 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 707 | + if ($alter_result === false) {
|
|
| 708 | + return __('Column change failed, you may have too many columns.', 'geodirectory');
|
|
| 709 | 709 | } |
| 710 | 710 | |
| 711 | 711 | if (isset($request_field['cat_display_type'])) |
@@ -722,9 +722,9 @@ discard block |
||
| 722 | 722 | case 'url': |
| 723 | 723 | case 'file': |
| 724 | 724 | |
| 725 | - $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
|
|
| 726 | - if($alter_result===false){
|
|
| 727 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 725 | + $alter_result = $wpdb->query("ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` TEXT NULL");
|
|
| 726 | + if ($alter_result === false) {
|
|
| 727 | + return __('Column change failed, you may have too many columns.', 'geodirectory');
|
|
| 728 | 728 | } |
| 729 | 729 | if (isset($request_field['advanced_editor'])) |
| 730 | 730 | $extra_fields = $request_field['advanced_editor']; |
@@ -738,24 +738,24 @@ discard block |
||
| 738 | 738 | default: |
| 739 | 739 | if ($data_type != 'VARCHAR' && $data_type != '') {
|
| 740 | 740 | if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
| 741 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL"; |
|
| 741 | + $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` DECIMAL(11, ".(int) $decimal_point.") NULL"; |
|
| 742 | 742 | } else {
|
| 743 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL"; |
|
| 743 | + $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` ".$data_type." NULL"; |
|
| 744 | 744 | } |
| 745 | 745 | |
| 746 | 746 | if (is_numeric($default_value) && $default_value != '') {
|
| 747 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 747 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 748 | 748 | } |
| 749 | 749 | } else {
|
| 750 | - $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL"; |
|
| 750 | + $default_value_add = "ALTER TABLE ".$detail_table." CHANGE `".$old_html_variable."` `".$htmlvar_name."` VARCHAR( 254 ) NULL"; |
|
| 751 | 751 | if ($default_value != '') {
|
| 752 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 752 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 753 | 753 | } |
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | $alter_result = $wpdb->query($default_value_add); |
| 757 | - if($alter_result===false){
|
|
| 758 | - return __('Column change failed, you may have too many columns.','geodirectory');
|
|
| 757 | + if ($alter_result === false) {
|
|
| 758 | + return __('Column change failed, you may have too many columns.', 'geodirectory');
|
|
| 759 | 759 | } |
| 760 | 760 | break; |
| 761 | 761 | endswitch; |
@@ -771,7 +771,7 @@ discard block |
||
| 771 | 771 | |
| 772 | 772 | $wpdb->prepare( |
| 773 | 773 | |
| 774 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 774 | + "update ".GEODIR_CUSTOM_FIELDS_TABLE." set |
|
| 775 | 775 | post_type = %s, |
| 776 | 776 | admin_title = %s, |
| 777 | 777 | site_title = %s, |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | for_admin_use = %s |
| 806 | 806 | where id = %d", |
| 807 | 807 | |
| 808 | - array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf) |
|
| 808 | + array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point, $validation_pattern, $validation_msg, $for_admin_use, $cf) |
|
| 809 | 809 | ) |
| 810 | 810 | |
| 811 | 811 | ); |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | |
| 816 | 816 | $wpdb->query( |
| 817 | 817 | $wpdb->prepare( |
| 818 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 818 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 819 | 819 | site_title=%s |
| 820 | 820 | where post_type = %s and htmlvar_name = %s", |
| 821 | 821 | array($site_title, $post_type, $htmlvar_name) |
@@ -824,7 +824,7 @@ discard block |
||
| 824 | 824 | |
| 825 | 825 | |
| 826 | 826 | if ($cat_sort == '') |
| 827 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 827 | + $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
|
|
| 828 | 828 | |
| 829 | 829 | |
| 830 | 830 | /** |
@@ -844,7 +844,7 @@ discard block |
||
| 844 | 844 | $data_type = ''; |
| 845 | 845 | |
| 846 | 846 | if ($htmlvar_name != '') {
|
| 847 | - $prefix = $htmlvar_name . '_'; |
|
| 847 | + $prefix = $htmlvar_name.'_'; |
|
| 848 | 848 | } |
| 849 | 849 | $old_prefix = $old_html_variable; |
| 850 | 850 | |
@@ -852,109 +852,109 @@ discard block |
||
| 852 | 852 | |
| 853 | 853 | $meta_field_add = "VARCHAR( 254 ) NULL"; |
| 854 | 854 | if ($default_value != '') {
|
| 855 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 855 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 856 | 856 | } |
| 857 | 857 | |
| 858 | - geodir_add_column_if_not_exist($detail_table, $prefix . "address", $meta_field_add); |
|
| 858 | + geodir_add_column_if_not_exist($detail_table, $prefix."address", $meta_field_add); |
|
| 859 | 859 | //$wpdb->query($meta_field_add); |
| 860 | 860 | |
| 861 | 861 | |
| 862 | 862 | if (!empty($extra_fields)) {
|
| 863 | 863 | |
| 864 | 864 | if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
|
| 865 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "city` VARCHAR( 30 ) NULL"; |
|
| 865 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."city` VARCHAR( 30 ) NULL"; |
|
| 866 | 866 | $meta_field_add = "VARCHAR( 30 ) NULL"; |
| 867 | 867 | if ($default_value != '') {
|
| 868 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 868 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 869 | 869 | } |
| 870 | 870 | |
| 871 | - geodir_add_column_if_not_exist($detail_table, $prefix . "city", $meta_field_add); |
|
| 871 | + geodir_add_column_if_not_exist($detail_table, $prefix."city", $meta_field_add); |
|
| 872 | 872 | //$wpdb->query($meta_field_add); |
| 873 | 873 | } |
| 874 | 874 | if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
|
| 875 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "region` VARCHAR( 30 ) NULL"; |
|
| 875 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."region` VARCHAR( 30 ) NULL"; |
|
| 876 | 876 | $meta_field_add = "VARCHAR( 30 ) NULL"; |
| 877 | 877 | if ($default_value != '') {
|
| 878 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 878 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 879 | 879 | } |
| 880 | 880 | |
| 881 | - geodir_add_column_if_not_exist($detail_table, $prefix . "region", $meta_field_add); |
|
| 881 | + geodir_add_column_if_not_exist($detail_table, $prefix."region", $meta_field_add); |
|
| 882 | 882 | //$wpdb->query($meta_field_add); |
| 883 | 883 | } |
| 884 | 884 | if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
|
| 885 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "country` VARCHAR( 30 ) NULL"; |
|
| 885 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."country` VARCHAR( 30 ) NULL"; |
|
| 886 | 886 | |
| 887 | 887 | $meta_field_add = "VARCHAR( 30 ) NULL"; |
| 888 | 888 | if ($default_value != '') {
|
| 889 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 889 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 890 | 890 | } |
| 891 | 891 | |
| 892 | - geodir_add_column_if_not_exist($detail_table, $prefix . "country", $meta_field_add); |
|
| 892 | + geodir_add_column_if_not_exist($detail_table, $prefix."country", $meta_field_add); |
|
| 893 | 893 | //$wpdb->query($meta_field_add); |
| 894 | 894 | } |
| 895 | 895 | if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
|
| 896 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "zip` VARCHAR( 15 ) NULL"; |
|
| 896 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."zip` VARCHAR( 15 ) NULL"; |
|
| 897 | 897 | $meta_field_add = "VARCHAR( 15 ) NULL"; |
| 898 | 898 | if ($default_value != '') {
|
| 899 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 899 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 900 | 900 | } |
| 901 | 901 | |
| 902 | - geodir_add_column_if_not_exist($detail_table, $prefix . "zip", $meta_field_add); |
|
| 902 | + geodir_add_column_if_not_exist($detail_table, $prefix."zip", $meta_field_add); |
|
| 903 | 903 | //$wpdb->query($meta_field_add); |
| 904 | 904 | } |
| 905 | 905 | if (isset($extra_fields['show_map']) && $extra_fields['show_map']) {
|
| 906 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latitude` VARCHAR( 20 ) NULL"; |
|
| 906 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latitude` VARCHAR( 20 ) NULL"; |
|
| 907 | 907 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 908 | 908 | if ($default_value != '') {
|
| 909 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 909 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 910 | 910 | } |
| 911 | 911 | |
| 912 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latitude", $meta_field_add); |
|
| 912 | + geodir_add_column_if_not_exist($detail_table, $prefix."latitude", $meta_field_add); |
|
| 913 | 913 | //$wpdb->query($meta_field_add); |
| 914 | 914 | |
| 915 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "longitude` VARCHAR( 20 ) NULL"; |
|
| 915 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."longitude` VARCHAR( 20 ) NULL"; |
|
| 916 | 916 | |
| 917 | 917 | $meta_field_add = "VARCHAR( 20 ) NULL"; |
| 918 | 918 | if ($default_value != '') {
|
| 919 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 919 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 920 | 920 | } |
| 921 | 921 | |
| 922 | - geodir_add_column_if_not_exist($detail_table, $prefix . "longitude", $meta_field_add); |
|
| 922 | + geodir_add_column_if_not_exist($detail_table, $prefix."longitude", $meta_field_add); |
|
| 923 | 923 | |
| 924 | 924 | //$wpdb->query($meta_field_add); |
| 925 | 925 | } |
| 926 | 926 | if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) {
|
| 927 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapview` VARCHAR( 15 ) NULL"; |
|
| 927 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapview` VARCHAR( 15 ) NULL"; |
|
| 928 | 928 | |
| 929 | 929 | $meta_field_add = "VARCHAR( 15 ) NULL"; |
| 930 | 930 | if ($default_value != '') {
|
| 931 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 931 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 932 | 932 | } |
| 933 | 933 | |
| 934 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapview", $meta_field_add); |
|
| 934 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapview", $meta_field_add); |
|
| 935 | 935 | |
| 936 | 936 | //$wpdb->query($meta_field_add); |
| 937 | 937 | } |
| 938 | 938 | if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) {
|
| 939 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "mapzoom` VARCHAR( 3 ) NULL"; |
|
| 939 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."mapzoom` VARCHAR( 3 ) NULL"; |
|
| 940 | 940 | |
| 941 | 941 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 942 | 942 | if ($default_value != '') {
|
| 943 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 943 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 944 | 944 | } |
| 945 | 945 | |
| 946 | - geodir_add_column_if_not_exist($detail_table, $prefix . "mapzoom", $meta_field_add); |
|
| 946 | + geodir_add_column_if_not_exist($detail_table, $prefix."mapzoom", $meta_field_add); |
|
| 947 | 947 | |
| 948 | 948 | //$wpdb->query($meta_field_add); |
| 949 | 949 | } |
| 950 | 950 | // show lat lng |
| 951 | 951 | if (isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) {
|
| 952 | - $meta_field_add = "ALTER TABLE " . $detail_table . " ADD `" . $prefix . "latlng` VARCHAR( 3 ) NULL"; |
|
| 952 | + $meta_field_add = "ALTER TABLE ".$detail_table." ADD `".$prefix."latlng` VARCHAR( 3 ) NULL"; |
|
| 953 | 953 | |
| 954 | 954 | $meta_field_add = "VARCHAR( 3 ) NULL"; |
| 955 | 955 | $meta_field_add .= " DEFAULT '1'"; |
| 956 | 956 | |
| 957 | - geodir_add_column_if_not_exist($detail_table, $prefix . "latlng", $meta_field_add); |
|
| 957 | + geodir_add_column_if_not_exist($detail_table, $prefix."latlng", $meta_field_add); |
|
| 958 | 958 | //$wpdb->query($meta_field_add); |
| 959 | 959 | } |
| 960 | 960 | } |
@@ -964,8 +964,8 @@ discard block |
||
| 964 | 964 | case 'checkbox': |
| 965 | 965 | $data_type = 'TINYINT'; |
| 966 | 966 | |
| 967 | - $meta_field_add = $data_type . "( 1 ) NOT NULL "; |
|
| 968 | - if ((int)$default_value === 1) {
|
|
| 967 | + $meta_field_add = $data_type."( 1 ) NOT NULL "; |
|
| 968 | + if ((int) $default_value === 1) {
|
|
| 969 | 969 | $meta_field_add .= " DEFAULT '1'"; |
| 970 | 970 | } |
| 971 | 971 | |
@@ -998,7 +998,7 @@ discard block |
||
| 998 | 998 | } |
| 999 | 999 | } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
|
| 1000 | 1000 | if (strlen($option_values)) {
|
| 1001 | - $op_size = strlen($option_values); |
|
| 1001 | + $op_size = strlen($option_values); |
|
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | 1004 | if (isset($request_field['multi_display_type'])) {
|
@@ -1006,9 +1006,9 @@ discard block |
||
| 1006 | 1006 | } |
| 1007 | 1007 | } |
| 1008 | 1008 | |
| 1009 | - $meta_field_add = $data_type . "( $op_size ) NULL "; |
|
| 1009 | + $meta_field_add = $data_type."( $op_size ) NULL "; |
|
| 1010 | 1010 | if ($default_value != '') {
|
| 1011 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1011 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | 1014 | $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
@@ -1023,9 +1023,9 @@ discard block |
||
| 1023 | 1023 | |
| 1024 | 1024 | $data_type = 'TEXT'; |
| 1025 | 1025 | |
| 1026 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1026 | + $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL "; |
|
| 1027 | 1027 | |
| 1028 | - $meta_field_add = $data_type . " NULL "; |
|
| 1028 | + $meta_field_add = $data_type." NULL "; |
|
| 1029 | 1029 | /*if($default_value != '') |
| 1030 | 1030 | { $meta_field_add .= " DEFAULT '".$default_value."'"; }*/
|
| 1031 | 1031 | |
@@ -1040,9 +1040,9 @@ discard block |
||
| 1040 | 1040 | |
| 1041 | 1041 | $data_type = 'DATE'; |
| 1042 | 1042 | |
| 1043 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1043 | + $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL "; |
|
| 1044 | 1044 | |
| 1045 | - $meta_field_add = $data_type . " NULL "; |
|
| 1045 | + $meta_field_add = $data_type." NULL "; |
|
| 1046 | 1046 | |
| 1047 | 1047 | $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
| 1048 | 1048 | if ($add_result === false) {
|
@@ -1055,9 +1055,9 @@ discard block |
||
| 1055 | 1055 | |
| 1056 | 1056 | $data_type = 'TIME'; |
| 1057 | 1057 | |
| 1058 | - $default_value_add = " `" . $htmlvar_name . "` " . $data_type . " NULL "; |
|
| 1058 | + $default_value_add = " `".$htmlvar_name."` ".$data_type." NULL "; |
|
| 1059 | 1059 | |
| 1060 | - $meta_field_add = $data_type . " NULL "; |
|
| 1060 | + $meta_field_add = $data_type." NULL "; |
|
| 1061 | 1061 | |
| 1062 | 1062 | $add_result = geodir_add_column_if_not_exist($detail_table, $htmlvar_name, $meta_field_add); |
| 1063 | 1063 | if ($add_result === false) {
|
@@ -1069,22 +1069,22 @@ discard block |
||
| 1069 | 1069 | default: |
| 1070 | 1070 | |
| 1071 | 1071 | if ($data_type != 'VARCHAR' && $data_type != '') {
|
| 1072 | - $meta_field_add = $data_type . " NULL "; |
|
| 1072 | + $meta_field_add = $data_type." NULL "; |
|
| 1073 | 1073 | |
| 1074 | 1074 | if ($data_type == 'FLOAT' && $decimal_point > 0) {
|
| 1075 | - $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL "; |
|
| 1075 | + $meta_field_add = "DECIMAL(11, ".(int) $decimal_point.") NULL "; |
|
| 1076 | 1076 | } |
| 1077 | 1077 | |
| 1078 | 1078 | if (is_numeric($default_value) && $default_value != '') {
|
| 1079 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1080 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1079 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 1080 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 1081 | 1081 | } |
| 1082 | 1082 | } else {
|
| 1083 | 1083 | $meta_field_add = " VARCHAR( 254 ) NULL "; |
| 1084 | 1084 | |
| 1085 | 1085 | if ($default_value != '') {
|
| 1086 | - $default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1087 | - $meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
| 1086 | + $default_value_add .= " DEFAULT '".$default_value."'"; |
|
| 1087 | + $meta_field_add .= " DEFAULT '".$default_value."'"; |
|
| 1088 | 1088 | } |
| 1089 | 1089 | } |
| 1090 | 1090 | |
@@ -1106,7 +1106,7 @@ discard block |
||
| 1106 | 1106 | |
| 1107 | 1107 | $wpdb->prepare( |
| 1108 | 1108 | |
| 1109 | - "insert into " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1109 | + "insert into ".GEODIR_CUSTOM_FIELDS_TABLE." set |
|
| 1110 | 1110 | post_type = %s, |
| 1111 | 1111 | admin_title = %s, |
| 1112 | 1112 | site_title = %s, |
@@ -1139,7 +1139,7 @@ discard block |
||
| 1139 | 1139 | validation_msg = %s, |
| 1140 | 1140 | for_admin_use = %s ", |
| 1141 | 1141 | |
| 1142 | - array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing,$show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use) |
|
| 1142 | + array($post_type, $admin_title, $site_title, $field_type, $field_type_key, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing, $show_in, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point, $validation_pattern, $validation_msg, $for_admin_use) |
|
| 1143 | 1143 | |
| 1144 | 1144 | ) |
| 1145 | 1145 | |
@@ -1151,7 +1151,7 @@ discard block |
||
| 1151 | 1151 | |
| 1152 | 1152 | } |
| 1153 | 1153 | |
| 1154 | - return (int)$lastid; |
|
| 1154 | + return (int) $lastid; |
|
| 1155 | 1155 | |
| 1156 | 1156 | |
| 1157 | 1157 | } else {
|
@@ -1184,7 +1184,7 @@ discard block |
||
| 1184 | 1184 | |
| 1185 | 1185 | $post_meta_info = $wpdb->query( |
| 1186 | 1186 | $wpdb->prepare( |
| 1187 | - "update " . GEODIR_CUSTOM_FIELDS_TABLE . " set |
|
| 1187 | + "update ".GEODIR_CUSTOM_FIELDS_TABLE." set |
|
| 1188 | 1188 | sort_order=%d |
| 1189 | 1189 | where id= %d", |
| 1190 | 1190 | array($count, $cf) |
@@ -1200,11 +1200,11 @@ discard block |
||
| 1200 | 1200 | } |
| 1201 | 1201 | |
| 1202 | 1202 | |
| 1203 | -function geodir_get_cf_value($cf){
|
|
| 1203 | +function geodir_get_cf_value($cf) {
|
|
| 1204 | 1204 | global $gd_session; |
| 1205 | 1205 | $value = ''; |
| 1206 | 1206 | if (is_admin()) {
|
| 1207 | - global $post,$gd_session; |
|
| 1207 | + global $post, $gd_session; |
|
| 1208 | 1208 | |
| 1209 | 1209 | if (isset($_REQUEST['post'])) |
| 1210 | 1210 | $_REQUEST['pid'] = $_REQUEST['post']; |
@@ -1246,16 +1246,16 @@ discard block |
||
| 1246 | 1246 | $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type); |
| 1247 | 1247 | |
| 1248 | 1248 | foreach ($custom_fields as $key => $val) {
|
| 1249 | - if(isset($val['extra_fields'])){$extra_fields = $val['extra_fields'];}
|
|
| 1249 | + if (isset($val['extra_fields'])) {$extra_fields = $val['extra_fields']; }
|
|
| 1250 | 1250 | $val = stripslashes_deep($val); // strip slashes from labels |
| 1251 | - if(isset($val['extra_fields'])){$val['extra_fields'] = $extra_fields;}
|
|
| 1251 | + if (isset($val['extra_fields'])) {$val['extra_fields'] = $extra_fields; }
|
|
| 1252 | 1252 | |
| 1253 | 1253 | $name = $val['name']; |
| 1254 | 1254 | $type = $val['type']; |
| 1255 | 1255 | $is_default = $val['is_default']; |
| 1256 | 1256 | |
| 1257 | 1257 | /* field available to site admin only for edit */ |
| 1258 | - $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false; |
|
| 1258 | + $for_admin_use = isset($val['for_admin_use']) && (int) $val['for_admin_use'] == 1 ? true : false; |
|
| 1259 | 1259 | if ($for_admin_use && !is_super_admin()) {
|
| 1260 | 1260 | continue; |
| 1261 | 1261 | } |
@@ -1280,11 +1280,11 @@ discard block |
||
| 1280 | 1280 | * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
| 1281 | 1281 | * @see 'geodir_after_custom_form_field_$name' |
| 1282 | 1282 | */ |
| 1283 | - do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1283 | + do_action('geodir_before_custom_form_field_'.$name, $listing_type, $package_id, $val);
|
|
| 1284 | 1284 | |
| 1285 | 1285 | |
| 1286 | 1286 | $custom_field = $val; |
| 1287 | - $html =''; |
|
| 1287 | + $html = ''; |
|
| 1288 | 1288 | /** |
| 1289 | 1289 | * Filter the output for custom fields. |
| 1290 | 1290 | * |
@@ -1293,7 +1293,7 @@ discard block |
||
| 1293 | 1293 | * @param string $html The html to be filtered (blank). |
| 1294 | 1294 | * @param array $custom_field The custom field array values. |
| 1295 | 1295 | */ |
| 1296 | - echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
|
|
| 1296 | + echo apply_filters("geodir_custom_field_input_{$type}", $html, $custom_field);
|
|
| 1297 | 1297 | |
| 1298 | 1298 | |
| 1299 | 1299 | |
@@ -1308,7 +1308,7 @@ discard block |
||
| 1308 | 1308 | * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
| 1309 | 1309 | * @see 'geodir_before_custom_form_field_$name' |
| 1310 | 1310 | */ |
| 1311 | - do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1311 | + do_action('geodir_after_custom_form_field_'.$name, $listing_type, $package_id, $val);
|
|
| 1312 | 1312 | |
| 1313 | 1313 | } |
| 1314 | 1314 | |
@@ -1334,7 +1334,7 @@ discard block |
||
| 1334 | 1334 | |
| 1335 | 1335 | $filter = $wpdb->get_row( |
| 1336 | 1336 | $wpdb->prepare( |
| 1337 | - "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'", |
|
| 1337 | + "SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND ".$key."='".$value."'", |
|
| 1338 | 1338 | array($geodir_post_type) |
| 1339 | 1339 | ) |
| 1340 | 1340 | ); |
@@ -1349,14 +1349,14 @@ discard block |
||
| 1349 | 1349 | } |
| 1350 | 1350 | |
| 1351 | 1351 | |
| 1352 | -function geodir_field_icon_proccess($cf){
|
|
| 1352 | +function geodir_field_icon_proccess($cf) {
|
|
| 1353 | 1353 | |
| 1354 | 1354 | |
| 1355 | 1355 | if (strpos($cf['field_icon'], 'http') !== false) {
|
| 1356 | - $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 1356 | + $field_icon = ' background: url('.$cf['field_icon'].') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 1357 | 1357 | } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
|
| 1358 | - $field_icon = '<i class="' . $cf['field_icon'] . '"></i>'; |
|
| 1359 | - }else{
|
|
| 1358 | + $field_icon = '<i class="'.$cf['field_icon'].'"></i>'; |
|
| 1359 | + } else {
|
|
| 1360 | 1360 | $field_icon = $cf['field_icon']; |
| 1361 | 1361 | } |
| 1362 | 1362 | |
@@ -1401,14 +1401,14 @@ discard block |
||
| 1401 | 1401 | |
| 1402 | 1402 | |
| 1403 | 1403 | foreach ($fields_info as $type) {
|
| 1404 | - if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];}
|
|
| 1404 | + if (isset($type['extra_fields'])) {$extra_fields = $type['extra_fields']; }
|
|
| 1405 | 1405 | $type = stripslashes_deep($type); // strip slashes |
| 1406 | - if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;}
|
|
| 1406 | + if (isset($type['extra_fields'])) {$type['extra_fields'] = $extra_fields; }
|
|
| 1407 | 1407 | $html = ''; |
| 1408 | 1408 | $field_icon = geodir_field_icon_proccess($type); |
| 1409 | 1409 | $filed_type = $type['type']; |
| 1410 | 1410 | $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : ''; |
| 1411 | - if($html_var=='post'){$html_var='post_address';}
|
|
| 1411 | + if ($html_var == 'post') {$html_var = 'post_address'; }
|
|
| 1412 | 1412 | |
| 1413 | 1413 | /** |
| 1414 | 1414 | * Filter the output for custom fields. |
@@ -1419,7 +1419,7 @@ discard block |
||
| 1419 | 1419 | * @param string $fields_location The location the field is to be show. |
| 1420 | 1420 | * @param array $type The array of field values. |
| 1421 | 1421 | */ |
| 1422 | - $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
|
|
| 1422 | + $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
|
|
| 1423 | 1423 | |
| 1424 | 1424 | $variables_array = array(); |
| 1425 | 1425 | |
@@ -1479,7 +1479,7 @@ discard block |
||
| 1479 | 1479 | * @param string $fields_location The location the fields are being output. |
| 1480 | 1480 | * @since 1.6.9 |
| 1481 | 1481 | */ |
| 1482 | - return apply_filters('geodir_show_listing_info',$html,$fields_location);
|
|
| 1482 | + return apply_filters('geodir_show_listing_info', $html, $fields_location);
|
|
| 1483 | 1483 | |
| 1484 | 1484 | } |
| 1485 | 1485 | } |
@@ -1554,7 +1554,7 @@ discard block |
||
| 1554 | 1554 | |
| 1555 | 1555 | $post_type = get_post_type($post_id); |
| 1556 | 1556 | //echo $field_id; exit; |
| 1557 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1557 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1558 | 1558 | |
| 1559 | 1559 | $postcurr_images = array(); |
| 1560 | 1560 | $postcurr_images = geodir_get_post_meta($post_id, $field_id, true); |
@@ -1573,13 +1573,13 @@ discard block |
||
| 1573 | 1573 | $geodir_uploadurl = $uploads['url']; |
| 1574 | 1574 | $sub_dir = $uploads['subdir']; |
| 1575 | 1575 | |
| 1576 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
|
|
| 1576 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
|
|
| 1577 | 1577 | |
| 1578 | 1578 | for ($m = 0; $m < count($post_image); $m++) {
|
| 1579 | 1579 | |
| 1580 | 1580 | /* --------- start ------- */ |
| 1581 | 1581 | |
| 1582 | - if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM " . $table . " WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
|
|
| 1582 | + if (!$find_image = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM ".$table." WHERE $field_id = %s AND post_id = %d", array($post_image[$m], $post_id)))) {
|
|
| 1583 | 1583 | |
| 1584 | 1584 | |
| 1585 | 1585 | $curr_img_url = $post_image[$m]; |
@@ -1605,24 +1605,24 @@ discard block |
||
| 1605 | 1605 | //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
|
| 1606 | 1606 | |
| 1607 | 1607 | if (!function_exists('wp_handle_upload'))
|
| 1608 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1608 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
| 1609 | 1609 | |
| 1610 | 1610 | if (!is_dir($geodir_uploadpath)) |
| 1611 | 1611 | mkdir($geodir_uploadpath); |
| 1612 | 1612 | |
| 1613 | - $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
|
| 1613 | + $new_name = $post_id.'_'.$field_id.'_'.$img_name_arr[0].'.'.$img_name_arr[1]; |
|
| 1614 | 1614 | $explode_sub_dir = explode("/", $sub_dir);
|
| 1615 | 1615 | if ($curr_img_dir == end($explode_sub_dir)) {
|
| 1616 | - $img_path = $geodir_uploadpath . '/' . $filename; |
|
| 1617 | - $img_url = $geodir_uploadurl . '/' . $filename; |
|
| 1616 | + $img_path = $geodir_uploadpath.'/'.$filename; |
|
| 1617 | + $img_url = $geodir_uploadurl.'/'.$filename; |
|
| 1618 | 1618 | } else {
|
| 1619 | - $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1620 | - $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1619 | + $img_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1620 | + $img_url = $uploads['url'].'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1621 | 1621 | } |
| 1622 | 1622 | |
| 1623 | 1623 | $uploaded_file = ''; |
| 1624 | 1624 | if (file_exists($img_path)) |
| 1625 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1625 | + $uploaded_file = copy($img_path, $geodir_uploadpath.'/'.$new_name); |
|
| 1626 | 1626 | |
| 1627 | 1627 | if ($curr_img_dir != $geodir_uploaddir) {
|
| 1628 | 1628 | if (file_exists($img_path)) |
@@ -1630,7 +1630,7 @@ discard block |
||
| 1630 | 1630 | } |
| 1631 | 1631 | |
| 1632 | 1632 | if (!empty($uploaded_file)) |
| 1633 | - $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 1633 | + $file_urls = $geodir_uploadurl.'/'.$new_name; |
|
| 1634 | 1634 | |
| 1635 | 1635 | } else {
|
| 1636 | 1636 | $file_urls = $post_image[$m]; |
@@ -1644,8 +1644,8 @@ discard block |
||
| 1644 | 1644 | if (!empty($postcurr_images)) {
|
| 1645 | 1645 | |
| 1646 | 1646 | if ($file_urls != $postcurr_images) {
|
| 1647 | - $invalid_files[] = (object)array('src' => $postcurr_images);
|
|
| 1648 | - $invalid_files = (object)$invalid_files; |
|
| 1647 | + $invalid_files[] = (object) array('src' => $postcurr_images);
|
|
| 1648 | + $invalid_files = (object) $invalid_files; |
|
| 1649 | 1649 | } |
| 1650 | 1650 | } |
| 1651 | 1651 | |
@@ -1697,9 +1697,9 @@ discard block |
||
| 1697 | 1697 | function geodir_upload_dir($upload) |
| 1698 | 1698 | {
|
| 1699 | 1699 | global $current_user; |
| 1700 | - $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID; |
|
| 1701 | - $upload['path'] = $upload['basedir'] . $upload['subdir']; |
|
| 1702 | - $upload['url'] = $upload['baseurl'] . $upload['subdir']; |
|
| 1700 | + $upload['subdir'] = $upload['subdir'].'/temp_'.$current_user->data->ID; |
|
| 1701 | + $upload['path'] = $upload['basedir'].$upload['subdir']; |
|
| 1702 | + $upload['url'] = $upload['baseurl'].$upload['subdir']; |
|
| 1703 | 1703 | return $upload; |
| 1704 | 1704 | } |
| 1705 | 1705 | |
@@ -1714,20 +1714,20 @@ discard block |
||
| 1714 | 1714 | // check ajax nonce |
| 1715 | 1715 | $imgid = $_POST["imgid"]; |
| 1716 | 1716 | |
| 1717 | - check_ajax_referer($imgid . 'pluploadan'); |
|
| 1717 | + check_ajax_referer($imgid.'pluploadan'); |
|
| 1718 | 1718 | |
| 1719 | 1719 | // handle custom file uploaddir |
| 1720 | 1720 | add_filter('upload_dir', 'geodir_upload_dir');
|
| 1721 | 1721 | |
| 1722 | 1722 | // change file orientation if needed |
| 1723 | - $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']); |
|
| 1723 | + $fixed_file = geodir_exif($_FILES[$imgid.'async-upload']); |
|
| 1724 | 1724 | |
| 1725 | 1725 | // handle file upload |
| 1726 | 1726 | $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
|
| 1727 | 1727 | // remove handle custom file uploaddir |
| 1728 | 1728 | remove_filter('upload_dir', 'geodir_upload_dir');
|
| 1729 | 1729 | |
| 1730 | - if(!isset($status['url']) && isset($status['error'])){
|
|
| 1730 | + if (!isset($status['url']) && isset($status['error'])) {
|
|
| 1731 | 1731 | print_r($status); |
| 1732 | 1732 | } |
| 1733 | 1733 | |
@@ -1757,9 +1757,9 @@ discard block |
||
| 1757 | 1757 | |
| 1758 | 1758 | $post_type = get_post_type($post_id); |
| 1759 | 1759 | |
| 1760 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1760 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1761 | 1761 | |
| 1762 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1762 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM ".$table." WHERE post_id=%d", array($post_id)));
|
|
| 1763 | 1763 | |
| 1764 | 1764 | if ($results) {
|
| 1765 | 1765 | return $results[0]->geodir_video; |
@@ -1783,9 +1783,9 @@ discard block |
||
| 1783 | 1783 | |
| 1784 | 1784 | $post_type = get_post_type($post_id); |
| 1785 | 1785 | |
| 1786 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1786 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1787 | 1787 | |
| 1788 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1788 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM ".$table." WHERE post_id=%d", array($post_id)));
|
|
| 1789 | 1789 | |
| 1790 | 1790 | if ($results) {
|
| 1791 | 1791 | return $results[0]->geodir_special_offers; |
@@ -1803,12 +1803,12 @@ discard block |
||
| 1803 | 1803 | */ |
| 1804 | 1804 | function geodir_max_upload_size() |
| 1805 | 1805 | {
|
| 1806 | - $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
|
|
| 1806 | + $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
|
|
| 1807 | 1807 | |
| 1808 | 1808 | if ($max_filesize > 0 && $max_filesize < 1) {
|
| 1809 | - $max_filesize = (int)($max_filesize * 1024) . 'kb'; |
|
| 1809 | + $max_filesize = (int) ($max_filesize * 1024).'kb'; |
|
| 1810 | 1810 | } else {
|
| 1811 | - $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
|
| 1811 | + $max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb'; |
|
| 1812 | 1812 | } |
| 1813 | 1813 | /** Filter documented in geodirectory-functions/general_functions.php **/ |
| 1814 | 1814 | return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
|
@@ -1840,7 +1840,7 @@ discard block |
||
| 1840 | 1840 | |
| 1841 | 1841 | $custom_fields = $wpdb->get_results( |
| 1842 | 1842 | $wpdb->prepare( |
| 1843 | - "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from " . GEODIR_CUSTOM_FIELDS_TABLE . " where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc", |
|
| 1843 | + "select post_type,data_type,field_type,site_title,htmlvar_name,field_icon from ".GEODIR_CUSTOM_FIELDS_TABLE." where post_type = %s and is_active='1' and cat_sort='1' AND field_type != 'address' order by sort_order asc", |
|
| 1844 | 1844 | array($post_type) |
| 1845 | 1845 | ), 'ARRAY_A' |
| 1846 | 1846 | ); |
@@ -1967,7 +1967,7 @@ discard block |
||
| 1967 | 1967 | |
| 1968 | 1968 | $post_meta_info = $wpdb->query( |
| 1969 | 1969 | $wpdb->prepare( |
| 1970 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 1970 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 1971 | 1971 | sort_order=%d |
| 1972 | 1972 | where id= %d", |
| 1973 | 1973 | array($count, $cf) |
@@ -2049,14 +2049,14 @@ discard block |
||
| 2049 | 2049 | |
| 2050 | 2050 | $check_html_variable = $wpdb->get_var( |
| 2051 | 2051 | $wpdb->prepare( |
| 2052 | - "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 2052 | + "select htmlvar_name from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 2053 | 2053 | array($cehhtmlvar_name, $post_type, $field_type) |
| 2054 | 2054 | ) |
| 2055 | 2055 | ); |
| 2056 | 2056 | |
| 2057 | 2057 | if ($is_default == 1) {
|
| 2058 | 2058 | |
| 2059 | - $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 2059 | + $wpdb->query($wpdb->prepare("update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 2060 | 2060 | |
| 2061 | 2061 | } |
| 2062 | 2062 | |
@@ -2067,7 +2067,7 @@ discard block |
||
| 2067 | 2067 | |
| 2068 | 2068 | $wpdb->prepare( |
| 2069 | 2069 | |
| 2070 | - "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2070 | + "insert into ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 2071 | 2071 | post_type = %s, |
| 2072 | 2072 | data_type = %s, |
| 2073 | 2073 | field_type = %s, |
@@ -2098,7 +2098,7 @@ discard block |
||
| 2098 | 2098 | |
| 2099 | 2099 | $wpdb->prepare( |
| 2100 | 2100 | |
| 2101 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2101 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 2102 | 2102 | post_type = %s, |
| 2103 | 2103 | data_type = %s, |
| 2104 | 2104 | field_type = %s, |
@@ -2124,7 +2124,7 @@ discard block |
||
| 2124 | 2124 | } |
| 2125 | 2125 | |
| 2126 | 2126 | |
| 2127 | - return (int)$lastid; |
|
| 2127 | + return (int) $lastid; |
|
| 2128 | 2128 | |
| 2129 | 2129 | } |
| 2130 | 2130 | } |
@@ -2147,7 +2147,7 @@ discard block |
||
| 2147 | 2147 | if ($field_id != '') {
|
| 2148 | 2148 | $cf = trim($field_id, '_'); |
| 2149 | 2149 | |
| 2150 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 2150 | + $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where id= %d ", array($cf)));
|
|
| 2151 | 2151 | |
| 2152 | 2152 | return $field_id; |
| 2153 | 2153 | |
@@ -2170,12 +2170,12 @@ discard block |
||
| 2170 | 2170 | * @param string $field_ins_upd When set to "submit" displays form. |
| 2171 | 2171 | * @param bool $default when set to true field will be for admin use only. |
| 2172 | 2172 | */ |
| 2173 | - function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='') |
|
| 2173 | + function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key = '') |
|
| 2174 | 2174 | {
|
| 2175 | 2175 | global $wpdb; |
| 2176 | 2176 | $cf = $result_str; |
| 2177 | 2177 | if (!is_object($cf)) {
|
| 2178 | - $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
|
|
| 2178 | + $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE id = %d", array($cf)));
|
|
| 2179 | 2179 | } else {
|
| 2180 | 2180 | $field_info = $cf; |
| 2181 | 2181 | $result_str = $cf->id; |
@@ -2211,18 +2211,18 @@ discard block |
||
| 2211 | 2211 | if ($htmlvar_name == '') |
| 2212 | 2212 | $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
| 2213 | 2213 | |
| 2214 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 2214 | + $nonce = wp_create_nonce('custom_fields_'.$result_str);
|
|
| 2215 | 2215 | |
| 2216 | 2216 | $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
| 2217 | 2217 | $cso_arr = geodir_get_custom_sort_options($post_type); |
| 2218 | 2218 | |
| 2219 | 2219 | $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']); |
| 2220 | - foreach($cso_arr as $cso){
|
|
| 2221 | - if($cur_field_type==$cso['field_type']){
|
|
| 2220 | + foreach ($cso_arr as $cso) {
|
|
| 2221 | + if ($cur_field_type == $cso['field_type']) {
|
|
| 2222 | 2222 | |
| 2223 | 2223 | if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
|
| 2224 | 2224 | $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>'; |
| 2225 | - }elseif(isset($cso['field_icon']) && $cso['field_icon']){
|
|
| 2225 | + }elseif (isset($cso['field_icon']) && $cso['field_icon']) {
|
|
| 2226 | 2226 | $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
|
| 2227 | 2227 | } |
| 2228 | 2228 | |
@@ -2232,40 +2232,40 @@ discard block |
||
| 2232 | 2232 | $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500); |
| 2233 | 2233 | ?> |
| 2234 | 2234 | |
| 2235 | - <li class="text" id="licontainer_<?php echo $result_str;?>"> |
|
| 2235 | + <li class="text" id="licontainer_<?php echo $result_str; ?>"> |
|
| 2236 | 2236 | <form><!-- we need to wrap in a form so we can use radio buttons with same name --> |
| 2237 | - <div class="title title<?php echo $result_str;?> gt-fieldset" |
|
| 2238 | - title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
|
|
| 2239 | - ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
|
|
| 2237 | + <div class="title title<?php echo $result_str; ?> gt-fieldset" |
|
| 2238 | + title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory'); ?>"
|
|
| 2239 | + ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
|
|
| 2240 | 2240 | <?php |
| 2241 | 2241 | |
| 2242 | 2242 | ?> |
| 2243 | 2243 | |
| 2244 | - <div title="<?php _e('Click to remove field', 'geodirectory');?>"
|
|
| 2245 | - onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
|
|
| 2244 | + <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
|
|
| 2245 | + onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
|
|
| 2246 | 2246 | class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div> |
| 2247 | 2247 | |
| 2248 | 2248 | |
| 2249 | - <?php echo $field_icon;?> |
|
| 2249 | + <?php echo $field_icon; ?> |
|
| 2250 | 2250 | <b style="cursor:pointer;" |
| 2251 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' (' . $site_title . ')');?></b>
|
|
| 2251 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory').' ('.$site_title.')'); ?></b>
|
|
| 2252 | 2252 | |
| 2253 | 2253 | </div> |
| 2254 | 2254 | |
| 2255 | - <div id="field_frm<?php echo $result_str;?>" class="field_frm" |
|
| 2255 | + <div id="field_frm<?php echo $result_str; ?>" class="field_frm" |
|
| 2256 | 2256 | style="display:<?php if ($field_ins_upd == 'submit') {
|
| 2257 | 2257 | echo 'block;'; |
| 2258 | 2258 | } else {
|
| 2259 | 2259 | echo 'none;'; |
| 2260 | 2260 | } ?>"> |
| 2261 | 2261 | <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/> |
| 2262 | - <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/> |
|
| 2263 | - <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/> |
|
| 2264 | - <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/> |
|
| 2262 | + <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/> |
|
| 2263 | + <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/> |
|
| 2264 | + <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str; ?>"/> |
|
| 2265 | 2265 | <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
|
| 2266 | 2266 | echo $field_info->data_type; |
| 2267 | 2267 | }?>"/> |
| 2268 | - <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/> |
|
| 2268 | + <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name; ?>"/> |
|
| 2269 | 2269 | |
| 2270 | 2270 | |
| 2271 | 2271 | <ul class="widefat post fixed" border="0" style="width:100%;"> |
@@ -2275,7 +2275,7 @@ discard block |
||
| 2275 | 2275 | <input type="hidden" name="site_title" id="site_title" value="<?php echo esc_attr($site_title); ?>"/> |
| 2276 | 2276 | |
| 2277 | 2277 | <li> |
| 2278 | - <?php $value = (isset($field_info->sort_asc) && $field_info->sort_asc) ? $field_info->sort_asc : 0;?> |
|
| 2278 | + <?php $value = (isset($field_info->sort_asc) && $field_info->sort_asc) ? $field_info->sort_asc : 0; ?> |
|
| 2279 | 2279 | |
| 2280 | 2280 | <label for="asc" class="gd-cf-tooltip-wrap"> |
| 2281 | 2281 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show Ascending Sort (low to high)', 'geodirectory'); ?>
|
@@ -2285,24 +2285,24 @@ discard block |
||
| 2285 | 2285 | </label> |
| 2286 | 2286 | <div class="gd-cf-input-wrap gd-switch"> |
| 2287 | 2287 | |
| 2288 | - <input type="radio" id="asc_yes<?php echo $radio_id;?>" name="asc" class="gdri-enabled" value="1" |
|
| 2288 | + <input type="radio" id="asc_yes<?php echo $radio_id; ?>" name="asc" class="gdri-enabled" value="1" |
|
| 2289 | 2289 | <?php if ($value == '1') {
|
| 2290 | 2290 | echo 'checked'; |
| 2291 | 2291 | } ?>/> |
| 2292 | - <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2292 | + <label onclick="show_hide_radio(this,'show','cfs-asc-title');" for="asc_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2293 | 2293 | |
| 2294 | - <input type="radio" id="asc_no<?php echo $radio_id;?>" name="asc" class="gdri-disabled" value="0" |
|
| 2294 | + <input type="radio" id="asc_no<?php echo $radio_id; ?>" name="asc" class="gdri-disabled" value="0" |
|
| 2295 | 2295 | <?php if ($value == '0' || !$value) {
|
| 2296 | 2296 | echo 'checked'; |
| 2297 | 2297 | } ?>/> |
| 2298 | - <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2298 | + <label onclick="show_hide_radio(this,'hide','cfs-asc-title');" for="asc_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2299 | 2299 | |
| 2300 | 2300 | </div> |
| 2301 | 2301 | |
| 2302 | 2302 | </li> |
| 2303 | 2303 | |
| 2304 | - <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'";}?>>
|
|
| 2305 | - <?php $value = (isset($field_info->asc_title) && $field_info->asc_title) ? esc_attr($field_info->asc_title) : '';?> |
|
| 2304 | + <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'"; }?>>
|
|
| 2305 | + <?php $value = (isset($field_info->asc_title) && $field_info->asc_title) ? esc_attr($field_info->asc_title) : ''; ?> |
|
| 2306 | 2306 | |
| 2307 | 2307 | <label for="asc_title" class="gd-cf-tooltip-wrap"> |
| 2308 | 2308 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Ascending title', 'geodirectory'); ?>
|
@@ -2312,14 +2312,14 @@ discard block |
||
| 2312 | 2312 | </label> |
| 2313 | 2313 | <div class="gd-cf-input-wrap"> |
| 2314 | 2314 | |
| 2315 | - <input type="text" name="asc_title" id="asc_title" value="<?php echo $value;?>" /> |
|
| 2315 | + <input type="text" name="asc_title" id="asc_title" value="<?php echo $value; ?>" /> |
|
| 2316 | 2316 | </div> |
| 2317 | 2317 | |
| 2318 | 2318 | |
| 2319 | 2319 | </li> |
| 2320 | 2320 | |
| 2321 | 2321 | |
| 2322 | - <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'";}?>>
|
|
| 2322 | + <li class="cfs-asc-title" <?php if ((isset($field_info->sort_asc) && $field_info->sort_asc == '0') || !isset($field_info->sort_asc)) {echo "style='display:none;'"; }?>>
|
|
| 2323 | 2323 | |
| 2324 | 2324 | <label for="is_default" class="gd-cf-tooltip-wrap"> |
| 2325 | 2325 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
|
@@ -2330,7 +2330,7 @@ discard block |
||
| 2330 | 2330 | <div class="gd-cf-input-wrap"> |
| 2331 | 2331 | |
| 2332 | 2332 | <input type="radio" name="is_default" |
| 2333 | - value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
|
|
| 2333 | + value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_asc') {
|
|
| 2334 | 2334 | echo 'checked="checked"'; |
| 2335 | 2335 | } ?>/> |
| 2336 | 2336 | </div> |
@@ -2340,7 +2340,7 @@ discard block |
||
| 2340 | 2340 | |
| 2341 | 2341 | |
| 2342 | 2342 | <li> |
| 2343 | - <?php $value = (isset($field_info->sort_desc) && $field_info->sort_desc) ? $field_info->sort_desc : 0;?> |
|
| 2343 | + <?php $value = (isset($field_info->sort_desc) && $field_info->sort_desc) ? $field_info->sort_desc : 0; ?> |
|
| 2344 | 2344 | |
| 2345 | 2345 | <label for="desc" class="gd-cf-tooltip-wrap"> |
| 2346 | 2346 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show Descending Sort (high to low)', 'geodirectory'); ?>
|
@@ -2350,24 +2350,24 @@ discard block |
||
| 2350 | 2350 | </label> |
| 2351 | 2351 | <div class="gd-cf-input-wrap gd-switch"> |
| 2352 | 2352 | |
| 2353 | - <input type="radio" id="desc_yes<?php echo $radio_id;?>" name="desc" class="gdri-enabled" value="1" |
|
| 2353 | + <input type="radio" id="desc_yes<?php echo $radio_id; ?>" name="desc" class="gdri-enabled" value="1" |
|
| 2354 | 2354 | <?php if ($value == '1') {
|
| 2355 | 2355 | echo 'checked'; |
| 2356 | 2356 | } ?>/> |
| 2357 | - <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2357 | + <label onclick="show_hide_radio(this,'show','cfs-desc-title');" for="desc_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2358 | 2358 | |
| 2359 | - <input type="radio" id="desc_no<?php echo $radio_id;?>" name="desc" class="gdri-disabled" value="0" |
|
| 2359 | + <input type="radio" id="desc_no<?php echo $radio_id; ?>" name="desc" class="gdri-disabled" value="0" |
|
| 2360 | 2360 | <?php if ($value == '0' || !$value) {
|
| 2361 | 2361 | echo 'checked'; |
| 2362 | 2362 | } ?>/> |
| 2363 | - <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2363 | + <label onclick="show_hide_radio(this,'hide','cfs-desc-title');" for="desc_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2364 | 2364 | |
| 2365 | 2365 | </div> |
| 2366 | 2366 | |
| 2367 | 2367 | </li> |
| 2368 | 2368 | |
| 2369 | - <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'";}?>>
|
|
| 2370 | - <?php $value = (isset($field_info->desc_title) && $field_info->desc_title) ? esc_attr($field_info->desc_title) : '';?> |
|
| 2369 | + <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'"; }?>>
|
|
| 2370 | + <?php $value = (isset($field_info->desc_title) && $field_info->desc_title) ? esc_attr($field_info->desc_title) : ''; ?> |
|
| 2371 | 2371 | |
| 2372 | 2372 | <label for="desc_title" class="gd-cf-tooltip-wrap"> |
| 2373 | 2373 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Descending title', 'geodirectory'); ?>
|
@@ -2377,13 +2377,13 @@ discard block |
||
| 2377 | 2377 | </label> |
| 2378 | 2378 | <div class="gd-cf-input-wrap"> |
| 2379 | 2379 | |
| 2380 | - <input type="text" name="desc_title" id="desc_title" value="<?php echo $value;?>" /> |
|
| 2380 | + <input type="text" name="desc_title" id="desc_title" value="<?php echo $value; ?>" /> |
|
| 2381 | 2381 | </div> |
| 2382 | 2382 | |
| 2383 | 2383 | |
| 2384 | 2384 | </li> |
| 2385 | 2385 | |
| 2386 | - <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'";}?>>
|
|
| 2386 | + <li class="cfs-desc-title" <?php if ((isset($field_info->sort_desc) && $field_info->sort_desc == '0') || !isset($field_info->sort_desc)) {echo "style='display:none;'"; }?>>
|
|
| 2387 | 2387 | |
| 2388 | 2388 | <label for="is_default" class="gd-cf-tooltip-wrap"> |
| 2389 | 2389 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
|
@@ -2394,7 +2394,7 @@ discard block |
||
| 2394 | 2394 | <div class="gd-cf-input-wrap"> |
| 2395 | 2395 | |
| 2396 | 2396 | <input type="radio" name="is_default" |
| 2397 | - value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
|
|
| 2397 | + value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_desc') {
|
|
| 2398 | 2398 | echo 'checked="checked"'; |
| 2399 | 2399 | } ?>/> |
| 2400 | 2400 | </div> |
@@ -2419,14 +2419,14 @@ discard block |
||
| 2419 | 2419 | </label> |
| 2420 | 2420 | <div class="gd-cf-input-wrap"> |
| 2421 | 2421 | |
| 2422 | - <input type="text" name="site_title" id="site_title" value="<?php echo $value;?>" /> |
|
| 2422 | + <input type="text" name="site_title" id="site_title" value="<?php echo $value; ?>" /> |
|
| 2423 | 2423 | </div> |
| 2424 | 2424 | |
| 2425 | 2425 | |
| 2426 | 2426 | </li> |
| 2427 | 2427 | |
| 2428 | 2428 | <li> |
| 2429 | - <?php $value = (isset($field_info->is_default) && $field_info->is_default) ? esc_attr($field_info->is_default) : '';?> |
|
| 2429 | + <?php $value = (isset($field_info->is_default) && $field_info->is_default) ? esc_attr($field_info->is_default) : ''; ?> |
|
| 2430 | 2430 | |
| 2431 | 2431 | <label for="is_default" class="gd-cf-tooltip-wrap"> |
| 2432 | 2432 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
|
@@ -2450,7 +2450,7 @@ discard block |
||
| 2450 | 2450 | |
| 2451 | 2451 | |
| 2452 | 2452 | <li> |
| 2453 | - <?php $value = (isset($field_info->is_active) && $field_info->is_active) ? $field_info->is_active: 0;?> |
|
| 2453 | + <?php $value = (isset($field_info->is_active) && $field_info->is_active) ? $field_info->is_active : 0; ?> |
|
| 2454 | 2454 | |
| 2455 | 2455 | <label for="is_active" class="gd-cf-tooltip-wrap"> |
| 2456 | 2456 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active', 'geodirectory'); ?>
|
@@ -2460,17 +2460,17 @@ discard block |
||
| 2460 | 2460 | </label> |
| 2461 | 2461 | <div class="gd-cf-input-wrap gd-switch"> |
| 2462 | 2462 | |
| 2463 | - <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
|
| 2463 | + <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled" value="1" |
|
| 2464 | 2464 | <?php if ($value == '1') {
|
| 2465 | 2465 | echo 'checked'; |
| 2466 | 2466 | } ?>/> |
| 2467 | - <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2467 | + <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2468 | 2468 | |
| 2469 | - <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
|
| 2469 | + <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0" |
|
| 2470 | 2470 | <?php if ($value == '0' || !$value) {
|
| 2471 | 2471 | echo 'checked'; |
| 2472 | 2472 | } ?>/> |
| 2473 | - <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2473 | + <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2474 | 2474 | |
| 2475 | 2475 | </div> |
| 2476 | 2476 | |
@@ -2491,10 +2491,10 @@ discard block |
||
| 2491 | 2491 | <h3></h3> |
| 2492 | 2492 | </label> |
| 2493 | 2493 | <div class="gd-cf-input-wrap"> |
| 2494 | - <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
|
|
| 2494 | + <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
|
|
| 2495 | 2495 | onclick="save_sort_field('<?php echo esc_attr($result_str); ?>')"/>
|
| 2496 | - <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
|
|
| 2497 | - onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
|
|
| 2496 | + <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
|
|
| 2497 | + onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
|
|
| 2498 | 2498 | class="button"/></a> |
| 2499 | 2499 | </div> |
| 2500 | 2500 | </li> |
@@ -2529,7 +2529,7 @@ discard block |
||
| 2529 | 2529 | if (!$package_id || !$field_name || !$post_type) {
|
| 2530 | 2530 | return true; |
| 2531 | 2531 | } |
| 2532 | - $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
|
|
| 2532 | + $sql = $wpdb->prepare("SELECT id FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int) $package_id));
|
|
| 2533 | 2533 | |
| 2534 | 2534 | if ($wpdb->get_var($sql)) {
|
| 2535 | 2535 | return true; |
@@ -2652,13 +2652,13 @@ discard block |
||
| 2652 | 2652 | } |
| 2653 | 2653 | |
| 2654 | 2654 | |
| 2655 | -function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
|
|
| 2655 | +function geodir_cfa_data_type_text($output, $result_str, $cf, $field_info) {
|
|
| 2656 | 2656 | ob_start(); |
| 2657 | 2657 | |
| 2658 | 2658 | $dt_value = ''; |
| 2659 | 2659 | if (isset($field_info->data_type)) {
|
| 2660 | 2660 | $dt_value = esc_attr($field_info->data_type); |
| 2661 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 2661 | + }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) {
|
|
| 2662 | 2662 | $dt_value = $cf['defaults']['data_type']; |
| 2663 | 2663 | } |
| 2664 | 2664 | ?> |
@@ -2669,15 +2669,15 @@ discard block |
||
| 2669 | 2669 | <select name="data_type" id="data_type" |
| 2670 | 2670 | onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');"> |
| 2671 | 2671 | <option |
| 2672 | - value="XVARCHAR" <?php if ($dt_value == 'VARCHAR') {
|
|
| 2672 | + value="XVARCHAR" <?php if ($dt_value == 'VARCHAR') {
|
|
| 2673 | 2673 | echo 'selected="selected"'; |
| 2674 | 2674 | } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
|
| 2675 | 2675 | <option |
| 2676 | - value="INT" <?php if ($dt_value == 'INT') {
|
|
| 2676 | + value="INT" <?php if ($dt_value == 'INT') {
|
|
| 2677 | 2677 | echo 'selected="selected"'; |
| 2678 | 2678 | } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
|
| 2679 | 2679 | <option |
| 2680 | - value="FLOAT" <?php if ($dt_value == 'FLOAT') {
|
|
| 2680 | + value="FLOAT" <?php if ($dt_value == 'FLOAT') {
|
|
| 2681 | 2681 | echo 'selected="selected"'; |
| 2682 | 2682 | } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
|
| 2683 | 2683 | </select> |
@@ -2690,13 +2690,13 @@ discard block |
||
| 2690 | 2690 | $value = ''; |
| 2691 | 2691 | if (isset($field_info->decimal_point)) {
|
| 2692 | 2692 | $value = esc_attr($field_info->decimal_point); |
| 2693 | - }elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
|
|
| 2693 | + }elseif (isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']) {
|
|
| 2694 | 2694 | $value = $cf['defaults']['decimal_point']; |
| 2695 | 2695 | } |
| 2696 | 2696 | ?> |
| 2697 | 2697 | |
| 2698 | 2698 | <li class="decimal-point-wrapper" |
| 2699 | - style="<?php echo ($dt_value == 'FLOAT') ? '' : 'display:none' ?>"> |
|
| 2699 | + style="<?php echo ($dt_value == 'FLOAT') ? '' : 'display:none' ?>"> |
|
| 2700 | 2700 | <label for="decimal_point"><?php _e('Select decimal point :', 'geodirectory'); ?></label>
|
| 2701 | 2701 | <div class="gd-cf-input-wrap"> |
| 2702 | 2702 | <select name="decimal_point" id="decimal_point"> |
@@ -2714,43 +2714,43 @@ discard block |
||
| 2714 | 2714 | $output = ob_get_clean(); |
| 2715 | 2715 | return $output; |
| 2716 | 2716 | } |
| 2717 | -add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
|
|
| 2717 | +add_filter('geodir_cfa_data_type_text', 'geodir_cfa_data_type_text', 10, 4);
|
|
| 2718 | 2718 | |
| 2719 | 2719 | // htmlvar not needed for fieldset and taxonomy |
| 2720 | -add_filter('geodir_cfa_htmlvar_name_fieldset','__return_empty_string',10,4);
|
|
| 2721 | -add_filter('geodir_cfa_htmlvar_name_taxonomy','__return_empty_string',10,4);
|
|
| 2720 | +add_filter('geodir_cfa_htmlvar_name_fieldset', '__return_empty_string', 10, 4);
|
|
| 2721 | +add_filter('geodir_cfa_htmlvar_name_taxonomy', '__return_empty_string', 10, 4);
|
|
| 2722 | 2722 | |
| 2723 | 2723 | |
| 2724 | 2724 | // default_value not needed for textarea, html, file, fieldset, taxonomy, address |
| 2725 | -add_filter('geodir_cfa_default_value_textarea','__return_empty_string',10,4);
|
|
| 2726 | -add_filter('geodir_cfa_default_value_html','__return_empty_string',10,4);
|
|
| 2727 | -add_filter('geodir_cfa_default_value_file','__return_empty_string',10,4);
|
|
| 2728 | -add_filter('geodir_cfa_default_value_taxonomy','__return_empty_string',10,4);
|
|
| 2729 | -add_filter('geodir_cfa_default_value_address','__return_empty_string',10,4);
|
|
| 2730 | -add_filter('geodir_cfa_default_value_fieldset','__return_empty_string',10,4);
|
|
| 2725 | +add_filter('geodir_cfa_default_value_textarea', '__return_empty_string', 10, 4);
|
|
| 2726 | +add_filter('geodir_cfa_default_value_html', '__return_empty_string', 10, 4);
|
|
| 2727 | +add_filter('geodir_cfa_default_value_file', '__return_empty_string', 10, 4);
|
|
| 2728 | +add_filter('geodir_cfa_default_value_taxonomy', '__return_empty_string', 10, 4);
|
|
| 2729 | +add_filter('geodir_cfa_default_value_address', '__return_empty_string', 10, 4);
|
|
| 2730 | +add_filter('geodir_cfa_default_value_fieldset', '__return_empty_string', 10, 4);
|
|
| 2731 | 2731 | |
| 2732 | 2732 | // is_required not needed for fieldset |
| 2733 | -add_filter('geodir_cfa_is_required_fieldset','__return_empty_string',10,4);
|
|
| 2734 | -add_filter('geodir_cfa_required_msg_fieldset','__return_empty_string',10,4);
|
|
| 2733 | +add_filter('geodir_cfa_is_required_fieldset', '__return_empty_string', 10, 4);
|
|
| 2734 | +add_filter('geodir_cfa_required_msg_fieldset', '__return_empty_string', 10, 4);
|
|
| 2735 | 2735 | |
| 2736 | 2736 | // field_icon not needed for fieldset |
| 2737 | -add_filter('geodir_cfa_field_icon_fieldset','__return_empty_string',10,4);
|
|
| 2738 | -add_filter('geodir_cfa_css_class_fieldset','__return_empty_string',10,4);
|
|
| 2737 | +add_filter('geodir_cfa_field_icon_fieldset', '__return_empty_string', 10, 4);
|
|
| 2738 | +add_filter('geodir_cfa_css_class_fieldset', '__return_empty_string', 10, 4);
|
|
| 2739 | 2739 | |
| 2740 | 2740 | // cat_sort not needed for some fields |
| 2741 | -add_filter('geodir_cfa_cat_sort_html','__return_empty_string',10,4);
|
|
| 2742 | -add_filter('geodir_cfa_cat_sort_file','__return_empty_string',10,4);
|
|
| 2743 | -add_filter('geodir_cfa_cat_sort_url','__return_empty_string',10,4);
|
|
| 2744 | -add_filter('geodir_cfa_cat_sort_fieldset','__return_empty_string',10,4);
|
|
| 2745 | -add_filter('geodir_cfa_cat_sort_multiselect','__return_empty_string',10,4);
|
|
| 2746 | -add_filter('geodir_cfa_cat_sort_textarea','__return_empty_string',10,4);
|
|
| 2747 | -add_filter('geodir_cfa_cat_sort_taxonomy','__return_empty_string',10,4);
|
|
| 2748 | -add_filter('geodir_cfa_cat_sort_address','__return_empty_string',10,4);
|
|
| 2741 | +add_filter('geodir_cfa_cat_sort_html', '__return_empty_string', 10, 4);
|
|
| 2742 | +add_filter('geodir_cfa_cat_sort_file', '__return_empty_string', 10, 4);
|
|
| 2743 | +add_filter('geodir_cfa_cat_sort_url', '__return_empty_string', 10, 4);
|
|
| 2744 | +add_filter('geodir_cfa_cat_sort_fieldset', '__return_empty_string', 10, 4);
|
|
| 2745 | +add_filter('geodir_cfa_cat_sort_multiselect', '__return_empty_string', 10, 4);
|
|
| 2746 | +add_filter('geodir_cfa_cat_sort_textarea', '__return_empty_string', 10, 4);
|
|
| 2747 | +add_filter('geodir_cfa_cat_sort_taxonomy', '__return_empty_string', 10, 4);
|
|
| 2748 | +add_filter('geodir_cfa_cat_sort_address', '__return_empty_string', 10, 4);
|
|
| 2749 | 2749 | |
| 2750 | 2750 | |
| 2751 | 2751 | |
| 2752 | -function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
|
|
| 2753 | - if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
|
|
| 2752 | +function geodir_cfa_advanced_editor_geodir_special_offers($output, $result_str, $cf, $field_info) {
|
|
| 2753 | + if ($field_info->htmlvar_name != 'geodir_special_offers') {return ''; }
|
|
| 2754 | 2754 | ob_start(); |
| 2755 | 2755 | ?> |
| 2756 | 2756 | <li> |
@@ -2781,16 +2781,16 @@ discard block |
||
| 2781 | 2781 | $output = ob_get_clean(); |
| 2782 | 2782 | return $output; |
| 2783 | 2783 | } |
| 2784 | -add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
|
|
| 2784 | +add_filter('geodir_cfa_advanced_editor_textarea', 'geodir_cfa_advanced_editor_geodir_special_offers', 10, 4);
|
|
| 2785 | 2785 | |
| 2786 | 2786 | |
| 2787 | -function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
|
|
| 2787 | +function geodir_cfa_validation_pattern_text($output, $result_str, $cf, $field_info) {
|
|
| 2788 | 2788 | ob_start(); |
| 2789 | 2789 | |
| 2790 | 2790 | $value = ''; |
| 2791 | 2791 | if (isset($field_info->validation_pattern)) {
|
| 2792 | 2792 | $value = esc_attr($field_info->validation_pattern); |
| 2793 | - }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
|
|
| 2793 | + }elseif (isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']) {
|
|
| 2794 | 2794 | $value = esc_attr($cf['defaults']['validation_pattern']); |
| 2795 | 2795 | } |
| 2796 | 2796 | ?> |
@@ -2810,7 +2810,7 @@ discard block |
||
| 2810 | 2810 | $value = ''; |
| 2811 | 2811 | if (isset($field_info->validation_msg)) {
|
| 2812 | 2812 | $value = esc_attr($field_info->validation_msg); |
| 2813 | - }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
|
|
| 2813 | + }elseif (isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']) {
|
|
| 2814 | 2814 | $value = esc_attr($cf['defaults']['validation_msg']); |
| 2815 | 2815 | } |
| 2816 | 2816 | ?> |
@@ -2831,10 +2831,10 @@ discard block |
||
| 2831 | 2831 | $output = ob_get_clean(); |
| 2832 | 2832 | return $output; |
| 2833 | 2833 | } |
| 2834 | -add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
|
|
| 2834 | +add_filter('geodir_cfa_validation_pattern_text', 'geodir_cfa_validation_pattern_text', 10, 4);
|
|
| 2835 | 2835 | |
| 2836 | 2836 | |
| 2837 | -function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
|
|
| 2837 | +function geodir_cfa_htmlvar_name_taxonomy($output, $result_str, $cf, $field_info) {
|
|
| 2838 | 2838 | ob_start(); |
| 2839 | 2839 | global $post_type; |
| 2840 | 2840 | |
@@ -2859,7 +2859,7 @@ discard block |
||
| 2859 | 2859 | ?> |
| 2860 | 2860 | <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
|
| 2861 | 2861 | echo 'selected="selected"'; |
| 2862 | - }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php |
|
| 2862 | + }?> id="<?php echo $gd_tax; ?>"><?php echo $gd_tax; ?></option><?php |
|
| 2863 | 2863 | } |
| 2864 | 2864 | ?> |
| 2865 | 2865 | </select> |
@@ -2870,7 +2870,7 @@ discard block |
||
| 2870 | 2870 | <label for="cat_display_type" class="gd-cf-tooltip-wrap"> |
| 2871 | 2871 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Category display type :', 'geodirectory'); ?>
|
| 2872 | 2872 | <div class="gdcf-tooltip"> |
| 2873 | - <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory');?>
|
|
| 2873 | + <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory'); ?>
|
|
| 2874 | 2874 | </div> |
| 2875 | 2875 | </label> |
| 2876 | 2876 | <div class="gd-cf-input-wrap"> |
@@ -2878,19 +2878,19 @@ discard block |
||
| 2878 | 2878 | <select name="cat_display_type" id="cat_display_type"> |
| 2879 | 2879 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
|
| 2880 | 2880 | echo 'selected="selected"'; |
| 2881 | - }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
|
|
| 2881 | + }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory'); ?></option>
|
|
| 2882 | 2882 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
|
| 2883 | 2883 | echo 'selected="selected"'; |
| 2884 | - }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 2884 | + }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
|
|
| 2885 | 2885 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
|
| 2886 | 2886 | echo 'selected="selected"'; |
| 2887 | - }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
|
|
| 2887 | + }?> value="multiselect"><?php _e('Multiselect', 'geodirectory'); ?></option>
|
|
| 2888 | 2888 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
|
| 2889 | 2889 | echo 'selected="selected"'; |
| 2890 | - }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 2890 | + }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
|
|
| 2891 | 2891 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
|
| 2892 | 2892 | echo 'selected="selected"'; |
| 2893 | - }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 2893 | + }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
|
|
| 2894 | 2894 | </select> |
| 2895 | 2895 | </div> |
| 2896 | 2896 | </li> |
@@ -2899,10 +2899,10 @@ discard block |
||
| 2899 | 2899 | $output = ob_get_clean(); |
| 2900 | 2900 | return $output; |
| 2901 | 2901 | } |
| 2902 | -add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
|
|
| 2902 | +add_filter('geodir_cfa_htmlvar_name_taxonomy', 'geodir_cfa_htmlvar_name_taxonomy', 10, 4);
|
|
| 2903 | 2903 | |
| 2904 | 2904 | |
| 2905 | -function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
|
|
| 2905 | +function geodir_cfa_extra_fields_address($output, $result_str, $cf, $field_info) {
|
|
| 2906 | 2906 | |
| 2907 | 2907 | ob_start(); |
| 2908 | 2908 | if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
@@ -2925,32 +2925,32 @@ discard block |
||
| 2925 | 2925 | <label for="show_zip" class="gd-cf-tooltip-wrap"> |
| 2926 | 2926 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display zip/post code :', 'geodirectory'); ?>
|
| 2927 | 2927 | <div class="gdcf-tooltip"> |
| 2928 | - <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory');?>
|
|
| 2928 | + <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory'); ?>
|
|
| 2929 | 2929 | </div> |
| 2930 | 2930 | </label> |
| 2931 | 2931 | <div class="gd-cf-input-wrap gd-switch"> |
| 2932 | 2932 | |
| 2933 | - <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled" value="1" |
|
| 2933 | + <input type="radio" id="show_zip_yes<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-enabled" value="1" |
|
| 2934 | 2934 | <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
|
| 2935 | 2935 | echo 'checked'; |
| 2936 | 2936 | } ?>/> |
| 2937 | - <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2937 | + <label onclick="show_hide_radio(this,'show','cf-zip-lable');" for="show_zip_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2938 | 2938 | |
| 2939 | - <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0" |
|
| 2939 | + <input type="radio" id="show_zip_no<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-disabled" value="0" |
|
| 2940 | 2940 | <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
|
| 2941 | 2941 | echo 'checked'; |
| 2942 | 2942 | } ?>/> |
| 2943 | - <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2943 | + <label onclick="show_hide_radio(this,'hide','cf-zip-lable');" for="show_zip_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2944 | 2944 | |
| 2945 | 2945 | |
| 2946 | 2946 | </div> |
| 2947 | 2947 | </li> |
| 2948 | 2948 | |
| 2949 | - <li class="cf-zip-lable" <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'";}?> >
|
|
| 2949 | + <li class="cf-zip-lable" <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'"; }?> >
|
|
| 2950 | 2950 | <label for="zip_lable" class="gd-cf-tooltip-wrap"> |
| 2951 | 2951 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Zip/Post code label :', 'geodirectory'); ?>
|
| 2952 | 2952 | <div class="gdcf-tooltip"> |
| 2953 | - <?php _e('Enter zip/post code field label in address section.', 'geodirectory');?>
|
|
| 2953 | + <?php _e('Enter zip/post code field label in address section.', 'geodirectory'); ?>
|
|
| 2954 | 2954 | </div> |
| 2955 | 2955 | </label> |
| 2956 | 2956 | <div class="gd-cf-input-wrap"> |
@@ -2968,7 +2968,7 @@ discard block |
||
| 2968 | 2968 | <label for="map_lable" class="gd-cf-tooltip-wrap"> |
| 2969 | 2969 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map button label :', 'geodirectory'); ?>
|
| 2970 | 2970 | <div class="gdcf-tooltip"> |
| 2971 | - <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory');?>
|
|
| 2971 | + <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory'); ?>
|
|
| 2972 | 2972 | </div> |
| 2973 | 2973 | </label> |
| 2974 | 2974 | <div class="gd-cf-input-wrap"> |
@@ -2983,22 +2983,22 @@ discard block |
||
| 2983 | 2983 | <label for="show_mapzoom" class="gd-cf-tooltip-wrap"> |
| 2984 | 2984 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Use user zoom level:', 'geodirectory'); ?>
|
| 2985 | 2985 | <div class="gdcf-tooltip"> |
| 2986 | - <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory');?>
|
|
| 2986 | + <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory'); ?>
|
|
| 2987 | 2987 | </div> |
| 2988 | 2988 | </label> |
| 2989 | 2989 | <div class="gd-cf-input-wrap gd-switch"> |
| 2990 | 2990 | |
| 2991 | - <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled" value="1" |
|
| 2991 | + <input type="radio" id="show_mapzoom_yes<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-enabled" value="1" |
|
| 2992 | 2992 | <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
|
| 2993 | 2993 | echo 'checked'; |
| 2994 | 2994 | } ?>/> |
| 2995 | - <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2995 | + <label for="show_mapzoom_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2996 | 2996 | |
| 2997 | - <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0" |
|
| 2997 | + <input type="radio" id="show_mapzoom_no<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0" |
|
| 2998 | 2998 | <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
|
| 2999 | 2999 | echo 'checked'; |
| 3000 | 3000 | } ?>/> |
| 3001 | - <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3001 | + <label for="show_mapzoom_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3002 | 3002 | |
| 3003 | 3003 | </div> |
| 3004 | 3004 | </li> |
@@ -3007,22 +3007,22 @@ discard block |
||
| 3007 | 3007 | <label for="show_mapview" class="gd-cf-tooltip-wrap"> |
| 3008 | 3008 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display map view:', 'geodirectory'); ?>
|
| 3009 | 3009 | <div class="gdcf-tooltip"> |
| 3010 | - <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory');?>
|
|
| 3010 | + <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory'); ?>
|
|
| 3011 | 3011 | </div> |
| 3012 | 3012 | </label> |
| 3013 | 3013 | <div class="gd-cf-input-wrap gd-switch"> |
| 3014 | 3014 | |
| 3015 | - <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled" value="1" |
|
| 3015 | + <input type="radio" id="show_mapview_yes<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-enabled" value="1" |
|
| 3016 | 3016 | <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
|
| 3017 | 3017 | echo 'checked'; |
| 3018 | 3018 | } ?>/> |
| 3019 | - <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3019 | + <label for="show_mapview_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3020 | 3020 | |
| 3021 | - <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0" |
|
| 3021 | + <input type="radio" id="show_mapview_no<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-disabled" value="0" |
|
| 3022 | 3022 | <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
|
| 3023 | 3023 | echo 'checked'; |
| 3024 | 3024 | } ?>/> |
| 3025 | - <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3025 | + <label for="show_mapview_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3026 | 3026 | |
| 3027 | 3027 | </div> |
| 3028 | 3028 | </li> |
@@ -3032,7 +3032,7 @@ discard block |
||
| 3032 | 3032 | <label for="mapview_lable" class="gd-cf-tooltip-wrap"> |
| 3033 | 3033 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map view label:', 'geodirectory'); ?>
|
| 3034 | 3034 | <div class="gdcf-tooltip"> |
| 3035 | - <?php _e('Enter mapview field label in address section.', 'geodirectory');?>
|
|
| 3035 | + <?php _e('Enter mapview field label in address section.', 'geodirectory'); ?>
|
|
| 3036 | 3036 | </div> |
| 3037 | 3037 | </label> |
| 3038 | 3038 | <div class="gd-cf-input-wrap"> |
@@ -3046,22 +3046,22 @@ discard block |
||
| 3046 | 3046 | <label for="show_latlng" class="gd-cf-tooltip-wrap"> |
| 3047 | 3047 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show latitude and longitude', 'geodirectory'); ?>
|
| 3048 | 3048 | <div class="gdcf-tooltip"> |
| 3049 | - <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory');?>
|
|
| 3049 | + <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory'); ?>
|
|
| 3050 | 3050 | </div> |
| 3051 | 3051 | </label> |
| 3052 | 3052 | <div class="gd-cf-input-wrap gd-switch"> |
| 3053 | 3053 | |
| 3054 | - <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled" value="1" |
|
| 3054 | + <input type="radio" id="show_latlng_yes<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-enabled" value="1" |
|
| 3055 | 3055 | <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
|
| 3056 | 3056 | echo 'checked'; |
| 3057 | 3057 | } ?>/> |
| 3058 | - <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3058 | + <label for="show_latlng_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3059 | 3059 | |
| 3060 | - <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0" |
|
| 3060 | + <input type="radio" id="show_latlng_no<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-disabled" value="0" |
|
| 3061 | 3061 | <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
|
| 3062 | 3062 | echo 'checked'; |
| 3063 | 3063 | } ?>/> |
| 3064 | - <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3064 | + <label for="show_latlng_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3065 | 3065 | |
| 3066 | 3066 | </div> |
| 3067 | 3067 | </li> |
@@ -3070,17 +3070,17 @@ discard block |
||
| 3070 | 3070 | $html = ob_get_clean(); |
| 3071 | 3071 | return $output.$html; |
| 3072 | 3072 | } |
| 3073 | -add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
|
|
| 3073 | +add_filter('geodir_cfa_extra_fields_address', 'geodir_cfa_extra_fields_address', 10, 4);
|
|
| 3074 | 3074 | |
| 3075 | 3075 | |
| 3076 | -function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
|
|
| 3076 | +function geodir_cfa_extra_fields_multiselect($output, $result_str, $cf, $field_info) {
|
|
| 3077 | 3077 | ob_start(); |
| 3078 | 3078 | ?> |
| 3079 | 3079 | <li> |
| 3080 | 3080 | <label for="multi_display_type" class="gd-cf-tooltip-wrap"> |
| 3081 | 3081 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
|
| 3082 | 3082 | <div class="gdcf-tooltip"> |
| 3083 | - <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory');?>
|
|
| 3083 | + <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory'); ?>
|
|
| 3084 | 3084 | </div> |
| 3085 | 3085 | </label> |
| 3086 | 3086 | <div class="gd-cf-input-wrap"> |
@@ -3088,13 +3088,13 @@ discard block |
||
| 3088 | 3088 | <select name="multi_display_type" id="multi_display_type"> |
| 3089 | 3089 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
|
| 3090 | 3090 | echo 'selected="selected"'; |
| 3091 | - }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 3091 | + }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
|
|
| 3092 | 3092 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
|
| 3093 | 3093 | echo 'selected="selected"'; |
| 3094 | - }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 3094 | + }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
|
|
| 3095 | 3095 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
|
| 3096 | 3096 | echo 'selected="selected"'; |
| 3097 | - }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 3097 | + }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
|
|
| 3098 | 3098 | </select> |
| 3099 | 3099 | |
| 3100 | 3100 | <br/> |
@@ -3105,17 +3105,17 @@ discard block |
||
| 3105 | 3105 | $html = ob_get_clean(); |
| 3106 | 3106 | return $output.$html; |
| 3107 | 3107 | } |
| 3108 | -add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
|
|
| 3108 | +add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_multiselect', 10, 4);
|
|
| 3109 | 3109 | |
| 3110 | 3110 | |
| 3111 | -function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
|
|
| 3111 | +function geodir_cfa_extra_fields_smr($output, $result_str, $cf, $field_info) {
|
|
| 3112 | 3112 | |
| 3113 | 3113 | ob_start(); |
| 3114 | 3114 | |
| 3115 | 3115 | $value = ''; |
| 3116 | 3116 | if (isset($field_info->option_values)) {
|
| 3117 | 3117 | $value = esc_attr($field_info->option_values); |
| 3118 | - }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
|
|
| 3118 | + }elseif (isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']) {
|
|
| 3119 | 3119 | $value = esc_attr($cf['defaults']['option_values']); |
| 3120 | 3120 | } |
| 3121 | 3121 | |
@@ -3125,11 +3125,11 @@ discard block |
||
| 3125 | 3125 | <label for="option_values" class="gd-cf-tooltip-wrap"> |
| 3126 | 3126 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
|
| 3127 | 3127 | <div class="gdcf-tooltip"> |
| 3128 | - <span><?php _e('Option Values should be separated by comma.', 'geodirectory');?></span>
|
|
| 3128 | + <span><?php _e('Option Values should be separated by comma.', 'geodirectory'); ?></span>
|
|
| 3129 | 3129 | <br/> |
| 3130 | - <small><span><?php _e('If using for a "tick filter" place a / and then either a 1 for true or 0 for false', 'geodirectory');?></span>
|
|
| 3130 | + <small><span><?php _e('If using for a "tick filter" place a / and then either a 1 for true or 0 for false', 'geodirectory'); ?></span>
|
|
| 3131 | 3131 | <br/> |
| 3132 | - <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory');?></span>
|
|
| 3132 | + <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory'); ?></span>
|
|
| 3133 | 3133 | <?php if ($field_type == 'multiselect' || $field_type == 'select') { ?>
|
| 3134 | 3134 | <br/> |
| 3135 | 3135 | <span><?php _e('- If using OPTGROUP tag to grouping options, use "{optgroup}OPTGROUP-LABEL|OPTION-1,OPTION-2{/optgroup}"', 'geodirectory'); ?></span>
|
@@ -3140,7 +3140,7 @@ discard block |
||
| 3140 | 3140 | </label> |
| 3141 | 3141 | <div class="gd-cf-input-wrap"> |
| 3142 | 3142 | <input type="text" name="option_values" id="option_values" |
| 3143 | - value="<?php echo $value;?>"/> |
|
| 3143 | + value="<?php echo $value; ?>"/> |
|
| 3144 | 3144 | <br/> |
| 3145 | 3145 | |
| 3146 | 3146 | </div> |
@@ -3150,12 +3150,12 @@ discard block |
||
| 3150 | 3150 | $html = ob_get_clean(); |
| 3151 | 3151 | return $output.$html; |
| 3152 | 3152 | } |
| 3153 | -add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
|
|
| 3154 | -add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
|
|
| 3155 | -add_filter('geodir_cfa_extra_fields_radio','geodir_cfa_extra_fields_smr',10,4);
|
|
| 3153 | +add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_smr', 10, 4);
|
|
| 3154 | +add_filter('geodir_cfa_extra_fields_select', 'geodir_cfa_extra_fields_smr', 10, 4);
|
|
| 3155 | +add_filter('geodir_cfa_extra_fields_radio', 'geodir_cfa_extra_fields_smr', 10, 4);
|
|
| 3156 | 3156 | |
| 3157 | 3157 | |
| 3158 | -function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
|
|
| 3158 | +function geodir_cfa_extra_fields_datepicker($output, $result_str, $cf, $field_info) {
|
|
| 3159 | 3159 | ob_start(); |
| 3160 | 3160 | $extra = array(); |
| 3161 | 3161 | if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
@@ -3166,7 +3166,7 @@ discard block |
||
| 3166 | 3166 | <label for="date_format" class="gd-cf-tooltip-wrap"> |
| 3167 | 3167 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
|
| 3168 | 3168 | <div class="gdcf-tooltip"> |
| 3169 | - <?php _e('Select the date format.', 'geodirectory');?>
|
|
| 3169 | + <?php _e('Select the date format.', 'geodirectory'); ?>
|
|
| 3170 | 3170 | </div> |
| 3171 | 3171 | </label> |
| 3172 | 3172 | <div class="gd-cf-input-wrap" style="overflow:inherit;"> |
@@ -3186,16 +3186,16 @@ discard block |
||
| 3186 | 3186 | * @since 1.6.5 |
| 3187 | 3187 | * @param array $date_formats The PHP date format array. |
| 3188 | 3188 | */ |
| 3189 | - $date_formats = apply_filters('geodir_date_formats',$date_formats);
|
|
| 3189 | + $date_formats = apply_filters('geodir_date_formats', $date_formats);
|
|
| 3190 | 3190 | ?> |
| 3191 | 3191 | <select name="extra[date_format]" id="date_format"> |
| 3192 | 3192 | <?php |
| 3193 | - foreach($date_formats as $format){
|
|
| 3193 | + foreach ($date_formats as $format) {
|
|
| 3194 | 3194 | $selected = ''; |
| 3195 | - if(!empty($extra) && esc_attr($extra['date_format'])==$format){
|
|
| 3195 | + if (!empty($extra) && esc_attr($extra['date_format']) == $format) {
|
|
| 3196 | 3196 | $selected = "selected='selected'"; |
| 3197 | 3197 | } |
| 3198 | - echo "<option $selected value='$format'>$format (".date_i18n( $format, time()).")</option>";
|
|
| 3198 | + echo "<option $selected value='$format'>$format (".date_i18n($format, time()).")</option>";
|
|
| 3199 | 3199 | } |
| 3200 | 3200 | ?> |
| 3201 | 3201 | </select> |
@@ -3207,10 +3207,10 @@ discard block |
||
| 3207 | 3207 | $html = ob_get_clean(); |
| 3208 | 3208 | return $output.$html; |
| 3209 | 3209 | } |
| 3210 | -add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
|
|
| 3210 | +add_filter('geodir_cfa_extra_fields_datepicker', 'geodir_cfa_extra_fields_datepicker', 10, 4);
|
|
| 3211 | 3211 | |
| 3212 | 3212 | |
| 3213 | -function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
|
|
| 3213 | +function geodir_cfa_extra_fields_file($output, $result_str, $cf, $field_info) {
|
|
| 3214 | 3214 | ob_start(); |
| 3215 | 3215 | $allowed_file_types = geodir_allowed_mime_types(); |
| 3216 | 3216 | |
@@ -3221,16 +3221,16 @@ discard block |
||
| 3221 | 3221 | <label for="gd_file_types" class="gd-cf-tooltip-wrap"> |
| 3222 | 3222 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
|
| 3223 | 3223 | <div class="gdcf-tooltip"> |
| 3224 | - <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory');?>
|
|
| 3224 | + <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory'); ?>
|
|
| 3225 | 3225 | </div> |
| 3226 | 3226 | </label> |
| 3227 | 3227 | <div class="gd-cf-input-wrap"> |
| 3228 | 3228 | <select name="extra[gd_file_types][]" id="gd_file_types" multiple="multiple" style="height:100px;width:90%;"> |
| 3229 | - <option value="*" <?php selected(true, in_array('*', $gd_file_types));?>><?php _e('All types', 'geodirectory') ;?></option>
|
|
| 3230 | - <?php foreach ( $allowed_file_types as $format => $types ) { ?>
|
|
| 3231 | - <optgroup label="<?php echo esc_attr( wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory') ) ) ;?>">
|
|
| 3232 | - <?php foreach ( $types as $ext => $type ) { ?>
|
|
| 3233 | - <option value="<?php echo esc_attr($ext) ;?>" <?php selected(true, in_array($ext, $gd_file_types));?>><?php echo '.' . $ext ;?></option> |
|
| 3229 | + <option value="*" <?php selected(true, in_array('*', $gd_file_types)); ?>><?php _e('All types', 'geodirectory'); ?></option>
|
|
| 3230 | + <?php foreach ($allowed_file_types as $format => $types) { ?>
|
|
| 3231 | + <optgroup label="<?php echo esc_attr(wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory'))); ?>">
|
|
| 3232 | + <?php foreach ($types as $ext => $type) { ?>
|
|
| 3233 | + <option value="<?php echo esc_attr($ext); ?>" <?php selected(true, in_array($ext, $gd_file_types)); ?>><?php echo '.'.$ext; ?></option> |
|
| 3234 | 3234 | <?php } ?> |
| 3235 | 3235 | </optgroup> |
| 3236 | 3236 | <?php } ?> |
@@ -3242,9 +3242,9 @@ discard block |
||
| 3242 | 3242 | $html = ob_get_clean(); |
| 3243 | 3243 | return $output.$html; |
| 3244 | 3244 | } |
| 3245 | -add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
|
|
| 3245 | +add_filter('geodir_cfa_extra_fields_file', 'geodir_cfa_extra_fields_file', 10, 4);
|
|
| 3246 | 3246 | |
| 3247 | -function geodir_cfa_extra_fields_text($output,$result_str,$cf,$field_info){
|
|
| 3247 | +function geodir_cfa_extra_fields_text($output, $result_str, $cf, $field_info) {
|
|
| 3248 | 3248 | ob_start(); |
| 3249 | 3249 | |
| 3250 | 3250 | $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : ''; |
@@ -3258,15 +3258,15 @@ discard block |
||
| 3258 | 3258 | $value = ''; |
| 3259 | 3259 | if ($extra_fields && isset($extra_fields['is_price'])) {
|
| 3260 | 3260 | $value = esc_attr($extra_fields['is_price']); |
| 3261 | - }elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
|
|
| 3261 | + }elseif (isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']) {
|
|
| 3262 | 3262 | $value = esc_attr($cf['defaults']['extra_fields']['is_price']); |
| 3263 | 3263 | } |
| 3264 | 3264 | |
| 3265 | - $show_price_extra = ($value==1) ? 1 : 0; |
|
| 3265 | + $show_price_extra = ($value == 1) ? 1 : 0; |
|
| 3266 | 3266 | |
| 3267 | - $show_price = (isset($field_info->data_type) && ($field_info->data_type=='INT' && $field_info->data_type=='FLOAT')) ? 1 : 0; |
|
| 3267 | + $show_price = (isset($field_info->data_type) && ($field_info->data_type == 'INT' && $field_info->data_type == 'FLOAT')) ? 1 : 0; |
|
| 3268 | 3268 | ?> |
| 3269 | - <li class="gdcf-price-extra-set" <?php if(!$show_price){ echo "style='display:none;'";}?>>
|
|
| 3269 | + <li class="gdcf-price-extra-set" <?php if (!$show_price) { echo "style='display:none;'"; }?>>
|
|
| 3270 | 3270 | <label for="is_price" class="gd-cf-tooltip-wrap"> |
| 3271 | 3271 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display as price? :', 'geodirectory'); ?>
|
| 3272 | 3272 | <div class="gdcf-tooltip"> |
@@ -3275,17 +3275,17 @@ discard block |
||
| 3275 | 3275 | </label> |
| 3276 | 3276 | <div class="gd-cf-input-wrap gd-switch"> |
| 3277 | 3277 | |
| 3278 | - <input type="radio" id="is_price_yes<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-enabled" value="1" |
|
| 3278 | + <input type="radio" id="is_price_yes<?php echo $radio_id; ?>" name="extra[is_price]" class="gdri-enabled" value="1" |
|
| 3279 | 3279 | <?php if ($value == '1') {
|
| 3280 | 3280 | echo 'checked'; |
| 3281 | 3281 | } ?>/> |
| 3282 | - <label onclick="show_hide_radio(this,'show','gdcf-price-extra');" for="is_price_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3282 | + <label onclick="show_hide_radio(this,'show','gdcf-price-extra');" for="is_price_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3283 | 3283 | |
| 3284 | - <input type="radio" id="is_price_no<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-disabled" value="0" |
|
| 3284 | + <input type="radio" id="is_price_no<?php echo $radio_id; ?>" name="extra[is_price]" class="gdri-disabled" value="0" |
|
| 3285 | 3285 | <?php if ($value == '0' || !$value) {
|
| 3286 | 3286 | echo 'checked'; |
| 3287 | 3287 | } ?>/> |
| 3288 | - <label onclick="show_hide_radio(this,'hide','gdcf-price-extra');" for="is_price_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3288 | + <label onclick="show_hide_radio(this,'hide','gdcf-price-extra');" for="is_price_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3289 | 3289 | |
| 3290 | 3290 | </div> |
| 3291 | 3291 | </li> |
@@ -3295,23 +3295,23 @@ discard block |
||
| 3295 | 3295 | $value = ''; |
| 3296 | 3296 | if ($extra_fields && isset($extra_fields['thousand_separator'])) {
|
| 3297 | 3297 | $value = esc_attr($extra_fields['thousand_separator']); |
| 3298 | - }elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
|
|
| 3298 | + }elseif (isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']) {
|
|
| 3299 | 3299 | $value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']); |
| 3300 | 3300 | } |
| 3301 | 3301 | ?> |
| 3302 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3303 | - <label for="thousand_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Thousand separator :', 'geodirectory');?>
|
|
| 3302 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3303 | + <label for="thousand_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Thousand separator :', 'geodirectory'); ?>
|
|
| 3304 | 3304 | <div class="gdcf-tooltip"> |
| 3305 | 3305 | <?php _e('Select the thousand separator.', 'geodirectory'); ?>
|
| 3306 | 3306 | </div> |
| 3307 | 3307 | </label> |
| 3308 | 3308 | <div class="gd-cf-input-wrap"> |
| 3309 | 3309 | <select name="extra[thousand_separator]" id="thousand_separator"> |
| 3310 | - <option value="comma" <?php selected(true, $value == 'comma');?>><?php _e(', (comma)', 'geodirectory'); ?></option>
|
|
| 3311 | - <option value="slash" <?php selected(true, $value == "slash");?>><?php _e('\ (slash)', 'geodirectory'); ?></option>
|
|
| 3312 | - <option value="period" <?php selected(true, $value == 'period');?>><?php _e('. (period)', 'geodirectory'); ?></option>
|
|
| 3313 | - <option value="space" <?php selected(true, $value == 'space');?>><?php _e(' (space)', 'geodirectory'); ?></option>
|
|
| 3314 | - <option value="none" <?php selected(true, $value == 'none');?>><?php _e('(none)', 'geodirectory'); ?></option>
|
|
| 3310 | + <option value="comma" <?php selected(true, $value == 'comma'); ?>><?php _e(', (comma)', 'geodirectory'); ?></option>
|
|
| 3311 | + <option value="slash" <?php selected(true, $value == "slash"); ?>><?php _e('\ (slash)', 'geodirectory'); ?></option>
|
|
| 3312 | + <option value="period" <?php selected(true, $value == 'period'); ?>><?php _e('. (period)', 'geodirectory'); ?></option>
|
|
| 3313 | + <option value="space" <?php selected(true, $value == 'space'); ?>><?php _e(' (space)', 'geodirectory'); ?></option>
|
|
| 3314 | + <option value="none" <?php selected(true, $value == 'none'); ?>><?php _e('(none)', 'geodirectory'); ?></option>
|
|
| 3315 | 3315 | </select> |
| 3316 | 3316 | </div> |
| 3317 | 3317 | </li> |
@@ -3322,20 +3322,20 @@ discard block |
||
| 3322 | 3322 | $value = ''; |
| 3323 | 3323 | if ($extra_fields && isset($extra_fields['decimal_separator'])) {
|
| 3324 | 3324 | $value = esc_attr($extra_fields['decimal_separator']); |
| 3325 | - }elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
|
|
| 3325 | + }elseif (isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']) {
|
|
| 3326 | 3326 | $value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']); |
| 3327 | 3327 | } |
| 3328 | 3328 | ?> |
| 3329 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3330 | - <label for="decimal_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal separator :', 'geodirectory');?>
|
|
| 3329 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3330 | + <label for="decimal_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal separator :', 'geodirectory'); ?>
|
|
| 3331 | 3331 | <div class="gdcf-tooltip"> |
| 3332 | 3332 | <?php _e('Select the decimal separator.', 'geodirectory'); ?>
|
| 3333 | 3333 | </div> |
| 3334 | 3334 | </label> |
| 3335 | 3335 | <div class="gd-cf-input-wrap"> |
| 3336 | 3336 | <select name="extra[decimal_separator]" id="decimal_separator"> |
| 3337 | - <option value="period" <?php selected(true, $value == 'period');?>><?php _e('. (period)', 'geodirectory'); ?></option>
|
|
| 3338 | - <option value="comma" <?php selected(true, $value == "comma");?>><?php _e(', (comma)', 'geodirectory'); ?></option>
|
|
| 3337 | + <option value="period" <?php selected(true, $value == 'period'); ?>><?php _e('. (period)', 'geodirectory'); ?></option>
|
|
| 3338 | + <option value="comma" <?php selected(true, $value == "comma"); ?>><?php _e(', (comma)', 'geodirectory'); ?></option>
|
|
| 3339 | 3339 | </select> |
| 3340 | 3340 | </div> |
| 3341 | 3341 | </li> |
@@ -3345,20 +3345,20 @@ discard block |
||
| 3345 | 3345 | $value = ''; |
| 3346 | 3346 | if ($extra_fields && isset($extra_fields['decimal_display'])) {
|
| 3347 | 3347 | $value = esc_attr($extra_fields['decimal_display']); |
| 3348 | - }elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
|
|
| 3348 | + }elseif (isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']) {
|
|
| 3349 | 3349 | $value = esc_attr($cf['defaults']['extra_fields']['decimal_display']); |
| 3350 | 3350 | } |
| 3351 | 3351 | ?> |
| 3352 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3353 | - <label for="decimal_display" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal display :', 'geodirectory');?>
|
|
| 3352 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3353 | + <label for="decimal_display" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal display :', 'geodirectory'); ?>
|
|
| 3354 | 3354 | <div class="gdcf-tooltip"> |
| 3355 | 3355 | <?php _e('Select how the decimal is displayed', 'geodirectory'); ?>
|
| 3356 | 3356 | </div> |
| 3357 | 3357 | </label> |
| 3358 | 3358 | <div class="gd-cf-input-wrap"> |
| 3359 | 3359 | <select name="extra[decimal_display]" id="decimal_display"> |
| 3360 | - <option value="if" <?php selected(true, $value == 'if');?>><?php _e('If used (not .00)', 'geodirectory'); ?></option>
|
|
| 3361 | - <option value="allways" <?php selected(true, $value == "allways");?>><?php _e('Always (.00)', 'geodirectory'); ?></option>
|
|
| 3360 | + <option value="if" <?php selected(true, $value == 'if'); ?>><?php _e('If used (not .00)', 'geodirectory'); ?></option>
|
|
| 3361 | + <option value="allways" <?php selected(true, $value == "allways"); ?>><?php _e('Always (.00)', 'geodirectory'); ?></option>
|
|
| 3362 | 3362 | </select> |
| 3363 | 3363 | </div> |
| 3364 | 3364 | </li> |
@@ -3368,12 +3368,12 @@ discard block |
||
| 3368 | 3368 | $value = ''; |
| 3369 | 3369 | if ($extra_fields && isset($extra_fields['currency_symbol'])) {
|
| 3370 | 3370 | $value = esc_attr($extra_fields['currency_symbol']); |
| 3371 | - }elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
|
|
| 3371 | + }elseif (isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']) {
|
|
| 3372 | 3372 | $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']); |
| 3373 | 3373 | } |
| 3374 | 3374 | ?> |
| 3375 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3376 | - <label for="currency_symbol" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol :', 'geodirectory');?>
|
|
| 3375 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3376 | + <label for="currency_symbol" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol :', 'geodirectory'); ?>
|
|
| 3377 | 3377 | <div class="gdcf-tooltip"> |
| 3378 | 3378 | <?php _e('Select the currency symbol.', 'geodirectory'); ?>
|
| 3379 | 3379 | </div> |
@@ -3389,20 +3389,20 @@ discard block |
||
| 3389 | 3389 | $value = ''; |
| 3390 | 3390 | if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
|
| 3391 | 3391 | $value = esc_attr($extra_fields['currency_symbol_placement']); |
| 3392 | - }elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
|
|
| 3392 | + }elseif (isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']) {
|
|
| 3393 | 3393 | $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']); |
| 3394 | 3394 | } |
| 3395 | 3395 | ?> |
| 3396 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3397 | - <label for="currency_symbol_placement" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol placement :', 'geodirectory');?>
|
|
| 3396 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3397 | + <label for="currency_symbol_placement" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol placement :', 'geodirectory'); ?>
|
|
| 3398 | 3398 | <div class="gdcf-tooltip"> |
| 3399 | 3399 | <?php _e('Select the currency symbol placement.', 'geodirectory'); ?>
|
| 3400 | 3400 | </div> |
| 3401 | 3401 | </label> |
| 3402 | 3402 | <div class="gd-cf-input-wrap"> |
| 3403 | 3403 | <select name="extra[currency_symbol_placement]" id="currency_symbol_placement"> |
| 3404 | - <option value="left" <?php selected(true, $value == 'left');?>><?php _e('Left', 'geodirectory'); ?></option>
|
|
| 3405 | - <option value="right" <?php selected(true, $value == "right");?>><?php _e('Right', 'geodirectory'); ?></option>
|
|
| 3404 | + <option value="left" <?php selected(true, $value == 'left'); ?>><?php _e('Left', 'geodirectory'); ?></option>
|
|
| 3405 | + <option value="right" <?php selected(true, $value == "right"); ?>><?php _e('Right', 'geodirectory'); ?></option>
|
|
| 3406 | 3406 | </select> |
| 3407 | 3407 | </div> |
| 3408 | 3408 | </li> |
@@ -3413,11 +3413,11 @@ discard block |
||
| 3413 | 3413 | $html = ob_get_clean(); |
| 3414 | 3414 | return $output.$html; |
| 3415 | 3415 | } |
| 3416 | -add_filter('geodir_cfa_extra_fields_text','geodir_cfa_extra_fields_text',10,4);
|
|
| 3416 | +add_filter('geodir_cfa_extra_fields_text', 'geodir_cfa_extra_fields_text', 10, 4);
|
|
| 3417 | 3417 | |
| 3418 | -function geodir_default_custom_fields($post_type='gd_place',$package_id=''){
|
|
| 3418 | +function geodir_default_custom_fields($post_type = 'gd_place', $package_id = '') {
|
|
| 3419 | 3419 | $fields = array(); |
| 3420 | - $package = ($package_id=='') ? '' : array($package_id); |
|
| 3420 | + $package = ($package_id == '') ? '' : array($package_id); |
|
| 3421 | 3421 | |
| 3422 | 3422 | $fields[] = array('listing_type' => $post_type,
|
| 3423 | 3423 | 'data_type' => 'VARCHAR', |
@@ -3590,7 +3590,7 @@ discard block |
||
| 3590 | 3590 | return $fields; |
| 3591 | 3591 | } |
| 3592 | 3592 | |
| 3593 | -function geodir_currency_format_number($number='',$cf=''){
|
|
| 3593 | +function geodir_currency_format_number($number = '', $cf = '') {
|
|
| 3594 | 3594 | |
| 3595 | 3595 | $cs = isset($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : ''; |
| 3596 | 3596 | |
@@ -3599,35 +3599,35 @@ discard block |
||
| 3599 | 3599 | $decimal_display = isset($cf['decimal_display']) && $cf['decimal_display'] ? $cf['decimal_display'] : 'if'; |
| 3600 | 3600 | $decimalpoint = '.'; |
| 3601 | 3601 | |
| 3602 | - if(isset($cs['decimal_separator']) && $cs['decimal_separator']=='comma'){
|
|
| 3602 | + if (isset($cs['decimal_separator']) && $cs['decimal_separator'] == 'comma') {
|
|
| 3603 | 3603 | $decimalpoint = ','; |
| 3604 | 3604 | } |
| 3605 | 3605 | |
| 3606 | 3606 | $separator = ','; |
| 3607 | 3607 | |
| 3608 | - if(isset($cs['thousand_separator'])){
|
|
| 3609 | - if($cs['thousand_separator']=='comma'){$separator = ',';}
|
|
| 3610 | - if($cs['thousand_separator']=='slash'){$separator = '\\';}
|
|
| 3611 | - if($cs['thousand_separator']=='period'){$separator = '.';}
|
|
| 3612 | - if($cs['thousand_separator']=='space'){$separator = ' ';}
|
|
| 3613 | - if($cs['thousand_separator']=='none'){$separator = '';}
|
|
| 3608 | + if (isset($cs['thousand_separator'])) {
|
|
| 3609 | + if ($cs['thousand_separator'] == 'comma') {$separator = ','; }
|
|
| 3610 | + if ($cs['thousand_separator'] == 'slash') {$separator = '\\'; }
|
|
| 3611 | + if ($cs['thousand_separator'] == 'period') {$separator = '.'; }
|
|
| 3612 | + if ($cs['thousand_separator'] == 'space') {$separator = ' '; }
|
|
| 3613 | + if ($cs['thousand_separator'] == 'none') {$separator = ''; }
|
|
| 3614 | 3614 | } |
| 3615 | 3615 | |
| 3616 | 3616 | $currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left'; |
| 3617 | 3617 | |
| 3618 | - if($decimals>0 && $decimal_display=='if'){
|
|
| 3619 | - if(is_int($number) || floor( $number ) == $number) |
|
| 3618 | + if ($decimals > 0 && $decimal_display == 'if') {
|
|
| 3619 | + if (is_int($number) || floor($number) == $number) |
|
| 3620 | 3620 | $decimals = 0; |
| 3621 | 3621 | } |
| 3622 | 3622 | |
| 3623 | - $number = number_format($number,$decimals,$decimalpoint,$separator); |
|
| 3623 | + $number = number_format($number, $decimals, $decimalpoint, $separator); |
|
| 3624 | 3624 | |
| 3625 | 3625 | |
| 3626 | 3626 | |
| 3627 | - if($currency_symbol_placement=='left'){
|
|
| 3628 | - $number = $symbol . $number; |
|
| 3629 | - }else{
|
|
| 3630 | - $number = $number . $symbol; |
|
| 3627 | + if ($currency_symbol_placement == 'left') {
|
|
| 3628 | + $number = $symbol.$number; |
|
| 3629 | + } else {
|
|
| 3630 | + $number = $number.$symbol; |
|
| 3631 | 3631 | } |
| 3632 | 3632 | |
| 3633 | 3633 | |