@@ -17,310 +17,310 @@ 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 type |
|
| 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 | - |
|
| 320 | - /** |
|
| 321 | - * @see `geodir_custom_fields` |
|
| 322 | - */ |
|
| 323 | - 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 type |
|
| 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 | + |
|
| 320 | + /** |
|
| 321 | + * @see `geodir_custom_fields` |
|
| 322 | + */ |
|
| 323 | + return apply_filters('geodir_custom_fields_predefined',$custom_fields,$post_type); |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | |
@@ -335,32 +335,32 @@ discard block |
||
| 335 | 335 | * @return string The html to output. |
| 336 | 336 | */ |
| 337 | 337 | function geodir_predefined_custom_field_output_twitter_feed($html,$location,$cf){ |
| 338 | - global $post; |
|
| 338 | + global $post; |
|
| 339 | 339 | |
| 340 | 340 | |
| 341 | - if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ): |
|
| 341 | + if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ): |
|
| 342 | 342 | |
| 343 | - $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text"; |
|
| 343 | + $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text"; |
|
| 344 | 344 | |
| 345 | - $field_icon = geodir_field_icon_proccess($cf); |
|
| 346 | - if (strpos($field_icon, 'http') !== false) { |
|
| 347 | - $field_icon_af = ''; |
|
| 348 | - } elseif ($field_icon == '') { |
|
| 349 | - $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : ""; |
|
| 350 | - } else { |
|
| 351 | - $field_icon_af = $field_icon; |
|
| 352 | - $field_icon = ''; |
|
| 353 | - } |
|
| 345 | + $field_icon = geodir_field_icon_proccess($cf); |
|
| 346 | + if (strpos($field_icon, 'http') !== false) { |
|
| 347 | + $field_icon_af = ''; |
|
| 348 | + } elseif ($field_icon == '') { |
|
| 349 | + $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : ""; |
|
| 350 | + } else { |
|
| 351 | + $field_icon_af = $field_icon; |
|
| 352 | + $field_icon = ''; |
|
| 353 | + } |
|
| 354 | 354 | |
| 355 | 355 | |
| 356 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">'; |
|
| 356 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">'; |
|
| 357 | 357 | |
| 358 | - $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>'; |
|
| 359 | - $html .= '</div>'; |
|
| 358 | + $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>'; |
|
| 359 | + $html .= '</div>'; |
|
| 360 | 360 | |
| 361 | - endif; |
|
| 361 | + endif; |
|
| 362 | 362 | |
| 363 | - return $html; |
|
| 363 | + return $html; |
|
| 364 | 364 | } |
| 365 | 365 | add_filter('geodir_custom_field_output_text_key_twitter_feed','geodir_predefined_custom_field_output_twitter_feed',10,3); |
| 366 | 366 | |
@@ -375,36 +375,36 @@ discard block |
||
| 375 | 375 | * @return string The html to output. |
| 376 | 376 | */ |
| 377 | 377 | function geodir_predefined_custom_field_output_get_directions($html,$location,$cf) { |
| 378 | - global $post; |
|
| 378 | + global $post; |
|
| 379 | 379 | |
| 380 | 380 | |
| 381 | - if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){ |
|
| 381 | + if ( isset( $post->{$cf['htmlvar_name']} ) && $post->{$cf['htmlvar_name']} != '' && isset( $post->post_latitude ) && $post->post_latitude ){ |
|
| 382 | 382 | |
| 383 | - $field_icon = geodir_field_icon_proccess( $cf ); |
|
| 384 | - if ( strpos( $field_icon, 'http' ) !== false ) { |
|
| 385 | - $field_icon_af = ''; |
|
| 386 | - } elseif ( $field_icon == '' ) { |
|
| 387 | - $field_icon_af = '<i class="fa fa-location-arrow"></i>'; |
|
| 388 | - } else { |
|
| 389 | - $field_icon_af = $field_icon; |
|
| 390 | - $field_icon = ''; |
|
| 391 | - } |
|
| 383 | + $field_icon = geodir_field_icon_proccess( $cf ); |
|
| 384 | + if ( strpos( $field_icon, 'http' ) !== false ) { |
|
| 385 | + $field_icon_af = ''; |
|
| 386 | + } elseif ( $field_icon == '' ) { |
|
| 387 | + $field_icon_af = '<i class="fa fa-location-arrow"></i>'; |
|
| 388 | + } else { |
|
| 389 | + $field_icon_af = $field_icon; |
|
| 390 | + $field_icon = ''; |
|
| 391 | + } |
|
| 392 | 392 | |
| 393 | - $link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' ); |
|
| 393 | + $link_text = isset( $post->{$cf['default_value']} ) ? $post->{$cf['default_value']} : __( 'Get Directions', 'geodirectory' ); |
|
| 394 | 394 | |
| 395 | - $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">'; |
|
| 395 | + $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;">'; |
|
| 396 | 396 | |
| 397 | - if(isset( $cf['field_icon'] ) && $cf['field_icon']){ |
|
| 398 | - $html .= $field_icon_af; |
|
| 399 | - } |
|
| 397 | + if(isset( $cf['field_icon'] ) && $cf['field_icon']){ |
|
| 398 | + $html .= $field_icon_af; |
|
| 399 | + } |
|
| 400 | 400 | |
| 401 | - $html .= '<a href="https://www.google.com/maps/dir//\'' . $post->post_latitude . ',' . $post->post_longitude . '\'/" target="_blank" >' . $link_text . '</a>'; |
|
| 402 | - $html .= '</div>'; |
|
| 401 | + $html .= '<a href="https://www.google.com/maps/dir//\'' . $post->post_latitude . ',' . $post->post_longitude . '\'/" target="_blank" >' . $link_text . '</a>'; |
|
| 402 | + $html .= '</div>'; |
|
| 403 | 403 | |
| 404 | - }else{ |
|
| 405 | - $html =''; |
|
| 406 | - } |
|
| 404 | + }else{ |
|
| 405 | + $html =''; |
|
| 406 | + } |
|
| 407 | 407 | |
| 408 | - return $html; |
|
| 408 | + return $html; |
|
| 409 | 409 | } |
| 410 | 410 | add_filter('geodir_custom_field_output_text_key_get_directions','geodir_predefined_custom_field_output_get_directions',10,3); |
@@ -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 requirment. |
|
| 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 dublicate 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 requirment. |
|
| 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 dublicate 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 | - // Nothig happend for fieldset |
|
| 736 | - break; |
|
| 734 | + case 'fieldset': |
|
| 735 | + // Nothig happend 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,420 +1239,420 @@ 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 | - $val = stripslashes_deep($val); // strip slashes from labels |
|
| 1250 | - $name = $val['name']; |
|
| 1251 | - $type = $val['type']; |
|
| 1252 | - $is_default = $val['is_default']; |
|
| 1248 | + foreach ($custom_fields as $key => $val) {
|
|
| 1249 | + $val = stripslashes_deep($val); // strip slashes from labels |
|
| 1250 | + $name = $val['name']; |
|
| 1251 | + $type = $val['type']; |
|
| 1252 | + $is_default = $val['is_default']; |
|
| 1253 | 1253 | |
| 1254 | - /* field available to site admin only for edit */ |
|
| 1255 | - $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false; |
|
| 1256 | - if ($for_admin_use && !is_super_admin()) {
|
|
| 1257 | - continue; |
|
| 1258 | - } |
|
| 1254 | + /* field available to site admin only for edit */ |
|
| 1255 | + $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false; |
|
| 1256 | + if ($for_admin_use && !is_super_admin()) {
|
|
| 1257 | + continue; |
|
| 1258 | + } |
|
| 1259 | 1259 | |
| 1260 | - if (is_admin()) {
|
|
| 1261 | - global $post; |
|
| 1260 | + if (is_admin()) {
|
|
| 1261 | + global $post; |
|
| 1262 | 1262 | |
| 1263 | - if (isset($_REQUEST['post'])) |
|
| 1264 | - $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1265 | - } |
|
| 1263 | + if (isset($_REQUEST['post'])) |
|
| 1264 | + $_REQUEST['pid'] = $_REQUEST['post']; |
|
| 1265 | + } |
|
| 1266 | 1266 | |
| 1267 | 1267 | |
| 1268 | 1268 | |
| 1269 | - /** |
|
| 1270 | - * Called before the custom fields info is output for submitting a post. |
|
| 1271 | - * |
|
| 1272 | - * Used dynamic hook type geodir_before_custom_form_field_$name. |
|
| 1273 | - * |
|
| 1274 | - * @since 1.0.0 |
|
| 1275 | - * @param string $listing_type The post post type. |
|
| 1276 | - * @param int $package_id The price package ID for the post. |
|
| 1277 | - * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
|
| 1278 | - * @see 'geodir_after_custom_form_field_$name' |
|
| 1279 | - */ |
|
| 1280 | - do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1281 | - |
|
| 1282 | - |
|
| 1283 | - $custom_field = $val; |
|
| 1284 | - $html =''; |
|
| 1285 | - /** |
|
| 1286 | - * Filter the output for custom fields. |
|
| 1287 | - * |
|
| 1288 | - * Here we can remove or add new functions depending on the field type. |
|
| 1289 | - * |
|
| 1290 | - * @param string $html The html to be filtered (blank). |
|
| 1291 | - * @param array $custom_field The custom field array values. |
|
| 1292 | - */ |
|
| 1293 | - echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
|
|
| 1294 | - |
|
| 1295 | - |
|
| 1296 | - |
|
| 1297 | - /** |
|
| 1298 | - * Called after the custom fields info is output for submitting a post. |
|
| 1299 | - * |
|
| 1300 | - * Used dynamic hook type geodir_after_custom_form_field_$name. |
|
| 1301 | - * |
|
| 1302 | - * @since 1.0.0 |
|
| 1303 | - * @param string $listing_type The post post type. |
|
| 1304 | - * @param int $package_id The price package ID for the post. |
|
| 1305 | - * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
|
| 1306 | - * @see 'geodir_before_custom_form_field_$name' |
|
| 1307 | - */ |
|
| 1308 | - do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1309 | - |
|
| 1310 | - } |
|
| 1269 | + /** |
|
| 1270 | + * Called before the custom fields info is output for submitting a post. |
|
| 1271 | + * |
|
| 1272 | + * Used dynamic hook type geodir_before_custom_form_field_$name. |
|
| 1273 | + * |
|
| 1274 | + * @since 1.0.0 |
|
| 1275 | + * @param string $listing_type The post post type. |
|
| 1276 | + * @param int $package_id The price package ID for the post. |
|
| 1277 | + * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
|
| 1278 | + * @see 'geodir_after_custom_form_field_$name' |
|
| 1279 | + */ |
|
| 1280 | + do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1281 | + |
|
| 1282 | + |
|
| 1283 | + $custom_field = $val; |
|
| 1284 | + $html =''; |
|
| 1285 | + /** |
|
| 1286 | + * Filter the output for custom fields. |
|
| 1287 | + * |
|
| 1288 | + * Here we can remove or add new functions depending on the field type. |
|
| 1289 | + * |
|
| 1290 | + * @param string $html The html to be filtered (blank). |
|
| 1291 | + * @param array $custom_field The custom field array values. |
|
| 1292 | + */ |
|
| 1293 | + echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
|
|
| 1294 | + |
|
| 1295 | + |
|
| 1296 | + |
|
| 1297 | + /** |
|
| 1298 | + * Called after the custom fields info is output for submitting a post. |
|
| 1299 | + * |
|
| 1300 | + * Used dynamic hook type geodir_after_custom_form_field_$name. |
|
| 1301 | + * |
|
| 1302 | + * @since 1.0.0 |
|
| 1303 | + * @param string $listing_type The post post type. |
|
| 1304 | + * @param int $package_id The price package ID for the post. |
|
| 1305 | + * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
|
| 1306 | + * @see 'geodir_before_custom_form_field_$name' |
|
| 1307 | + */ |
|
| 1308 | + do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1309 | + |
|
| 1310 | + } |
|
| 1311 | 1311 | |
| 1312 | 1312 | } |
| 1313 | 1313 | |
| 1314 | 1314 | |
| 1315 | 1315 | if (!function_exists('geodir_get_field_infoby')) {
|
| 1316 | - /** |
|
| 1317 | - * Get custom field using key and value. |
|
| 1318 | - * |
|
| 1319 | - * @since 1.0.0 |
|
| 1320 | - * @package GeoDirectory |
|
| 1321 | - * @global object $wpdb WordPress Database object. |
|
| 1322 | - * @param string $key The key you want to look for. |
|
| 1323 | - * @param string $value The value of the key you want to look for. |
|
| 1324 | - * @param string $geodir_post_type The post type. |
|
| 1325 | - * @return bool|mixed Returns field info when available. otherwise returns false. |
|
| 1326 | - */ |
|
| 1327 | - function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '') |
|
| 1328 | - {
|
|
| 1329 | - |
|
| 1330 | - global $wpdb; |
|
| 1331 | - |
|
| 1332 | - $filter = $wpdb->get_row( |
|
| 1333 | - $wpdb->prepare( |
|
| 1334 | - "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'", |
|
| 1335 | - array($geodir_post_type) |
|
| 1336 | - ) |
|
| 1337 | - ); |
|
| 1338 | - |
|
| 1339 | - if ($filter) {
|
|
| 1340 | - return $filter; |
|
| 1341 | - } else {
|
|
| 1342 | - return false; |
|
| 1343 | - } |
|
| 1344 | - |
|
| 1345 | - } |
|
| 1316 | + /** |
|
| 1317 | + * Get custom field using key and value. |
|
| 1318 | + * |
|
| 1319 | + * @since 1.0.0 |
|
| 1320 | + * @package GeoDirectory |
|
| 1321 | + * @global object $wpdb WordPress Database object. |
|
| 1322 | + * @param string $key The key you want to look for. |
|
| 1323 | + * @param string $value The value of the key you want to look for. |
|
| 1324 | + * @param string $geodir_post_type The post type. |
|
| 1325 | + * @return bool|mixed Returns field info when available. otherwise returns false. |
|
| 1326 | + */ |
|
| 1327 | + function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '') |
|
| 1328 | + {
|
|
| 1329 | + |
|
| 1330 | + global $wpdb; |
|
| 1331 | + |
|
| 1332 | + $filter = $wpdb->get_row( |
|
| 1333 | + $wpdb->prepare( |
|
| 1334 | + "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'", |
|
| 1335 | + array($geodir_post_type) |
|
| 1336 | + ) |
|
| 1337 | + ); |
|
| 1338 | + |
|
| 1339 | + if ($filter) {
|
|
| 1340 | + return $filter; |
|
| 1341 | + } else {
|
|
| 1342 | + return false; |
|
| 1343 | + } |
|
| 1344 | + |
|
| 1345 | + } |
|
| 1346 | 1346 | } |
| 1347 | 1347 | |
| 1348 | 1348 | |
| 1349 | 1349 | function geodir_field_icon_proccess($cf){
|
| 1350 | 1350 | |
| 1351 | 1351 | |
| 1352 | - if (strpos($cf['field_icon'], 'http') !== false) {
|
|
| 1353 | - $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 1354 | - } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
|
|
| 1355 | - $field_icon = '<i class="' . $cf['field_icon'] . '"></i>'; |
|
| 1356 | - }else{
|
|
| 1357 | - $field_icon = $cf['field_icon']; |
|
| 1358 | - } |
|
| 1352 | + if (strpos($cf['field_icon'], 'http') !== false) {
|
|
| 1353 | + $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 1354 | + } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
|
|
| 1355 | + $field_icon = '<i class="' . $cf['field_icon'] . '"></i>'; |
|
| 1356 | + }else{
|
|
| 1357 | + $field_icon = $cf['field_icon']; |
|
| 1358 | + } |
|
| 1359 | 1359 | |
| 1360 | - return $field_icon; |
|
| 1360 | + return $field_icon; |
|
| 1361 | 1361 | } |
| 1362 | 1362 | |
| 1363 | 1363 | if (!function_exists('geodir_show_listing_info')) {
|
| 1364 | - /** |
|
| 1365 | - * Show listing info depending on field location. |
|
| 1366 | - * |
|
| 1367 | - * @since 1.0.0 |
|
| 1368 | - * @since 1.5.7 Custom fields option values added to db translation. |
|
| 1369 | - * Changes to display url fields title. |
|
| 1370 | - * @package GeoDirectory |
|
| 1371 | - * @global object $wpdb WordPress Database object. |
|
| 1372 | - * @global object $post The current post object. |
|
| 1373 | - * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false. |
|
| 1374 | - * |
|
| 1375 | - * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc. |
|
| 1376 | - * @return string Returns listing info html. |
|
| 1377 | - */ |
|
| 1378 | - function geodir_show_listing_info($fields_location = '') {
|
|
| 1379 | - global $post, $preview, $wpdb, $send_to_friend; |
|
| 1380 | - |
|
| 1381 | - $package_info = array(); |
|
| 1382 | - |
|
| 1383 | - $package_info = geodir_post_package_info($package_info, $post); |
|
| 1384 | - $post_package_id = !empty($package_info->pid) ? $package_info->pid : ''; |
|
| 1385 | - $p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype(); |
|
| 1386 | - $send_to_friend = false; |
|
| 1387 | - |
|
| 1388 | - ob_start(); |
|
| 1389 | - $fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location); |
|
| 1390 | - |
|
| 1391 | - if (!empty($fields_info)) {
|
|
| 1392 | - $post = stripslashes_deep($post); // strip slashes |
|
| 1364 | + /** |
|
| 1365 | + * Show listing info depending on field location. |
|
| 1366 | + * |
|
| 1367 | + * @since 1.0.0 |
|
| 1368 | + * @since 1.5.7 Custom fields option values added to db translation. |
|
| 1369 | + * Changes to display url fields title. |
|
| 1370 | + * @package GeoDirectory |
|
| 1371 | + * @global object $wpdb WordPress Database object. |
|
| 1372 | + * @global object $post The current post object. |
|
| 1373 | + * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false. |
|
| 1374 | + * |
|
| 1375 | + * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc. |
|
| 1376 | + * @return string Returns listing info html. |
|
| 1377 | + */ |
|
| 1378 | + function geodir_show_listing_info($fields_location = '') {
|
|
| 1379 | + global $post, $preview, $wpdb, $send_to_friend; |
|
| 1380 | + |
|
| 1381 | + $package_info = array(); |
|
| 1382 | + |
|
| 1383 | + $package_info = geodir_post_package_info($package_info, $post); |
|
| 1384 | + $post_package_id = !empty($package_info->pid) ? $package_info->pid : ''; |
|
| 1385 | + $p_type = !empty($post->post_type) ? $post->post_type : geodir_get_current_posttype(); |
|
| 1386 | + $send_to_friend = false; |
|
| 1387 | + |
|
| 1388 | + ob_start(); |
|
| 1389 | + $fields_info = geodir_post_custom_fields($post_package_id, 'all', $p_type, $fields_location); |
|
| 1390 | + |
|
| 1391 | + if (!empty($fields_info)) {
|
|
| 1392 | + $post = stripslashes_deep($post); // strip slashes |
|
| 1393 | 1393 | |
| 1394 | - //echo '<div class="geodir-company_info field-group">'; |
|
| 1395 | - global $field_set_start; |
|
| 1396 | - $field_set_start = 0; |
|
| 1394 | + //echo '<div class="geodir-company_info field-group">'; |
|
| 1395 | + global $field_set_start; |
|
| 1396 | + $field_set_start = 0; |
|
| 1397 | 1397 | |
| 1398 | 1398 | |
| 1399 | 1399 | |
| 1400 | - foreach ($fields_info as $type) {
|
|
| 1401 | - $type = stripslashes_deep($type); // strip slashes |
|
| 1402 | - $html = ''; |
|
| 1403 | - $field_icon = geodir_field_icon_proccess($type); |
|
| 1404 | - $filed_type = $type['type']; |
|
| 1405 | - $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : ''; |
|
| 1406 | - if($html_var=='post'){$html_var='post_address';}
|
|
| 1400 | + foreach ($fields_info as $type) {
|
|
| 1401 | + $type = stripslashes_deep($type); // strip slashes |
|
| 1402 | + $html = ''; |
|
| 1403 | + $field_icon = geodir_field_icon_proccess($type); |
|
| 1404 | + $filed_type = $type['type']; |
|
| 1405 | + $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : ''; |
|
| 1406 | + if($html_var=='post'){$html_var='post_address';}
|
|
| 1407 | 1407 | |
| 1408 | - /** |
|
| 1409 | - * Filter the output for custom fields. |
|
| 1410 | - * |
|
| 1411 | - * Here we can remove or add new functions depending on the field type. |
|
| 1412 | - * |
|
| 1413 | - * @param string $html The html to be filtered (blank). |
|
| 1414 | - * @param string $fields_location The location the field is to be show. |
|
| 1415 | - * @param array $type The array of field values. |
|
| 1416 | - */ |
|
| 1417 | - $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
|
|
| 1408 | + /** |
|
| 1409 | + * Filter the output for custom fields. |
|
| 1410 | + * |
|
| 1411 | + * Here we can remove or add new functions depending on the field type. |
|
| 1412 | + * |
|
| 1413 | + * @param string $html The html to be filtered (blank). |
|
| 1414 | + * @param string $fields_location The location the field is to be show. |
|
| 1415 | + * @param array $type The array of field values. |
|
| 1416 | + */ |
|
| 1417 | + $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
|
|
| 1418 | 1418 | |
| 1419 | - $variables_array = array(); |
|
| 1419 | + $variables_array = array(); |
|
| 1420 | 1420 | |
| 1421 | 1421 | // if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int)$type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
|
| 1422 | 1422 | // continue; |
| 1423 | 1423 | // } |
| 1424 | 1424 | |
| 1425 | - if ($type['type'] != 'fieldset'): |
|
| 1426 | - $variables_array['post_id'] = $post->ID; |
|
| 1427 | - $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
|
| 1428 | - $variables_array['value'] = ''; |
|
| 1429 | - if (isset($post->{$type['htmlvar_name']}))
|
|
| 1430 | - $variables_array['value'] = $post->{$type['htmlvar_name']};
|
|
| 1431 | - endif; |
|
| 1432 | - |
|
| 1433 | - |
|
| 1434 | - if ($html): |
|
| 1435 | - |
|
| 1436 | - /** |
|
| 1437 | - * Called before a custom fields is output on the frontend. |
|
| 1438 | - * |
|
| 1439 | - * @since 1.0.0 |
|
| 1440 | - * @param string $html_var The HTML variable name for the field. |
|
| 1441 | - */ |
|
| 1442 | - do_action("geodir_before_show_{$html_var}");
|
|
| 1443 | - /** |
|
| 1444 | - * Filter custom field output. |
|
| 1445 | - * |
|
| 1446 | - * @since 1.0.0 |
|
| 1447 | - * |
|
| 1448 | - * @param string $html_var The HTML variable name for the field. |
|
| 1449 | - * @param string $html Custom field unfiltered HTML. |
|
| 1450 | - * @param array $variables_array Custom field variables array. |
|
| 1451 | - */ |
|
| 1452 | - if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
|
|
| 1453 | - |
|
| 1454 | - /** |
|
| 1455 | - * Called after a custom fields is output on the frontend. |
|
| 1456 | - * |
|
| 1457 | - * @since 1.0.0 |
|
| 1458 | - * @param string $html_var The HTML variable name for the field. |
|
| 1459 | - */ |
|
| 1460 | - do_action("geodir_after_show_{$html_var}");
|
|
| 1461 | - |
|
| 1462 | - endif; |
|
| 1463 | - |
|
| 1464 | - } |
|
| 1465 | - |
|
| 1466 | - //echo '</div>'; |
|
| 1467 | - |
|
| 1468 | - } |
|
| 1469 | - |
|
| 1470 | - |
|
| 1471 | - $html = ob_get_clean(); |
|
| 1472 | - |
|
| 1473 | - /** |
|
| 1474 | - * Filter the custom fields over all output. |
|
| 1475 | - * |
|
| 1476 | - * @param string $html The html of the custom fields. |
|
| 1477 | - * @param string $fields_location The location the fields are being output. |
|
| 1478 | - * @since 1.6.9 |
|
| 1479 | - */ |
|
| 1480 | - return apply_filters('geodir_show_listing_info',$html,$fields_location);
|
|
| 1481 | - |
|
| 1482 | - } |
|
| 1425 | + if ($type['type'] != 'fieldset'): |
|
| 1426 | + $variables_array['post_id'] = $post->ID; |
|
| 1427 | + $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
|
| 1428 | + $variables_array['value'] = ''; |
|
| 1429 | + if (isset($post->{$type['htmlvar_name']}))
|
|
| 1430 | + $variables_array['value'] = $post->{$type['htmlvar_name']};
|
|
| 1431 | + endif; |
|
| 1432 | + |
|
| 1433 | + |
|
| 1434 | + if ($html): |
|
| 1435 | + |
|
| 1436 | + /** |
|
| 1437 | + * Called before a custom fields is output on the frontend. |
|
| 1438 | + * |
|
| 1439 | + * @since 1.0.0 |
|
| 1440 | + * @param string $html_var The HTML variable name for the field. |
|
| 1441 | + */ |
|
| 1442 | + do_action("geodir_before_show_{$html_var}");
|
|
| 1443 | + /** |
|
| 1444 | + * Filter custom field output. |
|
| 1445 | + * |
|
| 1446 | + * @since 1.0.0 |
|
| 1447 | + * |
|
| 1448 | + * @param string $html_var The HTML variable name for the field. |
|
| 1449 | + * @param string $html Custom field unfiltered HTML. |
|
| 1450 | + * @param array $variables_array Custom field variables array. |
|
| 1451 | + */ |
|
| 1452 | + if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
|
|
| 1453 | + |
|
| 1454 | + /** |
|
| 1455 | + * Called after a custom fields is output on the frontend. |
|
| 1456 | + * |
|
| 1457 | + * @since 1.0.0 |
|
| 1458 | + * @param string $html_var The HTML variable name for the field. |
|
| 1459 | + */ |
|
| 1460 | + do_action("geodir_after_show_{$html_var}");
|
|
| 1461 | + |
|
| 1462 | + endif; |
|
| 1463 | + |
|
| 1464 | + } |
|
| 1465 | + |
|
| 1466 | + //echo '</div>'; |
|
| 1467 | + |
|
| 1468 | + } |
|
| 1469 | + |
|
| 1470 | + |
|
| 1471 | + $html = ob_get_clean(); |
|
| 1472 | + |
|
| 1473 | + /** |
|
| 1474 | + * Filter the custom fields over all output. |
|
| 1475 | + * |
|
| 1476 | + * @param string $html The html of the custom fields. |
|
| 1477 | + * @param string $fields_location The location the fields are being output. |
|
| 1478 | + * @since 1.6.9 |
|
| 1479 | + */ |
|
| 1480 | + return apply_filters('geodir_show_listing_info',$html,$fields_location);
|
|
| 1481 | + |
|
| 1482 | + } |
|
| 1483 | 1483 | } |
| 1484 | 1484 | |
| 1485 | 1485 | if (!function_exists('geodir_default_date_format')) {
|
| 1486 | - /** |
|
| 1487 | - * Returns default date format. |
|
| 1488 | - * |
|
| 1489 | - * @since 1.0.0 |
|
| 1490 | - * @package GeoDirectory |
|
| 1491 | - * @return mixed|string|void Returns default date format. |
|
| 1492 | - */ |
|
| 1493 | - function geodir_default_date_format() |
|
| 1494 | - {
|
|
| 1495 | - if ($format = get_option('date_format'))
|
|
| 1496 | - return $format; |
|
| 1497 | - else |
|
| 1498 | - return 'dd-mm-yy'; |
|
| 1499 | - } |
|
| 1486 | + /** |
|
| 1487 | + * Returns default date format. |
|
| 1488 | + * |
|
| 1489 | + * @since 1.0.0 |
|
| 1490 | + * @package GeoDirectory |
|
| 1491 | + * @return mixed|string|void Returns default date format. |
|
| 1492 | + */ |
|
| 1493 | + function geodir_default_date_format() |
|
| 1494 | + {
|
|
| 1495 | + if ($format = get_option('date_format'))
|
|
| 1496 | + return $format; |
|
| 1497 | + else |
|
| 1498 | + return 'dd-mm-yy'; |
|
| 1499 | + } |
|
| 1500 | 1500 | } |
| 1501 | 1501 | |
| 1502 | 1502 | if (!function_exists('geodir_get_formated_date')) {
|
| 1503 | - /** |
|
| 1504 | - * Returns formatted date. |
|
| 1505 | - * |
|
| 1506 | - * @since 1.0.0 |
|
| 1507 | - * @package GeoDirectory |
|
| 1508 | - * @param string $date Date string to convert. |
|
| 1509 | - * @return bool|int|string Returns formatted date. |
|
| 1510 | - */ |
|
| 1511 | - function geodir_get_formated_date($date) |
|
| 1512 | - {
|
|
| 1513 | - return mysql2date(get_option('date_format'), $date);
|
|
| 1514 | - } |
|
| 1503 | + /** |
|
| 1504 | + * Returns formatted date. |
|
| 1505 | + * |
|
| 1506 | + * @since 1.0.0 |
|
| 1507 | + * @package GeoDirectory |
|
| 1508 | + * @param string $date Date string to convert. |
|
| 1509 | + * @return bool|int|string Returns formatted date. |
|
| 1510 | + */ |
|
| 1511 | + function geodir_get_formated_date($date) |
|
| 1512 | + {
|
|
| 1513 | + return mysql2date(get_option('date_format'), $date);
|
|
| 1514 | + } |
|
| 1515 | 1515 | } |
| 1516 | 1516 | |
| 1517 | 1517 | if (!function_exists('geodir_get_formated_time')) {
|
| 1518 | - /** |
|
| 1519 | - * Returns formatted time. |
|
| 1520 | - * |
|
| 1521 | - * @since 1.0.0 |
|
| 1522 | - * @package GeoDirectory |
|
| 1523 | - * @param string $time Time string to convert. |
|
| 1524 | - * @return bool|int|string Returns formatted time. |
|
| 1525 | - */ |
|
| 1526 | - function geodir_get_formated_time($time) |
|
| 1527 | - {
|
|
| 1528 | - return mysql2date(get_option('time_format'), $time, $translate = true);
|
|
| 1529 | - } |
|
| 1518 | + /** |
|
| 1519 | + * Returns formatted time. |
|
| 1520 | + * |
|
| 1521 | + * @since 1.0.0 |
|
| 1522 | + * @package GeoDirectory |
|
| 1523 | + * @param string $time Time string to convert. |
|
| 1524 | + * @return bool|int|string Returns formatted time. |
|
| 1525 | + */ |
|
| 1526 | + function geodir_get_formated_time($time) |
|
| 1527 | + {
|
|
| 1528 | + return mysql2date(get_option('time_format'), $time, $translate = true);
|
|
| 1529 | + } |
|
| 1530 | 1530 | } |
| 1531 | 1531 | |
| 1532 | 1532 | |
| 1533 | 1533 | if (!function_exists('geodir_save_post_file_fields')) {
|
| 1534 | - /** |
|
| 1535 | - * Save post file fields |
|
| 1536 | - * |
|
| 1537 | - * @since 1.0.0 |
|
| 1538 | - * @since 1.4.7 Added `$extra_fields` parameter. |
|
| 1539 | - * @package GeoDirectory |
|
| 1540 | - * @global object $wpdb WordPress Database object. |
|
| 1541 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 1542 | - * @global object $current_user Current user object. |
|
| 1543 | - * @param int $post_id |
|
| 1544 | - * @param string $field_id |
|
| 1545 | - * @param array $post_image |
|
| 1546 | - * @param array $extra_fields Array of extra fields. |
|
| 1547 | - */ |
|
| 1548 | - function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array()) |
|
| 1549 | - {
|
|
| 1534 | + /** |
|
| 1535 | + * Save post file fields |
|
| 1536 | + * |
|
| 1537 | + * @since 1.0.0 |
|
| 1538 | + * @since 1.4.7 Added `$extra_fields` parameter. |
|
| 1539 | + * @package GeoDirectory |
|
| 1540 | + * @global object $wpdb WordPress Database object. |
|
| 1541 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 1542 | + * @global object $current_user Current user object. |
|
| 1543 | + * @param int $post_id |
|
| 1544 | + * @param string $field_id |
|
| 1545 | + * @param array $post_image |
|
| 1546 | + * @param array $extra_fields Array of extra fields. |
|
| 1547 | + */ |
|
| 1548 | + function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array()) |
|
| 1549 | + {
|
|
| 1550 | 1550 | |
| 1551 | - global $wpdb, $plugin_prefix, $current_user; |
|
| 1551 | + global $wpdb, $plugin_prefix, $current_user; |
|
| 1552 | 1552 | |
| 1553 | - $post_type = get_post_type($post_id); |
|
| 1554 | - //echo $field_id; exit; |
|
| 1555 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1553 | + $post_type = get_post_type($post_id); |
|
| 1554 | + //echo $field_id; exit; |
|
| 1555 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1556 | 1556 | |
| 1557 | - $postcurr_images = array(); |
|
| 1558 | - $postcurr_images = geodir_get_post_meta($post_id, $field_id, true); |
|
| 1559 | - $file_urls = ''; |
|
| 1557 | + $postcurr_images = array(); |
|
| 1558 | + $postcurr_images = geodir_get_post_meta($post_id, $field_id, true); |
|
| 1559 | + $file_urls = ''; |
|
| 1560 | 1560 | |
| 1561 | - if (!empty($post_image)) {
|
|
| 1561 | + if (!empty($post_image)) {
|
|
| 1562 | 1562 | |
| 1563 | - $invalid_files = array(); |
|
| 1563 | + $invalid_files = array(); |
|
| 1564 | 1564 | |
| 1565 | - //Get and remove all old images of post from database to set by new order |
|
| 1566 | - $geodir_uploaddir = ''; |
|
| 1567 | - $uploads = wp_upload_dir(); |
|
| 1568 | - $uploads_dir = $uploads['path']; |
|
| 1565 | + //Get and remove all old images of post from database to set by new order |
|
| 1566 | + $geodir_uploaddir = ''; |
|
| 1567 | + $uploads = wp_upload_dir(); |
|
| 1568 | + $uploads_dir = $uploads['path']; |
|
| 1569 | 1569 | |
| 1570 | - $geodir_uploadpath = $uploads['path']; |
|
| 1571 | - $geodir_uploadurl = $uploads['url']; |
|
| 1572 | - $sub_dir = $uploads['subdir']; |
|
| 1570 | + $geodir_uploadpath = $uploads['path']; |
|
| 1571 | + $geodir_uploadurl = $uploads['url']; |
|
| 1572 | + $sub_dir = $uploads['subdir']; |
|
| 1573 | 1573 | |
| 1574 | - $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'] : '';
|
|
| 1574 | + $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'] : '';
|
|
| 1575 | 1575 | |
| 1576 | - for ($m = 0; $m < count($post_image); $m++) {
|
|
| 1576 | + for ($m = 0; $m < count($post_image); $m++) {
|
|
| 1577 | 1577 | |
| 1578 | - /* --------- start ------- */ |
|
| 1578 | + /* --------- start ------- */ |
|
| 1579 | 1579 | |
| 1580 | - 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)))) {
|
|
| 1580 | + 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)))) {
|
|
| 1581 | 1581 | |
| 1582 | 1582 | |
| 1583 | - $curr_img_url = $post_image[$m]; |
|
| 1584 | - $image_name_arr = explode('/', $curr_img_url);
|
|
| 1585 | - $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
| 1586 | - $filename = end($image_name_arr); |
|
| 1587 | - $img_name_arr = explode('.', $filename);
|
|
| 1583 | + $curr_img_url = $post_image[$m]; |
|
| 1584 | + $image_name_arr = explode('/', $curr_img_url);
|
|
| 1585 | + $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
| 1586 | + $filename = end($image_name_arr); |
|
| 1587 | + $img_name_arr = explode('.', $filename);
|
|
| 1588 | 1588 | |
| 1589 | - $arr_file_type = wp_check_filetype($filename); |
|
| 1589 | + $arr_file_type = wp_check_filetype($filename); |
|
| 1590 | 1590 | |
| 1591 | - if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
|
|
| 1592 | - continue; |
|
| 1593 | - } |
|
| 1591 | + if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
|
|
| 1592 | + continue; |
|
| 1593 | + } |
|
| 1594 | 1594 | |
| 1595 | - $uploaded_file_type = $arr_file_type['type']; |
|
| 1596 | - $uploaded_file_ext = $arr_file_type['ext']; |
|
| 1595 | + $uploaded_file_type = $arr_file_type['type']; |
|
| 1596 | + $uploaded_file_ext = $arr_file_type['ext']; |
|
| 1597 | 1597 | |
| 1598 | - if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
|
|
| 1599 | - continue; // Invalid file type. |
|
| 1600 | - } |
|
| 1598 | + if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
|
|
| 1599 | + continue; // Invalid file type. |
|
| 1600 | + } |
|
| 1601 | 1601 | |
| 1602 | - // Set an array containing a list of acceptable formats |
|
| 1603 | - //$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');
|
|
| 1602 | + // Set an array containing a list of acceptable formats |
|
| 1603 | + //$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 | 1604 | |
| 1605 | - if (!function_exists('wp_handle_upload'))
|
|
| 1606 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1605 | + if (!function_exists('wp_handle_upload'))
|
|
| 1606 | + require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1607 | 1607 | |
| 1608 | - if (!is_dir($geodir_uploadpath)) |
|
| 1609 | - mkdir($geodir_uploadpath); |
|
| 1608 | + if (!is_dir($geodir_uploadpath)) |
|
| 1609 | + mkdir($geodir_uploadpath); |
|
| 1610 | 1610 | |
| 1611 | - $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
|
| 1612 | - $explode_sub_dir = explode("/", $sub_dir);
|
|
| 1613 | - if ($curr_img_dir == end($explode_sub_dir)) {
|
|
| 1614 | - $img_path = $geodir_uploadpath . '/' . $filename; |
|
| 1615 | - $img_url = $geodir_uploadurl . '/' . $filename; |
|
| 1616 | - } else {
|
|
| 1617 | - $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1618 | - $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1619 | - } |
|
| 1611 | + $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
|
| 1612 | + $explode_sub_dir = explode("/", $sub_dir);
|
|
| 1613 | + if ($curr_img_dir == end($explode_sub_dir)) {
|
|
| 1614 | + $img_path = $geodir_uploadpath . '/' . $filename; |
|
| 1615 | + $img_url = $geodir_uploadurl . '/' . $filename; |
|
| 1616 | + } else {
|
|
| 1617 | + $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1618 | + $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1619 | + } |
|
| 1620 | 1620 | |
| 1621 | - $uploaded_file = ''; |
|
| 1622 | - if (file_exists($img_path)) |
|
| 1623 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1621 | + $uploaded_file = ''; |
|
| 1622 | + if (file_exists($img_path)) |
|
| 1623 | + $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1624 | 1624 | |
| 1625 | - if ($curr_img_dir != $geodir_uploaddir) {
|
|
| 1626 | - if (file_exists($img_path)) |
|
| 1627 | - unlink($img_path); |
|
| 1628 | - } |
|
| 1625 | + if ($curr_img_dir != $geodir_uploaddir) {
|
|
| 1626 | + if (file_exists($img_path)) |
|
| 1627 | + unlink($img_path); |
|
| 1628 | + } |
|
| 1629 | 1629 | |
| 1630 | - if (!empty($uploaded_file)) |
|
| 1631 | - $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 1630 | + if (!empty($uploaded_file)) |
|
| 1631 | + $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 1632 | 1632 | |
| 1633 | - } else {
|
|
| 1634 | - $file_urls = $post_image[$m]; |
|
| 1635 | - } |
|
| 1636 | - } |
|
| 1633 | + } else {
|
|
| 1634 | + $file_urls = $post_image[$m]; |
|
| 1635 | + } |
|
| 1636 | + } |
|
| 1637 | 1637 | |
| 1638 | 1638 | |
| 1639 | - } |
|
| 1639 | + } |
|
| 1640 | 1640 | |
| 1641 | - //Remove all old attachments and temp images |
|
| 1642 | - if (!empty($postcurr_images)) {
|
|
| 1641 | + //Remove all old attachments and temp images |
|
| 1642 | + if (!empty($postcurr_images)) {
|
|
| 1643 | 1643 | |
| 1644 | - if ($file_urls != $postcurr_images) {
|
|
| 1645 | - $invalid_files[] = (object)array('src' => $postcurr_images);
|
|
| 1646 | - $invalid_files = (object)$invalid_files; |
|
| 1647 | - } |
|
| 1648 | - } |
|
| 1644 | + if ($file_urls != $postcurr_images) {
|
|
| 1645 | + $invalid_files[] = (object)array('src' => $postcurr_images);
|
|
| 1646 | + $invalid_files = (object)$invalid_files; |
|
| 1647 | + } |
|
| 1648 | + } |
|
| 1649 | 1649 | |
| 1650 | - geodir_save_post_meta($post_id, $field_id, $file_urls); |
|
| 1650 | + geodir_save_post_meta($post_id, $field_id, $file_urls); |
|
| 1651 | 1651 | |
| 1652 | - if (!empty($invalid_files)) |
|
| 1653 | - geodir_remove_attachments($invalid_files); |
|
| 1652 | + if (!empty($invalid_files)) |
|
| 1653 | + geodir_remove_attachments($invalid_files); |
|
| 1654 | 1654 | |
| 1655 | - } |
|
| 1655 | + } |
|
| 1656 | 1656 | } |
| 1657 | 1657 | |
| 1658 | 1658 | |
@@ -1667,76 +1667,76 @@ discard block |
||
| 1667 | 1667 | */ |
| 1668 | 1668 | function geodir_custom_upload_mimes($existing_mimes = array()) |
| 1669 | 1669 | {
|
| 1670 | - $existing_mimes['wif'] = 'text/plain'; |
|
| 1671 | - $existing_mimes['jpg|jpeg'] = 'image/jpeg'; |
|
| 1672 | - $existing_mimes['gif'] = 'image/gif'; |
|
| 1673 | - $existing_mimes['png'] = 'image/png'; |
|
| 1674 | - $existing_mimes['pdf'] = 'application/pdf'; |
|
| 1675 | - $existing_mimes['txt'] = 'text/text'; |
|
| 1676 | - $existing_mimes['csv'] = 'application/octet-stream'; |
|
| 1677 | - $existing_mimes['doc'] = 'application/msword'; |
|
| 1678 | - $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel'; |
|
| 1679 | - $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; |
|
| 1680 | - $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; |
|
| 1681 | - return $existing_mimes; |
|
| 1670 | + $existing_mimes['wif'] = 'text/plain'; |
|
| 1671 | + $existing_mimes['jpg|jpeg'] = 'image/jpeg'; |
|
| 1672 | + $existing_mimes['gif'] = 'image/gif'; |
|
| 1673 | + $existing_mimes['png'] = 'image/png'; |
|
| 1674 | + $existing_mimes['pdf'] = 'application/pdf'; |
|
| 1675 | + $existing_mimes['txt'] = 'text/text'; |
|
| 1676 | + $existing_mimes['csv'] = 'application/octet-stream'; |
|
| 1677 | + $existing_mimes['doc'] = 'application/msword'; |
|
| 1678 | + $existing_mimes['xla|xls|xlt|xlw'] = 'application/vnd.ms-excel'; |
|
| 1679 | + $existing_mimes['docx'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; |
|
| 1680 | + $existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; |
|
| 1681 | + return $existing_mimes; |
|
| 1682 | 1682 | } |
| 1683 | 1683 | |
| 1684 | 1684 | if (!function_exists('geodir_plupload_action')) {
|
| 1685 | 1685 | |
| 1686 | - /** |
|
| 1687 | - * Get upload directory path details |
|
| 1688 | - * |
|
| 1689 | - * @since 1.0.0 |
|
| 1690 | - * @package GeoDirectory |
|
| 1691 | - * @global object $current_user Current user object. |
|
| 1692 | - * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'. |
|
| 1693 | - * @return mixed Returns upload directory details as an array. |
|
| 1694 | - */ |
|
| 1695 | - function geodir_upload_dir($upload) |
|
| 1696 | - {
|
|
| 1697 | - global $current_user; |
|
| 1698 | - $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID; |
|
| 1699 | - $upload['path'] = $upload['basedir'] . $upload['subdir']; |
|
| 1700 | - $upload['url'] = $upload['baseurl'] . $upload['subdir']; |
|
| 1701 | - return $upload; |
|
| 1702 | - } |
|
| 1703 | - |
|
| 1704 | - /** |
|
| 1705 | - * Handles place file and image upload. |
|
| 1706 | - * |
|
| 1707 | - * @since 1.0.0 |
|
| 1708 | - * @package GeoDirectory |
|
| 1709 | - */ |
|
| 1710 | - function geodir_plupload_action() |
|
| 1711 | - {
|
|
| 1712 | - // check ajax noonce |
|
| 1713 | - $imgid = $_POST["imgid"]; |
|
| 1714 | - |
|
| 1715 | - check_ajax_referer($imgid . 'pluploadan'); |
|
| 1716 | - |
|
| 1717 | - // handle custom file uploaddir |
|
| 1718 | - add_filter('upload_dir', 'geodir_upload_dir');
|
|
| 1719 | - |
|
| 1720 | - // change file orinetation if needed |
|
| 1721 | - $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']); |
|
| 1722 | - |
|
| 1723 | - // handle file upload |
|
| 1724 | - $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
|
|
| 1725 | - // remove handle custom file uploaddir |
|
| 1726 | - remove_filter('upload_dir', 'geodir_upload_dir');
|
|
| 1727 | - |
|
| 1728 | - if(!isset($status['url']) && isset($status['error'])){
|
|
| 1729 | - print_r($status); |
|
| 1730 | - } |
|
| 1731 | - |
|
| 1732 | - // send the uploaded file url in response |
|
| 1733 | - if (isset($status['url'])) {
|
|
| 1734 | - echo $status['url']; |
|
| 1735 | - } else {
|
|
| 1736 | - echo 'x'; |
|
| 1737 | - } |
|
| 1738 | - exit; |
|
| 1739 | - } |
|
| 1686 | + /** |
|
| 1687 | + * Get upload directory path details |
|
| 1688 | + * |
|
| 1689 | + * @since 1.0.0 |
|
| 1690 | + * @package GeoDirectory |
|
| 1691 | + * @global object $current_user Current user object. |
|
| 1692 | + * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'. |
|
| 1693 | + * @return mixed Returns upload directory details as an array. |
|
| 1694 | + */ |
|
| 1695 | + function geodir_upload_dir($upload) |
|
| 1696 | + {
|
|
| 1697 | + global $current_user; |
|
| 1698 | + $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID; |
|
| 1699 | + $upload['path'] = $upload['basedir'] . $upload['subdir']; |
|
| 1700 | + $upload['url'] = $upload['baseurl'] . $upload['subdir']; |
|
| 1701 | + return $upload; |
|
| 1702 | + } |
|
| 1703 | + |
|
| 1704 | + /** |
|
| 1705 | + * Handles place file and image upload. |
|
| 1706 | + * |
|
| 1707 | + * @since 1.0.0 |
|
| 1708 | + * @package GeoDirectory |
|
| 1709 | + */ |
|
| 1710 | + function geodir_plupload_action() |
|
| 1711 | + {
|
|
| 1712 | + // check ajax noonce |
|
| 1713 | + $imgid = $_POST["imgid"]; |
|
| 1714 | + |
|
| 1715 | + check_ajax_referer($imgid . 'pluploadan'); |
|
| 1716 | + |
|
| 1717 | + // handle custom file uploaddir |
|
| 1718 | + add_filter('upload_dir', 'geodir_upload_dir');
|
|
| 1719 | + |
|
| 1720 | + // change file orinetation if needed |
|
| 1721 | + $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']); |
|
| 1722 | + |
|
| 1723 | + // handle file upload |
|
| 1724 | + $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
|
|
| 1725 | + // remove handle custom file uploaddir |
|
| 1726 | + remove_filter('upload_dir', 'geodir_upload_dir');
|
|
| 1727 | + |
|
| 1728 | + if(!isset($status['url']) && isset($status['error'])){
|
|
| 1729 | + print_r($status); |
|
| 1730 | + } |
|
| 1731 | + |
|
| 1732 | + // send the uploaded file url in response |
|
| 1733 | + if (isset($status['url'])) {
|
|
| 1734 | + echo $status['url']; |
|
| 1735 | + } else {
|
|
| 1736 | + echo 'x'; |
|
| 1737 | + } |
|
| 1738 | + exit; |
|
| 1739 | + } |
|
| 1740 | 1740 | } |
| 1741 | 1741 | |
| 1742 | 1742 | /** |
@@ -1751,17 +1751,17 @@ discard block |
||
| 1751 | 1751 | */ |
| 1752 | 1752 | function geodir_get_video($post_id) |
| 1753 | 1753 | {
|
| 1754 | - global $wpdb, $plugin_prefix; |
|
| 1754 | + global $wpdb, $plugin_prefix; |
|
| 1755 | 1755 | |
| 1756 | - $post_type = get_post_type($post_id); |
|
| 1756 | + $post_type = get_post_type($post_id); |
|
| 1757 | 1757 | |
| 1758 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1758 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1759 | 1759 | |
| 1760 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1760 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1761 | 1761 | |
| 1762 | - if ($results) {
|
|
| 1763 | - return $results[0]->geodir_video; |
|
| 1764 | - } |
|
| 1762 | + if ($results) {
|
|
| 1763 | + return $results[0]->geodir_video; |
|
| 1764 | + } |
|
| 1765 | 1765 | |
| 1766 | 1766 | } |
| 1767 | 1767 | |
@@ -1777,40 +1777,40 @@ discard block |
||
| 1777 | 1777 | */ |
| 1778 | 1778 | function geodir_get_special_offers($post_id) |
| 1779 | 1779 | {
|
| 1780 | - global $wpdb, $plugin_prefix; |
|
| 1780 | + global $wpdb, $plugin_prefix; |
|
| 1781 | 1781 | |
| 1782 | - $post_type = get_post_type($post_id); |
|
| 1782 | + $post_type = get_post_type($post_id); |
|
| 1783 | 1783 | |
| 1784 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1784 | + $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1785 | 1785 | |
| 1786 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1786 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1787 | 1787 | |
| 1788 | - if ($results) {
|
|
| 1789 | - return $results[0]->geodir_special_offers; |
|
| 1790 | - } |
|
| 1788 | + if ($results) {
|
|
| 1789 | + return $results[0]->geodir_special_offers; |
|
| 1790 | + } |
|
| 1791 | 1791 | |
| 1792 | 1792 | } |
| 1793 | 1793 | |
| 1794 | 1794 | if (!function_exists('geodir_max_upload_size')) {
|
| 1795 | - /** |
|
| 1796 | - * Get max upload file size |
|
| 1797 | - * |
|
| 1798 | - * @since 1.0.0 |
|
| 1799 | - * @package GeoDirectory |
|
| 1800 | - * @return mixed|void Returns max upload file size. |
|
| 1801 | - */ |
|
| 1802 | - function geodir_max_upload_size() |
|
| 1803 | - {
|
|
| 1804 | - $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
|
|
| 1805 | - |
|
| 1806 | - if ($max_filesize > 0 && $max_filesize < 1) {
|
|
| 1807 | - $max_filesize = (int)($max_filesize * 1024) . 'kb'; |
|
| 1808 | - } else {
|
|
| 1809 | - $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
|
| 1810 | - } |
|
| 1811 | - /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
| 1812 | - return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
|
|
| 1813 | - } |
|
| 1795 | + /** |
|
| 1796 | + * Get max upload file size |
|
| 1797 | + * |
|
| 1798 | + * @since 1.0.0 |
|
| 1799 | + * @package GeoDirectory |
|
| 1800 | + * @return mixed|void Returns max upload file size. |
|
| 1801 | + */ |
|
| 1802 | + function geodir_max_upload_size() |
|
| 1803 | + {
|
|
| 1804 | + $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
|
|
| 1805 | + |
|
| 1806 | + if ($max_filesize > 0 && $max_filesize < 1) {
|
|
| 1807 | + $max_filesize = (int)($max_filesize * 1024) . 'kb'; |
|
| 1808 | + } else {
|
|
| 1809 | + $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
|
| 1810 | + } |
|
| 1811 | + /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
| 1812 | + return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
|
|
| 1813 | + } |
|
| 1814 | 1814 | } |
| 1815 | 1815 | |
| 1816 | 1816 | |
@@ -1828,33 +1828,33 @@ discard block |
||
| 1828 | 1828 | */ |
| 1829 | 1829 | function geodir_add_custom_sort_options($fields, $post_type) |
| 1830 | 1830 | {
|
| 1831 | - global $wpdb; |
|
| 1831 | + global $wpdb; |
|
| 1832 | 1832 | |
| 1833 | - if ($post_type != '') {
|
|
| 1833 | + if ($post_type != '') {
|
|
| 1834 | 1834 | |
| 1835 | - $all_postypes = geodir_get_posttypes(); |
|
| 1835 | + $all_postypes = geodir_get_posttypes(); |
|
| 1836 | 1836 | |
| 1837 | - if (in_array($post_type, $all_postypes)) {
|
|
| 1837 | + if (in_array($post_type, $all_postypes)) {
|
|
| 1838 | 1838 | |
| 1839 | - $custom_fields = $wpdb->get_results( |
|
| 1840 | - $wpdb->prepare( |
|
| 1841 | - "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", |
|
| 1842 | - array($post_type) |
|
| 1843 | - ), 'ARRAY_A' |
|
| 1844 | - ); |
|
| 1839 | + $custom_fields = $wpdb->get_results( |
|
| 1840 | + $wpdb->prepare( |
|
| 1841 | + "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", |
|
| 1842 | + array($post_type) |
|
| 1843 | + ), 'ARRAY_A' |
|
| 1844 | + ); |
|
| 1845 | 1845 | |
| 1846 | - if (!empty($custom_fields)) {
|
|
| 1846 | + if (!empty($custom_fields)) {
|
|
| 1847 | 1847 | |
| 1848 | - foreach ($custom_fields as $val) {
|
|
| 1849 | - $fields[] = $val; |
|
| 1850 | - } |
|
| 1851 | - } |
|
| 1848 | + foreach ($custom_fields as $val) {
|
|
| 1849 | + $fields[] = $val; |
|
| 1850 | + } |
|
| 1851 | + } |
|
| 1852 | 1852 | |
| 1853 | - } |
|
| 1853 | + } |
|
| 1854 | 1854 | |
| 1855 | - } |
|
| 1855 | + } |
|
| 1856 | 1856 | |
| 1857 | - return $fields; |
|
| 1857 | + return $fields; |
|
| 1858 | 1858 | } |
| 1859 | 1859 | |
| 1860 | 1860 | |
@@ -1870,76 +1870,76 @@ discard block |
||
| 1870 | 1870 | function geodir_get_custom_sort_options($post_type = '') |
| 1871 | 1871 | {
|
| 1872 | 1872 | |
| 1873 | - global $wpdb; |
|
| 1874 | - |
|
| 1875 | - if ($post_type != '') {
|
|
| 1876 | - |
|
| 1877 | - $all_postypes = geodir_get_posttypes(); |
|
| 1878 | - |
|
| 1879 | - if (!in_array($post_type, $all_postypes)) |
|
| 1880 | - return false; |
|
| 1881 | - |
|
| 1882 | - $fields = array(); |
|
| 1883 | - |
|
| 1884 | - $fields[] = array( |
|
| 1885 | - 'post_type' => $post_type, |
|
| 1886 | - 'data_type' => '', |
|
| 1887 | - 'field_type' => 'random', |
|
| 1888 | - 'site_title' => 'Random', |
|
| 1889 | - 'htmlvar_name' => 'post_title', |
|
| 1890 | - 'field_icon' => 'fa fa-random', |
|
| 1891 | - 'description' => __('Random sort (not recommended for large sites)', 'geodirectory')
|
|
| 1892 | - ); |
|
| 1893 | - |
|
| 1894 | - $fields[] = array( |
|
| 1895 | - 'post_type' => $post_type, |
|
| 1896 | - 'data_type' => '', |
|
| 1897 | - 'field_type' => 'datetime', |
|
| 1898 | - 'site_title' => __('Add date', 'geodirectory'),
|
|
| 1899 | - 'htmlvar_name' => 'post_date', |
|
| 1900 | - 'field_icon' => 'fa fa-calendar', |
|
| 1901 | - 'description' => __('Sort by date added', 'geodirectory')
|
|
| 1902 | - ); |
|
| 1903 | - $fields[] = array( |
|
| 1904 | - 'post_type' => $post_type, |
|
| 1905 | - 'data_type' => '', |
|
| 1906 | - 'field_type' => 'bigint', |
|
| 1907 | - 'site_title' => __('Review', 'geodirectory'),
|
|
| 1908 | - 'htmlvar_name' => 'comment_count', |
|
| 1909 | - 'field_icon' => 'fa fa-commenting-o', |
|
| 1910 | - 'description' => __('Sort by the number of reviews', 'geodirectory')
|
|
| 1911 | - ); |
|
| 1912 | - $fields[] = array( |
|
| 1913 | - 'post_type' => $post_type, |
|
| 1914 | - 'data_type' => '', |
|
| 1915 | - 'field_type' => 'float', |
|
| 1916 | - 'site_title' => __('Rating', 'geodirectory'),
|
|
| 1917 | - 'htmlvar_name' => 'overall_rating', |
|
| 1918 | - 'field_icon' => 'fa fa-star-o', |
|
| 1919 | - 'description' => __('Sort by the overall rating value', 'geodirectory')
|
|
| 1920 | - ); |
|
| 1921 | - $fields[] = array( |
|
| 1922 | - 'post_type' => $post_type, |
|
| 1923 | - 'data_type' => '', |
|
| 1924 | - 'field_type' => 'text', |
|
| 1925 | - 'site_title' => __('Title', 'geodirectory'),
|
|
| 1926 | - 'htmlvar_name' => 'post_title', |
|
| 1927 | - 'field_icon' => 'fa fa-sort-alpha-desc', |
|
| 1928 | - 'description' => __('Sort alphabetically by title', 'geodirectory')
|
|
| 1929 | - ); |
|
| 1930 | - |
|
| 1931 | - /** |
|
| 1932 | - * Hook to add custom sort options. |
|
| 1933 | - * |
|
| 1934 | - * @since 1.0.0 |
|
| 1935 | - * @param array $fields Unmodified sort options array. |
|
| 1936 | - * @param string $post_type Post type. |
|
| 1937 | - */ |
|
| 1938 | - return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
|
|
| 1939 | - |
|
| 1940 | - } |
|
| 1941 | - |
|
| 1942 | - return false; |
|
| 1873 | + global $wpdb; |
|
| 1874 | + |
|
| 1875 | + if ($post_type != '') {
|
|
| 1876 | + |
|
| 1877 | + $all_postypes = geodir_get_posttypes(); |
|
| 1878 | + |
|
| 1879 | + if (!in_array($post_type, $all_postypes)) |
|
| 1880 | + return false; |
|
| 1881 | + |
|
| 1882 | + $fields = array(); |
|
| 1883 | + |
|
| 1884 | + $fields[] = array( |
|
| 1885 | + 'post_type' => $post_type, |
|
| 1886 | + 'data_type' => '', |
|
| 1887 | + 'field_type' => 'random', |
|
| 1888 | + 'site_title' => 'Random', |
|
| 1889 | + 'htmlvar_name' => 'post_title', |
|
| 1890 | + 'field_icon' => 'fa fa-random', |
|
| 1891 | + 'description' => __('Random sort (not recommended for large sites)', 'geodirectory')
|
|
| 1892 | + ); |
|
| 1893 | + |
|
| 1894 | + $fields[] = array( |
|
| 1895 | + 'post_type' => $post_type, |
|
| 1896 | + 'data_type' => '', |
|
| 1897 | + 'field_type' => 'datetime', |
|
| 1898 | + 'site_title' => __('Add date', 'geodirectory'),
|
|
| 1899 | + 'htmlvar_name' => 'post_date', |
|
| 1900 | + 'field_icon' => 'fa fa-calendar', |
|
| 1901 | + 'description' => __('Sort by date added', 'geodirectory')
|
|
| 1902 | + ); |
|
| 1903 | + $fields[] = array( |
|
| 1904 | + 'post_type' => $post_type, |
|
| 1905 | + 'data_type' => '', |
|
| 1906 | + 'field_type' => 'bigint', |
|
| 1907 | + 'site_title' => __('Review', 'geodirectory'),
|
|
| 1908 | + 'htmlvar_name' => 'comment_count', |
|
| 1909 | + 'field_icon' => 'fa fa-commenting-o', |
|
| 1910 | + 'description' => __('Sort by the number of reviews', 'geodirectory')
|
|
| 1911 | + ); |
|
| 1912 | + $fields[] = array( |
|
| 1913 | + 'post_type' => $post_type, |
|
| 1914 | + 'data_type' => '', |
|
| 1915 | + 'field_type' => 'float', |
|
| 1916 | + 'site_title' => __('Rating', 'geodirectory'),
|
|
| 1917 | + 'htmlvar_name' => 'overall_rating', |
|
| 1918 | + 'field_icon' => 'fa fa-star-o', |
|
| 1919 | + 'description' => __('Sort by the overall rating value', 'geodirectory')
|
|
| 1920 | + ); |
|
| 1921 | + $fields[] = array( |
|
| 1922 | + 'post_type' => $post_type, |
|
| 1923 | + 'data_type' => '', |
|
| 1924 | + 'field_type' => 'text', |
|
| 1925 | + 'site_title' => __('Title', 'geodirectory'),
|
|
| 1926 | + 'htmlvar_name' => 'post_title', |
|
| 1927 | + 'field_icon' => 'fa fa-sort-alpha-desc', |
|
| 1928 | + 'description' => __('Sort alphabetically by title', 'geodirectory')
|
|
| 1929 | + ); |
|
| 1930 | + |
|
| 1931 | + /** |
|
| 1932 | + * Hook to add custom sort options. |
|
| 1933 | + * |
|
| 1934 | + * @since 1.0.0 |
|
| 1935 | + * @param array $fields Unmodified sort options array. |
|
| 1936 | + * @param string $post_type Post type. |
|
| 1937 | + */ |
|
| 1938 | + return $fields = apply_filters('geodir_add_custom_sort_options', $fields, $post_type);
|
|
| 1939 | + |
|
| 1940 | + } |
|
| 1941 | + |
|
| 1942 | + return false; |
|
| 1943 | 1943 | } |
| 1944 | 1944 | |
| 1945 | 1945 | |
@@ -1955,117 +1955,117 @@ discard block |
||
| 1955 | 1955 | function godir_set_sort_field_order($field_ids = array()) |
| 1956 | 1956 | {
|
| 1957 | 1957 | |
| 1958 | - global $wpdb; |
|
| 1958 | + global $wpdb; |
|
| 1959 | 1959 | |
| 1960 | - $count = 0; |
|
| 1961 | - if (!empty($field_ids)): |
|
| 1962 | - foreach ($field_ids as $id) {
|
|
| 1960 | + $count = 0; |
|
| 1961 | + if (!empty($field_ids)): |
|
| 1962 | + foreach ($field_ids as $id) {
|
|
| 1963 | 1963 | |
| 1964 | - $cf = trim($id, '_'); |
|
| 1964 | + $cf = trim($id, '_'); |
|
| 1965 | 1965 | |
| 1966 | - $post_meta_info = $wpdb->query( |
|
| 1967 | - $wpdb->prepare( |
|
| 1968 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 1966 | + $post_meta_info = $wpdb->query( |
|
| 1967 | + $wpdb->prepare( |
|
| 1968 | + "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 1969 | 1969 | sort_order=%d |
| 1970 | 1970 | where id= %d", |
| 1971 | - array($count, $cf) |
|
| 1972 | - ) |
|
| 1973 | - ); |
|
| 1974 | - $count++; |
|
| 1975 | - } |
|
| 1976 | - |
|
| 1977 | - return $field_ids; |
|
| 1978 | - else: |
|
| 1979 | - return false; |
|
| 1980 | - endif; |
|
| 1971 | + array($count, $cf) |
|
| 1972 | + ) |
|
| 1973 | + ); |
|
| 1974 | + $count++; |
|
| 1975 | + } |
|
| 1976 | + |
|
| 1977 | + return $field_ids; |
|
| 1978 | + else: |
|
| 1979 | + return false; |
|
| 1980 | + endif; |
|
| 1981 | 1981 | } |
| 1982 | 1982 | |
| 1983 | 1983 | |
| 1984 | 1984 | if (!function_exists('geodir_custom_sort_field_save')) {
|
| 1985 | - /** |
|
| 1986 | - * Save or Update custom sort fields into the database. |
|
| 1987 | - * |
|
| 1988 | - * @since 1.0.0 |
|
| 1989 | - * @package GeoDirectory |
|
| 1990 | - * @global object $wpdb WordPress Database object. |
|
| 1991 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 1992 | - * @param array $request_field {
|
|
| 1993 | - * Attributes of the Request field. |
|
| 1994 | - * |
|
| 1995 | - * @type string $action Ajax action name. |
|
| 1996 | - * @type string $manage_field_type Manage field type Default "sorting_options". |
|
| 1997 | - * @type string $create_field Do you want to create this field?. |
|
| 1998 | - * @type string $field_ins_upd Field created or updated?. |
|
| 1999 | - * @type string $_wpnonce Nonce value. |
|
| 2000 | - * @type string $listing_type The Post type. |
|
| 2001 | - * @type string $field_type Field Type. |
|
| 2002 | - * @type string $field_id Field ID. |
|
| 2003 | - * @type string $data_type Data Type. |
|
| 2004 | - * @type string $htmlvar_name HTML variable name. |
|
| 2005 | - * @type string $site_title Section title which you wish to display in frontend. |
|
| 2006 | - * @type string $is_default Is this default sorting?. |
|
| 2007 | - * @type string $is_active If not active then the field will not be displayed anywhere. |
|
| 2008 | - * @type string $sort_order Sort Order. |
|
| 2009 | - * |
|
| 2010 | - * } |
|
| 2011 | - * @param bool $default Not yet implemented. |
|
| 2012 | - * @return int Returns the last affected db table row id. |
|
| 2013 | - */ |
|
| 2014 | - function geodir_custom_sort_field_save($request_field = array(), $default = false) |
|
| 2015 | - {
|
|
| 2016 | - |
|
| 2017 | - global $wpdb, $plugin_prefix; |
|
| 2018 | - |
|
| 2019 | - $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
|
| 2020 | - |
|
| 2021 | - $cf = trim($result_str, '_'); |
|
| 2022 | - |
|
| 2023 | - /*-------- check dublicate validation --------*/ |
|
| 2024 | - |
|
| 2025 | - $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : ''; |
|
| 2026 | - $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 2027 | - |
|
| 2028 | - $post_type = $request_field['listing_type']; |
|
| 2029 | - $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : ''; |
|
| 2030 | - $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : ''; |
|
| 2031 | - $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : ''; |
|
| 2032 | - $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 2033 | - $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0; |
|
| 2034 | - $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0; |
|
| 2035 | - $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : ''; |
|
| 2036 | - $asc = isset($request_field['asc']) ? $request_field['asc'] : 0; |
|
| 2037 | - $desc = isset($request_field['desc']) ? $request_field['desc'] : 0; |
|
| 2038 | - $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : ''; |
|
| 2039 | - $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : ''; |
|
| 2040 | - |
|
| 2041 | - $default_order = ''; |
|
| 2042 | - if ($is_default != '') {
|
|
| 2043 | - $default_order = $is_default; |
|
| 2044 | - $is_default = '1'; |
|
| 2045 | - } |
|
| 2046 | - |
|
| 2047 | - |
|
| 2048 | - $check_html_variable = $wpdb->get_var( |
|
| 2049 | - $wpdb->prepare( |
|
| 2050 | - "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 2051 | - array($cehhtmlvar_name, $post_type, $field_type) |
|
| 2052 | - ) |
|
| 2053 | - ); |
|
| 2054 | - |
|
| 2055 | - if ($is_default == 1) {
|
|
| 2056 | - |
|
| 2057 | - $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 2058 | - |
|
| 2059 | - } |
|
| 2060 | - |
|
| 2061 | - |
|
| 2062 | - if (!$check_html_variable) {
|
|
| 2063 | - |
|
| 2064 | - $wpdb->query( |
|
| 2065 | - |
|
| 2066 | - $wpdb->prepare( |
|
| 2067 | - |
|
| 2068 | - "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 1985 | + /** |
|
| 1986 | + * Save or Update custom sort fields into the database. |
|
| 1987 | + * |
|
| 1988 | + * @since 1.0.0 |
|
| 1989 | + * @package GeoDirectory |
|
| 1990 | + * @global object $wpdb WordPress Database object. |
|
| 1991 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 1992 | + * @param array $request_field {
|
|
| 1993 | + * Attributes of the Request field. |
|
| 1994 | + * |
|
| 1995 | + * @type string $action Ajax action name. |
|
| 1996 | + * @type string $manage_field_type Manage field type Default "sorting_options". |
|
| 1997 | + * @type string $create_field Do you want to create this field?. |
|
| 1998 | + * @type string $field_ins_upd Field created or updated?. |
|
| 1999 | + * @type string $_wpnonce Nonce value. |
|
| 2000 | + * @type string $listing_type The Post type. |
|
| 2001 | + * @type string $field_type Field Type. |
|
| 2002 | + * @type string $field_id Field ID. |
|
| 2003 | + * @type string $data_type Data Type. |
|
| 2004 | + * @type string $htmlvar_name HTML variable name. |
|
| 2005 | + * @type string $site_title Section title which you wish to display in frontend. |
|
| 2006 | + * @type string $is_default Is this default sorting?. |
|
| 2007 | + * @type string $is_active If not active then the field will not be displayed anywhere. |
|
| 2008 | + * @type string $sort_order Sort Order. |
|
| 2009 | + * |
|
| 2010 | + * } |
|
| 2011 | + * @param bool $default Not yet implemented. |
|
| 2012 | + * @return int Returns the last affected db table row id. |
|
| 2013 | + */ |
|
| 2014 | + function geodir_custom_sort_field_save($request_field = array(), $default = false) |
|
| 2015 | + {
|
|
| 2016 | + |
|
| 2017 | + global $wpdb, $plugin_prefix; |
|
| 2018 | + |
|
| 2019 | + $result_str = isset($request_field['field_id']) ? trim($request_field['field_id']) : ''; |
|
| 2020 | + |
|
| 2021 | + $cf = trim($result_str, '_'); |
|
| 2022 | + |
|
| 2023 | + /*-------- check dublicate validation --------*/ |
|
| 2024 | + |
|
| 2025 | + $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : ''; |
|
| 2026 | + $cehhtmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 2027 | + |
|
| 2028 | + $post_type = $request_field['listing_type']; |
|
| 2029 | + $data_type = isset($request_field['data_type']) ? $request_field['data_type'] : ''; |
|
| 2030 | + $field_type = isset($request_field['field_type']) ? $request_field['field_type'] : ''; |
|
| 2031 | + $site_title = isset($request_field['site_title']) ? $request_field['site_title'] : ''; |
|
| 2032 | + $htmlvar_name = isset($request_field['htmlvar_name']) ? $request_field['htmlvar_name'] : ''; |
|
| 2033 | + $sort_order = isset($request_field['sort_order']) ? $request_field['sort_order'] : 0; |
|
| 2034 | + $is_active = isset($request_field['is_active']) ? $request_field['is_active'] : 0; |
|
| 2035 | + $is_default = isset($request_field['is_default']) ? $request_field['is_default'] : ''; |
|
| 2036 | + $asc = isset($request_field['asc']) ? $request_field['asc'] : 0; |
|
| 2037 | + $desc = isset($request_field['desc']) ? $request_field['desc'] : 0; |
|
| 2038 | + $asc_title = isset($request_field['asc_title']) ? $request_field['asc_title'] : ''; |
|
| 2039 | + $desc_title = isset($request_field['desc_title']) ? $request_field['desc_title'] : ''; |
|
| 2040 | + |
|
| 2041 | + $default_order = ''; |
|
| 2042 | + if ($is_default != '') {
|
|
| 2043 | + $default_order = $is_default; |
|
| 2044 | + $is_default = '1'; |
|
| 2045 | + } |
|
| 2046 | + |
|
| 2047 | + |
|
| 2048 | + $check_html_variable = $wpdb->get_var( |
|
| 2049 | + $wpdb->prepare( |
|
| 2050 | + "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 2051 | + array($cehhtmlvar_name, $post_type, $field_type) |
|
| 2052 | + ) |
|
| 2053 | + ); |
|
| 2054 | + |
|
| 2055 | + if ($is_default == 1) {
|
|
| 2056 | + |
|
| 2057 | + $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 2058 | + |
|
| 2059 | + } |
|
| 2060 | + |
|
| 2061 | + |
|
| 2062 | + if (!$check_html_variable) {
|
|
| 2063 | + |
|
| 2064 | + $wpdb->query( |
|
| 2065 | + |
|
| 2066 | + $wpdb->prepare( |
|
| 2067 | + |
|
| 2068 | + "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2069 | 2069 | post_type = %s, |
| 2070 | 2070 | data_type = %s, |
| 2071 | 2071 | field_type = %s, |
@@ -2080,23 +2080,23 @@ discard block |
||
| 2080 | 2080 | asc_title = %s, |
| 2081 | 2081 | desc_title = %s", |
| 2082 | 2082 | |
| 2083 | - 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) |
|
| 2084 | - ) |
|
| 2083 | + 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) |
|
| 2084 | + ) |
|
| 2085 | 2085 | |
| 2086 | - ); |
|
| 2086 | + ); |
|
| 2087 | 2087 | |
| 2088 | 2088 | |
| 2089 | - $lastid = $wpdb->insert_id; |
|
| 2089 | + $lastid = $wpdb->insert_id; |
|
| 2090 | 2090 | |
| 2091 | - $lastid = trim($lastid); |
|
| 2091 | + $lastid = trim($lastid); |
|
| 2092 | 2092 | |
| 2093 | - } else {
|
|
| 2093 | + } else {
|
|
| 2094 | 2094 | |
| 2095 | - $wpdb->query( |
|
| 2095 | + $wpdb->query( |
|
| 2096 | 2096 | |
| 2097 | - $wpdb->prepare( |
|
| 2097 | + $wpdb->prepare( |
|
| 2098 | 2098 | |
| 2099 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2099 | + "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2100 | 2100 | post_type = %s, |
| 2101 | 2101 | data_type = %s, |
| 2102 | 2102 | field_type = %s, |
@@ -2112,123 +2112,123 @@ discard block |
||
| 2112 | 2112 | desc_title = %s |
| 2113 | 2113 | where id = %d", |
| 2114 | 2114 | |
| 2115 | - 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) |
|
| 2116 | - ) |
|
| 2115 | + 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) |
|
| 2116 | + ) |
|
| 2117 | 2117 | |
| 2118 | - ); |
|
| 2118 | + ); |
|
| 2119 | 2119 | |
| 2120 | - $lastid = trim($cf); |
|
| 2120 | + $lastid = trim($cf); |
|
| 2121 | 2121 | |
| 2122 | - } |
|
| 2122 | + } |
|
| 2123 | 2123 | |
| 2124 | 2124 | |
| 2125 | - return (int)$lastid; |
|
| 2125 | + return (int)$lastid; |
|
| 2126 | 2126 | |
| 2127 | - } |
|
| 2127 | + } |
|
| 2128 | 2128 | } |
| 2129 | 2129 | |
| 2130 | 2130 | |
| 2131 | 2131 | if (!function_exists('geodir_custom_sort_field_delete')) {
|
| 2132 | - /** |
|
| 2133 | - * Delete a custom sort field using field id. |
|
| 2134 | - * @since 1.0.0 |
|
| 2135 | - * @package GeoDirectory |
|
| 2136 | - * @global object $wpdb WordPress Database object. |
|
| 2137 | - * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 2138 | - * @param string $field_id The field ID. |
|
| 2139 | - * @return int|string Returns field id when successful deletion, else returns 0. |
|
| 2140 | - */ |
|
| 2141 | - function geodir_custom_sort_field_delete($field_id = '') |
|
| 2142 | - {
|
|
| 2143 | - |
|
| 2144 | - global $wpdb, $plugin_prefix; |
|
| 2145 | - if ($field_id != '') {
|
|
| 2146 | - $cf = trim($field_id, '_'); |
|
| 2147 | - |
|
| 2148 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 2149 | - |
|
| 2150 | - return $field_id; |
|
| 2151 | - |
|
| 2152 | - } else |
|
| 2153 | - return 0; |
|
| 2154 | - |
|
| 2155 | - } |
|
| 2132 | + /** |
|
| 2133 | + * Delete a custom sort field using field id. |
|
| 2134 | + * @since 1.0.0 |
|
| 2135 | + * @package GeoDirectory |
|
| 2136 | + * @global object $wpdb WordPress Database object. |
|
| 2137 | + * @global string $plugin_prefix Geodirectory plugin table prefix. |
|
| 2138 | + * @param string $field_id The field ID. |
|
| 2139 | + * @return int|string Returns field id when successful deletion, else returns 0. |
|
| 2140 | + */ |
|
| 2141 | + function geodir_custom_sort_field_delete($field_id = '') |
|
| 2142 | + {
|
|
| 2143 | + |
|
| 2144 | + global $wpdb, $plugin_prefix; |
|
| 2145 | + if ($field_id != '') {
|
|
| 2146 | + $cf = trim($field_id, '_'); |
|
| 2147 | + |
|
| 2148 | + $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 2149 | + |
|
| 2150 | + return $field_id; |
|
| 2151 | + |
|
| 2152 | + } else |
|
| 2153 | + return 0; |
|
| 2154 | + |
|
| 2155 | + } |
|
| 2156 | 2156 | } |
| 2157 | 2157 | |
| 2158 | 2158 | |
| 2159 | 2159 | if (!function_exists('geodir_custom_sort_field_adminhtml')) {
|
| 2160 | - /** |
|
| 2161 | - * Custom sort field admin html. |
|
| 2162 | - * |
|
| 2163 | - * @since 1.0.0 |
|
| 2164 | - * @package GeoDirectory |
|
| 2165 | - * @global object $wpdb WordPress Database object. |
|
| 2166 | - * @param string $field_type The form field type. |
|
| 2167 | - * @param object|int $result_str The custom field results object or row id. |
|
| 2168 | - * @param string $field_ins_upd When set to "submit" displays form. |
|
| 2169 | - * @param bool $default when set to true field will be for admin use only. |
|
| 2170 | - */ |
|
| 2171 | - function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='') |
|
| 2172 | - {
|
|
| 2173 | - global $wpdb; |
|
| 2174 | - $cf = $result_str; |
|
| 2175 | - if (!is_object($cf)) {
|
|
| 2176 | - $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
|
|
| 2177 | - } else {
|
|
| 2178 | - $field_info = $cf; |
|
| 2179 | - $result_str = $cf->id; |
|
| 2180 | - } |
|
| 2181 | - |
|
| 2182 | - $field_info = stripslashes_deep($field_info); // strip slashes |
|
| 2183 | - |
|
| 2184 | - if (!isset($field_info->post_type)) {
|
|
| 2185 | - $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2186 | - } else {
|
|
| 2187 | - $post_type = $field_info->post_type; |
|
| 2188 | - } |
|
| 2189 | - |
|
| 2190 | - |
|
| 2191 | - $htmlvar_name = isset($field_type_key) ? $field_type_key : ''; |
|
| 2192 | - |
|
| 2193 | - $site_title = ''; |
|
| 2194 | - if ($site_title == '') |
|
| 2195 | - $site_title = isset($field_info->site_title) ? $field_info->site_title : ''; |
|
| 2196 | - |
|
| 2197 | - if ($site_title == '') {
|
|
| 2198 | - $fields = geodir_get_custom_sort_options($post_type); |
|
| 2199 | - |
|
| 2200 | - foreach ($fields as $val) {
|
|
| 2201 | - $val = stripslashes_deep($val); // strip slashes |
|
| 2202 | - |
|
| 2203 | - if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
|
|
| 2204 | - $site_title = isset($val['site_title']) ? $val['site_title'] : ''; |
|
| 2205 | - } |
|
| 2206 | - } |
|
| 2207 | - } |
|
| 2208 | - |
|
| 2209 | - if ($htmlvar_name == '') |
|
| 2210 | - $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
|
| 2211 | - |
|
| 2212 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 2213 | - |
|
| 2214 | - $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
| 2215 | - $cso_arr = geodir_get_custom_sort_options($post_type); |
|
| 2216 | - |
|
| 2217 | - $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']); |
|
| 2218 | - foreach($cso_arr as $cso){
|
|
| 2219 | - if($cur_field_type==$cso['field_type']){
|
|
| 2220 | - |
|
| 2221 | - if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
|
|
| 2222 | - $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>'; |
|
| 2223 | - }elseif(isset($cso['field_icon']) && $cso['field_icon']){
|
|
| 2224 | - $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
|
|
| 2225 | - } |
|
| 2226 | - |
|
| 2227 | - } |
|
| 2228 | - } |
|
| 2229 | - |
|
| 2230 | - $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500); |
|
| 2231 | - ?> |
|
| 2160 | + /** |
|
| 2161 | + * Custom sort field admin html. |
|
| 2162 | + * |
|
| 2163 | + * @since 1.0.0 |
|
| 2164 | + * @package GeoDirectory |
|
| 2165 | + * @global object $wpdb WordPress Database object. |
|
| 2166 | + * @param string $field_type The form field type. |
|
| 2167 | + * @param object|int $result_str The custom field results object or row id. |
|
| 2168 | + * @param string $field_ins_upd When set to "submit" displays form. |
|
| 2169 | + * @param bool $default when set to true field will be for admin use only. |
|
| 2170 | + */ |
|
| 2171 | + function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='') |
|
| 2172 | + {
|
|
| 2173 | + global $wpdb; |
|
| 2174 | + $cf = $result_str; |
|
| 2175 | + if (!is_object($cf)) {
|
|
| 2176 | + $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
|
|
| 2177 | + } else {
|
|
| 2178 | + $field_info = $cf; |
|
| 2179 | + $result_str = $cf->id; |
|
| 2180 | + } |
|
| 2181 | + |
|
| 2182 | + $field_info = stripslashes_deep($field_info); // strip slashes |
|
| 2183 | + |
|
| 2184 | + if (!isset($field_info->post_type)) {
|
|
| 2185 | + $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2186 | + } else {
|
|
| 2187 | + $post_type = $field_info->post_type; |
|
| 2188 | + } |
|
| 2189 | + |
|
| 2190 | + |
|
| 2191 | + $htmlvar_name = isset($field_type_key) ? $field_type_key : ''; |
|
| 2192 | + |
|
| 2193 | + $site_title = ''; |
|
| 2194 | + if ($site_title == '') |
|
| 2195 | + $site_title = isset($field_info->site_title) ? $field_info->site_title : ''; |
|
| 2196 | + |
|
| 2197 | + if ($site_title == '') {
|
|
| 2198 | + $fields = geodir_get_custom_sort_options($post_type); |
|
| 2199 | + |
|
| 2200 | + foreach ($fields as $val) {
|
|
| 2201 | + $val = stripslashes_deep($val); // strip slashes |
|
| 2202 | + |
|
| 2203 | + if ($val['field_type'] == $field_type && $val['htmlvar_name'] == $htmlvar_name) {
|
|
| 2204 | + $site_title = isset($val['site_title']) ? $val['site_title'] : ''; |
|
| 2205 | + } |
|
| 2206 | + } |
|
| 2207 | + } |
|
| 2208 | + |
|
| 2209 | + if ($htmlvar_name == '') |
|
| 2210 | + $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
|
| 2211 | + |
|
| 2212 | + $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 2213 | + |
|
| 2214 | + $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
| 2215 | + $cso_arr = geodir_get_custom_sort_options($post_type); |
|
| 2216 | + |
|
| 2217 | + $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']); |
|
| 2218 | + foreach($cso_arr as $cso){
|
|
| 2219 | + if($cur_field_type==$cso['field_type']){
|
|
| 2220 | + |
|
| 2221 | + if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
|
|
| 2222 | + $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>'; |
|
| 2223 | + }elseif(isset($cso['field_icon']) && $cso['field_icon']){
|
|
| 2224 | + $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
|
|
| 2225 | + } |
|
| 2226 | + |
|
| 2227 | + } |
|
| 2228 | + } |
|
| 2229 | + |
|
| 2230 | + $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500); |
|
| 2231 | + ?> |
|
| 2232 | 2232 | |
| 2233 | 2233 | <li class="text" id="licontainer_<?php echo $result_str;?>"> |
| 2234 | 2234 | <form><!-- we need to wrap in a fom so we can use radio buttons with same name --> |
@@ -2237,7 +2237,7 @@ discard block |
||
| 2237 | 2237 | ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
|
| 2238 | 2238 | <?php |
| 2239 | 2239 | |
| 2240 | - ?> |
|
| 2240 | + ?> |
|
| 2241 | 2241 | |
| 2242 | 2242 | <div title="<?php _e('Click to remove field', 'geodirectory');?>"
|
| 2243 | 2243 | onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
|
@@ -2252,17 +2252,17 @@ discard block |
||
| 2252 | 2252 | |
| 2253 | 2253 | <div id="field_frm<?php echo $result_str;?>" class="field_frm" |
| 2254 | 2254 | style="display:<?php if ($field_ins_upd == 'submit') {
|
| 2255 | - echo 'block;'; |
|
| 2256 | - } else {
|
|
| 2257 | - echo 'none;'; |
|
| 2258 | - } ?>"> |
|
| 2255 | + echo 'block;'; |
|
| 2256 | + } else {
|
|
| 2257 | + echo 'none;'; |
|
| 2258 | + } ?>"> |
|
| 2259 | 2259 | <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/> |
| 2260 | 2260 | <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/> |
| 2261 | 2261 | <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/> |
| 2262 | 2262 | <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/> |
| 2263 | 2263 | <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
|
| 2264 | - echo $field_info->data_type; |
|
| 2265 | - }?>"/> |
|
| 2264 | + echo $field_info->data_type; |
|
| 2265 | + }?>"/> |
|
| 2266 | 2266 | <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/> |
| 2267 | 2267 | |
| 2268 | 2268 | |
@@ -2285,14 +2285,14 @@ discard block |
||
| 2285 | 2285 | |
| 2286 | 2286 | <input type="radio" id="asc_yes<?php echo $radio_id;?>" name="asc" class="gdri-enabled" value="1" |
| 2287 | 2287 | <?php if ($value == '1') {
|
| 2288 | - echo 'checked'; |
|
| 2289 | - } ?>/> |
|
| 2288 | + echo 'checked'; |
|
| 2289 | + } ?>/> |
|
| 2290 | 2290 | <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>
|
| 2291 | 2291 | |
| 2292 | 2292 | <input type="radio" id="asc_no<?php echo $radio_id;?>" name="asc" class="gdri-disabled" value="0" |
| 2293 | 2293 | <?php if ($value == '0' || !$value) {
|
| 2294 | - echo 'checked'; |
|
| 2295 | - } ?>/> |
|
| 2294 | + echo 'checked'; |
|
| 2295 | + } ?>/> |
|
| 2296 | 2296 | <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>
|
| 2297 | 2297 | |
| 2298 | 2298 | </div> |
@@ -2329,8 +2329,8 @@ discard block |
||
| 2329 | 2329 | |
| 2330 | 2330 | <input type="radio" name="is_default" |
| 2331 | 2331 | value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
|
| 2332 | - echo 'checked="checked"'; |
|
| 2333 | - } ?>/> |
|
| 2332 | + echo 'checked="checked"'; |
|
| 2333 | + } ?>/> |
|
| 2334 | 2334 | </div> |
| 2335 | 2335 | |
| 2336 | 2336 | </li> |
@@ -2350,14 +2350,14 @@ discard block |
||
| 2350 | 2350 | |
| 2351 | 2351 | <input type="radio" id="desc_yes<?php echo $radio_id;?>" name="desc" class="gdri-enabled" value="1" |
| 2352 | 2352 | <?php if ($value == '1') {
|
| 2353 | - echo 'checked'; |
|
| 2354 | - } ?>/> |
|
| 2353 | + echo 'checked'; |
|
| 2354 | + } ?>/> |
|
| 2355 | 2355 | <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>
|
| 2356 | 2356 | |
| 2357 | 2357 | <input type="radio" id="desc_no<?php echo $radio_id;?>" name="desc" class="gdri-disabled" value="0" |
| 2358 | 2358 | <?php if ($value == '0' || !$value) {
|
| 2359 | - echo 'checked'; |
|
| 2360 | - } ?>/> |
|
| 2359 | + echo 'checked'; |
|
| 2360 | + } ?>/> |
|
| 2361 | 2361 | <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>
|
| 2362 | 2362 | |
| 2363 | 2363 | </div> |
@@ -2393,8 +2393,8 @@ discard block |
||
| 2393 | 2393 | |
| 2394 | 2394 | <input type="radio" name="is_default" |
| 2395 | 2395 | value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
|
| 2396 | - echo 'checked="checked"'; |
|
| 2397 | - } ?>/> |
|
| 2396 | + echo 'checked="checked"'; |
|
| 2397 | + } ?>/> |
|
| 2398 | 2398 | </div> |
| 2399 | 2399 | |
| 2400 | 2400 | </li> |
@@ -2436,8 +2436,8 @@ discard block |
||
| 2436 | 2436 | |
| 2437 | 2437 | <input type="checkbox" name="is_default" |
| 2438 | 2438 | value="<?php echo $field_type; ?>" <?php if (isset($value) && $value == '1') {
|
| 2439 | - echo 'checked="checked"'; |
|
| 2440 | - } ?>/> |
|
| 2439 | + echo 'checked="checked"'; |
|
| 2440 | + } ?>/> |
|
| 2441 | 2441 | </div> |
| 2442 | 2442 | |
| 2443 | 2443 | |
@@ -2460,14 +2460,14 @@ discard block |
||
| 2460 | 2460 | |
| 2461 | 2461 | <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
| 2462 | 2462 | <?php if ($value == '1') {
|
| 2463 | - echo 'checked'; |
|
| 2464 | - } ?>/> |
|
| 2463 | + echo 'checked'; |
|
| 2464 | + } ?>/> |
|
| 2465 | 2465 | <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 2466 | 2466 | |
| 2467 | 2467 | <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
| 2468 | 2468 | <?php if ($value == '0' || !$value) {
|
| 2469 | - echo 'checked'; |
|
| 2470 | - } ?>/> |
|
| 2469 | + echo 'checked'; |
|
| 2470 | + } ?>/> |
|
| 2471 | 2471 | <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 2472 | 2472 | |
| 2473 | 2473 | </div> |
@@ -2477,8 +2477,8 @@ discard block |
||
| 2477 | 2477 | |
| 2478 | 2478 | <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" |
| 2479 | 2479 | value="<?php if (isset($field_info->sort_order)) {
|
| 2480 | - echo esc_attr($field_info->sort_order); |
|
| 2481 | - }?>" size="50"/> |
|
| 2480 | + echo esc_attr($field_info->sort_order); |
|
| 2481 | + }?>" size="50"/> |
|
| 2482 | 2482 | |
| 2483 | 2483 | |
| 2484 | 2484 | |
@@ -2502,38 +2502,38 @@ discard block |
||
| 2502 | 2502 | </form> |
| 2503 | 2503 | </li> <?php |
| 2504 | 2504 | |
| 2505 | - } |
|
| 2505 | + } |
|
| 2506 | 2506 | } |
| 2507 | 2507 | |
| 2508 | 2508 | if (!function_exists('check_field_visibility')) {
|
| 2509 | - /** |
|
| 2510 | - * Check field visibility as per price package. |
|
| 2511 | - * |
|
| 2512 | - * @since 1.0.0 |
|
| 2513 | - * @package GeoDirectory |
|
| 2514 | - * @global object $wpdb WordPress Database object. |
|
| 2515 | - * @global array $geodir_addon_list List of active GeoDirectory extensions. |
|
| 2516 | - * @param int|string $package_id The package ID. |
|
| 2517 | - * @param string $field_name The field name. |
|
| 2518 | - * @param string $post_type Optional. The wordpress post type. |
|
| 2519 | - * @return bool Returns true when field visible, otherwise false. |
|
| 2520 | - */ |
|
| 2521 | - function check_field_visibility($package_id, $field_name, $post_type) |
|
| 2522 | - {
|
|
| 2523 | - global $wpdb, $geodir_addon_list; |
|
| 2524 | - if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
|
|
| 2525 | - return true; |
|
| 2526 | - } |
|
| 2527 | - if (!$package_id || !$field_name || !$post_type) {
|
|
| 2528 | - return true; |
|
| 2529 | - } |
|
| 2530 | - $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));
|
|
| 2531 | - |
|
| 2532 | - if ($wpdb->get_var($sql)) {
|
|
| 2533 | - return true; |
|
| 2534 | - } |
|
| 2535 | - return false; |
|
| 2536 | - } |
|
| 2509 | + /** |
|
| 2510 | + * Check field visibility as per price package. |
|
| 2511 | + * |
|
| 2512 | + * @since 1.0.0 |
|
| 2513 | + * @package GeoDirectory |
|
| 2514 | + * @global object $wpdb WordPress Database object. |
|
| 2515 | + * @global array $geodir_addon_list List of active GeoDirectory extensions. |
|
| 2516 | + * @param int|string $package_id The package ID. |
|
| 2517 | + * @param string $field_name The field name. |
|
| 2518 | + * @param string $post_type Optional. The wordpress post type. |
|
| 2519 | + * @return bool Returns true when field visible, otherwise false. |
|
| 2520 | + */ |
|
| 2521 | + function check_field_visibility($package_id, $field_name, $post_type) |
|
| 2522 | + {
|
|
| 2523 | + global $wpdb, $geodir_addon_list; |
|
| 2524 | + if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
|
|
| 2525 | + return true; |
|
| 2526 | + } |
|
| 2527 | + if (!$package_id || !$field_name || !$post_type) {
|
|
| 2528 | + return true; |
|
| 2529 | + } |
|
| 2530 | + $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));
|
|
| 2531 | + |
|
| 2532 | + if ($wpdb->get_var($sql)) {
|
|
| 2533 | + return true; |
|
| 2534 | + } |
|
| 2535 | + return false; |
|
| 2536 | + } |
|
| 2537 | 2537 | } |
| 2538 | 2538 | |
| 2539 | 2539 | /** |
@@ -2548,43 +2548,43 @@ discard block |
||
| 2548 | 2548 | */ |
| 2549 | 2549 | function geodir_string_to_options($input = '', $translated = false) |
| 2550 | 2550 | {
|
| 2551 | - $return = array(); |
|
| 2552 | - if ($input != '') {
|
|
| 2553 | - $input = trim($input); |
|
| 2554 | - $input = rtrim($input, ","); |
|
| 2555 | - $input = ltrim($input, ","); |
|
| 2556 | - $input = trim($input); |
|
| 2557 | - } |
|
| 2558 | - |
|
| 2559 | - $input_arr = explode(',', $input);
|
|
| 2560 | - |
|
| 2561 | - if (!empty($input_arr)) {
|
|
| 2562 | - foreach ($input_arr as $input_str) {
|
|
| 2563 | - $input_str = trim($input_str); |
|
| 2564 | - |
|
| 2565 | - if (strpos($input_str, "/") !== false) {
|
|
| 2566 | - $input_str = explode("/", $input_str, 2);
|
|
| 2567 | - $label = trim($input_str[0]); |
|
| 2568 | - if ($translated && $label != '') {
|
|
| 2569 | - $label = __($label, 'geodirectory'); |
|
| 2570 | - } |
|
| 2571 | - $label = ucfirst($label); |
|
| 2572 | - $value = trim($input_str[1]); |
|
| 2573 | - } else {
|
|
| 2574 | - if ($translated && $input_str != '') {
|
|
| 2575 | - $input_str = __($input_str, 'geodirectory'); |
|
| 2576 | - } |
|
| 2577 | - $label = ucfirst($input_str); |
|
| 2578 | - $value = $input_str; |
|
| 2579 | - } |
|
| 2580 | - |
|
| 2581 | - if ($label != '') {
|
|
| 2582 | - $return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
|
|
| 2583 | - } |
|
| 2584 | - } |
|
| 2585 | - } |
|
| 2586 | - |
|
| 2587 | - return $return; |
|
| 2551 | + $return = array(); |
|
| 2552 | + if ($input != '') {
|
|
| 2553 | + $input = trim($input); |
|
| 2554 | + $input = rtrim($input, ","); |
|
| 2555 | + $input = ltrim($input, ","); |
|
| 2556 | + $input = trim($input); |
|
| 2557 | + } |
|
| 2558 | + |
|
| 2559 | + $input_arr = explode(',', $input);
|
|
| 2560 | + |
|
| 2561 | + if (!empty($input_arr)) {
|
|
| 2562 | + foreach ($input_arr as $input_str) {
|
|
| 2563 | + $input_str = trim($input_str); |
|
| 2564 | + |
|
| 2565 | + if (strpos($input_str, "/") !== false) {
|
|
| 2566 | + $input_str = explode("/", $input_str, 2);
|
|
| 2567 | + $label = trim($input_str[0]); |
|
| 2568 | + if ($translated && $label != '') {
|
|
| 2569 | + $label = __($label, 'geodirectory'); |
|
| 2570 | + } |
|
| 2571 | + $label = ucfirst($label); |
|
| 2572 | + $value = trim($input_str[1]); |
|
| 2573 | + } else {
|
|
| 2574 | + if ($translated && $input_str != '') {
|
|
| 2575 | + $input_str = __($input_str, 'geodirectory'); |
|
| 2576 | + } |
|
| 2577 | + $label = ucfirst($input_str); |
|
| 2578 | + $value = $input_str; |
|
| 2579 | + } |
|
| 2580 | + |
|
| 2581 | + if ($label != '') {
|
|
| 2582 | + $return[] = array('label' => $label, 'value' => $value, 'optgroup' => NULL);
|
|
| 2583 | + } |
|
| 2584 | + } |
|
| 2585 | + } |
|
| 2586 | + |
|
| 2587 | + return $return; |
|
| 2588 | 2588 | } |
| 2589 | 2589 | |
| 2590 | 2590 | /** |
@@ -2599,66 +2599,66 @@ discard block |
||
| 2599 | 2599 | */ |
| 2600 | 2600 | function geodir_string_values_to_options($option_values = '', $translated = false) |
| 2601 | 2601 | {
|
| 2602 | - $options = array(); |
|
| 2603 | - if ($option_values == '') {
|
|
| 2604 | - return NULL; |
|
| 2605 | - } |
|
| 2606 | - |
|
| 2607 | - if (strpos($option_values, "{/optgroup}") !== false) {
|
|
| 2608 | - $option_values_arr = explode("{/optgroup}", $option_values);
|
|
| 2609 | - |
|
| 2610 | - foreach ($option_values_arr as $optgroup) {
|
|
| 2611 | - if (strpos($optgroup, "{optgroup}") !== false) {
|
|
| 2612 | - $optgroup_arr = explode("{optgroup}", $optgroup);
|
|
| 2613 | - |
|
| 2614 | - $count = 0; |
|
| 2615 | - foreach ($optgroup_arr as $optgroup_str) {
|
|
| 2616 | - $count++; |
|
| 2617 | - $optgroup_str = trim($optgroup_str); |
|
| 2618 | - |
|
| 2619 | - $optgroup_label = ''; |
|
| 2620 | - if (strpos($optgroup_str, "|") !== false) {
|
|
| 2621 | - $optgroup_str_arr = explode("|", $optgroup_str, 2);
|
|
| 2622 | - $optgroup_label = trim($optgroup_str_arr[0]); |
|
| 2623 | - if ($translated && $optgroup_label != '') {
|
|
| 2624 | - $optgroup_label = __($optgroup_label, 'geodirectory'); |
|
| 2625 | - } |
|
| 2626 | - $optgroup_label = ucfirst($optgroup_label); |
|
| 2627 | - $optgroup_str = $optgroup_str_arr[1]; |
|
| 2628 | - } |
|
| 2629 | - |
|
| 2630 | - $optgroup3 = geodir_string_to_options($optgroup_str, $translated); |
|
| 2631 | - |
|
| 2632 | - if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
|
|
| 2633 | - $optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
|
|
| 2634 | - $optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
|
|
| 2635 | - $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end); |
|
| 2636 | - } |
|
| 2637 | - $options = array_merge($options, $optgroup3); |
|
| 2638 | - } |
|
| 2639 | - } else {
|
|
| 2640 | - $optgroup1 = geodir_string_to_options($optgroup, $translated); |
|
| 2641 | - $options = array_merge($options, $optgroup1); |
|
| 2642 | - } |
|
| 2643 | - } |
|
| 2644 | - } else {
|
|
| 2645 | - $options = geodir_string_to_options($option_values, $translated); |
|
| 2646 | - } |
|
| 2647 | - |
|
| 2648 | - return $options; |
|
| 2602 | + $options = array(); |
|
| 2603 | + if ($option_values == '') {
|
|
| 2604 | + return NULL; |
|
| 2605 | + } |
|
| 2606 | + |
|
| 2607 | + if (strpos($option_values, "{/optgroup}") !== false) {
|
|
| 2608 | + $option_values_arr = explode("{/optgroup}", $option_values);
|
|
| 2609 | + |
|
| 2610 | + foreach ($option_values_arr as $optgroup) {
|
|
| 2611 | + if (strpos($optgroup, "{optgroup}") !== false) {
|
|
| 2612 | + $optgroup_arr = explode("{optgroup}", $optgroup);
|
|
| 2613 | + |
|
| 2614 | + $count = 0; |
|
| 2615 | + foreach ($optgroup_arr as $optgroup_str) {
|
|
| 2616 | + $count++; |
|
| 2617 | + $optgroup_str = trim($optgroup_str); |
|
| 2618 | + |
|
| 2619 | + $optgroup_label = ''; |
|
| 2620 | + if (strpos($optgroup_str, "|") !== false) {
|
|
| 2621 | + $optgroup_str_arr = explode("|", $optgroup_str, 2);
|
|
| 2622 | + $optgroup_label = trim($optgroup_str_arr[0]); |
|
| 2623 | + if ($translated && $optgroup_label != '') {
|
|
| 2624 | + $optgroup_label = __($optgroup_label, 'geodirectory'); |
|
| 2625 | + } |
|
| 2626 | + $optgroup_label = ucfirst($optgroup_label); |
|
| 2627 | + $optgroup_str = $optgroup_str_arr[1]; |
|
| 2628 | + } |
|
| 2629 | + |
|
| 2630 | + $optgroup3 = geodir_string_to_options($optgroup_str, $translated); |
|
| 2631 | + |
|
| 2632 | + if ($count > 1 && $optgroup_label != '' && !empty($optgroup3)) {
|
|
| 2633 | + $optgroup_start = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'start'));
|
|
| 2634 | + $optgroup_end = array(array('label' => $optgroup_label, 'value' => NULL, 'optgroup' => 'end'));
|
|
| 2635 | + $optgroup3 = array_merge($optgroup_start, $optgroup3, $optgroup_end); |
|
| 2636 | + } |
|
| 2637 | + $options = array_merge($options, $optgroup3); |
|
| 2638 | + } |
|
| 2639 | + } else {
|
|
| 2640 | + $optgroup1 = geodir_string_to_options($optgroup, $translated); |
|
| 2641 | + $options = array_merge($options, $optgroup1); |
|
| 2642 | + } |
|
| 2643 | + } |
|
| 2644 | + } else {
|
|
| 2645 | + $options = geodir_string_to_options($option_values, $translated); |
|
| 2646 | + } |
|
| 2647 | + |
|
| 2648 | + return $options; |
|
| 2649 | 2649 | } |
| 2650 | 2650 | |
| 2651 | 2651 | |
| 2652 | 2652 | function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
|
| 2653 | - ob_start(); |
|
| 2654 | - |
|
| 2655 | - $dt_value = ''; |
|
| 2656 | - if (isset($field_info->data_type)) {
|
|
| 2657 | - $dt_value = esc_attr($field_info->data_type); |
|
| 2658 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 2659 | - $dt_value = $cf['defaults']['data_type']; |
|
| 2660 | - } |
|
| 2661 | - ?> |
|
| 2653 | + ob_start(); |
|
| 2654 | + |
|
| 2655 | + $dt_value = ''; |
|
| 2656 | + if (isset($field_info->data_type)) {
|
|
| 2657 | + $dt_value = esc_attr($field_info->data_type); |
|
| 2658 | + }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 2659 | + $dt_value = $cf['defaults']['data_type']; |
|
| 2660 | + } |
|
| 2661 | + ?> |
|
| 2662 | 2662 | <li> |
| 2663 | 2663 | <label for="data_type"><?php _e('Field Data Type ? :', 'geodirectory'); ?></label>
|
| 2664 | 2664 | <div class="gd-cf-input-wrap"> |
@@ -2667,16 +2667,16 @@ discard block |
||
| 2667 | 2667 | onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');"> |
| 2668 | 2668 | <option |
| 2669 | 2669 | value="XVARCHAR" <?php if ($dt_value == 'VARCHAR') {
|
| 2670 | - echo 'selected="selected"'; |
|
| 2671 | - } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
|
|
| 2670 | + echo 'selected="selected"'; |
|
| 2671 | + } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
|
|
| 2672 | 2672 | <option |
| 2673 | 2673 | value="INT" <?php if ($dt_value == 'INT') {
|
| 2674 | - echo 'selected="selected"'; |
|
| 2675 | - } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
|
|
| 2674 | + echo 'selected="selected"'; |
|
| 2675 | + } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
|
|
| 2676 | 2676 | <option |
| 2677 | 2677 | value="FLOAT" <?php if ($dt_value == 'FLOAT') {
|
| 2678 | - echo 'selected="selected"'; |
|
| 2679 | - } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
|
|
| 2678 | + echo 'selected="selected"'; |
|
| 2679 | + } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
|
|
| 2680 | 2680 | </select> |
| 2681 | 2681 | <br/> <span><?php _e('Select Custom Field type', 'geodirectory'); ?></span>
|
| 2682 | 2682 | |
@@ -2684,13 +2684,13 @@ discard block |
||
| 2684 | 2684 | </li> |
| 2685 | 2685 | |
| 2686 | 2686 | <?php |
| 2687 | - $value = ''; |
|
| 2688 | - if (isset($field_info->decimal_point)) {
|
|
| 2689 | - $value = esc_attr($field_info->decimal_point); |
|
| 2690 | - }elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
|
|
| 2691 | - $value = $cf['defaults']['decimal_point']; |
|
| 2692 | - } |
|
| 2693 | - ?> |
|
| 2687 | + $value = ''; |
|
| 2688 | + if (isset($field_info->decimal_point)) {
|
|
| 2689 | + $value = esc_attr($field_info->decimal_point); |
|
| 2690 | + }elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
|
|
| 2691 | + $value = $cf['defaults']['decimal_point']; |
|
| 2692 | + } |
|
| 2693 | + ?> |
|
| 2694 | 2694 | |
| 2695 | 2695 | <li class="decimal-point-wrapper" |
| 2696 | 2696 | style="<?php echo ($dt_value == 'FLOAT') ? '' : 'display:none' ?>"> |
@@ -2699,7 +2699,7 @@ discard block |
||
| 2699 | 2699 | <select name="decimal_point" id="decimal_point"> |
| 2700 | 2700 | <option value=""><?php echo _e('Select', 'geodirectory'); ?></option>
|
| 2701 | 2701 | <?php for ($i = 1; $i <= 10; $i++) {
|
| 2702 | - $selected = $i == $value ? 'selected="selected"' : ''; ?> |
|
| 2702 | + $selected = $i == $value ? 'selected="selected"' : ''; ?> |
|
| 2703 | 2703 | <option value="<?php echo $i; ?>" <?php echo $selected; ?>><?php echo $i; ?></option> |
| 2704 | 2704 | <?php } ?> |
| 2705 | 2705 | </select> |
@@ -2708,8 +2708,8 @@ discard block |
||
| 2708 | 2708 | </li> |
| 2709 | 2709 | <?php |
| 2710 | 2710 | |
| 2711 | - $output = ob_get_clean(); |
|
| 2712 | - return $output; |
|
| 2711 | + $output = ob_get_clean(); |
|
| 2712 | + return $output; |
|
| 2713 | 2713 | } |
| 2714 | 2714 | add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
|
| 2715 | 2715 | |
@@ -2747,9 +2747,9 @@ discard block |
||
| 2747 | 2747 | |
| 2748 | 2748 | |
| 2749 | 2749 | function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
|
| 2750 | - if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
|
|
| 2751 | - ob_start(); |
|
| 2752 | - ?> |
|
| 2750 | + if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
|
|
| 2751 | + ob_start(); |
|
| 2752 | + ?> |
|
| 2753 | 2753 | <li> |
| 2754 | 2754 | <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'); ?>
|
| 2755 | 2755 | <div class="gdcf-tooltip"> |
@@ -2760,13 +2760,13 @@ discard block |
||
| 2760 | 2760 | <div class="gd-cf-input-wrap"> |
| 2761 | 2761 | |
| 2762 | 2762 | <?php |
| 2763 | - $selected = ''; |
|
| 2764 | - if (isset($field_info->extra_fields)) |
|
| 2765 | - $advanced_editor = unserialize($field_info->extra_fields); |
|
| 2763 | + $selected = ''; |
|
| 2764 | + if (isset($field_info->extra_fields)) |
|
| 2765 | + $advanced_editor = unserialize($field_info->extra_fields); |
|
| 2766 | 2766 | |
| 2767 | - if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
|
|
| 2768 | - $selected = 'checked="checked"'; |
|
| 2769 | - ?> |
|
| 2767 | + if (!empty($advanced_editor) && is_array($advanced_editor) && in_array('1', $advanced_editor))
|
|
| 2768 | + $selected = 'checked="checked"'; |
|
| 2769 | + ?> |
|
| 2770 | 2770 | |
| 2771 | 2771 | <input type="checkbox" name="advanced_editor[]" id="advanced_editor" |
| 2772 | 2772 | value="1" <?php echo $selected; ?>/> |
@@ -2775,22 +2775,22 @@ discard block |
||
| 2775 | 2775 | </li> |
| 2776 | 2776 | <?php |
| 2777 | 2777 | |
| 2778 | - $output = ob_get_clean(); |
|
| 2779 | - return $output; |
|
| 2778 | + $output = ob_get_clean(); |
|
| 2779 | + return $output; |
|
| 2780 | 2780 | } |
| 2781 | 2781 | add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
|
| 2782 | 2782 | |
| 2783 | 2783 | |
| 2784 | 2784 | function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
|
| 2785 | - ob_start(); |
|
| 2786 | - |
|
| 2787 | - $value = ''; |
|
| 2788 | - if (isset($field_info->validation_pattern)) {
|
|
| 2789 | - $value = esc_attr($field_info->validation_pattern); |
|
| 2790 | - }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
|
|
| 2791 | - $value = esc_attr($cf['defaults']['validation_pattern']); |
|
| 2792 | - } |
|
| 2793 | - ?> |
|
| 2785 | + ob_start(); |
|
| 2786 | + |
|
| 2787 | + $value = ''; |
|
| 2788 | + if (isset($field_info->validation_pattern)) {
|
|
| 2789 | + $value = esc_attr($field_info->validation_pattern); |
|
| 2790 | + }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
|
|
| 2791 | + $value = esc_attr($cf['defaults']['validation_pattern']); |
|
| 2792 | + } |
|
| 2793 | + ?> |
|
| 2794 | 2794 | <li> |
| 2795 | 2795 | <label for="validation_pattern" class="gd-cf-tooltip-wrap"> |
| 2796 | 2796 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Pattern:', 'geodirectory'); ?>
|
@@ -2804,13 +2804,13 @@ discard block |
||
| 2804 | 2804 | </div> |
| 2805 | 2805 | </li> |
| 2806 | 2806 | <?php |
| 2807 | - $value = ''; |
|
| 2808 | - if (isset($field_info->validation_msg)) {
|
|
| 2809 | - $value = esc_attr($field_info->validation_msg); |
|
| 2810 | - }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
|
|
| 2811 | - $value = esc_attr($cf['defaults']['validation_msg']); |
|
| 2812 | - } |
|
| 2813 | - ?> |
|
| 2807 | + $value = ''; |
|
| 2808 | + if (isset($field_info->validation_msg)) {
|
|
| 2809 | + $value = esc_attr($field_info->validation_msg); |
|
| 2810 | + }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
|
|
| 2811 | + $value = esc_attr($cf['defaults']['validation_msg']); |
|
| 2812 | + } |
|
| 2813 | + ?> |
|
| 2814 | 2814 | <li> |
| 2815 | 2815 | <label for="validation_msg" class="gd-cf-tooltip-wrap"> |
| 2816 | 2816 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Validation Message:', 'geodirectory'); ?>
|
@@ -2825,21 +2825,21 @@ discard block |
||
| 2825 | 2825 | </li> |
| 2826 | 2826 | <?php |
| 2827 | 2827 | |
| 2828 | - $output = ob_get_clean(); |
|
| 2829 | - return $output; |
|
| 2828 | + $output = ob_get_clean(); |
|
| 2829 | + return $output; |
|
| 2830 | 2830 | } |
| 2831 | 2831 | add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
|
| 2832 | 2832 | |
| 2833 | 2833 | |
| 2834 | 2834 | function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
|
| 2835 | - ob_start(); |
|
| 2836 | - global $post_type; |
|
| 2837 | - |
|
| 2838 | - if (!isset($field_info->post_type)) {
|
|
| 2839 | - $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2840 | - } else |
|
| 2841 | - $post_type = $field_info->post_type; |
|
| 2842 | - ?> |
|
| 2835 | + ob_start(); |
|
| 2836 | + global $post_type; |
|
| 2837 | + |
|
| 2838 | + if (!isset($field_info->post_type)) {
|
|
| 2839 | + $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2840 | + } else |
|
| 2841 | + $post_type = $field_info->post_type; |
|
| 2842 | + ?> |
|
| 2843 | 2843 | <li style="display: none;"> |
| 2844 | 2844 | <label for="htmlvar_name" class="gd-cf-tooltip-wrap"> |
| 2845 | 2845 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Select taxonomy:', 'geodirectory'); ?>
|
@@ -2850,15 +2850,15 @@ discard block |
||
| 2850 | 2850 | <div class="gd-cf-input-wrap"> |
| 2851 | 2851 | <select name="htmlvar_name" id="htmlvar_name"> |
| 2852 | 2852 | <?php |
| 2853 | - $gd_taxonomy = geodir_get_taxonomies($post_type); |
|
| 2853 | + $gd_taxonomy = geodir_get_taxonomies($post_type); |
|
| 2854 | 2854 | |
| 2855 | - foreach ($gd_taxonomy as $gd_tax) {
|
|
| 2856 | - ?> |
|
| 2855 | + foreach ($gd_taxonomy as $gd_tax) {
|
|
| 2856 | + ?> |
|
| 2857 | 2857 | <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
|
| 2858 | - echo 'selected="selected"'; |
|
| 2859 | - }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php |
|
| 2860 | - } |
|
| 2861 | - ?> |
|
| 2858 | + echo 'selected="selected"'; |
|
| 2859 | + }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php |
|
| 2860 | + } |
|
| 2861 | + ?> |
|
| 2862 | 2862 | </select> |
| 2863 | 2863 | </div> |
| 2864 | 2864 | </li> |
@@ -2874,49 +2874,49 @@ discard block |
||
| 2874 | 2874 | |
| 2875 | 2875 | <select name="cat_display_type" id="cat_display_type"> |
| 2876 | 2876 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
|
| 2877 | - echo 'selected="selected"'; |
|
| 2878 | - }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
|
|
| 2877 | + echo 'selected="selected"'; |
|
| 2878 | + }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
|
|
| 2879 | 2879 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
|
| 2880 | - echo 'selected="selected"'; |
|
| 2881 | - }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 2880 | + echo 'selected="selected"'; |
|
| 2881 | + }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 2882 | 2882 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
|
| 2883 | - echo 'selected="selected"'; |
|
| 2884 | - }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
|
|
| 2883 | + echo 'selected="selected"'; |
|
| 2884 | + }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
|
|
| 2885 | 2885 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
|
| 2886 | - echo 'selected="selected"'; |
|
| 2887 | - }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 2886 | + echo 'selected="selected"'; |
|
| 2887 | + }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 2888 | 2888 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
|
| 2889 | - echo 'selected="selected"'; |
|
| 2890 | - }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 2889 | + echo 'selected="selected"'; |
|
| 2890 | + }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 2891 | 2891 | </select> |
| 2892 | 2892 | </div> |
| 2893 | 2893 | </li> |
| 2894 | 2894 | <?php |
| 2895 | 2895 | |
| 2896 | - $output = ob_get_clean(); |
|
| 2897 | - return $output; |
|
| 2896 | + $output = ob_get_clean(); |
|
| 2897 | + return $output; |
|
| 2898 | 2898 | } |
| 2899 | 2899 | add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
|
| 2900 | 2900 | |
| 2901 | 2901 | |
| 2902 | 2902 | function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
|
| 2903 | 2903 | |
| 2904 | - ob_start(); |
|
| 2905 | - if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
|
| 2906 | - $address = unserialize($field_info->extra_fields); |
|
| 2907 | - } |
|
| 2904 | + ob_start(); |
|
| 2905 | + if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
|
| 2906 | + $address = unserialize($field_info->extra_fields); |
|
| 2907 | + } |
|
| 2908 | 2908 | |
| 2909 | - $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500); |
|
| 2910 | - ?> |
|
| 2909 | + $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500); |
|
| 2910 | + ?> |
|
| 2911 | 2911 | <?php |
| 2912 | - /** |
|
| 2913 | - * Called on the add custom fields settings page before the address field is output. |
|
| 2914 | - * |
|
| 2915 | - * @since 1.0.0 |
|
| 2916 | - * @param array $address The address settings array. |
|
| 2917 | - * @param object $field_info Extra fields info. |
|
| 2918 | - */ |
|
| 2919 | - do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
|
|
| 2912 | + /** |
|
| 2913 | + * Called on the add custom fields settings page before the address field is output. |
|
| 2914 | + * |
|
| 2915 | + * @since 1.0.0 |
|
| 2916 | + * @param array $address The address settings array. |
|
| 2917 | + * @param object $field_info Extra fields info. |
|
| 2918 | + */ |
|
| 2919 | + do_action('geodir_address_extra_admin_fields', $address, $field_info); ?>
|
|
| 2920 | 2920 | |
| 2921 | 2921 | <li> |
| 2922 | 2922 | <label for="show_zip" class="gd-cf-tooltip-wrap"> |
@@ -2929,14 +2929,14 @@ discard block |
||
| 2929 | 2929 | |
| 2930 | 2930 | <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled" value="1" |
| 2931 | 2931 | <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
|
| 2932 | - echo 'checked'; |
|
| 2933 | - } ?>/> |
|
| 2932 | + echo 'checked'; |
|
| 2933 | + } ?>/> |
|
| 2934 | 2934 | <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>
|
| 2935 | 2935 | |
| 2936 | 2936 | <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0" |
| 2937 | 2937 | <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
|
| 2938 | - echo 'checked'; |
|
| 2939 | - } ?>/> |
|
| 2938 | + echo 'checked'; |
|
| 2939 | + } ?>/> |
|
| 2940 | 2940 | <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>
|
| 2941 | 2941 | |
| 2942 | 2942 | |
@@ -2953,8 +2953,8 @@ discard block |
||
| 2953 | 2953 | <div class="gd-cf-input-wrap"> |
| 2954 | 2954 | <input type="text" name="extra[zip_lable]" id="zip_lable" |
| 2955 | 2955 | value="<?php if (isset($address['zip_lable'])) {
|
| 2956 | - echo esc_attr($address['zip_lable']); |
|
| 2957 | - }?>"/> |
|
| 2956 | + echo esc_attr($address['zip_lable']); |
|
| 2957 | + }?>"/> |
|
| 2958 | 2958 | </div> |
| 2959 | 2959 | </li> |
| 2960 | 2960 | |
@@ -2971,8 +2971,8 @@ discard block |
||
| 2971 | 2971 | <div class="gd-cf-input-wrap"> |
| 2972 | 2972 | <input type="text" name="extra[map_lable]" id="map_lable" |
| 2973 | 2973 | value="<?php if (isset($address['map_lable'])) {
|
| 2974 | - echo esc_attr($address['map_lable']); |
|
| 2975 | - }?>"/> |
|
| 2974 | + echo esc_attr($address['map_lable']); |
|
| 2975 | + }?>"/> |
|
| 2976 | 2976 | </div> |
| 2977 | 2977 | </li> |
| 2978 | 2978 | |
@@ -2987,14 +2987,14 @@ discard block |
||
| 2987 | 2987 | |
| 2988 | 2988 | <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled" value="1" |
| 2989 | 2989 | <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
|
| 2990 | - echo 'checked'; |
|
| 2991 | - } ?>/> |
|
| 2990 | + echo 'checked'; |
|
| 2991 | + } ?>/> |
|
| 2992 | 2992 | <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 2993 | 2993 | |
| 2994 | 2994 | <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0" |
| 2995 | 2995 | <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
|
| 2996 | - echo 'checked'; |
|
| 2997 | - } ?>/> |
|
| 2996 | + echo 'checked'; |
|
| 2997 | + } ?>/> |
|
| 2998 | 2998 | <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 2999 | 2999 | |
| 3000 | 3000 | </div> |
@@ -3011,14 +3011,14 @@ discard block |
||
| 3011 | 3011 | |
| 3012 | 3012 | <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled" value="1" |
| 3013 | 3013 | <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
|
| 3014 | - echo 'checked'; |
|
| 3015 | - } ?>/> |
|
| 3014 | + echo 'checked'; |
|
| 3015 | + } ?>/> |
|
| 3016 | 3016 | <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 3017 | 3017 | |
| 3018 | 3018 | <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0" |
| 3019 | 3019 | <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
|
| 3020 | - echo 'checked'; |
|
| 3021 | - } ?>/> |
|
| 3020 | + echo 'checked'; |
|
| 3021 | + } ?>/> |
|
| 3022 | 3022 | <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 3023 | 3023 | |
| 3024 | 3024 | </div> |
@@ -3035,8 +3035,8 @@ discard block |
||
| 3035 | 3035 | <div class="gd-cf-input-wrap"> |
| 3036 | 3036 | <input type="text" name="extra[mapview_lable]" id="mapview_lable" |
| 3037 | 3037 | value="<?php if (isset($address['mapview_lable'])) {
|
| 3038 | - echo esc_attr($address['mapview_lable']); |
|
| 3039 | - }?>"/> |
|
| 3038 | + echo esc_attr($address['mapview_lable']); |
|
| 3039 | + }?>"/> |
|
| 3040 | 3040 | </div> |
| 3041 | 3041 | </li> |
| 3042 | 3042 | <li> |
@@ -3050,29 +3050,29 @@ discard block |
||
| 3050 | 3050 | |
| 3051 | 3051 | <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled" value="1" |
| 3052 | 3052 | <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
|
| 3053 | - echo 'checked'; |
|
| 3054 | - } ?>/> |
|
| 3053 | + echo 'checked'; |
|
| 3054 | + } ?>/> |
|
| 3055 | 3055 | <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 3056 | 3056 | |
| 3057 | 3057 | <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0" |
| 3058 | 3058 | <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
|
| 3059 | - echo 'checked'; |
|
| 3060 | - } ?>/> |
|
| 3059 | + echo 'checked'; |
|
| 3060 | + } ?>/> |
|
| 3061 | 3061 | <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 3062 | 3062 | |
| 3063 | 3063 | </div> |
| 3064 | 3064 | </li> |
| 3065 | 3065 | <?php |
| 3066 | 3066 | |
| 3067 | - $html = ob_get_clean(); |
|
| 3068 | - return $output.$html; |
|
| 3067 | + $html = ob_get_clean(); |
|
| 3068 | + return $output.$html; |
|
| 3069 | 3069 | } |
| 3070 | 3070 | add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
|
| 3071 | 3071 | |
| 3072 | 3072 | |
| 3073 | 3073 | function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
|
| 3074 | - ob_start(); |
|
| 3075 | - ?> |
|
| 3074 | + ob_start(); |
|
| 3075 | + ?> |
|
| 3076 | 3076 | <li> |
| 3077 | 3077 | <label for="multi_display_type" class="gd-cf-tooltip-wrap"> |
| 3078 | 3078 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
|
@@ -3084,14 +3084,14 @@ discard block |
||
| 3084 | 3084 | |
| 3085 | 3085 | <select name="multi_display_type" id="multi_display_type"> |
| 3086 | 3086 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
|
| 3087 | - echo 'selected="selected"'; |
|
| 3088 | - }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 3087 | + echo 'selected="selected"'; |
|
| 3088 | + }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 3089 | 3089 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
|
| 3090 | - echo 'selected="selected"'; |
|
| 3091 | - }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 3090 | + echo 'selected="selected"'; |
|
| 3091 | + }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 3092 | 3092 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
|
| 3093 | - echo 'selected="selected"'; |
|
| 3094 | - }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 3093 | + echo 'selected="selected"'; |
|
| 3094 | + }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 3095 | 3095 | </select> |
| 3096 | 3096 | |
| 3097 | 3097 | <br/> |
@@ -3099,25 +3099,25 @@ discard block |
||
| 3099 | 3099 | </li> |
| 3100 | 3100 | <?php |
| 3101 | 3101 | |
| 3102 | - $html = ob_get_clean(); |
|
| 3103 | - return $output.$html; |
|
| 3102 | + $html = ob_get_clean(); |
|
| 3103 | + return $output.$html; |
|
| 3104 | 3104 | } |
| 3105 | 3105 | add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
|
| 3106 | 3106 | |
| 3107 | 3107 | |
| 3108 | 3108 | function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
|
| 3109 | 3109 | |
| 3110 | - ob_start(); |
|
| 3110 | + ob_start(); |
|
| 3111 | 3111 | |
| 3112 | - $value = ''; |
|
| 3113 | - if (isset($field_info->option_values)) {
|
|
| 3114 | - $value = esc_attr($field_info->option_values); |
|
| 3115 | - }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
|
|
| 3116 | - $value = esc_attr($cf['defaults']['option_values']); |
|
| 3117 | - } |
|
| 3112 | + $value = ''; |
|
| 3113 | + if (isset($field_info->option_values)) {
|
|
| 3114 | + $value = esc_attr($field_info->option_values); |
|
| 3115 | + }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
|
|
| 3116 | + $value = esc_attr($cf['defaults']['option_values']); |
|
| 3117 | + } |
|
| 3118 | 3118 | |
| 3119 | - $field_type = isset($field_info->field_type) ? $field_info->field_type : ''; |
|
| 3120 | - ?> |
|
| 3119 | + $field_type = isset($field_info->field_type) ? $field_info->field_type : ''; |
|
| 3120 | + ?> |
|
| 3121 | 3121 | <li> |
| 3122 | 3122 | <label for="option_values" class="gd-cf-tooltip-wrap"> |
| 3123 | 3123 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
|
@@ -3144,8 +3144,8 @@ discard block |
||
| 3144 | 3144 | </li> |
| 3145 | 3145 | <?php |
| 3146 | 3146 | |
| 3147 | - $html = ob_get_clean(); |
|
| 3148 | - return $output.$html; |
|
| 3147 | + $html = ob_get_clean(); |
|
| 3148 | + return $output.$html; |
|
| 3149 | 3149 | } |
| 3150 | 3150 | add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
|
| 3151 | 3151 | add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
|
@@ -3153,12 +3153,12 @@ discard block |
||
| 3153 | 3153 | |
| 3154 | 3154 | |
| 3155 | 3155 | function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
|
| 3156 | - ob_start(); |
|
| 3157 | - $extra = array(); |
|
| 3158 | - if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
|
| 3159 | - $extra = unserialize($field_info->extra_fields); |
|
| 3160 | - } |
|
| 3161 | - ?> |
|
| 3156 | + ob_start(); |
|
| 3157 | + $extra = array(); |
|
| 3158 | + if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
|
| 3159 | + $extra = unserialize($field_info->extra_fields); |
|
| 3160 | + } |
|
| 3161 | + ?> |
|
| 3162 | 3162 | <li> |
| 3163 | 3163 | <label for="date_format" class="gd-cf-tooltip-wrap"> |
| 3164 | 3164 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
|
@@ -3168,52 +3168,52 @@ discard block |
||
| 3168 | 3168 | </label> |
| 3169 | 3169 | <div class="gd-cf-input-wrap" style="overflow:inherit;"> |
| 3170 | 3170 | <?php |
| 3171 | - $date_formats = array( |
|
| 3172 | - 'm/d/Y', |
|
| 3173 | - 'd/m/Y', |
|
| 3174 | - 'Y/m/d', |
|
| 3175 | - 'm-d-Y', |
|
| 3176 | - 'd-m-Y', |
|
| 3177 | - 'Y-m-d', |
|
| 3178 | - 'F j, Y', |
|
| 3179 | - ); |
|
| 3180 | - /** |
|
| 3181 | - * Filter the custom field date format options. |
|
| 3182 | - * |
|
| 3183 | - * @since 1.6.5 |
|
| 3184 | - * @param array $date_formats The PHP date format array. |
|
| 3185 | - */ |
|
| 3186 | - $date_formats = apply_filters('geodir_date_formats',$date_formats);
|
|
| 3187 | - ?> |
|
| 3171 | + $date_formats = array( |
|
| 3172 | + 'm/d/Y', |
|
| 3173 | + 'd/m/Y', |
|
| 3174 | + 'Y/m/d', |
|
| 3175 | + 'm-d-Y', |
|
| 3176 | + 'd-m-Y', |
|
| 3177 | + 'Y-m-d', |
|
| 3178 | + 'F j, Y', |
|
| 3179 | + ); |
|
| 3180 | + /** |
|
| 3181 | + * Filter the custom field date format options. |
|
| 3182 | + * |
|
| 3183 | + * @since 1.6.5 |
|
| 3184 | + * @param array $date_formats The PHP date format array. |
|
| 3185 | + */ |
|
| 3186 | + $date_formats = apply_filters('geodir_date_formats',$date_formats);
|
|
| 3187 | + ?> |
|
| 3188 | 3188 | <select name="extra[date_format]" id="date_format"> |
| 3189 | 3189 | <?php |
| 3190 | - foreach($date_formats as $format){
|
|
| 3191 | - $selected = ''; |
|
| 3192 | - if(!empty($extra) && esc_attr($extra['date_format'])==$format){
|
|
| 3193 | - $selected = "selected='selected'"; |
|
| 3194 | - } |
|
| 3195 | - echo "<option $selected value='$format'>$format (".date_i18n( $format, time()).")</option>";
|
|
| 3196 | - } |
|
| 3197 | - ?> |
|
| 3190 | + foreach($date_formats as $format){
|
|
| 3191 | + $selected = ''; |
|
| 3192 | + if(!empty($extra) && esc_attr($extra['date_format'])==$format){
|
|
| 3193 | + $selected = "selected='selected'"; |
|
| 3194 | + } |
|
| 3195 | + echo "<option $selected value='$format'>$format (".date_i18n( $format, time()).")</option>";
|
|
| 3196 | + } |
|
| 3197 | + ?> |
|
| 3198 | 3198 | </select> |
| 3199 | 3199 | |
| 3200 | 3200 | </div> |
| 3201 | 3201 | </li> |
| 3202 | 3202 | <?php |
| 3203 | 3203 | |
| 3204 | - $html = ob_get_clean(); |
|
| 3205 | - return $output.$html; |
|
| 3204 | + $html = ob_get_clean(); |
|
| 3205 | + return $output.$html; |
|
| 3206 | 3206 | } |
| 3207 | 3207 | add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
|
| 3208 | 3208 | |
| 3209 | 3209 | |
| 3210 | 3210 | function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
|
| 3211 | - ob_start(); |
|
| 3212 | - $allowed_file_types = geodir_allowed_mime_types(); |
|
| 3211 | + ob_start(); |
|
| 3212 | + $allowed_file_types = geodir_allowed_mime_types(); |
|
| 3213 | 3213 | |
| 3214 | - $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : ''; |
|
| 3215 | - $gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
|
|
| 3216 | - ?> |
|
| 3214 | + $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : ''; |
|
| 3215 | + $gd_file_types = !empty($extra_fields) && !empty($extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : array('*');
|
|
| 3216 | + ?> |
|
| 3217 | 3217 | <li> |
| 3218 | 3218 | <label for="gd_file_types" class="gd-cf-tooltip-wrap"> |
| 3219 | 3219 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
|
@@ -3236,33 +3236,33 @@ discard block |
||
| 3236 | 3236 | </li> |
| 3237 | 3237 | <?php |
| 3238 | 3238 | |
| 3239 | - $html = ob_get_clean(); |
|
| 3240 | - return $output.$html; |
|
| 3239 | + $html = ob_get_clean(); |
|
| 3240 | + return $output.$html; |
|
| 3241 | 3241 | } |
| 3242 | 3242 | add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
|
| 3243 | 3243 | |
| 3244 | 3244 | function geodir_cfa_extra_fields_text($output,$result_str,$cf,$field_info){
|
| 3245 | - ob_start(); |
|
| 3245 | + ob_start(); |
|
| 3246 | 3246 | |
| 3247 | - $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : ''; |
|
| 3247 | + $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : ''; |
|
| 3248 | 3248 | // print_r($cf);echo '###'; |
| 3249 | 3249 | |
| 3250 | 3250 | |
| 3251 | 3251 | |
| 3252 | - $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500); |
|
| 3252 | + $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name : rand(5, 500); |
|
| 3253 | 3253 | |
| 3254 | 3254 | |
| 3255 | - $value = ''; |
|
| 3256 | - if ($extra_fields && isset($extra_fields['is_price'])) {
|
|
| 3257 | - $value = esc_attr($extra_fields['is_price']); |
|
| 3258 | - }elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
|
|
| 3259 | - $value = esc_attr($cf['defaults']['extra_fields']['is_price']); |
|
| 3260 | - } |
|
| 3255 | + $value = ''; |
|
| 3256 | + if ($extra_fields && isset($extra_fields['is_price'])) {
|
|
| 3257 | + $value = esc_attr($extra_fields['is_price']); |
|
| 3258 | + }elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
|
|
| 3259 | + $value = esc_attr($cf['defaults']['extra_fields']['is_price']); |
|
| 3260 | + } |
|
| 3261 | 3261 | |
| 3262 | - $show_price_extra = ($value==1) ? 1 : 0; |
|
| 3262 | + $show_price_extra = ($value==1) ? 1 : 0; |
|
| 3263 | 3263 | |
| 3264 | - $show_price = (isset($field_info->data_type) && ($field_info->data_type=='INT' && $field_info->data_type=='FLOAT')) ? 1 : 0; |
|
| 3265 | - ?> |
|
| 3264 | + $show_price = (isset($field_info->data_type) && ($field_info->data_type=='INT' && $field_info->data_type=='FLOAT')) ? 1 : 0; |
|
| 3265 | + ?> |
|
| 3266 | 3266 | <li class="gdcf-price-extra-set" <?php if(!$show_price){ echo "style='display:none;'";}?>>
|
| 3267 | 3267 | <label for="is_price" class="gd-cf-tooltip-wrap"> |
| 3268 | 3268 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display as price? :', 'geodirectory'); ?>
|
@@ -3274,14 +3274,14 @@ discard block |
||
| 3274 | 3274 | |
| 3275 | 3275 | <input type="radio" id="is_price_yes<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-enabled" value="1" |
| 3276 | 3276 | <?php if ($value == '1') {
|
| 3277 | - echo 'checked'; |
|
| 3278 | - } ?>/> |
|
| 3277 | + echo 'checked'; |
|
| 3278 | + } ?>/> |
|
| 3279 | 3279 | <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>
|
| 3280 | 3280 | |
| 3281 | 3281 | <input type="radio" id="is_price_no<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-disabled" value="0" |
| 3282 | 3282 | <?php if ($value == '0' || !$value) {
|
| 3283 | - echo 'checked'; |
|
| 3284 | - } ?>/> |
|
| 3283 | + echo 'checked'; |
|
| 3284 | + } ?>/> |
|
| 3285 | 3285 | <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>
|
| 3286 | 3286 | |
| 3287 | 3287 | </div> |
@@ -3289,13 +3289,13 @@ discard block |
||
| 3289 | 3289 | |
| 3290 | 3290 | <?php |
| 3291 | 3291 | |
| 3292 | - $value = ''; |
|
| 3293 | - if ($extra_fields && isset($extra_fields['thousand_separator'])) {
|
|
| 3294 | - $value = esc_attr($extra_fields['thousand_separator']); |
|
| 3295 | - }elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
|
|
| 3296 | - $value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']); |
|
| 3297 | - } |
|
| 3298 | - ?> |
|
| 3292 | + $value = ''; |
|
| 3293 | + if ($extra_fields && isset($extra_fields['thousand_separator'])) {
|
|
| 3294 | + $value = esc_attr($extra_fields['thousand_separator']); |
|
| 3295 | + }elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
|
|
| 3296 | + $value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']); |
|
| 3297 | + } |
|
| 3298 | + ?> |
|
| 3299 | 3299 | <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
| 3300 | 3300 | <label for="thousand_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Thousand separator :', 'geodirectory');?>
|
| 3301 | 3301 | <div class="gdcf-tooltip"> |
@@ -3316,13 +3316,13 @@ discard block |
||
| 3316 | 3316 | |
| 3317 | 3317 | <?php |
| 3318 | 3318 | |
| 3319 | - $value = ''; |
|
| 3320 | - if ($extra_fields && isset($extra_fields['decimal_separator'])) {
|
|
| 3321 | - $value = esc_attr($extra_fields['decimal_separator']); |
|
| 3322 | - }elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
|
|
| 3323 | - $value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']); |
|
| 3324 | - } |
|
| 3325 | - ?> |
|
| 3319 | + $value = ''; |
|
| 3320 | + if ($extra_fields && isset($extra_fields['decimal_separator'])) {
|
|
| 3321 | + $value = esc_attr($extra_fields['decimal_separator']); |
|
| 3322 | + }elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
|
|
| 3323 | + $value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']); |
|
| 3324 | + } |
|
| 3325 | + ?> |
|
| 3326 | 3326 | <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
| 3327 | 3327 | <label for="decimal_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal separator :', 'geodirectory');?>
|
| 3328 | 3328 | <div class="gdcf-tooltip"> |
@@ -3339,13 +3339,13 @@ discard block |
||
| 3339 | 3339 | |
| 3340 | 3340 | <?php |
| 3341 | 3341 | |
| 3342 | - $value = ''; |
|
| 3343 | - if ($extra_fields && isset($extra_fields['decimal_display'])) {
|
|
| 3344 | - $value = esc_attr($extra_fields['decimal_display']); |
|
| 3345 | - }elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
|
|
| 3346 | - $value = esc_attr($cf['defaults']['extra_fields']['decimal_display']); |
|
| 3347 | - } |
|
| 3348 | - ?> |
|
| 3342 | + $value = ''; |
|
| 3343 | + if ($extra_fields && isset($extra_fields['decimal_display'])) {
|
|
| 3344 | + $value = esc_attr($extra_fields['decimal_display']); |
|
| 3345 | + }elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
|
|
| 3346 | + $value = esc_attr($cf['defaults']['extra_fields']['decimal_display']); |
|
| 3347 | + } |
|
| 3348 | + ?> |
|
| 3349 | 3349 | <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
| 3350 | 3350 | <label for="decimal_display" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal display :', 'geodirectory');?>
|
| 3351 | 3351 | <div class="gdcf-tooltip"> |
@@ -3362,13 +3362,13 @@ discard block |
||
| 3362 | 3362 | |
| 3363 | 3363 | <?php |
| 3364 | 3364 | |
| 3365 | - $value = ''; |
|
| 3366 | - if ($extra_fields && isset($extra_fields['currency_symbol'])) {
|
|
| 3367 | - $value = esc_attr($extra_fields['currency_symbol']); |
|
| 3368 | - }elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
|
|
| 3369 | - $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']); |
|
| 3370 | - } |
|
| 3371 | - ?> |
|
| 3365 | + $value = ''; |
|
| 3366 | + if ($extra_fields && isset($extra_fields['currency_symbol'])) {
|
|
| 3367 | + $value = esc_attr($extra_fields['currency_symbol']); |
|
| 3368 | + }elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
|
|
| 3369 | + $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']); |
|
| 3370 | + } |
|
| 3371 | + ?> |
|
| 3372 | 3372 | <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
| 3373 | 3373 | <label for="currency_symbol" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol :', 'geodirectory');?>
|
| 3374 | 3374 | <div class="gdcf-tooltip"> |
@@ -3383,13 +3383,13 @@ discard block |
||
| 3383 | 3383 | |
| 3384 | 3384 | <?php |
| 3385 | 3385 | |
| 3386 | - $value = ''; |
|
| 3387 | - if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
|
|
| 3388 | - $value = esc_attr($extra_fields['currency_symbol_placement']); |
|
| 3389 | - }elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
|
|
| 3390 | - $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']); |
|
| 3391 | - } |
|
| 3392 | - ?> |
|
| 3386 | + $value = ''; |
|
| 3387 | + if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
|
|
| 3388 | + $value = esc_attr($extra_fields['currency_symbol_placement']); |
|
| 3389 | + }elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
|
|
| 3390 | + $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']); |
|
| 3391 | + } |
|
| 3392 | + ?> |
|
| 3393 | 3393 | <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
| 3394 | 3394 | <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');?>
|
| 3395 | 3395 | <div class="gdcf-tooltip"> |
@@ -3407,225 +3407,225 @@ discard block |
||
| 3407 | 3407 | |
| 3408 | 3408 | <?php |
| 3409 | 3409 | |
| 3410 | - $html = ob_get_clean(); |
|
| 3411 | - return $output.$html; |
|
| 3410 | + $html = ob_get_clean(); |
|
| 3411 | + return $output.$html; |
|
| 3412 | 3412 | } |
| 3413 | 3413 | add_filter('geodir_cfa_extra_fields_text','geodir_cfa_extra_fields_text',10,4);
|
| 3414 | 3414 | |
| 3415 | 3415 | function geodir_default_custom_fields($post_type='gd_place',$package_id=''){
|
| 3416 | - $fields = array(); |
|
| 3417 | - $package = ($package_id=='') ? '' : array($package_id); |
|
| 3418 | - |
|
| 3419 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3420 | - 'data_type' => 'VARCHAR', |
|
| 3421 | - 'field_type' => 'taxonomy', |
|
| 3422 | - 'admin_title' => __('Category', 'geodirectory'),
|
|
| 3423 | - 'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
|
|
| 3424 | - 'site_title' => __('Category', 'geodirectory'),
|
|
| 3425 | - 'htmlvar_name' => $post_type.'category', |
|
| 3426 | - 'default_value' => '', |
|
| 3427 | - 'is_default' => '1', |
|
| 3428 | - 'is_admin' => '1', |
|
| 3429 | - 'is_required' => '1', |
|
| 3430 | - 'show_in' => '[detail]', |
|
| 3431 | - 'show_on_pkg' => $package, |
|
| 3432 | - 'clabels' => __('Category', 'geodirectory'));
|
|
| 3433 | - |
|
| 3434 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3435 | - 'data_type' => 'VARCHAR', |
|
| 3436 | - 'field_type' => 'address', |
|
| 3437 | - 'admin_title' => __('Address', 'geodirectory'),
|
|
| 3438 | - 'admin_desc' => ADDRESS_MSG, |
|
| 3439 | - 'site_title' => __('Address', 'geodirectory'),
|
|
| 3440 | - 'htmlvar_name' => 'post', |
|
| 3441 | - 'default_value' => '', |
|
| 3442 | - 'option_values' => '', |
|
| 3443 | - 'is_default' => '1', |
|
| 3444 | - 'is_admin' => '1', |
|
| 3445 | - 'is_required' => '1', |
|
| 3446 | - 'show_in' => '[detail],[mapbubble]', |
|
| 3447 | - 'show_on_pkg' => $package, |
|
| 3448 | - 'required_msg' => __('Address fields are required', 'geodirectory'),
|
|
| 3449 | - 'clabels' => __('Address', 'geodirectory'),
|
|
| 3450 | - 'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
|
|
| 3451 | - 'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
|
|
| 3452 | - 'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
|
|
| 3453 | - 'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
|
|
| 3454 | - 'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
|
|
| 3455 | - 'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
|
|
| 3456 | - 'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden', |
|
| 3457 | - 'show_latlng' => 1)); |
|
| 3458 | - |
|
| 3459 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3460 | - 'data_type' => 'VARCHAR', |
|
| 3461 | - 'field_type' => 'text', |
|
| 3462 | - 'admin_title' => __('Time', 'geodirectory'),
|
|
| 3463 | - 'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
|
|
| 3464 | - 'site_title' => __('Time', 'geodirectory'),
|
|
| 3465 | - 'htmlvar_name' => 'timing', |
|
| 3466 | - 'default_value' => '', |
|
| 3467 | - 'option_values' => '', |
|
| 3468 | - 'is_default' => '1', |
|
| 3469 | - 'is_admin' => '1', |
|
| 3470 | - 'show_in' => '[detail],[mapbubble]', |
|
| 3471 | - 'show_on_pkg' => $package, |
|
| 3472 | - 'clabels' => __('Time', 'geodirectory'));
|
|
| 3473 | - |
|
| 3474 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3475 | - 'data_type' => 'VARCHAR', |
|
| 3476 | - 'field_type' => 'phone', |
|
| 3477 | - 'admin_title' => __('Phone', 'geodirectory'),
|
|
| 3478 | - 'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
|
|
| 3479 | - 'site_title' => __('Phone', 'geodirectory'),
|
|
| 3480 | - 'htmlvar_name' => 'contact', |
|
| 3481 | - 'default_value' => '', |
|
| 3482 | - 'option_values' => '', |
|
| 3483 | - 'is_default' => '1', |
|
| 3484 | - 'is_admin' => '1', |
|
| 3485 | - 'show_in' => '[detail],[mapbubble]', |
|
| 3486 | - 'show_on_pkg' => $package, |
|
| 3487 | - 'clabels' => __('Phone', 'geodirectory'));
|
|
| 3488 | - |
|
| 3489 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3490 | - 'data_type' => 'VARCHAR', |
|
| 3491 | - 'field_type' => 'email', |
|
| 3492 | - 'admin_title' => __('Email', 'geodirectory'),
|
|
| 3493 | - 'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
|
|
| 3494 | - 'site_title' => __('Email', 'geodirectory'),
|
|
| 3495 | - 'htmlvar_name' => 'email', |
|
| 3496 | - 'default_value' => '', |
|
| 3497 | - 'option_values' => '', |
|
| 3498 | - 'is_default' => '1', |
|
| 3499 | - 'is_admin' => '1', |
|
| 3500 | - 'show_in' => '[detail]', |
|
| 3501 | - 'show_on_pkg' => $package, |
|
| 3502 | - 'clabels' => __('Email', 'geodirectory'));
|
|
| 3503 | - |
|
| 3504 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3505 | - 'data_type' => 'VARCHAR', |
|
| 3506 | - 'field_type' => 'url', |
|
| 3507 | - 'admin_title' => __('Website', 'geodirectory'),
|
|
| 3508 | - 'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
|
|
| 3509 | - 'site_title' => __('Website', 'geodirectory'),
|
|
| 3510 | - 'htmlvar_name' => 'website', |
|
| 3511 | - 'default_value' => '', |
|
| 3512 | - 'option_values' => '', |
|
| 3513 | - 'is_default' => '1', |
|
| 3514 | - 'is_admin' => '1', |
|
| 3515 | - 'show_in' => '[detail]', |
|
| 3516 | - 'show_on_pkg' => $package, |
|
| 3517 | - 'clabels' => __('Website', 'geodirectory'));
|
|
| 3518 | - |
|
| 3519 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3520 | - 'data_type' => 'VARCHAR', |
|
| 3521 | - 'field_type' => 'url', |
|
| 3522 | - 'admin_title' => __('Twitter', 'geodirectory'),
|
|
| 3523 | - 'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
|
|
| 3524 | - 'site_title' => __('Twitter', 'geodirectory'),
|
|
| 3525 | - 'htmlvar_name' => 'twitter', |
|
| 3526 | - 'default_value' => '', |
|
| 3527 | - 'option_values' => '', |
|
| 3528 | - 'is_default' => '1', |
|
| 3529 | - 'is_admin' => '1', |
|
| 3530 | - 'show_in' => '[detail]', |
|
| 3531 | - 'show_on_pkg' => $package, |
|
| 3532 | - 'clabels' => __('Twitter', 'geodirectory'));
|
|
| 3533 | - |
|
| 3534 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3535 | - 'data_type' => 'VARCHAR', |
|
| 3536 | - 'field_type' => 'url', |
|
| 3537 | - 'admin_title' => __('Facebook', 'geodirectory'),
|
|
| 3538 | - 'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
|
|
| 3539 | - 'site_title' => __('Facebook', 'geodirectory'),
|
|
| 3540 | - 'htmlvar_name' => 'facebook', |
|
| 3541 | - 'default_value' => '', |
|
| 3542 | - 'option_values' => '', |
|
| 3543 | - 'is_default' => '1', |
|
| 3544 | - 'is_admin' => '1', |
|
| 3545 | - 'show_in' => '[detail]', |
|
| 3546 | - 'show_on_pkg' => $package, |
|
| 3547 | - 'clabels' => __('Facebook', 'geodirectory'));
|
|
| 3548 | - |
|
| 3549 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3550 | - 'data_type' => 'TEXT', |
|
| 3551 | - 'field_type' => 'textarea', |
|
| 3552 | - 'admin_title' => __('Video', 'geodirectory'),
|
|
| 3553 | - 'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
|
|
| 3554 | - 'site_title' => __('Video', 'geodirectory'),
|
|
| 3555 | - 'htmlvar_name' => 'video', |
|
| 3556 | - 'default_value' => '', |
|
| 3557 | - 'option_values' => '', |
|
| 3558 | - 'is_default' => '0', |
|
| 3559 | - 'is_admin' => '1', |
|
| 3560 | - 'show_in' => '[owntab]', |
|
| 3561 | - 'show_on_pkg' => $package, |
|
| 3562 | - 'clabels' => __('Video', 'geodirectory'));
|
|
| 3563 | - |
|
| 3564 | - $fields[] = array('listing_type' => $post_type,
|
|
| 3565 | - 'data_type' => 'TEXT', |
|
| 3566 | - 'field_type' => 'textarea', |
|
| 3567 | - 'admin_title' => __('Special Offers', 'geodirectory'),
|
|
| 3568 | - 'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
|
|
| 3569 | - 'site_title' => __('Special Offers', 'geodirectory'),
|
|
| 3570 | - 'htmlvar_name' => 'special_offers', |
|
| 3571 | - 'default_value' => '', |
|
| 3572 | - 'option_values' => '', |
|
| 3573 | - 'is_default' => '0', |
|
| 3574 | - 'is_admin' => '1', |
|
| 3575 | - 'show_in' => '[owntab]', |
|
| 3576 | - 'show_on_pkg' => $package, |
|
| 3577 | - 'clabels' => __('Special Offers', 'geodirectory'));
|
|
| 3578 | - |
|
| 3579 | - /** |
|
| 3580 | - * Filter the array of default custom fields DB table data. |
|
| 3581 | - * |
|
| 3582 | - * @since 1.6.6 |
|
| 3583 | - * @param string $fields The default custom fields as an array. |
|
| 3584 | - */ |
|
| 3585 | - $fields = apply_filters('geodir_default_custom_fields', $fields);
|
|
| 3586 | - |
|
| 3587 | - return $fields; |
|
| 3416 | + $fields = array(); |
|
| 3417 | + $package = ($package_id=='') ? '' : array($package_id); |
|
| 3418 | + |
|
| 3419 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3420 | + 'data_type' => 'VARCHAR', |
|
| 3421 | + 'field_type' => 'taxonomy', |
|
| 3422 | + 'admin_title' => __('Category', 'geodirectory'),
|
|
| 3423 | + 'admin_desc' => __('SELECT listing category FROM here. SELECT at least one CATEGORY', 'geodirectory'),
|
|
| 3424 | + 'site_title' => __('Category', 'geodirectory'),
|
|
| 3425 | + 'htmlvar_name' => $post_type.'category', |
|
| 3426 | + 'default_value' => '', |
|
| 3427 | + 'is_default' => '1', |
|
| 3428 | + 'is_admin' => '1', |
|
| 3429 | + 'is_required' => '1', |
|
| 3430 | + 'show_in' => '[detail]', |
|
| 3431 | + 'show_on_pkg' => $package, |
|
| 3432 | + 'clabels' => __('Category', 'geodirectory'));
|
|
| 3433 | + |
|
| 3434 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3435 | + 'data_type' => 'VARCHAR', |
|
| 3436 | + 'field_type' => 'address', |
|
| 3437 | + 'admin_title' => __('Address', 'geodirectory'),
|
|
| 3438 | + 'admin_desc' => ADDRESS_MSG, |
|
| 3439 | + 'site_title' => __('Address', 'geodirectory'),
|
|
| 3440 | + 'htmlvar_name' => 'post', |
|
| 3441 | + 'default_value' => '', |
|
| 3442 | + 'option_values' => '', |
|
| 3443 | + 'is_default' => '1', |
|
| 3444 | + 'is_admin' => '1', |
|
| 3445 | + 'is_required' => '1', |
|
| 3446 | + 'show_in' => '[detail],[mapbubble]', |
|
| 3447 | + 'show_on_pkg' => $package, |
|
| 3448 | + 'required_msg' => __('Address fields are required', 'geodirectory'),
|
|
| 3449 | + 'clabels' => __('Address', 'geodirectory'),
|
|
| 3450 | + 'extra' => array('show_city' => 1, 'city_lable' => __('City', 'geodirectory'),
|
|
| 3451 | + 'show_region' => 1, 'region_lable' => __('Region', 'geodirectory'),
|
|
| 3452 | + 'show_country' => 1, 'country_lable' => __('Country', 'geodirectory'),
|
|
| 3453 | + 'show_zip' => 1, 'zip_lable' => __('Zip/Post Code', 'geodirectory'),
|
|
| 3454 | + 'show_map' => 1, 'map_lable' => __('Set Address On Map', 'geodirectory'),
|
|
| 3455 | + 'show_mapview' => 1, 'mapview_lable' => __('Select Map View', 'geodirectory'),
|
|
| 3456 | + 'show_mapzoom' => 1, 'mapzoom_lable' => 'hidden', |
|
| 3457 | + 'show_latlng' => 1)); |
|
| 3458 | + |
|
| 3459 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3460 | + 'data_type' => 'VARCHAR', |
|
| 3461 | + 'field_type' => 'text', |
|
| 3462 | + 'admin_title' => __('Time', 'geodirectory'),
|
|
| 3463 | + 'admin_desc' => __('Enter Business or Listing Timing Information.<br/>eg. : 10.00 am to 6 pm every day', 'geodirectory'),
|
|
| 3464 | + 'site_title' => __('Time', 'geodirectory'),
|
|
| 3465 | + 'htmlvar_name' => 'timing', |
|
| 3466 | + 'default_value' => '', |
|
| 3467 | + 'option_values' => '', |
|
| 3468 | + 'is_default' => '1', |
|
| 3469 | + 'is_admin' => '1', |
|
| 3470 | + 'show_in' => '[detail],[mapbubble]', |
|
| 3471 | + 'show_on_pkg' => $package, |
|
| 3472 | + 'clabels' => __('Time', 'geodirectory'));
|
|
| 3473 | + |
|
| 3474 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3475 | + 'data_type' => 'VARCHAR', |
|
| 3476 | + 'field_type' => 'phone', |
|
| 3477 | + 'admin_title' => __('Phone', 'geodirectory'),
|
|
| 3478 | + 'admin_desc' => __('You can enter phone number,cell phone number etc.', 'geodirectory'),
|
|
| 3479 | + 'site_title' => __('Phone', 'geodirectory'),
|
|
| 3480 | + 'htmlvar_name' => 'contact', |
|
| 3481 | + 'default_value' => '', |
|
| 3482 | + 'option_values' => '', |
|
| 3483 | + 'is_default' => '1', |
|
| 3484 | + 'is_admin' => '1', |
|
| 3485 | + 'show_in' => '[detail],[mapbubble]', |
|
| 3486 | + 'show_on_pkg' => $package, |
|
| 3487 | + 'clabels' => __('Phone', 'geodirectory'));
|
|
| 3488 | + |
|
| 3489 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3490 | + 'data_type' => 'VARCHAR', |
|
| 3491 | + 'field_type' => 'email', |
|
| 3492 | + 'admin_title' => __('Email', 'geodirectory'),
|
|
| 3493 | + 'admin_desc' => __('You can enter your business or listing email.', 'geodirectory'),
|
|
| 3494 | + 'site_title' => __('Email', 'geodirectory'),
|
|
| 3495 | + 'htmlvar_name' => 'email', |
|
| 3496 | + 'default_value' => '', |
|
| 3497 | + 'option_values' => '', |
|
| 3498 | + 'is_default' => '1', |
|
| 3499 | + 'is_admin' => '1', |
|
| 3500 | + 'show_in' => '[detail]', |
|
| 3501 | + 'show_on_pkg' => $package, |
|
| 3502 | + 'clabels' => __('Email', 'geodirectory'));
|
|
| 3503 | + |
|
| 3504 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3505 | + 'data_type' => 'VARCHAR', |
|
| 3506 | + 'field_type' => 'url', |
|
| 3507 | + 'admin_title' => __('Website', 'geodirectory'),
|
|
| 3508 | + 'admin_desc' => __('You can enter your business or listing website.', 'geodirectory'),
|
|
| 3509 | + 'site_title' => __('Website', 'geodirectory'),
|
|
| 3510 | + 'htmlvar_name' => 'website', |
|
| 3511 | + 'default_value' => '', |
|
| 3512 | + 'option_values' => '', |
|
| 3513 | + 'is_default' => '1', |
|
| 3514 | + 'is_admin' => '1', |
|
| 3515 | + 'show_in' => '[detail]', |
|
| 3516 | + 'show_on_pkg' => $package, |
|
| 3517 | + 'clabels' => __('Website', 'geodirectory'));
|
|
| 3518 | + |
|
| 3519 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3520 | + 'data_type' => 'VARCHAR', |
|
| 3521 | + 'field_type' => 'url', |
|
| 3522 | + 'admin_title' => __('Twitter', 'geodirectory'),
|
|
| 3523 | + 'admin_desc' => __('You can enter your business or listing twitter url.', 'geodirectory'),
|
|
| 3524 | + 'site_title' => __('Twitter', 'geodirectory'),
|
|
| 3525 | + 'htmlvar_name' => 'twitter', |
|
| 3526 | + 'default_value' => '', |
|
| 3527 | + 'option_values' => '', |
|
| 3528 | + 'is_default' => '1', |
|
| 3529 | + 'is_admin' => '1', |
|
| 3530 | + 'show_in' => '[detail]', |
|
| 3531 | + 'show_on_pkg' => $package, |
|
| 3532 | + 'clabels' => __('Twitter', 'geodirectory'));
|
|
| 3533 | + |
|
| 3534 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3535 | + 'data_type' => 'VARCHAR', |
|
| 3536 | + 'field_type' => 'url', |
|
| 3537 | + 'admin_title' => __('Facebook', 'geodirectory'),
|
|
| 3538 | + 'admin_desc' => __('You can enter your business or listing facebook url.', 'geodirectory'),
|
|
| 3539 | + 'site_title' => __('Facebook', 'geodirectory'),
|
|
| 3540 | + 'htmlvar_name' => 'facebook', |
|
| 3541 | + 'default_value' => '', |
|
| 3542 | + 'option_values' => '', |
|
| 3543 | + 'is_default' => '1', |
|
| 3544 | + 'is_admin' => '1', |
|
| 3545 | + 'show_in' => '[detail]', |
|
| 3546 | + 'show_on_pkg' => $package, |
|
| 3547 | + 'clabels' => __('Facebook', 'geodirectory'));
|
|
| 3548 | + |
|
| 3549 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3550 | + 'data_type' => 'TEXT', |
|
| 3551 | + 'field_type' => 'textarea', |
|
| 3552 | + 'admin_title' => __('Video', 'geodirectory'),
|
|
| 3553 | + 'admin_desc' => __('Add video code here, YouTube etc.', 'geodirectory'),
|
|
| 3554 | + 'site_title' => __('Video', 'geodirectory'),
|
|
| 3555 | + 'htmlvar_name' => 'video', |
|
| 3556 | + 'default_value' => '', |
|
| 3557 | + 'option_values' => '', |
|
| 3558 | + 'is_default' => '0', |
|
| 3559 | + 'is_admin' => '1', |
|
| 3560 | + 'show_in' => '[owntab]', |
|
| 3561 | + 'show_on_pkg' => $package, |
|
| 3562 | + 'clabels' => __('Video', 'geodirectory'));
|
|
| 3563 | + |
|
| 3564 | + $fields[] = array('listing_type' => $post_type,
|
|
| 3565 | + 'data_type' => 'TEXT', |
|
| 3566 | + 'field_type' => 'textarea', |
|
| 3567 | + 'admin_title' => __('Special Offers', 'geodirectory'),
|
|
| 3568 | + 'admin_desc' => __('Note: List out any special offers (optional)', 'geodirectory'),
|
|
| 3569 | + 'site_title' => __('Special Offers', 'geodirectory'),
|
|
| 3570 | + 'htmlvar_name' => 'special_offers', |
|
| 3571 | + 'default_value' => '', |
|
| 3572 | + 'option_values' => '', |
|
| 3573 | + 'is_default' => '0', |
|
| 3574 | + 'is_admin' => '1', |
|
| 3575 | + 'show_in' => '[owntab]', |
|
| 3576 | + 'show_on_pkg' => $package, |
|
| 3577 | + 'clabels' => __('Special Offers', 'geodirectory'));
|
|
| 3578 | + |
|
| 3579 | + /** |
|
| 3580 | + * Filter the array of default custom fields DB table data. |
|
| 3581 | + * |
|
| 3582 | + * @since 1.6.6 |
|
| 3583 | + * @param string $fields The default custom fields as an array. |
|
| 3584 | + */ |
|
| 3585 | + $fields = apply_filters('geodir_default_custom_fields', $fields);
|
|
| 3586 | + |
|
| 3587 | + return $fields; |
|
| 3588 | 3588 | } |
| 3589 | 3589 | |
| 3590 | 3590 | function geodir_currency_format_number($number='',$cf=''){
|
| 3591 | 3591 | |
| 3592 | - $cs = isset($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : ''; |
|
| 3592 | + $cs = isset($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : ''; |
|
| 3593 | 3593 | |
| 3594 | - $symbol = isset($cs['currency_symbol']) ? $cs['currency_symbol'] : '$'; |
|
| 3595 | - $decimals = isset($cf['decimal_point']) && $cf['decimal_point'] ? $cf['decimal_point'] : 2; |
|
| 3596 | - $decimal_display = isset($cf['decimal_display']) && $cf['decimal_display'] ? $cf['decimal_display'] : 'if'; |
|
| 3597 | - $decimalpoint = '.'; |
|
| 3594 | + $symbol = isset($cs['currency_symbol']) ? $cs['currency_symbol'] : '$'; |
|
| 3595 | + $decimals = isset($cf['decimal_point']) && $cf['decimal_point'] ? $cf['decimal_point'] : 2; |
|
| 3596 | + $decimal_display = isset($cf['decimal_display']) && $cf['decimal_display'] ? $cf['decimal_display'] : 'if'; |
|
| 3597 | + $decimalpoint = '.'; |
|
| 3598 | 3598 | |
| 3599 | - if(isset($cs['decimal_separator']) && $cs['decimal_separator']=='comma'){
|
|
| 3600 | - $decimalpoint = ','; |
|
| 3601 | - } |
|
| 3599 | + if(isset($cs['decimal_separator']) && $cs['decimal_separator']=='comma'){
|
|
| 3600 | + $decimalpoint = ','; |
|
| 3601 | + } |
|
| 3602 | 3602 | |
| 3603 | - $separator = ','; |
|
| 3603 | + $separator = ','; |
|
| 3604 | 3604 | |
| 3605 | - if(isset($cs['thousand_separator'])){
|
|
| 3606 | - if($cs['thousand_separator']=='comma'){$separator = ',';}
|
|
| 3607 | - if($cs['thousand_separator']=='slash'){$separator = '\\';}
|
|
| 3608 | - if($cs['thousand_separator']=='period'){$separator = '.';}
|
|
| 3609 | - if($cs['thousand_separator']=='space'){$separator = ' ';}
|
|
| 3610 | - if($cs['thousand_separator']=='none'){$separator = '';}
|
|
| 3611 | - } |
|
| 3605 | + if(isset($cs['thousand_separator'])){
|
|
| 3606 | + if($cs['thousand_separator']=='comma'){$separator = ',';}
|
|
| 3607 | + if($cs['thousand_separator']=='slash'){$separator = '\\';}
|
|
| 3608 | + if($cs['thousand_separator']=='period'){$separator = '.';}
|
|
| 3609 | + if($cs['thousand_separator']=='space'){$separator = ' ';}
|
|
| 3610 | + if($cs['thousand_separator']=='none'){$separator = '';}
|
|
| 3611 | + } |
|
| 3612 | 3612 | |
| 3613 | - $currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left'; |
|
| 3613 | + $currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left'; |
|
| 3614 | 3614 | |
| 3615 | - if($decimals>0 && $decimal_display=='if'){
|
|
| 3616 | - if(is_int($number) || floor( $number ) == $number) |
|
| 3617 | - $decimals = 0; |
|
| 3618 | - } |
|
| 3615 | + if($decimals>0 && $decimal_display=='if'){
|
|
| 3616 | + if(is_int($number) || floor( $number ) == $number) |
|
| 3617 | + $decimals = 0; |
|
| 3618 | + } |
|
| 3619 | 3619 | |
| 3620 | - $number = number_format($number,$decimals,$decimalpoint,$separator); |
|
| 3620 | + $number = number_format($number,$decimals,$decimalpoint,$separator); |
|
| 3621 | 3621 | |
| 3622 | 3622 | |
| 3623 | 3623 | |
| 3624 | - if($currency_symbol_placement=='left'){
|
|
| 3625 | - $number = $symbol . $number; |
|
| 3626 | - }else{
|
|
| 3627 | - $number = $number . $symbol; |
|
| 3628 | - } |
|
| 3624 | + if($currency_symbol_placement=='left'){
|
|
| 3625 | + $number = $symbol . $number; |
|
| 3626 | + }else{
|
|
| 3627 | + $number = $number . $symbol; |
|
| 3628 | + } |
|
| 3629 | 3629 | |
| 3630 | 3630 | |
| 3631 | 3631 | 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']; |
@@ -1252,7 +1252,7 @@ discard block |
||
| 1252 | 1252 | $is_default = $val['is_default']; |
| 1253 | 1253 | |
| 1254 | 1254 | /* field available to site admin only for edit */ |
| 1255 | - $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false; |
|
| 1255 | + $for_admin_use = isset($val['for_admin_use']) && (int) $val['for_admin_use'] == 1 ? true : false; |
|
| 1256 | 1256 | if ($for_admin_use && !is_super_admin()) {
|
| 1257 | 1257 | continue; |
| 1258 | 1258 | } |
@@ -1277,11 +1277,11 @@ discard block |
||
| 1277 | 1277 | * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
| 1278 | 1278 | * @see 'geodir_after_custom_form_field_$name' |
| 1279 | 1279 | */ |
| 1280 | - do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1280 | + do_action('geodir_before_custom_form_field_'.$name, $listing_type, $package_id, $val);
|
|
| 1281 | 1281 | |
| 1282 | 1282 | |
| 1283 | 1283 | $custom_field = $val; |
| 1284 | - $html =''; |
|
| 1284 | + $html = ''; |
|
| 1285 | 1285 | /** |
| 1286 | 1286 | * Filter the output for custom fields. |
| 1287 | 1287 | * |
@@ -1290,7 +1290,7 @@ discard block |
||
| 1290 | 1290 | * @param string $html The html to be filtered (blank). |
| 1291 | 1291 | * @param array $custom_field The custom field array values. |
| 1292 | 1292 | */ |
| 1293 | - echo apply_filters("geodir_custom_field_input_{$type}",$html,$custom_field);
|
|
| 1293 | + echo apply_filters("geodir_custom_field_input_{$type}", $html, $custom_field);
|
|
| 1294 | 1294 | |
| 1295 | 1295 | |
| 1296 | 1296 | |
@@ -1305,7 +1305,7 @@ discard block |
||
| 1305 | 1305 | * @param array $val The settings array for the field. {@see geodir_custom_field_save()}.
|
| 1306 | 1306 | * @see 'geodir_before_custom_form_field_$name' |
| 1307 | 1307 | */ |
| 1308 | - do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val);
|
|
| 1308 | + do_action('geodir_after_custom_form_field_'.$name, $listing_type, $package_id, $val);
|
|
| 1309 | 1309 | |
| 1310 | 1310 | } |
| 1311 | 1311 | |
@@ -1331,7 +1331,7 @@ discard block |
||
| 1331 | 1331 | |
| 1332 | 1332 | $filter = $wpdb->get_row( |
| 1333 | 1333 | $wpdb->prepare( |
| 1334 | - "SELECT * FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND " . $key . "='" . $value . "'", |
|
| 1334 | + "SELECT * FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND ".$key."='".$value."'", |
|
| 1335 | 1335 | array($geodir_post_type) |
| 1336 | 1336 | ) |
| 1337 | 1337 | ); |
@@ -1346,14 +1346,14 @@ discard block |
||
| 1346 | 1346 | } |
| 1347 | 1347 | |
| 1348 | 1348 | |
| 1349 | -function geodir_field_icon_proccess($cf){
|
|
| 1349 | +function geodir_field_icon_proccess($cf) {
|
|
| 1350 | 1350 | |
| 1351 | 1351 | |
| 1352 | 1352 | if (strpos($cf['field_icon'], 'http') !== false) {
|
| 1353 | - $field_icon = ' background: url(' . $cf['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 1353 | + $field_icon = ' background: url('.$cf['field_icon'].') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
|
|
| 1354 | 1354 | } elseif (strpos($cf['field_icon'], 'fa fa-') !== false) {
|
| 1355 | - $field_icon = '<i class="' . $cf['field_icon'] . '"></i>'; |
|
| 1356 | - }else{
|
|
| 1355 | + $field_icon = '<i class="'.$cf['field_icon'].'"></i>'; |
|
| 1356 | + } else {
|
|
| 1357 | 1357 | $field_icon = $cf['field_icon']; |
| 1358 | 1358 | } |
| 1359 | 1359 | |
@@ -1403,7 +1403,7 @@ discard block |
||
| 1403 | 1403 | $field_icon = geodir_field_icon_proccess($type); |
| 1404 | 1404 | $filed_type = $type['type']; |
| 1405 | 1405 | $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : ''; |
| 1406 | - if($html_var=='post'){$html_var='post_address';}
|
|
| 1406 | + if ($html_var == 'post') {$html_var = 'post_address'; }
|
|
| 1407 | 1407 | |
| 1408 | 1408 | /** |
| 1409 | 1409 | * Filter the output for custom fields. |
@@ -1414,7 +1414,7 @@ discard block |
||
| 1414 | 1414 | * @param string $fields_location The location the field is to be show. |
| 1415 | 1415 | * @param array $type The array of field values. |
| 1416 | 1416 | */ |
| 1417 | - $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type);
|
|
| 1417 | + $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type);
|
|
| 1418 | 1418 | |
| 1419 | 1419 | $variables_array = array(); |
| 1420 | 1420 | |
@@ -1477,7 +1477,7 @@ discard block |
||
| 1477 | 1477 | * @param string $fields_location The location the fields are being output. |
| 1478 | 1478 | * @since 1.6.9 |
| 1479 | 1479 | */ |
| 1480 | - return apply_filters('geodir_show_listing_info',$html,$fields_location);
|
|
| 1480 | + return apply_filters('geodir_show_listing_info', $html, $fields_location);
|
|
| 1481 | 1481 | |
| 1482 | 1482 | } |
| 1483 | 1483 | } |
@@ -1552,7 +1552,7 @@ discard block |
||
| 1552 | 1552 | |
| 1553 | 1553 | $post_type = get_post_type($post_id); |
| 1554 | 1554 | //echo $field_id; exit; |
| 1555 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1555 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1556 | 1556 | |
| 1557 | 1557 | $postcurr_images = array(); |
| 1558 | 1558 | $postcurr_images = geodir_get_post_meta($post_id, $field_id, true); |
@@ -1571,13 +1571,13 @@ discard block |
||
| 1571 | 1571 | $geodir_uploadurl = $uploads['url']; |
| 1572 | 1572 | $sub_dir = $uploads['subdir']; |
| 1573 | 1573 | |
| 1574 | - $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'] : '';
|
|
| 1574 | + $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'] : '';
|
|
| 1575 | 1575 | |
| 1576 | 1576 | for ($m = 0; $m < count($post_image); $m++) {
|
| 1577 | 1577 | |
| 1578 | 1578 | /* --------- start ------- */ |
| 1579 | 1579 | |
| 1580 | - 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)))) {
|
|
| 1580 | + 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)))) {
|
|
| 1581 | 1581 | |
| 1582 | 1582 | |
| 1583 | 1583 | $curr_img_url = $post_image[$m]; |
@@ -1603,24 +1603,24 @@ discard block |
||
| 1603 | 1603 | //$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 | 1604 | |
| 1605 | 1605 | if (!function_exists('wp_handle_upload'))
|
| 1606 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
| 1606 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
| 1607 | 1607 | |
| 1608 | 1608 | if (!is_dir($geodir_uploadpath)) |
| 1609 | 1609 | mkdir($geodir_uploadpath); |
| 1610 | 1610 | |
| 1611 | - $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1]; |
|
| 1611 | + $new_name = $post_id.'_'.$field_id.'_'.$img_name_arr[0].'.'.$img_name_arr[1]; |
|
| 1612 | 1612 | $explode_sub_dir = explode("/", $sub_dir);
|
| 1613 | 1613 | if ($curr_img_dir == end($explode_sub_dir)) {
|
| 1614 | - $img_path = $geodir_uploadpath . '/' . $filename; |
|
| 1615 | - $img_url = $geodir_uploadurl . '/' . $filename; |
|
| 1614 | + $img_path = $geodir_uploadpath.'/'.$filename; |
|
| 1615 | + $img_url = $geodir_uploadurl.'/'.$filename; |
|
| 1616 | 1616 | } else {
|
| 1617 | - $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1618 | - $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename; |
|
| 1617 | + $img_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1618 | + $img_url = $uploads['url'].'/temp_'.$current_user->data->ID.'/'.$filename; |
|
| 1619 | 1619 | } |
| 1620 | 1620 | |
| 1621 | 1621 | $uploaded_file = ''; |
| 1622 | 1622 | if (file_exists($img_path)) |
| 1623 | - $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name); |
|
| 1623 | + $uploaded_file = copy($img_path, $geodir_uploadpath.'/'.$new_name); |
|
| 1624 | 1624 | |
| 1625 | 1625 | if ($curr_img_dir != $geodir_uploaddir) {
|
| 1626 | 1626 | if (file_exists($img_path)) |
@@ -1628,7 +1628,7 @@ discard block |
||
| 1628 | 1628 | } |
| 1629 | 1629 | |
| 1630 | 1630 | if (!empty($uploaded_file)) |
| 1631 | - $file_urls = $geodir_uploadurl . '/' . $new_name; |
|
| 1631 | + $file_urls = $geodir_uploadurl.'/'.$new_name; |
|
| 1632 | 1632 | |
| 1633 | 1633 | } else {
|
| 1634 | 1634 | $file_urls = $post_image[$m]; |
@@ -1642,8 +1642,8 @@ discard block |
||
| 1642 | 1642 | if (!empty($postcurr_images)) {
|
| 1643 | 1643 | |
| 1644 | 1644 | if ($file_urls != $postcurr_images) {
|
| 1645 | - $invalid_files[] = (object)array('src' => $postcurr_images);
|
|
| 1646 | - $invalid_files = (object)$invalid_files; |
|
| 1645 | + $invalid_files[] = (object) array('src' => $postcurr_images);
|
|
| 1646 | + $invalid_files = (object) $invalid_files; |
|
| 1647 | 1647 | } |
| 1648 | 1648 | } |
| 1649 | 1649 | |
@@ -1695,9 +1695,9 @@ discard block |
||
| 1695 | 1695 | function geodir_upload_dir($upload) |
| 1696 | 1696 | {
|
| 1697 | 1697 | global $current_user; |
| 1698 | - $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID; |
|
| 1699 | - $upload['path'] = $upload['basedir'] . $upload['subdir']; |
|
| 1700 | - $upload['url'] = $upload['baseurl'] . $upload['subdir']; |
|
| 1698 | + $upload['subdir'] = $upload['subdir'].'/temp_'.$current_user->data->ID; |
|
| 1699 | + $upload['path'] = $upload['basedir'].$upload['subdir']; |
|
| 1700 | + $upload['url'] = $upload['baseurl'].$upload['subdir']; |
|
| 1701 | 1701 | return $upload; |
| 1702 | 1702 | } |
| 1703 | 1703 | |
@@ -1712,20 +1712,20 @@ discard block |
||
| 1712 | 1712 | // check ajax noonce |
| 1713 | 1713 | $imgid = $_POST["imgid"]; |
| 1714 | 1714 | |
| 1715 | - check_ajax_referer($imgid . 'pluploadan'); |
|
| 1715 | + check_ajax_referer($imgid.'pluploadan'); |
|
| 1716 | 1716 | |
| 1717 | 1717 | // handle custom file uploaddir |
| 1718 | 1718 | add_filter('upload_dir', 'geodir_upload_dir');
|
| 1719 | 1719 | |
| 1720 | 1720 | // change file orinetation if needed |
| 1721 | - $fixed_file = geodir_exif($_FILES[$imgid . 'async-upload']); |
|
| 1721 | + $fixed_file = geodir_exif($_FILES[$imgid.'async-upload']); |
|
| 1722 | 1722 | |
| 1723 | 1723 | // handle file upload |
| 1724 | 1724 | $status = wp_handle_upload($fixed_file, array('test_form' => true, 'action' => 'plupload_action'));
|
| 1725 | 1725 | // remove handle custom file uploaddir |
| 1726 | 1726 | remove_filter('upload_dir', 'geodir_upload_dir');
|
| 1727 | 1727 | |
| 1728 | - if(!isset($status['url']) && isset($status['error'])){
|
|
| 1728 | + if (!isset($status['url']) && isset($status['error'])) {
|
|
| 1729 | 1729 | print_r($status); |
| 1730 | 1730 | } |
| 1731 | 1731 | |
@@ -1755,9 +1755,9 @@ discard block |
||
| 1755 | 1755 | |
| 1756 | 1756 | $post_type = get_post_type($post_id); |
| 1757 | 1757 | |
| 1758 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1758 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1759 | 1759 | |
| 1760 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1760 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_video FROM ".$table." WHERE post_id=%d", array($post_id)));
|
|
| 1761 | 1761 | |
| 1762 | 1762 | if ($results) {
|
| 1763 | 1763 | return $results[0]->geodir_video; |
@@ -1781,9 +1781,9 @@ discard block |
||
| 1781 | 1781 | |
| 1782 | 1782 | $post_type = get_post_type($post_id); |
| 1783 | 1783 | |
| 1784 | - $table = $plugin_prefix . $post_type . '_detail'; |
|
| 1784 | + $table = $plugin_prefix.$post_type.'_detail'; |
|
| 1785 | 1785 | |
| 1786 | - $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM " . $table . " WHERE post_id=%d", array($post_id)));
|
|
| 1786 | + $results = $wpdb->get_results($wpdb->prepare("SELECT geodir_special_offers FROM ".$table." WHERE post_id=%d", array($post_id)));
|
|
| 1787 | 1787 | |
| 1788 | 1788 | if ($results) {
|
| 1789 | 1789 | return $results[0]->geodir_special_offers; |
@@ -1801,12 +1801,12 @@ discard block |
||
| 1801 | 1801 | */ |
| 1802 | 1802 | function geodir_max_upload_size() |
| 1803 | 1803 | {
|
| 1804 | - $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
|
|
| 1804 | + $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
|
|
| 1805 | 1805 | |
| 1806 | 1806 | if ($max_filesize > 0 && $max_filesize < 1) {
|
| 1807 | - $max_filesize = (int)($max_filesize * 1024) . 'kb'; |
|
| 1807 | + $max_filesize = (int) ($max_filesize * 1024).'kb'; |
|
| 1808 | 1808 | } else {
|
| 1809 | - $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb'; |
|
| 1809 | + $max_filesize = $max_filesize > 0 ? $max_filesize.'mb' : '2mb'; |
|
| 1810 | 1810 | } |
| 1811 | 1811 | /** Filter documented in geodirectory-functions/general_functions.php **/ |
| 1812 | 1812 | return apply_filters('geodir_default_image_upload_size_limit', $max_filesize);
|
@@ -1838,7 +1838,7 @@ discard block |
||
| 1838 | 1838 | |
| 1839 | 1839 | $custom_fields = $wpdb->get_results( |
| 1840 | 1840 | $wpdb->prepare( |
| 1841 | - "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", |
|
| 1841 | + "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", |
|
| 1842 | 1842 | array($post_type) |
| 1843 | 1843 | ), 'ARRAY_A' |
| 1844 | 1844 | ); |
@@ -1965,7 +1965,7 @@ discard block |
||
| 1965 | 1965 | |
| 1966 | 1966 | $post_meta_info = $wpdb->query( |
| 1967 | 1967 | $wpdb->prepare( |
| 1968 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 1968 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 1969 | 1969 | sort_order=%d |
| 1970 | 1970 | where id= %d", |
| 1971 | 1971 | array($count, $cf) |
@@ -2047,14 +2047,14 @@ discard block |
||
| 2047 | 2047 | |
| 2048 | 2048 | $check_html_variable = $wpdb->get_var( |
| 2049 | 2049 | $wpdb->prepare( |
| 2050 | - "select htmlvar_name from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 2050 | + "select htmlvar_name from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s and field_type=%s ", |
|
| 2051 | 2051 | array($cehhtmlvar_name, $post_type, $field_type) |
| 2052 | 2052 | ) |
| 2053 | 2053 | ); |
| 2054 | 2054 | |
| 2055 | 2055 | if ($is_default == 1) {
|
| 2056 | 2056 | |
| 2057 | - $wpdb->query($wpdb->prepare("update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 2057 | + $wpdb->query($wpdb->prepare("update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set is_default='0', default_order='' where post_type = %s", array($post_type)));
|
|
| 2058 | 2058 | |
| 2059 | 2059 | } |
| 2060 | 2060 | |
@@ -2065,7 +2065,7 @@ discard block |
||
| 2065 | 2065 | |
| 2066 | 2066 | $wpdb->prepare( |
| 2067 | 2067 | |
| 2068 | - "insert into " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2068 | + "insert into ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 2069 | 2069 | post_type = %s, |
| 2070 | 2070 | data_type = %s, |
| 2071 | 2071 | field_type = %s, |
@@ -2096,7 +2096,7 @@ discard block |
||
| 2096 | 2096 | |
| 2097 | 2097 | $wpdb->prepare( |
| 2098 | 2098 | |
| 2099 | - "update " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " set |
|
| 2099 | + "update ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." set |
|
| 2100 | 2100 | post_type = %s, |
| 2101 | 2101 | data_type = %s, |
| 2102 | 2102 | field_type = %s, |
@@ -2122,7 +2122,7 @@ discard block |
||
| 2122 | 2122 | } |
| 2123 | 2123 | |
| 2124 | 2124 | |
| 2125 | - return (int)$lastid; |
|
| 2125 | + return (int) $lastid; |
|
| 2126 | 2126 | |
| 2127 | 2127 | } |
| 2128 | 2128 | } |
@@ -2145,7 +2145,7 @@ discard block |
||
| 2145 | 2145 | if ($field_id != '') {
|
| 2146 | 2146 | $cf = trim($field_id, '_'); |
| 2147 | 2147 | |
| 2148 | - $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where id= %d ", array($cf)));
|
|
| 2148 | + $wpdb->query($wpdb->prepare("delete from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where id= %d ", array($cf)));
|
|
| 2149 | 2149 | |
| 2150 | 2150 | return $field_id; |
| 2151 | 2151 | |
@@ -2168,12 +2168,12 @@ discard block |
||
| 2168 | 2168 | * @param string $field_ins_upd When set to "submit" displays form. |
| 2169 | 2169 | * @param bool $default when set to true field will be for admin use only. |
| 2170 | 2170 | */ |
| 2171 | - function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key='') |
|
| 2171 | + function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $field_type_key = '') |
|
| 2172 | 2172 | {
|
| 2173 | 2173 | global $wpdb; |
| 2174 | 2174 | $cf = $result_str; |
| 2175 | 2175 | if (!is_object($cf)) {
|
| 2176 | - $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE id = %d", array($cf)));
|
|
| 2176 | + $field_info = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE id = %d", array($cf)));
|
|
| 2177 | 2177 | } else {
|
| 2178 | 2178 | $field_info = $cf; |
| 2179 | 2179 | $result_str = $cf->id; |
@@ -2209,18 +2209,18 @@ discard block |
||
| 2209 | 2209 | if ($htmlvar_name == '') |
| 2210 | 2210 | $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : ''; |
| 2211 | 2211 | |
| 2212 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 2212 | + $nonce = wp_create_nonce('custom_fields_'.$result_str);
|
|
| 2213 | 2213 | |
| 2214 | 2214 | $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
| 2215 | 2215 | $cso_arr = geodir_get_custom_sort_options($post_type); |
| 2216 | 2216 | |
| 2217 | 2217 | $cur_field_type = (isset($cf->field_type)) ? $cf->field_type : esc_html($_REQUEST['field_type']); |
| 2218 | - foreach($cso_arr as $cso){
|
|
| 2219 | - if($cur_field_type==$cso['field_type']){
|
|
| 2218 | + foreach ($cso_arr as $cso) {
|
|
| 2219 | + if ($cur_field_type == $cso['field_type']) {
|
|
| 2220 | 2220 | |
| 2221 | 2221 | if (isset($cso['field_icon']) && strpos($cso['field_icon'], 'fa fa-') !== false) {
|
| 2222 | 2222 | $field_icon = '<i class="'.$cso['field_icon'].'" aria-hidden="true"></i>'; |
| 2223 | - }elseif(isset($cso['field_icon']) && $cso['field_icon']){
|
|
| 2223 | + }elseif (isset($cso['field_icon']) && $cso['field_icon']) {
|
|
| 2224 | 2224 | $field_icon = '<b style="background-image: url("'.$cso['field_icon'].'")"></b>';
|
| 2225 | 2225 | } |
| 2226 | 2226 | |
@@ -2230,40 +2230,40 @@ discard block |
||
| 2230 | 2230 | $radio_id = (isset($field_info->htmlvar_name)) ? $field_info->htmlvar_name.$field_type : rand(5, 500); |
| 2231 | 2231 | ?> |
| 2232 | 2232 | |
| 2233 | - <li class="text" id="licontainer_<?php echo $result_str;?>"> |
|
| 2233 | + <li class="text" id="licontainer_<?php echo $result_str; ?>"> |
|
| 2234 | 2234 | <form><!-- we need to wrap in a fom so we can use radio buttons with same name --> |
| 2235 | - <div class="title title<?php echo $result_str;?> gt-fieldset" |
|
| 2236 | - title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
|
|
| 2237 | - ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
|
|
| 2235 | + <div class="title title<?php echo $result_str; ?> gt-fieldset" |
|
| 2236 | + title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory'); ?>"
|
|
| 2237 | + ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
|
|
| 2238 | 2238 | <?php |
| 2239 | 2239 | |
| 2240 | 2240 | ?> |
| 2241 | 2241 | |
| 2242 | - <div title="<?php _e('Click to remove field', 'geodirectory');?>"
|
|
| 2243 | - onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
|
|
| 2242 | + <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
|
|
| 2243 | + onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
|
|
| 2244 | 2244 | class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div> |
| 2245 | 2245 | |
| 2246 | 2246 | |
| 2247 | - <?php echo $field_icon;?> |
|
| 2247 | + <?php echo $field_icon; ?> |
|
| 2248 | 2248 | <b style="cursor:pointer;" |
| 2249 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' (' . $site_title . ')');?></b>
|
|
| 2249 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory').' ('.$site_title.')'); ?></b>
|
|
| 2250 | 2250 | |
| 2251 | 2251 | </div> |
| 2252 | 2252 | |
| 2253 | - <div id="field_frm<?php echo $result_str;?>" class="field_frm" |
|
| 2253 | + <div id="field_frm<?php echo $result_str; ?>" class="field_frm" |
|
| 2254 | 2254 | style="display:<?php if ($field_ins_upd == 'submit') {
|
| 2255 | 2255 | echo 'block;'; |
| 2256 | 2256 | } else {
|
| 2257 | 2257 | echo 'none;'; |
| 2258 | 2258 | } ?>"> |
| 2259 | 2259 | <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/> |
| 2260 | - <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/> |
|
| 2261 | - <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/> |
|
| 2262 | - <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/> |
|
| 2260 | + <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/> |
|
| 2261 | + <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/> |
|
| 2262 | + <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str; ?>"/> |
|
| 2263 | 2263 | <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
|
| 2264 | 2264 | echo $field_info->data_type; |
| 2265 | 2265 | }?>"/> |
| 2266 | - <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/> |
|
| 2266 | + <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name; ?>"/> |
|
| 2267 | 2267 | |
| 2268 | 2268 | |
| 2269 | 2269 | <ul class="widefat post fixed" border="0" style="width:100%;"> |
@@ -2273,7 +2273,7 @@ discard block |
||
| 2273 | 2273 | <input type="hidden" name="site_title" id="site_title" value="<?php echo esc_attr($site_title); ?>"/> |
| 2274 | 2274 | |
| 2275 | 2275 | <li> |
| 2276 | - <?php $value = (isset($field_info->sort_asc) && $field_info->sort_asc) ? $field_info->sort_asc : 0;?> |
|
| 2276 | + <?php $value = (isset($field_info->sort_asc) && $field_info->sort_asc) ? $field_info->sort_asc : 0; ?> |
|
| 2277 | 2277 | |
| 2278 | 2278 | <label for="asc" class="gd-cf-tooltip-wrap"> |
| 2279 | 2279 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show Ascending Sort (low to high)', 'geodirectory'); ?>
|
@@ -2283,24 +2283,24 @@ discard block |
||
| 2283 | 2283 | </label> |
| 2284 | 2284 | <div class="gd-cf-input-wrap gd-switch"> |
| 2285 | 2285 | |
| 2286 | - <input type="radio" id="asc_yes<?php echo $radio_id;?>" name="asc" class="gdri-enabled" value="1" |
|
| 2286 | + <input type="radio" id="asc_yes<?php echo $radio_id; ?>" name="asc" class="gdri-enabled" value="1" |
|
| 2287 | 2287 | <?php if ($value == '1') {
|
| 2288 | 2288 | echo 'checked'; |
| 2289 | 2289 | } ?>/> |
| 2290 | - <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>
|
|
| 2290 | + <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>
|
|
| 2291 | 2291 | |
| 2292 | - <input type="radio" id="asc_no<?php echo $radio_id;?>" name="asc" class="gdri-disabled" value="0" |
|
| 2292 | + <input type="radio" id="asc_no<?php echo $radio_id; ?>" name="asc" class="gdri-disabled" value="0" |
|
| 2293 | 2293 | <?php if ($value == '0' || !$value) {
|
| 2294 | 2294 | echo 'checked'; |
| 2295 | 2295 | } ?>/> |
| 2296 | - <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>
|
|
| 2296 | + <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>
|
|
| 2297 | 2297 | |
| 2298 | 2298 | </div> |
| 2299 | 2299 | |
| 2300 | 2300 | </li> |
| 2301 | 2301 | |
| 2302 | - <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;'";}?>>
|
|
| 2303 | - <?php $value = (isset($field_info->asc_title) && $field_info->asc_title) ? esc_attr($field_info->asc_title) : '';?> |
|
| 2302 | + <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;'"; }?>>
|
|
| 2303 | + <?php $value = (isset($field_info->asc_title) && $field_info->asc_title) ? esc_attr($field_info->asc_title) : ''; ?> |
|
| 2304 | 2304 | |
| 2305 | 2305 | <label for="asc_title" class="gd-cf-tooltip-wrap"> |
| 2306 | 2306 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Ascending title', 'geodirectory'); ?>
|
@@ -2310,14 +2310,14 @@ discard block |
||
| 2310 | 2310 | </label> |
| 2311 | 2311 | <div class="gd-cf-input-wrap"> |
| 2312 | 2312 | |
| 2313 | - <input type="text" name="asc_title" id="asc_title" value="<?php echo $value;?>" /> |
|
| 2313 | + <input type="text" name="asc_title" id="asc_title" value="<?php echo $value; ?>" /> |
|
| 2314 | 2314 | </div> |
| 2315 | 2315 | |
| 2316 | 2316 | |
| 2317 | 2317 | </li> |
| 2318 | 2318 | |
| 2319 | 2319 | |
| 2320 | - <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;'";}?>>
|
|
| 2320 | + <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;'"; }?>>
|
|
| 2321 | 2321 | |
| 2322 | 2322 | <label for="is_default" class="gd-cf-tooltip-wrap"> |
| 2323 | 2323 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
|
@@ -2328,7 +2328,7 @@ discard block |
||
| 2328 | 2328 | <div class="gd-cf-input-wrap"> |
| 2329 | 2329 | |
| 2330 | 2330 | <input type="radio" name="is_default" |
| 2331 | - value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
|
|
| 2331 | + value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_asc') {
|
|
| 2332 | 2332 | echo 'checked="checked"'; |
| 2333 | 2333 | } ?>/> |
| 2334 | 2334 | </div> |
@@ -2338,7 +2338,7 @@ discard block |
||
| 2338 | 2338 | |
| 2339 | 2339 | |
| 2340 | 2340 | <li> |
| 2341 | - <?php $value = (isset($field_info->sort_desc) && $field_info->sort_desc) ? $field_info->sort_desc : 0;?> |
|
| 2341 | + <?php $value = (isset($field_info->sort_desc) && $field_info->sort_desc) ? $field_info->sort_desc : 0; ?> |
|
| 2342 | 2342 | |
| 2343 | 2343 | <label for="desc" class="gd-cf-tooltip-wrap"> |
| 2344 | 2344 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show Descending Sort (high to low)', 'geodirectory'); ?>
|
@@ -2348,24 +2348,24 @@ discard block |
||
| 2348 | 2348 | </label> |
| 2349 | 2349 | <div class="gd-cf-input-wrap gd-switch"> |
| 2350 | 2350 | |
| 2351 | - <input type="radio" id="desc_yes<?php echo $radio_id;?>" name="desc" class="gdri-enabled" value="1" |
|
| 2351 | + <input type="radio" id="desc_yes<?php echo $radio_id; ?>" name="desc" class="gdri-enabled" value="1" |
|
| 2352 | 2352 | <?php if ($value == '1') {
|
| 2353 | 2353 | echo 'checked'; |
| 2354 | 2354 | } ?>/> |
| 2355 | - <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>
|
|
| 2355 | + <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>
|
|
| 2356 | 2356 | |
| 2357 | - <input type="radio" id="desc_no<?php echo $radio_id;?>" name="desc" class="gdri-disabled" value="0" |
|
| 2357 | + <input type="radio" id="desc_no<?php echo $radio_id; ?>" name="desc" class="gdri-disabled" value="0" |
|
| 2358 | 2358 | <?php if ($value == '0' || !$value) {
|
| 2359 | 2359 | echo 'checked'; |
| 2360 | 2360 | } ?>/> |
| 2361 | - <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>
|
|
| 2361 | + <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>
|
|
| 2362 | 2362 | |
| 2363 | 2363 | </div> |
| 2364 | 2364 | |
| 2365 | 2365 | </li> |
| 2366 | 2366 | |
| 2367 | - <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;'";}?>>
|
|
| 2368 | - <?php $value = (isset($field_info->desc_title) && $field_info->desc_title) ? esc_attr($field_info->desc_title) : '';?> |
|
| 2367 | + <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;'"; }?>>
|
|
| 2368 | + <?php $value = (isset($field_info->desc_title) && $field_info->desc_title) ? esc_attr($field_info->desc_title) : ''; ?> |
|
| 2369 | 2369 | |
| 2370 | 2370 | <label for="desc_title" class="gd-cf-tooltip-wrap"> |
| 2371 | 2371 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Descending title', 'geodirectory'); ?>
|
@@ -2375,13 +2375,13 @@ discard block |
||
| 2375 | 2375 | </label> |
| 2376 | 2376 | <div class="gd-cf-input-wrap"> |
| 2377 | 2377 | |
| 2378 | - <input type="text" name="desc_title" id="desc_title" value="<?php echo $value;?>" /> |
|
| 2378 | + <input type="text" name="desc_title" id="desc_title" value="<?php echo $value; ?>" /> |
|
| 2379 | 2379 | </div> |
| 2380 | 2380 | |
| 2381 | 2381 | |
| 2382 | 2382 | </li> |
| 2383 | 2383 | |
| 2384 | - <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;'";}?>>
|
|
| 2384 | + <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;'"; }?>>
|
|
| 2385 | 2385 | |
| 2386 | 2386 | <label for="is_default" class="gd-cf-tooltip-wrap"> |
| 2387 | 2387 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
|
@@ -2392,7 +2392,7 @@ discard block |
||
| 2392 | 2392 | <div class="gd-cf-input-wrap"> |
| 2393 | 2393 | |
| 2394 | 2394 | <input type="radio" name="is_default" |
| 2395 | - value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
|
|
| 2395 | + value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name.'_desc') {
|
|
| 2396 | 2396 | echo 'checked="checked"'; |
| 2397 | 2397 | } ?>/> |
| 2398 | 2398 | </div> |
@@ -2417,14 +2417,14 @@ discard block |
||
| 2417 | 2417 | </label> |
| 2418 | 2418 | <div class="gd-cf-input-wrap"> |
| 2419 | 2419 | |
| 2420 | - <input type="text" name="site_title" id="site_title" value="<?php echo $value;?>" /> |
|
| 2420 | + <input type="text" name="site_title" id="site_title" value="<?php echo $value; ?>" /> |
|
| 2421 | 2421 | </div> |
| 2422 | 2422 | |
| 2423 | 2423 | |
| 2424 | 2424 | </li> |
| 2425 | 2425 | |
| 2426 | 2426 | <li> |
| 2427 | - <?php $value = (isset($field_info->is_default) && $field_info->is_default) ? esc_attr($field_info->is_default) : '';?> |
|
| 2427 | + <?php $value = (isset($field_info->is_default) && $field_info->is_default) ? esc_attr($field_info->is_default) : ''; ?> |
|
| 2428 | 2428 | |
| 2429 | 2429 | <label for="is_default" class="gd-cf-tooltip-wrap"> |
| 2430 | 2430 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default sort?', 'geodirectory'); ?>
|
@@ -2448,7 +2448,7 @@ discard block |
||
| 2448 | 2448 | |
| 2449 | 2449 | |
| 2450 | 2450 | <li> |
| 2451 | - <?php $value = (isset($field_info->is_active) && $field_info->is_active) ? $field_info->is_active: 0;?> |
|
| 2451 | + <?php $value = (isset($field_info->is_active) && $field_info->is_active) ? $field_info->is_active : 0; ?> |
|
| 2452 | 2452 | |
| 2453 | 2453 | <label for="is_active" class="gd-cf-tooltip-wrap"> |
| 2454 | 2454 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active', 'geodirectory'); ?>
|
@@ -2458,17 +2458,17 @@ discard block |
||
| 2458 | 2458 | </label> |
| 2459 | 2459 | <div class="gd-cf-input-wrap gd-switch"> |
| 2460 | 2460 | |
| 2461 | - <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
|
| 2461 | + <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled" value="1" |
|
| 2462 | 2462 | <?php if ($value == '1') {
|
| 2463 | 2463 | echo 'checked'; |
| 2464 | 2464 | } ?>/> |
| 2465 | - <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2465 | + <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2466 | 2466 | |
| 2467 | - <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
|
| 2467 | + <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0" |
|
| 2468 | 2468 | <?php if ($value == '0' || !$value) {
|
| 2469 | 2469 | echo 'checked'; |
| 2470 | 2470 | } ?>/> |
| 2471 | - <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2471 | + <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2472 | 2472 | |
| 2473 | 2473 | </div> |
| 2474 | 2474 | |
@@ -2489,10 +2489,10 @@ discard block |
||
| 2489 | 2489 | <h3></h3> |
| 2490 | 2490 | </label> |
| 2491 | 2491 | <div class="gd-cf-input-wrap"> |
| 2492 | - <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
|
|
| 2492 | + <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
|
|
| 2493 | 2493 | onclick="save_sort_field('<?php echo esc_attr($result_str); ?>')"/>
|
| 2494 | - <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
|
|
| 2495 | - onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
|
|
| 2494 | + <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
|
|
| 2495 | + onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
|
|
| 2496 | 2496 | class="button"/></a> |
| 2497 | 2497 | </div> |
| 2498 | 2498 | </li> |
@@ -2527,7 +2527,7 @@ discard block |
||
| 2527 | 2527 | if (!$package_id || !$field_name || !$post_type) {
|
| 2528 | 2528 | return true; |
| 2529 | 2529 | } |
| 2530 | - $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));
|
|
| 2530 | + $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));
|
|
| 2531 | 2531 | |
| 2532 | 2532 | if ($wpdb->get_var($sql)) {
|
| 2533 | 2533 | return true; |
@@ -2649,13 +2649,13 @@ discard block |
||
| 2649 | 2649 | } |
| 2650 | 2650 | |
| 2651 | 2651 | |
| 2652 | -function geodir_cfa_data_type_text($output,$result_str,$cf,$field_info){
|
|
| 2652 | +function geodir_cfa_data_type_text($output, $result_str, $cf, $field_info) {
|
|
| 2653 | 2653 | ob_start(); |
| 2654 | 2654 | |
| 2655 | 2655 | $dt_value = ''; |
| 2656 | 2656 | if (isset($field_info->data_type)) {
|
| 2657 | 2657 | $dt_value = esc_attr($field_info->data_type); |
| 2658 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 2658 | + }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) {
|
|
| 2659 | 2659 | $dt_value = $cf['defaults']['data_type']; |
| 2660 | 2660 | } |
| 2661 | 2661 | ?> |
@@ -2666,15 +2666,15 @@ discard block |
||
| 2666 | 2666 | <select name="data_type" id="data_type" |
| 2667 | 2667 | onchange="javascript:gd_data_type_changed(this, '<?php echo $result_str; ?>');"> |
| 2668 | 2668 | <option |
| 2669 | - value="XVARCHAR" <?php if ($dt_value == 'VARCHAR') {
|
|
| 2669 | + value="XVARCHAR" <?php if ($dt_value == 'VARCHAR') {
|
|
| 2670 | 2670 | echo 'selected="selected"'; |
| 2671 | 2671 | } ?>><?php _e('CHARACTER', 'geodirectory'); ?></option>
|
| 2672 | 2672 | <option |
| 2673 | - value="INT" <?php if ($dt_value == 'INT') {
|
|
| 2673 | + value="INT" <?php if ($dt_value == 'INT') {
|
|
| 2674 | 2674 | echo 'selected="selected"'; |
| 2675 | 2675 | } ?>><?php _e('NUMBER', 'geodirectory'); ?></option>
|
| 2676 | 2676 | <option |
| 2677 | - value="FLOAT" <?php if ($dt_value == 'FLOAT') {
|
|
| 2677 | + value="FLOAT" <?php if ($dt_value == 'FLOAT') {
|
|
| 2678 | 2678 | echo 'selected="selected"'; |
| 2679 | 2679 | } ?>><?php _e('DECIMAL', 'geodirectory'); ?></option>
|
| 2680 | 2680 | </select> |
@@ -2687,13 +2687,13 @@ discard block |
||
| 2687 | 2687 | $value = ''; |
| 2688 | 2688 | if (isset($field_info->decimal_point)) {
|
| 2689 | 2689 | $value = esc_attr($field_info->decimal_point); |
| 2690 | - }elseif(isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']){
|
|
| 2690 | + }elseif (isset($cf['defaults']['decimal_point']) && $cf['defaults']['decimal_point']) {
|
|
| 2691 | 2691 | $value = $cf['defaults']['decimal_point']; |
| 2692 | 2692 | } |
| 2693 | 2693 | ?> |
| 2694 | 2694 | |
| 2695 | 2695 | <li class="decimal-point-wrapper" |
| 2696 | - style="<?php echo ($dt_value == 'FLOAT') ? '' : 'display:none' ?>"> |
|
| 2696 | + style="<?php echo ($dt_value == 'FLOAT') ? '' : 'display:none' ?>"> |
|
| 2697 | 2697 | <label for="decimal_point"><?php _e('Select decimal point :', 'geodirectory'); ?></label>
|
| 2698 | 2698 | <div class="gd-cf-input-wrap"> |
| 2699 | 2699 | <select name="decimal_point" id="decimal_point"> |
@@ -2711,43 +2711,43 @@ discard block |
||
| 2711 | 2711 | $output = ob_get_clean(); |
| 2712 | 2712 | return $output; |
| 2713 | 2713 | } |
| 2714 | -add_filter('geodir_cfa_data_type_text','geodir_cfa_data_type_text',10,4);
|
|
| 2714 | +add_filter('geodir_cfa_data_type_text', 'geodir_cfa_data_type_text', 10, 4);
|
|
| 2715 | 2715 | |
| 2716 | 2716 | // htmlvar not needed for fieldset and taxonomy |
| 2717 | -add_filter('geodir_cfa_htmlvar_name_fieldset','__return_empty_string',10,4);
|
|
| 2718 | -add_filter('geodir_cfa_htmlvar_name_taxonomy','__return_empty_string',10,4);
|
|
| 2717 | +add_filter('geodir_cfa_htmlvar_name_fieldset', '__return_empty_string', 10, 4);
|
|
| 2718 | +add_filter('geodir_cfa_htmlvar_name_taxonomy', '__return_empty_string', 10, 4);
|
|
| 2719 | 2719 | |
| 2720 | 2720 | |
| 2721 | 2721 | // default_value not needed for textarea, html, file, fieldset, taxonomy, address |
| 2722 | -add_filter('geodir_cfa_default_value_textarea','__return_empty_string',10,4);
|
|
| 2723 | -add_filter('geodir_cfa_default_value_html','__return_empty_string',10,4);
|
|
| 2724 | -add_filter('geodir_cfa_default_value_file','__return_empty_string',10,4);
|
|
| 2725 | -add_filter('geodir_cfa_default_value_taxonomy','__return_empty_string',10,4);
|
|
| 2726 | -add_filter('geodir_cfa_default_value_address','__return_empty_string',10,4);
|
|
| 2727 | -add_filter('geodir_cfa_default_value_fieldset','__return_empty_string',10,4);
|
|
| 2722 | +add_filter('geodir_cfa_default_value_textarea', '__return_empty_string', 10, 4);
|
|
| 2723 | +add_filter('geodir_cfa_default_value_html', '__return_empty_string', 10, 4);
|
|
| 2724 | +add_filter('geodir_cfa_default_value_file', '__return_empty_string', 10, 4);
|
|
| 2725 | +add_filter('geodir_cfa_default_value_taxonomy', '__return_empty_string', 10, 4);
|
|
| 2726 | +add_filter('geodir_cfa_default_value_address', '__return_empty_string', 10, 4);
|
|
| 2727 | +add_filter('geodir_cfa_default_value_fieldset', '__return_empty_string', 10, 4);
|
|
| 2728 | 2728 | |
| 2729 | 2729 | // is_required not needed for fieldset |
| 2730 | -add_filter('geodir_cfa_is_required_fieldset','__return_empty_string',10,4);
|
|
| 2731 | -add_filter('geodir_cfa_required_msg_fieldset','__return_empty_string',10,4);
|
|
| 2730 | +add_filter('geodir_cfa_is_required_fieldset', '__return_empty_string', 10, 4);
|
|
| 2731 | +add_filter('geodir_cfa_required_msg_fieldset', '__return_empty_string', 10, 4);
|
|
| 2732 | 2732 | |
| 2733 | 2733 | // field_icon not needed for fieldset |
| 2734 | -add_filter('geodir_cfa_field_icon_fieldset','__return_empty_string',10,4);
|
|
| 2735 | -add_filter('geodir_cfa_css_class_fieldset','__return_empty_string',10,4);
|
|
| 2734 | +add_filter('geodir_cfa_field_icon_fieldset', '__return_empty_string', 10, 4);
|
|
| 2735 | +add_filter('geodir_cfa_css_class_fieldset', '__return_empty_string', 10, 4);
|
|
| 2736 | 2736 | |
| 2737 | 2737 | // cat_sort not needed for some fields |
| 2738 | -add_filter('geodir_cfa_cat_sort_html','__return_empty_string',10,4);
|
|
| 2739 | -add_filter('geodir_cfa_cat_sort_file','__return_empty_string',10,4);
|
|
| 2740 | -add_filter('geodir_cfa_cat_sort_url','__return_empty_string',10,4);
|
|
| 2741 | -add_filter('geodir_cfa_cat_sort_fieldset','__return_empty_string',10,4);
|
|
| 2742 | -add_filter('geodir_cfa_cat_sort_multiselect','__return_empty_string',10,4);
|
|
| 2743 | -add_filter('geodir_cfa_cat_sort_textarea','__return_empty_string',10,4);
|
|
| 2744 | -add_filter('geodir_cfa_cat_sort_taxonomy','__return_empty_string',10,4);
|
|
| 2745 | -add_filter('geodir_cfa_cat_sort_address','__return_empty_string',10,4);
|
|
| 2738 | +add_filter('geodir_cfa_cat_sort_html', '__return_empty_string', 10, 4);
|
|
| 2739 | +add_filter('geodir_cfa_cat_sort_file', '__return_empty_string', 10, 4);
|
|
| 2740 | +add_filter('geodir_cfa_cat_sort_url', '__return_empty_string', 10, 4);
|
|
| 2741 | +add_filter('geodir_cfa_cat_sort_fieldset', '__return_empty_string', 10, 4);
|
|
| 2742 | +add_filter('geodir_cfa_cat_sort_multiselect', '__return_empty_string', 10, 4);
|
|
| 2743 | +add_filter('geodir_cfa_cat_sort_textarea', '__return_empty_string', 10, 4);
|
|
| 2744 | +add_filter('geodir_cfa_cat_sort_taxonomy', '__return_empty_string', 10, 4);
|
|
| 2745 | +add_filter('geodir_cfa_cat_sort_address', '__return_empty_string', 10, 4);
|
|
| 2746 | 2746 | |
| 2747 | 2747 | |
| 2748 | 2748 | |
| 2749 | -function geodir_cfa_advanced_editor_geodir_special_offers($output,$result_str,$cf,$field_info){
|
|
| 2750 | - if($field_info->htmlvar_name != 'geodir_special_offers'){return '';}
|
|
| 2749 | +function geodir_cfa_advanced_editor_geodir_special_offers($output, $result_str, $cf, $field_info) {
|
|
| 2750 | + if ($field_info->htmlvar_name != 'geodir_special_offers') {return ''; }
|
|
| 2751 | 2751 | ob_start(); |
| 2752 | 2752 | ?> |
| 2753 | 2753 | <li> |
@@ -2778,16 +2778,16 @@ discard block |
||
| 2778 | 2778 | $output = ob_get_clean(); |
| 2779 | 2779 | return $output; |
| 2780 | 2780 | } |
| 2781 | -add_filter('geodir_cfa_advanced_editor_textarea','geodir_cfa_advanced_editor_geodir_special_offers',10,4);
|
|
| 2781 | +add_filter('geodir_cfa_advanced_editor_textarea', 'geodir_cfa_advanced_editor_geodir_special_offers', 10, 4);
|
|
| 2782 | 2782 | |
| 2783 | 2783 | |
| 2784 | -function geodir_cfa_validation_pattern_text($output,$result_str,$cf,$field_info){
|
|
| 2784 | +function geodir_cfa_validation_pattern_text($output, $result_str, $cf, $field_info) {
|
|
| 2785 | 2785 | ob_start(); |
| 2786 | 2786 | |
| 2787 | 2787 | $value = ''; |
| 2788 | 2788 | if (isset($field_info->validation_pattern)) {
|
| 2789 | 2789 | $value = esc_attr($field_info->validation_pattern); |
| 2790 | - }elseif(isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']){
|
|
| 2790 | + }elseif (isset($cf['defaults']['validation_pattern']) && $cf['defaults']['validation_pattern']) {
|
|
| 2791 | 2791 | $value = esc_attr($cf['defaults']['validation_pattern']); |
| 2792 | 2792 | } |
| 2793 | 2793 | ?> |
@@ -2807,7 +2807,7 @@ discard block |
||
| 2807 | 2807 | $value = ''; |
| 2808 | 2808 | if (isset($field_info->validation_msg)) {
|
| 2809 | 2809 | $value = esc_attr($field_info->validation_msg); |
| 2810 | - }elseif(isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']){
|
|
| 2810 | + }elseif (isset($cf['defaults']['validation_msg']) && $cf['defaults']['validation_msg']) {
|
|
| 2811 | 2811 | $value = esc_attr($cf['defaults']['validation_msg']); |
| 2812 | 2812 | } |
| 2813 | 2813 | ?> |
@@ -2828,10 +2828,10 @@ discard block |
||
| 2828 | 2828 | $output = ob_get_clean(); |
| 2829 | 2829 | return $output; |
| 2830 | 2830 | } |
| 2831 | -add_filter('geodir_cfa_validation_pattern_text','geodir_cfa_validation_pattern_text',10,4);
|
|
| 2831 | +add_filter('geodir_cfa_validation_pattern_text', 'geodir_cfa_validation_pattern_text', 10, 4);
|
|
| 2832 | 2832 | |
| 2833 | 2833 | |
| 2834 | -function geodir_cfa_htmlvar_name_taxonomy($output,$result_str,$cf,$field_info){
|
|
| 2834 | +function geodir_cfa_htmlvar_name_taxonomy($output, $result_str, $cf, $field_info) {
|
|
| 2835 | 2835 | ob_start(); |
| 2836 | 2836 | global $post_type; |
| 2837 | 2837 | |
@@ -2856,7 +2856,7 @@ discard block |
||
| 2856 | 2856 | ?> |
| 2857 | 2857 | <option <?php if (isset($field_info->htmlvar_name) && $field_info->htmlvar_name == $gd_tax) {
|
| 2858 | 2858 | echo 'selected="selected"'; |
| 2859 | - }?> id="<?php echo $gd_tax;?>"><?php echo $gd_tax;?></option><?php |
|
| 2859 | + }?> id="<?php echo $gd_tax; ?>"><?php echo $gd_tax; ?></option><?php |
|
| 2860 | 2860 | } |
| 2861 | 2861 | ?> |
| 2862 | 2862 | </select> |
@@ -2867,7 +2867,7 @@ discard block |
||
| 2867 | 2867 | <label for="cat_display_type" class="gd-cf-tooltip-wrap"> |
| 2868 | 2868 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Category display type :', 'geodirectory'); ?>
|
| 2869 | 2869 | <div class="gdcf-tooltip"> |
| 2870 | - <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory');?>
|
|
| 2870 | + <?php _e('Show categories list as select, multiselect, checkbox or radio', 'geodirectory'); ?>
|
|
| 2871 | 2871 | </div> |
| 2872 | 2872 | </label> |
| 2873 | 2873 | <div class="gd-cf-input-wrap"> |
@@ -2875,19 +2875,19 @@ discard block |
||
| 2875 | 2875 | <select name="cat_display_type" id="cat_display_type"> |
| 2876 | 2876 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'ajax_chained') {
|
| 2877 | 2877 | echo 'selected="selected"'; |
| 2878 | - }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory');?></option>
|
|
| 2878 | + }?> value="ajax_chained"><?php _e('Ajax Chained', 'geodirectory'); ?></option>
|
|
| 2879 | 2879 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
|
| 2880 | 2880 | echo 'selected="selected"'; |
| 2881 | - }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 2881 | + }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
|
|
| 2882 | 2882 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'multiselect') {
|
| 2883 | 2883 | echo 'selected="selected"'; |
| 2884 | - }?> value="multiselect"><?php _e('Multiselect', 'geodirectory');?></option>
|
|
| 2884 | + }?> value="multiselect"><?php _e('Multiselect', 'geodirectory'); ?></option>
|
|
| 2885 | 2885 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
|
| 2886 | 2886 | echo 'selected="selected"'; |
| 2887 | - }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 2887 | + }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
|
|
| 2888 | 2888 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
|
| 2889 | 2889 | echo 'selected="selected"'; |
| 2890 | - }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 2890 | + }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
|
|
| 2891 | 2891 | </select> |
| 2892 | 2892 | </div> |
| 2893 | 2893 | </li> |
@@ -2896,10 +2896,10 @@ discard block |
||
| 2896 | 2896 | $output = ob_get_clean(); |
| 2897 | 2897 | return $output; |
| 2898 | 2898 | } |
| 2899 | -add_filter('geodir_cfa_htmlvar_name_taxonomy','geodir_cfa_htmlvar_name_taxonomy',10,4);
|
|
| 2899 | +add_filter('geodir_cfa_htmlvar_name_taxonomy', 'geodir_cfa_htmlvar_name_taxonomy', 10, 4);
|
|
| 2900 | 2900 | |
| 2901 | 2901 | |
| 2902 | -function geodir_cfa_extra_fields_address($output,$result_str,$cf,$field_info){
|
|
| 2902 | +function geodir_cfa_extra_fields_address($output, $result_str, $cf, $field_info) {
|
|
| 2903 | 2903 | |
| 2904 | 2904 | ob_start(); |
| 2905 | 2905 | if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
@@ -2922,32 +2922,32 @@ discard block |
||
| 2922 | 2922 | <label for="show_zip" class="gd-cf-tooltip-wrap"> |
| 2923 | 2923 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display zip/post code :', 'geodirectory'); ?>
|
| 2924 | 2924 | <div class="gdcf-tooltip"> |
| 2925 | - <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory');?>
|
|
| 2925 | + <?php _e('Select if you want to show zip/post code field in address section.', 'geodirectory'); ?>
|
|
| 2926 | 2926 | </div> |
| 2927 | 2927 | </label> |
| 2928 | 2928 | <div class="gd-cf-input-wrap gd-switch"> |
| 2929 | 2929 | |
| 2930 | - <input type="radio" id="show_zip_yes<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-enabled" value="1" |
|
| 2930 | + <input type="radio" id="show_zip_yes<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-enabled" value="1" |
|
| 2931 | 2931 | <?php if (isset($address['show_zip']) && $address['show_zip'] == '1') {
|
| 2932 | 2932 | echo 'checked'; |
| 2933 | 2933 | } ?>/> |
| 2934 | - <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>
|
|
| 2934 | + <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>
|
|
| 2935 | 2935 | |
| 2936 | - <input type="radio" id="show_zip_no<?php echo $radio_id;?>" name="extra[show_zip]" class="gdri-disabled" value="0" |
|
| 2936 | + <input type="radio" id="show_zip_no<?php echo $radio_id; ?>" name="extra[show_zip]" class="gdri-disabled" value="0" |
|
| 2937 | 2937 | <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {
|
| 2938 | 2938 | echo 'checked'; |
| 2939 | 2939 | } ?>/> |
| 2940 | - <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>
|
|
| 2940 | + <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>
|
|
| 2941 | 2941 | |
| 2942 | 2942 | |
| 2943 | 2943 | </div> |
| 2944 | 2944 | </li> |
| 2945 | 2945 | |
| 2946 | - <li class="cf-zip-lable" <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'";}?> >
|
|
| 2946 | + <li class="cf-zip-lable" <?php if ((isset($address['show_zip']) && !$address['show_zip']) || !isset($address['show_zip'])) {echo "style='display:none;'"; }?> >
|
|
| 2947 | 2947 | <label for="zip_lable" class="gd-cf-tooltip-wrap"> |
| 2948 | 2948 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Zip/Post code label :', 'geodirectory'); ?>
|
| 2949 | 2949 | <div class="gdcf-tooltip"> |
| 2950 | - <?php _e('Enter zip/post code field label in address section.', 'geodirectory');?>
|
|
| 2950 | + <?php _e('Enter zip/post code field label in address section.', 'geodirectory'); ?>
|
|
| 2951 | 2951 | </div> |
| 2952 | 2952 | </label> |
| 2953 | 2953 | <div class="gd-cf-input-wrap"> |
@@ -2965,7 +2965,7 @@ discard block |
||
| 2965 | 2965 | <label for="map_lable" class="gd-cf-tooltip-wrap"> |
| 2966 | 2966 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map button label :', 'geodirectory'); ?>
|
| 2967 | 2967 | <div class="gdcf-tooltip"> |
| 2968 | - <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory');?>
|
|
| 2968 | + <?php _e('Enter text for `set address on map` button in address section.', 'geodirectory'); ?>
|
|
| 2969 | 2969 | </div> |
| 2970 | 2970 | </label> |
| 2971 | 2971 | <div class="gd-cf-input-wrap"> |
@@ -2980,22 +2980,22 @@ discard block |
||
| 2980 | 2980 | <label for="show_mapzoom" class="gd-cf-tooltip-wrap"> |
| 2981 | 2981 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Use user zoom level:', 'geodirectory'); ?>
|
| 2982 | 2982 | <div class="gdcf-tooltip"> |
| 2983 | - <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory');?>
|
|
| 2983 | + <?php _e('Do you want to use the user defined map zoom level from the add listing page?', 'geodirectory'); ?>
|
|
| 2984 | 2984 | </div> |
| 2985 | 2985 | </label> |
| 2986 | 2986 | <div class="gd-cf-input-wrap gd-switch"> |
| 2987 | 2987 | |
| 2988 | - <input type="radio" id="show_mapzoom_yes<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-enabled" value="1" |
|
| 2988 | + <input type="radio" id="show_mapzoom_yes<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-enabled" value="1" |
|
| 2989 | 2989 | <?php if (isset($address['show_mapzoom']) && $address['show_mapzoom'] == '1') {
|
| 2990 | 2990 | echo 'checked'; |
| 2991 | 2991 | } ?>/> |
| 2992 | - <label for="show_mapzoom_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2992 | + <label for="show_mapzoom_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 2993 | 2993 | |
| 2994 | - <input type="radio" id="show_mapzoom_no<?php echo $radio_id;?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0" |
|
| 2994 | + <input type="radio" id="show_mapzoom_no<?php echo $radio_id; ?>" name="extra[show_mapzoom]" class="gdri-disabled" value="0" |
|
| 2995 | 2995 | <?php if ((isset($address['show_mapzoom']) && !$address['show_mapzoom']) || !isset($address['show_mapzoom'])) {
|
| 2996 | 2996 | echo 'checked'; |
| 2997 | 2997 | } ?>/> |
| 2998 | - <label for="show_mapzoom_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2998 | + <label for="show_mapzoom_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 2999 | 2999 | |
| 3000 | 3000 | </div> |
| 3001 | 3001 | </li> |
@@ -3004,22 +3004,22 @@ discard block |
||
| 3004 | 3004 | <label for="show_mapview" class="gd-cf-tooltip-wrap"> |
| 3005 | 3005 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display map view:', 'geodirectory'); ?>
|
| 3006 | 3006 | <div class="gdcf-tooltip"> |
| 3007 | - <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory');?>
|
|
| 3007 | + <?php _e('Select if you want to `set default map` options in address section. ( Satellite Map, Hybrid Map, Terrain Map)', 'geodirectory'); ?>
|
|
| 3008 | 3008 | </div> |
| 3009 | 3009 | </label> |
| 3010 | 3010 | <div class="gd-cf-input-wrap gd-switch"> |
| 3011 | 3011 | |
| 3012 | - <input type="radio" id="show_mapview_yes<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-enabled" value="1" |
|
| 3012 | + <input type="radio" id="show_mapview_yes<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-enabled" value="1" |
|
| 3013 | 3013 | <?php if (isset($address['show_mapview']) && $address['show_mapview'] == '1') {
|
| 3014 | 3014 | echo 'checked'; |
| 3015 | 3015 | } ?>/> |
| 3016 | - <label for="show_mapview_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3016 | + <label for="show_mapview_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3017 | 3017 | |
| 3018 | - <input type="radio" id="show_mapview_no<?php echo $radio_id;?>" name="extra[show_mapview]" class="gdri-disabled" value="0" |
|
| 3018 | + <input type="radio" id="show_mapview_no<?php echo $radio_id; ?>" name="extra[show_mapview]" class="gdri-disabled" value="0" |
|
| 3019 | 3019 | <?php if ((isset($address['show_mapview']) && !$address['show_mapview']) || !isset($address['show_mapview'])) {
|
| 3020 | 3020 | echo 'checked'; |
| 3021 | 3021 | } ?>/> |
| 3022 | - <label for="show_mapview_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3022 | + <label for="show_mapview_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3023 | 3023 | |
| 3024 | 3024 | </div> |
| 3025 | 3025 | </li> |
@@ -3029,7 +3029,7 @@ discard block |
||
| 3029 | 3029 | <label for="mapview_lable" class="gd-cf-tooltip-wrap"> |
| 3030 | 3030 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Map view label:', 'geodirectory'); ?>
|
| 3031 | 3031 | <div class="gdcf-tooltip"> |
| 3032 | - <?php _e('Enter mapview field label in address section.', 'geodirectory');?>
|
|
| 3032 | + <?php _e('Enter mapview field label in address section.', 'geodirectory'); ?>
|
|
| 3033 | 3033 | </div> |
| 3034 | 3034 | </label> |
| 3035 | 3035 | <div class="gd-cf-input-wrap"> |
@@ -3043,22 +3043,22 @@ discard block |
||
| 3043 | 3043 | <label for="show_latlng" class="gd-cf-tooltip-wrap"> |
| 3044 | 3044 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show latitude and longitude', 'geodirectory'); ?>
|
| 3045 | 3045 | <div class="gdcf-tooltip"> |
| 3046 | - <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory');?>
|
|
| 3046 | + <?php _e('This will show/hide the longitude fields in the address section add listing form.', 'geodirectory'); ?>
|
|
| 3047 | 3047 | </div> |
| 3048 | 3048 | </label> |
| 3049 | 3049 | <div class="gd-cf-input-wrap gd-switch"> |
| 3050 | 3050 | |
| 3051 | - <input type="radio" id="show_latlng_yes<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-enabled" value="1" |
|
| 3051 | + <input type="radio" id="show_latlng_yes<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-enabled" value="1" |
|
| 3052 | 3052 | <?php if (isset($address['show_latlng']) && $address['show_latlng'] == '1') {
|
| 3053 | 3053 | echo 'checked'; |
| 3054 | 3054 | } ?>/> |
| 3055 | - <label for="show_latlng_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3055 | + <label for="show_latlng_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 3056 | 3056 | |
| 3057 | - <input type="radio" id="show_latlng_no<?php echo $radio_id;?>" name="extra[show_latlng]" class="gdri-disabled" value="0" |
|
| 3057 | + <input type="radio" id="show_latlng_no<?php echo $radio_id; ?>" name="extra[show_latlng]" class="gdri-disabled" value="0" |
|
| 3058 | 3058 | <?php if ((isset($address['show_latlng']) && !$address['show_latlng']) || !isset($address['show_latlng'])) {
|
| 3059 | 3059 | echo 'checked'; |
| 3060 | 3060 | } ?>/> |
| 3061 | - <label for="show_latlng_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3061 | + <label for="show_latlng_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 3062 | 3062 | |
| 3063 | 3063 | </div> |
| 3064 | 3064 | </li> |
@@ -3067,17 +3067,17 @@ discard block |
||
| 3067 | 3067 | $html = ob_get_clean(); |
| 3068 | 3068 | return $output.$html; |
| 3069 | 3069 | } |
| 3070 | -add_filter('geodir_cfa_extra_fields_address','geodir_cfa_extra_fields_address',10,4);
|
|
| 3070 | +add_filter('geodir_cfa_extra_fields_address', 'geodir_cfa_extra_fields_address', 10, 4);
|
|
| 3071 | 3071 | |
| 3072 | 3072 | |
| 3073 | -function geodir_cfa_extra_fields_multiselect($output,$result_str,$cf,$field_info){
|
|
| 3073 | +function geodir_cfa_extra_fields_multiselect($output, $result_str, $cf, $field_info) {
|
|
| 3074 | 3074 | ob_start(); |
| 3075 | 3075 | ?> |
| 3076 | 3076 | <li> |
| 3077 | 3077 | <label for="multi_display_type" class="gd-cf-tooltip-wrap"> |
| 3078 | 3078 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Multiselect display type :', 'geodirectory'); ?>
|
| 3079 | 3079 | <div class="gdcf-tooltip"> |
| 3080 | - <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory');?>
|
|
| 3080 | + <?php _e('Show multiselect list as multiselect,checkbox or radio.', 'geodirectory'); ?>
|
|
| 3081 | 3081 | </div> |
| 3082 | 3082 | </label> |
| 3083 | 3083 | <div class="gd-cf-input-wrap"> |
@@ -3085,13 +3085,13 @@ discard block |
||
| 3085 | 3085 | <select name="multi_display_type" id="multi_display_type"> |
| 3086 | 3086 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'select') {
|
| 3087 | 3087 | echo 'selected="selected"'; |
| 3088 | - }?> value="select"><?php _e('Select', 'geodirectory');?></option>
|
|
| 3088 | + }?> value="select"><?php _e('Select', 'geodirectory'); ?></option>
|
|
| 3089 | 3089 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'checkbox') {
|
| 3090 | 3090 | echo 'selected="selected"'; |
| 3091 | - }?> value="checkbox"><?php _e('Checkbox', 'geodirectory');?></option>
|
|
| 3091 | + }?> value="checkbox"><?php _e('Checkbox', 'geodirectory'); ?></option>
|
|
| 3092 | 3092 | <option <?php if (isset($field_info->extra_fields) && unserialize($field_info->extra_fields) == 'radio') {
|
| 3093 | 3093 | echo 'selected="selected"'; |
| 3094 | - }?> value="radio"><?php _e('Radio', 'geodirectory');?></option>
|
|
| 3094 | + }?> value="radio"><?php _e('Radio', 'geodirectory'); ?></option>
|
|
| 3095 | 3095 | </select> |
| 3096 | 3096 | |
| 3097 | 3097 | <br/> |
@@ -3102,17 +3102,17 @@ discard block |
||
| 3102 | 3102 | $html = ob_get_clean(); |
| 3103 | 3103 | return $output.$html; |
| 3104 | 3104 | } |
| 3105 | -add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_multiselect',10,4);
|
|
| 3105 | +add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_multiselect', 10, 4);
|
|
| 3106 | 3106 | |
| 3107 | 3107 | |
| 3108 | -function geodir_cfa_extra_fields_smr($output,$result_str,$cf,$field_info){
|
|
| 3108 | +function geodir_cfa_extra_fields_smr($output, $result_str, $cf, $field_info) {
|
|
| 3109 | 3109 | |
| 3110 | 3110 | ob_start(); |
| 3111 | 3111 | |
| 3112 | 3112 | $value = ''; |
| 3113 | 3113 | if (isset($field_info->option_values)) {
|
| 3114 | 3114 | $value = esc_attr($field_info->option_values); |
| 3115 | - }elseif(isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']){
|
|
| 3115 | + }elseif (isset($cf['defaults']['option_values']) && $cf['defaults']['option_values']) {
|
|
| 3116 | 3116 | $value = esc_attr($cf['defaults']['option_values']); |
| 3117 | 3117 | } |
| 3118 | 3118 | |
@@ -3122,11 +3122,11 @@ discard block |
||
| 3122 | 3122 | <label for="option_values" class="gd-cf-tooltip-wrap"> |
| 3123 | 3123 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Option Values :', 'geodirectory'); ?>
|
| 3124 | 3124 | <div class="gdcf-tooltip"> |
| 3125 | - <span><?php _e('Option Values should be separated by comma.', 'geodirectory');?></span>
|
|
| 3125 | + <span><?php _e('Option Values should be separated by comma.', 'geodirectory'); ?></span>
|
|
| 3126 | 3126 | <br/> |
| 3127 | - <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>
|
|
| 3127 | + <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>
|
|
| 3128 | 3128 | <br/> |
| 3129 | - <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory');?></span>
|
|
| 3129 | + <span><?php _e('eg: "No Dogs Allowed/0,Dogs Allowed/1" (Select only, not multiselect)', 'geodirectory'); ?></span>
|
|
| 3130 | 3130 | <?php if ($field_type == 'multiselect' || $field_type == 'select') { ?>
|
| 3131 | 3131 | <br/> |
| 3132 | 3132 | <span><?php _e('- If using OPTGROUP tag to grouping options, use "{optgroup}OPTGROUP-LABEL|OPTION-1,OPTION-2{/optgroup}"', 'geodirectory'); ?></span>
|
@@ -3137,7 +3137,7 @@ discard block |
||
| 3137 | 3137 | </label> |
| 3138 | 3138 | <div class="gd-cf-input-wrap"> |
| 3139 | 3139 | <input type="text" name="option_values" id="option_values" |
| 3140 | - value="<?php echo $value;?>"/> |
|
| 3140 | + value="<?php echo $value; ?>"/> |
|
| 3141 | 3141 | <br/> |
| 3142 | 3142 | |
| 3143 | 3143 | </div> |
@@ -3147,12 +3147,12 @@ discard block |
||
| 3147 | 3147 | $html = ob_get_clean(); |
| 3148 | 3148 | return $output.$html; |
| 3149 | 3149 | } |
| 3150 | -add_filter('geodir_cfa_extra_fields_multiselect','geodir_cfa_extra_fields_smr',10,4);
|
|
| 3151 | -add_filter('geodir_cfa_extra_fields_select','geodir_cfa_extra_fields_smr',10,4);
|
|
| 3152 | -add_filter('geodir_cfa_extra_fields_radio','geodir_cfa_extra_fields_smr',10,4);
|
|
| 3150 | +add_filter('geodir_cfa_extra_fields_multiselect', 'geodir_cfa_extra_fields_smr', 10, 4);
|
|
| 3151 | +add_filter('geodir_cfa_extra_fields_select', 'geodir_cfa_extra_fields_smr', 10, 4);
|
|
| 3152 | +add_filter('geodir_cfa_extra_fields_radio', 'geodir_cfa_extra_fields_smr', 10, 4);
|
|
| 3153 | 3153 | |
| 3154 | 3154 | |
| 3155 | -function geodir_cfa_extra_fields_datepicker($output,$result_str,$cf,$field_info){
|
|
| 3155 | +function geodir_cfa_extra_fields_datepicker($output, $result_str, $cf, $field_info) {
|
|
| 3156 | 3156 | ob_start(); |
| 3157 | 3157 | $extra = array(); |
| 3158 | 3158 | if (isset($field_info->extra_fields) && $field_info->extra_fields != '') {
|
@@ -3163,7 +3163,7 @@ discard block |
||
| 3163 | 3163 | <label for="date_format" class="gd-cf-tooltip-wrap"> |
| 3164 | 3164 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Date Format :', 'geodirectory'); ?>
|
| 3165 | 3165 | <div class="gdcf-tooltip"> |
| 3166 | - <?php _e('Select the date format.', 'geodirectory');?>
|
|
| 3166 | + <?php _e('Select the date format.', 'geodirectory'); ?>
|
|
| 3167 | 3167 | </div> |
| 3168 | 3168 | </label> |
| 3169 | 3169 | <div class="gd-cf-input-wrap" style="overflow:inherit;"> |
@@ -3183,16 +3183,16 @@ discard block |
||
| 3183 | 3183 | * @since 1.6.5 |
| 3184 | 3184 | * @param array $date_formats The PHP date format array. |
| 3185 | 3185 | */ |
| 3186 | - $date_formats = apply_filters('geodir_date_formats',$date_formats);
|
|
| 3186 | + $date_formats = apply_filters('geodir_date_formats', $date_formats);
|
|
| 3187 | 3187 | ?> |
| 3188 | 3188 | <select name="extra[date_format]" id="date_format"> |
| 3189 | 3189 | <?php |
| 3190 | - foreach($date_formats as $format){
|
|
| 3190 | + foreach ($date_formats as $format) {
|
|
| 3191 | 3191 | $selected = ''; |
| 3192 | - if(!empty($extra) && esc_attr($extra['date_format'])==$format){
|
|
| 3192 | + if (!empty($extra) && esc_attr($extra['date_format']) == $format) {
|
|
| 3193 | 3193 | $selected = "selected='selected'"; |
| 3194 | 3194 | } |
| 3195 | - echo "<option $selected value='$format'>$format (".date_i18n( $format, time()).")</option>";
|
|
| 3195 | + echo "<option $selected value='$format'>$format (".date_i18n($format, time()).")</option>";
|
|
| 3196 | 3196 | } |
| 3197 | 3197 | ?> |
| 3198 | 3198 | </select> |
@@ -3204,10 +3204,10 @@ discard block |
||
| 3204 | 3204 | $html = ob_get_clean(); |
| 3205 | 3205 | return $output.$html; |
| 3206 | 3206 | } |
| 3207 | -add_filter('geodir_cfa_extra_fields_datepicker','geodir_cfa_extra_fields_datepicker',10,4);
|
|
| 3207 | +add_filter('geodir_cfa_extra_fields_datepicker', 'geodir_cfa_extra_fields_datepicker', 10, 4);
|
|
| 3208 | 3208 | |
| 3209 | 3209 | |
| 3210 | -function geodir_cfa_extra_fields_file($output,$result_str,$cf,$field_info){
|
|
| 3210 | +function geodir_cfa_extra_fields_file($output, $result_str, $cf, $field_info) {
|
|
| 3211 | 3211 | ob_start(); |
| 3212 | 3212 | $allowed_file_types = geodir_allowed_mime_types(); |
| 3213 | 3213 | |
@@ -3218,16 +3218,16 @@ discard block |
||
| 3218 | 3218 | <label for="gd_file_types" class="gd-cf-tooltip-wrap"> |
| 3219 | 3219 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Allowed file types :', 'geodirectory'); ?>
|
| 3220 | 3220 | <div class="gdcf-tooltip"> |
| 3221 | - <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory');?>
|
|
| 3221 | + <?php _e('Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'geodirectory'); ?>
|
|
| 3222 | 3222 | </div> |
| 3223 | 3223 | </label> |
| 3224 | 3224 | <div class="gd-cf-input-wrap"> |
| 3225 | 3225 | <select name="extra[gd_file_types][]" id="gd_file_types" multiple="multiple" style="height:100px;width:90%;"> |
| 3226 | - <option value="*" <?php selected(true, in_array('*', $gd_file_types));?>><?php _e('All types', 'geodirectory') ;?></option>
|
|
| 3227 | - <?php foreach ( $allowed_file_types as $format => $types ) { ?>
|
|
| 3228 | - <optgroup label="<?php echo esc_attr( wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory') ) ) ;?>">
|
|
| 3229 | - <?php foreach ( $types as $ext => $type ) { ?>
|
|
| 3230 | - <option value="<?php echo esc_attr($ext) ;?>" <?php selected(true, in_array($ext, $gd_file_types));?>><?php echo '.' . $ext ;?></option> |
|
| 3226 | + <option value="*" <?php selected(true, in_array('*', $gd_file_types)); ?>><?php _e('All types', 'geodirectory'); ?></option>
|
|
| 3227 | + <?php foreach ($allowed_file_types as $format => $types) { ?>
|
|
| 3228 | + <optgroup label="<?php echo esc_attr(wp_sprintf(__('%s formats', 'geodirectory'), __($format, 'geodirectory'))); ?>">
|
|
| 3229 | + <?php foreach ($types as $ext => $type) { ?>
|
|
| 3230 | + <option value="<?php echo esc_attr($ext); ?>" <?php selected(true, in_array($ext, $gd_file_types)); ?>><?php echo '.'.$ext; ?></option> |
|
| 3231 | 3231 | <?php } ?> |
| 3232 | 3232 | </optgroup> |
| 3233 | 3233 | <?php } ?> |
@@ -3239,9 +3239,9 @@ discard block |
||
| 3239 | 3239 | $html = ob_get_clean(); |
| 3240 | 3240 | return $output.$html; |
| 3241 | 3241 | } |
| 3242 | -add_filter('geodir_cfa_extra_fields_file','geodir_cfa_extra_fields_file',10,4);
|
|
| 3242 | +add_filter('geodir_cfa_extra_fields_file', 'geodir_cfa_extra_fields_file', 10, 4);
|
|
| 3243 | 3243 | |
| 3244 | -function geodir_cfa_extra_fields_text($output,$result_str,$cf,$field_info){
|
|
| 3244 | +function geodir_cfa_extra_fields_text($output, $result_str, $cf, $field_info) {
|
|
| 3245 | 3245 | ob_start(); |
| 3246 | 3246 | |
| 3247 | 3247 | $extra_fields = isset($field_info->extra_fields) && $field_info->extra_fields != '' ? maybe_unserialize($field_info->extra_fields) : ''; |
@@ -3255,15 +3255,15 @@ discard block |
||
| 3255 | 3255 | $value = ''; |
| 3256 | 3256 | if ($extra_fields && isset($extra_fields['is_price'])) {
|
| 3257 | 3257 | $value = esc_attr($extra_fields['is_price']); |
| 3258 | - }elseif(isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']){
|
|
| 3258 | + }elseif (isset($cf['defaults']['extra_fields']['is_price']) && $cf['defaults']['extra_fields']['is_price']) {
|
|
| 3259 | 3259 | $value = esc_attr($cf['defaults']['extra_fields']['is_price']); |
| 3260 | 3260 | } |
| 3261 | 3261 | |
| 3262 | - $show_price_extra = ($value==1) ? 1 : 0; |
|
| 3262 | + $show_price_extra = ($value == 1) ? 1 : 0; |
|
| 3263 | 3263 | |
| 3264 | - $show_price = (isset($field_info->data_type) && ($field_info->data_type=='INT' && $field_info->data_type=='FLOAT')) ? 1 : 0; |
|
| 3264 | + $show_price = (isset($field_info->data_type) && ($field_info->data_type == 'INT' && $field_info->data_type == 'FLOAT')) ? 1 : 0; |
|
| 3265 | 3265 | ?> |
| 3266 | - <li class="gdcf-price-extra-set" <?php if(!$show_price){ echo "style='display:none;'";}?>>
|
|
| 3266 | + <li class="gdcf-price-extra-set" <?php if (!$show_price) { echo "style='display:none;'"; }?>>
|
|
| 3267 | 3267 | <label for="is_price" class="gd-cf-tooltip-wrap"> |
| 3268 | 3268 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Display as price? :', 'geodirectory'); ?>
|
| 3269 | 3269 | <div class="gdcf-tooltip"> |
@@ -3272,17 +3272,17 @@ discard block |
||
| 3272 | 3272 | </label> |
| 3273 | 3273 | <div class="gd-cf-input-wrap gd-switch"> |
| 3274 | 3274 | |
| 3275 | - <input type="radio" id="is_price_yes<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-enabled" value="1" |
|
| 3275 | + <input type="radio" id="is_price_yes<?php echo $radio_id; ?>" name="extra[is_price]" class="gdri-enabled" value="1" |
|
| 3276 | 3276 | <?php if ($value == '1') {
|
| 3277 | 3277 | echo 'checked'; |
| 3278 | 3278 | } ?>/> |
| 3279 | - <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>
|
|
| 3279 | + <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>
|
|
| 3280 | 3280 | |
| 3281 | - <input type="radio" id="is_price_no<?php echo $radio_id;?>" name="extra[is_price]" class="gdri-disabled" value="0" |
|
| 3281 | + <input type="radio" id="is_price_no<?php echo $radio_id; ?>" name="extra[is_price]" class="gdri-disabled" value="0" |
|
| 3282 | 3282 | <?php if ($value == '0' || !$value) {
|
| 3283 | 3283 | echo 'checked'; |
| 3284 | 3284 | } ?>/> |
| 3285 | - <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>
|
|
| 3285 | + <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>
|
|
| 3286 | 3286 | |
| 3287 | 3287 | </div> |
| 3288 | 3288 | </li> |
@@ -3292,23 +3292,23 @@ discard block |
||
| 3292 | 3292 | $value = ''; |
| 3293 | 3293 | if ($extra_fields && isset($extra_fields['thousand_separator'])) {
|
| 3294 | 3294 | $value = esc_attr($extra_fields['thousand_separator']); |
| 3295 | - }elseif(isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']){
|
|
| 3295 | + }elseif (isset($cf['defaults']['extra_fields']['thousand_separator']) && $cf['defaults']['extra_fields']['thousand_separator']) {
|
|
| 3296 | 3296 | $value = esc_attr($cf['defaults']['extra_fields']['thousand_separator']); |
| 3297 | 3297 | } |
| 3298 | 3298 | ?> |
| 3299 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3300 | - <label for="thousand_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Thousand separator :', 'geodirectory');?>
|
|
| 3299 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3300 | + <label for="thousand_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Thousand separator :', 'geodirectory'); ?>
|
|
| 3301 | 3301 | <div class="gdcf-tooltip"> |
| 3302 | 3302 | <?php _e('Select the thousand separator.', 'geodirectory'); ?>
|
| 3303 | 3303 | </div> |
| 3304 | 3304 | </label> |
| 3305 | 3305 | <div class="gd-cf-input-wrap"> |
| 3306 | 3306 | <select name="extra[thousand_separator]" id="thousand_separator"> |
| 3307 | - <option value="comma" <?php selected(true, $value == 'comma');?>><?php _e(', (comma)', 'geodirectory'); ?></option>
|
|
| 3308 | - <option value="slash" <?php selected(true, $value == "slash");?>><?php _e('\ (slash)', 'geodirectory'); ?></option>
|
|
| 3309 | - <option value="period" <?php selected(true, $value == 'period');?>><?php _e('. (period)', 'geodirectory'); ?></option>
|
|
| 3310 | - <option value="space" <?php selected(true, $value == 'space');?>><?php _e(' (space)', 'geodirectory'); ?></option>
|
|
| 3311 | - <option value="none" <?php selected(true, $value == 'none');?>><?php _e('(none)', 'geodirectory'); ?></option>
|
|
| 3307 | + <option value="comma" <?php selected(true, $value == 'comma'); ?>><?php _e(', (comma)', 'geodirectory'); ?></option>
|
|
| 3308 | + <option value="slash" <?php selected(true, $value == "slash"); ?>><?php _e('\ (slash)', 'geodirectory'); ?></option>
|
|
| 3309 | + <option value="period" <?php selected(true, $value == 'period'); ?>><?php _e('. (period)', 'geodirectory'); ?></option>
|
|
| 3310 | + <option value="space" <?php selected(true, $value == 'space'); ?>><?php _e(' (space)', 'geodirectory'); ?></option>
|
|
| 3311 | + <option value="none" <?php selected(true, $value == 'none'); ?>><?php _e('(none)', 'geodirectory'); ?></option>
|
|
| 3312 | 3312 | </select> |
| 3313 | 3313 | </div> |
| 3314 | 3314 | </li> |
@@ -3319,20 +3319,20 @@ discard block |
||
| 3319 | 3319 | $value = ''; |
| 3320 | 3320 | if ($extra_fields && isset($extra_fields['decimal_separator'])) {
|
| 3321 | 3321 | $value = esc_attr($extra_fields['decimal_separator']); |
| 3322 | - }elseif(isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']){
|
|
| 3322 | + }elseif (isset($cf['defaults']['extra_fields']['decimal_separator']) && $cf['defaults']['extra_fields']['decimal_separator']) {
|
|
| 3323 | 3323 | $value = esc_attr($cf['defaults']['extra_fields']['decimal_separator']); |
| 3324 | 3324 | } |
| 3325 | 3325 | ?> |
| 3326 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3327 | - <label for="decimal_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal separator :', 'geodirectory');?>
|
|
| 3326 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3327 | + <label for="decimal_separator" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal separator :', 'geodirectory'); ?>
|
|
| 3328 | 3328 | <div class="gdcf-tooltip"> |
| 3329 | 3329 | <?php _e('Select the decimal separator.', 'geodirectory'); ?>
|
| 3330 | 3330 | </div> |
| 3331 | 3331 | </label> |
| 3332 | 3332 | <div class="gd-cf-input-wrap"> |
| 3333 | 3333 | <select name="extra[decimal_separator]" id="decimal_separator"> |
| 3334 | - <option value="period" <?php selected(true, $value == 'period');?>><?php _e('. (period)', 'geodirectory'); ?></option>
|
|
| 3335 | - <option value="comma" <?php selected(true, $value == "comma");?>><?php _e(', (comma)', 'geodirectory'); ?></option>
|
|
| 3334 | + <option value="period" <?php selected(true, $value == 'period'); ?>><?php _e('. (period)', 'geodirectory'); ?></option>
|
|
| 3335 | + <option value="comma" <?php selected(true, $value == "comma"); ?>><?php _e(', (comma)', 'geodirectory'); ?></option>
|
|
| 3336 | 3336 | </select> |
| 3337 | 3337 | </div> |
| 3338 | 3338 | </li> |
@@ -3342,20 +3342,20 @@ discard block |
||
| 3342 | 3342 | $value = ''; |
| 3343 | 3343 | if ($extra_fields && isset($extra_fields['decimal_display'])) {
|
| 3344 | 3344 | $value = esc_attr($extra_fields['decimal_display']); |
| 3345 | - }elseif(isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']){
|
|
| 3345 | + }elseif (isset($cf['defaults']['extra_fields']['decimal_display']) && $cf['defaults']['extra_fields']['decimal_display']) {
|
|
| 3346 | 3346 | $value = esc_attr($cf['defaults']['extra_fields']['decimal_display']); |
| 3347 | 3347 | } |
| 3348 | 3348 | ?> |
| 3349 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3350 | - <label for="decimal_display" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal display :', 'geodirectory');?>
|
|
| 3349 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3350 | + <label for="decimal_display" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Decimal display :', 'geodirectory'); ?>
|
|
| 3351 | 3351 | <div class="gdcf-tooltip"> |
| 3352 | 3352 | <?php _e('Select how the decimal is displayed', 'geodirectory'); ?>
|
| 3353 | 3353 | </div> |
| 3354 | 3354 | </label> |
| 3355 | 3355 | <div class="gd-cf-input-wrap"> |
| 3356 | 3356 | <select name="extra[decimal_display]" id="decimal_display"> |
| 3357 | - <option value="if" <?php selected(true, $value == 'if');?>><?php _e('If used (not .00)', 'geodirectory'); ?></option>
|
|
| 3358 | - <option value="allways" <?php selected(true, $value == "allways");?>><?php _e('Always (.00)', 'geodirectory'); ?></option>
|
|
| 3357 | + <option value="if" <?php selected(true, $value == 'if'); ?>><?php _e('If used (not .00)', 'geodirectory'); ?></option>
|
|
| 3358 | + <option value="allways" <?php selected(true, $value == "allways"); ?>><?php _e('Always (.00)', 'geodirectory'); ?></option>
|
|
| 3359 | 3359 | </select> |
| 3360 | 3360 | </div> |
| 3361 | 3361 | </li> |
@@ -3365,12 +3365,12 @@ discard block |
||
| 3365 | 3365 | $value = ''; |
| 3366 | 3366 | if ($extra_fields && isset($extra_fields['currency_symbol'])) {
|
| 3367 | 3367 | $value = esc_attr($extra_fields['currency_symbol']); |
| 3368 | - }elseif(isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']){
|
|
| 3368 | + }elseif (isset($cf['defaults']['extra_fields']['currency_symbol']) && $cf['defaults']['extra_fields']['currency_symbol']) {
|
|
| 3369 | 3369 | $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol']); |
| 3370 | 3370 | } |
| 3371 | 3371 | ?> |
| 3372 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3373 | - <label for="currency_symbol" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol :', 'geodirectory');?>
|
|
| 3372 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3373 | + <label for="currency_symbol" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Currency symbol :', 'geodirectory'); ?>
|
|
| 3374 | 3374 | <div class="gdcf-tooltip"> |
| 3375 | 3375 | <?php _e('Select the currency symbol.', 'geodirectory'); ?>
|
| 3376 | 3376 | </div> |
@@ -3386,20 +3386,20 @@ discard block |
||
| 3386 | 3386 | $value = ''; |
| 3387 | 3387 | if ($extra_fields && isset($extra_fields['currency_symbol_placement'])) {
|
| 3388 | 3388 | $value = esc_attr($extra_fields['currency_symbol_placement']); |
| 3389 | - }elseif(isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']){
|
|
| 3389 | + }elseif (isset($cf['defaults']['extra_fields']['currency_symbol_placement']) && $cf['defaults']['extra_fields']['currency_symbol_placement']) {
|
|
| 3390 | 3390 | $value = esc_attr($cf['defaults']['extra_fields']['currency_symbol_placement']); |
| 3391 | 3391 | } |
| 3392 | 3392 | ?> |
| 3393 | - <li class="gdcf-price-extra" <?php if(!$show_price_extra){ echo "style='display:none;'";}?>>
|
|
| 3394 | - <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');?>
|
|
| 3393 | + <li class="gdcf-price-extra" <?php if (!$show_price_extra) { echo "style='display:none;'"; }?>>
|
|
| 3394 | + <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'); ?>
|
|
| 3395 | 3395 | <div class="gdcf-tooltip"> |
| 3396 | 3396 | <?php _e('Select the currency symbol placement.', 'geodirectory'); ?>
|
| 3397 | 3397 | </div> |
| 3398 | 3398 | </label> |
| 3399 | 3399 | <div class="gd-cf-input-wrap"> |
| 3400 | 3400 | <select name="extra[currency_symbol_placement]" id="currency_symbol_placement"> |
| 3401 | - <option value="left" <?php selected(true, $value == 'left');?>><?php _e('Left', 'geodirectory'); ?></option>
|
|
| 3402 | - <option value="right" <?php selected(true, $value == "right");?>><?php _e('Right', 'geodirectory'); ?></option>
|
|
| 3401 | + <option value="left" <?php selected(true, $value == 'left'); ?>><?php _e('Left', 'geodirectory'); ?></option>
|
|
| 3402 | + <option value="right" <?php selected(true, $value == "right"); ?>><?php _e('Right', 'geodirectory'); ?></option>
|
|
| 3403 | 3403 | </select> |
| 3404 | 3404 | </div> |
| 3405 | 3405 | </li> |
@@ -3410,11 +3410,11 @@ discard block |
||
| 3410 | 3410 | $html = ob_get_clean(); |
| 3411 | 3411 | return $output.$html; |
| 3412 | 3412 | } |
| 3413 | -add_filter('geodir_cfa_extra_fields_text','geodir_cfa_extra_fields_text',10,4);
|
|
| 3413 | +add_filter('geodir_cfa_extra_fields_text', 'geodir_cfa_extra_fields_text', 10, 4);
|
|
| 3414 | 3414 | |
| 3415 | -function geodir_default_custom_fields($post_type='gd_place',$package_id=''){
|
|
| 3415 | +function geodir_default_custom_fields($post_type = 'gd_place', $package_id = '') {
|
|
| 3416 | 3416 | $fields = array(); |
| 3417 | - $package = ($package_id=='') ? '' : array($package_id); |
|
| 3417 | + $package = ($package_id == '') ? '' : array($package_id); |
|
| 3418 | 3418 | |
| 3419 | 3419 | $fields[] = array('listing_type' => $post_type,
|
| 3420 | 3420 | 'data_type' => 'VARCHAR', |
@@ -3587,7 +3587,7 @@ discard block |
||
| 3587 | 3587 | return $fields; |
| 3588 | 3588 | } |
| 3589 | 3589 | |
| 3590 | -function geodir_currency_format_number($number='',$cf=''){
|
|
| 3590 | +function geodir_currency_format_number($number = '', $cf = '') {
|
|
| 3591 | 3591 | |
| 3592 | 3592 | $cs = isset($cf['extra_fields']) ? maybe_unserialize($cf['extra_fields']) : ''; |
| 3593 | 3593 | |
@@ -3596,35 +3596,35 @@ discard block |
||
| 3596 | 3596 | $decimal_display = isset($cf['decimal_display']) && $cf['decimal_display'] ? $cf['decimal_display'] : 'if'; |
| 3597 | 3597 | $decimalpoint = '.'; |
| 3598 | 3598 | |
| 3599 | - if(isset($cs['decimal_separator']) && $cs['decimal_separator']=='comma'){
|
|
| 3599 | + if (isset($cs['decimal_separator']) && $cs['decimal_separator'] == 'comma') {
|
|
| 3600 | 3600 | $decimalpoint = ','; |
| 3601 | 3601 | } |
| 3602 | 3602 | |
| 3603 | 3603 | $separator = ','; |
| 3604 | 3604 | |
| 3605 | - if(isset($cs['thousand_separator'])){
|
|
| 3606 | - if($cs['thousand_separator']=='comma'){$separator = ',';}
|
|
| 3607 | - if($cs['thousand_separator']=='slash'){$separator = '\\';}
|
|
| 3608 | - if($cs['thousand_separator']=='period'){$separator = '.';}
|
|
| 3609 | - if($cs['thousand_separator']=='space'){$separator = ' ';}
|
|
| 3610 | - if($cs['thousand_separator']=='none'){$separator = '';}
|
|
| 3605 | + if (isset($cs['thousand_separator'])) {
|
|
| 3606 | + if ($cs['thousand_separator'] == 'comma') {$separator = ','; }
|
|
| 3607 | + if ($cs['thousand_separator'] == 'slash') {$separator = '\\'; }
|
|
| 3608 | + if ($cs['thousand_separator'] == 'period') {$separator = '.'; }
|
|
| 3609 | + if ($cs['thousand_separator'] == 'space') {$separator = ' '; }
|
|
| 3610 | + if ($cs['thousand_separator'] == 'none') {$separator = ''; }
|
|
| 3611 | 3611 | } |
| 3612 | 3612 | |
| 3613 | 3613 | $currency_symbol_placement = isset($cs['currency_symbol_placement']) ? $cs['currency_symbol_placement'] : 'left'; |
| 3614 | 3614 | |
| 3615 | - if($decimals>0 && $decimal_display=='if'){
|
|
| 3616 | - if(is_int($number) || floor( $number ) == $number) |
|
| 3615 | + if ($decimals > 0 && $decimal_display == 'if') {
|
|
| 3616 | + if (is_int($number) || floor($number) == $number) |
|
| 3617 | 3617 | $decimals = 0; |
| 3618 | 3618 | } |
| 3619 | 3619 | |
| 3620 | - $number = number_format($number,$decimals,$decimalpoint,$separator); |
|
| 3620 | + $number = number_format($number, $decimals, $decimalpoint, $separator); |
|
| 3621 | 3621 | |
| 3622 | 3622 | |
| 3623 | 3623 | |
| 3624 | - if($currency_symbol_placement=='left'){
|
|
| 3625 | - $number = $symbol . $number; |
|
| 3626 | - }else{
|
|
| 3627 | - $number = $number . $symbol; |
|
| 3624 | + if ($currency_symbol_placement == 'left') {
|
|
| 3625 | + $number = $symbol.$number; |
|
| 3626 | + } else {
|
|
| 3627 | + $number = $number.$symbol; |
|
| 3628 | 3628 | } |
| 3629 | 3629 | |
| 3630 | 3630 | |