@@ -19,35 +19,35 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | function geodir_cfi_fieldset($html,$cf){ |
| 21 | 21 | |
| 22 | - $html_var = $cf['htmlvar_name']; |
|
| 23 | - |
|
| 24 | - // Check if there is a custom field specific filter. |
|
| 25 | - if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){ |
|
| 26 | - /** |
|
| 27 | - * Filter the fieldset html by individual custom field. |
|
| 28 | - * |
|
| 29 | - * @param string $html The html to filter. |
|
| 30 | - * @param array $cf The custom field array. |
|
| 31 | - * @since 1.6.6 |
|
| 32 | - */ |
|
| 33 | - $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf); |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - // If no html then we run the standard output. |
|
| 37 | - if(empty($html)) { |
|
| 38 | - |
|
| 39 | - ob_start(); // Start buffering; |
|
| 40 | - ?> |
|
| 22 | + $html_var = $cf['htmlvar_name']; |
|
| 23 | + |
|
| 24 | + // Check if there is a custom field specific filter. |
|
| 25 | + if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){ |
|
| 26 | + /** |
|
| 27 | + * Filter the fieldset html by individual custom field. |
|
| 28 | + * |
|
| 29 | + * @param string $html The html to filter. |
|
| 30 | + * @param array $cf The custom field array. |
|
| 31 | + * @since 1.6.6 |
|
| 32 | + */ |
|
| 33 | + $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf); |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + // If no html then we run the standard output. |
|
| 37 | + if(empty($html)) { |
|
| 38 | + |
|
| 39 | + ob_start(); // Start buffering; |
|
| 40 | + ?> |
|
| 41 | 41 | <h5 id="geodir_fieldset_<?php echo (int) $cf['id']; ?>" class="geodir-fieldset-row" |
| 42 | 42 | gd-fieldset="<?php echo (int) $cf['id']; ?>"><?php echo __( $cf['site_title'], 'geodirectory' ); ?> |
| 43 | 43 | <?php if ( $cf['desc'] != '' ) { |
| 44 | - echo '<small>( ' . __( $cf['desc'], 'geodirectory' ) . ' )</small>'; |
|
| 45 | - } ?></h5> |
|
| 44 | + echo '<small>( ' . __( $cf['desc'], 'geodirectory' ) . ' )</small>'; |
|
| 45 | + } ?></h5> |
|
| 46 | 46 | <?php |
| 47 | - $html = ob_get_clean(); |
|
| 48 | - } |
|
| 47 | + $html = ob_get_clean(); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - return $html; |
|
| 50 | + return $html; |
|
| 51 | 51 | } |
| 52 | 52 | add_filter('geodir_custom_field_input_fieldset','geodir_cfi_fieldset',10,2); |
| 53 | 53 | |
@@ -64,47 +64,47 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | function geodir_cfi_text($html,$cf){ |
| 66 | 66 | |
| 67 | - $html_var = $cf['htmlvar_name']; |
|
| 68 | - |
|
| 69 | - // Check if there is a custom field specific filter. |
|
| 70 | - if(has_filter("geodir_custom_field_input_text_{$html_var}")){ |
|
| 71 | - /** |
|
| 72 | - * Filter the text html by individual custom field. |
|
| 73 | - * |
|
| 74 | - * @param string $html The html to filter. |
|
| 75 | - * @param array $cf The custom field array. |
|
| 76 | - * @since 1.6.6 |
|
| 77 | - */ |
|
| 78 | - $html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf); |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - // If no html then we run the standard output. |
|
| 82 | - if(empty($html)) { |
|
| 83 | - |
|
| 84 | - ob_start(); // Start buffering; |
|
| 85 | - |
|
| 86 | - $value = geodir_get_cf_value($cf); |
|
| 87 | - $type = $cf['type']; |
|
| 88 | - //number and float validation $validation_pattern |
|
| 89 | - if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';} |
|
| 90 | - elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';} |
|
| 91 | - |
|
| 92 | - //validation |
|
| 93 | - if(isset($cf['validation_pattern']) && $cf['validation_pattern']){ |
|
| 94 | - $validation = 'pattern="'.$cf['validation_pattern'].'"'; |
|
| 95 | - }else{$validation='';} |
|
| 96 | - |
|
| 97 | - // validation message |
|
| 98 | - if(isset($cf['validation_msg']) && $cf['validation_msg']){ |
|
| 99 | - $validation_msg = 'title="'.$cf['validation_msg'].'"'; |
|
| 100 | - }else{$validation_msg='';} |
|
| 101 | - ?> |
|
| 67 | + $html_var = $cf['htmlvar_name']; |
|
| 68 | + |
|
| 69 | + // Check if there is a custom field specific filter. |
|
| 70 | + if(has_filter("geodir_custom_field_input_text_{$html_var}")){ |
|
| 71 | + /** |
|
| 72 | + * Filter the text html by individual custom field. |
|
| 73 | + * |
|
| 74 | + * @param string $html The html to filter. |
|
| 75 | + * @param array $cf The custom field array. |
|
| 76 | + * @since 1.6.6 |
|
| 77 | + */ |
|
| 78 | + $html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf); |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + // If no html then we run the standard output. |
|
| 82 | + if(empty($html)) { |
|
| 83 | + |
|
| 84 | + ob_start(); // Start buffering; |
|
| 85 | + |
|
| 86 | + $value = geodir_get_cf_value($cf); |
|
| 87 | + $type = $cf['type']; |
|
| 88 | + //number and float validation $validation_pattern |
|
| 89 | + if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';} |
|
| 90 | + elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';} |
|
| 91 | + |
|
| 92 | + //validation |
|
| 93 | + if(isset($cf['validation_pattern']) && $cf['validation_pattern']){ |
|
| 94 | + $validation = 'pattern="'.$cf['validation_pattern'].'"'; |
|
| 95 | + }else{$validation='';} |
|
| 96 | + |
|
| 97 | + // validation message |
|
| 98 | + if(isset($cf['validation_msg']) && $cf['validation_msg']){ |
|
| 99 | + $validation_msg = 'title="'.$cf['validation_msg'].'"'; |
|
| 100 | + }else{$validation_msg='';} |
|
| 101 | + ?> |
|
| 102 | 102 | |
| 103 | 103 | <div id="<?php echo $cf['name'];?>_row" |
| 104 | 104 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 105 | 105 | <label> |
| 106 | 106 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 107 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 107 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 108 | 108 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 109 | 109 | </label> |
| 110 | 110 | <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
@@ -116,10 +116,10 @@ discard block |
||
| 116 | 116 | </div> |
| 117 | 117 | |
| 118 | 118 | <?php |
| 119 | - $html = ob_get_clean(); |
|
| 120 | - } |
|
| 119 | + $html = ob_get_clean(); |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - return $html; |
|
| 122 | + return $html; |
|
| 123 | 123 | } |
| 124 | 124 | add_filter('geodir_custom_field_input_text','geodir_cfi_text',10,2); |
| 125 | 125 | |
@@ -135,35 +135,35 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | function geodir_cfi_email($html,$cf){ |
| 137 | 137 | |
| 138 | - $html_var = $cf['htmlvar_name']; |
|
| 138 | + $html_var = $cf['htmlvar_name']; |
|
| 139 | 139 | |
| 140 | - // Check if there is a custom field specific filter. |
|
| 141 | - if(has_filter("geodir_custom_field_input_email_{$html_var}")){ |
|
| 142 | - /** |
|
| 143 | - * Filter the email html by individual custom field. |
|
| 144 | - * |
|
| 145 | - * @param string $html The html to filter. |
|
| 146 | - * @param array $cf The custom field array. |
|
| 147 | - * @since 1.6.6 |
|
| 148 | - */ |
|
| 149 | - $html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf); |
|
| 150 | - } |
|
| 140 | + // Check if there is a custom field specific filter. |
|
| 141 | + if(has_filter("geodir_custom_field_input_email_{$html_var}")){ |
|
| 142 | + /** |
|
| 143 | + * Filter the email html by individual custom field. |
|
| 144 | + * |
|
| 145 | + * @param string $html The html to filter. |
|
| 146 | + * @param array $cf The custom field array. |
|
| 147 | + * @since 1.6.6 |
|
| 148 | + */ |
|
| 149 | + $html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf); |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - // If no html then we run the standard output. |
|
| 153 | - if(empty($html)) { |
|
| 152 | + // If no html then we run the standard output. |
|
| 153 | + if(empty($html)) { |
|
| 154 | 154 | |
| 155 | - ob_start(); // Start buffering; |
|
| 156 | - $value = geodir_get_cf_value($cf); |
|
| 155 | + ob_start(); // Start buffering; |
|
| 156 | + $value = geodir_get_cf_value($cf); |
|
| 157 | 157 | |
| 158 | - if ($value == $cf['default']) { |
|
| 159 | - $value = ''; |
|
| 160 | - }?> |
|
| 158 | + if ($value == $cf['default']) { |
|
| 159 | + $value = ''; |
|
| 160 | + }?> |
|
| 161 | 161 | |
| 162 | 162 | <div id="<?php echo $cf['name'];?>_row" |
| 163 | 163 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 164 | 164 | <label> |
| 165 | 165 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 166 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 166 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 167 | 167 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 168 | 168 | </label> |
| 169 | 169 | <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
@@ -175,10 +175,10 @@ discard block |
||
| 175 | 175 | </div> |
| 176 | 176 | |
| 177 | 177 | <?php |
| 178 | - $html = ob_get_clean(); |
|
| 179 | - } |
|
| 178 | + $html = ob_get_clean(); |
|
| 179 | + } |
|
| 180 | 180 | |
| 181 | - return $html; |
|
| 181 | + return $html; |
|
| 182 | 182 | } |
| 183 | 183 | add_filter('geodir_custom_field_input_email','geodir_cfi_email',10,2); |
| 184 | 184 | |
@@ -195,35 +195,35 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | function geodir_cfi_phone($html,$cf){ |
| 197 | 197 | |
| 198 | - $html_var = $cf['htmlvar_name']; |
|
| 198 | + $html_var = $cf['htmlvar_name']; |
|
| 199 | 199 | |
| 200 | - // Check if there is a custom field specific filter. |
|
| 201 | - if(has_filter("geodir_custom_field_input_phone_{$html_var}")){ |
|
| 202 | - /** |
|
| 203 | - * Filter the phone html by individual custom field. |
|
| 204 | - * |
|
| 205 | - * @param string $html The html to filter. |
|
| 206 | - * @param array $cf The custom field array. |
|
| 207 | - * @since 1.6.6 |
|
| 208 | - */ |
|
| 209 | - $html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf); |
|
| 210 | - } |
|
| 200 | + // Check if there is a custom field specific filter. |
|
| 201 | + if(has_filter("geodir_custom_field_input_phone_{$html_var}")){ |
|
| 202 | + /** |
|
| 203 | + * Filter the phone html by individual custom field. |
|
| 204 | + * |
|
| 205 | + * @param string $html The html to filter. |
|
| 206 | + * @param array $cf The custom field array. |
|
| 207 | + * @since 1.6.6 |
|
| 208 | + */ |
|
| 209 | + $html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf); |
|
| 210 | + } |
|
| 211 | 211 | |
| 212 | - // If no html then we run the standard output. |
|
| 213 | - if(empty($html)) { |
|
| 212 | + // If no html then we run the standard output. |
|
| 213 | + if(empty($html)) { |
|
| 214 | 214 | |
| 215 | - ob_start(); // Start buffering; |
|
| 216 | - $value = geodir_get_cf_value($cf); |
|
| 215 | + ob_start(); // Start buffering; |
|
| 216 | + $value = geodir_get_cf_value($cf); |
|
| 217 | 217 | |
| 218 | - if ($value == $cf['default']) { |
|
| 219 | - $value = ''; |
|
| 220 | - }?> |
|
| 218 | + if ($value == $cf['default']) { |
|
| 219 | + $value = ''; |
|
| 220 | + }?> |
|
| 221 | 221 | |
| 222 | 222 | <div id="<?php echo $cf['name'];?>_row" |
| 223 | 223 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 224 | 224 | <label> |
| 225 | 225 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 226 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 226 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 227 | 227 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 228 | 228 | </label> |
| 229 | 229 | <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
@@ -235,10 +235,10 @@ discard block |
||
| 235 | 235 | </div> |
| 236 | 236 | |
| 237 | 237 | <?php |
| 238 | - $html = ob_get_clean(); |
|
| 239 | - } |
|
| 238 | + $html = ob_get_clean(); |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | - return $html; |
|
| 241 | + return $html; |
|
| 242 | 242 | } |
| 243 | 243 | add_filter('geodir_custom_field_input_phone','geodir_cfi_phone',10,2); |
| 244 | 244 | |
@@ -255,35 +255,35 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | function geodir_cfi_url($html,$cf){ |
| 257 | 257 | |
| 258 | - $html_var = $cf['htmlvar_name']; |
|
| 258 | + $html_var = $cf['htmlvar_name']; |
|
| 259 | 259 | |
| 260 | - // Check if there is a custom field specific filter. |
|
| 261 | - if(has_filter("geodir_custom_field_input_url_{$html_var}")){ |
|
| 262 | - /** |
|
| 263 | - * Filter the url html by individual custom field. |
|
| 264 | - * |
|
| 265 | - * @param string $html The html to filter. |
|
| 266 | - * @param array $cf The custom field array. |
|
| 267 | - * @since 1.6.6 |
|
| 268 | - */ |
|
| 269 | - $html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf); |
|
| 270 | - } |
|
| 260 | + // Check if there is a custom field specific filter. |
|
| 261 | + if(has_filter("geodir_custom_field_input_url_{$html_var}")){ |
|
| 262 | + /** |
|
| 263 | + * Filter the url html by individual custom field. |
|
| 264 | + * |
|
| 265 | + * @param string $html The html to filter. |
|
| 266 | + * @param array $cf The custom field array. |
|
| 267 | + * @since 1.6.6 |
|
| 268 | + */ |
|
| 269 | + $html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf); |
|
| 270 | + } |
|
| 271 | 271 | |
| 272 | - // If no html then we run the standard output. |
|
| 273 | - if(empty($html)) { |
|
| 272 | + // If no html then we run the standard output. |
|
| 273 | + if(empty($html)) { |
|
| 274 | 274 | |
| 275 | - ob_start(); // Start buffering; |
|
| 276 | - $value = geodir_get_cf_value($cf); |
|
| 275 | + ob_start(); // Start buffering; |
|
| 276 | + $value = geodir_get_cf_value($cf); |
|
| 277 | 277 | |
| 278 | - if ($value == $cf['default']) { |
|
| 279 | - $value = ''; |
|
| 280 | - }?> |
|
| 278 | + if ($value == $cf['default']) { |
|
| 279 | + $value = ''; |
|
| 280 | + }?> |
|
| 281 | 281 | |
| 282 | 282 | <div id="<?php echo $cf['name'];?>_row" |
| 283 | 283 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 284 | 284 | <label> |
| 285 | 285 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 286 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 286 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 287 | 287 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 288 | 288 | </label> |
| 289 | 289 | <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
@@ -298,10 +298,10 @@ discard block |
||
| 298 | 298 | </div> |
| 299 | 299 | |
| 300 | 300 | <?php |
| 301 | - $html = ob_get_clean(); |
|
| 302 | - } |
|
| 301 | + $html = ob_get_clean(); |
|
| 302 | + } |
|
| 303 | 303 | |
| 304 | - return $html; |
|
| 304 | + return $html; |
|
| 305 | 305 | } |
| 306 | 306 | add_filter('geodir_custom_field_input_url','geodir_cfi_url',10,2); |
| 307 | 307 | |
@@ -317,48 +317,48 @@ discard block |
||
| 317 | 317 | */ |
| 318 | 318 | function geodir_cfi_radio($html,$cf){ |
| 319 | 319 | |
| 320 | - $html_var = $cf['htmlvar_name']; |
|
| 320 | + $html_var = $cf['htmlvar_name']; |
|
| 321 | 321 | |
| 322 | - // Check if there is a custom field specific filter. |
|
| 323 | - if(has_filter("geodir_custom_field_input_radio_{$html_var}")){ |
|
| 324 | - /** |
|
| 325 | - * Filter the radio html by individual custom field. |
|
| 326 | - * |
|
| 327 | - * @param string $html The html to filter. |
|
| 328 | - * @param array $cf The custom field array. |
|
| 329 | - * @since 1.6.6 |
|
| 330 | - */ |
|
| 331 | - $html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf); |
|
| 332 | - } |
|
| 322 | + // Check if there is a custom field specific filter. |
|
| 323 | + if(has_filter("geodir_custom_field_input_radio_{$html_var}")){ |
|
| 324 | + /** |
|
| 325 | + * Filter the radio html by individual custom field. |
|
| 326 | + * |
|
| 327 | + * @param string $html The html to filter. |
|
| 328 | + * @param array $cf The custom field array. |
|
| 329 | + * @since 1.6.6 |
|
| 330 | + */ |
|
| 331 | + $html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf); |
|
| 332 | + } |
|
| 333 | 333 | |
| 334 | - // If no html then we run the standard output. |
|
| 335 | - if(empty($html)) { |
|
| 334 | + // If no html then we run the standard output. |
|
| 335 | + if(empty($html)) { |
|
| 336 | 336 | |
| 337 | - ob_start(); // Start buffering; |
|
| 338 | - $value = geodir_get_cf_value($cf); |
|
| 337 | + ob_start(); // Start buffering; |
|
| 338 | + $value = geodir_get_cf_value($cf); |
|
| 339 | 339 | |
| 340 | - ?> |
|
| 340 | + ?> |
|
| 341 | 341 | <div id="<?php echo $cf['name'];?>_row" |
| 342 | 342 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 343 | 343 | <label> |
| 344 | 344 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 345 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 345 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 346 | 346 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 347 | 347 | </label> |
| 348 | 348 | <?php if ($cf['option_values']) { |
| 349 | - $option_values = geodir_string_values_to_options($cf['option_values'], true); |
|
| 349 | + $option_values = geodir_string_values_to_options($cf['option_values'], true); |
|
| 350 | 350 | |
| 351 | - if (!empty($option_values)) { |
|
| 352 | - foreach ($option_values as $option_value) { |
|
| 353 | - if (empty($option_value['optgroup'])) { |
|
| 354 | - ?> |
|
| 351 | + if (!empty($option_values)) { |
|
| 352 | + foreach ($option_values as $option_value) { |
|
| 353 | + if (empty($option_value['optgroup'])) { |
|
| 354 | + ?> |
|
| 355 | 355 | <span class="gd-radios"><input name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" <?php checked(stripslashes($value), $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="radio" /><?php echo $option_value['label']; ?></span> |
| 356 | 356 | <?php |
| 357 | - } |
|
| 358 | - } |
|
| 359 | - } |
|
| 360 | - } |
|
| 361 | - ?> |
|
| 357 | + } |
|
| 358 | + } |
|
| 359 | + } |
|
| 360 | + } |
|
| 361 | + ?> |
|
| 362 | 362 | <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
| 363 | 363 | <?php if ($cf['is_required']) { ?> |
| 364 | 364 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
@@ -366,10 +366,10 @@ discard block |
||
| 366 | 366 | </div> |
| 367 | 367 | |
| 368 | 368 | <?php |
| 369 | - $html = ob_get_clean(); |
|
| 370 | - } |
|
| 369 | + $html = ob_get_clean(); |
|
| 370 | + } |
|
| 371 | 371 | |
| 372 | - return $html; |
|
| 372 | + return $html; |
|
| 373 | 373 | } |
| 374 | 374 | add_filter('geodir_custom_field_input_radio','geodir_cfi_radio',10,2); |
| 375 | 375 | |
@@ -385,46 +385,46 @@ discard block |
||
| 385 | 385 | */ |
| 386 | 386 | function geodir_cfi_checkbox($html,$cf){ |
| 387 | 387 | |
| 388 | - $html_var = $cf['htmlvar_name']; |
|
| 388 | + $html_var = $cf['htmlvar_name']; |
|
| 389 | 389 | |
| 390 | - // Check if there is a custom field specific filter. |
|
| 391 | - if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){ |
|
| 392 | - /** |
|
| 393 | - * Filter the checkbox html by individual custom field. |
|
| 394 | - * |
|
| 395 | - * @param string $html The html to filter. |
|
| 396 | - * @param array $cf The custom field array. |
|
| 397 | - * @since 1.6.6 |
|
| 398 | - */ |
|
| 399 | - $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf); |
|
| 400 | - } |
|
| 390 | + // Check if there is a custom field specific filter. |
|
| 391 | + if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){ |
|
| 392 | + /** |
|
| 393 | + * Filter the checkbox html by individual custom field. |
|
| 394 | + * |
|
| 395 | + * @param string $html The html to filter. |
|
| 396 | + * @param array $cf The custom field array. |
|
| 397 | + * @since 1.6.6 |
|
| 398 | + */ |
|
| 399 | + $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf); |
|
| 400 | + } |
|
| 401 | 401 | |
| 402 | - // If no html then we run the standard output. |
|
| 403 | - if(empty($html)) { |
|
| 402 | + // If no html then we run the standard output. |
|
| 403 | + if(empty($html)) { |
|
| 404 | 404 | |
| 405 | - ob_start(); // Start buffering; |
|
| 406 | - $value = geodir_get_cf_value($cf); |
|
| 405 | + ob_start(); // Start buffering; |
|
| 406 | + $value = geodir_get_cf_value($cf); |
|
| 407 | 407 | |
| 408 | 408 | |
| 409 | - if ($value == '' && $cf['default']) { |
|
| 410 | - $value = '1'; |
|
| 411 | - } |
|
| 412 | - ?> |
|
| 409 | + if ($value == '' && $cf['default']) { |
|
| 410 | + $value = '1'; |
|
| 411 | + } |
|
| 412 | + ?> |
|
| 413 | 413 | |
| 414 | 414 | <div id="<?php echo $cf['name'];?>_row" |
| 415 | 415 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 416 | 416 | <label> |
| 417 | 417 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 418 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 418 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 419 | 419 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 420 | 420 | </label> |
| 421 | 421 | <?php if ($value != '1') { |
| 422 | - $value = '0'; |
|
| 423 | - }?> |
|
| 422 | + $value = '0'; |
|
| 423 | + }?> |
|
| 424 | 424 | <input type="hidden" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" value="<?php echo esc_attr($value);?>"/> |
| 425 | 425 | <input <?php if ($value == '1') { |
| 426 | - echo 'checked="checked"'; |
|
| 427 | - }?> value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox" |
|
| 426 | + echo 'checked="checked"'; |
|
| 427 | + }?> value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox" |
|
| 428 | 428 | onchange="if(this.checked){jQuery('#<?php echo $cf['name'];?>').val('1');} else{ jQuery('#<?php echo $cf['name'];?>').val('0');}"/> |
| 429 | 429 | <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
| 430 | 430 | <?php if ($cf['is_required']) { ?> |
@@ -433,10 +433,10 @@ discard block |
||
| 433 | 433 | </div> |
| 434 | 434 | |
| 435 | 435 | <?php |
| 436 | - $html = ob_get_clean(); |
|
| 437 | - } |
|
| 436 | + $html = ob_get_clean(); |
|
| 437 | + } |
|
| 438 | 438 | |
| 439 | - return $html; |
|
| 439 | + return $html; |
|
| 440 | 440 | } |
| 441 | 441 | add_filter('geodir_custom_field_input_checkbox','geodir_cfi_checkbox',10,2); |
| 442 | 442 | |
@@ -452,52 +452,52 @@ discard block |
||
| 452 | 452 | */ |
| 453 | 453 | function geodir_cfi_textarea($html,$cf){ |
| 454 | 454 | |
| 455 | - $html_var = $cf['htmlvar_name']; |
|
| 455 | + $html_var = $cf['htmlvar_name']; |
|
| 456 | 456 | |
| 457 | - // Check if there is a custom field specific filter. |
|
| 458 | - if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){ |
|
| 459 | - /** |
|
| 460 | - * Filter the textarea html by individual custom field. |
|
| 461 | - * |
|
| 462 | - * @param string $html The html to filter. |
|
| 463 | - * @param array $cf The custom field array. |
|
| 464 | - * @since 1.6.6 |
|
| 465 | - */ |
|
| 466 | - $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf); |
|
| 467 | - } |
|
| 457 | + // Check if there is a custom field specific filter. |
|
| 458 | + if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){ |
|
| 459 | + /** |
|
| 460 | + * Filter the textarea html by individual custom field. |
|
| 461 | + * |
|
| 462 | + * @param string $html The html to filter. |
|
| 463 | + * @param array $cf The custom field array. |
|
| 464 | + * @since 1.6.6 |
|
| 465 | + */ |
|
| 466 | + $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf); |
|
| 467 | + } |
|
| 468 | 468 | |
| 469 | - // If no html then we run the standard output. |
|
| 470 | - if(empty($html)) { |
|
| 469 | + // If no html then we run the standard output. |
|
| 470 | + if(empty($html)) { |
|
| 471 | 471 | |
| 472 | - ob_start(); // Start buffering; |
|
| 473 | - $value = geodir_get_cf_value($cf); |
|
| 472 | + ob_start(); // Start buffering; |
|
| 473 | + $value = geodir_get_cf_value($cf); |
|
| 474 | 474 | |
| 475 | - $extra_fields = unserialize($cf['extra_fields']); |
|
| 476 | - ?> |
|
| 475 | + $extra_fields = unserialize($cf['extra_fields']); |
|
| 476 | + ?> |
|
| 477 | 477 | |
| 478 | 478 | <div id="<?php echo $cf['name'];?>_row" |
| 479 | 479 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 480 | 480 | <label> |
| 481 | 481 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 482 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 482 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 483 | 483 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 484 | 484 | </label><?php |
| 485 | 485 | |
| 486 | 486 | |
| 487 | - if (is_array($extra_fields) && in_array('1', $extra_fields)) { |
|
| 487 | + if (is_array($extra_fields) && in_array('1', $extra_fields)) { |
|
| 488 | 488 | |
| 489 | - $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?> |
|
| 489 | + $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?> |
|
| 490 | 490 | |
| 491 | 491 | <div class="editor" field_id="<?php echo $cf['name'];?>" field_type="editor"> |
| 492 | 492 | <?php wp_editor(stripslashes($value), $cf['name'], $editor_settings); ?> |
| 493 | 493 | </div><?php |
| 494 | 494 | |
| 495 | - } else { |
|
| 495 | + } else { |
|
| 496 | 496 | |
| 497 | - ?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>" |
|
| 497 | + ?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>" |
|
| 498 | 498 | id="<?php echo $cf['name'];?>"><?php echo stripslashes($value);?></textarea><?php |
| 499 | 499 | |
| 500 | - }?> |
|
| 500 | + }?> |
|
| 501 | 501 | |
| 502 | 502 | |
| 503 | 503 | <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
@@ -507,10 +507,10 @@ discard block |
||
| 507 | 507 | </div> |
| 508 | 508 | |
| 509 | 509 | <?php |
| 510 | - $html = ob_get_clean(); |
|
| 511 | - } |
|
| 510 | + $html = ob_get_clean(); |
|
| 511 | + } |
|
| 512 | 512 | |
| 513 | - return $html; |
|
| 513 | + return $html; |
|
| 514 | 514 | } |
| 515 | 515 | add_filter('geodir_custom_field_input_textarea','geodir_cfi_textarea',10,2); |
| 516 | 516 | |
@@ -526,53 +526,53 @@ discard block |
||
| 526 | 526 | */ |
| 527 | 527 | function geodir_cfi_select($html,$cf){ |
| 528 | 528 | |
| 529 | - $html_var = $cf['htmlvar_name']; |
|
| 529 | + $html_var = $cf['htmlvar_name']; |
|
| 530 | 530 | |
| 531 | - // Check if there is a custom field specific filter. |
|
| 532 | - if(has_filter("geodir_custom_field_input_select_{$html_var}")){ |
|
| 533 | - /** |
|
| 534 | - * Filter the select html by individual custom field. |
|
| 535 | - * |
|
| 536 | - * @param string $html The html to filter. |
|
| 537 | - * @param array $cf The custom field array. |
|
| 538 | - * @since 1.6.6 |
|
| 539 | - */ |
|
| 540 | - $html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf); |
|
| 541 | - } |
|
| 531 | + // Check if there is a custom field specific filter. |
|
| 532 | + if(has_filter("geodir_custom_field_input_select_{$html_var}")){ |
|
| 533 | + /** |
|
| 534 | + * Filter the select html by individual custom field. |
|
| 535 | + * |
|
| 536 | + * @param string $html The html to filter. |
|
| 537 | + * @param array $cf The custom field array. |
|
| 538 | + * @since 1.6.6 |
|
| 539 | + */ |
|
| 540 | + $html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf); |
|
| 541 | + } |
|
| 542 | 542 | |
| 543 | - // If no html then we run the standard output. |
|
| 544 | - if(empty($html)) { |
|
| 543 | + // If no html then we run the standard output. |
|
| 544 | + if(empty($html)) { |
|
| 545 | 545 | |
| 546 | - ob_start(); // Start buffering; |
|
| 547 | - $value = geodir_get_cf_value($cf); |
|
| 546 | + ob_start(); // Start buffering; |
|
| 547 | + $value = geodir_get_cf_value($cf); |
|
| 548 | 548 | |
| 549 | - ?> |
|
| 549 | + ?> |
|
| 550 | 550 | <div id="<?php echo $cf['name'];?>_row" |
| 551 | 551 | class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details"> |
| 552 | 552 | <label> |
| 553 | 553 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 554 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 554 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 555 | 555 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 556 | 556 | </label> |
| 557 | 557 | <?php |
| 558 | - $option_values_arr = geodir_string_values_to_options($cf['option_values'], true); |
|
| 559 | - $select_options = ''; |
|
| 560 | - if (!empty($option_values_arr)) { |
|
| 561 | - foreach ($option_values_arr as $option_row) { |
|
| 562 | - if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) { |
|
| 563 | - $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 564 | - |
|
| 565 | - $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
| 566 | - } else { |
|
| 567 | - $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 568 | - $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
|
| 569 | - $selected = $option_value == stripslashes($value) ? 'selected="selected"' : ''; |
|
| 570 | - |
|
| 571 | - $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
| 572 | - } |
|
| 573 | - } |
|
| 574 | - } |
|
| 575 | - ?> |
|
| 558 | + $option_values_arr = geodir_string_values_to_options($cf['option_values'], true); |
|
| 559 | + $select_options = ''; |
|
| 560 | + if (!empty($option_values_arr)) { |
|
| 561 | + foreach ($option_values_arr as $option_row) { |
|
| 562 | + if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) { |
|
| 563 | + $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 564 | + |
|
| 565 | + $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
| 566 | + } else { |
|
| 567 | + $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 568 | + $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
|
| 569 | + $selected = $option_value == stripslashes($value) ? 'selected="selected"' : ''; |
|
| 570 | + |
|
| 571 | + $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
| 572 | + } |
|
| 573 | + } |
|
| 574 | + } |
|
| 575 | + ?> |
|
| 576 | 576 | <select field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
| 577 | 577 | class="geodir_textfield textfield_x chosen_select" |
| 578 | 578 | data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '…';?>" |
@@ -584,10 +584,10 @@ discard block |
||
| 584 | 584 | </div> |
| 585 | 585 | |
| 586 | 586 | <?php |
| 587 | - $html = ob_get_clean(); |
|
| 588 | - } |
|
| 587 | + $html = ob_get_clean(); |
|
| 588 | + } |
|
| 589 | 589 | |
| 590 | - return $html; |
|
| 590 | + return $html; |
|
| 591 | 591 | } |
| 592 | 592 | add_filter('geodir_custom_field_input_select','geodir_cfi_select',10,2); |
| 593 | 593 | |
@@ -603,36 +603,36 @@ discard block |
||
| 603 | 603 | */ |
| 604 | 604 | function geodir_cfi_multiselect($html,$cf){ |
| 605 | 605 | |
| 606 | - $html_var = $cf['htmlvar_name']; |
|
| 607 | - |
|
| 608 | - // Check if there is a custom field specific filter. |
|
| 609 | - if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){ |
|
| 610 | - /** |
|
| 611 | - * Filter the multiselect html by individual custom field. |
|
| 612 | - * |
|
| 613 | - * @param string $html The html to filter. |
|
| 614 | - * @param array $cf The custom field array. |
|
| 615 | - * @since 1.6.6 |
|
| 616 | - */ |
|
| 617 | - $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf); |
|
| 618 | - } |
|
| 619 | - |
|
| 620 | - // If no html then we run the standard output. |
|
| 621 | - if(empty($html)) { |
|
| 622 | - |
|
| 623 | - ob_start(); // Start buffering; |
|
| 624 | - $value = geodir_get_cf_value($cf); |
|
| 625 | - |
|
| 626 | - $multi_display = 'select'; |
|
| 627 | - if (!empty($cf['extra_fields'])) { |
|
| 628 | - $multi_display = unserialize($cf['extra_fields']); |
|
| 629 | - } |
|
| 630 | - ?> |
|
| 606 | + $html_var = $cf['htmlvar_name']; |
|
| 607 | + |
|
| 608 | + // Check if there is a custom field specific filter. |
|
| 609 | + if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){ |
|
| 610 | + /** |
|
| 611 | + * Filter the multiselect html by individual custom field. |
|
| 612 | + * |
|
| 613 | + * @param string $html The html to filter. |
|
| 614 | + * @param array $cf The custom field array. |
|
| 615 | + * @since 1.6.6 |
|
| 616 | + */ |
|
| 617 | + $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf); |
|
| 618 | + } |
|
| 619 | + |
|
| 620 | + // If no html then we run the standard output. |
|
| 621 | + if(empty($html)) { |
|
| 622 | + |
|
| 623 | + ob_start(); // Start buffering; |
|
| 624 | + $value = geodir_get_cf_value($cf); |
|
| 625 | + |
|
| 626 | + $multi_display = 'select'; |
|
| 627 | + if (!empty($cf['extra_fields'])) { |
|
| 628 | + $multi_display = unserialize($cf['extra_fields']); |
|
| 629 | + } |
|
| 630 | + ?> |
|
| 631 | 631 | <div id="<?php echo $cf['name']; ?>_row" |
| 632 | 632 | class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
| 633 | 633 | <label> |
| 634 | 634 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 635 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 635 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 636 | 636 | <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
| 637 | 637 | </label> |
| 638 | 638 | <input type="hidden" name="gd_field_<?php echo $cf['name']; ?>" value="1"/> |
@@ -643,63 +643,63 @@ discard block |
||
| 643 | 643 | data-placeholder="<?php _e('Select', 'geodirectory'); ?>" |
| 644 | 644 | option-ajaxchosen="false"> |
| 645 | 645 | <?php |
| 646 | - } else { |
|
| 647 | - echo '<ul class="gd_multi_choice">'; |
|
| 648 | - } |
|
| 649 | - |
|
| 650 | - $option_values_arr = geodir_string_values_to_options($cf['option_values'], true); |
|
| 651 | - $select_options = ''; |
|
| 652 | - if (!empty($option_values_arr)) { |
|
| 653 | - foreach ($option_values_arr as $option_row) { |
|
| 654 | - if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) { |
|
| 655 | - $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 656 | - |
|
| 657 | - if ($multi_display == 'select') { |
|
| 658 | - $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
| 659 | - } else { |
|
| 660 | - $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : ''; |
|
| 661 | - } |
|
| 662 | - } else { |
|
| 663 | - if (!is_array($value) && $value != '') { |
|
| 664 | - $value = trim($value); |
|
| 665 | - } |
|
| 646 | + } else { |
|
| 647 | + echo '<ul class="gd_multi_choice">'; |
|
| 648 | + } |
|
| 649 | + |
|
| 650 | + $option_values_arr = geodir_string_values_to_options($cf['option_values'], true); |
|
| 651 | + $select_options = ''; |
|
| 652 | + if (!empty($option_values_arr)) { |
|
| 653 | + foreach ($option_values_arr as $option_row) { |
|
| 654 | + if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) { |
|
| 655 | + $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 656 | + |
|
| 657 | + if ($multi_display == 'select') { |
|
| 658 | + $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
| 659 | + } else { |
|
| 660 | + $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : ''; |
|
| 661 | + } |
|
| 662 | + } else { |
|
| 663 | + if (!is_array($value) && $value != '') { |
|
| 664 | + $value = trim($value); |
|
| 665 | + } |
|
| 666 | 666 | |
| 667 | - $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 668 | - $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
|
| 669 | - $selected = $option_value == $value ? 'selected="selected"' : ''; |
|
| 670 | - $selected = ''; |
|
| 671 | - $checked = ''; |
|
| 672 | - |
|
| 673 | - if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) { |
|
| 674 | - if (!is_array($value)) { |
|
| 675 | - $value_array = explode(',', $value); |
|
| 676 | - } else { |
|
| 677 | - $value_array = $value; |
|
| 678 | - } |
|
| 667 | + $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
|
| 668 | + $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
|
| 669 | + $selected = $option_value == $value ? 'selected="selected"' : ''; |
|
| 670 | + $selected = ''; |
|
| 671 | + $checked = ''; |
|
| 672 | + |
|
| 673 | + if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) { |
|
| 674 | + if (!is_array($value)) { |
|
| 675 | + $value_array = explode(',', $value); |
|
| 676 | + } else { |
|
| 677 | + $value_array = $value; |
|
| 678 | + } |
|
| 679 | 679 | |
| 680 | - $value_array = stripslashes_deep($value_array); |
|
| 680 | + $value_array = stripslashes_deep($value_array); |
|
| 681 | 681 | |
| 682 | - if (is_array($value_array)) { |
|
| 683 | - $value_array = array_map('trim', $value_array); |
|
| 682 | + if (is_array($value_array)) { |
|
| 683 | + $value_array = array_map('trim', $value_array); |
|
| 684 | 684 | |
| 685 | - if (in_array($option_value, $value_array)) { |
|
| 686 | - $selected = 'selected="selected"'; |
|
| 687 | - $checked = 'checked="checked"'; |
|
| 688 | - } |
|
| 689 | - } |
|
| 690 | - } |
|
| 691 | - |
|
| 692 | - if ($multi_display == 'select') { |
|
| 693 | - $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
| 694 | - } else { |
|
| 695 | - $select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" /> ' . $option_label . ' </li>'; |
|
| 696 | - } |
|
| 697 | - } |
|
| 698 | - } |
|
| 699 | - } |
|
| 700 | - echo $select_options; |
|
| 701 | - |
|
| 702 | - if ($multi_display == 'select') { ?></select></div> |
|
| 685 | + if (in_array($option_value, $value_array)) { |
|
| 686 | + $selected = 'selected="selected"'; |
|
| 687 | + $checked = 'checked="checked"'; |
|
| 688 | + } |
|
| 689 | + } |
|
| 690 | + } |
|
| 691 | + |
|
| 692 | + if ($multi_display == 'select') { |
|
| 693 | + $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
| 694 | + } else { |
|
| 695 | + $select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" /> ' . $option_label . ' </li>'; |
|
| 696 | + } |
|
| 697 | + } |
|
| 698 | + } |
|
| 699 | + } |
|
| 700 | + echo $select_options; |
|
| 701 | + |
|
| 702 | + if ($multi_display == 'select') { ?></select></div> |
|
| 703 | 703 | <?php } else { ?></ul><?php } ?> |
| 704 | 704 | <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
| 705 | 705 | <?php if ($cf['is_required']) { ?> |
@@ -707,10 +707,10 @@ discard block |
||
| 707 | 707 | <?php } ?> |
| 708 | 708 | </div> |
| 709 | 709 | <?php |
| 710 | - $html = ob_get_clean(); |
|
| 711 | - } |
|
| 710 | + $html = ob_get_clean(); |
|
| 711 | + } |
|
| 712 | 712 | |
| 713 | - return $html; |
|
| 713 | + return $html; |
|
| 714 | 714 | } |
| 715 | 715 | add_filter('geodir_custom_field_input_multiselect','geodir_cfi_multiselect',10,2); |
| 716 | 716 | |
@@ -726,32 +726,32 @@ discard block |
||
| 726 | 726 | */ |
| 727 | 727 | function geodir_cfi_html($html,$cf){ |
| 728 | 728 | |
| 729 | - $html_var = $cf['htmlvar_name']; |
|
| 729 | + $html_var = $cf['htmlvar_name']; |
|
| 730 | 730 | |
| 731 | - // Check if there is a custom field specific filter. |
|
| 732 | - if(has_filter("geodir_custom_field_input_html_{$html_var}")){ |
|
| 733 | - /** |
|
| 734 | - * Filter the html html by individual custom field. |
|
| 735 | - * |
|
| 736 | - * @param string $html The html to filter. |
|
| 737 | - * @param array $cf The custom field array. |
|
| 738 | - * @since 1.6.6 |
|
| 739 | - */ |
|
| 740 | - $html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf); |
|
| 741 | - } |
|
| 731 | + // Check if there is a custom field specific filter. |
|
| 732 | + if(has_filter("geodir_custom_field_input_html_{$html_var}")){ |
|
| 733 | + /** |
|
| 734 | + * Filter the html html by individual custom field. |
|
| 735 | + * |
|
| 736 | + * @param string $html The html to filter. |
|
| 737 | + * @param array $cf The custom field array. |
|
| 738 | + * @since 1.6.6 |
|
| 739 | + */ |
|
| 740 | + $html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf); |
|
| 741 | + } |
|
| 742 | 742 | |
| 743 | - // If no html then we run the standard output. |
|
| 744 | - if(empty($html)) { |
|
| 743 | + // If no html then we run the standard output. |
|
| 744 | + if(empty($html)) { |
|
| 745 | 745 | |
| 746 | - ob_start(); // Start buffering; |
|
| 747 | - $value = geodir_get_cf_value($cf); |
|
| 748 | - ?> |
|
| 746 | + ob_start(); // Start buffering; |
|
| 747 | + $value = geodir_get_cf_value($cf); |
|
| 748 | + ?> |
|
| 749 | 749 | |
| 750 | 750 | <div id="<?php echo $cf['name']; ?>_row" |
| 751 | 751 | class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
| 752 | 752 | <label> |
| 753 | 753 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 754 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 754 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 755 | 755 | <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
| 756 | 756 | </label> |
| 757 | 757 | |
@@ -769,10 +769,10 @@ discard block |
||
| 769 | 769 | </div> |
| 770 | 770 | |
| 771 | 771 | <?php |
| 772 | - $html = ob_get_clean(); |
|
| 773 | - } |
|
| 772 | + $html = ob_get_clean(); |
|
| 773 | + } |
|
| 774 | 774 | |
| 775 | - return $html; |
|
| 775 | + return $html; |
|
| 776 | 776 | } |
| 777 | 777 | add_filter('geodir_custom_field_input_html','geodir_cfi_html',10,2); |
| 778 | 778 | |
@@ -789,68 +789,68 @@ discard block |
||
| 789 | 789 | */ |
| 790 | 790 | function geodir_cfi_datepicker($html,$cf){ |
| 791 | 791 | |
| 792 | - $html_var = $cf['htmlvar_name']; |
|
| 792 | + $html_var = $cf['htmlvar_name']; |
|
| 793 | 793 | |
| 794 | - // Check if there is a custom field specific filter. |
|
| 795 | - if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){ |
|
| 796 | - /** |
|
| 797 | - * Filter the datepicker html by individual custom field. |
|
| 798 | - * |
|
| 799 | - * @param string $html The html to filter. |
|
| 800 | - * @param array $cf The custom field array. |
|
| 801 | - * @since 1.6.6 |
|
| 802 | - */ |
|
| 803 | - $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf); |
|
| 804 | - } |
|
| 794 | + // Check if there is a custom field specific filter. |
|
| 795 | + if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){ |
|
| 796 | + /** |
|
| 797 | + * Filter the datepicker html by individual custom field. |
|
| 798 | + * |
|
| 799 | + * @param string $html The html to filter. |
|
| 800 | + * @param array $cf The custom field array. |
|
| 801 | + * @since 1.6.6 |
|
| 802 | + */ |
|
| 803 | + $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf); |
|
| 804 | + } |
|
| 805 | 805 | |
| 806 | - // If no html then we run the standard output. |
|
| 807 | - if(empty($html)) { |
|
| 806 | + // If no html then we run the standard output. |
|
| 807 | + if(empty($html)) { |
|
| 808 | 808 | |
| 809 | - ob_start(); // Start buffering; |
|
| 810 | - $value = geodir_get_cf_value($cf); |
|
| 809 | + ob_start(); // Start buffering; |
|
| 810 | + $value = geodir_get_cf_value($cf); |
|
| 811 | 811 | |
| 812 | - $extra_fields = unserialize($cf['extra_fields']); |
|
| 813 | - $name = $cf['name']; |
|
| 812 | + $extra_fields = unserialize($cf['extra_fields']); |
|
| 813 | + $name = $cf['name']; |
|
| 814 | 814 | |
| 815 | - if ($extra_fields['date_format'] == '') |
|
| 816 | - $extra_fields['date_format'] = 'yy-mm-dd'; |
|
| 815 | + if ($extra_fields['date_format'] == '') |
|
| 816 | + $extra_fields['date_format'] = 'yy-mm-dd'; |
|
| 817 | 817 | |
| 818 | - $date_format = $extra_fields['date_format']; |
|
| 819 | - $jquery_date_format = $date_format; |
|
| 818 | + $date_format = $extra_fields['date_format']; |
|
| 819 | + $jquery_date_format = $date_format; |
|
| 820 | 820 | |
| 821 | 821 | |
| 822 | - // check if we need to change the format or not |
|
| 823 | - $date_format_len = strlen(str_replace(' ', '', $date_format)); |
|
| 824 | - if($date_format_len>5){// if greater then 5 then it's the old style format. |
|
| 822 | + // check if we need to change the format or not |
|
| 823 | + $date_format_len = strlen(str_replace(' ', '', $date_format)); |
|
| 824 | + if($date_format_len>5){// if greater then 5 then it's the old style format. |
|
| 825 | 825 | |
| 826 | - $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format |
|
| 827 | - $replace = array('d','j','l','m','n','F','Y');//PHP date format |
|
| 826 | + $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format |
|
| 827 | + $replace = array('d','j','l','m','n','F','Y');//PHP date format |
|
| 828 | 828 | |
| 829 | - $date_format = str_replace($search, $replace, $date_format); |
|
| 830 | - }else{ |
|
| 831 | - $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format ); |
|
| 832 | - } |
|
| 829 | + $date_format = str_replace($search, $replace, $date_format); |
|
| 830 | + }else{ |
|
| 831 | + $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format ); |
|
| 832 | + } |
|
| 833 | 833 | |
| 834 | - if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty |
|
| 835 | - if($value && !isset($_REQUEST['backandedit'])) { |
|
| 836 | - //$time = strtotime($value); |
|
| 837 | - //$value = date_i18n($date_format, $time); |
|
| 838 | - } |
|
| 839 | - $value = geodir_date($value, 'Y-m-d', $date_format); |
|
| 834 | + if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty |
|
| 835 | + if($value && !isset($_REQUEST['backandedit'])) { |
|
| 836 | + //$time = strtotime($value); |
|
| 837 | + //$value = date_i18n($date_format, $time); |
|
| 838 | + } |
|
| 839 | + $value = geodir_date($value, 'Y-m-d', $date_format); |
|
| 840 | 840 | |
| 841 | - ?> |
|
| 841 | + ?> |
|
| 842 | 842 | <script type="text/javascript"> |
| 843 | 843 | |
| 844 | 844 | jQuery(function () { |
| 845 | 845 | |
| 846 | 846 | jQuery("#<?php echo $cf['name'];?>").datepicker({changeMonth: true, changeYear: true <?php |
| 847 | - /** |
|
| 848 | - * Used to add extra option to datepicker per custom field. |
|
| 849 | - * |
|
| 850 | - * @since 1.5.7 |
|
| 851 | - * @param string $name The custom field name. |
|
| 852 | - */ |
|
| 853 | - echo apply_filters("gd_datepicker_extra_{$name}",'');?>}); |
|
| 847 | + /** |
|
| 848 | + * Used to add extra option to datepicker per custom field. |
|
| 849 | + * |
|
| 850 | + * @since 1.5.7 |
|
| 851 | + * @param string $name The custom field name. |
|
| 852 | + */ |
|
| 853 | + echo apply_filters("gd_datepicker_extra_{$name}",'');?>}); |
|
| 854 | 854 | |
| 855 | 855 | jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format;?>'); |
| 856 | 856 | |
@@ -866,7 +866,7 @@ discard block |
||
| 866 | 866 | <label> |
| 867 | 867 | |
| 868 | 868 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 869 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 869 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 870 | 870 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 871 | 871 | </label> |
| 872 | 872 | |
@@ -880,10 +880,10 @@ discard block |
||
| 880 | 880 | </div> |
| 881 | 881 | |
| 882 | 882 | <?php |
| 883 | - $html = ob_get_clean(); |
|
| 884 | - } |
|
| 883 | + $html = ob_get_clean(); |
|
| 884 | + } |
|
| 885 | 885 | |
| 886 | - return $html; |
|
| 886 | + return $html; |
|
| 887 | 887 | } |
| 888 | 888 | add_filter('geodir_custom_field_input_datepicker','geodir_cfi_datepicker',10,2); |
| 889 | 889 | |
@@ -899,31 +899,31 @@ discard block |
||
| 899 | 899 | */ |
| 900 | 900 | function geodir_cfi_time($html,$cf){ |
| 901 | 901 | |
| 902 | - $html_var = $cf['htmlvar_name']; |
|
| 902 | + $html_var = $cf['htmlvar_name']; |
|
| 903 | 903 | |
| 904 | - // Check if there is a custom field specific filter. |
|
| 905 | - if(has_filter("geodir_custom_field_input_time_{$html_var}")){ |
|
| 906 | - /** |
|
| 907 | - * Filter the time html by individual custom field. |
|
| 908 | - * |
|
| 909 | - * @param string $html The html to filter. |
|
| 910 | - * @param array $cf The custom field array. |
|
| 911 | - * @since 1.6.6 |
|
| 912 | - */ |
|
| 913 | - $html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf); |
|
| 914 | - } |
|
| 904 | + // Check if there is a custom field specific filter. |
|
| 905 | + if(has_filter("geodir_custom_field_input_time_{$html_var}")){ |
|
| 906 | + /** |
|
| 907 | + * Filter the time html by individual custom field. |
|
| 908 | + * |
|
| 909 | + * @param string $html The html to filter. |
|
| 910 | + * @param array $cf The custom field array. |
|
| 911 | + * @since 1.6.6 |
|
| 912 | + */ |
|
| 913 | + $html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf); |
|
| 914 | + } |
|
| 915 | 915 | |
| 916 | - // If no html then we run the standard output. |
|
| 917 | - if(empty($html)) { |
|
| 916 | + // If no html then we run the standard output. |
|
| 917 | + if(empty($html)) { |
|
| 918 | 918 | |
| 919 | - ob_start(); // Start buffering; |
|
| 920 | - $value = geodir_get_cf_value($cf); |
|
| 919 | + ob_start(); // Start buffering; |
|
| 920 | + $value = geodir_get_cf_value($cf); |
|
| 921 | 921 | |
| 922 | - $name = $cf['name']; |
|
| 922 | + $name = $cf['name']; |
|
| 923 | 923 | |
| 924 | - if ($value != '') |
|
| 925 | - $value = date('H:i', strtotime($value)); |
|
| 926 | - ?> |
|
| 924 | + if ($value != '') |
|
| 925 | + $value = date('H:i', strtotime($value)); |
|
| 926 | + ?> |
|
| 927 | 927 | <script type="text/javascript"> |
| 928 | 928 | jQuery(document).ready(function () { |
| 929 | 929 | |
@@ -939,7 +939,7 @@ discard block |
||
| 939 | 939 | <label> |
| 940 | 940 | |
| 941 | 941 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 942 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 942 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 943 | 943 | <?php if ($cf['is_required']) echo '<span>*</span>';?> |
| 944 | 944 | </label> |
| 945 | 945 | <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>" |
@@ -951,10 +951,10 @@ discard block |
||
| 951 | 951 | <?php } ?> |
| 952 | 952 | </div> |
| 953 | 953 | <?php |
| 954 | - $html = ob_get_clean(); |
|
| 955 | - } |
|
| 954 | + $html = ob_get_clean(); |
|
| 955 | + } |
|
| 956 | 956 | |
| 957 | - return $html; |
|
| 957 | + return $html; |
|
| 958 | 958 | } |
| 959 | 959 | add_filter('geodir_custom_field_input_time','geodir_cfi_time',10,2); |
| 960 | 960 | |
@@ -970,100 +970,100 @@ discard block |
||
| 970 | 970 | */ |
| 971 | 971 | function geodir_cfi_address($html,$cf){ |
| 972 | 972 | |
| 973 | - $html_var = $cf['htmlvar_name']; |
|
| 974 | - |
|
| 975 | - // Check if there is a custom field specific filter. |
|
| 976 | - if(has_filter("geodir_custom_field_input_address_{$html_var}")){ |
|
| 977 | - /** |
|
| 978 | - * Filter the address html by individual custom field. |
|
| 979 | - * |
|
| 980 | - * @param string $html The html to filter. |
|
| 981 | - * @param array $cf The custom field array. |
|
| 982 | - * @since 1.6.6 |
|
| 983 | - */ |
|
| 984 | - $html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf); |
|
| 985 | - } |
|
| 986 | - |
|
| 987 | - // If no html then we run the standard output. |
|
| 988 | - if(empty($html)) { |
|
| 989 | - |
|
| 990 | - global $gd_session; |
|
| 991 | - ob_start(); // Start buffering; |
|
| 992 | - $value = geodir_get_cf_value($cf); |
|
| 993 | - $name = $cf['name']; |
|
| 994 | - $type = $cf['type']; |
|
| 995 | - $admin_desc = $cf['desc']; |
|
| 996 | - $is_required = $cf['is_required']; |
|
| 997 | - $required_msg = $cf['required_msg']; |
|
| 998 | - $site_title = $cf['site_title']; |
|
| 999 | - $is_admin = $cf['is_admin']; |
|
| 1000 | - $extra_fields = stripslashes_deep(unserialize($cf['extra_fields'])); |
|
| 1001 | - $prefix = $name . '_'; |
|
| 1002 | - |
|
| 1003 | - ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address'); |
|
| 1004 | - ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code '); |
|
| 1005 | - ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map'); |
|
| 1006 | - ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview'); |
|
| 1007 | - |
|
| 1008 | - $address = ''; |
|
| 1009 | - $zip = ''; |
|
| 1010 | - $mapview = ''; |
|
| 1011 | - $mapzoom = ''; |
|
| 1012 | - $lat = ''; |
|
| 1013 | - $lng = ''; |
|
| 1014 | - |
|
| 1015 | - if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) { |
|
| 1016 | - $post = $gd_ses_listing; |
|
| 1017 | - $address = $post[$prefix . 'address']; |
|
| 1018 | - $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : ''; |
|
| 1019 | - $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : ''; |
|
| 1020 | - $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : ''; |
|
| 1021 | - $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : ''; |
|
| 1022 | - $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : ''; |
|
| 1023 | - } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) { |
|
| 1024 | - $post_info = (array)$post_info; |
|
| 1025 | - |
|
| 1026 | - $address = $post_info[$prefix . 'address']; |
|
| 1027 | - $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : ''; |
|
| 1028 | - $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : ''; |
|
| 1029 | - $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : ''; |
|
| 1030 | - $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : ''; |
|
| 1031 | - $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : ''; |
|
| 1032 | - } |
|
| 1033 | - |
|
| 1034 | - $location = geodir_get_default_location(); |
|
| 1035 | - if (empty($city)) $city = isset($location->city) ? $location->city : ''; |
|
| 1036 | - if (empty($region)) $region = isset($location->region) ? $location->region : ''; |
|
| 1037 | - if (empty($country)) $country = isset($location->country) ? $location->country : ''; |
|
| 1038 | - |
|
| 1039 | - $lat_lng_blank = false; |
|
| 1040 | - if (empty($lat) && empty($lng)) { |
|
| 1041 | - $lat_lng_blank = true; |
|
| 1042 | - } |
|
| 1043 | - |
|
| 1044 | - if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : ''; |
|
| 1045 | - if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : ''; |
|
| 1046 | - |
|
| 1047 | - /** |
|
| 1048 | - * Filter the default latitude. |
|
| 1049 | - * |
|
| 1050 | - * @since 1.0.0 |
|
| 1051 | - * |
|
| 1052 | - * @param float $lat Default latitude. |
|
| 1053 | - * @param bool $is_admin For admin use only?. |
|
| 1054 | - */ |
|
| 1055 | - $lat = apply_filters('geodir_default_latitude', $lat, $is_admin); |
|
| 1056 | - /** |
|
| 1057 | - * Filter the default longitude. |
|
| 1058 | - * |
|
| 1059 | - * @since 1.0.0 |
|
| 1060 | - * |
|
| 1061 | - * @param float $lat Default longitude. |
|
| 1062 | - * @param bool $is_admin For admin use only?. |
|
| 1063 | - */ |
|
| 1064 | - $lng = apply_filters('geodir_default_longitude', $lng, $is_admin); |
|
| 1065 | - |
|
| 1066 | - ?> |
|
| 973 | + $html_var = $cf['htmlvar_name']; |
|
| 974 | + |
|
| 975 | + // Check if there is a custom field specific filter. |
|
| 976 | + if(has_filter("geodir_custom_field_input_address_{$html_var}")){ |
|
| 977 | + /** |
|
| 978 | + * Filter the address html by individual custom field. |
|
| 979 | + * |
|
| 980 | + * @param string $html The html to filter. |
|
| 981 | + * @param array $cf The custom field array. |
|
| 982 | + * @since 1.6.6 |
|
| 983 | + */ |
|
| 984 | + $html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf); |
|
| 985 | + } |
|
| 986 | + |
|
| 987 | + // If no html then we run the standard output. |
|
| 988 | + if(empty($html)) { |
|
| 989 | + |
|
| 990 | + global $gd_session; |
|
| 991 | + ob_start(); // Start buffering; |
|
| 992 | + $value = geodir_get_cf_value($cf); |
|
| 993 | + $name = $cf['name']; |
|
| 994 | + $type = $cf['type']; |
|
| 995 | + $admin_desc = $cf['desc']; |
|
| 996 | + $is_required = $cf['is_required']; |
|
| 997 | + $required_msg = $cf['required_msg']; |
|
| 998 | + $site_title = $cf['site_title']; |
|
| 999 | + $is_admin = $cf['is_admin']; |
|
| 1000 | + $extra_fields = stripslashes_deep(unserialize($cf['extra_fields'])); |
|
| 1001 | + $prefix = $name . '_'; |
|
| 1002 | + |
|
| 1003 | + ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address'); |
|
| 1004 | + ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code '); |
|
| 1005 | + ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map'); |
|
| 1006 | + ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview'); |
|
| 1007 | + |
|
| 1008 | + $address = ''; |
|
| 1009 | + $zip = ''; |
|
| 1010 | + $mapview = ''; |
|
| 1011 | + $mapzoom = ''; |
|
| 1012 | + $lat = ''; |
|
| 1013 | + $lng = ''; |
|
| 1014 | + |
|
| 1015 | + if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) { |
|
| 1016 | + $post = $gd_ses_listing; |
|
| 1017 | + $address = $post[$prefix . 'address']; |
|
| 1018 | + $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : ''; |
|
| 1019 | + $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : ''; |
|
| 1020 | + $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : ''; |
|
| 1021 | + $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : ''; |
|
| 1022 | + $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : ''; |
|
| 1023 | + } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) { |
|
| 1024 | + $post_info = (array)$post_info; |
|
| 1025 | + |
|
| 1026 | + $address = $post_info[$prefix . 'address']; |
|
| 1027 | + $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : ''; |
|
| 1028 | + $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : ''; |
|
| 1029 | + $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : ''; |
|
| 1030 | + $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : ''; |
|
| 1031 | + $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : ''; |
|
| 1032 | + } |
|
| 1033 | + |
|
| 1034 | + $location = geodir_get_default_location(); |
|
| 1035 | + if (empty($city)) $city = isset($location->city) ? $location->city : ''; |
|
| 1036 | + if (empty($region)) $region = isset($location->region) ? $location->region : ''; |
|
| 1037 | + if (empty($country)) $country = isset($location->country) ? $location->country : ''; |
|
| 1038 | + |
|
| 1039 | + $lat_lng_blank = false; |
|
| 1040 | + if (empty($lat) && empty($lng)) { |
|
| 1041 | + $lat_lng_blank = true; |
|
| 1042 | + } |
|
| 1043 | + |
|
| 1044 | + if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : ''; |
|
| 1045 | + if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : ''; |
|
| 1046 | + |
|
| 1047 | + /** |
|
| 1048 | + * Filter the default latitude. |
|
| 1049 | + * |
|
| 1050 | + * @since 1.0.0 |
|
| 1051 | + * |
|
| 1052 | + * @param float $lat Default latitude. |
|
| 1053 | + * @param bool $is_admin For admin use only?. |
|
| 1054 | + */ |
|
| 1055 | + $lat = apply_filters('geodir_default_latitude', $lat, $is_admin); |
|
| 1056 | + /** |
|
| 1057 | + * Filter the default longitude. |
|
| 1058 | + * |
|
| 1059 | + * @since 1.0.0 |
|
| 1060 | + * |
|
| 1061 | + * @param float $lat Default longitude. |
|
| 1062 | + * @param bool $is_admin For admin use only?. |
|
| 1063 | + */ |
|
| 1064 | + $lng = apply_filters('geodir_default_longitude', $lng, $is_admin); |
|
| 1065 | + |
|
| 1066 | + ?> |
|
| 1067 | 1067 | |
| 1068 | 1068 | <div id="geodir_<?php echo $prefix . 'address';?>_row" |
| 1069 | 1069 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
@@ -1082,17 +1082,17 @@ discard block |
||
| 1082 | 1082 | |
| 1083 | 1083 | |
| 1084 | 1084 | <?php |
| 1085 | - /** |
|
| 1086 | - * Called after the address input on the add listings. |
|
| 1087 | - * |
|
| 1088 | - * This is used by the location manage to add further locations info etc. |
|
| 1089 | - * |
|
| 1090 | - * @since 1.0.0 |
|
| 1091 | - * @param array $cf The array of setting for the custom field. {@see geodir_custom_field_save()}. |
|
| 1092 | - */ |
|
| 1093 | - do_action('geodir_address_extra_listing_fields', $cf); |
|
| 1094 | - |
|
| 1095 | - if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?> |
|
| 1085 | + /** |
|
| 1086 | + * Called after the address input on the add listings. |
|
| 1087 | + * |
|
| 1088 | + * This is used by the location manage to add further locations info etc. |
|
| 1089 | + * |
|
| 1090 | + * @since 1.0.0 |
|
| 1091 | + * @param array $cf The array of setting for the custom field. {@see geodir_custom_field_save()}. |
|
| 1092 | + */ |
|
| 1093 | + do_action('geodir_address_extra_listing_fields', $cf); |
|
| 1094 | + |
|
| 1095 | + if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?> |
|
| 1096 | 1096 | |
| 1097 | 1097 | <div id="geodir_<?php echo $prefix . 'zip'; ?>_row" |
| 1098 | 1098 | class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix gd-fieldset-details"> |
@@ -1113,22 +1113,22 @@ discard block |
||
| 1113 | 1113 | |
| 1114 | 1114 | <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details"> |
| 1115 | 1115 | <?php |
| 1116 | - /** |
|
| 1117 | - * Contains add listing page map functions. |
|
| 1118 | - * |
|
| 1119 | - * @since 1.0.0 |
|
| 1120 | - */ |
|
| 1121 | - include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php"); |
|
| 1122 | - if ($lat_lng_blank) { |
|
| 1123 | - $lat = ''; |
|
| 1124 | - $lng = ''; |
|
| 1125 | - } |
|
| 1126 | - ?> |
|
| 1116 | + /** |
|
| 1117 | + * Contains add listing page map functions. |
|
| 1118 | + * |
|
| 1119 | + * @since 1.0.0 |
|
| 1120 | + */ |
|
| 1121 | + include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php"); |
|
| 1122 | + if ($lat_lng_blank) { |
|
| 1123 | + $lat = ''; |
|
| 1124 | + $lng = ''; |
|
| 1125 | + } |
|
| 1126 | + ?> |
|
| 1127 | 1127 | <span class="geodir_message_note"><?php echo stripslashes(GET_MAP_MSG); ?></span> |
| 1128 | 1128 | </div> |
| 1129 | 1129 | <?php |
| 1130 | - /* show lat lng */ |
|
| 1131 | - $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?> |
|
| 1130 | + /* show lat lng */ |
|
| 1131 | + $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?> |
|
| 1132 | 1132 | <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row" |
| 1133 | 1133 | class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>> |
| 1134 | 1134 | <label> |
@@ -1169,27 +1169,27 @@ discard block |
||
| 1169 | 1169 | class="gd-checkbox" |
| 1170 | 1170 | name="<?php echo $prefix . 'mapview'; ?>" |
| 1171 | 1171 | id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') { |
| 1172 | - echo 'checked="checked"'; |
|
| 1173 | - } ?> value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span> |
|
| 1172 | + echo 'checked="checked"'; |
|
| 1173 | + } ?> value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span> |
|
| 1174 | 1174 | <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio" |
| 1175 | 1175 | class="gd-checkbox" |
| 1176 | 1176 | name="<?php echo $prefix . 'mapview'; ?>" |
| 1177 | 1177 | id="map_view1" <?php if ($mapview == 'SATELLITE') { |
| 1178 | - echo 'checked="checked"'; |
|
| 1179 | - } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span> |
|
| 1178 | + echo 'checked="checked"'; |
|
| 1179 | + } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span> |
|
| 1180 | 1180 | |
| 1181 | 1181 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio" |
| 1182 | 1182 | class="gd-checkbox" |
| 1183 | 1183 | name="<?php echo $prefix . 'mapview'; ?>" |
| 1184 | 1184 | id="map_view2" <?php if ($mapview == 'HYBRID') { |
| 1185 | - echo 'checked="checked"'; |
|
| 1186 | - } ?> value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span> |
|
| 1185 | + echo 'checked="checked"'; |
|
| 1186 | + } ?> value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span> |
|
| 1187 | 1187 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio" |
| 1188 | 1188 | class="gd-checkbox" |
| 1189 | 1189 | name="<?php echo $prefix . 'mapview'; ?>" |
| 1190 | 1190 | id="map_view3" <?php if ($mapview == 'TERRAIN') { |
| 1191 | - echo 'checked="checked"'; |
|
| 1192 | - } ?> value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span> |
|
| 1191 | + echo 'checked="checked"'; |
|
| 1192 | + } ?> value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span> |
|
| 1193 | 1193 | |
| 1194 | 1194 | |
| 1195 | 1195 | </div> |
@@ -1197,14 +1197,14 @@ discard block |
||
| 1197 | 1197 | |
| 1198 | 1198 | <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?> |
| 1199 | 1199 | <input type="hidden" value="<?php if (isset($mapzoom)) { |
| 1200 | - echo esc_attr($mapzoom); |
|
| 1201 | - } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/> |
|
| 1200 | + echo esc_attr($mapzoom); |
|
| 1201 | + } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/> |
|
| 1202 | 1202 | <?php } |
| 1203 | 1203 | |
| 1204 | - $html = ob_get_clean(); |
|
| 1205 | - } |
|
| 1204 | + $html = ob_get_clean(); |
|
| 1205 | + } |
|
| 1206 | 1206 | |
| 1207 | - return $html; |
|
| 1207 | + return $html; |
|
| 1208 | 1208 | } |
| 1209 | 1209 | add_filter('geodir_custom_field_input_address','geodir_cfi_address',10,2); |
| 1210 | 1210 | |
@@ -1221,137 +1221,137 @@ discard block |
||
| 1221 | 1221 | */ |
| 1222 | 1222 | function geodir_cfi_taxonomy($html,$cf){ |
| 1223 | 1223 | |
| 1224 | - $html_var = $cf['htmlvar_name']; |
|
| 1225 | - |
|
| 1226 | - // Check if there is a custom field specific filter. |
|
| 1227 | - if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){ |
|
| 1228 | - /** |
|
| 1229 | - * Filter the taxonomy html by individual custom field. |
|
| 1230 | - * |
|
| 1231 | - * @param string $html The html to filter. |
|
| 1232 | - * @param array $cf The custom field array. |
|
| 1233 | - * @since 1.6.6 |
|
| 1234 | - */ |
|
| 1235 | - $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf); |
|
| 1236 | - } |
|
| 1237 | - |
|
| 1238 | - // If no html then we run the standard output. |
|
| 1239 | - if(empty($html)) { |
|
| 1240 | - |
|
| 1241 | - ob_start(); // Start buffering; |
|
| 1242 | - $value = geodir_get_cf_value($cf); |
|
| 1243 | - |
|
| 1244 | - $name = $cf['name']; |
|
| 1245 | - $site_title = $cf['site_title']; |
|
| 1246 | - $admin_desc = $cf['desc']; |
|
| 1247 | - $is_required = $cf['is_required']; |
|
| 1248 | - $is_admin = $cf['is_admin']; |
|
| 1249 | - $required_msg = $cf['required_msg']; |
|
| 1250 | - |
|
| 1251 | - if ($value == $cf['default']) { |
|
| 1252 | - $value = ''; |
|
| 1253 | - } ?> |
|
| 1224 | + $html_var = $cf['htmlvar_name']; |
|
| 1225 | + |
|
| 1226 | + // Check if there is a custom field specific filter. |
|
| 1227 | + if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){ |
|
| 1228 | + /** |
|
| 1229 | + * Filter the taxonomy html by individual custom field. |
|
| 1230 | + * |
|
| 1231 | + * @param string $html The html to filter. |
|
| 1232 | + * @param array $cf The custom field array. |
|
| 1233 | + * @since 1.6.6 |
|
| 1234 | + */ |
|
| 1235 | + $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf); |
|
| 1236 | + } |
|
| 1237 | + |
|
| 1238 | + // If no html then we run the standard output. |
|
| 1239 | + if(empty($html)) { |
|
| 1240 | + |
|
| 1241 | + ob_start(); // Start buffering; |
|
| 1242 | + $value = geodir_get_cf_value($cf); |
|
| 1243 | + |
|
| 1244 | + $name = $cf['name']; |
|
| 1245 | + $site_title = $cf['site_title']; |
|
| 1246 | + $admin_desc = $cf['desc']; |
|
| 1247 | + $is_required = $cf['is_required']; |
|
| 1248 | + $is_admin = $cf['is_admin']; |
|
| 1249 | + $required_msg = $cf['required_msg']; |
|
| 1250 | + |
|
| 1251 | + if ($value == $cf['default']) { |
|
| 1252 | + $value = ''; |
|
| 1253 | + } ?> |
|
| 1254 | 1254 | <div id="<?php echo $name;?>_row" |
| 1255 | 1255 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
| 1256 | 1256 | <label> |
| 1257 | 1257 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1258 | - echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1258 | + echo (trim($site_title)) ? $site_title : ' '; ?> |
|
| 1259 | 1259 | <?php if ($is_required) echo '<span>*</span>';?> |
| 1260 | 1260 | </label> |
| 1261 | 1261 | |
| 1262 | 1262 | <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;"> |
| 1263 | 1263 | <?php |
| 1264 | - global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats; |
|
| 1264 | + global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats; |
|
| 1265 | 1265 | |
| 1266 | - $exclude_cats = array(); |
|
| 1266 | + $exclude_cats = array(); |
|
| 1267 | 1267 | |
| 1268 | - if ($is_admin == '1') { |
|
| 1268 | + if ($is_admin == '1') { |
|
| 1269 | 1269 | |
| 1270 | - $post_type = get_post_type(); |
|
| 1270 | + $post_type = get_post_type(); |
|
| 1271 | 1271 | |
| 1272 | - $package_info = array(); |
|
| 1272 | + $package_info = array(); |
|
| 1273 | 1273 | |
| 1274 | - $package_info = (array)geodir_post_package_info($package_info, $post, $post_type); |
|
| 1274 | + $package_info = (array)geodir_post_package_info($package_info, $post, $post_type); |
|
| 1275 | 1275 | |
| 1276 | - if (!empty($package_info)) { |
|
| 1276 | + if (!empty($package_info)) { |
|
| 1277 | 1277 | |
| 1278 | - if (isset($package_info['cat']) && $package_info['cat'] != '') { |
|
| 1278 | + if (isset($package_info['cat']) && $package_info['cat'] != '') { |
|
| 1279 | 1279 | |
| 1280 | - $exclude_cats = explode(',', $package_info['cat']); |
|
| 1280 | + $exclude_cats = explode(',', $package_info['cat']); |
|
| 1281 | 1281 | |
| 1282 | - } |
|
| 1283 | - } |
|
| 1284 | - } |
|
| 1282 | + } |
|
| 1283 | + } |
|
| 1284 | + } |
|
| 1285 | 1285 | |
| 1286 | - $cat_display = unserialize($cf['extra_fields']); |
|
| 1286 | + $cat_display = unserialize($cf['extra_fields']); |
|
| 1287 | 1287 | |
| 1288 | - if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) { |
|
| 1288 | + if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) { |
|
| 1289 | 1289 | |
| 1290 | - $post_cat = implode(",", $post_cat[$name]); |
|
| 1290 | + $post_cat = implode(",", $post_cat[$name]); |
|
| 1291 | 1291 | |
| 1292 | - } else { |
|
| 1293 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 1294 | - $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true); |
|
| 1295 | - } |
|
| 1292 | + } else { |
|
| 1293 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 1294 | + $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true); |
|
| 1295 | + } |
|
| 1296 | 1296 | |
| 1297 | 1297 | |
| 1298 | - global $geodir_addon_list; |
|
| 1299 | - if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') { |
|
| 1298 | + global $geodir_addon_list; |
|
| 1299 | + if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') { |
|
| 1300 | 1300 | |
| 1301 | - $catadd_limit = $wpdb->get_var( |
|
| 1302 | - $wpdb->prepare( |
|
| 1303 | - "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d", |
|
| 1304 | - array($package_id) |
|
| 1305 | - ) |
|
| 1306 | - ); |
|
| 1301 | + $catadd_limit = $wpdb->get_var( |
|
| 1302 | + $wpdb->prepare( |
|
| 1303 | + "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d", |
|
| 1304 | + array($package_id) |
|
| 1305 | + ) |
|
| 1306 | + ); |
|
| 1307 | 1307 | |
| 1308 | 1308 | |
| 1309 | - } else { |
|
| 1310 | - $catadd_limit = 0; |
|
| 1311 | - } |
|
| 1309 | + } else { |
|
| 1310 | + $catadd_limit = 0; |
|
| 1311 | + } |
|
| 1312 | 1312 | |
| 1313 | 1313 | |
| 1314 | - if ($cat_display != '' && $cat_display != 'ajax_chained') { |
|
| 1314 | + if ($cat_display != '' && $cat_display != 'ajax_chained') { |
|
| 1315 | 1315 | |
| 1316 | - $required_limit_msg = ''; |
|
| 1317 | - if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') { |
|
| 1316 | + $required_limit_msg = ''; |
|
| 1317 | + if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') { |
|
| 1318 | 1318 | |
| 1319 | - $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory'); |
|
| 1319 | + $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory'); |
|
| 1320 | 1320 | |
| 1321 | - } else { |
|
| 1322 | - $required_limit_msg = $required_msg; |
|
| 1323 | - } |
|
| 1321 | + } else { |
|
| 1322 | + $required_limit_msg = $required_msg; |
|
| 1323 | + } |
|
| 1324 | 1324 | |
| 1325 | - echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']" />'; |
|
| 1325 | + echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']" />'; |
|
| 1326 | 1326 | |
| 1327 | 1327 | |
| 1328 | - if ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
| 1328 | + if ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
| 1329 | 1329 | |
| 1330 | - $cat_display == ''; |
|
| 1331 | - $multiple = ''; |
|
| 1332 | - if ($cat_display == 'multiselect') |
|
| 1333 | - $multiple = 'multiple="multiple"'; |
|
| 1330 | + $cat_display == ''; |
|
| 1331 | + $multiple = ''; |
|
| 1332 | + if ($cat_display == 'multiselect') |
|
| 1333 | + $multiple = 'multiple="multiple"'; |
|
| 1334 | 1334 | |
| 1335 | - echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">'; |
|
| 1335 | + echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">'; |
|
| 1336 | 1336 | |
| 1337 | 1337 | |
| 1338 | - if ($cat_display == 'select') |
|
| 1339 | - echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>'; |
|
| 1338 | + if ($cat_display == 'select') |
|
| 1339 | + echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>'; |
|
| 1340 | 1340 | |
| 1341 | - } |
|
| 1341 | + } |
|
| 1342 | 1342 | |
| 1343 | - echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0); |
|
| 1343 | + echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0); |
|
| 1344 | 1344 | |
| 1345 | - if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 1346 | - echo '</select>'; |
|
| 1345 | + if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 1346 | + echo '</select>'; |
|
| 1347 | 1347 | |
| 1348 | - } else { |
|
| 1348 | + } else { |
|
| 1349 | 1349 | |
| 1350 | - echo geodir_custom_taxonomy_walker2($name, $catadd_limit); |
|
| 1350 | + echo geodir_custom_taxonomy_walker2($name, $catadd_limit); |
|
| 1351 | 1351 | |
| 1352 | - } |
|
| 1352 | + } |
|
| 1353 | 1353 | |
| 1354 | - ?> |
|
| 1354 | + ?> |
|
| 1355 | 1355 | </div> |
| 1356 | 1356 | |
| 1357 | 1357 | <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
@@ -1361,10 +1361,10 @@ discard block |
||
| 1361 | 1361 | </div> |
| 1362 | 1362 | |
| 1363 | 1363 | <?php |
| 1364 | - $html = ob_get_clean(); |
|
| 1365 | - } |
|
| 1364 | + $html = ob_get_clean(); |
|
| 1365 | + } |
|
| 1366 | 1366 | |
| 1367 | - return $html; |
|
| 1367 | + return $html; |
|
| 1368 | 1368 | } |
| 1369 | 1369 | add_filter('geodir_custom_field_input_taxonomy','geodir_cfi_taxonomy',10,2); |
| 1370 | 1370 | |
@@ -1380,74 +1380,74 @@ discard block |
||
| 1380 | 1380 | */ |
| 1381 | 1381 | function geodir_cfi_file($html,$cf){ |
| 1382 | 1382 | |
| 1383 | - $html_var = $cf['htmlvar_name']; |
|
| 1383 | + $html_var = $cf['htmlvar_name']; |
|
| 1384 | 1384 | |
| 1385 | - // Check if there is a custom field specific filter. |
|
| 1386 | - if(has_filter("geodir_custom_field_input_file_{$html_var}")){ |
|
| 1387 | - /** |
|
| 1388 | - * Filter the file html by individual custom field. |
|
| 1389 | - * |
|
| 1390 | - * @param string $html The html to filter. |
|
| 1391 | - * @param array $cf The custom field array. |
|
| 1392 | - * @since 1.6.6 |
|
| 1393 | - */ |
|
| 1394 | - $html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf); |
|
| 1395 | - } |
|
| 1385 | + // Check if there is a custom field specific filter. |
|
| 1386 | + if(has_filter("geodir_custom_field_input_file_{$html_var}")){ |
|
| 1387 | + /** |
|
| 1388 | + * Filter the file html by individual custom field. |
|
| 1389 | + * |
|
| 1390 | + * @param string $html The html to filter. |
|
| 1391 | + * @param array $cf The custom field array. |
|
| 1392 | + * @since 1.6.6 |
|
| 1393 | + */ |
|
| 1394 | + $html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf); |
|
| 1395 | + } |
|
| 1396 | 1396 | |
| 1397 | - // If no html then we run the standard output. |
|
| 1398 | - if(empty($html)) { |
|
| 1397 | + // If no html then we run the standard output. |
|
| 1398 | + if(empty($html)) { |
|
| 1399 | 1399 | |
| 1400 | - ob_start(); // Start buffering; |
|
| 1401 | - $value = geodir_get_cf_value($cf); |
|
| 1400 | + ob_start(); // Start buffering; |
|
| 1401 | + $value = geodir_get_cf_value($cf); |
|
| 1402 | 1402 | |
| 1403 | - $name = $cf['name']; |
|
| 1404 | - $site_title = $cf['site_title']; |
|
| 1405 | - $admin_desc = $cf['desc']; |
|
| 1406 | - $is_required = $cf['is_required']; |
|
| 1407 | - $required_msg = $cf['required_msg']; |
|
| 1408 | - $extra_fields = unserialize($cf['extra_fields']); |
|
| 1403 | + $name = $cf['name']; |
|
| 1404 | + $site_title = $cf['site_title']; |
|
| 1405 | + $admin_desc = $cf['desc']; |
|
| 1406 | + $is_required = $cf['is_required']; |
|
| 1407 | + $required_msg = $cf['required_msg']; |
|
| 1408 | + $extra_fields = unserialize($cf['extra_fields']); |
|
| 1409 | 1409 | |
| 1410 | 1410 | |
| 1411 | - // adjust values here |
|
| 1412 | - $file_id = $name; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls |
|
| 1411 | + // adjust values here |
|
| 1412 | + $file_id = $name; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls |
|
| 1413 | 1413 | |
| 1414 | - if ($value != '') { |
|
| 1414 | + if ($value != '') { |
|
| 1415 | 1415 | |
| 1416 | - $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls. |
|
| 1416 | + $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls. |
|
| 1417 | 1417 | |
| 1418 | - } else |
|
| 1419 | - $file_value = ''; |
|
| 1418 | + } else |
|
| 1419 | + $file_value = ''; |
|
| 1420 | 1420 | |
| 1421 | - if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) |
|
| 1422 | - $file_multiple = true; // allow multiple files upload |
|
| 1423 | - else |
|
| 1424 | - $file_multiple = false; |
|
| 1421 | + if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) |
|
| 1422 | + $file_multiple = true; // allow multiple files upload |
|
| 1423 | + else |
|
| 1424 | + $file_multiple = false; |
|
| 1425 | 1425 | |
| 1426 | - if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) |
|
| 1427 | - $file_image_limit = $extra_fields['image_limit']; |
|
| 1428 | - else |
|
| 1429 | - $file_image_limit = 1; |
|
| 1426 | + if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) |
|
| 1427 | + $file_image_limit = $extra_fields['image_limit']; |
|
| 1428 | + else |
|
| 1429 | + $file_image_limit = 1; |
|
| 1430 | 1430 | |
| 1431 | - $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) |
|
| 1431 | + $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) |
|
| 1432 | 1432 | |
| 1433 | - $file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels) |
|
| 1433 | + $file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels) |
|
| 1434 | 1434 | |
| 1435 | - if (!empty($file_value)) { |
|
| 1436 | - $curImages = explode(',', $file_value); |
|
| 1437 | - if (!empty($curImages)) |
|
| 1438 | - $file_totImg = count($curImages); |
|
| 1439 | - } |
|
| 1435 | + if (!empty($file_value)) { |
|
| 1436 | + $curImages = explode(',', $file_value); |
|
| 1437 | + if (!empty($curImages)) |
|
| 1438 | + $file_totImg = count($curImages); |
|
| 1439 | + } |
|
| 1440 | 1440 | |
| 1441 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : ''; |
|
| 1442 | - $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : ''; |
|
| 1441 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : ''; |
|
| 1442 | + $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : ''; |
|
| 1443 | 1443 | |
| 1444 | - ?> |
|
| 1444 | + ?> |
|
| 1445 | 1445 | <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?> |
| 1446 | 1446 | <?php if($file_image_limit!=0 && $file_image_limit==1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('image with this package').')</small>';} ?> |
| 1447 | 1447 | <?php if($file_image_limit!=0 && $file_image_limit>1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('images with this package').')</small>';} ?> |
| 1448 | 1448 | <?php if($file_image_limit==0){echo '<br /><small>('.__('You can upload unlimited images with this package').')</small>';} ?> |
| 1449 | 1449 | </h5> <?php */ |
| 1450 | - ?> |
|
| 1450 | + ?> |
|
| 1451 | 1451 | |
| 1452 | 1452 | <div id="<?php echo $name;?>_row" |
| 1453 | 1453 | class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
@@ -1455,7 +1455,7 @@ discard block |
||
| 1455 | 1455 | <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;"> |
| 1456 | 1456 | <label |
| 1457 | 1457 | style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory'); |
| 1458 | - echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label> |
|
| 1458 | + echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label> |
|
| 1459 | 1459 | <input class="geodir-custom-file-upload" field_type="file" type="hidden" |
| 1460 | 1460 | name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>" |
| 1461 | 1461 | value="<?php echo esc_attr($file_value); ?>"/> |
@@ -1467,17 +1467,17 @@ discard block |
||
| 1467 | 1467 | <?php } ?> |
| 1468 | 1468 | <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg" |
| 1469 | 1469 | value="<?php if (isset($file_totImg)) { |
| 1470 | - echo esc_attr($file_totImg); |
|
| 1471 | - } else { |
|
| 1472 | - echo '0'; |
|
| 1473 | - } ?>"/> |
|
| 1470 | + echo esc_attr($file_totImg); |
|
| 1471 | + } else { |
|
| 1472 | + echo '0'; |
|
| 1473 | + } ?>"/> |
|
| 1474 | 1474 | |
| 1475 | 1475 | <div style="float:left; width:55%;"> |
| 1476 | 1476 | <div |
| 1477 | 1477 | class="plupload-upload-uic hide-if-no-js <?php if ($file_multiple): ?>plupload-upload-uic-multiple<?php endif; ?>" |
| 1478 | 1478 | id="<?php echo $file_id; ?>plupload-upload-ui" style="float:left; width:30%;"> |
| 1479 | 1479 | <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */ |
| 1480 | - ?> |
|
| 1480 | + ?> |
|
| 1481 | 1481 | <input id="<?php echo $file_id; ?>plupload-browse-button" type="button" |
| 1482 | 1482 | value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>" |
| 1483 | 1483 | class="geodir_button" style="margin-top:10px;"/> |
@@ -1496,7 +1496,7 @@ discard block |
||
| 1496 | 1496 | style=" clear:inherit; margin-top:0; margin-left:15px; padding-top:10px; float:left; width:50%;"> |
| 1497 | 1497 | </div> |
| 1498 | 1498 | <?php /*?><span id="upload-msg" ><?php _e('Please drag & drop the images to rearrange the order');?></span><?php */ |
| 1499 | - ?> |
|
| 1499 | + ?> |
|
| 1500 | 1500 | |
| 1501 | 1501 | <span id="<?php echo $file_id; ?>upload-error" style="display:none"></span> |
| 1502 | 1502 | |
@@ -1510,9 +1510,9 @@ discard block |
||
| 1510 | 1510 | |
| 1511 | 1511 | |
| 1512 | 1512 | <?php |
| 1513 | - $html = ob_get_clean(); |
|
| 1514 | - } |
|
| 1513 | + $html = ob_get_clean(); |
|
| 1514 | + } |
|
| 1515 | 1515 | |
| 1516 | - return $html; |
|
| 1516 | + return $html; |
|
| 1517 | 1517 | } |
| 1518 | 1518 | add_filter('geodir_custom_field_input_file','geodir_cfi_file',10,2); |
| 1519 | 1519 | \ No newline at end of file |
@@ -17,12 +17,12 @@ discard block |
||
| 17 | 17 | * |
| 18 | 18 | * @return string The html to output for the custom field. |
| 19 | 19 | */ |
| 20 | -function geodir_cfi_fieldset($html,$cf){ |
|
| 20 | +function geodir_cfi_fieldset($html, $cf) { |
|
| 21 | 21 | |
| 22 | 22 | $html_var = $cf['htmlvar_name']; |
| 23 | 23 | |
| 24 | 24 | // Check if there is a custom field specific filter. |
| 25 | - if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){ |
|
| 25 | + if (has_filter("geodir_custom_field_input_fieldset_{$html_var}")) { |
|
| 26 | 26 | /** |
| 27 | 27 | * Filter the fieldset html by individual custom field. |
| 28 | 28 | * |
@@ -30,18 +30,18 @@ discard block |
||
| 30 | 30 | * @param array $cf The custom field array. |
| 31 | 31 | * @since 1.6.6 |
| 32 | 32 | */ |
| 33 | - $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf); |
|
| 33 | + $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}", $html, $cf); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | // If no html then we run the standard output. |
| 37 | - if(empty($html)) { |
|
| 37 | + if (empty($html)) { |
|
| 38 | 38 | |
| 39 | 39 | ob_start(); // Start buffering; |
| 40 | 40 | ?> |
| 41 | 41 | <h5 id="geodir_fieldset_<?php echo (int) $cf['id']; ?>" class="geodir-fieldset-row" |
| 42 | - gd-fieldset="<?php echo (int) $cf['id']; ?>"><?php echo __( $cf['site_title'], 'geodirectory' ); ?> |
|
| 43 | - <?php if ( $cf['desc'] != '' ) { |
|
| 44 | - echo '<small>( ' . __( $cf['desc'], 'geodirectory' ) . ' )</small>'; |
|
| 42 | + gd-fieldset="<?php echo (int) $cf['id']; ?>"><?php echo __($cf['site_title'], 'geodirectory'); ?> |
|
| 43 | + <?php if ($cf['desc'] != '') { |
|
| 44 | + echo '<small>( '.__($cf['desc'], 'geodirectory').' )</small>'; |
|
| 45 | 45 | } ?></h5> |
| 46 | 46 | <?php |
| 47 | 47 | $html = ob_get_clean(); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | return $html; |
| 51 | 51 | } |
| 52 | -add_filter('geodir_custom_field_input_fieldset','geodir_cfi_fieldset',10,2); |
|
| 52 | +add_filter('geodir_custom_field_input_fieldset', 'geodir_cfi_fieldset', 10, 2); |
|
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | |
@@ -62,12 +62,12 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @return string The html to output for the custom field. |
| 64 | 64 | */ |
| 65 | -function geodir_cfi_text($html,$cf){ |
|
| 65 | +function geodir_cfi_text($html, $cf) { |
|
| 66 | 66 | |
| 67 | 67 | $html_var = $cf['htmlvar_name']; |
| 68 | 68 | |
| 69 | 69 | // Check if there is a custom field specific filter. |
| 70 | - if(has_filter("geodir_custom_field_input_text_{$html_var}")){ |
|
| 70 | + if (has_filter("geodir_custom_field_input_text_{$html_var}")) { |
|
| 71 | 71 | /** |
| 72 | 72 | * Filter the text html by individual custom field. |
| 73 | 73 | * |
@@ -75,41 +75,41 @@ discard block |
||
| 75 | 75 | * @param array $cf The custom field array. |
| 76 | 76 | * @since 1.6.6 |
| 77 | 77 | */ |
| 78 | - $html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf); |
|
| 78 | + $html = apply_filters("geodir_custom_field_input_text_{$html_var}", $html, $cf); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // If no html then we run the standard output. |
| 82 | - if(empty($html)) { |
|
| 82 | + if (empty($html)) { |
|
| 83 | 83 | |
| 84 | 84 | ob_start(); // Start buffering; |
| 85 | 85 | |
| 86 | 86 | $value = geodir_get_cf_value($cf); |
| 87 | 87 | $type = $cf['type']; |
| 88 | 88 | //number and float validation $validation_pattern |
| 89 | - if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';} |
|
| 90 | - elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';} |
|
| 89 | + if (isset($cf['data_type']) && $cf['data_type'] == 'INT') {$type = 'number'; } |
|
| 90 | + elseif (isset($cf['data_type']) && $cf['data_type'] == 'FLOAT') {$type = 'float'; } |
|
| 91 | 91 | |
| 92 | 92 | //validation |
| 93 | - if(isset($cf['validation_pattern']) && $cf['validation_pattern']){ |
|
| 93 | + if (isset($cf['validation_pattern']) && $cf['validation_pattern']) { |
|
| 94 | 94 | $validation = 'pattern="'.$cf['validation_pattern'].'"'; |
| 95 | - }else{$validation='';} |
|
| 95 | + } else {$validation = ''; } |
|
| 96 | 96 | |
| 97 | 97 | // validation message |
| 98 | - if(isset($cf['validation_msg']) && $cf['validation_msg']){ |
|
| 98 | + if (isset($cf['validation_msg']) && $cf['validation_msg']) { |
|
| 99 | 99 | $validation_msg = 'title="'.$cf['validation_msg'].'"'; |
| 100 | - }else{$validation_msg='';} |
|
| 100 | + } else {$validation_msg = ''; } |
|
| 101 | 101 | ?> |
| 102 | 102 | |
| 103 | - <div id="<?php echo $cf['name'];?>_row" |
|
| 104 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 103 | + <div id="<?php echo $cf['name']; ?>_row" |
|
| 104 | + class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 105 | 105 | <label> |
| 106 | 106 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 107 | 107 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 108 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 108 | + <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
|
| 109 | 109 | </label> |
| 110 | - <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
|
| 111 | - value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> /> |
|
| 112 | - <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
|
| 110 | + <input field_type="<?php echo $type; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" |
|
| 111 | + value="<?php echo esc_attr(stripslashes($value)); ?>" type="<?php echo $type; ?>" class="geodir_textfield" <?php echo $validation; echo $validation_msg; ?> /> |
|
| 112 | + <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
|
| 113 | 113 | <?php if ($cf['is_required']) { ?> |
| 114 | 114 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
| 115 | 115 | <?php } ?> |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | return $html; |
| 123 | 123 | } |
| 124 | -add_filter('geodir_custom_field_input_text','geodir_cfi_text',10,2); |
|
| 124 | +add_filter('geodir_custom_field_input_text', 'geodir_cfi_text', 10, 2); |
|
| 125 | 125 | |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -133,12 +133,12 @@ discard block |
||
| 133 | 133 | * |
| 134 | 134 | * @return string The html to output for the custom field. |
| 135 | 135 | */ |
| 136 | -function geodir_cfi_email($html,$cf){ |
|
| 136 | +function geodir_cfi_email($html, $cf) { |
|
| 137 | 137 | |
| 138 | 138 | $html_var = $cf['htmlvar_name']; |
| 139 | 139 | |
| 140 | 140 | // Check if there is a custom field specific filter. |
| 141 | - if(has_filter("geodir_custom_field_input_email_{$html_var}")){ |
|
| 141 | + if (has_filter("geodir_custom_field_input_email_{$html_var}")) { |
|
| 142 | 142 | /** |
| 143 | 143 | * Filter the email html by individual custom field. |
| 144 | 144 | * |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | * @param array $cf The custom field array. |
| 147 | 147 | * @since 1.6.6 |
| 148 | 148 | */ |
| 149 | - $html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf); |
|
| 149 | + $html = apply_filters("geodir_custom_field_input_email_{$html_var}", $html, $cf); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | // If no html then we run the standard output. |
| 153 | - if(empty($html)) { |
|
| 153 | + if (empty($html)) { |
|
| 154 | 154 | |
| 155 | 155 | ob_start(); // Start buffering; |
| 156 | 156 | $value = geodir_get_cf_value($cf); |
@@ -159,16 +159,16 @@ discard block |
||
| 159 | 159 | $value = ''; |
| 160 | 160 | }?> |
| 161 | 161 | |
| 162 | - <div id="<?php echo $cf['name'];?>_row" |
|
| 163 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 162 | + <div id="<?php echo $cf['name']; ?>_row" |
|
| 163 | + class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 164 | 164 | <label> |
| 165 | 165 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 166 | 166 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 167 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 167 | + <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
|
| 168 | 168 | </label> |
| 169 | - <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
|
| 170 | - value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/> |
|
| 171 | - <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
|
| 169 | + <input field_type="<?php echo $cf['type']; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" |
|
| 170 | + value="<?php echo esc_attr(stripslashes($value)); ?>" type="email" class="geodir_textfield"/> |
|
| 171 | + <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
|
| 172 | 172 | <?php if ($cf['is_required']) { ?> |
| 173 | 173 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
| 174 | 174 | <?php } ?> |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | return $html; |
| 182 | 182 | } |
| 183 | -add_filter('geodir_custom_field_input_email','geodir_cfi_email',10,2); |
|
| 183 | +add_filter('geodir_custom_field_input_email', 'geodir_cfi_email', 10, 2); |
|
| 184 | 184 | |
| 185 | 185 | |
| 186 | 186 | |
@@ -193,12 +193,12 @@ discard block |
||
| 193 | 193 | * |
| 194 | 194 | * @return string The html to output for the custom field. |
| 195 | 195 | */ |
| 196 | -function geodir_cfi_phone($html,$cf){ |
|
| 196 | +function geodir_cfi_phone($html, $cf) { |
|
| 197 | 197 | |
| 198 | 198 | $html_var = $cf['htmlvar_name']; |
| 199 | 199 | |
| 200 | 200 | // Check if there is a custom field specific filter. |
| 201 | - if(has_filter("geodir_custom_field_input_phone_{$html_var}")){ |
|
| 201 | + if (has_filter("geodir_custom_field_input_phone_{$html_var}")) { |
|
| 202 | 202 | /** |
| 203 | 203 | * Filter the phone html by individual custom field. |
| 204 | 204 | * |
@@ -206,11 +206,11 @@ discard block |
||
| 206 | 206 | * @param array $cf The custom field array. |
| 207 | 207 | * @since 1.6.6 |
| 208 | 208 | */ |
| 209 | - $html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf); |
|
| 209 | + $html = apply_filters("geodir_custom_field_input_phone_{$html_var}", $html, $cf); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | // If no html then we run the standard output. |
| 213 | - if(empty($html)) { |
|
| 213 | + if (empty($html)) { |
|
| 214 | 214 | |
| 215 | 215 | ob_start(); // Start buffering; |
| 216 | 216 | $value = geodir_get_cf_value($cf); |
@@ -219,16 +219,16 @@ discard block |
||
| 219 | 219 | $value = ''; |
| 220 | 220 | }?> |
| 221 | 221 | |
| 222 | - <div id="<?php echo $cf['name'];?>_row" |
|
| 223 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 222 | + <div id="<?php echo $cf['name']; ?>_row" |
|
| 223 | + class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 224 | 224 | <label> |
| 225 | 225 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 226 | 226 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 227 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 227 | + <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
|
| 228 | 228 | </label> |
| 229 | - <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
|
| 230 | - value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/> |
|
| 231 | - <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
|
| 229 | + <input field_type="<?php echo $cf['type']; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" |
|
| 230 | + value="<?php echo esc_attr(stripslashes($value)); ?>" type="tel" class="geodir_textfield"/> |
|
| 231 | + <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
|
| 232 | 232 | <?php if ($cf['is_required']) { ?> |
| 233 | 233 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
| 234 | 234 | <?php } ?> |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | return $html; |
| 242 | 242 | } |
| 243 | -add_filter('geodir_custom_field_input_phone','geodir_cfi_phone',10,2); |
|
| 243 | +add_filter('geodir_custom_field_input_phone', 'geodir_cfi_phone', 10, 2); |
|
| 244 | 244 | |
| 245 | 245 | |
| 246 | 246 | |
@@ -253,12 +253,12 @@ discard block |
||
| 253 | 253 | * |
| 254 | 254 | * @return string The html to output for the custom field. |
| 255 | 255 | */ |
| 256 | -function geodir_cfi_url($html,$cf){ |
|
| 256 | +function geodir_cfi_url($html, $cf) { |
|
| 257 | 257 | |
| 258 | 258 | $html_var = $cf['htmlvar_name']; |
| 259 | 259 | |
| 260 | 260 | // Check if there is a custom field specific filter. |
| 261 | - if(has_filter("geodir_custom_field_input_url_{$html_var}")){ |
|
| 261 | + if (has_filter("geodir_custom_field_input_url_{$html_var}")) { |
|
| 262 | 262 | /** |
| 263 | 263 | * Filter the url html by individual custom field. |
| 264 | 264 | * |
@@ -266,11 +266,11 @@ discard block |
||
| 266 | 266 | * @param array $cf The custom field array. |
| 267 | 267 | * @since 1.6.6 |
| 268 | 268 | */ |
| 269 | - $html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf); |
|
| 269 | + $html = apply_filters("geodir_custom_field_input_url_{$html_var}", $html, $cf); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | // If no html then we run the standard output. |
| 273 | - if(empty($html)) { |
|
| 273 | + if (empty($html)) { |
|
| 274 | 274 | |
| 275 | 275 | ob_start(); // Start buffering; |
| 276 | 276 | $value = geodir_get_cf_value($cf); |
@@ -279,19 +279,19 @@ discard block |
||
| 279 | 279 | $value = ''; |
| 280 | 280 | }?> |
| 281 | 281 | |
| 282 | - <div id="<?php echo $cf['name'];?>_row" |
|
| 283 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 282 | + <div id="<?php echo $cf['name']; ?>_row" |
|
| 283 | + class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 284 | 284 | <label> |
| 285 | 285 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 286 | 286 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 287 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 287 | + <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
|
| 288 | 288 | </label> |
| 289 | - <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
|
| 290 | - value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield" |
|
| 289 | + <input field_type="<?php echo $cf['type']; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" |
|
| 290 | + value="<?php echo esc_attr(stripslashes($value)); ?>" type="url" class="geodir_textfield" |
|
| 291 | 291 | oninvalid="setCustomValidity('<?php _e('Please enter a valid URL including http://', 'geodirectory'); ?>')" |
| 292 | 292 | onchange="try{setCustomValidity('')}catch(e){}" |
| 293 | 293 | /> |
| 294 | - <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
|
| 294 | + <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
|
| 295 | 295 | <?php if ($cf['is_required']) { ?> |
| 296 | 296 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
| 297 | 297 | <?php } ?> |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | |
| 304 | 304 | return $html; |
| 305 | 305 | } |
| 306 | -add_filter('geodir_custom_field_input_url','geodir_cfi_url',10,2); |
|
| 306 | +add_filter('geodir_custom_field_input_url', 'geodir_cfi_url', 10, 2); |
|
| 307 | 307 | |
| 308 | 308 | |
| 309 | 309 | /** |
@@ -315,12 +315,12 @@ discard block |
||
| 315 | 315 | * |
| 316 | 316 | * @return string The html to output for the custom field. |
| 317 | 317 | */ |
| 318 | -function geodir_cfi_radio($html,$cf){ |
|
| 318 | +function geodir_cfi_radio($html, $cf) { |
|
| 319 | 319 | |
| 320 | 320 | $html_var = $cf['htmlvar_name']; |
| 321 | 321 | |
| 322 | 322 | // Check if there is a custom field specific filter. |
| 323 | - if(has_filter("geodir_custom_field_input_radio_{$html_var}")){ |
|
| 323 | + if (has_filter("geodir_custom_field_input_radio_{$html_var}")) { |
|
| 324 | 324 | /** |
| 325 | 325 | * Filter the radio html by individual custom field. |
| 326 | 326 | * |
@@ -328,22 +328,22 @@ discard block |
||
| 328 | 328 | * @param array $cf The custom field array. |
| 329 | 329 | * @since 1.6.6 |
| 330 | 330 | */ |
| 331 | - $html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf); |
|
| 331 | + $html = apply_filters("geodir_custom_field_input_radio_{$html_var}", $html, $cf); |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | // If no html then we run the standard output. |
| 335 | - if(empty($html)) { |
|
| 335 | + if (empty($html)) { |
|
| 336 | 336 | |
| 337 | 337 | ob_start(); // Start buffering; |
| 338 | 338 | $value = geodir_get_cf_value($cf); |
| 339 | 339 | |
| 340 | 340 | ?> |
| 341 | - <div id="<?php echo $cf['name'];?>_row" |
|
| 342 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 341 | + <div id="<?php echo $cf['name']; ?>_row" |
|
| 342 | + class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 343 | 343 | <label> |
| 344 | 344 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 345 | 345 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 346 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 346 | + <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
|
| 347 | 347 | </label> |
| 348 | 348 | <?php if ($cf['option_values']) { |
| 349 | 349 | $option_values = geodir_string_values_to_options($cf['option_values'], true); |
@@ -352,14 +352,14 @@ discard block |
||
| 352 | 352 | foreach ($option_values as $option_value) { |
| 353 | 353 | if (empty($option_value['optgroup'])) { |
| 354 | 354 | ?> |
| 355 | - <span class="gd-radios"><input name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" <?php checked(stripslashes($value), $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="radio" /><?php echo $option_value['label']; ?></span> |
|
| 355 | + <span class="gd-radios"><input name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" <?php checked(stripslashes($value), $option_value['value']); ?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type']; ?>" type="radio" /><?php echo $option_value['label']; ?></span> |
|
| 356 | 356 | <?php |
| 357 | 357 | } |
| 358 | 358 | } |
| 359 | 359 | } |
| 360 | 360 | } |
| 361 | 361 | ?> |
| 362 | - <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
|
| 362 | + <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
|
| 363 | 363 | <?php if ($cf['is_required']) { ?> |
| 364 | 364 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
| 365 | 365 | <?php } ?> |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | |
| 372 | 372 | return $html; |
| 373 | 373 | } |
| 374 | -add_filter('geodir_custom_field_input_radio','geodir_cfi_radio',10,2); |
|
| 374 | +add_filter('geodir_custom_field_input_radio', 'geodir_cfi_radio', 10, 2); |
|
| 375 | 375 | |
| 376 | 376 | |
| 377 | 377 | /** |
@@ -383,12 +383,12 @@ discard block |
||
| 383 | 383 | * |
| 384 | 384 | * @return string The html to output for the custom field. |
| 385 | 385 | */ |
| 386 | -function geodir_cfi_checkbox($html,$cf){ |
|
| 386 | +function geodir_cfi_checkbox($html, $cf) { |
|
| 387 | 387 | |
| 388 | 388 | $html_var = $cf['htmlvar_name']; |
| 389 | 389 | |
| 390 | 390 | // Check if there is a custom field specific filter. |
| 391 | - if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){ |
|
| 391 | + if (has_filter("geodir_custom_field_input_checkbox_{$html_var}")) { |
|
| 392 | 392 | /** |
| 393 | 393 | * Filter the checkbox html by individual custom field. |
| 394 | 394 | * |
@@ -396,11 +396,11 @@ discard block |
||
| 396 | 396 | * @param array $cf The custom field array. |
| 397 | 397 | * @since 1.6.6 |
| 398 | 398 | */ |
| 399 | - $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf); |
|
| 399 | + $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}", $html, $cf); |
|
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | // If no html then we run the standard output. |
| 403 | - if(empty($html)) { |
|
| 403 | + if (empty($html)) { |
|
| 404 | 404 | |
| 405 | 405 | ob_start(); // Start buffering; |
| 406 | 406 | $value = geodir_get_cf_value($cf); |
@@ -411,22 +411,22 @@ discard block |
||
| 411 | 411 | } |
| 412 | 412 | ?> |
| 413 | 413 | |
| 414 | - <div id="<?php echo $cf['name'];?>_row" |
|
| 415 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 414 | + <div id="<?php echo $cf['name']; ?>_row" |
|
| 415 | + class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 416 | 416 | <label> |
| 417 | 417 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 418 | 418 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 419 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 419 | + <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
|
| 420 | 420 | </label> |
| 421 | 421 | <?php if ($value != '1') { |
| 422 | 422 | $value = '0'; |
| 423 | 423 | }?> |
| 424 | - <input type="hidden" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" value="<?php echo esc_attr($value);?>"/> |
|
| 424 | + <input type="hidden" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" value="<?php echo esc_attr($value); ?>"/> |
|
| 425 | 425 | <input <?php if ($value == '1') { |
| 426 | 426 | echo 'checked="checked"'; |
| 427 | - }?> value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox" |
|
| 428 | - onchange="if(this.checked){jQuery('#<?php echo $cf['name'];?>').val('1');} else{ jQuery('#<?php echo $cf['name'];?>').val('0');}"/> |
|
| 429 | - <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
|
| 427 | + }?> value="1" class="gd-checkbox" field_type="<?php echo $cf['type']; ?>" type="checkbox" |
|
| 428 | + onchange="if(this.checked){jQuery('#<?php echo $cf['name']; ?>').val('1');} else{ jQuery('#<?php echo $cf['name']; ?>').val('0');}"/> |
|
| 429 | + <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
|
| 430 | 430 | <?php if ($cf['is_required']) { ?> |
| 431 | 431 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
| 432 | 432 | <?php } ?> |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | |
| 439 | 439 | return $html; |
| 440 | 440 | } |
| 441 | -add_filter('geodir_custom_field_input_checkbox','geodir_cfi_checkbox',10,2); |
|
| 441 | +add_filter('geodir_custom_field_input_checkbox', 'geodir_cfi_checkbox', 10, 2); |
|
| 442 | 442 | |
| 443 | 443 | |
| 444 | 444 | /** |
@@ -450,12 +450,12 @@ discard block |
||
| 450 | 450 | * |
| 451 | 451 | * @return string The html to output for the custom field. |
| 452 | 452 | */ |
| 453 | -function geodir_cfi_textarea($html,$cf){ |
|
| 453 | +function geodir_cfi_textarea($html, $cf) { |
|
| 454 | 454 | |
| 455 | 455 | $html_var = $cf['htmlvar_name']; |
| 456 | 456 | |
| 457 | 457 | // Check if there is a custom field specific filter. |
| 458 | - if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){ |
|
| 458 | + if (has_filter("geodir_custom_field_input_textarea_{$html_var}")) { |
|
| 459 | 459 | /** |
| 460 | 460 | * Filter the textarea html by individual custom field. |
| 461 | 461 | * |
@@ -463,11 +463,11 @@ discard block |
||
| 463 | 463 | * @param array $cf The custom field array. |
| 464 | 464 | * @since 1.6.6 |
| 465 | 465 | */ |
| 466 | - $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf); |
|
| 466 | + $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}", $html, $cf); |
|
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | // If no html then we run the standard output. |
| 470 | - if(empty($html)) { |
|
| 470 | + if (empty($html)) { |
|
| 471 | 471 | |
| 472 | 472 | ob_start(); // Start buffering; |
| 473 | 473 | $value = geodir_get_cf_value($cf); |
@@ -475,32 +475,32 @@ discard block |
||
| 475 | 475 | $extra_fields = unserialize($cf['extra_fields']); |
| 476 | 476 | ?> |
| 477 | 477 | |
| 478 | - <div id="<?php echo $cf['name'];?>_row" |
|
| 479 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 478 | + <div id="<?php echo $cf['name']; ?>_row" |
|
| 479 | + class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 480 | 480 | <label> |
| 481 | 481 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 482 | 482 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 483 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 483 | + <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
|
| 484 | 484 | </label><?php |
| 485 | 485 | |
| 486 | 486 | |
| 487 | 487 | if (is_array($extra_fields) && in_array('1', $extra_fields)) { |
| 488 | 488 | |
| 489 | - $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?> |
|
| 489 | + $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?> |
|
| 490 | 490 | |
| 491 | - <div class="editor" field_id="<?php echo $cf['name'];?>" field_type="editor"> |
|
| 491 | + <div class="editor" field_id="<?php echo $cf['name']; ?>" field_type="editor"> |
|
| 492 | 492 | <?php wp_editor(stripslashes($value), $cf['name'], $editor_settings); ?> |
| 493 | 493 | </div><?php |
| 494 | 494 | |
| 495 | 495 | } else { |
| 496 | 496 | |
| 497 | - ?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>" |
|
| 498 | - id="<?php echo $cf['name'];?>"><?php echo stripslashes($value);?></textarea><?php |
|
| 497 | + ?><textarea field_type="<?php echo $cf['type']; ?>" class="geodir_textarea" name="<?php echo $cf['name']; ?>" |
|
| 498 | + id="<?php echo $cf['name']; ?>"><?php echo stripslashes($value); ?></textarea><?php |
|
| 499 | 499 | |
| 500 | 500 | }?> |
| 501 | 501 | |
| 502 | 502 | |
| 503 | - <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
|
| 503 | + <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
|
| 504 | 504 | <?php if ($cf['is_required']) { ?> |
| 505 | 505 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
| 506 | 506 | <?php } ?> |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | |
| 513 | 513 | return $html; |
| 514 | 514 | } |
| 515 | -add_filter('geodir_custom_field_input_textarea','geodir_cfi_textarea',10,2); |
|
| 515 | +add_filter('geodir_custom_field_input_textarea', 'geodir_cfi_textarea', 10, 2); |
|
| 516 | 516 | |
| 517 | 517 | |
| 518 | 518 | /** |
@@ -524,12 +524,12 @@ discard block |
||
| 524 | 524 | * |
| 525 | 525 | * @return string The html to output for the custom field. |
| 526 | 526 | */ |
| 527 | -function geodir_cfi_select($html,$cf){ |
|
| 527 | +function geodir_cfi_select($html, $cf) { |
|
| 528 | 528 | |
| 529 | 529 | $html_var = $cf['htmlvar_name']; |
| 530 | 530 | |
| 531 | 531 | // Check if there is a custom field specific filter. |
| 532 | - if(has_filter("geodir_custom_field_input_select_{$html_var}")){ |
|
| 532 | + if (has_filter("geodir_custom_field_input_select_{$html_var}")) { |
|
| 533 | 533 | /** |
| 534 | 534 | * Filter the select html by individual custom field. |
| 535 | 535 | * |
@@ -537,22 +537,22 @@ discard block |
||
| 537 | 537 | * @param array $cf The custom field array. |
| 538 | 538 | * @since 1.6.6 |
| 539 | 539 | */ |
| 540 | - $html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf); |
|
| 540 | + $html = apply_filters("geodir_custom_field_input_select_{$html_var}", $html, $cf); |
|
| 541 | 541 | } |
| 542 | 542 | |
| 543 | 543 | // If no html then we run the standard output. |
| 544 | - if(empty($html)) { |
|
| 544 | + if (empty($html)) { |
|
| 545 | 545 | |
| 546 | 546 | ob_start(); // Start buffering; |
| 547 | 547 | $value = geodir_get_cf_value($cf); |
| 548 | 548 | |
| 549 | 549 | ?> |
| 550 | - <div id="<?php echo $cf['name'];?>_row" |
|
| 551 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details"> |
|
| 550 | + <div id="<?php echo $cf['name']; ?>_row" |
|
| 551 | + class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details"> |
|
| 552 | 552 | <label> |
| 553 | 553 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 554 | 554 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 555 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 555 | + <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
|
| 556 | 556 | </label> |
| 557 | 557 | <?php |
| 558 | 558 | $option_values_arr = geodir_string_values_to_options($cf['option_values'], true); |
@@ -562,22 +562,22 @@ discard block |
||
| 562 | 562 | if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) { |
| 563 | 563 | $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
| 564 | 564 | |
| 565 | - $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
| 565 | + $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="'.esc_attr($option_label).'">' : '</optgroup>'; |
|
| 566 | 566 | } else { |
| 567 | 567 | $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
| 568 | 568 | $option_value = isset($option_row['value']) ? $option_row['value'] : ''; |
| 569 | 569 | $selected = $option_value == stripslashes($value) ? 'selected="selected"' : ''; |
| 570 | 570 | |
| 571 | - $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
| 571 | + $select_options .= '<option value="'.esc_attr($option_value).'" '.$selected.'>'.$option_label.'</option>'; |
|
| 572 | 572 | } |
| 573 | 573 | } |
| 574 | 574 | } |
| 575 | 575 | ?> |
| 576 | - <select field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" |
|
| 576 | + <select field_type="<?php echo $cf['type']; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" |
|
| 577 | 577 | class="geodir_textfield textfield_x chosen_select" |
| 578 | - data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '…';?>" |
|
| 579 | - option-ajaxchosen="false"><?php echo $select_options;?></select> |
|
| 580 | - <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
|
| 578 | + data-placeholder="<?php echo __('Choose', 'geodirectory').' '.$site_title.'…'; ?>" |
|
| 579 | + option-ajaxchosen="false"><?php echo $select_options; ?></select> |
|
| 580 | + <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
|
| 581 | 581 | <?php if ($cf['is_required']) { ?> |
| 582 | 582 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
| 583 | 583 | <?php } ?> |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | |
| 590 | 590 | return $html; |
| 591 | 591 | } |
| 592 | -add_filter('geodir_custom_field_input_select','geodir_cfi_select',10,2); |
|
| 592 | +add_filter('geodir_custom_field_input_select', 'geodir_cfi_select', 10, 2); |
|
| 593 | 593 | |
| 594 | 594 | |
| 595 | 595 | /** |
@@ -601,12 +601,12 @@ discard block |
||
| 601 | 601 | * |
| 602 | 602 | * @return string The html to output for the custom field. |
| 603 | 603 | */ |
| 604 | -function geodir_cfi_multiselect($html,$cf){ |
|
| 604 | +function geodir_cfi_multiselect($html, $cf) { |
|
| 605 | 605 | |
| 606 | 606 | $html_var = $cf['htmlvar_name']; |
| 607 | 607 | |
| 608 | 608 | // Check if there is a custom field specific filter. |
| 609 | - if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){ |
|
| 609 | + if (has_filter("geodir_custom_field_input_multiselect_{$html_var}")) { |
|
| 610 | 610 | /** |
| 611 | 611 | * Filter the multiselect html by individual custom field. |
| 612 | 612 | * |
@@ -614,11 +614,11 @@ discard block |
||
| 614 | 614 | * @param array $cf The custom field array. |
| 615 | 615 | * @since 1.6.6 |
| 616 | 616 | */ |
| 617 | - $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf); |
|
| 617 | + $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}", $html, $cf); |
|
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | // If no html then we run the standard output. |
| 621 | - if(empty($html)) { |
|
| 621 | + if (empty($html)) { |
|
| 622 | 622 | |
| 623 | 623 | ob_start(); // Start buffering; |
| 624 | 624 | $value = geodir_get_cf_value($cf); |
@@ -655,9 +655,9 @@ discard block |
||
| 655 | 655 | $option_label = isset($option_row['label']) ? $option_row['label'] : ''; |
| 656 | 656 | |
| 657 | 657 | if ($multi_display == 'select') { |
| 658 | - $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; |
|
| 658 | + $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="'.esc_attr($option_label).'">' : '</optgroup>'; |
|
| 659 | 659 | } else { |
| 660 | - $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : ''; |
|
| 660 | + $select_options .= $option_row['optgroup'] == 'start' ? '<li>'.$option_label.'</li>' : ''; |
|
| 661 | 661 | } |
| 662 | 662 | } else { |
| 663 | 663 | if (!is_array($value) && $value != '') { |
@@ -690,9 +690,9 @@ discard block |
||
| 690 | 690 | } |
| 691 | 691 | |
| 692 | 692 | if ($multi_display == 'select') { |
| 693 | - $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; |
|
| 693 | + $select_options .= '<option value="'.esc_attr($option_value).'" '.$selected.'>'.$option_label.'</option>'; |
|
| 694 | 694 | } else { |
| 695 | - $select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" /> ' . $option_label . ' </li>'; |
|
| 695 | + $select_options .= '<li><input name="'.$cf['name'].'[]" '.$checked.' value="'.esc_attr($option_value).'" class="gd-'.$multi_display.'" field_type="'.$multi_display.'" type="'.$multi_display.'" /> '.$option_label.' </li>'; |
|
| 696 | 696 | } |
| 697 | 697 | } |
| 698 | 698 | } |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | |
| 713 | 713 | return $html; |
| 714 | 714 | } |
| 715 | -add_filter('geodir_custom_field_input_multiselect','geodir_cfi_multiselect',10,2); |
|
| 715 | +add_filter('geodir_custom_field_input_multiselect', 'geodir_cfi_multiselect', 10, 2); |
|
| 716 | 716 | |
| 717 | 717 | |
| 718 | 718 | /** |
@@ -724,12 +724,12 @@ discard block |
||
| 724 | 724 | * |
| 725 | 725 | * @return string The html to output for the custom field. |
| 726 | 726 | */ |
| 727 | -function geodir_cfi_html($html,$cf){ |
|
| 727 | +function geodir_cfi_html($html, $cf) { |
|
| 728 | 728 | |
| 729 | 729 | $html_var = $cf['htmlvar_name']; |
| 730 | 730 | |
| 731 | 731 | // Check if there is a custom field specific filter. |
| 732 | - if(has_filter("geodir_custom_field_input_html_{$html_var}")){ |
|
| 732 | + if (has_filter("geodir_custom_field_input_html_{$html_var}")) { |
|
| 733 | 733 | /** |
| 734 | 734 | * Filter the html html by individual custom field. |
| 735 | 735 | * |
@@ -737,11 +737,11 @@ discard block |
||
| 737 | 737 | * @param array $cf The custom field array. |
| 738 | 738 | * @since 1.6.6 |
| 739 | 739 | */ |
| 740 | - $html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf); |
|
| 740 | + $html = apply_filters("geodir_custom_field_input_html_{$html_var}", $html, $cf); |
|
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | // If no html then we run the standard output. |
| 744 | - if(empty($html)) { |
|
| 744 | + if (empty($html)) { |
|
| 745 | 745 | |
| 746 | 746 | ob_start(); // Start buffering; |
| 747 | 747 | $value = geodir_get_cf_value($cf); |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | |
| 775 | 775 | return $html; |
| 776 | 776 | } |
| 777 | -add_filter('geodir_custom_field_input_html','geodir_cfi_html',10,2); |
|
| 777 | +add_filter('geodir_custom_field_input_html', 'geodir_cfi_html', 10, 2); |
|
| 778 | 778 | |
| 779 | 779 | |
| 780 | 780 | |
@@ -787,12 +787,12 @@ discard block |
||
| 787 | 787 | * |
| 788 | 788 | * @return string The html to output for the custom field. |
| 789 | 789 | */ |
| 790 | -function geodir_cfi_datepicker($html,$cf){ |
|
| 790 | +function geodir_cfi_datepicker($html, $cf) { |
|
| 791 | 791 | |
| 792 | 792 | $html_var = $cf['htmlvar_name']; |
| 793 | 793 | |
| 794 | 794 | // Check if there is a custom field specific filter. |
| 795 | - if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){ |
|
| 795 | + if (has_filter("geodir_custom_field_input_datepicker_{$html_var}")) { |
|
| 796 | 796 | /** |
| 797 | 797 | * Filter the datepicker html by individual custom field. |
| 798 | 798 | * |
@@ -800,11 +800,11 @@ discard block |
||
| 800 | 800 | * @param array $cf The custom field array. |
| 801 | 801 | * @since 1.6.6 |
| 802 | 802 | */ |
| 803 | - $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf); |
|
| 803 | + $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}", $html, $cf); |
|
| 804 | 804 | } |
| 805 | 805 | |
| 806 | 806 | // If no html then we run the standard output. |
| 807 | - if(empty($html)) { |
|
| 807 | + if (empty($html)) { |
|
| 808 | 808 | |
| 809 | 809 | ob_start(); // Start buffering; |
| 810 | 810 | $value = geodir_get_cf_value($cf); |
@@ -816,23 +816,23 @@ discard block |
||
| 816 | 816 | $extra_fields['date_format'] = 'yy-mm-dd'; |
| 817 | 817 | |
| 818 | 818 | $date_format = $extra_fields['date_format']; |
| 819 | - $jquery_date_format = $date_format; |
|
| 819 | + $jquery_date_format = $date_format; |
|
| 820 | 820 | |
| 821 | 821 | |
| 822 | 822 | // check if we need to change the format or not |
| 823 | 823 | $date_format_len = strlen(str_replace(' ', '', $date_format)); |
| 824 | - if($date_format_len>5){// if greater then 5 then it's the old style format. |
|
| 824 | + if ($date_format_len > 5) {// if greater then 5 then it's the old style format. |
|
| 825 | 825 | |
| 826 | - $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format |
|
| 827 | - $replace = array('d','j','l','m','n','F','Y');//PHP date format |
|
| 826 | + $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format |
|
| 827 | + $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format |
|
| 828 | 828 | |
| 829 | 829 | $date_format = str_replace($search, $replace, $date_format); |
| 830 | - }else{ |
|
| 831 | - $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format ); |
|
| 830 | + } else { |
|
| 831 | + $jquery_date_format = geodir_date_format_php_to_jqueryui($jquery_date_format); |
|
| 832 | 832 | } |
| 833 | 833 | |
| 834 | - if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty |
|
| 835 | - if($value && !isset($_REQUEST['backandedit'])) { |
|
| 834 | + if ($value == '0000-00-00') {$value = ''; }//if date not set, then mark it empty |
|
| 835 | + if ($value && !isset($_REQUEST['backandedit'])) { |
|
| 836 | 836 | //$time = strtotime($value); |
| 837 | 837 | //$value = date_i18n($date_format, $time); |
| 838 | 838 | } |
@@ -843,37 +843,37 @@ discard block |
||
| 843 | 843 | |
| 844 | 844 | jQuery(function () { |
| 845 | 845 | |
| 846 | - jQuery("#<?php echo $cf['name'];?>").datepicker({changeMonth: true, changeYear: true <?php |
|
| 846 | + jQuery("#<?php echo $cf['name']; ?>").datepicker({changeMonth: true, changeYear: true <?php |
|
| 847 | 847 | /** |
| 848 | 848 | * Used to add extra option to datepicker per custom field. |
| 849 | 849 | * |
| 850 | 850 | * @since 1.5.7 |
| 851 | 851 | * @param string $name The custom field name. |
| 852 | 852 | */ |
| 853 | - echo apply_filters("gd_datepicker_extra_{$name}",'');?>}); |
|
| 853 | + echo apply_filters("gd_datepicker_extra_{$name}", ''); ?>}); |
|
| 854 | 854 | |
| 855 | - jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format;?>'); |
|
| 855 | + jQuery("#<?php echo $name; ?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format; ?>'); |
|
| 856 | 856 | |
| 857 | - <?php if(!empty($value)){?> |
|
| 858 | - jQuery("#<?php echo $name;?>").datepicker("setDate", '<?php echo $value;?>'); |
|
| 857 | + <?php if (!empty($value)) {?> |
|
| 858 | + jQuery("#<?php echo $name; ?>").datepicker("setDate", '<?php echo $value; ?>'); |
|
| 859 | 859 | <?php } ?> |
| 860 | 860 | |
| 861 | 861 | }); |
| 862 | 862 | |
| 863 | 863 | </script> |
| 864 | - <div id="<?php echo $name;?>_row" |
|
| 865 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 864 | + <div id="<?php echo $name; ?>_row" |
|
| 865 | + class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 866 | 866 | <label> |
| 867 | 867 | |
| 868 | 868 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 869 | 869 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 870 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 870 | + <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
|
| 871 | 871 | </label> |
| 872 | 872 | |
| 873 | - <input field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>" id="<?php echo $name;?>" |
|
| 874 | - value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/> |
|
| 873 | + <input field_type="<?php echo $cf['type']; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>" |
|
| 874 | + value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/> |
|
| 875 | 875 | |
| 876 | - <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
|
| 876 | + <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
|
| 877 | 877 | <?php if ($cf['is_required']) { ?> |
| 878 | 878 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
| 879 | 879 | <?php } ?> |
@@ -885,7 +885,7 @@ discard block |
||
| 885 | 885 | |
| 886 | 886 | return $html; |
| 887 | 887 | } |
| 888 | -add_filter('geodir_custom_field_input_datepicker','geodir_cfi_datepicker',10,2); |
|
| 888 | +add_filter('geodir_custom_field_input_datepicker', 'geodir_cfi_datepicker', 10, 2); |
|
| 889 | 889 | |
| 890 | 890 | |
| 891 | 891 | /** |
@@ -897,12 +897,12 @@ discard block |
||
| 897 | 897 | * |
| 898 | 898 | * @return string The html to output for the custom field. |
| 899 | 899 | */ |
| 900 | -function geodir_cfi_time($html,$cf){ |
|
| 900 | +function geodir_cfi_time($html, $cf) { |
|
| 901 | 901 | |
| 902 | 902 | $html_var = $cf['htmlvar_name']; |
| 903 | 903 | |
| 904 | 904 | // Check if there is a custom field specific filter. |
| 905 | - if(has_filter("geodir_custom_field_input_time_{$html_var}")){ |
|
| 905 | + if (has_filter("geodir_custom_field_input_time_{$html_var}")) { |
|
| 906 | 906 | /** |
| 907 | 907 | * Filter the time html by individual custom field. |
| 908 | 908 | * |
@@ -910,11 +910,11 @@ discard block |
||
| 910 | 910 | * @param array $cf The custom field array. |
| 911 | 911 | * @since 1.6.6 |
| 912 | 912 | */ |
| 913 | - $html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf); |
|
| 913 | + $html = apply_filters("geodir_custom_field_input_time_{$html_var}", $html, $cf); |
|
| 914 | 914 | } |
| 915 | 915 | |
| 916 | 916 | // If no html then we run the standard output. |
| 917 | - if(empty($html)) { |
|
| 917 | + if (empty($html)) { |
|
| 918 | 918 | |
| 919 | 919 | ob_start(); // Start buffering; |
| 920 | 920 | $value = geodir_get_cf_value($cf); |
@@ -927,25 +927,25 @@ discard block |
||
| 927 | 927 | <script type="text/javascript"> |
| 928 | 928 | jQuery(document).ready(function () { |
| 929 | 929 | |
| 930 | - jQuery('#<?php echo $name;?>').timepicker({ |
|
| 930 | + jQuery('#<?php echo $name; ?>').timepicker({ |
|
| 931 | 931 | showPeriod: true, |
| 932 | 932 | showLeadingZero: true, |
| 933 | 933 | showPeriod: true, |
| 934 | 934 | }); |
| 935 | 935 | }); |
| 936 | 936 | </script> |
| 937 | - <div id="<?php echo $name;?>_row" |
|
| 938 | - class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 937 | + <div id="<?php echo $name; ?>_row" |
|
| 938 | + class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 939 | 939 | <label> |
| 940 | 940 | |
| 941 | 941 | <?php $site_title = __($cf['site_title'], 'geodirectory'); |
| 942 | 942 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 943 | - <?php if ($cf['is_required']) echo '<span>*</span>';?> |
|
| 943 | + <?php if ($cf['is_required']) echo '<span>*</span>'; ?> |
|
| 944 | 944 | </label> |
| 945 | - <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>" |
|
| 946 | - id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/> |
|
| 945 | + <input readonly="readonly" field_type="<?php echo $cf['type']; ?>" name="<?php echo $name; ?>" |
|
| 946 | + id="<?php echo $name; ?>" value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/> |
|
| 947 | 947 | |
| 948 | - <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span> |
|
| 948 | + <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span> |
|
| 949 | 949 | <?php if ($cf['is_required']) { ?> |
| 950 | 950 | <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span> |
| 951 | 951 | <?php } ?> |
@@ -956,7 +956,7 @@ discard block |
||
| 956 | 956 | |
| 957 | 957 | return $html; |
| 958 | 958 | } |
| 959 | -add_filter('geodir_custom_field_input_time','geodir_cfi_time',10,2); |
|
| 959 | +add_filter('geodir_custom_field_input_time', 'geodir_cfi_time', 10, 2); |
|
| 960 | 960 | |
| 961 | 961 | |
| 962 | 962 | /** |
@@ -968,12 +968,12 @@ discard block |
||
| 968 | 968 | * |
| 969 | 969 | * @return string The html to output for the custom field. |
| 970 | 970 | */ |
| 971 | -function geodir_cfi_address($html,$cf){ |
|
| 971 | +function geodir_cfi_address($html, $cf) { |
|
| 972 | 972 | |
| 973 | 973 | $html_var = $cf['htmlvar_name']; |
| 974 | 974 | |
| 975 | 975 | // Check if there is a custom field specific filter. |
| 976 | - if(has_filter("geodir_custom_field_input_address_{$html_var}")){ |
|
| 976 | + if (has_filter("geodir_custom_field_input_address_{$html_var}")) { |
|
| 977 | 977 | /** |
| 978 | 978 | * Filter the address html by individual custom field. |
| 979 | 979 | * |
@@ -981,11 +981,11 @@ discard block |
||
| 981 | 981 | * @param array $cf The custom field array. |
| 982 | 982 | * @since 1.6.6 |
| 983 | 983 | */ |
| 984 | - $html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf); |
|
| 984 | + $html = apply_filters("geodir_custom_field_input_address_{$html_var}", $html, $cf); |
|
| 985 | 985 | } |
| 986 | 986 | |
| 987 | 987 | // If no html then we run the standard output. |
| 988 | - if(empty($html)) { |
|
| 988 | + if (empty($html)) { |
|
| 989 | 989 | |
| 990 | 990 | global $gd_session; |
| 991 | 991 | ob_start(); // Start buffering; |
@@ -998,12 +998,12 @@ discard block |
||
| 998 | 998 | $site_title = $cf['site_title']; |
| 999 | 999 | $is_admin = $cf['is_admin']; |
| 1000 | 1000 | $extra_fields = stripslashes_deep(unserialize($cf['extra_fields'])); |
| 1001 | - $prefix = $name . '_'; |
|
| 1001 | + $prefix = $name.'_'; |
|
| 1002 | 1002 | |
| 1003 | - ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address'); |
|
| 1004 | - ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code '); |
|
| 1003 | + ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix.' address'); |
|
| 1004 | + ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix.' zip/post code '); |
|
| 1005 | 1005 | ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map'); |
| 1006 | - ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview'); |
|
| 1006 | + ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix.' mapview'); |
|
| 1007 | 1007 | |
| 1008 | 1008 | $address = ''; |
| 1009 | 1009 | $zip = ''; |
@@ -1014,21 +1014,21 @@ discard block |
||
| 1014 | 1014 | |
| 1015 | 1015 | if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) { |
| 1016 | 1016 | $post = $gd_ses_listing; |
| 1017 | - $address = $post[$prefix . 'address']; |
|
| 1018 | - $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : ''; |
|
| 1019 | - $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : ''; |
|
| 1020 | - $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : ''; |
|
| 1021 | - $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : ''; |
|
| 1022 | - $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : ''; |
|
| 1017 | + $address = $post[$prefix.'address']; |
|
| 1018 | + $zip = isset($post[$prefix.'zip']) ? $post[$prefix.'zip'] : ''; |
|
| 1019 | + $lat = isset($post[$prefix.'latitude']) ? $post[$prefix.'latitude'] : ''; |
|
| 1020 | + $lng = isset($post[$prefix.'longitude']) ? $post[$prefix.'longitude'] : ''; |
|
| 1021 | + $mapview = isset($post[$prefix.'mapview']) ? $post[$prefix.'mapview'] : ''; |
|
| 1022 | + $mapzoom = isset($post[$prefix.'mapzoom']) ? $post[$prefix.'mapzoom'] : ''; |
|
| 1023 | 1023 | } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) { |
| 1024 | - $post_info = (array)$post_info; |
|
| 1025 | - |
|
| 1026 | - $address = $post_info[$prefix . 'address']; |
|
| 1027 | - $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : ''; |
|
| 1028 | - $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : ''; |
|
| 1029 | - $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : ''; |
|
| 1030 | - $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : ''; |
|
| 1031 | - $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : ''; |
|
| 1024 | + $post_info = (array) $post_info; |
|
| 1025 | + |
|
| 1026 | + $address = $post_info[$prefix.'address']; |
|
| 1027 | + $zip = isset($post_info[$prefix.'zip']) ? $post_info[$prefix.'zip'] : ''; |
|
| 1028 | + $lat = isset($post_info[$prefix.'latitude']) ? $post_info[$prefix.'latitude'] : ''; |
|
| 1029 | + $lng = isset($post_info[$prefix.'longitude']) ? $post_info[$prefix.'longitude'] : ''; |
|
| 1030 | + $mapview = isset($post_info[$prefix.'mapview']) ? $post_info[$prefix.'mapview'] : ''; |
|
| 1031 | + $mapzoom = isset($post_info[$prefix.'mapzoom']) ? $post_info[$prefix.'mapzoom'] : ''; |
|
| 1032 | 1032 | } |
| 1033 | 1033 | |
| 1034 | 1034 | $location = geodir_get_default_location(); |
@@ -1065,16 +1065,16 @@ discard block |
||
| 1065 | 1065 | |
| 1066 | 1066 | ?> |
| 1067 | 1067 | |
| 1068 | - <div id="geodir_<?php echo $prefix . 'address';?>_row" |
|
| 1069 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 1068 | + <div id="geodir_<?php echo $prefix.'address'; ?>_row" |
|
| 1069 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 1070 | 1070 | <label> |
| 1071 | 1071 | <?php _e($address_title, 'geodirectory'); ?> |
| 1072 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1072 | + <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1073 | 1073 | </label> |
| 1074 | - <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>" |
|
| 1075 | - id="<?php echo $prefix . 'address';?>" class="geodir_textfield" |
|
| 1074 | + <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'address'; ?>" |
|
| 1075 | + id="<?php echo $prefix.'address'; ?>" class="geodir_textfield" |
|
| 1076 | 1076 | value="<?php echo esc_attr(stripslashes($address)); ?>"/> |
| 1077 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
|
| 1077 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span> |
|
| 1078 | 1078 | <?php if ($is_required) { ?> |
| 1079 | 1079 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
| 1080 | 1080 | <?php } ?> |
@@ -1094,14 +1094,14 @@ discard block |
||
| 1094 | 1094 | |
| 1095 | 1095 | if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?> |
| 1096 | 1096 | |
| 1097 | - <div id="geodir_<?php echo $prefix . 'zip'; ?>_row" |
|
| 1097 | + <div id="geodir_<?php echo $prefix.'zip'; ?>_row" |
|
| 1098 | 1098 | class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix gd-fieldset-details"> |
| 1099 | 1099 | <label> |
| 1100 | 1100 | <?php _e($zip_title, 'geodirectory'); ?> |
| 1101 | 1101 | <?php /*if($is_required) echo '<span>*</span>';*/ ?> |
| 1102 | 1102 | </label> |
| 1103 | - <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'zip'; ?>" |
|
| 1104 | - id="<?php echo $prefix . 'zip'; ?>" class="geodir_textfield autofill" |
|
| 1103 | + <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'zip'; ?>" |
|
| 1104 | + id="<?php echo $prefix.'zip'; ?>" class="geodir_textfield autofill" |
|
| 1105 | 1105 | value="<?php echo esc_attr(stripslashes($zip)); ?>"/> |
| 1106 | 1106 | <?php /*if($is_required) {?> |
| 1107 | 1107 | <span class="geodir_message_error"><?php echo _e($required_msg,'geodirectory');?></span> |
@@ -1111,14 +1111,14 @@ discard block |
||
| 1111 | 1111 | |
| 1112 | 1112 | <?php if (isset($extra_fields['show_map']) && $extra_fields['show_map']) { ?> |
| 1113 | 1113 | |
| 1114 | - <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details"> |
|
| 1114 | + <div id="geodir_<?php echo $prefix.'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details"> |
|
| 1115 | 1115 | <?php |
| 1116 | 1116 | /** |
| 1117 | 1117 | * Contains add listing page map functions. |
| 1118 | 1118 | * |
| 1119 | 1119 | * @since 1.0.0 |
| 1120 | 1120 | */ |
| 1121 | - include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php"); |
|
| 1121 | + include(geodir_plugin_path()."/geodirectory-functions/map-functions/map_on_add_listing_page.php"); |
|
| 1122 | 1122 | if ($lat_lng_blank) { |
| 1123 | 1123 | $lat = ''; |
| 1124 | 1124 | $lng = ''; |
@@ -1129,14 +1129,14 @@ discard block |
||
| 1129 | 1129 | <?php |
| 1130 | 1130 | /* show lat lng */ |
| 1131 | 1131 | $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?> |
| 1132 | - <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row" |
|
| 1132 | + <div id="geodir_<?php echo $prefix.'latitude'; ?>_row" |
|
| 1133 | 1133 | class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>> |
| 1134 | 1134 | <label> |
| 1135 | 1135 | <?php echo PLACE_ADDRESS_LAT; ?> |
| 1136 | 1136 | <?php if ($is_required) echo '<span>*</span>'; ?> |
| 1137 | 1137 | </label> |
| 1138 | - <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>" |
|
| 1139 | - id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield" |
|
| 1138 | + <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'latitude'; ?>" |
|
| 1139 | + id="<?php echo $prefix.'latitude'; ?>" class="geodir_textfield" |
|
| 1140 | 1140 | value="<?php echo esc_attr(stripslashes($lat)); ?>" size="25"/> |
| 1141 | 1141 | <span class="geodir_message_note"><?php echo GET_LATITUDE_MSG; ?></span> |
| 1142 | 1142 | <?php if ($is_required) { ?> |
@@ -1144,14 +1144,14 @@ discard block |
||
| 1144 | 1144 | <?php } ?> |
| 1145 | 1145 | </div> |
| 1146 | 1146 | |
| 1147 | - <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row" |
|
| 1147 | + <div id="geodir_<?php echo $prefix.'longitude'; ?>_row" |
|
| 1148 | 1148 | class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>> |
| 1149 | 1149 | <label> |
| 1150 | 1150 | <?php echo PLACE_ADDRESS_LNG; ?> |
| 1151 | 1151 | <?php if ($is_required) echo '<span>*</span>'; ?> |
| 1152 | 1152 | </label> |
| 1153 | - <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>" |
|
| 1154 | - id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield" |
|
| 1153 | + <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'longitude'; ?>" |
|
| 1154 | + id="<?php echo $prefix.'longitude'; ?>" class="geodir_textfield" |
|
| 1155 | 1155 | value="<?php echo esc_attr(stripslashes($lng)); ?>" size="25"/> |
| 1156 | 1156 | <span class="geodir_message_note"><?php echo GET_LOGNGITUDE_MSG; ?></span> |
| 1157 | 1157 | <?php if ($is_required) { ?> |
@@ -1161,32 +1161,32 @@ discard block |
||
| 1161 | 1161 | <?php } ?> |
| 1162 | 1162 | |
| 1163 | 1163 | <?php if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) { ?> |
| 1164 | - <div id="geodir_<?php echo $prefix . 'mapview'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details"> |
|
| 1164 | + <div id="geodir_<?php echo $prefix.'mapview'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details"> |
|
| 1165 | 1165 | <label><?php _e($mapview_title, 'geodirectory'); ?></label> |
| 1166 | 1166 | |
| 1167 | 1167 | |
| 1168 | 1168 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio" |
| 1169 | 1169 | class="gd-checkbox" |
| 1170 | - name="<?php echo $prefix . 'mapview'; ?>" |
|
| 1171 | - id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') { |
|
| 1170 | + name="<?php echo $prefix.'mapview'; ?>" |
|
| 1171 | + id="<?php echo $prefix.'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') { |
|
| 1172 | 1172 | echo 'checked="checked"'; |
| 1173 | 1173 | } ?> value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span> |
| 1174 | 1174 | <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio" |
| 1175 | 1175 | class="gd-checkbox" |
| 1176 | - name="<?php echo $prefix . 'mapview'; ?>" |
|
| 1176 | + name="<?php echo $prefix.'mapview'; ?>" |
|
| 1177 | 1177 | id="map_view1" <?php if ($mapview == 'SATELLITE') { |
| 1178 | 1178 | echo 'checked="checked"'; |
| 1179 | 1179 | } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span> |
| 1180 | 1180 | |
| 1181 | 1181 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio" |
| 1182 | 1182 | class="gd-checkbox" |
| 1183 | - name="<?php echo $prefix . 'mapview'; ?>" |
|
| 1183 | + name="<?php echo $prefix.'mapview'; ?>" |
|
| 1184 | 1184 | id="map_view2" <?php if ($mapview == 'HYBRID') { |
| 1185 | 1185 | echo 'checked="checked"'; |
| 1186 | 1186 | } ?> value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span> |
| 1187 | 1187 | <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio" |
| 1188 | 1188 | class="gd-checkbox" |
| 1189 | - name="<?php echo $prefix . 'mapview'; ?>" |
|
| 1189 | + name="<?php echo $prefix.'mapview'; ?>" |
|
| 1190 | 1190 | id="map_view3" <?php if ($mapview == 'TERRAIN') { |
| 1191 | 1191 | echo 'checked="checked"'; |
| 1192 | 1192 | } ?> value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span> |
@@ -1198,7 +1198,7 @@ discard block |
||
| 1198 | 1198 | <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?> |
| 1199 | 1199 | <input type="hidden" value="<?php if (isset($mapzoom)) { |
| 1200 | 1200 | echo esc_attr($mapzoom); |
| 1201 | - } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/> |
|
| 1201 | + } ?>" name="<?php echo $prefix.'mapzoom'; ?>" id="<?php echo $prefix.'mapzoom'; ?>"/> |
|
| 1202 | 1202 | <?php } |
| 1203 | 1203 | |
| 1204 | 1204 | $html = ob_get_clean(); |
@@ -1206,7 +1206,7 @@ discard block |
||
| 1206 | 1206 | |
| 1207 | 1207 | return $html; |
| 1208 | 1208 | } |
| 1209 | -add_filter('geodir_custom_field_input_address','geodir_cfi_address',10,2); |
|
| 1209 | +add_filter('geodir_custom_field_input_address', 'geodir_cfi_address', 10, 2); |
|
| 1210 | 1210 | |
| 1211 | 1211 | |
| 1212 | 1212 | |
@@ -1219,12 +1219,12 @@ discard block |
||
| 1219 | 1219 | * |
| 1220 | 1220 | * @return string The html to output for the custom field. |
| 1221 | 1221 | */ |
| 1222 | -function geodir_cfi_taxonomy($html,$cf){ |
|
| 1222 | +function geodir_cfi_taxonomy($html, $cf) { |
|
| 1223 | 1223 | |
| 1224 | 1224 | $html_var = $cf['htmlvar_name']; |
| 1225 | 1225 | |
| 1226 | 1226 | // Check if there is a custom field specific filter. |
| 1227 | - if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){ |
|
| 1227 | + if (has_filter("geodir_custom_field_input_taxonomy_{$html_var}")) { |
|
| 1228 | 1228 | /** |
| 1229 | 1229 | * Filter the taxonomy html by individual custom field. |
| 1230 | 1230 | * |
@@ -1232,11 +1232,11 @@ discard block |
||
| 1232 | 1232 | * @param array $cf The custom field array. |
| 1233 | 1233 | * @since 1.6.6 |
| 1234 | 1234 | */ |
| 1235 | - $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf); |
|
| 1235 | + $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}", $html, $cf); |
|
| 1236 | 1236 | } |
| 1237 | 1237 | |
| 1238 | 1238 | // If no html then we run the standard output. |
| 1239 | - if(empty($html)) { |
|
| 1239 | + if (empty($html)) { |
|
| 1240 | 1240 | |
| 1241 | 1241 | ob_start(); // Start buffering; |
| 1242 | 1242 | $value = geodir_get_cf_value($cf); |
@@ -1251,15 +1251,15 @@ discard block |
||
| 1251 | 1251 | if ($value == $cf['default']) { |
| 1252 | 1252 | $value = ''; |
| 1253 | 1253 | } ?> |
| 1254 | - <div id="<?php echo $name;?>_row" |
|
| 1255 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 1254 | + <div id="<?php echo $name; ?>_row" |
|
| 1255 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 1256 | 1256 | <label> |
| 1257 | 1257 | <?php $site_title = __($site_title, 'geodirectory'); |
| 1258 | 1258 | echo (trim($site_title)) ? $site_title : ' '; ?> |
| 1259 | - <?php if ($is_required) echo '<span>*</span>';?> |
|
| 1259 | + <?php if ($is_required) echo '<span>*</span>'; ?> |
|
| 1260 | 1260 | </label> |
| 1261 | 1261 | |
| 1262 | - <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;"> |
|
| 1262 | + <div id="<?php echo $name; ?>" class="geodir_taxonomy_field" style="float:left; width:70%;"> |
|
| 1263 | 1263 | <?php |
| 1264 | 1264 | global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats; |
| 1265 | 1265 | |
@@ -1271,7 +1271,7 @@ discard block |
||
| 1271 | 1271 | |
| 1272 | 1272 | $package_info = array(); |
| 1273 | 1273 | |
| 1274 | - $package_info = (array)geodir_post_package_info($package_info, $post, $post_type); |
|
| 1274 | + $package_info = (array) geodir_post_package_info($package_info, $post, $post_type); |
|
| 1275 | 1275 | |
| 1276 | 1276 | if (!empty($package_info)) { |
| 1277 | 1277 | |
@@ -1300,7 +1300,7 @@ discard block |
||
| 1300 | 1300 | |
| 1301 | 1301 | $catadd_limit = $wpdb->get_var( |
| 1302 | 1302 | $wpdb->prepare( |
| 1303 | - "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d", |
|
| 1303 | + "SELECT cat_limit FROM ".GEODIR_PRICE_TABLE." WHERE pid = %d", |
|
| 1304 | 1304 | array($package_id) |
| 1305 | 1305 | ) |
| 1306 | 1306 | ); |
@@ -1316,13 +1316,13 @@ discard block |
||
| 1316 | 1316 | $required_limit_msg = ''; |
| 1317 | 1317 | if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') { |
| 1318 | 1318 | |
| 1319 | - $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory'); |
|
| 1319 | + $required_limit_msg = __('Only select', 'geodirectory').' '.$catadd_limit.__(' categories for this package.', 'geodirectory'); |
|
| 1320 | 1320 | |
| 1321 | 1321 | } else { |
| 1322 | 1322 | $required_limit_msg = $required_msg; |
| 1323 | 1323 | } |
| 1324 | 1324 | |
| 1325 | - echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']" />'; |
|
| 1325 | + echo '<input type="hidden" cat_limit="'.$catadd_limit.'" id="cat_limit" value="'.esc_attr($required_limit_msg).'" name="cat_limit['.$name.']" />'; |
|
| 1326 | 1326 | |
| 1327 | 1327 | |
| 1328 | 1328 | if ($cat_display == 'select' || $cat_display == 'multiselect') { |
@@ -1332,11 +1332,11 @@ discard block |
||
| 1332 | 1332 | if ($cat_display == 'multiselect') |
| 1333 | 1333 | $multiple = 'multiple="multiple"'; |
| 1334 | 1334 | |
| 1335 | - echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">'; |
|
| 1335 | + echo '<select id="'.$name.'" '.$multiple.' type="'.$name.'" name="post_category['.$name.'][]" alt="'.$name.'" field_type="'.$cat_display.'" class="geodir_textfield textfield_x chosen_select" data-placeholder="'.__('Select Category', 'geodirectory').'">'; |
|
| 1336 | 1336 | |
| 1337 | 1337 | |
| 1338 | 1338 | if ($cat_display == 'select') |
| 1339 | - echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>'; |
|
| 1339 | + echo '<option value="">'.__('Select Category', 'geodirectory').'</option>'; |
|
| 1340 | 1340 | |
| 1341 | 1341 | } |
| 1342 | 1342 | |
@@ -1354,7 +1354,7 @@ discard block |
||
| 1354 | 1354 | ?> |
| 1355 | 1355 | </div> |
| 1356 | 1356 | |
| 1357 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span> |
|
| 1357 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span> |
|
| 1358 | 1358 | <?php if ($is_required) { ?> |
| 1359 | 1359 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
| 1360 | 1360 | <?php } ?> |
@@ -1366,7 +1366,7 @@ discard block |
||
| 1366 | 1366 | |
| 1367 | 1367 | return $html; |
| 1368 | 1368 | } |
| 1369 | -add_filter('geodir_custom_field_input_taxonomy','geodir_cfi_taxonomy',10,2); |
|
| 1369 | +add_filter('geodir_custom_field_input_taxonomy', 'geodir_cfi_taxonomy', 10, 2); |
|
| 1370 | 1370 | |
| 1371 | 1371 | |
| 1372 | 1372 | /** |
@@ -1378,12 +1378,12 @@ discard block |
||
| 1378 | 1378 | * |
| 1379 | 1379 | * @return string The html to output for the custom field. |
| 1380 | 1380 | */ |
| 1381 | -function geodir_cfi_file($html,$cf){ |
|
| 1381 | +function geodir_cfi_file($html, $cf) { |
|
| 1382 | 1382 | |
| 1383 | 1383 | $html_var = $cf['htmlvar_name']; |
| 1384 | 1384 | |
| 1385 | 1385 | // Check if there is a custom field specific filter. |
| 1386 | - if(has_filter("geodir_custom_field_input_file_{$html_var}")){ |
|
| 1386 | + if (has_filter("geodir_custom_field_input_file_{$html_var}")) { |
|
| 1387 | 1387 | /** |
| 1388 | 1388 | * Filter the file html by individual custom field. |
| 1389 | 1389 | * |
@@ -1391,11 +1391,11 @@ discard block |
||
| 1391 | 1391 | * @param array $cf The custom field array. |
| 1392 | 1392 | * @since 1.6.6 |
| 1393 | 1393 | */ |
| 1394 | - $html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf); |
|
| 1394 | + $html = apply_filters("geodir_custom_field_input_file_{$html_var}", $html, $cf); |
|
| 1395 | 1395 | } |
| 1396 | 1396 | |
| 1397 | 1397 | // If no html then we run the standard output. |
| 1398 | - if(empty($html)) { |
|
| 1398 | + if (empty($html)) { |
|
| 1399 | 1399 | |
| 1400 | 1400 | ob_start(); // Start buffering; |
| 1401 | 1401 | $value = geodir_get_cf_value($cf); |
@@ -1438,8 +1438,8 @@ discard block |
||
| 1438 | 1438 | $file_totImg = count($curImages); |
| 1439 | 1439 | } |
| 1440 | 1440 | |
| 1441 | - $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : ''; |
|
| 1442 | - $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : ''; |
|
| 1441 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? implode(",", $extra_fields['gd_file_types']) : ''; |
|
| 1442 | + $display_file_types = $allowed_file_types != '' ? '.'.implode(", .", $extra_fields['gd_file_types']) : ''; |
|
| 1443 | 1443 | |
| 1444 | 1444 | ?> |
| 1445 | 1445 | <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?> |
@@ -1449,13 +1449,13 @@ discard block |
||
| 1449 | 1449 | </h5> <?php */ |
| 1450 | 1450 | ?> |
| 1451 | 1451 | |
| 1452 | - <div id="<?php echo $name;?>_row" |
|
| 1453 | - class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 1452 | + <div id="<?php echo $name; ?>_row" |
|
| 1453 | + class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details"> |
|
| 1454 | 1454 | |
| 1455 | 1455 | <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;"> |
| 1456 | 1456 | <label |
| 1457 | 1457 | style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory'); |
| 1458 | - echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label> |
|
| 1458 | + echo $site_title; ?><?php if ($is_required) echo '<span>*</span>'; ?></label> |
|
| 1459 | 1459 | <input class="geodir-custom-file-upload" field_type="file" type="hidden" |
| 1460 | 1460 | name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>" |
| 1461 | 1461 | value="<?php echo esc_attr($file_value); ?>"/> |
@@ -1463,7 +1463,7 @@ discard block |
||
| 1463 | 1463 | id="<?php echo $file_id; ?>image_limit" value="<?php echo $file_image_limit; ?>"/> |
| 1464 | 1464 | <?php if ($allowed_file_types != '') { ?> |
| 1465 | 1465 | <input type="hidden" name="<?php echo $file_id; ?>_allowed_types" |
| 1466 | - id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types);?>"/> |
|
| 1466 | + id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types); ?>"/> |
|
| 1467 | 1467 | <?php } ?> |
| 1468 | 1468 | <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg" |
| 1469 | 1469 | value="<?php if (isset($file_totImg)) { |
@@ -1479,10 +1479,10 @@ discard block |
||
| 1479 | 1479 | <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */ |
| 1480 | 1480 | ?> |
| 1481 | 1481 | <input id="<?php echo $file_id; ?>plupload-browse-button" type="button" |
| 1482 | - value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>" |
|
| 1482 | + value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory')); ?>" |
|
| 1483 | 1483 | class="geodir_button" style="margin-top:10px;"/> |
| 1484 | 1484 | <span class="ajaxnonceplu" |
| 1485 | - id="ajaxnonceplu<?php echo wp_create_nonce($file_id . 'pluploadan'); ?>"></span> |
|
| 1485 | + id="ajaxnonceplu<?php echo wp_create_nonce($file_id.'pluploadan'); ?>"></span> |
|
| 1486 | 1486 | <?php if ($file_width && $file_height): ?> |
| 1487 | 1487 | <span class="plupload-resize"></span> |
| 1488 | 1488 | <span class="plupload-width" id="plupload-width<?php echo $file_width; ?>"></span> |
@@ -1502,7 +1502,7 @@ discard block |
||
| 1502 | 1502 | |
| 1503 | 1503 | </div> |
| 1504 | 1504 | </div> |
| 1505 | - <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?> <?php echo ( $display_file_types != '' ? __('Allowed file types:', 'geodirectory') . ' ' . $display_file_types : '' );?></span> |
|
| 1505 | + <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> <?php echo ($display_file_types != '' ? __('Allowed file types:', 'geodirectory').' '.$display_file_types : ''); ?></span> |
|
| 1506 | 1506 | <?php if ($is_required) { ?> |
| 1507 | 1507 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
| 1508 | 1508 | <?php } ?> |
@@ -1515,4 +1515,4 @@ discard block |
||
| 1515 | 1515 | |
| 1516 | 1516 | return $html; |
| 1517 | 1517 | } |
| 1518 | -add_filter('geodir_custom_field_input_file','geodir_cfi_file',10,2); |
|
| 1519 | 1518 | \ No newline at end of file |
| 1519 | +add_filter('geodir_custom_field_input_file', 'geodir_cfi_file', 10, 2); |
|
| 1520 | 1520 | \ No newline at end of file |
@@ -14,13 +14,13 @@ discard block |
||
| 14 | 14 | * @return int|null Return the page ID if present or null if not. |
| 15 | 15 | */ |
| 16 | 16 | function geodir_add_listing_page_id(){ |
| 17 | - $gd_page_id = get_option('geodir_add_listing_page'); |
|
| 17 | + $gd_page_id = get_option('geodir_add_listing_page'); |
|
| 18 | 18 | |
| 19 | - if (function_exists('icl_object_id')) { |
|
| 20 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 21 | - } |
|
| 19 | + if (function_exists('icl_object_id')) { |
|
| 20 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - return $gd_page_id; |
|
| 23 | + return $gd_page_id; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -31,13 +31,13 @@ discard block |
||
| 31 | 31 | * @return int|null Return the page ID if present or null if not. |
| 32 | 32 | */ |
| 33 | 33 | function geodir_preview_page_id(){ |
| 34 | - $gd_page_id = get_option('geodir_preview_page'); |
|
| 34 | + $gd_page_id = get_option('geodir_preview_page'); |
|
| 35 | 35 | |
| 36 | - if (function_exists('icl_object_id')) { |
|
| 37 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 38 | - } |
|
| 36 | + if (function_exists('icl_object_id')) { |
|
| 37 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - return $gd_page_id; |
|
| 40 | + return $gd_page_id; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -48,13 +48,13 @@ discard block |
||
| 48 | 48 | * @return int|null Return the page ID if present or null if not. |
| 49 | 49 | */ |
| 50 | 50 | function geodir_success_page_id(){ |
| 51 | - $gd_page_id = get_option('geodir_success_page'); |
|
| 51 | + $gd_page_id = get_option('geodir_success_page'); |
|
| 52 | 52 | |
| 53 | - if (function_exists('icl_object_id')) { |
|
| 54 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 55 | - } |
|
| 53 | + if (function_exists('icl_object_id')) { |
|
| 54 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - return $gd_page_id; |
|
| 57 | + return $gd_page_id; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -65,13 +65,13 @@ discard block |
||
| 65 | 65 | * @return int|null Return the page ID if present or null if not. |
| 66 | 66 | */ |
| 67 | 67 | function geodir_location_page_id(){ |
| 68 | - $gd_page_id = get_option('geodir_location_page'); |
|
| 68 | + $gd_page_id = get_option('geodir_location_page'); |
|
| 69 | 69 | |
| 70 | - if (function_exists('icl_object_id')) { |
|
| 71 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 72 | - } |
|
| 70 | + if (function_exists('icl_object_id')) { |
|
| 71 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - return $gd_page_id; |
|
| 74 | + return $gd_page_id; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -82,13 +82,13 @@ discard block |
||
| 82 | 82 | * @return int|null Return the page ID if present or null if not. |
| 83 | 83 | */ |
| 84 | 84 | function geodir_home_page_id(){ |
| 85 | - $gd_page_id = get_option('geodir_home_page'); |
|
| 85 | + $gd_page_id = get_option('geodir_home_page'); |
|
| 86 | 86 | |
| 87 | - if (function_exists('icl_object_id')) { |
|
| 88 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 89 | - } |
|
| 87 | + if (function_exists('icl_object_id')) { |
|
| 88 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - return $gd_page_id; |
|
| 91 | + return $gd_page_id; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -99,13 +99,13 @@ discard block |
||
| 99 | 99 | * @return int|null Return the page ID if present or null if not. |
| 100 | 100 | */ |
| 101 | 101 | function geodir_info_page_id(){ |
| 102 | - $gd_page_id = get_option('geodir_info_page'); |
|
| 102 | + $gd_page_id = get_option('geodir_info_page'); |
|
| 103 | 103 | |
| 104 | - if (function_exists('icl_object_id')) { |
|
| 105 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 106 | - } |
|
| 104 | + if (function_exists('icl_object_id')) { |
|
| 105 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - return $gd_page_id; |
|
| 108 | + return $gd_page_id; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
@@ -116,13 +116,13 @@ discard block |
||
| 116 | 116 | * @return int|null Return the page ID if present or null if not. |
| 117 | 117 | */ |
| 118 | 118 | function geodir_login_page_id(){ |
| 119 | - $gd_page_id = get_option('geodir_login_page'); |
|
| 119 | + $gd_page_id = get_option('geodir_login_page'); |
|
| 120 | 120 | |
| 121 | - if (function_exists('icl_object_id')) { |
|
| 122 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 123 | - } |
|
| 121 | + if (function_exists('icl_object_id')) { |
|
| 122 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - return $gd_page_id; |
|
| 125 | + return $gd_page_id; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
@@ -134,51 +134,51 @@ discard block |
||
| 134 | 134 | * @return int|null Return the page ID if present or null if not. |
| 135 | 135 | */ |
| 136 | 136 | function geodir_login_url($args=array()){ |
| 137 | - $gd_page_id = get_option('geodir_login_page'); |
|
| 138 | - |
|
| 139 | - if (function_exists('icl_object_id')) { |
|
| 140 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - if (function_exists('geodir_location_geo_home_link')) { |
|
| 144 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - if (geodir_is_wpml()){ |
|
| 148 | - $home_url = icl_get_home_url(); |
|
| 149 | - }else{ |
|
| 150 | - $home_url = home_url(); |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - if (function_exists('geodir_location_geo_home_link')) { |
|
| 154 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - if($gd_page_id){ |
|
| 158 | - $post = get_post($gd_page_id); |
|
| 159 | - $slug = $post->post_name; |
|
| 160 | - //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
| 161 | - $login_url = trailingslashit($home_url)."$slug/"; |
|
| 162 | - }else{ |
|
| 163 | - $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - if($args){ |
|
| 167 | - $login_url = add_query_arg($args,$login_url ); |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * Filter the GeoDirectory login page url. |
|
| 172 | - * |
|
| 173 | - * This filter can be used to change the GeoDirectory page url. |
|
| 174 | - * |
|
| 175 | - * @since 1.5.3 |
|
| 176 | - * @package GeoDirectory |
|
| 177 | - * @param string $login_url The url of the login page. |
|
| 178 | - * @param array $args The array of query args used. |
|
| 179 | - * @param int $gd_page_id The page id of the GD login page. |
|
| 180 | - */ |
|
| 181 | - return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id); |
|
| 137 | + $gd_page_id = get_option('geodir_login_page'); |
|
| 138 | + |
|
| 139 | + if (function_exists('icl_object_id')) { |
|
| 140 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + if (function_exists('geodir_location_geo_home_link')) { |
|
| 144 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + if (geodir_is_wpml()){ |
|
| 148 | + $home_url = icl_get_home_url(); |
|
| 149 | + }else{ |
|
| 150 | + $home_url = home_url(); |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + if (function_exists('geodir_location_geo_home_link')) { |
|
| 154 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + if($gd_page_id){ |
|
| 158 | + $post = get_post($gd_page_id); |
|
| 159 | + $slug = $post->post_name; |
|
| 160 | + //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
| 161 | + $login_url = trailingslashit($home_url)."$slug/"; |
|
| 162 | + }else{ |
|
| 163 | + $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + if($args){ |
|
| 167 | + $login_url = add_query_arg($args,$login_url ); |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * Filter the GeoDirectory login page url. |
|
| 172 | + * |
|
| 173 | + * This filter can be used to change the GeoDirectory page url. |
|
| 174 | + * |
|
| 175 | + * @since 1.5.3 |
|
| 176 | + * @package GeoDirectory |
|
| 177 | + * @param string $login_url The url of the login page. |
|
| 178 | + * @param array $args The array of query args used. |
|
| 179 | + * @param int $gd_page_id The page id of the GD login page. |
|
| 180 | + */ |
|
| 181 | + return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | /** |
@@ -190,40 +190,40 @@ discard block |
||
| 190 | 190 | * @return string Info page url. |
| 191 | 191 | */ |
| 192 | 192 | function geodir_info_url($args=array()){ |
| 193 | - $gd_page_id = get_option('geodir_info_page'); |
|
| 194 | - |
|
| 195 | - if (function_exists('icl_object_id')) { |
|
| 196 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 197 | - } |
|
| 198 | - |
|
| 199 | - if (function_exists('geodir_location_geo_home_link')) { |
|
| 200 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - if (geodir_is_wpml()){ |
|
| 204 | - $home_url = icl_get_home_url(); |
|
| 205 | - }else{ |
|
| 206 | - $home_url = home_url(); |
|
| 207 | - } |
|
| 208 | - |
|
| 209 | - if (function_exists('geodir_location_geo_home_link')) { |
|
| 210 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
| 211 | - } |
|
| 212 | - |
|
| 213 | - if($gd_page_id){ |
|
| 214 | - $post = get_post($gd_page_id); |
|
| 215 | - $slug = $post->post_name; |
|
| 216 | - //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
| 217 | - $info_url = trailingslashit($home_url)."$slug/"; |
|
| 218 | - }else{ |
|
| 219 | - $info_url = trailingslashit($home_url); |
|
| 220 | - } |
|
| 221 | - |
|
| 222 | - if($args){ |
|
| 223 | - $info_url = add_query_arg($args,$info_url ); |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - return $info_url; |
|
| 193 | + $gd_page_id = get_option('geodir_info_page'); |
|
| 194 | + |
|
| 195 | + if (function_exists('icl_object_id')) { |
|
| 196 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 197 | + } |
|
| 198 | + |
|
| 199 | + if (function_exists('geodir_location_geo_home_link')) { |
|
| 200 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + if (geodir_is_wpml()){ |
|
| 204 | + $home_url = icl_get_home_url(); |
|
| 205 | + }else{ |
|
| 206 | + $home_url = home_url(); |
|
| 207 | + } |
|
| 208 | + |
|
| 209 | + if (function_exists('geodir_location_geo_home_link')) { |
|
| 210 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + if($gd_page_id){ |
|
| 214 | + $post = get_post($gd_page_id); |
|
| 215 | + $slug = $post->post_name; |
|
| 216 | + //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
|
| 217 | + $info_url = trailingslashit($home_url)."$slug/"; |
|
| 218 | + }else{ |
|
| 219 | + $info_url = trailingslashit($home_url); |
|
| 220 | + } |
|
| 221 | + |
|
| 222 | + if($args){ |
|
| 223 | + $info_url = add_query_arg($args,$info_url ); |
|
| 224 | + } |
|
| 225 | + |
|
| 226 | + return $info_url; |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | /** |
@@ -239,11 +239,11 @@ discard block |
||
| 239 | 239 | * @return string Returns converted string. |
| 240 | 240 | */ |
| 241 | 241 | function geodir_ucwords($string, $charset='UTF-8') { |
| 242 | - if (function_exists('mb_convert_case')) { |
|
| 243 | - return mb_convert_case($string, MB_CASE_TITLE, $charset); |
|
| 244 | - } else { |
|
| 245 | - return ucwords($string); |
|
| 246 | - } |
|
| 242 | + if (function_exists('mb_convert_case')) { |
|
| 243 | + return mb_convert_case($string, MB_CASE_TITLE, $charset); |
|
| 244 | + } else { |
|
| 245 | + return ucwords($string); |
|
| 246 | + } |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /** |
@@ -259,11 +259,11 @@ discard block |
||
| 259 | 259 | * @return string Returns converted string. |
| 260 | 260 | */ |
| 261 | 261 | function geodir_strtolower($string, $charset='UTF-8') { |
| 262 | - if (function_exists('mb_convert_case')) { |
|
| 263 | - return mb_convert_case($string, MB_CASE_LOWER, $charset); |
|
| 264 | - } else { |
|
| 265 | - return strtolower($string); |
|
| 266 | - } |
|
| 262 | + if (function_exists('mb_convert_case')) { |
|
| 263 | + return mb_convert_case($string, MB_CASE_LOWER, $charset); |
|
| 264 | + } else { |
|
| 265 | + return strtolower($string); |
|
| 266 | + } |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /** |
@@ -279,11 +279,11 @@ discard block |
||
| 279 | 279 | * @return string Returns converted string. |
| 280 | 280 | */ |
| 281 | 281 | function geodir_strtoupper($string, $charset='UTF-8') { |
| 282 | - if (function_exists('mb_convert_case')) { |
|
| 283 | - return mb_convert_case($string, MB_CASE_UPPER, $charset); |
|
| 284 | - } else { |
|
| 285 | - return strtoupper($string); |
|
| 286 | - } |
|
| 282 | + if (function_exists('mb_convert_case')) { |
|
| 283 | + return mb_convert_case($string, MB_CASE_UPPER, $charset); |
|
| 284 | + } else { |
|
| 285 | + return strtoupper($string); |
|
| 286 | + } |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /** |
@@ -462,11 +462,11 @@ discard block |
||
| 462 | 462 | * @package GeoDirectory |
| 463 | 463 | */ |
| 464 | 464 | function _gd_die_handler() { |
| 465 | - if ( defined( 'GD_TESTING_MODE' ) ) { |
|
| 466 | - return '_gd_die_handler'; |
|
| 467 | - } else { |
|
| 468 | - die(); |
|
| 469 | - } |
|
| 465 | + if ( defined( 'GD_TESTING_MODE' ) ) { |
|
| 466 | + return '_gd_die_handler'; |
|
| 467 | + } else { |
|
| 468 | + die(); |
|
| 469 | + } |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | /** |
@@ -481,9 +481,9 @@ discard block |
||
| 481 | 481 | * @param int $status Optional. Status code. |
| 482 | 482 | */ |
| 483 | 483 | function gd_die( $message = '', $title = '', $status = 400 ) { |
| 484 | - add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 ); |
|
| 485 | - add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 ); |
|
| 486 | - wp_die( $message, $title, array( 'response' => $status )); |
|
| 484 | + add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 ); |
|
| 485 | + add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 ); |
|
| 486 | + wp_die( $message, $title, array( 'response' => $status )); |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | /* |
@@ -652,37 +652,37 @@ discard block |
||
| 652 | 652 | * @return string The formatted date. |
| 653 | 653 | */ |
| 654 | 654 | function geodir_date($date_input, $date_to, $date_from = '') { |
| 655 | - if (empty($date_input) || empty($date_to)) { |
|
| 656 | - return NULL; |
|
| 657 | - } |
|
| 655 | + if (empty($date_input) || empty($date_to)) { |
|
| 656 | + return NULL; |
|
| 657 | + } |
|
| 658 | 658 | |
| 659 | - $date = ''; |
|
| 660 | - if (!empty($date_from)) { |
|
| 661 | - $datetime = date_create_from_format($date_from, $date_input); |
|
| 659 | + $date = ''; |
|
| 660 | + if (!empty($date_from)) { |
|
| 661 | + $datetime = date_create_from_format($date_from, $date_input); |
|
| 662 | 662 | |
| 663 | - if (!empty($datetime)) { |
|
| 664 | - $date = $datetime->format($date_to); |
|
| 665 | - } |
|
| 666 | - } |
|
| 663 | + if (!empty($datetime)) { |
|
| 664 | + $date = $datetime->format($date_to); |
|
| 665 | + } |
|
| 666 | + } |
|
| 667 | 667 | |
| 668 | - if (empty($date)) { |
|
| 669 | - $date = strpos($date_input, '/') !== false ? str_replace('/', '-', $date_input) : $date_input; |
|
| 670 | - $date = date_i18n($date_to, strtotime($date)); |
|
| 671 | - } |
|
| 668 | + if (empty($date)) { |
|
| 669 | + $date = strpos($date_input, '/') !== false ? str_replace('/', '-', $date_input) : $date_input; |
|
| 670 | + $date = date_i18n($date_to, strtotime($date)); |
|
| 671 | + } |
|
| 672 | 672 | |
| 673 | - $date = geodir_maybe_untranslate_date($date); |
|
| 674 | - /** |
|
| 675 | - * Filter the the date format conversion. |
|
| 676 | - * |
|
| 677 | - * @since 1.6.7 |
|
| 678 | - * @package GeoDirectory |
|
| 679 | - * |
|
| 680 | - * @param string $date The date string. |
|
| 681 | - * @param string $date_input The date input. |
|
| 682 | - * @param string $date_to The destination date format. |
|
| 683 | - * @param string $date_from The source date format. |
|
| 684 | - */ |
|
| 685 | - return apply_filters('geodir_date', $date, $date_input, $date_to, $date_from); |
|
| 673 | + $date = geodir_maybe_untranslate_date($date); |
|
| 674 | + /** |
|
| 675 | + * Filter the the date format conversion. |
|
| 676 | + * |
|
| 677 | + * @since 1.6.7 |
|
| 678 | + * @package GeoDirectory |
|
| 679 | + * |
|
| 680 | + * @param string $date The date string. |
|
| 681 | + * @param string $date_input The date input. |
|
| 682 | + * @param string $date_to The destination date format. |
|
| 683 | + * @param string $date_from The source date format. |
|
| 684 | + */ |
|
| 685 | + return apply_filters('geodir_date', $date, $date_input, $date_to, $date_from); |
|
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | /** |
@@ -707,91 +707,91 @@ discard block |
||
| 707 | 707 | * @return string Trimmed string. |
| 708 | 708 | */ |
| 709 | 709 | function geodir_excerpt($text, $length = 100, $options = array()) { |
| 710 | - if (!(int)$length > 0) { |
|
| 711 | - return $text; |
|
| 712 | - } |
|
| 713 | - $default = array( |
|
| 714 | - 'ellipsis' => '', 'exact' => true, 'html' => true, 'trimWidth' => false, |
|
| 710 | + if (!(int)$length > 0) { |
|
| 711 | + return $text; |
|
| 712 | + } |
|
| 713 | + $default = array( |
|
| 714 | + 'ellipsis' => '', 'exact' => true, 'html' => true, 'trimWidth' => false, |
|
| 715 | 715 | ); |
| 716 | - if (!empty($options['html']) && strtolower(mb_internal_encoding()) === 'utf-8') { |
|
| 717 | - $default['ellipsis'] = ""; |
|
| 718 | - } |
|
| 719 | - $options += $default; |
|
| 720 | - |
|
| 721 | - $prefix = ''; |
|
| 722 | - $suffix = $options['ellipsis']; |
|
| 723 | - |
|
| 724 | - if ($options['html']) { |
|
| 725 | - $ellipsisLength = geodir_strlen(strip_tags($options['ellipsis']), $options); |
|
| 726 | - |
|
| 727 | - $truncateLength = 0; |
|
| 728 | - $totalLength = 0; |
|
| 729 | - $openTags = array(); |
|
| 730 | - $truncate = ''; |
|
| 731 | - |
|
| 732 | - preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER); |
|
| 733 | - foreach ($tags as $tag) { |
|
| 734 | - $contentLength = geodir_strlen($tag[3], $options); |
|
| 735 | - |
|
| 736 | - if ($truncate === '') { |
|
| 737 | - if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/i', $tag[2])) { |
|
| 738 | - if (preg_match('/<[\w]+[^>]*>/', $tag[0])) { |
|
| 739 | - array_unshift($openTags, $tag[2]); |
|
| 740 | - } elseif (preg_match('/<\/([\w]+)[^>]*>/', $tag[0], $closeTag)) { |
|
| 741 | - $pos = array_search($closeTag[1], $openTags); |
|
| 742 | - if ($pos !== false) { |
|
| 743 | - array_splice($openTags, $pos, 1); |
|
| 744 | - } |
|
| 745 | - } |
|
| 746 | - } |
|
| 747 | - |
|
| 748 | - $prefix .= $tag[1]; |
|
| 749 | - |
|
| 750 | - if ($totalLength + $contentLength + $ellipsisLength > $length) { |
|
| 751 | - $truncate = $tag[3]; |
|
| 752 | - $truncateLength = $length - $totalLength; |
|
| 753 | - } else { |
|
| 754 | - $prefix .= $tag[3]; |
|
| 755 | - } |
|
| 756 | - } |
|
| 757 | - |
|
| 758 | - $totalLength += $contentLength; |
|
| 759 | - if ($totalLength > $length) { |
|
| 760 | - break; |
|
| 761 | - } |
|
| 762 | - } |
|
| 763 | - |
|
| 764 | - if ($totalLength <= $length) { |
|
| 765 | - return $text; |
|
| 766 | - } |
|
| 767 | - |
|
| 768 | - $text = $truncate; |
|
| 769 | - $length = $truncateLength; |
|
| 770 | - |
|
| 771 | - foreach ($openTags as $tag) { |
|
| 772 | - $suffix .= '</' . $tag . '>'; |
|
| 773 | - } |
|
| 774 | - } else { |
|
| 775 | - if (geodir_strlen($text, $options) <= $length) { |
|
| 776 | - return $text; |
|
| 777 | - } |
|
| 778 | - $ellipsisLength = geodir_strlen($options['ellipsis'], $options); |
|
| 779 | - } |
|
| 780 | - |
|
| 781 | - $result = geodir_substr($text, 0, $length - $ellipsisLength, $options); |
|
| 782 | - |
|
| 783 | - if (!$options['exact']) { |
|
| 784 | - if (geodir_substr($text, $length - $ellipsisLength, 1, $options) !== ' ') { |
|
| 785 | - $result = geodir_remove_last_word($result); |
|
| 786 | - } |
|
| 787 | - |
|
| 788 | - // Do not need to count ellipsis in the cut, if result is empty. |
|
| 789 | - if (!strlen($result)) { |
|
| 790 | - $result = geodir_substr($text, 0, $length, $options); |
|
| 791 | - } |
|
| 792 | - } |
|
| 793 | - |
|
| 794 | - return $prefix . $result . $suffix; |
|
| 716 | + if (!empty($options['html']) && strtolower(mb_internal_encoding()) === 'utf-8') { |
|
| 717 | + $default['ellipsis'] = ""; |
|
| 718 | + } |
|
| 719 | + $options += $default; |
|
| 720 | + |
|
| 721 | + $prefix = ''; |
|
| 722 | + $suffix = $options['ellipsis']; |
|
| 723 | + |
|
| 724 | + if ($options['html']) { |
|
| 725 | + $ellipsisLength = geodir_strlen(strip_tags($options['ellipsis']), $options); |
|
| 726 | + |
|
| 727 | + $truncateLength = 0; |
|
| 728 | + $totalLength = 0; |
|
| 729 | + $openTags = array(); |
|
| 730 | + $truncate = ''; |
|
| 731 | + |
|
| 732 | + preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER); |
|
| 733 | + foreach ($tags as $tag) { |
|
| 734 | + $contentLength = geodir_strlen($tag[3], $options); |
|
| 735 | + |
|
| 736 | + if ($truncate === '') { |
|
| 737 | + if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/i', $tag[2])) { |
|
| 738 | + if (preg_match('/<[\w]+[^>]*>/', $tag[0])) { |
|
| 739 | + array_unshift($openTags, $tag[2]); |
|
| 740 | + } elseif (preg_match('/<\/([\w]+)[^>]*>/', $tag[0], $closeTag)) { |
|
| 741 | + $pos = array_search($closeTag[1], $openTags); |
|
| 742 | + if ($pos !== false) { |
|
| 743 | + array_splice($openTags, $pos, 1); |
|
| 744 | + } |
|
| 745 | + } |
|
| 746 | + } |
|
| 747 | + |
|
| 748 | + $prefix .= $tag[1]; |
|
| 749 | + |
|
| 750 | + if ($totalLength + $contentLength + $ellipsisLength > $length) { |
|
| 751 | + $truncate = $tag[3]; |
|
| 752 | + $truncateLength = $length - $totalLength; |
|
| 753 | + } else { |
|
| 754 | + $prefix .= $tag[3]; |
|
| 755 | + } |
|
| 756 | + } |
|
| 757 | + |
|
| 758 | + $totalLength += $contentLength; |
|
| 759 | + if ($totalLength > $length) { |
|
| 760 | + break; |
|
| 761 | + } |
|
| 762 | + } |
|
| 763 | + |
|
| 764 | + if ($totalLength <= $length) { |
|
| 765 | + return $text; |
|
| 766 | + } |
|
| 767 | + |
|
| 768 | + $text = $truncate; |
|
| 769 | + $length = $truncateLength; |
|
| 770 | + |
|
| 771 | + foreach ($openTags as $tag) { |
|
| 772 | + $suffix .= '</' . $tag . '>'; |
|
| 773 | + } |
|
| 774 | + } else { |
|
| 775 | + if (geodir_strlen($text, $options) <= $length) { |
|
| 776 | + return $text; |
|
| 777 | + } |
|
| 778 | + $ellipsisLength = geodir_strlen($options['ellipsis'], $options); |
|
| 779 | + } |
|
| 780 | + |
|
| 781 | + $result = geodir_substr($text, 0, $length - $ellipsisLength, $options); |
|
| 782 | + |
|
| 783 | + if (!$options['exact']) { |
|
| 784 | + if (geodir_substr($text, $length - $ellipsisLength, 1, $options) !== ' ') { |
|
| 785 | + $result = geodir_remove_last_word($result); |
|
| 786 | + } |
|
| 787 | + |
|
| 788 | + // Do not need to count ellipsis in the cut, if result is empty. |
|
| 789 | + if (!strlen($result)) { |
|
| 790 | + $result = geodir_substr($text, 0, $length, $options); |
|
| 791 | + } |
|
| 792 | + } |
|
| 793 | + |
|
| 794 | + return $prefix . $result . $suffix; |
|
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | /** |
@@ -815,28 +815,28 @@ discard block |
||
| 815 | 815 | * @return int |
| 816 | 816 | */ |
| 817 | 817 | function geodir_strlen($text, array $options) { |
| 818 | - if (empty($options['trimWidth'])) { |
|
| 819 | - $strlen = 'mb_strlen'; |
|
| 820 | - } else { |
|
| 821 | - $strlen = 'mb_strwidth'; |
|
| 822 | - } |
|
| 823 | - |
|
| 824 | - if (empty($options['html'])) { |
|
| 825 | - return $strlen($text); |
|
| 826 | - } |
|
| 827 | - |
|
| 828 | - $pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i'; |
|
| 829 | - $replace = preg_replace_callback( |
|
| 830 | - $pattern, |
|
| 831 | - function ($match) use ($strlen) { |
|
| 832 | - $utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8'); |
|
| 833 | - |
|
| 834 | - return str_repeat(' ', $strlen($utf8, 'UTF-8')); |
|
| 835 | - }, |
|
| 836 | - $text |
|
| 837 | - ); |
|
| 838 | - |
|
| 839 | - return $strlen($replace); |
|
| 818 | + if (empty($options['trimWidth'])) { |
|
| 819 | + $strlen = 'mb_strlen'; |
|
| 820 | + } else { |
|
| 821 | + $strlen = 'mb_strwidth'; |
|
| 822 | + } |
|
| 823 | + |
|
| 824 | + if (empty($options['html'])) { |
|
| 825 | + return $strlen($text); |
|
| 826 | + } |
|
| 827 | + |
|
| 828 | + $pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i'; |
|
| 829 | + $replace = preg_replace_callback( |
|
| 830 | + $pattern, |
|
| 831 | + function ($match) use ($strlen) { |
|
| 832 | + $utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8'); |
|
| 833 | + |
|
| 834 | + return str_repeat(' ', $strlen($utf8, 'UTF-8')); |
|
| 835 | + }, |
|
| 836 | + $text |
|
| 837 | + ); |
|
| 838 | + |
|
| 839 | + return $strlen($replace); |
|
| 840 | 840 | } |
| 841 | 841 | |
| 842 | 842 | /** |
@@ -857,80 +857,80 @@ discard block |
||
| 857 | 857 | * @return string |
| 858 | 858 | */ |
| 859 | 859 | function geodir_substr($text, $start, $length, array $options) { |
| 860 | - if (empty($options['trimWidth'])) { |
|
| 861 | - $substr = 'mb_substr'; |
|
| 862 | - } else { |
|
| 863 | - $substr = 'mb_strimwidth'; |
|
| 864 | - } |
|
| 865 | - |
|
| 866 | - $maxPosition = geodir_strlen($text, array('trimWidth' => false) + $options); |
|
| 867 | - if ($start < 0) { |
|
| 868 | - $start += $maxPosition; |
|
| 869 | - if ($start < 0) { |
|
| 870 | - $start = 0; |
|
| 871 | - } |
|
| 872 | - } |
|
| 873 | - if ($start >= $maxPosition) { |
|
| 874 | - return ''; |
|
| 875 | - } |
|
| 876 | - |
|
| 877 | - if ($length === null) { |
|
| 878 | - $length = geodir_strlen($text, $options); |
|
| 879 | - } |
|
| 880 | - |
|
| 881 | - if ($length < 0) { |
|
| 882 | - $text = geodir_substr($text, $start, null, $options); |
|
| 883 | - $start = 0; |
|
| 884 | - $length += geodir_strlen($text, $options); |
|
| 885 | - } |
|
| 886 | - |
|
| 887 | - if ($length <= 0) { |
|
| 888 | - return ''; |
|
| 889 | - } |
|
| 890 | - |
|
| 891 | - if (empty($options['html'])) { |
|
| 892 | - return (string)$substr($text, $start, $length); |
|
| 893 | - } |
|
| 894 | - |
|
| 895 | - $totalOffset = 0; |
|
| 896 | - $totalLength = 0; |
|
| 897 | - $result = ''; |
|
| 898 | - |
|
| 899 | - $pattern = '/(&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};)/i'; |
|
| 900 | - $parts = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
| 901 | - foreach ($parts as $part) { |
|
| 902 | - $offset = 0; |
|
| 903 | - |
|
| 904 | - if ($totalOffset < $start) { |
|
| 905 | - $len = geodir_strlen($part, array('trimWidth' => false) + $options); |
|
| 906 | - if ($totalOffset + $len <= $start) { |
|
| 907 | - $totalOffset += $len; |
|
| 908 | - continue; |
|
| 909 | - } |
|
| 910 | - |
|
| 911 | - $offset = $start - $totalOffset; |
|
| 912 | - $totalOffset = $start; |
|
| 913 | - } |
|
| 914 | - |
|
| 915 | - $len = geodir_strlen($part, $options); |
|
| 916 | - if ($offset !== 0 || $totalLength + $len > $length) { |
|
| 917 | - if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) { |
|
| 918 | - // Entities cannot be passed substr. |
|
| 919 | - continue; |
|
| 920 | - } |
|
| 921 | - |
|
| 922 | - $part = $substr($part, $offset, $length - $totalLength); |
|
| 923 | - $len = geodir_strlen($part, $options); |
|
| 924 | - } |
|
| 925 | - |
|
| 926 | - $result .= $part; |
|
| 927 | - $totalLength += $len; |
|
| 928 | - if ($totalLength >= $length) { |
|
| 929 | - break; |
|
| 930 | - } |
|
| 931 | - } |
|
| 932 | - |
|
| 933 | - return $result; |
|
| 860 | + if (empty($options['trimWidth'])) { |
|
| 861 | + $substr = 'mb_substr'; |
|
| 862 | + } else { |
|
| 863 | + $substr = 'mb_strimwidth'; |
|
| 864 | + } |
|
| 865 | + |
|
| 866 | + $maxPosition = geodir_strlen($text, array('trimWidth' => false) + $options); |
|
| 867 | + if ($start < 0) { |
|
| 868 | + $start += $maxPosition; |
|
| 869 | + if ($start < 0) { |
|
| 870 | + $start = 0; |
|
| 871 | + } |
|
| 872 | + } |
|
| 873 | + if ($start >= $maxPosition) { |
|
| 874 | + return ''; |
|
| 875 | + } |
|
| 876 | + |
|
| 877 | + if ($length === null) { |
|
| 878 | + $length = geodir_strlen($text, $options); |
|
| 879 | + } |
|
| 880 | + |
|
| 881 | + if ($length < 0) { |
|
| 882 | + $text = geodir_substr($text, $start, null, $options); |
|
| 883 | + $start = 0; |
|
| 884 | + $length += geodir_strlen($text, $options); |
|
| 885 | + } |
|
| 886 | + |
|
| 887 | + if ($length <= 0) { |
|
| 888 | + return ''; |
|
| 889 | + } |
|
| 890 | + |
|
| 891 | + if (empty($options['html'])) { |
|
| 892 | + return (string)$substr($text, $start, $length); |
|
| 893 | + } |
|
| 894 | + |
|
| 895 | + $totalOffset = 0; |
|
| 896 | + $totalLength = 0; |
|
| 897 | + $result = ''; |
|
| 898 | + |
|
| 899 | + $pattern = '/(&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};)/i'; |
|
| 900 | + $parts = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
| 901 | + foreach ($parts as $part) { |
|
| 902 | + $offset = 0; |
|
| 903 | + |
|
| 904 | + if ($totalOffset < $start) { |
|
| 905 | + $len = geodir_strlen($part, array('trimWidth' => false) + $options); |
|
| 906 | + if ($totalOffset + $len <= $start) { |
|
| 907 | + $totalOffset += $len; |
|
| 908 | + continue; |
|
| 909 | + } |
|
| 910 | + |
|
| 911 | + $offset = $start - $totalOffset; |
|
| 912 | + $totalOffset = $start; |
|
| 913 | + } |
|
| 914 | + |
|
| 915 | + $len = geodir_strlen($part, $options); |
|
| 916 | + if ($offset !== 0 || $totalLength + $len > $length) { |
|
| 917 | + if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) { |
|
| 918 | + // Entities cannot be passed substr. |
|
| 919 | + continue; |
|
| 920 | + } |
|
| 921 | + |
|
| 922 | + $part = $substr($part, $offset, $length - $totalLength); |
|
| 923 | + $len = geodir_strlen($part, $options); |
|
| 924 | + } |
|
| 925 | + |
|
| 926 | + $result .= $part; |
|
| 927 | + $totalLength += $len; |
|
| 928 | + if ($totalLength >= $length) { |
|
| 929 | + break; |
|
| 930 | + } |
|
| 931 | + } |
|
| 932 | + |
|
| 933 | + return $result; |
|
| 934 | 934 | } |
| 935 | 935 | |
| 936 | 936 | /** |
@@ -943,21 +943,21 @@ discard block |
||
| 943 | 943 | * @return string |
| 944 | 944 | */ |
| 945 | 945 | function geodir_remove_last_word($text) { |
| 946 | - $spacepos = mb_strrpos($text, ' '); |
|
| 946 | + $spacepos = mb_strrpos($text, ' '); |
|
| 947 | 947 | |
| 948 | - if ($spacepos !== false) { |
|
| 949 | - $lastWord = mb_strrpos($text, $spacepos); |
|
| 948 | + if ($spacepos !== false) { |
|
| 949 | + $lastWord = mb_strrpos($text, $spacepos); |
|
| 950 | 950 | |
| 951 | - // Some languages are written without word separation. |
|
| 952 | - // We recognize a string as a word if it does not contain any full-width characters. |
|
| 953 | - if (mb_strwidth($lastWord) === mb_strlen($lastWord)) { |
|
| 954 | - $text = mb_substr($text, 0, $spacepos); |
|
| 955 | - } |
|
| 951 | + // Some languages are written without word separation. |
|
| 952 | + // We recognize a string as a word if it does not contain any full-width characters. |
|
| 953 | + if (mb_strwidth($lastWord) === mb_strlen($lastWord)) { |
|
| 954 | + $text = mb_substr($text, 0, $spacepos); |
|
| 955 | + } |
|
| 956 | 956 | |
| 957 | - return $text; |
|
| 958 | - } |
|
| 957 | + return $text; |
|
| 958 | + } |
|
| 959 | 959 | |
| 960 | - return ''; |
|
| 960 | + return ''; |
|
| 961 | 961 | } |
| 962 | 962 | |
| 963 | 963 | function geodir_tool_restore_cpt_from_taxonomies(){ |
@@ -13,11 +13,11 @@ discard block |
||
| 13 | 13 | * @since 1.4.6 |
| 14 | 14 | * @return int|null Return the page ID if present or null if not. |
| 15 | 15 | */ |
| 16 | -function geodir_add_listing_page_id(){ |
|
| 16 | +function geodir_add_listing_page_id() { |
|
| 17 | 17 | $gd_page_id = get_option('geodir_add_listing_page'); |
| 18 | 18 | |
| 19 | 19 | if (function_exists('icl_object_id')) { |
| 20 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 20 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | return $gd_page_id; |
@@ -30,11 +30,11 @@ discard block |
||
| 30 | 30 | * @since 1.4.6 |
| 31 | 31 | * @return int|null Return the page ID if present or null if not. |
| 32 | 32 | */ |
| 33 | -function geodir_preview_page_id(){ |
|
| 33 | +function geodir_preview_page_id() { |
|
| 34 | 34 | $gd_page_id = get_option('geodir_preview_page'); |
| 35 | 35 | |
| 36 | 36 | if (function_exists('icl_object_id')) { |
| 37 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 37 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | return $gd_page_id; |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | * @since 1.4.6 |
| 48 | 48 | * @return int|null Return the page ID if present or null if not. |
| 49 | 49 | */ |
| 50 | -function geodir_success_page_id(){ |
|
| 50 | +function geodir_success_page_id() { |
|
| 51 | 51 | $gd_page_id = get_option('geodir_success_page'); |
| 52 | 52 | |
| 53 | 53 | if (function_exists('icl_object_id')) { |
| 54 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 54 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | return $gd_page_id; |
@@ -64,11 +64,11 @@ discard block |
||
| 64 | 64 | * @since 1.4.6 |
| 65 | 65 | * @return int|null Return the page ID if present or null if not. |
| 66 | 66 | */ |
| 67 | -function geodir_location_page_id(){ |
|
| 67 | +function geodir_location_page_id() { |
|
| 68 | 68 | $gd_page_id = get_option('geodir_location_page'); |
| 69 | 69 | |
| 70 | 70 | if (function_exists('icl_object_id')) { |
| 71 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 71 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | return $gd_page_id; |
@@ -81,11 +81,11 @@ discard block |
||
| 81 | 81 | * @since 1.5.4 |
| 82 | 82 | * @return int|null Return the page ID if present or null if not. |
| 83 | 83 | */ |
| 84 | -function geodir_home_page_id(){ |
|
| 84 | +function geodir_home_page_id() { |
|
| 85 | 85 | $gd_page_id = get_option('geodir_home_page'); |
| 86 | 86 | |
| 87 | 87 | if (function_exists('icl_object_id')) { |
| 88 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 88 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | return $gd_page_id; |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | * @since 1.5.3 |
| 99 | 99 | * @return int|null Return the page ID if present or null if not. |
| 100 | 100 | */ |
| 101 | -function geodir_info_page_id(){ |
|
| 101 | +function geodir_info_page_id() { |
|
| 102 | 102 | $gd_page_id = get_option('geodir_info_page'); |
| 103 | 103 | |
| 104 | 104 | if (function_exists('icl_object_id')) { |
| 105 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 105 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | return $gd_page_id; |
@@ -115,11 +115,11 @@ discard block |
||
| 115 | 115 | * @since 1.5.3 |
| 116 | 116 | * @return int|null Return the page ID if present or null if not. |
| 117 | 117 | */ |
| 118 | -function geodir_login_page_id(){ |
|
| 118 | +function geodir_login_page_id() { |
|
| 119 | 119 | $gd_page_id = get_option('geodir_login_page'); |
| 120 | 120 | |
| 121 | 121 | if (function_exists('icl_object_id')) { |
| 122 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 122 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | return $gd_page_id; |
@@ -133,20 +133,20 @@ discard block |
||
| 133 | 133 | * @since 1.5.3 |
| 134 | 134 | * @return int|null Return the page ID if present or null if not. |
| 135 | 135 | */ |
| 136 | -function geodir_login_url($args=array()){ |
|
| 136 | +function geodir_login_url($args = array()) { |
|
| 137 | 137 | $gd_page_id = get_option('geodir_login_page'); |
| 138 | 138 | |
| 139 | 139 | if (function_exists('icl_object_id')) { |
| 140 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 140 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | if (function_exists('geodir_location_geo_home_link')) { |
| 144 | 144 | remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - if (geodir_is_wpml()){ |
|
| 147 | + if (geodir_is_wpml()) { |
|
| 148 | 148 | $home_url = icl_get_home_url(); |
| 149 | - }else{ |
|
| 149 | + } else { |
|
| 150 | 150 | $home_url = home_url(); |
| 151 | 151 | } |
| 152 | 152 | |
@@ -154,17 +154,17 @@ discard block |
||
| 154 | 154 | add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - if($gd_page_id){ |
|
| 157 | + if ($gd_page_id) { |
|
| 158 | 158 | $post = get_post($gd_page_id); |
| 159 | 159 | $slug = $post->post_name; |
| 160 | 160 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
| 161 | 161 | $login_url = trailingslashit($home_url)."$slug/"; |
| 162 | - }else{ |
|
| 162 | + } else { |
|
| 163 | 163 | $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if($args){ |
|
| 167 | - $login_url = add_query_arg($args,$login_url ); |
|
| 166 | + if ($args) { |
|
| 167 | + $login_url = add_query_arg($args, $login_url); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * @param array $args The array of query args used. |
| 179 | 179 | * @param int $gd_page_id The page id of the GD login page. |
| 180 | 180 | */ |
| 181 | - return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id); |
|
| 181 | + return apply_filters('geodir_login_url', $login_url, $args, $gd_page_id); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | /** |
@@ -189,20 +189,20 @@ discard block |
||
| 189 | 189 | * @since 1.5.16 Added WPML lang code to url. |
| 190 | 190 | * @return string Info page url. |
| 191 | 191 | */ |
| 192 | -function geodir_info_url($args=array()){ |
|
| 192 | +function geodir_info_url($args = array()) { |
|
| 193 | 193 | $gd_page_id = get_option('geodir_info_page'); |
| 194 | 194 | |
| 195 | 195 | if (function_exists('icl_object_id')) { |
| 196 | - $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 196 | + $gd_page_id = icl_object_id($gd_page_id, 'page', true); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | if (function_exists('geodir_location_geo_home_link')) { |
| 200 | 200 | remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - if (geodir_is_wpml()){ |
|
| 203 | + if (geodir_is_wpml()) { |
|
| 204 | 204 | $home_url = icl_get_home_url(); |
| 205 | - }else{ |
|
| 205 | + } else { |
|
| 206 | 206 | $home_url = home_url(); |
| 207 | 207 | } |
| 208 | 208 | |
@@ -210,17 +210,17 @@ discard block |
||
| 210 | 210 | add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - if($gd_page_id){ |
|
| 213 | + if ($gd_page_id) { |
|
| 214 | 214 | $post = get_post($gd_page_id); |
| 215 | 215 | $slug = $post->post_name; |
| 216 | 216 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
| 217 | 217 | $info_url = trailingslashit($home_url)."$slug/"; |
| 218 | - }else{ |
|
| 218 | + } else { |
|
| 219 | 219 | $info_url = trailingslashit($home_url); |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - if($args){ |
|
| 223 | - $info_url = add_query_arg($args,$info_url ); |
|
| 222 | + if ($args) { |
|
| 223 | + $info_url = add_query_arg($args, $info_url); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | return $info_url; |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | * @param string $charset Character set to use for conversion. |
| 239 | 239 | * @return string Returns converted string. |
| 240 | 240 | */ |
| 241 | -function geodir_ucwords($string, $charset='UTF-8') { |
|
| 241 | +function geodir_ucwords($string, $charset = 'UTF-8') { |
|
| 242 | 242 | if (function_exists('mb_convert_case')) { |
| 243 | 243 | return mb_convert_case($string, MB_CASE_TITLE, $charset); |
| 244 | 244 | } else { |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | * @param string $charset Character set to use for conversion. |
| 259 | 259 | * @return string Returns converted string. |
| 260 | 260 | */ |
| 261 | -function geodir_strtolower($string, $charset='UTF-8') { |
|
| 261 | +function geodir_strtolower($string, $charset = 'UTF-8') { |
|
| 262 | 262 | if (function_exists('mb_convert_case')) { |
| 263 | 263 | return mb_convert_case($string, MB_CASE_LOWER, $charset); |
| 264 | 264 | } else { |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | * @param string $charset Character set to use for conversion. |
| 279 | 279 | * @return string Returns converted string. |
| 280 | 280 | */ |
| 281 | -function geodir_strtoupper($string, $charset='UTF-8') { |
|
| 281 | +function geodir_strtoupper($string, $charset = 'UTF-8') { |
|
| 282 | 282 | if (function_exists('mb_convert_case')) { |
| 283 | 283 | return mb_convert_case($string, MB_CASE_UPPER, $charset); |
| 284 | 284 | } else { |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | |
| 310 | 310 | $url = trim($parts[0]); |
| 311 | 311 | if ($formatted && $url != '') { |
| 312 | - $url = str_replace( ' ', '%20', $url ); |
|
| 312 | + $url = str_replace(' ', '%20', $url); |
|
| 313 | 313 | $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url); |
| 314 | 314 | |
| 315 | 315 | if (0 !== stripos($url, 'mailto:')) { |
@@ -319,8 +319,8 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | $url = str_replace(';//', '://', $url); |
| 321 | 321 | |
| 322 | - if (strpos($url, ':') === false && ! in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) { |
|
| 323 | - $url = 'http://' . $url; |
|
| 322 | + if (strpos($url, ':') === false && !in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) { |
|
| 323 | + $url = 'http://'.$url; |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | $url = wp_kses_normalize_entities($url); |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | * @package GeoDirectory |
| 463 | 463 | */ |
| 464 | 464 | function _gd_die_handler() { |
| 465 | - if ( defined( 'GD_TESTING_MODE' ) ) { |
|
| 465 | + if (defined('GD_TESTING_MODE')) { |
|
| 466 | 466 | return '_gd_die_handler'; |
| 467 | 467 | } else { |
| 468 | 468 | die(); |
@@ -480,10 +480,10 @@ discard block |
||
| 480 | 480 | * @param string $title Optional. Error title. |
| 481 | 481 | * @param int $status Optional. Status code. |
| 482 | 482 | */ |
| 483 | -function gd_die( $message = '', $title = '', $status = 400 ) { |
|
| 484 | - add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 ); |
|
| 485 | - add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 ); |
|
| 486 | - wp_die( $message, $title, array( 'response' => $status )); |
|
| 483 | +function gd_die($message = '', $title = '', $status = 400) { |
|
| 484 | + add_filter('wp_die_ajax_handler', '_gd_die_handler', 10, 3); |
|
| 485 | + add_filter('wp_die_handler', '_gd_die_handler', 10, 3); |
|
| 486 | + wp_die($message, $title, array('response' => $status)); |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | /* |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | * @param string $php_format The PHP date format. |
| 494 | 494 | * @return string The jQuery format date string. |
| 495 | 495 | */ |
| 496 | -function geodir_date_format_php_to_jqueryui( $php_format ) { |
|
| 496 | +function geodir_date_format_php_to_jqueryui($php_format) { |
|
| 497 | 497 | $symbols = array( |
| 498 | 498 | // Day |
| 499 | 499 | 'd' => 'dd', |
@@ -533,27 +533,27 @@ discard block |
||
| 533 | 533 | $jqueryui_format = ""; |
| 534 | 534 | $escaping = false; |
| 535 | 535 | |
| 536 | - for ( $i = 0; $i < strlen( $php_format ); $i++ ) { |
|
| 536 | + for ($i = 0; $i < strlen($php_format); $i++) { |
|
| 537 | 537 | $char = $php_format[$i]; |
| 538 | 538 | |
| 539 | 539 | // PHP date format escaping character |
| 540 | - if ( $char === '\\' ) { |
|
| 540 | + if ($char === '\\') { |
|
| 541 | 541 | $i++; |
| 542 | 542 | |
| 543 | - if ( $escaping ) { |
|
| 543 | + if ($escaping) { |
|
| 544 | 544 | $jqueryui_format .= $php_format[$i]; |
| 545 | 545 | } else { |
| 546 | - $jqueryui_format .= '\'' . $php_format[$i]; |
|
| 546 | + $jqueryui_format .= '\''.$php_format[$i]; |
|
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | $escaping = true; |
| 550 | 550 | } else { |
| 551 | - if ( $escaping ) { |
|
| 551 | + if ($escaping) { |
|
| 552 | 552 | $jqueryui_format .= "'"; |
| 553 | 553 | $escaping = false; |
| 554 | 554 | } |
| 555 | 555 | |
| 556 | - if ( isset( $symbols[$char] ) ) { |
|
| 556 | + if (isset($symbols[$char])) { |
|
| 557 | 557 | $jqueryui_format .= $symbols[$char]; |
| 558 | 558 | } else { |
| 559 | 559 | $jqueryui_format .= $char; |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | * @return string The untranslated date string. |
| 573 | 573 | * @since 1.6.5 |
| 574 | 574 | */ |
| 575 | -function geodir_maybe_untranslate_date($date){ |
|
| 575 | +function geodir_maybe_untranslate_date($date) { |
|
| 576 | 576 | $english_long_months = array( |
| 577 | 577 | 'January', |
| 578 | 578 | 'February', |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | 'December', |
| 589 | 589 | ); |
| 590 | 590 | |
| 591 | - $non_english_long_months = array( |
|
| 591 | + $non_english_long_months = array( |
|
| 592 | 592 | __('January'), |
| 593 | 593 | __('February'), |
| 594 | 594 | __('March'), |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | __('November'), |
| 603 | 603 | __('December'), |
| 604 | 604 | ); |
| 605 | - $date = str_replace($non_english_long_months,$english_long_months,$date); |
|
| 605 | + $date = str_replace($non_english_long_months, $english_long_months, $date); |
|
| 606 | 606 | |
| 607 | 607 | |
| 608 | 608 | $english_short_months = array( |
@@ -621,21 +621,21 @@ discard block |
||
| 621 | 621 | ); |
| 622 | 622 | |
| 623 | 623 | $non_english_short_months = array( |
| 624 | - ' '._x( 'Jan', 'January abbreviation' ).' ', |
|
| 625 | - ' '._x( 'Feb', 'February abbreviation' ).' ', |
|
| 626 | - ' '._x( 'Mar', 'March abbreviation' ).' ', |
|
| 627 | - ' '._x( 'Apr', 'April abbreviation' ).' ', |
|
| 628 | - ' '._x( 'May', 'May abbreviation' ).' ', |
|
| 629 | - ' '._x( 'Jun', 'June abbreviation' ).' ', |
|
| 630 | - ' '._x( 'Jul', 'July abbreviation' ).' ', |
|
| 631 | - ' '._x( 'Aug', 'August abbreviation' ).' ', |
|
| 632 | - ' '._x( 'Sep', 'September abbreviation' ).' ', |
|
| 633 | - ' '._x( 'Oct', 'October abbreviation' ).' ', |
|
| 634 | - ' '._x( 'Nov', 'November abbreviation' ).' ', |
|
| 635 | - ' '._x( 'Dec', 'December abbreviation' ).' ', |
|
| 624 | + ' '._x('Jan', 'January abbreviation').' ', |
|
| 625 | + ' '._x('Feb', 'February abbreviation').' ', |
|
| 626 | + ' '._x('Mar', 'March abbreviation').' ', |
|
| 627 | + ' '._x('Apr', 'April abbreviation').' ', |
|
| 628 | + ' '._x('May', 'May abbreviation').' ', |
|
| 629 | + ' '._x('Jun', 'June abbreviation').' ', |
|
| 630 | + ' '._x('Jul', 'July abbreviation').' ', |
|
| 631 | + ' '._x('Aug', 'August abbreviation').' ', |
|
| 632 | + ' '._x('Sep', 'September abbreviation').' ', |
|
| 633 | + ' '._x('Oct', 'October abbreviation').' ', |
|
| 634 | + ' '._x('Nov', 'November abbreviation').' ', |
|
| 635 | + ' '._x('Dec', 'December abbreviation').' ', |
|
| 636 | 636 | ); |
| 637 | 637 | |
| 638 | - $date = str_replace($non_english_short_months,$english_short_months,$date); |
|
| 638 | + $date = str_replace($non_english_short_months, $english_short_months, $date); |
|
| 639 | 639 | |
| 640 | 640 | |
| 641 | 641 | return $date; |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | * @return string Trimmed string. |
| 708 | 708 | */ |
| 709 | 709 | function geodir_excerpt($text, $length = 100, $options = array()) { |
| 710 | - if (!(int)$length > 0) { |
|
| 710 | + if (!(int) $length > 0) { |
|
| 711 | 711 | return $text; |
| 712 | 712 | } |
| 713 | 713 | $default = array( |
@@ -769,7 +769,7 @@ discard block |
||
| 769 | 769 | $length = $truncateLength; |
| 770 | 770 | |
| 771 | 771 | foreach ($openTags as $tag) { |
| 772 | - $suffix .= '</' . $tag . '>'; |
|
| 772 | + $suffix .= '</'.$tag.'>'; |
|
| 773 | 773 | } |
| 774 | 774 | } else { |
| 775 | 775 | if (geodir_strlen($text, $options) <= $length) { |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | } |
| 792 | 792 | } |
| 793 | 793 | |
| 794 | - return $prefix . $result . $suffix; |
|
| 794 | + return $prefix.$result.$suffix; |
|
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | /** |
@@ -828,7 +828,7 @@ discard block |
||
| 828 | 828 | $pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i'; |
| 829 | 829 | $replace = preg_replace_callback( |
| 830 | 830 | $pattern, |
| 831 | - function ($match) use ($strlen) { |
|
| 831 | + function($match) use ($strlen) { |
|
| 832 | 832 | $utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8'); |
| 833 | 833 | |
| 834 | 834 | return str_repeat(' ', $strlen($utf8, 'UTF-8')); |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | } |
| 890 | 890 | |
| 891 | 891 | if (empty($options['html'])) { |
| 892 | - return (string)$substr($text, $start, $length); |
|
| 892 | + return (string) $substr($text, $start, $length); |
|
| 893 | 893 | } |
| 894 | 894 | |
| 895 | 895 | $totalOffset = 0; |
@@ -914,7 +914,7 @@ discard block |
||
| 914 | 914 | |
| 915 | 915 | $len = geodir_strlen($part, $options); |
| 916 | 916 | if ($offset !== 0 || $totalLength + $len > $length) { |
| 917 | - if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) { |
|
| 917 | + if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8')) { |
|
| 918 | 918 | // Entities cannot be passed substr. |
| 919 | 919 | continue; |
| 920 | 920 | } |
@@ -960,39 +960,39 @@ discard block |
||
| 960 | 960 | return ''; |
| 961 | 961 | } |
| 962 | 962 | |
| 963 | -function geodir_tool_restore_cpt_from_taxonomies(){ |
|
| 963 | +function geodir_tool_restore_cpt_from_taxonomies() { |
|
| 964 | 964 | |
| 965 | 965 | $cpts = get_option('geodir_post_types'); |
| 966 | 966 | |
| 967 | - if(!empty($cpts)){return;} |
|
| 967 | + if (!empty($cpts)) {return; } |
|
| 968 | 968 | |
| 969 | 969 | $taxonomies = get_option('geodir_taxonomies'); |
| 970 | 970 | |
| 971 | - if(empty($taxonomies)){return;} |
|
| 971 | + if (empty($taxonomies)) {return; } |
|
| 972 | 972 | |
| 973 | 973 | $cpts = array(); |
| 974 | 974 | |
| 975 | - foreach($taxonomies as $key => $val){ |
|
| 975 | + foreach ($taxonomies as $key => $val) { |
|
| 976 | 976 | |
| 977 | - if(strpos($val['listing_slug'], '/') === false) { |
|
| 978 | - $cpts[$val['object_type']] = array('cpt'=>$val['object_type'],'slug'=>$val['listing_slug']); |
|
| 977 | + if (strpos($val['listing_slug'], '/') === false) { |
|
| 978 | + $cpts[$val['object_type']] = array('cpt'=>$val['object_type'], 'slug'=>$val['listing_slug']); |
|
| 979 | 979 | } |
| 980 | 980 | |
| 981 | 981 | } |
| 982 | 982 | |
| 983 | - if(empty($cpts)){return;} |
|
| 983 | + if (empty($cpts)) {return; } |
|
| 984 | 984 | |
| 985 | 985 | |
| 986 | 986 | $cpts_restore = $cpts; |
| 987 | 987 | |
| 988 | - foreach($cpts as $cpt){ |
|
| 988 | + foreach ($cpts as $cpt) { |
|
| 989 | 989 | |
| 990 | 990 | |
| 991 | - $is_custom = $cpt['cpt']=='gd_place' ? 0 : 1; |
|
| 991 | + $is_custom = $cpt['cpt'] == 'gd_place' ? 0 : 1; |
|
| 992 | 992 | |
| 993 | - $cpts_restore[$cpt['cpt']] = array ( |
|
| 993 | + $cpts_restore[$cpt['cpt']] = array( |
|
| 994 | 994 | 'labels' => |
| 995 | - array ( |
|
| 995 | + array( |
|
| 996 | 996 | 'name' => $cpt['slug'], |
| 997 | 997 | 'singular_name' => $cpt['slug'], |
| 998 | 998 | 'add_new' => 'Add New', |
@@ -1020,14 +1020,14 @@ discard block |
||
| 1020 | 1020 | 'public' => true, |
| 1021 | 1021 | 'query_var' => true, |
| 1022 | 1022 | 'rewrite' => |
| 1023 | - array ( |
|
| 1023 | + array( |
|
| 1024 | 1024 | 'slug' => $cpt['slug'], |
| 1025 | 1025 | 'with_front' => false, |
| 1026 | 1026 | 'hierarchical' => true, |
| 1027 | 1027 | 'feeds' => true, |
| 1028 | 1028 | ), |
| 1029 | 1029 | 'supports' => |
| 1030 | - array ( |
|
| 1030 | + array( |
|
| 1031 | 1031 | 0 => 'title', |
| 1032 | 1032 | 1 => 'editor', |
| 1033 | 1033 | 2 => 'author', |
@@ -1037,14 +1037,14 @@ discard block |
||
| 1037 | 1037 | 6 => 'comments', |
| 1038 | 1038 | ), |
| 1039 | 1039 | 'taxonomies' => |
| 1040 | - array ( |
|
| 1040 | + array( |
|
| 1041 | 1041 | 0 => $cpt['cpt'].'category', |
| 1042 | 1042 | 1 => $cpt['cpt'].'_tags', |
| 1043 | 1043 | ), |
| 1044 | 1044 | 'is_custom' => $is_custom, |
| 1045 | 1045 | 'listing_order' => '1', |
| 1046 | 1046 | 'seo' => |
| 1047 | - array ( |
|
| 1047 | + array( |
|
| 1048 | 1048 | 'meta_keyword' => '', |
| 1049 | 1049 | 'meta_description' => '', |
| 1050 | 1050 | ), |
@@ -1056,6 +1056,6 @@ discard block |
||
| 1056 | 1056 | } |
| 1057 | 1057 | |
| 1058 | 1058 | |
| 1059 | - update_option('geodir_post_types',$cpts_restore); |
|
| 1059 | + update_option('geodir_post_types', $cpts_restore); |
|
| 1060 | 1060 | |
| 1061 | 1061 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | if (geodir_is_wpml()){ |
| 148 | 148 | $home_url = icl_get_home_url(); |
| 149 | - }else{ |
|
| 149 | + } else{ |
|
| 150 | 150 | $home_url = home_url(); |
| 151 | 151 | } |
| 152 | 152 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $slug = $post->post_name; |
| 160 | 160 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
| 161 | 161 | $login_url = trailingslashit($home_url)."$slug/"; |
| 162 | - }else{ |
|
| 162 | + } else{ |
|
| 163 | 163 | $login_url = trailingslashit($home_url)."?geodir_signup=true"; |
| 164 | 164 | } |
| 165 | 165 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | |
| 203 | 203 | if (geodir_is_wpml()){ |
| 204 | 204 | $home_url = icl_get_home_url(); |
| 205 | - }else{ |
|
| 205 | + } else{ |
|
| 206 | 206 | $home_url = home_url(); |
| 207 | 207 | } |
| 208 | 208 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $slug = $post->post_name; |
| 216 | 216 | //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors |
| 217 | 217 | $info_url = trailingslashit($home_url)."$slug/"; |
| 218 | - }else{ |
|
| 218 | + } else{ |
|
| 219 | 219 | $info_url = trailingslashit($home_url); |
| 220 | 220 | } |
| 221 | 221 | |
@@ -13,26 +13,26 @@ discard block |
||
| 13 | 13 | global $wp_query, $current_term, $query; |
| 14 | 14 | |
| 15 | 15 | if (function_exists('geodir_location_geo_home_link')) {
|
| 16 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
|
|
| 16 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
|
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | if (geodir_is_wpml() && defined('DOING_AJAX') && DOING_AJAX){
|
| 20 | - $search_url = icl_get_home_url(); |
|
| 20 | + $search_url = icl_get_home_url(); |
|
| 21 | 21 | } else {
|
| 22 | - $search_url = get_home_url(); |
|
| 22 | + $search_url = get_home_url(); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | $search_url = trailingslashit($search_url); |
| 26 | 26 | |
| 27 | 27 | if (function_exists('geodir_location_geo_home_link')) {
|
| 28 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
|
|
| 28 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
|
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | $new_style = get_option('geodir_show_search_old_search_from') ? false : true;
|
| 32 | 32 | $form_class = 'geodir-listing-search'; |
| 33 | 33 | |
| 34 | 34 | if($new_style){
|
| 35 | - $form_class .= ' gd-search-bar-style'; |
|
| 35 | + $form_class .= ' gd-search-bar-style'; |
|
| 36 | 36 | } |
| 37 | 37 | ?> |
| 38 | 38 | <form class="<?php |
@@ -49,56 +49,56 @@ discard block |
||
| 49 | 49 | <div class="geodir-loc-bar"> |
| 50 | 50 | |
| 51 | 51 | <?php |
| 52 | - /** |
|
| 53 | - * Called inside the search form but before any of the fields. |
|
| 54 | - * |
|
| 55 | - * @since 1.0.0 |
|
| 56 | - */ |
|
| 57 | - do_action('geodir_before_search_form') ?>
|
|
| 52 | + /** |
|
| 53 | + * Called inside the search form but before any of the fields. |
|
| 54 | + * |
|
| 55 | + * @since 1.0.0 |
|
| 56 | + */ |
|
| 57 | + do_action('geodir_before_search_form') ?>
|
|
| 58 | 58 | |
| 59 | 59 | <div class="clearfix geodir-loc-bar-in"> |
| 60 | 60 | <div class="geodir-search"> |
| 61 | 61 | |
| 62 | 62 | <?php |
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Adds the input fields to the search form. |
|
| 66 | - * |
|
| 67 | - * @since 1.6.9 |
|
| 68 | - */ |
|
| 69 | - do_action('geodir_search_form_inputs');
|
|
| 64 | + /** |
|
| 65 | + * Adds the input fields to the search form. |
|
| 66 | + * |
|
| 67 | + * @since 1.6.9 |
|
| 68 | + */ |
|
| 69 | + do_action('geodir_search_form_inputs');
|
|
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * Called on the GD search form just before the search button. |
|
| 75 | - * |
|
| 76 | - * @since 1.0.0 |
|
| 77 | - */ |
|
| 78 | - do_action('geodir_before_search_button');
|
|
| 73 | + /** |
|
| 74 | + * Called on the GD search form just before the search button. |
|
| 75 | + * |
|
| 76 | + * @since 1.0.0 |
|
| 77 | + */ |
|
| 78 | + do_action('geodir_before_search_button');
|
|
| 79 | 79 | |
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Called on the GD search form just after the search button. |
|
| 83 | - * |
|
| 84 | - * @since 1.0.0 |
|
| 85 | - */ |
|
| 86 | - do_action('geodir_after_search_button');
|
|
| 81 | + /** |
|
| 82 | + * Called on the GD search form just after the search button. |
|
| 83 | + * |
|
| 84 | + * @since 1.0.0 |
|
| 85 | + */ |
|
| 86 | + do_action('geodir_after_search_button');
|
|
| 87 | 87 | |
| 88 | 88 | |
| 89 | - ?> |
|
| 89 | + ?> |
|
| 90 | 90 | </div> |
| 91 | 91 | |
| 92 | 92 | |
| 93 | 93 | </div> |
| 94 | 94 | |
| 95 | 95 | <?php |
| 96 | - /** |
|
| 97 | - * Called inside the search form but after all the input fields. |
|
| 98 | - * |
|
| 99 | - * @since 1.0.0 |
|
| 100 | - */ |
|
| 101 | - do_action('geodir_after_search_form') ?>
|
|
| 96 | + /** |
|
| 97 | + * Called inside the search form but after all the input fields. |
|
| 98 | + * |
|
| 99 | + * @since 1.0.0 |
|
| 100 | + */ |
|
| 101 | + do_action('geodir_after_search_form') ?>
|
|
| 102 | 102 | |
| 103 | 103 | |
| 104 | 104 | </div> |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if (geodir_is_wpml() && defined('DOING_AJAX') && DOING_AJAX){
|
|
| 19 | +if (geodir_is_wpml() && defined('DOING_AJAX') && DOING_AJAX) {
|
|
| 20 | 20 | $search_url = icl_get_home_url(); |
| 21 | 21 | } else {
|
| 22 | 22 | $search_url = get_home_url(); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $new_style = get_option('geodir_show_search_old_search_from') ? false : true;
|
| 32 | 32 | $form_class = 'geodir-listing-search'; |
| 33 | 33 | |
| 34 | -if($new_style){
|
|
| 34 | +if ($new_style) {
|
|
| 35 | 35 | $form_class .= ' gd-search-bar-style'; |
| 36 | 36 | } |
| 37 | 37 | ?> |