@@ -18,9 +18,9 @@ discard block |
||
| 18 | 18 | global $post_type; |
| 19 | 19 | |
| 20 | 20 | if (!isset($field_info->post_type)) {
|
| 21 | - $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 21 | + $post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 22 | 22 | } else |
| 23 | - $post_type = $field_info->post_type; |
|
| 23 | + $post_type = $field_info->post_type; |
|
| 24 | 24 | |
| 25 | 25 | //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){
|
| 26 | 26 | // $cf_arr = geodir_custom_fields_predefined($post_type); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | $field_admin_title = ''; |
| 50 | 50 | if (isset($field_info->admin_title)) |
| 51 | - $field_admin_title = $field_info->admin_title; |
|
| 51 | + $field_admin_title = $field_info->admin_title; |
|
| 52 | 52 | |
| 53 | 53 | $default = isset($field_info->is_admin) ? $field_info->is_admin : ''; |
| 54 | 54 | |
@@ -68,17 +68,17 @@ discard block |
||
| 68 | 68 | //print_r($field_info); |
| 69 | 69 | |
| 70 | 70 | if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
|
| 71 | - $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
|
| 71 | + $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
|
| 72 | 72 | }elseif(isset($cf['icon']) && $cf['icon']){
|
| 73 | - $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
|
|
| 73 | + $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
|
|
| 74 | 74 | }else{
|
| 75 | - $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
| 75 | + $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | if(isset($cf['name']) && $cf['name']){
|
| 79 | - $field_type_name = $cf['name']; |
|
| 79 | + $field_type_name = $cf['name']; |
|
| 80 | 80 | }else{
|
| 81 | - $field_type_name = $field_type; |
|
| 81 | + $field_type_name = $field_type; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | ?> |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
|
| 89 | 89 | <?php |
| 90 | 90 | |
| 91 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 92 | - ?> |
|
| 91 | + $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 92 | + ?> |
|
| 93 | 93 | |
| 94 | 94 | <?php if ($default): ?> |
| 95 | 95 | <div title="<?php _e('Default field, should not be removed.', 'geodirectory'); ?>" class="handlediv move gd-default-remove"><i class="fa fa-times" aria-hidden="true"></i></div>
|
@@ -98,37 +98,37 @@ discard block |
||
| 98 | 98 | onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
|
| 99 | 99 | class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div> |
| 100 | 100 | <?php endif; |
| 101 | - if ($field_type == 'fieldset') {
|
|
| 102 | - ?> |
|
| 101 | + if ($field_type == 'fieldset') {
|
|
| 102 | + ?> |
|
| 103 | 103 | <i class="fa fa-long-arrow-left " aria-hidden="true"></i> |
| 104 | 104 | <i class="fa fa-long-arrow-right " aria-hidden="true"></i> |
| 105 | 105 | <b style="cursor:pointer;" |
| 106 | 106 | onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
|
| 107 | 107 | <?php |
| 108 | - } else {echo $field_icon;
|
|
| 109 | - ?> |
|
| 108 | + } else {echo $field_icon;
|
|
| 109 | + ?> |
|
| 110 | 110 | <b style="cursor:pointer;" |
| 111 | 111 | onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b>
|
| 112 | 112 | <?php |
| 113 | - } |
|
| 114 | - ?> |
|
| 113 | + } |
|
| 114 | + ?> |
|
| 115 | 115 | </div> |
| 116 | 116 | |
| 117 | 117 | <form><!-- we need to wrap in a fom so we can use radio buttons with same name --> |
| 118 | 118 | <div id="field_frm<?php echo $result_str; ?>" class="field_frm" |
| 119 | 119 | style="display:<?php if ($field_ins_upd == 'submit') {
|
| 120 | - echo 'block;'; |
|
| 121 | - } else {
|
|
| 122 | - echo 'none;'; |
|
| 123 | - } ?>"> |
|
| 120 | + echo 'block;'; |
|
| 121 | + } else {
|
|
| 122 | + echo 'none;'; |
|
| 123 | + } ?>"> |
|
| 124 | 124 | <input type="hidden" name="_wpnonce" value="<?php echo esc_attr($nonce); ?>"/> |
| 125 | 125 | <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/> |
| 126 | 126 | <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/> |
| 127 | 127 | <input type="hidden" name="field_type_key" id="field_type_key" value="<?php echo $field_type_key; ?>"/> |
| 128 | 128 | <input type="hidden" name="field_id" id="field_id" value="<?php echo esc_attr($result_str); ?>"/> |
| 129 | 129 | <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
|
| 130 | - echo $field_info->data_type; |
|
| 131 | - } ?>"/> |
|
| 130 | + echo $field_info->data_type; |
|
| 131 | + } ?>"/> |
|
| 132 | 132 | <input type="hidden" name="is_active" id="is_active" value="1"/> |
| 133 | 133 | |
| 134 | 134 | <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?> |
@@ -140,37 +140,37 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | <?php |
| 142 | 142 | |
| 143 | - // data_type |
|
| 144 | - if(has_filter("geodir_cfa_data_type_{$field_type}")){
|
|
| 143 | + // data_type |
|
| 144 | + if(has_filter("geodir_cfa_data_type_{$field_type}")){
|
|
| 145 | 145 | |
| 146 | - echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 146 | + echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 147 | 147 | |
| 148 | - }else{
|
|
| 149 | - $value = ''; |
|
| 150 | - if (isset($field_info->data_type)) {
|
|
| 151 | - $value = esc_attr($field_info->data_type); |
|
| 152 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 153 | - $value = $cf['defaults']['data_type']; |
|
| 154 | - } |
|
| 155 | - ?> |
|
| 148 | + }else{
|
|
| 149 | + $value = ''; |
|
| 150 | + if (isset($field_info->data_type)) {
|
|
| 151 | + $value = esc_attr($field_info->data_type); |
|
| 152 | + }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 153 | + $value = $cf['defaults']['data_type']; |
|
| 154 | + } |
|
| 155 | + ?> |
|
| 156 | 156 | <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/> |
| 157 | 157 | <?php |
| 158 | - } |
|
| 158 | + } |
|
| 159 | 159 | |
| 160 | 160 | |
| 161 | - // admin_title |
|
| 162 | - if(has_filter("geodir_cfa_admin_title_{$field_type}")){
|
|
| 161 | + // admin_title |
|
| 162 | + if(has_filter("geodir_cfa_admin_title_{$field_type}")){
|
|
| 163 | 163 | |
| 164 | - echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 164 | + echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 165 | 165 | |
| 166 | - }else{
|
|
| 167 | - $value = ''; |
|
| 168 | - if (isset($field_info->admin_title)) {
|
|
| 169 | - $value = esc_attr($field_info->admin_title); |
|
| 170 | - }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
|
|
| 171 | - $value = $cf['defaults']['admin_title']; |
|
| 172 | - } |
|
| 173 | - ?> |
|
| 166 | + }else{
|
|
| 167 | + $value = ''; |
|
| 168 | + if (isset($field_info->admin_title)) {
|
|
| 169 | + $value = esc_attr($field_info->admin_title); |
|
| 170 | + }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
|
|
| 171 | + $value = $cf['defaults']['admin_title']; |
|
| 172 | + } |
|
| 173 | + ?> |
|
| 174 | 174 | <li> |
| 175 | 175 | <label for="admin_title" class="gd-cf-tooltip-wrap"> |
| 176 | 176 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Admin title :', 'geodirectory'); ?>
|
@@ -184,22 +184,22 @@ discard block |
||
| 184 | 184 | </div> |
| 185 | 185 | </li> |
| 186 | 186 | <?php |
| 187 | - } |
|
| 187 | + } |
|
| 188 | 188 | |
| 189 | 189 | |
| 190 | - // site_title |
|
| 191 | - if(has_filter("geodir_cfa_site_title_{$field_type}")){
|
|
| 190 | + // site_title |
|
| 191 | + if(has_filter("geodir_cfa_site_title_{$field_type}")){
|
|
| 192 | 192 | |
| 193 | - echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 193 | + echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 194 | 194 | |
| 195 | - }else{
|
|
| 196 | - $value = ''; |
|
| 197 | - if (isset($field_info->site_title)) {
|
|
| 198 | - $value = esc_attr($field_info->site_title); |
|
| 199 | - }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
|
|
| 200 | - $value = $cf['defaults']['site_title']; |
|
| 201 | - } |
|
| 202 | - ?> |
|
| 195 | + }else{
|
|
| 196 | + $value = ''; |
|
| 197 | + if (isset($field_info->site_title)) {
|
|
| 198 | + $value = esc_attr($field_info->site_title); |
|
| 199 | + }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
|
|
| 200 | + $value = $cf['defaults']['site_title']; |
|
| 201 | + } |
|
| 202 | + ?> |
|
| 203 | 203 | <li> |
| 204 | 204 | <label for="site_title" class="gd-cf-tooltip-wrap"> <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend title :', 'geodirectory'); ?>
|
| 205 | 205 | <div class="gdcf-tooltip"> |
@@ -212,22 +212,22 @@ discard block |
||
| 212 | 212 | </div> |
| 213 | 213 | </li> |
| 214 | 214 | <?php |
| 215 | - } |
|
| 215 | + } |
|
| 216 | 216 | |
| 217 | 217 | |
| 218 | - // admin_desc |
|
| 219 | - if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
|
|
| 218 | + // admin_desc |
|
| 219 | + if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
|
|
| 220 | 220 | |
| 221 | - echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 221 | + echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 222 | 222 | |
| 223 | - }else{
|
|
| 224 | - $value = ''; |
|
| 225 | - if (isset($field_info->admin_desc)) {
|
|
| 226 | - $value = esc_attr($field_info->admin_desc); |
|
| 227 | - }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
|
|
| 228 | - $value = $cf['defaults']['admin_desc']; |
|
| 229 | - } |
|
| 230 | - ?> |
|
| 223 | + }else{
|
|
| 224 | + $value = ''; |
|
| 225 | + if (isset($field_info->admin_desc)) {
|
|
| 226 | + $value = esc_attr($field_info->admin_desc); |
|
| 227 | + }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
|
|
| 228 | + $value = $cf['defaults']['admin_desc']; |
|
| 229 | + } |
|
| 230 | + ?> |
|
| 231 | 231 | <li> |
| 232 | 232 | <label for="admin_desc" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend description :', 'geodirectory'); ?>
|
| 233 | 233 | <div class="gdcf-tooltip"> |
@@ -239,23 +239,23 @@ discard block |
||
| 239 | 239 | </div> |
| 240 | 240 | </li> |
| 241 | 241 | <?php |
| 242 | - } |
|
| 242 | + } |
|
| 243 | 243 | |
| 244 | 244 | |
| 245 | 245 | |
| 246 | - // htmlvar_name |
|
| 247 | - if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
|
|
| 246 | + // htmlvar_name |
|
| 247 | + if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
|
|
| 248 | 248 | |
| 249 | - echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 249 | + echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 250 | 250 | |
| 251 | - }else{
|
|
| 252 | - $value = ''; |
|
| 253 | - if (isset($field_info->htmlvar_name)) {
|
|
| 254 | - $value = esc_attr($field_info->htmlvar_name); |
|
| 255 | - }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
|
|
| 256 | - $value = $cf['defaults']['htmlvar_name']; |
|
| 257 | - } |
|
| 258 | - ?> |
|
| 251 | + }else{
|
|
| 252 | + $value = ''; |
|
| 253 | + if (isset($field_info->htmlvar_name)) {
|
|
| 254 | + $value = esc_attr($field_info->htmlvar_name); |
|
| 255 | + }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
|
|
| 256 | + $value = $cf['defaults']['htmlvar_name']; |
|
| 257 | + } |
|
| 258 | + ?> |
|
| 259 | 259 | <li> |
| 260 | 260 | <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?>
|
| 261 | 261 | <div class="gdcf-tooltip"> |
@@ -265,29 +265,29 @@ discard block |
||
| 265 | 265 | <div class="gd-cf-input-wrap"> |
| 266 | 266 | <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>"
|
| 267 | 267 | value="<?php if ($value) {
|
| 268 | - echo preg_replace('/geodir_/', '', $value, 1);
|
|
| 269 | - }?>" <?php if ($default) {
|
|
| 270 | - echo 'readonly="readonly"'; |
|
| 271 | - }?> /> |
|
| 268 | + echo preg_replace('/geodir_/', '', $value, 1);
|
|
| 269 | + }?>" <?php if ($default) {
|
|
| 270 | + echo 'readonly="readonly"'; |
|
| 271 | + }?> /> |
|
| 272 | 272 | </div> |
| 273 | 273 | </li> |
| 274 | 274 | <?php |
| 275 | - } |
|
| 275 | + } |
|
| 276 | 276 | |
| 277 | 277 | |
| 278 | - // is_active |
|
| 279 | - if(has_filter("geodir_cfa_is_active_{$field_type}")){
|
|
| 278 | + // is_active |
|
| 279 | + if(has_filter("geodir_cfa_is_active_{$field_type}")){
|
|
| 280 | 280 | |
| 281 | - echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 281 | + echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 282 | 282 | |
| 283 | - }else{
|
|
| 284 | - $value = ''; |
|
| 285 | - if (isset($field_info->is_active)) {
|
|
| 286 | - $value = esc_attr($field_info->is_active); |
|
| 287 | - }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
|
|
| 288 | - $value = $cf['defaults']['is_active']; |
|
| 289 | - } |
|
| 290 | - ?> |
|
| 283 | + }else{
|
|
| 284 | + $value = ''; |
|
| 285 | + if (isset($field_info->is_active)) {
|
|
| 286 | + $value = esc_attr($field_info->is_active); |
|
| 287 | + }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
|
|
| 288 | + $value = $cf['defaults']['is_active']; |
|
| 289 | + } |
|
| 290 | + ?> |
|
| 291 | 291 | <li <?php echo $field_display; ?>> |
| 292 | 292 | <label for="is_active" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active :', 'geodirectory'); ?>
|
| 293 | 293 | <div class="gdcf-tooltip"> |
@@ -298,35 +298,35 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
| 300 | 300 | <?php if ($value == '1') {
|
| 301 | - echo 'checked'; |
|
| 302 | - } ?>/> |
|
| 301 | + echo 'checked'; |
|
| 302 | + } ?>/> |
|
| 303 | 303 | <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 304 | 304 | |
| 305 | 305 | <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
| 306 | 306 | <?php if ($value == '0' || !$value) {
|
| 307 | - echo 'checked'; |
|
| 308 | - } ?>/> |
|
| 307 | + echo 'checked'; |
|
| 308 | + } ?>/> |
|
| 309 | 309 | <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 310 | 310 | |
| 311 | 311 | </div> |
| 312 | 312 | </li> |
| 313 | 313 | <?php |
| 314 | - } |
|
| 314 | + } |
|
| 315 | 315 | |
| 316 | 316 | |
| 317 | - // for_admin_use |
|
| 318 | - if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
|
|
| 317 | + // for_admin_use |
|
| 318 | + if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
|
|
| 319 | 319 | |
| 320 | - echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 320 | + echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 321 | 321 | |
| 322 | - }else{
|
|
| 323 | - $value = ''; |
|
| 324 | - if (isset($field_info->for_admin_use)) {
|
|
| 325 | - $value = esc_attr($field_info->for_admin_use); |
|
| 326 | - }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
|
|
| 327 | - $value = $cf['defaults']['for_admin_use']; |
|
| 328 | - } |
|
| 329 | - ?> |
|
| 322 | + }else{
|
|
| 323 | + $value = ''; |
|
| 324 | + if (isset($field_info->for_admin_use)) {
|
|
| 325 | + $value = esc_attr($field_info->for_admin_use); |
|
| 326 | + }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
|
|
| 327 | + $value = $cf['defaults']['for_admin_use']; |
|
| 328 | + } |
|
| 329 | + ?> |
|
| 330 | 330 | <li> |
| 331 | 331 | <label for="for_admin_use" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('For admin use only? :', 'geodirectory'); ?>
|
| 332 | 332 | <div class="gdcf-tooltip"> |
@@ -337,47 +337,47 @@ discard block |
||
| 337 | 337 | |
| 338 | 338 | <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled" value="1" |
| 339 | 339 | <?php if ($value == '1') {
|
| 340 | - echo 'checked'; |
|
| 341 | - } ?>/> |
|
| 340 | + echo 'checked'; |
|
| 341 | + } ?>/> |
|
| 342 | 342 | <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 343 | 343 | |
| 344 | 344 | <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0" |
| 345 | 345 | <?php if ($value == '0' || !$value) {
|
| 346 | - echo 'checked'; |
|
| 347 | - } ?>/> |
|
| 346 | + echo 'checked'; |
|
| 347 | + } ?>/> |
|
| 348 | 348 | <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 349 | 349 | |
| 350 | 350 | </div> |
| 351 | 351 | </li> |
| 352 | 352 | <?php |
| 353 | - } |
|
| 353 | + } |
|
| 354 | 354 | |
| 355 | 355 | |
| 356 | - // default_value |
|
| 357 | - if(has_filter("geodir_cfa_default_value_{$field_type}")){
|
|
| 356 | + // default_value |
|
| 357 | + if(has_filter("geodir_cfa_default_value_{$field_type}")){
|
|
| 358 | 358 | |
| 359 | - echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 359 | + echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 360 | 360 | |
| 361 | - }else{
|
|
| 362 | - $value = ''; |
|
| 363 | - if (isset($field_info->default_value)) {
|
|
| 364 | - $value = esc_attr($field_info->default_value); |
|
| 365 | - }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
|
|
| 366 | - $value = $cf['defaults']['default_value']; |
|
| 367 | - } |
|
| 368 | - ?> |
|
| 361 | + }else{
|
|
| 362 | + $value = ''; |
|
| 363 | + if (isset($field_info->default_value)) {
|
|
| 364 | + $value = esc_attr($field_info->default_value); |
|
| 365 | + }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
|
|
| 366 | + $value = $cf['defaults']['default_value']; |
|
| 367 | + } |
|
| 368 | + ?> |
|
| 369 | 369 | <li> |
| 370 | 370 | <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
|
| 371 | 371 | <div class="gdcf-tooltip"> |
| 372 | 372 | <?php |
| 373 | - if ($field_type == 'checkbox') {
|
|
| 374 | - _e('Should the checkbox be checked by default?', 'geodirectory');
|
|
| 375 | - } else if ($field_type == 'email') {
|
|
| 376 | - _e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory');
|
|
| 377 | - } else {
|
|
| 378 | - _e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory');
|
|
| 379 | - } |
|
| 380 | - ?> |
|
| 373 | + if ($field_type == 'checkbox') {
|
|
| 374 | + _e('Should the checkbox be checked by default?', 'geodirectory');
|
|
| 375 | + } else if ($field_type == 'email') {
|
|
| 376 | + _e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory');
|
|
| 377 | + } else {
|
|
| 378 | + _e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory');
|
|
| 379 | + } |
|
| 380 | + ?> |
|
| 381 | 381 | </div> |
| 382 | 382 | </label> |
| 383 | 383 | <div class="gd-cf-input-wrap"> |
@@ -394,22 +394,22 @@ discard block |
||
| 394 | 394 | </div> |
| 395 | 395 | </li> |
| 396 | 396 | <?php |
| 397 | - } |
|
| 397 | + } |
|
| 398 | 398 | |
| 399 | 399 | |
| 400 | - // show_in |
|
| 401 | - if(has_filter("geodir_cfa_show_in_{$field_type}")){
|
|
| 400 | + // show_in |
|
| 401 | + if(has_filter("geodir_cfa_show_in_{$field_type}")){
|
|
| 402 | 402 | |
| 403 | - echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 403 | + echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 404 | 404 | |
| 405 | - }else{
|
|
| 406 | - $value = ''; |
|
| 407 | - if (isset($field_info->show_in)) {
|
|
| 408 | - $value = esc_attr($field_info->show_in); |
|
| 409 | - }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
|
|
| 410 | - $value = esc_attr($cf['defaults']['show_in']); |
|
| 411 | - } |
|
| 412 | - ?> |
|
| 405 | + }else{
|
|
| 406 | + $value = ''; |
|
| 407 | + if (isset($field_info->show_in)) {
|
|
| 408 | + $value = esc_attr($field_info->show_in); |
|
| 409 | + }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
|
|
| 410 | + $value = esc_attr($cf['defaults']['show_in']); |
|
| 411 | + } |
|
| 412 | + ?> |
|
| 413 | 413 | <li> |
| 414 | 414 | <label for="show_in" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show in what locations?:', 'geodirectory'); ?>
|
| 415 | 415 | <div class="gdcf-tooltip"> |
@@ -420,41 +420,41 @@ discard block |
||
| 420 | 420 | |
| 421 | 421 | <?php |
| 422 | 422 | |
| 423 | - /* |
|
| 423 | + /* |
|
| 424 | 424 | * We wrap the key values in [] so we can search the DB easier with a LIKE query. |
| 425 | 425 | */ |
| 426 | - $show_in_locations = array( |
|
| 427 | - "[detail]" => __("Details page sidebar", 'geodirectory'),
|
|
| 428 | - "[moreinfo]" => __("More info tab", 'geodirectory'),
|
|
| 429 | - "[listing]" => __("Listings page", 'geodirectory'),
|
|
| 430 | - "[owntab]" => __("Details page own tab", 'geodirectory'),
|
|
| 431 | - "[mapbubble]" => __("Map bubble", 'geodirectory'),
|
|
| 432 | - ); |
|
| 433 | - |
|
| 434 | - /** |
|
| 435 | - * Filter the locations array for where to display custom fields. |
|
| 436 | - * |
|
| 437 | - * @since 1.6.6 |
|
| 438 | - * @param array $show_in_locations The array of locations and descriptions. |
|
| 439 | - * @param object $field_info The field being displayed info. |
|
| 440 | - * @param string $field_info The type of field. |
|
| 441 | - */ |
|
| 442 | - $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
|
|
| 443 | - |
|
| 444 | - |
|
| 445 | - // remove some locations for some field types |
|
| 446 | - |
|
| 447 | - // don't show new tab option for some types |
|
| 448 | - if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
|
|
| 449 | - }else{
|
|
| 450 | - unset($show_in_locations['[owntab]']); |
|
| 451 | - } |
|
| 452 | - |
|
| 453 | - if(!$display_on_listing){
|
|
| 454 | - unset($show_in_locations['[listings]']); |
|
| 455 | - } |
|
| 456 | - |
|
| 457 | - ?> |
|
| 426 | + $show_in_locations = array( |
|
| 427 | + "[detail]" => __("Details page sidebar", 'geodirectory'),
|
|
| 428 | + "[moreinfo]" => __("More info tab", 'geodirectory'),
|
|
| 429 | + "[listing]" => __("Listings page", 'geodirectory'),
|
|
| 430 | + "[owntab]" => __("Details page own tab", 'geodirectory'),
|
|
| 431 | + "[mapbubble]" => __("Map bubble", 'geodirectory'),
|
|
| 432 | + ); |
|
| 433 | + |
|
| 434 | + /** |
|
| 435 | + * Filter the locations array for where to display custom fields. |
|
| 436 | + * |
|
| 437 | + * @since 1.6.6 |
|
| 438 | + * @param array $show_in_locations The array of locations and descriptions. |
|
| 439 | + * @param object $field_info The field being displayed info. |
|
| 440 | + * @param string $field_info The type of field. |
|
| 441 | + */ |
|
| 442 | + $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
|
|
| 443 | + |
|
| 444 | + |
|
| 445 | + // remove some locations for some field types |
|
| 446 | + |
|
| 447 | + // don't show new tab option for some types |
|
| 448 | + if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
|
|
| 449 | + }else{
|
|
| 450 | + unset($show_in_locations['[owntab]']); |
|
| 451 | + } |
|
| 452 | + |
|
| 453 | + if(!$display_on_listing){
|
|
| 454 | + unset($show_in_locations['[listings]']); |
|
| 455 | + } |
|
| 456 | + |
|
| 457 | + ?> |
|
| 458 | 458 | |
| 459 | 459 | <select multiple="multiple" name="show_in[]" |
| 460 | 460 | id="show_in" |
@@ -464,38 +464,38 @@ discard block |
||
| 464 | 464 | option-ajaxchosen="false"> |
| 465 | 465 | <?php |
| 466 | 466 | |
| 467 | - $show_in_values = explode(',',$value);
|
|
| 467 | + $show_in_values = explode(',',$value);
|
|
| 468 | 468 | |
| 469 | - foreach( $show_in_locations as $key => $val){
|
|
| 470 | - $selected = ''; |
|
| 469 | + foreach( $show_in_locations as $key => $val){
|
|
| 470 | + $selected = ''; |
|
| 471 | 471 | |
| 472 | - if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
|
|
| 473 | - $selected = 'selected'; |
|
| 474 | - } |
|
| 472 | + if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
|
|
| 473 | + $selected = 'selected'; |
|
| 474 | + } |
|
| 475 | 475 | |
| 476 | - ?> |
|
| 476 | + ?> |
|
| 477 | 477 | <option value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option> |
| 478 | 478 | <?php |
| 479 | - } |
|
| 480 | - ?> |
|
| 479 | + } |
|
| 480 | + ?> |
|
| 481 | 481 | </select> |
| 482 | 482 | </div> |
| 483 | 483 | </li> |
| 484 | 484 | <?php |
| 485 | - } |
|
| 485 | + } |
|
| 486 | 486 | |
| 487 | 487 | |
| 488 | - // advanced_editor |
|
| 489 | - if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
|
|
| 488 | + // advanced_editor |
|
| 489 | + if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
|
|
| 490 | 490 | |
| 491 | - echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 491 | + echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 492 | 492 | |
| 493 | - } |
|
| 493 | + } |
|
| 494 | 494 | |
| 495 | 495 | |
| 496 | 496 | |
| 497 | 497 | |
| 498 | - ?> |
|
| 498 | + ?> |
|
| 499 | 499 | |
| 500 | 500 | |
| 501 | 501 | <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?> |
@@ -508,38 +508,38 @@ discard block |
||
| 508 | 508 | |
| 509 | 509 | <?php |
| 510 | 510 | |
| 511 | - $pricearr = array(); |
|
| 512 | - if (isset($field_info->packages) && $field_info->packages != '') {
|
|
| 513 | - $pricearr = explode(',', trim($field_info->packages, ','));
|
|
| 514 | - } else {
|
|
| 515 | - $package_info = array(); |
|
| 511 | + $pricearr = array(); |
|
| 512 | + if (isset($field_info->packages) && $field_info->packages != '') {
|
|
| 513 | + $pricearr = explode(',', trim($field_info->packages, ','));
|
|
| 514 | + } else {
|
|
| 515 | + $package_info = array(); |
|
| 516 | 516 | |
| 517 | - $package_info = geodir_post_package_info($package_info, '', $post_type); |
|
| 518 | - $pricearr[] = $package_info->pid; |
|
| 519 | - } |
|
| 517 | + $package_info = geodir_post_package_info($package_info, '', $post_type); |
|
| 518 | + $pricearr[] = $package_info->pid; |
|
| 519 | + } |
|
| 520 | 520 | |
| 521 | - ob_start() |
|
| 522 | - ?> |
|
| 521 | + ob_start() |
|
| 522 | + ?> |
|
| 523 | 523 | |
| 524 | 524 | <select style="display:none" name="show_on_pkg[]" id="show_on_pkg" multiple="multiple"> |
| 525 | 525 | <?php |
| 526 | - if (!empty($pricearr)) {
|
|
| 527 | - foreach ($pricearr as $val) {
|
|
| 528 | - ?> |
|
| 526 | + if (!empty($pricearr)) {
|
|
| 527 | + foreach ($pricearr as $val) {
|
|
| 528 | + ?> |
|
| 529 | 529 | <option selected="selected" value="<?php echo esc_attr($val); ?>" ><?php echo $val; ?></option><?php |
| 530 | - } |
|
| 531 | - } |
|
| 532 | - ?> |
|
| 530 | + } |
|
| 531 | + } |
|
| 532 | + ?> |
|
| 533 | 533 | </select> |
| 534 | 534 | |
| 535 | 535 | <?php |
| 536 | - $html = ob_get_clean(); |
|
| 536 | + $html = ob_get_clean(); |
|
| 537 | 537 | |
| 538 | 538 | /** |
| 539 | 539 | * Filter the price packages list. |
| 540 | 540 | * |
| 541 | 541 | * Filter the price packages list in custom field form in admin |
| 542 | - * custom fields settings. |
|
| 542 | + * custom fields settings. |
|
| 543 | 543 | * |
| 544 | 544 | * @since 1.0.0 |
| 545 | 545 | * |
@@ -548,25 +548,25 @@ discard block |
||
| 548 | 548 | */ |
| 549 | 549 | echo $html = apply_filters('geodir_packages_list_on_custom_fields', $html, $field_info);
|
| 550 | 550 | |
| 551 | - ?> |
|
| 551 | + ?> |
|
| 552 | 552 | |
| 553 | 553 | |
| 554 | 554 | |
| 555 | 555 | <?php |
| 556 | 556 | |
| 557 | - // is_required |
|
| 558 | - if(has_filter("geodir_cfa_is_required_{$field_type}")){
|
|
| 557 | + // is_required |
|
| 558 | + if(has_filter("geodir_cfa_is_required_{$field_type}")){
|
|
| 559 | 559 | |
| 560 | - echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 560 | + echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 561 | 561 | |
| 562 | - }else{
|
|
| 563 | - $value = ''; |
|
| 564 | - if (isset($field_info->is_required)) {
|
|
| 565 | - $value = esc_attr($field_info->is_required); |
|
| 566 | - }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
|
|
| 567 | - $value = $cf['defaults']['is_required']; |
|
| 568 | - } |
|
| 569 | - ?> |
|
| 562 | + }else{
|
|
| 563 | + $value = ''; |
|
| 564 | + if (isset($field_info->is_required)) {
|
|
| 565 | + $value = esc_attr($field_info->is_required); |
|
| 566 | + }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
|
|
| 567 | + $value = $cf['defaults']['is_required']; |
|
| 568 | + } |
|
| 569 | + ?> |
|
| 570 | 570 | <li> |
| 571 | 571 | <label for="is_required" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is required :', 'geodirectory'); ?>
|
| 572 | 572 | <div class="gdcf-tooltip"> |
@@ -578,14 +578,14 @@ discard block |
||
| 578 | 578 | |
| 579 | 579 | <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled" value="1" |
| 580 | 580 | <?php if ($value == '1') {
|
| 581 | - echo 'checked'; |
|
| 582 | - } ?>/> |
|
| 581 | + echo 'checked'; |
|
| 582 | + } ?>/> |
|
| 583 | 583 | <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 584 | 584 | |
| 585 | 585 | <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0" |
| 586 | 586 | <?php if ($value == '0' || !$value) {
|
| 587 | - echo 'checked'; |
|
| 588 | - } ?>/> |
|
| 587 | + echo 'checked'; |
|
| 588 | + } ?>/> |
|
| 589 | 589 | <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 590 | 590 | |
| 591 | 591 | </div> |
@@ -593,21 +593,21 @@ discard block |
||
| 593 | 593 | </li> |
| 594 | 594 | |
| 595 | 595 | <?php |
| 596 | - } |
|
| 596 | + } |
|
| 597 | 597 | |
| 598 | - // required_msg |
|
| 599 | - if(has_filter("geodir_cfa_required_msg_{$field_type}")){
|
|
| 598 | + // required_msg |
|
| 599 | + if(has_filter("geodir_cfa_required_msg_{$field_type}")){
|
|
| 600 | 600 | |
| 601 | - echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 601 | + echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 602 | 602 | |
| 603 | - }else{
|
|
| 604 | - $value = ''; |
|
| 605 | - if (isset($field_info->required_msg)) {
|
|
| 606 | - $value = esc_attr($field_info->required_msg); |
|
| 607 | - }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
|
|
| 608 | - $value = $cf['defaults']['required_msg']; |
|
| 609 | - } |
|
| 610 | - ?> |
|
| 603 | + }else{
|
|
| 604 | + $value = ''; |
|
| 605 | + if (isset($field_info->required_msg)) {
|
|
| 606 | + $value = esc_attr($field_info->required_msg); |
|
| 607 | + }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
|
|
| 608 | + $value = $cf['defaults']['required_msg']; |
|
| 609 | + } |
|
| 610 | + ?> |
|
| 611 | 611 | <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>>
|
| 612 | 612 | <label for="required_msg" class="gd-cf-tooltip-wrap"> |
| 613 | 613 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
|
@@ -621,38 +621,38 @@ discard block |
||
| 621 | 621 | </div> |
| 622 | 622 | </li> |
| 623 | 623 | <?php |
| 624 | - } |
|
| 624 | + } |
|
| 625 | 625 | |
| 626 | 626 | |
| 627 | - // required_msg |
|
| 628 | - if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
|
|
| 627 | + // required_msg |
|
| 628 | + if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
|
|
| 629 | 629 | |
| 630 | - echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 630 | + echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 631 | 631 | |
| 632 | - } |
|
| 632 | + } |
|
| 633 | 633 | |
| 634 | 634 | |
| 635 | - // extra_fields |
|
| 636 | - if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
|
|
| 635 | + // extra_fields |
|
| 636 | + if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
|
|
| 637 | 637 | |
| 638 | - echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 638 | + echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 639 | 639 | |
| 640 | - } |
|
| 640 | + } |
|
| 641 | 641 | |
| 642 | 642 | |
| 643 | - // field_icon |
|
| 644 | - if(has_filter("geodir_cfa_field_icon_{$field_type}")){
|
|
| 643 | + // field_icon |
|
| 644 | + if(has_filter("geodir_cfa_field_icon_{$field_type}")){
|
|
| 645 | 645 | |
| 646 | - echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 646 | + echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 647 | 647 | |
| 648 | - }else{
|
|
| 649 | - $value = ''; |
|
| 650 | - if (isset($field_info->field_icon)) {
|
|
| 651 | - $value = esc_attr($field_info->field_icon); |
|
| 652 | - }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
|
|
| 653 | - $value = $cf['defaults']['field_icon']; |
|
| 654 | - } |
|
| 655 | - ?> |
|
| 648 | + }else{
|
|
| 649 | + $value = ''; |
|
| 650 | + if (isset($field_info->field_icon)) {
|
|
| 651 | + $value = esc_attr($field_info->field_icon); |
|
| 652 | + }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
|
|
| 653 | + $value = $cf['defaults']['field_icon']; |
|
| 654 | + } |
|
| 655 | + ?> |
|
| 656 | 656 | <li> |
| 657 | 657 | <h3><?php echo __('Custom css', 'geodirectory'); ?></h3>
|
| 658 | 658 | |
@@ -670,22 +670,22 @@ discard block |
||
| 670 | 670 | |
| 671 | 671 | </li> |
| 672 | 672 | <?php |
| 673 | - } |
|
| 673 | + } |
|
| 674 | 674 | |
| 675 | 675 | |
| 676 | - // css_class |
|
| 677 | - if(has_filter("geodir_cfa_css_class_{$field_type}")){
|
|
| 676 | + // css_class |
|
| 677 | + if(has_filter("geodir_cfa_css_class_{$field_type}")){
|
|
| 678 | 678 | |
| 679 | - echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 679 | + echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 680 | 680 | |
| 681 | - }else{
|
|
| 682 | - $value = ''; |
|
| 683 | - if (isset($field_info->css_class)) {
|
|
| 684 | - $value = esc_attr($field_info->css_class); |
|
| 685 | - }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
|
|
| 686 | - $value = $cf['defaults']['css_class']; |
|
| 687 | - } |
|
| 688 | - ?> |
|
| 681 | + }else{
|
|
| 682 | + $value = ''; |
|
| 683 | + if (isset($field_info->css_class)) {
|
|
| 684 | + $value = esc_attr($field_info->css_class); |
|
| 685 | + }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
|
|
| 686 | + $value = $cf['defaults']['css_class']; |
|
| 687 | + } |
|
| 688 | + ?> |
|
| 689 | 689 | <li> |
| 690 | 690 | |
| 691 | 691 | <label for="css_class" class="gd-cf-tooltip-wrap"> |
@@ -698,47 +698,47 @@ discard block |
||
| 698 | 698 | <div class="gd-cf-input-wrap"> |
| 699 | 699 | <input type="text" name="css_class" id="css_class" |
| 700 | 700 | value="<?php if (isset($field_info->css_class)) {
|
| 701 | - echo esc_attr($field_info->css_class); |
|
| 702 | - }?>"/> |
|
| 701 | + echo esc_attr($field_info->css_class); |
|
| 702 | + }?>"/> |
|
| 703 | 703 | </div> |
| 704 | 704 | </li> |
| 705 | 705 | <?php |
| 706 | - } |
|
| 706 | + } |
|
| 707 | 707 | |
| 708 | 708 | |
| 709 | - // cat_sort |
|
| 710 | - if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
|
|
| 709 | + // cat_sort |
|
| 710 | + if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
|
|
| 711 | 711 | |
| 712 | - echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 712 | + echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 713 | 713 | |
| 714 | - }else{
|
|
| 715 | - $value = ''; |
|
| 716 | - $hide_cat_sort =''; |
|
| 717 | - if (isset($field_info->cat_sort)) {
|
|
| 718 | - $value = esc_attr($field_info->cat_sort); |
|
| 719 | - }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
|
|
| 720 | - $value = $cf['defaults']['cat_sort']; |
|
| 721 | - $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
|
| 722 | - } |
|
| 714 | + }else{
|
|
| 715 | + $value = ''; |
|
| 716 | + $hide_cat_sort =''; |
|
| 717 | + if (isset($field_info->cat_sort)) {
|
|
| 718 | + $value = esc_attr($field_info->cat_sort); |
|
| 719 | + }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
|
|
| 720 | + $value = $cf['defaults']['cat_sort']; |
|
| 721 | + $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
|
| 722 | + } |
|
| 723 | 723 | |
| 724 | - $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : ''; |
|
| 725 | - ?> |
|
| 724 | + $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : ''; |
|
| 725 | + ?> |
|
| 726 | 726 | <li <?php echo $hide_cat_sort ;?>> |
| 727 | 727 | <h3><?php |
| 728 | - /** |
|
| 729 | - * Filter the section title. |
|
| 730 | - * |
|
| 731 | - * Filter the section title in custom field form in admin |
|
| 732 | - * custom fields settings. |
|
| 733 | - * |
|
| 734 | - * @since 1.0.0 |
|
| 735 | - * |
|
| 736 | - * @param string $title Title of the section. |
|
| 737 | - * @param string $field_type Current field type. |
|
| 738 | - */ |
|
| 739 | - echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
|
|
| 740 | - |
|
| 741 | - ?></h3> |
|
| 728 | + /** |
|
| 729 | + * Filter the section title. |
|
| 730 | + * |
|
| 731 | + * Filter the section title in custom field form in admin |
|
| 732 | + * custom fields settings. |
|
| 733 | + * |
|
| 734 | + * @since 1.0.0 |
|
| 735 | + * |
|
| 736 | + * @param string $title Title of the section. |
|
| 737 | + * @param string $field_type Current field type. |
|
| 738 | + */ |
|
| 739 | + echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
|
|
| 740 | + |
|
| 741 | + ?></h3> |
|
| 742 | 742 | <label for="cat_sort" class="gd-cf-tooltip-wrap"> |
| 743 | 743 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
|
| 744 | 744 | <div class="gdcf-tooltip"> |
@@ -750,42 +750,42 @@ discard block |
||
| 750 | 750 | |
| 751 | 751 | <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled" value="1" |
| 752 | 752 | <?php if ($value == '1') {
|
| 753 | - echo 'checked'; |
|
| 754 | - } ?>/> |
|
| 753 | + echo 'checked'; |
|
| 754 | + } ?>/> |
|
| 755 | 755 | <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 756 | 756 | |
| 757 | 757 | <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0" |
| 758 | 758 | <?php if (!$value) {
|
| 759 | - echo 'checked'; |
|
| 760 | - } ?>/> |
|
| 759 | + echo 'checked'; |
|
| 760 | + } ?>/> |
|
| 761 | 761 | <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 762 | 762 | |
| 763 | 763 | </div> |
| 764 | 764 | </li> |
| 765 | 765 | <?php |
| 766 | - } |
|
| 767 | - |
|
| 768 | - |
|
| 769 | - |
|
| 770 | - switch ($field_type): |
|
| 771 | - case 'html': |
|
| 772 | - case 'file': |
|
| 773 | - case 'url': |
|
| 774 | - case 'fieldset': |
|
| 775 | - break; |
|
| 776 | - default: |
|
| 777 | - |
|
| 778 | - /** |
|
| 779 | - * Called at the end of the advanced custom fields settings page loop. |
|
| 780 | - * |
|
| 781 | - * Can be used to add or deal with different settings types. |
|
| 782 | - * |
|
| 783 | - * @since 1.0.0 |
|
| 784 | - * @since 1.6.6 $cf param added. |
|
| 785 | - * @param object $field_info The current fields info. |
|
| 786 | - * @param array $cf The custom field settings |
|
| 787 | - */ |
|
| 788 | - do_action('geodir_advance_custom_fields', $field_info,$cf);?>
|
|
| 766 | + } |
|
| 767 | + |
|
| 768 | + |
|
| 769 | + |
|
| 770 | + switch ($field_type): |
|
| 771 | + case 'html': |
|
| 772 | + case 'file': |
|
| 773 | + case 'url': |
|
| 774 | + case 'fieldset': |
|
| 775 | + break; |
|
| 776 | + default: |
|
| 777 | + |
|
| 778 | + /** |
|
| 779 | + * Called at the end of the advanced custom fields settings page loop. |
|
| 780 | + * |
|
| 781 | + * Can be used to add or deal with different settings types. |
|
| 782 | + * |
|
| 783 | + * @since 1.0.0 |
|
| 784 | + * @since 1.6.6 $cf param added. |
|
| 785 | + * @param object $field_info The current fields info. |
|
| 786 | + * @param array $cf The custom field settings |
|
| 787 | + */ |
|
| 788 | + do_action('geodir_advance_custom_fields', $field_info,$cf);?>
|
|
| 789 | 789 | |
| 790 | 790 | |
| 791 | 791 | <?php endswitch; ?> |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | $cf = (isset($cf_arr[$field_type_key])) ? $cf_arr[$field_type_key] : ''; |
| 40 | 40 | |
| 41 | 41 | |
| 42 | -if(isset($field_info->extra_fields)){$extra_fields = $field_info->extra_fields;}
|
|
| 42 | +if (isset($field_info->extra_fields)) {$extra_fields = $field_info->extra_fields; }
|
|
| 43 | 43 | $field_info = stripslashes_deep($field_info); // strip slashes from labels |
| 44 | -if(isset($field_info->extra_fields)){$field_info->extra_fields = $extra_fields;}
|
|
| 44 | +if (isset($field_info->extra_fields)) {$field_info->extra_fields = $extra_fields; }
|
|
| 45 | 45 | |
| 46 | 46 | |
| 47 | -$nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 47 | +$nonce = wp_create_nonce('custom_fields_'.$result_str);
|
|
| 48 | 48 | |
| 49 | 49 | $field_admin_title = ''; |
| 50 | 50 | if (isset($field_info->admin_title)) |
@@ -69,15 +69,15 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
|
| 71 | 71 | $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
| 72 | -}elseif(isset($cf['icon']) && $cf['icon']){
|
|
| 72 | +}elseif (isset($cf['icon']) && $cf['icon']) {
|
|
| 73 | 73 | $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
|
| 74 | -}else{
|
|
| 74 | +} else {
|
|
| 75 | 75 | $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | -if(isset($cf['name']) && $cf['name']){
|
|
| 78 | +if (isset($cf['name']) && $cf['name']) {
|
|
| 79 | 79 | $field_type_name = $cf['name']; |
| 80 | -}else{
|
|
| 80 | +} else {
|
|
| 81 | 81 | $field_type_name = $field_type; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
|
| 89 | 89 | <?php |
| 90 | 90 | |
| 91 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 91 | + $nonce = wp_create_nonce('custom_fields_'.$result_str);
|
|
| 92 | 92 | ?> |
| 93 | 93 | |
| 94 | 94 | <?php if ($default): ?> |
@@ -103,12 +103,12 @@ discard block |
||
| 103 | 103 | <i class="fa fa-long-arrow-left " aria-hidden="true"></i> |
| 104 | 104 | <i class="fa fa-long-arrow-right " aria-hidden="true"></i> |
| 105 | 105 | <b style="cursor:pointer;" |
| 106 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
|
|
| 106 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory').' '.$field_admin_title); ?></b>
|
|
| 107 | 107 | <?php |
| 108 | 108 | } else {echo $field_icon;
|
| 109 | 109 | ?> |
| 110 | 110 | <b style="cursor:pointer;" |
| 111 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b>
|
|
| 111 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(' '.$field_admin_title.' ('.$field_type_name.')'); ?></b>
|
|
| 112 | 112 | <?php |
| 113 | 113 | } |
| 114 | 114 | ?> |
@@ -131,43 +131,43 @@ discard block |
||
| 131 | 131 | } ?>"/> |
| 132 | 132 | <input type="hidden" name="is_active" id="is_active" value="1"/> |
| 133 | 133 | |
| 134 | - <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?> |
|
| 135 | - <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" /> |
|
| 136 | - <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" /> |
|
| 137 | - <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : '';?>" /> |
|
| 134 | + <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : ''; ?>" /><?php // show in sidebar value?> |
|
| 135 | + <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" /> |
|
| 136 | + <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" /> |
|
| 137 | + <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : ''; ?>" /> |
|
| 138 | 138 | |
| 139 | 139 | <ul class="widefat post fixed" border="0" style="width:100%;"> |
| 140 | 140 | |
| 141 | 141 | <?php |
| 142 | 142 | |
| 143 | 143 | // data_type |
| 144 | - if(has_filter("geodir_cfa_data_type_{$field_type}")){
|
|
| 144 | + if (has_filter("geodir_cfa_data_type_{$field_type}")) {
|
|
| 145 | 145 | |
| 146 | - echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 146 | + echo apply_filters("geodir_cfa_data_type_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 147 | 147 | |
| 148 | - }else{
|
|
| 148 | + } else {
|
|
| 149 | 149 | $value = ''; |
| 150 | 150 | if (isset($field_info->data_type)) {
|
| 151 | 151 | $value = esc_attr($field_info->data_type); |
| 152 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 152 | + }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) {
|
|
| 153 | 153 | $value = $cf['defaults']['data_type']; |
| 154 | 154 | } |
| 155 | 155 | ?> |
| 156 | - <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/> |
|
| 156 | + <input type="hidden" name="data_type" id="data_type" value="<?php echo $value; ?>"/> |
|
| 157 | 157 | <?php |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | |
| 161 | 161 | // admin_title |
| 162 | - if(has_filter("geodir_cfa_admin_title_{$field_type}")){
|
|
| 162 | + if (has_filter("geodir_cfa_admin_title_{$field_type}")) {
|
|
| 163 | 163 | |
| 164 | - echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 164 | + echo apply_filters("geodir_cfa_admin_title_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 165 | 165 | |
| 166 | - }else{
|
|
| 166 | + } else {
|
|
| 167 | 167 | $value = ''; |
| 168 | 168 | if (isset($field_info->admin_title)) {
|
| 169 | 169 | $value = esc_attr($field_info->admin_title); |
| 170 | - }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
|
|
| 170 | + }elseif (isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']) {
|
|
| 171 | 171 | $value = $cf['defaults']['admin_title']; |
| 172 | 172 | } |
| 173 | 173 | ?> |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | </label> |
| 181 | 181 | <div class="gd-cf-input-wrap"> |
| 182 | 182 | <input type="text" name="admin_title" id="admin_title" |
| 183 | - value="<?php echo $value;?>"/> |
|
| 183 | + value="<?php echo $value; ?>"/> |
|
| 184 | 184 | </div> |
| 185 | 185 | </li> |
| 186 | 186 | <?php |
@@ -188,15 +188,15 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | |
| 190 | 190 | // site_title |
| 191 | - if(has_filter("geodir_cfa_site_title_{$field_type}")){
|
|
| 191 | + if (has_filter("geodir_cfa_site_title_{$field_type}")) {
|
|
| 192 | 192 | |
| 193 | - echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 193 | + echo apply_filters("geodir_cfa_site_title_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 194 | 194 | |
| 195 | - }else{
|
|
| 195 | + } else {
|
|
| 196 | 196 | $value = ''; |
| 197 | 197 | if (isset($field_info->site_title)) {
|
| 198 | 198 | $value = esc_attr($field_info->site_title); |
| 199 | - }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
|
|
| 199 | + }elseif (isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']) {
|
|
| 200 | 200 | $value = $cf['defaults']['site_title']; |
| 201 | 201 | } |
| 202 | 202 | ?> |
@@ -216,15 +216,15 @@ discard block |
||
| 216 | 216 | |
| 217 | 217 | |
| 218 | 218 | // admin_desc |
| 219 | - if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
|
|
| 219 | + if (has_filter("geodir_cfa_admin_desc_{$field_type}")) {
|
|
| 220 | 220 | |
| 221 | - echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 221 | + echo apply_filters("geodir_cfa_admin_desc_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 222 | 222 | |
| 223 | - }else{
|
|
| 223 | + } else {
|
|
| 224 | 224 | $value = ''; |
| 225 | 225 | if (isset($field_info->admin_desc)) {
|
| 226 | 226 | $value = esc_attr($field_info->admin_desc); |
| 227 | - }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
|
|
| 227 | + }elseif (isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']) {
|
|
| 228 | 228 | $value = $cf['defaults']['admin_desc']; |
| 229 | 229 | } |
| 230 | 230 | ?> |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | </div> |
| 236 | 236 | </label> |
| 237 | 237 | <div class="gd-cf-input-wrap"> |
| 238 | - <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value;?>"/> |
|
| 238 | + <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value; ?>"/> |
|
| 239 | 239 | </div> |
| 240 | 240 | </li> |
| 241 | 241 | <?php |
@@ -244,26 +244,26 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | |
| 246 | 246 | // htmlvar_name |
| 247 | - if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
|
|
| 247 | + if (has_filter("geodir_cfa_htmlvar_name_{$field_type}")) {
|
|
| 248 | 248 | |
| 249 | - echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 249 | + echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 250 | 250 | |
| 251 | - }else{
|
|
| 251 | + } else {
|
|
| 252 | 252 | $value = ''; |
| 253 | 253 | if (isset($field_info->htmlvar_name)) {
|
| 254 | 254 | $value = esc_attr($field_info->htmlvar_name); |
| 255 | - }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
|
|
| 255 | + }elseif (isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']) {
|
|
| 256 | 256 | $value = $cf['defaults']['htmlvar_name']; |
| 257 | 257 | } |
| 258 | 258 | ?> |
| 259 | 259 | <li> |
| 260 | - <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?>
|
|
| 260 | + <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory'); ?>
|
|
| 261 | 261 | <div class="gdcf-tooltip"> |
| 262 | 262 | <?php _e('This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.', 'geodirectory'); ?>
|
| 263 | 263 | </div> |
| 264 | 264 | </label> |
| 265 | 265 | <div class="gd-cf-input-wrap"> |
| 266 | - <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>"
|
|
| 266 | + <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory'); ?>"
|
|
| 267 | 267 | value="<?php if ($value) {
|
| 268 | 268 | echo preg_replace('/geodir_/', '', $value, 1);
|
| 269 | 269 | }?>" <?php if ($default) {
|
@@ -276,15 +276,15 @@ discard block |
||
| 276 | 276 | |
| 277 | 277 | |
| 278 | 278 | // is_active |
| 279 | - if(has_filter("geodir_cfa_is_active_{$field_type}")){
|
|
| 279 | + if (has_filter("geodir_cfa_is_active_{$field_type}")) {
|
|
| 280 | 280 | |
| 281 | - echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 281 | + echo apply_filters("geodir_cfa_is_active_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 282 | 282 | |
| 283 | - }else{
|
|
| 283 | + } else {
|
|
| 284 | 284 | $value = ''; |
| 285 | 285 | if (isset($field_info->is_active)) {
|
| 286 | 286 | $value = esc_attr($field_info->is_active); |
| 287 | - }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
|
|
| 287 | + }elseif (isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']) {
|
|
| 288 | 288 | $value = $cf['defaults']['is_active']; |
| 289 | 289 | } |
| 290 | 290 | ?> |
@@ -296,17 +296,17 @@ discard block |
||
| 296 | 296 | </label> |
| 297 | 297 | <div class="gd-cf-input-wrap gd-switch"> |
| 298 | 298 | |
| 299 | - <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
|
| 299 | + <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled" value="1" |
|
| 300 | 300 | <?php if ($value == '1') {
|
| 301 | 301 | echo 'checked'; |
| 302 | 302 | } ?>/> |
| 303 | - <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 303 | + <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 304 | 304 | |
| 305 | - <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
|
| 305 | + <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0" |
|
| 306 | 306 | <?php if ($value == '0' || !$value) {
|
| 307 | 307 | echo 'checked'; |
| 308 | 308 | } ?>/> |
| 309 | - <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 309 | + <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 310 | 310 | |
| 311 | 311 | </div> |
| 312 | 312 | </li> |
@@ -315,15 +315,15 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | |
| 317 | 317 | // for_admin_use |
| 318 | - if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
|
|
| 318 | + if (has_filter("geodir_cfa_for_admin_use_{$field_type}")) {
|
|
| 319 | 319 | |
| 320 | - echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 320 | + echo apply_filters("geodir_cfa_for_admin_use_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 321 | 321 | |
| 322 | - }else{
|
|
| 322 | + } else {
|
|
| 323 | 323 | $value = ''; |
| 324 | 324 | if (isset($field_info->for_admin_use)) {
|
| 325 | 325 | $value = esc_attr($field_info->for_admin_use); |
| 326 | - }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
|
|
| 326 | + }elseif (isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']) {
|
|
| 327 | 327 | $value = $cf['defaults']['for_admin_use']; |
| 328 | 328 | } |
| 329 | 329 | ?> |
@@ -335,17 +335,17 @@ discard block |
||
| 335 | 335 | </label> |
| 336 | 336 | <div class="gd-cf-input-wrap gd-switch"> |
| 337 | 337 | |
| 338 | - <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled" value="1" |
|
| 338 | + <input type="radio" id="for_admin_use_yes<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-enabled" value="1" |
|
| 339 | 339 | <?php if ($value == '1') {
|
| 340 | 340 | echo 'checked'; |
| 341 | 341 | } ?>/> |
| 342 | - <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 342 | + <label for="for_admin_use_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 343 | 343 | |
| 344 | - <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0" |
|
| 344 | + <input type="radio" id="for_admin_use_no<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-disabled" value="0" |
|
| 345 | 345 | <?php if ($value == '0' || !$value) {
|
| 346 | 346 | echo 'checked'; |
| 347 | 347 | } ?>/> |
| 348 | - <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 348 | + <label for="for_admin_use_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 349 | 349 | |
| 350 | 350 | </div> |
| 351 | 351 | </li> |
@@ -354,20 +354,20 @@ discard block |
||
| 354 | 354 | |
| 355 | 355 | |
| 356 | 356 | // default_value |
| 357 | - if(has_filter("geodir_cfa_default_value_{$field_type}")){
|
|
| 357 | + if (has_filter("geodir_cfa_default_value_{$field_type}")) {
|
|
| 358 | 358 | |
| 359 | - echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 359 | + echo apply_filters("geodir_cfa_default_value_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 360 | 360 | |
| 361 | - }else{
|
|
| 361 | + } else {
|
|
| 362 | 362 | $value = ''; |
| 363 | 363 | if (isset($field_info->default_value)) {
|
| 364 | 364 | $value = esc_attr($field_info->default_value); |
| 365 | - }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
|
|
| 365 | + }elseif (isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']) {
|
|
| 366 | 366 | $value = $cf['defaults']['default_value']; |
| 367 | 367 | } |
| 368 | 368 | ?> |
| 369 | 369 | <li> |
| 370 | - <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
|
|
| 370 | + <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory'); ?>
|
|
| 371 | 371 | <div class="gdcf-tooltip"> |
| 372 | 372 | <?php |
| 373 | 373 | if ($field_type == 'checkbox') {
|
@@ -384,12 +384,12 @@ discard block |
||
| 384 | 384 | <?php if ($field_type == 'checkbox') { ?>
|
| 385 | 385 | <select name="default_value" id="default_value"> |
| 386 | 386 | <option value=""><?php _e('Unchecked', 'geodirectory'); ?></option>
|
| 387 | - <option value="1" <?php selected(true, (int)$value === 1);?>><?php _e('Checked', 'geodirectory'); ?></option>
|
|
| 387 | + <option value="1" <?php selected(true, (int) $value === 1); ?>><?php _e('Checked', 'geodirectory'); ?></option>
|
|
| 388 | 388 | </select> |
| 389 | 389 | <?php } else if ($field_type == 'email') { ?>
|
| 390 | - <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory') ;?>" id="default_value" value="<?php echo esc_attr($value);?>" /><br/>
|
|
| 390 | + <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory'); ?>" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/>
|
|
| 391 | 391 | <?php } else { ?>
|
| 392 | - <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value);?>" /><br/> |
|
| 392 | + <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/> |
|
| 393 | 393 | <?php } ?> |
| 394 | 394 | </div> |
| 395 | 395 | </li> |
@@ -398,15 +398,15 @@ discard block |
||
| 398 | 398 | |
| 399 | 399 | |
| 400 | 400 | // show_in |
| 401 | - if(has_filter("geodir_cfa_show_in_{$field_type}")){
|
|
| 401 | + if (has_filter("geodir_cfa_show_in_{$field_type}")) {
|
|
| 402 | 402 | |
| 403 | - echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 403 | + echo apply_filters("geodir_cfa_show_in_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 404 | 404 | |
| 405 | - }else{
|
|
| 405 | + } else {
|
|
| 406 | 406 | $value = ''; |
| 407 | 407 | if (isset($field_info->show_in)) {
|
| 408 | 408 | $value = esc_attr($field_info->show_in); |
| 409 | - }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
|
|
| 409 | + }elseif (isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']) {
|
|
| 410 | 410 | $value = esc_attr($cf['defaults']['show_in']); |
| 411 | 411 | } |
| 412 | 412 | ?> |
@@ -439,18 +439,18 @@ discard block |
||
| 439 | 439 | * @param object $field_info The field being displayed info. |
| 440 | 440 | * @param string $field_info The type of field. |
| 441 | 441 | */ |
| 442 | - $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
|
|
| 442 | + $show_in_locations = apply_filters('geodir_show_in_locations', $show_in_locations, $field_info, $field_type);
|
|
| 443 | 443 | |
| 444 | 444 | |
| 445 | 445 | // remove some locations for some field types |
| 446 | 446 | |
| 447 | 447 | // don't show new tab option for some types |
| 448 | - if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
|
|
| 449 | - }else{
|
|
| 448 | + if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) {
|
|
| 449 | + } else {
|
|
| 450 | 450 | unset($show_in_locations['[owntab]']); |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | - if(!$display_on_listing){
|
|
| 453 | + if (!$display_on_listing) {
|
|
| 454 | 454 | unset($show_in_locations['[listings]']); |
| 455 | 455 | } |
| 456 | 456 | |
@@ -464,17 +464,17 @@ discard block |
||
| 464 | 464 | option-ajaxchosen="false"> |
| 465 | 465 | <?php |
| 466 | 466 | |
| 467 | - $show_in_values = explode(',',$value);
|
|
| 467 | + $show_in_values = explode(',', $value);
|
|
| 468 | 468 | |
| 469 | - foreach( $show_in_locations as $key => $val){
|
|
| 469 | + foreach ($show_in_locations as $key => $val) {
|
|
| 470 | 470 | $selected = ''; |
| 471 | 471 | |
| 472 | - if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
|
|
| 472 | + if (is_array($show_in_values) && in_array($key, $show_in_values)) {
|
|
| 473 | 473 | $selected = 'selected'; |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | ?> |
| 477 | - <option value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option> |
|
| 477 | + <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $val; ?></option> |
|
| 478 | 478 | <?php |
| 479 | 479 | } |
| 480 | 480 | ?> |
@@ -486,9 +486,9 @@ discard block |
||
| 486 | 486 | |
| 487 | 487 | |
| 488 | 488 | // advanced_editor |
| 489 | - if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
|
|
| 489 | + if (has_filter("geodir_cfa_advanced_editor_{$field_type}")) {
|
|
| 490 | 490 | |
| 491 | - echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 491 | + echo apply_filters("geodir_cfa_advanced_editor_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 492 | 492 | |
| 493 | 493 | } |
| 494 | 494 | |
@@ -499,10 +499,10 @@ discard block |
||
| 499 | 499 | |
| 500 | 500 | |
| 501 | 501 | <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?> |
| 502 | - <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels);} ?>"/>
|
|
| 502 | + <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels); } ?>"/>
|
|
| 503 | 503 | |
| 504 | 504 | <?php // we dont need to show the sort order ?> |
| 505 | - <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order);} ?>"/>
|
|
| 505 | + <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order); } ?>"/>
|
|
| 506 | 506 | |
| 507 | 507 | |
| 508 | 508 | |
@@ -555,15 +555,15 @@ discard block |
||
| 555 | 555 | <?php |
| 556 | 556 | |
| 557 | 557 | // is_required |
| 558 | - if(has_filter("geodir_cfa_is_required_{$field_type}")){
|
|
| 558 | + if (has_filter("geodir_cfa_is_required_{$field_type}")) {
|
|
| 559 | 559 | |
| 560 | - echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 560 | + echo apply_filters("geodir_cfa_is_required_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 561 | 561 | |
| 562 | - }else{
|
|
| 562 | + } else {
|
|
| 563 | 563 | $value = ''; |
| 564 | 564 | if (isset($field_info->is_required)) {
|
| 565 | 565 | $value = esc_attr($field_info->is_required); |
| 566 | - }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
|
|
| 566 | + }elseif (isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']) {
|
|
| 567 | 567 | $value = $cf['defaults']['is_required']; |
| 568 | 568 | } |
| 569 | 569 | ?> |
@@ -576,17 +576,17 @@ discard block |
||
| 576 | 576 | |
| 577 | 577 | <div class="gd-cf-input-wrap gd-switch"> |
| 578 | 578 | |
| 579 | - <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled" value="1" |
|
| 579 | + <input type="radio" id="is_required_yes<?php echo $radio_id; ?>" name="is_required" class="gdri-enabled" value="1" |
|
| 580 | 580 | <?php if ($value == '1') {
|
| 581 | 581 | echo 'checked'; |
| 582 | 582 | } ?>/> |
| 583 | - <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 583 | + <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 584 | 584 | |
| 585 | - <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0" |
|
| 585 | + <input type="radio" id="is_required_no<?php echo $radio_id; ?>" name="is_required" class="gdri-disabled" value="0" |
|
| 586 | 586 | <?php if ($value == '0' || !$value) {
|
| 587 | 587 | echo 'checked'; |
| 588 | 588 | } ?>/> |
| 589 | - <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 589 | + <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 590 | 590 | |
| 591 | 591 | </div> |
| 592 | 592 | |
@@ -596,19 +596,19 @@ discard block |
||
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | // required_msg |
| 599 | - if(has_filter("geodir_cfa_required_msg_{$field_type}")){
|
|
| 599 | + if (has_filter("geodir_cfa_required_msg_{$field_type}")) {
|
|
| 600 | 600 | |
| 601 | - echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 601 | + echo apply_filters("geodir_cfa_required_msg_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 602 | 602 | |
| 603 | - }else{
|
|
| 603 | + } else {
|
|
| 604 | 604 | $value = ''; |
| 605 | 605 | if (isset($field_info->required_msg)) {
|
| 606 | 606 | $value = esc_attr($field_info->required_msg); |
| 607 | - }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
|
|
| 607 | + }elseif (isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']) {
|
|
| 608 | 608 | $value = $cf['defaults']['required_msg']; |
| 609 | 609 | } |
| 610 | 610 | ?> |
| 611 | - <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>>
|
|
| 611 | + <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'"; }?>>
|
|
| 612 | 612 | <label for="required_msg" class="gd-cf-tooltip-wrap"> |
| 613 | 613 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
|
| 614 | 614 | <div class="gdcf-tooltip"> |
@@ -625,31 +625,31 @@ discard block |
||
| 625 | 625 | |
| 626 | 626 | |
| 627 | 627 | // required_msg |
| 628 | - if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
|
|
| 628 | + if (has_filter("geodir_cfa_validation_pattern_{$field_type}")) {
|
|
| 629 | 629 | |
| 630 | - echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 630 | + echo apply_filters("geodir_cfa_validation_pattern_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 631 | 631 | |
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | |
| 635 | 635 | // extra_fields |
| 636 | - if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
|
|
| 636 | + if (has_filter("geodir_cfa_extra_fields_{$field_type}")) {
|
|
| 637 | 637 | |
| 638 | - echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 638 | + echo apply_filters("geodir_cfa_extra_fields_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 639 | 639 | |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | |
| 643 | 643 | // field_icon |
| 644 | - if(has_filter("geodir_cfa_field_icon_{$field_type}")){
|
|
| 644 | + if (has_filter("geodir_cfa_field_icon_{$field_type}")) {
|
|
| 645 | 645 | |
| 646 | - echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 646 | + echo apply_filters("geodir_cfa_field_icon_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 647 | 647 | |
| 648 | - }else{
|
|
| 648 | + } else {
|
|
| 649 | 649 | $value = ''; |
| 650 | 650 | if (isset($field_info->field_icon)) {
|
| 651 | 651 | $value = esc_attr($field_info->field_icon); |
| 652 | - }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
|
|
| 652 | + }elseif (isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']) {
|
|
| 653 | 653 | $value = $cf['defaults']['field_icon']; |
| 654 | 654 | } |
| 655 | 655 | ?> |
@@ -660,12 +660,12 @@ discard block |
||
| 660 | 660 | <label for="field_icon" class="gd-cf-tooltip-wrap"> |
| 661 | 661 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Upload icon :', 'geodirectory'); ?>
|
| 662 | 662 | <div class="gdcf-tooltip"> |
| 663 | - <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory');?>
|
|
| 663 | + <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory'); ?>
|
|
| 664 | 664 | </div> |
| 665 | 665 | </label> |
| 666 | 666 | <div class="gd-cf-input-wrap"> |
| 667 | 667 | <input type="text" name="field_icon" id="field_icon" |
| 668 | - value="<?php echo $value;?>"/> |
|
| 668 | + value="<?php echo $value; ?>"/> |
|
| 669 | 669 | </div> |
| 670 | 670 | |
| 671 | 671 | </li> |
@@ -674,15 +674,15 @@ discard block |
||
| 674 | 674 | |
| 675 | 675 | |
| 676 | 676 | // css_class |
| 677 | - if(has_filter("geodir_cfa_css_class_{$field_type}")){
|
|
| 677 | + if (has_filter("geodir_cfa_css_class_{$field_type}")) {
|
|
| 678 | 678 | |
| 679 | - echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 679 | + echo apply_filters("geodir_cfa_css_class_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 680 | 680 | |
| 681 | - }else{
|
|
| 681 | + } else {
|
|
| 682 | 682 | $value = ''; |
| 683 | 683 | if (isset($field_info->css_class)) {
|
| 684 | 684 | $value = esc_attr($field_info->css_class); |
| 685 | - }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
|
|
| 685 | + }elseif (isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']) {
|
|
| 686 | 686 | $value = $cf['defaults']['css_class']; |
| 687 | 687 | } |
| 688 | 688 | ?> |
@@ -691,8 +691,8 @@ discard block |
||
| 691 | 691 | <label for="css_class" class="gd-cf-tooltip-wrap"> |
| 692 | 692 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Css class :', 'geodirectory'); ?>
|
| 693 | 693 | <div class="gdcf-tooltip"> |
| 694 | - <?php _e('Enter custom css class for field custom style.', 'geodirectory');?>
|
|
| 695 | - <?php if($field_type=='multiselect'){_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory');}?>
|
|
| 694 | + <?php _e('Enter custom css class for field custom style.', 'geodirectory'); ?>
|
|
| 695 | + <?php if ($field_type == 'multiselect') {_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory'); }?>
|
|
| 696 | 696 | </div> |
| 697 | 697 | </label> |
| 698 | 698 | <div class="gd-cf-input-wrap"> |
@@ -707,23 +707,23 @@ discard block |
||
| 707 | 707 | |
| 708 | 708 | |
| 709 | 709 | // cat_sort |
| 710 | - if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
|
|
| 710 | + if (has_filter("geodir_cfa_cat_sort_{$field_type}")) {
|
|
| 711 | 711 | |
| 712 | - echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 712 | + echo apply_filters("geodir_cfa_cat_sort_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 713 | 713 | |
| 714 | - }else{
|
|
| 714 | + } else {
|
|
| 715 | 715 | $value = ''; |
| 716 | - $hide_cat_sort =''; |
|
| 716 | + $hide_cat_sort = ''; |
|
| 717 | 717 | if (isset($field_info->cat_sort)) {
|
| 718 | 718 | $value = esc_attr($field_info->cat_sort); |
| 719 | - }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
|
|
| 719 | + }elseif (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']) {
|
|
| 720 | 720 | $value = $cf['defaults']['cat_sort']; |
| 721 | - $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
|
| 721 | + $hide_cat_sort = ($value === false) ? "style='display:none;'" : ''; |
|
| 722 | 722 | } |
| 723 | 723 | |
| 724 | - $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : ''; |
|
| 724 | + $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort'] === false) ? "style='display:none;'" : ''; |
|
| 725 | 725 | ?> |
| 726 | - <li <?php echo $hide_cat_sort ;?>> |
|
| 726 | + <li <?php echo $hide_cat_sort; ?>> |
|
| 727 | 727 | <h3><?php |
| 728 | 728 | /** |
| 729 | 729 | * Filter the section title. |
@@ -742,23 +742,23 @@ discard block |
||
| 742 | 742 | <label for="cat_sort" class="gd-cf-tooltip-wrap"> |
| 743 | 743 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
|
| 744 | 744 | <div class="gdcf-tooltip"> |
| 745 | - <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory');?>
|
|
| 745 | + <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory'); ?>
|
|
| 746 | 746 | </div> |
| 747 | 747 | </label> |
| 748 | 748 | |
| 749 | 749 | <div class="gd-cf-input-wrap gd-switch"> |
| 750 | 750 | |
| 751 | - <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled" value="1" |
|
| 751 | + <input type="radio" id="cat_sort_yes<?php echo $radio_id; ?>" name="cat_sort" class="gdri-enabled" value="1" |
|
| 752 | 752 | <?php if ($value == '1') {
|
| 753 | 753 | echo 'checked'; |
| 754 | 754 | } ?>/> |
| 755 | - <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 755 | + <label for="cat_sort_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 756 | 756 | |
| 757 | - <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0" |
|
| 757 | + <input type="radio" id="cat_sort_no<?php echo $radio_id; ?>" name="cat_sort" class="gdri-disabled" value="0" |
|
| 758 | 758 | <?php if (!$value) {
|
| 759 | 759 | echo 'checked'; |
| 760 | 760 | } ?>/> |
| 761 | - <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 761 | + <label for="cat_sort_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 762 | 762 | |
| 763 | 763 | </div> |
| 764 | 764 | </li> |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | * @param object $field_info The current fields info. |
| 786 | 786 | * @param array $cf The custom field settings |
| 787 | 787 | */ |
| 788 | - do_action('geodir_advance_custom_fields', $field_info,$cf);?>
|
|
| 788 | + do_action('geodir_advance_custom_fields', $field_info, $cf); ?>
|
|
| 789 | 789 | |
| 790 | 790 | |
| 791 | 791 | <?php endswitch; ?> |
@@ -797,10 +797,10 @@ discard block |
||
| 797 | 797 | <h3></h3> |
| 798 | 798 | </label> |
| 799 | 799 | <div class="gd-cf-input-wrap"> |
| 800 | - <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
|
|
| 800 | + <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
|
|
| 801 | 801 | onclick="save_field('<?php echo esc_attr($result_str); ?>')"/>
|
| 802 | 802 | <?php if (!$default): ?> |
| 803 | - <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
|
|
| 803 | + <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
|
|
| 804 | 804 | onclick="delete_field('<?php echo esc_attr($result_str); ?>', '<?php echo $nonce; ?>')"
|
| 805 | 805 | class="button"/></a> |
| 806 | 806 | <?php endif; ?> |
@@ -19,8 +19,9 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | if (!isset($field_info->post_type)) {
|
| 21 | 21 | $post_type = sanitize_text_field($_REQUEST['listing_type']); |
| 22 | -} else |
|
| 23 | - $post_type = $field_info->post_type; |
|
| 22 | +} else { |
|
| 23 | + $post_type = $field_info->post_type; |
|
| 24 | +} |
|
| 24 | 25 | |
| 25 | 26 | //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){
|
| 26 | 27 | // $cf_arr = geodir_custom_fields_predefined($post_type); |
@@ -47,8 +48,9 @@ discard block |
||
| 47 | 48 | $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
| 48 | 49 | |
| 49 | 50 | $field_admin_title = ''; |
| 50 | -if (isset($field_info->admin_title)) |
|
| 51 | - $field_admin_title = $field_info->admin_title; |
|
| 51 | +if (isset($field_info->admin_title)) { |
|
| 52 | + $field_admin_title = $field_info->admin_title; |
|
| 53 | +} |
|
| 52 | 54 | |
| 53 | 55 | $default = isset($field_info->is_admin) ? $field_info->is_admin : ''; |
| 54 | 56 | |
@@ -69,15 +71,15 @@ discard block |
||
| 69 | 71 | |
| 70 | 72 | if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
|
| 71 | 73 | $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>'; |
| 72 | -}elseif(isset($cf['icon']) && $cf['icon']){
|
|
| 74 | +} elseif(isset($cf['icon']) && $cf['icon']){
|
|
| 73 | 75 | $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
|
| 74 | -}else{
|
|
| 76 | +} else{
|
|
| 75 | 77 | $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>'; |
| 76 | 78 | } |
| 77 | 79 | |
| 78 | 80 | if(isset($cf['name']) && $cf['name']){
|
| 79 | 81 | $field_type_name = $cf['name']; |
| 80 | -}else{
|
|
| 82 | +} else{
|
|
| 81 | 83 | $field_type_name = $field_type; |
| 82 | 84 | } |
| 83 | 85 | |
@@ -93,8 +95,11 @@ discard block |
||
| 93 | 95 | |
| 94 | 96 | <?php if ($default): ?> |
| 95 | 97 | <div title="<?php _e('Default field, should not be removed.', 'geodirectory'); ?>" class="handlediv move gd-default-remove"><i class="fa fa-times" aria-hidden="true"></i></div>
|
| 96 | - <?php else: ?> |
|
| 97 | - <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
|
|
| 98 | + <?php else { |
|
| 99 | + : ?> |
|
| 100 | + <div title="<?php _e('Click to remove field', 'geodirectory'); |
|
| 101 | +} |
|
| 102 | +?>" |
|
| 98 | 103 | onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
|
| 99 | 104 | class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div> |
| 100 | 105 | <?php endif; |
@@ -145,11 +150,11 @@ discard block |
||
| 145 | 150 | |
| 146 | 151 | echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
|
| 147 | 152 | |
| 148 | - }else{
|
|
| 153 | + } else{
|
|
| 149 | 154 | $value = ''; |
| 150 | 155 | if (isset($field_info->data_type)) {
|
| 151 | 156 | $value = esc_attr($field_info->data_type); |
| 152 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 157 | + } elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 153 | 158 | $value = $cf['defaults']['data_type']; |
| 154 | 159 | } |
| 155 | 160 | ?> |
@@ -163,11 +168,11 @@ discard block |
||
| 163 | 168 | |
| 164 | 169 | echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
|
| 165 | 170 | |
| 166 | - }else{
|
|
| 171 | + } else{
|
|
| 167 | 172 | $value = ''; |
| 168 | 173 | if (isset($field_info->admin_title)) {
|
| 169 | 174 | $value = esc_attr($field_info->admin_title); |
| 170 | - }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
|
|
| 175 | + } elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
|
|
| 171 | 176 | $value = $cf['defaults']['admin_title']; |
| 172 | 177 | } |
| 173 | 178 | ?> |
@@ -192,11 +197,11 @@ discard block |
||
| 192 | 197 | |
| 193 | 198 | echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
|
| 194 | 199 | |
| 195 | - }else{
|
|
| 200 | + } else{
|
|
| 196 | 201 | $value = ''; |
| 197 | 202 | if (isset($field_info->site_title)) {
|
| 198 | 203 | $value = esc_attr($field_info->site_title); |
| 199 | - }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
|
|
| 204 | + } elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
|
|
| 200 | 205 | $value = $cf['defaults']['site_title']; |
| 201 | 206 | } |
| 202 | 207 | ?> |
@@ -220,11 +225,11 @@ discard block |
||
| 220 | 225 | |
| 221 | 226 | echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
|
| 222 | 227 | |
| 223 | - }else{
|
|
| 228 | + } else{
|
|
| 224 | 229 | $value = ''; |
| 225 | 230 | if (isset($field_info->admin_desc)) {
|
| 226 | 231 | $value = esc_attr($field_info->admin_desc); |
| 227 | - }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
|
|
| 232 | + } elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
|
|
| 228 | 233 | $value = $cf['defaults']['admin_desc']; |
| 229 | 234 | } |
| 230 | 235 | ?> |
@@ -248,11 +253,11 @@ discard block |
||
| 248 | 253 | |
| 249 | 254 | echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
|
| 250 | 255 | |
| 251 | - }else{
|
|
| 256 | + } else{
|
|
| 252 | 257 | $value = ''; |
| 253 | 258 | if (isset($field_info->htmlvar_name)) {
|
| 254 | 259 | $value = esc_attr($field_info->htmlvar_name); |
| 255 | - }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
|
|
| 260 | + } elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
|
|
| 256 | 261 | $value = $cf['defaults']['htmlvar_name']; |
| 257 | 262 | } |
| 258 | 263 | ?> |
@@ -280,11 +285,11 @@ discard block |
||
| 280 | 285 | |
| 281 | 286 | echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
|
| 282 | 287 | |
| 283 | - }else{
|
|
| 288 | + } else{
|
|
| 284 | 289 | $value = ''; |
| 285 | 290 | if (isset($field_info->is_active)) {
|
| 286 | 291 | $value = esc_attr($field_info->is_active); |
| 287 | - }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
|
|
| 292 | + } elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
|
|
| 288 | 293 | $value = $cf['defaults']['is_active']; |
| 289 | 294 | } |
| 290 | 295 | ?> |
@@ -319,11 +324,11 @@ discard block |
||
| 319 | 324 | |
| 320 | 325 | echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
|
| 321 | 326 | |
| 322 | - }else{
|
|
| 327 | + } else{
|
|
| 323 | 328 | $value = ''; |
| 324 | 329 | if (isset($field_info->for_admin_use)) {
|
| 325 | 330 | $value = esc_attr($field_info->for_admin_use); |
| 326 | - }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
|
|
| 331 | + } elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
|
|
| 327 | 332 | $value = $cf['defaults']['for_admin_use']; |
| 328 | 333 | } |
| 329 | 334 | ?> |
@@ -358,11 +363,11 @@ discard block |
||
| 358 | 363 | |
| 359 | 364 | echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
|
| 360 | 365 | |
| 361 | - }else{
|
|
| 366 | + } else{
|
|
| 362 | 367 | $value = ''; |
| 363 | 368 | if (isset($field_info->default_value)) {
|
| 364 | 369 | $value = esc_attr($field_info->default_value); |
| 365 | - }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
|
|
| 370 | + } elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
|
|
| 366 | 371 | $value = $cf['defaults']['default_value']; |
| 367 | 372 | } |
| 368 | 373 | ?> |
@@ -402,11 +407,11 @@ discard block |
||
| 402 | 407 | |
| 403 | 408 | echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
|
| 404 | 409 | |
| 405 | - }else{
|
|
| 410 | + } else{
|
|
| 406 | 411 | $value = ''; |
| 407 | 412 | if (isset($field_info->show_in)) {
|
| 408 | 413 | $value = esc_attr($field_info->show_in); |
| 409 | - }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
|
|
| 414 | + } elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
|
|
| 410 | 415 | $value = esc_attr($cf['defaults']['show_in']); |
| 411 | 416 | } |
| 412 | 417 | ?> |
@@ -446,7 +451,7 @@ discard block |
||
| 446 | 451 | |
| 447 | 452 | // don't show new tab option for some types |
| 448 | 453 | if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
|
| 449 | - }else{
|
|
| 454 | + } else{
|
|
| 450 | 455 | unset($show_in_locations['[owntab]']); |
| 451 | 456 | } |
| 452 | 457 | |
@@ -559,11 +564,11 @@ discard block |
||
| 559 | 564 | |
| 560 | 565 | echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
|
| 561 | 566 | |
| 562 | - }else{
|
|
| 567 | + } else{
|
|
| 563 | 568 | $value = ''; |
| 564 | 569 | if (isset($field_info->is_required)) {
|
| 565 | 570 | $value = esc_attr($field_info->is_required); |
| 566 | - }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
|
|
| 571 | + } elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
|
|
| 567 | 572 | $value = $cf['defaults']['is_required']; |
| 568 | 573 | } |
| 569 | 574 | ?> |
@@ -600,11 +605,11 @@ discard block |
||
| 600 | 605 | |
| 601 | 606 | echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
|
| 602 | 607 | |
| 603 | - }else{
|
|
| 608 | + } else{
|
|
| 604 | 609 | $value = ''; |
| 605 | 610 | if (isset($field_info->required_msg)) {
|
| 606 | 611 | $value = esc_attr($field_info->required_msg); |
| 607 | - }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
|
|
| 612 | + } elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
|
|
| 608 | 613 | $value = $cf['defaults']['required_msg']; |
| 609 | 614 | } |
| 610 | 615 | ?> |
@@ -645,11 +650,11 @@ discard block |
||
| 645 | 650 | |
| 646 | 651 | echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
|
| 647 | 652 | |
| 648 | - }else{
|
|
| 653 | + } else{
|
|
| 649 | 654 | $value = ''; |
| 650 | 655 | if (isset($field_info->field_icon)) {
|
| 651 | 656 | $value = esc_attr($field_info->field_icon); |
| 652 | - }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
|
|
| 657 | + } elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
|
|
| 653 | 658 | $value = $cf['defaults']['field_icon']; |
| 654 | 659 | } |
| 655 | 660 | ?> |
@@ -678,11 +683,11 @@ discard block |
||
| 678 | 683 | |
| 679 | 684 | echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
|
| 680 | 685 | |
| 681 | - }else{
|
|
| 686 | + } else{
|
|
| 682 | 687 | $value = ''; |
| 683 | 688 | if (isset($field_info->css_class)) {
|
| 684 | 689 | $value = esc_attr($field_info->css_class); |
| 685 | - }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
|
|
| 690 | + } elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
|
|
| 686 | 691 | $value = $cf['defaults']['css_class']; |
| 687 | 692 | } |
| 688 | 693 | ?> |
@@ -711,12 +716,12 @@ discard block |
||
| 711 | 716 | |
| 712 | 717 | echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
|
| 713 | 718 | |
| 714 | - }else{
|
|
| 719 | + } else{
|
|
| 715 | 720 | $value = ''; |
| 716 | 721 | $hide_cat_sort =''; |
| 717 | 722 | if (isset($field_info->cat_sort)) {
|
| 718 | 723 | $value = esc_attr($field_info->cat_sort); |
| 719 | - }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
|
|
| 724 | + } elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
|
|
| 720 | 725 | $value = $cf['defaults']['cat_sort']; |
| 721 | 726 | $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
| 722 | 727 | } |
@@ -197,14 +197,14 @@ discard block |
||
| 197 | 197 | // Add marker cluster |
| 198 | 198 | if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
| 199 | 199 | $map_args['enable_marker_cluster'] = true; |
| 200 | - if(get_option('geodir_marker_cluster_type')) { |
|
| 200 | + if (get_option('geodir_marker_cluster_type')) { |
|
| 201 | 201 | if ($map_args['autozoom']) { |
| 202 | 202 | $map_args['enable_marker_cluster_no_reposition'] = false; |
| 203 | 203 | } else { |
| 204 | 204 | $map_args['enable_marker_cluster_no_reposition'] = true; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - $map_args['enable_marker_cluster_server'] = true ; |
|
| 207 | + $map_args['enable_marker_cluster_server'] = true; |
|
| 208 | 208 | |
| 209 | 209 | } |
| 210 | 210 | } else { |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | // if lat and long set in shortcode, hack it so the map is not repositioned |
| 215 | - if(!empty($params['latitude']) && !empty($params['longitude']) ){ |
|
| 215 | + if (!empty($params['latitude']) && !empty($params['longitude'])) { |
|
| 216 | 216 | $map_args['enable_marker_cluster_no_reposition'] = true; |
| 217 | 217 | } |
| 218 | 218 | |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | function geodir_sc_listing_map($atts) { |
| 265 | 265 | |
| 266 | 266 | // if some params are set then we need a new query, if not then we can use the main query |
| 267 | - if( isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type']) ) { |
|
| 267 | + if (isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type'])) { |
|
| 268 | 268 | |
| 269 | 269 | global $add_post_in_marker_array, $gd_sc_map_params; |
| 270 | 270 | $backup_globals = array(); |
@@ -287,34 +287,34 @@ discard block |
||
| 287 | 287 | 'event_type' => 'all' |
| 288 | 288 | ); |
| 289 | 289 | |
| 290 | - $params = shortcode_atts( $defaults, $atts ); |
|
| 290 | + $params = shortcode_atts($defaults, $atts); |
|
| 291 | 291 | |
| 292 | - if ( ! ( gdsc_is_post_type_valid( $params['post_type'] ) ) ) { |
|
| 292 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
| 293 | 293 | $params['post_type'] = 'gd_place'; |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | // Validate the selected category/ies - Grab the current list based on post_type |
| 297 | - $category_taxonomy = geodir_get_taxonomies( $params['post_type'] ); |
|
| 298 | - $categories = get_terms( $category_taxonomy, array( |
|
| 297 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
| 298 | + $categories = get_terms($category_taxonomy, array( |
|
| 299 | 299 | 'orderby' => 'count', |
| 300 | 300 | 'order' => 'DESC', |
| 301 | 301 | 'fields' => 'ids' |
| 302 | - ) ); |
|
| 302 | + )); |
|
| 303 | 303 | |
| 304 | 304 | // Make sure we have an array |
| 305 | - if ( ! ( is_array( $params['category'] ) ) ) { |
|
| 306 | - $params['category'] = explode( ',', $params['category'] ); |
|
| 305 | + if (!(is_array($params['category']))) { |
|
| 306 | + $params['category'] = explode(',', $params['category']); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | // Array_intersect returns only the items in $params['category'] that are also in our category list |
| 310 | 310 | // Otherwise it becomes empty and later on that will mean "All" |
| 311 | - $params['category'] = array_intersect( $params['category'], $categories ); |
|
| 311 | + $params['category'] = array_intersect($params['category'], $categories); |
|
| 312 | 312 | |
| 313 | - if ( $params['post_type'] == 'gd_event' ) { |
|
| 314 | - $params['event_type'] = gdsc_validate_list_filter_choice( $params['event_type'] ); |
|
| 313 | + if ($params['post_type'] == 'gd_event') { |
|
| 314 | + $params['event_type'] = gdsc_validate_list_filter_choice($params['event_type']); |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - $params = gdsc_validate_map_args( $params ); |
|
| 317 | + $params = gdsc_validate_map_args($params); |
|
| 318 | 318 | |
| 319 | 319 | $gd_sc_map_params = $params; |
| 320 | 320 | |
@@ -324,12 +324,12 @@ discard block |
||
| 324 | 324 | 'gd_location' => false, |
| 325 | 325 | ); |
| 326 | 326 | |
| 327 | - if ( ! empty( $params['category'] ) && isset( $params['category'][0] ) && (int) $params['category'][0] != 0 ) { |
|
| 328 | - $category_taxonomy = geodir_get_taxonomies( $params['post_type'] ); |
|
| 327 | + if (!empty($params['category']) && isset($params['category'][0]) && (int) $params['category'][0] != 0) { |
|
| 328 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
| 329 | 329 | |
| 330 | 330 | ######### WPML ######### |
| 331 | - if ( function_exists( 'icl_object_id' ) ) { |
|
| 332 | - $category = gd_lang_object_ids( $params['category'], $category_taxonomy[0] ); |
|
| 331 | + if (function_exists('icl_object_id')) { |
|
| 332 | + $category = gd_lang_object_ids($params['category'], $category_taxonomy[0]); |
|
| 333 | 333 | } |
| 334 | 334 | ######### WPML ######### |
| 335 | 335 | |
@@ -339,36 +339,36 @@ discard block |
||
| 339 | 339 | 'terms' => $params['category'] |
| 340 | 340 | ); |
| 341 | 341 | |
| 342 | - $query_args['tax_query'] = array( $tax_query ); |
|
| 342 | + $query_args['tax_query'] = array($tax_query); |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | $add_post_in_marker_array = true; |
| 346 | 346 | |
| 347 | - if ( $params['post_type'] == 'gd_event' && function_exists( 'geodir_event_get_widget_events' ) ) { |
|
| 347 | + if ($params['post_type'] == 'gd_event' && function_exists('geodir_event_get_widget_events')) { |
|
| 348 | 348 | global $geodir_event_widget_listview; |
| 349 | 349 | $geodir_event_widget_listview = true; |
| 350 | 350 | |
| 351 | 351 | $query_args['geodir_event_type'] = $params['event_type']; |
| 352 | 352 | |
| 353 | - $listings = geodir_event_get_widget_events( $query_args ); |
|
| 353 | + $listings = geodir_event_get_widget_events($query_args); |
|
| 354 | 354 | |
| 355 | 355 | $geodir_event_widget_listview = false; |
| 356 | 356 | } else { |
| 357 | - $listings = geodir_get_widget_listings( $query_args ); |
|
| 357 | + $listings = geodir_get_widget_listings($query_args); |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | - if ( ! empty( $listings ) ) { |
|
| 361 | - foreach ( $listings as $listing ) { |
|
| 362 | - create_marker_jason_of_posts( $listing ); |
|
| 360 | + if (!empty($listings)) { |
|
| 361 | + foreach ($listings as $listing) { |
|
| 362 | + create_marker_jason_of_posts($listing); |
|
| 363 | 363 | } |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | ob_start(); |
| 367 | - add_action( 'wp_head', 'init_listing_map_script' ); // Initialize the map object and marker array |
|
| 367 | + add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
| 368 | 368 | |
| 369 | - add_action( 'the_post', 'create_list_jsondata' ); // Add marker in json array |
|
| 369 | + add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
| 370 | 370 | |
| 371 | - add_action( 'wp_footer', 'show_listing_widget_map' ); // Show map for listings with markers |
|
| 371 | + add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
| 372 | 372 | |
| 373 | 373 | $default_location = geodir_get_default_location(); |
| 374 | 374 | |
@@ -389,17 +389,17 @@ discard block |
||
| 389 | 389 | 'enable_location_filters' => false, |
| 390 | 390 | 'enable_jason_on_load' => true, |
| 391 | 391 | 'ajax_url' => geodir_get_ajax_url(), |
| 392 | - 'latitude' => isset( $default_location->city_latitude ) ? $default_location->city_latitude : '', |
|
| 393 | - 'longitude' => isset( $default_location->city_longitude ) ? $default_location->city_longitude : '', |
|
| 392 | + 'latitude' => isset($default_location->city_latitude) ? $default_location->city_latitude : '', |
|
| 393 | + 'longitude' => isset($default_location->city_longitude) ? $default_location->city_longitude : '', |
|
| 394 | 394 | 'streetViewControl' => true, |
| 395 | 395 | 'showPreview' => '0', |
| 396 | 396 | 'maxZoom' => 21, |
| 397 | 397 | 'bubble_size' => 'small', |
| 398 | 398 | ); |
| 399 | 399 | |
| 400 | - if ( is_single() ) { |
|
| 400 | + if (is_single()) { |
|
| 401 | 401 | global $post; |
| 402 | - if ( isset( $post->post_latitude ) ) { |
|
| 402 | + if (isset($post->post_latitude)) { |
|
| 403 | 403 | $map_args['latitude'] = $post->post_latitude; |
| 404 | 404 | $map_args['longitude'] = $post->post_longitude; |
| 405 | 405 | } |
@@ -410,24 +410,24 @@ discard block |
||
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | // Add marker cluster |
| 413 | - if ( isset( $params['marker_cluster'] ) && gdsc_to_bool_val( $params['marker_cluster'] ) && defined( 'GDCLUSTER_VERSION' ) ) { |
|
| 413 | + if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
|
| 414 | 414 | $map_args['enable_marker_cluster'] = true; |
| 415 | 415 | } else { |
| 416 | 416 | $map_args['enable_marker_cluster'] = false; |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - geodir_draw_map( $map_args ); |
|
| 419 | + geodir_draw_map($map_args); |
|
| 420 | 420 | |
| 421 | 421 | $output = ob_get_contents(); |
| 422 | 422 | |
| 423 | 423 | ob_end_clean(); |
| 424 | 424 | |
| 425 | - foreach ( $backup_globals as $global => $value ) { |
|
| 425 | + foreach ($backup_globals as $global => $value) { |
|
| 426 | 426 | ${$global} = $value; |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | return $output; |
| 430 | - }else{ |
|
| 430 | + } else { |
|
| 431 | 431 | ob_start(); |
| 432 | 432 | add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
| 433 | 433 | add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
@@ -1044,20 +1044,20 @@ discard block |
||
| 1044 | 1044 | |
| 1045 | 1045 | $show_adv_search = isset($params['show_adv_search']) && in_array($params['show_adv_search'], array('default', 'always', 'searched')) ? $params['show_adv_search'] : ''; |
| 1046 | 1046 | |
| 1047 | - if ($show_adv_search != '' ) { |
|
| 1048 | - $show_adv_class = 'geodir-advance-search-' . $show_adv_search . ' '; |
|
| 1047 | + if ($show_adv_search != '') { |
|
| 1048 | + $show_adv_class = 'geodir-advance-search-'.$show_adv_search.' '; |
|
| 1049 | 1049 | if ($show_adv_search == 'searched' && geodir_is_page('search')) { |
| 1050 | 1050 | $show_adv_search = 'search'; |
| 1051 | 1051 | } |
| 1052 | - $show_adv_attrs = 'data-show-adv="' . $show_adv_search . '"'; |
|
| 1052 | + $show_adv_attrs = 'data-show-adv="'.$show_adv_search.'"'; |
|
| 1053 | 1053 | |
| 1054 | - $params['before_widget'] = str_replace('class="', $show_adv_attrs . ' class="' . $show_adv_class, $params['before_widget']); |
|
| 1054 | + $params['before_widget'] = str_replace('class="', $show_adv_attrs.' class="'.$show_adv_class, $params['before_widget']); |
|
| 1055 | 1055 | } |
| 1056 | 1056 | |
| 1057 | 1057 | ob_start(); |
| 1058 | 1058 | |
| 1059 | 1059 | //geodir_get_template_part('listing', 'filter-form'); |
| 1060 | - the_widget('geodir_advance_search_widget', $params, $params ); |
|
| 1060 | + the_widget('geodir_advance_search_widget', $params, $params); |
|
| 1061 | 1061 | |
| 1062 | 1062 | $output = ob_get_contents(); |
| 1063 | 1063 | ob_end_clean(); |
@@ -1257,7 +1257,7 @@ discard block |
||
| 1257 | 1257 | |
| 1258 | 1258 | // Validate character_count |
| 1259 | 1259 | //todo: is this necessary? |
| 1260 | - $params['character_count'] = $params['character_count']; |
|
| 1260 | + $params['character_count'] = $params['character_count']; |
|
| 1261 | 1261 | |
| 1262 | 1262 | // Validate our layout choice |
| 1263 | 1263 | // Outside of the norm, I added some more simple terms to match the existing |
@@ -1269,7 +1269,7 @@ discard block |
||
| 1269 | 1269 | |
| 1270 | 1270 | // Validate Listing width, used in the template widget-listing-listview.php |
| 1271 | 1271 | // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
| 1272 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
| 1272 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
| 1273 | 1273 | |
| 1274 | 1274 | // Validate the checkboxes used on the widget |
| 1275 | 1275 | $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
@@ -1285,7 +1285,7 @@ discard block |
||
| 1285 | 1285 | if (!empty($params['tags'])) { |
| 1286 | 1286 | if (!is_array($params['tags'])) { |
| 1287 | 1287 | $comma = _x(',', 'tag delimiter'); |
| 1288 | - if ( ',' !== $comma ) { |
|
| 1288 | + if (',' !== $comma) { |
|
| 1289 | 1289 | $params['tags'] = str_replace($comma, ',', $params['tags']); |
| 1290 | 1290 | } |
| 1291 | 1291 | $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,")); |
@@ -1307,13 +1307,13 @@ discard block |
||
| 1307 | 1307 | unset($atts['pageno']); |
| 1308 | 1308 | } |
| 1309 | 1309 | |
| 1310 | - if ( !empty($atts['shortcode_content']) ) { |
|
| 1310 | + if (!empty($atts['shortcode_content'])) { |
|
| 1311 | 1311 | $content = $atts['shortcode_content']; |
| 1312 | 1312 | } |
| 1313 | 1313 | $params['shortcode_content'] = trim($content); |
| 1314 | 1314 | $atts['shortcode_content'] = trim($content); |
| 1315 | 1315 | |
| 1316 | - $params['shortcode_atts'] = $atts; |
|
| 1316 | + $params['shortcode_atts'] = $atts; |
|
| 1317 | 1317 | |
| 1318 | 1318 | $output = geodir_sc_gd_listings_output($params); |
| 1319 | 1319 | |
@@ -1385,8 +1385,8 @@ discard block |
||
| 1385 | 1385 | // Validate the checkboxes used on the widget |
| 1386 | 1386 | $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
| 1387 | 1387 | $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
| 1388 | - $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
| 1389 | - $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
| 1388 | + $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
| 1389 | + $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
| 1390 | 1390 | |
| 1391 | 1391 | if ($params['max_count'] != 'all') { |
| 1392 | 1392 | $params['max_count'] = absint($params['max_count']); |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | // If this file is called directly, abort. |
| 9 | 9 | if (!defined('WPINC')) { |
| 10 | - die; |
|
| 10 | + die; |
|
| 11 | 11 | } |
| 12 | 12 | require_once('geodirectory-functions/shortcode_functions.php'); |
| 13 | 13 | |
@@ -32,43 +32,43 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | function geodir_sc_add_listing($atts) |
| 34 | 34 | { |
| 35 | - ob_start(); |
|
| 36 | - $defaults = array( |
|
| 37 | - 'pid' => '', |
|
| 38 | - 'listing_type' => 'gd_place', |
|
| 39 | - 'login_msg' => __('You must login to post.', 'geodirectory'), |
|
| 40 | - 'show_login' => false, |
|
| 41 | - ); |
|
| 42 | - $params = shortcode_atts($defaults, $atts); |
|
| 43 | - |
|
| 44 | - foreach ($params as $key => $value) { |
|
| 45 | - $_REQUEST[$key] = $value; |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - $user_id = get_current_user_id(); |
|
| 49 | - if (!$user_id) { |
|
| 50 | - echo $params['login_msg']; |
|
| 51 | - if ($params['show_login']) { |
|
| 52 | - echo "<br />"; |
|
| 53 | - $defaults = array( |
|
| 54 | - 'before_widget' => '', |
|
| 55 | - 'after_widget' => '', |
|
| 56 | - 'before_title' => '', |
|
| 57 | - 'after_title' => '', |
|
| 58 | - ); |
|
| 59 | - |
|
| 60 | - geodir_loginwidget_output($defaults, $defaults); |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - |
|
| 64 | - } else { |
|
| 65 | - // Add listing page will be used if shortcode is detected in page content, no need to call it here |
|
| 66 | - } |
|
| 67 | - $output = ob_get_contents(); |
|
| 68 | - |
|
| 69 | - ob_end_clean(); |
|
| 70 | - |
|
| 71 | - return $output; |
|
| 35 | + ob_start(); |
|
| 36 | + $defaults = array( |
|
| 37 | + 'pid' => '', |
|
| 38 | + 'listing_type' => 'gd_place', |
|
| 39 | + 'login_msg' => __('You must login to post.', 'geodirectory'), |
|
| 40 | + 'show_login' => false, |
|
| 41 | + ); |
|
| 42 | + $params = shortcode_atts($defaults, $atts); |
|
| 43 | + |
|
| 44 | + foreach ($params as $key => $value) { |
|
| 45 | + $_REQUEST[$key] = $value; |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + $user_id = get_current_user_id(); |
|
| 49 | + if (!$user_id) { |
|
| 50 | + echo $params['login_msg']; |
|
| 51 | + if ($params['show_login']) { |
|
| 52 | + echo "<br />"; |
|
| 53 | + $defaults = array( |
|
| 54 | + 'before_widget' => '', |
|
| 55 | + 'after_widget' => '', |
|
| 56 | + 'before_title' => '', |
|
| 57 | + 'after_title' => '', |
|
| 58 | + ); |
|
| 59 | + |
|
| 60 | + geodir_loginwidget_output($defaults, $defaults); |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + |
|
| 64 | + } else { |
|
| 65 | + // Add listing page will be used if shortcode is detected in page content, no need to call it here |
|
| 66 | + } |
|
| 67 | + $output = ob_get_contents(); |
|
| 68 | + |
|
| 69 | + ob_end_clean(); |
|
| 70 | + |
|
| 71 | + return $output; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -96,136 +96,136 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | function geodir_sc_home_map($atts) |
| 98 | 98 | { |
| 99 | - ob_start(); |
|
| 100 | - $defaults = array( |
|
| 101 | - 'width' => '960', |
|
| 102 | - 'height' => '425', |
|
| 103 | - 'maptype' => 'ROADMAP', |
|
| 104 | - 'zoom' => '13', |
|
| 105 | - 'autozoom' => '', |
|
| 106 | - 'child_collapse' => '0', |
|
| 107 | - 'scrollwheel' => '0', |
|
| 99 | + ob_start(); |
|
| 100 | + $defaults = array( |
|
| 101 | + 'width' => '960', |
|
| 102 | + 'height' => '425', |
|
| 103 | + 'maptype' => 'ROADMAP', |
|
| 104 | + 'zoom' => '13', |
|
| 105 | + 'autozoom' => '', |
|
| 106 | + 'child_collapse' => '0', |
|
| 107 | + 'scrollwheel' => '0', |
|
| 108 | 108 | 'marker_cluster' => false, |
| 109 | - 'latitude' => '', |
|
| 110 | - 'longitude' => '' |
|
| 111 | - ); |
|
| 112 | - |
|
| 113 | - $params = shortcode_atts($defaults, $atts); |
|
| 114 | - |
|
| 115 | - $params = gdsc_validate_map_args($params); |
|
| 116 | - |
|
| 117 | - $map_args = array( |
|
| 118 | - 'map_canvas_name' => 'gd_home_map', |
|
| 119 | - 'latitude' => $params['latitude'], |
|
| 120 | - 'longitude' => $params['longitude'], |
|
| 121 | - |
|
| 122 | - /** |
|
| 123 | - * Filter the widget width of the map on home/listings page. |
|
| 124 | - * |
|
| 125 | - * @since 1.0.0 |
|
| 126 | - * @param mixed(string|int|float) $params['width'] The map width. |
|
| 127 | - */ |
|
| 128 | - 'width' => apply_filters('widget_width', $params['width']), |
|
| 129 | - /** |
|
| 130 | - * Filter the widget height of the map on home/listings page. |
|
| 131 | - * |
|
| 132 | - * @since 1.0.0 |
|
| 133 | - * @param mixed(string|int|float) $params['height'] The map height. |
|
| 134 | - */ |
|
| 135 | - 'height' => apply_filters('widget_heigh', $params['height']), |
|
| 136 | - /** |
|
| 137 | - * Filter the widget maptype of the map on home/listings page. |
|
| 138 | - * |
|
| 139 | - * @since 1.0.0 |
|
| 109 | + 'latitude' => '', |
|
| 110 | + 'longitude' => '' |
|
| 111 | + ); |
|
| 112 | + |
|
| 113 | + $params = shortcode_atts($defaults, $atts); |
|
| 114 | + |
|
| 115 | + $params = gdsc_validate_map_args($params); |
|
| 116 | + |
|
| 117 | + $map_args = array( |
|
| 118 | + 'map_canvas_name' => 'gd_home_map', |
|
| 119 | + 'latitude' => $params['latitude'], |
|
| 120 | + 'longitude' => $params['longitude'], |
|
| 121 | + |
|
| 122 | + /** |
|
| 123 | + * Filter the widget width of the map on home/listings page. |
|
| 124 | + * |
|
| 125 | + * @since 1.0.0 |
|
| 126 | + * @param mixed(string|int|float) $params['width'] The map width. |
|
| 127 | + */ |
|
| 128 | + 'width' => apply_filters('widget_width', $params['width']), |
|
| 129 | + /** |
|
| 130 | + * Filter the widget height of the map on home/listings page. |
|
| 131 | + * |
|
| 132 | + * @since 1.0.0 |
|
| 133 | + * @param mixed(string|int|float) $params['height'] The map height. |
|
| 134 | + */ |
|
| 135 | + 'height' => apply_filters('widget_heigh', $params['height']), |
|
| 136 | + /** |
|
| 137 | + * Filter the widget maptype of the map on home/listings page. |
|
| 138 | + * |
|
| 139 | + * @since 1.0.0 |
|
| 140 | 140 | * @since 1.5.2 Added TERRAIN map type. |
| 141 | - * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN. |
|
| 142 | - */ |
|
| 143 | - 'maptype' => apply_filters('widget_maptype', $params['maptype']), |
|
| 144 | - /** |
|
| 145 | - * Filter the widget scrollwheel value of the map on home/listings page. |
|
| 146 | - * |
|
| 147 | - * Should the scrollwheel zoom the map or not. |
|
| 148 | - * |
|
| 149 | - * @since 1.0.0 |
|
| 150 | - * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not. |
|
| 151 | - */ |
|
| 152 | - 'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']), |
|
| 153 | - /** |
|
| 154 | - * Filter the widget zoom level of the map on home/listings page. |
|
| 155 | - * |
|
| 156 | - * @since 1.0.0 |
|
| 157 | - * @param int $params['zoom'] The zoom level of the map. Between 1-19. |
|
| 158 | - */ |
|
| 159 | - 'zoom' => apply_filters('widget_zoom', $params['zoom']), |
|
| 160 | - /** |
|
| 161 | - * Filter the widget auto zoom value of the map on home/listings page. |
|
| 162 | - * |
|
| 163 | - * If the map should autozoom to fit the markers shown. |
|
| 164 | - * |
|
| 165 | - * @since 1.0.0 |
|
| 166 | - * @param bool $params['autozoom'] True if the map should autozoom, false if not. |
|
| 167 | - */ |
|
| 168 | - 'autozoom' => apply_filters('widget_autozoom', $params['autozoom']), |
|
| 169 | - /** |
|
| 170 | - * Filter the widget child_collapse value of the map on home/listings page. |
|
| 171 | - * |
|
| 172 | - * If the map should auto collapse the child categories if the category bar is present. |
|
| 173 | - * |
|
| 174 | - * @since 1.0.0 |
|
| 175 | - * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not. |
|
| 176 | - */ |
|
| 177 | - 'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']), |
|
| 178 | - 'enable_cat_filters' => true, |
|
| 179 | - 'enable_text_search' => true, |
|
| 180 | - 'enable_post_type_filters' => true, |
|
| 181 | - /** |
|
| 182 | - * Filter the widget enable_location_filters value of the map on home/listings page. |
|
| 183 | - * |
|
| 184 | - * This is used when the location addon is used. |
|
| 185 | - * |
|
| 186 | - * @since 1.0.0 |
|
| 187 | - * @param bool $val True if location filters should be used, false if not. |
|
| 188 | - */ |
|
| 189 | - 'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false), |
|
| 190 | - 'enable_jason_on_load' => false, |
|
| 191 | - 'enable_marker_cluster' => false, |
|
| 192 | - 'enable_map_resize_button' => true, |
|
| 193 | - 'map_class_name' => 'geodir-map-home-page', |
|
| 194 | - 'is_geodir_home_map_widget' => true, |
|
| 195 | - ); |
|
| 141 | + * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN. |
|
| 142 | + */ |
|
| 143 | + 'maptype' => apply_filters('widget_maptype', $params['maptype']), |
|
| 144 | + /** |
|
| 145 | + * Filter the widget scrollwheel value of the map on home/listings page. |
|
| 146 | + * |
|
| 147 | + * Should the scrollwheel zoom the map or not. |
|
| 148 | + * |
|
| 149 | + * @since 1.0.0 |
|
| 150 | + * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not. |
|
| 151 | + */ |
|
| 152 | + 'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']), |
|
| 153 | + /** |
|
| 154 | + * Filter the widget zoom level of the map on home/listings page. |
|
| 155 | + * |
|
| 156 | + * @since 1.0.0 |
|
| 157 | + * @param int $params['zoom'] The zoom level of the map. Between 1-19. |
|
| 158 | + */ |
|
| 159 | + 'zoom' => apply_filters('widget_zoom', $params['zoom']), |
|
| 160 | + /** |
|
| 161 | + * Filter the widget auto zoom value of the map on home/listings page. |
|
| 162 | + * |
|
| 163 | + * If the map should autozoom to fit the markers shown. |
|
| 164 | + * |
|
| 165 | + * @since 1.0.0 |
|
| 166 | + * @param bool $params['autozoom'] True if the map should autozoom, false if not. |
|
| 167 | + */ |
|
| 168 | + 'autozoom' => apply_filters('widget_autozoom', $params['autozoom']), |
|
| 169 | + /** |
|
| 170 | + * Filter the widget child_collapse value of the map on home/listings page. |
|
| 171 | + * |
|
| 172 | + * If the map should auto collapse the child categories if the category bar is present. |
|
| 173 | + * |
|
| 174 | + * @since 1.0.0 |
|
| 175 | + * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not. |
|
| 176 | + */ |
|
| 177 | + 'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']), |
|
| 178 | + 'enable_cat_filters' => true, |
|
| 179 | + 'enable_text_search' => true, |
|
| 180 | + 'enable_post_type_filters' => true, |
|
| 181 | + /** |
|
| 182 | + * Filter the widget enable_location_filters value of the map on home/listings page. |
|
| 183 | + * |
|
| 184 | + * This is used when the location addon is used. |
|
| 185 | + * |
|
| 186 | + * @since 1.0.0 |
|
| 187 | + * @param bool $val True if location filters should be used, false if not. |
|
| 188 | + */ |
|
| 189 | + 'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false), |
|
| 190 | + 'enable_jason_on_load' => false, |
|
| 191 | + 'enable_marker_cluster' => false, |
|
| 192 | + 'enable_map_resize_button' => true, |
|
| 193 | + 'map_class_name' => 'geodir-map-home-page', |
|
| 194 | + 'is_geodir_home_map_widget' => true, |
|
| 195 | + ); |
|
| 196 | 196 | |
| 197 | 197 | // Add marker cluster |
| 198 | 198 | if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
| 199 | - $map_args['enable_marker_cluster'] = true; |
|
| 200 | - if(get_option('geodir_marker_cluster_type')) { |
|
| 201 | - if ($map_args['autozoom']) { |
|
| 202 | - $map_args['enable_marker_cluster_no_reposition'] = false; |
|
| 203 | - } else { |
|
| 204 | - $map_args['enable_marker_cluster_no_reposition'] = true; |
|
| 205 | - } |
|
| 199 | + $map_args['enable_marker_cluster'] = true; |
|
| 200 | + if(get_option('geodir_marker_cluster_type')) { |
|
| 201 | + if ($map_args['autozoom']) { |
|
| 202 | + $map_args['enable_marker_cluster_no_reposition'] = false; |
|
| 203 | + } else { |
|
| 204 | + $map_args['enable_marker_cluster_no_reposition'] = true; |
|
| 205 | + } |
|
| 206 | 206 | |
| 207 | - $map_args['enable_marker_cluster_server'] = true ; |
|
| 207 | + $map_args['enable_marker_cluster_server'] = true ; |
|
| 208 | 208 | |
| 209 | - } |
|
| 209 | + } |
|
| 210 | 210 | } else { |
| 211 | 211 | $map_args['enable_marker_cluster'] = false; |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - // if lat and long set in shortcode, hack it so the map is not repositioned |
|
| 215 | - if(!empty($params['latitude']) && !empty($params['longitude']) ){ |
|
| 216 | - $map_args['enable_marker_cluster_no_reposition'] = true; |
|
| 217 | - } |
|
| 214 | + // if lat and long set in shortcode, hack it so the map is not repositioned |
|
| 215 | + if(!empty($params['latitude']) && !empty($params['longitude']) ){ |
|
| 216 | + $map_args['enable_marker_cluster_no_reposition'] = true; |
|
| 217 | + } |
|
| 218 | 218 | |
| 219 | 219 | |
| 220 | - geodir_draw_map($map_args); |
|
| 220 | + geodir_draw_map($map_args); |
|
| 221 | 221 | |
| 222 | - add_action('wp_footer', 'geodir_home_map_add_script', 100); |
|
| 222 | + add_action('wp_footer', 'geodir_home_map_add_script', 100); |
|
| 223 | 223 | |
| 224 | - $output = ob_get_contents(); |
|
| 224 | + $output = ob_get_contents(); |
|
| 225 | 225 | |
| 226 | - ob_end_clean(); |
|
| 226 | + ob_end_clean(); |
|
| 227 | 227 | |
| 228 | - return $output; |
|
| 228 | + return $output; |
|
| 229 | 229 | } |
| 230 | 230 | add_shortcode('gd_homepage_map', 'geodir_sc_home_map'); |
| 231 | 231 | |
@@ -263,242 +263,242 @@ discard block |
||
| 263 | 263 | */ |
| 264 | 264 | function geodir_sc_listing_map($atts) { |
| 265 | 265 | |
| 266 | - // if some params are set then we need a new query, if not then we can use the main query |
|
| 267 | - if( isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type']) ) { |
|
| 268 | - |
|
| 269 | - global $add_post_in_marker_array, $gd_sc_map_params; |
|
| 270 | - $backup_globals = array(); |
|
| 271 | - $backup_globals['add_post_in_marker_array'] = $add_post_in_marker_array; |
|
| 272 | - $backup_globals['gd_sc_map_params'] = $gd_sc_map_params; |
|
| 273 | - |
|
| 274 | - $defaults = array( |
|
| 275 | - 'width' => '294', |
|
| 276 | - 'height' => '370', |
|
| 277 | - 'zoom' => '13', |
|
| 278 | - 'autozoom' => '', |
|
| 279 | - 'sticky' => '', |
|
| 280 | - 'showall' => '0', |
|
| 281 | - 'scrollwheel' => '0', |
|
| 282 | - 'maptype' => 'ROADMAP', |
|
| 283 | - 'child_collapse' => 0, |
|
| 284 | - 'marker_cluster' => false, |
|
| 285 | - 'post_type' => 'gd_place', |
|
| 286 | - 'category' => '0', |
|
| 287 | - 'event_type' => 'all' |
|
| 288 | - ); |
|
| 289 | - |
|
| 290 | - $params = shortcode_atts( $defaults, $atts ); |
|
| 291 | - |
|
| 292 | - if ( ! ( gdsc_is_post_type_valid( $params['post_type'] ) ) ) { |
|
| 293 | - $params['post_type'] = 'gd_place'; |
|
| 294 | - } |
|
| 295 | - |
|
| 296 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
| 297 | - $category_taxonomy = geodir_get_taxonomies( $params['post_type'] ); |
|
| 298 | - $categories = get_terms( $category_taxonomy, array( |
|
| 299 | - 'orderby' => 'count', |
|
| 300 | - 'order' => 'DESC', |
|
| 301 | - 'fields' => 'ids' |
|
| 302 | - ) ); |
|
| 303 | - |
|
| 304 | - // Make sure we have an array |
|
| 305 | - if ( ! ( is_array( $params['category'] ) ) ) { |
|
| 306 | - $params['category'] = explode( ',', $params['category'] ); |
|
| 307 | - } |
|
| 308 | - |
|
| 309 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
| 310 | - // Otherwise it becomes empty and later on that will mean "All" |
|
| 311 | - $params['category'] = array_intersect( $params['category'], $categories ); |
|
| 312 | - |
|
| 313 | - if ( $params['post_type'] == 'gd_event' ) { |
|
| 314 | - $params['event_type'] = gdsc_validate_list_filter_choice( $params['event_type'] ); |
|
| 315 | - } |
|
| 316 | - |
|
| 317 | - $params = gdsc_validate_map_args( $params ); |
|
| 318 | - |
|
| 319 | - $gd_sc_map_params = $params; |
|
| 320 | - |
|
| 321 | - $query_args = array( |
|
| 322 | - 'posts_per_page' => 1000000, //@todo kiran why was this added? |
|
| 323 | - 'is_geodir_loop' => true, |
|
| 324 | - 'gd_location' => false, |
|
| 325 | - ); |
|
| 326 | - |
|
| 327 | - if ( ! empty( $params['category'] ) && isset( $params['category'][0] ) && (int) $params['category'][0] != 0 ) { |
|
| 328 | - $category_taxonomy = geodir_get_taxonomies( $params['post_type'] ); |
|
| 329 | - |
|
| 330 | - ######### WPML ######### |
|
| 331 | - if ( function_exists( 'icl_object_id' ) ) { |
|
| 332 | - $category = gd_lang_object_ids( $params['category'], $category_taxonomy[0] ); |
|
| 333 | - } |
|
| 334 | - ######### WPML ######### |
|
| 335 | - |
|
| 336 | - $tax_query = array( |
|
| 337 | - 'taxonomy' => $category_taxonomy[0], |
|
| 338 | - 'field' => 'id', |
|
| 339 | - 'terms' => $params['category'] |
|
| 340 | - ); |
|
| 341 | - |
|
| 342 | - $query_args['tax_query'] = array( $tax_query ); |
|
| 343 | - } |
|
| 344 | - |
|
| 345 | - $add_post_in_marker_array = true; |
|
| 346 | - |
|
| 347 | - if ( $params['post_type'] == 'gd_event' && function_exists( 'geodir_event_get_widget_events' ) ) { |
|
| 348 | - global $geodir_event_widget_listview; |
|
| 349 | - $geodir_event_widget_listview = true; |
|
| 350 | - |
|
| 351 | - $query_args['geodir_event_type'] = $params['event_type']; |
|
| 352 | - |
|
| 353 | - $listings = geodir_event_get_widget_events( $query_args ); |
|
| 354 | - |
|
| 355 | - $geodir_event_widget_listview = false; |
|
| 356 | - } else { |
|
| 357 | - $listings = geodir_get_widget_listings( $query_args ); |
|
| 358 | - } |
|
| 359 | - |
|
| 360 | - if ( ! empty( $listings ) ) { |
|
| 361 | - foreach ( $listings as $listing ) { |
|
| 362 | - create_marker_jason_of_posts( $listing ); |
|
| 363 | - } |
|
| 364 | - } |
|
| 365 | - |
|
| 366 | - ob_start(); |
|
| 367 | - add_action( 'wp_head', 'init_listing_map_script' ); // Initialize the map object and marker array |
|
| 368 | - |
|
| 369 | - add_action( 'the_post', 'create_list_jsondata' ); // Add marker in json array |
|
| 370 | - |
|
| 371 | - add_action( 'wp_footer', 'show_listing_widget_map' ); // Show map for listings with markers |
|
| 372 | - |
|
| 373 | - $default_location = geodir_get_default_location(); |
|
| 374 | - |
|
| 375 | - $map_args = array( |
|
| 376 | - 'map_canvas_name' => 'gd_listing_map', |
|
| 377 | - 'width' => $params['width'], |
|
| 378 | - 'height' => $params['height'], |
|
| 379 | - 'zoom' => $params['zoom'], |
|
| 380 | - 'autozoom' => $params['autozoom'], |
|
| 381 | - 'sticky' => $params['sticky'], |
|
| 382 | - 'showall' => $params['showall'], |
|
| 383 | - 'scrollwheel' => $params['scrollwheel'], |
|
| 384 | - 'maptype' => $params['maptype'], |
|
| 385 | - 'child_collapse' => 0, |
|
| 386 | - 'enable_cat_filters' => false, |
|
| 387 | - 'enable_text_search' => false, |
|
| 388 | - 'enable_post_type_filters' => false, |
|
| 389 | - 'enable_location_filters' => false, |
|
| 390 | - 'enable_jason_on_load' => true, |
|
| 391 | - 'ajax_url' => geodir_get_ajax_url(), |
|
| 392 | - 'latitude' => isset( $default_location->city_latitude ) ? $default_location->city_latitude : '', |
|
| 393 | - 'longitude' => isset( $default_location->city_longitude ) ? $default_location->city_longitude : '', |
|
| 394 | - 'streetViewControl' => true, |
|
| 395 | - 'showPreview' => '0', |
|
| 396 | - 'maxZoom' => 21, |
|
| 397 | - 'bubble_size' => 'small', |
|
| 398 | - ); |
|
| 399 | - |
|
| 400 | - if ( is_single() ) { |
|
| 401 | - global $post; |
|
| 402 | - if ( isset( $post->post_latitude ) ) { |
|
| 403 | - $map_args['latitude'] = $post->post_latitude; |
|
| 404 | - $map_args['longitude'] = $post->post_longitude; |
|
| 405 | - } |
|
| 406 | - |
|
| 407 | - $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
| 408 | - } else { |
|
| 409 | - $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
| 410 | - } |
|
| 411 | - |
|
| 412 | - // Add marker cluster |
|
| 413 | - if ( isset( $params['marker_cluster'] ) && gdsc_to_bool_val( $params['marker_cluster'] ) && defined( 'GDCLUSTER_VERSION' ) ) { |
|
| 414 | - $map_args['enable_marker_cluster'] = true; |
|
| 415 | - } else { |
|
| 416 | - $map_args['enable_marker_cluster'] = false; |
|
| 417 | - } |
|
| 418 | - |
|
| 419 | - geodir_draw_map( $map_args ); |
|
| 420 | - |
|
| 421 | - $output = ob_get_contents(); |
|
| 422 | - |
|
| 423 | - ob_end_clean(); |
|
| 424 | - |
|
| 425 | - foreach ( $backup_globals as $global => $value ) { |
|
| 426 | - ${$global} = $value; |
|
| 427 | - } |
|
| 428 | - |
|
| 429 | - return $output; |
|
| 430 | - }else{ |
|
| 431 | - ob_start(); |
|
| 432 | - add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
| 433 | - add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
| 434 | - add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
| 435 | - $defaults = array( |
|
| 436 | - 'width' => '294', |
|
| 437 | - 'height' => '370', |
|
| 438 | - 'zoom' => '13', |
|
| 439 | - 'autozoom' => '', |
|
| 440 | - 'sticky' => '', |
|
| 441 | - 'showall' => '0', |
|
| 442 | - 'scrollwheel' => '0', |
|
| 443 | - 'maptype' => 'ROADMAP', |
|
| 444 | - 'child_collapse' => 0, |
|
| 445 | - 'marker_cluster' => false |
|
| 446 | - ); |
|
| 447 | - $params = shortcode_atts($defaults, $atts); |
|
| 448 | - $params = gdsc_validate_map_args($params); |
|
| 449 | - $map_args = array( |
|
| 450 | - 'map_canvas_name' => 'gd_listing_map', |
|
| 451 | - 'width' => $params['width'], |
|
| 452 | - 'height' => $params['height'], |
|
| 453 | - 'zoom' => $params['zoom'], |
|
| 454 | - 'autozoom' => $params['autozoom'], |
|
| 455 | - 'sticky' => $params['sticky'], |
|
| 456 | - 'showall' => $params['showall'], |
|
| 457 | - 'scrollwheel' => $params['scrollwheel'], |
|
| 458 | - 'child_collapse' => 0, |
|
| 459 | - 'enable_cat_filters' => false, |
|
| 460 | - 'enable_text_search' => false, |
|
| 461 | - 'enable_post_type_filters' => false, |
|
| 462 | - 'enable_location_filters' => false, |
|
| 463 | - 'enable_jason_on_load' => true, |
|
| 464 | - ); |
|
| 465 | - if (is_single()) { |
|
| 466 | - global $post; |
|
| 467 | - $map_default_lat = $address_latitude = $post->post_latitude; |
|
| 468 | - $map_default_lng = $address_longitude = $post->post_longitude; |
|
| 469 | - $mapview = $post->post_mapview; |
|
| 470 | - $map_args['zoom'] = $post->post_mapzoom; |
|
| 471 | - $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
| 472 | - } else { |
|
| 473 | - $default_location = geodir_get_default_location(); |
|
| 474 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 475 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 476 | - $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
| 477 | - } |
|
| 478 | - if (empty($mapview)) { |
|
| 479 | - $mapview = 'ROADMAP'; |
|
| 480 | - } |
|
| 481 | - // Set default map options |
|
| 482 | - $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
| 483 | - $map_args['latitude'] = $map_default_lat; |
|
| 484 | - $map_args['longitude'] = $map_default_lng; |
|
| 485 | - $map_args['streetViewControl'] = true; |
|
| 486 | - $map_args['maptype'] = $mapview; |
|
| 487 | - $map_args['showPreview'] = '0'; |
|
| 488 | - $map_args['maxZoom'] = 21; |
|
| 489 | - $map_args['bubble_size'] = 'small'; |
|
| 490 | - |
|
| 491 | - // Add marker cluster |
|
| 492 | - if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
|
| 493 | - $map_args['enable_marker_cluster'] = true; |
|
| 494 | - } else { |
|
| 495 | - $map_args['enable_marker_cluster'] = false; |
|
| 496 | - } |
|
| 497 | - geodir_draw_map($map_args); |
|
| 498 | - $output = ob_get_contents(); |
|
| 499 | - ob_end_clean(); |
|
| 500 | - return $output; |
|
| 501 | - } |
|
| 266 | + // if some params are set then we need a new query, if not then we can use the main query |
|
| 267 | + if( isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type']) ) { |
|
| 268 | + |
|
| 269 | + global $add_post_in_marker_array, $gd_sc_map_params; |
|
| 270 | + $backup_globals = array(); |
|
| 271 | + $backup_globals['add_post_in_marker_array'] = $add_post_in_marker_array; |
|
| 272 | + $backup_globals['gd_sc_map_params'] = $gd_sc_map_params; |
|
| 273 | + |
|
| 274 | + $defaults = array( |
|
| 275 | + 'width' => '294', |
|
| 276 | + 'height' => '370', |
|
| 277 | + 'zoom' => '13', |
|
| 278 | + 'autozoom' => '', |
|
| 279 | + 'sticky' => '', |
|
| 280 | + 'showall' => '0', |
|
| 281 | + 'scrollwheel' => '0', |
|
| 282 | + 'maptype' => 'ROADMAP', |
|
| 283 | + 'child_collapse' => 0, |
|
| 284 | + 'marker_cluster' => false, |
|
| 285 | + 'post_type' => 'gd_place', |
|
| 286 | + 'category' => '0', |
|
| 287 | + 'event_type' => 'all' |
|
| 288 | + ); |
|
| 289 | + |
|
| 290 | + $params = shortcode_atts( $defaults, $atts ); |
|
| 291 | + |
|
| 292 | + if ( ! ( gdsc_is_post_type_valid( $params['post_type'] ) ) ) { |
|
| 293 | + $params['post_type'] = 'gd_place'; |
|
| 294 | + } |
|
| 295 | + |
|
| 296 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
| 297 | + $category_taxonomy = geodir_get_taxonomies( $params['post_type'] ); |
|
| 298 | + $categories = get_terms( $category_taxonomy, array( |
|
| 299 | + 'orderby' => 'count', |
|
| 300 | + 'order' => 'DESC', |
|
| 301 | + 'fields' => 'ids' |
|
| 302 | + ) ); |
|
| 303 | + |
|
| 304 | + // Make sure we have an array |
|
| 305 | + if ( ! ( is_array( $params['category'] ) ) ) { |
|
| 306 | + $params['category'] = explode( ',', $params['category'] ); |
|
| 307 | + } |
|
| 308 | + |
|
| 309 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
| 310 | + // Otherwise it becomes empty and later on that will mean "All" |
|
| 311 | + $params['category'] = array_intersect( $params['category'], $categories ); |
|
| 312 | + |
|
| 313 | + if ( $params['post_type'] == 'gd_event' ) { |
|
| 314 | + $params['event_type'] = gdsc_validate_list_filter_choice( $params['event_type'] ); |
|
| 315 | + } |
|
| 316 | + |
|
| 317 | + $params = gdsc_validate_map_args( $params ); |
|
| 318 | + |
|
| 319 | + $gd_sc_map_params = $params; |
|
| 320 | + |
|
| 321 | + $query_args = array( |
|
| 322 | + 'posts_per_page' => 1000000, //@todo kiran why was this added? |
|
| 323 | + 'is_geodir_loop' => true, |
|
| 324 | + 'gd_location' => false, |
|
| 325 | + ); |
|
| 326 | + |
|
| 327 | + if ( ! empty( $params['category'] ) && isset( $params['category'][0] ) && (int) $params['category'][0] != 0 ) { |
|
| 328 | + $category_taxonomy = geodir_get_taxonomies( $params['post_type'] ); |
|
| 329 | + |
|
| 330 | + ######### WPML ######### |
|
| 331 | + if ( function_exists( 'icl_object_id' ) ) { |
|
| 332 | + $category = gd_lang_object_ids( $params['category'], $category_taxonomy[0] ); |
|
| 333 | + } |
|
| 334 | + ######### WPML ######### |
|
| 335 | + |
|
| 336 | + $tax_query = array( |
|
| 337 | + 'taxonomy' => $category_taxonomy[0], |
|
| 338 | + 'field' => 'id', |
|
| 339 | + 'terms' => $params['category'] |
|
| 340 | + ); |
|
| 341 | + |
|
| 342 | + $query_args['tax_query'] = array( $tax_query ); |
|
| 343 | + } |
|
| 344 | + |
|
| 345 | + $add_post_in_marker_array = true; |
|
| 346 | + |
|
| 347 | + if ( $params['post_type'] == 'gd_event' && function_exists( 'geodir_event_get_widget_events' ) ) { |
|
| 348 | + global $geodir_event_widget_listview; |
|
| 349 | + $geodir_event_widget_listview = true; |
|
| 350 | + |
|
| 351 | + $query_args['geodir_event_type'] = $params['event_type']; |
|
| 352 | + |
|
| 353 | + $listings = geodir_event_get_widget_events( $query_args ); |
|
| 354 | + |
|
| 355 | + $geodir_event_widget_listview = false; |
|
| 356 | + } else { |
|
| 357 | + $listings = geodir_get_widget_listings( $query_args ); |
|
| 358 | + } |
|
| 359 | + |
|
| 360 | + if ( ! empty( $listings ) ) { |
|
| 361 | + foreach ( $listings as $listing ) { |
|
| 362 | + create_marker_jason_of_posts( $listing ); |
|
| 363 | + } |
|
| 364 | + } |
|
| 365 | + |
|
| 366 | + ob_start(); |
|
| 367 | + add_action( 'wp_head', 'init_listing_map_script' ); // Initialize the map object and marker array |
|
| 368 | + |
|
| 369 | + add_action( 'the_post', 'create_list_jsondata' ); // Add marker in json array |
|
| 370 | + |
|
| 371 | + add_action( 'wp_footer', 'show_listing_widget_map' ); // Show map for listings with markers |
|
| 372 | + |
|
| 373 | + $default_location = geodir_get_default_location(); |
|
| 374 | + |
|
| 375 | + $map_args = array( |
|
| 376 | + 'map_canvas_name' => 'gd_listing_map', |
|
| 377 | + 'width' => $params['width'], |
|
| 378 | + 'height' => $params['height'], |
|
| 379 | + 'zoom' => $params['zoom'], |
|
| 380 | + 'autozoom' => $params['autozoom'], |
|
| 381 | + 'sticky' => $params['sticky'], |
|
| 382 | + 'showall' => $params['showall'], |
|
| 383 | + 'scrollwheel' => $params['scrollwheel'], |
|
| 384 | + 'maptype' => $params['maptype'], |
|
| 385 | + 'child_collapse' => 0, |
|
| 386 | + 'enable_cat_filters' => false, |
|
| 387 | + 'enable_text_search' => false, |
|
| 388 | + 'enable_post_type_filters' => false, |
|
| 389 | + 'enable_location_filters' => false, |
|
| 390 | + 'enable_jason_on_load' => true, |
|
| 391 | + 'ajax_url' => geodir_get_ajax_url(), |
|
| 392 | + 'latitude' => isset( $default_location->city_latitude ) ? $default_location->city_latitude : '', |
|
| 393 | + 'longitude' => isset( $default_location->city_longitude ) ? $default_location->city_longitude : '', |
|
| 394 | + 'streetViewControl' => true, |
|
| 395 | + 'showPreview' => '0', |
|
| 396 | + 'maxZoom' => 21, |
|
| 397 | + 'bubble_size' => 'small', |
|
| 398 | + ); |
|
| 399 | + |
|
| 400 | + if ( is_single() ) { |
|
| 401 | + global $post; |
|
| 402 | + if ( isset( $post->post_latitude ) ) { |
|
| 403 | + $map_args['latitude'] = $post->post_latitude; |
|
| 404 | + $map_args['longitude'] = $post->post_longitude; |
|
| 405 | + } |
|
| 406 | + |
|
| 407 | + $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
| 408 | + } else { |
|
| 409 | + $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
| 410 | + } |
|
| 411 | + |
|
| 412 | + // Add marker cluster |
|
| 413 | + if ( isset( $params['marker_cluster'] ) && gdsc_to_bool_val( $params['marker_cluster'] ) && defined( 'GDCLUSTER_VERSION' ) ) { |
|
| 414 | + $map_args['enable_marker_cluster'] = true; |
|
| 415 | + } else { |
|
| 416 | + $map_args['enable_marker_cluster'] = false; |
|
| 417 | + } |
|
| 418 | + |
|
| 419 | + geodir_draw_map( $map_args ); |
|
| 420 | + |
|
| 421 | + $output = ob_get_contents(); |
|
| 422 | + |
|
| 423 | + ob_end_clean(); |
|
| 424 | + |
|
| 425 | + foreach ( $backup_globals as $global => $value ) { |
|
| 426 | + ${$global} = $value; |
|
| 427 | + } |
|
| 428 | + |
|
| 429 | + return $output; |
|
| 430 | + }else{ |
|
| 431 | + ob_start(); |
|
| 432 | + add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
|
| 433 | + add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
|
| 434 | + add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers |
|
| 435 | + $defaults = array( |
|
| 436 | + 'width' => '294', |
|
| 437 | + 'height' => '370', |
|
| 438 | + 'zoom' => '13', |
|
| 439 | + 'autozoom' => '', |
|
| 440 | + 'sticky' => '', |
|
| 441 | + 'showall' => '0', |
|
| 442 | + 'scrollwheel' => '0', |
|
| 443 | + 'maptype' => 'ROADMAP', |
|
| 444 | + 'child_collapse' => 0, |
|
| 445 | + 'marker_cluster' => false |
|
| 446 | + ); |
|
| 447 | + $params = shortcode_atts($defaults, $atts); |
|
| 448 | + $params = gdsc_validate_map_args($params); |
|
| 449 | + $map_args = array( |
|
| 450 | + 'map_canvas_name' => 'gd_listing_map', |
|
| 451 | + 'width' => $params['width'], |
|
| 452 | + 'height' => $params['height'], |
|
| 453 | + 'zoom' => $params['zoom'], |
|
| 454 | + 'autozoom' => $params['autozoom'], |
|
| 455 | + 'sticky' => $params['sticky'], |
|
| 456 | + 'showall' => $params['showall'], |
|
| 457 | + 'scrollwheel' => $params['scrollwheel'], |
|
| 458 | + 'child_collapse' => 0, |
|
| 459 | + 'enable_cat_filters' => false, |
|
| 460 | + 'enable_text_search' => false, |
|
| 461 | + 'enable_post_type_filters' => false, |
|
| 462 | + 'enable_location_filters' => false, |
|
| 463 | + 'enable_jason_on_load' => true, |
|
| 464 | + ); |
|
| 465 | + if (is_single()) { |
|
| 466 | + global $post; |
|
| 467 | + $map_default_lat = $address_latitude = $post->post_latitude; |
|
| 468 | + $map_default_lng = $address_longitude = $post->post_longitude; |
|
| 469 | + $mapview = $post->post_mapview; |
|
| 470 | + $map_args['zoom'] = $post->post_mapzoom; |
|
| 471 | + $map_args['map_class_name'] = 'geodir-map-listing-page-single'; |
|
| 472 | + } else { |
|
| 473 | + $default_location = geodir_get_default_location(); |
|
| 474 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 475 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 476 | + $map_args['map_class_name'] = 'geodir-map-listing-page'; |
|
| 477 | + } |
|
| 478 | + if (empty($mapview)) { |
|
| 479 | + $mapview = 'ROADMAP'; |
|
| 480 | + } |
|
| 481 | + // Set default map options |
|
| 482 | + $map_args['ajax_url'] = geodir_get_ajax_url(); |
|
| 483 | + $map_args['latitude'] = $map_default_lat; |
|
| 484 | + $map_args['longitude'] = $map_default_lng; |
|
| 485 | + $map_args['streetViewControl'] = true; |
|
| 486 | + $map_args['maptype'] = $mapview; |
|
| 487 | + $map_args['showPreview'] = '0'; |
|
| 488 | + $map_args['maxZoom'] = 21; |
|
| 489 | + $map_args['bubble_size'] = 'small'; |
|
| 490 | + |
|
| 491 | + // Add marker cluster |
|
| 492 | + if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) { |
|
| 493 | + $map_args['enable_marker_cluster'] = true; |
|
| 494 | + } else { |
|
| 495 | + $map_args['enable_marker_cluster'] = false; |
|
| 496 | + } |
|
| 497 | + geodir_draw_map($map_args); |
|
| 498 | + $output = ob_get_contents(); |
|
| 499 | + ob_end_clean(); |
|
| 500 | + return $output; |
|
| 501 | + } |
|
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | add_shortcode('gd_listing_slider', 'geodir_sc_listing_slider'); |
@@ -531,120 +531,120 @@ discard block |
||
| 531 | 531 | */ |
| 532 | 532 | function geodir_sc_listing_slider($atts) |
| 533 | 533 | { |
| 534 | - ob_start(); |
|
| 535 | - $defaults = array( |
|
| 536 | - 'post_type' => 'gd_place', |
|
| 537 | - 'category' => '0', |
|
| 538 | - 'post_number' => '5', |
|
| 539 | - 'slideshow' => '0', |
|
| 540 | - 'animation_loop' => 0, |
|
| 541 | - 'direction_nav' => 0, |
|
| 542 | - 'slideshow_speed' => 5000, |
|
| 543 | - 'animation_speed' => 600, |
|
| 544 | - 'animation' => 'slide', |
|
| 545 | - 'order_by' => 'latest', |
|
| 546 | - 'show_title' => '', |
|
| 547 | - 'show_featured_only' => '', |
|
| 548 | - 'title' => '', |
|
| 549 | - ); |
|
| 550 | - |
|
| 551 | - $params = shortcode_atts($defaults, $atts); |
|
| 552 | - |
|
| 553 | - |
|
| 554 | - /* |
|
| 534 | + ob_start(); |
|
| 535 | + $defaults = array( |
|
| 536 | + 'post_type' => 'gd_place', |
|
| 537 | + 'category' => '0', |
|
| 538 | + 'post_number' => '5', |
|
| 539 | + 'slideshow' => '0', |
|
| 540 | + 'animation_loop' => 0, |
|
| 541 | + 'direction_nav' => 0, |
|
| 542 | + 'slideshow_speed' => 5000, |
|
| 543 | + 'animation_speed' => 600, |
|
| 544 | + 'animation' => 'slide', |
|
| 545 | + 'order_by' => 'latest', |
|
| 546 | + 'show_title' => '', |
|
| 547 | + 'show_featured_only' => '', |
|
| 548 | + 'title' => '', |
|
| 549 | + ); |
|
| 550 | + |
|
| 551 | + $params = shortcode_atts($defaults, $atts); |
|
| 552 | + |
|
| 553 | + |
|
| 554 | + /* |
|
| 555 | 555 | * |
| 556 | 556 | * Now we begin the validation of the attributes. |
| 557 | 557 | */ |
| 558 | - // Check we have a valid post_type |
|
| 559 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
| 560 | - $params['post_type'] = 'gd_place'; |
|
| 561 | - } |
|
| 562 | - |
|
| 563 | - // Check we have a valid sort_order |
|
| 564 | - $params['order_by'] = gdsc_validate_sort_choice($params['order_by']); |
|
| 565 | - |
|
| 566 | - // Match the chosen animation to our options |
|
| 567 | - $animation_list = array('slide', 'fade'); |
|
| 568 | - if (!(in_array($params['animation'], $animation_list))) { |
|
| 569 | - $params['animation'] = 'slide'; |
|
| 570 | - } |
|
| 571 | - |
|
| 572 | - // Post_number needs to be a positive integer |
|
| 573 | - $params['post_number'] = absint($params['post_number']); |
|
| 574 | - if (0 == $params['post_number']) { |
|
| 575 | - $params['post_number'] = 1; |
|
| 576 | - } |
|
| 577 | - |
|
| 578 | - // Manage the entered categories |
|
| 579 | - if (0 != $params['category'] || '' != $params['category']) { |
|
| 580 | - $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']); |
|
| 581 | - } |
|
| 582 | - // Convert show_title to a bool |
|
| 583 | - $params['show_title'] = intval(gdsc_to_bool_val($params['show_title'])); |
|
| 584 | - |
|
| 585 | - // Convert show_featured_only to a bool |
|
| 586 | - $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only'])); |
|
| 587 | - |
|
| 588 | - /* |
|
| 558 | + // Check we have a valid post_type |
|
| 559 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
| 560 | + $params['post_type'] = 'gd_place'; |
|
| 561 | + } |
|
| 562 | + |
|
| 563 | + // Check we have a valid sort_order |
|
| 564 | + $params['order_by'] = gdsc_validate_sort_choice($params['order_by']); |
|
| 565 | + |
|
| 566 | + // Match the chosen animation to our options |
|
| 567 | + $animation_list = array('slide', 'fade'); |
|
| 568 | + if (!(in_array($params['animation'], $animation_list))) { |
|
| 569 | + $params['animation'] = 'slide'; |
|
| 570 | + } |
|
| 571 | + |
|
| 572 | + // Post_number needs to be a positive integer |
|
| 573 | + $params['post_number'] = absint($params['post_number']); |
|
| 574 | + if (0 == $params['post_number']) { |
|
| 575 | + $params['post_number'] = 1; |
|
| 576 | + } |
|
| 577 | + |
|
| 578 | + // Manage the entered categories |
|
| 579 | + if (0 != $params['category'] || '' != $params['category']) { |
|
| 580 | + $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']); |
|
| 581 | + } |
|
| 582 | + // Convert show_title to a bool |
|
| 583 | + $params['show_title'] = intval(gdsc_to_bool_val($params['show_title'])); |
|
| 584 | + |
|
| 585 | + // Convert show_featured_only to a bool |
|
| 586 | + $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only'])); |
|
| 587 | + |
|
| 588 | + /* |
|
| 589 | 589 | * Hopefully all attributes are now valid, and safe to pass forward |
| 590 | 590 | */ |
| 591 | 591 | |
| 592 | - // redeclare vars after validation |
|
| 593 | - |
|
| 594 | - if (isset($params['direction_nav'])) { |
|
| 595 | - $params['directionNav'] = $params['direction_nav']; |
|
| 596 | - } |
|
| 597 | - if (isset($params['animation_loop'])) { |
|
| 598 | - $params['animationLoop'] = $params['animation_loop']; |
|
| 599 | - } |
|
| 600 | - if (isset($params['slideshow_speed'])) { |
|
| 601 | - $params['slideshowSpeed'] = $params['slideshow_speed']; |
|
| 602 | - } |
|
| 603 | - if (isset($params['animation_speed'])) { |
|
| 604 | - $params['animationSpeed'] = $params['animation_speed']; |
|
| 605 | - } |
|
| 606 | - if (isset($params['order_by'])) { |
|
| 607 | - $params['list_sort'] = $params['order_by']; |
|
| 608 | - } |
|
| 609 | - |
|
| 610 | - $query_args = array( |
|
| 611 | - 'post_number' => $params['post_number'], |
|
| 612 | - 'is_geodir_loop' => true, |
|
| 613 | - 'post_type' => $params['post_type'], |
|
| 614 | - 'order_by' => $params['order_by'] |
|
| 615 | - ); |
|
| 616 | - |
|
| 617 | - if (1 == $params['show_featured_only']) { |
|
| 618 | - $query_args['show_featured_only'] = 1; |
|
| 619 | - } |
|
| 620 | - |
|
| 621 | - if (0 != $params['category'] && '' != $params['category']) { |
|
| 622 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
| 623 | - $tax_query = array( |
|
| 624 | - 'taxonomy' => $category_taxonomy[0], |
|
| 625 | - 'field' => 'id', |
|
| 626 | - 'terms' => $params['category'], |
|
| 627 | - ); |
|
| 628 | - |
|
| 629 | - $query_args['tax_query'] = array($tax_query); |
|
| 630 | - } |
|
| 631 | - |
|
| 632 | - $defaults = array( |
|
| 633 | - 'before_widget' => '', |
|
| 634 | - 'after_widget' => '', |
|
| 635 | - 'before_title' => '', |
|
| 636 | - 'after_title' => '', |
|
| 637 | - ); |
|
| 638 | - |
|
| 639 | - $query_args = array_merge($query_args, $params); |
|
| 640 | - |
|
| 641 | - geodir_listing_slider_widget_output($defaults, $query_args); |
|
| 642 | - |
|
| 643 | - $output = ob_get_contents(); |
|
| 644 | - |
|
| 645 | - ob_end_clean(); |
|
| 646 | - |
|
| 647 | - return $output; |
|
| 592 | + // redeclare vars after validation |
|
| 593 | + |
|
| 594 | + if (isset($params['direction_nav'])) { |
|
| 595 | + $params['directionNav'] = $params['direction_nav']; |
|
| 596 | + } |
|
| 597 | + if (isset($params['animation_loop'])) { |
|
| 598 | + $params['animationLoop'] = $params['animation_loop']; |
|
| 599 | + } |
|
| 600 | + if (isset($params['slideshow_speed'])) { |
|
| 601 | + $params['slideshowSpeed'] = $params['slideshow_speed']; |
|
| 602 | + } |
|
| 603 | + if (isset($params['animation_speed'])) { |
|
| 604 | + $params['animationSpeed'] = $params['animation_speed']; |
|
| 605 | + } |
|
| 606 | + if (isset($params['order_by'])) { |
|
| 607 | + $params['list_sort'] = $params['order_by']; |
|
| 608 | + } |
|
| 609 | + |
|
| 610 | + $query_args = array( |
|
| 611 | + 'post_number' => $params['post_number'], |
|
| 612 | + 'is_geodir_loop' => true, |
|
| 613 | + 'post_type' => $params['post_type'], |
|
| 614 | + 'order_by' => $params['order_by'] |
|
| 615 | + ); |
|
| 616 | + |
|
| 617 | + if (1 == $params['show_featured_only']) { |
|
| 618 | + $query_args['show_featured_only'] = 1; |
|
| 619 | + } |
|
| 620 | + |
|
| 621 | + if (0 != $params['category'] && '' != $params['category']) { |
|
| 622 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
| 623 | + $tax_query = array( |
|
| 624 | + 'taxonomy' => $category_taxonomy[0], |
|
| 625 | + 'field' => 'id', |
|
| 626 | + 'terms' => $params['category'], |
|
| 627 | + ); |
|
| 628 | + |
|
| 629 | + $query_args['tax_query'] = array($tax_query); |
|
| 630 | + } |
|
| 631 | + |
|
| 632 | + $defaults = array( |
|
| 633 | + 'before_widget' => '', |
|
| 634 | + 'after_widget' => '', |
|
| 635 | + 'before_title' => '', |
|
| 636 | + 'after_title' => '', |
|
| 637 | + ); |
|
| 638 | + |
|
| 639 | + $query_args = array_merge($query_args, $params); |
|
| 640 | + |
|
| 641 | + geodir_listing_slider_widget_output($defaults, $query_args); |
|
| 642 | + |
|
| 643 | + $output = ob_get_contents(); |
|
| 644 | + |
|
| 645 | + ob_end_clean(); |
|
| 646 | + |
|
| 647 | + return $output; |
|
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | add_shortcode('gd_login_box', 'geodir_sc_login_box'); |
@@ -668,22 +668,22 @@ discard block |
||
| 668 | 668 | */ |
| 669 | 669 | function geodir_sc_login_box($atts) |
| 670 | 670 | { |
| 671 | - ob_start(); |
|
| 671 | + ob_start(); |
|
| 672 | 672 | |
| 673 | - $defaults = array( |
|
| 674 | - 'before_widget' => '', |
|
| 675 | - 'after_widget' => '', |
|
| 676 | - 'before_title' => '', |
|
| 677 | - 'after_title' => '', |
|
| 678 | - ); |
|
| 673 | + $defaults = array( |
|
| 674 | + 'before_widget' => '', |
|
| 675 | + 'after_widget' => '', |
|
| 676 | + 'before_title' => '', |
|
| 677 | + 'after_title' => '', |
|
| 678 | + ); |
|
| 679 | 679 | |
| 680 | - geodir_loginwidget_output($defaults, $defaults); |
|
| 680 | + geodir_loginwidget_output($defaults, $defaults); |
|
| 681 | 681 | |
| 682 | - $output = ob_get_contents(); |
|
| 682 | + $output = ob_get_contents(); |
|
| 683 | 683 | |
| 684 | - ob_end_clean(); |
|
| 684 | + ob_end_clean(); |
|
| 685 | 685 | |
| 686 | - return $output; |
|
| 686 | + return $output; |
|
| 687 | 687 | } |
| 688 | 688 | |
| 689 | 689 | add_shortcode('gd_popular_post_category', 'geodir_sc_popular_post_category'); |
@@ -714,31 +714,31 @@ discard block |
||
| 714 | 714 | */ |
| 715 | 715 | function geodir_sc_popular_post_category($atts) |
| 716 | 716 | { |
| 717 | - ob_start(); |
|
| 718 | - global $geodir_post_category_str; |
|
| 719 | - $defaults = array( |
|
| 720 | - 'category_limit' => 15, |
|
| 721 | - 'category_restrict' => false, |
|
| 722 | - 'before_widget' => '', |
|
| 723 | - 'after_widget' => '', |
|
| 724 | - 'before_title' => '', |
|
| 725 | - 'after_title' => '', |
|
| 726 | - 'title' => '', |
|
| 727 | - 'default_post_type' => '', |
|
| 728 | - 'parent_only' => false, |
|
| 729 | - ); |
|
| 730 | - |
|
| 731 | - $params = shortcode_atts($defaults, $atts, 'popular_post_category'); |
|
| 732 | - $params['category_limit'] = absint($params['category_limit']); |
|
| 733 | - $params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : ''; |
|
| 734 | - $params['parent_only'] = gdsc_to_bool_val($params['parent_only']); |
|
| 735 | - geodir_popular_post_category_output($params, $params); |
|
| 736 | - |
|
| 737 | - $output = ob_get_contents(); |
|
| 738 | - |
|
| 739 | - ob_end_clean(); |
|
| 740 | - |
|
| 741 | - return $output; |
|
| 717 | + ob_start(); |
|
| 718 | + global $geodir_post_category_str; |
|
| 719 | + $defaults = array( |
|
| 720 | + 'category_limit' => 15, |
|
| 721 | + 'category_restrict' => false, |
|
| 722 | + 'before_widget' => '', |
|
| 723 | + 'after_widget' => '', |
|
| 724 | + 'before_title' => '', |
|
| 725 | + 'after_title' => '', |
|
| 726 | + 'title' => '', |
|
| 727 | + 'default_post_type' => '', |
|
| 728 | + 'parent_only' => false, |
|
| 729 | + ); |
|
| 730 | + |
|
| 731 | + $params = shortcode_atts($defaults, $atts, 'popular_post_category'); |
|
| 732 | + $params['category_limit'] = absint($params['category_limit']); |
|
| 733 | + $params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : ''; |
|
| 734 | + $params['parent_only'] = gdsc_to_bool_val($params['parent_only']); |
|
| 735 | + geodir_popular_post_category_output($params, $params); |
|
| 736 | + |
|
| 737 | + $output = ob_get_contents(); |
|
| 738 | + |
|
| 739 | + ob_end_clean(); |
|
| 740 | + |
|
| 741 | + return $output; |
|
| 742 | 742 | } |
| 743 | 743 | |
| 744 | 744 | add_shortcode('gd_popular_post_view', 'geodir_sc_popular_post_view'); |
@@ -778,97 +778,97 @@ discard block |
||
| 778 | 778 | */ |
| 779 | 779 | function geodir_sc_popular_post_view($atts) |
| 780 | 780 | { |
| 781 | - ob_start(); |
|
| 782 | - $defaults = array( |
|
| 783 | - 'post_type' => 'gd_place', |
|
| 784 | - 'category' => '0', |
|
| 785 | - 'post_number' => '5', |
|
| 786 | - 'layout' => 'gridview_onehalf', |
|
| 787 | - 'add_location_filter' => '0', |
|
| 788 | - 'list_sort' => 'latest', |
|
| 789 | - 'use_viewing_post_type' => '1', |
|
| 790 | - 'character_count' => '20', |
|
| 791 | - 'listing_width' => '', |
|
| 792 | - 'show_featured_only' => '0', |
|
| 793 | - 'show_special_only' => '0', |
|
| 794 | - 'with_pics_only' => '0', |
|
| 795 | - 'with_videos_only' => '0', |
|
| 796 | - 'before_widget' => '', |
|
| 797 | - 'after_widget' => '', |
|
| 798 | - 'before_title' => '<h3 class="widget-title">', |
|
| 799 | - 'after_title' => '</h3>', |
|
| 800 | - 'title' => '', |
|
| 801 | - 'category_title' => '', |
|
| 802 | - ); |
|
| 803 | - |
|
| 804 | - $params = shortcode_atts($defaults, $atts); |
|
| 805 | - |
|
| 806 | - /** |
|
| 807 | - * Validate our incoming params |
|
| 808 | - */ |
|
| 781 | + ob_start(); |
|
| 782 | + $defaults = array( |
|
| 783 | + 'post_type' => 'gd_place', |
|
| 784 | + 'category' => '0', |
|
| 785 | + 'post_number' => '5', |
|
| 786 | + 'layout' => 'gridview_onehalf', |
|
| 787 | + 'add_location_filter' => '0', |
|
| 788 | + 'list_sort' => 'latest', |
|
| 789 | + 'use_viewing_post_type' => '1', |
|
| 790 | + 'character_count' => '20', |
|
| 791 | + 'listing_width' => '', |
|
| 792 | + 'show_featured_only' => '0', |
|
| 793 | + 'show_special_only' => '0', |
|
| 794 | + 'with_pics_only' => '0', |
|
| 795 | + 'with_videos_only' => '0', |
|
| 796 | + 'before_widget' => '', |
|
| 797 | + 'after_widget' => '', |
|
| 798 | + 'before_title' => '<h3 class="widget-title">', |
|
| 799 | + 'after_title' => '</h3>', |
|
| 800 | + 'title' => '', |
|
| 801 | + 'category_title' => '', |
|
| 802 | + ); |
|
| 809 | 803 | |
| 810 | - // Validate the selected post type, default to gd_place on fail |
|
| 811 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
| 812 | - $params['post_type'] = 'gd_place'; |
|
| 813 | - } |
|
| 814 | - |
|
| 815 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
| 816 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
| 817 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
| 818 | - |
|
| 819 | - // Make sure we have an array |
|
| 820 | - if (!(is_array($params['category']))) { |
|
| 821 | - $params['category'] = explode(',', $params['category']); |
|
| 822 | - } |
|
| 823 | - |
|
| 824 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
| 825 | - // Otherwise it becomes empty and later on that will mean "All" |
|
| 826 | - $params['category'] = array_intersect($params['category'], $categories); |
|
| 827 | - |
|
| 828 | - // Post_number needs to be a positive integer |
|
| 829 | - $params['post_number'] = absint($params['post_number']); |
|
| 830 | - if (0 == $params['post_number']) { |
|
| 831 | - $params['post_number'] = 1; |
|
| 832 | - } |
|
| 833 | - |
|
| 834 | - // Validate our layout choice |
|
| 835 | - // Outside of the norm, I added some more simple terms to match the existing |
|
| 836 | - // So now I just run the switch to set it properly. |
|
| 837 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
| 838 | - |
|
| 839 | - // Validate our sorting choice |
|
| 840 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
| 841 | - |
|
| 842 | - // Validate character_count |
|
| 843 | - $params['character_count'] = absint($params['character_count']); |
|
| 844 | - if (20 > $params['character_count']) { |
|
| 845 | - $params['character_count'] = 20; |
|
| 846 | - } |
|
| 847 | - |
|
| 848 | - // Validate Listing width, used in the template widget-listing-listview.php |
|
| 849 | - // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
| 850 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
| 851 | - |
|
| 852 | - // Validate the checkboxes used on the widget |
|
| 853 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
| 854 | - $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
| 855 | - $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
| 856 | - $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
| 857 | - $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
| 858 | - $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']); |
|
| 859 | - |
|
| 860 | - /** |
|
| 861 | - * End of validation |
|
| 862 | - */ |
|
| 804 | + $params = shortcode_atts($defaults, $atts); |
|
| 805 | + |
|
| 806 | + /** |
|
| 807 | + * Validate our incoming params |
|
| 808 | + */ |
|
| 863 | 809 | |
| 864 | - geodir_popular_postview_output($params, $params); |
|
| 810 | + // Validate the selected post type, default to gd_place on fail |
|
| 811 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
| 812 | + $params['post_type'] = 'gd_place'; |
|
| 813 | + } |
|
| 865 | 814 | |
| 815 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
| 816 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
| 817 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
| 866 | 818 | |
| 867 | - $output = ob_get_contents(); |
|
| 819 | + // Make sure we have an array |
|
| 820 | + if (!(is_array($params['category']))) { |
|
| 821 | + $params['category'] = explode(',', $params['category']); |
|
| 822 | + } |
|
| 868 | 823 | |
| 869 | - ob_end_clean(); |
|
| 824 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
| 825 | + // Otherwise it becomes empty and later on that will mean "All" |
|
| 826 | + $params['category'] = array_intersect($params['category'], $categories); |
|
| 870 | 827 | |
| 871 | - return $output; |
|
| 828 | + // Post_number needs to be a positive integer |
|
| 829 | + $params['post_number'] = absint($params['post_number']); |
|
| 830 | + if (0 == $params['post_number']) { |
|
| 831 | + $params['post_number'] = 1; |
|
| 832 | + } |
|
| 833 | + |
|
| 834 | + // Validate our layout choice |
|
| 835 | + // Outside of the norm, I added some more simple terms to match the existing |
|
| 836 | + // So now I just run the switch to set it properly. |
|
| 837 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
| 838 | + |
|
| 839 | + // Validate our sorting choice |
|
| 840 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
| 841 | + |
|
| 842 | + // Validate character_count |
|
| 843 | + $params['character_count'] = absint($params['character_count']); |
|
| 844 | + if (20 > $params['character_count']) { |
|
| 845 | + $params['character_count'] = 20; |
|
| 846 | + } |
|
| 847 | + |
|
| 848 | + // Validate Listing width, used in the template widget-listing-listview.php |
|
| 849 | + // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
| 850 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
| 851 | + |
|
| 852 | + // Validate the checkboxes used on the widget |
|
| 853 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
| 854 | + $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
| 855 | + $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
| 856 | + $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
| 857 | + $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
| 858 | + $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']); |
|
| 859 | + |
|
| 860 | + /** |
|
| 861 | + * End of validation |
|
| 862 | + */ |
|
| 863 | + |
|
| 864 | + geodir_popular_postview_output($params, $params); |
|
| 865 | + |
|
| 866 | + |
|
| 867 | + $output = ob_get_contents(); |
|
| 868 | + |
|
| 869 | + ob_end_clean(); |
|
| 870 | + |
|
| 871 | + return $output; |
|
| 872 | 872 | } |
| 873 | 873 | |
| 874 | 874 | add_shortcode('gd_recent_reviews', 'geodir_sc_recent_reviews'); |
@@ -890,37 +890,37 @@ discard block |
||
| 890 | 890 | * @return string Recent reviews HTML. |
| 891 | 891 | */ |
| 892 | 892 | function geodir_sc_recent_reviews($atts) { |
| 893 | - ob_start(); |
|
| 894 | - $defaults = array( |
|
| 893 | + ob_start(); |
|
| 894 | + $defaults = array( |
|
| 895 | 895 | 'title' => '', |
| 896 | 896 | 'count' => 5, |
| 897 | - ); |
|
| 897 | + ); |
|
| 898 | 898 | |
| 899 | - $params = shortcode_atts($defaults, $atts); |
|
| 899 | + $params = shortcode_atts($defaults, $atts); |
|
| 900 | 900 | |
| 901 | - $count = absint($params['count']); |
|
| 902 | - if (0 == $count) { |
|
| 903 | - $count = 1; |
|
| 904 | - } |
|
| 901 | + $count = absint($params['count']); |
|
| 902 | + if (0 == $count) { |
|
| 903 | + $count = 1; |
|
| 904 | + } |
|
| 905 | 905 | |
| 906 | 906 | $title = !empty($params['title']) ? __($params['title'], 'geodirectory') : ''; |
| 907 | 907 | |
| 908 | - $comments_li = geodir_get_recent_reviews(30, $count, 100, false); |
|
| 908 | + $comments_li = geodir_get_recent_reviews(30, $count, 100, false); |
|
| 909 | 909 | |
| 910 | - if ($comments_li) { |
|
| 911 | - if ($title != '') { ?> |
|
| 910 | + if ($comments_li) { |
|
| 911 | + if ($title != '') { ?> |
|
| 912 | 912 | <h3 class="geodir-sc-recent-reviews-title widget-title"><?php echo $title; ?></h3> |
| 913 | 913 | <?php } ?> |
| 914 | 914 | <div class="geodir_sc_recent_reviews_section"> |
| 915 | 915 | <ul class="geodir_sc_recent_reviews"><?php echo $comments_li; ?></ul> |
| 916 | 916 | </div> |
| 917 | 917 | <?php |
| 918 | - } |
|
| 919 | - $output = ob_get_contents(); |
|
| 918 | + } |
|
| 919 | + $output = ob_get_contents(); |
|
| 920 | 920 | |
| 921 | - ob_end_clean(); |
|
| 921 | + ob_end_clean(); |
|
| 922 | 922 | |
| 923 | - return $output; |
|
| 923 | + return $output; |
|
| 924 | 924 | } |
| 925 | 925 | |
| 926 | 926 | add_shortcode('gd_related_listings', 'geodir_sc_related_listings'); |
@@ -950,64 +950,64 @@ discard block |
||
| 950 | 950 | */ |
| 951 | 951 | function geodir_sc_related_listings($atts) |
| 952 | 952 | { |
| 953 | - ob_start(); |
|
| 954 | - $defaults = array( |
|
| 955 | - 'post_number' => 5, |
|
| 956 | - 'relate_to' => 'category', |
|
| 957 | - 'layout' => 'gridview_onehalf', |
|
| 958 | - 'add_location_filter' => 0, |
|
| 959 | - 'listing_width' => '', |
|
| 960 | - 'list_sort' => 'latest', |
|
| 961 | - 'character_count' => 20, |
|
| 962 | - 'is_widget' => 1, |
|
| 963 | - 'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>', |
|
| 964 | - ); |
|
| 965 | - // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet. |
|
| 966 | - |
|
| 967 | - $params = shortcode_atts($defaults, $atts); |
|
| 968 | - |
|
| 969 | - /** |
|
| 970 | - * Begin validating parameters |
|
| 971 | - */ |
|
| 953 | + ob_start(); |
|
| 954 | + $defaults = array( |
|
| 955 | + 'post_number' => 5, |
|
| 956 | + 'relate_to' => 'category', |
|
| 957 | + 'layout' => 'gridview_onehalf', |
|
| 958 | + 'add_location_filter' => 0, |
|
| 959 | + 'listing_width' => '', |
|
| 960 | + 'list_sort' => 'latest', |
|
| 961 | + 'character_count' => 20, |
|
| 962 | + 'is_widget' => 1, |
|
| 963 | + 'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>', |
|
| 964 | + ); |
|
| 965 | + // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet. |
|
| 972 | 966 | |
| 973 | - // Validate that post_number is a number and is 1 or higher |
|
| 974 | - $params['post_number'] = absint($params['post_number']); |
|
| 975 | - if (0 === $params['post_number']) { |
|
| 976 | - $params['post_number'] = 1; |
|
| 977 | - } |
|
| 967 | + $params = shortcode_atts($defaults, $atts); |
|
| 978 | 968 | |
| 979 | - // Validate relate_to - only category or tags |
|
| 980 | - $params['relate_to'] = geodir_strtolower($params['relate_to']); |
|
| 981 | - if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) { |
|
| 982 | - $params['relate_to'] = 'category'; |
|
| 983 | - } |
|
| 969 | + /** |
|
| 970 | + * Begin validating parameters |
|
| 971 | + */ |
|
| 984 | 972 | |
| 985 | - // Validate layout selection |
|
| 986 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
| 973 | + // Validate that post_number is a number and is 1 or higher |
|
| 974 | + $params['post_number'] = absint($params['post_number']); |
|
| 975 | + if (0 === $params['post_number']) { |
|
| 976 | + $params['post_number'] = 1; |
|
| 977 | + } |
|
| 987 | 978 | |
| 988 | - // Validate sorting option |
|
| 989 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
| 979 | + // Validate relate_to - only category or tags |
|
| 980 | + $params['relate_to'] = geodir_strtolower($params['relate_to']); |
|
| 981 | + if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) { |
|
| 982 | + $params['relate_to'] = 'category'; |
|
| 983 | + } |
|
| 990 | 984 | |
| 991 | - // Validate add_location_filter |
|
| 992 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
| 985 | + // Validate layout selection |
|
| 986 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
| 993 | 987 | |
| 994 | - // Validate listing_width |
|
| 995 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
| 988 | + // Validate sorting option |
|
| 989 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
| 996 | 990 | |
| 997 | - // Validate character_count |
|
| 998 | - $params['character_count'] = absint($params['character_count']); |
|
| 999 | - if (20 > $params['character_count']) { |
|
| 1000 | - $params['character_count'] = 20; |
|
| 1001 | - } |
|
| 991 | + // Validate add_location_filter |
|
| 992 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
| 1002 | 993 | |
| 1003 | - if ($related_display = geodir_related_posts_display($params)) { |
|
| 1004 | - echo $related_display; |
|
| 1005 | - } |
|
| 1006 | - $output = ob_get_contents(); |
|
| 994 | + // Validate listing_width |
|
| 995 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
| 1007 | 996 | |
| 1008 | - ob_end_clean(); |
|
| 997 | + // Validate character_count |
|
| 998 | + $params['character_count'] = absint($params['character_count']); |
|
| 999 | + if (20 > $params['character_count']) { |
|
| 1000 | + $params['character_count'] = 20; |
|
| 1001 | + } |
|
| 1009 | 1002 | |
| 1010 | - return $output; |
|
| 1003 | + if ($related_display = geodir_related_posts_display($params)) { |
|
| 1004 | + echo $related_display; |
|
| 1005 | + } |
|
| 1006 | + $output = ob_get_contents(); |
|
| 1007 | + |
|
| 1008 | + ob_end_clean(); |
|
| 1009 | + |
|
| 1010 | + return $output; |
|
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | 1013 | /** |
@@ -1031,13 +1031,13 @@ discard block |
||
| 1031 | 1031 | * @return string Advanced search widget HTML. |
| 1032 | 1032 | */ |
| 1033 | 1033 | function geodir_sc_advanced_search($atts) { |
| 1034 | - $defaults = array( |
|
| 1034 | + $defaults = array( |
|
| 1035 | 1035 | 'title' => '', |
| 1036 | 1036 | 'before_widget' => '<section id="geodir_advanced_search-1" class="widget geodir-widget geodir_advance_search_widget">', |
| 1037 | - 'after_widget' => '</section>', |
|
| 1038 | - 'before_title' => '<h3 class="widget-title">', |
|
| 1039 | - 'after_title' => '</h3>', |
|
| 1040 | - 'show_adv_search' => 'default', |
|
| 1037 | + 'after_widget' => '</section>', |
|
| 1038 | + 'before_title' => '<h3 class="widget-title">', |
|
| 1039 | + 'after_title' => '</h3>', |
|
| 1040 | + 'show_adv_search' => 'default', |
|
| 1041 | 1041 | 'post_type' => '' |
| 1042 | 1042 | ); |
| 1043 | 1043 | |
@@ -1061,9 +1061,9 @@ discard block |
||
| 1061 | 1061 | the_widget('geodir_advance_search_widget', $params, $params ); |
| 1062 | 1062 | |
| 1063 | 1063 | $output = ob_get_contents(); |
| 1064 | - ob_end_clean(); |
|
| 1064 | + ob_end_clean(); |
|
| 1065 | 1065 | |
| 1066 | - return $output; |
|
| 1066 | + return $output; |
|
| 1067 | 1067 | } |
| 1068 | 1068 | add_shortcode('gd_advanced_search', 'geodir_sc_advanced_search'); |
| 1069 | 1069 | |
@@ -1109,48 +1109,48 @@ discard block |
||
| 1109 | 1109 | 'add_location_filter' => '1', |
| 1110 | 1110 | 'tab_layout' => 'bestof-tabs-on-top', |
| 1111 | 1111 | 'before_widget' => '<section id="bestof_widget-1" class="widget geodir-widget geodir_bestof_widget geodir_sc_bestof_widget">', |
| 1112 | - 'after_widget' => '</section>', |
|
| 1113 | - 'before_title' => '<h3 class="widget-title">', |
|
| 1114 | - 'after_title' => '</h3>', |
|
| 1112 | + 'after_widget' => '</section>', |
|
| 1113 | + 'before_title' => '<h3 class="widget-title">', |
|
| 1114 | + 'after_title' => '</h3>', |
|
| 1115 | 1115 | ); |
| 1116 | 1116 | $params = shortcode_atts($defaults, $atts); |
| 1117 | 1117 | |
| 1118 | - /** |
|
| 1119 | - * Validate our incoming params |
|
| 1120 | - */ |
|
| 1118 | + /** |
|
| 1119 | + * Validate our incoming params |
|
| 1120 | + */ |
|
| 1121 | 1121 | |
| 1122 | - // Validate the selected post type, default to gd_place on fail |
|
| 1123 | - if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
| 1124 | - $params['post_type'] = 'gd_place'; |
|
| 1125 | - } |
|
| 1122 | + // Validate the selected post type, default to gd_place on fail |
|
| 1123 | + if (!(gdsc_is_post_type_valid($params['post_type']))) { |
|
| 1124 | + $params['post_type'] = 'gd_place'; |
|
| 1125 | + } |
|
| 1126 | 1126 | |
| 1127 | 1127 | // Post limit needs to be a positive integer |
| 1128 | - $params['post_limit'] = absint($params['post_limit']); |
|
| 1129 | - if (0 == $params['post_limit']) { |
|
| 1130 | - $params['post_limit'] = 5; |
|
| 1131 | - } |
|
| 1128 | + $params['post_limit'] = absint($params['post_limit']); |
|
| 1129 | + if (0 == $params['post_limit']) { |
|
| 1130 | + $params['post_limit'] = 5; |
|
| 1131 | + } |
|
| 1132 | 1132 | |
| 1133 | 1133 | // Category limit needs to be a positive integer |
| 1134 | - $params['categ_limit'] = absint($params['categ_limit']); |
|
| 1135 | - if (0 == $params['categ_limit']) { |
|
| 1136 | - $params['categ_limit'] = 3; |
|
| 1137 | - } |
|
| 1134 | + $params['categ_limit'] = absint($params['categ_limit']); |
|
| 1135 | + if (0 == $params['categ_limit']) { |
|
| 1136 | + $params['categ_limit'] = 3; |
|
| 1137 | + } |
|
| 1138 | 1138 | |
| 1139 | 1139 | // Tab layout validation |
| 1140 | - $params['tab_layout'] = $params['tab_layout']; |
|
| 1141 | - if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) { |
|
| 1142 | - $params['tab_layout'] = 'bestof-tabs-on-top'; |
|
| 1143 | - } |
|
| 1140 | + $params['tab_layout'] = $params['tab_layout']; |
|
| 1141 | + if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) { |
|
| 1142 | + $params['tab_layout'] = 'bestof-tabs-on-top'; |
|
| 1143 | + } |
|
| 1144 | 1144 | |
| 1145 | 1145 | // Validate character_count |
| 1146 | - $params['character_count'] = $params['character_count']; |
|
| 1146 | + $params['character_count'] = $params['character_count']; |
|
| 1147 | 1147 | |
| 1148 | 1148 | ob_start(); |
| 1149 | 1149 | the_widget('geodir_bestof_widget', $params, $params); |
| 1150 | - $output = ob_get_contents(); |
|
| 1151 | - ob_end_clean(); |
|
| 1150 | + $output = ob_get_contents(); |
|
| 1151 | + ob_end_clean(); |
|
| 1152 | 1152 | |
| 1153 | - return $output; |
|
| 1153 | + return $output; |
|
| 1154 | 1154 | } |
| 1155 | 1155 | add_shortcode('gd_bestof_widget', 'geodir_sc_bestof_widget'); |
| 1156 | 1156 | |
@@ -1198,127 +1198,127 @@ discard block |
||
| 1198 | 1198 | * @return string HTML content to display geodirectory listings. |
| 1199 | 1199 | */ |
| 1200 | 1200 | function geodir_sc_gd_listings($atts, $content = '') { |
| 1201 | - global $post; |
|
| 1202 | - $defaults = array( |
|
| 1203 | - 'title' => '', |
|
| 1204 | - 'post_type' => 'gd_place', |
|
| 1205 | - 'category' => 0, |
|
| 1206 | - 'list_sort' => 'latest', |
|
| 1207 | - 'event_type' => '', |
|
| 1208 | - 'post_number' => 10, |
|
| 1209 | - 'post_author' => '', |
|
| 1210 | - 'layout' => 'gridview_onehalf', |
|
| 1211 | - 'listing_width' => '', |
|
| 1212 | - 'character_count' => 20, |
|
| 1213 | - 'add_location_filter' => 1, |
|
| 1214 | - 'show_featured_only' => '', |
|
| 1215 | - 'show_special_only' => '', |
|
| 1216 | - 'with_pics_only' => '', |
|
| 1217 | - 'with_videos_only' => '', |
|
| 1218 | - 'with_pagination' => '1', |
|
| 1219 | - 'top_pagination' => '0', |
|
| 1220 | - 'bottom_pagination' => '1', |
|
| 1221 | - 'without_no_results' => 0, |
|
| 1222 | - 'tags' => '' |
|
| 1223 | - ); |
|
| 1224 | - $params = shortcode_atts($defaults, $atts); |
|
| 1225 | - |
|
| 1226 | - $params['title'] = wp_strip_all_tags($params['title']); |
|
| 1227 | - $params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place'; |
|
| 1228 | - |
|
| 1229 | - // Validate the selected category/ies - Grab the current list based on post_type |
|
| 1230 | - $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
| 1231 | - $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
| 1232 | - |
|
| 1233 | - // Make sure we have an array |
|
| 1234 | - if (!(is_array($params['category']))) { |
|
| 1235 | - $params['category'] = explode(',', $params['category']); |
|
| 1236 | - } |
|
| 1237 | - |
|
| 1238 | - // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
| 1239 | - // Otherwise it becomes empty and later on that will mean "All" |
|
| 1240 | - $params['category'] = array_intersect($params['category'], $categories); |
|
| 1241 | - |
|
| 1242 | - // Post_number needs to be a positive integer |
|
| 1243 | - $params['post_number'] = absint($params['post_number']); |
|
| 1244 | - $params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10; |
|
| 1201 | + global $post; |
|
| 1202 | + $defaults = array( |
|
| 1203 | + 'title' => '', |
|
| 1204 | + 'post_type' => 'gd_place', |
|
| 1205 | + 'category' => 0, |
|
| 1206 | + 'list_sort' => 'latest', |
|
| 1207 | + 'event_type' => '', |
|
| 1208 | + 'post_number' => 10, |
|
| 1209 | + 'post_author' => '', |
|
| 1210 | + 'layout' => 'gridview_onehalf', |
|
| 1211 | + 'listing_width' => '', |
|
| 1212 | + 'character_count' => 20, |
|
| 1213 | + 'add_location_filter' => 1, |
|
| 1214 | + 'show_featured_only' => '', |
|
| 1215 | + 'show_special_only' => '', |
|
| 1216 | + 'with_pics_only' => '', |
|
| 1217 | + 'with_videos_only' => '', |
|
| 1218 | + 'with_pagination' => '1', |
|
| 1219 | + 'top_pagination' => '0', |
|
| 1220 | + 'bottom_pagination' => '1', |
|
| 1221 | + 'without_no_results' => 0, |
|
| 1222 | + 'tags' => '' |
|
| 1223 | + ); |
|
| 1224 | + $params = shortcode_atts($defaults, $atts); |
|
| 1225 | + |
|
| 1226 | + $params['title'] = wp_strip_all_tags($params['title']); |
|
| 1227 | + $params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place'; |
|
| 1228 | + |
|
| 1229 | + // Validate the selected category/ies - Grab the current list based on post_type |
|
| 1230 | + $category_taxonomy = geodir_get_taxonomies($params['post_type']); |
|
| 1231 | + $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids')); |
|
| 1232 | + |
|
| 1233 | + // Make sure we have an array |
|
| 1234 | + if (!(is_array($params['category']))) { |
|
| 1235 | + $params['category'] = explode(',', $params['category']); |
|
| 1236 | + } |
|
| 1237 | + |
|
| 1238 | + // Array_intersect returns only the items in $params['category'] that are also in our category list |
|
| 1239 | + // Otherwise it becomes empty and later on that will mean "All" |
|
| 1240 | + $params['category'] = array_intersect($params['category'], $categories); |
|
| 1241 | + |
|
| 1242 | + // Post_number needs to be a positive integer |
|
| 1243 | + $params['post_number'] = absint($params['post_number']); |
|
| 1244 | + $params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10; |
|
| 1245 | 1245 | |
| 1246 | - // Post_number needs to be a positive integer |
|
| 1247 | - if (!empty($atts['post_author'])) { |
|
| 1248 | - if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') { |
|
| 1249 | - $params['post_author'] = $post->post_author; |
|
| 1250 | - } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) { |
|
| 1251 | - $params['post_author'] = absint($atts['post_author']); |
|
| 1252 | - } else { |
|
| 1253 | - unset($params['post_author']); |
|
| 1254 | - } |
|
| 1255 | - } else { |
|
| 1256 | - unset($params['post_author']); |
|
| 1257 | - } |
|
| 1258 | - |
|
| 1259 | - // Validate character_count |
|
| 1260 | - //todo: is this necessary? |
|
| 1261 | - $params['character_count'] = $params['character_count']; |
|
| 1262 | - |
|
| 1263 | - // Validate our layout choice |
|
| 1264 | - // Outside of the norm, I added some more simple terms to match the existing |
|
| 1265 | - // So now I just run the switch to set it properly. |
|
| 1266 | - $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
| 1267 | - |
|
| 1268 | - // Validate our sorting choice |
|
| 1269 | - $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
| 1270 | - |
|
| 1271 | - // Validate Listing width, used in the template widget-listing-listview.php |
|
| 1272 | - // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
| 1273 | - $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
| 1274 | - |
|
| 1275 | - // Validate the checkboxes used on the widget |
|
| 1276 | - $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
| 1277 | - $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
| 1278 | - $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
| 1279 | - $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
| 1280 | - $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
| 1281 | - $params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']); |
|
| 1282 | - $params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']); |
|
| 1283 | - $params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']); |
|
| 1284 | - |
|
| 1285 | - // Clean tags |
|
| 1286 | - if (!empty($params['tags'])) { |
|
| 1287 | - if (!is_array($params['tags'])) { |
|
| 1288 | - $comma = _x(',', 'tag delimiter'); |
|
| 1289 | - if ( ',' !== $comma ) { |
|
| 1290 | - $params['tags'] = str_replace($comma, ',', $params['tags']); |
|
| 1291 | - } |
|
| 1292 | - $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,")); |
|
| 1293 | - $params['tags'] = array_map('trim', $params['tags']); |
|
| 1294 | - } |
|
| 1295 | - } else { |
|
| 1296 | - $params['tags'] = array(); |
|
| 1297 | - } |
|
| 1298 | - |
|
| 1299 | - /** |
|
| 1300 | - * End of validation |
|
| 1301 | - */ |
|
| 1302 | - if (isset($atts['geodir_ajax'])) { |
|
| 1303 | - $params['geodir_ajax'] = $atts['geodir_ajax']; |
|
| 1304 | - unset($atts['geodir_ajax']); |
|
| 1305 | - } |
|
| 1306 | - if (isset($atts['pageno'])) { |
|
| 1307 | - $params['pageno'] = $atts['pageno']; |
|
| 1308 | - unset($atts['pageno']); |
|
| 1309 | - } |
|
| 1310 | - |
|
| 1311 | - if ( !empty($atts['shortcode_content']) ) { |
|
| 1312 | - $content = $atts['shortcode_content']; |
|
| 1313 | - } |
|
| 1314 | - $params['shortcode_content'] = trim($content); |
|
| 1315 | - $atts['shortcode_content'] = trim($content); |
|
| 1246 | + // Post_number needs to be a positive integer |
|
| 1247 | + if (!empty($atts['post_author'])) { |
|
| 1248 | + if ($atts['post_author'] == 'current' && !empty($post) && isset($post->post_author) && $post->post_type != 'page') { |
|
| 1249 | + $params['post_author'] = $post->post_author; |
|
| 1250 | + } else if ($atts['post_author'] != 'current' && absint($atts['post_author']) > 0) { |
|
| 1251 | + $params['post_author'] = absint($atts['post_author']); |
|
| 1252 | + } else { |
|
| 1253 | + unset($params['post_author']); |
|
| 1254 | + } |
|
| 1255 | + } else { |
|
| 1256 | + unset($params['post_author']); |
|
| 1257 | + } |
|
| 1258 | + |
|
| 1259 | + // Validate character_count |
|
| 1260 | + //todo: is this necessary? |
|
| 1261 | + $params['character_count'] = $params['character_count']; |
|
| 1262 | + |
|
| 1263 | + // Validate our layout choice |
|
| 1264 | + // Outside of the norm, I added some more simple terms to match the existing |
|
| 1265 | + // So now I just run the switch to set it properly. |
|
| 1266 | + $params['layout'] = gdsc_validate_layout_choice($params['layout']); |
|
| 1267 | + |
|
| 1268 | + // Validate our sorting choice |
|
| 1269 | + $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); |
|
| 1270 | + |
|
| 1271 | + // Validate Listing width, used in the template widget-listing-listview.php |
|
| 1272 | + // The context is in width=$listing_width% - So we need a positive number between 0 & 100 |
|
| 1273 | + $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']); |
|
| 1274 | + |
|
| 1275 | + // Validate the checkboxes used on the widget |
|
| 1276 | + $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']); |
|
| 1277 | + $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']); |
|
| 1278 | + $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']); |
|
| 1279 | + $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']); |
|
| 1280 | + $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']); |
|
| 1281 | + $params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']); |
|
| 1282 | + $params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']); |
|
| 1283 | + $params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']); |
|
| 1284 | + |
|
| 1285 | + // Clean tags |
|
| 1286 | + if (!empty($params['tags'])) { |
|
| 1287 | + if (!is_array($params['tags'])) { |
|
| 1288 | + $comma = _x(',', 'tag delimiter'); |
|
| 1289 | + if ( ',' !== $comma ) { |
|
| 1290 | + $params['tags'] = str_replace($comma, ',', $params['tags']); |
|
| 1291 | + } |
|
| 1292 | + $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,")); |
|
| 1293 | + $params['tags'] = array_map('trim', $params['tags']); |
|
| 1294 | + } |
|
| 1295 | + } else { |
|
| 1296 | + $params['tags'] = array(); |
|
| 1297 | + } |
|
| 1298 | + |
|
| 1299 | + /** |
|
| 1300 | + * End of validation |
|
| 1301 | + */ |
|
| 1302 | + if (isset($atts['geodir_ajax'])) { |
|
| 1303 | + $params['geodir_ajax'] = $atts['geodir_ajax']; |
|
| 1304 | + unset($atts['geodir_ajax']); |
|
| 1305 | + } |
|
| 1306 | + if (isset($atts['pageno'])) { |
|
| 1307 | + $params['pageno'] = $atts['pageno']; |
|
| 1308 | + unset($atts['pageno']); |
|
| 1309 | + } |
|
| 1310 | + |
|
| 1311 | + if ( !empty($atts['shortcode_content']) ) { |
|
| 1312 | + $content = $atts['shortcode_content']; |
|
| 1313 | + } |
|
| 1314 | + $params['shortcode_content'] = trim($content); |
|
| 1315 | + $atts['shortcode_content'] = trim($content); |
|
| 1316 | 1316 | |
| 1317 | - $params['shortcode_atts'] = $atts; |
|
| 1317 | + $params['shortcode_atts'] = $atts; |
|
| 1318 | 1318 | |
| 1319 | - $output = geodir_sc_gd_listings_output($params); |
|
| 1319 | + $output = geodir_sc_gd_listings_output($params); |
|
| 1320 | 1320 | |
| 1321 | - return $output; |
|
| 1321 | + return $output; |
|
| 1322 | 1322 | } |
| 1323 | 1323 | add_shortcode('gd_listings', 'geodir_sc_gd_listings'); |
| 1324 | 1324 | |
@@ -1358,56 +1358,56 @@ discard block |
||
| 1358 | 1358 | * @return string HTML content to display CPT categories. |
| 1359 | 1359 | */ |
| 1360 | 1360 | function geodir_sc_cpt_categories_widget($atts, $content = '') { |
| 1361 | - $defaults = array( |
|
| 1362 | - 'title' => '', |
|
| 1363 | - 'post_type' => '', // NULL for all |
|
| 1364 | - 'hide_empty' => '', |
|
| 1365 | - 'show_count' => '', |
|
| 1366 | - 'hide_icon' => '', |
|
| 1367 | - 'cpt_left' => '', |
|
| 1368 | - 'sort_by' => 'count', |
|
| 1369 | - 'max_count' => 'all', |
|
| 1370 | - 'max_level' => '1', |
|
| 1371 | - 'no_cpt_filter' => '', |
|
| 1372 | - 'no_cat_filter' => '', |
|
| 1373 | - 'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">', |
|
| 1374 | - 'after_widget' => '</section>', |
|
| 1375 | - 'before_title' => '<h3 class="widget-title">', |
|
| 1376 | - 'after_title' => '</h3>', |
|
| 1377 | - ); |
|
| 1378 | - $params = shortcode_atts($defaults, $atts); |
|
| 1379 | - |
|
| 1380 | - /** |
|
| 1381 | - * Validate our incoming params |
|
| 1382 | - */ |
|
| 1383 | - // Make sure we have an array |
|
| 1384 | - $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array(); |
|
| 1385 | - |
|
| 1386 | - // Validate the checkboxes used on the widget |
|
| 1387 | - $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
|
| 1388 | - $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
|
| 1389 | - $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
| 1390 | - $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
| 1361 | + $defaults = array( |
|
| 1362 | + 'title' => '', |
|
| 1363 | + 'post_type' => '', // NULL for all |
|
| 1364 | + 'hide_empty' => '', |
|
| 1365 | + 'show_count' => '', |
|
| 1366 | + 'hide_icon' => '', |
|
| 1367 | + 'cpt_left' => '', |
|
| 1368 | + 'sort_by' => 'count', |
|
| 1369 | + 'max_count' => 'all', |
|
| 1370 | + 'max_level' => '1', |
|
| 1371 | + 'no_cpt_filter' => '', |
|
| 1372 | + 'no_cat_filter' => '', |
|
| 1373 | + 'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">', |
|
| 1374 | + 'after_widget' => '</section>', |
|
| 1375 | + 'before_title' => '<h3 class="widget-title">', |
|
| 1376 | + 'after_title' => '</h3>', |
|
| 1377 | + ); |
|
| 1378 | + $params = shortcode_atts($defaults, $atts); |
|
| 1391 | 1379 | |
| 1392 | - if ($params['max_count'] != 'all') { |
|
| 1393 | - $params['max_count'] = absint($params['max_count']); |
|
| 1394 | - } |
|
| 1380 | + /** |
|
| 1381 | + * Validate our incoming params |
|
| 1382 | + */ |
|
| 1383 | + // Make sure we have an array |
|
| 1384 | + $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array(); |
|
| 1385 | + |
|
| 1386 | + // Validate the checkboxes used on the widget |
|
| 1387 | + $params['hide_empty'] = gdsc_to_bool_val($params['hide_empty']); |
|
| 1388 | + $params['show_count'] = gdsc_to_bool_val($params['show_count']); |
|
| 1389 | + $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']); |
|
| 1390 | + $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']); |
|
| 1391 | + |
|
| 1392 | + if ($params['max_count'] != 'all') { |
|
| 1393 | + $params['max_count'] = absint($params['max_count']); |
|
| 1394 | + } |
|
| 1395 | 1395 | |
| 1396 | - if ($params['max_level'] != 'all') { |
|
| 1397 | - $params['max_level'] = absint($params['max_level']); |
|
| 1398 | - } |
|
| 1396 | + if ($params['max_level'] != 'all') { |
|
| 1397 | + $params['max_level'] = absint($params['max_level']); |
|
| 1398 | + } |
|
| 1399 | 1399 | |
| 1400 | - $params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']); |
|
| 1401 | - $params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']); |
|
| 1400 | + $params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']); |
|
| 1401 | + $params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']); |
|
| 1402 | 1402 | |
| 1403 | - $params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count'; |
|
| 1403 | + $params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count'; |
|
| 1404 | 1404 | |
| 1405 | - ob_start(); |
|
| 1406 | - the_widget('geodir_cpt_categories_widget', $params, $params); |
|
| 1407 | - $output = ob_get_contents(); |
|
| 1408 | - ob_end_clean(); |
|
| 1405 | + ob_start(); |
|
| 1406 | + the_widget('geodir_cpt_categories_widget', $params, $params); |
|
| 1407 | + $output = ob_get_contents(); |
|
| 1408 | + ob_end_clean(); |
|
| 1409 | 1409 | |
| 1410 | - return $output; |
|
| 1410 | + return $output; |
|
| 1411 | 1411 | } |
| 1412 | 1412 | add_shortcode('gd_cpt_categories', 'geodir_sc_cpt_categories_widget'); |
| 1413 | 1413 | |
@@ -1422,6 +1422,6 @@ discard block |
||
| 1422 | 1422 | * @return string HTML code. |
| 1423 | 1423 | */ |
| 1424 | 1424 | function geodir_sc_responsive_videos($atts, $content) { |
| 1425 | - return '<div class="geodir-video-wrapper">'.$content.'</div>'; |
|
| 1425 | + return '<div class="geodir-video-wrapper">'.$content.'</div>'; |
|
| 1426 | 1426 | } |
| 1427 | 1427 | add_shortcode('gd_video', 'geodir_sc_responsive_videos'); |
| 1428 | 1428 | \ No newline at end of file |
@@ -427,7 +427,7 @@ |
||
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | return $output; |
| 430 | - }else{ |
|
| 430 | + } else{ |
|
| 431 | 431 | ob_start(); |
| 432 | 432 | add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array |
| 433 | 433 | add_action('the_post', 'create_list_jsondata'); // Add marker in json array |
@@ -35,19 +35,19 @@ discard block |
||
| 35 | 35 | $defaultcity = isset($default_location->city) ? $default_location->city : ''; |
| 36 | 36 | $lat_lng_blank = false; |
| 37 | 37 | if ($lat == '' && $lng == '') {
|
| 38 | - $lat_lng_blank = true; |
|
| 39 | - $city = $defaultcity; |
|
| 40 | - $region = isset($default_location->region) ? $default_location->region : ''; |
|
| 41 | - $country = isset($default_location->country) ? $default_location->country : ''; |
|
| 42 | - $lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 43 | - $lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 38 | + $lat_lng_blank = true; |
|
| 39 | + $city = $defaultcity; |
|
| 40 | + $region = isset($default_location->region) ? $default_location->region : ''; |
|
| 41 | + $country = isset($default_location->country) ? $default_location->country : ''; |
|
| 42 | + $lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 43 | + $lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 44 | 44 | } |
| 45 | 45 | $default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
| 46 | 46 | $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
| 47 | 47 | if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') {
|
| 48 | - $mapzoom = 4; |
|
| 49 | - if (isset($_REQUEST['add_hood'])) |
|
| 50 | - $mapzoom = 10; |
|
| 48 | + $mapzoom = 4; |
|
| 49 | + if (isset($_REQUEST['add_hood'])) |
|
| 50 | + $mapzoom = 10; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * Fires at the start of the add javascript on the add lsitings map. |
| 69 | 69 | * |
| 70 | 70 | * @since 1.0.0 |
| 71 | - * @param string $prefix The prefix for all elements. |
|
| 71 | + * @param string $prefix The prefix for all elements. |
|
| 72 | 72 | */ |
| 73 | 73 | do_action('geodir_add_listing_js_start', $prefix);
|
| 74 | 74 | ?> |
@@ -260,12 +260,12 @@ discard block |
||
| 260 | 260 | // fix for regions in GB |
| 261 | 261 | |
| 262 | 262 | $country_arr = <?php |
| 263 | - /** |
|
| 264 | - * Filter the regions array that uses administrative_area_level_2 instead of administrative_area_level_1. |
|
| 265 | - * |
|
| 266 | - * @since 1.6.16 |
|
| 267 | - */ |
|
| 268 | - echo apply_filters("geodir_geocode_region_level",'["GB","ES"]');?>;
|
|
| 263 | + /** |
|
| 264 | + * Filter the regions array that uses administrative_area_level_2 instead of administrative_area_level_1. |
|
| 265 | + * |
|
| 266 | + * @since 1.6.16 |
|
| 267 | + */ |
|
| 268 | + echo apply_filters("geodir_geocode_region_level",'["GB","ES"]');?>;
|
|
| 269 | 269 | if (jQuery.inArray(rr, $country_arr) !== -1) {
|
| 270 | 270 | if (administrative_area_level_2.long_name) {
|
| 271 | 271 | getState = administrative_area_level_2.long_name; |
@@ -339,13 +339,13 @@ discard block |
||
| 339 | 339 | getZip = postal_code.long_name; |
| 340 | 340 | } |
| 341 | 341 | <?php |
| 342 | - /** |
|
| 343 | - * Fires to add javascript variable to use in google map. |
|
| 344 | - * |
|
| 345 | - * @since 1.0.0 |
|
| 346 | - */ |
|
| 347 | - do_action('geodir_add_listing_geocode_js_vars');
|
|
| 348 | - ?> |
|
| 342 | + /** |
|
| 343 | + * Fires to add javascript variable to use in google map. |
|
| 344 | + * |
|
| 345 | + * @since 1.0.0 |
|
| 346 | + */ |
|
| 347 | + do_action('geodir_add_listing_geocode_js_vars');
|
|
| 348 | + ?> |
|
| 349 | 349 | <?php if ($is_map_restrict) { ?>
|
| 350 | 350 | if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
|
| 351 | 351 | alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
|
@@ -426,15 +426,15 @@ discard block |
||
| 426 | 426 | } |
| 427 | 427 | } |
| 428 | 428 | <?php |
| 429 | - /** |
|
| 430 | - * Fires when marker address updated on map. |
|
| 431 | - * |
|
| 432 | - * @since 1.0.0 |
|
| 433 | - * @param string $prefix Identifier used as a prefix for field name |
|
| 434 | - */ |
|
| 435 | - do_action('geodir_update_marker_address', $prefix);
|
|
| 436 | - echo $updateMarkerAddress = ob_get_clean(); |
|
| 437 | - ?> |
|
| 429 | + /** |
|
| 430 | + * Fires when marker address updated on map. |
|
| 431 | + * |
|
| 432 | + * @since 1.0.0 |
|
| 433 | + * @param string $prefix Identifier used as a prefix for field name |
|
| 434 | + */ |
|
| 435 | + do_action('geodir_update_marker_address', $prefix);
|
|
| 436 | + echo $updateMarkerAddress = ob_get_clean(); |
|
| 437 | + ?> |
|
| 438 | 438 | } |
| 439 | 439 | function geodir_codeAddress(set_on_map) {
|
| 440 | 440 | var address = jQuery('#<?php echo $prefix.'address';?>').val();
|
@@ -464,9 +464,9 @@ discard block |
||
| 464 | 464 | } |
| 465 | 465 | var is_restrict = '<?php echo $is_map_restrict; ?>'; |
| 466 | 466 | <?php ob_start(); |
| 467 | - $defaultregion = isset($default_location->region) ? $default_location->region : ''; |
|
| 468 | - $defaultcountry = isset($default_location->country) ? $default_location->country : ''; |
|
| 469 | - ?> |
|
| 467 | + $defaultregion = isset($default_location->region) ? $default_location->region : ''; |
|
| 468 | + $defaultcountry = isset($default_location->country) ? $default_location->country : ''; |
|
| 469 | + ?> |
|
| 470 | 470 | if (set_on_map && is_restrict) {
|
| 471 | 471 | if (zip != '' && address != '') {
|
| 472 | 472 | address = address + ',' + zip; |
@@ -478,12 +478,12 @@ discard block |
||
| 478 | 478 | if( address == city || address == region || address == country || address == zip ) |
| 479 | 479 | address = ''; |
| 480 | 480 | <?php |
| 481 | - if(is_admin() && isset($_REQUEST['tab'])){?>
|
|
| 481 | + if(is_admin() && isset($_REQUEST['tab'])){?>
|
|
| 482 | 482 | if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
|
| 483 | 483 | address = ''; |
| 484 | 484 | } |
| 485 | 485 | <?php |
| 486 | - }?> |
|
| 486 | + }?> |
|
| 487 | 487 | |
| 488 | 488 | if (ISO2 == 'GB') {
|
| 489 | 489 | address = address + ',' + city + ',' + country; // UK is funny with regions |
@@ -499,15 +499,15 @@ discard block |
||
| 499 | 499 | address = address.replace(",null,", ",");
|
| 500 | 500 | } |
| 501 | 501 | <?php $codeAddress = ob_get_clean(); |
| 502 | - /** |
|
| 503 | - * Filter the address variable |
|
| 504 | - * |
|
| 505 | - * @since 1.0.0 |
|
| 506 | - * |
|
| 507 | - * @param string $codeAddress Row of address to use in google map. |
|
| 508 | - */ |
|
| 509 | - echo apply_filters('geodir_codeaddress', $codeAddress);
|
|
| 510 | - ?> |
|
| 502 | + /** |
|
| 503 | + * Filter the address variable |
|
| 504 | + * |
|
| 505 | + * @since 1.0.0 |
|
| 506 | + * |
|
| 507 | + * @param string $codeAddress Row of address to use in google map. |
|
| 508 | + */ |
|
| 509 | + echo apply_filters('geodir_codeaddress', $codeAddress);
|
|
| 510 | + ?> |
|
| 511 | 511 | if (!window.gdMaps) { // No Google Map Loaded
|
| 512 | 512 | return; |
| 513 | 513 | } |
@@ -532,13 +532,13 @@ discard block |
||
| 532 | 532 | updateMarkerPosition(baseMarker.getPosition()); |
| 533 | 533 | //if(set_on_map && is_restrict) {
|
| 534 | 534 | <?php |
| 535 | - /** |
|
| 536 | - * Fires before set geocode position. |
|
| 537 | - * |
|
| 538 | - * @since 1.0.0 |
|
| 539 | - */ |
|
| 540 | - do_action('geodir_add_listing_codeaddress_before_geocode');
|
|
| 541 | - ?> |
|
| 535 | + /** |
|
| 536 | + * Fires before set geocode position. |
|
| 537 | + * |
|
| 538 | + * @since 1.0.0 |
|
| 539 | + */ |
|
| 540 | + do_action('geodir_add_listing_codeaddress_before_geocode');
|
|
| 541 | + ?> |
|
| 542 | 542 | geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
|
| 543 | 543 | //} |
| 544 | 544 | } else {
|
@@ -584,13 +584,13 @@ discard block |
||
| 584 | 584 | updateMarkerPositionOSM(baseMarker.getLatLng()); |
| 585 | 585 | } |
| 586 | 586 | <?php |
| 587 | - /** |
|
| 588 | - * Fires to add javascript variable to use in google map. |
|
| 589 | - * |
|
| 590 | - * @since 1.0.0 |
|
| 591 | - */ |
|
| 592 | - do_action('geodir_add_listing_geocode_js_vars');
|
|
| 593 | - ?> |
|
| 587 | + /** |
|
| 588 | + * Fires to add javascript variable to use in google map. |
|
| 589 | + * |
|
| 590 | + * @since 1.0.0 |
|
| 591 | + */ |
|
| 592 | + do_action('geodir_add_listing_geocode_js_vars');
|
|
| 593 | + ?> |
|
| 594 | 594 | <?php if ($is_map_restrict) { ?>
|
| 595 | 595 | if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
|
| 596 | 596 | alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
|
@@ -738,7 +738,7 @@ discard block |
||
| 738 | 738 | <?php |
| 739 | 739 | $set_button_class = 'geodir_button'; |
| 740 | 740 | if (is_admin()) |
| 741 | - $set_button_class = 'button-primary'; |
|
| 741 | + $set_button_class = 'button-primary'; |
|
| 742 | 742 | ?> |
| 743 | 743 | <input type="button" id="<?php echo $prefix; ?>set_address_button" class="<?php echo $set_button_class; ?>" value="<?php esc_attr_e($map_title, 'geodirectory'); ?>" style="float:none;"/> |
| 744 | 744 | <div id="<?php echo $prefix; ?>d_mouseClick"></div> |
@@ -82,16 +82,16 @@ discard block |
||
| 82 | 82 | window.gdMaps = window.gdMaps || gdMaps; |
| 83 | 83 | |
| 84 | 84 | user_address = false; |
| 85 | - jQuery('#<?php echo $prefix.'address';?>').keypress(function () {
|
|
| 85 | + jQuery('#<?php echo $prefix.'address'; ?>').keypress(function () {
|
|
| 86 | 86 | user_address = true; |
| 87 | 87 | }); |
| 88 | 88 | |
| 89 | 89 | baseMarker = ''; |
| 90 | 90 | geocoder = ''; |
| 91 | - var <?php echo $prefix;?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat : '39.952484'; ?>; |
|
| 92 | - var <?php echo $prefix;?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng : '-75.163786'; ?>; |
|
| 93 | - <?php if($lat_lng_blank){$lat='';$lng='';}?>
|
|
| 94 | - var <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12;?>; |
|
| 91 | + var <?php echo $prefix; ?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat : '39.952484'; ?>; |
|
| 92 | + var <?php echo $prefix; ?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng : '-75.163786'; ?>; |
|
| 93 | + <?php if ($lat_lng_blank) {$lat = ''; $lng = ''; }?>
|
|
| 94 | + var <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12; ?>; |
|
| 95 | 95 | var minZoomLevel = <?php echo ($is_map_restrict) ? 5 : 0; ?>; |
| 96 | 96 | var oldstr_address; |
| 97 | 97 | var oldstr_zip; |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | * |
| 266 | 266 | * @since 1.6.16 |
| 267 | 267 | */ |
| 268 | - echo apply_filters("geodir_geocode_region_level",'["GB","ES"]');?>;
|
|
| 268 | + echo apply_filters("geodir_geocode_region_level", '["GB","ES"]'); ?>;
|
|
| 269 | 269 | if (jQuery.inArray(rr, $country_arr) !== -1) {
|
| 270 | 270 | if (administrative_area_level_2.long_name) {
|
| 271 | 271 | getState = administrative_area_level_2.long_name; |
@@ -347,9 +347,9 @@ discard block |
||
| 347 | 347 | do_action('geodir_add_listing_geocode_js_vars');
|
| 348 | 348 | ?> |
| 349 | 349 | <?php if ($is_map_restrict) { ?>
|
| 350 | - if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
|
|
| 351 | - alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
|
|
| 352 | - jQuery("#<?php echo $prefix.'map';?>").goMap();
|
|
| 350 | + if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
|
|
| 351 | + alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
|
|
| 352 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 353 | 353 | jQuery.goMap.map.setCenter(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
|
| 354 | 354 | baseMarker.setPosition(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
|
| 355 | 355 | updateMarkerPosition(baseMarker.getPosition()); |
@@ -358,11 +358,11 @@ discard block |
||
| 358 | 358 | <?php } ?> |
| 359 | 359 | updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry); |
| 360 | 360 | } else {
|
| 361 | - updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
|
|
| 361 | + updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
|
|
| 362 | 362 | } |
| 363 | 363 | } |
| 364 | 364 | function centerMap(latlng) {
|
| 365 | - jQuery("#<?php echo $prefix.'map';?>").goMap();
|
|
| 365 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 366 | 366 | if (window.gdMaps == 'google') {
|
| 367 | 367 | jQuery.goMap.map.panTo(baseMarker.getPosition()); |
| 368 | 368 | } else if (window.gdMaps == 'osm') {
|
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | } |
| 372 | 372 | } |
| 373 | 373 | function centerMarker() {
|
| 374 | - jQuery("#<?php echo $prefix.'map';?>").goMap();
|
|
| 374 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 375 | 375 | var center = jQuery.goMap.map.getCenter(); |
| 376 | 376 | if (window.gdMaps == 'google') {
|
| 377 | 377 | baseMarker.setPosition(center); |
@@ -380,48 +380,48 @@ discard block |
||
| 380 | 380 | } |
| 381 | 381 | } |
| 382 | 382 | function updateMapZoom(zoom) {
|
| 383 | - jQuery('#<?php echo $prefix.'mapzoom';?>').val(zoom);
|
|
| 383 | + jQuery('#<?php echo $prefix.'mapzoom'; ?>').val(zoom);
|
|
| 384 | 384 | } |
| 385 | 385 | function updateMarkerPosition(markerlatLng) {
|
| 386 | - jQuery("#<?php echo $prefix.'map';?>").goMap();
|
|
| 387 | - jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat());
|
|
| 388 | - jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng());
|
|
| 386 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 387 | + jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat());
|
|
| 388 | + jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng());
|
|
| 389 | 389 | } |
| 390 | 390 | function updateMarkerPositionOSM(markerlatLng) {
|
| 391 | - jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat);
|
|
| 392 | - jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng);
|
|
| 391 | + jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat);
|
|
| 392 | + jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng);
|
|
| 393 | 393 | } |
| 394 | 394 | function updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry) {
|
| 395 | - var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields);?>'; |
|
| 396 | - <?php ob_start();?> |
|
| 397 | - var old_country = jQuery("#<?php echo $prefix.'country';?>").val();
|
|
| 398 | - var old_region = jQuery("#<?php echo $prefix.'region';?>").val();
|
|
| 395 | + var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields); ?>'; |
|
| 396 | + <?php ob_start(); ?> |
|
| 397 | + var old_country = jQuery("#<?php echo $prefix.'country'; ?>").val();
|
|
| 398 | + var old_region = jQuery("#<?php echo $prefix.'region'; ?>").val();
|
|
| 399 | 399 | |
| 400 | - if (user_address == false || jQuery('#<?php echo $prefix.'address';?>').val() == '') {
|
|
| 401 | - jQuery("#<?php echo $prefix.'address';?>").val(getAddress);
|
|
| 400 | + if (user_address == false || jQuery('#<?php echo $prefix.'address'; ?>').val() == '') {
|
|
| 401 | + jQuery("#<?php echo $prefix.'address'; ?>").val(getAddress);
|
|
| 402 | 402 | } |
| 403 | 403 | if (getAddress) {
|
| 404 | 404 | oldstr_address = getAddress; |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | - jQuery("#<?php echo $prefix.'zip';?>").val(getZip);
|
|
| 407 | + jQuery("#<?php echo $prefix.'zip'; ?>").val(getZip);
|
|
| 408 | 408 | if (getZip) {
|
| 409 | 409 | oldstr_zip = getZip; |
| 410 | 410 | } |
| 411 | 411 | if (set_map_val_in_fields) {
|
| 412 | 412 | if (getCountry) {
|
| 413 | - jQuery('#<?php echo $prefix .'country'; ?> option[value=""]').attr("selected",false);
|
|
| 414 | - jQuery('#<?php echo $prefix.'country';?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
|
|
| 415 | - jQuery("#<?php echo $prefix.'country';?>").trigger("chosen:updated");
|
|
| 413 | + jQuery('#<?php echo $prefix.'country'; ?> option[value=""]').attr("selected",false);
|
|
| 414 | + jQuery('#<?php echo $prefix.'country'; ?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
|
|
| 415 | + jQuery("#<?php echo $prefix.'country'; ?>").trigger("chosen:updated");
|
|
| 416 | 416 | } |
| 417 | 417 | if (getState) {
|
| 418 | - if (jQuery('input[id="<?php echo $prefix.'region';?>"]').attr('id')) {
|
|
| 419 | - jQuery("#<?php echo $prefix.'region';?>").val(getState);
|
|
| 418 | + if (jQuery('input[id="<?php echo $prefix.'region'; ?>"]').attr('id')) {
|
|
| 419 | + jQuery("#<?php echo $prefix.'region'; ?>").val(getState);
|
|
| 420 | 420 | } |
| 421 | 421 | } |
| 422 | 422 | if (getCity) {
|
| 423 | - if (jQuery('input[id="<?php echo $prefix.'city';?>"]').attr('id')) {
|
|
| 424 | - jQuery("#<?php echo $prefix.'city';?>").val(getCity);
|
|
| 423 | + if (jQuery('input[id="<?php echo $prefix.'city'; ?>"]').attr('id')) {
|
|
| 424 | + jQuery("#<?php echo $prefix.'city'; ?>").val(getCity);
|
|
| 425 | 425 | } |
| 426 | 426 | } |
| 427 | 427 | } |
@@ -437,15 +437,15 @@ discard block |
||
| 437 | 437 | ?> |
| 438 | 438 | } |
| 439 | 439 | function geodir_codeAddress(set_on_map) {
|
| 440 | - var address = jQuery('#<?php echo $prefix.'address';?>').val();
|
|
| 441 | - var zip = jQuery('#<?php echo $prefix.'zip';?>').val();
|
|
| 442 | - var city = jQuery('#<?php echo $prefix.'city';?>').val();
|
|
| 443 | - var region = jQuery('#<?php echo $prefix.'region';?>').val();
|
|
| 444 | - var country = jQuery('#<?php echo $prefix.'country';?>').val();
|
|
| 445 | - var country_selected = jQuery('#<?php echo $prefix.'country';?>').find('option:selected');
|
|
| 440 | + var address = jQuery('#<?php echo $prefix.'address'; ?>').val();
|
|
| 441 | + var zip = jQuery('#<?php echo $prefix.'zip'; ?>').val();
|
|
| 442 | + var city = jQuery('#<?php echo $prefix.'city'; ?>').val();
|
|
| 443 | + var region = jQuery('#<?php echo $prefix.'region'; ?>').val();
|
|
| 444 | + var country = jQuery('#<?php echo $prefix.'country'; ?>').val();
|
|
| 445 | + var country_selected = jQuery('#<?php echo $prefix.'country'; ?>').find('option:selected');
|
|
| 446 | 446 | var ISO2 = country_selected.data('country_code');
|
| 447 | - if (!ISO2 && jQuery('#<?php echo $prefix.'country';?>').data('country_code')) {
|
|
| 448 | - ISO2 = jQuery('#<?php echo $prefix.'country';?>').data('country_code');
|
|
| 447 | + if (!ISO2 && jQuery('#<?php echo $prefix.'country'; ?>').data('country_code')) {
|
|
| 448 | + ISO2 = jQuery('#<?php echo $prefix.'country'; ?>').data('country_code');
|
|
| 449 | 449 | } |
| 450 | 450 | if (ISO2 == '--') {
|
| 451 | 451 | ISO2 = ''; |
@@ -454,13 +454,13 @@ discard block |
||
| 454 | 454 | zip = ''; |
| 455 | 455 | } |
| 456 | 456 | if (typeof city == "undefined") {
|
| 457 | - city = '<?php echo addslashes_gpc($city);?>'; |
|
| 457 | + city = '<?php echo addslashes_gpc($city); ?>'; |
|
| 458 | 458 | } |
| 459 | 459 | if (typeof region == "undefined") {
|
| 460 | - region = '<?php echo addslashes_gpc($region);?>'; |
|
| 460 | + region = '<?php echo addslashes_gpc($region); ?>'; |
|
| 461 | 461 | } |
| 462 | 462 | if (typeof country == "undefined") {
|
| 463 | - country = '<?php echo addslashes_gpc($country);?>'; |
|
| 463 | + country = '<?php echo addslashes_gpc($country); ?>'; |
|
| 464 | 464 | } |
| 465 | 465 | var is_restrict = '<?php echo $is_map_restrict; ?>'; |
| 466 | 466 | <?php ob_start(); |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | if( address == city || address == region || address == country || address == zip ) |
| 479 | 479 | address = ''; |
| 480 | 480 | <?php |
| 481 | - if(is_admin() && isset($_REQUEST['tab'])){?>
|
|
| 481 | + if (is_admin() && isset($_REQUEST['tab'])) {?>
|
|
| 482 | 482 | if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
|
| 483 | 483 | address = ''; |
| 484 | 484 | } |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | geocoder.geocode({'address': address, 'country': ISO2},
|
| 526 | 526 | function (results, status) {
|
| 527 | 527 | console.log(status); |
| 528 | - jQuery("#<?php echo $prefix.'map';?>").goMap();
|
|
| 528 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 529 | 529 | if (status == google.maps.GeocoderStatus.OK) {
|
| 530 | 530 | baseMarker.setPosition(results[0].geometry.location); |
| 531 | 531 | jQuery.goMap.map.setCenter(results[0].geometry.location); |
@@ -542,21 +542,21 @@ discard block |
||
| 542 | 542 | geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
|
| 543 | 543 | //} |
| 544 | 544 | } else {
|
| 545 | - alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:','geodirectory'));?> ' + status);
|
|
| 545 | + alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:', 'geodirectory')); ?> ' + status);
|
|
| 546 | 546 | } |
| 547 | 547 | }); |
| 548 | 548 | } |
| 549 | 549 | } |
| 550 | 550 | function gdMaxMap() {
|
| 551 | - jQuery("#<?php echo $prefix.'map';?>").goMap();
|
|
| 551 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 552 | 552 | |
| 553 | - jQuery('#<?php echo $prefix.'map';?>').toggleClass('map-fullscreen');
|
|
| 553 | + jQuery('#<?php echo $prefix.'map'; ?>').toggleClass('map-fullscreen');
|
|
| 554 | 554 | jQuery('.map_category').toggleClass('map_category_fullscreen');
|
| 555 | - jQuery('#<?php echo $prefix;?>trigger').toggleClass('map_category_fullscreen');
|
|
| 555 | + jQuery('#<?php echo $prefix; ?>trigger').toggleClass('map_category_fullscreen');
|
|
| 556 | 556 | jQuery('body').toggleClass('body_fullscreen');
|
| 557 | - jQuery('#<?php echo $prefix;?>loading_div').toggleClass('loading_div_fullscreen');
|
|
| 558 | - jQuery('#<?php echo $prefix;?>advmap_nofound').toggleClass('nofound_fullscreen');
|
|
| 559 | - jQuery('#<?php echo $prefix;?>triggermap').toggleClass('triggermap_fullscreen');
|
|
| 557 | + jQuery('#<?php echo $prefix; ?>loading_div').toggleClass('loading_div_fullscreen');
|
|
| 558 | + jQuery('#<?php echo $prefix; ?>advmap_nofound').toggleClass('nofound_fullscreen');
|
|
| 559 | + jQuery('#<?php echo $prefix; ?>triggermap').toggleClass('triggermap_fullscreen');
|
|
| 560 | 560 | jQuery('.TopLeft').toggleClass('TopLeft_fullscreen');
|
| 561 | 561 | window.setTimeout(function () {
|
| 562 | 562 | if (window.gdMaps == 'google') {
|
@@ -592,9 +592,9 @@ discard block |
||
| 592 | 592 | do_action('geodir_add_listing_geocode_js_vars');
|
| 593 | 593 | ?> |
| 594 | 594 | <?php if ($is_map_restrict) { ?>
|
| 595 | - if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
|
|
| 596 | - alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
|
|
| 597 | - jQuery("#<?php echo $prefix.'map';?>").goMap();
|
|
| 595 | + if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
|
|
| 596 | + alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
|
|
| 597 | + jQuery("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 598 | 598 | centerMap(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
|
| 599 | 599 | baseMarker.setLatLng(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
|
| 600 | 600 | updateMarkerPositionOSM(baseMarker.getLatLng()); |
@@ -603,39 +603,39 @@ discard block |
||
| 603 | 603 | <?php } ?> |
| 604 | 604 | updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry); |
| 605 | 605 | } else {
|
| 606 | - alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
|
|
| 606 | + alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
|
|
| 607 | 607 | } |
| 608 | 608 | } |
| 609 | 609 | |
| 610 | 610 | jQuery(function ($) {
|
| 611 | - $("#<?php echo $prefix.'map';?>").goMap({
|
|
| 612 | - latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT, |
|
| 613 | - longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG, |
|
| 614 | - zoom: <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT, |
|
| 611 | + $("#<?php echo $prefix.'map'; ?>").goMap({
|
|
| 612 | + latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT, |
|
| 613 | + longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG, |
|
| 614 | + zoom: <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT, |
|
| 615 | 615 | maptype: 'ROADMAP', // Map type - HYBRID, ROADMAP, SATELLITE, TERRAIN |
| 616 | 616 | streetViewControl: true, |
| 617 | - <?php if(get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,';}?>
|
|
| 617 | + <?php if (get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,'; }?>
|
|
| 618 | 618 | }); |
| 619 | 619 | |
| 620 | 620 | if (window.gdMaps) {
|
| 621 | 621 | geocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : []; |
| 622 | 622 | |
| 623 | 623 | baseMarker = $.goMap.createMarker({
|
| 624 | - latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT, |
|
| 625 | - longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG, |
|
| 624 | + latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT, |
|
| 625 | + longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG, |
|
| 626 | 626 | id: 'baseMarker', |
| 627 | - icon: '<?php echo $marker_icon;?>', |
|
| 627 | + icon: '<?php echo $marker_icon; ?>', |
|
| 628 | 628 | draggable: true, |
| 629 | 629 | addToMap: true, // For OSM |
| 630 | - w: parseFloat('<?php echo $icon_size['w'];?>'),
|
|
| 631 | - h: parseFloat('<?php echo $icon_size['h'];?>'),
|
|
| 630 | + w: parseFloat('<?php echo $icon_size['w']; ?>'),
|
|
| 631 | + h: parseFloat('<?php echo $icon_size['h']; ?>'),
|
|
| 632 | 632 | }); |
| 633 | 633 | } else {
|
| 634 | - jQuery('#<?php echo $prefix.'advmap_nofound';?>').hide();
|
|
| 635 | - jQuery('#<?php echo $prefix.'advmap_notloaded';?>').show();
|
|
| 634 | + jQuery('#<?php echo $prefix.'advmap_nofound'; ?>').hide();
|
|
| 635 | + jQuery('#<?php echo $prefix.'advmap_notloaded'; ?>').show();
|
|
| 636 | 636 | } |
| 637 | 637 | |
| 638 | - $("#<?php echo $prefix;?>set_address_button").click(function () {
|
|
| 638 | + $("#<?php echo $prefix; ?>set_address_button").click(function () {
|
|
| 639 | 639 | var set_on_map = true; |
| 640 | 640 | geodir_codeAddress(set_on_map); |
| 641 | 641 | }); |
@@ -669,14 +669,14 @@ discard block |
||
| 669 | 669 | updateMapZoom($.goMap.map.zoom); |
| 670 | 670 | }); |
| 671 | 671 | |
| 672 | - var maxMap = document.getElementById('<?php echo $prefix;?>triggermap');
|
|
| 672 | + var maxMap = document.getElementById('<?php echo $prefix; ?>triggermap');
|
|
| 673 | 673 | google.maps.event.addDomListener(maxMap, 'click', gdMaxMap); |
| 674 | 674 | |
| 675 | 675 | <?php if ($is_map_restrict) { ?>
|
| 676 | - var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country);?>'; |
|
| 676 | + var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country); ?>'; |
|
| 677 | 677 | geocoder.geocode({'address': CITY_ADDRESS},
|
| 678 | 678 | function (results, status) {
|
| 679 | - $("#<?php echo $prefix.'map';?>").goMap();
|
|
| 679 | + $("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 680 | 680 | if (status == google.maps.GeocoderStatus.OK) {
|
| 681 | 681 | // Bounds for North America |
| 682 | 682 | var bound_lat_lng = String(results[0].geometry.bounds); |
@@ -687,13 +687,13 @@ discard block |
||
| 687 | 687 | new google.maps.LatLng(bound_lat_lng[2], bound_lat_lng[3]) |
| 688 | 688 | ); |
| 689 | 689 | } else {
|
| 690 | - alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status);
|
|
| 690 | + alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
|
|
| 691 | 691 | } |
| 692 | 692 | }); |
| 693 | 693 | <?php } ?> |
| 694 | 694 | // Limit the zoom level |
| 695 | 695 | google.maps.event.addListener($.goMap.map, 'zoom_changed', function () {
|
| 696 | - $("#<?php echo $prefix.'map';?>").goMap();
|
|
| 696 | + $("#<?php echo $prefix.'map'; ?>").goMap();
|
|
| 697 | 697 | if ($.goMap.map.getZoom() < minZoomLevel) $.goMap.map.setZoom(minZoomLevel); |
| 698 | 698 | }); |
| 699 | 699 | } else if (window.gdMaps == 'osm') {
|
@@ -719,10 +719,10 @@ discard block |
||
| 719 | 719 | updateMapZoom($.goMap.map.getZoom()); |
| 720 | 720 | }); |
| 721 | 721 | |
| 722 | - L.DomEvent.addListener($('<?php echo $prefix;?>triggermap'), 'click', gdMaxMap);
|
|
| 722 | + L.DomEvent.addListener($('<?php echo $prefix; ?>triggermap'), 'click', gdMaxMap);
|
|
| 723 | 723 | |
| 724 | 724 | <?php if ($is_map_restrict) { ?>
|
| 725 | - var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country);?>'; |
|
| 725 | + var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country); ?>'; |
|
| 726 | 726 | geocodePositionOSM('', CITY_ADDRESS);
|
| 727 | 727 | <?php } ?> |
| 728 | 728 | // Limit the zoom level |
@@ -745,14 +745,14 @@ discard block |
||
| 745 | 745 | <div class="top_banner_section_inn geodir_map_container clearfix" style="margin-top:10px;"> |
| 746 | 746 | <div class="TopLeft"><span id="<?php echo $prefix; ?>triggermap" style="margin-top:-11px;margin-left:-12px;"></span></div> |
| 747 | 747 | <div class="TopRight"></div> |
| 748 | - <div id="<?php echo $prefix . 'map'; ?>" class="geodir_map" style="height:300px"> |
|
| 748 | + <div id="<?php echo $prefix.'map'; ?>" class="geodir_map" style="height:300px"> |
|
| 749 | 749 | <!-- new map start --> |
| 750 | 750 | <div class="iprelative"> |
| 751 | - <div id="<?php echo $prefix . 'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div> |
|
| 751 | + <div id="<?php echo $prefix.'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div> |
|
| 752 | 752 | <div id="<?php echo $prefix; ?>loading_div" style="height:300px"></div> |
| 753 | 753 | <div id="<?php echo $prefix; ?>advmap_counter"></div> |
| 754 | 754 | <div id="<?php echo $prefix; ?>advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div> |
| 755 | - <div id="<?php echo $prefix;?>advmap_notloaded" class="advmap_notloaded"><?php _e('<h3>Map Not Loaded</h3><p>Sorry, unable to load Maps API.', 'geodirectory'); ?></div>
|
|
| 755 | + <div id="<?php echo $prefix; ?>advmap_notloaded" class="advmap_notloaded"><?php _e('<h3>Map Not Loaded</h3><p>Sorry, unable to load Maps API.', 'geodirectory'); ?></div>
|
|
| 756 | 756 | </div> |
| 757 | 757 | <!-- new map end --> |
| 758 | 758 | </div> |
@@ -46,9 +46,10 @@ discard block |
||
| 46 | 46 | $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
| 47 | 47 | if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') {
|
| 48 | 48 | $mapzoom = 4; |
| 49 | - if (isset($_REQUEST['add_hood'])) |
|
| 50 | - $mapzoom = 10; |
|
| 51 | -} |
|
| 49 | + if (isset($_REQUEST['add_hood'])) { |
|
| 50 | + $mapzoom = 10; |
|
| 51 | + } |
|
| 52 | + } |
|
| 52 | 53 | |
| 53 | 54 | /** |
| 54 | 55 | * Filter the auto change address fields values |
@@ -737,8 +738,9 @@ discard block |
||
| 737 | 738 | </script> |
| 738 | 739 | <?php |
| 739 | 740 | $set_button_class = 'geodir_button'; |
| 740 | -if (is_admin()) |
|
| 741 | - $set_button_class = 'button-primary'; |
|
| 741 | +if (is_admin()) { |
|
| 742 | + $set_button_class = 'button-primary'; |
|
| 743 | +} |
|
| 742 | 744 | ?> |
| 743 | 745 | <input type="button" id="<?php echo $prefix; ?>set_address_button" class="<?php echo $set_button_class; ?>" value="<?php esc_attr_e($map_title, 'geodirectory'); ?>" style="float:none;"/> |
| 744 | 746 | <div id="<?php echo $prefix; ?>d_mouseClick"></div> |
@@ -39,8 +39,9 @@ discard block |
||
| 39 | 39 | if (get_option('geodir_show_listing_nav')) {
|
| 40 | 40 | |
| 41 | 41 | $menu_class = ''; |
| 42 | - if (geodir_is_page('listing'))
|
|
| 43 | - $menu_class = 'current-menu-item'; |
|
| 42 | + if (geodir_is_page('listing')) { |
|
| 43 | + $menu_class = 'current-menu-item'; |
|
| 44 | + } |
|
| 44 | 45 | |
| 45 | 46 | |
| 46 | 47 | //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION |
@@ -52,8 +53,9 @@ discard block |
||
| 52 | 53 | if (in_array($post_type, $show_post_type_main_nav)) {
|
| 53 | 54 | if (get_post_type_archive_link($post_type)) {
|
| 54 | 55 | $menu_class = ''; |
| 55 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
|
|
| 56 | - $menu_class = 'current-menu-item'; |
|
| 56 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) { |
|
| 57 | + $menu_class = 'current-menu-item'; |
|
| 58 | + } |
|
| 57 | 59 | /** |
| 58 | 60 | * Filter the menu li class. |
| 59 | 61 | * |
@@ -130,8 +132,9 @@ discard block |
||
| 130 | 132 | if (get_post_type_archive_link($post_type)) {
|
| 131 | 133 | |
| 132 | 134 | $menu_class = ''; |
| 133 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
|
|
| 134 | - $menu_class = 'current-menu-item'; |
|
| 135 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) { |
|
| 136 | + $menu_class = 'current-menu-item'; |
|
| 137 | + } |
|
| 135 | 138 | |
| 136 | 139 | $items .= '<li class="' . $sub_li_class . '"> |
| 137 | 140 | <a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '"> |
@@ -159,8 +162,9 @@ discard block |
||
| 159 | 162 | if (get_option('geodir_show_addlisting_nav')) {
|
| 160 | 163 | |
| 161 | 164 | $menu_class = ''; |
| 162 | - if (geodir_is_page('add-listing'))
|
|
| 163 | - $menu_class = 'current-menu-item'; |
|
| 165 | + if (geodir_is_page('add-listing')) { |
|
| 166 | + $menu_class = 'current-menu-item'; |
|
| 167 | + } |
|
| 164 | 168 | |
| 165 | 169 | //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
| 166 | 170 | $post_types = geodir_get_posttypes('object');
|
@@ -176,8 +180,9 @@ discard block |
||
| 176 | 180 | if (geodir_get_addlisting_link($post_type)) {
|
| 177 | 181 | |
| 178 | 182 | $menu_class = ''; |
| 179 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
|
|
| 180 | - $menu_class = 'current-menu-item'; |
|
| 183 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) { |
|
| 184 | + $menu_class = 'current-menu-item'; |
|
| 185 | + } |
|
| 181 | 186 | /** |
| 182 | 187 | * Filter the menu li class. |
| 183 | 188 | * |
@@ -261,8 +266,9 @@ discard block |
||
| 261 | 266 | if (geodir_get_addlisting_link($post_type)) {
|
| 262 | 267 | |
| 263 | 268 | $menu_class = ''; |
| 264 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
|
|
| 265 | - $menu_class = 'current-menu-item'; |
|
| 269 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) { |
|
| 270 | + $menu_class = 'current-menu-item'; |
|
| 271 | + } |
|
| 266 | 272 | /** |
| 267 | 273 | * Filter the menu li class. |
| 268 | 274 | * |
@@ -319,8 +325,9 @@ discard block |
||
| 319 | 325 | } |
| 320 | 326 | //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet. |
| 321 | 327 | // $menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
|
| 322 | - else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) |
|
| 323 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
|
|
| 328 | + else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) { |
|
| 329 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
| 330 | + } |
|
| 324 | 331 | |
| 325 | 332 | return $menu; |
| 326 | 333 | |
@@ -406,24 +413,28 @@ discard block |
||
| 406 | 413 | $geodir_post_type = get_query_var('post_type');
|
| 407 | 414 | |
| 408 | 415 | if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
|
| 409 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 410 | - $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
| 411 | - elseif (isset($_REQUEST['listing_type'])) |
|
| 412 | - $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 416 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
| 417 | + $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
| 418 | + } elseif (isset($_REQUEST['listing_type'])) { |
|
| 419 | + $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 420 | + } |
|
| 413 | 421 | } |
| 414 | 422 | |
| 415 | - if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
|
|
| 416 | - $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
| 423 | + if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) { |
|
| 424 | + $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
| 425 | + } |
|
| 417 | 426 | |
| 418 | - if (is_tax()) |
|
| 419 | - $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
| 427 | + if (is_tax()) { |
|
| 428 | + $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
| 429 | + } |
|
| 420 | 430 | |
| 421 | 431 | |
| 422 | 432 | $all_postypes = geodir_get_posttypes(); |
| 423 | 433 | $all_postypes = stripslashes_deep($all_postypes); |
| 424 | 434 | |
| 425 | - if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
|
| 426 | - $geodir_post_type = ''; |
|
| 435 | + if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) { |
|
| 436 | + $geodir_post_type = ''; |
|
| 437 | + } |
|
| 427 | 438 | |
| 428 | 439 | if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
|
| 429 | 440 | $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
@@ -508,11 +519,12 @@ discard block |
||
| 508 | 519 | endswitch; |
| 509 | 520 | } |
| 510 | 521 | |
| 511 | - if (!empty($post_types)) |
|
| 512 | - return $post_types; |
|
| 513 | - else |
|
| 514 | - return array(); |
|
| 515 | -} |
|
| 522 | + if (!empty($post_types)) { |
|
| 523 | + return $post_types; |
|
| 524 | + } else { |
|
| 525 | + return array(); |
|
| 526 | + } |
|
| 527 | + } |
|
| 516 | 528 | |
| 517 | 529 | /** |
| 518 | 530 | * Get Custom Post Type info. |
@@ -529,9 +541,10 @@ discard block |
||
| 529 | 541 | $post_types = stripslashes_deep($post_types); |
| 530 | 542 | if (!empty($post_types) && $post_type != '') {
|
| 531 | 543 | return $post_types[$post_type]; |
| 532 | - } else |
|
| 533 | - return false; |
|
| 534 | -} |
|
| 544 | + } else { |
|
| 545 | + return false; |
|
| 546 | + } |
|
| 547 | + } |
|
| 535 | 548 | |
| 536 | 549 | if (!function_exists('geodir_get_taxonomies')) {
|
| 537 | 550 | /** |
@@ -555,18 +568,21 @@ discard block |
||
| 555 | 568 | $gd_taxonomies = array_keys($taxonomies); |
| 556 | 569 | |
| 557 | 570 | |
| 558 | - if ($post_type != '') |
|
| 559 | - $gd_taxonomies = array(); |
|
| 571 | + if ($post_type != '') { |
|
| 572 | + $gd_taxonomies = array(); |
|
| 573 | + } |
|
| 560 | 574 | |
| 561 | 575 | $i = 0; |
| 562 | 576 | foreach ($taxonomies as $taxonomy => $args) {
|
| 563 | 577 | |
| 564 | - if ($post_type != '' && $args['object_type'] == $post_type) |
|
| 565 | - $gd_taxonomies[] = $taxonomy; |
|
| 578 | + if ($post_type != '' && $args['object_type'] == $post_type) { |
|
| 579 | + $gd_taxonomies[] = $taxonomy; |
|
| 580 | + } |
|
| 566 | 581 | |
| 567 | 582 | if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
|
| 568 | - if (array_search($taxonomy, $gd_taxonomies) !== false) |
|
| 569 | - unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
|
| 583 | + if (array_search($taxonomy, $gd_taxonomies) !== false) { |
|
| 584 | + unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
|
| 585 | + } |
|
| 570 | 586 | } |
| 571 | 587 | |
| 572 | 588 | } |
@@ -621,10 +637,11 @@ discard block |
||
| 621 | 637 | . ucfirst($category_obj->name) . '</option>'; |
| 622 | 638 | } |
| 623 | 639 | |
| 624 | - if ($echo) |
|
| 625 | - echo $html; |
|
| 626 | - else |
|
| 627 | - return $html; |
|
| 640 | + if ($echo) { |
|
| 641 | + echo $html; |
|
| 642 | + } else { |
|
| 643 | + return $html; |
|
| 644 | + } |
|
| 628 | 645 | } |
| 629 | 646 | } |
| 630 | 647 | |
@@ -658,11 +675,12 @@ discard block |
||
| 658 | 675 | |
| 659 | 676 | } |
| 660 | 677 | |
| 661 | - if (!empty($listing_slug)) |
|
| 662 | - return $listing_slug; |
|
| 663 | - else |
|
| 664 | - return false; |
|
| 665 | -} |
|
| 678 | + if (!empty($listing_slug)) { |
|
| 679 | + return $listing_slug; |
|
| 680 | + } else { |
|
| 681 | + return false; |
|
| 682 | + } |
|
| 683 | + } |
|
| 666 | 684 | |
| 667 | 685 | |
| 668 | 686 | /** |
@@ -693,16 +711,18 @@ discard block |
||
| 693 | 711 | if (!empty($taxonomies)) {
|
| 694 | 712 | foreach (geodir_get_posttypes() as $pt) {
|
| 695 | 713 | $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt); |
| 696 | - if (array_intersect($taxonomies, $object_taxonomies)) |
|
| 697 | - $post_type[] = $pt; |
|
| 714 | + if (array_intersect($taxonomies, $object_taxonomies)) { |
|
| 715 | + $post_type[] = $pt; |
|
| 716 | + } |
|
| 698 | 717 | } |
| 699 | 718 | } |
| 700 | 719 | |
| 701 | - if (!empty($post_type)) |
|
| 702 | - return $post_type[0]; |
|
| 703 | - else |
|
| 704 | - return false; |
|
| 705 | -} |
|
| 720 | + if (!empty($post_type)) { |
|
| 721 | + return $post_type[0]; |
|
| 722 | + } else { |
|
| 723 | + return false; |
|
| 724 | + } |
|
| 725 | + } |
|
| 706 | 726 | |
| 707 | 727 | if (!function_exists('geodir_custom_taxonomy_walker')) {
|
| 708 | 728 | /** |
@@ -758,18 +778,18 @@ discard block |
||
| 758 | 778 | $checked = ''; |
| 759 | 779 | |
| 760 | 780 | if (in_array($cat_term->term_id, $search_terms)) {
|
| 761 | - if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 762 | - $checked = 'selected="selected"'; |
|
| 763 | - else |
|
| 764 | - $checked = 'checked="checked"'; |
|
| 781 | + if ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
| 782 | + $checked = 'selected="selected"'; |
|
| 783 | + } else { |
|
| 784 | + $checked = 'checked="checked"'; |
|
| 785 | + } |
|
| 765 | 786 | } |
| 766 | 787 | |
| 767 | - if ($cat_display == 'radio') |
|
| 768 | - $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>'; |
|
| 769 | - elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 770 | - $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>'; |
|
| 771 | - |
|
| 772 | - else {
|
|
| 788 | + if ($cat_display == 'radio') { |
|
| 789 | + $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>'; |
|
| 790 | + } elseif ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
| 791 | + $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>'; |
|
| 792 | + } else {
|
|
| 773 | 793 | $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>'; |
| 774 | 794 | } |
| 775 | 795 | |
@@ -778,8 +798,9 @@ discard block |
||
| 778 | 798 | |
| 779 | 799 | } |
| 780 | 800 | |
| 781 | - if ($cat_display == 'checkbox' || $cat_display == 'radio') |
|
| 782 | - $out .= '</div>'; |
|
| 801 | + if ($cat_display == 'checkbox' || $cat_display == 'radio') { |
|
| 802 | + $out .= '</div>'; |
|
| 803 | + } |
|
| 783 | 804 | |
| 784 | 805 | return $out; |
| 785 | 806 | } |
@@ -805,18 +826,21 @@ discard block |
||
| 805 | 826 | global $exclude_cats, $gd_session; |
| 806 | 827 | |
| 807 | 828 | $cat_exclude = ''; |
| 808 | - if (is_array($exclude_cats) && !empty($exclude_cats)) |
|
| 809 | - $cat_exclude = serialize($exclude_cats); |
|
| 829 | + if (is_array($exclude_cats) && !empty($exclude_cats)) { |
|
| 830 | + $cat_exclude = serialize($exclude_cats); |
|
| 831 | + } |
|
| 810 | 832 | |
| 811 | 833 | if (isset($_REQUEST['backandedit'])) {
|
| 812 | 834 | $post = (object)$gd_session->get('listing');
|
| 813 | 835 | |
| 814 | - if (!is_array($post->post_category[$cat_taxonomy])) |
|
| 815 | - $post_category = $post->post_category[$cat_taxonomy]; |
|
| 836 | + if (!is_array($post->post_category[$cat_taxonomy])) { |
|
| 837 | + $post_category = $post->post_category[$cat_taxonomy]; |
|
| 838 | + } |
|
| 816 | 839 | |
| 817 | 840 | $post_categories = $post->post_category_str; |
| 818 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) |
|
| 819 | - $post_category_str = $post_categories[$cat_taxonomy]; |
|
| 841 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { |
|
| 842 | + $post_category_str = $post_categories[$cat_taxonomy]; |
|
| 843 | + } |
|
| 820 | 844 | |
| 821 | 845 | } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
|
| 822 | 846 | global $post; |
@@ -1007,8 +1031,9 @@ discard block |
||
| 1007 | 1031 | if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
|
| 1008 | 1032 | $post_cat_str = $post_categories[$cat_taxonomy]; |
| 1009 | 1033 | $post_cat_array = explode("#", $post_cat_str);
|
| 1010 | - if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) |
|
| 1011 | - $style = "display:none;"; |
|
| 1034 | + if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) { |
|
| 1035 | + $style = "display:none;"; |
|
| 1036 | + } |
|
| 1012 | 1037 | } |
| 1013 | 1038 | ?> |
| 1014 | 1039 | <div class="main_cat_list" style=" <?php if (isset($style)) {
|
@@ -1043,7 +1068,7 @@ discard block |
||
| 1043 | 1068 | |
| 1044 | 1069 | if(is_array( $exclude_cats)){
|
| 1045 | 1070 | $exclude_cats = array_map( 'intval', $exclude_cats ); |
| 1046 | - }else{
|
|
| 1071 | + } else{
|
|
| 1047 | 1072 | $exclude_cats = intval($exclude_cats); |
| 1048 | 1073 | } |
| 1049 | 1074 | |
@@ -1073,7 +1098,10 @@ discard block |
||
| 1073 | 1098 | |
| 1074 | 1099 | <div class="post_default_category"> |
| 1075 | 1100 | <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>" |
| 1076 | - onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?> /> |
|
| 1101 | + onchange="update_listing_cat()" <?php if ($default) { |
|
| 1102 | + echo ' checked="checked" '; |
|
| 1103 | +} |
|
| 1104 | +?> /> |
|
| 1077 | 1105 | <span> |
| 1078 | 1106 | <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
|
| 1079 | 1107 | </span> |
@@ -1173,8 +1201,9 @@ discard block |
||
| 1173 | 1201 | $onchange = ' onchange="show_subcatlist(this.value, this)" '; |
| 1174 | 1202 | |
| 1175 | 1203 | $option_selected = ''; |
| 1176 | - if (!$selected) |
|
| 1177 | - $option_slected = ' selected="selected" '; |
|
| 1204 | + if (!$selected) { |
|
| 1205 | + $option_slected = ' selected="selected" '; |
|
| 1206 | + } |
|
| 1178 | 1207 | |
| 1179 | 1208 | echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
| 1180 | 1209 | |
@@ -1182,8 +1211,9 @@ discard block |
||
| 1182 | 1211 | |
| 1183 | 1212 | foreach ($cat_terms as $cat_term) {
|
| 1184 | 1213 | $option_selected = ''; |
| 1185 | - if ($selected == $cat_term->term_id) |
|
| 1186 | - $option_selected = ' selected="selected" '; |
|
| 1214 | + if ($selected == $cat_term->term_id) { |
|
| 1215 | + $option_selected = ' selected="selected" '; |
|
| 1216 | + } |
|
| 1187 | 1217 | |
| 1188 | 1218 | // Count child terms |
| 1189 | 1219 | $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
@@ -1248,8 +1278,9 @@ discard block |
||
| 1248 | 1278 | |
| 1249 | 1279 | $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
| 1250 | 1280 | |
| 1251 | - if (!$listing_slug = get_option('geodir_listing_prefix'))
|
|
| 1252 | - $listing_slug = 'places'; |
|
| 1281 | + if (!$listing_slug = get_option('geodir_listing_prefix')) { |
|
| 1282 | + $listing_slug = 'places'; |
|
| 1283 | + } |
|
| 1253 | 1284 | |
| 1254 | 1285 | /** |
| 1255 | 1286 | * Taxonomies |
@@ -1399,7 +1430,7 @@ discard block |
||
| 1399 | 1430 | //print_r( $segments); |
| 1400 | 1431 | if($gd_wpml_get_languages){
|
| 1401 | 1432 | $langs = $gd_wpml_get_languages; |
| 1402 | - }else{
|
|
| 1433 | + } else{
|
|
| 1403 | 1434 | global $sitepress; |
| 1404 | 1435 | $gd_wpml_get_languages = $sitepress->get_active_languages(); |
| 1405 | 1436 | } |
@@ -1552,8 +1583,9 @@ discard block |
||
| 1552 | 1583 | 'city_slug' => $post->city_slug |
| 1553 | 1584 | ); |
| 1554 | 1585 | |
| 1555 | - } else |
|
| 1556 | - $post_location = geodir_get_location(); |
|
| 1586 | + } else { |
|
| 1587 | + $post_location = geodir_get_location(); |
|
| 1588 | + } |
|
| 1557 | 1589 | |
| 1558 | 1590 | |
| 1559 | 1591 | } else {
|
@@ -1582,8 +1614,9 @@ discard block |
||
| 1582 | 1614 | ); |
| 1583 | 1615 | |
| 1584 | 1616 | } |
| 1585 | - } else |
|
| 1586 | - $post_location = geodir_get_location(); |
|
| 1617 | + } else { |
|
| 1618 | + $post_location = geodir_get_location(); |
|
| 1619 | + } |
|
| 1587 | 1620 | } |
| 1588 | 1621 | |
| 1589 | 1622 | |
@@ -1626,8 +1659,9 @@ discard block |
||
| 1626 | 1659 | $post_terms = $post_terms[0]; |
| 1627 | 1660 | } |
| 1628 | 1661 | |
| 1629 | - if (!$post_terms) |
|
| 1630 | - $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
| 1662 | + if (!$post_terms) { |
|
| 1663 | + $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
| 1664 | + } |
|
| 1631 | 1665 | |
| 1632 | 1666 | if (!$post_terms) {
|
| 1633 | 1667 | $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true); |
@@ -1641,8 +1675,9 @@ discard block |
||
| 1641 | 1675 | |
| 1642 | 1676 | $term = get_term_by('id', $post_terms, $taxonomies);
|
| 1643 | 1677 | |
| 1644 | - if (!empty($term)) |
|
| 1645 | - $term_request = $term->slug; |
|
| 1678 | + if (!empty($term)) { |
|
| 1679 | + $term_request = $term->slug; |
|
| 1680 | + } |
|
| 1646 | 1681 | //$term_request = $term->slug.'/'; |
| 1647 | 1682 | } |
| 1648 | 1683 | |
@@ -1657,15 +1692,20 @@ discard block |
||
| 1657 | 1692 | $request_term .= $term_request; |
| 1658 | 1693 | |
| 1659 | 1694 | } else {
|
| 1660 | - if (isset($location_request) && $location_request != '') $request_term = $location_request; |
|
| 1695 | + if (isset($location_request) && $location_request != '') { |
|
| 1696 | + $request_term = $location_request; |
|
| 1697 | + } |
|
| 1661 | 1698 | |
| 1662 | - if (isset($term_request) && $term_request != '') $request_term .= $term_request; |
|
| 1699 | + if (isset($term_request) && $term_request != '') { |
|
| 1700 | + $request_term .= $term_request; |
|
| 1701 | + } |
|
| 1663 | 1702 | } |
| 1664 | 1703 | $request_term = trim($request_term, '/'); |
| 1665 | - if (!empty($request_term)) |
|
| 1666 | - $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
|
|
| 1667 | - else |
|
| 1668 | - $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
|
|
| 1704 | + if (!empty($request_term)) { |
|
| 1705 | + $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
| 1706 | + } else { |
|
| 1707 | + $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
| 1708 | + } |
|
| 1669 | 1709 | //echo $post_link ; |
| 1670 | 1710 | } |
| 1671 | 1711 | // temp cache the permalink |
@@ -1857,11 +1897,12 @@ discard block |
||
| 1857 | 1897 | |
| 1858 | 1898 | $label = $translate ? __($obj_post_type->labels->singular_name, 'geodirectory') : $obj_post_type->labels->singular_name; |
| 1859 | 1899 | |
| 1860 | - if ($echo) |
|
| 1861 | - echo $label; |
|
| 1862 | - else |
|
| 1863 | - return $label; |
|
| 1864 | -} |
|
| 1900 | + if ($echo) { |
|
| 1901 | + echo $label; |
|
| 1902 | + } else { |
|
| 1903 | + return $label; |
|
| 1904 | + } |
|
| 1905 | + } |
|
| 1865 | 1906 | |
| 1866 | 1907 | /** |
| 1867 | 1908 | * Print or Get post type plural label. |
@@ -1877,18 +1918,20 @@ discard block |
||
| 1877 | 1918 | function get_post_type_plural_label($post_type, $echo = false, $translate = false) {
|
| 1878 | 1919 | $all_postypes = geodir_get_posttypes(); |
| 1879 | 1920 | |
| 1880 | - if (!in_array($post_type, $all_postypes)) |
|
| 1881 | - return false; |
|
| 1921 | + if (!in_array($post_type, $all_postypes)) { |
|
| 1922 | + return false; |
|
| 1923 | + } |
|
| 1882 | 1924 | |
| 1883 | 1925 | $obj_post_type = get_post_type_object($post_type); |
| 1884 | 1926 | |
| 1885 | 1927 | $label = $translate ? __($obj_post_type->labels->name, 'geodirectory') : $obj_post_type->labels->name; |
| 1886 | 1928 | |
| 1887 | - if ($echo) |
|
| 1888 | - echo $label; |
|
| 1889 | - else |
|
| 1890 | - return $label; |
|
| 1891 | -} |
|
| 1929 | + if ($echo) { |
|
| 1930 | + echo $label; |
|
| 1931 | + } else { |
|
| 1932 | + return $label; |
|
| 1933 | + } |
|
| 1934 | + } |
|
| 1892 | 1935 | |
| 1893 | 1936 | /** |
| 1894 | 1937 | * Checks whether a term exists or not. |
@@ -1911,19 +1954,22 @@ discard block |
||
| 1911 | 1954 | $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE "; |
| 1912 | 1955 | |
| 1913 | 1956 | if (is_int($term)) {
|
| 1914 | - if (0 == $term) |
|
| 1915 | - return 0; |
|
| 1957 | + if (0 == $term) { |
|
| 1958 | + return 0; |
|
| 1959 | + } |
|
| 1916 | 1960 | $where = 't.term_id = %d'; |
| 1917 | - if (!empty($taxonomy)) |
|
| 1918 | - return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
| 1919 | - else |
|
| 1920 | - return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
| 1961 | + if (!empty($taxonomy)) { |
|
| 1962 | + return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
| 1963 | + } else { |
|
| 1964 | + return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
| 1965 | + } |
|
| 1921 | 1966 | } |
| 1922 | 1967 | |
| 1923 | 1968 | $term = trim(wp_unslash($term)); |
| 1924 | 1969 | |
| 1925 | - if ('' === $slug = sanitize_title($term))
|
|
| 1926 | - return 0; |
|
| 1970 | + if ('' === $slug = sanitize_title($term)) { |
|
| 1971 | + return 0; |
|
| 1972 | + } |
|
| 1927 | 1973 | |
| 1928 | 1974 | $where = 't.slug = %s'; |
| 1929 | 1975 | |
@@ -1940,14 +1986,16 @@ discard block |
||
| 1940 | 1986 | $where_fields[] = $taxonomy; |
| 1941 | 1987 | |
| 1942 | 1988 | |
| 1943 | - if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
|
|
| 1944 | - return $result; |
|
| 1989 | + if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) { |
|
| 1990 | + return $result; |
|
| 1991 | + } |
|
| 1945 | 1992 | |
| 1946 | 1993 | return false; |
| 1947 | 1994 | } |
| 1948 | 1995 | |
| 1949 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
|
|
| 1950 | - return $result; |
|
| 1996 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) { |
|
| 1997 | + return $result; |
|
| 1998 | + } |
|
| 1951 | 1999 | |
| 1952 | 2000 | return false; |
| 1953 | 2001 | } |
@@ -33,265 +33,265 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | function geodir_add_nav_menu_items() |
| 35 | 35 | {
|
| 36 | - $items = ''; |
|
| 37 | - // apply filter to add more navigations // -Filter-Location-Manager |
|
| 38 | - |
|
| 39 | - if (get_option('geodir_show_listing_nav')) {
|
|
| 40 | - |
|
| 41 | - $menu_class = ''; |
|
| 42 | - if (geodir_is_page('listing'))
|
|
| 43 | - $menu_class = 'current-menu-item'; |
|
| 44 | - |
|
| 45 | - |
|
| 46 | - //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION |
|
| 47 | - $post_types = geodir_get_posttypes('object');
|
|
| 48 | - $show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav');
|
|
| 49 | - if (!empty($post_types)) {
|
|
| 50 | - foreach ($post_types as $post_type => $args) {
|
|
| 51 | - if (!empty($show_post_type_main_nav)) {
|
|
| 52 | - if (in_array($post_type, $show_post_type_main_nav)) {
|
|
| 53 | - if (get_post_type_archive_link($post_type)) {
|
|
| 54 | - $menu_class = ''; |
|
| 55 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
|
|
| 56 | - $menu_class = 'current-menu-item'; |
|
| 57 | - /** |
|
| 58 | - * Filter the menu li class. |
|
| 59 | - * |
|
| 60 | - * @since 1.0.0 |
|
| 61 | - * @param string $menu_class The menu HTML class. |
|
| 62 | - */ |
|
| 63 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 64 | - /** |
|
| 65 | - * Filter the menu a class. |
|
| 66 | - * |
|
| 67 | - * @since 1.0.0 |
|
| 68 | - */ |
|
| 69 | - $a_class = apply_filters('geodir_menu_a_class', '');
|
|
| 70 | - $items .= '<li class="' . $li_class . '"> |
|
| 36 | + $items = ''; |
|
| 37 | + // apply filter to add more navigations // -Filter-Location-Manager |
|
| 38 | + |
|
| 39 | + if (get_option('geodir_show_listing_nav')) {
|
|
| 40 | + |
|
| 41 | + $menu_class = ''; |
|
| 42 | + if (geodir_is_page('listing'))
|
|
| 43 | + $menu_class = 'current-menu-item'; |
|
| 44 | + |
|
| 45 | + |
|
| 46 | + //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION |
|
| 47 | + $post_types = geodir_get_posttypes('object');
|
|
| 48 | + $show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav');
|
|
| 49 | + if (!empty($post_types)) {
|
|
| 50 | + foreach ($post_types as $post_type => $args) {
|
|
| 51 | + if (!empty($show_post_type_main_nav)) {
|
|
| 52 | + if (in_array($post_type, $show_post_type_main_nav)) {
|
|
| 53 | + if (get_post_type_archive_link($post_type)) {
|
|
| 54 | + $menu_class = ''; |
|
| 55 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
|
|
| 56 | + $menu_class = 'current-menu-item'; |
|
| 57 | + /** |
|
| 58 | + * Filter the menu li class. |
|
| 59 | + * |
|
| 60 | + * @since 1.0.0 |
|
| 61 | + * @param string $menu_class The menu HTML class. |
|
| 62 | + */ |
|
| 63 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 64 | + /** |
|
| 65 | + * Filter the menu a class. |
|
| 66 | + * |
|
| 67 | + * @since 1.0.0 |
|
| 68 | + */ |
|
| 69 | + $a_class = apply_filters('geodir_menu_a_class', '');
|
|
| 70 | + $items .= '<li class="' . $li_class . '"> |
|
| 71 | 71 | <a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '"> |
| 72 | 72 | ' . __(ucfirst($args->labels->name),'geodirectory') . ' |
| 73 | 73 | </a> |
| 74 | 74 | </li>'; |
| 75 | - } |
|
| 76 | - } |
|
| 77 | - } |
|
| 78 | - } |
|
| 79 | - } |
|
| 80 | - //END LISTING OF POST TYPE IN MAIN NAVIGATION |
|
| 81 | - |
|
| 82 | - $view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
|
|
| 83 | - $is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false; |
|
| 84 | - if ($is_listing_sub_meny_exists) {
|
|
| 85 | - /** |
|
| 86 | - * Filter the menu li class. |
|
| 87 | - * |
|
| 88 | - * @since 1.0.0 |
|
| 89 | - * @param string $menu_class The menu HTML class. |
|
| 90 | - */ |
|
| 91 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
|
|
| 92 | - /** |
|
| 93 | - * Filter the sub menu li class. |
|
| 94 | - * |
|
| 95 | - * @since 1.0.0 |
|
| 96 | - * @param string $menu_class The menu HTML class. |
|
| 97 | - */ |
|
| 98 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 99 | - /** |
|
| 100 | - * Filter the sub menu ul class. |
|
| 101 | - * |
|
| 102 | - * @since 1.0.0 |
|
| 103 | - */ |
|
| 104 | - $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
|
|
| 105 | - /** |
|
| 106 | - * Filter the menu a class. |
|
| 107 | - * |
|
| 108 | - * @since 1.0.0 |
|
| 109 | - */ |
|
| 110 | - $a_class = apply_filters('geodir_menu_a_class', '');
|
|
| 111 | - /** |
|
| 112 | - * Filter the sub menu a class. |
|
| 113 | - * |
|
| 114 | - * @since 1.0.0 |
|
| 115 | - */ |
|
| 116 | - $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
|
|
| 117 | - $items .= '<li class="' . $li_class . '"> |
|
| 75 | + } |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | + //END LISTING OF POST TYPE IN MAIN NAVIGATION |
|
| 81 | + |
|
| 82 | + $view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
|
|
| 83 | + $is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false; |
|
| 84 | + if ($is_listing_sub_meny_exists) {
|
|
| 85 | + /** |
|
| 86 | + * Filter the menu li class. |
|
| 87 | + * |
|
| 88 | + * @since 1.0.0 |
|
| 89 | + * @param string $menu_class The menu HTML class. |
|
| 90 | + */ |
|
| 91 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
|
|
| 92 | + /** |
|
| 93 | + * Filter the sub menu li class. |
|
| 94 | + * |
|
| 95 | + * @since 1.0.0 |
|
| 96 | + * @param string $menu_class The menu HTML class. |
|
| 97 | + */ |
|
| 98 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 99 | + /** |
|
| 100 | + * Filter the sub menu ul class. |
|
| 101 | + * |
|
| 102 | + * @since 1.0.0 |
|
| 103 | + */ |
|
| 104 | + $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
|
|
| 105 | + /** |
|
| 106 | + * Filter the menu a class. |
|
| 107 | + * |
|
| 108 | + * @since 1.0.0 |
|
| 109 | + */ |
|
| 110 | + $a_class = apply_filters('geodir_menu_a_class', '');
|
|
| 111 | + /** |
|
| 112 | + * Filter the sub menu a class. |
|
| 113 | + * |
|
| 114 | + * @since 1.0.0 |
|
| 115 | + */ |
|
| 116 | + $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
|
|
| 117 | + $items .= '<li class="' . $li_class . '"> |
|
| 118 | 118 | <a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a>
|
| 119 | 119 | <ul class="' . $sub_ul_class . '">'; |
| 120 | - $post_types = geodir_get_posttypes('object');
|
|
| 120 | + $post_types = geodir_get_posttypes('object');
|
|
| 121 | 121 | |
| 122 | - $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
|
|
| 122 | + $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
|
|
| 123 | 123 | |
| 124 | - if (!empty($post_types)) {
|
|
| 125 | - global $geodir_add_location_url; |
|
| 126 | - $geodir_add_location_url = true; |
|
| 127 | - foreach ($post_types as $post_type => $args) {
|
|
| 128 | - if (!empty($show_listing_post_types)) {
|
|
| 129 | - if (in_array($post_type, $show_listing_post_types)) {
|
|
| 130 | - if (get_post_type_archive_link($post_type)) {
|
|
| 124 | + if (!empty($post_types)) {
|
|
| 125 | + global $geodir_add_location_url; |
|
| 126 | + $geodir_add_location_url = true; |
|
| 127 | + foreach ($post_types as $post_type => $args) {
|
|
| 128 | + if (!empty($show_listing_post_types)) {
|
|
| 129 | + if (in_array($post_type, $show_listing_post_types)) {
|
|
| 130 | + if (get_post_type_archive_link($post_type)) {
|
|
| 131 | 131 | |
| 132 | - $menu_class = ''; |
|
| 133 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
|
|
| 134 | - $menu_class = 'current-menu-item'; |
|
| 132 | + $menu_class = ''; |
|
| 133 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
|
|
| 134 | + $menu_class = 'current-menu-item'; |
|
| 135 | 135 | |
| 136 | - $items .= '<li class="' . $sub_li_class . '"> |
|
| 136 | + $items .= '<li class="' . $sub_li_class . '"> |
|
| 137 | 137 | <a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '"> |
| 138 | 138 | ' . __(ucfirst($args->labels->name),'geodirectory') . ' |
| 139 | 139 | </a> |
| 140 | 140 | </li>'; |
| 141 | - } |
|
| 142 | - } |
|
| 143 | - } |
|
| 144 | - } |
|
| 145 | - $geodir_add_location_url = NULL; |
|
| 146 | - } |
|
| 141 | + } |
|
| 142 | + } |
|
| 143 | + } |
|
| 144 | + } |
|
| 145 | + $geodir_add_location_url = NULL; |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | - $items .= ' </ul> '; |
|
| 149 | - /** |
|
| 150 | - * Filter called after the sub menu closing ul tag for dynamic added menu items. |
|
| 151 | - * |
|
| 152 | - * @since 1.5.9 |
|
| 153 | - */ |
|
| 154 | - $items .= apply_filters('geodir_menu_after_sub_ul','');
|
|
| 155 | - $items .= '</li>'; |
|
| 156 | - } |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - if (get_option('geodir_show_addlisting_nav')) {
|
|
| 160 | - |
|
| 161 | - $menu_class = ''; |
|
| 162 | - if (geodir_is_page('add-listing'))
|
|
| 163 | - $menu_class = 'current-menu-item'; |
|
| 164 | - |
|
| 165 | - //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
| 166 | - $post_types = geodir_get_posttypes('object');
|
|
| 167 | - $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
|
|
| 168 | - $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
|
|
| 169 | - |
|
| 170 | - if (!empty($post_types)) {
|
|
| 171 | - foreach ($post_types as $post_type => $args) {
|
|
| 172 | - if (!empty($geodir_allow_posttype_frontend)) {
|
|
| 173 | - if (in_array($post_type, $geodir_allow_posttype_frontend)) {
|
|
| 174 | - if (!empty($show_add_listing_post_types_main_nav)) {
|
|
| 175 | - if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
|
|
| 176 | - if (geodir_get_addlisting_link($post_type)) {
|
|
| 177 | - |
|
| 178 | - $menu_class = ''; |
|
| 179 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
|
|
| 180 | - $menu_class = 'current-menu-item'; |
|
| 181 | - /** |
|
| 182 | - * Filter the menu li class. |
|
| 183 | - * |
|
| 184 | - * @since 1.0.0 |
|
| 185 | - * @param string $menu_class The menu HTML class. |
|
| 186 | - */ |
|
| 187 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 188 | - /** |
|
| 189 | - * Filter the menu a class. |
|
| 190 | - * |
|
| 191 | - * @since 1.0.0 |
|
| 192 | - */ |
|
| 193 | - $a_class = apply_filters('geodir_menu_a_class', '');
|
|
| 194 | - $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
| 195 | - $items .= '<li class="' . $li_class . '"> |
|
| 148 | + $items .= ' </ul> '; |
|
| 149 | + /** |
|
| 150 | + * Filter called after the sub menu closing ul tag for dynamic added menu items. |
|
| 151 | + * |
|
| 152 | + * @since 1.5.9 |
|
| 153 | + */ |
|
| 154 | + $items .= apply_filters('geodir_menu_after_sub_ul','');
|
|
| 155 | + $items .= '</li>'; |
|
| 156 | + } |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + if (get_option('geodir_show_addlisting_nav')) {
|
|
| 160 | + |
|
| 161 | + $menu_class = ''; |
|
| 162 | + if (geodir_is_page('add-listing'))
|
|
| 163 | + $menu_class = 'current-menu-item'; |
|
| 164 | + |
|
| 165 | + //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
| 166 | + $post_types = geodir_get_posttypes('object');
|
|
| 167 | + $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
|
|
| 168 | + $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
|
|
| 169 | + |
|
| 170 | + if (!empty($post_types)) {
|
|
| 171 | + foreach ($post_types as $post_type => $args) {
|
|
| 172 | + if (!empty($geodir_allow_posttype_frontend)) {
|
|
| 173 | + if (in_array($post_type, $geodir_allow_posttype_frontend)) {
|
|
| 174 | + if (!empty($show_add_listing_post_types_main_nav)) {
|
|
| 175 | + if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
|
|
| 176 | + if (geodir_get_addlisting_link($post_type)) {
|
|
| 177 | + |
|
| 178 | + $menu_class = ''; |
|
| 179 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
|
|
| 180 | + $menu_class = 'current-menu-item'; |
|
| 181 | + /** |
|
| 182 | + * Filter the menu li class. |
|
| 183 | + * |
|
| 184 | + * @since 1.0.0 |
|
| 185 | + * @param string $menu_class The menu HTML class. |
|
| 186 | + */ |
|
| 187 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 188 | + /** |
|
| 189 | + * Filter the menu a class. |
|
| 190 | + * |
|
| 191 | + * @since 1.0.0 |
|
| 192 | + */ |
|
| 193 | + $a_class = apply_filters('geodir_menu_a_class', '');
|
|
| 194 | + $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
| 195 | + $items .= '<li class="' . $li_class . '"> |
|
| 196 | 196 | <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '"> |
| 197 | 197 | ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
|
| 198 | 198 | </a> |
| 199 | 199 | </li>'; |
| 200 | - } |
|
| 201 | - } |
|
| 202 | - } |
|
| 203 | - } |
|
| 204 | - } |
|
| 205 | - } |
|
| 206 | - } |
|
| 207 | - //END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - $view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
|
|
| 211 | - $is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false; |
|
| 212 | - if ($is_add_listing_sub_meny_exists) {
|
|
| 213 | - |
|
| 214 | - if (get_option('geodir_show_addlisting_nav')) {
|
|
| 215 | - /** |
|
| 216 | - * Filter the menu li class. |
|
| 217 | - * |
|
| 218 | - * @since 1.0.0 |
|
| 219 | - * @param string $menu_class The menu HTML class. |
|
| 220 | - */ |
|
| 221 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
|
|
| 222 | - /** |
|
| 223 | - * Filter the sub menu li class. |
|
| 224 | - * |
|
| 225 | - * @since 1.0.0 |
|
| 226 | - * @param string $menu_class The menu HTML class. |
|
| 227 | - */ |
|
| 228 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 229 | - /** |
|
| 230 | - * Filter the sub menu ul class. |
|
| 231 | - * |
|
| 232 | - * @since 1.0.0 |
|
| 233 | - */ |
|
| 234 | - $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
|
|
| 235 | - /** |
|
| 236 | - * Filter the menu a class. |
|
| 237 | - * |
|
| 238 | - * @since 1.0.0 |
|
| 239 | - */ |
|
| 240 | - $a_class = apply_filters('geodir_menu_a_class', '');
|
|
| 241 | - /** |
|
| 242 | - * Filter the sub menu a class. |
|
| 243 | - * |
|
| 244 | - * @since 1.0.0 |
|
| 245 | - */ |
|
| 246 | - $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
|
|
| 247 | - $items .= '<li class="' . $li_class . '"> |
|
| 200 | + } |
|
| 201 | + } |
|
| 202 | + } |
|
| 203 | + } |
|
| 204 | + } |
|
| 205 | + } |
|
| 206 | + } |
|
| 207 | + //END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + $view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
|
|
| 211 | + $is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false; |
|
| 212 | + if ($is_add_listing_sub_meny_exists) {
|
|
| 213 | + |
|
| 214 | + if (get_option('geodir_show_addlisting_nav')) {
|
|
| 215 | + /** |
|
| 216 | + * Filter the menu li class. |
|
| 217 | + * |
|
| 218 | + * @since 1.0.0 |
|
| 219 | + * @param string $menu_class The menu HTML class. |
|
| 220 | + */ |
|
| 221 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
|
|
| 222 | + /** |
|
| 223 | + * Filter the sub menu li class. |
|
| 224 | + * |
|
| 225 | + * @since 1.0.0 |
|
| 226 | + * @param string $menu_class The menu HTML class. |
|
| 227 | + */ |
|
| 228 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 229 | + /** |
|
| 230 | + * Filter the sub menu ul class. |
|
| 231 | + * |
|
| 232 | + * @since 1.0.0 |
|
| 233 | + */ |
|
| 234 | + $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
|
|
| 235 | + /** |
|
| 236 | + * Filter the menu a class. |
|
| 237 | + * |
|
| 238 | + * @since 1.0.0 |
|
| 239 | + */ |
|
| 240 | + $a_class = apply_filters('geodir_menu_a_class', '');
|
|
| 241 | + /** |
|
| 242 | + * Filter the sub menu a class. |
|
| 243 | + * |
|
| 244 | + * @since 1.0.0 |
|
| 245 | + */ |
|
| 246 | + $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
|
|
| 247 | + $items .= '<li class="' . $li_class . '"> |
|
| 248 | 248 | <a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a>
|
| 249 | 249 | <ul class="' . $sub_ul_class . '">'; |
| 250 | 250 | |
| 251 | - $post_types = geodir_get_posttypes('object');
|
|
| 252 | - |
|
| 253 | - $show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
|
|
| 254 | - |
|
| 255 | - if (!empty($post_types)) {
|
|
| 256 | - foreach ($post_types as $post_type => $args) {
|
|
| 257 | - if (!empty($geodir_allow_posttype_frontend)) {
|
|
| 258 | - if (in_array($post_type, $geodir_allow_posttype_frontend)) {
|
|
| 259 | - if (!empty($show_add_listing_post_types)) {
|
|
| 260 | - if (in_array($post_type, $show_add_listing_post_types)) {
|
|
| 261 | - if (geodir_get_addlisting_link($post_type)) {
|
|
| 262 | - |
|
| 263 | - $menu_class = ''; |
|
| 264 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
|
|
| 265 | - $menu_class = 'current-menu-item'; |
|
| 266 | - /** |
|
| 267 | - * Filter the menu li class. |
|
| 268 | - * |
|
| 269 | - * @since 1.0.0 |
|
| 270 | - * @param string $menu_class The menu HTML class. |
|
| 271 | - */ |
|
| 272 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 273 | - $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
| 274 | - $items .= '<li class="' . $li_class . '"> |
|
| 251 | + $post_types = geodir_get_posttypes('object');
|
|
| 252 | + |
|
| 253 | + $show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
|
|
| 254 | + |
|
| 255 | + if (!empty($post_types)) {
|
|
| 256 | + foreach ($post_types as $post_type => $args) {
|
|
| 257 | + if (!empty($geodir_allow_posttype_frontend)) {
|
|
| 258 | + if (in_array($post_type, $geodir_allow_posttype_frontend)) {
|
|
| 259 | + if (!empty($show_add_listing_post_types)) {
|
|
| 260 | + if (in_array($post_type, $show_add_listing_post_types)) {
|
|
| 261 | + if (geodir_get_addlisting_link($post_type)) {
|
|
| 262 | + |
|
| 263 | + $menu_class = ''; |
|
| 264 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
|
|
| 265 | + $menu_class = 'current-menu-item'; |
|
| 266 | + /** |
|
| 267 | + * Filter the menu li class. |
|
| 268 | + * |
|
| 269 | + * @since 1.0.0 |
|
| 270 | + * @param string $menu_class The menu HTML class. |
|
| 271 | + */ |
|
| 272 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 273 | + $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
| 274 | + $items .= '<li class="' . $li_class . '"> |
|
| 275 | 275 | <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '"> |
| 276 | 276 | ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
|
| 277 | 277 | </a> |
| 278 | 278 | </li>'; |
| 279 | - } |
|
| 280 | - } |
|
| 281 | - } |
|
| 282 | - } |
|
| 283 | - } |
|
| 284 | - } |
|
| 285 | - } |
|
| 279 | + } |
|
| 280 | + } |
|
| 281 | + } |
|
| 282 | + } |
|
| 283 | + } |
|
| 284 | + } |
|
| 285 | + } |
|
| 286 | 286 | |
| 287 | - $items .= ' </ul> '; |
|
| 288 | - $items .= apply_filters('geodir_menu_after_sub_ul','');
|
|
| 289 | - $items .= '</li>'; |
|
| 287 | + $items .= ' </ul> '; |
|
| 288 | + $items .= apply_filters('geodir_menu_after_sub_ul','');
|
|
| 289 | + $items .= '</li>'; |
|
| 290 | 290 | |
| 291 | - } |
|
| 292 | - } |
|
| 293 | - // apply filter to add more navigations // -Filter-Location-Manager |
|
| 294 | - return $items; |
|
| 291 | + } |
|
| 292 | + } |
|
| 293 | + // apply filter to add more navigations // -Filter-Location-Manager |
|
| 294 | + return $items; |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | |
@@ -309,20 +309,20 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | function geodir_pagemenu_items($menu, $args) |
| 311 | 311 | {
|
| 312 | - $locations = get_nav_menu_locations(); |
|
| 313 | - $geodir_theme_location = get_option('geodir_theme_location_nav');
|
|
| 314 | - $geodir_theme_location_nav = array(); |
|
| 315 | - if (empty($locations) && empty($geodir_theme_location)) {
|
|
| 316 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
|
|
| 317 | - $geodir_theme_location_nav[] = $args['theme_location']; |
|
| 318 | - update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
|
|
| 319 | - } |
|
| 320 | - //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet. |
|
| 312 | + $locations = get_nav_menu_locations(); |
|
| 313 | + $geodir_theme_location = get_option('geodir_theme_location_nav');
|
|
| 314 | + $geodir_theme_location_nav = array(); |
|
| 315 | + if (empty($locations) && empty($geodir_theme_location)) {
|
|
| 316 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
|
|
| 317 | + $geodir_theme_location_nav[] = $args['theme_location']; |
|
| 318 | + update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
|
|
| 319 | + } |
|
| 320 | + //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet. |
|
| 321 | 321 | // $menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
|
| 322 | - else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) |
|
| 323 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
|
|
| 322 | + else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) |
|
| 323 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
|
|
| 324 | 324 | |
| 325 | - return $menu; |
|
| 325 | + return $menu; |
|
| 326 | 326 | |
| 327 | 327 | } |
| 328 | 328 | |
@@ -342,18 +342,18 @@ discard block |
||
| 342 | 342 | function geodir_menu_items($items, $args) |
| 343 | 343 | {
|
| 344 | 344 | |
| 345 | - $location = $args->theme_location; |
|
| 345 | + $location = $args->theme_location; |
|
| 346 | 346 | |
| 347 | - $geodir_theme_location = get_option('geodir_theme_location_nav');
|
|
| 347 | + $geodir_theme_location = get_option('geodir_theme_location_nav');
|
|
| 348 | 348 | |
| 349 | - if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
|
|
| 349 | + if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
|
|
| 350 | 350 | |
| 351 | - $items = $items . geodir_add_nav_menu_items(); |
|
| 352 | - return $items; |
|
| 351 | + $items = $items . geodir_add_nav_menu_items(); |
|
| 352 | + return $items; |
|
| 353 | 353 | |
| 354 | - } else {
|
|
| 355 | - return $items; |
|
| 356 | - } |
|
| 354 | + } else {
|
|
| 355 | + return $items; |
|
| 356 | + } |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | /** |
@@ -368,25 +368,25 @@ discard block |
||
| 368 | 368 | */ |
| 369 | 369 | function geodir_get_category_all_array() |
| 370 | 370 | {
|
| 371 | - global $wpdb; |
|
| 372 | - $return_array = array(); |
|
| 373 | - |
|
| 374 | - $taxonomies = geodir_get_taxonomies(); |
|
| 375 | - $taxonomies = implode("','", $taxonomies);
|
|
| 376 | - $taxonomies = "'" . $taxonomies . "'"; |
|
| 377 | - |
|
| 378 | - $pn_categories = $wpdb->get_results( |
|
| 379 | - $wpdb->prepare( |
|
| 380 | - "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy, $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name", |
|
| 381 | - array($wpdb->terms . term_id) |
|
| 382 | - ) |
|
| 383 | - ); |
|
| 384 | - |
|
| 385 | - foreach ($pn_categories as $pn_categories_obj) {
|
|
| 386 | - $return_array[] = array("id" => $pn_categories_obj->cat_ID,
|
|
| 387 | - "title" => $pn_categories_obj->name,); |
|
| 388 | - } |
|
| 389 | - return $return_array; |
|
| 371 | + global $wpdb; |
|
| 372 | + $return_array = array(); |
|
| 373 | + |
|
| 374 | + $taxonomies = geodir_get_taxonomies(); |
|
| 375 | + $taxonomies = implode("','", $taxonomies);
|
|
| 376 | + $taxonomies = "'" . $taxonomies . "'"; |
|
| 377 | + |
|
| 378 | + $pn_categories = $wpdb->get_results( |
|
| 379 | + $wpdb->prepare( |
|
| 380 | + "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy, $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name", |
|
| 381 | + array($wpdb->terms . term_id) |
|
| 382 | + ) |
|
| 383 | + ); |
|
| 384 | + |
|
| 385 | + foreach ($pn_categories as $pn_categories_obj) {
|
|
| 386 | + $return_array[] = array("id" => $pn_categories_obj->cat_ID,
|
|
| 387 | + "title" => $pn_categories_obj->name,); |
|
| 388 | + } |
|
| 389 | + return $return_array; |
|
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | |
@@ -401,41 +401,41 @@ discard block |
||
| 401 | 401 | */ |
| 402 | 402 | function geodir_get_current_posttype() |
| 403 | 403 | {
|
| 404 | - global $wp_query, $geodir_post_type; |
|
| 404 | + global $wp_query, $geodir_post_type; |
|
| 405 | 405 | |
| 406 | - $geodir_post_type = get_query_var('post_type');
|
|
| 406 | + $geodir_post_type = get_query_var('post_type');
|
|
| 407 | 407 | |
| 408 | - if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
|
|
| 409 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 410 | - $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
| 411 | - elseif (isset($_REQUEST['listing_type'])) |
|
| 412 | - $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 413 | - } |
|
| 408 | + if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
|
|
| 409 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 410 | + $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
| 411 | + elseif (isset($_REQUEST['listing_type'])) |
|
| 412 | + $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 413 | + } |
|
| 414 | 414 | |
| 415 | - if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
|
|
| 416 | - $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
| 415 | + if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
|
|
| 416 | + $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
| 417 | 417 | |
| 418 | - if (is_tax()) |
|
| 419 | - $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
| 418 | + if (is_tax()) |
|
| 419 | + $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
| 420 | 420 | |
| 421 | 421 | |
| 422 | - $all_postypes = geodir_get_posttypes(); |
|
| 423 | - $all_postypes = stripslashes_deep($all_postypes); |
|
| 422 | + $all_postypes = geodir_get_posttypes(); |
|
| 423 | + $all_postypes = stripslashes_deep($all_postypes); |
|
| 424 | 424 | |
| 425 | - if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
|
| 426 | - $geodir_post_type = ''; |
|
| 425 | + if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
|
| 426 | + $geodir_post_type = ''; |
|
| 427 | 427 | |
| 428 | - if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
|
|
| 429 | - $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
| 430 | - } |
|
| 428 | + if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
|
|
| 429 | + $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
| 430 | + } |
|
| 431 | 431 | |
| 432 | 432 | |
| 433 | - /** |
|
| 434 | - * Filter the default CPT return. |
|
| 435 | - * |
|
| 436 | - * @since 1.6.9 |
|
| 437 | - */ |
|
| 438 | - return apply_filters('geodir_get_current_posttype',$geodir_post_type);
|
|
| 433 | + /** |
|
| 434 | + * Filter the default CPT return. |
|
| 435 | + * |
|
| 436 | + * @since 1.6.9 |
|
| 437 | + */ |
|
| 438 | + return apply_filters('geodir_get_current_posttype',$geodir_post_type);
|
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | /** |
@@ -449,22 +449,22 @@ discard block |
||
| 449 | 449 | */ |
| 450 | 450 | function geodir_get_default_posttype() |
| 451 | 451 | {
|
| 452 | - $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) ); |
|
| 453 | - |
|
| 454 | - $stype = false; |
|
| 455 | - foreach ( $post_types as $post_type => $info ) {
|
|
| 456 | - global $wpdb; |
|
| 457 | - $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) ); |
|
| 458 | - if ( $has_posts ) {
|
|
| 459 | - $stype = $post_type; break; |
|
| 460 | - } |
|
| 461 | - } |
|
| 462 | - |
|
| 463 | - if(!$stype){
|
|
| 464 | - $stype = 'gd_place'; |
|
| 465 | - } |
|
| 466 | - |
|
| 467 | - return $stype; |
|
| 452 | + $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) ); |
|
| 453 | + |
|
| 454 | + $stype = false; |
|
| 455 | + foreach ( $post_types as $post_type => $info ) {
|
|
| 456 | + global $wpdb; |
|
| 457 | + $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) ); |
|
| 458 | + if ( $has_posts ) {
|
|
| 459 | + $stype = $post_type; break; |
|
| 460 | + } |
|
| 461 | + } |
|
| 462 | + |
|
| 463 | + if(!$stype){
|
|
| 464 | + $stype = 'gd_place'; |
|
| 465 | + } |
|
| 466 | + |
|
| 467 | + return $stype; |
|
| 468 | 468 | } |
| 469 | 469 | |
| 470 | 470 | /** |
@@ -478,21 +478,21 @@ discard block |
||
| 478 | 478 | */ |
| 479 | 479 | function geodir_get_posttypes($output = 'names') |
| 480 | 480 | {
|
| 481 | - $post_types = array(); |
|
| 482 | - $post_types = get_option('geodir_post_types');
|
|
| 483 | - $post_types = stripslashes_deep($post_types); |
|
| 484 | - if (!empty($post_types)) {
|
|
| 485 | - switch ($output): |
|
| 486 | - case 'object': |
|
| 487 | - case 'Object': |
|
| 488 | - $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types; |
|
| 489 | - break; |
|
| 490 | - case 'array': |
|
| 491 | - case 'Array': |
|
| 492 | - $post_types = (array)$post_types; |
|
| 493 | - break; |
|
| 481 | + $post_types = array(); |
|
| 482 | + $post_types = get_option('geodir_post_types');
|
|
| 483 | + $post_types = stripslashes_deep($post_types); |
|
| 484 | + if (!empty($post_types)) {
|
|
| 485 | + switch ($output): |
|
| 486 | + case 'object': |
|
| 487 | + case 'Object': |
|
| 488 | + $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types; |
|
| 489 | + break; |
|
| 490 | + case 'array': |
|
| 491 | + case 'Array': |
|
| 492 | + $post_types = (array)$post_types; |
|
| 493 | + break; |
|
| 494 | 494 | case 'options': |
| 495 | - $post_types = (array)$post_types; |
|
| 495 | + $post_types = (array)$post_types; |
|
| 496 | 496 | |
| 497 | 497 | $options = array(); |
| 498 | 498 | if (!empty($post_types)) {
|
@@ -501,17 +501,17 @@ discard block |
||
| 501 | 501 | } |
| 502 | 502 | } |
| 503 | 503 | $post_types = $options; |
| 504 | - break; |
|
| 505 | - default: |
|
| 506 | - $post_types = array_keys($post_types); |
|
| 507 | - break; |
|
| 508 | - endswitch; |
|
| 509 | - } |
|
| 510 | - |
|
| 511 | - if (!empty($post_types)) |
|
| 512 | - return $post_types; |
|
| 513 | - else |
|
| 514 | - return array(); |
|
| 504 | + break; |
|
| 505 | + default: |
|
| 506 | + $post_types = array_keys($post_types); |
|
| 507 | + break; |
|
| 508 | + endswitch; |
|
| 509 | + } |
|
| 510 | + |
|
| 511 | + if (!empty($post_types)) |
|
| 512 | + return $post_types; |
|
| 513 | + else |
|
| 514 | + return array(); |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | /** |
@@ -524,108 +524,108 @@ discard block |
||
| 524 | 524 | */ |
| 525 | 525 | function geodir_get_posttype_info($post_type = '') |
| 526 | 526 | {
|
| 527 | - $post_types = array(); |
|
| 528 | - $post_types = get_option('geodir_post_types');
|
|
| 529 | - $post_types = stripslashes_deep($post_types); |
|
| 530 | - if (!empty($post_types) && $post_type != '') {
|
|
| 531 | - return $post_types[$post_type]; |
|
| 532 | - } else |
|
| 533 | - return false; |
|
| 527 | + $post_types = array(); |
|
| 528 | + $post_types = get_option('geodir_post_types');
|
|
| 529 | + $post_types = stripslashes_deep($post_types); |
|
| 530 | + if (!empty($post_types) && $post_type != '') {
|
|
| 531 | + return $post_types[$post_type]; |
|
| 532 | + } else |
|
| 533 | + return false; |
|
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | if (!function_exists('geodir_get_taxonomies')) {
|
| 537 | - /** |
|
| 538 | - * Get all custom taxonomies. |
|
| 539 | - * |
|
| 540 | - * @since 1.0.0 |
|
| 541 | - * @package GeoDirectory |
|
| 542 | - * @param string $post_type The post type. |
|
| 543 | - * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
| 544 | - * @return array|bool Taxonomies on success. false on failure. |
|
| 545 | - */ |
|
| 546 | - function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false) |
|
| 547 | - {
|
|
| 537 | + /** |
|
| 538 | + * Get all custom taxonomies. |
|
| 539 | + * |
|
| 540 | + * @since 1.0.0 |
|
| 541 | + * @package GeoDirectory |
|
| 542 | + * @param string $post_type The post type. |
|
| 543 | + * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
| 544 | + * @return array|bool Taxonomies on success. false on failure. |
|
| 545 | + */ |
|
| 546 | + function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false) |
|
| 547 | + {
|
|
| 548 | 548 | |
| 549 | - $taxonomies = array(); |
|
| 550 | - $gd_taxonomies = array(); |
|
| 549 | + $taxonomies = array(); |
|
| 550 | + $gd_taxonomies = array(); |
|
| 551 | 551 | |
| 552 | - if ($taxonomies = get_option('geodir_taxonomies')) {
|
|
| 552 | + if ($taxonomies = get_option('geodir_taxonomies')) {
|
|
| 553 | 553 | |
| 554 | 554 | |
| 555 | - $gd_taxonomies = array_keys($taxonomies); |
|
| 555 | + $gd_taxonomies = array_keys($taxonomies); |
|
| 556 | 556 | |
| 557 | 557 | |
| 558 | - if ($post_type != '') |
|
| 559 | - $gd_taxonomies = array(); |
|
| 558 | + if ($post_type != '') |
|
| 559 | + $gd_taxonomies = array(); |
|
| 560 | 560 | |
| 561 | - $i = 0; |
|
| 562 | - foreach ($taxonomies as $taxonomy => $args) {
|
|
| 561 | + $i = 0; |
|
| 562 | + foreach ($taxonomies as $taxonomy => $args) {
|
|
| 563 | 563 | |
| 564 | - if ($post_type != '' && $args['object_type'] == $post_type) |
|
| 565 | - $gd_taxonomies[] = $taxonomy; |
|
| 564 | + if ($post_type != '' && $args['object_type'] == $post_type) |
|
| 565 | + $gd_taxonomies[] = $taxonomy; |
|
| 566 | 566 | |
| 567 | - if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
|
|
| 568 | - if (array_search($taxonomy, $gd_taxonomies) !== false) |
|
| 569 | - unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
|
| 570 | - } |
|
| 567 | + if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) {
|
|
| 568 | + if (array_search($taxonomy, $gd_taxonomies) !== false) |
|
| 569 | + unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
|
| 570 | + } |
|
| 571 | 571 | |
| 572 | - } |
|
| 572 | + } |
|
| 573 | + |
|
| 574 | + $gd_taxonomies = array_values($gd_taxonomies); |
|
| 575 | + } |
|
| 573 | 576 | |
| 574 | - $gd_taxonomies = array_values($gd_taxonomies); |
|
| 575 | - } |
|
| 576 | - |
|
| 577 | - /** |
|
| 578 | - * Filter the taxonomies. |
|
| 579 | - * |
|
| 580 | - * @since 1.0.0 |
|
| 581 | - * @param array $gd_taxonomies The taxonomy array. |
|
| 582 | - */ |
|
| 583 | - $taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
|
|
| 584 | - |
|
| 585 | - if (!empty($taxonomies)) {
|
|
| 586 | - return $taxonomies; |
|
| 587 | - } else {
|
|
| 588 | - return false; |
|
| 589 | - } |
|
| 590 | - } |
|
| 577 | + /** |
|
| 578 | + * Filter the taxonomies. |
|
| 579 | + * |
|
| 580 | + * @since 1.0.0 |
|
| 581 | + * @param array $gd_taxonomies The taxonomy array. |
|
| 582 | + */ |
|
| 583 | + $taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
|
|
| 584 | + |
|
| 585 | + if (!empty($taxonomies)) {
|
|
| 586 | + return $taxonomies; |
|
| 587 | + } else {
|
|
| 588 | + return false; |
|
| 589 | + } |
|
| 590 | + } |
|
| 591 | 591 | } |
| 592 | 592 | |
| 593 | 593 | if (!function_exists(' geodir_get_categories_dl')) {
|
| 594 | - /** |
|
| 595 | - * Get categories dropdown HTML. |
|
| 596 | - * |
|
| 597 | - * @since 1.0.0 |
|
| 598 | - * @package GeoDirectory |
|
| 599 | - * @param string $post_type The post type. |
|
| 600 | - * @param string $selected The selected value. |
|
| 601 | - * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
| 602 | - * @param bool $echo Prints the HTML when set to true. Default: true. |
|
| 603 | - * @return void|string Dropdown HTML. |
|
| 604 | - */ |
|
| 605 | - function geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true) |
|
| 606 | - {
|
|
| 607 | - |
|
| 608 | - $html = ''; |
|
| 609 | - $taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies); |
|
| 610 | - |
|
| 611 | - $categories = get_terms($taxonomies); |
|
| 612 | - |
|
| 613 | - $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
|
|
| 614 | - |
|
| 615 | - foreach ($categories as $category_obj) {
|
|
| 616 | - $select_opt = ''; |
|
| 617 | - if ($selected == $category_obj->term_id) {
|
|
| 618 | - $select_opt = 'selected="selected"'; |
|
| 619 | - } |
|
| 620 | - $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">' |
|
| 621 | - . ucfirst($category_obj->name) . '</option>'; |
|
| 622 | - } |
|
| 623 | - |
|
| 624 | - if ($echo) |
|
| 625 | - echo $html; |
|
| 626 | - else |
|
| 627 | - return $html; |
|
| 628 | - } |
|
| 594 | + /** |
|
| 595 | + * Get categories dropdown HTML. |
|
| 596 | + * |
|
| 597 | + * @since 1.0.0 |
|
| 598 | + * @package GeoDirectory |
|
| 599 | + * @param string $post_type The post type. |
|
| 600 | + * @param string $selected The selected value. |
|
| 601 | + * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
| 602 | + * @param bool $echo Prints the HTML when set to true. Default: true. |
|
| 603 | + * @return void|string Dropdown HTML. |
|
| 604 | + */ |
|
| 605 | + function geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true) |
|
| 606 | + {
|
|
| 607 | + |
|
| 608 | + $html = ''; |
|
| 609 | + $taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies); |
|
| 610 | + |
|
| 611 | + $categories = get_terms($taxonomies); |
|
| 612 | + |
|
| 613 | + $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
|
|
| 614 | + |
|
| 615 | + foreach ($categories as $category_obj) {
|
|
| 616 | + $select_opt = ''; |
|
| 617 | + if ($selected == $category_obj->term_id) {
|
|
| 618 | + $select_opt = 'selected="selected"'; |
|
| 619 | + } |
|
| 620 | + $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">' |
|
| 621 | + . ucfirst($category_obj->name) . '</option>'; |
|
| 622 | + } |
|
| 623 | + |
|
| 624 | + if ($echo) |
|
| 625 | + echo $html; |
|
| 626 | + else |
|
| 627 | + return $html; |
|
| 628 | + } |
|
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | |
@@ -640,28 +640,28 @@ discard block |
||
| 640 | 640 | function geodir_get_listing_slug($object_type = '') |
| 641 | 641 | {
|
| 642 | 642 | |
| 643 | - $listing_slug = ''; |
|
| 643 | + $listing_slug = ''; |
|
| 644 | 644 | |
| 645 | - $post_types = get_option('geodir_post_types');
|
|
| 646 | - $taxonomies = get_option('geodir_taxonomies');
|
|
| 645 | + $post_types = get_option('geodir_post_types');
|
|
| 646 | + $taxonomies = get_option('geodir_taxonomies');
|
|
| 647 | 647 | |
| 648 | 648 | |
| 649 | - if ($object_type != '') {
|
|
| 650 | - if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
|
|
| 649 | + if ($object_type != '') {
|
|
| 650 | + if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
|
|
| 651 | 651 | |
| 652 | - $object_info = $post_types[$object_type]; |
|
| 653 | - $listing_slug = $object_info['listing_slug']; |
|
| 654 | - } elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
|
|
| 655 | - $object_info = $taxonomies[$object_type]; |
|
| 656 | - $listing_slug = $object_info['listing_slug']; |
|
| 657 | - } |
|
| 652 | + $object_info = $post_types[$object_type]; |
|
| 653 | + $listing_slug = $object_info['listing_slug']; |
|
| 654 | + } elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
|
|
| 655 | + $object_info = $taxonomies[$object_type]; |
|
| 656 | + $listing_slug = $object_info['listing_slug']; |
|
| 657 | + } |
|
| 658 | 658 | |
| 659 | - } |
|
| 659 | + } |
|
| 660 | 660 | |
| 661 | - if (!empty($listing_slug)) |
|
| 662 | - return $listing_slug; |
|
| 663 | - else |
|
| 664 | - return false; |
|
| 661 | + if (!empty($listing_slug)) |
|
| 662 | + return $listing_slug; |
|
| 663 | + else |
|
| 664 | + return false; |
|
| 665 | 665 | } |
| 666 | 666 | |
| 667 | 667 | |
@@ -676,212 +676,212 @@ discard block |
||
| 676 | 676 | */ |
| 677 | 677 | function geodir_get_taxonomy_posttype($taxonomy = '') |
| 678 | 678 | {
|
| 679 | - global $wp_query; |
|
| 680 | - |
|
| 681 | - $post_type = array(); |
|
| 682 | - $taxonomies = array(); |
|
| 683 | - |
|
| 684 | - if (!empty($taxonomy)) {
|
|
| 685 | - $taxonomies[] = $taxonomy; |
|
| 686 | - } elseif (isset($wp_query->tax_query->queries)) {
|
|
| 687 | - $tax_arr = $wp_query->tax_query->queries; |
|
| 688 | - //if tax query has 'relation' set then it will break wp_list_pluck so we remove it |
|
| 689 | - if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
|
|
| 690 | - $taxonomies = wp_list_pluck($tax_arr, 'taxonomy'); |
|
| 691 | - } |
|
| 692 | - |
|
| 693 | - if (!empty($taxonomies)) {
|
|
| 694 | - foreach (geodir_get_posttypes() as $pt) {
|
|
| 695 | - $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt); |
|
| 696 | - if (array_intersect($taxonomies, $object_taxonomies)) |
|
| 697 | - $post_type[] = $pt; |
|
| 698 | - } |
|
| 699 | - } |
|
| 700 | - |
|
| 701 | - if (!empty($post_type)) |
|
| 702 | - return $post_type[0]; |
|
| 703 | - else |
|
| 704 | - return false; |
|
| 679 | + global $wp_query; |
|
| 680 | + |
|
| 681 | + $post_type = array(); |
|
| 682 | + $taxonomies = array(); |
|
| 683 | + |
|
| 684 | + if (!empty($taxonomy)) {
|
|
| 685 | + $taxonomies[] = $taxonomy; |
|
| 686 | + } elseif (isset($wp_query->tax_query->queries)) {
|
|
| 687 | + $tax_arr = $wp_query->tax_query->queries; |
|
| 688 | + //if tax query has 'relation' set then it will break wp_list_pluck so we remove it |
|
| 689 | + if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
|
|
| 690 | + $taxonomies = wp_list_pluck($tax_arr, 'taxonomy'); |
|
| 691 | + } |
|
| 692 | + |
|
| 693 | + if (!empty($taxonomies)) {
|
|
| 694 | + foreach (geodir_get_posttypes() as $pt) {
|
|
| 695 | + $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt); |
|
| 696 | + if (array_intersect($taxonomies, $object_taxonomies)) |
|
| 697 | + $post_type[] = $pt; |
|
| 698 | + } |
|
| 699 | + } |
|
| 700 | + |
|
| 701 | + if (!empty($post_type)) |
|
| 702 | + return $post_type[0]; |
|
| 703 | + else |
|
| 704 | + return false; |
|
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | if (!function_exists('geodir_custom_taxonomy_walker')) {
|
| 708 | - /** |
|
| 709 | - * Custom taxonomy walker function. |
|
| 710 | - * |
|
| 711 | - * @since 1.0.0 |
|
| 712 | - * @package GeoDirectory |
|
| 713 | - * @param string $cat_taxonomy The taxonomy name. |
|
| 714 | - * @param int $cat_parent The parent term ID. |
|
| 715 | - * @param bool $hide_empty Hide empty taxonomies? Default: false. |
|
| 716 | - * @param int $pading CSS padding in pixels. |
|
| 717 | - * @return string|void taxonomy HTML. |
|
| 718 | - */ |
|
| 719 | - function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0) |
|
| 720 | - {
|
|
| 721 | - global $cat_display, $post_cat, $exclude_cats; |
|
| 722 | - |
|
| 723 | - $search_terms = trim($post_cat, ","); |
|
| 724 | - |
|
| 725 | - $search_terms = explode(",", $search_terms);
|
|
| 726 | - |
|
| 727 | - $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
|
|
| 728 | - |
|
| 729 | - $display = ''; |
|
| 730 | - $onchange = ''; |
|
| 731 | - $term_check = ''; |
|
| 732 | - $main_list_class = ''; |
|
| 733 | - $out = ''; |
|
| 734 | - //If there are terms, start displaying |
|
| 735 | - if (count($cat_terms) > 0) {
|
|
| 736 | - //Displaying as a list |
|
| 737 | - $p = $pading * 20; |
|
| 738 | - $pading++; |
|
| 739 | - |
|
| 740 | - |
|
| 741 | - if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
|
|
| 742 | - if ($cat_parent == 0) {
|
|
| 743 | - $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display; |
|
| 744 | - $main_list_class = 'class="main_list_selecter"'; |
|
| 745 | - } else {
|
|
| 746 | - //$display = 'display:none'; |
|
| 747 | - $list_class = 'sub_list gd-sub-cats-list'; |
|
| 748 | - } |
|
| 749 | - } |
|
| 708 | + /** |
|
| 709 | + * Custom taxonomy walker function. |
|
| 710 | + * |
|
| 711 | + * @since 1.0.0 |
|
| 712 | + * @package GeoDirectory |
|
| 713 | + * @param string $cat_taxonomy The taxonomy name. |
|
| 714 | + * @param int $cat_parent The parent term ID. |
|
| 715 | + * @param bool $hide_empty Hide empty taxonomies? Default: false. |
|
| 716 | + * @param int $pading CSS padding in pixels. |
|
| 717 | + * @return string|void taxonomy HTML. |
|
| 718 | + */ |
|
| 719 | + function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0) |
|
| 720 | + {
|
|
| 721 | + global $cat_display, $post_cat, $exclude_cats; |
|
| 722 | + |
|
| 723 | + $search_terms = trim($post_cat, ","); |
|
| 724 | + |
|
| 725 | + $search_terms = explode(",", $search_terms);
|
|
| 726 | + |
|
| 727 | + $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
|
|
| 728 | + |
|
| 729 | + $display = ''; |
|
| 730 | + $onchange = ''; |
|
| 731 | + $term_check = ''; |
|
| 732 | + $main_list_class = ''; |
|
| 733 | + $out = ''; |
|
| 734 | + //If there are terms, start displaying |
|
| 735 | + if (count($cat_terms) > 0) {
|
|
| 736 | + //Displaying as a list |
|
| 737 | + $p = $pading * 20; |
|
| 738 | + $pading++; |
|
| 739 | + |
|
| 740 | + |
|
| 741 | + if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
|
|
| 742 | + if ($cat_parent == 0) {
|
|
| 743 | + $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display; |
|
| 744 | + $main_list_class = 'class="main_list_selecter"'; |
|
| 745 | + } else {
|
|
| 746 | + //$display = 'display:none'; |
|
| 747 | + $list_class = 'sub_list gd-sub-cats-list'; |
|
| 748 | + } |
|
| 749 | + } |
|
| 750 | 750 | |
| 751 | - if ($cat_display == 'checkbox' || $cat_display == 'radio') {
|
|
| 752 | - $p = 0; |
|
| 753 | - $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
| 754 | - } |
|
| 751 | + if ($cat_display == 'checkbox' || $cat_display == 'radio') {
|
|
| 752 | + $p = 0; |
|
| 753 | + $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
| 754 | + } |
|
| 755 | 755 | |
| 756 | - foreach ($cat_terms as $cat_term) {
|
|
| 756 | + foreach ($cat_terms as $cat_term) {
|
|
| 757 | 757 | |
| 758 | - $checked = ''; |
|
| 758 | + $checked = ''; |
|
| 759 | 759 | |
| 760 | - if (in_array($cat_term->term_id, $search_terms)) {
|
|
| 761 | - if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 762 | - $checked = 'selected="selected"'; |
|
| 763 | - else |
|
| 764 | - $checked = 'checked="checked"'; |
|
| 765 | - } |
|
| 760 | + if (in_array($cat_term->term_id, $search_terms)) {
|
|
| 761 | + if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 762 | + $checked = 'selected="selected"'; |
|
| 763 | + else |
|
| 764 | + $checked = 'checked="checked"'; |
|
| 765 | + } |
|
| 766 | 766 | |
| 767 | - if ($cat_display == 'radio') |
|
| 768 | - $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>'; |
|
| 769 | - elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 770 | - $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>'; |
|
| 767 | + if ($cat_display == 'radio') |
|
| 768 | + $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>'; |
|
| 769 | + elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 770 | + $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>'; |
|
| 771 | 771 | |
| 772 | - else {
|
|
| 773 | - $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>'; |
|
| 774 | - } |
|
| 772 | + else {
|
|
| 773 | + $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>'; |
|
| 774 | + } |
|
| 775 | 775 | |
| 776 | - // Call recurson to print sub cats |
|
| 777 | - $out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading); |
|
| 776 | + // Call recurson to print sub cats |
|
| 777 | + $out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading); |
|
| 778 | 778 | |
| 779 | - } |
|
| 779 | + } |
|
| 780 | 780 | |
| 781 | - if ($cat_display == 'checkbox' || $cat_display == 'radio') |
|
| 782 | - $out .= '</div>'; |
|
| 781 | + if ($cat_display == 'checkbox' || $cat_display == 'radio') |
|
| 782 | + $out .= '</div>'; |
|
| 783 | 783 | |
| 784 | - return $out; |
|
| 785 | - } |
|
| 786 | - return; |
|
| 787 | - } |
|
| 784 | + return $out; |
|
| 785 | + } |
|
| 786 | + return; |
|
| 787 | + } |
|
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | if (!function_exists('geodir_custom_taxonomy_walker2')) {
|
| 791 | - /** |
|
| 792 | - * Custom taxonomy walker function. |
|
| 793 | - * |
|
| 794 | - * @since 1.0.0 |
|
| 795 | - * @package GeoDirectory |
|
| 796 | - * @global object $post WordPress Post object. |
|
| 797 | - * @global object $gd_session GeoDirectory Session object. |
|
| 798 | - * @param string $cat_taxonomy The taxonomy name. |
|
| 799 | - * @param string $cat_limit Number of categories to display. |
|
| 800 | - */ |
|
| 801 | - function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '') |
|
| 802 | - {
|
|
| 803 | - $post_category = ''; |
|
| 804 | - $post_category_str = ''; |
|
| 805 | - global $exclude_cats, $gd_session; |
|
| 806 | - |
|
| 807 | - $cat_exclude = ''; |
|
| 808 | - if (is_array($exclude_cats) && !empty($exclude_cats)) |
|
| 809 | - $cat_exclude = serialize($exclude_cats); |
|
| 810 | - |
|
| 811 | - if (isset($_REQUEST['backandedit'])) {
|
|
| 812 | - $post = (object)$gd_session->get('listing');
|
|
| 813 | - |
|
| 814 | - if (!is_array($post->post_category[$cat_taxonomy])) |
|
| 815 | - $post_category = $post->post_category[$cat_taxonomy]; |
|
| 816 | - |
|
| 817 | - $post_categories = $post->post_category_str; |
|
| 818 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) |
|
| 819 | - $post_category_str = $post_categories[$cat_taxonomy]; |
|
| 820 | - |
|
| 821 | - } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
|
|
| 822 | - global $post; |
|
| 823 | - |
|
| 824 | - $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true); |
|
| 825 | - if (empty($post_category) && isset($post->{$cat_taxonomy})) {
|
|
| 826 | - $post_category = $post->{$cat_taxonomy};
|
|
| 827 | - } |
|
| 791 | + /** |
|
| 792 | + * Custom taxonomy walker function. |
|
| 793 | + * |
|
| 794 | + * @since 1.0.0 |
|
| 795 | + * @package GeoDirectory |
|
| 796 | + * @global object $post WordPress Post object. |
|
| 797 | + * @global object $gd_session GeoDirectory Session object. |
|
| 798 | + * @param string $cat_taxonomy The taxonomy name. |
|
| 799 | + * @param string $cat_limit Number of categories to display. |
|
| 800 | + */ |
|
| 801 | + function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '') |
|
| 802 | + {
|
|
| 803 | + $post_category = ''; |
|
| 804 | + $post_category_str = ''; |
|
| 805 | + global $exclude_cats, $gd_session; |
|
| 806 | + |
|
| 807 | + $cat_exclude = ''; |
|
| 808 | + if (is_array($exclude_cats) && !empty($exclude_cats)) |
|
| 809 | + $cat_exclude = serialize($exclude_cats); |
|
| 810 | + |
|
| 811 | + if (isset($_REQUEST['backandedit'])) {
|
|
| 812 | + $post = (object)$gd_session->get('listing');
|
|
| 813 | + |
|
| 814 | + if (!is_array($post->post_category[$cat_taxonomy])) |
|
| 815 | + $post_category = $post->post_category[$cat_taxonomy]; |
|
| 816 | + |
|
| 817 | + $post_categories = $post->post_category_str; |
|
| 818 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) |
|
| 819 | + $post_category_str = $post_categories[$cat_taxonomy]; |
|
| 820 | + |
|
| 821 | + } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
|
|
| 822 | + global $post; |
|
| 823 | + |
|
| 824 | + $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true); |
|
| 825 | + if (empty($post_category) && isset($post->{$cat_taxonomy})) {
|
|
| 826 | + $post_category = $post->{$cat_taxonomy};
|
|
| 827 | + } |
|
| 828 | 828 | |
| 829 | - $post_categories = get_post_meta($post->ID, 'post_categories', true); |
|
| 829 | + $post_categories = get_post_meta($post->ID, 'post_categories', true); |
|
| 830 | 830 | |
| 831 | - if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
|
|
| 832 | - foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
|
|
| 833 | - if (is_numeric($cat_part)) {
|
|
| 834 | - $cat_part_arr[] = $cat_part; |
|
| 835 | - } |
|
| 836 | - } |
|
| 837 | - if (is_array($cat_part_arr)) {
|
|
| 838 | - $post_category = implode(',', $cat_part_arr);
|
|
| 839 | - } |
|
| 840 | - } |
|
| 831 | + if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
|
|
| 832 | + foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
|
|
| 833 | + if (is_numeric($cat_part)) {
|
|
| 834 | + $cat_part_arr[] = $cat_part; |
|
| 835 | + } |
|
| 836 | + } |
|
| 837 | + if (is_array($cat_part_arr)) {
|
|
| 838 | + $post_category = implode(',', $cat_part_arr);
|
|
| 839 | + } |
|
| 840 | + } |
|
| 841 | 841 | |
| 842 | - if (!empty($post_category)) {
|
|
| 843 | - $cat1 = array_filter(explode(',', $post_category));
|
|
| 844 | - $post_category = ',' . implode(',', $cat1) . ',';
|
|
| 842 | + if (!empty($post_category)) {
|
|
| 843 | + $cat1 = array_filter(explode(',', $post_category));
|
|
| 844 | + $post_category = ',' . implode(',', $cat1) . ',';
|
|
| 845 | 845 | |
| 846 | - } |
|
| 846 | + } |
|
| 847 | 847 | |
| 848 | - if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
|
|
| 848 | + if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
|
|
| 849 | 849 | |
| 850 | - $post_category_upd = explode(',', $post_category);
|
|
| 851 | - $post_category_change = ''; |
|
| 852 | - foreach ($post_category_upd as $cat) {
|
|
| 850 | + $post_category_upd = explode(',', $post_category);
|
|
| 851 | + $post_category_change = ''; |
|
| 852 | + foreach ($post_category_upd as $cat) {
|
|
| 853 | 853 | |
| 854 | - if (!in_array($cat, $exclude_cats) && $cat != '') {
|
|
| 855 | - $post_category_change .= ',' . $cat; |
|
| 856 | - } |
|
| 857 | - } |
|
| 858 | - $post_category = $post_category_change; |
|
| 859 | - } |
|
| 854 | + if (!in_array($cat, $exclude_cats) && $cat != '') {
|
|
| 855 | + $post_category_change .= ',' . $cat; |
|
| 856 | + } |
|
| 857 | + } |
|
| 858 | + $post_category = $post_category_change; |
|
| 859 | + } |
|
| 860 | 860 | |
| 861 | 861 | |
| 862 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
|
|
| 863 | - $post_category_str = $post_categories[$cat_taxonomy]; |
|
| 864 | - } |
|
| 865 | - } |
|
| 862 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
|
|
| 863 | + $post_category_str = $post_categories[$cat_taxonomy]; |
|
| 864 | + } |
|
| 865 | + } |
|
| 866 | 866 | |
| 867 | - echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']" />'; |
|
| 867 | + echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']" />'; |
|
| 868 | 868 | |
| 869 | - echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']" />'; |
|
| 869 | + echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']" />'; |
|
| 870 | 870 | |
| 871 | - echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']" />'; |
|
| 871 | + echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']" />'; |
|
| 872 | 872 | |
| 873 | 873 | |
| 874 | - ?> |
|
| 874 | + ?> |
|
| 875 | 875 | <div class="cat_sublist"> |
| 876 | 876 | <?php |
| 877 | 877 | |
| 878 | - $post_id = isset($post->ID) ? $post->ID : ''; |
|
| 878 | + $post_id = isset($post->ID) ? $post->ID : ''; |
|
| 879 | 879 | |
| 880 | - if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
|
|
| 880 | + if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
|
|
| 881 | 881 | |
| 882 | - geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories); |
|
| 883 | - } |
|
| 884 | - ?> |
|
| 882 | + geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories); |
|
| 883 | + } |
|
| 884 | + ?> |
|
| 885 | 885 | </div> |
| 886 | 886 | <script type="text/javascript"> |
| 887 | 887 | |
@@ -1004,22 +1004,22 @@ discard block |
||
| 1004 | 1004 | |
| 1005 | 1005 | </script> |
| 1006 | 1006 | <?php |
| 1007 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
|
|
| 1008 | - $post_cat_str = $post_categories[$cat_taxonomy]; |
|
| 1009 | - $post_cat_array = explode("#", $post_cat_str);
|
|
| 1010 | - if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) |
|
| 1011 | - $style = "display:none;"; |
|
| 1012 | - } |
|
| 1013 | - ?> |
|
| 1007 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
|
|
| 1008 | + $post_cat_str = $post_categories[$cat_taxonomy]; |
|
| 1009 | + $post_cat_array = explode("#", $post_cat_str);
|
|
| 1010 | + if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) |
|
| 1011 | + $style = "display:none;"; |
|
| 1012 | + } |
|
| 1013 | + ?> |
|
| 1014 | 1014 | <div class="main_cat_list" style=" <?php if (isset($style)) {
|
| 1015 | - echo $style; |
|
| 1016 | - }?> "> |
|
| 1015 | + echo $style; |
|
| 1016 | + }?> "> |
|
| 1017 | 1017 | <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
| 1018 | - ?> |
|
| 1018 | + ?> |
|
| 1019 | 1019 | </div> |
| 1020 | 1020 | <?php |
| 1021 | 1021 | |
| 1022 | - } |
|
| 1022 | + } |
|
| 1023 | 1023 | } |
| 1024 | 1024 | |
| 1025 | 1025 | /** |
@@ -1036,23 +1036,23 @@ discard block |
||
| 1036 | 1036 | */ |
| 1037 | 1037 | function geodir_addpost_categories_html($request_taxonomy, $parrent, $selected = false, $main_selected = true, $default = false, $exclude = '') |
| 1038 | 1038 | {
|
| 1039 | - global $exclude_cats; |
|
| 1039 | + global $exclude_cats; |
|
| 1040 | 1040 | |
| 1041 | - if ($exclude != '') {
|
|
| 1042 | - $exclude_cats = maybe_unserialize(base64_decode($exclude)); |
|
| 1041 | + if ($exclude != '') {
|
|
| 1042 | + $exclude_cats = maybe_unserialize(base64_decode($exclude)); |
|
| 1043 | 1043 | |
| 1044 | - if(is_array( $exclude_cats)){
|
|
| 1045 | - $exclude_cats = array_map( 'intval', $exclude_cats ); |
|
| 1046 | - }else{
|
|
| 1047 | - $exclude_cats = intval($exclude_cats); |
|
| 1048 | - } |
|
| 1044 | + if(is_array( $exclude_cats)){
|
|
| 1045 | + $exclude_cats = array_map( 'intval', $exclude_cats ); |
|
| 1046 | + }else{
|
|
| 1047 | + $exclude_cats = intval($exclude_cats); |
|
| 1048 | + } |
|
| 1049 | 1049 | |
| 1050 | - } |
|
| 1050 | + } |
|
| 1051 | 1051 | |
| 1052 | - if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) || |
|
| 1053 | - (!is_array($exclude_cats) || empty($exclude_cats)) |
|
| 1054 | - ) {
|
|
| 1055 | - ?> |
|
| 1052 | + if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) || |
|
| 1053 | + (!is_array($exclude_cats) || empty($exclude_cats)) |
|
| 1054 | + ) {
|
|
| 1055 | + ?> |
|
| 1056 | 1056 | |
| 1057 | 1057 | <?php $main_cat = get_term($parrent, $request_taxonomy); ?> |
| 1058 | 1058 | |
@@ -1081,8 +1081,8 @@ discard block |
||
| 1081 | 1081 | |
| 1082 | 1082 | <br/> |
| 1083 | 1083 | <?php |
| 1084 | - $cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
|
|
| 1085 | - if (!empty($cat_terms)) { ?>
|
|
| 1084 | + $cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
|
|
| 1085 | + if (!empty($cat_terms)) { ?>
|
|
| 1086 | 1086 | <span> <?php printf(__('Add listing in category', 'geodirectory')); ?></span>
|
| 1087 | 1087 | <?php geodir_get_catlist($request_taxonomy, $parrent, $selected) ?> |
| 1088 | 1088 | <?php } ?> |
@@ -1104,53 +1104,53 @@ discard block |
||
| 1104 | 1104 | function geodir_editpost_categories_html($request_taxonomy, $request_postid, $post_categories) |
| 1105 | 1105 | {
|
| 1106 | 1106 | |
| 1107 | - if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
|
|
| 1108 | - $post_cat_str = $post_categories[$request_taxonomy]; |
|
| 1109 | - $post_cat_array = explode("#", $post_cat_str);
|
|
| 1110 | - if (is_array($post_cat_array)) {
|
|
| 1111 | - $post_cat_array = array_unique( $post_cat_array ); |
|
| 1107 | + if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
|
|
| 1108 | + $post_cat_str = $post_categories[$request_taxonomy]; |
|
| 1109 | + $post_cat_array = explode("#", $post_cat_str);
|
|
| 1110 | + if (is_array($post_cat_array)) {
|
|
| 1111 | + $post_cat_array = array_unique( $post_cat_array ); |
|
| 1112 | 1112 | |
| 1113 | 1113 | foreach ($post_cat_array as $post_cat_html) {
|
| 1114 | 1114 | |
| 1115 | - $post_cat_info = explode(":", $post_cat_html);
|
|
| 1116 | - $post_maincat_str = $post_cat_info[0]; |
|
| 1115 | + $post_cat_info = explode(":", $post_cat_html);
|
|
| 1116 | + $post_maincat_str = $post_cat_info[0]; |
|
| 1117 | 1117 | |
| 1118 | - if (!empty($post_maincat_str)) {
|
|
| 1119 | - $post_maincat_info = explode(",", $post_maincat_str);
|
|
| 1120 | - $post_maincat_id = $post_maincat_info[0]; |
|
| 1121 | - ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
| 1122 | - (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
| 1123 | - } |
|
| 1124 | - $post_sub_catid = ''; |
|
| 1125 | - if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
|
|
| 1126 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
| 1127 | - } |
|
| 1118 | + if (!empty($post_maincat_str)) {
|
|
| 1119 | + $post_maincat_info = explode(",", $post_maincat_str);
|
|
| 1120 | + $post_maincat_id = $post_maincat_info[0]; |
|
| 1121 | + ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
| 1122 | + (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
| 1123 | + } |
|
| 1124 | + $post_sub_catid = ''; |
|
| 1125 | + if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
|
|
| 1126 | + $post_sub_catid = (int)$post_cat_info[1]; |
|
| 1127 | + } |
|
| 1128 | 1128 | |
| 1129 | - geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
| 1129 | + geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
| 1130 | 1130 | |
| 1131 | - } |
|
| 1132 | - } else {
|
|
| 1131 | + } |
|
| 1132 | + } else {
|
|
| 1133 | 1133 | |
| 1134 | - $post_cat_info = explode(":", $post_cat_str);
|
|
| 1135 | - $post_maincat_str = $post_cat_info[0]; |
|
| 1134 | + $post_cat_info = explode(":", $post_cat_str);
|
|
| 1135 | + $post_maincat_str = $post_cat_info[0]; |
|
| 1136 | 1136 | |
| 1137 | - $post_sub_catid = ''; |
|
| 1137 | + $post_sub_catid = ''; |
|
| 1138 | 1138 | |
| 1139 | - if (!empty($post_maincat_str)) {
|
|
| 1140 | - $post_maincat_info = explode(",", $post_maincat_str);
|
|
| 1141 | - $post_maincat_id = $post_maincat_info[0]; |
|
| 1142 | - ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
| 1143 | - (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
| 1144 | - } |
|
| 1139 | + if (!empty($post_maincat_str)) {
|
|
| 1140 | + $post_maincat_info = explode(",", $post_maincat_str);
|
|
| 1141 | + $post_maincat_id = $post_maincat_info[0]; |
|
| 1142 | + ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
| 1143 | + (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
| 1144 | + } |
|
| 1145 | 1145 | |
| 1146 | - if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
|
|
| 1147 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
| 1148 | - } |
|
| 1146 | + if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
|
|
| 1147 | + $post_sub_catid = (int)$post_cat_info[1]; |
|
| 1148 | + } |
|
| 1149 | 1149 | |
| 1150 | - geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
| 1150 | + geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
| 1151 | 1151 | |
| 1152 | - } |
|
| 1153 | - } |
|
| 1152 | + } |
|
| 1153 | + } |
|
| 1154 | 1154 | } |
| 1155 | 1155 | |
| 1156 | 1156 | /** |
@@ -1164,35 +1164,35 @@ discard block |
||
| 1164 | 1164 | */ |
| 1165 | 1165 | function geodir_get_catlist($cat_taxonomy, $parrent = 0, $selected = false) |
| 1166 | 1166 | {
|
| 1167 | - global $exclude_cats; |
|
| 1167 | + global $exclude_cats; |
|
| 1168 | 1168 | |
| 1169 | - $cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
|
|
| 1169 | + $cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
|
|
| 1170 | 1170 | |
| 1171 | - if (!empty($cat_terms)) {
|
|
| 1172 | - $onchange = ''; |
|
| 1173 | - $onchange = ' onchange="show_subcatlist(this.value, this)" '; |
|
| 1171 | + if (!empty($cat_terms)) {
|
|
| 1172 | + $onchange = ''; |
|
| 1173 | + $onchange = ' onchange="show_subcatlist(this.value, this)" '; |
|
| 1174 | 1174 | |
| 1175 | - $option_selected = ''; |
|
| 1176 | - if (!$selected) |
|
| 1177 | - $option_slected = ' selected="selected" '; |
|
| 1175 | + $option_selected = ''; |
|
| 1176 | + if (!$selected) |
|
| 1177 | + $option_slected = ' selected="selected" '; |
|
| 1178 | 1178 | |
| 1179 | - echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
|
| 1179 | + echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
|
| 1180 | 1180 | |
| 1181 | - echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
|
|
| 1181 | + echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
|
|
| 1182 | 1182 | |
| 1183 | - foreach ($cat_terms as $cat_term) {
|
|
| 1184 | - $option_selected = ''; |
|
| 1185 | - if ($selected == $cat_term->term_id) |
|
| 1186 | - $option_selected = ' selected="selected" '; |
|
| 1183 | + foreach ($cat_terms as $cat_term) {
|
|
| 1184 | + $option_selected = ''; |
|
| 1185 | + if ($selected == $cat_term->term_id) |
|
| 1186 | + $option_selected = ' selected="selected" '; |
|
| 1187 | 1187 | |
| 1188 | - // Count child terms |
|
| 1189 | - $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
|
| 1190 | - $has_child = !empty( $child_terms ) ? 't' : 'f'; |
|
| 1188 | + // Count child terms |
|
| 1189 | + $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
|
| 1190 | + $has_child = !empty( $child_terms ) ? 't' : 'f'; |
|
| 1191 | 1191 | |
| 1192 | - echo '<option ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>'; |
|
| 1193 | - } |
|
| 1194 | - echo '</select>'; |
|
| 1195 | - } |
|
| 1192 | + echo '<option ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>'; |
|
| 1193 | + } |
|
| 1194 | + echo '</select>'; |
|
| 1195 | + } |
|
| 1196 | 1196 | } |
| 1197 | 1197 | |
| 1198 | 1198 | /** |
@@ -1208,28 +1208,28 @@ discard block |
||
| 1208 | 1208 | */ |
| 1209 | 1209 | function geodir_custom_update_messages($messages) |
| 1210 | 1210 | {
|
| 1211 | - global $post, $post_ID; |
|
| 1212 | - |
|
| 1213 | - $post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
|
|
| 1214 | - |
|
| 1215 | - foreach ($post_types as $post_type => $post_object) {
|
|
| 1216 | - |
|
| 1217 | - $messages[$post_type] = array( |
|
| 1218 | - 0 => '', // Unused. Messages start at index 1. |
|
| 1219 | - 1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
|
|
| 1220 | - 2 => __('Custom field updated.', 'geodirectory'),
|
|
| 1221 | - 3 => __('Custom field deleted.', 'geodirectory'),
|
|
| 1222 | - 4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
|
|
| 1223 | - 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
|
|
| 1224 | - 6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
|
|
| 1225 | - 7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
|
|
| 1226 | - 8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
|
|
| 1227 | - 9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
|
|
| 1228 | - 10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
|
|
| 1229 | - ); |
|
| 1230 | - } |
|
| 1231 | - |
|
| 1232 | - return $messages; |
|
| 1211 | + global $post, $post_ID; |
|
| 1212 | + |
|
| 1213 | + $post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
|
|
| 1214 | + |
|
| 1215 | + foreach ($post_types as $post_type => $post_object) {
|
|
| 1216 | + |
|
| 1217 | + $messages[$post_type] = array( |
|
| 1218 | + 0 => '', // Unused. Messages start at index 1. |
|
| 1219 | + 1 => sprintf(__('%s updated. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
|
|
| 1220 | + 2 => __('Custom field updated.', 'geodirectory'),
|
|
| 1221 | + 3 => __('Custom field deleted.', 'geodirectory'),
|
|
| 1222 | + 4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
|
|
| 1223 | + 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
|
|
| 1224 | + 6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
|
|
| 1225 | + 7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
|
|
| 1226 | + 8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
|
|
| 1227 | + 9 => sprintf(__('%s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, date_i18n(__('M j, Y @ G:i', 'geodirectory'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
|
|
| 1228 | + 10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
|
|
| 1229 | + ); |
|
| 1230 | + } |
|
| 1231 | + |
|
| 1232 | + return $messages; |
|
| 1233 | 1233 | } |
| 1234 | 1234 | |
| 1235 | 1235 | |
@@ -1244,183 +1244,183 @@ discard block |
||
| 1244 | 1244 | function geodir_register_defaults() |
| 1245 | 1245 | {
|
| 1246 | 1246 | |
| 1247 | - global $wpdb; |
|
| 1248 | - |
|
| 1249 | - $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
|
| 1250 | - |
|
| 1251 | - if (!$listing_slug = get_option('geodir_listing_prefix'))
|
|
| 1252 | - $listing_slug = 'places'; |
|
| 1253 | - |
|
| 1254 | - /** |
|
| 1255 | - * Taxonomies |
|
| 1256 | - **/ |
|
| 1257 | - //if ( ! taxonomy_exists('gd_place_tags') )
|
|
| 1258 | - {
|
|
| 1259 | - |
|
| 1260 | - $gd_placetags = array(); |
|
| 1261 | - $gd_placetags['object_type'] = 'gd_place'; |
|
| 1262 | - $gd_placetags['listing_slug'] = $listing_slug . '/tags'; |
|
| 1263 | - $gd_placetags['args'] = array( |
|
| 1264 | - 'public' => true, |
|
| 1265 | - 'hierarchical' => false, |
|
| 1266 | - 'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
|
|
| 1267 | - 'query_var' => true, |
|
| 1268 | - |
|
| 1269 | - 'labels' => array( |
|
| 1270 | - 'name' => __('Place Tags', 'geodirectory'),
|
|
| 1271 | - 'singular_name' => __('Place Tag', 'geodirectory'),
|
|
| 1272 | - 'search_items' => __('Search Place Tags', 'geodirectory'),
|
|
| 1273 | - 'popular_items' => __('Popular Place Tags', 'geodirectory'),
|
|
| 1274 | - 'all_items' => __('All Place Tags', 'geodirectory'),
|
|
| 1275 | - 'edit_item' => __('Edit Place Tag', 'geodirectory'),
|
|
| 1276 | - 'update_item' => __('Update Place Tag', 'geodirectory'),
|
|
| 1277 | - 'add_new_item' => __('Add New Place Tag', 'geodirectory'),
|
|
| 1278 | - 'new_item_name' => __('New Place Tag Name', 'geodirectory'),
|
|
| 1279 | - 'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
|
|
| 1280 | - 'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
|
|
| 1281 | - 'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
|
|
| 1282 | - ), |
|
| 1283 | - ); |
|
| 1284 | - |
|
| 1285 | - |
|
| 1286 | - $geodir_taxonomies = get_option('geodir_taxonomies');
|
|
| 1287 | - $geodir_taxonomies['gd_place_tags'] = $gd_placetags; |
|
| 1288 | - update_option('geodir_taxonomies', $geodir_taxonomies);
|
|
| 1289 | - |
|
| 1290 | - |
|
| 1291 | - // Update post types and delete tmp options |
|
| 1292 | - flush_rewrite_rules(); |
|
| 1293 | - |
|
| 1294 | - } |
|
| 1295 | - |
|
| 1296 | - //if ( ! taxonomy_exists('gd_placecategory') )
|
|
| 1297 | - {
|
|
| 1298 | - |
|
| 1299 | - $gd_placecategory = array(); |
|
| 1300 | - $gd_placecategory['object_type'] = 'gd_place'; |
|
| 1301 | - $gd_placecategory['listing_slug'] = $listing_slug; |
|
| 1302 | - $gd_placecategory['args'] = array( |
|
| 1303 | - 'public' => true, |
|
| 1304 | - 'hierarchical' => true, |
|
| 1305 | - 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
|
|
| 1306 | - 'query_var' => true, |
|
| 1307 | - 'labels' => array( |
|
| 1308 | - 'name' => __('Place Categories', 'geodirectory'),
|
|
| 1309 | - 'singular_name' => __('Place Category', 'geodirectory'),
|
|
| 1310 | - 'search_items' => __('Search Place Categories', 'geodirectory'),
|
|
| 1311 | - 'popular_items' => __('Popular Place Categories', 'geodirectory'),
|
|
| 1312 | - 'all_items' => __('All Place Categories', 'geodirectory'),
|
|
| 1313 | - 'edit_item' => __('Edit Place Category', 'geodirectory'),
|
|
| 1314 | - 'update_item' => __('Update Place Category', 'geodirectory'),
|
|
| 1315 | - 'add_new_item' => __('Add New Place Category', 'geodirectory'),
|
|
| 1316 | - 'new_item_name' => __('New Place Category', 'geodirectory'),
|
|
| 1317 | - 'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
|
|
| 1318 | - ), |
|
| 1319 | - ); |
|
| 1320 | - |
|
| 1321 | - |
|
| 1322 | - $geodir_taxonomies = get_option('geodir_taxonomies');
|
|
| 1323 | - $geodir_taxonomies['gd_placecategory'] = $gd_placecategory; |
|
| 1324 | - update_option('geodir_taxonomies', $geodir_taxonomies);
|
|
| 1325 | - |
|
| 1326 | - |
|
| 1327 | - flush_rewrite_rules(); |
|
| 1328 | - } |
|
| 1329 | - |
|
| 1330 | - /** |
|
| 1331 | - * Post Types |
|
| 1332 | - **/ |
|
| 1333 | - |
|
| 1334 | - //if ( ! post_type_exists('gd_place') )
|
|
| 1335 | - {
|
|
| 1336 | - |
|
| 1337 | - $labels = array( |
|
| 1338 | - 'name' => __('Places', 'geodirectory'),
|
|
| 1339 | - 'singular_name' => __('Place', 'geodirectory'),
|
|
| 1340 | - 'add_new' => __('Add New', 'geodirectory'),
|
|
| 1341 | - 'add_new_item' => __('Add New Place', 'geodirectory'),
|
|
| 1342 | - 'edit_item' => __('Edit Place', 'geodirectory'),
|
|
| 1343 | - 'new_item' => __('New Place', 'geodirectory'),
|
|
| 1344 | - 'view_item' => __('View Place', 'geodirectory'),
|
|
| 1345 | - 'search_items' => __('Search Places', 'geodirectory'),
|
|
| 1346 | - 'not_found' => __('No Place Found', 'geodirectory'),
|
|
| 1347 | - 'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
|
|
| 1348 | - |
|
| 1349 | - $place_default = array( |
|
| 1350 | - 'labels' => $labels, |
|
| 1351 | - 'can_export' => true, |
|
| 1352 | - 'capability_type' => 'post', |
|
| 1353 | - 'description' => 'Place post type.', |
|
| 1354 | - 'has_archive' => $listing_slug, |
|
| 1355 | - 'hierarchical' => false, |
|
| 1356 | - 'map_meta_cap' => true, |
|
| 1357 | - 'menu_icon' => $menu_icon, |
|
| 1358 | - 'public' => true, |
|
| 1359 | - 'query_var' => true, |
|
| 1360 | - 'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
|
|
| 1361 | - 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
|
|
| 1362 | - 'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
|
|
| 1363 | - |
|
| 1364 | - //Update custom post types |
|
| 1365 | - $geodir_post_types = get_option('geodir_post_types');
|
|
| 1366 | - $geodir_post_types['gd_place'] = $place_default; |
|
| 1367 | - update_option('geodir_post_types', $geodir_post_types);
|
|
| 1368 | - |
|
| 1369 | - // Update post types and delete tmp options |
|
| 1370 | - flush_rewrite_rules(); |
|
| 1371 | - } |
|
| 1372 | - |
|
| 1373 | - |
|
| 1374 | - geodir_register_taxonomies(); |
|
| 1375 | - geodir_register_post_types(); |
|
| 1376 | - |
|
| 1377 | - //die; |
|
| 1247 | + global $wpdb; |
|
| 1248 | + |
|
| 1249 | + $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
|
| 1250 | + |
|
| 1251 | + if (!$listing_slug = get_option('geodir_listing_prefix'))
|
|
| 1252 | + $listing_slug = 'places'; |
|
| 1253 | + |
|
| 1254 | + /** |
|
| 1255 | + * Taxonomies |
|
| 1256 | + **/ |
|
| 1257 | + //if ( ! taxonomy_exists('gd_place_tags') )
|
|
| 1258 | + {
|
|
| 1259 | + |
|
| 1260 | + $gd_placetags = array(); |
|
| 1261 | + $gd_placetags['object_type'] = 'gd_place'; |
|
| 1262 | + $gd_placetags['listing_slug'] = $listing_slug . '/tags'; |
|
| 1263 | + $gd_placetags['args'] = array( |
|
| 1264 | + 'public' => true, |
|
| 1265 | + 'hierarchical' => false, |
|
| 1266 | + 'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
|
|
| 1267 | + 'query_var' => true, |
|
| 1268 | + |
|
| 1269 | + 'labels' => array( |
|
| 1270 | + 'name' => __('Place Tags', 'geodirectory'),
|
|
| 1271 | + 'singular_name' => __('Place Tag', 'geodirectory'),
|
|
| 1272 | + 'search_items' => __('Search Place Tags', 'geodirectory'),
|
|
| 1273 | + 'popular_items' => __('Popular Place Tags', 'geodirectory'),
|
|
| 1274 | + 'all_items' => __('All Place Tags', 'geodirectory'),
|
|
| 1275 | + 'edit_item' => __('Edit Place Tag', 'geodirectory'),
|
|
| 1276 | + 'update_item' => __('Update Place Tag', 'geodirectory'),
|
|
| 1277 | + 'add_new_item' => __('Add New Place Tag', 'geodirectory'),
|
|
| 1278 | + 'new_item_name' => __('New Place Tag Name', 'geodirectory'),
|
|
| 1279 | + 'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
|
|
| 1280 | + 'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
|
|
| 1281 | + 'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
|
|
| 1282 | + ), |
|
| 1283 | + ); |
|
| 1284 | + |
|
| 1285 | + |
|
| 1286 | + $geodir_taxonomies = get_option('geodir_taxonomies');
|
|
| 1287 | + $geodir_taxonomies['gd_place_tags'] = $gd_placetags; |
|
| 1288 | + update_option('geodir_taxonomies', $geodir_taxonomies);
|
|
| 1289 | + |
|
| 1290 | + |
|
| 1291 | + // Update post types and delete tmp options |
|
| 1292 | + flush_rewrite_rules(); |
|
| 1293 | + |
|
| 1294 | + } |
|
| 1295 | + |
|
| 1296 | + //if ( ! taxonomy_exists('gd_placecategory') )
|
|
| 1297 | + {
|
|
| 1298 | + |
|
| 1299 | + $gd_placecategory = array(); |
|
| 1300 | + $gd_placecategory['object_type'] = 'gd_place'; |
|
| 1301 | + $gd_placecategory['listing_slug'] = $listing_slug; |
|
| 1302 | + $gd_placecategory['args'] = array( |
|
| 1303 | + 'public' => true, |
|
| 1304 | + 'hierarchical' => true, |
|
| 1305 | + 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
|
|
| 1306 | + 'query_var' => true, |
|
| 1307 | + 'labels' => array( |
|
| 1308 | + 'name' => __('Place Categories', 'geodirectory'),
|
|
| 1309 | + 'singular_name' => __('Place Category', 'geodirectory'),
|
|
| 1310 | + 'search_items' => __('Search Place Categories', 'geodirectory'),
|
|
| 1311 | + 'popular_items' => __('Popular Place Categories', 'geodirectory'),
|
|
| 1312 | + 'all_items' => __('All Place Categories', 'geodirectory'),
|
|
| 1313 | + 'edit_item' => __('Edit Place Category', 'geodirectory'),
|
|
| 1314 | + 'update_item' => __('Update Place Category', 'geodirectory'),
|
|
| 1315 | + 'add_new_item' => __('Add New Place Category', 'geodirectory'),
|
|
| 1316 | + 'new_item_name' => __('New Place Category', 'geodirectory'),
|
|
| 1317 | + 'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
|
|
| 1318 | + ), |
|
| 1319 | + ); |
|
| 1320 | + |
|
| 1321 | + |
|
| 1322 | + $geodir_taxonomies = get_option('geodir_taxonomies');
|
|
| 1323 | + $geodir_taxonomies['gd_placecategory'] = $gd_placecategory; |
|
| 1324 | + update_option('geodir_taxonomies', $geodir_taxonomies);
|
|
| 1325 | + |
|
| 1326 | + |
|
| 1327 | + flush_rewrite_rules(); |
|
| 1328 | + } |
|
| 1329 | + |
|
| 1330 | + /** |
|
| 1331 | + * Post Types |
|
| 1332 | + **/ |
|
| 1333 | + |
|
| 1334 | + //if ( ! post_type_exists('gd_place') )
|
|
| 1335 | + {
|
|
| 1336 | + |
|
| 1337 | + $labels = array( |
|
| 1338 | + 'name' => __('Places', 'geodirectory'),
|
|
| 1339 | + 'singular_name' => __('Place', 'geodirectory'),
|
|
| 1340 | + 'add_new' => __('Add New', 'geodirectory'),
|
|
| 1341 | + 'add_new_item' => __('Add New Place', 'geodirectory'),
|
|
| 1342 | + 'edit_item' => __('Edit Place', 'geodirectory'),
|
|
| 1343 | + 'new_item' => __('New Place', 'geodirectory'),
|
|
| 1344 | + 'view_item' => __('View Place', 'geodirectory'),
|
|
| 1345 | + 'search_items' => __('Search Places', 'geodirectory'),
|
|
| 1346 | + 'not_found' => __('No Place Found', 'geodirectory'),
|
|
| 1347 | + 'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
|
|
| 1348 | + |
|
| 1349 | + $place_default = array( |
|
| 1350 | + 'labels' => $labels, |
|
| 1351 | + 'can_export' => true, |
|
| 1352 | + 'capability_type' => 'post', |
|
| 1353 | + 'description' => 'Place post type.', |
|
| 1354 | + 'has_archive' => $listing_slug, |
|
| 1355 | + 'hierarchical' => false, |
|
| 1356 | + 'map_meta_cap' => true, |
|
| 1357 | + 'menu_icon' => $menu_icon, |
|
| 1358 | + 'public' => true, |
|
| 1359 | + 'query_var' => true, |
|
| 1360 | + 'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
|
|
| 1361 | + 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
|
|
| 1362 | + 'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
|
|
| 1363 | + |
|
| 1364 | + //Update custom post types |
|
| 1365 | + $geodir_post_types = get_option('geodir_post_types');
|
|
| 1366 | + $geodir_post_types['gd_place'] = $place_default; |
|
| 1367 | + update_option('geodir_post_types', $geodir_post_types);
|
|
| 1368 | + |
|
| 1369 | + // Update post types and delete tmp options |
|
| 1370 | + flush_rewrite_rules(); |
|
| 1371 | + } |
|
| 1372 | + |
|
| 1373 | + |
|
| 1374 | + geodir_register_taxonomies(); |
|
| 1375 | + geodir_register_post_types(); |
|
| 1376 | + |
|
| 1377 | + //die; |
|
| 1378 | 1378 | |
| 1379 | 1379 | } |
| 1380 | 1380 | |
| 1381 | 1381 | $gd_wpml_get_languages = ""; |
| 1382 | 1382 | function gd_wpml_get_lang_from_url($url){
|
| 1383 | 1383 | |
| 1384 | - global $gd_wpml_get_languages; |
|
| 1385 | - if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
|
|
| 1384 | + global $gd_wpml_get_languages; |
|
| 1385 | + if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
|
|
| 1386 | 1386 | |
| 1387 | 1387 | |
| 1388 | - // |
|
| 1389 | - $url = str_replace(array("http://","https://"),"",$url);
|
|
| 1388 | + // |
|
| 1389 | + $url = str_replace(array("http://","https://"),"",$url);
|
|
| 1390 | 1390 | |
| 1391 | - // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
|
|
| 1392 | - $site_url = str_replace(array("http://","https://"),"",site_url());
|
|
| 1391 | + // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
|
|
| 1392 | + $site_url = str_replace(array("http://","https://"),"",site_url());
|
|
| 1393 | 1393 | |
| 1394 | - $url = str_replace($site_url,"",$url); |
|
| 1394 | + $url = str_replace($site_url,"",$url); |
|
| 1395 | 1395 | |
| 1396 | 1396 | |
| 1397 | - $segments = explode('/', trim($url, '/'));
|
|
| 1397 | + $segments = explode('/', trim($url, '/'));
|
|
| 1398 | 1398 | |
| 1399 | - //print_r( $segments); |
|
| 1400 | - if($gd_wpml_get_languages){
|
|
| 1401 | - $langs = $gd_wpml_get_languages; |
|
| 1402 | - }else{
|
|
| 1403 | - global $sitepress; |
|
| 1404 | - $gd_wpml_get_languages = $sitepress->get_active_languages(); |
|
| 1405 | - } |
|
| 1399 | + //print_r( $segments); |
|
| 1400 | + if($gd_wpml_get_languages){
|
|
| 1401 | + $langs = $gd_wpml_get_languages; |
|
| 1402 | + }else{
|
|
| 1403 | + global $sitepress; |
|
| 1404 | + $gd_wpml_get_languages = $sitepress->get_active_languages(); |
|
| 1405 | + } |
|
| 1406 | 1406 | |
| 1407 | - if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
|
|
| 1408 | - return $segments[0]; |
|
| 1409 | - } |
|
| 1407 | + if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
|
|
| 1408 | + return $segments[0]; |
|
| 1409 | + } |
|
| 1410 | 1410 | |
| 1411 | - return false; |
|
| 1411 | + return false; |
|
| 1412 | 1412 | |
| 1413 | 1413 | |
| 1414 | 1414 | } |
| 1415 | 1415 | |
| 1416 | 1416 | function gd_wpml_slug_translation_turned_on($post_type) {
|
| 1417 | 1417 | |
| 1418 | - global $sitepress; |
|
| 1419 | - $settings = $sitepress->get_settings(); |
|
| 1420 | - return isset($settings['posts_slug_translation']['types'][$post_type]) |
|
| 1421 | - && $settings['posts_slug_translation']['types'][$post_type] |
|
| 1422 | - && isset($settings['posts_slug_translation']['on']) |
|
| 1423 | - && $settings['posts_slug_translation']['on']; |
|
| 1418 | + global $sitepress; |
|
| 1419 | + $settings = $sitepress->get_settings(); |
|
| 1420 | + return isset($settings['posts_slug_translation']['types'][$post_type]) |
|
| 1421 | + && $settings['posts_slug_translation']['types'][$post_type] |
|
| 1422 | + && isset($settings['posts_slug_translation']['on']) |
|
| 1423 | + && $settings['posts_slug_translation']['on']; |
|
| 1424 | 1424 | } |
| 1425 | 1425 | |
| 1426 | 1426 | |
@@ -1445,150 +1445,150 @@ discard block |
||
| 1445 | 1445 | */ |
| 1446 | 1446 | function geodir_listing_permalink_structure($post_link, $post_obj, $leavename, $sample) |
| 1447 | 1447 | {
|
| 1448 | - //echo $post_link."<br />".$sample ; |
|
| 1448 | + //echo $post_link."<br />".$sample ; |
|
| 1449 | 1449 | |
| 1450 | 1450 | |
| 1451 | - global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache; |
|
| 1452 | - if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
|
|
| 1453 | - } elseif (isset($post_obj->post_status) && $post_obj->post_status == 'auto-draft') {
|
|
| 1454 | - return $post_link; |
|
| 1455 | - } else {
|
|
| 1456 | - $orig_post = $post; |
|
| 1457 | - $post = $post_obj; |
|
| 1458 | - } |
|
| 1451 | + global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache; |
|
| 1452 | + if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
|
|
| 1453 | + } elseif (isset($post_obj->post_status) && $post_obj->post_status == 'auto-draft') {
|
|
| 1454 | + return $post_link; |
|
| 1455 | + } else {
|
|
| 1456 | + $orig_post = $post; |
|
| 1457 | + $post = $post_obj; |
|
| 1458 | + } |
|
| 1459 | 1459 | |
| 1460 | - if (in_array($post->post_type, geodir_get_posttypes())) {
|
|
| 1460 | + if (in_array($post->post_type, geodir_get_posttypes())) {
|
|
| 1461 | 1461 | |
| 1462 | 1462 | |
| 1463 | - $post_types = get_option('geodir_post_types');
|
|
| 1464 | - $slug = $post_types[$post->post_type]['rewrite']['slug']; |
|
| 1463 | + $post_types = get_option('geodir_post_types');
|
|
| 1464 | + $slug = $post_types[$post->post_type]['rewrite']['slug']; |
|
| 1465 | 1465 | |
| 1466 | - // Alter the CPT slug if WPML is set to do so |
|
| 1467 | - if(function_exists('icl_object_id')){
|
|
| 1468 | - if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
|
|
| 1466 | + // Alter the CPT slug if WPML is set to do so |
|
| 1467 | + if(function_exists('icl_object_id')){
|
|
| 1468 | + if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
|
|
| 1469 | 1469 | |
| 1470 | - $org_slug = $slug; |
|
| 1471 | - $slug = apply_filters( 'wpml_translate_single_string', |
|
| 1472 | - $slug, |
|
| 1473 | - 'WordPress', |
|
| 1474 | - 'URL slug: ' . $slug, |
|
| 1475 | - $language_code); |
|
| 1470 | + $org_slug = $slug; |
|
| 1471 | + $slug = apply_filters( 'wpml_translate_single_string', |
|
| 1472 | + $slug, |
|
| 1473 | + 'WordPress', |
|
| 1474 | + 'URL slug: ' . $slug, |
|
| 1475 | + $language_code); |
|
| 1476 | 1476 | |
| 1477 | - if(!$slug){$slug = $org_slug;}
|
|
| 1477 | + if(!$slug){$slug = $org_slug;}
|
|
| 1478 | 1478 | |
| 1479 | - } |
|
| 1480 | - } |
|
| 1479 | + } |
|
| 1480 | + } |
|
| 1481 | 1481 | |
| 1482 | - if (function_exists('geodir_location_geo_home_link')) {
|
|
| 1483 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
|
|
| 1484 | - } |
|
| 1482 | + if (function_exists('geodir_location_geo_home_link')) {
|
|
| 1483 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
|
|
| 1484 | + } |
|
| 1485 | 1485 | |
| 1486 | - // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz. |
|
| 1487 | - $site_url = trailingslashit(get_bloginfo('url'));
|
|
| 1486 | + // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz. |
|
| 1487 | + $site_url = trailingslashit(get_bloginfo('url'));
|
|
| 1488 | 1488 | |
| 1489 | - if (function_exists('geodir_location_geo_home_link')) {
|
|
| 1490 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
|
|
| 1491 | - } |
|
| 1492 | - |
|
| 1493 | - $fix_url = strpos($post_link, $site_url) === 0 ? true : false; |
|
| 1494 | - if ($fix_url) {
|
|
| 1495 | - $post_link = str_replace($site_url, '', $post_link); |
|
| 1496 | - } |
|
| 1497 | - |
|
| 1498 | - $post_link = trailingslashit( |
|
| 1499 | - preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
|
| 1500 | - ); |
|
| 1501 | - |
|
| 1502 | - if ($fix_url) {
|
|
| 1503 | - $post_link = $site_url . $post_link; |
|
| 1504 | - } |
|
| 1505 | - |
|
| 1506 | - if (isset($comment_post_cache[$post->ID])) {
|
|
| 1507 | - $post = $comment_post_cache[$post->ID]; |
|
| 1508 | - } |
|
| 1509 | - if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
|
|
| 1510 | - $post_id = $post->ID; |
|
| 1511 | - if (isset($orig_post)) {
|
|
| 1512 | - $post = $orig_post; |
|
| 1513 | - } |
|
| 1514 | - return $gd_permalink_cache[$post_id]; |
|
| 1515 | - } |
|
| 1489 | + if (function_exists('geodir_location_geo_home_link')) {
|
|
| 1490 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
|
|
| 1491 | + } |
|
| 1516 | 1492 | |
| 1517 | - if (!isset($post->post_locations)) {
|
|
| 1518 | - $post_type = $post->post_type; |
|
| 1519 | - $ID = $post->ID; |
|
| 1520 | - $post2 = $wpdb->get_row( |
|
| 1521 | - $wpdb->prepare( |
|
| 1522 | - "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
| 1523 | - array($post->ID) |
|
| 1524 | - ) |
|
| 1525 | - ); |
|
| 1493 | + $fix_url = strpos($post_link, $site_url) === 0 ? true : false; |
|
| 1494 | + if ($fix_url) {
|
|
| 1495 | + $post_link = str_replace($site_url, '', $post_link); |
|
| 1496 | + } |
|
| 1526 | 1497 | |
| 1527 | - $post = (object)array_merge((array)$post, (array)$post2); |
|
| 1498 | + $post_link = trailingslashit( |
|
| 1499 | + preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
|
| 1500 | + ); |
|
| 1528 | 1501 | |
| 1529 | - $comment_post_cache[$post->ID] = $post; |
|
| 1530 | - } |
|
| 1502 | + if ($fix_url) {
|
|
| 1503 | + $post_link = $site_url . $post_link; |
|
| 1504 | + } |
|
| 1531 | 1505 | |
| 1506 | + if (isset($comment_post_cache[$post->ID])) {
|
|
| 1507 | + $post = $comment_post_cache[$post->ID]; |
|
| 1508 | + } |
|
| 1509 | + if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
|
|
| 1510 | + $post_id = $post->ID; |
|
| 1511 | + if (isset($orig_post)) {
|
|
| 1512 | + $post = $orig_post; |
|
| 1513 | + } |
|
| 1514 | + return $gd_permalink_cache[$post_id]; |
|
| 1515 | + } |
|
| 1532 | 1516 | |
| 1517 | + if (!isset($post->post_locations)) {
|
|
| 1518 | + $post_type = $post->post_type; |
|
| 1519 | + $ID = $post->ID; |
|
| 1520 | + $post2 = $wpdb->get_row( |
|
| 1521 | + $wpdb->prepare( |
|
| 1522 | + "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
| 1523 | + array($post->ID) |
|
| 1524 | + ) |
|
| 1525 | + ); |
|
| 1533 | 1526 | |
| 1534 | - if (false !== strpos($post_link, '%gd_taxonomy%')) {
|
|
| 1527 | + $post = (object)array_merge((array)$post, (array)$post2); |
|
| 1535 | 1528 | |
| 1536 | - if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
|
|
| 1537 | - $location_request = ''; |
|
| 1529 | + $comment_post_cache[$post->ID] = $post; |
|
| 1530 | + } |
|
| 1538 | 1531 | |
| 1539 | 1532 | |
| 1540 | - if (!empty($post->post_locations)) {
|
|
| 1541 | - $geodir_arr_locations = explode(',', $post->post_locations);
|
|
| 1542 | - if (count($geodir_arr_locations) == 3) {
|
|
| 1543 | - $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
|
|
| 1544 | - $post->city_slug = str_replace(']', '', $post->city_slug);
|
|
| 1545 | - $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
|
|
| 1546 | - $post->region_slug = str_replace(']', '', $post->region_slug);
|
|
| 1547 | - $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
|
|
| 1548 | - $post->country_slug = str_replace(']', '', $post->country_slug);
|
|
| 1549 | 1533 | |
| 1550 | - $post_location = (object)array('country_slug' => $post->country_slug,
|
|
| 1551 | - 'region_slug' => $post->region_slug, |
|
| 1552 | - 'city_slug' => $post->city_slug |
|
| 1553 | - ); |
|
| 1534 | + if (false !== strpos($post_link, '%gd_taxonomy%')) {
|
|
| 1554 | 1535 | |
| 1555 | - } else |
|
| 1556 | - $post_location = geodir_get_location(); |
|
| 1536 | + if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
|
|
| 1537 | + $location_request = ''; |
|
| 1557 | 1538 | |
| 1558 | 1539 | |
| 1559 | - } else {
|
|
| 1540 | + if (!empty($post->post_locations)) {
|
|
| 1541 | + $geodir_arr_locations = explode(',', $post->post_locations);
|
|
| 1542 | + if (count($geodir_arr_locations) == 3) {
|
|
| 1543 | + $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
|
|
| 1544 | + $post->city_slug = str_replace(']', '', $post->city_slug);
|
|
| 1545 | + $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
|
|
| 1546 | + $post->region_slug = str_replace(']', '', $post->region_slug);
|
|
| 1547 | + $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
|
|
| 1548 | + $post->country_slug = str_replace(']', '', $post->country_slug);
|
|
| 1560 | 1549 | |
| 1561 | - $post_location_sql = $wpdb->get_results( |
|
| 1562 | - $wpdb->prepare( |
|
| 1563 | - "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
| 1564 | - array($post->ID) |
|
| 1565 | - ) |
|
| 1566 | - ); |
|
| 1567 | - |
|
| 1568 | - if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
|
|
| 1569 | - |
|
| 1570 | - $geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
|
|
| 1571 | - if (count($geodir_arr_locations) == 3) {
|
|
| 1572 | - $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
|
|
| 1573 | - $post->city_slug = str_replace(']', '', $post->city_slug);
|
|
| 1574 | - $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
|
|
| 1575 | - $post->region_slug = str_replace(']', '', $post->region_slug);
|
|
| 1576 | - $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
|
|
| 1577 | - $post->country_slug = str_replace(']', '', $post->country_slug);
|
|
| 1578 | - |
|
| 1579 | - $post_location = (object)array('country_slug' => $post->country_slug,
|
|
| 1580 | - 'region_slug' => $post->region_slug, |
|
| 1581 | - 'city_slug' => $post->city_slug |
|
| 1582 | - ); |
|
| 1550 | + $post_location = (object)array('country_slug' => $post->country_slug,
|
|
| 1551 | + 'region_slug' => $post->region_slug, |
|
| 1552 | + 'city_slug' => $post->city_slug |
|
| 1553 | + ); |
|
| 1583 | 1554 | |
| 1584 | - } |
|
| 1585 | - } else |
|
| 1586 | - $post_location = geodir_get_location(); |
|
| 1587 | - } |
|
| 1555 | + } else |
|
| 1556 | + $post_location = geodir_get_location(); |
|
| 1588 | 1557 | |
| 1589 | 1558 | |
| 1590 | - if (!empty($post_location)) {
|
|
| 1591 | - $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : ''; |
|
| 1559 | + } else {
|
|
| 1560 | + |
|
| 1561 | + $post_location_sql = $wpdb->get_results( |
|
| 1562 | + $wpdb->prepare( |
|
| 1563 | + "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
| 1564 | + array($post->ID) |
|
| 1565 | + ) |
|
| 1566 | + ); |
|
| 1567 | + |
|
| 1568 | + if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
|
|
| 1569 | + |
|
| 1570 | + $geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
|
|
| 1571 | + if (count($geodir_arr_locations) == 3) {
|
|
| 1572 | + $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
|
|
| 1573 | + $post->city_slug = str_replace(']', '', $post->city_slug);
|
|
| 1574 | + $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
|
|
| 1575 | + $post->region_slug = str_replace(']', '', $post->region_slug);
|
|
| 1576 | + $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
|
|
| 1577 | + $post->country_slug = str_replace(']', '', $post->country_slug);
|
|
| 1578 | + |
|
| 1579 | + $post_location = (object)array('country_slug' => $post->country_slug,
|
|
| 1580 | + 'region_slug' => $post->region_slug, |
|
| 1581 | + 'city_slug' => $post->city_slug |
|
| 1582 | + ); |
|
| 1583 | + |
|
| 1584 | + } |
|
| 1585 | + } else |
|
| 1586 | + $post_location = geodir_get_location(); |
|
| 1587 | + } |
|
| 1588 | + |
|
| 1589 | + |
|
| 1590 | + if (!empty($post_location)) {
|
|
| 1591 | + $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : ''; |
|
| 1592 | 1592 | $region_slug = isset($post_location->region_slug) ? $post_location->region_slug : ''; |
| 1593 | 1593 | $city_slug = isset($post_location->city_slug) ? $post_location->city_slug : ''; |
| 1594 | 1594 | |
@@ -1606,78 +1606,78 @@ discard block |
||
| 1606 | 1606 | $location_slug[] = $city_slug; |
| 1607 | 1607 | |
| 1608 | 1608 | $location_request .= implode('/', $location_slug) . '/';
|
| 1609 | - } |
|
| 1610 | - } |
|
| 1609 | + } |
|
| 1610 | + } |
|
| 1611 | 1611 | |
| 1612 | - if (get_option('geodir_add_categories_url')) {
|
|
| 1612 | + if (get_option('geodir_add_categories_url')) {
|
|
| 1613 | 1613 | |
| 1614 | - $term_request = ''; |
|
| 1615 | - $taxonomies = geodir_get_taxonomies($post->post_type); |
|
| 1614 | + $term_request = ''; |
|
| 1615 | + $taxonomies = geodir_get_taxonomies($post->post_type); |
|
| 1616 | 1616 | |
| 1617 | - $taxonomies = end($taxonomies); |
|
| 1617 | + $taxonomies = end($taxonomies); |
|
| 1618 | 1618 | |
| 1619 | - if (!empty($post->default_category)) {
|
|
| 1620 | - $post_terms = $post->default_category; |
|
| 1621 | - } else {
|
|
| 1622 | - $post_terms = ''; |
|
| 1619 | + if (!empty($post->default_category)) {
|
|
| 1620 | + $post_terms = $post->default_category; |
|
| 1621 | + } else {
|
|
| 1622 | + $post_terms = ''; |
|
| 1623 | 1623 | |
| 1624 | - if (isset($post->{$taxonomies})) {
|
|
| 1625 | - $post_terms = explode(",", trim($post->{$taxonomies}, ","));
|
|
| 1626 | - $post_terms = $post_terms[0]; |
|
| 1627 | - } |
|
| 1624 | + if (isset($post->{$taxonomies})) {
|
|
| 1625 | + $post_terms = explode(",", trim($post->{$taxonomies}, ","));
|
|
| 1626 | + $post_terms = $post_terms[0]; |
|
| 1627 | + } |
|
| 1628 | 1628 | |
| 1629 | - if (!$post_terms) |
|
| 1630 | - $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
| 1629 | + if (!$post_terms) |
|
| 1630 | + $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
| 1631 | 1631 | |
| 1632 | - if (!$post_terms) {
|
|
| 1633 | - $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true); |
|
| 1632 | + if (!$post_terms) {
|
|
| 1633 | + $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true); |
|
| 1634 | 1634 | |
| 1635 | - if ($post_terms) {
|
|
| 1636 | - $post_terms = explode(",", trim($post_terms, ","));
|
|
| 1637 | - $post_terms = $post_terms[0]; |
|
| 1638 | - } |
|
| 1639 | - } |
|
| 1640 | - } |
|
| 1635 | + if ($post_terms) {
|
|
| 1636 | + $post_terms = explode(",", trim($post_terms, ","));
|
|
| 1637 | + $post_terms = $post_terms[0]; |
|
| 1638 | + } |
|
| 1639 | + } |
|
| 1640 | + } |
|
| 1641 | 1641 | |
| 1642 | - $term = get_term_by('id', $post_terms, $taxonomies);
|
|
| 1642 | + $term = get_term_by('id', $post_terms, $taxonomies);
|
|
| 1643 | 1643 | |
| 1644 | - if (!empty($term)) |
|
| 1645 | - $term_request = $term->slug; |
|
| 1646 | - //$term_request = $term->slug.'/'; |
|
| 1647 | - } |
|
| 1644 | + if (!empty($term)) |
|
| 1645 | + $term_request = $term->slug; |
|
| 1646 | + //$term_request = $term->slug.'/'; |
|
| 1647 | + } |
|
| 1648 | 1648 | |
| 1649 | - $request_term = ''; |
|
| 1650 | - $listingurl_separator = ''; |
|
| 1651 | - //$detailurl_separator = get_option('geodir_detailurl_separator');
|
|
| 1652 | - $detailurl_separator = ''; |
|
| 1653 | - if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
|
|
| 1654 | - $request_term = $location_request; |
|
| 1655 | - //$listingurl_separator = get_option('geodir_listingurl_separator');
|
|
| 1656 | - //$request_term .= $listingurl_separator.'/'.$term_request; |
|
| 1657 | - $request_term .= $term_request; |
|
| 1649 | + $request_term = ''; |
|
| 1650 | + $listingurl_separator = ''; |
|
| 1651 | + //$detailurl_separator = get_option('geodir_detailurl_separator');
|
|
| 1652 | + $detailurl_separator = ''; |
|
| 1653 | + if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
|
|
| 1654 | + $request_term = $location_request; |
|
| 1655 | + //$listingurl_separator = get_option('geodir_listingurl_separator');
|
|
| 1656 | + //$request_term .= $listingurl_separator.'/'.$term_request; |
|
| 1657 | + $request_term .= $term_request; |
|
| 1658 | 1658 | |
| 1659 | - } else {
|
|
| 1660 | - if (isset($location_request) && $location_request != '') $request_term = $location_request; |
|
| 1659 | + } else {
|
|
| 1660 | + if (isset($location_request) && $location_request != '') $request_term = $location_request; |
|
| 1661 | 1661 | |
| 1662 | - if (isset($term_request) && $term_request != '') $request_term .= $term_request; |
|
| 1663 | - } |
|
| 1664 | - $request_term = trim($request_term, '/'); |
|
| 1665 | - if (!empty($request_term)) |
|
| 1666 | - $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
|
|
| 1667 | - else |
|
| 1668 | - $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
|
|
| 1669 | - //echo $post_link ; |
|
| 1670 | - } |
|
| 1671 | - // temp cache the permalink |
|
| 1672 | - if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
|
|
| 1673 | - $gd_permalink_cache[$post->ID] = $post_link; |
|
| 1674 | - } |
|
| 1675 | - } |
|
| 1676 | - if (isset($orig_post)) {
|
|
| 1677 | - $post = $orig_post; |
|
| 1678 | - } |
|
| 1679 | - |
|
| 1680 | - return $post_link; |
|
| 1662 | + if (isset($term_request) && $term_request != '') $request_term .= $term_request; |
|
| 1663 | + } |
|
| 1664 | + $request_term = trim($request_term, '/'); |
|
| 1665 | + if (!empty($request_term)) |
|
| 1666 | + $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
|
|
| 1667 | + else |
|
| 1668 | + $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
|
|
| 1669 | + //echo $post_link ; |
|
| 1670 | + } |
|
| 1671 | + // temp cache the permalink |
|
| 1672 | + if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
|
|
| 1673 | + $gd_permalink_cache[$post->ID] = $post_link; |
|
| 1674 | + } |
|
| 1675 | + } |
|
| 1676 | + if (isset($orig_post)) {
|
|
| 1677 | + $post = $orig_post; |
|
| 1678 | + } |
|
| 1679 | + |
|
| 1680 | + return $post_link; |
|
| 1681 | 1681 | } |
| 1682 | 1682 | |
| 1683 | 1683 | /** |
@@ -1693,99 +1693,99 @@ discard block |
||
| 1693 | 1693 | * @return string The term link. |
| 1694 | 1694 | */ |
| 1695 | 1695 | function geodir_term_link($termlink, $term, $taxonomy) {
|
| 1696 | - $geodir_taxonomies = geodir_get_taxonomies('', true);
|
|
| 1696 | + $geodir_taxonomies = geodir_get_taxonomies('', true);
|
|
| 1697 | 1697 | |
| 1698 | - if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
|
|
| 1699 | - global $geodir_add_location_url, $gd_session; |
|
| 1700 | - $include_location = false; |
|
| 1701 | - $request_term = array(); |
|
| 1702 | - $add_location_url = get_option('geodir_add_location_url');
|
|
| 1703 | - $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
|
|
| 1698 | + if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
|
|
| 1699 | + global $geodir_add_location_url, $gd_session; |
|
| 1700 | + $include_location = false; |
|
| 1701 | + $request_term = array(); |
|
| 1702 | + $add_location_url = get_option('geodir_add_location_url');
|
|
| 1703 | + $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
|
|
| 1704 | 1704 | |
| 1705 | - $listing_slug = geodir_get_listing_slug($taxonomy); |
|
| 1705 | + $listing_slug = geodir_get_listing_slug($taxonomy); |
|
| 1706 | 1706 | |
| 1707 | - if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
|
|
| 1708 | - if ($geodir_add_location_url && $add_location_url) {
|
|
| 1709 | - $include_location = true; |
|
| 1710 | - } |
|
| 1711 | - } elseif ($add_location_url && $gd_session->get('gd_multi_location') == 1) {
|
|
| 1712 | - $include_location = true; |
|
| 1713 | - } elseif ($add_location_url && $location_manager && geodir_is_page('detail')) {
|
|
| 1714 | - $include_location = true; |
|
| 1715 | - } |
|
| 1716 | - |
|
| 1717 | - if ($include_location) {
|
|
| 1718 | - global $post; |
|
| 1707 | + if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
|
|
| 1708 | + if ($geodir_add_location_url && $add_location_url) {
|
|
| 1709 | + $include_location = true; |
|
| 1710 | + } |
|
| 1711 | + } elseif ($add_location_url && $gd_session->get('gd_multi_location') == 1) {
|
|
| 1712 | + $include_location = true; |
|
| 1713 | + } elseif ($add_location_url && $location_manager && geodir_is_page('detail')) {
|
|
| 1714 | + $include_location = true; |
|
| 1715 | + } |
|
| 1716 | + |
|
| 1717 | + if ($include_location) {
|
|
| 1718 | + global $post; |
|
| 1719 | 1719 | |
| 1720 | - $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
|
|
| 1720 | + $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
|
|
| 1721 | 1721 | |
| 1722 | - if (geodir_is_page('detail') && isset($post->country_slug)) {
|
|
| 1723 | - $location_terms = array( |
|
| 1724 | - 'gd_country' => $post->country_slug, |
|
| 1725 | - 'gd_region' => $post->region_slug, |
|
| 1726 | - 'gd_city' => $post->city_slug |
|
| 1727 | - ); |
|
| 1722 | + if (geodir_is_page('detail') && isset($post->country_slug)) {
|
|
| 1723 | + $location_terms = array( |
|
| 1724 | + 'gd_country' => $post->country_slug, |
|
| 1725 | + 'gd_region' => $post->region_slug, |
|
| 1726 | + 'gd_city' => $post->city_slug |
|
| 1727 | + ); |
|
| 1728 | 1728 | |
| 1729 | - if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
|
|
| 1730 | - $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood; |
|
| 1731 | - } |
|
| 1732 | - } else {
|
|
| 1733 | - $location_terms = geodir_get_current_location_terms('query_vars');
|
|
| 1734 | - } |
|
| 1729 | + if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
|
|
| 1730 | + $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood; |
|
| 1731 | + } |
|
| 1732 | + } else {
|
|
| 1733 | + $location_terms = geodir_get_current_location_terms('query_vars');
|
|
| 1734 | + } |
|
| 1735 | 1735 | |
| 1736 | - $geodir_show_location_url = get_option('geodir_show_location_url');
|
|
| 1737 | - $location_terms = geodir_remove_location_terms($location_terms); |
|
| 1736 | + $geodir_show_location_url = get_option('geodir_show_location_url');
|
|
| 1737 | + $location_terms = geodir_remove_location_terms($location_terms); |
|
| 1738 | 1738 | |
| 1739 | - if (!empty($location_terms)) {
|
|
| 1740 | - $url_separator = ''; |
|
| 1739 | + if (!empty($location_terms)) {
|
|
| 1740 | + $url_separator = ''; |
|
| 1741 | 1741 | |
| 1742 | - if (get_option('permalink_structure') != '') {
|
|
| 1743 | - $old_listing_slug = '/' . $listing_slug . '/'; |
|
| 1744 | - $request_term = implode("/", $location_terms);
|
|
| 1745 | - $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/'; |
|
| 1742 | + if (get_option('permalink_structure') != '') {
|
|
| 1743 | + $old_listing_slug = '/' . $listing_slug . '/'; |
|
| 1744 | + $request_term = implode("/", $location_terms);
|
|
| 1745 | + $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/'; |
|
| 1746 | 1746 | |
| 1747 | - $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug)); |
|
| 1748 | - } else {
|
|
| 1749 | - $termlink = geodir_getlink($termlink, $request_term); |
|
| 1750 | - } |
|
| 1751 | - } |
|
| 1752 | - } |
|
| 1747 | + $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug)); |
|
| 1748 | + } else {
|
|
| 1749 | + $termlink = geodir_getlink($termlink, $request_term); |
|
| 1750 | + } |
|
| 1751 | + } |
|
| 1752 | + } |
|
| 1753 | 1753 | |
| 1754 | - // Alter the CPT slug is WPML is set to do so |
|
| 1755 | - /* we can replace this with the below function |
|
| 1754 | + // Alter the CPT slug is WPML is set to do so |
|
| 1755 | + /* we can replace this with the below function |
|
| 1756 | 1756 | if(function_exists('icl_object_id')){
|
| 1757 | 1757 | global $sitepress; |
| 1758 | 1758 | $post_type = str_replace("category","",$taxonomy);
|
| 1759 | 1759 | $termlink = $sitepress->post_type_archive_link_filter( $termlink, $post_type); |
| 1760 | 1760 | }*/ |
| 1761 | 1761 | |
| 1762 | - // Alter the CPT slug if WPML is set to do so |
|
| 1763 | - if (function_exists('icl_object_id')) {
|
|
| 1764 | - $post_types = get_option('geodir_post_types');
|
|
| 1765 | - $post_type = str_replace("category","",$taxonomy);
|
|
| 1766 | - $post_type = str_replace("_tags","",$post_type);
|
|
| 1767 | - $slug = $post_types[$post_type]['rewrite']['slug']; |
|
| 1768 | - if (gd_wpml_slug_translation_turned_on($post_type)) {
|
|
| 1769 | - global $sitepress; |
|
| 1770 | - $default_lang = $sitepress->get_default_language(); |
|
| 1771 | - $language_code = gd_wpml_get_lang_from_url($termlink); |
|
| 1772 | - if (!$language_code ) {
|
|
| 1773 | - $language_code = $default_lang; |
|
| 1774 | - } |
|
| 1762 | + // Alter the CPT slug if WPML is set to do so |
|
| 1763 | + if (function_exists('icl_object_id')) {
|
|
| 1764 | + $post_types = get_option('geodir_post_types');
|
|
| 1765 | + $post_type = str_replace("category","",$taxonomy);
|
|
| 1766 | + $post_type = str_replace("_tags","",$post_type);
|
|
| 1767 | + $slug = $post_types[$post_type]['rewrite']['slug']; |
|
| 1768 | + if (gd_wpml_slug_translation_turned_on($post_type)) {
|
|
| 1769 | + global $sitepress; |
|
| 1770 | + $default_lang = $sitepress->get_default_language(); |
|
| 1771 | + $language_code = gd_wpml_get_lang_from_url($termlink); |
|
| 1772 | + if (!$language_code ) {
|
|
| 1773 | + $language_code = $default_lang; |
|
| 1774 | + } |
|
| 1775 | 1775 | |
| 1776 | - $org_slug = $slug; |
|
| 1777 | - $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code);
|
|
| 1776 | + $org_slug = $slug; |
|
| 1777 | + $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code);
|
|
| 1778 | 1778 | |
| 1779 | - if (!$slug) {
|
|
| 1780 | - $slug = $org_slug; |
|
| 1781 | - } |
|
| 1779 | + if (!$slug) {
|
|
| 1780 | + $slug = $org_slug; |
|
| 1781 | + } |
|
| 1782 | 1782 | |
| 1783 | - $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug ,$termlink, 1));
|
|
| 1784 | - } |
|
| 1785 | - } |
|
| 1786 | - } |
|
| 1783 | + $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug ,$termlink, 1));
|
|
| 1784 | + } |
|
| 1785 | + } |
|
| 1786 | + } |
|
| 1787 | 1787 | |
| 1788 | - return $termlink; |
|
| 1788 | + return $termlink; |
|
| 1789 | 1789 | } |
| 1790 | 1790 | |
| 1791 | 1791 | /** |
@@ -1811,14 +1811,14 @@ discard block |
||
| 1811 | 1811 | if (in_array($post_type, geodir_get_posttypes())) {
|
| 1812 | 1812 | if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
|
| 1813 | 1813 | if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
|
| 1814 | - $location_terms = array( |
|
| 1815 | - 'gd_country' => $post->country_slug, |
|
| 1816 | - 'gd_region' => $post->region_slug, |
|
| 1817 | - 'gd_city' => $post->city_slug |
|
| 1818 | - ); |
|
| 1819 | - } else {
|
|
| 1820 | - $location_terms = geodir_get_current_location_terms('query_vars');
|
|
| 1821 | - } |
|
| 1814 | + $location_terms = array( |
|
| 1815 | + 'gd_country' => $post->country_slug, |
|
| 1816 | + 'gd_region' => $post->region_slug, |
|
| 1817 | + 'gd_city' => $post->city_slug |
|
| 1818 | + ); |
|
| 1819 | + } else {
|
|
| 1820 | + $location_terms = geodir_get_current_location_terms('query_vars');
|
|
| 1821 | + } |
|
| 1822 | 1822 | |
| 1823 | 1823 | $location_terms = geodir_remove_location_terms($location_terms); |
| 1824 | 1824 | |
@@ -1850,17 +1850,17 @@ discard block |
||
| 1850 | 1850 | * @return void|string Label. |
| 1851 | 1851 | */ |
| 1852 | 1852 | function get_post_type_singular_label($post_type, $echo = false, $translate = false) {
|
| 1853 | - $obj_post_type = get_post_type_object($post_type); |
|
| 1854 | - if (!is_object($obj_post_type)) {
|
|
| 1855 | - return; |
|
| 1856 | - } |
|
| 1853 | + $obj_post_type = get_post_type_object($post_type); |
|
| 1854 | + if (!is_object($obj_post_type)) {
|
|
| 1855 | + return; |
|
| 1856 | + } |
|
| 1857 | 1857 | |
| 1858 | - $label = $translate ? __($obj_post_type->labels->singular_name, 'geodirectory') : $obj_post_type->labels->singular_name; |
|
| 1858 | + $label = $translate ? __($obj_post_type->labels->singular_name, 'geodirectory') : $obj_post_type->labels->singular_name; |
|
| 1859 | 1859 | |
| 1860 | - if ($echo) |
|
| 1861 | - echo $label; |
|
| 1862 | - else |
|
| 1863 | - return $label; |
|
| 1860 | + if ($echo) |
|
| 1861 | + echo $label; |
|
| 1862 | + else |
|
| 1863 | + return $label; |
|
| 1864 | 1864 | } |
| 1865 | 1865 | |
| 1866 | 1866 | /** |
@@ -1875,19 +1875,19 @@ discard block |
||
| 1875 | 1875 | * @return void|string Label. |
| 1876 | 1876 | */ |
| 1877 | 1877 | function get_post_type_plural_label($post_type, $echo = false, $translate = false) {
|
| 1878 | - $all_postypes = geodir_get_posttypes(); |
|
| 1878 | + $all_postypes = geodir_get_posttypes(); |
|
| 1879 | 1879 | |
| 1880 | - if (!in_array($post_type, $all_postypes)) |
|
| 1881 | - return false; |
|
| 1880 | + if (!in_array($post_type, $all_postypes)) |
|
| 1881 | + return false; |
|
| 1882 | 1882 | |
| 1883 | - $obj_post_type = get_post_type_object($post_type); |
|
| 1883 | + $obj_post_type = get_post_type_object($post_type); |
|
| 1884 | 1884 | |
| 1885 | - $label = $translate ? __($obj_post_type->labels->name, 'geodirectory') : $obj_post_type->labels->name; |
|
| 1885 | + $label = $translate ? __($obj_post_type->labels->name, 'geodirectory') : $obj_post_type->labels->name; |
|
| 1886 | 1886 | |
| 1887 | - if ($echo) |
|
| 1888 | - echo $label; |
|
| 1889 | - else |
|
| 1890 | - return $label; |
|
| 1887 | + if ($echo) |
|
| 1888 | + echo $label; |
|
| 1889 | + else |
|
| 1890 | + return $label; |
|
| 1891 | 1891 | } |
| 1892 | 1892 | |
| 1893 | 1893 | /** |
@@ -1905,51 +1905,51 @@ discard block |
||
| 1905 | 1905 | */ |
| 1906 | 1906 | function geodir_term_exists($term, $taxonomy = '', $parent = 0) |
| 1907 | 1907 | {
|
| 1908 | - global $wpdb; |
|
| 1909 | - |
|
| 1910 | - $select = "SELECT term_id FROM $wpdb->terms as t WHERE "; |
|
| 1911 | - $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE "; |
|
| 1912 | - |
|
| 1913 | - if (is_int($term)) {
|
|
| 1914 | - if (0 == $term) |
|
| 1915 | - return 0; |
|
| 1916 | - $where = 't.term_id = %d'; |
|
| 1917 | - if (!empty($taxonomy)) |
|
| 1918 | - return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
| 1919 | - else |
|
| 1920 | - return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
| 1921 | - } |
|
| 1908 | + global $wpdb; |
|
| 1909 | + |
|
| 1910 | + $select = "SELECT term_id FROM $wpdb->terms as t WHERE "; |
|
| 1911 | + $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE "; |
|
| 1912 | + |
|
| 1913 | + if (is_int($term)) {
|
|
| 1914 | + if (0 == $term) |
|
| 1915 | + return 0; |
|
| 1916 | + $where = 't.term_id = %d'; |
|
| 1917 | + if (!empty($taxonomy)) |
|
| 1918 | + return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
| 1919 | + else |
|
| 1920 | + return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
| 1921 | + } |
|
| 1922 | 1922 | |
| 1923 | - $term = trim(wp_unslash($term)); |
|
| 1923 | + $term = trim(wp_unslash($term)); |
|
| 1924 | 1924 | |
| 1925 | - if ('' === $slug = sanitize_title($term))
|
|
| 1926 | - return 0; |
|
| 1925 | + if ('' === $slug = sanitize_title($term))
|
|
| 1926 | + return 0; |
|
| 1927 | 1927 | |
| 1928 | - $where = 't.slug = %s'; |
|
| 1928 | + $where = 't.slug = %s'; |
|
| 1929 | 1929 | |
| 1930 | - $where_fields = array($slug); |
|
| 1931 | - if (!empty($taxonomy)) {
|
|
| 1932 | - $parent = (int)$parent; |
|
| 1933 | - if ($parent > 0) {
|
|
| 1934 | - $where_fields[] = $parent; |
|
| 1935 | - $else_where_fields[] = $parent; |
|
| 1936 | - $where .= ' AND tt.parent = %d'; |
|
| 1930 | + $where_fields = array($slug); |
|
| 1931 | + if (!empty($taxonomy)) {
|
|
| 1932 | + $parent = (int)$parent; |
|
| 1933 | + if ($parent > 0) {
|
|
| 1934 | + $where_fields[] = $parent; |
|
| 1935 | + $else_where_fields[] = $parent; |
|
| 1936 | + $where .= ' AND tt.parent = %d'; |
|
| 1937 | 1937 | |
| 1938 | - } |
|
| 1938 | + } |
|
| 1939 | 1939 | |
| 1940 | - $where_fields[] = $taxonomy; |
|
| 1940 | + $where_fields[] = $taxonomy; |
|
| 1941 | 1941 | |
| 1942 | 1942 | |
| 1943 | - if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
|
|
| 1944 | - return $result; |
|
| 1943 | + if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A))
|
|
| 1944 | + return $result; |
|
| 1945 | 1945 | |
| 1946 | - return false; |
|
| 1947 | - } |
|
| 1946 | + return false; |
|
| 1947 | + } |
|
| 1948 | 1948 | |
| 1949 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
|
|
| 1950 | - return $result; |
|
| 1949 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
|
|
| 1950 | + return $result; |
|
| 1951 | 1951 | |
| 1952 | - return false; |
|
| 1952 | + return false; |
|
| 1953 | 1953 | } |
| 1954 | 1954 | |
| 1955 | 1955 | /** |
@@ -1961,7 +1961,7 @@ discard block |
||
| 1961 | 1961 | function geodir_get_term_icon_rebuild() |
| 1962 | 1962 | {
|
| 1963 | 1963 | |
| 1964 | - update_option('gd_term_icons', '');
|
|
| 1964 | + update_option('gd_term_icons', '');
|
|
| 1965 | 1965 | |
| 1966 | 1966 | } |
| 1967 | 1967 | |
@@ -1979,61 +1979,61 @@ discard block |
||
| 1979 | 1979 | */ |
| 1980 | 1980 | function geodir_get_term_icon($term_id = false, $rebuild = false) |
| 1981 | 1981 | {
|
| 1982 | - global $wpdb; |
|
| 1983 | - if (!$rebuild) {
|
|
| 1984 | - $terms_icons = get_option('gd_term_icons');
|
|
| 1985 | - } else {
|
|
| 1986 | - $terms_icons = array(); |
|
| 1987 | - } |
|
| 1988 | - |
|
| 1989 | - if (empty($terms_icons)) {
|
|
| 1990 | - $terms_icons = array(); |
|
| 1991 | - $default_icon_url = get_option('geodir_default_marker_icon');
|
|
| 1992 | - $taxonomy = geodir_get_taxonomies(); |
|
| 1993 | - $post_types = geodir_get_posttypes(); |
|
| 1994 | - $tax_arr = array(); |
|
| 1995 | - foreach ($post_types as $post_type) {
|
|
| 1996 | - $tax_arr[] = "'" . $post_type . "category'"; |
|
| 1997 | - } |
|
| 1998 | - $tax_c = implode(',', $tax_arr);
|
|
| 1999 | - $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
|
|
| 2000 | - //$terms = get_terms( $taxonomy ); |
|
| 2001 | - |
|
| 2002 | - if($terms) {
|
|
| 2003 | - foreach ($terms as $term) {
|
|
| 2004 | - $post_type = str_replace("category", "", $term->taxonomy);
|
|
| 2005 | - $a_terms[$post_type][] = $term; |
|
| 1982 | + global $wpdb; |
|
| 1983 | + if (!$rebuild) {
|
|
| 1984 | + $terms_icons = get_option('gd_term_icons');
|
|
| 1985 | + } else {
|
|
| 1986 | + $terms_icons = array(); |
|
| 1987 | + } |
|
| 2006 | 1988 | |
| 2007 | - } |
|
| 2008 | - } |
|
| 1989 | + if (empty($terms_icons)) {
|
|
| 1990 | + $terms_icons = array(); |
|
| 1991 | + $default_icon_url = get_option('geodir_default_marker_icon');
|
|
| 1992 | + $taxonomy = geodir_get_taxonomies(); |
|
| 1993 | + $post_types = geodir_get_posttypes(); |
|
| 1994 | + $tax_arr = array(); |
|
| 1995 | + foreach ($post_types as $post_type) {
|
|
| 1996 | + $tax_arr[] = "'" . $post_type . "category'"; |
|
| 1997 | + } |
|
| 1998 | + $tax_c = implode(',', $tax_arr);
|
|
| 1999 | + $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
|
|
| 2000 | + //$terms = get_terms( $taxonomy ); |
|
| 2009 | 2001 | |
| 2010 | - if($a_terms) {
|
|
| 2011 | - foreach ($a_terms as $pt => $t2) {
|
|
| 2002 | + if($terms) {
|
|
| 2003 | + foreach ($terms as $term) {
|
|
| 2004 | + $post_type = str_replace("category", "", $term->taxonomy);
|
|
| 2005 | + $a_terms[$post_type][] = $term; |
|
| 2012 | 2006 | |
| 2013 | - foreach ($t2 as $term) {
|
|
| 2014 | - $term_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt); |
|
| 2015 | - if ($term_icon) {
|
|
| 2016 | - $term_icon_url = $term_icon["src"]; |
|
| 2017 | - } else {
|
|
| 2018 | - $term_icon_url = $default_icon_url; |
|
| 2019 | - } |
|
| 2020 | - $terms_icons[$term->term_id] = $term_icon_url; |
|
| 2021 | - } |
|
| 2022 | - } |
|
| 2023 | - } |
|
| 2007 | + } |
|
| 2008 | + } |
|
| 2009 | + |
|
| 2010 | + if($a_terms) {
|
|
| 2011 | + foreach ($a_terms as $pt => $t2) {
|
|
| 2012 | + |
|
| 2013 | + foreach ($t2 as $term) {
|
|
| 2014 | + $term_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt); |
|
| 2015 | + if ($term_icon) {
|
|
| 2016 | + $term_icon_url = $term_icon["src"]; |
|
| 2017 | + } else {
|
|
| 2018 | + $term_icon_url = $default_icon_url; |
|
| 2019 | + } |
|
| 2020 | + $terms_icons[$term->term_id] = $term_icon_url; |
|
| 2021 | + } |
|
| 2022 | + } |
|
| 2023 | + } |
|
| 2024 | 2024 | |
| 2025 | - update_option('gd_term_icons', $terms_icons);
|
|
| 2026 | - } |
|
| 2025 | + update_option('gd_term_icons', $terms_icons);
|
|
| 2026 | + } |
|
| 2027 | 2027 | |
| 2028 | - if ($term_id && isset($terms_icons[$term_id])) {
|
|
| 2029 | - return $terms_icons[$term_id]; |
|
| 2030 | - } elseif ($term_id && !isset($terms_icons[$term_id])) {
|
|
| 2031 | - return get_option('geodir_default_marker_icon');
|
|
| 2032 | - } |
|
| 2028 | + if ($term_id && isset($terms_icons[$term_id])) {
|
|
| 2029 | + return $terms_icons[$term_id]; |
|
| 2030 | + } elseif ($term_id && !isset($terms_icons[$term_id])) {
|
|
| 2031 | + return get_option('geodir_default_marker_icon');
|
|
| 2032 | + } |
|
| 2033 | 2033 | |
| 2034 | - if (is_ssl()) {
|
|
| 2035 | - $terms_icons = str_replace("http:","https:",$terms_icons );
|
|
| 2036 | - } |
|
| 2034 | + if (is_ssl()) {
|
|
| 2035 | + $terms_icons = str_replace("http:","https:",$terms_icons );
|
|
| 2036 | + } |
|
| 2037 | 2037 | |
| 2038 | - return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
|
|
| 2038 | + return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
|
|
| 2039 | 2039 | } |
| 2040 | 2040 | \ No newline at end of file |
@@ -60,16 +60,16 @@ discard block |
||
| 60 | 60 | * @since 1.0.0 |
| 61 | 61 | * @param string $menu_class The menu HTML class. |
| 62 | 62 | */ |
| 63 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 63 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class);
|
|
| 64 | 64 | /** |
| 65 | 65 | * Filter the menu a class. |
| 66 | 66 | * |
| 67 | 67 | * @since 1.0.0 |
| 68 | 68 | */ |
| 69 | 69 | $a_class = apply_filters('geodir_menu_a_class', '');
|
| 70 | - $items .= '<li class="' . $li_class . '"> |
|
| 71 | - <a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '"> |
|
| 72 | - ' . __(ucfirst($args->labels->name),'geodirectory') . ' |
|
| 70 | + $items .= '<li class="'.$li_class.'"> |
|
| 71 | + <a href="' . get_post_type_archive_link($post_type).'" class="'.$a_class.'"> |
|
| 72 | + ' . __(ucfirst($args->labels->name), 'geodirectory').' |
|
| 73 | 73 | </a> |
| 74 | 74 | </li>'; |
| 75 | 75 | } |
@@ -88,14 +88,14 @@ discard block |
||
| 88 | 88 | * @since 1.0.0 |
| 89 | 89 | * @param string $menu_class The menu HTML class. |
| 90 | 90 | */ |
| 91 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
|
|
| 91 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings '.$menu_class);
|
|
| 92 | 92 | /** |
| 93 | 93 | * Filter the sub menu li class. |
| 94 | 94 | * |
| 95 | 95 | * @since 1.0.0 |
| 96 | 96 | * @param string $menu_class The menu HTML class. |
| 97 | 97 | */ |
| 98 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 98 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item '.$menu_class);
|
|
| 99 | 99 | /** |
| 100 | 100 | * Filter the sub menu ul class. |
| 101 | 101 | * |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | * @since 1.0.0 |
| 115 | 115 | */ |
| 116 | 116 | $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
|
| 117 | - $items .= '<li class="' . $li_class . '"> |
|
| 118 | - <a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a>
|
|
| 119 | - <ul class="' . $sub_ul_class . '">'; |
|
| 117 | + $items .= '<li class="'.$li_class.'"> |
|
| 118 | + <a href="#" class="' . $a_class.'">'.__('Listing', 'geodirectory').'</a>
|
|
| 119 | + <ul class="' . $sub_ul_class.'">'; |
|
| 120 | 120 | $post_types = geodir_get_posttypes('object');
|
| 121 | 121 | |
| 122 | 122 | $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
|
@@ -133,9 +133,9 @@ discard block |
||
| 133 | 133 | if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
|
| 134 | 134 | $menu_class = 'current-menu-item'; |
| 135 | 135 | |
| 136 | - $items .= '<li class="' . $sub_li_class . '"> |
|
| 137 | - <a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '"> |
|
| 138 | - ' . __(ucfirst($args->labels->name),'geodirectory') . ' |
|
| 136 | + $items .= '<li class="'.$sub_li_class.'"> |
|
| 137 | + <a href="' . get_post_type_archive_link($post_type).'" class="'.$sub_a_class.'"> |
|
| 138 | + ' . __(ucfirst($args->labels->name), 'geodirectory').' |
|
| 139 | 139 | </a> |
| 140 | 140 | </li>'; |
| 141 | 141 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * |
| 152 | 152 | * @since 1.5.9 |
| 153 | 153 | */ |
| 154 | - $items .= apply_filters('geodir_menu_after_sub_ul','');
|
|
| 154 | + $items .= apply_filters('geodir_menu_after_sub_ul', '');
|
|
| 155 | 155 | $items .= '</li>'; |
| 156 | 156 | } |
| 157 | 157 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | * @since 1.0.0 |
| 185 | 185 | * @param string $menu_class The menu HTML class. |
| 186 | 186 | */ |
| 187 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 187 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class);
|
|
| 188 | 188 | /** |
| 189 | 189 | * Filter the menu a class. |
| 190 | 190 | * |
@@ -192,9 +192,9 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | $a_class = apply_filters('geodir_menu_a_class', '');
|
| 194 | 194 | $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
| 195 | - $items .= '<li class="' . $li_class . '"> |
|
| 196 | - <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '"> |
|
| 197 | - ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
|
|
| 195 | + $items .= '<li class="'.$li_class.'"> |
|
| 196 | + <a href="' . geodir_get_addlisting_link($post_type).'" class="'.$a_class.'"> |
|
| 197 | + ' . sprintf(__('Add %s', 'geodirectory'), $cpt_name).'
|
|
| 198 | 198 | </a> |
| 199 | 199 | </li>'; |
| 200 | 200 | } |
@@ -218,14 +218,14 @@ discard block |
||
| 218 | 218 | * @since 1.0.0 |
| 219 | 219 | * @param string $menu_class The menu HTML class. |
| 220 | 220 | */ |
| 221 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
|
|
| 221 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing '.$menu_class);
|
|
| 222 | 222 | /** |
| 223 | 223 | * Filter the sub menu li class. |
| 224 | 224 | * |
| 225 | 225 | * @since 1.0.0 |
| 226 | 226 | * @param string $menu_class The menu HTML class. |
| 227 | 227 | */ |
| 228 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 228 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item '.$menu_class);
|
|
| 229 | 229 | /** |
| 230 | 230 | * Filter the sub menu ul class. |
| 231 | 231 | * |
@@ -244,9 +244,9 @@ discard block |
||
| 244 | 244 | * @since 1.0.0 |
| 245 | 245 | */ |
| 246 | 246 | $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
|
| 247 | - $items .= '<li class="' . $li_class . '"> |
|
| 248 | - <a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a>
|
|
| 249 | - <ul class="' . $sub_ul_class . '">'; |
|
| 247 | + $items .= '<li class="'.$li_class.'"> |
|
| 248 | + <a href="#" class="' . $a_class.'">'.__('Add Listing', 'geodirectory').'</a>
|
|
| 249 | + <ul class="' . $sub_ul_class.'">'; |
|
| 250 | 250 | |
| 251 | 251 | $post_types = geodir_get_posttypes('object');
|
| 252 | 252 | |
@@ -269,11 +269,11 @@ discard block |
||
| 269 | 269 | * @since 1.0.0 |
| 270 | 270 | * @param string $menu_class The menu HTML class. |
| 271 | 271 | */ |
| 272 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 272 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class);
|
|
| 273 | 273 | $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
| 274 | - $items .= '<li class="' . $li_class . '"> |
|
| 275 | - <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '"> |
|
| 276 | - ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
|
|
| 274 | + $items .= '<li class="'.$li_class.'"> |
|
| 275 | + <a href="' . geodir_get_addlisting_link($post_type).'" class="'.$sub_a_class.'"> |
|
| 276 | + ' . sprintf(__('Add %s', 'geodirectory'), $cpt_name).'
|
|
| 277 | 277 | </a> |
| 278 | 278 | </li>'; |
| 279 | 279 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | $items .= ' </ul> '; |
| 288 | - $items .= apply_filters('geodir_menu_after_sub_ul','');
|
|
| 288 | + $items .= apply_filters('geodir_menu_after_sub_ul', '');
|
|
| 289 | 289 | $items .= '</li>'; |
| 290 | 290 | |
| 291 | 291 | } |
@@ -313,14 +313,14 @@ discard block |
||
| 313 | 313 | $geodir_theme_location = get_option('geodir_theme_location_nav');
|
| 314 | 314 | $geodir_theme_location_nav = array(); |
| 315 | 315 | if (empty($locations) && empty($geodir_theme_location)) {
|
| 316 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
|
|
| 316 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items()."</ul></div>", $menu);
|
|
| 317 | 317 | $geodir_theme_location_nav[] = $args['theme_location']; |
| 318 | 318 | update_option('geodir_theme_location_nav', $geodir_theme_location_nav);
|
| 319 | 319 | } |
| 320 | 320 | //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet. |
| 321 | 321 | // $menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu);
|
| 322 | 322 | else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) |
| 323 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu);
|
|
| 323 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items()."</ul></div>", $menu);
|
|
| 324 | 324 | |
| 325 | 325 | return $menu; |
| 326 | 326 | |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | |
| 349 | 349 | if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) {
|
| 350 | 350 | |
| 351 | - $items = $items . geodir_add_nav_menu_items(); |
|
| 351 | + $items = $items.geodir_add_nav_menu_items(); |
|
| 352 | 352 | return $items; |
| 353 | 353 | |
| 354 | 354 | } else {
|
@@ -373,12 +373,12 @@ discard block |
||
| 373 | 373 | |
| 374 | 374 | $taxonomies = geodir_get_taxonomies(); |
| 375 | 375 | $taxonomies = implode("','", $taxonomies);
|
| 376 | - $taxonomies = "'" . $taxonomies . "'"; |
|
| 376 | + $taxonomies = "'".$taxonomies."'"; |
|
| 377 | 377 | |
| 378 | 378 | $pn_categories = $wpdb->get_results( |
| 379 | 379 | $wpdb->prepare( |
| 380 | 380 | "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy, $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name", |
| 381 | - array($wpdb->terms . term_id) |
|
| 381 | + array($wpdb->terms.term_id) |
|
| 382 | 382 | ) |
| 383 | 383 | ); |
| 384 | 384 | |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | |
| 408 | 408 | if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
|
| 409 | 409 | if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
| 410 | - $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
| 410 | + $geodir_post_type = get_post_type((int) $_REQUEST['pid']); |
|
| 411 | 411 | elseif (isset($_REQUEST['listing_type'])) |
| 412 | 412 | $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
| 413 | 413 | } |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
| 426 | 426 | $geodir_post_type = ''; |
| 427 | 427 | |
| 428 | - if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
|
|
| 428 | + if (defined('DOING_AJAX') && isset($_REQUEST['stype'])) {
|
|
| 429 | 429 | $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
| 430 | 430 | } |
| 431 | 431 | |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | * |
| 436 | 436 | * @since 1.6.9 |
| 437 | 437 | */ |
| 438 | - return apply_filters('geodir_get_current_posttype',$geodir_post_type);
|
|
| 438 | + return apply_filters('geodir_get_current_posttype', $geodir_post_type);
|
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | /** |
@@ -449,18 +449,18 @@ discard block |
||
| 449 | 449 | */ |
| 450 | 450 | function geodir_get_default_posttype() |
| 451 | 451 | {
|
| 452 | - $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) ); |
|
| 452 | + $post_types = apply_filters('geodir_get_default_posttype', geodir_get_posttypes('object'));
|
|
| 453 | 453 | |
| 454 | 454 | $stype = false; |
| 455 | - foreach ( $post_types as $post_type => $info ) {
|
|
| 455 | + foreach ($post_types as $post_type => $info) {
|
|
| 456 | 456 | global $wpdb; |
| 457 | - $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) ); |
|
| 458 | - if ( $has_posts ) {
|
|
| 457 | + $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
|
|
| 458 | + if ($has_posts) {
|
|
| 459 | 459 | $stype = $post_type; break; |
| 460 | 460 | } |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | - if(!$stype){
|
|
| 463 | + if (!$stype) {
|
|
| 464 | 464 | $stype = 'gd_place'; |
| 465 | 465 | } |
| 466 | 466 | |
@@ -485,14 +485,14 @@ discard block |
||
| 485 | 485 | switch ($output): |
| 486 | 486 | case 'object': |
| 487 | 487 | case 'Object': |
| 488 | - $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types; |
|
| 488 | + $post_types = json_decode(json_encode($post_types), FALSE); //(object)$post_types; |
|
| 489 | 489 | break; |
| 490 | 490 | case 'array': |
| 491 | 491 | case 'Array': |
| 492 | - $post_types = (array)$post_types; |
|
| 492 | + $post_types = (array) $post_types; |
|
| 493 | 493 | break; |
| 494 | 494 | case 'options': |
| 495 | - $post_types = (array)$post_types; |
|
| 495 | + $post_types = (array) $post_types; |
|
| 496 | 496 | |
| 497 | 497 | $options = array(); |
| 498 | 498 | if (!empty($post_types)) {
|
@@ -610,15 +610,15 @@ discard block |
||
| 610 | 610 | |
| 611 | 611 | $categories = get_terms($taxonomies); |
| 612 | 612 | |
| 613 | - $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
|
|
| 613 | + $html .= '<option value="0">'.__('All', 'geodirectory').'</option>';
|
|
| 614 | 614 | |
| 615 | 615 | foreach ($categories as $category_obj) {
|
| 616 | 616 | $select_opt = ''; |
| 617 | 617 | if ($selected == $category_obj->term_id) {
|
| 618 | 618 | $select_opt = 'selected="selected"'; |
| 619 | 619 | } |
| 620 | - $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">' |
|
| 621 | - . ucfirst($category_obj->name) . '</option>'; |
|
| 620 | + $html .= '<option '.$select_opt.' value="'.$category_obj->term_id.'">' |
|
| 621 | + . ucfirst($category_obj->name).'</option>'; |
|
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | if ($echo) |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | } elseif (isset($wp_query->tax_query->queries)) {
|
| 687 | 687 | $tax_arr = $wp_query->tax_query->queries; |
| 688 | 688 | //if tax query has 'relation' set then it will break wp_list_pluck so we remove it |
| 689 | - if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
|
|
| 689 | + if (isset($tax_arr['relation'])) {unset($tax_arr['relation']); }
|
|
| 690 | 690 | $taxonomies = wp_list_pluck($tax_arr, 'taxonomy'); |
| 691 | 691 | } |
| 692 | 692 | |
@@ -740,7 +740,7 @@ discard block |
||
| 740 | 740 | |
| 741 | 741 | if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
|
| 742 | 742 | if ($cat_parent == 0) {
|
| 743 | - $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display; |
|
| 743 | + $list_class = 'main_list gd-parent-cats-list gd-cats-display-'.$cat_display; |
|
| 744 | 744 | $main_list_class = 'class="main_list_selecter"'; |
| 745 | 745 | } else {
|
| 746 | 746 | //$display = 'display:none'; |
@@ -750,7 +750,7 @@ discard block |
||
| 750 | 750 | |
| 751 | 751 | if ($cat_display == 'checkbox' || $cat_display == 'radio') {
|
| 752 | 752 | $p = 0; |
| 753 | - $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
| 753 | + $out = '<div class="'.$list_class.' gd-cat-row-'.$cat_parent.'" style="margin-left:'.$p.'px;'.$display.';">'; |
|
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | foreach ($cat_terms as $cat_term) {
|
@@ -765,12 +765,12 @@ discard block |
||
| 765 | 765 | } |
| 766 | 766 | |
| 767 | 767 | if ($cat_display == 'radio') |
| 768 | - $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>'; |
|
| 768 | + $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.ucfirst($cat_term->name).'</span>'; |
|
| 769 | 769 | elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
| 770 | - $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>'; |
|
| 770 | + $out .= '<option '.$main_list_class.' style="margin-left:'.$p.'px;" alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' >'.$term_check.ucfirst($cat_term->name).'</option>'; |
|
| 771 | 771 | |
| 772 | 772 | else {
|
| 773 | - $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>'; |
|
| 773 | + $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.ucfirst($cat_term->name).'</span>'; |
|
| 774 | 774 | } |
| 775 | 775 | |
| 776 | 776 | // Call recurson to print sub cats |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | $cat_exclude = serialize($exclude_cats); |
| 810 | 810 | |
| 811 | 811 | if (isset($_REQUEST['backandedit'])) {
|
| 812 | - $post = (object)$gd_session->get('listing');
|
|
| 812 | + $post = (object) $gd_session->get('listing');
|
|
| 813 | 813 | |
| 814 | 814 | if (!is_array($post->post_category[$cat_taxonomy])) |
| 815 | 815 | $post_category = $post->post_category[$cat_taxonomy]; |
@@ -841,7 +841,7 @@ discard block |
||
| 841 | 841 | |
| 842 | 842 | if (!empty($post_category)) {
|
| 843 | 843 | $cat1 = array_filter(explode(',', $post_category));
|
| 844 | - $post_category = ',' . implode(',', $cat1) . ',';
|
|
| 844 | + $post_category = ','.implode(',', $cat1).',';
|
|
| 845 | 845 | |
| 846 | 846 | } |
| 847 | 847 | |
@@ -852,7 +852,7 @@ discard block |
||
| 852 | 852 | foreach ($post_category_upd as $cat) {
|
| 853 | 853 | |
| 854 | 854 | if (!in_array($cat, $exclude_cats) && $cat != '') {
|
| 855 | - $post_category_change .= ',' . $cat; |
|
| 855 | + $post_category_change .= ','.$cat; |
|
| 856 | 856 | } |
| 857 | 857 | } |
| 858 | 858 | $post_category = $post_category_change; |
@@ -864,11 +864,11 @@ discard block |
||
| 864 | 864 | } |
| 865 | 865 | } |
| 866 | 866 | |
| 867 | - echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']" />'; |
|
| 867 | + echo '<input type="hidden" id="cat_limit" value="'.$cat_limit.'" name="cat_limit['.$cat_taxonomy.']" />'; |
|
| 868 | 868 | |
| 869 | - echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']" />'; |
|
| 869 | + echo '<input type="hidden" id="post_category" value="'.$post_category.'" name="post_category['.$cat_taxonomy.']" />'; |
|
| 870 | 870 | |
| 871 | - echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']" />'; |
|
| 871 | + echo '<input type="hidden" id="post_category_str" value="'.$post_category_str.'" name="post_category_str['.$cat_taxonomy.']" />'; |
|
| 872 | 872 | |
| 873 | 873 | |
| 874 | 874 | ?> |
@@ -887,14 +887,14 @@ discard block |
||
| 887 | 887 | |
| 888 | 888 | function show_subcatlist(main_cat, catObj) {
|
| 889 | 889 | if (main_cat != '') {
|
| 890 | - var url = '<?php echo geodir_get_ajax_url();?>'; |
|
| 891 | - var cat_taxonomy = '<?php echo $cat_taxonomy;?>'; |
|
| 892 | - var cat_exclude = '<?php echo base64_encode($cat_exclude);?>'; |
|
| 890 | + var url = '<?php echo geodir_get_ajax_url(); ?>'; |
|
| 891 | + var cat_taxonomy = '<?php echo $cat_taxonomy; ?>'; |
|
| 892 | + var cat_exclude = '<?php echo base64_encode($cat_exclude); ?>'; |
|
| 893 | 893 | var cat_limit = jQuery('#' + cat_taxonomy).find('#cat_limit').val();
|
| 894 | - <?php if ((int)$cat_limit > 0) { ?>
|
|
| 894 | + <?php if ((int) $cat_limit > 0) { ?>
|
|
| 895 | 895 | var selected = parseInt(jQuery('#' + cat_taxonomy).find('.cat_sublist > div.post_catlist_item').length);
|
| 896 | 896 | if (cat_limit != '' && selected > 0 && selected >= cat_limit && cat_limit != 0) {
|
| 897 | - alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int)$cat_limit));?>");
|
|
| 897 | + alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int) $cat_limit)); ?>");
|
|
| 898 | 898 | return false; |
| 899 | 899 | } |
| 900 | 900 | <?php } ?> |
@@ -933,7 +933,7 @@ discard block |
||
| 933 | 933 | } |
| 934 | 934 | |
| 935 | 935 | function update_listing_cat(el) {
|
| 936 | - var cat_taxonomy = '<?php echo $cat_taxonomy;?>'; |
|
| 936 | + var cat_taxonomy = '<?php echo $cat_taxonomy; ?>'; |
|
| 937 | 937 | var cat_ids = ''; |
| 938 | 938 | var main_cat = ''; |
| 939 | 939 | var sub_cat = ''; |
@@ -1014,7 +1014,7 @@ discard block |
||
| 1014 | 1014 | <div class="main_cat_list" style=" <?php if (isset($style)) {
|
| 1015 | 1015 | echo $style; |
| 1016 | 1016 | }?> "> |
| 1017 | - <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
|
| 1017 | + <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
|
| 1018 | 1018 | ?> |
| 1019 | 1019 | </div> |
| 1020 | 1020 | <?php |
@@ -1041,9 +1041,9 @@ discard block |
||
| 1041 | 1041 | if ($exclude != '') {
|
| 1042 | 1042 | $exclude_cats = maybe_unserialize(base64_decode($exclude)); |
| 1043 | 1043 | |
| 1044 | - if(is_array( $exclude_cats)){
|
|
| 1045 | - $exclude_cats = array_map( 'intval', $exclude_cats ); |
|
| 1046 | - }else{
|
|
| 1044 | + if (is_array($exclude_cats)) {
|
|
| 1045 | + $exclude_cats = array_map('intval', $exclude_cats);
|
|
| 1046 | + } else {
|
|
| 1047 | 1047 | $exclude_cats = intval($exclude_cats); |
| 1048 | 1048 | } |
| 1049 | 1049 | |
@@ -1057,25 +1057,25 @@ discard block |
||
| 1057 | 1057 | <?php $main_cat = get_term($parrent, $request_taxonomy); ?> |
| 1058 | 1058 | |
| 1059 | 1059 | <div class="post_catlist_item" style="border:1px solid #CCCCCC; margin:5px auto; padding:5px;"> |
| 1060 | - <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png';?>" |
|
| 1060 | + <img alt="move icon" src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png'; ?>" |
|
| 1061 | 1061 | onclick="jQuery(this).closest('div').remove();update_listing_cat(this);" align="right"/>
|
| 1062 | 1062 | <?php /* ?> |
| 1063 | 1063 | <img src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png';?>" onclick="jQuery(this).closest('div').remove();show_subcatlist();" align="right" />
|
| 1064 | 1064 | <?php */ ?> |
| 1065 | 1065 | |
| 1066 | - <input type="checkbox" value="<?php echo $main_cat->term_id;?>" class="listing_main_cat" |
|
| 1066 | + <input type="checkbox" value="<?php echo $main_cat->term_id; ?>" class="listing_main_cat" |
|
| 1067 | 1067 | onchange="if(jQuery(this).is(':checked')){jQuery(this).closest('div').find('.post_default_category').prop('checked',false).show();}else{jQuery(this).closest('div').find('.post_default_category').prop('checked',false).hide();};update_listing_cat()"
|
| 1068 | 1068 | checked="checked" disabled="disabled"/> |
| 1069 | 1069 | <span> |
| 1070 | - <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
|
|
| 1070 | + <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
|
|
| 1071 | 1071 | </span> |
| 1072 | 1072 | <br/> |
| 1073 | 1073 | |
| 1074 | 1074 | <div class="post_default_category"> |
| 1075 | - <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>" |
|
| 1076 | - onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?> /> |
|
| 1075 | + <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id; ?>" |
|
| 1076 | + onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" '; ?> /> |
|
| 1077 | 1077 | <span> |
| 1078 | - <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
|
|
| 1078 | + <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
|
|
| 1079 | 1079 | </span> |
| 1080 | 1080 | </div> |
| 1081 | 1081 | |
@@ -1108,7 +1108,7 @@ discard block |
||
| 1108 | 1108 | $post_cat_str = $post_categories[$request_taxonomy]; |
| 1109 | 1109 | $post_cat_array = explode("#", $post_cat_str);
|
| 1110 | 1110 | if (is_array($post_cat_array)) {
|
| 1111 | - $post_cat_array = array_unique( $post_cat_array ); |
|
| 1111 | + $post_cat_array = array_unique($post_cat_array); |
|
| 1112 | 1112 | |
| 1113 | 1113 | foreach ($post_cat_array as $post_cat_html) {
|
| 1114 | 1114 | |
@@ -1123,7 +1123,7 @@ discard block |
||
| 1123 | 1123 | } |
| 1124 | 1124 | $post_sub_catid = ''; |
| 1125 | 1125 | if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
|
| 1126 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
| 1126 | + $post_sub_catid = (int) $post_cat_info[1]; |
|
| 1127 | 1127 | } |
| 1128 | 1128 | |
| 1129 | 1129 | geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
@@ -1144,7 +1144,7 @@ discard block |
||
| 1144 | 1144 | } |
| 1145 | 1145 | |
| 1146 | 1146 | if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
|
| 1147 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
| 1147 | + $post_sub_catid = (int) $post_cat_info[1]; |
|
| 1148 | 1148 | } |
| 1149 | 1149 | |
| 1150 | 1150 | geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
@@ -1176,9 +1176,9 @@ discard block |
||
| 1176 | 1176 | if (!$selected) |
| 1177 | 1177 | $option_slected = ' selected="selected" '; |
| 1178 | 1178 | |
| 1179 | - echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
|
| 1179 | + echo '<select field_type="select" id="'.sanitize_text_field($cat_taxonomy).'" class="chosen_select" '.$onchange.' option-ajaxChosen="false" >'; |
|
| 1180 | 1180 | |
| 1181 | - echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
|
|
| 1181 | + echo '<option value="" '.$option_selected.' >'.__('Select Category', 'geodirectory').'</option>';
|
|
| 1182 | 1182 | |
| 1183 | 1183 | foreach ($cat_terms as $cat_term) {
|
| 1184 | 1184 | $option_selected = ''; |
@@ -1186,10 +1186,10 @@ discard block |
||
| 1186 | 1186 | $option_selected = ' selected="selected" '; |
| 1187 | 1187 | |
| 1188 | 1188 | // Count child terms |
| 1189 | - $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
|
| 1190 | - $has_child = !empty( $child_terms ) ? 't' : 'f'; |
|
| 1189 | + $child_terms = get_terms($cat_taxonomy, array('parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1));
|
|
| 1190 | + $has_child = !empty($child_terms) ? 't' : 'f'; |
|
| 1191 | 1191 | |
| 1192 | - echo '<option ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>'; |
|
| 1192 | + echo '<option '.$option_selected.' alt="'.$cat_term->taxonomy.'" title="'.ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" _hc="'.$has_child.'" >'.ucfirst($cat_term->name).'</option>'; |
|
| 1193 | 1193 | } |
| 1194 | 1194 | echo '</select>'; |
| 1195 | 1195 | } |
@@ -1220,7 +1220,7 @@ discard block |
||
| 1220 | 1220 | 2 => __('Custom field updated.', 'geodirectory'),
|
| 1221 | 1221 | 3 => __('Custom field deleted.', 'geodirectory'),
|
| 1222 | 1222 | 4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
|
| 1223 | - 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false,
|
|
| 1223 | + 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], false)) : false,
|
|
| 1224 | 1224 | 6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name),
|
| 1225 | 1225 | 7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
|
| 1226 | 1226 | 8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name),
|
@@ -1246,7 +1246,7 @@ discard block |
||
| 1246 | 1246 | |
| 1247 | 1247 | global $wpdb; |
| 1248 | 1248 | |
| 1249 | - $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
|
| 1249 | + $menu_icon = geodir_plugin_url().'/geodirectory-assets/images/favicon.ico'; |
|
| 1250 | 1250 | |
| 1251 | 1251 | if (!$listing_slug = get_option('geodir_listing_prefix'))
|
| 1252 | 1252 | $listing_slug = 'places'; |
@@ -1259,11 +1259,11 @@ discard block |
||
| 1259 | 1259 | |
| 1260 | 1260 | $gd_placetags = array(); |
| 1261 | 1261 | $gd_placetags['object_type'] = 'gd_place'; |
| 1262 | - $gd_placetags['listing_slug'] = $listing_slug . '/tags'; |
|
| 1262 | + $gd_placetags['listing_slug'] = $listing_slug.'/tags'; |
|
| 1263 | 1263 | $gd_placetags['args'] = array( |
| 1264 | 1264 | 'public' => true, |
| 1265 | 1265 | 'hierarchical' => false, |
| 1266 | - 'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
|
|
| 1266 | + 'rewrite' => array('slug' => $listing_slug.'/tags', 'with_front' => false, 'hierarchical' => true),
|
|
| 1267 | 1267 | 'query_var' => true, |
| 1268 | 1268 | |
| 1269 | 1269 | 'labels' => array( |
@@ -1357,7 +1357,7 @@ discard block |
||
| 1357 | 1357 | 'menu_icon' => $menu_icon, |
| 1358 | 1358 | 'public' => true, |
| 1359 | 1359 | 'query_var' => true, |
| 1360 | - 'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
|
|
| 1360 | + 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
|
|
| 1361 | 1361 | 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
|
| 1362 | 1362 | 'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
|
| 1363 | 1363 | |
@@ -1379,27 +1379,27 @@ discard block |
||
| 1379 | 1379 | } |
| 1380 | 1380 | |
| 1381 | 1381 | $gd_wpml_get_languages = ""; |
| 1382 | -function gd_wpml_get_lang_from_url($url){
|
|
| 1382 | +function gd_wpml_get_lang_from_url($url) {
|
|
| 1383 | 1383 | |
| 1384 | 1384 | global $gd_wpml_get_languages; |
| 1385 | - if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];}
|
|
| 1385 | + if (isset($_REQUEST['lang']) && $_REQUEST['lang']) {return $_REQUEST['lang']; }
|
|
| 1386 | 1386 | |
| 1387 | 1387 | |
| 1388 | 1388 | // |
| 1389 | - $url = str_replace(array("http://","https://"),"",$url);
|
|
| 1389 | + $url = str_replace(array("http://", "https://"), "", $url);
|
|
| 1390 | 1390 | |
| 1391 | 1391 | // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
|
| 1392 | - $site_url = str_replace(array("http://","https://"),"",site_url());
|
|
| 1392 | + $site_url = str_replace(array("http://", "https://"), "", site_url());
|
|
| 1393 | 1393 | |
| 1394 | - $url = str_replace($site_url,"",$url); |
|
| 1394 | + $url = str_replace($site_url, "", $url); |
|
| 1395 | 1395 | |
| 1396 | 1396 | |
| 1397 | 1397 | $segments = explode('/', trim($url, '/'));
|
| 1398 | 1398 | |
| 1399 | 1399 | //print_r( $segments); |
| 1400 | - if($gd_wpml_get_languages){
|
|
| 1400 | + if ($gd_wpml_get_languages) {
|
|
| 1401 | 1401 | $langs = $gd_wpml_get_languages; |
| 1402 | - }else{
|
|
| 1402 | + } else {
|
|
| 1403 | 1403 | global $sitepress; |
| 1404 | 1404 | $gd_wpml_get_languages = $sitepress->get_active_languages(); |
| 1405 | 1405 | } |
@@ -1464,17 +1464,17 @@ discard block |
||
| 1464 | 1464 | $slug = $post_types[$post->post_type]['rewrite']['slug']; |
| 1465 | 1465 | |
| 1466 | 1466 | // Alter the CPT slug if WPML is set to do so |
| 1467 | - if(function_exists('icl_object_id')){
|
|
| 1468 | - if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
|
|
| 1467 | + if (function_exists('icl_object_id')) {
|
|
| 1468 | + if (gd_wpml_slug_translation_turned_on($post->post_type) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
|
|
| 1469 | 1469 | |
| 1470 | 1470 | $org_slug = $slug; |
| 1471 | - $slug = apply_filters( 'wpml_translate_single_string', |
|
| 1471 | + $slug = apply_filters('wpml_translate_single_string',
|
|
| 1472 | 1472 | $slug, |
| 1473 | 1473 | 'WordPress', |
| 1474 | - 'URL slug: ' . $slug, |
|
| 1474 | + 'URL slug: '.$slug, |
|
| 1475 | 1475 | $language_code); |
| 1476 | 1476 | |
| 1477 | - if(!$slug){$slug = $org_slug;}
|
|
| 1477 | + if (!$slug) {$slug = $org_slug; }
|
|
| 1478 | 1478 | |
| 1479 | 1479 | } |
| 1480 | 1480 | } |
@@ -1496,11 +1496,11 @@ discard block |
||
| 1496 | 1496 | } |
| 1497 | 1497 | |
| 1498 | 1498 | $post_link = trailingslashit( |
| 1499 | - preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
|
| 1499 | + preg_replace("/".preg_quote($slug, "/")."/", $slug."/%gd_taxonomy%", $post_link, 1)
|
|
| 1500 | 1500 | ); |
| 1501 | 1501 | |
| 1502 | 1502 | if ($fix_url) {
|
| 1503 | - $post_link = $site_url . $post_link; |
|
| 1503 | + $post_link = $site_url.$post_link; |
|
| 1504 | 1504 | } |
| 1505 | 1505 | |
| 1506 | 1506 | if (isset($comment_post_cache[$post->ID])) {
|
@@ -1519,12 +1519,12 @@ discard block |
||
| 1519 | 1519 | $ID = $post->ID; |
| 1520 | 1520 | $post2 = $wpdb->get_row( |
| 1521 | 1521 | $wpdb->prepare( |
| 1522 | - "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
| 1522 | + "SELECT * from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ", |
|
| 1523 | 1523 | array($post->ID) |
| 1524 | 1524 | ) |
| 1525 | 1525 | ); |
| 1526 | 1526 | |
| 1527 | - $post = (object)array_merge((array)$post, (array)$post2); |
|
| 1527 | + $post = (object) array_merge((array) $post, (array) $post2); |
|
| 1528 | 1528 | |
| 1529 | 1529 | $comment_post_cache[$post->ID] = $post; |
| 1530 | 1530 | } |
@@ -1533,7 +1533,7 @@ discard block |
||
| 1533 | 1533 | |
| 1534 | 1534 | if (false !== strpos($post_link, '%gd_taxonomy%')) {
|
| 1535 | 1535 | |
| 1536 | - if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
|
|
| 1536 | + if (apply_filters("geodir_add_location_url_to_url", get_option('geodir_add_location_url'), $post->post_type, $post)) {
|
|
| 1537 | 1537 | $location_request = ''; |
| 1538 | 1538 | |
| 1539 | 1539 | |
@@ -1547,7 +1547,7 @@ discard block |
||
| 1547 | 1547 | $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
|
| 1548 | 1548 | $post->country_slug = str_replace(']', '', $post->country_slug);
|
| 1549 | 1549 | |
| 1550 | - $post_location = (object)array('country_slug' => $post->country_slug,
|
|
| 1550 | + $post_location = (object) array('country_slug' => $post->country_slug,
|
|
| 1551 | 1551 | 'region_slug' => $post->region_slug, |
| 1552 | 1552 | 'city_slug' => $post->city_slug |
| 1553 | 1553 | ); |
@@ -1560,7 +1560,7 @@ discard block |
||
| 1560 | 1560 | |
| 1561 | 1561 | $post_location_sql = $wpdb->get_results( |
| 1562 | 1562 | $wpdb->prepare( |
| 1563 | - "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
| 1563 | + "SELECT post_locations from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ", |
|
| 1564 | 1564 | array($post->ID) |
| 1565 | 1565 | ) |
| 1566 | 1566 | ); |
@@ -1576,7 +1576,7 @@ discard block |
||
| 1576 | 1576 | $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
|
| 1577 | 1577 | $post->country_slug = str_replace(']', '', $post->country_slug);
|
| 1578 | 1578 | |
| 1579 | - $post_location = (object)array('country_slug' => $post->country_slug,
|
|
| 1579 | + $post_location = (object) array('country_slug' => $post->country_slug,
|
|
| 1580 | 1580 | 'region_slug' => $post->region_slug, |
| 1581 | 1581 | 'city_slug' => $post->city_slug |
| 1582 | 1582 | ); |
@@ -1605,7 +1605,7 @@ discard block |
||
| 1605 | 1605 | } |
| 1606 | 1606 | $location_slug[] = $city_slug; |
| 1607 | 1607 | |
| 1608 | - $location_request .= implode('/', $location_slug) . '/';
|
|
| 1608 | + $location_request .= implode('/', $location_slug).'/';
|
|
| 1609 | 1609 | } |
| 1610 | 1610 | } |
| 1611 | 1611 | |
@@ -1663,9 +1663,9 @@ discard block |
||
| 1663 | 1663 | } |
| 1664 | 1664 | $request_term = trim($request_term, '/'); |
| 1665 | 1665 | if (!empty($request_term)) |
| 1666 | - $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
|
|
| 1666 | + $post_link = str_replace('%gd_taxonomy%', $request_term.$detailurl_separator, $post_link);
|
|
| 1667 | 1667 | else |
| 1668 | - $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
|
|
| 1668 | + $post_link = str_replace('/%gd_taxonomy%', $request_term.$detailurl_separator, $post_link);
|
|
| 1669 | 1669 | //echo $post_link ; |
| 1670 | 1670 | } |
| 1671 | 1671 | // temp cache the permalink |
@@ -1740,9 +1740,9 @@ discard block |
||
| 1740 | 1740 | $url_separator = ''; |
| 1741 | 1741 | |
| 1742 | 1742 | if (get_option('permalink_structure') != '') {
|
| 1743 | - $old_listing_slug = '/' . $listing_slug . '/'; |
|
| 1743 | + $old_listing_slug = '/'.$listing_slug.'/'; |
|
| 1744 | 1744 | $request_term = implode("/", $location_terms);
|
| 1745 | - $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/'; |
|
| 1745 | + $new_listing_slug = '/'.$listing_slug.'/'.$request_term.'/'; |
|
| 1746 | 1746 | |
| 1747 | 1747 | $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug)); |
| 1748 | 1748 | } else {
|
@@ -1762,25 +1762,25 @@ discard block |
||
| 1762 | 1762 | // Alter the CPT slug if WPML is set to do so |
| 1763 | 1763 | if (function_exists('icl_object_id')) {
|
| 1764 | 1764 | $post_types = get_option('geodir_post_types');
|
| 1765 | - $post_type = str_replace("category","",$taxonomy);
|
|
| 1766 | - $post_type = str_replace("_tags","",$post_type);
|
|
| 1765 | + $post_type = str_replace("category", "", $taxonomy);
|
|
| 1766 | + $post_type = str_replace("_tags", "", $post_type);
|
|
| 1767 | 1767 | $slug = $post_types[$post_type]['rewrite']['slug']; |
| 1768 | 1768 | if (gd_wpml_slug_translation_turned_on($post_type)) {
|
| 1769 | 1769 | global $sitepress; |
| 1770 | 1770 | $default_lang = $sitepress->get_default_language(); |
| 1771 | 1771 | $language_code = gd_wpml_get_lang_from_url($termlink); |
| 1772 | - if (!$language_code ) {
|
|
| 1773 | - $language_code = $default_lang; |
|
| 1772 | + if (!$language_code) {
|
|
| 1773 | + $language_code = $default_lang; |
|
| 1774 | 1774 | } |
| 1775 | 1775 | |
| 1776 | 1776 | $org_slug = $slug; |
| 1777 | - $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code);
|
|
| 1777 | + $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: '.$slug, $language_code);
|
|
| 1778 | 1778 | |
| 1779 | 1779 | if (!$slug) {
|
| 1780 | 1780 | $slug = $org_slug; |
| 1781 | 1781 | } |
| 1782 | 1782 | |
| 1783 | - $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug ,$termlink, 1));
|
|
| 1783 | + $termlink = trailingslashit(preg_replace("/".preg_quote($org_slug, "/")."/", $slug, $termlink, 1));
|
|
| 1784 | 1784 | } |
| 1785 | 1785 | } |
| 1786 | 1786 | } |
@@ -1810,7 +1810,7 @@ discard block |
||
| 1810 | 1810 | |
| 1811 | 1811 | if (in_array($post_type, geodir_get_posttypes())) {
|
| 1812 | 1812 | if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
|
| 1813 | - if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
|
|
| 1813 | + if (geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
|
|
| 1814 | 1814 | $location_terms = array( |
| 1815 | 1815 | 'gd_country' => $post->country_slug, |
| 1816 | 1816 | 'gd_region' => $post->region_slug, |
@@ -1827,7 +1827,7 @@ discard block |
||
| 1827 | 1827 | $location_terms = implode("/", $location_terms);
|
| 1828 | 1828 | $location_terms = rtrim($location_terms, '/'); |
| 1829 | 1829 | |
| 1830 | - $link .= urldecode($location_terms) . '/'; |
|
| 1830 | + $link .= urldecode($location_terms).'/'; |
|
| 1831 | 1831 | } else {
|
| 1832 | 1832 | $link = geodir_getlink($link, $location_terms); |
| 1833 | 1833 | } |
@@ -1915,9 +1915,9 @@ discard block |
||
| 1915 | 1915 | return 0; |
| 1916 | 1916 | $where = 't.term_id = %d'; |
| 1917 | 1917 | if (!empty($taxonomy)) |
| 1918 | - return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
| 1918 | + return $wpdb->get_row($wpdb->prepare($tax_select.$where." AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
| 1919 | 1919 | else |
| 1920 | - return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
| 1920 | + return $wpdb->get_var($wpdb->prepare($select.$where, $term)); |
|
| 1921 | 1921 | } |
| 1922 | 1922 | |
| 1923 | 1923 | $term = trim(wp_unslash($term)); |
@@ -1929,7 +1929,7 @@ discard block |
||
| 1929 | 1929 | |
| 1930 | 1930 | $where_fields = array($slug); |
| 1931 | 1931 | if (!empty($taxonomy)) {
|
| 1932 | - $parent = (int)$parent; |
|
| 1932 | + $parent = (int) $parent; |
|
| 1933 | 1933 | if ($parent > 0) {
|
| 1934 | 1934 | $where_fields[] = $parent; |
| 1935 | 1935 | $else_where_fields[] = $parent; |
@@ -1993,13 +1993,13 @@ discard block |
||
| 1993 | 1993 | $post_types = geodir_get_posttypes(); |
| 1994 | 1994 | $tax_arr = array(); |
| 1995 | 1995 | foreach ($post_types as $post_type) {
|
| 1996 | - $tax_arr[] = "'" . $post_type . "category'"; |
|
| 1996 | + $tax_arr[] = "'".$post_type."category'"; |
|
| 1997 | 1997 | } |
| 1998 | 1998 | $tax_c = implode(',', $tax_arr);
|
| 1999 | 1999 | $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
|
| 2000 | 2000 | //$terms = get_terms( $taxonomy ); |
| 2001 | 2001 | |
| 2002 | - if($terms) {
|
|
| 2002 | + if ($terms) {
|
|
| 2003 | 2003 | foreach ($terms as $term) {
|
| 2004 | 2004 | $post_type = str_replace("category", "", $term->taxonomy);
|
| 2005 | 2005 | $a_terms[$post_type][] = $term; |
@@ -2007,7 +2007,7 @@ discard block |
||
| 2007 | 2007 | } |
| 2008 | 2008 | } |
| 2009 | 2009 | |
| 2010 | - if($a_terms) {
|
|
| 2010 | + if ($a_terms) {
|
|
| 2011 | 2011 | foreach ($a_terms as $pt => $t2) {
|
| 2012 | 2012 | |
| 2013 | 2013 | foreach ($t2 as $term) {
|
@@ -2032,7 +2032,7 @@ discard block |
||
| 2032 | 2032 | } |
| 2033 | 2033 | |
| 2034 | 2034 | if (is_ssl()) {
|
| 2035 | - $terms_icons = str_replace("http:","https:",$terms_icons );
|
|
| 2035 | + $terms_icons = str_replace("http:", "https:", $terms_icons);
|
|
| 2036 | 2036 | } |
| 2037 | 2037 | |
| 2038 | 2038 | return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
|
@@ -715,8 +715,9 @@ discard block |
||
| 715 | 715 | |
| 716 | 716 | if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
|
| 717 | 717 | if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
|
| 718 | - if (isset($term_icon_url['src']) && $term_icon_url['src'] != '') |
|
| 719 | - $term_icon = $term_icon_url['src']; |
|
| 718 | + if (isset($term_icon_url['src']) && $term_icon_url['src'] != '') { |
|
| 719 | + $term_icon = $term_icon_url['src']; |
|
| 720 | + } |
|
| 720 | 721 | break; |
| 721 | 722 | } |
| 722 | 723 | } |
@@ -1265,8 +1266,9 @@ discard block |
||
| 1265 | 1266 | echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>'; |
| 1266 | 1267 | } |
| 1267 | 1268 | |
| 1268 | - if (isset($taxonomies[$post_type . '_tags'])) |
|
| 1269 | - echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>'; |
|
| 1269 | + if (isset($taxonomies[$post_type . '_tags'])) { |
|
| 1270 | + echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>'; |
|
| 1271 | + } |
|
| 1270 | 1272 | |
| 1271 | 1273 | ?> |
| 1272 | 1274 | </p><?php |
@@ -1634,23 +1636,21 @@ discard block |
||
| 1634 | 1636 | if(geodir_is_page('pt')){
|
| 1635 | 1637 | $gd_page = 'pt'; |
| 1636 | 1638 | $title = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
|
| 1637 | - } |
|
| 1638 | - elseif(geodir_is_page('listing')){
|
|
| 1639 | + } elseif(geodir_is_page('listing')){
|
|
| 1639 | 1640 | $gd_page = 'listing'; |
| 1640 | 1641 | global $wp_query; |
| 1641 | 1642 | $current_term = $wp_query->get_queried_object(); |
| 1642 | 1643 | if (strpos($current_term->taxonomy,'_tags') !== false) {
|
| 1643 | 1644 | $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
|
| 1644 | - }else{
|
|
| 1645 | + } else{
|
|
| 1645 | 1646 | $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
|
| 1646 | 1647 | } |
| 1647 | 1648 | |
| 1648 | - } |
|
| 1649 | - elseif(geodir_is_page('author')){
|
|
| 1649 | + } elseif(geodir_is_page('author')){
|
|
| 1650 | 1650 | $gd_page = 'author'; |
| 1651 | 1651 | if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
|
| 1652 | 1652 | $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
|
| 1653 | - }else{
|
|
| 1653 | + } else{
|
|
| 1654 | 1654 | $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
|
| 1655 | 1655 | } |
| 1656 | 1656 | |
@@ -2074,8 +2074,9 @@ discard block |
||
| 2074 | 2074 | */ |
| 2075 | 2075 | function geodir_action_add_listing_page_title() |
| 2076 | 2076 | {
|
| 2077 | - if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '') |
|
| 2078 | - $listing_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2077 | + if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '') { |
|
| 2078 | + $listing_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2079 | + } |
|
| 2079 | 2080 | /** This action is documented in geodirectory_template_actions.php */ |
| 2080 | 2081 | $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
| 2081 | 2082 | /** This action is documented in geodirectory_template_actions.php */ |
@@ -2087,7 +2088,7 @@ discard block |
||
| 2087 | 2088 | $gd_page = 'add-listing'; |
| 2088 | 2089 | if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
|
| 2089 | 2090 | $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
|
| 2090 | - }elseif(isset($listing_type)){
|
|
| 2091 | + } elseif(isset($listing_type)){
|
|
| 2091 | 2092 | $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
|
| 2092 | 2093 | } |
| 2093 | 2094 | |
@@ -2406,8 +2407,9 @@ discard block |
||
| 2406 | 2407 | $totImg = 0; |
| 2407 | 2408 | if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
|
| 2408 | 2409 | $post = (object)$gd_session->get('listing');
|
| 2409 | - if (isset($post->post_images)) |
|
| 2410 | - $curImages = trim($post->post_images, ","); |
|
| 2410 | + if (isset($post->post_images)) { |
|
| 2411 | + $curImages = trim($post->post_images, ","); |
|
| 2412 | + } |
|
| 2411 | 2413 | |
| 2412 | 2414 | |
| 2413 | 2415 | if ($curImages != '') {
|
@@ -2435,10 +2437,13 @@ discard block |
||
| 2435 | 2437 | $totImg = count((array)$thumb_img_arr); |
| 2436 | 2438 | } |
| 2437 | 2439 | |
| 2438 | - if ($curImages != '') |
|
| 2439 | - $svalue = $curImages; // this will be initial value of the above form field. Image urls. |
|
| 2440 | - else |
|
| 2441 | - $svalue = ''; |
|
| 2440 | + if ($curImages != '') { |
|
| 2441 | + $svalue = $curImages; |
|
| 2442 | + } |
|
| 2443 | + // this will be initial value of the above form field. Image urls. |
|
| 2444 | + else { |
|
| 2445 | + $svalue = ''; |
|
| 2446 | + } |
|
| 2442 | 2447 | |
| 2443 | 2448 | $image_limit = isset($package_info->image_limit) ? $package_info->image_limit : '0'; |
| 2444 | 2449 | $show_image_input_box = ($image_limit != '0'); |
@@ -2648,8 +2653,9 @@ discard block |
||
| 2648 | 2653 | </script><?php |
| 2649 | 2654 | |
| 2650 | 2655 | global $errors; |
| 2651 | - if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim') |
|
| 2652 | - $errors->add('claim_login', LOGIN_CLAIM);
|
|
| 2656 | + if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim') { |
|
| 2657 | + $errors->add('claim_login', LOGIN_CLAIM); |
|
| 2658 | + } |
|
| 2653 | 2659 | |
| 2654 | 2660 | if (!empty($errors)) {
|
| 2655 | 2661 | foreach ($errors as $errorsObj) {
|
@@ -2753,8 +2759,9 @@ discard block |
||
| 2753 | 2759 | |
| 2754 | 2760 | if (!empty($term)) {
|
| 2755 | 2761 | $current_term = get_term_by('slug', $term, $taxonomy[0]);
|
| 2756 | - if (!empty($current_term)) |
|
| 2757 | - $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
|
|
| 2762 | + if (!empty($current_term)) { |
|
| 2763 | + $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'"; |
|
| 2764 | + } |
|
| 2758 | 2765 | } |
| 2759 | 2766 | |
| 2760 | 2767 | |
@@ -2772,7 +2779,7 @@ discard block |
||
| 2772 | 2779 | $gd_page = 'author'; |
| 2773 | 2780 | if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
|
| 2774 | 2781 | $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
|
| 2775 | - }else{
|
|
| 2782 | + } else{
|
|
| 2776 | 2783 | $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
|
| 2777 | 2784 | } |
| 2778 | 2785 | |
@@ -17,10 +17,10 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | function gd_compat_styles() |
| 19 | 19 | {
|
| 20 | - $tc = get_option('theme_compatibility_setting');
|
|
| 21 | - echo "<style id='gd-compat-styles' type='text/css'>"; |
|
| 22 | - echo $tc['geodir_theme_compat_css']; |
|
| 23 | - echo "</style>"; |
|
| 20 | + $tc = get_option('theme_compatibility_setting');
|
|
| 21 | + echo "<style id='gd-compat-styles' type='text/css'>"; |
|
| 22 | + echo $tc['geodir_theme_compat_css']; |
|
| 23 | + echo "</style>"; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | function gd_compat_script() |
| 33 | 33 | {
|
| 34 | - $tc = get_option('theme_compatibility_setting');
|
|
| 35 | - echo "<script>"; |
|
| 36 | - echo $tc['geodir_theme_compat_js']; |
|
| 37 | - echo " </script>"; |
|
| 34 | + $tc = get_option('theme_compatibility_setting');
|
|
| 35 | + echo "<script>"; |
|
| 36 | + echo $tc['geodir_theme_compat_js']; |
|
| 37 | + echo " </script>"; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | function geodir_top_content_add_dynamic() |
| 49 | 49 | {
|
| 50 | - $tc = get_option('theme_compatibility_setting');
|
|
| 51 | - echo $tc['geodir_top_content_add']; |
|
| 50 | + $tc = get_option('theme_compatibility_setting');
|
|
| 51 | + echo $tc['geodir_top_content_add']; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | function geodir_before_main_content_add_dynamic() |
| 63 | 63 | {
|
| 64 | - $tc = get_option('theme_compatibility_setting');
|
|
| 65 | - echo $tc['geodir_before_main_content_add']; |
|
| 64 | + $tc = get_option('theme_compatibility_setting');
|
|
| 65 | + echo $tc['geodir_before_main_content_add']; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | function geodir_full_page_class_dynamic() |
| 77 | 77 | {
|
| 78 | - $tc = get_option('theme_compatibility_setting');
|
|
| 79 | - return $tc['geodir_full_page_class_filter']; |
|
| 78 | + $tc = get_option('theme_compatibility_setting');
|
|
| 79 | + return $tc['geodir_full_page_class_filter']; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | function geodir_before_widget_dynamic() |
| 91 | 91 | {
|
| 92 | - $tc = get_option('theme_compatibility_setting');
|
|
| 93 | - return $tc['geodir_before_widget_filter']; |
|
| 92 | + $tc = get_option('theme_compatibility_setting');
|
|
| 93 | + return $tc['geodir_before_widget_filter']; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | function geodir_after_widget_dynamic() |
| 105 | 105 | {
|
| 106 | - $tc = get_option('theme_compatibility_setting');
|
|
| 107 | - return $tc['geodir_after_widget_filter']; |
|
| 106 | + $tc = get_option('theme_compatibility_setting');
|
|
| 107 | + return $tc['geodir_after_widget_filter']; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | function geodir_before_title_dynamic() |
| 119 | 119 | {
|
| 120 | - $tc = get_option('theme_compatibility_setting');
|
|
| 121 | - return $tc['geodir_before_title_filter']; |
|
| 120 | + $tc = get_option('theme_compatibility_setting');
|
|
| 121 | + return $tc['geodir_before_title_filter']; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -131,8 +131,8 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | function geodir_after_title_dynamic() |
| 133 | 133 | {
|
| 134 | - $tc = get_option('theme_compatibility_setting');
|
|
| 135 | - return $tc['geodir_after_title_filter']; |
|
| 134 | + $tc = get_option('theme_compatibility_setting');
|
|
| 135 | + return $tc['geodir_after_title_filter']; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
@@ -145,8 +145,8 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | function geodir_menu_li_class_dynamic() |
| 147 | 147 | {
|
| 148 | - $tc = get_option('theme_compatibility_setting');
|
|
| 149 | - return $tc['geodir_menu_li_class_filter']; |
|
| 148 | + $tc = get_option('theme_compatibility_setting');
|
|
| 149 | + return $tc['geodir_menu_li_class_filter']; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
@@ -159,8 +159,8 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | function geodir_sub_menu_ul_class_dynamic() |
| 161 | 161 | {
|
| 162 | - $tc = get_option('theme_compatibility_setting');
|
|
| 163 | - return $tc['geodir_sub_menu_ul_class_filter']; |
|
| 162 | + $tc = get_option('theme_compatibility_setting');
|
|
| 163 | + return $tc['geodir_sub_menu_ul_class_filter']; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | function geodir_sub_menu_li_class_dynamic() |
| 175 | 175 | {
|
| 176 | - $tc = get_option('theme_compatibility_setting');
|
|
| 177 | - return $tc['geodir_sub_menu_li_class_filter']; |
|
| 176 | + $tc = get_option('theme_compatibility_setting');
|
|
| 177 | + return $tc['geodir_sub_menu_li_class_filter']; |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | /** |
@@ -187,8 +187,8 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | function geodir_menu_a_class_dynamic() |
| 189 | 189 | {
|
| 190 | - $tc = get_option('theme_compatibility_setting');
|
|
| 191 | - return $tc['geodir_menu_a_class_filter']; |
|
| 190 | + $tc = get_option('theme_compatibility_setting');
|
|
| 191 | + return $tc['geodir_menu_a_class_filter']; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** |
@@ -201,8 +201,8 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | function geodir_sub_menu_a_class_dynamic() |
| 203 | 203 | {
|
| 204 | - $tc = get_option('theme_compatibility_setting');
|
|
| 205 | - return $tc['geodir_sub_menu_a_class_filter']; |
|
| 204 | + $tc = get_option('theme_compatibility_setting');
|
|
| 205 | + return $tc['geodir_sub_menu_a_class_filter']; |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -215,8 +215,8 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | function geodir_location_switcher_menu_li_class_dynamic() |
| 217 | 217 | {
|
| 218 | - $tc = get_option('theme_compatibility_setting');
|
|
| 219 | - return $tc['geodir_location_switcher_menu_li_class_filter']; |
|
| 218 | + $tc = get_option('theme_compatibility_setting');
|
|
| 219 | + return $tc['geodir_location_switcher_menu_li_class_filter']; |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | /** |
@@ -229,8 +229,8 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | function geodir_location_switcher_menu_a_class_dynamic() |
| 231 | 231 | {
|
| 232 | - $tc = get_option('theme_compatibility_setting');
|
|
| 233 | - return $tc['geodir_location_switcher_menu_a_class_filter']; |
|
| 232 | + $tc = get_option('theme_compatibility_setting');
|
|
| 233 | + return $tc['geodir_location_switcher_menu_a_class_filter']; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /** |
@@ -243,8 +243,8 @@ discard block |
||
| 243 | 243 | */ |
| 244 | 244 | function geodir_location_switcher_menu_sub_ul_class_dynamic() |
| 245 | 245 | {
|
| 246 | - $tc = get_option('theme_compatibility_setting');
|
|
| 247 | - return $tc['geodir_location_switcher_menu_sub_ul_class_filter']; |
|
| 246 | + $tc = get_option('theme_compatibility_setting');
|
|
| 247 | + return $tc['geodir_location_switcher_menu_sub_ul_class_filter']; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | /** |
@@ -257,8 +257,8 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | function geodir_location_switcher_menu_sub_li_class_dynamic() |
| 259 | 259 | {
|
| 260 | - $tc = get_option('theme_compatibility_setting');
|
|
| 261 | - return $tc['geodir_location_switcher_menu_sub_li_class_filter']; |
|
| 260 | + $tc = get_option('theme_compatibility_setting');
|
|
| 261 | + return $tc['geodir_location_switcher_menu_sub_li_class_filter']; |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | |
@@ -275,107 +275,107 @@ discard block |
||
| 275 | 275 | function geodir_content_actions_dynamic() |
| 276 | 276 | {
|
| 277 | 277 | |
| 278 | - $tc = get_option('theme_compatibility_setting');
|
|
| 278 | + $tc = get_option('theme_compatibility_setting');
|
|
| 279 | 279 | //print_r($tc); |
| 280 | - if (empty($tc)) {
|
|
| 281 | - return; |
|
| 282 | - } |
|
| 283 | - |
|
| 284 | - //php |
|
| 285 | - if (!empty($tc['geodir_theme_compat_code'])) {
|
|
| 286 | - include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
|
|
| 287 | - } |
|
| 288 | - |
|
| 289 | - //geodir_full_page_class |
|
| 290 | - if (!empty($tc['geodir_full_page_class_filter'])) {
|
|
| 291 | - add_filter('geodir_full_page_class', 'geodir_full_page_class_dynamic', 10);
|
|
| 292 | - } |
|
| 293 | - |
|
| 294 | - //widget before filter |
|
| 295 | - if (!empty($tc['geodir_before_widget_filter'])) {
|
|
| 296 | - add_filter('geodir_before_widget', 'geodir_before_widget_dynamic', 10);
|
|
| 297 | - } |
|
| 298 | - |
|
| 299 | - //widget after filter |
|
| 300 | - if (!empty($tc['geodir_after_widget_filter'])) {
|
|
| 301 | - add_filter('geodir_after_widget', 'geodir_after_widget_dynamic', 10);
|
|
| 302 | - } |
|
| 303 | - |
|
| 304 | - //widget before title filter |
|
| 305 | - if (!empty($tc['geodir_before_title_filter'])) {
|
|
| 306 | - add_filter('geodir_before_title', 'geodir_before_title_dynamic', 10);
|
|
| 307 | - } |
|
| 308 | - |
|
| 309 | - //widget before title filter |
|
| 310 | - if (!empty($tc['geodir_after_title_filter'])) {
|
|
| 311 | - add_filter('geodir_after_title', 'geodir_after_title_dynamic', 10);
|
|
| 312 | - } |
|
| 313 | - |
|
| 314 | - //menu li class |
|
| 315 | - if (!empty($tc['geodir_menu_li_class_filter'])) {
|
|
| 316 | - add_filter('geodir_menu_li_class', 'geodir_menu_li_class_dynamic', 10);
|
|
| 317 | - } |
|
| 318 | - |
|
| 319 | - //menu ul class |
|
| 320 | - if (!empty($tc['geodir_sub_menu_ul_class_filter'])) {
|
|
| 321 | - add_filter('geodir_sub_menu_ul_class', 'geodir_sub_menu_ul_class_dynamic', 10);
|
|
| 322 | - } |
|
| 323 | - |
|
| 324 | - //menu sub li class |
|
| 325 | - if (!empty($tc['geodir_sub_menu_li_class_filter'])) {
|
|
| 326 | - add_filter('geodir_sub_menu_li_class', 'geodir_sub_menu_li_class_dynamic', 10);
|
|
| 327 | - } |
|
| 328 | - |
|
| 329 | - //menu a class |
|
| 330 | - if (!empty($tc['geodir_menu_a_class_filter'])) {
|
|
| 331 | - add_filter('geodir_menu_a_class', 'geodir_menu_a_class_dynamic', 10);
|
|
| 332 | - } |
|
| 333 | - |
|
| 334 | - //menu sub a class |
|
| 335 | - if (!empty($tc['geodir_sub_menu_a_class_filter'])) {
|
|
| 336 | - add_filter('geodir_sub_menu_a_class', 'geodir_sub_menu_a_class_dynamic', 10);
|
|
| 337 | - } |
|
| 338 | - |
|
| 339 | - //location menu li class |
|
| 340 | - if (!empty($tc['geodir_location_switcher_menu_li_class_filter'])) {
|
|
| 341 | - add_filter('geodir_location_switcher_menu_li_class', 'geodir_location_switcher_menu_li_class_dynamic', 10);
|
|
| 342 | - } |
|
| 343 | - |
|
| 344 | - //location menu sub ul class |
|
| 345 | - if (!empty($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
|
|
| 346 | - add_filter('geodir_location_switcher_menu_sub_ul_class', 'geodir_location_switcher_menu_sub_ul_class_dynamic', 10);
|
|
| 347 | - } |
|
| 348 | - |
|
| 349 | - //location menu sub li class |
|
| 350 | - if (!empty($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
|
|
| 351 | - add_filter('geodir_location_switcher_menu_sub_li_class', 'geodir_location_switcher_menu_sub_li_class_dynamic', 10);
|
|
| 352 | - } |
|
| 353 | - |
|
| 354 | - //location menu a class |
|
| 355 | - if (!empty($tc['geodir_location_switcher_menu_a_class_filter'])) {
|
|
| 356 | - add_filter('geodir_location_switcher_menu_a_class', 'geodir_location_switcher_menu_a_class_dynamic', 10);
|
|
| 357 | - } |
|
| 358 | - |
|
| 359 | - // compat styles |
|
| 360 | - if (!empty($tc['geodir_theme_compat_css'])) {
|
|
| 361 | - add_action('wp_head', 'gd_compat_styles');
|
|
| 362 | - } |
|
| 363 | - |
|
| 364 | - // compat js |
|
| 365 | - if (!empty($tc['geodir_theme_compat_js'])) {
|
|
| 366 | - add_action('wp_footer', 'gd_compat_script');
|
|
| 367 | - } |
|
| 368 | - |
|
| 369 | - |
|
| 370 | - // geodir_top_content_add |
|
| 371 | - if (!empty($tc['geodir_top_content_add'])) {
|
|
| 372 | - add_action('geodir_top_content', 'geodir_top_content_add_dynamic', 10, 1);
|
|
| 373 | - } |
|
| 374 | - |
|
| 375 | - // geodir_before_main_content_add |
|
| 376 | - if (!empty($tc['geodir_before_main_content_add'])) {
|
|
| 377 | - add_action('geodir_before_main_content', 'geodir_before_main_content_add_dynamic', 10, 1);
|
|
| 378 | - } |
|
| 280 | + if (empty($tc)) {
|
|
| 281 | + return; |
|
| 282 | + } |
|
| 283 | + |
|
| 284 | + //php |
|
| 285 | + if (!empty($tc['geodir_theme_compat_code'])) {
|
|
| 286 | + include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
|
|
| 287 | + } |
|
| 288 | + |
|
| 289 | + //geodir_full_page_class |
|
| 290 | + if (!empty($tc['geodir_full_page_class_filter'])) {
|
|
| 291 | + add_filter('geodir_full_page_class', 'geodir_full_page_class_dynamic', 10);
|
|
| 292 | + } |
|
| 293 | + |
|
| 294 | + //widget before filter |
|
| 295 | + if (!empty($tc['geodir_before_widget_filter'])) {
|
|
| 296 | + add_filter('geodir_before_widget', 'geodir_before_widget_dynamic', 10);
|
|
| 297 | + } |
|
| 298 | + |
|
| 299 | + //widget after filter |
|
| 300 | + if (!empty($tc['geodir_after_widget_filter'])) {
|
|
| 301 | + add_filter('geodir_after_widget', 'geodir_after_widget_dynamic', 10);
|
|
| 302 | + } |
|
| 303 | + |
|
| 304 | + //widget before title filter |
|
| 305 | + if (!empty($tc['geodir_before_title_filter'])) {
|
|
| 306 | + add_filter('geodir_before_title', 'geodir_before_title_dynamic', 10);
|
|
| 307 | + } |
|
| 308 | + |
|
| 309 | + //widget before title filter |
|
| 310 | + if (!empty($tc['geodir_after_title_filter'])) {
|
|
| 311 | + add_filter('geodir_after_title', 'geodir_after_title_dynamic', 10);
|
|
| 312 | + } |
|
| 313 | + |
|
| 314 | + //menu li class |
|
| 315 | + if (!empty($tc['geodir_menu_li_class_filter'])) {
|
|
| 316 | + add_filter('geodir_menu_li_class', 'geodir_menu_li_class_dynamic', 10);
|
|
| 317 | + } |
|
| 318 | + |
|
| 319 | + //menu ul class |
|
| 320 | + if (!empty($tc['geodir_sub_menu_ul_class_filter'])) {
|
|
| 321 | + add_filter('geodir_sub_menu_ul_class', 'geodir_sub_menu_ul_class_dynamic', 10);
|
|
| 322 | + } |
|
| 323 | + |
|
| 324 | + //menu sub li class |
|
| 325 | + if (!empty($tc['geodir_sub_menu_li_class_filter'])) {
|
|
| 326 | + add_filter('geodir_sub_menu_li_class', 'geodir_sub_menu_li_class_dynamic', 10);
|
|
| 327 | + } |
|
| 328 | + |
|
| 329 | + //menu a class |
|
| 330 | + if (!empty($tc['geodir_menu_a_class_filter'])) {
|
|
| 331 | + add_filter('geodir_menu_a_class', 'geodir_menu_a_class_dynamic', 10);
|
|
| 332 | + } |
|
| 333 | + |
|
| 334 | + //menu sub a class |
|
| 335 | + if (!empty($tc['geodir_sub_menu_a_class_filter'])) {
|
|
| 336 | + add_filter('geodir_sub_menu_a_class', 'geodir_sub_menu_a_class_dynamic', 10);
|
|
| 337 | + } |
|
| 338 | + |
|
| 339 | + //location menu li class |
|
| 340 | + if (!empty($tc['geodir_location_switcher_menu_li_class_filter'])) {
|
|
| 341 | + add_filter('geodir_location_switcher_menu_li_class', 'geodir_location_switcher_menu_li_class_dynamic', 10);
|
|
| 342 | + } |
|
| 343 | + |
|
| 344 | + //location menu sub ul class |
|
| 345 | + if (!empty($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
|
|
| 346 | + add_filter('geodir_location_switcher_menu_sub_ul_class', 'geodir_location_switcher_menu_sub_ul_class_dynamic', 10);
|
|
| 347 | + } |
|
| 348 | + |
|
| 349 | + //location menu sub li class |
|
| 350 | + if (!empty($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
|
|
| 351 | + add_filter('geodir_location_switcher_menu_sub_li_class', 'geodir_location_switcher_menu_sub_li_class_dynamic', 10);
|
|
| 352 | + } |
|
| 353 | + |
|
| 354 | + //location menu a class |
|
| 355 | + if (!empty($tc['geodir_location_switcher_menu_a_class_filter'])) {
|
|
| 356 | + add_filter('geodir_location_switcher_menu_a_class', 'geodir_location_switcher_menu_a_class_dynamic', 10);
|
|
| 357 | + } |
|
| 358 | + |
|
| 359 | + // compat styles |
|
| 360 | + if (!empty($tc['geodir_theme_compat_css'])) {
|
|
| 361 | + add_action('wp_head', 'gd_compat_styles');
|
|
| 362 | + } |
|
| 363 | + |
|
| 364 | + // compat js |
|
| 365 | + if (!empty($tc['geodir_theme_compat_js'])) {
|
|
| 366 | + add_action('wp_footer', 'gd_compat_script');
|
|
| 367 | + } |
|
| 368 | + |
|
| 369 | + |
|
| 370 | + // geodir_top_content_add |
|
| 371 | + if (!empty($tc['geodir_top_content_add'])) {
|
|
| 372 | + add_action('geodir_top_content', 'geodir_top_content_add_dynamic', 10, 1);
|
|
| 373 | + } |
|
| 374 | + |
|
| 375 | + // geodir_before_main_content_add |
|
| 376 | + if (!empty($tc['geodir_before_main_content_add'])) {
|
|
| 377 | + add_action('geodir_before_main_content', 'geodir_before_main_content_add_dynamic', 10, 1);
|
|
| 378 | + } |
|
| 379 | 379 | |
| 380 | 380 | |
| 381 | 381 | } |
@@ -398,23 +398,23 @@ discard block |
||
| 398 | 398 | */ |
| 399 | 399 | function geodir_action_wrapper_open($type = '', $id = '', $class = '') |
| 400 | 400 | {
|
| 401 | - $tc = get_option('theme_compatibility_setting');
|
|
| 402 | - if (!empty($tc['geodir_wrapper_open_replace'])) {
|
|
| 403 | - $text = $tc['geodir_wrapper_open_replace']; |
|
| 404 | - } else {
|
|
| 405 | - $text = '<div id="[id]" class="[class]">'; |
|
| 406 | - } |
|
| 401 | + $tc = get_option('theme_compatibility_setting');
|
|
| 402 | + if (!empty($tc['geodir_wrapper_open_replace'])) {
|
|
| 403 | + $text = $tc['geodir_wrapper_open_replace']; |
|
| 404 | + } else {
|
|
| 405 | + $text = '<div id="[id]" class="[class]">'; |
|
| 406 | + } |
|
| 407 | 407 | |
| 408 | - if (!empty($tc['geodir_wrapper_open_id'])) {
|
|
| 409 | - $id = $tc['geodir_wrapper_open_id']; |
|
| 410 | - } |
|
| 411 | - if (!empty($tc['geodir_wrapper_open_class'])) {
|
|
| 412 | - $class = $tc['geodir_wrapper_open_class']; |
|
| 413 | - } |
|
| 408 | + if (!empty($tc['geodir_wrapper_open_id'])) {
|
|
| 409 | + $id = $tc['geodir_wrapper_open_id']; |
|
| 410 | + } |
|
| 411 | + if (!empty($tc['geodir_wrapper_open_class'])) {
|
|
| 412 | + $class = $tc['geodir_wrapper_open_class']; |
|
| 413 | + } |
|
| 414 | 414 | |
| 415 | - $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
|
|
| 415 | + $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
|
|
| 416 | 416 | |
| 417 | - echo $text; |
|
| 417 | + echo $text; |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | // action for adding the wrapperdiv closing tag |
@@ -429,14 +429,14 @@ discard block |
||
| 429 | 429 | */ |
| 430 | 430 | function geodir_action_wrapper_close($type = '') |
| 431 | 431 | {
|
| 432 | - $tc = get_option('theme_compatibility_setting');
|
|
| 433 | - if (!empty($tc['geodir_wrapper_close_replace'])) {
|
|
| 434 | - $text = $tc['geodir_wrapper_close_replace']; |
|
| 435 | - } else {
|
|
| 436 | - $text = '</div><!-- wrapper ends here-->'; |
|
| 437 | - } |
|
| 432 | + $tc = get_option('theme_compatibility_setting');
|
|
| 433 | + if (!empty($tc['geodir_wrapper_close_replace'])) {
|
|
| 434 | + $text = $tc['geodir_wrapper_close_replace']; |
|
| 435 | + } else {
|
|
| 436 | + $text = '</div><!-- wrapper ends here-->'; |
|
| 437 | + } |
|
| 438 | 438 | |
| 439 | - echo $text; |
|
| 439 | + echo $text; |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | // action for adding the content div opening tag |
@@ -452,35 +452,35 @@ discard block |
||
| 452 | 452 | */ |
| 453 | 453 | function geodir_action_wrapper_content_open($type = '', $id = '', $class = '') |
| 454 | 454 | {
|
| 455 | - if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
|
|
| 456 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 457 | - } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
|
|
| 458 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 459 | - } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
|
|
| 460 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 461 | - } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
|
|
| 462 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 463 | - } else {
|
|
| 464 | - $width_css = ''; |
|
| 465 | - } |
|
| 466 | - |
|
| 467 | - $tc = get_option('theme_compatibility_setting');
|
|
| 468 | - if (!empty($tc['geodir_wrapper_content_open_replace'])) {
|
|
| 469 | - $text = $tc['geodir_wrapper_content_open_replace']; |
|
| 470 | - } else {
|
|
| 471 | - $text = '<div id="[id]" class="[class]" role="main" [width_css]>'; |
|
| 472 | - } |
|
| 473 | - |
|
| 474 | - if (!empty($tc['geodir_wrapper_content_open_id'])) {
|
|
| 475 | - $id = $tc['geodir_wrapper_content_open_id']; |
|
| 476 | - } |
|
| 477 | - if (!empty($tc['geodir_wrapper_content_open_class'])) {
|
|
| 478 | - $class = $tc['geodir_wrapper_content_open_class']; |
|
| 479 | - } |
|
| 480 | - |
|
| 481 | - $text = str_replace(array("[id]", "[class]", "[width_css]"), array($id, $class, $width_css), $text);
|
|
| 482 | - |
|
| 483 | - echo $text; |
|
| 455 | + if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
|
|
| 456 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 457 | + } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
|
|
| 458 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 459 | + } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
|
|
| 460 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 461 | + } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
|
|
| 462 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 463 | + } else {
|
|
| 464 | + $width_css = ''; |
|
| 465 | + } |
|
| 466 | + |
|
| 467 | + $tc = get_option('theme_compatibility_setting');
|
|
| 468 | + if (!empty($tc['geodir_wrapper_content_open_replace'])) {
|
|
| 469 | + $text = $tc['geodir_wrapper_content_open_replace']; |
|
| 470 | + } else {
|
|
| 471 | + $text = '<div id="[id]" class="[class]" role="main" [width_css]>'; |
|
| 472 | + } |
|
| 473 | + |
|
| 474 | + if (!empty($tc['geodir_wrapper_content_open_id'])) {
|
|
| 475 | + $id = $tc['geodir_wrapper_content_open_id']; |
|
| 476 | + } |
|
| 477 | + if (!empty($tc['geodir_wrapper_content_open_class'])) {
|
|
| 478 | + $class = $tc['geodir_wrapper_content_open_class']; |
|
| 479 | + } |
|
| 480 | + |
|
| 481 | + $text = str_replace(array("[id]", "[class]", "[width_css]"), array($id, $class, $width_css), $text);
|
|
| 482 | + |
|
| 483 | + echo $text; |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | // action for adding the primary div closing tag |
@@ -494,13 +494,13 @@ discard block |
||
| 494 | 494 | */ |
| 495 | 495 | function geodir_action_wrapper_content_close($type = '') |
| 496 | 496 | {
|
| 497 | - $tc = get_option('theme_compatibility_setting');
|
|
| 498 | - if (!empty($tc['geodir_wrapper_content_close_replace'])) {
|
|
| 499 | - $text = $tc['geodir_wrapper_content_close_replace']; |
|
| 500 | - } else {
|
|
| 501 | - $text = '</div><!-- content ends here-->'; |
|
| 502 | - } |
|
| 503 | - echo $text; |
|
| 497 | + $tc = get_option('theme_compatibility_setting');
|
|
| 498 | + if (!empty($tc['geodir_wrapper_content_close_replace'])) {
|
|
| 499 | + $text = $tc['geodir_wrapper_content_close_replace']; |
|
| 500 | + } else {
|
|
| 501 | + $text = '</div><!-- content ends here-->'; |
|
| 502 | + } |
|
| 503 | + echo $text; |
|
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | // action for adding the <article> opening tag |
@@ -518,24 +518,24 @@ discard block |
||
| 518 | 518 | */ |
| 519 | 519 | function geodir_action_article_open($type = '', $id = '', $class = '', $itemtype = '') |
| 520 | 520 | {
|
| 521 | - $class = implode(" ", $class);
|
|
| 522 | - $tc = get_option('theme_compatibility_setting');
|
|
| 523 | - if (!empty($tc['geodir_article_open_replace'])) {
|
|
| 524 | - $text = $tc['geodir_article_open_replace']; |
|
| 525 | - } else {
|
|
| 526 | - $text = '<article id="[id]" class="[class]" >'; |
|
| 527 | - } |
|
| 521 | + $class = implode(" ", $class);
|
|
| 522 | + $tc = get_option('theme_compatibility_setting');
|
|
| 523 | + if (!empty($tc['geodir_article_open_replace'])) {
|
|
| 524 | + $text = $tc['geodir_article_open_replace']; |
|
| 525 | + } else {
|
|
| 526 | + $text = '<article id="[id]" class="[class]" >'; |
|
| 527 | + } |
|
| 528 | 528 | |
| 529 | - if (!empty($tc['geodir_article_open_id'])) {
|
|
| 530 | - $id = $tc['geodir_article_open_id']; |
|
| 531 | - } |
|
| 532 | - if (!empty($tc['geodir_article_open_class'])) {
|
|
| 533 | - $class = $tc['geodir_article_open_class']; |
|
| 534 | - } |
|
| 529 | + if (!empty($tc['geodir_article_open_id'])) {
|
|
| 530 | + $id = $tc['geodir_article_open_id']; |
|
| 531 | + } |
|
| 532 | + if (!empty($tc['geodir_article_open_class'])) {
|
|
| 533 | + $class = $tc['geodir_article_open_class']; |
|
| 534 | + } |
|
| 535 | 535 | |
| 536 | - $text = str_replace(array("[id]", "[class]", "[itemtype]"), array($id, $class, $itemtype), $text);
|
|
| 536 | + $text = str_replace(array("[id]", "[class]", "[itemtype]"), array($id, $class, $itemtype), $text);
|
|
| 537 | 537 | |
| 538 | - echo $text; |
|
| 538 | + echo $text; |
|
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | // action for adding the primary div closing tag |
@@ -549,13 +549,13 @@ discard block |
||
| 549 | 549 | */ |
| 550 | 550 | function geodir_action_article_close($type = '') |
| 551 | 551 | {
|
| 552 | - $tc = get_option('theme_compatibility_setting');
|
|
| 553 | - if (!empty($tc['geodir_article_close_replace'])) {
|
|
| 554 | - $text = $tc['geodir_article_close_replace']; |
|
| 555 | - } else {
|
|
| 556 | - $text = '</article><!-- article ends here-->'; |
|
| 557 | - } |
|
| 558 | - echo $text; |
|
| 552 | + $tc = get_option('theme_compatibility_setting');
|
|
| 553 | + if (!empty($tc['geodir_article_close_replace'])) {
|
|
| 554 | + $text = $tc['geodir_article_close_replace']; |
|
| 555 | + } else {
|
|
| 556 | + $text = '</article><!-- article ends here-->'; |
|
| 557 | + } |
|
| 558 | + echo $text; |
|
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | // action for adding the sidebar opening tag |
@@ -572,35 +572,35 @@ discard block |
||
| 572 | 572 | */ |
| 573 | 573 | function geodir_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '') |
| 574 | 574 | {
|
| 575 | - if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
|
|
| 576 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 577 | - } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
|
|
| 578 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 579 | - } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
|
|
| 580 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 581 | - } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
|
|
| 582 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 583 | - } else {
|
|
| 584 | - $width_css = ''; |
|
| 585 | - } |
|
| 586 | - |
|
| 587 | - $tc = get_option('theme_compatibility_setting');
|
|
| 588 | - if (!empty($tc['geodir_sidebar_right_open_replace'])) {
|
|
| 589 | - $text = $tc['geodir_sidebar_right_open_replace']; |
|
| 590 | - } else {
|
|
| 591 | - $text = '<aside id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'; |
|
| 592 | - } |
|
| 593 | - |
|
| 594 | - if (!empty($tc['geodir_sidebar_right_open_id'])) {
|
|
| 595 | - $id = $tc['geodir_sidebar_right_open_id']; |
|
| 596 | - } |
|
| 597 | - if (!empty($tc['geodir_sidebar_right_open_class'])) {
|
|
| 598 | - $class = $tc['geodir_sidebar_right_open_class']; |
|
| 599 | - } |
|
| 600 | - |
|
| 601 | - $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
|
|
| 602 | - |
|
| 603 | - echo $text; |
|
| 575 | + if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
|
|
| 576 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 577 | + } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
|
|
| 578 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 579 | + } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
|
|
| 580 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 581 | + } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
|
|
| 582 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 583 | + } else {
|
|
| 584 | + $width_css = ''; |
|
| 585 | + } |
|
| 586 | + |
|
| 587 | + $tc = get_option('theme_compatibility_setting');
|
|
| 588 | + if (!empty($tc['geodir_sidebar_right_open_replace'])) {
|
|
| 589 | + $text = $tc['geodir_sidebar_right_open_replace']; |
|
| 590 | + } else {
|
|
| 591 | + $text = '<aside id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'; |
|
| 592 | + } |
|
| 593 | + |
|
| 594 | + if (!empty($tc['geodir_sidebar_right_open_id'])) {
|
|
| 595 | + $id = $tc['geodir_sidebar_right_open_id']; |
|
| 596 | + } |
|
| 597 | + if (!empty($tc['geodir_sidebar_right_open_class'])) {
|
|
| 598 | + $class = $tc['geodir_sidebar_right_open_class']; |
|
| 599 | + } |
|
| 600 | + |
|
| 601 | + $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
|
|
| 602 | + |
|
| 603 | + echo $text; |
|
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | // action for adding the primary div closing tag |
@@ -614,13 +614,13 @@ discard block |
||
| 614 | 614 | */ |
| 615 | 615 | function geodir_action_sidebar_right_close($type = '') |
| 616 | 616 | {
|
| 617 | - $tc = get_option('theme_compatibility_setting');
|
|
| 618 | - if (!empty($tc['geodir_sidebar_right_close_replace'])) {
|
|
| 619 | - $text = $tc['geodir_sidebar_right_close_replace']; |
|
| 620 | - } else {
|
|
| 621 | - $text = '</aside><!-- sidebar ends here-->'; |
|
| 622 | - } |
|
| 623 | - echo $text; |
|
| 617 | + $tc = get_option('theme_compatibility_setting');
|
|
| 618 | + if (!empty($tc['geodir_sidebar_right_close_replace'])) {
|
|
| 619 | + $text = $tc['geodir_sidebar_right_close_replace']; |
|
| 620 | + } else {
|
|
| 621 | + $text = '</aside><!-- sidebar ends here-->'; |
|
| 622 | + } |
|
| 623 | + echo $text; |
|
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | |
@@ -641,121 +641,121 @@ discard block |
||
| 641 | 641 | */ |
| 642 | 642 | function geodir_action_geodir_set_preview_post() |
| 643 | 643 | {
|
| 644 | - global $post, $preview, $gd_session; |
|
| 645 | - $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend |
|
| 646 | - if (!$preview || $is_backend_preview) {
|
|
| 647 | - return; |
|
| 648 | - }// bail if not previewing |
|
| 649 | - |
|
| 650 | - $listing_type = isset($_REQUEST['listing_type']) ? sanitize_text_field($_REQUEST['listing_type']) : ''; |
|
| 651 | - |
|
| 652 | - $fields_info = geodir_get_custom_fields_type($listing_type); |
|
| 653 | - |
|
| 654 | - foreach ($_REQUEST as $pkey => $pval) {
|
|
| 655 | - if ($pkey == 'geodir_video') {
|
|
| 656 | - $tags = '<iframe>'; |
|
| 657 | - } else if ($pkey == 'post_desc') {
|
|
| 658 | - $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'; |
|
| 659 | - } else if (is_array($fields_info) && isset($fields_info[$pkey]) && ($fields_info[$pkey] == 'textarea' || $fields_info[$pkey] == 'html')) {
|
|
| 660 | - $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'; |
|
| 661 | - } else if (is_array($_REQUEST[$pkey])) {
|
|
| 662 | - $tags = 'skip_field'; |
|
| 663 | - } else {
|
|
| 664 | - $tags = ''; |
|
| 665 | - } |
|
| 666 | - /** |
|
| 667 | - * Allows the filtering of the allowed HTML tags per field when submitting from frontend add listing page. |
|
| 668 | - * |
|
| 669 | - * @since 1.0.0 |
|
| 670 | - * @param string $tags The allowed HTML tags for the field. Can be many things, for example the description allows these tags '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'. |
|
| 671 | - * @param string|array $pkey The field id/name. If array then value is set as "skip_field". |
|
| 672 | - */ |
|
| 673 | - $tags = apply_filters('geodir_save_post_key', $tags, $pkey);
|
|
| 674 | - |
|
| 675 | - if ($tags != 'skip_field') {
|
|
| 676 | - $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags); |
|
| 677 | - } |
|
| 678 | - } |
|
| 679 | - |
|
| 680 | - $post = (object)$_REQUEST; |
|
| 681 | - |
|
| 682 | - |
|
| 683 | - if (isset($post->video)) {
|
|
| 684 | - $post->video = stripslashes($post->video); |
|
| 685 | - } |
|
| 686 | - |
|
| 687 | - if (isset($post->Video2)) {
|
|
| 688 | - $post->Video2 = stripslashes($post->Video2); |
|
| 689 | - } |
|
| 690 | - |
|
| 691 | - $post_type = $post->listing_type; |
|
| 692 | - $post_type_info = get_post_type_object($post_type); |
|
| 693 | - |
|
| 694 | - $listing_label = $post_type_info->labels->singular_name; |
|
| 695 | - |
|
| 696 | - $term_icon = ''; |
|
| 697 | - |
|
| 698 | - if (!empty($post->post_category)) {
|
|
| 699 | - foreach ($post->post_category as $post_taxonomy => $post_term) {
|
|
| 700 | - |
|
| 701 | - if ($post_term != '' && !is_array($post_term)) {
|
|
| 702 | - $post_term = explode(',', trim($post_term, ','));
|
|
| 703 | - } |
|
| 644 | + global $post, $preview, $gd_session; |
|
| 645 | + $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend |
|
| 646 | + if (!$preview || $is_backend_preview) {
|
|
| 647 | + return; |
|
| 648 | + }// bail if not previewing |
|
| 649 | + |
|
| 650 | + $listing_type = isset($_REQUEST['listing_type']) ? sanitize_text_field($_REQUEST['listing_type']) : ''; |
|
| 651 | + |
|
| 652 | + $fields_info = geodir_get_custom_fields_type($listing_type); |
|
| 653 | + |
|
| 654 | + foreach ($_REQUEST as $pkey => $pval) {
|
|
| 655 | + if ($pkey == 'geodir_video') {
|
|
| 656 | + $tags = '<iframe>'; |
|
| 657 | + } else if ($pkey == 'post_desc') {
|
|
| 658 | + $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'; |
|
| 659 | + } else if (is_array($fields_info) && isset($fields_info[$pkey]) && ($fields_info[$pkey] == 'textarea' || $fields_info[$pkey] == 'html')) {
|
|
| 660 | + $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'; |
|
| 661 | + } else if (is_array($_REQUEST[$pkey])) {
|
|
| 662 | + $tags = 'skip_field'; |
|
| 663 | + } else {
|
|
| 664 | + $tags = ''; |
|
| 665 | + } |
|
| 666 | + /** |
|
| 667 | + * Allows the filtering of the allowed HTML tags per field when submitting from frontend add listing page. |
|
| 668 | + * |
|
| 669 | + * @since 1.0.0 |
|
| 670 | + * @param string $tags The allowed HTML tags for the field. Can be many things, for example the description allows these tags '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'. |
|
| 671 | + * @param string|array $pkey The field id/name. If array then value is set as "skip_field". |
|
| 672 | + */ |
|
| 673 | + $tags = apply_filters('geodir_save_post_key', $tags, $pkey);
|
|
| 674 | + |
|
| 675 | + if ($tags != 'skip_field') {
|
|
| 676 | + $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags); |
|
| 677 | + } |
|
| 678 | + } |
|
| 679 | + |
|
| 680 | + $post = (object)$_REQUEST; |
|
| 681 | + |
|
| 682 | + |
|
| 683 | + if (isset($post->video)) {
|
|
| 684 | + $post->video = stripslashes($post->video); |
|
| 685 | + } |
|
| 686 | + |
|
| 687 | + if (isset($post->Video2)) {
|
|
| 688 | + $post->Video2 = stripslashes($post->Video2); |
|
| 689 | + } |
|
| 690 | + |
|
| 691 | + $post_type = $post->listing_type; |
|
| 692 | + $post_type_info = get_post_type_object($post_type); |
|
| 693 | + |
|
| 694 | + $listing_label = $post_type_info->labels->singular_name; |
|
| 695 | + |
|
| 696 | + $term_icon = ''; |
|
| 697 | + |
|
| 698 | + if (!empty($post->post_category)) {
|
|
| 699 | + foreach ($post->post_category as $post_taxonomy => $post_term) {
|
|
| 700 | + |
|
| 701 | + if ($post_term != '' && !is_array($post_term)) {
|
|
| 702 | + $post_term = explode(',', trim($post_term, ','));
|
|
| 703 | + } |
|
| 704 | 704 | |
| 705 | - if (is_array($post_term)) {
|
|
| 706 | - $post_term = array_unique($post_term); |
|
| 707 | - } |
|
| 705 | + if (is_array($post_term)) {
|
|
| 706 | + $post_term = array_unique($post_term); |
|
| 707 | + } |
|
| 708 | 708 | |
| 709 | - if (!empty($post_term)) {
|
|
| 710 | - foreach ($post_term as $cat_id) {
|
|
| 711 | - $cat_id = trim($cat_id); |
|
| 712 | - |
|
| 713 | - if ($cat_id != '') {
|
|
| 714 | - $term_icon = get_option('geodir_default_marker_icon');
|
|
| 715 | - |
|
| 716 | - if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
|
|
| 717 | - if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
|
|
| 718 | - if (isset($term_icon_url['src']) && $term_icon_url['src'] != '') |
|
| 719 | - $term_icon = $term_icon_url['src']; |
|
| 720 | - break; |
|
| 721 | - } |
|
| 722 | - } |
|
| 723 | - } |
|
| 724 | - } |
|
| 725 | - } |
|
| 726 | - } |
|
| 727 | - } |
|
| 709 | + if (!empty($post_term)) {
|
|
| 710 | + foreach ($post_term as $cat_id) {
|
|
| 711 | + $cat_id = trim($cat_id); |
|
| 712 | + |
|
| 713 | + if ($cat_id != '') {
|
|
| 714 | + $term_icon = get_option('geodir_default_marker_icon');
|
|
| 715 | + |
|
| 716 | + if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
|
|
| 717 | + if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
|
|
| 718 | + if (isset($term_icon_url['src']) && $term_icon_url['src'] != '') |
|
| 719 | + $term_icon = $term_icon_url['src']; |
|
| 720 | + break; |
|
| 721 | + } |
|
| 722 | + } |
|
| 723 | + } |
|
| 724 | + } |
|
| 725 | + } |
|
| 726 | + } |
|
| 727 | + } |
|
| 728 | 728 | |
| 729 | - $post_latitude = isset($post->post_latitude) ? $post->post_latitude : ''; |
|
| 730 | - $post_longitude = isset($post->post_longitude) ? $post->post_longitude : ''; |
|
| 729 | + $post_latitude = isset($post->post_latitude) ? $post->post_latitude : ''; |
|
| 730 | + $post_longitude = isset($post->post_longitude) ? $post->post_longitude : ''; |
|
| 731 | 731 | |
| 732 | - $srcharr = array("'", "/", "-", '"', '\\');
|
|
| 733 | - $replarr = array("′", "⁄", "–", "“", '');
|
|
| 732 | + $srcharr = array("'", "/", "-", '"', '\\');
|
|
| 733 | + $replarr = array("′", "⁄", "–", "“", '');
|
|
| 734 | 734 | |
| 735 | - $json_title = str_replace($srcharr, $replarr, $post->post_title); |
|
| 735 | + $json_title = str_replace($srcharr, $replarr, $post->post_title); |
|
| 736 | 736 | |
| 737 | - $json = '{';
|
|
| 738 | - $json .= '"post_preview": "1",'; |
|
| 739 | - $json .= '"t": "' . $json_title . '",'; |
|
| 740 | - $json .= '"lt": "' . $post_latitude . '",'; |
|
| 741 | - $json .= '"ln": "' . $post_longitude . '",'; |
|
| 742 | - $json .= '"i":"' . $term_icon . '"'; |
|
| 743 | - $json .= '}'; |
|
| 737 | + $json = '{';
|
|
| 738 | + $json .= '"post_preview": "1",'; |
|
| 739 | + $json .= '"t": "' . $json_title . '",'; |
|
| 740 | + $json .= '"lt": "' . $post_latitude . '",'; |
|
| 741 | + $json .= '"ln": "' . $post_longitude . '",'; |
|
| 742 | + $json .= '"i":"' . $term_icon . '"'; |
|
| 743 | + $json .= '}'; |
|
| 744 | 744 | |
| 745 | - $post->marker_json = $json; |
|
| 745 | + $post->marker_json = $json; |
|
| 746 | 746 | |
| 747 | - $gd_session->set('listing', $_REQUEST);
|
|
| 747 | + $gd_session->set('listing', $_REQUEST);
|
|
| 748 | 748 | |
| 749 | - // we need to define a few things to trick the setup_postdata |
|
| 750 | - if (!isset($post->ID)) {
|
|
| 751 | - $post->ID = ''; |
|
| 752 | - $post->post_author = ''; |
|
| 753 | - $post->post_date = ''; |
|
| 754 | - $post->post_content = ''; |
|
| 755 | - $post->default_category = ''; |
|
| 756 | - $post->post_type = ''; |
|
| 757 | - } |
|
| 758 | - setup_postdata($post); |
|
| 749 | + // we need to define a few things to trick the setup_postdata |
|
| 750 | + if (!isset($post->ID)) {
|
|
| 751 | + $post->ID = ''; |
|
| 752 | + $post->post_author = ''; |
|
| 753 | + $post->post_date = ''; |
|
| 754 | + $post->post_content = ''; |
|
| 755 | + $post->default_category = ''; |
|
| 756 | + $post->post_type = ''; |
|
| 757 | + } |
|
| 758 | + setup_postdata($post); |
|
| 759 | 759 | } |
| 760 | 760 | |
| 761 | 761 | /** |
@@ -767,15 +767,15 @@ discard block |
||
| 767 | 767 | */ |
| 768 | 768 | function geodir_action_geodir_preview_code() |
| 769 | 769 | {
|
| 770 | - global $preview; |
|
| 770 | + global $preview; |
|
| 771 | 771 | |
| 772 | - $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend |
|
| 772 | + $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend |
|
| 773 | 773 | |
| 774 | - if (!$preview || $is_backend_preview) {
|
|
| 775 | - return; |
|
| 776 | - }// bail if not previewing |
|
| 774 | + if (!$preview || $is_backend_preview) {
|
|
| 775 | + return; |
|
| 776 | + }// bail if not previewing |
|
| 777 | 777 | |
| 778 | - geodir_get_template_part('preview', 'buttons');
|
|
| 778 | + geodir_get_template_part('preview', 'buttons');
|
|
| 779 | 779 | } |
| 780 | 780 | |
| 781 | 781 | // action for adding the details page top widget area |
@@ -791,20 +791,20 @@ discard block |
||
| 791 | 791 | */ |
| 792 | 792 | function geodir_action_geodir_sidebar_detail_top($class = '') |
| 793 | 793 | {
|
| 794 | - if (get_option('geodir_show_detail_top_section')) { ?>
|
|
| 794 | + if (get_option('geodir_show_detail_top_section')) { ?>
|
|
| 795 | 795 | <div |
| 796 | 796 | class="<?php |
| 797 | - /** |
|
| 798 | - * Filter the div class for the wrapper of the full width widget areas. |
|
| 799 | - * |
|
| 800 | - * Allows you to filter the class of the div for the HTML Container wrapper for the full width widget areas referred to as "Top Section" or "Bottom Section" in the widget areas. |
|
| 801 | - * |
|
| 802 | - * @since 1.0.0 |
|
| 803 | - * @param string $class The class of the div. |
|
| 804 | - * @param string $type The page type the widget area is being used on. Values can be 'geodir_detail_top', 'geodir_detail_bottom', 'geodir_listing_top', 'geodir_listing_bottom', 'Reg/Login Top Section', |
|
| 805 | - * 'geodir_author_top','geodir_author_bottom', 'geodir_search_top', 'geodir_search_bottom', 'geodir_home_top' or 'geodir_home_bottom'. |
|
| 806 | - */ |
|
| 807 | - echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_top'); ?> <?php echo $class; ?>">
|
|
| 797 | + /** |
|
| 798 | + * Filter the div class for the wrapper of the full width widget areas. |
|
| 799 | + * |
|
| 800 | + * Allows you to filter the class of the div for the HTML Container wrapper for the full width widget areas referred to as "Top Section" or "Bottom Section" in the widget areas. |
|
| 801 | + * |
|
| 802 | + * @since 1.0.0 |
|
| 803 | + * @param string $class The class of the div. |
|
| 804 | + * @param string $type The page type the widget area is being used on. Values can be 'geodir_detail_top', 'geodir_detail_bottom', 'geodir_listing_top', 'geodir_listing_bottom', 'Reg/Login Top Section', |
|
| 805 | + * 'geodir_author_top','geodir_author_bottom', 'geodir_search_top', 'geodir_search_bottom', 'geodir_home_top' or 'geodir_home_bottom'. |
|
| 806 | + */ |
|
| 807 | + echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_top'); ?> <?php echo $class; ?>">
|
|
| 808 | 808 | <?php dynamic_sidebar('geodir_detail_top'); ?>
|
| 809 | 809 | </div> |
| 810 | 810 | <?php } |
@@ -828,11 +828,11 @@ discard block |
||
| 828 | 828 | */ |
| 829 | 829 | function geodir_action_geodir_sidebar_detail_bottom_section($class = '') |
| 830 | 830 | {
|
| 831 | - if (get_option('geodir_show_detail_bottom_section')) { ?>
|
|
| 831 | + if (get_option('geodir_show_detail_bottom_section')) { ?>
|
|
| 832 | 832 | <div |
| 833 | 833 | class="<?php |
| 834 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 835 | - echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_bottom'); ?> <?php echo $class; ?>">
|
|
| 834 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 835 | + echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_bottom'); ?> <?php echo $class; ?>">
|
|
| 836 | 836 | <?php dynamic_sidebar('geodir_detail_bottom'); ?>
|
| 837 | 837 | </div><!-- clearfix ends here--> |
| 838 | 838 | <?php } |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | */ |
| 847 | 847 | function geodir_details_sidebar_widget_area() |
| 848 | 848 | {
|
| 849 | - dynamic_sidebar('geodir_detail_sidebar');
|
|
| 849 | + dynamic_sidebar('geodir_detail_sidebar');
|
|
| 850 | 850 | } |
| 851 | 851 | |
| 852 | 852 | /** |
@@ -857,12 +857,12 @@ discard block |
||
| 857 | 857 | */ |
| 858 | 858 | function geodir_details_sidebar_place_details() |
| 859 | 859 | {
|
| 860 | - /** |
|
| 861 | - * Used to add items to the details page sidebar. |
|
| 862 | - * |
|
| 863 | - * @since 1.0.0 |
|
| 864 | - */ |
|
| 865 | - do_action('geodir_detail_page_sidebar');
|
|
| 860 | + /** |
|
| 861 | + * Used to add items to the details page sidebar. |
|
| 862 | + * |
|
| 863 | + * @since 1.0.0 |
|
| 864 | + */ |
|
| 865 | + do_action('geodir_detail_page_sidebar');
|
|
| 866 | 866 | } |
| 867 | 867 | |
| 868 | 868 | add_action('geodir_detail_sidebar_inside', 'geodir_details_sidebar_place_details', 10);
|
@@ -877,68 +877,68 @@ discard block |
||
| 877 | 877 | */ |
| 878 | 878 | function geodir_action_details_sidebar() |
| 879 | 879 | {
|
| 880 | - // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='') |
|
| 881 | - if (get_option('geodir_detail_sidebar_left_section')) {
|
|
| 882 | - /** |
|
| 883 | - * Called before the details page left sidebar is opened. |
|
| 884 | - * |
|
| 885 | - * This is used to add opening wrapper HTML to the details page left sidebar. |
|
| 886 | - * |
|
| 887 | - * @since 1.0.0 |
|
| 888 | - * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'. |
|
| 889 | - * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-left'. |
|
| 890 | - * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-left geodir-details-sidebar-left'. |
|
| 891 | - * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'. |
|
| 892 | - */ |
|
| 893 | - do_action('geodir_sidebar_left_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-left geodir-details-sidebar-left', 'https://schema.org/WPSideBar');
|
|
| 894 | - ?> |
|
| 880 | + // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='') |
|
| 881 | + if (get_option('geodir_detail_sidebar_left_section')) {
|
|
| 882 | + /** |
|
| 883 | + * Called before the details page left sidebar is opened. |
|
| 884 | + * |
|
| 885 | + * This is used to add opening wrapper HTML to the details page left sidebar. |
|
| 886 | + * |
|
| 887 | + * @since 1.0.0 |
|
| 888 | + * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'. |
|
| 889 | + * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-left'. |
|
| 890 | + * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-left geodir-details-sidebar-left'. |
|
| 891 | + * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'. |
|
| 892 | + */ |
|
| 893 | + do_action('geodir_sidebar_left_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-left geodir-details-sidebar-left', 'https://schema.org/WPSideBar');
|
|
| 894 | + ?> |
|
| 895 | 895 | <div class="geodir-content-left geodir-sidebar-wrap"><?php |
| 896 | - /** |
|
| 897 | - * Called inside the HTML wrapper of the details sidebar for either the left and right sidebar. |
|
| 898 | - * |
|
| 899 | - * This is used to add all info to the details page sidebars. |
|
| 900 | - * |
|
| 901 | - * @since 1.0.0 |
|
| 902 | - */ |
|
| 903 | - do_action('geodir_detail_sidebar_inside');
|
|
| 904 | - ?></div><!-- end geodir-content-left --><?php |
|
| 905 | - /** |
|
| 906 | - * Called after the details page left sidebar. |
|
| 907 | - * |
|
| 908 | - * This is used to add closing wrapper HTML to the details page left sidebar. |
|
| 909 | - * |
|
| 910 | - * @since 1.0.0 |
|
| 911 | - * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'. |
|
| 912 | - */ |
|
| 913 | - do_action('geodir_sidebar_left_close', 'details-page');
|
|
| 914 | - } else {
|
|
| 915 | - /** |
|
| 916 | - * Called before the details page right sidebar is opened. |
|
| 917 | - * |
|
| 918 | - * This is used to add opening wrapper HTML to the details page right sidebar. |
|
| 919 | - * |
|
| 920 | - * @since 1.0.0 |
|
| 921 | - * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'add-listing-page', 'author-page', 'search-page' or 'home-page'. |
|
| 922 | - * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-right'. |
|
| 923 | - * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-right geodir-details-sidebar-right'. |
|
| 924 | - * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'. |
|
| 925 | - */ |
|
| 926 | - do_action('geodir_sidebar_right_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-right geodir-details-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 927 | - ?> |
|
| 896 | + /** |
|
| 897 | + * Called inside the HTML wrapper of the details sidebar for either the left and right sidebar. |
|
| 898 | + * |
|
| 899 | + * This is used to add all info to the details page sidebars. |
|
| 900 | + * |
|
| 901 | + * @since 1.0.0 |
|
| 902 | + */ |
|
| 903 | + do_action('geodir_detail_sidebar_inside');
|
|
| 904 | + ?></div><!-- end geodir-content-left --><?php |
|
| 905 | + /** |
|
| 906 | + * Called after the details page left sidebar. |
|
| 907 | + * |
|
| 908 | + * This is used to add closing wrapper HTML to the details page left sidebar. |
|
| 909 | + * |
|
| 910 | + * @since 1.0.0 |
|
| 911 | + * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'. |
|
| 912 | + */ |
|
| 913 | + do_action('geodir_sidebar_left_close', 'details-page');
|
|
| 914 | + } else {
|
|
| 915 | + /** |
|
| 916 | + * Called before the details page right sidebar is opened. |
|
| 917 | + * |
|
| 918 | + * This is used to add opening wrapper HTML to the details page right sidebar. |
|
| 919 | + * |
|
| 920 | + * @since 1.0.0 |
|
| 921 | + * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'add-listing-page', 'author-page', 'search-page' or 'home-page'. |
|
| 922 | + * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-right'. |
|
| 923 | + * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-right geodir-details-sidebar-right'. |
|
| 924 | + * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'. |
|
| 925 | + */ |
|
| 926 | + do_action('geodir_sidebar_right_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-right geodir-details-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 927 | + ?> |
|
| 928 | 928 | <div class="geodir-content-right geodir-sidebar-wrap"><?php |
| 929 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 930 | - do_action('geodir_detail_sidebar_inside');
|
|
| 931 | - ?></div><!-- end geodir-content-right --><?php |
|
| 932 | - /** |
|
| 933 | - * Called after the details page right sidebar. |
|
| 934 | - * |
|
| 935 | - * This is used to add closing wrapper HTML to the details page right sidebar. |
|
| 936 | - * |
|
| 937 | - * @since 1.0.0 |
|
| 938 | - * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'. |
|
| 939 | - */ |
|
| 940 | - do_action('geodir_sidebar_right_close', 'details-page');
|
|
| 941 | - } |
|
| 929 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 930 | + do_action('geodir_detail_sidebar_inside');
|
|
| 931 | + ?></div><!-- end geodir-content-right --><?php |
|
| 932 | + /** |
|
| 933 | + * Called after the details page right sidebar. |
|
| 934 | + * |
|
| 935 | + * This is used to add closing wrapper HTML to the details page right sidebar. |
|
| 936 | + * |
|
| 937 | + * @since 1.0.0 |
|
| 938 | + * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'. |
|
| 939 | + */ |
|
| 940 | + do_action('geodir_sidebar_right_close', 'details-page');
|
|
| 941 | + } |
|
| 942 | 942 | } |
| 943 | 943 | |
| 944 | 944 | add_action('geodir_page_title', 'geodir_action_page_title', 10);
|
@@ -952,21 +952,21 @@ discard block |
||
| 952 | 952 | */ |
| 953 | 953 | function geodir_action_page_title() |
| 954 | 954 | {
|
| 955 | - /** |
|
| 956 | - * Filter the page title HTML h1 class. |
|
| 957 | - * |
|
| 958 | - * @since 1.0.0 |
|
| 959 | - * @param string $class The class to use. Default is 'entry-title fn'. |
|
| 960 | - */ |
|
| 961 | - $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
|
| 962 | - /** |
|
| 963 | - * Filter the page title HTML header wrapper class. |
|
| 964 | - * |
|
| 965 | - * @since 1.0.0 |
|
| 966 | - * @param string $class The class to use. Default is 'entry-header'. |
|
| 967 | - */ |
|
| 968 | - $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
|
| 969 | - echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>'; |
|
| 955 | + /** |
|
| 956 | + * Filter the page title HTML h1 class. |
|
| 957 | + * |
|
| 958 | + * @since 1.0.0 |
|
| 959 | + * @param string $class The class to use. Default is 'entry-title fn'. |
|
| 960 | + */ |
|
| 961 | + $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
|
| 962 | + /** |
|
| 963 | + * Filter the page title HTML header wrapper class. |
|
| 964 | + * |
|
| 965 | + * @since 1.0.0 |
|
| 966 | + * @param string $class The class to use. Default is 'entry-header'. |
|
| 967 | + */ |
|
| 968 | + $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
|
| 969 | + echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>'; |
|
| 970 | 970 | } |
| 971 | 971 | |
| 972 | 972 | |
@@ -983,94 +983,94 @@ discard block |
||
| 983 | 983 | */ |
| 984 | 984 | function geodir_action_details_slider() |
| 985 | 985 | {
|
| 986 | - global $preview, $post; |
|
| 986 | + global $preview, $post; |
|
| 987 | 987 | |
| 988 | - $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // preview from backend |
|
| 988 | + $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // preview from backend |
|
| 989 | 989 | |
| 990 | - if ($is_backend_preview && !empty($post) && !empty($post->ID) && !isset($post->post_images)) {
|
|
| 991 | - $preview_get_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
|
|
| 990 | + if ($is_backend_preview && !empty($post) && !empty($post->ID) && !isset($post->post_images)) {
|
|
| 991 | + $preview_get_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
|
|
| 992 | 992 | |
| 993 | - $preview_post_images = array(); |
|
| 994 | - if ($preview_get_images) {
|
|
| 995 | - foreach ($preview_get_images as $row) {
|
|
| 996 | - $preview_post_images[] = $row->src; |
|
| 997 | - } |
|
| 998 | - } |
|
| 999 | - if (!empty($preview_post_images)) {
|
|
| 1000 | - $post->post_images = implode(',', $preview_post_images);
|
|
| 1001 | - } |
|
| 1002 | - } |
|
| 1003 | - |
|
| 1004 | - if ($preview) {
|
|
| 1005 | - $post_images = array(); |
|
| 1006 | - if (isset($post->post_images) && !empty($post->post_images)) {
|
|
| 1007 | - $post->post_images = trim($post->post_images, ","); |
|
| 1008 | - $post_images = explode(",", $post->post_images);
|
|
| 1009 | - } |
|
| 1010 | - |
|
| 1011 | - $main_slides = ''; |
|
| 1012 | - $nav_slides = ''; |
|
| 1013 | - $slides = 0; |
|
| 1014 | - |
|
| 1015 | - if (!empty($post_images)) {
|
|
| 1016 | - foreach ($post_images as $image) {
|
|
| 1017 | - if (!empty($image)) {
|
|
| 1018 | - $sizes = getimagesize(trim($image)); |
|
| 1019 | - $width = !empty($sizes) && isset($sizes[0]) ? $sizes[0] : 0; |
|
| 1020 | - $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0; |
|
| 1021 | - |
|
| 1022 | - if ($image && $width && $height) {
|
|
| 1023 | - $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
|
|
| 1024 | - } |
|
| 1025 | - |
|
| 1026 | - if (isset($image->src)) {
|
|
| 1027 | - if ($image->height >= 400) {
|
|
| 1028 | - $spacer_height = 0; |
|
| 1029 | - } else {
|
|
| 1030 | - $spacer_height = ((400 - $image->height) / 2); |
|
| 1031 | - } |
|
| 1032 | - |
|
| 1033 | - $image_title = isset($image->title) ? $image->title : ''; |
|
| 1034 | - |
|
| 1035 | - $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />'; |
|
| 1036 | - $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>'; |
|
| 1037 | - $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>'; |
|
| 1038 | - $slides++; |
|
| 1039 | - } |
|
| 1040 | - } |
|
| 1041 | - }// endfore |
|
| 1042 | - } //end if |
|
| 1043 | - } else {
|
|
| 1044 | - $main_slides = ''; |
|
| 1045 | - $nav_slides = ''; |
|
| 1046 | - /** |
|
| 1047 | - * Filter if default images should show on the details page. |
|
| 1048 | - * |
|
| 1049 | - * @param bool $use_default_image Default false. |
|
| 1050 | - * @since 1.6.16 |
|
| 1051 | - */ |
|
| 1052 | - $use_default_image = apply_filters('geodir_details_default_image_show', false);
|
|
| 1053 | - $post_images = geodir_get_images($post->ID, 'thumbnail', $use_default_image); // Hide default image on listing preview/detail page. |
|
| 1054 | - $slides = 0; |
|
| 1055 | - |
|
| 1056 | - if (!empty($post_images)) {
|
|
| 1057 | - foreach ($post_images as $image) {
|
|
| 1058 | - if ($image->height >= 400) {
|
|
| 1059 | - $spacer_height = 0; |
|
| 1060 | - } else {
|
|
| 1061 | - $spacer_height = ((400 - $image->height) / 2); |
|
| 1062 | - } |
|
| 1063 | - $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : ''; |
|
| 1064 | - $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />'; |
|
| 1065 | - $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>'; |
|
| 1066 | - $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>'; |
|
| 1067 | - $slides++; |
|
| 1068 | - } |
|
| 1069 | - }// endfore |
|
| 1070 | - } |
|
| 993 | + $preview_post_images = array(); |
|
| 994 | + if ($preview_get_images) {
|
|
| 995 | + foreach ($preview_get_images as $row) {
|
|
| 996 | + $preview_post_images[] = $row->src; |
|
| 997 | + } |
|
| 998 | + } |
|
| 999 | + if (!empty($preview_post_images)) {
|
|
| 1000 | + $post->post_images = implode(',', $preview_post_images);
|
|
| 1001 | + } |
|
| 1002 | + } |
|
| 1003 | + |
|
| 1004 | + if ($preview) {
|
|
| 1005 | + $post_images = array(); |
|
| 1006 | + if (isset($post->post_images) && !empty($post->post_images)) {
|
|
| 1007 | + $post->post_images = trim($post->post_images, ","); |
|
| 1008 | + $post_images = explode(",", $post->post_images);
|
|
| 1009 | + } |
|
| 1010 | + |
|
| 1011 | + $main_slides = ''; |
|
| 1012 | + $nav_slides = ''; |
|
| 1013 | + $slides = 0; |
|
| 1014 | + |
|
| 1015 | + if (!empty($post_images)) {
|
|
| 1016 | + foreach ($post_images as $image) {
|
|
| 1017 | + if (!empty($image)) {
|
|
| 1018 | + $sizes = getimagesize(trim($image)); |
|
| 1019 | + $width = !empty($sizes) && isset($sizes[0]) ? $sizes[0] : 0; |
|
| 1020 | + $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0; |
|
| 1021 | + |
|
| 1022 | + if ($image && $width && $height) {
|
|
| 1023 | + $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
|
|
| 1024 | + } |
|
| 1025 | + |
|
| 1026 | + if (isset($image->src)) {
|
|
| 1027 | + if ($image->height >= 400) {
|
|
| 1028 | + $spacer_height = 0; |
|
| 1029 | + } else {
|
|
| 1030 | + $spacer_height = ((400 - $image->height) / 2); |
|
| 1031 | + } |
|
| 1032 | + |
|
| 1033 | + $image_title = isset($image->title) ? $image->title : ''; |
|
| 1034 | + |
|
| 1035 | + $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />'; |
|
| 1036 | + $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>'; |
|
| 1037 | + $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>'; |
|
| 1038 | + $slides++; |
|
| 1039 | + } |
|
| 1040 | + } |
|
| 1041 | + }// endfore |
|
| 1042 | + } //end if |
|
| 1043 | + } else {
|
|
| 1044 | + $main_slides = ''; |
|
| 1045 | + $nav_slides = ''; |
|
| 1046 | + /** |
|
| 1047 | + * Filter if default images should show on the details page. |
|
| 1048 | + * |
|
| 1049 | + * @param bool $use_default_image Default false. |
|
| 1050 | + * @since 1.6.16 |
|
| 1051 | + */ |
|
| 1052 | + $use_default_image = apply_filters('geodir_details_default_image_show', false);
|
|
| 1053 | + $post_images = geodir_get_images($post->ID, 'thumbnail', $use_default_image); // Hide default image on listing preview/detail page. |
|
| 1054 | + $slides = 0; |
|
| 1055 | + |
|
| 1056 | + if (!empty($post_images)) {
|
|
| 1057 | + foreach ($post_images as $image) {
|
|
| 1058 | + if ($image->height >= 400) {
|
|
| 1059 | + $spacer_height = 0; |
|
| 1060 | + } else {
|
|
| 1061 | + $spacer_height = ((400 - $image->height) / 2); |
|
| 1062 | + } |
|
| 1063 | + $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : ''; |
|
| 1064 | + $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />'; |
|
| 1065 | + $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>'; |
|
| 1066 | + $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>'; |
|
| 1067 | + $slides++; |
|
| 1068 | + } |
|
| 1069 | + }// endfore |
|
| 1070 | + } |
|
| 1071 | 1071 | |
| 1072 | - if (!empty($post_images)) {
|
|
| 1073 | - ?> |
|
| 1072 | + if (!empty($post_images)) {
|
|
| 1073 | + ?> |
|
| 1074 | 1074 | <div class="geodir_flex-container"> |
| 1075 | 1075 | <div class="geodir_flex-loader"><i class="fa fa-refresh fa-spin"></i></div> |
| 1076 | 1076 | <div id="geodir_slider" class="geodir_flexslider "> |
@@ -1083,7 +1083,7 @@ discard block |
||
| 1083 | 1083 | <?php } ?> |
| 1084 | 1084 | </div> |
| 1085 | 1085 | <?php |
| 1086 | - } |
|
| 1086 | + } |
|
| 1087 | 1087 | } |
| 1088 | 1088 | |
| 1089 | 1089 | add_action('geodir_details_taxonomies', 'geodir_action_details_taxonomies', 10);
|
@@ -1098,177 +1098,177 @@ discard block |
||
| 1098 | 1098 | */ |
| 1099 | 1099 | function geodir_action_details_taxonomies() |
| 1100 | 1100 | {
|
| 1101 | - global $preview, $post;?> |
|
| 1101 | + global $preview, $post;?> |
|
| 1102 | 1102 | <p class="geodir_post_taxomomies clearfix"> |
| 1103 | 1103 | <?php |
| 1104 | - $taxonomies = array(); |
|
| 1105 | - |
|
| 1106 | - $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend |
|
| 1107 | - |
|
| 1108 | - if ($preview && !$is_backend_preview) {
|
|
| 1109 | - $post_type = $post->listing_type; |
|
| 1110 | - $post_taxonomy = $post_type . 'category'; |
|
| 1111 | - $post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
|
|
| 1112 | - } else {
|
|
| 1113 | - $post_type = $post->post_type; |
|
| 1114 | - $post_taxonomy = $post_type . 'category'; |
|
| 1115 | - } |
|
| 1104 | + $taxonomies = array(); |
|
| 1105 | + |
|
| 1106 | + $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend |
|
| 1107 | + |
|
| 1108 | + if ($preview && !$is_backend_preview) {
|
|
| 1109 | + $post_type = $post->listing_type; |
|
| 1110 | + $post_taxonomy = $post_type . 'category'; |
|
| 1111 | + $post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
|
|
| 1112 | + } else {
|
|
| 1113 | + $post_type = $post->post_type; |
|
| 1114 | + $post_taxonomy = $post_type . 'category'; |
|
| 1115 | + } |
|
| 1116 | 1116 | //{
|
| 1117 | - $post_type_info = get_post_type_object($post_type); |
|
| 1118 | - $listing_label = __($post_type_info->labels->singular_name, 'geodirectory'); |
|
| 1119 | - |
|
| 1120 | - if (!empty($post->post_tags)) {
|
|
| 1121 | - |
|
| 1122 | - if (taxonomy_exists($post_type . '_tags')): |
|
| 1123 | - $links = array(); |
|
| 1124 | - $terms = array(); |
|
| 1125 | - // to limit post tags |
|
| 1126 | - $post_tags = trim($post->post_tags, ","); |
|
| 1127 | - $post_id = isset($post->ID) ? $post->ID : ''; |
|
| 1128 | - /** |
|
| 1129 | - * Filter the post tags. |
|
| 1130 | - * |
|
| 1131 | - * Allows you to filter the post tags output on the details page of a post. |
|
| 1132 | - * |
|
| 1133 | - * @since 1.0.0 |
|
| 1134 | - * @param string $post_tags A comma seperated list of tags. |
|
| 1135 | - * @param int $post_id The current post id. |
|
| 1136 | - */ |
|
| 1137 | - $post_tags = apply_filters('geodir_action_details_post_tags', $post_tags, $post_id);
|
|
| 1138 | - |
|
| 1139 | - $post->post_tags = $post_tags; |
|
| 1140 | - $post_tags = explode(",", trim($post->post_tags, ","));
|
|
| 1141 | - |
|
| 1142 | - |
|
| 1143 | - foreach ($post_tags as $post_term) {
|
|
| 1144 | - |
|
| 1145 | - // fix slug creation order for tags & location |
|
| 1146 | - $post_term = trim($post_term); |
|
| 1147 | - |
|
| 1148 | - $priority_location = false; |
|
| 1149 | - if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
|
|
| 1150 | - $term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
|
|
| 1151 | - } else {
|
|
| 1152 | - $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL; |
|
| 1153 | - $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL; |
|
| 1154 | - $post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL; |
|
| 1155 | - $match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false; |
|
| 1156 | - $match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false; |
|
| 1157 | - $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false; |
|
| 1158 | - if ($match_country || $match_region || $match_city) {
|
|
| 1159 | - $priority_location = true; |
|
| 1160 | - $term = get_term_by('name', $post_term, $post_type . '_tags');
|
|
| 1161 | - } else {
|
|
| 1162 | - $insert_term = wp_insert_term($post_term, $post_type . '_tags'); |
|
| 1163 | - $term = get_term_by('name', $post_term, $post_type . '_tags');
|
|
| 1164 | - } |
|
| 1165 | - } |
|
| 1166 | - |
|
| 1167 | - if (!is_wp_error($term) && is_object($term)) {
|
|
| 1168 | - |
|
| 1169 | - // fix tag link on detail page |
|
| 1170 | - if ($priority_location) {
|
|
| 1171 | - |
|
| 1172 | - $tag_link = "<a href=''>$post_term</a>"; |
|
| 1173 | - /** |
|
| 1174 | - * Filter the tag name on the details page. |
|
| 1175 | - * |
|
| 1176 | - * @since 1.5.6 |
|
| 1177 | - * @param string $tag_link The tag link html. |
|
| 1178 | - * @param object $term The tag term object. |
|
| 1179 | - */ |
|
| 1180 | - $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
|
|
| 1181 | - $links[] = $tag_link; |
|
| 1182 | - } else {
|
|
| 1183 | - $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>"; |
|
| 1184 | - /** This action is documented in geodirectory-template_actions.php */ |
|
| 1185 | - $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
|
|
| 1186 | - $links[] = $tag_link; |
|
| 1187 | - } |
|
| 1188 | - $terms[] = $term; |
|
| 1189 | - } |
|
| 1190 | - // |
|
| 1191 | - } |
|
| 1192 | - if (!isset($listing_label)) {
|
|
| 1193 | - $listing_label = ''; |
|
| 1194 | - } |
|
| 1195 | - $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
|
|
| 1196 | - endif; |
|
| 1197 | - |
|
| 1198 | - } |
|
| 1199 | - |
|
| 1200 | - if (!empty($post->{$post_taxonomy})) {
|
|
| 1201 | - $links = array(); |
|
| 1202 | - $terms = array(); |
|
| 1203 | - $termsOrdered = array(); |
|
| 1204 | - if (!is_array($post->{$post_taxonomy})) {
|
|
| 1205 | - $post_term = explode(",", trim($post->{$post_taxonomy}, ","));
|
|
| 1206 | - } else {
|
|
| 1207 | - $post_term = $post->{$post_taxonomy};
|
|
| 1117 | + $post_type_info = get_post_type_object($post_type); |
|
| 1118 | + $listing_label = __($post_type_info->labels->singular_name, 'geodirectory'); |
|
| 1119 | + |
|
| 1120 | + if (!empty($post->post_tags)) {
|
|
| 1121 | + |
|
| 1122 | + if (taxonomy_exists($post_type . '_tags')): |
|
| 1123 | + $links = array(); |
|
| 1124 | + $terms = array(); |
|
| 1125 | + // to limit post tags |
|
| 1126 | + $post_tags = trim($post->post_tags, ","); |
|
| 1127 | + $post_id = isset($post->ID) ? $post->ID : ''; |
|
| 1128 | + /** |
|
| 1129 | + * Filter the post tags. |
|
| 1130 | + * |
|
| 1131 | + * Allows you to filter the post tags output on the details page of a post. |
|
| 1132 | + * |
|
| 1133 | + * @since 1.0.0 |
|
| 1134 | + * @param string $post_tags A comma seperated list of tags. |
|
| 1135 | + * @param int $post_id The current post id. |
|
| 1136 | + */ |
|
| 1137 | + $post_tags = apply_filters('geodir_action_details_post_tags', $post_tags, $post_id);
|
|
| 1138 | + |
|
| 1139 | + $post->post_tags = $post_tags; |
|
| 1140 | + $post_tags = explode(",", trim($post->post_tags, ","));
|
|
| 1141 | + |
|
| 1142 | + |
|
| 1143 | + foreach ($post_tags as $post_term) {
|
|
| 1144 | + |
|
| 1145 | + // fix slug creation order for tags & location |
|
| 1146 | + $post_term = trim($post_term); |
|
| 1147 | + |
|
| 1148 | + $priority_location = false; |
|
| 1149 | + if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
|
|
| 1150 | + $term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
|
|
| 1151 | + } else {
|
|
| 1152 | + $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL; |
|
| 1153 | + $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL; |
|
| 1154 | + $post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL; |
|
| 1155 | + $match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false; |
|
| 1156 | + $match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false; |
|
| 1157 | + $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false; |
|
| 1158 | + if ($match_country || $match_region || $match_city) {
|
|
| 1159 | + $priority_location = true; |
|
| 1160 | + $term = get_term_by('name', $post_term, $post_type . '_tags');
|
|
| 1161 | + } else {
|
|
| 1162 | + $insert_term = wp_insert_term($post_term, $post_type . '_tags'); |
|
| 1163 | + $term = get_term_by('name', $post_term, $post_type . '_tags');
|
|
| 1164 | + } |
|
| 1165 | + } |
|
| 1166 | + |
|
| 1167 | + if (!is_wp_error($term) && is_object($term)) {
|
|
| 1168 | + |
|
| 1169 | + // fix tag link on detail page |
|
| 1170 | + if ($priority_location) {
|
|
| 1171 | + |
|
| 1172 | + $tag_link = "<a href=''>$post_term</a>"; |
|
| 1173 | + /** |
|
| 1174 | + * Filter the tag name on the details page. |
|
| 1175 | + * |
|
| 1176 | + * @since 1.5.6 |
|
| 1177 | + * @param string $tag_link The tag link html. |
|
| 1178 | + * @param object $term The tag term object. |
|
| 1179 | + */ |
|
| 1180 | + $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
|
|
| 1181 | + $links[] = $tag_link; |
|
| 1182 | + } else {
|
|
| 1183 | + $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>"; |
|
| 1184 | + /** This action is documented in geodirectory-template_actions.php */ |
|
| 1185 | + $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
|
|
| 1186 | + $links[] = $tag_link; |
|
| 1187 | + } |
|
| 1188 | + $terms[] = $term; |
|
| 1189 | + } |
|
| 1190 | + // |
|
| 1191 | + } |
|
| 1192 | + if (!isset($listing_label)) {
|
|
| 1193 | + $listing_label = ''; |
|
| 1194 | + } |
|
| 1195 | + $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
|
|
| 1196 | + endif; |
|
| 1197 | + |
|
| 1198 | + } |
|
| 1199 | + |
|
| 1200 | + if (!empty($post->{$post_taxonomy})) {
|
|
| 1201 | + $links = array(); |
|
| 1202 | + $terms = array(); |
|
| 1203 | + $termsOrdered = array(); |
|
| 1204 | + if (!is_array($post->{$post_taxonomy})) {
|
|
| 1205 | + $post_term = explode(",", trim($post->{$post_taxonomy}, ","));
|
|
| 1206 | + } else {
|
|
| 1207 | + $post_term = $post->{$post_taxonomy};
|
|
| 1208 | 1208 | |
| 1209 | 1209 | if ($preview && !$is_backend_preview) {
|
| 1210 | 1210 | $post_term = geodir_add_parent_terms($post_term, $post_taxonomy); |
| 1211 | 1211 | } |
| 1212 | - } |
|
| 1213 | - |
|
| 1214 | - $post_term = array_unique($post_term); |
|
| 1215 | - if (!empty($post_term)) {
|
|
| 1216 | - foreach ($post_term as $post_term) {
|
|
| 1217 | - $post_term = trim($post_term); |
|
| 1218 | - |
|
| 1219 | - if ($post_term != ''): |
|
| 1220 | - $term = get_term_by('id', $post_term, $post_taxonomy);
|
|
| 1221 | - |
|
| 1222 | - if (is_object($term)) {
|
|
| 1223 | - $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>"; |
|
| 1224 | - /** |
|
| 1225 | - * Filter the category name on the details page. |
|
| 1226 | - * |
|
| 1227 | - * @since 1.5.6 |
|
| 1228 | - * @param string $term_link The link html to the category. |
|
| 1229 | - * @param object $term The category term object. |
|
| 1230 | - */ |
|
| 1231 | - $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
|
|
| 1232 | - $links[] = $term_link; |
|
| 1233 | - $terms[] = $term; |
|
| 1234 | - } |
|
| 1235 | - endif; |
|
| 1236 | - } |
|
| 1237 | - // order alphabetically |
|
| 1238 | - asort($links); |
|
| 1239 | - foreach (array_keys($links) as $key) {
|
|
| 1240 | - $termsOrdered[$key] = $terms[$key]; |
|
| 1241 | - } |
|
| 1242 | - $terms = $termsOrdered; |
|
| 1212 | + } |
|
| 1213 | + |
|
| 1214 | + $post_term = array_unique($post_term); |
|
| 1215 | + if (!empty($post_term)) {
|
|
| 1216 | + foreach ($post_term as $post_term) {
|
|
| 1217 | + $post_term = trim($post_term); |
|
| 1218 | + |
|
| 1219 | + if ($post_term != ''): |
|
| 1220 | + $term = get_term_by('id', $post_term, $post_taxonomy);
|
|
| 1221 | + |
|
| 1222 | + if (is_object($term)) {
|
|
| 1223 | + $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>"; |
|
| 1224 | + /** |
|
| 1225 | + * Filter the category name on the details page. |
|
| 1226 | + * |
|
| 1227 | + * @since 1.5.6 |
|
| 1228 | + * @param string $term_link The link html to the category. |
|
| 1229 | + * @param object $term The category term object. |
|
| 1230 | + */ |
|
| 1231 | + $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
|
|
| 1232 | + $links[] = $term_link; |
|
| 1233 | + $terms[] = $term; |
|
| 1234 | + } |
|
| 1235 | + endif; |
|
| 1236 | + } |
|
| 1237 | + // order alphabetically |
|
| 1238 | + asort($links); |
|
| 1239 | + foreach (array_keys($links) as $key) {
|
|
| 1240 | + $termsOrdered[$key] = $terms[$key]; |
|
| 1241 | + } |
|
| 1242 | + $terms = $termsOrdered; |
|
| 1243 | 1243 | |
| 1244 | - } |
|
| 1244 | + } |
|
| 1245 | 1245 | |
| 1246 | - if (!isset($listing_label)) {
|
|
| 1247 | - $listing_label = ''; |
|
| 1248 | - } |
|
| 1249 | - $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
|
|
| 1246 | + if (!isset($listing_label)) {
|
|
| 1247 | + $listing_label = ''; |
|
| 1248 | + } |
|
| 1249 | + $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
|
|
| 1250 | 1250 | |
| 1251 | - } |
|
| 1251 | + } |
|
| 1252 | 1252 | |
| 1253 | - /** |
|
| 1254 | - * Filter the taxonomies array before output. |
|
| 1255 | - * |
|
| 1256 | - * @since 1.5.9 |
|
| 1257 | - * @param array $taxonomies The array of cats and tags. |
|
| 1258 | - * @param string $post_type The post type being output. |
|
| 1259 | - * @param string $listing_label The post type label. |
|
| 1260 | - * @param string $listing_label The post type label with ucwords function. |
|
| 1261 | - */ |
|
| 1262 | - $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
|
|
| 1253 | + /** |
|
| 1254 | + * Filter the taxonomies array before output. |
|
| 1255 | + * |
|
| 1256 | + * @since 1.5.9 |
|
| 1257 | + * @param array $taxonomies The array of cats and tags. |
|
| 1258 | + * @param string $post_type The post type being output. |
|
| 1259 | + * @param string $listing_label The post type label. |
|
| 1260 | + * @param string $listing_label The post type label with ucwords function. |
|
| 1261 | + */ |
|
| 1262 | + $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
|
|
| 1263 | 1263 | |
| 1264 | - if (isset($taxonomies[$post_taxonomy])) {
|
|
| 1265 | - echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>'; |
|
| 1266 | - } |
|
| 1264 | + if (isset($taxonomies[$post_taxonomy])) {
|
|
| 1265 | + echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>'; |
|
| 1266 | + } |
|
| 1267 | 1267 | |
| 1268 | - if (isset($taxonomies[$post_type . '_tags'])) |
|
| 1269 | - echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>'; |
|
| 1268 | + if (isset($taxonomies[$post_type . '_tags'])) |
|
| 1269 | + echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>'; |
|
| 1270 | 1270 | |
| 1271 | - ?> |
|
| 1271 | + ?> |
|
| 1272 | 1272 | </p><?php |
| 1273 | 1273 | } |
| 1274 | 1274 | |
@@ -1290,140 +1290,140 @@ discard block |
||
| 1290 | 1290 | function geodir_action_details_micordata($post='') |
| 1291 | 1291 | {
|
| 1292 | 1292 | |
| 1293 | - global $preview; |
|
| 1294 | - if(empty($post)){global $post;}
|
|
| 1295 | - if ($preview || !geodir_is_page('detail')) {
|
|
| 1296 | - return; |
|
| 1297 | - } |
|
| 1298 | - |
|
| 1299 | - // url |
|
| 1300 | - $c_url = geodir_curPageURL(); |
|
| 1301 | - |
|
| 1302 | - // post reviews |
|
| 1303 | - $post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
|
|
| 1304 | - if (empty($post_reviews)) {
|
|
| 1305 | - $reviews = ''; |
|
| 1306 | - } else {
|
|
| 1307 | - foreach ($post_reviews as $review) {
|
|
| 1308 | - $reviews[] = array( |
|
| 1309 | - "@type" => "Review", |
|
| 1310 | - "author" => $review->comment_author, |
|
| 1311 | - "datePublished" => $review->comment_date, |
|
| 1312 | - "description" => $review->comment_content, |
|
| 1313 | - "reviewRating" => array( |
|
| 1314 | - "@type" => "Rating", |
|
| 1315 | - "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score. |
|
| 1316 | - "ratingValue" => geodir_get_commentoverall($review->comment_ID), |
|
| 1317 | - "worstRating" => "1" |
|
| 1318 | - ) |
|
| 1319 | - ); |
|
| 1320 | - } |
|
| 1321 | - |
|
| 1322 | - } |
|
| 1323 | - |
|
| 1324 | - // post images |
|
| 1325 | - $post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
|
|
| 1326 | - if (empty($post_images)) {
|
|
| 1327 | - $images = ''; |
|
| 1328 | - } else {
|
|
| 1329 | - $i_arr = array(); |
|
| 1330 | - foreach ($post_images as $img) {
|
|
| 1331 | - $i_arr[] = $img->src; |
|
| 1332 | - } |
|
| 1333 | - |
|
| 1334 | - if (count($i_arr) == 1) {
|
|
| 1335 | - $images = $i_arr[0]; |
|
| 1336 | - } else {
|
|
| 1337 | - $images = $i_arr; |
|
| 1338 | - } |
|
| 1339 | - |
|
| 1340 | - } |
|
| 1341 | - //print_r($post); |
|
| 1342 | - // external links |
|
| 1343 | - $external_links = array(); |
|
| 1344 | - $external_links[] = $post->geodir_website; |
|
| 1345 | - $external_links[] = $post->geodir_twitter; |
|
| 1346 | - $external_links[] = $post->geodir_facebook; |
|
| 1347 | - $external_links = array_filter($external_links); |
|
| 1348 | - |
|
| 1349 | - if(!empty($external_links)){
|
|
| 1350 | - $external_links = array_values($external_links); |
|
| 1351 | - } |
|
| 1352 | - |
|
| 1353 | - // reviews |
|
| 1354 | - $comment_count = geodir_get_review_count_total($post->ID); |
|
| 1355 | - $post_avgratings = geodir_get_post_rating($post->ID); |
|
| 1356 | - |
|
| 1357 | - // schema type |
|
| 1358 | - $schema_type = 'LocalBusiness'; |
|
| 1359 | - if(isset($post->default_category) && $post->default_category){
|
|
| 1360 | - $cat_schema = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type); |
|
| 1361 | - if($cat_schema){$schema_type = $cat_schema;}
|
|
| 1362 | - if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
|
|
| 1363 | - } |
|
| 1364 | - |
|
| 1365 | - $schema = array(); |
|
| 1366 | - $schema['@context'] = "https://schema.org"; |
|
| 1367 | - $schema['@type'] = $schema_type; |
|
| 1368 | - $schema['name'] = $post->post_title; |
|
| 1369 | - $schema['description'] = wp_strip_all_tags( $post->post_content, true ); |
|
| 1370 | - $schema['telephone'] = $post->geodir_contact; |
|
| 1371 | - $schema['url'] = $c_url; |
|
| 1372 | - $schema['sameAs'] = $external_links; |
|
| 1373 | - $schema['image'] = $images; |
|
| 1374 | - $schema['address'] = array( |
|
| 1375 | - "@type" => "PostalAddress", |
|
| 1376 | - "streetAddress" => $post->post_address, |
|
| 1377 | - "addressLocality" => $post->post_city, |
|
| 1378 | - "addressRegion" => $post->post_region, |
|
| 1379 | - "addressCountry" => $post->post_country, |
|
| 1380 | - "postalCode" => $post->post_zip |
|
| 1381 | - ); |
|
| 1382 | - |
|
| 1383 | - if($post->post_latitude && $post->post_longitude) {
|
|
| 1384 | - $schema['geo'] = array( |
|
| 1385 | - "@type" => "GeoCoordinates", |
|
| 1386 | - "latitude" => $post->post_latitude, |
|
| 1387 | - "longitude" => $post->post_longitude |
|
| 1388 | - ); |
|
| 1389 | - } |
|
| 1390 | - |
|
| 1391 | - if($post_avgratings) {
|
|
| 1392 | - $schema['aggregateRating'] = array( |
|
| 1393 | - "@type" => "AggregateRating", |
|
| 1394 | - "ratingValue" => $post_avgratings, |
|
| 1395 | - "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score. |
|
| 1396 | - "worstRating" => "1", |
|
| 1397 | - "ratingCount" => $comment_count |
|
| 1398 | - ); |
|
| 1399 | - } |
|
| 1400 | - $schema['review'] = $reviews; |
|
| 1401 | - |
|
| 1402 | - /** |
|
| 1403 | - * Allow the schema JSON-LD info to be filtered. |
|
| 1404 | - * |
|
| 1405 | - * @since 1.5.4 |
|
| 1406 | - * @since 1.5.7 Added $post variable. |
|
| 1407 | - * @param array $schema The array of schema data to be filtered. |
|
| 1408 | - * @param object $post The post object. |
|
| 1409 | - */ |
|
| 1410 | - $schema = apply_filters('geodir_details_schema', $schema,$post);
|
|
| 1411 | - |
|
| 1412 | - |
|
| 1413 | - echo '<script type="application/ld+json">' . json_encode($schema) . '</script>'; |
|
| 1414 | - |
|
| 1415 | - |
|
| 1416 | - $uploads = wp_upload_dir(); |
|
| 1417 | - $facebook_og = (isset($post->featured_image) && $post->featured_image) ? '<meta property="og:image" content="'.$uploads['baseurl'].$post->featured_image.'"/>' : ''; |
|
| 1418 | - |
|
| 1419 | - /** |
|
| 1420 | - * Show facebook open graph meta info |
|
| 1421 | - * |
|
| 1422 | - * @since 1.6.6 |
|
| 1423 | - * @param string $facebook_og The open graph html to be filtered. |
|
| 1424 | - * @param object $post The post object. |
|
| 1425 | - */ |
|
| 1426 | - echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
|
|
| 1293 | + global $preview; |
|
| 1294 | + if(empty($post)){global $post;}
|
|
| 1295 | + if ($preview || !geodir_is_page('detail')) {
|
|
| 1296 | + return; |
|
| 1297 | + } |
|
| 1298 | + |
|
| 1299 | + // url |
|
| 1300 | + $c_url = geodir_curPageURL(); |
|
| 1301 | + |
|
| 1302 | + // post reviews |
|
| 1303 | + $post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
|
|
| 1304 | + if (empty($post_reviews)) {
|
|
| 1305 | + $reviews = ''; |
|
| 1306 | + } else {
|
|
| 1307 | + foreach ($post_reviews as $review) {
|
|
| 1308 | + $reviews[] = array( |
|
| 1309 | + "@type" => "Review", |
|
| 1310 | + "author" => $review->comment_author, |
|
| 1311 | + "datePublished" => $review->comment_date, |
|
| 1312 | + "description" => $review->comment_content, |
|
| 1313 | + "reviewRating" => array( |
|
| 1314 | + "@type" => "Rating", |
|
| 1315 | + "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score. |
|
| 1316 | + "ratingValue" => geodir_get_commentoverall($review->comment_ID), |
|
| 1317 | + "worstRating" => "1" |
|
| 1318 | + ) |
|
| 1319 | + ); |
|
| 1320 | + } |
|
| 1321 | + |
|
| 1322 | + } |
|
| 1323 | + |
|
| 1324 | + // post images |
|
| 1325 | + $post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
|
|
| 1326 | + if (empty($post_images)) {
|
|
| 1327 | + $images = ''; |
|
| 1328 | + } else {
|
|
| 1329 | + $i_arr = array(); |
|
| 1330 | + foreach ($post_images as $img) {
|
|
| 1331 | + $i_arr[] = $img->src; |
|
| 1332 | + } |
|
| 1333 | + |
|
| 1334 | + if (count($i_arr) == 1) {
|
|
| 1335 | + $images = $i_arr[0]; |
|
| 1336 | + } else {
|
|
| 1337 | + $images = $i_arr; |
|
| 1338 | + } |
|
| 1339 | + |
|
| 1340 | + } |
|
| 1341 | + //print_r($post); |
|
| 1342 | + // external links |
|
| 1343 | + $external_links = array(); |
|
| 1344 | + $external_links[] = $post->geodir_website; |
|
| 1345 | + $external_links[] = $post->geodir_twitter; |
|
| 1346 | + $external_links[] = $post->geodir_facebook; |
|
| 1347 | + $external_links = array_filter($external_links); |
|
| 1348 | + |
|
| 1349 | + if(!empty($external_links)){
|
|
| 1350 | + $external_links = array_values($external_links); |
|
| 1351 | + } |
|
| 1352 | + |
|
| 1353 | + // reviews |
|
| 1354 | + $comment_count = geodir_get_review_count_total($post->ID); |
|
| 1355 | + $post_avgratings = geodir_get_post_rating($post->ID); |
|
| 1356 | + |
|
| 1357 | + // schema type |
|
| 1358 | + $schema_type = 'LocalBusiness'; |
|
| 1359 | + if(isset($post->default_category) && $post->default_category){
|
|
| 1360 | + $cat_schema = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type); |
|
| 1361 | + if($cat_schema){$schema_type = $cat_schema;}
|
|
| 1362 | + if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
|
|
| 1363 | + } |
|
| 1364 | + |
|
| 1365 | + $schema = array(); |
|
| 1366 | + $schema['@context'] = "https://schema.org"; |
|
| 1367 | + $schema['@type'] = $schema_type; |
|
| 1368 | + $schema['name'] = $post->post_title; |
|
| 1369 | + $schema['description'] = wp_strip_all_tags( $post->post_content, true ); |
|
| 1370 | + $schema['telephone'] = $post->geodir_contact; |
|
| 1371 | + $schema['url'] = $c_url; |
|
| 1372 | + $schema['sameAs'] = $external_links; |
|
| 1373 | + $schema['image'] = $images; |
|
| 1374 | + $schema['address'] = array( |
|
| 1375 | + "@type" => "PostalAddress", |
|
| 1376 | + "streetAddress" => $post->post_address, |
|
| 1377 | + "addressLocality" => $post->post_city, |
|
| 1378 | + "addressRegion" => $post->post_region, |
|
| 1379 | + "addressCountry" => $post->post_country, |
|
| 1380 | + "postalCode" => $post->post_zip |
|
| 1381 | + ); |
|
| 1382 | + |
|
| 1383 | + if($post->post_latitude && $post->post_longitude) {
|
|
| 1384 | + $schema['geo'] = array( |
|
| 1385 | + "@type" => "GeoCoordinates", |
|
| 1386 | + "latitude" => $post->post_latitude, |
|
| 1387 | + "longitude" => $post->post_longitude |
|
| 1388 | + ); |
|
| 1389 | + } |
|
| 1390 | + |
|
| 1391 | + if($post_avgratings) {
|
|
| 1392 | + $schema['aggregateRating'] = array( |
|
| 1393 | + "@type" => "AggregateRating", |
|
| 1394 | + "ratingValue" => $post_avgratings, |
|
| 1395 | + "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score. |
|
| 1396 | + "worstRating" => "1", |
|
| 1397 | + "ratingCount" => $comment_count |
|
| 1398 | + ); |
|
| 1399 | + } |
|
| 1400 | + $schema['review'] = $reviews; |
|
| 1401 | + |
|
| 1402 | + /** |
|
| 1403 | + * Allow the schema JSON-LD info to be filtered. |
|
| 1404 | + * |
|
| 1405 | + * @since 1.5.4 |
|
| 1406 | + * @since 1.5.7 Added $post variable. |
|
| 1407 | + * @param array $schema The array of schema data to be filtered. |
|
| 1408 | + * @param object $post The post object. |
|
| 1409 | + */ |
|
| 1410 | + $schema = apply_filters('geodir_details_schema', $schema,$post);
|
|
| 1411 | + |
|
| 1412 | + |
|
| 1413 | + echo '<script type="application/ld+json">' . json_encode($schema) . '</script>'; |
|
| 1414 | + |
|
| 1415 | + |
|
| 1416 | + $uploads = wp_upload_dir(); |
|
| 1417 | + $facebook_og = (isset($post->featured_image) && $post->featured_image) ? '<meta property="og:image" content="'.$uploads['baseurl'].$post->featured_image.'"/>' : ''; |
|
| 1418 | + |
|
| 1419 | + /** |
|
| 1420 | + * Show facebook open graph meta info |
|
| 1421 | + * |
|
| 1422 | + * @since 1.6.6 |
|
| 1423 | + * @param string $facebook_og The open graph html to be filtered. |
|
| 1424 | + * @param object $post The post object. |
|
| 1425 | + */ |
|
| 1426 | + echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
|
|
| 1427 | 1427 | |
| 1428 | 1428 | |
| 1429 | 1429 | |
@@ -1443,7 +1443,7 @@ discard block |
||
| 1443 | 1443 | */ |
| 1444 | 1444 | function geodir_action_details_next_prev() |
| 1445 | 1445 | {
|
| 1446 | - ?> |
|
| 1446 | + ?> |
|
| 1447 | 1447 | <div class="geodir-pos_navigation clearfix"> |
| 1448 | 1448 | <div |
| 1449 | 1449 | class="geodir-post_left"><?php previous_post_link('%link', '' . __('Previous', 'geodirectory'), false) ?></div>
|
@@ -1461,15 +1461,15 @@ discard block |
||
| 1461 | 1461 | */ |
| 1462 | 1462 | function geodir_action_before_single_post() |
| 1463 | 1463 | {
|
| 1464 | - global $post; |
|
| 1465 | - /** |
|
| 1466 | - * Called at the very start of the details page output, before the title section. |
|
| 1467 | - * |
|
| 1468 | - * @since 1.0.0 |
|
| 1469 | - * @param object $post The current post object. |
|
| 1470 | - * @global WP_Post|null $post The current post, if available. |
|
| 1471 | - */ |
|
| 1472 | - do_action('geodir_before_single_post', $post); // extra action
|
|
| 1464 | + global $post; |
|
| 1465 | + /** |
|
| 1466 | + * Called at the very start of the details page output, before the title section. |
|
| 1467 | + * |
|
| 1468 | + * @since 1.0.0 |
|
| 1469 | + * @param object $post The current post object. |
|
| 1470 | + * @global WP_Post|null $post The current post, if available. |
|
| 1471 | + */ |
|
| 1472 | + do_action('geodir_before_single_post', $post); // extra action
|
|
| 1473 | 1473 | } |
| 1474 | 1474 | |
| 1475 | 1475 | /** |
@@ -1480,13 +1480,13 @@ discard block |
||
| 1480 | 1480 | */ |
| 1481 | 1481 | function geodir_action_after_single_post($post) |
| 1482 | 1482 | {
|
| 1483 | - /** |
|
| 1484 | - * Called on the details page after the details page tabs section and before the next/prev buttons. |
|
| 1485 | - * |
|
| 1486 | - * @since 1.0.0 |
|
| 1487 | - * @param object $post The current post object. |
|
| 1488 | - */ |
|
| 1489 | - do_action('geodir_after_single_post', $post); // extra action
|
|
| 1483 | + /** |
|
| 1484 | + * Called on the details page after the details page tabs section and before the next/prev buttons. |
|
| 1485 | + * |
|
| 1486 | + * @since 1.0.0 |
|
| 1487 | + * @param object $post The current post object. |
|
| 1488 | + */ |
|
| 1489 | + do_action('geodir_after_single_post', $post); // extra action
|
|
| 1490 | 1490 | } |
| 1491 | 1491 | |
| 1492 | 1492 | add_action('geodir_details_main_content', 'geodir_action_before_single_post', 10);
|
@@ -1512,168 +1512,168 @@ discard block |
||
| 1512 | 1512 | */ |
| 1513 | 1513 | function geodir_action_listings_title() |
| 1514 | 1514 | {
|
| 1515 | - global $wp, $term; |
|
| 1516 | - |
|
| 1517 | - $gd_post_type = geodir_get_current_posttype(); |
|
| 1518 | - $post_type_info = get_post_type_object($gd_post_type); |
|
| 1519 | - |
|
| 1520 | - $add_string_in_title = __('All', 'geodirectory') . ' ';
|
|
| 1521 | - if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
|
|
| 1522 | - $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
|
|
| 1523 | - } |
|
| 1524 | - |
|
| 1525 | - $list_title = $add_string_in_title . __($post_type_info->labels->name, 'geodirectory'); |
|
| 1526 | - $single_name = $post_type_info->labels->singular_name; |
|
| 1527 | - |
|
| 1528 | - $taxonomy = geodir_get_taxonomies($gd_post_type, true); |
|
| 1529 | - |
|
| 1530 | - $gd_country = get_query_var('gd_country');
|
|
| 1531 | - $gd_region = get_query_var('gd_region');
|
|
| 1532 | - $gd_city = get_query_var('gd_city');
|
|
| 1533 | - |
|
| 1534 | - if (!empty($term)) {
|
|
| 1535 | - $location_name = ''; |
|
| 1536 | - if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
|
|
| 1537 | - if ($gd_country != '') {
|
|
| 1538 | - $location_name = geodir_sanitize_location_name('gd_country', $gd_country);
|
|
| 1539 | - } |
|
| 1540 | - |
|
| 1541 | - if ($gd_region != '') {
|
|
| 1542 | - $location_name = geodir_sanitize_location_name('gd_region', $gd_region);
|
|
| 1543 | - } |
|
| 1544 | - |
|
| 1545 | - if ($gd_city != '') {
|
|
| 1546 | - $location_name = geodir_sanitize_location_name('gd_city', $gd_city);
|
|
| 1547 | - } |
|
| 1548 | - } |
|
| 1549 | - |
|
| 1550 | - $current_term = get_term_by('slug', $term, $taxonomy[0]);
|
|
| 1551 | - if (!empty($current_term)) {
|
|
| 1552 | - $current_term_name = __(ucfirst($current_term->name), 'geodirectory'); |
|
| 1553 | - if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
|
|
| 1554 | - $location_last_char = substr($location_name, -1); |
|
| 1555 | - $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
|
|
| 1556 | - $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
|
|
| 1557 | - } else {
|
|
| 1558 | - $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
|
|
| 1559 | - } |
|
| 1560 | - } else {
|
|
| 1561 | - if (count($taxonomy) > 1) {
|
|
| 1562 | - $current_term = get_term_by('slug', $term, $taxonomy[1]);
|
|
| 1563 | - |
|
| 1564 | - if (!empty($current_term)) {
|
|
| 1565 | - $current_term_name = __(ucfirst($current_term->name), 'geodirectory'); |
|
| 1566 | - if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
|
|
| 1567 | - $location_last_char = substr($location_name, -1); |
|
| 1568 | - $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
|
|
| 1569 | - $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
|
|
| 1570 | - } else {
|
|
| 1571 | - $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
|
|
| 1572 | - } |
|
| 1573 | - } |
|
| 1574 | - } |
|
| 1575 | - } |
|
| 1515 | + global $wp, $term; |
|
| 1576 | 1516 | |
| 1577 | - } else {
|
|
| 1578 | - $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : ''; |
|
| 1579 | - $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : ''; |
|
| 1580 | - $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : ''; |
|
| 1517 | + $gd_post_type = geodir_get_current_posttype(); |
|
| 1518 | + $post_type_info = get_post_type_object($gd_post_type); |
|
| 1581 | 1519 | |
| 1582 | - $gd_country_actual = $gd_region_actual = $gd_city_actual = ''; |
|
| 1520 | + $add_string_in_title = __('All', 'geodirectory') . ' ';
|
|
| 1521 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
|
|
| 1522 | + $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
|
|
| 1523 | + } |
|
| 1583 | 1524 | |
| 1584 | - if (function_exists('get_actual_location_name')) {
|
|
| 1585 | - $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
|
|
| 1586 | - $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
|
|
| 1587 | - $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
|
|
| 1588 | - } |
|
| 1525 | + $list_title = $add_string_in_title . __($post_type_info->labels->name, 'geodirectory'); |
|
| 1526 | + $single_name = $post_type_info->labels->singular_name; |
|
| 1589 | 1527 | |
| 1590 | - if ($gd_city != '') {
|
|
| 1591 | - if ($gd_city_actual != '') {
|
|
| 1592 | - $gd_city = $gd_city_actual; |
|
| 1593 | - } else {
|
|
| 1594 | - $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
|
|
| 1595 | - $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
|
|
| 1596 | - $gd_city = __(geodir_ucwords($gd_city), 'geodirectory'); |
|
| 1597 | - } |
|
| 1528 | + $taxonomy = geodir_get_taxonomies($gd_post_type, true); |
|
| 1598 | 1529 | |
| 1599 | - $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
|
|
| 1600 | - } else if ($gd_region != '') {
|
|
| 1601 | - if ($gd_region_actual != '') {
|
|
| 1602 | - $gd_region = $gd_region_actual; |
|
| 1603 | - } else {
|
|
| 1604 | - $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
|
|
| 1605 | - $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
|
|
| 1606 | - $gd_region = __(geodir_ucwords($gd_region), 'geodirectory'); |
|
| 1607 | - } |
|
| 1530 | + $gd_country = get_query_var('gd_country');
|
|
| 1531 | + $gd_region = get_query_var('gd_region');
|
|
| 1532 | + $gd_city = get_query_var('gd_city');
|
|
| 1608 | 1533 | |
| 1609 | - $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
|
|
| 1610 | - } else if ($gd_country != '') {
|
|
| 1611 | - if ($gd_country_actual != '') {
|
|
| 1612 | - $gd_country = $gd_country_actual; |
|
| 1613 | - } else {
|
|
| 1614 | - $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
|
|
| 1615 | - $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
|
|
| 1616 | - $gd_country = __(geodir_ucwords($gd_country), 'geodirectory'); |
|
| 1617 | - } |
|
| 1618 | - |
|
| 1619 | - $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
|
|
| 1620 | - } |
|
| 1621 | - } |
|
| 1622 | - |
|
| 1623 | - if (is_search()) {
|
|
| 1624 | - $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
|
|
| 1625 | - } |
|
| 1626 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 1627 | - $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
|
| 1628 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 1629 | - $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
|
| 1630 | - |
|
| 1631 | - |
|
| 1632 | - $title = $list_title; |
|
| 1633 | - $gd_page = ''; |
|
| 1634 | - if(geodir_is_page('pt')){
|
|
| 1635 | - $gd_page = 'pt'; |
|
| 1636 | - $title = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
|
|
| 1637 | - } |
|
| 1638 | - elseif(geodir_is_page('listing')){
|
|
| 1639 | - $gd_page = 'listing'; |
|
| 1640 | - global $wp_query; |
|
| 1641 | - $current_term = $wp_query->get_queried_object(); |
|
| 1642 | - if (strpos($current_term->taxonomy,'_tags') !== false) {
|
|
| 1643 | - $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
|
|
| 1644 | - }else{
|
|
| 1645 | - $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
|
|
| 1646 | - } |
|
| 1534 | + if (!empty($term)) {
|
|
| 1535 | + $location_name = ''; |
|
| 1536 | + if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
|
|
| 1537 | + if ($gd_country != '') {
|
|
| 1538 | + $location_name = geodir_sanitize_location_name('gd_country', $gd_country);
|
|
| 1539 | + } |
|
| 1647 | 1540 | |
| 1648 | - } |
|
| 1649 | - elseif(geodir_is_page('author')){
|
|
| 1650 | - $gd_page = 'author'; |
|
| 1651 | - if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
|
|
| 1652 | - $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
|
|
| 1653 | - }else{
|
|
| 1654 | - $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
|
|
| 1655 | - } |
|
| 1541 | + if ($gd_region != '') {
|
|
| 1542 | + $location_name = geodir_sanitize_location_name('gd_region', $gd_region);
|
|
| 1543 | + } |
|
| 1656 | 1544 | |
| 1657 | - } |
|
| 1545 | + if ($gd_city != '') {
|
|
| 1546 | + $location_name = geodir_sanitize_location_name('gd_city', $gd_city);
|
|
| 1547 | + } |
|
| 1548 | + } |
|
| 1549 | + |
|
| 1550 | + $current_term = get_term_by('slug', $term, $taxonomy[0]);
|
|
| 1551 | + if (!empty($current_term)) {
|
|
| 1552 | + $current_term_name = __(ucfirst($current_term->name), 'geodirectory'); |
|
| 1553 | + if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
|
|
| 1554 | + $location_last_char = substr($location_name, -1); |
|
| 1555 | + $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
|
|
| 1556 | + $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
|
|
| 1557 | + } else {
|
|
| 1558 | + $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
|
|
| 1559 | + } |
|
| 1560 | + } else {
|
|
| 1561 | + if (count($taxonomy) > 1) {
|
|
| 1562 | + $current_term = get_term_by('slug', $term, $taxonomy[1]);
|
|
| 1563 | + |
|
| 1564 | + if (!empty($current_term)) {
|
|
| 1565 | + $current_term_name = __(ucfirst($current_term->name), 'geodirectory'); |
|
| 1566 | + if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
|
|
| 1567 | + $location_last_char = substr($location_name, -1); |
|
| 1568 | + $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
|
|
| 1569 | + $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
|
|
| 1570 | + } else {
|
|
| 1571 | + $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
|
|
| 1572 | + } |
|
| 1573 | + } |
|
| 1574 | + } |
|
| 1575 | + } |
|
| 1576 | + |
|
| 1577 | + } else {
|
|
| 1578 | + $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : ''; |
|
| 1579 | + $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : ''; |
|
| 1580 | + $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : ''; |
|
| 1581 | + |
|
| 1582 | + $gd_country_actual = $gd_region_actual = $gd_city_actual = ''; |
|
| 1583 | + |
|
| 1584 | + if (function_exists('get_actual_location_name')) {
|
|
| 1585 | + $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
|
|
| 1586 | + $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
|
|
| 1587 | + $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
|
|
| 1588 | + } |
|
| 1589 | + |
|
| 1590 | + if ($gd_city != '') {
|
|
| 1591 | + if ($gd_city_actual != '') {
|
|
| 1592 | + $gd_city = $gd_city_actual; |
|
| 1593 | + } else {
|
|
| 1594 | + $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
|
|
| 1595 | + $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
|
|
| 1596 | + $gd_city = __(geodir_ucwords($gd_city), 'geodirectory'); |
|
| 1597 | + } |
|
| 1658 | 1598 | |
| 1599 | + $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
|
|
| 1600 | + } else if ($gd_region != '') {
|
|
| 1601 | + if ($gd_region_actual != '') {
|
|
| 1602 | + $gd_region = $gd_region_actual; |
|
| 1603 | + } else {
|
|
| 1604 | + $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
|
|
| 1605 | + $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
|
|
| 1606 | + $gd_region = __(geodir_ucwords($gd_region), 'geodirectory'); |
|
| 1607 | + } |
|
| 1659 | 1608 | |
| 1660 | - /** |
|
| 1661 | - * Filter page title to replace variables. |
|
| 1662 | - * |
|
| 1663 | - * @since 1.5.4 |
|
| 1664 | - * @param string $title The page title including variables. |
|
| 1665 | - * @param string $gd_page The GeoDirectory page type if any. |
|
| 1666 | - */ |
|
| 1667 | - $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 1609 | + $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
|
|
| 1610 | + } else if ($gd_country != '') {
|
|
| 1611 | + if ($gd_country_actual != '') {
|
|
| 1612 | + $gd_country = $gd_country_actual; |
|
| 1613 | + } else {
|
|
| 1614 | + $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
|
|
| 1615 | + $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
|
|
| 1616 | + $gd_country = __(geodir_ucwords($gd_country), 'geodirectory'); |
|
| 1617 | + } |
|
| 1668 | 1618 | |
| 1669 | - echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . |
|
| 1670 | - /** |
|
| 1671 | - * Filter the listing page title. |
|
| 1672 | - * |
|
| 1673 | - * @since 1.0.0 |
|
| 1674 | - * @param string $list_title The title for the category page. |
|
| 1675 | - */ |
|
| 1676 | - apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
|
|
| 1619 | + $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
|
|
| 1620 | + } |
|
| 1621 | + } |
|
| 1622 | + |
|
| 1623 | + if (is_search()) {
|
|
| 1624 | + $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
|
|
| 1625 | + } |
|
| 1626 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 1627 | + $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
|
| 1628 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 1629 | + $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
|
| 1630 | + |
|
| 1631 | + |
|
| 1632 | + $title = $list_title; |
|
| 1633 | + $gd_page = ''; |
|
| 1634 | + if(geodir_is_page('pt')){
|
|
| 1635 | + $gd_page = 'pt'; |
|
| 1636 | + $title = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
|
|
| 1637 | + } |
|
| 1638 | + elseif(geodir_is_page('listing')){
|
|
| 1639 | + $gd_page = 'listing'; |
|
| 1640 | + global $wp_query; |
|
| 1641 | + $current_term = $wp_query->get_queried_object(); |
|
| 1642 | + if (strpos($current_term->taxonomy,'_tags') !== false) {
|
|
| 1643 | + $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
|
|
| 1644 | + }else{
|
|
| 1645 | + $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
|
|
| 1646 | + } |
|
| 1647 | + |
|
| 1648 | + } |
|
| 1649 | + elseif(geodir_is_page('author')){
|
|
| 1650 | + $gd_page = 'author'; |
|
| 1651 | + if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
|
|
| 1652 | + $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
|
|
| 1653 | + }else{
|
|
| 1654 | + $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
|
|
| 1655 | + } |
|
| 1656 | + |
|
| 1657 | + } |
|
| 1658 | + |
|
| 1659 | + |
|
| 1660 | + /** |
|
| 1661 | + * Filter page title to replace variables. |
|
| 1662 | + * |
|
| 1663 | + * @since 1.5.4 |
|
| 1664 | + * @param string $title The page title including variables. |
|
| 1665 | + * @param string $gd_page The GeoDirectory page type if any. |
|
| 1666 | + */ |
|
| 1667 | + $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 1668 | + |
|
| 1669 | + echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . |
|
| 1670 | + /** |
|
| 1671 | + * Filter the listing page title. |
|
| 1672 | + * |
|
| 1673 | + * @since 1.0.0 |
|
| 1674 | + * @param string $list_title The title for the category page. |
|
| 1675 | + */ |
|
| 1676 | + apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
|
|
| 1677 | 1677 | } |
| 1678 | 1678 | |
| 1679 | 1679 | add_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
|
@@ -1686,46 +1686,46 @@ discard block |
||
| 1686 | 1686 | */ |
| 1687 | 1687 | function geodir_action_listings_description() |
| 1688 | 1688 | {
|
| 1689 | - global $wp_query; |
|
| 1690 | - $current_term = $wp_query->get_queried_object(); |
|
| 1689 | + global $wp_query; |
|
| 1690 | + $current_term = $wp_query->get_queried_object(); |
|
| 1691 | 1691 | |
| 1692 | - $gd_post_type = geodir_get_current_posttype(); |
|
| 1693 | - if (isset($current_term->term_id) && $current_term->term_id != '') {
|
|
| 1692 | + $gd_post_type = geodir_get_current_posttype(); |
|
| 1693 | + if (isset($current_term->term_id) && $current_term->term_id != '') {
|
|
| 1694 | 1694 | |
| 1695 | - $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags'); |
|
| 1696 | - $saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type)); |
|
| 1697 | - if ($term_desc && !$saved_data) {
|
|
| 1698 | - $saved_data = $term_desc; |
|
| 1699 | - } |
|
| 1695 | + $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags'); |
|
| 1696 | + $saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type)); |
|
| 1697 | + if ($term_desc && !$saved_data) {
|
|
| 1698 | + $saved_data = $term_desc; |
|
| 1699 | + } |
|
| 1700 | 1700 | |
| 1701 | - // stop payment manager filtering content length |
|
| 1702 | - $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' ); |
|
| 1703 | - if ( false !== $filter_priority ) {
|
|
| 1704 | - remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority ); |
|
| 1705 | - } |
|
| 1701 | + // stop payment manager filtering content length |
|
| 1702 | + $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' ); |
|
| 1703 | + if ( false !== $filter_priority ) {
|
|
| 1704 | + remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority ); |
|
| 1705 | + } |
|
| 1706 | 1706 | |
| 1707 | - /** |
|
| 1708 | - * Apply the core filter `the_content` filter to the variable string. |
|
| 1709 | - * |
|
| 1710 | - * This is a WordPress core filter that does many things. |
|
| 1711 | - * |
|
| 1712 | - * @since 1.0.0 |
|
| 1713 | - * @param string $var The string to apply the filter to. |
|
| 1714 | - */ |
|
| 1715 | - $cat_description = apply_filters('the_content', $saved_data);
|
|
| 1707 | + /** |
|
| 1708 | + * Apply the core filter `the_content` filter to the variable string. |
|
| 1709 | + * |
|
| 1710 | + * This is a WordPress core filter that does many things. |
|
| 1711 | + * |
|
| 1712 | + * @since 1.0.0 |
|
| 1713 | + * @param string $var The string to apply the filter to. |
|
| 1714 | + */ |
|
| 1715 | + $cat_description = apply_filters('the_content', $saved_data);
|
|
| 1716 | 1716 | |
| 1717 | 1717 | |
| 1718 | - if ( false !== $filter_priority ) {
|
|
| 1719 | - add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority ); |
|
| 1720 | - } |
|
| 1718 | + if ( false !== $filter_priority ) {
|
|
| 1719 | + add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority ); |
|
| 1720 | + } |
|
| 1721 | 1721 | |
| 1722 | - if ($cat_description) {
|
|
| 1723 | - ?> |
|
| 1722 | + if ($cat_description) {
|
|
| 1723 | + ?> |
|
| 1724 | 1724 | |
| 1725 | 1725 | <div class="term_description"><?php echo $cat_description;?></div> <?php |
| 1726 | - } |
|
| 1726 | + } |
|
| 1727 | 1727 | |
| 1728 | - } |
|
| 1728 | + } |
|
| 1729 | 1729 | } |
| 1730 | 1730 | |
| 1731 | 1731 | // action for adding the listings page top widget area |
@@ -1744,11 +1744,11 @@ discard block |
||
| 1744 | 1744 | */ |
| 1745 | 1745 | function geodir_action_geodir_sidebar_listings_top() |
| 1746 | 1746 | {
|
| 1747 | - if (get_option('geodir_show_listing_top_section')) { ?>
|
|
| 1747 | + if (get_option('geodir_show_listing_top_section')) { ?>
|
|
| 1748 | 1748 | <div |
| 1749 | 1749 | class="<?php |
| 1750 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 1751 | - echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
|
|
| 1750 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 1751 | + echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
|
|
| 1752 | 1752 | <?php dynamic_sidebar('geodir_listing_top'); ?>
|
| 1753 | 1753 | </div><!-- clearfix ends here--> |
| 1754 | 1754 | <?php } |
@@ -1771,35 +1771,35 @@ discard block |
||
| 1771 | 1771 | */ |
| 1772 | 1772 | function geodir_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '') |
| 1773 | 1773 | {
|
| 1774 | - if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
|
|
| 1775 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 1776 | - } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
|
|
| 1777 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 1778 | - } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
|
|
| 1779 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 1780 | - } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
|
|
| 1781 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 1782 | - } else {
|
|
| 1783 | - $width_css = ''; |
|
| 1784 | - } |
|
| 1785 | - |
|
| 1786 | - $tc = get_option('theme_compatibility_setting');
|
|
| 1787 | - if (!empty($tc['geodir_sidebar_left_open_replace'])) {
|
|
| 1788 | - $text = $tc['geodir_sidebar_left_open_replace']; |
|
| 1789 | - } else {
|
|
| 1790 | - $text = '<aside id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'; |
|
| 1791 | - } |
|
| 1792 | - |
|
| 1793 | - if (!empty($tc['geodir_sidebar_left_open_id'])) {
|
|
| 1794 | - $id = $tc['geodir_sidebar_left_open_id']; |
|
| 1795 | - } |
|
| 1796 | - if (!empty($tc['geodir_sidebar_left_open_class'])) {
|
|
| 1797 | - $class = $tc['geodir_sidebar_left_open_class']; |
|
| 1798 | - } |
|
| 1799 | - |
|
| 1800 | - $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
|
|
| 1801 | - |
|
| 1802 | - echo $text; |
|
| 1774 | + if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
|
|
| 1775 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 1776 | + } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
|
|
| 1777 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 1778 | + } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
|
|
| 1779 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 1780 | + } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
|
|
| 1781 | + $width_css = 'style="width:' . $width . '%;"'; |
|
| 1782 | + } else {
|
|
| 1783 | + $width_css = ''; |
|
| 1784 | + } |
|
| 1785 | + |
|
| 1786 | + $tc = get_option('theme_compatibility_setting');
|
|
| 1787 | + if (!empty($tc['geodir_sidebar_left_open_replace'])) {
|
|
| 1788 | + $text = $tc['geodir_sidebar_left_open_replace']; |
|
| 1789 | + } else {
|
|
| 1790 | + $text = '<aside id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'; |
|
| 1791 | + } |
|
| 1792 | + |
|
| 1793 | + if (!empty($tc['geodir_sidebar_left_open_id'])) {
|
|
| 1794 | + $id = $tc['geodir_sidebar_left_open_id']; |
|
| 1795 | + } |
|
| 1796 | + if (!empty($tc['geodir_sidebar_left_open_class'])) {
|
|
| 1797 | + $class = $tc['geodir_sidebar_left_open_class']; |
|
| 1798 | + } |
|
| 1799 | + |
|
| 1800 | + $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
|
|
| 1801 | + |
|
| 1802 | + echo $text; |
|
| 1803 | 1803 | } |
| 1804 | 1804 | |
| 1805 | 1805 | // action for adding the primary div closing tag |
@@ -1815,13 +1815,13 @@ discard block |
||
| 1815 | 1815 | */ |
| 1816 | 1816 | function geodir_action_sidebar_left_close($type = '') |
| 1817 | 1817 | {
|
| 1818 | - $tc = get_option('theme_compatibility_setting');
|
|
| 1819 | - if (!empty($tc['geodir_sidebar_left_close_replace'])) {
|
|
| 1820 | - $text = $tc['geodir_sidebar_left_close_replace']; |
|
| 1821 | - } else {
|
|
| 1822 | - $text = '</aside><!-- sidebar ends here-->'; |
|
| 1823 | - } |
|
| 1824 | - echo $text; |
|
| 1818 | + $tc = get_option('theme_compatibility_setting');
|
|
| 1819 | + if (!empty($tc['geodir_sidebar_left_close_replace'])) {
|
|
| 1820 | + $text = $tc['geodir_sidebar_left_close_replace']; |
|
| 1821 | + } else {
|
|
| 1822 | + $text = '</aside><!-- sidebar ends here-->'; |
|
| 1823 | + } |
|
| 1824 | + echo $text; |
|
| 1825 | 1825 | } |
| 1826 | 1826 | |
| 1827 | 1827 | /** |
@@ -1834,7 +1834,7 @@ discard block |
||
| 1834 | 1834 | */ |
| 1835 | 1835 | function geodir_listing_left_section() |
| 1836 | 1836 | {
|
| 1837 | - if (get_option('geodir_show_listing_left_section')) { ?>
|
|
| 1837 | + if (get_option('geodir_show_listing_left_section')) { ?>
|
|
| 1838 | 1838 | <div class="geodir-content-left geodir-sidebar-wrap"> |
| 1839 | 1839 | <?php dynamic_sidebar('geodir_listing_left_sidebar'); ?>
|
| 1840 | 1840 | </div><!-- end geodir-content-left --> |
@@ -1852,20 +1852,20 @@ discard block |
||
| 1852 | 1852 | */ |
| 1853 | 1853 | function geodir_action_listings_sidebar_left() |
| 1854 | 1854 | {
|
| 1855 | - if (get_option('geodir_show_listing_left_section')) {
|
|
| 1856 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 1857 | - do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'https://schema.org/WPSideBar');
|
|
| 1858 | - /** |
|
| 1859 | - * Calls the listings page (category) left sidebar content. |
|
| 1860 | - * |
|
| 1861 | - * All the content for the listings page left sidebar is added via this hook. |
|
| 1862 | - * |
|
| 1863 | - * @since 1.0.0 |
|
| 1864 | - */ |
|
| 1865 | - do_action('geodir_listings_sidebar_left_inside');
|
|
| 1866 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 1867 | - do_action('geodir_sidebar_left_close', 'listings-page');
|
|
| 1868 | - } |
|
| 1855 | + if (get_option('geodir_show_listing_left_section')) {
|
|
| 1856 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 1857 | + do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'https://schema.org/WPSideBar');
|
|
| 1858 | + /** |
|
| 1859 | + * Calls the listings page (category) left sidebar content. |
|
| 1860 | + * |
|
| 1861 | + * All the content for the listings page left sidebar is added via this hook. |
|
| 1862 | + * |
|
| 1863 | + * @since 1.0.0 |
|
| 1864 | + */ |
|
| 1865 | + do_action('geodir_listings_sidebar_left_inside');
|
|
| 1866 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 1867 | + do_action('geodir_sidebar_left_close', 'listings-page');
|
|
| 1868 | + } |
|
| 1869 | 1869 | } |
| 1870 | 1870 | |
| 1871 | 1871 | /** |
@@ -1878,7 +1878,7 @@ discard block |
||
| 1878 | 1878 | */ |
| 1879 | 1879 | function geodir_listing_right_section() |
| 1880 | 1880 | {
|
| 1881 | - if (get_option('geodir_show_listing_right_section')) { ?>
|
|
| 1881 | + if (get_option('geodir_show_listing_right_section')) { ?>
|
|
| 1882 | 1882 | <div class="geodir-content-right geodir-sidebar-wrap"> |
| 1883 | 1883 | <?php dynamic_sidebar('geodir_listing_right_sidebar'); ?>
|
| 1884 | 1884 | </div><!-- end geodir-content-right --> |
@@ -1896,20 +1896,20 @@ discard block |
||
| 1896 | 1896 | */ |
| 1897 | 1897 | function geodir_action_listings_sidebar_right() |
| 1898 | 1898 | {
|
| 1899 | - if (get_option('geodir_show_listing_right_section')) {
|
|
| 1900 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 1901 | - do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 1902 | - /** |
|
| 1903 | - * Calls the listings page (category) right sidebar content. |
|
| 1904 | - * |
|
| 1905 | - * All the content for the listings page right sidebar is added via this hook. |
|
| 1906 | - * |
|
| 1907 | - * @since 1.0.0 |
|
| 1908 | - */ |
|
| 1909 | - do_action('geodir_listings_sidebar_right_inside');
|
|
| 1910 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 1911 | - do_action('geodir_sidebar_right_close', 'listings-page');
|
|
| 1912 | - } |
|
| 1899 | + if (get_option('geodir_show_listing_right_section')) {
|
|
| 1900 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 1901 | + do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 1902 | + /** |
|
| 1903 | + * Calls the listings page (category) right sidebar content. |
|
| 1904 | + * |
|
| 1905 | + * All the content for the listings page right sidebar is added via this hook. |
|
| 1906 | + * |
|
| 1907 | + * @since 1.0.0 |
|
| 1908 | + */ |
|
| 1909 | + do_action('geodir_listings_sidebar_right_inside');
|
|
| 1910 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 1911 | + do_action('geodir_sidebar_right_close', 'listings-page');
|
|
| 1912 | + } |
|
| 1913 | 1913 | } |
| 1914 | 1914 | |
| 1915 | 1915 | |
@@ -1926,23 +1926,23 @@ discard block |
||
| 1926 | 1926 | */ |
| 1927 | 1927 | function geodir_action_main_content_open($type = '', $id = '', $class = '') |
| 1928 | 1928 | {
|
| 1929 | - $tc = get_option('theme_compatibility_setting');
|
|
| 1930 | - if (!empty($tc['geodir_main_content_open_replace'])) {
|
|
| 1931 | - $text = $tc['geodir_main_content_open_replace']; |
|
| 1932 | - } else {
|
|
| 1933 | - $text = '<main id="[id]" class="[class]" role="main">'; |
|
| 1934 | - } |
|
| 1929 | + $tc = get_option('theme_compatibility_setting');
|
|
| 1930 | + if (!empty($tc['geodir_main_content_open_replace'])) {
|
|
| 1931 | + $text = $tc['geodir_main_content_open_replace']; |
|
| 1932 | + } else {
|
|
| 1933 | + $text = '<main id="[id]" class="[class]" role="main">'; |
|
| 1934 | + } |
|
| 1935 | 1935 | |
| 1936 | - if (!empty($tc['geodir_main_content_open_id'])) {
|
|
| 1937 | - $id = $tc['geodir_main_content_open_id']; |
|
| 1938 | - } |
|
| 1939 | - if (!empty($tc['geodir_main_content_open_class'])) {
|
|
| 1940 | - $class = $tc['geodir_main_content_open_class']; |
|
| 1941 | - } |
|
| 1936 | + if (!empty($tc['geodir_main_content_open_id'])) {
|
|
| 1937 | + $id = $tc['geodir_main_content_open_id']; |
|
| 1938 | + } |
|
| 1939 | + if (!empty($tc['geodir_main_content_open_class'])) {
|
|
| 1940 | + $class = $tc['geodir_main_content_open_class']; |
|
| 1941 | + } |
|
| 1942 | 1942 | |
| 1943 | - $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
|
|
| 1943 | + $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
|
|
| 1944 | 1944 | |
| 1945 | - echo $text; |
|
| 1945 | + echo $text; |
|
| 1946 | 1946 | } |
| 1947 | 1947 | |
| 1948 | 1948 | // action for adding the primary div closing tag |
@@ -1955,13 +1955,13 @@ discard block |
||
| 1955 | 1955 | */ |
| 1956 | 1956 | function geodir_action_main_content_close() |
| 1957 | 1957 | {
|
| 1958 | - $tc = get_option('theme_compatibility_setting');
|
|
| 1959 | - if (!empty($tc['geodir_main_content_close_replace'])) {
|
|
| 1960 | - $text = $tc['geodir_main_content_close_replace']; |
|
| 1961 | - } else {
|
|
| 1962 | - $text = '</main><!-- main ends here-->'; |
|
| 1963 | - } |
|
| 1964 | - echo $text; |
|
| 1958 | + $tc = get_option('theme_compatibility_setting');
|
|
| 1959 | + if (!empty($tc['geodir_main_content_close_replace'])) {
|
|
| 1960 | + $text = $tc['geodir_main_content_close_replace']; |
|
| 1961 | + } else {
|
|
| 1962 | + $text = '</main><!-- main ends here-->'; |
|
| 1963 | + } |
|
| 1964 | + echo $text; |
|
| 1965 | 1965 | } |
| 1966 | 1966 | |
| 1967 | 1967 | /** |
@@ -1973,14 +1973,14 @@ discard block |
||
| 1973 | 1973 | */ |
| 1974 | 1974 | function geodir_action_listings_content_inside() |
| 1975 | 1975 | {
|
| 1976 | - global $gridview_columns; |
|
| 1977 | - $listing_view = get_option('geodir_listing_view');
|
|
| 1978 | - if (strstr($listing_view, 'gridview')) {
|
|
| 1979 | - $gridview_columns = $listing_view; |
|
| 1980 | - $listing_view_exp = explode('_', $listing_view);
|
|
| 1981 | - $listing_view = $listing_view_exp[0]; |
|
| 1982 | - } |
|
| 1983 | - geodir_get_template_part('listing', 'listview');
|
|
| 1976 | + global $gridview_columns; |
|
| 1977 | + $listing_view = get_option('geodir_listing_view');
|
|
| 1978 | + if (strstr($listing_view, 'gridview')) {
|
|
| 1979 | + $gridview_columns = $listing_view; |
|
| 1980 | + $listing_view_exp = explode('_', $listing_view);
|
|
| 1981 | + $listing_view = $listing_view_exp[0]; |
|
| 1982 | + } |
|
| 1983 | + geodir_get_template_part('listing', 'listview');
|
|
| 1984 | 1984 | } |
| 1985 | 1985 | |
| 1986 | 1986 | add_action('geodir_listings_content_inside', 'geodir_action_listings_content_inside', 10);
|
@@ -1996,47 +1996,47 @@ discard block |
||
| 1996 | 1996 | */ |
| 1997 | 1997 | function geodir_action_listings_content() |
| 1998 | 1998 | {
|
| 1999 | - /** |
|
| 2000 | - * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc. |
|
| 2001 | - * |
|
| 2002 | - * @since 1.0.0 |
|
| 2003 | - * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'. |
|
| 2004 | - * @param string $id The id for the div. Usually 'geodir-main-content'. |
|
| 2005 | - * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'. |
|
| 2006 | - * @see 'geodir_main_content_close' Where the oposing closing tag is added. |
|
| 2007 | - */ |
|
| 2008 | - do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
|
|
| 2009 | - $extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
|
|
| 2010 | - echo '<div class="clearfix '.$extra_class.'">'; |
|
| 2011 | - /** |
|
| 2012 | - * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages. |
|
| 2013 | - * |
|
| 2014 | - * @since 1.0.0 |
|
| 2015 | - */ |
|
| 2016 | - do_action('geodir_before_listing');
|
|
| 2017 | - echo '</div>'; |
|
| 2018 | - |
|
| 2019 | - /** |
|
| 2020 | - * This actions calls the listings list content. Used on listings pages and search and author pages. |
|
| 2021 | - * |
|
| 2022 | - * @since 1.0.0 |
|
| 2023 | - */ |
|
| 2024 | - do_action('geodir_listings_content_inside');
|
|
| 2025 | - |
|
| 2026 | - /** |
|
| 2027 | - * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages. |
|
| 2028 | - * |
|
| 2029 | - * @since 1.0.0 |
|
| 2030 | - */ |
|
| 2031 | - do_action('geodir_after_listing');
|
|
| 2032 | - |
|
| 2033 | - /** |
|
| 2034 | - * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc. |
|
| 2035 | - * |
|
| 2036 | - * @since 1.0.0 |
|
| 2037 | - * @see 'geodir_main_content_open' Where the oposing opening tag is added. |
|
| 2038 | - */ |
|
| 2039 | - do_action('geodir_main_content_close', 'listings-page');
|
|
| 1999 | + /** |
|
| 2000 | + * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc. |
|
| 2001 | + * |
|
| 2002 | + * @since 1.0.0 |
|
| 2003 | + * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'. |
|
| 2004 | + * @param string $id The id for the div. Usually 'geodir-main-content'. |
|
| 2005 | + * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'. |
|
| 2006 | + * @see 'geodir_main_content_close' Where the oposing closing tag is added. |
|
| 2007 | + */ |
|
| 2008 | + do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
|
|
| 2009 | + $extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
|
|
| 2010 | + echo '<div class="clearfix '.$extra_class.'">'; |
|
| 2011 | + /** |
|
| 2012 | + * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages. |
|
| 2013 | + * |
|
| 2014 | + * @since 1.0.0 |
|
| 2015 | + */ |
|
| 2016 | + do_action('geodir_before_listing');
|
|
| 2017 | + echo '</div>'; |
|
| 2018 | + |
|
| 2019 | + /** |
|
| 2020 | + * This actions calls the listings list content. Used on listings pages and search and author pages. |
|
| 2021 | + * |
|
| 2022 | + * @since 1.0.0 |
|
| 2023 | + */ |
|
| 2024 | + do_action('geodir_listings_content_inside');
|
|
| 2025 | + |
|
| 2026 | + /** |
|
| 2027 | + * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages. |
|
| 2028 | + * |
|
| 2029 | + * @since 1.0.0 |
|
| 2030 | + */ |
|
| 2031 | + do_action('geodir_after_listing');
|
|
| 2032 | + |
|
| 2033 | + /** |
|
| 2034 | + * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc. |
|
| 2035 | + * |
|
| 2036 | + * @since 1.0.0 |
|
| 2037 | + * @see 'geodir_main_content_open' Where the oposing opening tag is added. |
|
| 2038 | + */ |
|
| 2039 | + do_action('geodir_main_content_close', 'listings-page');
|
|
| 2040 | 2040 | } |
| 2041 | 2041 | |
| 2042 | 2042 | |
@@ -2051,10 +2051,10 @@ discard block |
||
| 2051 | 2051 | */ |
| 2052 | 2052 | function geodir_action_sidebar_listings_bottom_section() |
| 2053 | 2053 | {
|
| 2054 | - if (get_option('geodir_show_listing_bottom_section')) { ?>
|
|
| 2054 | + if (get_option('geodir_show_listing_bottom_section')) { ?>
|
|
| 2055 | 2055 | <div class="<?php |
| 2056 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2057 | - echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
|
|
| 2056 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2057 | + echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
|
|
| 2058 | 2058 | <?php dynamic_sidebar('geodir_listing_bottom'); ?>
|
| 2059 | 2059 | </div><!-- clearfix ends here--> |
| 2060 | 2060 | <?php } |
@@ -2074,38 +2074,38 @@ discard block |
||
| 2074 | 2074 | */ |
| 2075 | 2075 | function geodir_action_add_listing_page_title() |
| 2076 | 2076 | {
|
| 2077 | - if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '') |
|
| 2078 | - $listing_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2079 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2080 | - $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
|
| 2081 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2082 | - $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
|
| 2083 | - |
|
| 2084 | - $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
|
|
| 2085 | - |
|
| 2086 | - if(geodir_is_page('add-listing')){
|
|
| 2087 | - $gd_page = 'add-listing'; |
|
| 2088 | - if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
|
|
| 2089 | - $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
|
|
| 2090 | - }elseif(isset($listing_type)){
|
|
| 2091 | - $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
|
|
| 2092 | - } |
|
| 2077 | + if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '') |
|
| 2078 | + $listing_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2079 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2080 | + $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
|
| 2081 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2082 | + $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
|
| 2083 | + |
|
| 2084 | + $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
|
|
| 2085 | + |
|
| 2086 | + if(geodir_is_page('add-listing')){
|
|
| 2087 | + $gd_page = 'add-listing'; |
|
| 2088 | + if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
|
|
| 2089 | + $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
|
|
| 2090 | + }elseif(isset($listing_type)){
|
|
| 2091 | + $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
|
|
| 2092 | + } |
|
| 2093 | 2093 | |
| 2094 | - } |
|
| 2094 | + } |
|
| 2095 | 2095 | |
| 2096 | 2096 | |
| 2097 | - /** |
|
| 2098 | - * Filter page title to replace variables. |
|
| 2099 | - * |
|
| 2100 | - * @since 1.5.4 |
|
| 2101 | - * @param string $title The page title including variables. |
|
| 2102 | - * @param string $gd_page The GeoDirectory page type if any. |
|
| 2103 | - */ |
|
| 2104 | - $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 2097 | + /** |
|
| 2098 | + * Filter page title to replace variables. |
|
| 2099 | + * |
|
| 2100 | + * @since 1.5.4 |
|
| 2101 | + * @param string $title The page title including variables. |
|
| 2102 | + * @param string $gd_page The GeoDirectory page type if any. |
|
| 2103 | + */ |
|
| 2104 | + $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 2105 | 2105 | |
| 2106 | - echo '<header class="' . $class_header . '"><h1 class="' . $class . '">'; |
|
| 2107 | - echo $title; |
|
| 2108 | - echo '</h1></header>'; |
|
| 2106 | + echo '<header class="' . $class_header . '"><h1 class="' . $class . '">'; |
|
| 2107 | + echo $title; |
|
| 2108 | + echo '</h1></header>'; |
|
| 2109 | 2109 | } |
| 2110 | 2110 | |
| 2111 | 2111 | add_action('geodir_add_listing_page_mandatory', 'geodir_action_add_listing_page_mandatory', 10);
|
@@ -2136,61 +2136,61 @@ discard block |
||
| 2136 | 2136 | */ |
| 2137 | 2137 | function geodir_action_add_listing_form() |
| 2138 | 2138 | {
|
| 2139 | - global $cat_display, $post_cat, $current_user, $gd_session; |
|
| 2140 | - $page_id = get_the_ID(); |
|
| 2141 | - $post = ''; |
|
| 2142 | - $title = ''; |
|
| 2143 | - $desc = ''; |
|
| 2144 | - $kw_tags = ''; |
|
| 2145 | - $required_msg = ''; |
|
| 2146 | - $submit_button = ''; |
|
| 2147 | - |
|
| 2148 | - $ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add'; |
|
| 2149 | - |
|
| 2150 | - $thumb_img_arr = array(); |
|
| 2151 | - $curImages = ''; |
|
| 2152 | - |
|
| 2153 | - if (isset($_REQUEST['backandedit'])) {
|
|
| 2154 | - global $post; |
|
| 2155 | - $post = (object)$gd_session->get('listing');
|
|
| 2156 | - $listing_type = $post->listing_type; |
|
| 2157 | - $title = $post->post_title; |
|
| 2158 | - $desc = $post->post_desc; |
|
| 2159 | - $post_cat = $post->post_category; |
|
| 2160 | - |
|
| 2161 | - $kw_tags = $post->post_tags; |
|
| 2162 | - $curImages = isset($post->post_images) ? $post->post_images : ''; |
|
| 2163 | - } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 2164 | - global $post, $post_images; |
|
| 2165 | - |
|
| 2166 | - $post = geodir_get_post_info($_REQUEST['pid']); |
|
| 2167 | - $thumb_img_arr = geodir_get_images($post->ID); |
|
| 2168 | - if ($thumb_img_arr) {
|
|
| 2169 | - foreach ($thumb_img_arr as $post_img) {
|
|
| 2170 | - $curImages .= $post_img->src . ','; |
|
| 2171 | - } |
|
| 2172 | - } |
|
| 2139 | + global $cat_display, $post_cat, $current_user, $gd_session; |
|
| 2140 | + $page_id = get_the_ID(); |
|
| 2141 | + $post = ''; |
|
| 2142 | + $title = ''; |
|
| 2143 | + $desc = ''; |
|
| 2144 | + $kw_tags = ''; |
|
| 2145 | + $required_msg = ''; |
|
| 2146 | + $submit_button = ''; |
|
| 2147 | + |
|
| 2148 | + $ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add'; |
|
| 2149 | + |
|
| 2150 | + $thumb_img_arr = array(); |
|
| 2151 | + $curImages = ''; |
|
| 2152 | + |
|
| 2153 | + if (isset($_REQUEST['backandedit'])) {
|
|
| 2154 | + global $post; |
|
| 2155 | + $post = (object)$gd_session->get('listing');
|
|
| 2156 | + $listing_type = $post->listing_type; |
|
| 2157 | + $title = $post->post_title; |
|
| 2158 | + $desc = $post->post_desc; |
|
| 2159 | + $post_cat = $post->post_category; |
|
| 2160 | + |
|
| 2161 | + $kw_tags = $post->post_tags; |
|
| 2162 | + $curImages = isset($post->post_images) ? $post->post_images : ''; |
|
| 2163 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 2164 | + global $post, $post_images; |
|
| 2165 | + |
|
| 2166 | + $post = geodir_get_post_info($_REQUEST['pid']); |
|
| 2167 | + $thumb_img_arr = geodir_get_images($post->ID); |
|
| 2168 | + if ($thumb_img_arr) {
|
|
| 2169 | + foreach ($thumb_img_arr as $post_img) {
|
|
| 2170 | + $curImages .= $post_img->src . ','; |
|
| 2171 | + } |
|
| 2172 | + } |
|
| 2173 | 2173 | |
| 2174 | - $listing_type = $post->post_type; |
|
| 2175 | - $title = $post->post_title; |
|
| 2176 | - $desc = $post->post_content; |
|
| 2177 | - $kw_tags = $post->post_tags; |
|
| 2178 | - $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
|
|
| 2179 | - } else {
|
|
| 2180 | - $listing_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2181 | - } |
|
| 2174 | + $listing_type = $post->post_type; |
|
| 2175 | + $title = $post->post_title; |
|
| 2176 | + $desc = $post->post_content; |
|
| 2177 | + $kw_tags = $post->post_tags; |
|
| 2178 | + $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
|
|
| 2179 | + } else {
|
|
| 2180 | + $listing_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2181 | + } |
|
| 2182 | 2182 | |
| 2183 | - if ($current_user->ID != '0') {
|
|
| 2184 | - $user_login = true; |
|
| 2185 | - } |
|
| 2183 | + if ($current_user->ID != '0') {
|
|
| 2184 | + $user_login = true; |
|
| 2185 | + } |
|
| 2186 | 2186 | |
| 2187 | - $post_type_info = geodir_get_posttype_info($listing_type); |
|
| 2187 | + $post_type_info = geodir_get_posttype_info($listing_type); |
|
| 2188 | 2188 | |
| 2189 | - $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing','geodirectory');
|
|
| 2189 | + $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing','geodirectory');
|
|
| 2190 | 2190 | |
| 2191 | - $package_info = array(); |
|
| 2192 | - $package_info = geodir_post_package_info($package_info, $post); |
|
| 2193 | - ?> |
|
| 2191 | + $package_info = array(); |
|
| 2192 | + $package_info = geodir_post_package_info($package_info, $post); |
|
| 2193 | + ?> |
|
| 2194 | 2194 | <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data"> |
| 2195 | 2195 | <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/> |
| 2196 | 2196 | <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/> |
@@ -2201,114 +2201,114 @@ discard block |
||
| 2201 | 2201 | <?php } if (isset($_REQUEST['backandedit'])) { ?>
|
| 2202 | 2202 | <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/> |
| 2203 | 2203 | <?php |
| 2204 | - } |
|
| 2205 | - /** |
|
| 2206 | - * Called at the very top of the add listing page form for frontend. |
|
| 2207 | - * |
|
| 2208 | - * This is called just before the "Enter Listing Details" text. |
|
| 2209 | - * |
|
| 2210 | - * @since 1.0.0 |
|
| 2211 | - */ |
|
| 2212 | - do_action('geodir_before_detail_fields');
|
|
| 2213 | - ?> |
|
| 2204 | + } |
|
| 2205 | + /** |
|
| 2206 | + * Called at the very top of the add listing page form for frontend. |
|
| 2207 | + * |
|
| 2208 | + * This is called just before the "Enter Listing Details" text. |
|
| 2209 | + * |
|
| 2210 | + * @since 1.0.0 |
|
| 2211 | + */ |
|
| 2212 | + do_action('geodir_before_detail_fields');
|
|
| 2213 | + ?> |
|
| 2214 | 2214 | <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5> |
| 2215 | 2215 | <?php |
| 2216 | - /** |
|
| 2217 | - * Called at the top of the add listing page form for frontend. |
|
| 2218 | - * |
|
| 2219 | - * This is called after the "Enter Listing Details" text. |
|
| 2220 | - * |
|
| 2221 | - * @since 1.0.0 |
|
| 2222 | - */ |
|
| 2223 | - do_action('geodir_before_main_form_fields');
|
|
| 2224 | - ?> |
|
| 2216 | + /** |
|
| 2217 | + * Called at the top of the add listing page form for frontend. |
|
| 2218 | + * |
|
| 2219 | + * This is called after the "Enter Listing Details" text. |
|
| 2220 | + * |
|
| 2221 | + * @since 1.0.0 |
|
| 2222 | + */ |
|
| 2223 | + do_action('geodir_before_main_form_fields');
|
|
| 2224 | + ?> |
|
| 2225 | 2225 | <div id="geodir_post_title_row" class="required_field geodir_form_row clearfix gd-fieldset-details"> |
| 2226 | 2226 | <label><?php |
| 2227 | - /** |
|
| 2228 | - * Filter the add listing page title input label. |
|
| 2229 | - * |
|
| 2230 | - * @since 1.6.11 |
|
| 2231 | - * @param string $title The title to be output. |
|
| 2232 | - * @param string $cpt_singular_name The singular title of the curent CPT. |
|
| 2233 | - * @param string $listing_type The CPT being requested. ie: gd_place. |
|
| 2234 | - */ |
|
| 2235 | - echo apply_filters('geodir_add_listing_title_label', sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span>*</span> </label>
|
|
| 2227 | + /** |
|
| 2228 | + * Filter the add listing page title input label. |
|
| 2229 | + * |
|
| 2230 | + * @since 1.6.11 |
|
| 2231 | + * @param string $title The title to be output. |
|
| 2232 | + * @param string $cpt_singular_name The singular title of the curent CPT. |
|
| 2233 | + * @param string $listing_type The CPT being requested. ie: gd_place. |
|
| 2234 | + */ |
|
| 2235 | + echo apply_filters('geodir_add_listing_title_label', sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span>*</span> </label>
|
|
| 2236 | 2236 | <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield" |
| 2237 | 2237 | value="<?php echo esc_attr(stripslashes($title)); ?>"/> |
| 2238 | 2238 | <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span> |
| 2239 | 2239 | </div> |
| 2240 | 2240 | <?php |
| 2241 | - $show_editor = get_option('geodir_tiny_editor_on_add_listing');
|
|
| 2242 | - $show_editor = !empty($show_editor) && in_array($listing_type, $show_editor) ? true : false; |
|
| 2243 | - /** |
|
| 2244 | - * Filter whether to show or don't show the editor. |
|
| 2245 | - * |
|
| 2246 | - * @since 1.6.16 |
|
| 2247 | - * @param bool $show_editor If true the editor will be available for description field. |
|
| 2248 | - * @param object $package_info The listing package. |
|
| 2249 | - * @param string $listing_type The current post type. |
|
| 2250 | - * @param object $post The current post object. |
|
| 2251 | - */ |
|
| 2252 | - $show_editor = apply_filters('geodir_description_field_show_editor', $show_editor, $package_info, $listing_type, $post);
|
|
| 2253 | - |
|
| 2254 | - $desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc)); |
|
| 2255 | - $desc_limit = ''; |
|
| 2256 | - /** |
|
| 2257 | - * Filter the add listing description field character limit number. |
|
| 2258 | - * |
|
| 2259 | - * @since 1.0.0 |
|
| 2260 | - * @param int $desc_limit The amount of characters to limit the description to. |
|
| 2261 | - */ |
|
| 2262 | - $desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
|
|
| 2263 | - /** |
|
| 2264 | - * Filter the add listing description field text. |
|
| 2265 | - * |
|
| 2266 | - * @since 1.0.0 |
|
| 2267 | - * @param string $desc The text for the description field. |
|
| 2268 | - * @param int $desc_limit The character limit number if any. |
|
| 2269 | - */ |
|
| 2270 | - $desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
|
|
| 2271 | - $desc_limit_msg = ''; |
|
| 2272 | - /** |
|
| 2273 | - * Filter the add listing description limit message. |
|
| 2274 | - * |
|
| 2275 | - * This is the message shown if there is a limit applied to the amount of characters the description can use. |
|
| 2276 | - * |
|
| 2277 | - * @since 1.0.0 |
|
| 2278 | - * @param string $desc_limit_msg The limit message string if any. |
|
| 2279 | - * @param int $desc_limit The character limit numer if any. |
|
| 2280 | - */ |
|
| 2281 | - $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
|
|
| 2241 | + $show_editor = get_option('geodir_tiny_editor_on_add_listing');
|
|
| 2242 | + $show_editor = !empty($show_editor) && in_array($listing_type, $show_editor) ? true : false; |
|
| 2243 | + /** |
|
| 2244 | + * Filter whether to show or don't show the editor. |
|
| 2245 | + * |
|
| 2246 | + * @since 1.6.16 |
|
| 2247 | + * @param bool $show_editor If true the editor will be available for description field. |
|
| 2248 | + * @param object $package_info The listing package. |
|
| 2249 | + * @param string $listing_type The current post type. |
|
| 2250 | + * @param object $post The current post object. |
|
| 2251 | + */ |
|
| 2252 | + $show_editor = apply_filters('geodir_description_field_show_editor', $show_editor, $package_info, $listing_type, $post);
|
|
| 2253 | + |
|
| 2254 | + $desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc)); |
|
| 2255 | + $desc_limit = ''; |
|
| 2256 | + /** |
|
| 2257 | + * Filter the add listing description field character limit number. |
|
| 2258 | + * |
|
| 2259 | + * @since 1.0.0 |
|
| 2260 | + * @param int $desc_limit The amount of characters to limit the description to. |
|
| 2261 | + */ |
|
| 2262 | + $desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
|
|
| 2263 | + /** |
|
| 2264 | + * Filter the add listing description field text. |
|
| 2265 | + * |
|
| 2266 | + * @since 1.0.0 |
|
| 2267 | + * @param string $desc The text for the description field. |
|
| 2268 | + * @param int $desc_limit The character limit number if any. |
|
| 2269 | + */ |
|
| 2270 | + $desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
|
|
| 2271 | + $desc_limit_msg = ''; |
|
| 2272 | + /** |
|
| 2273 | + * Filter the add listing description limit message. |
|
| 2274 | + * |
|
| 2275 | + * This is the message shown if there is a limit applied to the amount of characters the description can use. |
|
| 2276 | + * |
|
| 2277 | + * @since 1.0.0 |
|
| 2278 | + * @param string $desc_limit_msg The limit message string if any. |
|
| 2279 | + * @param int $desc_limit The character limit numer if any. |
|
| 2280 | + */ |
|
| 2281 | + $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
|
|
| 2282 | 2282 | |
| 2283 | - $desc_class = ''; |
|
| 2284 | - if ($desc_limit === '' || (int)$desc_limit > 0) {
|
|
| 2285 | - /** |
|
| 2286 | - * Called on the add listing page form for frontend just before the description field. |
|
| 2287 | - * |
|
| 2288 | - * @since 1.0.0 |
|
| 2289 | - */ |
|
| 2290 | - do_action('geodir_before_description_field');
|
|
| 2283 | + $desc_class = ''; |
|
| 2284 | + if ($desc_limit === '' || (int)$desc_limit > 0) {
|
|
| 2285 | + /** |
|
| 2286 | + * Called on the add listing page form for frontend just before the description field. |
|
| 2287 | + * |
|
| 2288 | + * @since 1.0.0 |
|
| 2289 | + */ |
|
| 2290 | + do_action('geodir_before_description_field');
|
|
| 2291 | 2291 | |
| 2292 | - $desc_class = ' required_field'; |
|
| 2293 | - } else {
|
|
| 2294 | - $desc_class = ' hidden'; |
|
| 2295 | - } |
|
| 2296 | - ?> |
|
| 2292 | + $desc_class = ' required_field'; |
|
| 2293 | + } else {
|
|
| 2294 | + $desc_class = ' hidden'; |
|
| 2295 | + } |
|
| 2296 | + ?> |
|
| 2297 | 2297 | <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>"> |
| 2298 | 2298 | <label><?php |
| 2299 | - /** |
|
| 2300 | - * Filter the add listing page description input label. |
|
| 2301 | - * |
|
| 2302 | - * @since 1.6.11 |
|
| 2303 | - * @param string $title The title to be output. |
|
| 2304 | - * @param string $cpt_singular_name The singular title of the curent CPT. |
|
| 2305 | - * @param string $listing_type The CPT being requested. ie: gd_place. |
|
| 2306 | - */ |
|
| 2307 | - echo apply_filters('geodir_add_listing_description_label',sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
|
|
| 2299 | + /** |
|
| 2300 | + * Filter the add listing page description input label. |
|
| 2301 | + * |
|
| 2302 | + * @since 1.6.11 |
|
| 2303 | + * @param string $title The title to be output. |
|
| 2304 | + * @param string $cpt_singular_name The singular title of the curent CPT. |
|
| 2305 | + * @param string $listing_type The CPT being requested. ie: gd_place. |
|
| 2306 | + */ |
|
| 2307 | + echo apply_filters('geodir_add_listing_description_label',sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
|
|
| 2308 | 2308 | <?php |
| 2309 | - if ($show_editor) {
|
|
| 2310 | - $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
|
|
| 2311 | - ?> |
|
| 2309 | + if ($show_editor) {
|
|
| 2310 | + $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
|
|
| 2311 | + ?> |
|
| 2312 | 2312 | <div class="editor" field_id="post_desc" field_type="editor"> |
| 2313 | 2313 | <?php wp_editor($desc, "post_desc", $editor_settings); ?> |
| 2314 | 2314 | </div> |
@@ -2322,56 +2322,56 @@ discard block |
||
| 2322 | 2322 | <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span> |
| 2323 | 2323 | </div> |
| 2324 | 2324 | <?php |
| 2325 | - if ($desc_limit === '' || (int)$desc_limit > 0) {
|
|
| 2326 | - /** |
|
| 2327 | - * Called on the add listing page form for frontend just after the description field. |
|
| 2328 | - * |
|
| 2329 | - * @since 1.0.0 |
|
| 2330 | - */ |
|
| 2331 | - do_action('geodir_after_description_field');
|
|
| 2332 | - } |
|
| 2325 | + if ($desc_limit === '' || (int)$desc_limit > 0) {
|
|
| 2326 | + /** |
|
| 2327 | + * Called on the add listing page form for frontend just after the description field. |
|
| 2328 | + * |
|
| 2329 | + * @since 1.0.0 |
|
| 2330 | + */ |
|
| 2331 | + do_action('geodir_after_description_field');
|
|
| 2332 | + } |
|
| 2333 | 2333 | |
| 2334 | - $kw_tags = esc_attr(stripslashes($kw_tags)); |
|
| 2335 | - $kw_tags_count = TAGKW_TEXT_COUNT; |
|
| 2336 | - $kw_tags_msg = TAGKW_MSG; |
|
| 2337 | - /** |
|
| 2338 | - * Filter the add listing tags character limit. |
|
| 2339 | - * |
|
| 2340 | - * @since 1.0.0 |
|
| 2341 | - * @param int $kw_tags_count The character count limit if any. |
|
| 2342 | - */ |
|
| 2343 | - $kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
|
|
| 2344 | - /** |
|
| 2345 | - * Filter the add listing tags field value. |
|
| 2346 | - * |
|
| 2347 | - * You can use the $_REQUEST values to check if this is a go back and edit value etc. |
|
| 2348 | - * |
|
| 2349 | - * @since 1.0.0 |
|
| 2350 | - * @param string $kw_tags The tag field value, usually a comma separated list of tags. |
|
| 2351 | - * @param int $kw_tags_count The character count limit if any. |
|
| 2352 | - */ |
|
| 2353 | - $kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
|
|
| 2354 | - /** |
|
| 2355 | - * Filter the add listing tags field message text. |
|
| 2356 | - * |
|
| 2357 | - * @since 1.0.0 |
|
| 2358 | - * @param string $kw_tags_msg The message shown under the field. |
|
| 2359 | - * @param int $kw_tags_count The character count limit if any. |
|
| 2360 | - */ |
|
| 2361 | - $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
|
|
| 2334 | + $kw_tags = esc_attr(stripslashes($kw_tags)); |
|
| 2335 | + $kw_tags_count = TAGKW_TEXT_COUNT; |
|
| 2336 | + $kw_tags_msg = TAGKW_MSG; |
|
| 2337 | + /** |
|
| 2338 | + * Filter the add listing tags character limit. |
|
| 2339 | + * |
|
| 2340 | + * @since 1.0.0 |
|
| 2341 | + * @param int $kw_tags_count The character count limit if any. |
|
| 2342 | + */ |
|
| 2343 | + $kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
|
|
| 2344 | + /** |
|
| 2345 | + * Filter the add listing tags field value. |
|
| 2346 | + * |
|
| 2347 | + * You can use the $_REQUEST values to check if this is a go back and edit value etc. |
|
| 2348 | + * |
|
| 2349 | + * @since 1.0.0 |
|
| 2350 | + * @param string $kw_tags The tag field value, usually a comma separated list of tags. |
|
| 2351 | + * @param int $kw_tags_count The character count limit if any. |
|
| 2352 | + */ |
|
| 2353 | + $kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
|
|
| 2354 | + /** |
|
| 2355 | + * Filter the add listing tags field message text. |
|
| 2356 | + * |
|
| 2357 | + * @since 1.0.0 |
|
| 2358 | + * @param string $kw_tags_msg The message shown under the field. |
|
| 2359 | + * @param int $kw_tags_count The character count limit if any. |
|
| 2360 | + */ |
|
| 2361 | + $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
|
|
| 2362 | 2362 | |
| 2363 | - $tags_class = ''; |
|
| 2364 | - if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
|
|
| 2365 | - /** |
|
| 2366 | - * Called on the add listing page form for frontend just before the tags field. |
|
| 2367 | - * |
|
| 2368 | - * @since 1.0.0 |
|
| 2369 | - */ |
|
| 2370 | - do_action('geodir_before_listing_tags_field');
|
|
| 2371 | - } else {
|
|
| 2372 | - $tags_class = ' hidden'; |
|
| 2373 | - } |
|
| 2374 | - ?> |
|
| 2363 | + $tags_class = ''; |
|
| 2364 | + if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
|
|
| 2365 | + /** |
|
| 2366 | + * Called on the add listing page form for frontend just before the tags field. |
|
| 2367 | + * |
|
| 2368 | + * @since 1.0.0 |
|
| 2369 | + */ |
|
| 2370 | + do_action('geodir_before_listing_tags_field');
|
|
| 2371 | + } else {
|
|
| 2372 | + $tags_class = ' hidden'; |
|
| 2373 | + } |
|
| 2374 | + ?> |
|
| 2375 | 2375 | <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>"> |
| 2376 | 2376 | <label><?php echo TAGKW_TEXT; ?></label> |
| 2377 | 2377 | <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield" |
@@ -2379,90 +2379,90 @@ discard block |
||
| 2379 | 2379 | <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span> |
| 2380 | 2380 | </div> |
| 2381 | 2381 | <?php |
| 2382 | - if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
|
|
| 2383 | - /** |
|
| 2384 | - * Called on the add listing page form for frontend just after the tags field. |
|
| 2385 | - * |
|
| 2386 | - * @since 1.0.0 |
|
| 2387 | - */ |
|
| 2388 | - do_action('geodir_after_listing_tags_field');
|
|
| 2389 | - } |
|
| 2382 | + if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
|
|
| 2383 | + /** |
|
| 2384 | + * Called on the add listing page form for frontend just after the tags field. |
|
| 2385 | + * |
|
| 2386 | + * @since 1.0.0 |
|
| 2387 | + */ |
|
| 2388 | + do_action('geodir_after_listing_tags_field');
|
|
| 2389 | + } |
|
| 2390 | 2390 | |
| 2391 | - $package_info = array(); |
|
| 2392 | - $package_info = geodir_post_package_info($package_info, $post); |
|
| 2391 | + $package_info = array(); |
|
| 2392 | + $package_info = geodir_post_package_info($package_info, $post); |
|
| 2393 | 2393 | |
| 2394 | - geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type); |
|
| 2394 | + geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type); |
|
| 2395 | 2395 | |
| 2396 | - // adjust values here |
|
| 2397 | - $id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls |
|
| 2396 | + // adjust values here |
|
| 2397 | + $id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls |
|
| 2398 | 2398 | |
| 2399 | - $multiple = true; // allow multiple files upload |
|
| 2399 | + $multiple = true; // allow multiple files upload |
|
| 2400 | 2400 | |
| 2401 | - $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) |
|
| 2401 | + $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) |
|
| 2402 | 2402 | |
| 2403 | - $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels) |
|
| 2403 | + $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels) |
|
| 2404 | 2404 | |
| 2405 | - $thumb_img_arr = array(); |
|
| 2406 | - $totImg = 0; |
|
| 2407 | - if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
|
|
| 2408 | - $post = (object)$gd_session->get('listing');
|
|
| 2409 | - if (isset($post->post_images)) |
|
| 2410 | - $curImages = trim($post->post_images, ","); |
|
| 2405 | + $thumb_img_arr = array(); |
|
| 2406 | + $totImg = 0; |
|
| 2407 | + if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
|
|
| 2408 | + $post = (object)$gd_session->get('listing');
|
|
| 2409 | + if (isset($post->post_images)) |
|
| 2410 | + $curImages = trim($post->post_images, ","); |
|
| 2411 | 2411 | |
| 2412 | 2412 | |
| 2413 | - if ($curImages != '') {
|
|
| 2414 | - $curImages_array = explode(',', $curImages);
|
|
| 2415 | - $totImg = count($curImages_array); |
|
| 2416 | - } |
|
| 2413 | + if ($curImages != '') {
|
|
| 2414 | + $curImages_array = explode(',', $curImages);
|
|
| 2415 | + $totImg = count($curImages_array); |
|
| 2416 | + } |
|
| 2417 | 2417 | |
| 2418 | - $listing_type = $post->listing_type; |
|
| 2418 | + $listing_type = $post->listing_type; |
|
| 2419 | 2419 | |
| 2420 | - } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 2421 | - $post = geodir_get_post_info((int)$_REQUEST['pid']); |
|
| 2422 | - $listing_type = $post->post_type; |
|
| 2423 | - $thumb_img_arr = geodir_get_images($_REQUEST['pid']); |
|
| 2420 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 2421 | + $post = geodir_get_post_info((int)$_REQUEST['pid']); |
|
| 2422 | + $listing_type = $post->post_type; |
|
| 2423 | + $thumb_img_arr = geodir_get_images($_REQUEST['pid']); |
|
| 2424 | 2424 | |
| 2425 | - } else {
|
|
| 2426 | - $listing_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2427 | - } |
|
| 2425 | + } else {
|
|
| 2426 | + $listing_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 2427 | + } |
|
| 2428 | 2428 | |
| 2429 | 2429 | |
| 2430 | - if (!empty($thumb_img_arr)) {
|
|
| 2431 | - foreach ($thumb_img_arr as $img) {
|
|
| 2432 | - //$curImages = $img->src.","; |
|
| 2433 | - } |
|
| 2434 | - |
|
| 2435 | - $totImg = count((array)$thumb_img_arr); |
|
| 2436 | - } |
|
| 2430 | + if (!empty($thumb_img_arr)) {
|
|
| 2431 | + foreach ($thumb_img_arr as $img) {
|
|
| 2432 | + //$curImages = $img->src.","; |
|
| 2433 | + } |
|
| 2437 | 2434 | |
| 2438 | - if ($curImages != '') |
|
| 2439 | - $svalue = $curImages; // this will be initial value of the above form field. Image urls. |
|
| 2440 | - else |
|
| 2441 | - $svalue = ''; |
|
| 2442 | - |
|
| 2443 | - $image_limit = isset($package_info->image_limit) ? $package_info->image_limit : '0'; |
|
| 2444 | - $show_image_input_box = ($image_limit != '0'); |
|
| 2445 | - /** |
|
| 2446 | - * Filter to be able to show/hide the image upload section of the add listing form. |
|
| 2447 | - * |
|
| 2448 | - * @since 1.0.0 |
|
| 2449 | - * @param bool $show_image_input_box Set true to show. Set false to not show. |
|
| 2450 | - * @param string $listing_type The custom post type slug. |
|
| 2451 | - */ |
|
| 2452 | - $show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
|
|
| 2453 | - if ($show_image_input_box) {
|
|
| 2454 | - ?> |
|
| 2435 | + $totImg = count((array)$thumb_img_arr); |
|
| 2436 | + } |
|
| 2437 | + |
|
| 2438 | + if ($curImages != '') |
|
| 2439 | + $svalue = $curImages; // this will be initial value of the above form field. Image urls. |
|
| 2440 | + else |
|
| 2441 | + $svalue = ''; |
|
| 2442 | + |
|
| 2443 | + $image_limit = isset($package_info->image_limit) ? $package_info->image_limit : '0'; |
|
| 2444 | + $show_image_input_box = ($image_limit != '0'); |
|
| 2445 | + /** |
|
| 2446 | + * Filter to be able to show/hide the image upload section of the add listing form. |
|
| 2447 | + * |
|
| 2448 | + * @since 1.0.0 |
|
| 2449 | + * @param bool $show_image_input_box Set true to show. Set false to not show. |
|
| 2450 | + * @param string $listing_type The custom post type slug. |
|
| 2451 | + */ |
|
| 2452 | + $show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
|
|
| 2453 | + if ($show_image_input_box) {
|
|
| 2454 | + ?> |
|
| 2455 | 2455 | |
| 2456 | 2456 | <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?> |
| 2457 | 2457 | <?php if ($image_limit == 1) {
|
| 2458 | - echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
|
|
| 2459 | - } ?> |
|
| 2458 | + echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
|
|
| 2459 | + } ?> |
|
| 2460 | 2460 | <?php if ($image_limit > 1) {
|
| 2461 | - echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
|
|
| 2462 | - } ?> |
|
| 2461 | + echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
|
|
| 2462 | + } ?> |
|
| 2463 | 2463 | <?php if ($image_limit == '') {
|
| 2464 | - echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
|
|
| 2465 | - } ?> |
|
| 2464 | + echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
|
|
| 2465 | + } ?> |
|
| 2466 | 2466 | </h5> |
| 2467 | 2467 | |
| 2468 | 2468 | <div class="geodir_form_row clearfix" id="<?php echo $id; ?>dropbox" |
@@ -2500,12 +2500,12 @@ discard block |
||
| 2500 | 2500 | <?php } ?> |
| 2501 | 2501 | |
| 2502 | 2502 | <?php |
| 2503 | - /** |
|
| 2504 | - * Called on the add listing page form for frontend just after the image upload field. |
|
| 2505 | - * |
|
| 2506 | - * @since 1.0.0 |
|
| 2507 | - */ |
|
| 2508 | - do_action('geodir_after_main_form_fields');?>
|
|
| 2503 | + /** |
|
| 2504 | + * Called on the add listing page form for frontend just after the image upload field. |
|
| 2505 | + * |
|
| 2506 | + * @since 1.0.0 |
|
| 2507 | + */ |
|
| 2508 | + do_action('geodir_after_main_form_fields');?>
|
|
| 2509 | 2509 | |
| 2510 | 2510 | |
| 2511 | 2511 | <!-- add captcha code --> |
@@ -2534,7 +2534,7 @@ discard block |
||
| 2534 | 2534 | |
| 2535 | 2535 | </form> |
| 2536 | 2536 | <?php |
| 2537 | - wp_reset_query(); |
|
| 2537 | + wp_reset_query(); |
|
| 2538 | 2538 | } |
| 2539 | 2539 | |
| 2540 | 2540 | /** |
@@ -2545,7 +2545,7 @@ discard block |
||
| 2545 | 2545 | */ |
| 2546 | 2546 | function geodir_add_listing_sidebar_widget_area() |
| 2547 | 2547 | {
|
| 2548 | - dynamic_sidebar('geodir_add_listing_sidebar');
|
|
| 2548 | + dynamic_sidebar('geodir_add_listing_sidebar');
|
|
| 2549 | 2549 | } |
| 2550 | 2550 | |
| 2551 | 2551 | add_action('geodir_add_listing_sidebar_inside', 'geodir_add_listing_sidebar_widget_area', 10);
|
@@ -2560,16 +2560,16 @@ discard block |
||
| 2560 | 2560 | */ |
| 2561 | 2561 | function geodir_action_add_listing_sidebar() |
| 2562 | 2562 | {
|
| 2563 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2564 | - do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 2565 | - /** |
|
| 2566 | - * This is used to add the content to the add listing page sidebar. |
|
| 2567 | - * |
|
| 2568 | - * @since 1.0.0 |
|
| 2569 | - */ |
|
| 2570 | - do_action('geodir_add_listing_sidebar_inside');
|
|
| 2571 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2572 | - do_action('geodir_sidebar_right_close', 'details-page');
|
|
| 2563 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2564 | + do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 2565 | + /** |
|
| 2566 | + * This is used to add the content to the add listing page sidebar. |
|
| 2567 | + * |
|
| 2568 | + * @since 1.0.0 |
|
| 2569 | + */ |
|
| 2570 | + do_action('geodir_add_listing_sidebar_inside');
|
|
| 2571 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2572 | + do_action('geodir_sidebar_right_close', 'details-page');
|
|
| 2573 | 2573 | } |
| 2574 | 2574 | |
| 2575 | 2575 | ############################################### |
@@ -2586,11 +2586,11 @@ discard block |
||
| 2586 | 2586 | */ |
| 2587 | 2587 | function geodir_action_geodir_sidebar_signup_top() |
| 2588 | 2588 | {
|
| 2589 | - ?> |
|
| 2589 | + ?> |
|
| 2590 | 2590 | <div |
| 2591 | 2591 | class="<?php |
| 2592 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2593 | - echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
|
|
| 2592 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2593 | + echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
|
|
| 2594 | 2594 | <?php dynamic_sidebar('Reg/Login Top Section');?>
|
| 2595 | 2595 | </div><!-- clearfix ends here--> |
| 2596 | 2596 | <?php |
@@ -2609,11 +2609,11 @@ discard block |
||
| 2609 | 2609 | function geodir_action_signup_forms() |
| 2610 | 2610 | {
|
| 2611 | 2611 | |
| 2612 | - global $user_login; |
|
| 2612 | + global $user_login; |
|
| 2613 | 2613 | |
| 2614 | - $is_enable_signup = get_option( 'users_can_register' ); |
|
| 2614 | + $is_enable_signup = get_option( 'users_can_register' ); |
|
| 2615 | 2615 | |
| 2616 | - ?> |
|
| 2616 | + ?> |
|
| 2617 | 2617 | <script type="text/javascript"> |
| 2618 | 2618 | <?php if ( $user_login ) { ?>
|
| 2619 | 2619 | setTimeout(function () {
|
@@ -2649,67 +2649,67 @@ discard block |
||
| 2649 | 2649 | <?php } ?> |
| 2650 | 2650 | </script><?php |
| 2651 | 2651 | |
| 2652 | - global $errors; |
|
| 2653 | - if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim') |
|
| 2654 | - $errors->add('claim_login', LOGIN_CLAIM);
|
|
| 2655 | - |
|
| 2656 | - if (!empty($errors)) {
|
|
| 2657 | - foreach ($errors as $errorsObj) {
|
|
| 2658 | - foreach ($errorsObj as $key => $val) {
|
|
| 2659 | - for ($i = 0; $i < count($val); $i++) {
|
|
| 2660 | - echo "<div class=error_msg_fix>" . $val[$i] . '</div>'; |
|
| 2661 | - $registration_error_msg = 1; |
|
| 2662 | - } |
|
| 2663 | - } |
|
| 2664 | - } |
|
| 2665 | - } |
|
| 2652 | + global $errors; |
|
| 2653 | + if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim') |
|
| 2654 | + $errors->add('claim_login', LOGIN_CLAIM);
|
|
| 2655 | + |
|
| 2656 | + if (!empty($errors)) {
|
|
| 2657 | + foreach ($errors as $errorsObj) {
|
|
| 2658 | + foreach ($errorsObj as $key => $val) {
|
|
| 2659 | + for ($i = 0; $i < count($val); $i++) {
|
|
| 2660 | + echo "<div class=error_msg_fix>" . $val[$i] . '</div>'; |
|
| 2661 | + $registration_error_msg = 1; |
|
| 2662 | + } |
|
| 2663 | + } |
|
| 2664 | + } |
|
| 2665 | + } |
|
| 2666 | 2666 | |
| 2667 | - if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
|
|
| 2668 | - ?> |
|
| 2667 | + if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
|
|
| 2668 | + ?> |
|
| 2669 | 2669 | |
| 2670 | 2670 | <div class="login_form"> |
| 2671 | 2671 | <?php |
| 2672 | - /** |
|
| 2673 | - * Contains login form template. |
|
| 2674 | - * |
|
| 2675 | - * @since 1.0.0 |
|
| 2676 | - */ |
|
| 2677 | - include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?> |
|
| 2672 | + /** |
|
| 2673 | + * Contains login form template. |
|
| 2674 | + * |
|
| 2675 | + * @since 1.0.0 |
|
| 2676 | + */ |
|
| 2677 | + include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?> |
|
| 2678 | 2678 | </div> |
| 2679 | 2679 | |
| 2680 | 2680 | <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up' && $is_enable_signup ) { ?>
|
| 2681 | 2681 | |
| 2682 | 2682 | <div class="registration_form"> |
| 2683 | 2683 | <?php |
| 2684 | - /** |
|
| 2685 | - * Contains registration form template. |
|
| 2686 | - * |
|
| 2687 | - * @since 1.0.0 |
|
| 2688 | - */ |
|
| 2689 | - include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?> |
|
| 2684 | + /** |
|
| 2685 | + * Contains registration form template. |
|
| 2686 | + * |
|
| 2687 | + * @since 1.0.0 |
|
| 2688 | + */ |
|
| 2689 | + include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?> |
|
| 2690 | 2690 | </div> |
| 2691 | 2691 | |
| 2692 | 2692 | <?php } else { ?>
|
| 2693 | 2693 | |
| 2694 | 2694 | <div class="login_form_l"> |
| 2695 | 2695 | <?php |
| 2696 | - /** |
|
| 2697 | - * Contains login form template. |
|
| 2698 | - * |
|
| 2699 | - * @since 1.0.0 |
|
| 2700 | - */ |
|
| 2701 | - include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?> |
|
| 2696 | + /** |
|
| 2697 | + * Contains login form template. |
|
| 2698 | + * |
|
| 2699 | + * @since 1.0.0 |
|
| 2700 | + */ |
|
| 2701 | + include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?> |
|
| 2702 | 2702 | </div> |
| 2703 | 2703 | |
| 2704 | 2704 | <?php if ( $is_enable_signup ) { ?>
|
| 2705 | 2705 | <div class="registration_form_r"> |
| 2706 | 2706 | <?php |
| 2707 | - /** |
|
| 2708 | - * Contains registration form template. |
|
| 2709 | - * |
|
| 2710 | - * @since 1.0.0 |
|
| 2711 | - */ |
|
| 2712 | - include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?> |
|
| 2707 | + /** |
|
| 2708 | + * Contains registration form template. |
|
| 2709 | + * |
|
| 2710 | + * @since 1.0.0 |
|
| 2711 | + */ |
|
| 2712 | + include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?> |
|
| 2713 | 2713 | </div> |
| 2714 | 2714 | <?php } ?> |
| 2715 | 2715 | |
@@ -2741,66 +2741,66 @@ discard block |
||
| 2741 | 2741 | */ |
| 2742 | 2742 | function geodir_action_author_page_title() |
| 2743 | 2743 | {
|
| 2744 | - global $term; |
|
| 2744 | + global $term; |
|
| 2745 | 2745 | |
| 2746 | - $gd_post_type = geodir_get_current_posttype(); |
|
| 2747 | - $post_type_info = get_post_type_object($gd_post_type); |
|
| 2746 | + $gd_post_type = geodir_get_current_posttype(); |
|
| 2747 | + $post_type_info = get_post_type_object($gd_post_type); |
|
| 2748 | 2748 | |
| 2749 | - $add_string_in_title = __('All', 'geodirectory') . ' ';
|
|
| 2750 | - if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
|
|
| 2751 | - $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
|
|
| 2752 | - } |
|
| 2749 | + $add_string_in_title = __('All', 'geodirectory') . ' ';
|
|
| 2750 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
|
|
| 2751 | + $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
|
|
| 2752 | + } |
|
| 2753 | 2753 | |
| 2754 | - $list_title = $add_string_in_title . $post_type_info->labels->name; |
|
| 2755 | - $single_name = $post_type_info->labels->singular_name; |
|
| 2754 | + $list_title = $add_string_in_title . $post_type_info->labels->name; |
|
| 2755 | + $single_name = $post_type_info->labels->singular_name; |
|
| 2756 | 2756 | |
| 2757 | - $taxonomy = geodir_get_taxonomies($gd_post_type); |
|
| 2757 | + $taxonomy = geodir_get_taxonomies($gd_post_type); |
|
| 2758 | 2758 | |
| 2759 | - if (!empty($term)) {
|
|
| 2760 | - $current_term = get_term_by('slug', $term, $taxonomy[0]);
|
|
| 2761 | - if (!empty($current_term)) |
|
| 2762 | - $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
|
|
| 2763 | - } |
|
| 2759 | + if (!empty($term)) {
|
|
| 2760 | + $current_term = get_term_by('slug', $term, $taxonomy[0]);
|
|
| 2761 | + if (!empty($current_term)) |
|
| 2762 | + $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
|
|
| 2763 | + } |
|
| 2764 | 2764 | |
| 2765 | 2765 | |
| 2766 | - if (is_search()) {
|
|
| 2767 | - $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
|
|
| 2766 | + if (is_search()) {
|
|
| 2767 | + $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
|
|
| 2768 | 2768 | |
| 2769 | - } |
|
| 2770 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2771 | - $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
|
| 2772 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2773 | - $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
|
| 2769 | + } |
|
| 2770 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2771 | + $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
|
| 2772 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2773 | + $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
|
| 2774 | 2774 | |
| 2775 | - $title = $list_title; |
|
| 2776 | - if(geodir_is_page('author')){
|
|
| 2777 | - $gd_page = 'author'; |
|
| 2778 | - if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
|
|
| 2779 | - $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
|
|
| 2780 | - }else{
|
|
| 2781 | - $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
|
|
| 2782 | - } |
|
| 2775 | + $title = $list_title; |
|
| 2776 | + if(geodir_is_page('author')){
|
|
| 2777 | + $gd_page = 'author'; |
|
| 2778 | + if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
|
|
| 2779 | + $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
|
|
| 2780 | + }else{
|
|
| 2781 | + $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
|
|
| 2782 | + } |
|
| 2783 | 2783 | |
| 2784 | - } |
|
| 2784 | + } |
|
| 2785 | 2785 | |
| 2786 | 2786 | |
| 2787 | - /** |
|
| 2788 | - * Filter page title to replace variables. |
|
| 2789 | - * |
|
| 2790 | - * @since 1.5.4 |
|
| 2791 | - * @param string $title The page title including variables. |
|
| 2792 | - * @param string $gd_page The GeoDirectory page type if any. |
|
| 2793 | - */ |
|
| 2794 | - $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 2787 | + /** |
|
| 2788 | + * Filter page title to replace variables. |
|
| 2789 | + * |
|
| 2790 | + * @since 1.5.4 |
|
| 2791 | + * @param string $title The page title including variables. |
|
| 2792 | + * @param string $gd_page The GeoDirectory page type if any. |
|
| 2793 | + */ |
|
| 2794 | + $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 2795 | 2795 | |
| 2796 | - echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . |
|
| 2797 | - /** |
|
| 2798 | - * Filter the author page title text. |
|
| 2799 | - * |
|
| 2800 | - * @since 1.0.0 |
|
| 2801 | - * @param string $list_title The title for the page. |
|
| 2802 | - */ |
|
| 2803 | - apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
|
|
| 2796 | + echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . |
|
| 2797 | + /** |
|
| 2798 | + * Filter the author page title text. |
|
| 2799 | + * |
|
| 2800 | + * @since 1.0.0 |
|
| 2801 | + * @param string $list_title The title for the page. |
|
| 2802 | + */ |
|
| 2803 | + apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
|
|
| 2804 | 2804 | } |
| 2805 | 2805 | |
| 2806 | 2806 | |
@@ -2818,11 +2818,11 @@ discard block |
||
| 2818 | 2818 | */ |
| 2819 | 2819 | function geodir_action_geodir_sidebar_author_top() |
| 2820 | 2820 | {
|
| 2821 | - if (get_option('geodir_show_author_top_section')) { ?>
|
|
| 2821 | + if (get_option('geodir_show_author_top_section')) { ?>
|
|
| 2822 | 2822 | <div |
| 2823 | 2823 | class="<?php |
| 2824 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2825 | - echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
|
|
| 2824 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2825 | + echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
|
|
| 2826 | 2826 | <?php dynamic_sidebar('geodir_author_top'); ?>
|
| 2827 | 2827 | </div><!-- clearfix ends here--> |
| 2828 | 2828 | <?php } |
@@ -2838,7 +2838,7 @@ discard block |
||
| 2838 | 2838 | */ |
| 2839 | 2839 | function geodir_author_left_section() |
| 2840 | 2840 | {
|
| 2841 | - if (get_option('geodir_show_author_left_section')) { ?>
|
|
| 2841 | + if (get_option('geodir_show_author_left_section')) { ?>
|
|
| 2842 | 2842 | <div class="geodir-content-left geodir-sidebar-wrap"> |
| 2843 | 2843 | <?php dynamic_sidebar('geodir_author_left_sidebar'); ?>
|
| 2844 | 2844 | </div><!-- end geodir-content-left --> |
@@ -2859,19 +2859,19 @@ discard block |
||
| 2859 | 2859 | */ |
| 2860 | 2860 | function geodir_action_author_sidebar_left() |
| 2861 | 2861 | {
|
| 2862 | - if (get_option('geodir_show_author_left_section')) {
|
|
| 2862 | + if (get_option('geodir_show_author_left_section')) {
|
|
| 2863 | 2863 | // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='') |
| 2864 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2865 | - do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
|
|
| 2866 | - /** |
|
| 2867 | - * This is used to add the content to the author page left sidebar (if active). |
|
| 2868 | - * |
|
| 2869 | - * @since 1.0.0 |
|
| 2870 | - */ |
|
| 2871 | - do_action('geodir_author_sidebar_left_inside');
|
|
| 2872 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2873 | - do_action('geodir_sidebar_left_close', 'author-page');
|
|
| 2874 | - } |
|
| 2864 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2865 | + do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
|
|
| 2866 | + /** |
|
| 2867 | + * This is used to add the content to the author page left sidebar (if active). |
|
| 2868 | + * |
|
| 2869 | + * @since 1.0.0 |
|
| 2870 | + */ |
|
| 2871 | + do_action('geodir_author_sidebar_left_inside');
|
|
| 2872 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2873 | + do_action('geodir_sidebar_left_close', 'author-page');
|
|
| 2874 | + } |
|
| 2875 | 2875 | } |
| 2876 | 2876 | |
| 2877 | 2877 | /** |
@@ -2884,7 +2884,7 @@ discard block |
||
| 2884 | 2884 | */ |
| 2885 | 2885 | function geodir_author_right_section() |
| 2886 | 2886 | {
|
| 2887 | - if (get_option('geodir_show_author_right_section')) { ?>
|
|
| 2887 | + if (get_option('geodir_show_author_right_section')) { ?>
|
|
| 2888 | 2888 | <div class="geodir-content-right geodir-sidebar-wrap"> |
| 2889 | 2889 | <?php dynamic_sidebar('geodir_author_right_sidebar'); ?>
|
| 2890 | 2890 | </div><!-- end geodir-content-right --> |
@@ -2904,18 +2904,18 @@ discard block |
||
| 2904 | 2904 | */ |
| 2905 | 2905 | function geodir_action_author_sidebar_right() |
| 2906 | 2906 | {
|
| 2907 | - if (get_option('geodir_show_author_right_section')) {
|
|
| 2908 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2909 | - do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 2910 | - /** |
|
| 2911 | - * This is used to add the content to the author page right sidebar (if active). |
|
| 2912 | - * |
|
| 2913 | - * @since 1.0.0 |
|
| 2914 | - */ |
|
| 2915 | - do_action('geodir_author_sidebar_right_inside');
|
|
| 2916 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2917 | - do_action('geodir_sidebar_right_close', 'author-page');
|
|
| 2918 | - } |
|
| 2907 | + if (get_option('geodir_show_author_right_section')) {
|
|
| 2908 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2909 | + do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 2910 | + /** |
|
| 2911 | + * This is used to add the content to the author page right sidebar (if active). |
|
| 2912 | + * |
|
| 2913 | + * @since 1.0.0 |
|
| 2914 | + */ |
|
| 2915 | + do_action('geodir_author_sidebar_right_inside');
|
|
| 2916 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2917 | + do_action('geodir_sidebar_right_close', 'author-page');
|
|
| 2918 | + } |
|
| 2919 | 2919 | } |
| 2920 | 2920 | |
| 2921 | 2921 | /** |
@@ -2927,14 +2927,14 @@ discard block |
||
| 2927 | 2927 | */ |
| 2928 | 2928 | function geodir_action_author_content_inside() |
| 2929 | 2929 | {
|
| 2930 | - global $gridview_columns; |
|
| 2931 | - $listing_view = get_option('geodir_author_view');
|
|
| 2932 | - if (strstr($listing_view, 'gridview')) {
|
|
| 2933 | - $gridview_columns = $listing_view; |
|
| 2934 | - $listing_view_exp = explode('_', $listing_view);
|
|
| 2935 | - $listing_view = $listing_view_exp[0]; |
|
| 2936 | - } |
|
| 2937 | - geodir_get_template_part('listing', 'listview');
|
|
| 2930 | + global $gridview_columns; |
|
| 2931 | + $listing_view = get_option('geodir_author_view');
|
|
| 2932 | + if (strstr($listing_view, 'gridview')) {
|
|
| 2933 | + $gridview_columns = $listing_view; |
|
| 2934 | + $listing_view_exp = explode('_', $listing_view);
|
|
| 2935 | + $listing_view = $listing_view_exp[0]; |
|
| 2936 | + } |
|
| 2937 | + geodir_get_template_part('listing', 'listview');
|
|
| 2938 | 2938 | } |
| 2939 | 2939 | |
| 2940 | 2940 | add_action('geodir_author_content_inside', 'geodir_action_author_content_inside', 10);
|
@@ -2949,22 +2949,22 @@ discard block |
||
| 2949 | 2949 | */ |
| 2950 | 2950 | function geodir_action_author_content() |
| 2951 | 2951 | {
|
| 2952 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2953 | - do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
|
|
| 2954 | - echo '<div class="clearfix">'; |
|
| 2955 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2956 | - do_action('geodir_before_listing');
|
|
| 2957 | - echo '</div>'; |
|
| 2958 | - /** |
|
| 2959 | - * This is used to add the content to the author page main content. |
|
| 2960 | - * |
|
| 2961 | - * @since 1.0.0 |
|
| 2962 | - */ |
|
| 2963 | - do_action('geodir_author_content_inside');
|
|
| 2964 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2965 | - do_action('geodir_after_listing');
|
|
| 2966 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2967 | - do_action('geodir_main_content_close', 'author-page');
|
|
| 2952 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2953 | + do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
|
|
| 2954 | + echo '<div class="clearfix">'; |
|
| 2955 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2956 | + do_action('geodir_before_listing');
|
|
| 2957 | + echo '</div>'; |
|
| 2958 | + /** |
|
| 2959 | + * This is used to add the content to the author page main content. |
|
| 2960 | + * |
|
| 2961 | + * @since 1.0.0 |
|
| 2962 | + */ |
|
| 2963 | + do_action('geodir_author_content_inside');
|
|
| 2964 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2965 | + do_action('geodir_after_listing');
|
|
| 2966 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2967 | + do_action('geodir_main_content_close', 'author-page');
|
|
| 2968 | 2968 | } |
| 2969 | 2969 | |
| 2970 | 2970 | add_action('geodir_sidebar_author_bottom_section', 'geodir_action_sidebar_author_bottom_section', 10);
|
@@ -2978,11 +2978,11 @@ discard block |
||
| 2978 | 2978 | */ |
| 2979 | 2979 | function geodir_action_sidebar_author_bottom_section() |
| 2980 | 2980 | {
|
| 2981 | - if (get_option('geodir_show_author_bottom_section')) { ?>
|
|
| 2981 | + if (get_option('geodir_show_author_bottom_section')) { ?>
|
|
| 2982 | 2982 | <div |
| 2983 | 2983 | class="<?php |
| 2984 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 2985 | - echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
|
|
| 2984 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 2985 | + echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
|
|
| 2986 | 2986 | <?php dynamic_sidebar('geodir_author_bottom'); ?>
|
| 2987 | 2987 | </div><!-- clearfix ends here--> |
| 2988 | 2988 | <?php } |
@@ -3001,23 +3001,23 @@ discard block |
||
| 3001 | 3001 | */ |
| 3002 | 3002 | function geodir_action_search_page_title() |
| 3003 | 3003 | {
|
| 3004 | - $gd_post_type = geodir_get_current_posttype(); |
|
| 3005 | - $post_type_info = get_post_type_object($gd_post_type); |
|
| 3004 | + $gd_post_type = geodir_get_current_posttype(); |
|
| 3005 | + $post_type_info = get_post_type_object($gd_post_type); |
|
| 3006 | 3006 | |
| 3007 | - $pt_name = ''; |
|
| 3008 | - if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
|
|
| 3007 | + $pt_name = ''; |
|
| 3008 | + if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
|
|
| 3009 | 3009 | |
| 3010 | - if (is_search()) {
|
|
| 3011 | - $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
|
|
| 3010 | + if (is_search()) {
|
|
| 3011 | + $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
|
|
| 3012 | 3012 | |
| 3013 | - } |
|
| 3014 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3015 | - $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
|
| 3016 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3017 | - $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
|
| 3018 | - echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . |
|
| 3019 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3020 | - apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
|
|
| 3013 | + } |
|
| 3014 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3015 | + $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
|
| 3016 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3017 | + $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
|
| 3018 | + echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . |
|
| 3019 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3020 | + apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
|
|
| 3021 | 3021 | } |
| 3022 | 3022 | |
| 3023 | 3023 | // action for adding the listings page top widget area |
@@ -3033,11 +3033,11 @@ discard block |
||
| 3033 | 3033 | */ |
| 3034 | 3034 | function geodir_action_geodir_sidebar_search_top() |
| 3035 | 3035 | {
|
| 3036 | - if (get_option('geodir_show_search_top_section')) { ?>
|
|
| 3036 | + if (get_option('geodir_show_search_top_section')) { ?>
|
|
| 3037 | 3037 | <div |
| 3038 | 3038 | class="<?php |
| 3039 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3040 | - echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
|
|
| 3039 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3040 | + echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
|
|
| 3041 | 3041 | <?php dynamic_sidebar('geodir_search_top'); ?>
|
| 3042 | 3042 | </div><!-- clearfix ends here--> |
| 3043 | 3043 | <?php } |
@@ -3053,7 +3053,7 @@ discard block |
||
| 3053 | 3053 | */ |
| 3054 | 3054 | function geodir_search_left_section() |
| 3055 | 3055 | {
|
| 3056 | - if (get_option('geodir_show_search_left_section')) { ?>
|
|
| 3056 | + if (get_option('geodir_show_search_left_section')) { ?>
|
|
| 3057 | 3057 | <div class="geodir-content-left geodir-sidebar-wrap"> |
| 3058 | 3058 | <?php dynamic_sidebar('geodir_search_left_sidebar'); ?>
|
| 3059 | 3059 | </div><!-- end geodir-content-left --> |
@@ -3073,19 +3073,19 @@ discard block |
||
| 3073 | 3073 | */ |
| 3074 | 3074 | function geodir_action_search_sidebar_left() |
| 3075 | 3075 | {
|
| 3076 | - if (get_option('geodir_show_search_left_section')) {
|
|
| 3076 | + if (get_option('geodir_show_search_left_section')) {
|
|
| 3077 | 3077 | // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='') |
| 3078 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3079 | - do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
|
|
| 3080 | - /** |
|
| 3081 | - * This is used to add the content to the search page left sidebar (if active). |
|
| 3082 | - * |
|
| 3083 | - * @since 1.0.0 |
|
| 3084 | - */ |
|
| 3085 | - do_action('geodir_search_sidebar_left_inside');
|
|
| 3086 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3087 | - do_action('geodir_sidebar_left_close', 'search-page');
|
|
| 3088 | - } |
|
| 3078 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3079 | + do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
|
|
| 3080 | + /** |
|
| 3081 | + * This is used to add the content to the search page left sidebar (if active). |
|
| 3082 | + * |
|
| 3083 | + * @since 1.0.0 |
|
| 3084 | + */ |
|
| 3085 | + do_action('geodir_search_sidebar_left_inside');
|
|
| 3086 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3087 | + do_action('geodir_sidebar_left_close', 'search-page');
|
|
| 3088 | + } |
|
| 3089 | 3089 | } |
| 3090 | 3090 | |
| 3091 | 3091 | /** |
@@ -3098,7 +3098,7 @@ discard block |
||
| 3098 | 3098 | */ |
| 3099 | 3099 | function geodir_search_right_section() |
| 3100 | 3100 | {
|
| 3101 | - if (get_option('geodir_show_search_right_section')) { ?>
|
|
| 3101 | + if (get_option('geodir_show_search_right_section')) { ?>
|
|
| 3102 | 3102 | <div class="geodir-content-right geodir-sidebar-wrap"> |
| 3103 | 3103 | <?php dynamic_sidebar('geodir_search_right_sidebar'); ?>
|
| 3104 | 3104 | </div><!-- end geodir-content-right --> |
@@ -3118,18 +3118,18 @@ discard block |
||
| 3118 | 3118 | */ |
| 3119 | 3119 | function geodir_action_search_sidebar_right() |
| 3120 | 3120 | {
|
| 3121 | - if (get_option('geodir_show_search_right_section')) {
|
|
| 3122 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3123 | - do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 3124 | - /** |
|
| 3125 | - * This is used to add the content to the search page right sidebar (if active). |
|
| 3126 | - * |
|
| 3127 | - * @since 1.0.0 |
|
| 3128 | - */ |
|
| 3129 | - do_action('geodir_search_sidebar_right_inside');
|
|
| 3130 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3131 | - do_action('geodir_sidebar_right_close', 'search-page');
|
|
| 3132 | - } |
|
| 3121 | + if (get_option('geodir_show_search_right_section')) {
|
|
| 3122 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3123 | + do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 3124 | + /** |
|
| 3125 | + * This is used to add the content to the search page right sidebar (if active). |
|
| 3126 | + * |
|
| 3127 | + * @since 1.0.0 |
|
| 3128 | + */ |
|
| 3129 | + do_action('geodir_search_sidebar_right_inside');
|
|
| 3130 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3131 | + do_action('geodir_sidebar_right_close', 'search-page');
|
|
| 3132 | + } |
|
| 3133 | 3133 | } |
| 3134 | 3134 | |
| 3135 | 3135 | |
@@ -3144,11 +3144,11 @@ discard block |
||
| 3144 | 3144 | */ |
| 3145 | 3145 | function geodir_action_sidebar_search_bottom_section() |
| 3146 | 3146 | {
|
| 3147 | - if (get_option('geodir_show_search_bottom_section')) { ?>
|
|
| 3147 | + if (get_option('geodir_show_search_bottom_section')) { ?>
|
|
| 3148 | 3148 | <div |
| 3149 | 3149 | class="<?php |
| 3150 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3151 | - echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
|
|
| 3150 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3151 | + echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
|
|
| 3152 | 3152 | <?php dynamic_sidebar('geodir_search_bottom'); ?>
|
| 3153 | 3153 | </div><!-- clearfix ends here--> |
| 3154 | 3154 | <?php } |
@@ -3163,14 +3163,14 @@ discard block |
||
| 3163 | 3163 | */ |
| 3164 | 3164 | function geodir_action_search_content_inside() |
| 3165 | 3165 | {
|
| 3166 | - global $gridview_columns; |
|
| 3167 | - $listing_view = get_option('geodir_search_view');
|
|
| 3168 | - if (strstr($listing_view, 'gridview')) {
|
|
| 3169 | - $gridview_columns = $listing_view; |
|
| 3170 | - $listing_view_exp = explode('_', $listing_view);
|
|
| 3171 | - $listing_view = $listing_view_exp[0]; |
|
| 3172 | - } |
|
| 3173 | - geodir_get_template_part('listing', 'listview');
|
|
| 3166 | + global $gridview_columns; |
|
| 3167 | + $listing_view = get_option('geodir_search_view');
|
|
| 3168 | + if (strstr($listing_view, 'gridview')) {
|
|
| 3169 | + $gridview_columns = $listing_view; |
|
| 3170 | + $listing_view_exp = explode('_', $listing_view);
|
|
| 3171 | + $listing_view = $listing_view_exp[0]; |
|
| 3172 | + } |
|
| 3173 | + geodir_get_template_part('listing', 'listview');
|
|
| 3174 | 3174 | } |
| 3175 | 3175 | |
| 3176 | 3176 | add_action('geodir_search_content_inside', 'geodir_action_search_content_inside', 10);
|
@@ -3186,22 +3186,22 @@ discard block |
||
| 3186 | 3186 | */ |
| 3187 | 3187 | function geodir_action_search_content() |
| 3188 | 3188 | {
|
| 3189 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3190 | - do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
|
|
| 3191 | - echo '<div class="clearfix">'; |
|
| 3192 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3193 | - do_action('geodir_before_listing');
|
|
| 3194 | - echo '</div>'; |
|
| 3195 | - /** |
|
| 3196 | - * This is used to add the content to the search page main content. |
|
| 3197 | - * |
|
| 3198 | - * @since 1.0.0 |
|
| 3199 | - */ |
|
| 3200 | - do_action('geodir_search_content_inside');
|
|
| 3201 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3202 | - do_action('geodir_after_listing');
|
|
| 3203 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3204 | - do_action('geodir_main_content_close', 'search-page');
|
|
| 3189 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3190 | + do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
|
|
| 3191 | + echo '<div class="clearfix">'; |
|
| 3192 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3193 | + do_action('geodir_before_listing');
|
|
| 3194 | + echo '</div>'; |
|
| 3195 | + /** |
|
| 3196 | + * This is used to add the content to the search page main content. |
|
| 3197 | + * |
|
| 3198 | + * @since 1.0.0 |
|
| 3199 | + */ |
|
| 3200 | + do_action('geodir_search_content_inside');
|
|
| 3201 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3202 | + do_action('geodir_after_listing');
|
|
| 3203 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3204 | + do_action('geodir_main_content_close', 'search-page');
|
|
| 3205 | 3205 | } |
| 3206 | 3206 | |
| 3207 | 3207 | ############################################### |
@@ -3224,11 +3224,11 @@ discard block |
||
| 3224 | 3224 | */ |
| 3225 | 3225 | function geodir_action_geodir_sidebar_home_top() |
| 3226 | 3226 | {
|
| 3227 | - if (get_option('geodir_show_home_top_section')) { ?>
|
|
| 3227 | + if (get_option('geodir_show_home_top_section')) { ?>
|
|
| 3228 | 3228 | <div |
| 3229 | 3229 | class="<?php |
| 3230 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3231 | - echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
|
|
| 3230 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3231 | + echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
|
|
| 3232 | 3232 | <?php dynamic_sidebar('geodir_home_top'); ?>
|
| 3233 | 3233 | </div><!-- clearfix ends here--> |
| 3234 | 3234 | <?php } |
@@ -3244,7 +3244,7 @@ discard block |
||
| 3244 | 3244 | */ |
| 3245 | 3245 | function geodir_home_left_section() |
| 3246 | 3246 | {
|
| 3247 | - if (get_option('geodir_show_home_left_section')) { ?>
|
|
| 3247 | + if (get_option('geodir_show_home_left_section')) { ?>
|
|
| 3248 | 3248 | <div class="geodir-content-left geodir-sidebar-wrap"> |
| 3249 | 3249 | <?php dynamic_sidebar('geodir_home_left'); ?>
|
| 3250 | 3250 | </div><!-- end geodir-content-left --> |
@@ -3266,19 +3266,19 @@ discard block |
||
| 3266 | 3266 | */ |
| 3267 | 3267 | function geodir_action_home_sidebar_left() |
| 3268 | 3268 | {
|
| 3269 | - if (get_option('geodir_show_home_left_section')) {
|
|
| 3269 | + if (get_option('geodir_show_home_left_section')) {
|
|
| 3270 | 3270 | // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='') |
| 3271 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3272 | - do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
|
|
| 3273 | - /** |
|
| 3274 | - * This is used to add the content to the home page left sidebar (if active). |
|
| 3275 | - * |
|
| 3276 | - * @since 1.0.0 |
|
| 3277 | - */ |
|
| 3278 | - do_action('geodir_home_sidebar_left_inside');
|
|
| 3279 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3280 | - do_action('geodir_sidebar_left_close', 'home-page');
|
|
| 3281 | - } |
|
| 3271 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3272 | + do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
|
|
| 3273 | + /** |
|
| 3274 | + * This is used to add the content to the home page left sidebar (if active). |
|
| 3275 | + * |
|
| 3276 | + * @since 1.0.0 |
|
| 3277 | + */ |
|
| 3278 | + do_action('geodir_home_sidebar_left_inside');
|
|
| 3279 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3280 | + do_action('geodir_sidebar_left_close', 'home-page');
|
|
| 3281 | + } |
|
| 3282 | 3282 | } |
| 3283 | 3283 | |
| 3284 | 3284 | /** |
@@ -3291,7 +3291,7 @@ discard block |
||
| 3291 | 3291 | */ |
| 3292 | 3292 | function geodir_home_right_section() |
| 3293 | 3293 | {
|
| 3294 | - if (get_option('geodir_show_home_right_section')) { ?>
|
|
| 3294 | + if (get_option('geodir_show_home_right_section')) { ?>
|
|
| 3295 | 3295 | <div class="geodir-content-right geodir-sidebar-wrap"> |
| 3296 | 3296 | <?php dynamic_sidebar('geodir_home_right'); ?>
|
| 3297 | 3297 | </div><!-- end geodir-content-right --> |
@@ -3312,18 +3312,18 @@ discard block |
||
| 3312 | 3312 | */ |
| 3313 | 3313 | function geodir_action_home_sidebar_right() |
| 3314 | 3314 | {
|
| 3315 | - if (get_option('geodir_show_home_right_section')) {
|
|
| 3316 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3317 | - do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 3318 | - /** |
|
| 3319 | - * This is used to add the content to the home page right sidebar (if active). |
|
| 3320 | - * |
|
| 3321 | - * @since 1.0.0 |
|
| 3322 | - */ |
|
| 3323 | - do_action('geodir_home_sidebar_right_inside');
|
|
| 3324 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3325 | - do_action('geodir_sidebar_right_close', 'home-page');
|
|
| 3326 | - } |
|
| 3315 | + if (get_option('geodir_show_home_right_section')) {
|
|
| 3316 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3317 | + do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
|
|
| 3318 | + /** |
|
| 3319 | + * This is used to add the content to the home page right sidebar (if active). |
|
| 3320 | + * |
|
| 3321 | + * @since 1.0.0 |
|
| 3322 | + */ |
|
| 3323 | + do_action('geodir_home_sidebar_right_inside');
|
|
| 3324 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3325 | + do_action('geodir_sidebar_right_close', 'home-page');
|
|
| 3326 | + } |
|
| 3327 | 3327 | } |
| 3328 | 3328 | |
| 3329 | 3329 | /** |
@@ -3334,7 +3334,7 @@ discard block |
||
| 3334 | 3334 | */ |
| 3335 | 3335 | function geodir_action_home_content_inside() |
| 3336 | 3336 | {
|
| 3337 | - dynamic_sidebar('geodir_home_content');
|
|
| 3337 | + dynamic_sidebar('geodir_home_content');
|
|
| 3338 | 3338 | } |
| 3339 | 3339 | |
| 3340 | 3340 | add_action('geodir_home_content_inside', 'geodir_action_home_content_inside', 10);
|
@@ -3349,28 +3349,28 @@ discard block |
||
| 3349 | 3349 | */ |
| 3350 | 3350 | function geodir_action_home_content() |
| 3351 | 3351 | {
|
| 3352 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3353 | - do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
|
|
| 3354 | - /** |
|
| 3355 | - * This called before the home page main content. |
|
| 3356 | - * |
|
| 3357 | - * @since 1.0.0 |
|
| 3358 | - */ |
|
| 3359 | - do_action('geodir_before_home_content');
|
|
| 3360 | - /** |
|
| 3361 | - * This is used to add the content to the home page main content. |
|
| 3362 | - * |
|
| 3363 | - * @since 1.0.0 |
|
| 3364 | - */ |
|
| 3365 | - do_action('geodir_home_content_inside');
|
|
| 3366 | - /** |
|
| 3367 | - * This is called after the homepage main content. |
|
| 3368 | - * |
|
| 3369 | - * @since 1.0.0 |
|
| 3370 | - */ |
|
| 3371 | - do_action('geodir_after_home_content');
|
|
| 3372 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3373 | - do_action('geodir_main_content_close', 'home-page');
|
|
| 3352 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3353 | + do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
|
|
| 3354 | + /** |
|
| 3355 | + * This called before the home page main content. |
|
| 3356 | + * |
|
| 3357 | + * @since 1.0.0 |
|
| 3358 | + */ |
|
| 3359 | + do_action('geodir_before_home_content');
|
|
| 3360 | + /** |
|
| 3361 | + * This is used to add the content to the home page main content. |
|
| 3362 | + * |
|
| 3363 | + * @since 1.0.0 |
|
| 3364 | + */ |
|
| 3365 | + do_action('geodir_home_content_inside');
|
|
| 3366 | + /** |
|
| 3367 | + * This is called after the homepage main content. |
|
| 3368 | + * |
|
| 3369 | + * @since 1.0.0 |
|
| 3370 | + */ |
|
| 3371 | + do_action('geodir_after_home_content');
|
|
| 3372 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3373 | + do_action('geodir_main_content_close', 'home-page');
|
|
| 3374 | 3374 | } |
| 3375 | 3375 | |
| 3376 | 3376 | add_action('geodir_sidebar_location_bottom_section', 'geodir_action_sidebar_home_bottom_section', 10);
|
@@ -3385,11 +3385,11 @@ discard block |
||
| 3385 | 3385 | */ |
| 3386 | 3386 | function geodir_action_sidebar_home_bottom_section() |
| 3387 | 3387 | {
|
| 3388 | - if (get_option('geodir_show_home_bottom_section')) { ?>
|
|
| 3388 | + if (get_option('geodir_show_home_bottom_section')) { ?>
|
|
| 3389 | 3389 | <div |
| 3390 | 3390 | class="<?php |
| 3391 | - /** This action is documented in geodirectory_template_actions.php */ |
|
| 3392 | - echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
|
|
| 3391 | + /** This action is documented in geodirectory_template_actions.php */ |
|
| 3392 | + echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
|
|
| 3393 | 3393 | <?php dynamic_sidebar('geodir_home_bottom'); ?>
|
| 3394 | 3394 | </div><!-- clearfix ends here--> |
| 3395 | 3395 | <?php } |
@@ -3417,13 +3417,13 @@ discard block |
||
| 3417 | 3417 | */ |
| 3418 | 3418 | function geodir_filter_listing_page_title($list_title) |
| 3419 | 3419 | {
|
| 3420 | - if (is_search() && trim(get_search_query()) == '') {
|
|
| 3421 | - $gd_post_type = geodir_get_current_posttype(); |
|
| 3422 | - $post_type_info = get_post_type_object($gd_post_type); |
|
| 3420 | + if (is_search() && trim(get_search_query()) == '') {
|
|
| 3421 | + $gd_post_type = geodir_get_current_posttype(); |
|
| 3422 | + $post_type_info = get_post_type_object($gd_post_type); |
|
| 3423 | 3423 | |
| 3424 | - $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
|
|
| 3425 | - } |
|
| 3426 | - return $list_title; |
|
| 3424 | + $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
|
|
| 3425 | + } |
|
| 3426 | + return $list_title; |
|
| 3427 | 3427 | } |
| 3428 | 3428 | |
| 3429 | 3429 | add_action('geodir_message_not_found_on_listing', 'geodir_display_message_not_found_on_listing');
|
@@ -3438,62 +3438,62 @@ discard block |
||
| 3438 | 3438 | * @param string $gd_page The geodirectory page type. Default null. |
| 3439 | 3439 | */ |
| 3440 | 3440 | function geodir_add_page_content( $position = 'before', $gd_page = '' ) {
|
| 3441 | - global $post; |
|
| 3442 | - |
|
| 3443 | - $gd_page_id = NULL; |
|
| 3444 | - if ($gd_page == 'home-page' && geodir_is_page('home')) {
|
|
| 3445 | - $gd_page_id = geodir_home_page_id(); |
|
| 3446 | - } else if ($gd_page == 'details-page' && geodir_is_page('preview')) {
|
|
| 3447 | - $gd_page_id = geodir_preview_page_id(); |
|
| 3448 | - } else if ($gd_page == 'add-listing-page' && geodir_is_page('add-listing')) {
|
|
| 3449 | - $gd_page_id = geodir_add_listing_page_id(); |
|
| 3450 | - } else if ($gd_page == 'success-page' && geodir_is_page('listing-success')) {
|
|
| 3451 | - $gd_page_id = geodir_success_page_id(); |
|
| 3452 | - } else if ($gd_page == 'location-page' && geodir_is_page('location')) {
|
|
| 3453 | - $gd_page_id = geodir_location_page_id(); |
|
| 3454 | - } else if ($gd_page == 'info-page' && geodir_is_page('info')) {
|
|
| 3455 | - $gd_page_id = geodir_info_page_id(); |
|
| 3456 | - } else if ($gd_page == 'signup-page' && geodir_is_page('login')) {
|
|
| 3457 | - $gd_page_id = geodir_login_page_id(); |
|
| 3458 | - } else if ($gd_page == 'checkout-page' && geodir_is_page('checkout')) {
|
|
| 3459 | - $gd_page_id = geodir_payment_checkout_page_id(); |
|
| 3460 | - } else if ($gd_page == 'invoices-page' && geodir_is_page('invoices')) {
|
|
| 3461 | - $gd_page_id = geodir_payment_invoices_page_id(); |
|
| 3462 | - } |
|
| 3463 | - |
|
| 3464 | - if (!$gd_page_id > 0) {
|
|
| 3465 | - return; |
|
| 3466 | - } |
|
| 3441 | + global $post; |
|
| 3442 | + |
|
| 3443 | + $gd_page_id = NULL; |
|
| 3444 | + if ($gd_page == 'home-page' && geodir_is_page('home')) {
|
|
| 3445 | + $gd_page_id = geodir_home_page_id(); |
|
| 3446 | + } else if ($gd_page == 'details-page' && geodir_is_page('preview')) {
|
|
| 3447 | + $gd_page_id = geodir_preview_page_id(); |
|
| 3448 | + } else if ($gd_page == 'add-listing-page' && geodir_is_page('add-listing')) {
|
|
| 3449 | + $gd_page_id = geodir_add_listing_page_id(); |
|
| 3450 | + } else if ($gd_page == 'success-page' && geodir_is_page('listing-success')) {
|
|
| 3451 | + $gd_page_id = geodir_success_page_id(); |
|
| 3452 | + } else if ($gd_page == 'location-page' && geodir_is_page('location')) {
|
|
| 3453 | + $gd_page_id = geodir_location_page_id(); |
|
| 3454 | + } else if ($gd_page == 'info-page' && geodir_is_page('info')) {
|
|
| 3455 | + $gd_page_id = geodir_info_page_id(); |
|
| 3456 | + } else if ($gd_page == 'signup-page' && geodir_is_page('login')) {
|
|
| 3457 | + $gd_page_id = geodir_login_page_id(); |
|
| 3458 | + } else if ($gd_page == 'checkout-page' && geodir_is_page('checkout')) {
|
|
| 3459 | + $gd_page_id = geodir_payment_checkout_page_id(); |
|
| 3460 | + } else if ($gd_page == 'invoices-page' && geodir_is_page('invoices')) {
|
|
| 3461 | + $gd_page_id = geodir_payment_invoices_page_id(); |
|
| 3462 | + } |
|
| 3463 | + |
|
| 3464 | + if (!$gd_page_id > 0) {
|
|
| 3465 | + return; |
|
| 3466 | + } |
|
| 3467 | 3467 | |
| 3468 | - $display = 'before'; |
|
| 3469 | - /** |
|
| 3470 | - * Filter the position to display the page content. |
|
| 3471 | - * |
|
| 3472 | - * @since 1.6.3 |
|
| 3473 | - * |
|
| 3474 | - * @param string $display Position to add the post content. |
|
| 3475 | - * @param string $gd_page The geodirectory page type. |
|
| 3476 | - */ |
|
| 3477 | - $display = apply_filters('geodir_add_page_content_position', $display, $gd_page);
|
|
| 3478 | - |
|
| 3479 | - if ($position !== $display) {
|
|
| 3480 | - return; |
|
| 3481 | - } |
|
| 3482 | - |
|
| 3483 | - $gd_post = $post; |
|
| 3468 | + $display = 'before'; |
|
| 3469 | + /** |
|
| 3470 | + * Filter the position to display the page content. |
|
| 3471 | + * |
|
| 3472 | + * @since 1.6.3 |
|
| 3473 | + * |
|
| 3474 | + * @param string $display Position to add the post content. |
|
| 3475 | + * @param string $gd_page The geodirectory page type. |
|
| 3476 | + */ |
|
| 3477 | + $display = apply_filters('geodir_add_page_content_position', $display, $gd_page);
|
|
| 3478 | + |
|
| 3479 | + if ($position !== $display) {
|
|
| 3480 | + return; |
|
| 3481 | + } |
|
| 3482 | + |
|
| 3483 | + $gd_post = $post; |
|
| 3484 | 3484 | |
| 3485 | - setup_postdata(get_post($gd_page_id)); |
|
| 3485 | + setup_postdata(get_post($gd_page_id)); |
|
| 3486 | 3486 | |
| 3487 | - if (get_the_content()) {
|
|
| 3488 | - ?> |
|
| 3487 | + if (get_the_content()) {
|
|
| 3488 | + ?> |
|
| 3489 | 3489 | <section class="entry-content clearfix" itemprop="articleBody"><?php the_content(); ?></section> |
| 3490 | 3490 | <?php |
| 3491 | - } |
|
| 3491 | + } |
|
| 3492 | 3492 | |
| 3493 | - $post = $gd_post; |
|
| 3494 | - if (!empty($gd_post) && is_object($gd_post)) {
|
|
| 3495 | - setup_postdata($gd_post); |
|
| 3496 | - } |
|
| 3493 | + $post = $gd_post; |
|
| 3494 | + if (!empty($gd_post) && is_object($gd_post)) {
|
|
| 3495 | + setup_postdata($gd_post); |
|
| 3496 | + } |
|
| 3497 | 3497 | |
| 3498 | 3498 | } |
| 3499 | 3499 | add_action('geodir_add_page_content', 'geodir_add_page_content', 10, 2);
|
@@ -3514,13 +3514,13 @@ discard block |
||
| 3514 | 3514 | * @return string Filtered SQL JOIN clause. |
| 3515 | 3515 | */ |
| 3516 | 3516 | function geodir_previous_next_post_join( $join, $in_same_term, $excluded_terms, $taxonomy, $post ) {
|
| 3517 | - global $plugin_prefix; |
|
| 3517 | + global $plugin_prefix; |
|
| 3518 | 3518 | |
| 3519 | - if ( !empty($post->post_type) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
|
|
| 3520 | - $join .= " INNER JOIN " . $plugin_prefix . $post->post_type . "_detail AS gd ON gd.post_id = p.ID"; |
|
| 3521 | - } |
|
| 3519 | + if ( !empty($post->post_type) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
|
|
| 3520 | + $join .= " INNER JOIN " . $plugin_prefix . $post->post_type . "_detail AS gd ON gd.post_id = p.ID"; |
|
| 3521 | + } |
|
| 3522 | 3522 | |
| 3523 | - return $join; |
|
| 3523 | + return $join; |
|
| 3524 | 3524 | } |
| 3525 | 3525 | add_filter( 'get_previous_post_join', 'geodir_previous_next_post_join', 10, 5 ); |
| 3526 | 3526 | add_filter( 'get_next_post_join', 'geodir_previous_next_post_join', 10, 5 ); |
@@ -3542,31 +3542,31 @@ discard block |
||
| 3542 | 3542 | * @return string Filtered SQL WHERE clause. |
| 3543 | 3543 | */ |
| 3544 | 3544 | function geodir_previous_next_post_where( $where, $in_same_term, $excluded_terms, $taxonomy, $post ) {
|
| 3545 | - global $wpdb, $plugin_prefix; |
|
| 3545 | + global $wpdb, $plugin_prefix; |
|
| 3546 | 3546 | |
| 3547 | - if ( !empty($post->post_type) && ( !empty( $post->country_slug ) || !empty( $post->region_slug ) || !empty( $post->city_slug ) ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
|
|
| 3548 | - $post_locations = ''; |
|
| 3549 | - $post_locations_var = array(); |
|
| 3547 | + if ( !empty($post->post_type) && ( !empty( $post->country_slug ) || !empty( $post->region_slug ) || !empty( $post->city_slug ) ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
|
|
| 3548 | + $post_locations = ''; |
|
| 3549 | + $post_locations_var = array(); |
|
| 3550 | 3550 | |
| 3551 | - if ( !empty( $post->country_slug ) ) {
|
|
| 3552 | - $post_locations .= " AND post_locations LIKE %s"; |
|
| 3553 | - $post_locations_var[] = "%,[" . $post->country_slug . "]"; |
|
| 3554 | - } |
|
| 3555 | - |
|
| 3556 | - if ( !empty( $post->region_slug ) ) {
|
|
| 3557 | - $post_locations .= " AND post_locations LIKE %s"; |
|
| 3558 | - $post_locations_var[] = "%,[" . $post->region_slug . "],%"; |
|
| 3559 | - } |
|
| 3560 | - |
|
| 3561 | - if ( !empty( $post->city_slug ) ) {
|
|
| 3562 | - $post_locations .= " AND post_locations LIKE %s"; |
|
| 3563 | - $post_locations_var[] = "[" . $post->city_slug . "],%"; |
|
| 3564 | - } |
|
| 3551 | + if ( !empty( $post->country_slug ) ) {
|
|
| 3552 | + $post_locations .= " AND post_locations LIKE %s"; |
|
| 3553 | + $post_locations_var[] = "%,[" . $post->country_slug . "]"; |
|
| 3554 | + } |
|
| 3555 | + |
|
| 3556 | + if ( !empty( $post->region_slug ) ) {
|
|
| 3557 | + $post_locations .= " AND post_locations LIKE %s"; |
|
| 3558 | + $post_locations_var[] = "%,[" . $post->region_slug . "],%"; |
|
| 3559 | + } |
|
| 3560 | + |
|
| 3561 | + if ( !empty( $post->city_slug ) ) {
|
|
| 3562 | + $post_locations .= " AND post_locations LIKE %s"; |
|
| 3563 | + $post_locations_var[] = "[" . $post->city_slug . "],%"; |
|
| 3564 | + } |
|
| 3565 | 3565 | |
| 3566 | - $where .= $wpdb->prepare( $post_locations, $post_locations_var ); |
|
| 3567 | - } |
|
| 3566 | + $where .= $wpdb->prepare( $post_locations, $post_locations_var ); |
|
| 3567 | + } |
|
| 3568 | 3568 | |
| 3569 | - return $where; |
|
| 3569 | + return $where; |
|
| 3570 | 3570 | } |
| 3571 | 3571 | add_filter( 'get_previous_post_where', 'geodir_previous_next_post_where', 10, 5 ); |
| 3572 | 3572 | add_filter( 'get_next_post_where', 'geodir_previous_next_post_where', 10, 5 ); |
| 3573 | 3573 | \ No newline at end of file |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | //php |
| 285 | 285 | if (!empty($tc['geodir_theme_compat_code'])) {
|
| 286 | - include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
|
|
| 286 | + include_once('geodirectory-functions/compatibility/'.$tc['geodir_theme_compat_code'].'.php');
|
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | //geodir_full_page_class |
@@ -453,13 +453,13 @@ discard block |
||
| 453 | 453 | function geodir_action_wrapper_content_open($type = '', $id = '', $class = '') |
| 454 | 454 | {
|
| 455 | 455 | if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
|
| 456 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 456 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 457 | 457 | } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
|
| 458 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 458 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 459 | 459 | } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
|
| 460 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 460 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 461 | 461 | } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
|
| 462 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 462 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 463 | 463 | } else {
|
| 464 | 464 | $width_css = ''; |
| 465 | 465 | } |
@@ -573,13 +573,13 @@ discard block |
||
| 573 | 573 | function geodir_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '') |
| 574 | 574 | {
|
| 575 | 575 | if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
|
| 576 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 576 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 577 | 577 | } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
|
| 578 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 578 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 579 | 579 | } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
|
| 580 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 580 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 581 | 581 | } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
|
| 582 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 582 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 583 | 583 | } else {
|
| 584 | 584 | $width_css = ''; |
| 585 | 585 | } |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | } |
| 678 | 678 | } |
| 679 | 679 | |
| 680 | - $post = (object)$_REQUEST; |
|
| 680 | + $post = (object) $_REQUEST; |
|
| 681 | 681 | |
| 682 | 682 | |
| 683 | 683 | if (isset($post->video)) {
|
@@ -736,10 +736,10 @@ discard block |
||
| 736 | 736 | |
| 737 | 737 | $json = '{';
|
| 738 | 738 | $json .= '"post_preview": "1",'; |
| 739 | - $json .= '"t": "' . $json_title . '",'; |
|
| 740 | - $json .= '"lt": "' . $post_latitude . '",'; |
|
| 741 | - $json .= '"ln": "' . $post_longitude . '",'; |
|
| 742 | - $json .= '"i":"' . $term_icon . '"'; |
|
| 739 | + $json .= '"t": "'.$json_title.'",'; |
|
| 740 | + $json .= '"lt": "'.$post_latitude.'",'; |
|
| 741 | + $json .= '"ln": "'.$post_longitude.'",'; |
|
| 742 | + $json .= '"i":"'.$term_icon.'"'; |
|
| 743 | 743 | $json .= '}'; |
| 744 | 744 | |
| 745 | 745 | $post->marker_json = $json; |
@@ -966,7 +966,7 @@ discard block |
||
| 966 | 966 | * @param string $class The class to use. Default is 'entry-header'. |
| 967 | 967 | */ |
| 968 | 968 | $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
| 969 | - echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>'; |
|
| 969 | + echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.stripslashes(get_the_title()).'</h1></header>'; |
|
| 970 | 970 | } |
| 971 | 971 | |
| 972 | 972 | |
@@ -1020,7 +1020,7 @@ discard block |
||
| 1020 | 1020 | $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0; |
| 1021 | 1021 | |
| 1022 | 1022 | if ($image && $width && $height) {
|
| 1023 | - $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
|
|
| 1023 | + $image = (object) array('src' => $image, 'width' => $width, 'height' => $height);
|
|
| 1024 | 1024 | } |
| 1025 | 1025 | |
| 1026 | 1026 | if (isset($image->src)) {
|
@@ -1032,9 +1032,9 @@ discard block |
||
| 1032 | 1032 | |
| 1033 | 1033 | $image_title = isset($image->title) ? $image->title : ''; |
| 1034 | 1034 | |
| 1035 | - $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />'; |
|
| 1036 | - $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>'; |
|
| 1037 | - $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>'; |
|
| 1035 | + $main_slides .= '<li><img src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:'.$spacer_height.'px;margin:0 auto;" />'; |
|
| 1036 | + $main_slides .= '<img src="'.$image->src.'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:400px;margin:0 auto;" /></li>'; |
|
| 1037 | + $nav_slides .= '<li><img src="'.$image->src.'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:48px;margin:0 auto;" /></li>'; |
|
| 1038 | 1038 | $slides++; |
| 1039 | 1039 | } |
| 1040 | 1040 | } |
@@ -1060,10 +1060,10 @@ discard block |
||
| 1060 | 1060 | } else {
|
| 1061 | 1061 | $spacer_height = ((400 - $image->height) / 2); |
| 1062 | 1062 | } |
| 1063 | - $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : ''; |
|
| 1064 | - $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />'; |
|
| 1065 | - $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>'; |
|
| 1066 | - $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>'; |
|
| 1063 | + $caption = ''; //(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : ''; |
|
| 1064 | + $main_slides .= '<li><img src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:'.$spacer_height.'px;margin:0 auto;" />'; |
|
| 1065 | + $main_slides .= '<img src="'.$image->src.'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>'; |
|
| 1066 | + $nav_slides .= '<li><img src="'.$image->src.'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:48px;margin:0 auto;" /></li>'; |
|
| 1067 | 1067 | $slides++; |
| 1068 | 1068 | } |
| 1069 | 1069 | }// endfore |
@@ -1098,7 +1098,7 @@ discard block |
||
| 1098 | 1098 | */ |
| 1099 | 1099 | function geodir_action_details_taxonomies() |
| 1100 | 1100 | {
|
| 1101 | - global $preview, $post;?> |
|
| 1101 | + global $preview, $post; ?> |
|
| 1102 | 1102 | <p class="geodir_post_taxomomies clearfix"> |
| 1103 | 1103 | <?php |
| 1104 | 1104 | $taxonomies = array(); |
@@ -1107,11 +1107,11 @@ discard block |
||
| 1107 | 1107 | |
| 1108 | 1108 | if ($preview && !$is_backend_preview) {
|
| 1109 | 1109 | $post_type = $post->listing_type; |
| 1110 | - $post_taxonomy = $post_type . 'category'; |
|
| 1110 | + $post_taxonomy = $post_type.'category'; |
|
| 1111 | 1111 | $post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
|
| 1112 | 1112 | } else {
|
| 1113 | 1113 | $post_type = $post->post_type; |
| 1114 | - $post_taxonomy = $post_type . 'category'; |
|
| 1114 | + $post_taxonomy = $post_type.'category'; |
|
| 1115 | 1115 | } |
| 1116 | 1116 | //{
|
| 1117 | 1117 | $post_type_info = get_post_type_object($post_type); |
@@ -1119,7 +1119,7 @@ discard block |
||
| 1119 | 1119 | |
| 1120 | 1120 | if (!empty($post->post_tags)) {
|
| 1121 | 1121 | |
| 1122 | - if (taxonomy_exists($post_type . '_tags')): |
|
| 1122 | + if (taxonomy_exists($post_type.'_tags')): |
|
| 1123 | 1123 | $links = array(); |
| 1124 | 1124 | $terms = array(); |
| 1125 | 1125 | // to limit post tags |
@@ -1146,8 +1146,8 @@ discard block |
||
| 1146 | 1146 | $post_term = trim($post_term); |
| 1147 | 1147 | |
| 1148 | 1148 | $priority_location = false; |
| 1149 | - if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
|
|
| 1150 | - $term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
|
|
| 1149 | + if ($insert_term = term_exists($post_term, $post_type.'_tags')) {
|
|
| 1150 | + $term = get_term_by('id', $insert_term['term_id'], $post_type.'_tags');
|
|
| 1151 | 1151 | } else {
|
| 1152 | 1152 | $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL; |
| 1153 | 1153 | $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL; |
@@ -1157,10 +1157,10 @@ discard block |
||
| 1157 | 1157 | $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false; |
| 1158 | 1158 | if ($match_country || $match_region || $match_city) {
|
| 1159 | 1159 | $priority_location = true; |
| 1160 | - $term = get_term_by('name', $post_term, $post_type . '_tags');
|
|
| 1160 | + $term = get_term_by('name', $post_term, $post_type.'_tags');
|
|
| 1161 | 1161 | } else {
|
| 1162 | - $insert_term = wp_insert_term($post_term, $post_type . '_tags'); |
|
| 1163 | - $term = get_term_by('name', $post_term, $post_type . '_tags');
|
|
| 1162 | + $insert_term = wp_insert_term($post_term, $post_type.'_tags'); |
|
| 1163 | + $term = get_term_by('name', $post_term, $post_type.'_tags');
|
|
| 1164 | 1164 | } |
| 1165 | 1165 | } |
| 1166 | 1166 | |
@@ -1177,12 +1177,12 @@ discard block |
||
| 1177 | 1177 | * @param string $tag_link The tag link html. |
| 1178 | 1178 | * @param object $term The tag term object. |
| 1179 | 1179 | */ |
| 1180 | - $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
|
|
| 1180 | + $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
|
|
| 1181 | 1181 | $links[] = $tag_link; |
| 1182 | 1182 | } else {
|
| 1183 | - $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>"; |
|
| 1183 | + $tag_link = "<a href='".esc_attr(get_term_link($term->term_id, $term->taxonomy))."'>$term->name</a>"; |
|
| 1184 | 1184 | /** This action is documented in geodirectory-template_actions.php */ |
| 1185 | - $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
|
|
| 1185 | + $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
|
|
| 1186 | 1186 | $links[] = $tag_link; |
| 1187 | 1187 | } |
| 1188 | 1188 | $terms[] = $term; |
@@ -1192,7 +1192,7 @@ discard block |
||
| 1192 | 1192 | if (!isset($listing_label)) {
|
| 1193 | 1193 | $listing_label = ''; |
| 1194 | 1194 | } |
| 1195 | - $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
|
|
| 1195 | + $taxonomies[$post_type.'_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object) $terms);
|
|
| 1196 | 1196 | endif; |
| 1197 | 1197 | |
| 1198 | 1198 | } |
@@ -1220,7 +1220,7 @@ discard block |
||
| 1220 | 1220 | $term = get_term_by('id', $post_term, $post_taxonomy);
|
| 1221 | 1221 | |
| 1222 | 1222 | if (is_object($term)) {
|
| 1223 | - $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>"; |
|
| 1223 | + $term_link = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>$term->name</a>"; |
|
| 1224 | 1224 | /** |
| 1225 | 1225 | * Filter the category name on the details page. |
| 1226 | 1226 | * |
@@ -1228,7 +1228,7 @@ discard block |
||
| 1228 | 1228 | * @param string $term_link The link html to the category. |
| 1229 | 1229 | * @param object $term The category term object. |
| 1230 | 1230 | */ |
| 1231 | - $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
|
|
| 1231 | + $term_link = apply_filters('geodir_details_taxonomies_cat_link', $term_link, $term);
|
|
| 1232 | 1232 | $links[] = $term_link; |
| 1233 | 1233 | $terms[] = $term; |
| 1234 | 1234 | } |
@@ -1246,7 +1246,7 @@ discard block |
||
| 1246 | 1246 | if (!isset($listing_label)) {
|
| 1247 | 1247 | $listing_label = ''; |
| 1248 | 1248 | } |
| 1249 | - $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
|
|
| 1249 | + $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object) $terms);
|
|
| 1250 | 1250 | |
| 1251 | 1251 | } |
| 1252 | 1252 | |
@@ -1259,14 +1259,14 @@ discard block |
||
| 1259 | 1259 | * @param string $listing_label The post type label. |
| 1260 | 1260 | * @param string $listing_label The post type label with ucwords function. |
| 1261 | 1261 | */ |
| 1262 | - $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
|
|
| 1262 | + $taxonomies = apply_filters('geodir_details_taxonomies_output', $taxonomies, $post_type, $listing_label, geodir_ucwords($listing_label));
|
|
| 1263 | 1263 | |
| 1264 | 1264 | if (isset($taxonomies[$post_taxonomy])) {
|
| 1265 | - echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>'; |
|
| 1265 | + echo '<span class="geodir-category">'.$taxonomies[$post_taxonomy].'</span>'; |
|
| 1266 | 1266 | } |
| 1267 | 1267 | |
| 1268 | - if (isset($taxonomies[$post_type . '_tags'])) |
|
| 1269 | - echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>'; |
|
| 1268 | + if (isset($taxonomies[$post_type.'_tags'])) |
|
| 1269 | + echo '<span class="geodir-tags">'.$taxonomies[$post_type.'_tags'].'</span>'; |
|
| 1270 | 1270 | |
| 1271 | 1271 | ?> |
| 1272 | 1272 | </p><?php |
@@ -1287,11 +1287,11 @@ discard block |
||
| 1287 | 1287 | * @param object $post Optional. The post object or blank. |
| 1288 | 1288 | * @package GeoDirectory |
| 1289 | 1289 | */ |
| 1290 | -function geodir_action_details_micordata($post='') |
|
| 1290 | +function geodir_action_details_micordata($post = '') |
|
| 1291 | 1291 | {
|
| 1292 | 1292 | |
| 1293 | 1293 | global $preview; |
| 1294 | - if(empty($post)){global $post;}
|
|
| 1294 | + if (empty($post)) {global $post; }
|
|
| 1295 | 1295 | if ($preview || !geodir_is_page('detail')) {
|
| 1296 | 1296 | return; |
| 1297 | 1297 | } |
@@ -1312,7 +1312,7 @@ discard block |
||
| 1312 | 1312 | "description" => $review->comment_content, |
| 1313 | 1313 | "reviewRating" => array( |
| 1314 | 1314 | "@type" => "Rating", |
| 1315 | - "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score. |
|
| 1315 | + "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score. |
|
| 1316 | 1316 | "ratingValue" => geodir_get_commentoverall($review->comment_ID), |
| 1317 | 1317 | "worstRating" => "1" |
| 1318 | 1318 | ) |
@@ -1340,13 +1340,13 @@ discard block |
||
| 1340 | 1340 | } |
| 1341 | 1341 | //print_r($post); |
| 1342 | 1342 | // external links |
| 1343 | - $external_links = array(); |
|
| 1343 | + $external_links = array(); |
|
| 1344 | 1344 | $external_links[] = $post->geodir_website; |
| 1345 | 1345 | $external_links[] = $post->geodir_twitter; |
| 1346 | 1346 | $external_links[] = $post->geodir_facebook; |
| 1347 | 1347 | $external_links = array_filter($external_links); |
| 1348 | 1348 | |
| 1349 | - if(!empty($external_links)){
|
|
| 1349 | + if (!empty($external_links)) {
|
|
| 1350 | 1350 | $external_links = array_values($external_links); |
| 1351 | 1351 | } |
| 1352 | 1352 | |
@@ -1356,17 +1356,17 @@ discard block |
||
| 1356 | 1356 | |
| 1357 | 1357 | // schema type |
| 1358 | 1358 | $schema_type = 'LocalBusiness'; |
| 1359 | - if(isset($post->default_category) && $post->default_category){
|
|
| 1359 | + if (isset($post->default_category) && $post->default_category) {
|
|
| 1360 | 1360 | $cat_schema = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type); |
| 1361 | - if($cat_schema){$schema_type = $cat_schema;}
|
|
| 1362 | - if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
|
|
| 1361 | + if ($cat_schema) {$schema_type = $cat_schema; }
|
|
| 1362 | + if (!$schema_type && $post->post_type == 'gd_event') {$schema_type = 'Event'; }
|
|
| 1363 | 1363 | } |
| 1364 | 1364 | |
| 1365 | 1365 | $schema = array(); |
| 1366 | 1366 | $schema['@context'] = "https://schema.org"; |
| 1367 | 1367 | $schema['@type'] = $schema_type; |
| 1368 | 1368 | $schema['name'] = $post->post_title; |
| 1369 | - $schema['description'] = wp_strip_all_tags( $post->post_content, true ); |
|
| 1369 | + $schema['description'] = wp_strip_all_tags($post->post_content, true); |
|
| 1370 | 1370 | $schema['telephone'] = $post->geodir_contact; |
| 1371 | 1371 | $schema['url'] = $c_url; |
| 1372 | 1372 | $schema['sameAs'] = $external_links; |
@@ -1380,7 +1380,7 @@ discard block |
||
| 1380 | 1380 | "postalCode" => $post->post_zip |
| 1381 | 1381 | ); |
| 1382 | 1382 | |
| 1383 | - if($post->post_latitude && $post->post_longitude) {
|
|
| 1383 | + if ($post->post_latitude && $post->post_longitude) {
|
|
| 1384 | 1384 | $schema['geo'] = array( |
| 1385 | 1385 | "@type" => "GeoCoordinates", |
| 1386 | 1386 | "latitude" => $post->post_latitude, |
@@ -1388,7 +1388,7 @@ discard block |
||
| 1388 | 1388 | ); |
| 1389 | 1389 | } |
| 1390 | 1390 | |
| 1391 | - if($post_avgratings) {
|
|
| 1391 | + if ($post_avgratings) {
|
|
| 1392 | 1392 | $schema['aggregateRating'] = array( |
| 1393 | 1393 | "@type" => "AggregateRating", |
| 1394 | 1394 | "ratingValue" => $post_avgratings, |
@@ -1407,10 +1407,10 @@ discard block |
||
| 1407 | 1407 | * @param array $schema The array of schema data to be filtered. |
| 1408 | 1408 | * @param object $post The post object. |
| 1409 | 1409 | */ |
| 1410 | - $schema = apply_filters('geodir_details_schema', $schema,$post);
|
|
| 1410 | + $schema = apply_filters('geodir_details_schema', $schema, $post);
|
|
| 1411 | 1411 | |
| 1412 | 1412 | |
| 1413 | - echo '<script type="application/ld+json">' . json_encode($schema) . '</script>'; |
|
| 1413 | + echo '<script type="application/ld+json">'.json_encode($schema).'</script>'; |
|
| 1414 | 1414 | |
| 1415 | 1415 | |
| 1416 | 1416 | $uploads = wp_upload_dir(); |
@@ -1423,7 +1423,7 @@ discard block |
||
| 1423 | 1423 | * @param string $facebook_og The open graph html to be filtered. |
| 1424 | 1424 | * @param object $post The post object. |
| 1425 | 1425 | */ |
| 1426 | - echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
|
|
| 1426 | + echo apply_filters('geodir_details_facebook_og', $facebook_og, $post);
|
|
| 1427 | 1427 | |
| 1428 | 1428 | |
| 1429 | 1429 | |
@@ -1446,9 +1446,9 @@ discard block |
||
| 1446 | 1446 | ?> |
| 1447 | 1447 | <div class="geodir-pos_navigation clearfix"> |
| 1448 | 1448 | <div |
| 1449 | - class="geodir-post_left"><?php previous_post_link('%link', '' . __('Previous', 'geodirectory'), false) ?></div>
|
|
| 1449 | + class="geodir-post_left"><?php previous_post_link('%link', ''.__('Previous', 'geodirectory'), false) ?></div>
|
|
| 1450 | 1450 | <div |
| 1451 | - class="geodir-post_right"><?php next_post_link('%link', __('Next', 'geodirectory') . '', false) ?></div>
|
|
| 1451 | + class="geodir-post_right"><?php next_post_link('%link', __('Next', 'geodirectory').'', false) ?></div>
|
|
| 1452 | 1452 | </div><?php |
| 1453 | 1453 | } |
| 1454 | 1454 | |
@@ -1517,12 +1517,12 @@ discard block |
||
| 1517 | 1517 | $gd_post_type = geodir_get_current_posttype(); |
| 1518 | 1518 | $post_type_info = get_post_type_object($gd_post_type); |
| 1519 | 1519 | |
| 1520 | - $add_string_in_title = __('All', 'geodirectory') . ' ';
|
|
| 1520 | + $add_string_in_title = __('All', 'geodirectory').' ';
|
|
| 1521 | 1521 | if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
|
| 1522 | - $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
|
|
| 1522 | + $add_string_in_title = __('My Favorite', 'geodirectory').' ';
|
|
| 1523 | 1523 | } |
| 1524 | 1524 | |
| 1525 | - $list_title = $add_string_in_title . __($post_type_info->labels->name, 'geodirectory'); |
|
| 1525 | + $list_title = $add_string_in_title.__($post_type_info->labels->name, 'geodirectory'); |
|
| 1526 | 1526 | $single_name = $post_type_info->labels->singular_name; |
| 1527 | 1527 | |
| 1528 | 1528 | $taxonomy = geodir_get_taxonomies($gd_post_type, true); |
@@ -1550,12 +1550,12 @@ discard block |
||
| 1550 | 1550 | $current_term = get_term_by('slug', $term, $taxonomy[0]);
|
| 1551 | 1551 | if (!empty($current_term)) {
|
| 1552 | 1552 | $current_term_name = __(ucfirst($current_term->name), 'geodirectory'); |
| 1553 | - if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
|
|
| 1553 | + if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type.'category') {
|
|
| 1554 | 1554 | $location_last_char = substr($location_name, -1); |
| 1555 | 1555 | $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
|
| 1556 | - $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
|
|
| 1556 | + $list_title .= __(' in', 'geodirectory').' '.$location_name.$location_name_attach.' '.$current_term_name;
|
|
| 1557 | 1557 | } else {
|
| 1558 | - $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
|
|
| 1558 | + $list_title .= __(' in', 'geodirectory')." '".$current_term_name."'";
|
|
| 1559 | 1559 | } |
| 1560 | 1560 | } else {
|
| 1561 | 1561 | if (count($taxonomy) > 1) {
|
@@ -1563,12 +1563,12 @@ discard block |
||
| 1563 | 1563 | |
| 1564 | 1564 | if (!empty($current_term)) {
|
| 1565 | 1565 | $current_term_name = __(ucfirst($current_term->name), 'geodirectory'); |
| 1566 | - if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
|
|
| 1566 | + if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type.'category') {
|
|
| 1567 | 1567 | $location_last_char = substr($location_name, -1); |
| 1568 | 1568 | $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
|
| 1569 | - $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
|
|
| 1569 | + $list_title .= __(' in', 'geodirectory').' '.$location_name.$location_name_attach.' '.$current_term_name;
|
|
| 1570 | 1570 | } else {
|
| 1571 | - $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
|
|
| 1571 | + $list_title .= __(' in', 'geodirectory')." '".$current_term_name."'";
|
|
| 1572 | 1572 | } |
| 1573 | 1573 | } |
| 1574 | 1574 | } |
@@ -1596,7 +1596,7 @@ discard block |
||
| 1596 | 1596 | $gd_city = __(geodir_ucwords($gd_city), 'geodirectory'); |
| 1597 | 1597 | } |
| 1598 | 1598 | |
| 1599 | - $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
|
|
| 1599 | + $list_title .= __(' in', 'geodirectory')." '".$gd_city."'";
|
|
| 1600 | 1600 | } else if ($gd_region != '') {
|
| 1601 | 1601 | if ($gd_region_actual != '') {
|
| 1602 | 1602 | $gd_region = $gd_region_actual; |
@@ -1606,7 +1606,7 @@ discard block |
||
| 1606 | 1606 | $gd_region = __(geodir_ucwords($gd_region), 'geodirectory'); |
| 1607 | 1607 | } |
| 1608 | 1608 | |
| 1609 | - $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
|
|
| 1609 | + $list_title .= __(' in', 'geodirectory')." '".$gd_region."'";
|
|
| 1610 | 1610 | } else if ($gd_country != '') {
|
| 1611 | 1611 | if ($gd_country_actual != '') {
|
| 1612 | 1612 | $gd_country = $gd_country_actual; |
@@ -1616,12 +1616,12 @@ discard block |
||
| 1616 | 1616 | $gd_country = __(geodir_ucwords($gd_country), 'geodirectory'); |
| 1617 | 1617 | } |
| 1618 | 1618 | |
| 1619 | - $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
|
|
| 1619 | + $list_title .= __(' in', 'geodirectory')." '".$gd_country."'";
|
|
| 1620 | 1620 | } |
| 1621 | 1621 | } |
| 1622 | 1622 | |
| 1623 | 1623 | if (is_search()) {
|
| 1624 | - $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
|
|
| 1624 | + $list_title = __('Search', 'geodirectory').' '.__(ucfirst($post_type_info->labels->name), 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
|
|
| 1625 | 1625 | } |
| 1626 | 1626 | /** This action is documented in geodirectory_template_actions.php */ |
| 1627 | 1627 | $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
@@ -1631,26 +1631,26 @@ discard block |
||
| 1631 | 1631 | |
| 1632 | 1632 | $title = $list_title; |
| 1633 | 1633 | $gd_page = ''; |
| 1634 | - if(geodir_is_page('pt')){
|
|
| 1634 | + if (geodir_is_page('pt')) {
|
|
| 1635 | 1635 | $gd_page = 'pt'; |
| 1636 | - $title = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
|
|
| 1636 | + $title = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
|
|
| 1637 | 1637 | } |
| 1638 | - elseif(geodir_is_page('listing')){
|
|
| 1638 | + elseif (geodir_is_page('listing')) {
|
|
| 1639 | 1639 | $gd_page = 'listing'; |
| 1640 | 1640 | global $wp_query; |
| 1641 | 1641 | $current_term = $wp_query->get_queried_object(); |
| 1642 | - if (strpos($current_term->taxonomy,'_tags') !== false) {
|
|
| 1642 | + if (strpos($current_term->taxonomy, '_tags') !== false) {
|
|
| 1643 | 1643 | $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
|
| 1644 | - }else{
|
|
| 1644 | + } else {
|
|
| 1645 | 1645 | $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
|
| 1646 | 1646 | } |
| 1647 | 1647 | |
| 1648 | 1648 | } |
| 1649 | - elseif(geodir_is_page('author')){
|
|
| 1649 | + elseif (geodir_is_page('author')) {
|
|
| 1650 | 1650 | $gd_page = 'author'; |
| 1651 | - if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
|
|
| 1651 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
|
|
| 1652 | 1652 | $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
|
| 1653 | - }else{
|
|
| 1653 | + } else {
|
|
| 1654 | 1654 | $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
|
| 1655 | 1655 | } |
| 1656 | 1656 | |
@@ -1664,16 +1664,16 @@ discard block |
||
| 1664 | 1664 | * @param string $title The page title including variables. |
| 1665 | 1665 | * @param string $gd_page The GeoDirectory page type if any. |
| 1666 | 1666 | */ |
| 1667 | - $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 1667 | + $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 1668 | 1668 | |
| 1669 | - echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . |
|
| 1669 | + echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'. |
|
| 1670 | 1670 | /** |
| 1671 | 1671 | * Filter the listing page title. |
| 1672 | 1672 | * |
| 1673 | 1673 | * @since 1.0.0 |
| 1674 | 1674 | * @param string $list_title The title for the category page. |
| 1675 | 1675 | */ |
| 1676 | - apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
|
|
| 1676 | + apply_filters('geodir_listing_page_title', $title).'</h1></header>';
|
|
| 1677 | 1677 | } |
| 1678 | 1678 | |
| 1679 | 1679 | add_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
|
@@ -1692,16 +1692,16 @@ discard block |
||
| 1692 | 1692 | $gd_post_type = geodir_get_current_posttype(); |
| 1693 | 1693 | if (isset($current_term->term_id) && $current_term->term_id != '') {
|
| 1694 | 1694 | |
| 1695 | - $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags'); |
|
| 1695 | + $term_desc = term_description($current_term->term_id, $gd_post_type.'_tags'); |
|
| 1696 | 1696 | $saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type)); |
| 1697 | 1697 | if ($term_desc && !$saved_data) {
|
| 1698 | 1698 | $saved_data = $term_desc; |
| 1699 | 1699 | } |
| 1700 | 1700 | |
| 1701 | 1701 | // stop payment manager filtering content length |
| 1702 | - $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' ); |
|
| 1703 | - if ( false !== $filter_priority ) {
|
|
| 1704 | - remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority ); |
|
| 1702 | + $filter_priority = has_filter('the_content', 'geodir_payments_the_content');
|
|
| 1703 | + if (false !== $filter_priority) {
|
|
| 1704 | + remove_filter('the_content', 'geodir_payments_the_content', $filter_priority);
|
|
| 1705 | 1705 | } |
| 1706 | 1706 | |
| 1707 | 1707 | /** |
@@ -1715,14 +1715,14 @@ discard block |
||
| 1715 | 1715 | $cat_description = apply_filters('the_content', $saved_data);
|
| 1716 | 1716 | |
| 1717 | 1717 | |
| 1718 | - if ( false !== $filter_priority ) {
|
|
| 1719 | - add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority ); |
|
| 1718 | + if (false !== $filter_priority) {
|
|
| 1719 | + add_filter('the_content', 'geodir_payments_the_content', $filter_priority);
|
|
| 1720 | 1720 | } |
| 1721 | 1721 | |
| 1722 | 1722 | if ($cat_description) {
|
| 1723 | 1723 | ?> |
| 1724 | 1724 | |
| 1725 | - <div class="term_description"><?php echo $cat_description;?></div> <?php |
|
| 1725 | + <div class="term_description"><?php echo $cat_description; ?></div> <?php |
|
| 1726 | 1726 | } |
| 1727 | 1727 | |
| 1728 | 1728 | } |
@@ -1772,13 +1772,13 @@ discard block |
||
| 1772 | 1772 | function geodir_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '') |
| 1773 | 1773 | {
|
| 1774 | 1774 | if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
|
| 1775 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 1775 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 1776 | 1776 | } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
|
| 1777 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 1777 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 1778 | 1778 | } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
|
| 1779 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 1779 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 1780 | 1780 | } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
|
| 1781 | - $width_css = 'style="width:' . $width . '%;"'; |
|
| 1781 | + $width_css = 'style="width:'.$width.'%;"'; |
|
| 1782 | 1782 | } else {
|
| 1783 | 1783 | $width_css = ''; |
| 1784 | 1784 | } |
@@ -2083,11 +2083,11 @@ discard block |
||
| 2083 | 2083 | |
| 2084 | 2084 | $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
|
| 2085 | 2085 | |
| 2086 | - if(geodir_is_page('add-listing')){
|
|
| 2086 | + if (geodir_is_page('add-listing')) {
|
|
| 2087 | 2087 | $gd_page = 'add-listing'; |
| 2088 | - if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
|
|
| 2088 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 2089 | 2089 | $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
|
| 2090 | - }elseif(isset($listing_type)){
|
|
| 2090 | + }elseif (isset($listing_type)) {
|
|
| 2091 | 2091 | $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
|
| 2092 | 2092 | } |
| 2093 | 2093 | |
@@ -2101,9 +2101,9 @@ discard block |
||
| 2101 | 2101 | * @param string $title The page title including variables. |
| 2102 | 2102 | * @param string $gd_page The GeoDirectory page type if any. |
| 2103 | 2103 | */ |
| 2104 | - $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 2104 | + $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 2105 | 2105 | |
| 2106 | - echo '<header class="' . $class_header . '"><h1 class="' . $class . '">'; |
|
| 2106 | + echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'; |
|
| 2107 | 2107 | echo $title; |
| 2108 | 2108 | echo '</h1></header>'; |
| 2109 | 2109 | } |
@@ -2117,7 +2117,7 @@ discard block |
||
| 2117 | 2117 | */ |
| 2118 | 2118 | function geodir_action_add_listing_page_mandatory() |
| 2119 | 2119 | {?>
|
| 2120 | - <p class="geodir-note "><span class="geodir-required">*</span> <?php echo INDICATES_MANDATORY_FIELDS_TEXT;?></p> |
|
| 2120 | + <p class="geodir-note "><span class="geodir-required">*</span> <?php echo INDICATES_MANDATORY_FIELDS_TEXT; ?></p> |
|
| 2121 | 2121 | <?php |
| 2122 | 2122 | } |
| 2123 | 2123 | |
@@ -2152,7 +2152,7 @@ discard block |
||
| 2152 | 2152 | |
| 2153 | 2153 | if (isset($_REQUEST['backandedit'])) {
|
| 2154 | 2154 | global $post; |
| 2155 | - $post = (object)$gd_session->get('listing');
|
|
| 2155 | + $post = (object) $gd_session->get('listing');
|
|
| 2156 | 2156 | $listing_type = $post->listing_type; |
| 2157 | 2157 | $title = $post->post_title; |
| 2158 | 2158 | $desc = $post->post_desc; |
@@ -2167,7 +2167,7 @@ discard block |
||
| 2167 | 2167 | $thumb_img_arr = geodir_get_images($post->ID); |
| 2168 | 2168 | if ($thumb_img_arr) {
|
| 2169 | 2169 | foreach ($thumb_img_arr as $post_img) {
|
| 2170 | - $curImages .= $post_img->src . ','; |
|
| 2170 | + $curImages .= $post_img->src.','; |
|
| 2171 | 2171 | } |
| 2172 | 2172 | } |
| 2173 | 2173 | |
@@ -2175,7 +2175,7 @@ discard block |
||
| 2175 | 2175 | $title = $post->post_title; |
| 2176 | 2176 | $desc = $post->post_content; |
| 2177 | 2177 | $kw_tags = $post->post_tags; |
| 2178 | - $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
|
|
| 2178 | + $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type.'_tags', array('fields' => 'names')));
|
|
| 2179 | 2179 | } else {
|
| 2180 | 2180 | $listing_type = sanitize_text_field($_REQUEST['listing_type']); |
| 2181 | 2181 | } |
@@ -2186,20 +2186,20 @@ discard block |
||
| 2186 | 2186 | |
| 2187 | 2187 | $post_type_info = geodir_get_posttype_info($listing_type); |
| 2188 | 2188 | |
| 2189 | - $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing','geodirectory');
|
|
| 2189 | + $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing', 'geodirectory');
|
|
| 2190 | 2190 | |
| 2191 | 2191 | $package_info = array(); |
| 2192 | 2192 | $package_info = geodir_post_package_info($package_info, $post); |
| 2193 | 2193 | ?> |
| 2194 | - <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data"> |
|
| 2195 | - <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/> |
|
| 2196 | - <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/> |
|
| 2194 | + <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id()); ?>" method="post" enctype="multipart/form-data"> |
|
| 2195 | + <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type); ?>"/> |
|
| 2196 | + <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type); ?>"/> |
|
| 2197 | 2197 | <?php if ($page_id) { ?>
|
| 2198 | - <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id;?>"/> |
|
| 2198 | + <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id; ?>"/> |
|
| 2199 | 2199 | <?php } if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { ?>
|
| 2200 | - <input type="hidden" name="pid" value="<?php echo sanitize_text_field($_REQUEST['pid']);?>"/> |
|
| 2200 | + <input type="hidden" name="pid" value="<?php echo sanitize_text_field($_REQUEST['pid']); ?>"/> |
|
| 2201 | 2201 | <?php } if (isset($_REQUEST['backandedit'])) { ?>
|
| 2202 | - <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/> |
|
| 2202 | + <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']); ?>"/> |
|
| 2203 | 2203 | <?php |
| 2204 | 2204 | } |
| 2205 | 2205 | /** |
@@ -2211,7 +2211,7 @@ discard block |
||
| 2211 | 2211 | */ |
| 2212 | 2212 | do_action('geodir_before_detail_fields');
|
| 2213 | 2213 | ?> |
| 2214 | - <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5> |
|
| 2214 | + <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT; ?></h5> |
|
| 2215 | 2215 | <?php |
| 2216 | 2216 | /** |
| 2217 | 2217 | * Called at the top of the add listing page form for frontend. |
@@ -2232,10 +2232,10 @@ discard block |
||
| 2232 | 2232 | * @param string $cpt_singular_name The singular title of the curent CPT. |
| 2233 | 2233 | * @param string $listing_type The CPT being requested. ie: gd_place. |
| 2234 | 2234 | */ |
| 2235 | - echo apply_filters('geodir_add_listing_title_label', sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span>*</span> </label>
|
|
| 2235 | + echo apply_filters('geodir_add_listing_title_label', sprintf(__('%s Title', 'geodirectory'), $cpt_singular_name), $cpt_singular_name, $listing_type); ?><span>*</span> </label>
|
|
| 2236 | 2236 | <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield" |
| 2237 | 2237 | value="<?php echo esc_attr(stripslashes($title)); ?>"/> |
| 2238 | - <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span> |
|
| 2238 | + <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
|
| 2239 | 2239 | </div> |
| 2240 | 2240 | <?php |
| 2241 | 2241 | $show_editor = get_option('geodir_tiny_editor_on_add_listing');
|
@@ -2281,7 +2281,7 @@ discard block |
||
| 2281 | 2281 | $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
|
| 2282 | 2282 | |
| 2283 | 2283 | $desc_class = ''; |
| 2284 | - if ($desc_limit === '' || (int)$desc_limit > 0) {
|
|
| 2284 | + if ($desc_limit === '' || (int) $desc_limit > 0) {
|
|
| 2285 | 2285 | /** |
| 2286 | 2286 | * Called on the add listing page form for frontend just before the description field. |
| 2287 | 2287 | * |
@@ -2294,7 +2294,7 @@ discard block |
||
| 2294 | 2294 | $desc_class = ' hidden'; |
| 2295 | 2295 | } |
| 2296 | 2296 | ?> |
| 2297 | - <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>"> |
|
| 2297 | + <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class; ?>"> |
|
| 2298 | 2298 | <label><?php |
| 2299 | 2299 | /** |
| 2300 | 2300 | * Filter the add listing page description input label. |
@@ -2304,7 +2304,7 @@ discard block |
||
| 2304 | 2304 | * @param string $cpt_singular_name The singular title of the curent CPT. |
| 2305 | 2305 | * @param string $listing_type The CPT being requested. ie: gd_place. |
| 2306 | 2306 | */ |
| 2307 | - echo apply_filters('geodir_add_listing_description_label',sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
|
|
| 2307 | + echo apply_filters('geodir_add_listing_description_label', sprintf(__('%s Description', 'geodirectory'), $cpt_singular_name), $cpt_singular_name, $listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
|
|
| 2308 | 2308 | <?php |
| 2309 | 2309 | if ($show_editor) {
|
| 2310 | 2310 | $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
|
@@ -2313,16 +2313,16 @@ discard block |
||
| 2313 | 2313 | <?php wp_editor($desc, "post_desc", $editor_settings); ?> |
| 2314 | 2314 | </div> |
| 2315 | 2315 | <?php if ($desc_limit != '') { ?>
|
| 2316 | - <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit;?>");</script>
|
|
| 2316 | + <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit; ?>");</script>
|
|
| 2317 | 2317 | <?php } } else { ?>
|
| 2318 | 2318 | <textarea field_type="textarea" name="post_desc" id="post_desc" class="geodir_textarea" maxlength="<?php echo $desc_limit; ?>"><?php echo $desc; ?></textarea> |
| 2319 | 2319 | <?php } if ($desc_limit_msg != '') { ?>
|
| 2320 | 2320 | <span class="geodir_message_note"><?php echo $desc_limit_msg; ?></span> |
| 2321 | 2321 | <?php } ?> |
| 2322 | - <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span> |
|
| 2322 | + <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory'); ?></span> |
|
| 2323 | 2323 | </div> |
| 2324 | 2324 | <?php |
| 2325 | - if ($desc_limit === '' || (int)$desc_limit > 0) {
|
|
| 2325 | + if ($desc_limit === '' || (int) $desc_limit > 0) {
|
|
| 2326 | 2326 | /** |
| 2327 | 2327 | * Called on the add listing page form for frontend just after the description field. |
| 2328 | 2328 | * |
@@ -2361,7 +2361,7 @@ discard block |
||
| 2361 | 2361 | $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
|
| 2362 | 2362 | |
| 2363 | 2363 | $tags_class = ''; |
| 2364 | - if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
|
|
| 2364 | + if ($kw_tags_count === '' || (int) $kw_tags_count > 0) {
|
|
| 2365 | 2365 | /** |
| 2366 | 2366 | * Called on the add listing page form for frontend just before the tags field. |
| 2367 | 2367 | * |
@@ -2372,14 +2372,14 @@ discard block |
||
| 2372 | 2372 | $tags_class = ' hidden'; |
| 2373 | 2373 | } |
| 2374 | 2374 | ?> |
| 2375 | - <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>"> |
|
| 2375 | + <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class; ?>"> |
|
| 2376 | 2376 | <label><?php echo TAGKW_TEXT; ?></label> |
| 2377 | 2377 | <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield" |
| 2378 | - maxlength="<?php echo $kw_tags_count;?>"/> |
|
| 2379 | - <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span> |
|
| 2378 | + maxlength="<?php echo $kw_tags_count; ?>"/> |
|
| 2379 | + <span class="geodir_message_note"><?php echo $kw_tags_msg; ?></span> |
|
| 2380 | 2380 | </div> |
| 2381 | 2381 | <?php |
| 2382 | - if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
|
|
| 2382 | + if ($kw_tags_count === '' || (int) $kw_tags_count > 0) {
|
|
| 2383 | 2383 | /** |
| 2384 | 2384 | * Called on the add listing page form for frontend just after the tags field. |
| 2385 | 2385 | * |
@@ -2405,7 +2405,7 @@ discard block |
||
| 2405 | 2405 | $thumb_img_arr = array(); |
| 2406 | 2406 | $totImg = 0; |
| 2407 | 2407 | if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
|
| 2408 | - $post = (object)$gd_session->get('listing');
|
|
| 2408 | + $post = (object) $gd_session->get('listing');
|
|
| 2409 | 2409 | if (isset($post->post_images)) |
| 2410 | 2410 | $curImages = trim($post->post_images, ","); |
| 2411 | 2411 | |
@@ -2418,7 +2418,7 @@ discard block |
||
| 2418 | 2418 | $listing_type = $post->listing_type; |
| 2419 | 2419 | |
| 2420 | 2420 | } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
| 2421 | - $post = geodir_get_post_info((int)$_REQUEST['pid']); |
|
| 2421 | + $post = geodir_get_post_info((int) $_REQUEST['pid']); |
|
| 2422 | 2422 | $listing_type = $post->post_type; |
| 2423 | 2423 | $thumb_img_arr = geodir_get_images($_REQUEST['pid']); |
| 2424 | 2424 | |
@@ -2432,7 +2432,7 @@ discard block |
||
| 2432 | 2432 | //$curImages = $img->src.","; |
| 2433 | 2433 | } |
| 2434 | 2434 | |
| 2435 | - $totImg = count((array)$thumb_img_arr); |
|
| 2435 | + $totImg = count((array) $thumb_img_arr); |
|
| 2436 | 2436 | } |
| 2437 | 2437 | |
| 2438 | 2438 | if ($curImages != '') |
@@ -2453,15 +2453,15 @@ discard block |
||
| 2453 | 2453 | if ($show_image_input_box) {
|
| 2454 | 2454 | ?> |
| 2455 | 2455 | |
| 2456 | - <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?> |
|
| 2456 | + <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT; ?> |
|
| 2457 | 2457 | <?php if ($image_limit == 1) {
|
| 2458 | - echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
|
|
| 2458 | + echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('image with this package', 'geodirectory').')</small>';
|
|
| 2459 | 2459 | } ?> |
| 2460 | 2460 | <?php if ($image_limit > 1) {
|
| 2461 | - echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
|
|
| 2461 | + echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('images with this package', 'geodirectory').')</small>';
|
|
| 2462 | 2462 | } ?> |
| 2463 | 2463 | <?php if ($image_limit == '') {
|
| 2464 | - echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
|
|
| 2464 | + echo '<br /><small>('.__('You can upload unlimited images with this package', 'geodirectory').')</small>';
|
|
| 2465 | 2465 | } ?> |
| 2466 | 2466 | </h5> |
| 2467 | 2467 | |
@@ -2476,11 +2476,11 @@ discard block |
||
| 2476 | 2476 | <div |
| 2477 | 2477 | class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>" |
| 2478 | 2478 | id="<?php echo $id; ?>plupload-upload-ui"> |
| 2479 | - <h4><?php _e('Drop files to upload', 'geodirectory');?></h4><br/>
|
|
| 2479 | + <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4><br/>
|
|
| 2480 | 2480 | <input id="<?php echo $id; ?>plupload-browse-button" type="button" |
| 2481 | 2481 | value="<?php esc_attr_e('Select Files', 'geodirectory'); ?>" class="geodir_button"/>
|
| 2482 | 2482 | <span class="ajaxnonceplu" |
| 2483 | - id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span> |
|
| 2483 | + id="ajaxnonceplu<?php echo wp_create_nonce($id.'pluploadan'); ?>"></span> |
|
| 2484 | 2484 | <?php if ($width && $height): ?> |
| 2485 | 2485 | <span class="plupload-resize"></span> |
| 2486 | 2486 | <span class="plupload-width" id="plupload-width<?php echo $width; ?>"></span> |
@@ -2493,7 +2493,7 @@ discard block |
||
| 2493 | 2493 | id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;"> |
| 2494 | 2494 | </div> |
| 2495 | 2495 | <span |
| 2496 | - id="upload-msg"><?php _e('Please drag & drop the images to rearrange the order', 'geodirectory');?></span>
|
|
| 2496 | + id="upload-msg"><?php _e('Please drag & drop the images to rearrange the order', 'geodirectory'); ?></span>
|
|
| 2497 | 2497 | <span id="<?php echo $id; ?>upload-error" style="display:none"></span> |
| 2498 | 2498 | </div> |
| 2499 | 2499 | |
@@ -2505,7 +2505,7 @@ discard block |
||
| 2505 | 2505 | * |
| 2506 | 2506 | * @since 1.0.0 |
| 2507 | 2507 | */ |
| 2508 | - do_action('geodir_after_main_form_fields');?>
|
|
| 2508 | + do_action('geodir_after_main_form_fields'); ?>
|
|
| 2509 | 2509 | |
| 2510 | 2510 | |
| 2511 | 2511 | <!-- add captcha code --> |
@@ -2516,7 +2516,7 @@ discard block |
||
| 2516 | 2516 | </script> |
| 2517 | 2517 | <noscript> |
| 2518 | 2518 | <div> |
| 2519 | - <label><?php _e('Type 64 into this box', 'geodirectory');?></label>
|
|
| 2519 | + <label><?php _e('Type 64 into this box', 'geodirectory'); ?></label>
|
|
| 2520 | 2520 | <input type="text" id="geodir_spamblocker_top_form" name="geodir_spamblocker" value="" maxlength="10"/> |
| 2521 | 2521 | </div> |
| 2522 | 2522 | </noscript> |
@@ -2526,10 +2526,10 @@ discard block |
||
| 2526 | 2526 | <!-- end captcha code --> |
| 2527 | 2527 | |
| 2528 | 2528 | <div id="geodir-add-listing-submit" class="geodir_form_row clear_both" style="padding:2px;text-align:center;"> |
| 2529 | - <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON;?>" |
|
| 2530 | - class="geodir_button" <?php echo $submit_button;?>/> |
|
| 2529 | + <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON; ?>" |
|
| 2530 | + class="geodir_button" <?php echo $submit_button; ?>/> |
|
| 2531 | 2531 | <span class="geodir_message_note" |
| 2532 | - style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory');?></span>
|
|
| 2532 | + style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory'); ?></span>
|
|
| 2533 | 2533 | </div> |
| 2534 | 2534 | |
| 2535 | 2535 | </form> |
@@ -2591,7 +2591,7 @@ discard block |
||
| 2591 | 2591 | class="<?php |
| 2592 | 2592 | /** This action is documented in geodirectory_template_actions.php */ |
| 2593 | 2593 | echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
|
| 2594 | - <?php dynamic_sidebar('Reg/Login Top Section');?>
|
|
| 2594 | + <?php dynamic_sidebar('Reg/Login Top Section'); ?>
|
|
| 2595 | 2595 | </div><!-- clearfix ends here--> |
| 2596 | 2596 | <?php |
| 2597 | 2597 | } |
@@ -2611,11 +2611,11 @@ discard block |
||
| 2611 | 2611 | |
| 2612 | 2612 | global $user_login; |
| 2613 | 2613 | |
| 2614 | - $is_enable_signup = get_option( 'users_can_register' ); |
|
| 2614 | + $is_enable_signup = get_option('users_can_register');
|
|
| 2615 | 2615 | |
| 2616 | 2616 | ?> |
| 2617 | 2617 | <script type="text/javascript"> |
| 2618 | - <?php if ( $user_login ) { ?>
|
|
| 2618 | + <?php if ($user_login) { ?>
|
|
| 2619 | 2619 | setTimeout(function () {
|
| 2620 | 2620 | try {
|
| 2621 | 2621 | d = document.getElementById('user_pass');
|
@@ -2632,7 +2632,7 @@ discard block |
||
| 2632 | 2632 | <?php } ?> |
| 2633 | 2633 | </script> |
| 2634 | 2634 | <script type="text/javascript"> |
| 2635 | - <?php if ( $user_login ) { ?>
|
|
| 2635 | + <?php if ($user_login) { ?>
|
|
| 2636 | 2636 | setTimeout(function () {
|
| 2637 | 2637 | try {
|
| 2638 | 2638 | d = document.getElementById('user_pass');
|
@@ -2657,7 +2657,7 @@ discard block |
||
| 2657 | 2657 | foreach ($errors as $errorsObj) {
|
| 2658 | 2658 | foreach ($errorsObj as $key => $val) {
|
| 2659 | 2659 | for ($i = 0; $i < count($val); $i++) {
|
| 2660 | - echo "<div class=error_msg_fix>" . $val[$i] . '</div>'; |
|
| 2660 | + echo "<div class=error_msg_fix>".$val[$i].'</div>'; |
|
| 2661 | 2661 | $registration_error_msg = 1; |
| 2662 | 2662 | } |
| 2663 | 2663 | } |
@@ -2674,10 +2674,10 @@ discard block |
||
| 2674 | 2674 | * |
| 2675 | 2675 | * @since 1.0.0 |
| 2676 | 2676 | */ |
| 2677 | - include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?> |
|
| 2677 | + include(geodir_plugin_path()."/geodirectory-templates/login_frm.php"); ?> |
|
| 2678 | 2678 | </div> |
| 2679 | 2679 | |
| 2680 | - <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up' && $is_enable_signup ) { ?>
|
|
| 2680 | + <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up' && $is_enable_signup) { ?>
|
|
| 2681 | 2681 | |
| 2682 | 2682 | <div class="registration_form"> |
| 2683 | 2683 | <?php |
@@ -2686,7 +2686,7 @@ discard block |
||
| 2686 | 2686 | * |
| 2687 | 2687 | * @since 1.0.0 |
| 2688 | 2688 | */ |
| 2689 | - include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?> |
|
| 2689 | + include(geodir_plugin_path()."/geodirectory-templates/reg_frm.php"); ?> |
|
| 2690 | 2690 | </div> |
| 2691 | 2691 | |
| 2692 | 2692 | <?php } else { ?>
|
@@ -2698,10 +2698,10 @@ discard block |
||
| 2698 | 2698 | * |
| 2699 | 2699 | * @since 1.0.0 |
| 2700 | 2700 | */ |
| 2701 | - include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?> |
|
| 2701 | + include(geodir_plugin_path()."/geodirectory-templates/login_frm.php"); ?> |
|
| 2702 | 2702 | </div> |
| 2703 | 2703 | |
| 2704 | - <?php if ( $is_enable_signup ) { ?>
|
|
| 2704 | + <?php if ($is_enable_signup) { ?>
|
|
| 2705 | 2705 | <div class="registration_form_r"> |
| 2706 | 2706 | <?php |
| 2707 | 2707 | /** |
@@ -2709,7 +2709,7 @@ discard block |
||
| 2709 | 2709 | * |
| 2710 | 2710 | * @since 1.0.0 |
| 2711 | 2711 | */ |
| 2712 | - include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?> |
|
| 2712 | + include(geodir_plugin_path()."/geodirectory-templates/reg_frm.php"); ?> |
|
| 2713 | 2713 | </div> |
| 2714 | 2714 | <?php } ?> |
| 2715 | 2715 | |
@@ -2746,12 +2746,12 @@ discard block |
||
| 2746 | 2746 | $gd_post_type = geodir_get_current_posttype(); |
| 2747 | 2747 | $post_type_info = get_post_type_object($gd_post_type); |
| 2748 | 2748 | |
| 2749 | - $add_string_in_title = __('All', 'geodirectory') . ' ';
|
|
| 2749 | + $add_string_in_title = __('All', 'geodirectory').' ';
|
|
| 2750 | 2750 | if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
|
| 2751 | - $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
|
|
| 2751 | + $add_string_in_title = __('My Favorite', 'geodirectory').' ';
|
|
| 2752 | 2752 | } |
| 2753 | 2753 | |
| 2754 | - $list_title = $add_string_in_title . $post_type_info->labels->name; |
|
| 2754 | + $list_title = $add_string_in_title.$post_type_info->labels->name; |
|
| 2755 | 2755 | $single_name = $post_type_info->labels->singular_name; |
| 2756 | 2756 | |
| 2757 | 2757 | $taxonomy = geodir_get_taxonomies($gd_post_type); |
@@ -2759,12 +2759,12 @@ discard block |
||
| 2759 | 2759 | if (!empty($term)) {
|
| 2760 | 2760 | $current_term = get_term_by('slug', $term, $taxonomy[0]);
|
| 2761 | 2761 | if (!empty($current_term)) |
| 2762 | - $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
|
|
| 2762 | + $list_title .= __(' in', 'geodirectory')." '".geodir_ucwords($current_term->name)."'";
|
|
| 2763 | 2763 | } |
| 2764 | 2764 | |
| 2765 | 2765 | |
| 2766 | 2766 | if (is_search()) {
|
| 2767 | - $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
|
|
| 2767 | + $list_title = __('Search', 'geodirectory').' '.__($post_type_info->labels->name, 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
|
|
| 2768 | 2768 | |
| 2769 | 2769 | } |
| 2770 | 2770 | /** This action is documented in geodirectory_template_actions.php */ |
@@ -2773,11 +2773,11 @@ discard block |
||
| 2773 | 2773 | $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
| 2774 | 2774 | |
| 2775 | 2775 | $title = $list_title; |
| 2776 | - if(geodir_is_page('author')){
|
|
| 2776 | + if (geodir_is_page('author')) {
|
|
| 2777 | 2777 | $gd_page = 'author'; |
| 2778 | - if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
|
|
| 2778 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
|
|
| 2779 | 2779 | $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
|
| 2780 | - }else{
|
|
| 2780 | + } else {
|
|
| 2781 | 2781 | $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
|
| 2782 | 2782 | } |
| 2783 | 2783 | |
@@ -2791,16 +2791,16 @@ discard block |
||
| 2791 | 2791 | * @param string $title The page title including variables. |
| 2792 | 2792 | * @param string $gd_page The GeoDirectory page type if any. |
| 2793 | 2793 | */ |
| 2794 | - $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 2794 | + $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
|
|
| 2795 | 2795 | |
| 2796 | - echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . |
|
| 2796 | + echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'. |
|
| 2797 | 2797 | /** |
| 2798 | 2798 | * Filter the author page title text. |
| 2799 | 2799 | * |
| 2800 | 2800 | * @since 1.0.0 |
| 2801 | 2801 | * @param string $list_title The title for the page. |
| 2802 | 2802 | */ |
| 2803 | - apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
|
|
| 2803 | + apply_filters('geodir_author_page_title_text', $title).'</h1></header>';
|
|
| 2804 | 2804 | } |
| 2805 | 2805 | |
| 2806 | 2806 | |
@@ -3005,19 +3005,19 @@ discard block |
||
| 3005 | 3005 | $post_type_info = get_post_type_object($gd_post_type); |
| 3006 | 3006 | |
| 3007 | 3007 | $pt_name = ''; |
| 3008 | - if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
|
|
| 3008 | + if (isset($post_type_info->labels->name)) {$pt_name = $post_type_info->labels->name; }
|
|
| 3009 | 3009 | |
| 3010 | 3010 | if (is_search()) {
|
| 3011 | - $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
|
|
| 3011 | + $list_title = __('Search', 'geodirectory').' '.__($pt_name, 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
|
|
| 3012 | 3012 | |
| 3013 | 3013 | } |
| 3014 | 3014 | /** This action is documented in geodirectory_template_actions.php */ |
| 3015 | 3015 | $class = apply_filters('geodir_page_title_class', 'entry-title fn');
|
| 3016 | 3016 | /** This action is documented in geodirectory_template_actions.php */ |
| 3017 | 3017 | $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
|
| 3018 | - echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . |
|
| 3018 | + echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'. |
|
| 3019 | 3019 | /** This action is documented in geodirectory_template_actions.php */ |
| 3020 | - apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
|
|
| 3020 | + apply_filters('geodir_listing_page_title', wptexturize($list_title)).'</h1></header>';
|
|
| 3021 | 3021 | } |
| 3022 | 3022 | |
| 3023 | 3023 | // action for adding the listings page top widget area |
@@ -3421,7 +3421,7 @@ discard block |
||
| 3421 | 3421 | $gd_post_type = geodir_get_current_posttype(); |
| 3422 | 3422 | $post_type_info = get_post_type_object($gd_post_type); |
| 3423 | 3423 | |
| 3424 | - $list_title = __('Search', 'geodirectory') . ' ' . __(ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
|
|
| 3424 | + $list_title = __('Search', 'geodirectory').' '.__(ucfirst($post_type_info->labels->name), 'geodirectory').__(' :', 'geodirectory');
|
|
| 3425 | 3425 | } |
| 3426 | 3426 | return $list_title; |
| 3427 | 3427 | } |
@@ -3437,7 +3437,7 @@ discard block |
||
| 3437 | 3437 | * @param string $position Position to add the post content. 'before' or 'after'. Default 'before'. |
| 3438 | 3438 | * @param string $gd_page The geodirectory page type. Default null. |
| 3439 | 3439 | */ |
| 3440 | -function geodir_add_page_content( $position = 'before', $gd_page = '' ) {
|
|
| 3440 | +function geodir_add_page_content($position = 'before', $gd_page = '') {
|
|
| 3441 | 3441 | global $post; |
| 3442 | 3442 | |
| 3443 | 3443 | $gd_page_id = NULL; |
@@ -3513,17 +3513,17 @@ discard block |
||
| 3513 | 3513 | * @param WP_Post $post WP_Post object. |
| 3514 | 3514 | * @return string Filtered SQL JOIN clause. |
| 3515 | 3515 | */ |
| 3516 | -function geodir_previous_next_post_join( $join, $in_same_term, $excluded_terms, $taxonomy, $post ) {
|
|
| 3516 | +function geodir_previous_next_post_join($join, $in_same_term, $excluded_terms, $taxonomy, $post) {
|
|
| 3517 | 3517 | global $plugin_prefix; |
| 3518 | 3518 | |
| 3519 | - if ( !empty($post->post_type) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
|
|
| 3520 | - $join .= " INNER JOIN " . $plugin_prefix . $post->post_type . "_detail AS gd ON gd.post_id = p.ID"; |
|
| 3519 | + if (!empty($post->post_type) && in_array($post->post_type, geodir_get_posttypes())) {
|
|
| 3520 | + $join .= " INNER JOIN ".$plugin_prefix.$post->post_type."_detail AS gd ON gd.post_id = p.ID"; |
|
| 3521 | 3521 | } |
| 3522 | 3522 | |
| 3523 | 3523 | return $join; |
| 3524 | 3524 | } |
| 3525 | -add_filter( 'get_previous_post_join', 'geodir_previous_next_post_join', 10, 5 ); |
|
| 3526 | -add_filter( 'get_next_post_join', 'geodir_previous_next_post_join', 10, 5 ); |
|
| 3525 | +add_filter('get_previous_post_join', 'geodir_previous_next_post_join', 10, 5);
|
|
| 3526 | +add_filter('get_next_post_join', 'geodir_previous_next_post_join', 10, 5);
|
|
| 3527 | 3527 | |
| 3528 | 3528 | /** |
| 3529 | 3529 | * Filters the WHERE clause in the SQL for an adjacent post query. |
@@ -3541,32 +3541,32 @@ discard block |
||
| 3541 | 3541 | * @param WP_Post $post WP_Post object. |
| 3542 | 3542 | * @return string Filtered SQL WHERE clause. |
| 3543 | 3543 | */ |
| 3544 | -function geodir_previous_next_post_where( $where, $in_same_term, $excluded_terms, $taxonomy, $post ) {
|
|
| 3544 | +function geodir_previous_next_post_where($where, $in_same_term, $excluded_terms, $taxonomy, $post) {
|
|
| 3545 | 3545 | global $wpdb, $plugin_prefix; |
| 3546 | 3546 | |
| 3547 | - if ( !empty($post->post_type) && ( !empty( $post->country_slug ) || !empty( $post->region_slug ) || !empty( $post->city_slug ) ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
|
|
| 3547 | + if (!empty($post->post_type) && (!empty($post->country_slug) || !empty($post->region_slug) || !empty($post->city_slug)) && in_array($post->post_type, geodir_get_posttypes())) {
|
|
| 3548 | 3548 | $post_locations = ''; |
| 3549 | 3549 | $post_locations_var = array(); |
| 3550 | 3550 | |
| 3551 | - if ( !empty( $post->country_slug ) ) {
|
|
| 3551 | + if (!empty($post->country_slug)) {
|
|
| 3552 | 3552 | $post_locations .= " AND post_locations LIKE %s"; |
| 3553 | - $post_locations_var[] = "%,[" . $post->country_slug . "]"; |
|
| 3553 | + $post_locations_var[] = "%,[".$post->country_slug."]"; |
|
| 3554 | 3554 | } |
| 3555 | 3555 | |
| 3556 | - if ( !empty( $post->region_slug ) ) {
|
|
| 3556 | + if (!empty($post->region_slug)) {
|
|
| 3557 | 3557 | $post_locations .= " AND post_locations LIKE %s"; |
| 3558 | - $post_locations_var[] = "%,[" . $post->region_slug . "],%"; |
|
| 3558 | + $post_locations_var[] = "%,[".$post->region_slug."],%"; |
|
| 3559 | 3559 | } |
| 3560 | 3560 | |
| 3561 | - if ( !empty( $post->city_slug ) ) {
|
|
| 3561 | + if (!empty($post->city_slug)) {
|
|
| 3562 | 3562 | $post_locations .= " AND post_locations LIKE %s"; |
| 3563 | - $post_locations_var[] = "[" . $post->city_slug . "],%"; |
|
| 3563 | + $post_locations_var[] = "[".$post->city_slug."],%"; |
|
| 3564 | 3564 | } |
| 3565 | 3565 | |
| 3566 | - $where .= $wpdb->prepare( $post_locations, $post_locations_var ); |
|
| 3566 | + $where .= $wpdb->prepare($post_locations, $post_locations_var); |
|
| 3567 | 3567 | } |
| 3568 | 3568 | |
| 3569 | 3569 | return $where; |
| 3570 | 3570 | } |
| 3571 | -add_filter( 'get_previous_post_where', 'geodir_previous_next_post_where', 10, 5 ); |
|
| 3572 | -add_filter( 'get_next_post_where', 'geodir_previous_next_post_where', 10, 5 ); |
|
| 3573 | 3571 | \ No newline at end of file |
| 3572 | +add_filter('get_previous_post_where', 'geodir_previous_next_post_where', 10, 5);
|
|
| 3573 | +add_filter('get_next_post_where', 'geodir_previous_next_post_where', 10, 5); |
|
| 3574 | 3574 | \ No newline at end of file |
@@ -16,7 +16,9 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | function geodir_session_start() |
| 18 | 18 | {
|
| 19 | - if (!session_id()) session_start(); |
|
| 19 | + if (!session_id()) { |
|
| 20 | + session_start(); |
|
| 21 | + } |
|
| 20 | 22 | global $geodir_add_location_url; |
| 21 | 23 | |
| 22 | 24 | $geodir_add_location_url = NULL; |
@@ -86,7 +88,9 @@ discard block |
||
| 86 | 88 | |
| 87 | 89 | if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')): |
| 88 | 90 | |
| 89 | - if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = ''; |
|
| 91 | + if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') { |
|
| 92 | + $_REQUEST['scat'] = ''; |
|
| 93 | + } |
|
| 90 | 94 | //if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = ''; |
| 91 | 95 | |
| 92 | 96 | if (isset($_REQUEST['sdist'])) {
|
@@ -198,8 +202,9 @@ discard block |
||
| 198 | 202 | add_filter('posts_fields', 'geodir_posts_fields', 1);
|
| 199 | 203 | add_filter('posts_join', 'geodir_posts_join', 1);
|
| 200 | 204 | geodir_post_where(); |
| 201 | - if (!is_admin()) |
|
| 202 | - add_filter('posts_orderby', 'geodir_posts_orderby', 1);
|
|
| 205 | + if (!is_admin()) { |
|
| 206 | + add_filter('posts_orderby', 'geodir_posts_orderby', 1); |
|
| 207 | + } |
|
| 203 | 208 | |
| 204 | 209 | // advanced filter for popular post view widget |
| 205 | 210 | global $wp_query; |
@@ -349,8 +354,9 @@ discard block |
||
| 349 | 354 | $sort_by = ''; |
| 350 | 355 | $orderby = ' '; |
| 351 | 356 | |
| 352 | - if (get_query_var('order_by'))
|
|
| 353 | - $sort_by = get_query_var('order_by');
|
|
| 357 | + if (get_query_var('order_by')) { |
|
| 358 | + $sort_by = get_query_var('order_by'); |
|
| 359 | + } |
|
| 354 | 360 | |
| 355 | 361 | /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
|
| 356 | 362 | $current_term = $wp_query->get_queried_object(); |
@@ -370,14 +376,16 @@ discard block |
||
| 370 | 376 | $orderby .= " distance,"; |
| 371 | 377 | } |
| 372 | 378 | |
| 373 | - if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) |
|
| 374 | - $sort_by = esc_attr($_REQUEST['sort_by']); |
|
| 379 | + if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) { |
|
| 380 | + $sort_by = esc_attr($_REQUEST['sort_by']); |
|
| 381 | + } |
|
| 375 | 382 | |
| 376 | 383 | |
| 377 | 384 | if ($sort_by == '') {
|
| 378 | 385 | $default_sort = geodir_get_posts_default_sort($geodir_post_type); |
| 379 | - if (!empty($default_sort)) |
|
| 380 | - $sort_by = $default_sort; |
|
| 386 | + if (!empty($default_sort)) { |
|
| 387 | + $sort_by = $default_sort; |
|
| 388 | + } |
|
| 381 | 389 | } |
| 382 | 390 | |
| 383 | 391 | /* |
@@ -572,8 +580,9 @@ discard block |
||
| 572 | 580 | |
| 573 | 581 | add_filter('posts_where', 'searching_filter_where', 1);
|
| 574 | 582 | |
| 575 | - if ($snear != '') |
|
| 576 | - add_filter('posts_where', 'searching_filter_where', 1);
|
|
| 583 | + if ($snear != '') { |
|
| 584 | + add_filter('posts_where', 'searching_filter_where', 1); |
|
| 585 | + } |
|
| 577 | 586 | |
| 578 | 587 | add_filter('posts_orderby', 'geodir_posts_orderby', 1);
|
| 579 | 588 | |
@@ -727,10 +736,11 @@ discard block |
||
| 727 | 736 | |
| 728 | 737 | $where = ''; |
| 729 | 738 | $better_search_terms = ''; |
| 730 | - if (isset($_REQUEST['stype'])) |
|
| 731 | - $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
| 732 | - else |
|
| 733 | - $post_types = 'gd_place'; |
|
| 739 | + if (isset($_REQUEST['stype'])) { |
|
| 740 | + $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
| 741 | + } else { |
|
| 742 | + $post_types = 'gd_place'; |
|
| 743 | + } |
|
| 734 | 744 | |
| 735 | 745 | if ($s != '') {
|
| 736 | 746 | $keywords = explode(" ", $s);
|
@@ -767,7 +777,7 @@ discard block |
||
| 767 | 777 | if($taxonomies) {
|
| 768 | 778 | $taxonomies = implode("','", $taxonomies);
|
| 769 | 779 | $taxonomies = "'" . $taxonomies . "'"; |
| 770 | - }else{$taxonomies='';}
|
|
| 780 | + } else{$taxonomies='';}
|
|
| 771 | 781 | |
| 772 | 782 | $content_where = $terms_where = ''; |
| 773 | 783 | if ($s != '') {
|
@@ -887,8 +897,9 @@ discard block |
||
| 887 | 897 | $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
| 888 | 898 | $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
|
| 889 | 899 | $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
|
| 890 | - } else |
|
| 891 | - $where .= " AND $wpdb->posts.post_author = $user_id"; |
|
| 900 | + } else { |
|
| 901 | + $where .= " AND $wpdb->posts.post_author = $user_id"; |
|
| 902 | + } |
|
| 892 | 903 | |
| 893 | 904 | if ($user_id == (int)get_current_user_id()) {
|
| 894 | 905 | $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
|
@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | function geodir_session_start() |
| 18 | 18 | {
|
| 19 | - if (!session_id()) session_start(); |
|
| 20 | - global $geodir_add_location_url; |
|
| 19 | + if (!session_id()) session_start(); |
|
| 20 | + global $geodir_add_location_url; |
|
| 21 | 21 | |
| 22 | - $geodir_add_location_url = NULL; |
|
| 22 | + $geodir_add_location_url = NULL; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -33,18 +33,18 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | function geodir_modified_query($query) |
| 35 | 35 | {
|
| 36 | - if ($query->is_main_query() && ( |
|
| 37 | - (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
|
|
| 38 | - || geodir_is_page('listing')
|
|
| 39 | - || geodir_is_page('author')
|
|
| 40 | - || geodir_is_page('search')
|
|
| 41 | - || geodir_is_page('detail'))
|
|
| 42 | - ) {
|
|
| 43 | - |
|
| 44 | - $query->set('is_geodir_loop', true);
|
|
| 45 | - } |
|
| 36 | + if ($query->is_main_query() && ( |
|
| 37 | + (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
|
|
| 38 | + || geodir_is_page('listing')
|
|
| 39 | + || geodir_is_page('author')
|
|
| 40 | + || geodir_is_page('search')
|
|
| 41 | + || geodir_is_page('detail'))
|
|
| 42 | + ) {
|
|
| 43 | + |
|
| 44 | + $query->set('is_geodir_loop', true);
|
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - return $query; |
|
| 47 | + return $query; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -67,81 +67,81 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | function set_listing_request($query ) |
| 69 | 69 | {
|
| 70 | - global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA; |
|
| 70 | + global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA; |
|
| 71 | 71 | |
| 72 | 72 | |
| 73 | - // fix woocommerce shop products filtered by language for GD + WPML + Woocommerce |
|
| 74 | - if (!geodir_is_geodir_page()) {
|
|
| 75 | - return; |
|
| 76 | - } |
|
| 73 | + // fix woocommerce shop products filtered by language for GD + WPML + Woocommerce |
|
| 74 | + if (!geodir_is_geodir_page()) {
|
|
| 75 | + return; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - /* remove all pre filters */ |
|
| 79 | - remove_all_filters('query');
|
|
| 80 | - remove_all_filters('posts_search');
|
|
| 81 | - remove_all_filters('posts_fields');
|
|
| 82 | - remove_all_filters('posts_join');
|
|
| 83 | - remove_all_filters('posts_orderby');
|
|
| 84 | - remove_all_filters('posts_where');
|
|
| 78 | + /* remove all pre filters */ |
|
| 79 | + remove_all_filters('query');
|
|
| 80 | + remove_all_filters('posts_search');
|
|
| 81 | + remove_all_filters('posts_fields');
|
|
| 82 | + remove_all_filters('posts_join');
|
|
| 83 | + remove_all_filters('posts_orderby');
|
|
| 84 | + remove_all_filters('posts_where');
|
|
| 85 | 85 | |
| 86 | 86 | |
| 87 | - if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')): |
|
| 87 | + if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')): |
|
| 88 | 88 | |
| 89 | - if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = ''; |
|
| 90 | - //if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = ''; |
|
| 89 | + if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = ''; |
|
| 90 | + //if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = ''; |
|
| 91 | 91 | |
| 92 | - if (isset($_REQUEST['sdist'])) {
|
|
| 93 | - ($_REQUEST['sdist'] != '0' && $_REQUEST['sdist'] != '') ? $dist = esc_attr($_REQUEST['sdist']) : $dist = 25000; |
|
| 94 | - } elseif (get_option('geodir_search_dist') != '') {
|
|
| 95 | - $dist = get_option('geodir_search_dist');
|
|
| 92 | + if (isset($_REQUEST['sdist'])) {
|
|
| 93 | + ($_REQUEST['sdist'] != '0' && $_REQUEST['sdist'] != '') ? $dist = esc_attr($_REQUEST['sdist']) : $dist = 25000; |
|
| 94 | + } elseif (get_option('geodir_search_dist') != '') {
|
|
| 95 | + $dist = get_option('geodir_search_dist');
|
|
| 96 | 96 | |
| 97 | - } else {
|
|
| 98 | - $dist = 25000; |
|
| 99 | - } // Distance |
|
| 97 | + } else {
|
|
| 98 | + $dist = 25000; |
|
| 99 | + } // Distance |
|
| 100 | 100 | |
| 101 | - if (isset($_REQUEST['sgeo_lat'])) {
|
|
| 102 | - $mylat = (float)esc_attr($_REQUEST['sgeo_lat']); |
|
| 103 | - } else {
|
|
| 104 | - $mylat = (float)geodir_get_current_city_lat(); |
|
| 105 | - } // Latatude |
|
| 101 | + if (isset($_REQUEST['sgeo_lat'])) {
|
|
| 102 | + $mylat = (float)esc_attr($_REQUEST['sgeo_lat']); |
|
| 103 | + } else {
|
|
| 104 | + $mylat = (float)geodir_get_current_city_lat(); |
|
| 105 | + } // Latatude |
|
| 106 | 106 | |
| 107 | - if (isset($_REQUEST['sgeo_lon'])) {
|
|
| 108 | - $mylon = (float)esc_attr($_REQUEST['sgeo_lon']); |
|
| 109 | - } else {
|
|
| 110 | - $mylon = (float)geodir_get_current_city_lng(); |
|
| 111 | - } // Distance |
|
| 107 | + if (isset($_REQUEST['sgeo_lon'])) {
|
|
| 108 | + $mylon = (float)esc_attr($_REQUEST['sgeo_lon']); |
|
| 109 | + } else {
|
|
| 110 | + $mylon = (float)geodir_get_current_city_lng(); |
|
| 111 | + } // Distance |
|
| 112 | 112 | |
| 113 | - if (isset($_REQUEST['snear'])) {
|
|
| 114 | - $snear = trim(esc_attr($_REQUEST['snear'])); |
|
| 115 | - } |
|
| 113 | + if (isset($_REQUEST['snear'])) {
|
|
| 114 | + $snear = trim(esc_attr($_REQUEST['snear'])); |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - if (isset($_REQUEST['s'])) {
|
|
| 118 | - $s = trim(esc_attr(wp_strip_all_tags($_REQUEST['s']))); |
|
| 119 | - } |
|
| 117 | + if (isset($_REQUEST['s'])) {
|
|
| 118 | + $s = trim(esc_attr(wp_strip_all_tags($_REQUEST['s']))); |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - if ($snear == 'NEAR ME') {
|
|
| 122 | - $ip = $_SERVER['REMOTE_ADDR']; |
|
| 123 | - $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip));
|
|
| 124 | - $mylat = stripslashes(ucfirst($addr_details[geoplugin_latitude])); |
|
| 125 | - $mylon = stripslashes(ucfirst($addr_details[geoplugin_longitude])); |
|
| 126 | - } |
|
| 121 | + if ($snear == 'NEAR ME') {
|
|
| 122 | + $ip = $_SERVER['REMOTE_ADDR']; |
|
| 123 | + $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip));
|
|
| 124 | + $mylat = stripslashes(ucfirst($addr_details[geoplugin_latitude])); |
|
| 125 | + $mylon = stripslashes(ucfirst($addr_details[geoplugin_longitude])); |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | 128 | |
| 129 | - if (strstr($s, ',')) {
|
|
| 130 | - $s_AA = str_replace(" ", "", $s);
|
|
| 131 | - $s_A = explode(",", $s_AA);
|
|
| 132 | - $s_A = implode('","', $s_A);
|
|
| 133 | - $s_A = '"' . $s_A . '"'; |
|
| 134 | - } else {
|
|
| 135 | - $s_A = '"' . $s . '"'; |
|
| 136 | - } |
|
| 129 | + if (strstr($s, ',')) {
|
|
| 130 | + $s_AA = str_replace(" ", "", $s);
|
|
| 131 | + $s_A = explode(",", $s_AA);
|
|
| 132 | + $s_A = implode('","', $s_A);
|
|
| 133 | + $s_A = '"' . $s_A . '"'; |
|
| 134 | + } else {
|
|
| 135 | + $s_A = '"' . $s . '"'; |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | - if (strstr($s, ' ')) {
|
|
| 139 | - $s_SA = explode(" ", $s);
|
|
| 140 | - } else {
|
|
| 141 | - $s_SA = ''; |
|
| 142 | - } |
|
| 138 | + if (strstr($s, ' ')) {
|
|
| 139 | + $s_SA = explode(" ", $s);
|
|
| 140 | + } else {
|
|
| 141 | + $s_SA = ''; |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | - endif; |
|
| 144 | + endif; |
|
| 145 | 145 | |
| 146 | 146 | |
| 147 | 147 | |
@@ -162,56 +162,56 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | function geodir_listing_loop_filter($query) |
| 164 | 164 | {
|
| 165 | - global $wp_query, $geodir_post_type, $table, $plugin_prefix, $table, $term; |
|
| 165 | + global $wp_query, $geodir_post_type, $table, $plugin_prefix, $table, $term; |
|
| 166 | 166 | |
| 167 | - // fix wp_reset_query for popular post view widget |
|
| 168 | - if (!geodir_is_geodir_page()) {
|
|
| 169 | - return; |
|
| 170 | - } |
|
| 167 | + // fix wp_reset_query for popular post view widget |
|
| 168 | + if (!geodir_is_geodir_page()) {
|
|
| 169 | + return; |
|
| 170 | + } |
|
| 171 | 171 | |
| 172 | - $geodir_post_type = geodir_get_current_posttype(); |
|
| 173 | - |
|
| 174 | - if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) {
|
|
| 175 | - $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy'); |
|
| 176 | - |
|
| 177 | - if (isset($wp_query->query[$taxonomies[0]])) {
|
|
| 178 | - $request_term = explode("/", $wp_query->query[$taxonomies[0]]);
|
|
| 179 | - $request_term = end($request_term); |
|
| 180 | - if (!term_exists($request_term)) {
|
|
| 181 | - $args = array('number' => '1',);
|
|
| 182 | - $terms_arr = get_terms($taxonomies[0], $args); |
|
| 183 | - foreach ($terms_arr as $location_term) {
|
|
| 184 | - $term_arr = $location_term; |
|
| 185 | - $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term));
|
|
| 186 | - } |
|
| 187 | - $wp_query->queried_object_id = 1; |
|
| 188 | - $wp_query->queried_object = $term_arr; |
|
| 189 | - //print_r($wp_query) ; |
|
| 190 | - } |
|
| 191 | - } |
|
| 172 | + $geodir_post_type = geodir_get_current_posttype(); |
|
| 173 | + |
|
| 174 | + if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) {
|
|
| 175 | + $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy'); |
|
| 176 | + |
|
| 177 | + if (isset($wp_query->query[$taxonomies[0]])) {
|
|
| 178 | + $request_term = explode("/", $wp_query->query[$taxonomies[0]]);
|
|
| 179 | + $request_term = end($request_term); |
|
| 180 | + if (!term_exists($request_term)) {
|
|
| 181 | + $args = array('number' => '1',);
|
|
| 182 | + $terms_arr = get_terms($taxonomies[0], $args); |
|
| 183 | + foreach ($terms_arr as $location_term) {
|
|
| 184 | + $term_arr = $location_term; |
|
| 185 | + $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term));
|
|
| 186 | + } |
|
| 187 | + $wp_query->queried_object_id = 1; |
|
| 188 | + $wp_query->queried_object = $term_arr; |
|
| 189 | + //print_r($wp_query) ; |
|
| 190 | + } |
|
| 191 | + } |
|
| 192 | 192 | |
| 193 | - } |
|
| 194 | - if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
|
|
| 195 | - |
|
| 196 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 197 | - |
|
| 198 | - add_filter('posts_fields', 'geodir_posts_fields', 1);
|
|
| 199 | - add_filter('posts_join', 'geodir_posts_join', 1);
|
|
| 200 | - geodir_post_where(); |
|
| 201 | - if (!is_admin()) |
|
| 202 | - add_filter('posts_orderby', 'geodir_posts_orderby', 1);
|
|
| 203 | - |
|
| 204 | - // advanced filter for popular post view widget |
|
| 205 | - global $wp_query; |
|
| 206 | - if (!is_admin()) {
|
|
| 207 | - if (!empty($wp_query->query['with_pics_only'])) {
|
|
| 208 | - add_filter('posts_join', 'geodir_filter_widget_join', 1000);
|
|
| 209 | - } |
|
| 210 | - add_filter('posts_where', 'geodir_filter_widget_where', 1000);
|
|
| 211 | - } |
|
| 193 | + } |
|
| 194 | + if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
|
|
| 212 | 195 | |
| 213 | - } |
|
| 214 | - return $query; |
|
| 196 | + $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 197 | + |
|
| 198 | + add_filter('posts_fields', 'geodir_posts_fields', 1);
|
|
| 199 | + add_filter('posts_join', 'geodir_posts_join', 1);
|
|
| 200 | + geodir_post_where(); |
|
| 201 | + if (!is_admin()) |
|
| 202 | + add_filter('posts_orderby', 'geodir_posts_orderby', 1);
|
|
| 203 | + |
|
| 204 | + // advanced filter for popular post view widget |
|
| 205 | + global $wp_query; |
|
| 206 | + if (!is_admin()) {
|
|
| 207 | + if (!empty($wp_query->query['with_pics_only'])) {
|
|
| 208 | + add_filter('posts_join', 'geodir_filter_widget_join', 1000);
|
|
| 209 | + } |
|
| 210 | + add_filter('posts_where', 'geodir_filter_widget_where', 1000);
|
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + } |
|
| 214 | + return $query; |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | |
@@ -230,67 +230,67 @@ discard block |
||
| 230 | 230 | * @return string Modified fields query string. |
| 231 | 231 | */ |
| 232 | 232 | function geodir_posts_fields($fields) {
|
| 233 | - global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session; |
|
| 233 | + global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session; |
|
| 234 | 234 | |
| 235 | - // Filter-Location-Manager to add location table. |
|
| 236 | - $fields .= ", " . $table . ".* "; |
|
| 235 | + // Filter-Location-Manager to add location table. |
|
| 236 | + $fields .= ", " . $table . ".* "; |
|
| 237 | 237 | |
| 238 | 238 | if ($snear != '' || $gd_session->get('all_near_me')) {
|
| 239 | - $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
|
| 239 | + $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
|
| 240 | 240 | |
| 241 | 241 | if ($gd_session->get('all_near_me')) {
|
| 242 | - $mylat = $gd_session->get('user_lat');
|
|
| 243 | - $mylon = $gd_session->get('user_lon');
|
|
| 244 | - } |
|
| 245 | - |
|
| 246 | - $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 247 | - } |
|
| 248 | - |
|
| 249 | - global $s; |
|
| 250 | - if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
|
|
| 251 | - $keywords = explode(" ", $s);
|
|
| 252 | - |
|
| 253 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 254 | - foreach($keywords as $kkey=>$kword){
|
|
| 255 | - if(mb_strlen($kword, 'UTF-8')<=$klimit){
|
|
| 256 | - unset($keywords[$kkey]); |
|
| 257 | - } |
|
| 258 | - } |
|
| 259 | - } |
|
| 242 | + $mylat = $gd_session->get('user_lat');
|
|
| 243 | + $mylon = $gd_session->get('user_lon');
|
|
| 244 | + } |
|
| 260 | 245 | |
| 246 | + $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 247 | + } |
|
| 261 | 248 | |
| 262 | - if (count($keywords) > 1) {
|
|
| 263 | - $parts = array( |
|
| 264 | - 'AND' => 'gd_alltitlematch_part', |
|
| 265 | - 'OR' => 'gd_titlematch_part' |
|
| 266 | - ); |
|
| 267 | - $gd_titlematch_part = ""; |
|
| 268 | - foreach ($parts as $key => $part) {
|
|
| 269 | - $gd_titlematch_part .= " CASE WHEN "; |
|
| 270 | - $count = 0; |
|
| 271 | - foreach ($keywords as $keyword) {
|
|
| 272 | - $keyword = trim($keyword); |
|
| 273 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
| 249 | + global $s; |
|
| 250 | + if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
|
|
| 251 | + $keywords = explode(" ", $s);
|
|
| 252 | + |
|
| 253 | + if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 254 | + foreach($keywords as $kkey=>$kword){
|
|
| 255 | + if(mb_strlen($kword, 'UTF-8')<=$klimit){
|
|
| 256 | + unset($keywords[$kkey]); |
|
| 257 | + } |
|
| 258 | + } |
|
| 259 | + } |
|
| 260 | + |
|
| 261 | + |
|
| 262 | + if (count($keywords) > 1) {
|
|
| 263 | + $parts = array( |
|
| 264 | + 'AND' => 'gd_alltitlematch_part', |
|
| 265 | + 'OR' => 'gd_titlematch_part' |
|
| 266 | + ); |
|
| 267 | + $gd_titlematch_part = ""; |
|
| 268 | + foreach ($parts as $key => $part) {
|
|
| 269 | + $gd_titlematch_part .= " CASE WHEN "; |
|
| 270 | + $count = 0; |
|
| 271 | + foreach ($keywords as $keyword) {
|
|
| 272 | + $keyword = trim($keyword); |
|
| 273 | + $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
| 274 | 274 | $count++; |
| 275 | - if ($count < count($keywords)) {
|
|
| 276 | - // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " "; |
|
| 275 | + if ($count < count($keywords)) {
|
|
| 276 | + // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " "; |
|
| 277 | 277 | $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) " . $key . " "; |
| 278 | - } else {
|
|
| 279 | - //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' "; |
|
| 278 | + } else {
|
|
| 279 | + //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' "; |
|
| 280 | 280 | $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) "; |
| 281 | - } |
|
| 282 | - } |
|
| 283 | - $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ","; |
|
| 284 | - } |
|
| 285 | - } else {
|
|
| 286 | - $gd_titlematch_part = ""; |
|
| 287 | - } |
|
| 288 | - $s = stripslashes_deep( $s ); |
|
| 289 | - $s = wp_specialchars_decode($s,ENT_QUOTES); |
|
| 281 | + } |
|
| 282 | + } |
|
| 283 | + $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ","; |
|
| 284 | + } |
|
| 285 | + } else {
|
|
| 286 | + $gd_titlematch_part = ""; |
|
| 287 | + } |
|
| 288 | + $s = stripslashes_deep( $s ); |
|
| 289 | + $s = wp_specialchars_decode($s,ENT_QUOTES); |
|
| 290 | 290 | $fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN ( " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s . '%', '% ' . $s . '%', $s, $s . ' %', '% ' . $s . ' %', '% ' . $s));
|
| 291 | - } |
|
| 291 | + } |
|
| 292 | 292 | |
| 293 | - return $fields; |
|
| 293 | + return $fields; |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | |
@@ -307,26 +307,26 @@ discard block |
||
| 307 | 307 | */ |
| 308 | 308 | function geodir_posts_join($join) |
| 309 | 309 | {
|
| 310 | - global $wpdb, $geodir_post_type, $table, $table_prefix, $plugin_prefix; |
|
| 310 | + global $wpdb, $geodir_post_type, $table, $table_prefix, $plugin_prefix; |
|
| 311 | 311 | |
| 312 | - ########### WPML ########### |
|
| 312 | + ########### WPML ########### |
|
| 313 | 313 | |
| 314 | - if (function_exists('icl_object_id')) {
|
|
| 315 | - global $sitepress; |
|
| 316 | - $lang_code = ICL_LANGUAGE_CODE; |
|
| 317 | - $default_lang_code = $sitepress->get_default_language(); |
|
| 318 | - if ($lang_code) {
|
|
| 319 | - $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID"; |
|
| 320 | - } |
|
| 314 | + if (function_exists('icl_object_id')) {
|
|
| 315 | + global $sitepress; |
|
| 316 | + $lang_code = ICL_LANGUAGE_CODE; |
|
| 317 | + $default_lang_code = $sitepress->get_default_language(); |
|
| 318 | + if ($lang_code) {
|
|
| 319 | + $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID"; |
|
| 320 | + } |
|
| 321 | 321 | |
| 322 | - } |
|
| 323 | - ########### WPML ########### |
|
| 322 | + } |
|
| 323 | + ########### WPML ########### |
|
| 324 | 324 | |
| 325 | - $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID) ";
|
|
| 326 | - //===old code start |
|
| 327 | - //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id) " ;//===old code end
|
|
| 325 | + $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID) ";
|
|
| 326 | + //===old code start |
|
| 327 | + //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id) " ;//===old code end
|
|
| 328 | 328 | |
| 329 | - return $join; |
|
| 329 | + return $join; |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | |
@@ -344,15 +344,15 @@ discard block |
||
| 344 | 344 | */ |
| 345 | 345 | function geodir_posts_orderby($orderby) |
| 346 | 346 | {
|
| 347 | - global $wpdb, $wp_query, $geodir_post_type, $table, $plugin_prefix, $snear, $default_sort; |
|
| 347 | + global $wpdb, $wp_query, $geodir_post_type, $table, $plugin_prefix, $snear, $default_sort; |
|
| 348 | 348 | |
| 349 | - $sort_by = ''; |
|
| 350 | - $orderby = ' '; |
|
| 349 | + $sort_by = ''; |
|
| 350 | + $orderby = ' '; |
|
| 351 | 351 | |
| 352 | - if (get_query_var('order_by'))
|
|
| 353 | - $sort_by = get_query_var('order_by');
|
|
| 352 | + if (get_query_var('order_by'))
|
|
| 353 | + $sort_by = get_query_var('order_by');
|
|
| 354 | 354 | |
| 355 | - /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
|
|
| 355 | + /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
|
|
| 356 | 356 | $current_term = $wp_query->get_queried_object(); |
| 357 | 357 | } |
| 358 | 358 | |
@@ -366,133 +366,133 @@ discard block |
||
| 366 | 366 | }*/ |
| 367 | 367 | |
| 368 | 368 | |
| 369 | - if ($snear != '') {
|
|
| 370 | - $orderby .= " distance,"; |
|
| 371 | - } |
|
| 369 | + if ($snear != '') {
|
|
| 370 | + $orderby .= " distance,"; |
|
| 371 | + } |
|
| 372 | 372 | |
| 373 | - if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) |
|
| 374 | - $sort_by = esc_attr($_REQUEST['sort_by']); |
|
| 373 | + if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) |
|
| 374 | + $sort_by = esc_attr($_REQUEST['sort_by']); |
|
| 375 | 375 | |
| 376 | 376 | |
| 377 | - if ($sort_by == '') {
|
|
| 378 | - $default_sort = geodir_get_posts_default_sort($geodir_post_type); |
|
| 379 | - if (!empty($default_sort)) |
|
| 380 | - $sort_by = $default_sort; |
|
| 381 | - } |
|
| 377 | + if ($sort_by == '') {
|
|
| 378 | + $default_sort = geodir_get_posts_default_sort($geodir_post_type); |
|
| 379 | + if (!empty($default_sort)) |
|
| 380 | + $sort_by = $default_sort; |
|
| 381 | + } |
|
| 382 | 382 | |
| 383 | - /* |
|
| 383 | + /* |
|
| 384 | 384 | if search by term & no location then order always "relevance" |
| 385 | 385 | if search by location then order always "nearest" |
| 386 | 386 | */ |
| 387 | - if (is_main_query() && geodir_is_page('search')) {
|
|
| 388 | - $search_term = get_query_var('s');
|
|
| 387 | + if (is_main_query() && geodir_is_page('search')) {
|
|
| 388 | + $search_term = get_query_var('s');
|
|
| 389 | 389 | |
| 390 | - if (trim($search_term) != '' && !isset($_REQUEST['sort_by'])) {
|
|
| 391 | - $sort_by = 'az'; |
|
| 392 | - } |
|
| 390 | + if (trim($search_term) != '' && !isset($_REQUEST['sort_by'])) {
|
|
| 391 | + $sort_by = 'az'; |
|
| 392 | + } |
|
| 393 | 393 | |
| 394 | - if ($snear != '' && $sort_by!='farthest') {
|
|
| 395 | - $sort_by = 'nearest'; |
|
| 396 | - } |
|
| 397 | - } |
|
| 398 | - |
|
| 399 | - switch ($sort_by): |
|
| 400 | - case 'newest': |
|
| 401 | - $orderby = "$wpdb->posts.post_date desc, "; |
|
| 402 | - break; |
|
| 403 | - case 'oldest': |
|
| 404 | - $orderby = "$wpdb->posts.post_date asc, "; |
|
| 405 | - break; |
|
| 406 | - case 'low_review': |
|
| 407 | - case 'rating_count_asc': |
|
| 408 | - $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, "; |
|
| 409 | - break; |
|
| 410 | - case 'high_review': |
|
| 411 | - case 'rating_count_desc': |
|
| 412 | - $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, "; |
|
| 413 | - break; |
|
| 414 | - case 'low_rating': |
|
| 415 | - $orderby = "( " . $table . ".overall_rating ) ASC, " . $table . ".rating_count ASC, "; |
|
| 416 | - break; |
|
| 417 | - case 'high_rating': |
|
| 418 | - $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
| 419 | - break; |
|
| 420 | - case 'featured': |
|
| 421 | - $orderby = $table . ".is_featured asc, "; |
|
| 422 | - break; |
|
| 423 | - case 'nearest': |
|
| 424 | - $orderby = " distance asc, "; |
|
| 425 | - break; |
|
| 426 | - case 'farthest': |
|
| 427 | - $orderby = " distance desc, "; |
|
| 428 | - break; |
|
| 429 | - case 'random': |
|
| 430 | - $orderby = " rand(), "; |
|
| 431 | - break; |
|
| 432 | - case 'az': |
|
| 433 | - $orderby = "$wpdb->posts.post_title asc, "; |
|
| 434 | - break; |
|
| 435 | - // sort by rating |
|
| 436 | - case 'overall_rating_desc': |
|
| 437 | - $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
| 438 | - break; |
|
| 439 | - case 'overall_rating_asc': |
|
| 440 | - $orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, "; |
|
| 441 | - break; |
|
| 442 | - default: |
|
| 443 | - |
|
| 444 | - break; |
|
| 445 | - endswitch; |
|
| 446 | - |
|
| 447 | - if ($sort_by != '' && geodir_cpt_has_rating_disabled($geodir_post_type)) {
|
|
| 448 | - if (in_array($sort_by, array('high_review', 'rating_count_desc', 'high_rating', 'overall_rating_desc'))) {
|
|
| 449 | - $orderby = "$wpdb->posts.comment_count DESC, "; |
|
| 450 | - $sort_by = 'comment_count_desc'; |
|
| 451 | - } else if (in_array($sort_by, array('low_review', 'rating_count_asc', 'low_rating', 'overall_rating_asc'))) {
|
|
| 452 | - $orderby = "$wpdb->posts.comment_count ASC, "; |
|
| 453 | - $sort_by = 'comment_count_asc'; |
|
| 454 | - } |
|
| 455 | - } |
|
| 394 | + if ($snear != '' && $sort_by!='farthest') {
|
|
| 395 | + $sort_by = 'nearest'; |
|
| 396 | + } |
|
| 397 | + } |
|
| 456 | 398 | |
| 457 | - global $s; |
|
| 399 | + switch ($sort_by): |
|
| 400 | + case 'newest': |
|
| 401 | + $orderby = "$wpdb->posts.post_date desc, "; |
|
| 402 | + break; |
|
| 403 | + case 'oldest': |
|
| 404 | + $orderby = "$wpdb->posts.post_date asc, "; |
|
| 405 | + break; |
|
| 406 | + case 'low_review': |
|
| 407 | + case 'rating_count_asc': |
|
| 408 | + $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, "; |
|
| 409 | + break; |
|
| 410 | + case 'high_review': |
|
| 411 | + case 'rating_count_desc': |
|
| 412 | + $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, "; |
|
| 413 | + break; |
|
| 414 | + case 'low_rating': |
|
| 415 | + $orderby = "( " . $table . ".overall_rating ) ASC, " . $table . ".rating_count ASC, "; |
|
| 416 | + break; |
|
| 417 | + case 'high_rating': |
|
| 418 | + $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
| 419 | + break; |
|
| 420 | + case 'featured': |
|
| 421 | + $orderby = $table . ".is_featured asc, "; |
|
| 422 | + break; |
|
| 423 | + case 'nearest': |
|
| 424 | + $orderby = " distance asc, "; |
|
| 425 | + break; |
|
| 426 | + case 'farthest': |
|
| 427 | + $orderby = " distance desc, "; |
|
| 428 | + break; |
|
| 429 | + case 'random': |
|
| 430 | + $orderby = " rand(), "; |
|
| 431 | + break; |
|
| 432 | + case 'az': |
|
| 433 | + $orderby = "$wpdb->posts.post_title asc, "; |
|
| 434 | + break; |
|
| 435 | + // sort by rating |
|
| 436 | + case 'overall_rating_desc': |
|
| 437 | + $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
| 438 | + break; |
|
| 439 | + case 'overall_rating_asc': |
|
| 440 | + $orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, "; |
|
| 441 | + break; |
|
| 442 | + default: |
|
| 443 | + |
|
| 444 | + break; |
|
| 445 | + endswitch; |
|
| 446 | + |
|
| 447 | + if ($sort_by != '' && geodir_cpt_has_rating_disabled($geodir_post_type)) {
|
|
| 448 | + if (in_array($sort_by, array('high_review', 'rating_count_desc', 'high_rating', 'overall_rating_desc'))) {
|
|
| 449 | + $orderby = "$wpdb->posts.comment_count DESC, "; |
|
| 450 | + $sort_by = 'comment_count_desc'; |
|
| 451 | + } else if (in_array($sort_by, array('low_review', 'rating_count_asc', 'low_rating', 'overall_rating_asc'))) {
|
|
| 452 | + $orderby = "$wpdb->posts.comment_count ASC, "; |
|
| 453 | + $sort_by = 'comment_count_asc'; |
|
| 454 | + } |
|
| 455 | + } |
|
| 458 | 456 | |
| 459 | - if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
|
|
| 460 | - $keywords = explode(" ", $s);
|
|
| 461 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 462 | - foreach($keywords as $kkey=>$kword){
|
|
| 463 | - if(mb_strlen($kword, 'UTF-8')<=$klimit){
|
|
| 464 | - unset($keywords[$kkey]); |
|
| 465 | - } |
|
| 466 | - } |
|
| 467 | - } |
|
| 468 | - if ($sort_by == 'nearest' || $sort_by == 'farthest') {
|
|
| 469 | - if (count($keywords) > 1) {
|
|
| 470 | - $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, "; |
|
| 471 | - } else {
|
|
| 472 | - $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, "; |
|
| 473 | - } |
|
| 474 | - } else {
|
|
| 475 | - if (count($keywords) > 1) {
|
|
| 476 | - $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby; |
|
| 477 | - } else {
|
|
| 478 | - $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby; |
|
| 479 | - } |
|
| 480 | - } |
|
| 481 | - } |
|
| 457 | + global $s; |
|
| 458 | + |
|
| 459 | + if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
|
|
| 460 | + $keywords = explode(" ", $s);
|
|
| 461 | + if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 462 | + foreach($keywords as $kkey=>$kword){
|
|
| 463 | + if(mb_strlen($kword, 'UTF-8')<=$klimit){
|
|
| 464 | + unset($keywords[$kkey]); |
|
| 465 | + } |
|
| 466 | + } |
|
| 467 | + } |
|
| 468 | + if ($sort_by == 'nearest' || $sort_by == 'farthest') {
|
|
| 469 | + if (count($keywords) > 1) {
|
|
| 470 | + $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, "; |
|
| 471 | + } else {
|
|
| 472 | + $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, "; |
|
| 473 | + } |
|
| 474 | + } else {
|
|
| 475 | + if (count($keywords) > 1) {
|
|
| 476 | + $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby; |
|
| 477 | + } else {
|
|
| 478 | + $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby; |
|
| 479 | + } |
|
| 480 | + } |
|
| 481 | + } |
|
| 482 | 482 | |
| 483 | - /** |
|
| 484 | - * Filter order by SQL. |
|
| 485 | - * |
|
| 486 | - * @since 1.0.0 |
|
| 487 | - * @param string $orderby The orderby query string. |
|
| 488 | - * @param string $sort_by Sortby query string. |
|
| 489 | - * @param string $table Listing table name. |
|
| 490 | - */ |
|
| 491 | - $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
|
|
| 483 | + /** |
|
| 484 | + * Filter order by SQL. |
|
| 485 | + * |
|
| 486 | + * @since 1.0.0 |
|
| 487 | + * @param string $orderby The orderby query string. |
|
| 488 | + * @param string $sort_by Sortby query string. |
|
| 489 | + * @param string $table Listing table name. |
|
| 490 | + */ |
|
| 491 | + $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
|
|
| 492 | 492 | |
| 493 | - $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title "; |
|
| 493 | + $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title "; |
|
| 494 | 494 | |
| 495 | - return $orderby; |
|
| 495 | + return $orderby; |
|
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | |
@@ -510,53 +510,53 @@ discard block |
||
| 510 | 510 | function geodir_posts_order_by_custom_sort($orderby, $sort_by, $table) |
| 511 | 511 | {
|
| 512 | 512 | |
| 513 | - global $wpdb; |
|
| 513 | + global $wpdb; |
|
| 514 | 514 | |
| 515 | - if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' || $_REQUEST['s']==' ') ) )) {
|
|
| 515 | + if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' || $_REQUEST['s']==' ') ) )) {
|
|
| 516 | 516 | |
| 517 | - $sort_array = explode('_', $sort_by);
|
|
| 517 | + $sort_array = explode('_', $sort_by);
|
|
| 518 | 518 | |
| 519 | - $sort_by_count = count($sort_array); |
|
| 519 | + $sort_by_count = count($sort_array); |
|
| 520 | 520 | |
| 521 | - $order = $sort_array[$sort_by_count - 1]; |
|
| 521 | + $order = $sort_array[$sort_by_count - 1]; |
|
| 522 | 522 | |
| 523 | - if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
|
|
| 523 | + if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
|
|
| 524 | 524 | |
| 525 | - $sort_by = str_replace('_' . $order, '', $sort_by);
|
|
| 525 | + $sort_by = str_replace('_' . $order, '', $sort_by);
|
|
| 526 | 526 | |
| 527 | - switch ($sort_by): |
|
| 527 | + switch ($sort_by): |
|
| 528 | 528 | |
| 529 | - case 'post_date': |
|
| 530 | - case 'comment_count': |
|
| 529 | + case 'post_date': |
|
| 530 | + case 'comment_count': |
|
| 531 | 531 | |
| 532 | - $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", "; |
|
| 533 | - break; |
|
| 532 | + $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", "; |
|
| 533 | + break; |
|
| 534 | 534 | |
| 535 | - case 'distance': |
|
| 536 | - $orderby = $sort_by . " " . $order . ", "; |
|
| 537 | - break; |
|
| 535 | + case 'distance': |
|
| 536 | + $orderby = $sort_by . " " . $order . ", "; |
|
| 537 | + break; |
|
| 538 | 538 | |
| 539 | 539 | |
| 540 | - // sort by rating |
|
| 541 | - case 'overall_rating': |
|
| 542 | - $orderby = " " . $table . "." . $sort_by . " " . $order . ", " . $table . ".rating_count " . $order . ", "; |
|
| 540 | + // sort by rating |
|
| 541 | + case 'overall_rating': |
|
| 542 | + $orderby = " " . $table . "." . $sort_by . " " . $order . ", " . $table . ".rating_count " . $order . ", "; |
|
| 543 | 543 | |
| 544 | - break; |
|
| 544 | + break; |
|
| 545 | 545 | |
| 546 | 546 | |
| 547 | - default: |
|
| 548 | - if (geodir_column_exist($table, $sort_by)) {
|
|
| 547 | + default: |
|
| 548 | + if (geodir_column_exist($table, $sort_by)) {
|
|
| 549 | 549 | $orderby = $table . "." . $sort_by . " " . $order . ", "; |
| 550 | 550 | } |
| 551 | - break; |
|
| 551 | + break; |
|
| 552 | 552 | |
| 553 | - endswitch; |
|
| 553 | + endswitch; |
|
| 554 | 554 | |
| 555 | - } |
|
| 555 | + } |
|
| 556 | 556 | |
| 557 | - } |
|
| 557 | + } |
|
| 558 | 558 | |
| 559 | - return $orderby; |
|
| 559 | + return $orderby; |
|
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | /** |
@@ -571,34 +571,34 @@ discard block |
||
| 571 | 571 | {
|
| 572 | 572 | |
| 573 | 573 | |
| 574 | - global $wpdb, $geodir_post_type, $table, $s, $snear; |
|
| 574 | + global $wpdb, $geodir_post_type, $table, $s, $snear; |
|
| 575 | 575 | |
| 576 | - if (!is_admin()) {
|
|
| 576 | + if (!is_admin()) {
|
|
| 577 | 577 | |
| 578 | - if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 579 | - add_filter('posts_where', 'geodir_edit_listing_where', 1);
|
|
| 578 | + if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 579 | + add_filter('posts_where', 'geodir_edit_listing_where', 1);
|
|
| 580 | 580 | |
| 581 | - } elseif ((is_search() && $_REQUEST['geodir_search'])) {
|
|
| 581 | + } elseif ((is_search() && $_REQUEST['geodir_search'])) {
|
|
| 582 | 582 | |
| 583 | - add_filter('posts_where', 'searching_filter_where', 1);
|
|
| 583 | + add_filter('posts_where', 'searching_filter_where', 1);
|
|
| 584 | 584 | |
| 585 | - if ($snear != '') |
|
| 586 | - add_filter('posts_where', 'searching_filter_where', 1);
|
|
| 585 | + if ($snear != '') |
|
| 586 | + add_filter('posts_where', 'searching_filter_where', 1);
|
|
| 587 | 587 | |
| 588 | - add_filter('posts_orderby', 'geodir_posts_orderby', 1);
|
|
| 588 | + add_filter('posts_orderby', 'geodir_posts_orderby', 1);
|
|
| 589 | 589 | |
| 590 | - } elseif (geodir_is_page('author')) {
|
|
| 590 | + } elseif (geodir_is_page('author')) {
|
|
| 591 | 591 | |
| 592 | - add_filter('posts_where', 'author_filter_where', 1);
|
|
| 592 | + add_filter('posts_where', 'author_filter_where', 1);
|
|
| 593 | 593 | |
| 594 | - } |
|
| 594 | + } |
|
| 595 | 595 | |
| 596 | - //if (!geodir_is_page('detail'))
|
|
| 597 | - add_filter('posts_where', 'geodir_default_where', 1);/**/
|
|
| 596 | + //if (!geodir_is_page('detail'))
|
|
| 597 | + add_filter('posts_where', 'geodir_default_where', 1);/**/
|
|
| 598 | 598 | |
| 599 | - //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts |
|
| 599 | + //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts |
|
| 600 | 600 | |
| 601 | - } |
|
| 601 | + } |
|
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | /** |
@@ -613,13 +613,13 @@ discard block |
||
| 613 | 613 | */ |
| 614 | 614 | function geodir_preview_post_cap($allcaps, $caps, $args) |
| 615 | 615 | {
|
| 616 | - $user_id = get_current_user_id(); |
|
| 617 | - if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) {
|
|
| 616 | + $user_id = get_current_user_id(); |
|
| 617 | + if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) {
|
|
| 618 | 618 | |
| 619 | - $allcaps['edit_posts'] = true; |
|
| 620 | - } |
|
| 621 | - //print_r($allcaps); |
|
| 622 | - return $allcaps; |
|
| 619 | + $allcaps['edit_posts'] = true; |
|
| 620 | + } |
|
| 621 | + //print_r($allcaps); |
|
| 622 | + return $allcaps; |
|
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | |
@@ -634,9 +634,9 @@ discard block |
||
| 634 | 634 | */ |
| 635 | 635 | function geodir_edit_listing_where($where) |
| 636 | 636 | {
|
| 637 | - global $wpdb; |
|
| 638 | - $where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']);
|
|
| 639 | - return $where; |
|
| 637 | + global $wpdb; |
|
| 638 | + $where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']);
|
|
| 639 | + return $where; |
|
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | |
@@ -653,29 +653,29 @@ discard block |
||
| 653 | 653 | */ |
| 654 | 654 | function geodir_default_where($where) |
| 655 | 655 | {
|
| 656 | - global $wp_query, $wpdb; |
|
| 657 | - |
|
| 658 | - //print_r($wp_query); |
|
| 659 | - ########### WPML ########### |
|
| 660 | - |
|
| 661 | - if (function_exists('icl_object_id')) {
|
|
| 662 | - global $sitepress, $table_prefix; |
|
| 663 | - $lang_code = ICL_LANGUAGE_CODE; |
|
| 664 | - $default_lang_code = $sitepress->get_default_language(); |
|
| 665 | - $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : ''; |
|
| 666 | - //echo '##########'.$q_post_type; |
|
| 667 | - if ($lang_code && $q_post_type) {
|
|
| 668 | - $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
|
|
| 669 | - //$where .= " AND icl_t.language_code = '$lang_code' "; |
|
| 670 | - } |
|
| 656 | + global $wp_query, $wpdb; |
|
| 671 | 657 | |
| 672 | - } |
|
| 673 | - ########### WPML ########### |
|
| 658 | + //print_r($wp_query); |
|
| 659 | + ########### WPML ########### |
|
| 660 | + |
|
| 661 | + if (function_exists('icl_object_id')) {
|
|
| 662 | + global $sitepress, $table_prefix; |
|
| 663 | + $lang_code = ICL_LANGUAGE_CODE; |
|
| 664 | + $default_lang_code = $sitepress->get_default_language(); |
|
| 665 | + $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : ''; |
|
| 666 | + //echo '##########'.$q_post_type; |
|
| 667 | + if ($lang_code && $q_post_type) {
|
|
| 668 | + $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
|
|
| 669 | + //$where .= " AND icl_t.language_code = '$lang_code' "; |
|
| 670 | + } |
|
| 671 | + |
|
| 672 | + } |
|
| 673 | + ########### WPML ########### |
|
| 674 | 674 | |
| 675 | 675 | |
| 676 | - return $where = str_replace("0 = 1", "1=1", $where);
|
|
| 676 | + return $where = str_replace("0 = 1", "1=1", $where);
|
|
| 677 | 677 | |
| 678 | - /* ====== old code start === |
|
| 678 | + /* ====== old code start === |
|
| 679 | 679 | $where = str_replace("0 = 1", "1=1", $where);
|
| 680 | 680 | $country = get_query_var('gd_country');
|
| 681 | 681 | $region = get_query_var('gd_region');
|
@@ -716,108 +716,108 @@ discard block |
||
| 716 | 716 | * @return string Modified where query string. |
| 717 | 717 | */ |
| 718 | 718 | function searching_filter_where($where) {
|
| 719 | - global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session; |
|
| 719 | + global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session; |
|
| 720 | 720 | |
| 721 | - $search_term = 'OR'; |
|
| 722 | - $search_term = 'AND'; |
|
| 723 | - $geodir_custom_search = ''; |
|
| 724 | - $category_search_range = ''; |
|
| 721 | + $search_term = 'OR'; |
|
| 722 | + $search_term = 'AND'; |
|
| 723 | + $geodir_custom_search = ''; |
|
| 724 | + $category_search_range = ''; |
|
| 725 | 725 | |
| 726 | - if (is_single() && get_query_var('post_type')) {
|
|
| 726 | + if (is_single() && get_query_var('post_type')) {
|
|
| 727 | 727 | return $where; |
| 728 | 728 | } |
| 729 | 729 | |
| 730 | - if (is_tax()) {
|
|
| 730 | + if (is_tax()) {
|
|
| 731 | 731 | return $where; |
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | $s = trim($s); |
| 735 | - $s = wp_specialchars_decode($s ,ENT_QUOTES); |
|
| 736 | - $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES); |
|
| 737 | - |
|
| 738 | - $where = ''; |
|
| 739 | - $better_search_terms = ''; |
|
| 740 | - if (isset($_REQUEST['stype'])) |
|
| 741 | - $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
| 742 | - else |
|
| 743 | - $post_types = 'gd_place'; |
|
| 744 | - |
|
| 745 | - if ($s != '') {
|
|
| 746 | - $keywords = explode(" ", $s);
|
|
| 747 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 748 | - foreach($keywords as $kkey=>$kword){
|
|
| 749 | - if(mb_strlen($kword, 'UTF-8')<=$klimit){
|
|
| 750 | - unset($keywords[$kkey]); |
|
| 751 | - } |
|
| 752 | - } |
|
| 753 | - } |
|
| 735 | + $s = wp_specialchars_decode($s ,ENT_QUOTES); |
|
| 736 | + $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES); |
|
| 754 | 737 | |
| 755 | - if (!empty($keywords)) {
|
|
| 756 | - foreach ($keywords as $keyword) {
|
|
| 757 | - $keyword = trim($keyword); |
|
| 758 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
| 759 | - if ($keyword != '') {
|
|
| 760 | - /** |
|
| 761 | - * Filter the search query keywords SQL. |
|
| 762 | - * |
|
| 763 | - * @since 1.5.9 |
|
| 764 | - * @package GeoDirectory |
|
| 765 | - * @param string $better_search_terms The query values, default: `' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )'`. |
|
| 766 | - * @param array $keywords The array of keywords for the query. |
|
| 767 | - * @param string $keyword The single keyword being searched. |
|
| 768 | - */ |
|
| 738 | + $where = ''; |
|
| 739 | + $better_search_terms = ''; |
|
| 740 | + if (isset($_REQUEST['stype'])) |
|
| 741 | + $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype'])); |
|
| 742 | + else |
|
| 743 | + $post_types = 'gd_place'; |
|
| 744 | + |
|
| 745 | + if ($s != '') {
|
|
| 746 | + $keywords = explode(" ", $s);
|
|
| 747 | + if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 748 | + foreach($keywords as $kkey=>$kword){
|
|
| 749 | + if(mb_strlen($kword, 'UTF-8')<=$klimit){
|
|
| 750 | + unset($keywords[$kkey]); |
|
| 751 | + } |
|
| 752 | + } |
|
| 753 | + } |
|
| 754 | + |
|
| 755 | + if (!empty($keywords)) {
|
|
| 756 | + foreach ($keywords as $keyword) {
|
|
| 757 | + $keyword = trim($keyword); |
|
| 758 | + $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
| 759 | + if ($keyword != '') {
|
|
| 760 | + /** |
|
| 761 | + * Filter the search query keywords SQL. |
|
| 762 | + * |
|
| 763 | + * @since 1.5.9 |
|
| 764 | + * @package GeoDirectory |
|
| 765 | + * @param string $better_search_terms The query values, default: `' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )'`. |
|
| 766 | + * @param array $keywords The array of keywords for the query. |
|
| 767 | + * @param string $keyword The single keyword being searched. |
|
| 768 | + */ |
|
| 769 | 769 | $better_search_terms .= apply_filters("geodir_search_better_search_terms",' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )',$keywords,$keyword);
|
| 770 | - } |
|
| 771 | - } |
|
| 772 | - } |
|
| 773 | - } |
|
| 770 | + } |
|
| 771 | + } |
|
| 772 | + } |
|
| 773 | + } |
|
| 774 | 774 | |
| 775 | - /* get taxonomy */ |
|
| 776 | - $taxonomies = geodir_get_taxonomies($post_types, true); |
|
| 777 | - if($taxonomies) {
|
|
| 778 | - $taxonomies = implode("','", $taxonomies);
|
|
| 779 | - $taxonomies = "'" . $taxonomies . "'"; |
|
| 780 | - }else{$taxonomies='';}
|
|
| 775 | + /* get taxonomy */ |
|
| 776 | + $taxonomies = geodir_get_taxonomies($post_types, true); |
|
| 777 | + if($taxonomies) {
|
|
| 778 | + $taxonomies = implode("','", $taxonomies);
|
|
| 779 | + $taxonomies = "'" . $taxonomies . "'"; |
|
| 780 | + }else{$taxonomies='';}
|
|
| 781 | 781 | |
| 782 | - $content_where = $terms_where = ''; |
|
| 782 | + $content_where = $terms_where = ''; |
|
| 783 | 783 | if ($s != '') {
|
| 784 | - /** |
|
| 785 | - * Filter the search query content where values. |
|
| 786 | - * |
|
| 787 | - * @since 1.5.0 |
|
| 788 | - * @package GeoDirectory |
|
| 789 | - * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`. |
|
| 790 | - */ |
|
| 784 | + /** |
|
| 785 | + * Filter the search query content where values. |
|
| 786 | + * |
|
| 787 | + * @since 1.5.0 |
|
| 788 | + * @package GeoDirectory |
|
| 789 | + * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`. |
|
| 790 | + */ |
|
| 791 | 791 | $content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
|
| 792 | - /** |
|
| 793 | - * Filter the search query term values. |
|
| 794 | - * |
|
| 795 | - * @since 1.5.0 |
|
| 796 | - * @package GeoDirectory |
|
| 797 | - * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`. |
|
| 798 | - */ |
|
| 799 | - $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
|
|
| 792 | + /** |
|
| 793 | + * Filter the search query term values. |
|
| 794 | + * |
|
| 795 | + * @since 1.5.0 |
|
| 796 | + * @package GeoDirectory |
|
| 797 | + * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`. |
|
| 798 | + */ |
|
| 799 | + $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
|
|
| 800 | 800 | } |
| 801 | 801 | |
| 802 | - if ($snear != '') {
|
|
| 802 | + if ($snear != '') {
|
|
| 803 | 803 | |
| 804 | 804 | |
| 805 | - if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) {
|
|
| 806 | - $dist = $gd_session->get('near_me_range');
|
|
| 807 | - } |
|
| 808 | - $lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69); |
|
| 809 | - $lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69); |
|
| 810 | - $lat1 = $mylat - ($dist / 69); |
|
| 811 | - $lat2 = $mylat + ($dist / 69); |
|
| 805 | + if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) {
|
|
| 806 | + $dist = $gd_session->get('near_me_range');
|
|
| 807 | + } |
|
| 808 | + $lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69); |
|
| 809 | + $lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69); |
|
| 810 | + $lat1 = $mylat - ($dist / 69); |
|
| 811 | + $lat2 = $mylat + ($dist / 69); |
|
| 812 | 812 | |
| 813 | - $rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : ''; |
|
| 814 | - $rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : ''; |
|
| 815 | - $rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : ''; |
|
| 816 | - $rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : ''; |
|
| 813 | + $rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : ''; |
|
| 814 | + $rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : ''; |
|
| 815 | + $rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : ''; |
|
| 816 | + $rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : ''; |
|
| 817 | 817 | |
| 818 | 818 | |
| 819 | 819 | |
| 820 | - $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms) |
|
| 820 | + $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms) |
|
| 821 | 821 | $content_where |
| 822 | 822 | OR ($wpdb->posts.ID IN( |
| 823 | 823 | SELECT $wpdb->term_relationships.object_id as post_id |
@@ -834,13 +834,13 @@ discard block |
||
| 834 | 834 | AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 ) |
| 835 | 835 | AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) "; |
| 836 | 836 | |
| 837 | - if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
|
|
| 838 | - $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
|
| 839 | - $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist;
|
|
| 840 | - } |
|
| 837 | + if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
|
|
| 838 | + $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
|
| 839 | + $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist;
|
|
| 840 | + } |
|
| 841 | 841 | |
| 842 | - } else {
|
|
| 843 | - $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms) |
|
| 842 | + } else {
|
|
| 843 | + $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms) |
|
| 844 | 844 | $content_where |
| 845 | 845 | OR ( $wpdb->posts.ID IN( |
| 846 | 846 | SELECT $wpdb->term_relationships.object_id as post_id |
@@ -854,19 +854,19 @@ discard block |
||
| 854 | 854 | ) |
| 855 | 855 | AND $wpdb->posts.post_type in ('$post_types')
|
| 856 | 856 | AND ($wpdb->posts.post_status = 'publish') "; |
| 857 | - } |
|
| 857 | + } |
|
| 858 | 858 | |
| 859 | 859 | ########### WPML ########### |
| 860 | - if ( function_exists( 'icl_object_id' ) ) {
|
|
| 860 | + if ( function_exists( 'icl_object_id' ) ) {
|
|
| 861 | 861 | $lang_code = ICL_LANGUAGE_CODE; |
| 862 | 862 | |
| 863 | 863 | if ($lang_code && $post_types) {
|
| 864 | - $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
|
|
| 865 | - } |
|
| 866 | - } |
|
| 867 | - ########### WPML ########### |
|
| 864 | + $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
|
|
| 865 | + } |
|
| 866 | + } |
|
| 867 | + ########### WPML ########### |
|
| 868 | 868 | |
| 869 | - return $where; |
|
| 869 | + return $where; |
|
| 870 | 870 | } |
| 871 | 871 | |
| 872 | 872 | |
@@ -881,45 +881,45 @@ discard block |
||
| 881 | 881 | * @return string Modified where query string. |
| 882 | 882 | */ |
| 883 | 883 | function author_filter_where($where) {
|
| 884 | - global $wpdb, $geodir_post_type, $table, $curr; |
|
| 884 | + global $wpdb, $geodir_post_type, $table, $curr; |
|
| 885 | 885 | |
| 886 | - $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
|
|
| 887 | - $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0; |
|
| 886 | + $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
|
|
| 887 | + $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0; |
|
| 888 | 888 | |
| 889 | - if (isset($_REQUEST['stype'])) {
|
|
| 890 | - $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
|
|
| 891 | - } else {
|
|
| 892 | - $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
|
|
| 893 | - } |
|
| 889 | + if (isset($_REQUEST['stype'])) {
|
|
| 890 | + $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
|
|
| 891 | + } else {
|
|
| 892 | + $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
|
|
| 893 | + } |
|
| 894 | 894 | |
| 895 | - if ($user_id > 0) {
|
|
| 896 | - if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
|
|
| 897 | - $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
|
| 898 | - $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
|
|
| 899 | - $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
|
|
| 900 | - } else |
|
| 901 | - $where .= " AND $wpdb->posts.post_author = $user_id"; |
|
| 902 | - |
|
| 903 | - if ($user_id == (int)get_current_user_id()) {
|
|
| 904 | - $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
|
|
| 905 | - } else {
|
|
| 906 | - $where .= " AND $wpdb->posts.post_status = 'publish' "; |
|
| 907 | - } |
|
| 908 | - } else {
|
|
| 909 | - $where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' "; |
|
| 910 | - } |
|
| 895 | + if ($user_id > 0) {
|
|
| 896 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
|
|
| 897 | + $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
|
| 898 | + $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
|
|
| 899 | + $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
|
|
| 900 | + } else |
|
| 901 | + $where .= " AND $wpdb->posts.post_author = $user_id"; |
|
| 902 | + |
|
| 903 | + if ($user_id == (int)get_current_user_id()) {
|
|
| 904 | + $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
|
|
| 905 | + } else {
|
|
| 906 | + $where .= " AND $wpdb->posts.post_status = 'publish' "; |
|
| 907 | + } |
|
| 908 | + } else {
|
|
| 909 | + $where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' "; |
|
| 910 | + } |
|
| 911 | 911 | |
| 912 | - ########### WPML ########### |
|
| 913 | - if (function_exists('icl_object_id')) {
|
|
| 914 | - $lang_code = ICL_LANGUAGE_CODE; |
|
| 915 | - if ($lang_code) {
|
|
| 916 | - $where .= " AND icl_t.language_code='" . $lang_code . "' "; |
|
| 917 | - } |
|
| 912 | + ########### WPML ########### |
|
| 913 | + if (function_exists('icl_object_id')) {
|
|
| 914 | + $lang_code = ICL_LANGUAGE_CODE; |
|
| 915 | + if ($lang_code) {
|
|
| 916 | + $where .= " AND icl_t.language_code='" . $lang_code . "' "; |
|
| 917 | + } |
|
| 918 | 918 | |
| 919 | - } |
|
| 920 | - ########### WPML ########### |
|
| 919 | + } |
|
| 920 | + ########### WPML ########### |
|
| 921 | 921 | |
| 922 | - return $where; |
|
| 922 | + return $where; |
|
| 923 | 923 | } |
| 924 | 924 | |
| 925 | 925 | /** |
@@ -934,11 +934,11 @@ discard block |
||
| 934 | 934 | */ |
| 935 | 935 | function geodir_filter_widget_join($join) |
| 936 | 936 | {
|
| 937 | - global $wp_query, $table; |
|
| 938 | - if (!empty($wp_query->query['with_pics_only'])) {
|
|
| 939 | - $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
| 940 | - } |
|
| 941 | - return $join; |
|
| 937 | + global $wp_query, $table; |
|
| 938 | + if (!empty($wp_query->query['with_pics_only'])) {
|
|
| 939 | + $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
| 940 | + } |
|
| 941 | + return $join; |
|
| 942 | 942 | } |
| 943 | 943 | |
| 944 | 944 | /** |
@@ -953,42 +953,42 @@ discard block |
||
| 953 | 953 | */ |
| 954 | 954 | function geodir_filter_widget_where($where) |
| 955 | 955 | {
|
| 956 | - global $wp_query, $table; |
|
| 957 | - if (!empty($wp_query->query['show_featured_only'])) {
|
|
| 958 | - $where .= " AND " . $table . ".is_featured = '1'"; |
|
| 959 | - } |
|
| 960 | - if (!empty($wp_query->query['show_special_only'])) {
|
|
| 961 | - $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
| 962 | - } |
|
| 963 | - if (!empty($wp_query->query['with_pics_only'])) {
|
|
| 964 | - $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id"; |
|
| 965 | - } |
|
| 966 | - if (!empty($wp_query->query['with_videos_only'])) {
|
|
| 967 | - $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
| 968 | - } |
|
| 969 | - return $where; |
|
| 956 | + global $wp_query, $table; |
|
| 957 | + if (!empty($wp_query->query['show_featured_only'])) {
|
|
| 958 | + $where .= " AND " . $table . ".is_featured = '1'"; |
|
| 959 | + } |
|
| 960 | + if (!empty($wp_query->query['show_special_only'])) {
|
|
| 961 | + $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
| 962 | + } |
|
| 963 | + if (!empty($wp_query->query['with_pics_only'])) {
|
|
| 964 | + $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id"; |
|
| 965 | + } |
|
| 966 | + if (!empty($wp_query->query['with_videos_only'])) {
|
|
| 967 | + $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
| 968 | + } |
|
| 969 | + return $where; |
|
| 970 | 970 | } |
| 971 | 971 | |
| 972 | 972 | |
| 973 | 973 | function geodir_related_posts_fields($fields) {
|
| 974 | - global $wp_query, $wpdb, $table, $post; |
|
| 974 | + global $wp_query, $wpdb, $table, $post; |
|
| 975 | 975 | |
| 976 | - $fields .= ", " . $table . ".* "; |
|
| 976 | + $fields .= ", " . $table . ".* "; |
|
| 977 | 977 | |
| 978 | - $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
|
| 978 | + $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
|
| 979 | 979 | |
| 980 | - $mylat = $post->post_latitude; |
|
| 981 | - $mylon = $post->post_longitude; |
|
| 980 | + $mylat = $post->post_latitude; |
|
| 981 | + $mylon = $post->post_longitude; |
|
| 982 | 982 | |
| 983 | - $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 984 | - return $fields; |
|
| 983 | + $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 984 | + return $fields; |
|
| 985 | 985 | } |
| 986 | 986 | function geodir_related_posts_fields_filter($query) {
|
| 987 | - if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
| 988 | - && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest' |
|
| 989 | - && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings'] |
|
| 990 | - ) {
|
|
| 991 | - add_filter('posts_fields', 'geodir_related_posts_fields', 1);
|
|
| 992 | - } |
|
| 987 | + if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
| 988 | + && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest' |
|
| 989 | + && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings'] |
|
| 990 | + ) {
|
|
| 991 | + add_filter('posts_fields', 'geodir_related_posts_fields', 1);
|
|
| 992 | + } |
|
| 993 | 993 | } |
| 994 | 994 | add_action('pre_get_posts', 'geodir_related_posts_fields_filter', 1); |
| 995 | 995 | \ No newline at end of file |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @global string $s_A Extra parameters. |
| 66 | 66 | * @global string $s_SA Extra parameters. |
| 67 | 67 | */ |
| 68 | -function set_listing_request($query ) |
|
| 68 | +function set_listing_request($query) |
|
| 69 | 69 | {
|
| 70 | 70 | global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA; |
| 71 | 71 | |
@@ -99,15 +99,15 @@ discard block |
||
| 99 | 99 | } // Distance |
| 100 | 100 | |
| 101 | 101 | if (isset($_REQUEST['sgeo_lat'])) {
|
| 102 | - $mylat = (float)esc_attr($_REQUEST['sgeo_lat']); |
|
| 102 | + $mylat = (float) esc_attr($_REQUEST['sgeo_lat']); |
|
| 103 | 103 | } else {
|
| 104 | - $mylat = (float)geodir_get_current_city_lat(); |
|
| 104 | + $mylat = (float) geodir_get_current_city_lat(); |
|
| 105 | 105 | } // Latatude |
| 106 | 106 | |
| 107 | 107 | if (isset($_REQUEST['sgeo_lon'])) {
|
| 108 | - $mylon = (float)esc_attr($_REQUEST['sgeo_lon']); |
|
| 108 | + $mylon = (float) esc_attr($_REQUEST['sgeo_lon']); |
|
| 109 | 109 | } else {
|
| 110 | - $mylon = (float)geodir_get_current_city_lng(); |
|
| 110 | + $mylon = (float) geodir_get_current_city_lng(); |
|
| 111 | 111 | } // Distance |
| 112 | 112 | |
| 113 | 113 | if (isset($_REQUEST['snear'])) {
|
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | if ($snear == 'NEAR ME') {
|
| 122 | 122 | $ip = $_SERVER['REMOTE_ADDR']; |
| 123 | - $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip));
|
|
| 123 | + $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$ip));
|
|
| 124 | 124 | $mylat = stripslashes(ucfirst($addr_details[geoplugin_latitude])); |
| 125 | 125 | $mylon = stripslashes(ucfirst($addr_details[geoplugin_longitude])); |
| 126 | 126 | } |
@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | $s_AA = str_replace(" ", "", $s);
|
| 131 | 131 | $s_A = explode(",", $s_AA);
|
| 132 | 132 | $s_A = implode('","', $s_A);
|
| 133 | - $s_A = '"' . $s_A . '"'; |
|
| 133 | + $s_A = '"'.$s_A.'"'; |
|
| 134 | 134 | } else {
|
| 135 | - $s_A = '"' . $s . '"'; |
|
| 135 | + $s_A = '"'.$s.'"'; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (strstr($s, ' ')) {
|
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | } |
| 194 | 194 | if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
|
| 195 | 195 | |
| 196 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
| 196 | + $table = $plugin_prefix.$geodir_post_type.'_detail'; |
|
| 197 | 197 | |
| 198 | 198 | add_filter('posts_fields', 'geodir_posts_fields', 1);
|
| 199 | 199 | add_filter('posts_join', 'geodir_posts_join', 1);
|
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session; |
| 234 | 234 | |
| 235 | 235 | // Filter-Location-Manager to add location table. |
| 236 | - $fields .= ", " . $table . ".* "; |
|
| 236 | + $fields .= ", ".$table.".* "; |
|
| 237 | 237 | |
| 238 | 238 | if ($snear != '' || $gd_session->get('all_near_me')) {
|
| 239 | 239 | $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
@@ -243,16 +243,16 @@ discard block |
||
| 243 | 243 | $mylon = $gd_session->get('user_lon');
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 246 | + $fields .= " , (".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | global $s; |
| 250 | 250 | if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
|
| 251 | 251 | $keywords = explode(" ", $s);
|
| 252 | 252 | |
| 253 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 254 | - foreach($keywords as $kkey=>$kword){
|
|
| 255 | - if(mb_strlen($kword, 'UTF-8')<=$klimit){
|
|
| 253 | + if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
|
|
| 254 | + foreach ($keywords as $kkey=>$kword) {
|
|
| 255 | + if (mb_strlen($kword, 'UTF-8') <= $klimit) {
|
|
| 256 | 256 | unset($keywords[$kkey]); |
| 257 | 257 | } |
| 258 | 258 | } |
@@ -270,24 +270,24 @@ discard block |
||
| 270 | 270 | $count = 0; |
| 271 | 271 | foreach ($keywords as $keyword) {
|
| 272 | 272 | $keyword = trim($keyword); |
| 273 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
| 273 | + $keyword = wp_specialchars_decode($keyword, ENT_QUOTES); |
|
| 274 | 274 | $count++; |
| 275 | 275 | if ($count < count($keywords)) {
|
| 276 | 276 | // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " "; |
| 277 | - $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) " . $key . " "; |
|
| 277 | + $gd_titlematch_part .= "( ".$wpdb->posts.".post_title LIKE '".$keyword."' OR ".$wpdb->posts.".post_title LIKE '".$keyword."%%' OR ".$wpdb->posts.".post_title LIKE '%% ".$keyword."%%' ) ".$key." "; |
|
| 278 | 278 | } else {
|
| 279 | 279 | //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' "; |
| 280 | - $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) "; |
|
| 280 | + $gd_titlematch_part .= "( ".$wpdb->posts.".post_title LIKE '".$keyword."' OR ".$wpdb->posts.".post_title LIKE '".$keyword."%%' OR ".$wpdb->posts.".post_title LIKE '%% ".$keyword."%%' ) "; |
|
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | - $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ","; |
|
| 283 | + $gd_titlematch_part .= "THEN 1 ELSE 0 END AS ".$part.","; |
|
| 284 | 284 | } |
| 285 | 285 | } else {
|
| 286 | 286 | $gd_titlematch_part = ""; |
| 287 | 287 | } |
| 288 | - $s = stripslashes_deep( $s ); |
|
| 289 | - $s = wp_specialchars_decode($s,ENT_QUOTES); |
|
| 290 | - $fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN ( " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s . '%', '% ' . $s . '%', $s, $s . ' %', '% ' . $s . ' %', '% ' . $s));
|
|
| 288 | + $s = stripslashes_deep($s); |
|
| 289 | + $s = wp_specialchars_decode($s, ENT_QUOTES); |
|
| 290 | + $fields .= $wpdb->prepare(", CASE WHEN ".$table.".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN ".$wpdb->posts.".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle,".$gd_titlematch_part." CASE WHEN ( ".$wpdb->posts.".post_title LIKE %s OR ".$wpdb->posts.".post_title LIKE %s OR ".$wpdb->posts.".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s.'%', '% '.$s.'%', $s, $s.' %', '% '.$s.' %', '% '.$s));
|
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | return $fields; |
@@ -316,13 +316,13 @@ discard block |
||
| 316 | 316 | $lang_code = ICL_LANGUAGE_CODE; |
| 317 | 317 | $default_lang_code = $sitepress->get_default_language(); |
| 318 | 318 | if ($lang_code) {
|
| 319 | - $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID"; |
|
| 319 | + $join .= "JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID"; |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | } |
| 323 | 323 | ########### WPML ########### |
| 324 | 324 | |
| 325 | - $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID) ";
|
|
| 325 | + $join .= " INNER JOIN ".$table." ON (".$table.".post_id = $wpdb->posts.ID) ";
|
|
| 326 | 326 | //===old code start |
| 327 | 327 | //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id) " ;//===old code end
|
| 328 | 328 | |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | $sort_by = 'az'; |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | - if ($snear != '' && $sort_by!='farthest') {
|
|
| 394 | + if ($snear != '' && $sort_by != 'farthest') {
|
|
| 395 | 395 | $sort_by = 'nearest'; |
| 396 | 396 | } |
| 397 | 397 | } |
@@ -405,20 +405,20 @@ discard block |
||
| 405 | 405 | break; |
| 406 | 406 | case 'low_review': |
| 407 | 407 | case 'rating_count_asc': |
| 408 | - $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, "; |
|
| 408 | + $orderby = $table.".rating_count ASC, ".$table.".overall_rating ASC, "; |
|
| 409 | 409 | break; |
| 410 | 410 | case 'high_review': |
| 411 | 411 | case 'rating_count_desc': |
| 412 | - $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, "; |
|
| 412 | + $orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, "; |
|
| 413 | 413 | break; |
| 414 | 414 | case 'low_rating': |
| 415 | - $orderby = "( " . $table . ".overall_rating ) ASC, " . $table . ".rating_count ASC, "; |
|
| 415 | + $orderby = "( ".$table.".overall_rating ) ASC, ".$table.".rating_count ASC, "; |
|
| 416 | 416 | break; |
| 417 | 417 | case 'high_rating': |
| 418 | - $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
| 418 | + $orderby = " ".$table.".overall_rating DESC, ".$table.".rating_count DESC, "; |
|
| 419 | 419 | break; |
| 420 | 420 | case 'featured': |
| 421 | - $orderby = $table . ".is_featured asc, "; |
|
| 421 | + $orderby = $table.".is_featured asc, "; |
|
| 422 | 422 | break; |
| 423 | 423 | case 'nearest': |
| 424 | 424 | $orderby = " distance asc, "; |
@@ -434,10 +434,10 @@ discard block |
||
| 434 | 434 | break; |
| 435 | 435 | // sort by rating |
| 436 | 436 | case 'overall_rating_desc': |
| 437 | - $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
| 437 | + $orderby = " ".$table.".overall_rating DESC, ".$table.".rating_count DESC, "; |
|
| 438 | 438 | break; |
| 439 | 439 | case 'overall_rating_asc': |
| 440 | - $orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, "; |
|
| 440 | + $orderby = " ".$table.".overall_rating ASC, ".$table.".rating_count ASC, "; |
|
| 441 | 441 | break; |
| 442 | 442 | default: |
| 443 | 443 | |
@@ -458,24 +458,24 @@ discard block |
||
| 458 | 458 | |
| 459 | 459 | if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
|
| 460 | 460 | $keywords = explode(" ", $s);
|
| 461 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 462 | - foreach($keywords as $kkey=>$kword){
|
|
| 463 | - if(mb_strlen($kword, 'UTF-8')<=$klimit){
|
|
| 461 | + if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
|
|
| 462 | + foreach ($keywords as $kkey=>$kword) {
|
|
| 463 | + if (mb_strlen($kword, 'UTF-8') <= $klimit) {
|
|
| 464 | 464 | unset($keywords[$kkey]); |
| 465 | 465 | } |
| 466 | 466 | } |
| 467 | 467 | } |
| 468 | 468 | if ($sort_by == 'nearest' || $sort_by == 'farthest') {
|
| 469 | 469 | if (count($keywords) > 1) {
|
| 470 | - $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, "; |
|
| 470 | + $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, "; |
|
| 471 | 471 | } else {
|
| 472 | - $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, "; |
|
| 472 | + $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, "; |
|
| 473 | 473 | } |
| 474 | 474 | } else {
|
| 475 | 475 | if (count($keywords) > 1) {
|
| 476 | - $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby; |
|
| 476 | + $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ".$orderby; |
|
| 477 | 477 | } else {
|
| 478 | - $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby; |
|
| 478 | + $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ".$orderby; |
|
| 479 | 479 | } |
| 480 | 480 | } |
| 481 | 481 | } |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | */ |
| 491 | 491 | $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
|
| 492 | 492 | |
| 493 | - $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title "; |
|
| 493 | + $orderby .= $table.".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title "; |
|
| 494 | 494 | |
| 495 | 495 | return $orderby; |
| 496 | 496 | } |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | |
| 513 | 513 | global $wpdb; |
| 514 | 514 | |
| 515 | - if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' || $_REQUEST['s']==' ') ) )) {
|
|
| 515 | + if ($sort_by != '' && (!is_search() || (isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear'] == '' && ($_REQUEST['s'] == '' || $_REQUEST['s'] == ' ')))) {
|
|
| 516 | 516 | |
| 517 | 517 | $sort_array = explode('_', $sort_by);
|
| 518 | 518 | |
@@ -522,31 +522,31 @@ discard block |
||
| 522 | 522 | |
| 523 | 523 | if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
|
| 524 | 524 | |
| 525 | - $sort_by = str_replace('_' . $order, '', $sort_by);
|
|
| 525 | + $sort_by = str_replace('_'.$order, '', $sort_by);
|
|
| 526 | 526 | |
| 527 | 527 | switch ($sort_by): |
| 528 | 528 | |
| 529 | 529 | case 'post_date': |
| 530 | 530 | case 'comment_count': |
| 531 | 531 | |
| 532 | - $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", "; |
|
| 532 | + $orderby = "$wpdb->posts.".$sort_by." ".$order.", ".$table.".overall_rating ".$order.", "; |
|
| 533 | 533 | break; |
| 534 | 534 | |
| 535 | 535 | case 'distance': |
| 536 | - $orderby = $sort_by . " " . $order . ", "; |
|
| 536 | + $orderby = $sort_by." ".$order.", "; |
|
| 537 | 537 | break; |
| 538 | 538 | |
| 539 | 539 | |
| 540 | 540 | // sort by rating |
| 541 | 541 | case 'overall_rating': |
| 542 | - $orderby = " " . $table . "." . $sort_by . " " . $order . ", " . $table . ".rating_count " . $order . ", "; |
|
| 542 | + $orderby = " ".$table.".".$sort_by." ".$order.", ".$table.".rating_count ".$order.", "; |
|
| 543 | 543 | |
| 544 | 544 | break; |
| 545 | 545 | |
| 546 | 546 | |
| 547 | 547 | default: |
| 548 | 548 | if (geodir_column_exist($table, $sort_by)) {
|
| 549 | - $orderby = $table . "." . $sort_by . " " . $order . ", "; |
|
| 549 | + $orderby = $table.".".$sort_by." ".$order.", "; |
|
| 550 | 550 | } |
| 551 | 551 | break; |
| 552 | 552 | |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | } |
| 595 | 595 | |
| 596 | 596 | //if (!geodir_is_page('detail'))
|
| 597 | - add_filter('posts_where', 'geodir_default_where', 1);/**/
|
|
| 597 | + add_filter('posts_where', 'geodir_default_where', 1); /**/
|
|
| 598 | 598 | |
| 599 | 599 | //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts |
| 600 | 600 | |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : ''; |
| 666 | 666 | //echo '##########'.$q_post_type; |
| 667 | 667 | if ($lang_code && $q_post_type) {
|
| 668 | - $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
|
|
| 668 | + $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_".$q_post_type."') ";
|
|
| 669 | 669 | //$where .= " AND icl_t.language_code = '$lang_code' "; |
| 670 | 670 | } |
| 671 | 671 | |
@@ -732,8 +732,8 @@ discard block |
||
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | $s = trim($s); |
| 735 | - $s = wp_specialchars_decode($s ,ENT_QUOTES); |
|
| 736 | - $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES); |
|
| 735 | + $s = wp_specialchars_decode($s, ENT_QUOTES); |
|
| 736 | + $s_A = wp_specialchars_decode($s_A, ENT_QUOTES); |
|
| 737 | 737 | |
| 738 | 738 | $where = ''; |
| 739 | 739 | $better_search_terms = ''; |
@@ -744,9 +744,9 @@ discard block |
||
| 744 | 744 | |
| 745 | 745 | if ($s != '') {
|
| 746 | 746 | $keywords = explode(" ", $s);
|
| 747 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
|
|
| 748 | - foreach($keywords as $kkey=>$kword){
|
|
| 749 | - if(mb_strlen($kword, 'UTF-8')<=$klimit){
|
|
| 747 | + if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
|
|
| 748 | + foreach ($keywords as $kkey=>$kword) {
|
|
| 749 | + if (mb_strlen($kword, 'UTF-8') <= $klimit) {
|
|
| 750 | 750 | unset($keywords[$kkey]); |
| 751 | 751 | } |
| 752 | 752 | } |
@@ -755,7 +755,7 @@ discard block |
||
| 755 | 755 | if (!empty($keywords)) {
|
| 756 | 756 | foreach ($keywords as $keyword) {
|
| 757 | 757 | $keyword = trim($keyword); |
| 758 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
| 758 | + $keyword = wp_specialchars_decode($keyword, ENT_QUOTES); |
|
| 759 | 759 | if ($keyword != '') {
|
| 760 | 760 | /** |
| 761 | 761 | * Filter the search query keywords SQL. |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | * @param array $keywords The array of keywords for the query. |
| 767 | 767 | * @param string $keyword The single keyword being searched. |
| 768 | 768 | */ |
| 769 | - $better_search_terms .= apply_filters("geodir_search_better_search_terms",' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )',$keywords,$keyword);
|
|
| 769 | + $better_search_terms .= apply_filters("geodir_search_better_search_terms", ' OR ( '.$wpdb->posts.'.post_title LIKE "'.$keyword.'" OR '.$wpdb->posts.'.post_title LIKE "'.$keyword.'%" OR '.$wpdb->posts.'.post_title LIKE "% '.$keyword.'%" )', $keywords, $keyword);
|
|
| 770 | 770 | } |
| 771 | 771 | } |
| 772 | 772 | } |
@@ -774,10 +774,10 @@ discard block |
||
| 774 | 774 | |
| 775 | 775 | /* get taxonomy */ |
| 776 | 776 | $taxonomies = geodir_get_taxonomies($post_types, true); |
| 777 | - if($taxonomies) {
|
|
| 777 | + if ($taxonomies) {
|
|
| 778 | 778 | $taxonomies = implode("','", $taxonomies);
|
| 779 | - $taxonomies = "'" . $taxonomies . "'"; |
|
| 780 | - }else{$taxonomies='';}
|
|
| 779 | + $taxonomies = "'".$taxonomies."'"; |
|
| 780 | + } else {$taxonomies = ''; }
|
|
| 781 | 781 | |
| 782 | 782 | $content_where = $terms_where = ''; |
| 783 | 783 | if ($s != '') {
|
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | * @package GeoDirectory |
| 789 | 789 | * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`. |
| 790 | 790 | */ |
| 791 | - $content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
|
|
| 791 | + $content_where = apply_filters("geodir_search_content_where", " OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
|
|
| 792 | 792 | /** |
| 793 | 793 | * Filter the search query term values. |
| 794 | 794 | * |
@@ -796,7 +796,7 @@ discard block |
||
| 796 | 796 | * @package GeoDirectory |
| 797 | 797 | * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`. |
| 798 | 798 | */ |
| 799 | - $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
|
|
| 799 | + $terms_where = apply_filters("geodir_search_terms_where", " AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
|
|
| 800 | 800 | } |
| 801 | 801 | |
| 802 | 802 | if ($snear != '') {
|
@@ -831,12 +831,12 @@ discard block |
||
| 831 | 831 | ) |
| 832 | 832 | AND $wpdb->posts.post_type in ('{$post_types}')
|
| 833 | 833 | AND ($wpdb->posts.post_status = 'publish') |
| 834 | - AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 ) |
|
| 835 | - AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) "; |
|
| 834 | + AND ( ".$table.".post_latitude between $rlat1 and $rlat2 ) |
|
| 835 | + AND ( ".$table.".post_longitude between $rlon1 and $rlon2 ) "; |
|
| 836 | 836 | |
| 837 | 837 | if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
|
| 838 | 838 | $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
| 839 | - $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist;
|
|
| 839 | + $where .= " AND CONVERT((".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= ".$dist;
|
|
| 840 | 840 | } |
| 841 | 841 | |
| 842 | 842 | } else {
|
@@ -857,11 +857,11 @@ discard block |
||
| 857 | 857 | } |
| 858 | 858 | |
| 859 | 859 | ########### WPML ########### |
| 860 | - if ( function_exists( 'icl_object_id' ) ) {
|
|
| 860 | + if (function_exists('icl_object_id')) {
|
|
| 861 | 861 | $lang_code = ICL_LANGUAGE_CODE; |
| 862 | 862 | |
| 863 | 863 | if ($lang_code && $post_types) {
|
| 864 | - $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
|
|
| 864 | + $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_".$post_types."') ";
|
|
| 865 | 865 | } |
| 866 | 866 | } |
| 867 | 867 | ########### WPML ########### |
@@ -884,10 +884,10 @@ discard block |
||
| 884 | 884 | global $wpdb, $geodir_post_type, $table, $curr; |
| 885 | 885 | |
| 886 | 886 | $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
|
| 887 | - $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0; |
|
| 887 | + $user_id = !empty($curauth->ID) ? (int) $curauth->ID : 0; |
|
| 888 | 888 | |
| 889 | 889 | if (isset($_REQUEST['stype'])) {
|
| 890 | - $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
|
|
| 890 | + $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ", $_REQUEST['stype']);
|
|
| 891 | 891 | } else {
|
| 892 | 892 | $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
|
| 893 | 893 | } |
@@ -900,7 +900,7 @@ discard block |
||
| 900 | 900 | } else |
| 901 | 901 | $where .= " AND $wpdb->posts.post_author = $user_id"; |
| 902 | 902 | |
| 903 | - if ($user_id == (int)get_current_user_id()) {
|
|
| 903 | + if ($user_id == (int) get_current_user_id()) {
|
|
| 904 | 904 | $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
|
| 905 | 905 | } else {
|
| 906 | 906 | $where .= " AND $wpdb->posts.post_status = 'publish' "; |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | if (function_exists('icl_object_id')) {
|
| 914 | 914 | $lang_code = ICL_LANGUAGE_CODE; |
| 915 | 915 | if ($lang_code) {
|
| 916 | - $where .= " AND icl_t.language_code='" . $lang_code . "' "; |
|
| 916 | + $where .= " AND icl_t.language_code='".$lang_code."' "; |
|
| 917 | 917 | } |
| 918 | 918 | |
| 919 | 919 | } |
@@ -936,7 +936,7 @@ discard block |
||
| 936 | 936 | {
|
| 937 | 937 | global $wp_query, $table; |
| 938 | 938 | if (!empty($wp_query->query['with_pics_only'])) {
|
| 939 | - $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
| 939 | + $join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )"; |
|
| 940 | 940 | } |
| 941 | 941 | return $join; |
| 942 | 942 | } |
@@ -955,16 +955,16 @@ discard block |
||
| 955 | 955 | {
|
| 956 | 956 | global $wp_query, $table; |
| 957 | 957 | if (!empty($wp_query->query['show_featured_only'])) {
|
| 958 | - $where .= " AND " . $table . ".is_featured = '1'"; |
|
| 958 | + $where .= " AND ".$table.".is_featured = '1'"; |
|
| 959 | 959 | } |
| 960 | 960 | if (!empty($wp_query->query['show_special_only'])) {
|
| 961 | - $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
| 961 | + $where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )"; |
|
| 962 | 962 | } |
| 963 | 963 | if (!empty($wp_query->query['with_pics_only'])) {
|
| 964 | - $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id"; |
|
| 964 | + $where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL GROUP BY ".$table.".post_id"; |
|
| 965 | 965 | } |
| 966 | 966 | if (!empty($wp_query->query['with_videos_only'])) {
|
| 967 | - $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
| 967 | + $where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )"; |
|
| 968 | 968 | } |
| 969 | 969 | return $where; |
| 970 | 970 | } |
@@ -973,18 +973,18 @@ discard block |
||
| 973 | 973 | function geodir_related_posts_fields($fields) {
|
| 974 | 974 | global $wp_query, $wpdb, $table, $post; |
| 975 | 975 | |
| 976 | - $fields .= ", " . $table . ".* "; |
|
| 976 | + $fields .= ", ".$table.".* "; |
|
| 977 | 977 | |
| 978 | 978 | $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
|
| 979 | 979 | |
| 980 | 980 | $mylat = $post->post_latitude; |
| 981 | 981 | $mylon = $post->post_longitude; |
| 982 | 982 | |
| 983 | - $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 983 | + $fields .= " , (".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) )))as distance ";
|
|
| 984 | 984 | return $fields; |
| 985 | 985 | } |
| 986 | 986 | function geodir_related_posts_fields_filter($query) {
|
| 987 | - if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
| 987 | + if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
| 988 | 988 | && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest' |
| 989 | 989 | && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings'] |
| 990 | 990 | ) {
|
@@ -61,11 +61,12 @@ discard block |
||
| 61 | 61 | function geodir_is_default_location_set() |
| 62 | 62 | {
|
| 63 | 63 | $default_location = geodir_get_default_location(); |
| 64 | - if (!empty($default_location)) |
|
| 65 | - return true; |
|
| 66 | - else |
|
| 67 | - return false; |
|
| 68 | -} |
|
| 64 | + if (!empty($default_location)) { |
|
| 65 | + return true; |
|
| 66 | + } else { |
|
| 67 | + return false; |
|
| 68 | + } |
|
| 69 | + } |
|
| 69 | 70 | |
| 70 | 71 | /** |
| 71 | 72 | * Returns location slug using location string. |
@@ -259,8 +260,9 @@ discard block |
||
| 259 | 260 | } |
| 260 | 261 | */ |
| 261 | 262 | |
| 262 | - if ($geodir_location->is_default) |
|
| 263 | - update_option('geodir_default_location', $geodir_location);
|
|
| 263 | + if ($geodir_location->is_default) { |
|
| 264 | + update_option('geodir_default_location', $geodir_location); |
|
| 265 | + } |
|
| 264 | 266 | |
| 265 | 267 | return $geodir_location->location_id; |
| 266 | 268 | |
@@ -308,9 +310,10 @@ discard block |
||
| 308 | 310 | $status = $data->status; |
| 309 | 311 | if ($status == "OK") {
|
| 310 | 312 | return $data->results[0]->address_components; |
| 311 | - } else |
|
| 312 | - return false; |
|
| 313 | -} |
|
| 313 | + } else { |
|
| 314 | + return false; |
|
| 315 | + } |
|
| 316 | + } |
|
| 314 | 317 | |
| 315 | 318 | /** |
| 316 | 319 | * Returns current location terms. |
@@ -334,16 +337,19 @@ discard block |
||
| 334 | 337 | } |
| 335 | 338 | |
| 336 | 339 | $country = $gd_session->get('gd_country');
|
| 337 | - if ($country != '' && $country) |
|
| 338 | - $location_array['gd_country'] = urldecode($country); |
|
| 340 | + if ($country != '' && $country) { |
|
| 341 | + $location_array['gd_country'] = urldecode($country); |
|
| 342 | + } |
|
| 339 | 343 | |
| 340 | 344 | $region = $gd_session->get('gd_region');
|
| 341 | - if ($region != '' && $region) |
|
| 342 | - $location_array['gd_region'] = urldecode($region); |
|
| 345 | + if ($region != '' && $region) { |
|
| 346 | + $location_array['gd_region'] = urldecode($region); |
|
| 347 | + } |
|
| 343 | 348 | |
| 344 | 349 | $city = $gd_session->get('gd_city');
|
| 345 | - if ($city != '' && $city) |
|
| 346 | - $location_array['gd_city'] = urldecode($city); |
|
| 350 | + if ($city != '' && $city) { |
|
| 351 | + $location_array['gd_city'] = urldecode($city); |
|
| 352 | + } |
|
| 347 | 353 | } else {
|
| 348 | 354 | if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) {
|
| 349 | 355 | return $location_array; |
@@ -355,14 +361,17 @@ discard block |
||
| 355 | 361 | |
| 356 | 362 | $city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : ''; |
| 357 | 363 | |
| 358 | - if ($country != '') |
|
| 359 | - $location_array['gd_country'] = urldecode($country); |
|
| 364 | + if ($country != '') { |
|
| 365 | + $location_array['gd_country'] = urldecode($country); |
|
| 366 | + } |
|
| 360 | 367 | |
| 361 | - if ($region != '') |
|
| 362 | - $location_array['gd_region'] = urldecode($region); |
|
| 368 | + if ($region != '') { |
|
| 369 | + $location_array['gd_region'] = urldecode($region); |
|
| 370 | + } |
|
| 363 | 371 | |
| 364 | - if ($city != '') |
|
| 365 | - $location_array['gd_city'] = urldecode($city); |
|
| 372 | + if ($city != '') { |
|
| 373 | + $location_array['gd_city'] = urldecode($city); |
|
| 374 | + } |
|
| 366 | 375 | |
| 367 | 376 | // Fix category link in ajax popular category widget on change post type |
| 368 | 377 | if (empty($location_array) && defined('DOING_AJAX') && DOING_AJAX) {
|
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @since 1.0.0 |
| 38 | 38 | * @package GeoDirectory |
| 39 | - * @return object |
|
| 39 | + * @return string |
|
| 40 | 40 | */ |
| 41 | 41 | function geodir_get_default_location() |
| 42 | 42 | {
|
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | * @package GeoDirectory |
| 277 | 277 | * @param int $min The minimum number. Default: 0. |
| 278 | 278 | * @param int $max The maximum number. Default: 1. |
| 279 | - * @return float |
|
| 279 | + * @return integer |
|
| 280 | 280 | */ |
| 281 | 281 | function geodir_random_float($min = 0, $max = 1) |
| 282 | 282 | {
|
@@ -594,6 +594,9 @@ discard block |
||
| 594 | 594 | add_filter('geodir_replace_location_variables', 'geodir_replace_location_variables');
|
| 595 | 595 | |
| 596 | 596 | |
| 597 | +/** |
|
| 598 | + * @param string $sep |
|
| 599 | + */ |
|
| 597 | 600 | function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = ''){
|
| 598 | 601 | |
| 599 | 602 | global $wp; |
@@ -9,10 +9,10 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | function geodir_get_current_city_lat() |
| 11 | 11 | {
|
| 12 | - $location = geodir_get_default_location(); |
|
| 13 | - $lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '39.952484'; |
|
| 12 | + $location = geodir_get_default_location(); |
|
| 13 | + $lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '39.952484'; |
|
| 14 | 14 | |
| 15 | - return $lat; |
|
| 15 | + return $lat; |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | /** |
@@ -25,9 +25,9 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function geodir_get_current_city_lng() |
| 27 | 27 | {
|
| 28 | - $location = geodir_get_default_location(); |
|
| 29 | - $lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '-75.163786'; |
|
| 30 | - return $lng; |
|
| 28 | + $location = geodir_get_default_location(); |
|
| 29 | + $lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '-75.163786'; |
|
| 30 | + return $lng; |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
@@ -40,15 +40,15 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | function geodir_get_default_location() |
| 42 | 42 | {
|
| 43 | - /** |
|
| 44 | - * Filter the default location. |
|
| 45 | - * |
|
| 46 | - * @since 1.0.0 |
|
| 47 | - * @package GeoDirectory |
|
| 48 | - * |
|
| 49 | - * @param string $location_result The default location object. |
|
| 50 | - */ |
|
| 51 | - return $location_result = apply_filters('geodir_get_default_location', get_option('geodir_default_location'));
|
|
| 43 | + /** |
|
| 44 | + * Filter the default location. |
|
| 45 | + * |
|
| 46 | + * @since 1.0.0 |
|
| 47 | + * @package GeoDirectory |
|
| 48 | + * |
|
| 49 | + * @param string $location_result The default location object. |
|
| 50 | + */ |
|
| 51 | + return $location_result = apply_filters('geodir_get_default_location', get_option('geodir_default_location'));
|
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -60,11 +60,11 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | function geodir_is_default_location_set() |
| 62 | 62 | {
|
| 63 | - $default_location = geodir_get_default_location(); |
|
| 64 | - if (!empty($default_location)) |
|
| 65 | - return true; |
|
| 66 | - else |
|
| 67 | - return false; |
|
| 63 | + $default_location = geodir_get_default_location(); |
|
| 64 | + if (!empty($default_location)) |
|
| 65 | + return true; |
|
| 66 | + else |
|
| 67 | + return false; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -78,15 +78,15 @@ discard block |
||
| 78 | 78 | function create_location_slug($location_string) |
| 79 | 79 | {
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Filter the location slug. |
|
| 83 | - * |
|
| 84 | - * @since 1.0.0 |
|
| 85 | - * @package GeoDirectory |
|
| 86 | - * |
|
| 87 | - * @param string $location_string Sanitized location string. |
|
| 88 | - */ |
|
| 89 | - return urldecode(apply_filters('geodir_location_slug_check', sanitize_title($location_string)));
|
|
| 81 | + /** |
|
| 82 | + * Filter the location slug. |
|
| 83 | + * |
|
| 84 | + * @since 1.0.0 |
|
| 85 | + * @package GeoDirectory |
|
| 86 | + * |
|
| 87 | + * @param string $location_string Sanitized location string. |
|
| 88 | + */ |
|
| 89 | + return urldecode(apply_filters('geodir_location_slug_check', sanitize_title($location_string)));
|
|
| 90 | 90 | |
| 91 | 91 | } |
| 92 | 92 | |
@@ -100,15 +100,15 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | function geodir_get_location($id = '') |
| 102 | 102 | {
|
| 103 | - /** |
|
| 104 | - * Filter the location information. |
|
| 105 | - * |
|
| 106 | - * @since 1.0.0 |
|
| 107 | - * @package GeoDirectory |
|
| 108 | - * |
|
| 109 | - * @param string $id The location ID. |
|
| 110 | - */ |
|
| 111 | - return $location_result = apply_filters('geodir_get_location_by_id', get_option('geodir_default_location'), $id);
|
|
| 103 | + /** |
|
| 104 | + * Filter the location information. |
|
| 105 | + * |
|
| 106 | + * @since 1.0.0 |
|
| 107 | + * @package GeoDirectory |
|
| 108 | + * |
|
| 109 | + * @param string $id The location ID. |
|
| 110 | + */ |
|
| 111 | + return $location_result = apply_filters('geodir_get_location_by_id', get_option('geodir_default_location'), $id);
|
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -122,28 +122,28 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | function geodir_get_country_dl($post_country = '', $prefix = '') |
| 124 | 124 | {
|
| 125 | - global $wpdb; |
|
| 125 | + global $wpdb; |
|
| 126 | 126 | |
| 127 | - $rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC");
|
|
| 127 | + $rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC");
|
|
| 128 | 128 | |
| 129 | - $ISO2 = array(); |
|
| 130 | - $countries = array(); |
|
| 129 | + $ISO2 = array(); |
|
| 130 | + $countries = array(); |
|
| 131 | 131 | |
| 132 | - foreach ($rows as $row) {
|
|
| 133 | - $ISO2[$row->Country] = $row->ISO2; |
|
| 134 | - $countries[$row->Country] = __($row->Country, 'geodirectory'); |
|
| 135 | - } |
|
| 132 | + foreach ($rows as $row) {
|
|
| 133 | + $ISO2[$row->Country] = $row->ISO2; |
|
| 134 | + $countries[$row->Country] = __($row->Country, 'geodirectory'); |
|
| 135 | + } |
|
| 136 | 136 | |
| 137 | - asort($countries); |
|
| 137 | + asort($countries); |
|
| 138 | 138 | |
| 139 | - $out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
|
|
| 140 | - foreach ($countries as $country => $name) {
|
|
| 141 | - $ccode = $ISO2[$country]; |
|
| 139 | + $out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
|
|
| 140 | + foreach ($countries as $country => $name) {
|
|
| 141 | + $ccode = $ISO2[$country]; |
|
| 142 | 142 | |
| 143 | - $out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>'; |
|
| 144 | - } |
|
| 143 | + $out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>'; |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | - echo $out_put; |
|
| 146 | + echo $out_put; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | |
@@ -158,40 +158,40 @@ discard block |
||
| 158 | 158 | function geodir_location_form_submit() |
| 159 | 159 | {
|
| 160 | 160 | |
| 161 | - global $wpdb, $plugin_prefix; |
|
| 162 | - if (isset($_REQUEST['add_location'])) {
|
|
| 161 | + global $wpdb, $plugin_prefix; |
|
| 162 | + if (isset($_REQUEST['add_location'])) {
|
|
| 163 | 163 | |
| 164 | - $location_info = array( |
|
| 165 | - 'city' => $_REQUEST['city'], |
|
| 166 | - 'region' => $_REQUEST['region'], |
|
| 167 | - 'country' => $_REQUEST['country'], |
|
| 168 | - 'geo_lat' => $_REQUEST['latitude'], |
|
| 169 | - 'geo_lng' => $_REQUEST['longitude'], |
|
| 170 | - 'is_default' => $_REQUEST['is_default'], |
|
| 171 | - 'update_city' => $_REQUEST['update_city'] |
|
| 172 | - ); |
|
| 164 | + $location_info = array( |
|
| 165 | + 'city' => $_REQUEST['city'], |
|
| 166 | + 'region' => $_REQUEST['region'], |
|
| 167 | + 'country' => $_REQUEST['country'], |
|
| 168 | + 'geo_lat' => $_REQUEST['latitude'], |
|
| 169 | + 'geo_lng' => $_REQUEST['longitude'], |
|
| 170 | + 'is_default' => $_REQUEST['is_default'], |
|
| 171 | + 'update_city' => $_REQUEST['update_city'] |
|
| 172 | + ); |
|
| 173 | 173 | |
| 174 | - $old_location = geodir_get_default_location(); |
|
| 174 | + $old_location = geodir_get_default_location(); |
|
| 175 | 175 | |
| 176 | - $locationid = geodir_add_new_location($location_info); |
|
| 176 | + $locationid = geodir_add_new_location($location_info); |
|
| 177 | 177 | |
| 178 | - $default_location = geodir_get_location($locationid); |
|
| 178 | + $default_location = geodir_get_location($locationid); |
|
| 179 | 179 | |
| 180 | - //UPDATE AND DELETE LISTING |
|
| 181 | - $posttype = geodir_get_posttypes(); |
|
| 182 | - if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
|
|
| 180 | + //UPDATE AND DELETE LISTING |
|
| 181 | + $posttype = geodir_get_posttypes(); |
|
| 182 | + if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
|
|
| 183 | 183 | |
| 184 | - foreach ($posttype as $posttypeobj) {
|
|
| 185 | - $post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location |
|
| 184 | + foreach ($posttype as $posttypeobj) {
|
|
| 185 | + $post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location |
|
| 186 | 186 | |
| 187 | - $sql = $wpdb->prepare( |
|
| 188 | - "UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)", |
|
| 189 | - array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations) |
|
| 190 | - ); |
|
| 191 | - $wpdb->query($sql); |
|
| 192 | - } |
|
| 193 | - } |
|
| 194 | - } |
|
| 187 | + $sql = $wpdb->prepare( |
|
| 188 | + "UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)", |
|
| 189 | + array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations) |
|
| 190 | + ); |
|
| 191 | + $wpdb->query($sql); |
|
| 192 | + } |
|
| 193 | + } |
|
| 194 | + } |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /** |
@@ -215,37 +215,37 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | function geodir_add_new_location($location_info = array()) |
| 217 | 217 | {
|
| 218 | - global $wpdb; |
|
| 219 | - |
|
| 220 | - if (!empty($location_info)) {
|
|
| 221 | - $location_city = ($location_info['city'] != '') ? $location_info['city'] : 'all'; |
|
| 222 | - $location_region = ($location_info['region'] != '') ? $location_info['region'] : 'all'; |
|
| 223 | - $location_country = ($location_info['country'] != '') ? geodir_get_normal_country($location_info['country']) : 'all'; |
|
| 224 | - $location_lat = ($location_info['geo_lat'] != '') ? $location_info['geo_lat'] : ''; |
|
| 225 | - $location_lng = ($location_info['geo_lng'] != '') ? $location_info['geo_lng'] : ''; |
|
| 226 | - $is_default = isset($location_info['is_default']) ? $location_info['is_default'] : ''; |
|
| 227 | - $country_slug = create_location_slug(__($location_country, 'geodirectory')); |
|
| 228 | - $region_slug = create_location_slug($location_region); |
|
| 229 | - $city_slug = create_location_slug($location_city); |
|
| 218 | + global $wpdb; |
|
| 219 | + |
|
| 220 | + if (!empty($location_info)) {
|
|
| 221 | + $location_city = ($location_info['city'] != '') ? $location_info['city'] : 'all'; |
|
| 222 | + $location_region = ($location_info['region'] != '') ? $location_info['region'] : 'all'; |
|
| 223 | + $location_country = ($location_info['country'] != '') ? geodir_get_normal_country($location_info['country']) : 'all'; |
|
| 224 | + $location_lat = ($location_info['geo_lat'] != '') ? $location_info['geo_lat'] : ''; |
|
| 225 | + $location_lng = ($location_info['geo_lng'] != '') ? $location_info['geo_lng'] : ''; |
|
| 226 | + $is_default = isset($location_info['is_default']) ? $location_info['is_default'] : ''; |
|
| 227 | + $country_slug = create_location_slug(__($location_country, 'geodirectory')); |
|
| 228 | + $region_slug = create_location_slug($location_region); |
|
| 229 | + $city_slug = create_location_slug($location_city); |
|
| 230 | 230 | |
| 231 | - /** |
|
| 232 | - * Filter add new location data. |
|
| 233 | - * |
|
| 234 | - * @since 1.0.0 |
|
| 235 | - */ |
|
| 236 | - $geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
|
|
| 237 | - 'country' => $location_country, |
|
| 238 | - 'region' => $location_region, |
|
| 239 | - 'city' => $location_city, |
|
| 240 | - 'country_slug' => $country_slug, |
|
| 241 | - 'region_slug' => $region_slug, |
|
| 242 | - 'city_slug' => $city_slug, |
|
| 243 | - 'city_latitude' => $location_lat, |
|
| 244 | - 'city_longitude' => $location_lng, |
|
| 245 | - 'is_default' => $is_default |
|
| 246 | - )); |
|
| 247 | - |
|
| 248 | - /* // Not allowed to create country in DB : 2016-12-09 |
|
| 231 | + /** |
|
| 232 | + * Filter add new location data. |
|
| 233 | + * |
|
| 234 | + * @since 1.0.0 |
|
| 235 | + */ |
|
| 236 | + $geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
|
|
| 237 | + 'country' => $location_country, |
|
| 238 | + 'region' => $location_region, |
|
| 239 | + 'city' => $location_city, |
|
| 240 | + 'country_slug' => $country_slug, |
|
| 241 | + 'region_slug' => $region_slug, |
|
| 242 | + 'city_slug' => $city_slug, |
|
| 243 | + 'city_latitude' => $location_lat, |
|
| 244 | + 'city_longitude' => $location_lng, |
|
| 245 | + 'is_default' => $is_default |
|
| 246 | + )); |
|
| 247 | + |
|
| 248 | + /* // Not allowed to create country in DB : 2016-12-09 |
|
| 249 | 249 | if ($geodir_location->country) {
|
| 250 | 250 | |
| 251 | 251 | $get_country = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s", array($geodir_location->country)));
|
@@ -259,14 +259,14 @@ discard block |
||
| 259 | 259 | } |
| 260 | 260 | */ |
| 261 | 261 | |
| 262 | - if ($geodir_location->is_default) |
|
| 263 | - update_option('geodir_default_location', $geodir_location);
|
|
| 262 | + if ($geodir_location->is_default) |
|
| 263 | + update_option('geodir_default_location', $geodir_location);
|
|
| 264 | 264 | |
| 265 | - return $geodir_location->location_id; |
|
| 265 | + return $geodir_location->location_id; |
|
| 266 | 266 | |
| 267 | - } else {
|
|
| 268 | - return false; |
|
| 269 | - } |
|
| 267 | + } else {
|
|
| 268 | + return false; |
|
| 269 | + } |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /** |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | */ |
| 281 | 281 | function geodir_random_float($min = 0, $max = 1) |
| 282 | 282 | {
|
| 283 | - return $min + mt_rand() / mt_getrandmax() * ($max - $min); |
|
| 283 | + return $min + mt_rand() / mt_getrandmax() * ($max - $min); |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | /** |
@@ -294,22 +294,22 @@ discard block |
||
| 294 | 294 | */ |
| 295 | 295 | function geodir_get_address_by_lat_lan($lat, $lng) |
| 296 | 296 | {
|
| 297 | - $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ; |
|
| 298 | - |
|
| 299 | - $ch = curl_init(); |
|
| 300 | - curl_setopt($ch, CURLOPT_URL, $url); |
|
| 301 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
| 302 | - curl_setopt($ch, CURLOPT_PROXYPORT, 3128); |
|
| 303 | - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); |
|
| 304 | - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); |
|
| 305 | - $response = curl_exec($ch); |
|
| 306 | - curl_close($ch); |
|
| 307 | - $data = json_decode($response); |
|
| 308 | - $status = $data->status; |
|
| 309 | - if ($status == "OK") {
|
|
| 310 | - return $data->results[0]->address_components; |
|
| 311 | - } else |
|
| 312 | - return false; |
|
| 297 | + $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ; |
|
| 298 | + |
|
| 299 | + $ch = curl_init(); |
|
| 300 | + curl_setopt($ch, CURLOPT_URL, $url); |
|
| 301 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
| 302 | + curl_setopt($ch, CURLOPT_PROXYPORT, 3128); |
|
| 303 | + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); |
|
| 304 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); |
|
| 305 | + $response = curl_exec($ch); |
|
| 306 | + curl_close($ch); |
|
| 307 | + $data = json_decode($response); |
|
| 308 | + $status = $data->status; |
|
| 309 | + if ($status == "OK") {
|
|
| 310 | + return $data->results[0]->address_components; |
|
| 311 | + } else |
|
| 312 | + return false; |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /** |
@@ -326,70 +326,70 @@ discard block |
||
| 326 | 326 | */ |
| 327 | 327 | function geodir_get_current_location_terms($location_array_from = 'session', $gd_post_type = '') |
| 328 | 328 | {
|
| 329 | - global $wp, $gd_session; |
|
| 330 | - $location_array = array(); |
|
| 331 | - if ($location_array_from == 'session') {
|
|
| 332 | - if ($gd_session->get('gd_country') == 'me' || $gd_session->get('gd_region') == 'me' || $gd_session->get('gd_city') == 'me') {
|
|
| 333 | - return $location_array; |
|
| 334 | - } |
|
| 329 | + global $wp, $gd_session; |
|
| 330 | + $location_array = array(); |
|
| 331 | + if ($location_array_from == 'session') {
|
|
| 332 | + if ($gd_session->get('gd_country') == 'me' || $gd_session->get('gd_region') == 'me' || $gd_session->get('gd_city') == 'me') {
|
|
| 333 | + return $location_array; |
|
| 334 | + } |
|
| 335 | 335 | |
| 336 | - $country = $gd_session->get('gd_country');
|
|
| 337 | - if ($country != '' && $country) |
|
| 338 | - $location_array['gd_country'] = urldecode($country); |
|
| 336 | + $country = $gd_session->get('gd_country');
|
|
| 337 | + if ($country != '' && $country) |
|
| 338 | + $location_array['gd_country'] = urldecode($country); |
|
| 339 | 339 | |
| 340 | - $region = $gd_session->get('gd_region');
|
|
| 341 | - if ($region != '' && $region) |
|
| 342 | - $location_array['gd_region'] = urldecode($region); |
|
| 340 | + $region = $gd_session->get('gd_region');
|
|
| 341 | + if ($region != '' && $region) |
|
| 342 | + $location_array['gd_region'] = urldecode($region); |
|
| 343 | 343 | |
| 344 | - $city = $gd_session->get('gd_city');
|
|
| 345 | - if ($city != '' && $city) |
|
| 346 | - $location_array['gd_city'] = urldecode($city); |
|
| 347 | - } else {
|
|
| 348 | - if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) {
|
|
| 349 | - return $location_array; |
|
| 350 | - } |
|
| 344 | + $city = $gd_session->get('gd_city');
|
|
| 345 | + if ($city != '' && $city) |
|
| 346 | + $location_array['gd_city'] = urldecode($city); |
|
| 347 | + } else {
|
|
| 348 | + if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) {
|
|
| 349 | + return $location_array; |
|
| 350 | + } |
|
| 351 | 351 | |
| 352 | - $country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : ''; |
|
| 352 | + $country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : ''; |
|
| 353 | 353 | |
| 354 | - $region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : ''; |
|
| 354 | + $region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : ''; |
|
| 355 | 355 | |
| 356 | - $city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : ''; |
|
| 356 | + $city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : ''; |
|
| 357 | 357 | |
| 358 | - if ($country != '') |
|
| 359 | - $location_array['gd_country'] = urldecode($country); |
|
| 358 | + if ($country != '') |
|
| 359 | + $location_array['gd_country'] = urldecode($country); |
|
| 360 | 360 | |
| 361 | - if ($region != '') |
|
| 362 | - $location_array['gd_region'] = urldecode($region); |
|
| 361 | + if ($region != '') |
|
| 362 | + $location_array['gd_region'] = urldecode($region); |
|
| 363 | 363 | |
| 364 | - if ($city != '') |
|
| 365 | - $location_array['gd_city'] = urldecode($city); |
|
| 364 | + if ($city != '') |
|
| 365 | + $location_array['gd_city'] = urldecode($city); |
|
| 366 | 366 | |
| 367 | 367 | // Fix category link in ajax popular category widget on change post type |
| 368 | 368 | if (empty($location_array) && defined('DOING_AJAX') && DOING_AJAX) {
|
| 369 | 369 | $location_array = geodir_get_current_location_terms('session');
|
| 370 | 370 | } |
| 371 | - } |
|
| 371 | + } |
|
| 372 | 372 | |
| 373 | 373 | /** |
| 374 | 374 | * Filter the location terms. |
| 375 | 375 | * |
| 376 | 376 | * @since 1.4.6 |
| 377 | - * @package GeoDirectory |
|
| 377 | + * @package GeoDirectory |
|
| 378 | + * |
|
| 379 | + * @param array $location_array {
|
|
| 380 | + * Attributes of the location_array. |
|
| 381 | + * |
|
| 382 | + * @type string $gd_country The country slug. |
|
| 383 | + * @type string $gd_region The region slug. |
|
| 384 | + * @type string $gd_city The city slug. |
|
| 378 | 385 | * |
| 379 | - * @param array $location_array {
|
|
| 380 | - * Attributes of the location_array. |
|
| 381 | - * |
|
| 382 | - * @type string $gd_country The country slug. |
|
| 383 | - * @type string $gd_region The region slug. |
|
| 384 | - * @type string $gd_city The city slug. |
|
| 385 | - * |
|
| 386 | - * } |
|
| 386 | + * } |
|
| 387 | 387 | * @param string $location_array_from Source type of location terms. Default session. |
| 388 | 388 | * @param string $gd_post_type WP post type. |
| 389 | 389 | */ |
| 390 | 390 | $location_array = apply_filters( 'geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type ); |
| 391 | 391 | |
| 392 | - return $location_array; |
|
| 392 | + return $location_array; |
|
| 393 | 393 | |
| 394 | 394 | } |
| 395 | 395 | |
@@ -402,24 +402,24 @@ discard block |
||
| 402 | 402 | * @return bool|string |
| 403 | 403 | */ |
| 404 | 404 | function geodir_get_location_link($which_location = 'current') {
|
| 405 | - $location_link = get_permalink(geodir_location_page_id()); |
|
| 406 | - |
|
| 407 | - if ($which_location == 'base') {
|
|
| 408 | - return $location_link; |
|
| 409 | - } else {
|
|
| 410 | - $location_terms = geodir_get_current_location_terms(); |
|
| 411 | - |
|
| 412 | - if (!empty($location_terms)) {
|
|
| 413 | - if (get_option('permalink_structure') != '') {
|
|
| 414 | - $location_terms = implode("/", $location_terms);
|
|
| 415 | - $location_terms = rtrim($location_terms, '/'); |
|
| 416 | - $location_link .= $location_terms; |
|
| 417 | - } else {
|
|
| 418 | - $location_link = geodir_getlink($location_link, $location_terms); |
|
| 419 | - } |
|
| 420 | - } |
|
| 421 | - } |
|
| 422 | - return $location_link; |
|
| 405 | + $location_link = get_permalink(geodir_location_page_id()); |
|
| 406 | + |
|
| 407 | + if ($which_location == 'base') {
|
|
| 408 | + return $location_link; |
|
| 409 | + } else {
|
|
| 410 | + $location_terms = geodir_get_current_location_terms(); |
|
| 411 | + |
|
| 412 | + if (!empty($location_terms)) {
|
|
| 413 | + if (get_option('permalink_structure') != '') {
|
|
| 414 | + $location_terms = implode("/", $location_terms);
|
|
| 415 | + $location_terms = rtrim($location_terms, '/'); |
|
| 416 | + $location_link .= $location_terms; |
|
| 417 | + } else {
|
|
| 418 | + $location_link = geodir_getlink($location_link, $location_terms); |
|
| 419 | + } |
|
| 420 | + } |
|
| 421 | + } |
|
| 422 | + return $location_link; |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | /** |
@@ -432,34 +432,34 @@ discard block |
||
| 432 | 432 | * @return array|bool Returns address on success. |
| 433 | 433 | */ |
| 434 | 434 | function geodir_get_osm_address_by_lat_lan($lat, $lng) {
|
| 435 | - $url = is_ssl() ? 'https:' : 'http:'; |
|
| 436 | - $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
|
|
| 437 | - |
|
| 438 | - $ch = curl_init(); |
|
| 439 | - curl_setopt($ch, CURLOPT_URL, $url); |
|
| 440 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
| 441 | - curl_setopt($ch, CURLOPT_PROXYPORT, 3128); |
|
| 442 | - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); |
|
| 443 | - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); |
|
| 444 | - $response = curl_exec($ch); |
|
| 445 | - curl_close($ch); |
|
| 446 | - $data = json_decode($response); |
|
| 435 | + $url = is_ssl() ? 'https:' : 'http:'; |
|
| 436 | + $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
|
|
| 437 | + |
|
| 438 | + $ch = curl_init(); |
|
| 439 | + curl_setopt($ch, CURLOPT_URL, $url); |
|
| 440 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
| 441 | + curl_setopt($ch, CURLOPT_PROXYPORT, 3128); |
|
| 442 | + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); |
|
| 443 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); |
|
| 444 | + $response = curl_exec($ch); |
|
| 445 | + curl_close($ch); |
|
| 446 | + $data = json_decode($response); |
|
| 447 | 447 | |
| 448 | - if (!empty($data) && !empty($data->address)) {
|
|
| 449 | - $address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
|
|
| 450 | - $formatted_address = (array)$data->address; |
|
| 448 | + if (!empty($data) && !empty($data->address)) {
|
|
| 449 | + $address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
|
|
| 450 | + $formatted_address = (array)$data->address; |
|
| 451 | 451 | |
| 452 | - foreach ( $data->address as $key => $value ) {
|
|
| 453 | - if (!in_array($key, $address_fields)) {
|
|
| 454 | - unset($formatted_address[$key]); |
|
| 455 | - } |
|
| 456 | - } |
|
| 457 | - $data->formatted_address = !empty($formatted_address) ? implode(', ', $formatted_address) : '';
|
|
| 452 | + foreach ( $data->address as $key => $value ) {
|
|
| 453 | + if (!in_array($key, $address_fields)) {
|
|
| 454 | + unset($formatted_address[$key]); |
|
| 455 | + } |
|
| 456 | + } |
|
| 457 | + $data->formatted_address = !empty($formatted_address) ? implode(', ', $formatted_address) : '';
|
|
| 458 | 458 | |
| 459 | - return $data; |
|
| 460 | - } else {
|
|
| 461 | - return false; |
|
| 462 | - } |
|
| 459 | + return $data; |
|
| 460 | + } else {
|
|
| 461 | + return false; |
|
| 462 | + } |
|
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | /** |
@@ -471,47 +471,47 @@ discard block |
||
| 471 | 471 | * @return string Returns the country. |
| 472 | 472 | */ |
| 473 | 473 | function geodir_get_normal_country($country) {
|
| 474 | - global $wpdb; |
|
| 475 | - if ($result = geodir_get_country_by_name($country)) {
|
|
| 476 | - return $result; |
|
| 477 | - } |
|
| 474 | + global $wpdb; |
|
| 475 | + if ($result = geodir_get_country_by_name($country)) {
|
|
| 476 | + return $result; |
|
| 477 | + } |
|
| 478 | 478 | |
| 479 | - if (defined('POST_LOCATION_TABLE')) {
|
|
| 480 | - $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
|
|
| 481 | - if (!empty($rows)) {
|
|
| 482 | - foreach ($rows as $row) {
|
|
| 483 | - $translated = __($row->country, 'geodirectory'); |
|
| 484 | - if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
|
|
| 485 | - return $result; |
|
| 486 | - } |
|
| 487 | - } |
|
| 488 | - } |
|
| 479 | + if (defined('POST_LOCATION_TABLE')) {
|
|
| 480 | + $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
|
|
| 481 | + if (!empty($rows)) {
|
|
| 482 | + foreach ($rows as $row) {
|
|
| 483 | + $translated = __($row->country, 'geodirectory'); |
|
| 484 | + if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
|
|
| 485 | + return $result; |
|
| 486 | + } |
|
| 487 | + } |
|
| 488 | + } |
|
| 489 | 489 | |
| 490 | - $rows = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country ) ); |
|
| 491 | - if (!empty($rows)) {
|
|
| 492 | - foreach ($rows as $row) {
|
|
| 493 | - $translated = __($row->country, 'geodirectory'); |
|
| 494 | - if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
|
|
| 495 | - return $result; |
|
| 496 | - } |
|
| 497 | - } |
|
| 498 | - } |
|
| 499 | - } |
|
| 490 | + $rows = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country ) ); |
|
| 491 | + if (!empty($rows)) {
|
|
| 492 | + foreach ($rows as $row) {
|
|
| 493 | + $translated = __($row->country, 'geodirectory'); |
|
| 494 | + if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
|
|
| 495 | + return $result; |
|
| 496 | + } |
|
| 497 | + } |
|
| 498 | + } |
|
| 499 | + } |
|
| 500 | 500 | |
| 501 | - $default_location = geodir_get_default_location(); |
|
| 502 | - if (!empty($default_location->country) && $result = geodir_get_country_by_name($default_location->country)) {
|
|
| 503 | - return $result; |
|
| 504 | - } |
|
| 501 | + $default_location = geodir_get_default_location(); |
|
| 502 | + if (!empty($default_location->country) && $result = geodir_get_country_by_name($default_location->country)) {
|
|
| 503 | + return $result; |
|
| 504 | + } |
|
| 505 | 505 | |
| 506 | - if (!empty($default_location->country_slug) && $result = geodir_get_country_by_name($default_location->country_slug)) {
|
|
| 507 | - return $result; |
|
| 508 | - } |
|
| 506 | + if (!empty($default_location->country_slug) && $result = geodir_get_country_by_name($default_location->country_slug)) {
|
|
| 507 | + return $result; |
|
| 508 | + } |
|
| 509 | 509 | |
| 510 | - if (!empty($default_location->country_ISO2) && $result = geodir_get_country_by_name($default_location->country_ISO2, true)) {
|
|
| 511 | - return $result; |
|
| 512 | - } |
|
| 510 | + if (!empty($default_location->country_ISO2) && $result = geodir_get_country_by_name($default_location->country_ISO2, true)) {
|
|
| 511 | + return $result; |
|
| 512 | + } |
|
| 513 | 513 | |
| 514 | - return $country; |
|
| 514 | + return $country; |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | /** |
@@ -523,16 +523,16 @@ discard block |
||
| 523 | 523 | * @return string Country ISO2 code. |
| 524 | 524 | */ |
| 525 | 525 | function geodir_get_country_iso2($country) {
|
| 526 | - global $wpdb; |
|
| 526 | + global $wpdb; |
|
| 527 | 527 | |
| 528 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
|
|
| 529 | - return $result; |
|
| 530 | - } |
|
| 531 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
|
|
| 532 | - return $result; |
|
| 533 | - } |
|
| 528 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
|
|
| 529 | + return $result; |
|
| 530 | + } |
|
| 531 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
|
|
| 532 | + return $result; |
|
| 533 | + } |
|
| 534 | 534 | |
| 535 | - return $country; |
|
| 535 | + return $country; |
|
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | /** |
@@ -545,16 +545,16 @@ discard block |
||
| 545 | 545 | * @return string|null Country ISO2 code. |
| 546 | 546 | */ |
| 547 | 547 | function geodir_get_country_by_name($country, $iso2 = false) {
|
| 548 | - global $wpdb; |
|
| 548 | + global $wpdb; |
|
| 549 | 549 | |
| 550 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
|
|
| 551 | - return $result; |
|
| 552 | - } |
|
| 553 | - if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
|
|
| 554 | - return $result; |
|
| 555 | - } |
|
| 550 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
|
|
| 551 | + return $result; |
|
| 552 | + } |
|
| 553 | + if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
|
|
| 554 | + return $result; |
|
| 555 | + } |
|
| 556 | 556 | |
| 557 | - return NULL; |
|
| 557 | + return NULL; |
|
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | |
@@ -574,130 +574,130 @@ discard block |
||
| 574 | 574 | */ |
| 575 | 575 | function geodir_replace_location_variables($content, $location_array = array(), $sep = NULL, $gd_page = '') {
|
| 576 | 576 | |
| 577 | - if (empty($content)) {
|
|
| 578 | - return $content; |
|
| 579 | - } |
|
| 577 | + if (empty($content)) {
|
|
| 578 | + return $content; |
|
| 579 | + } |
|
| 580 | 580 | |
| 581 | 581 | |
| 582 | - $location_replace_vars = geodir_location_replace_vars($location_array, $sep, $gd_page); |
|
| 582 | + $location_replace_vars = geodir_location_replace_vars($location_array, $sep, $gd_page); |
|
| 583 | 583 | |
| 584 | - if (!empty($location_replace_vars)) {
|
|
| 585 | - foreach ($location_replace_vars as $search => $replace) {
|
|
| 586 | - if (!empty($search) && strpos($content, $search) !== false) {
|
|
| 587 | - $content = str_replace($search, $replace, $content); |
|
| 588 | - } |
|
| 589 | - } |
|
| 590 | - } |
|
| 584 | + if (!empty($location_replace_vars)) {
|
|
| 585 | + foreach ($location_replace_vars as $search => $replace) {
|
|
| 586 | + if (!empty($search) && strpos($content, $search) !== false) {
|
|
| 587 | + $content = str_replace($search, $replace, $content); |
|
| 588 | + } |
|
| 589 | + } |
|
| 590 | + } |
|
| 591 | 591 | |
| 592 | - return $content; |
|
| 592 | + return $content; |
|
| 593 | 593 | } |
| 594 | 594 | add_filter('geodir_replace_location_variables', 'geodir_replace_location_variables');
|
| 595 | 595 | |
| 596 | 596 | |
| 597 | 597 | function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = ''){
|
| 598 | 598 | |
| 599 | - global $wp; |
|
| 599 | + global $wp; |
|
| 600 | 600 | |
| 601 | - $location_manager = defined('GEODIRLOCATION_VERSION') ? true : false;
|
|
| 602 | - |
|
| 603 | - if (empty($location_array)) {
|
|
| 604 | - $location_array = geodir_get_current_location_terms('query_vars');
|
|
| 605 | - } |
|
| 606 | - |
|
| 607 | - $location_terms = array(); |
|
| 608 | - $location_terms['gd_neighbourhood'] = !empty($wp->query_vars['gd_neighbourhood']) ? $wp->query_vars['gd_neighbourhood'] : ''; |
|
| 609 | - $location_terms['gd_city'] = !empty($wp->query_vars['gd_city']) ? $wp->query_vars['gd_city'] : ''; |
|
| 610 | - $location_terms['gd_region'] = !empty($wp->query_vars['gd_region']) ? $wp->query_vars['gd_region'] : ''; |
|
| 611 | - $location_terms['gd_country'] = !empty($wp->query_vars['gd_country']) ? $wp->query_vars['gd_country'] : ''; |
|
| 612 | - |
|
| 613 | - $location_names = array(); |
|
| 614 | - foreach ($location_terms as $type => $location) {
|
|
| 615 | - $location_name = $location; |
|
| 616 | - |
|
| 617 | - if (!empty($location_name)) {
|
|
| 618 | - if ($location_manager) {
|
|
| 619 | - $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
| 620 | - $location_name = get_actual_location_name($location_type, $location, true); |
|
| 621 | - } else {
|
|
| 622 | - $location_name = preg_replace( '/-(\d+)$/', '', $location_name); |
|
| 623 | - $location_name = preg_replace( '/[_-]/', ' ', $location_name ); |
|
| 624 | - $location_name = __(geodir_ucwords($location_name), 'geodirectory'); |
|
| 625 | - } |
|
| 626 | - } |
|
| 601 | + $location_manager = defined('GEODIRLOCATION_VERSION') ? true : false;
|
|
| 602 | + |
|
| 603 | + if (empty($location_array)) {
|
|
| 604 | + $location_array = geodir_get_current_location_terms('query_vars');
|
|
| 605 | + } |
|
| 606 | + |
|
| 607 | + $location_terms = array(); |
|
| 608 | + $location_terms['gd_neighbourhood'] = !empty($wp->query_vars['gd_neighbourhood']) ? $wp->query_vars['gd_neighbourhood'] : ''; |
|
| 609 | + $location_terms['gd_city'] = !empty($wp->query_vars['gd_city']) ? $wp->query_vars['gd_city'] : ''; |
|
| 610 | + $location_terms['gd_region'] = !empty($wp->query_vars['gd_region']) ? $wp->query_vars['gd_region'] : ''; |
|
| 611 | + $location_terms['gd_country'] = !empty($wp->query_vars['gd_country']) ? $wp->query_vars['gd_country'] : ''; |
|
| 612 | + |
|
| 613 | + $location_names = array(); |
|
| 614 | + foreach ($location_terms as $type => $location) {
|
|
| 615 | + $location_name = $location; |
|
| 616 | + |
|
| 617 | + if (!empty($location_name)) {
|
|
| 618 | + if ($location_manager) {
|
|
| 619 | + $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
| 620 | + $location_name = get_actual_location_name($location_type, $location, true); |
|
| 621 | + } else {
|
|
| 622 | + $location_name = preg_replace( '/-(\d+)$/', '', $location_name); |
|
| 623 | + $location_name = preg_replace( '/[_-]/', ' ', $location_name ); |
|
| 624 | + $location_name = __(geodir_ucwords($location_name), 'geodirectory'); |
|
| 625 | + } |
|
| 626 | + } |
|
| 627 | 627 | |
| 628 | - $location_names[$type] = $location_name; |
|
| 629 | - } |
|
| 630 | - |
|
| 631 | - $location_single = ''; |
|
| 632 | - foreach ($location_terms as $type => $location) {
|
|
| 633 | - if (!empty($location)) {
|
|
| 634 | - if (!empty($location_names[$type])) {
|
|
| 635 | - $location_single = $location_names[$type]; |
|
| 636 | - } else {
|
|
| 637 | - if ($location_manager) {
|
|
| 638 | - $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
| 639 | - $location_single = get_actual_location_name($location_type, $location, true); |
|
| 640 | - } else {
|
|
| 641 | - $location_name = preg_replace( '/-(\d+)$/', '', $location); |
|
| 642 | - $location_name = preg_replace( '/[_-]/', ' ', $location_name ); |
|
| 643 | - $location_single = __(geodir_ucwords($location_name), 'geodirectory'); |
|
| 644 | - } |
|
| 645 | - } |
|
| 646 | - break; |
|
| 647 | - } |
|
| 648 | - } |
|
| 649 | - |
|
| 650 | - $full_location = array(); |
|
| 651 | - if (!empty($location_array)) {
|
|
| 652 | - $location_array = array_reverse($location_array); |
|
| 653 | - |
|
| 654 | - foreach ($location_array as $type => $location) {
|
|
| 655 | - if (!empty($location_names[$type])) {
|
|
| 656 | - $location_name = $location_names[$type]; |
|
| 657 | - } else {
|
|
| 658 | - if ($location_manager) {
|
|
| 659 | - $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
| 660 | - $location_name = get_actual_location_name($location_type, $location, true); |
|
| 661 | - } else {
|
|
| 662 | - $location_name = preg_replace( '/-(\d+)$/', '', $location); |
|
| 663 | - $location_name = preg_replace( '/[_-]/', ' ', $location_name ); |
|
| 664 | - $location_name = __(geodir_ucwords($location_name), 'geodirectory'); |
|
| 665 | - } |
|
| 666 | - } |
|
| 628 | + $location_names[$type] = $location_name; |
|
| 629 | + } |
|
| 630 | + |
|
| 631 | + $location_single = ''; |
|
| 632 | + foreach ($location_terms as $type => $location) {
|
|
| 633 | + if (!empty($location)) {
|
|
| 634 | + if (!empty($location_names[$type])) {
|
|
| 635 | + $location_single = $location_names[$type]; |
|
| 636 | + } else {
|
|
| 637 | + if ($location_manager) {
|
|
| 638 | + $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
| 639 | + $location_single = get_actual_location_name($location_type, $location, true); |
|
| 640 | + } else {
|
|
| 641 | + $location_name = preg_replace( '/-(\d+)$/', '', $location); |
|
| 642 | + $location_name = preg_replace( '/[_-]/', ' ', $location_name ); |
|
| 643 | + $location_single = __(geodir_ucwords($location_name), 'geodirectory'); |
|
| 644 | + } |
|
| 645 | + } |
|
| 646 | + break; |
|
| 647 | + } |
|
| 648 | + } |
|
| 649 | + |
|
| 650 | + $full_location = array(); |
|
| 651 | + if (!empty($location_array)) {
|
|
| 652 | + $location_array = array_reverse($location_array); |
|
| 653 | + |
|
| 654 | + foreach ($location_array as $type => $location) {
|
|
| 655 | + if (!empty($location_names[$type])) {
|
|
| 656 | + $location_name = $location_names[$type]; |
|
| 657 | + } else {
|
|
| 658 | + if ($location_manager) {
|
|
| 659 | + $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
| 660 | + $location_name = get_actual_location_name($location_type, $location, true); |
|
| 661 | + } else {
|
|
| 662 | + $location_name = preg_replace( '/-(\d+)$/', '', $location); |
|
| 663 | + $location_name = preg_replace( '/[_-]/', ' ', $location_name ); |
|
| 664 | + $location_name = __(geodir_ucwords($location_name), 'geodirectory'); |
|
| 665 | + } |
|
| 666 | + } |
|
| 667 | + |
|
| 668 | + $full_location[] = $location_name; |
|
| 669 | + } |
|
| 667 | 670 | |
| 668 | - $full_location[] = $location_name; |
|
| 669 | - } |
|
| 671 | + if (!empty($full_location)) {
|
|
| 672 | + $full_location = array_unique($full_location); |
|
| 673 | + } |
|
| 674 | + } |
|
| 675 | + $full_location = !empty($full_location) ? implode(', ', $full_location): '';
|
|
| 670 | 676 | |
| 671 | - if (!empty($full_location)) {
|
|
| 672 | - $full_location = array_unique($full_location); |
|
| 673 | - } |
|
| 674 | - } |
|
| 675 | - $full_location = !empty($full_location) ? implode(', ', $full_location): '';
|
|
| 676 | - |
|
| 677 | - $location_replace_vars = array(); |
|
| 678 | - $location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|'; |
|
| 679 | - $location_replace_vars['%%location%%'] = $full_location; |
|
| 680 | - $location_replace_vars['%%in_location%%'] = $full_location != '' ? __( 'in', 'geodirectory' ) . ' ' . $full_location : ''; |
|
| 681 | - $location_replace_vars['%%location_single%%'] = $location_single; |
|
| 682 | - $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? __( 'in', 'geodirectory' ) . ' ' . $location_single : ''; |
|
| 683 | - |
|
| 684 | - foreach ($location_names as $type => $name) {
|
|
| 685 | - $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
| 686 | - |
|
| 687 | - $location_replace_vars['%%location_' . $location_type . '%%'] = $name; |
|
| 688 | - $location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? __( 'in', 'geodirectory' ) . ' ' . $name : ''; |
|
| 689 | - } |
|
| 690 | - |
|
| 691 | - /** |
|
| 692 | - * Filter the location terms variables to search & replace. |
|
| 693 | - * |
|
| 694 | - * @since 1.6.16 |
|
| 695 | - * @package GeoDirectory |
|
| 696 | - * |
|
| 697 | - * @param array $location_replace_vars The array of search & replace variables. |
|
| 698 | - * @param array $location_array The array of location variables. |
|
| 699 | - * @param string $gd_page The page being filtered. |
|
| 700 | - * @param string $sep The separator. |
|
| 701 | - */ |
|
| 702 | - return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep ); |
|
| 677 | + $location_replace_vars = array(); |
|
| 678 | + $location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|'; |
|
| 679 | + $location_replace_vars['%%location%%'] = $full_location; |
|
| 680 | + $location_replace_vars['%%in_location%%'] = $full_location != '' ? __( 'in', 'geodirectory' ) . ' ' . $full_location : ''; |
|
| 681 | + $location_replace_vars['%%location_single%%'] = $location_single; |
|
| 682 | + $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? __( 'in', 'geodirectory' ) . ' ' . $location_single : ''; |
|
| 683 | + |
|
| 684 | + foreach ($location_names as $type => $name) {
|
|
| 685 | + $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
|
| 686 | + |
|
| 687 | + $location_replace_vars['%%location_' . $location_type . '%%'] = $name; |
|
| 688 | + $location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? __( 'in', 'geodirectory' ) . ' ' . $name : ''; |
|
| 689 | + } |
|
| 690 | + |
|
| 691 | + /** |
|
| 692 | + * Filter the location terms variables to search & replace. |
|
| 693 | + * |
|
| 694 | + * @since 1.6.16 |
|
| 695 | + * @package GeoDirectory |
|
| 696 | + * |
|
| 697 | + * @param array $location_replace_vars The array of search & replace variables. |
|
| 698 | + * @param array $location_array The array of location variables. |
|
| 699 | + * @param string $gd_page The page being filtered. |
|
| 700 | + * @param string $sep The separator. |
|
| 701 | + */ |
|
| 702 | + return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep ); |
|
| 703 | 703 | } |
| 704 | 704 | \ No newline at end of file |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | {
|
| 125 | 125 | global $wpdb; |
| 126 | 126 | |
| 127 | - $rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC");
|
|
| 127 | + $rows = $wpdb->get_results("SELECT Country,ISO2 FROM ".GEODIR_COUNTRIES_TABLE." ORDER BY Country ASC");
|
|
| 128 | 128 | |
| 129 | 129 | $ISO2 = array(); |
| 130 | 130 | $countries = array(); |
@@ -136,11 +136,11 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | asort($countries); |
| 138 | 138 | |
| 139 | - $out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
|
|
| 139 | + $out_put = '<option '.selected('', $post_country, false).' value="">'.__('Select Country', 'geodirectory').'</option>';
|
|
| 140 | 140 | foreach ($countries as $country => $name) {
|
| 141 | 141 | $ccode = $ISO2[$country]; |
| 142 | 142 | |
| 143 | - $out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>'; |
|
| 143 | + $out_put .= '<option '.selected($post_country, $country, false).' value="'.esc_attr($country).'" data-country_code="'.$ccode.'">'.$name.'</option>'; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | echo $out_put; |
@@ -182,10 +182,10 @@ discard block |
||
| 182 | 182 | if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
|
| 183 | 183 | |
| 184 | 184 | foreach ($posttype as $posttypeobj) {
|
| 185 | - $post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location |
|
| 185 | + $post_locations = '['.$default_location->city_slug.'],['.$default_location->region_slug.'],['.$default_location->country_slug.']'; // set all overall post location |
|
| 186 | 186 | |
| 187 | 187 | $sql = $wpdb->prepare( |
| 188 | - "UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)", |
|
| 188 | + "UPDATE ".$plugin_prefix.$posttypeobj."_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)", |
|
| 189 | 189 | array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations) |
| 190 | 190 | ); |
| 191 | 191 | $wpdb->query($sql); |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * |
| 234 | 234 | * @since 1.0.0 |
| 235 | 235 | */ |
| 236 | - $geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
|
|
| 236 | + $geodir_location = (object) apply_filters('geodir_add_new_location', array('location_id' => 0,
|
|
| 237 | 237 | 'country' => $location_country, |
| 238 | 238 | 'region' => $location_region, |
| 239 | 239 | 'city' => $location_city, |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | */ |
| 295 | 295 | function geodir_get_address_by_lat_lan($lat, $lng) |
| 296 | 296 | {
|
| 297 | - $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ; |
|
| 297 | + $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng='.trim($lat).','.trim($lng); |
|
| 298 | 298 | |
| 299 | 299 | $ch = curl_init(); |
| 300 | 300 | curl_setopt($ch, CURLOPT_URL, $url); |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | * @param string $location_array_from Source type of location terms. Default session. |
| 388 | 388 | * @param string $gd_post_type WP post type. |
| 389 | 389 | */ |
| 390 | - $location_array = apply_filters( 'geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type ); |
|
| 390 | + $location_array = apply_filters('geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type);
|
|
| 391 | 391 | |
| 392 | 392 | return $location_array; |
| 393 | 393 | |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | */ |
| 434 | 434 | function geodir_get_osm_address_by_lat_lan($lat, $lng) {
|
| 435 | 435 | $url = is_ssl() ? 'https:' : 'http:'; |
| 436 | - $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
|
|
| 436 | + $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat='.trim($lat).'&lon='.trim($lng).'&zoom=16&addressdetails=1&email='.get_option('admin_email');
|
|
| 437 | 437 | |
| 438 | 438 | $ch = curl_init(); |
| 439 | 439 | curl_setopt($ch, CURLOPT_URL, $url); |
@@ -447,9 +447,9 @@ discard block |
||
| 447 | 447 | |
| 448 | 448 | if (!empty($data) && !empty($data->address)) {
|
| 449 | 449 | $address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
|
| 450 | - $formatted_address = (array)$data->address; |
|
| 450 | + $formatted_address = (array) $data->address; |
|
| 451 | 451 | |
| 452 | - foreach ( $data->address as $key => $value ) {
|
|
| 452 | + foreach ($data->address as $key => $value) {
|
|
| 453 | 453 | if (!in_array($key, $address_fields)) {
|
| 454 | 454 | unset($formatted_address[$key]); |
| 455 | 455 | } |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | if (defined('POST_LOCATION_TABLE')) {
|
| 480 | - $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
|
|
| 480 | + $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM ".POST_LOCATION_TABLE." WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
|
|
| 481 | 481 | if (!empty($rows)) {
|
| 482 | 482 | foreach ($rows as $row) {
|
| 483 | 483 | $translated = __($row->country, 'geodirectory'); |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | - $rows = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country ) ); |
|
| 490 | + $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM ".POST_LOCATION_TABLE." WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country));
|
|
| 491 | 491 | if (!empty($rows)) {
|
| 492 | 492 | foreach ($rows as $row) {
|
| 493 | 493 | $translated = __($row->country, 'geodirectory'); |
@@ -525,10 +525,10 @@ discard block |
||
| 525 | 525 | function geodir_get_country_iso2($country) {
|
| 526 | 526 | global $wpdb; |
| 527 | 527 | |
| 528 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
|
|
| 528 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", $country))) {
|
|
| 529 | 529 | return $result; |
| 530 | 530 | } |
| 531 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
|
|
| 531 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
|
|
| 532 | 532 | return $result; |
| 533 | 533 | } |
| 534 | 534 | |
@@ -547,10 +547,10 @@ discard block |
||
| 547 | 547 | function geodir_get_country_by_name($country, $iso2 = false) {
|
| 548 | 548 | global $wpdb; |
| 549 | 549 | |
| 550 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
|
|
| 550 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", $country))) {
|
|
| 551 | 551 | return $result; |
| 552 | 552 | } |
| 553 | - if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
|
|
| 553 | + if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM ".GEODIR_COUNTRIES_TABLE." WHERE ISO2 LIKE %s", $country))) {
|
|
| 554 | 554 | return $result; |
| 555 | 555 | } |
| 556 | 556 | |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | add_filter('geodir_replace_location_variables', 'geodir_replace_location_variables');
|
| 595 | 595 | |
| 596 | 596 | |
| 597 | -function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = ''){
|
|
| 597 | +function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = '') {
|
|
| 598 | 598 | |
| 599 | 599 | global $wp; |
| 600 | 600 | |
@@ -619,8 +619,8 @@ discard block |
||
| 619 | 619 | $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
| 620 | 620 | $location_name = get_actual_location_name($location_type, $location, true); |
| 621 | 621 | } else {
|
| 622 | - $location_name = preg_replace( '/-(\d+)$/', '', $location_name); |
|
| 623 | - $location_name = preg_replace( '/[_-]/', ' ', $location_name ); |
|
| 622 | + $location_name = preg_replace('/-(\d+)$/', '', $location_name);
|
|
| 623 | + $location_name = preg_replace('/[_-]/', ' ', $location_name);
|
|
| 624 | 624 | $location_name = __(geodir_ucwords($location_name), 'geodirectory'); |
| 625 | 625 | } |
| 626 | 626 | } |
@@ -638,8 +638,8 @@ discard block |
||
| 638 | 638 | $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
| 639 | 639 | $location_single = get_actual_location_name($location_type, $location, true); |
| 640 | 640 | } else {
|
| 641 | - $location_name = preg_replace( '/-(\d+)$/', '', $location); |
|
| 642 | - $location_name = preg_replace( '/[_-]/', ' ', $location_name ); |
|
| 641 | + $location_name = preg_replace('/-(\d+)$/', '', $location);
|
|
| 642 | + $location_name = preg_replace('/[_-]/', ' ', $location_name);
|
|
| 643 | 643 | $location_single = __(geodir_ucwords($location_name), 'geodirectory'); |
| 644 | 644 | } |
| 645 | 645 | } |
@@ -659,8 +659,8 @@ discard block |
||
| 659 | 659 | $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
| 660 | 660 | $location_name = get_actual_location_name($location_type, $location, true); |
| 661 | 661 | } else {
|
| 662 | - $location_name = preg_replace( '/-(\d+)$/', '', $location); |
|
| 663 | - $location_name = preg_replace( '/[_-]/', ' ', $location_name ); |
|
| 662 | + $location_name = preg_replace('/-(\d+)$/', '', $location);
|
|
| 663 | + $location_name = preg_replace('/[_-]/', ' ', $location_name);
|
|
| 664 | 664 | $location_name = __(geodir_ucwords($location_name), 'geodirectory'); |
| 665 | 665 | } |
| 666 | 666 | } |
@@ -672,20 +672,20 @@ discard block |
||
| 672 | 672 | $full_location = array_unique($full_location); |
| 673 | 673 | } |
| 674 | 674 | } |
| 675 | - $full_location = !empty($full_location) ? implode(', ', $full_location): '';
|
|
| 675 | + $full_location = !empty($full_location) ? implode(', ', $full_location) : '';
|
|
| 676 | 676 | |
| 677 | 677 | $location_replace_vars = array(); |
| 678 | 678 | $location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|'; |
| 679 | 679 | $location_replace_vars['%%location%%'] = $full_location; |
| 680 | - $location_replace_vars['%%in_location%%'] = $full_location != '' ? __( 'in', 'geodirectory' ) . ' ' . $full_location : ''; |
|
| 680 | + $location_replace_vars['%%in_location%%'] = $full_location != '' ? __('in', 'geodirectory').' '.$full_location : '';
|
|
| 681 | 681 | $location_replace_vars['%%location_single%%'] = $location_single; |
| 682 | - $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? __( 'in', 'geodirectory' ) . ' ' . $location_single : ''; |
|
| 682 | + $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? __('in', 'geodirectory').' '.$location_single : '';
|
|
| 683 | 683 | |
| 684 | 684 | foreach ($location_names as $type => $name) {
|
| 685 | 685 | $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type; |
| 686 | 686 | |
| 687 | - $location_replace_vars['%%location_' . $location_type . '%%'] = $name; |
|
| 688 | - $location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? __( 'in', 'geodirectory' ) . ' ' . $name : ''; |
|
| 687 | + $location_replace_vars['%%location_'.$location_type.'%%'] = $name; |
|
| 688 | + $location_replace_vars['%%in_location_'.$location_type.'%%'] = !empty($name) ? __('in', 'geodirectory').' '.$name : '';
|
|
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | /** |
@@ -699,5 +699,5 @@ discard block |
||
| 699 | 699 | * @param string $gd_page The page being filtered. |
| 700 | 700 | * @param string $sep The separator. |
| 701 | 701 | */ |
| 702 | - return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep ); |
|
| 702 | + return apply_filters('geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep);
|
|
| 703 | 703 | } |
| 704 | 704 | \ No newline at end of file |
@@ -2256,7 +2256,7 @@ discard block |
||
| 2256 | 2256 | |
| 2257 | 2257 | if ( $new_style ) {
|
| 2258 | 2258 | $default_search_button_label = '<i class="fa fa-search" aria-hidden="true"></i>'; |
| 2259 | - }else{
|
|
| 2259 | + } else{
|
|
| 2260 | 2260 | $default_search_button_label = 'Search'; |
| 2261 | 2261 | } |
| 2262 | 2262 | if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) {
|
@@ -2283,7 +2283,7 @@ discard block |
||
| 2283 | 2283 | if ( $new_style ) {
|
| 2284 | 2284 | ?> |
| 2285 | 2285 | <button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e( $default_search_button_label ,'geodirectory'); ?></button> |
| 2286 | -<?php }else{?>
|
|
| 2286 | +<?php } else{?>
|
|
| 2287 | 2287 | <input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>" |
| 2288 | 2288 | class="geodir_submit_search <?php echo $fa_class; ?>"/> |
| 2289 | 2289 | <?php } |
@@ -2333,17 +2333,17 @@ discard block |
||
| 2333 | 2333 | if ( $new_style ) {
|
| 2334 | 2334 | echo "</div>"; |
| 2335 | 2335 | } |
| 2336 | - }else{
|
|
| 2336 | + } else{
|
|
| 2337 | 2337 | if(! empty( $post_types )){
|
| 2338 | 2338 | $pt_arr = (array)$post_types; |
| 2339 | 2339 | echo '<input type="hidden" name="stype" value="' . key( $pt_arr ) . '" />'; |
| 2340 | - }else{
|
|
| 2340 | + } else{
|
|
| 2341 | 2341 | echo '<input type="hidden" name="stype" value="gd_place" />'; |
| 2342 | 2342 | } |
| 2343 | 2343 | |
| 2344 | 2344 | } |
| 2345 | 2345 | |
| 2346 | - }elseif ( ! empty( $post_types ) ) {
|
|
| 2346 | + } elseif ( ! empty( $post_types ) ) {
|
|
| 2347 | 2347 | echo '<input type="hidden" name="stype" value="gd_place" />'; |
| 2348 | 2348 | } |
| 2349 | 2349 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * @param object|string $post The post object. |
| 162 | 162 | * @param string $post_type The post type. |
| 163 | 163 | * |
| 164 | - * @return object Returns filtered package info as an object. |
|
| 164 | + * @return string Returns filtered package info as an object. |
|
| 165 | 165 | */ |
| 166 | 166 | function geodir_post_package_info( $package_info, $post = '', $post_type = '' ) {
|
| 167 | 167 | $package_info['pid'] = 0; |
@@ -2489,7 +2489,7 @@ discard block |
||
| 2489 | 2489 | * |
| 2490 | 2490 | * @since 1.5.0 |
| 2491 | 2491 | * |
| 2492 | - * @return True if WPML is active else False. |
|
| 2492 | + * @return boolean if WPML is active else False. |
|
| 2493 | 2493 | */ |
| 2494 | 2494 | function geodir_is_wpml() {
|
| 2495 | 2495 | if (function_exists('icl_object_id')) {
|
@@ -2561,7 +2561,6 @@ discard block |
||
| 2561 | 2561 | * @since 1.6.16 Sync reviews if sync comments allowed. |
| 2562 | 2562 | * |
| 2563 | 2563 | * @param int $post_id The Post ID. |
| 2564 | - * @param string $lang Language code for translating post. |
|
| 2565 | 2564 | * @param array $request_info The post details in an array. |
| 2566 | 2565 | */ |
| 2567 | 2566 | function geodir_wpml_duplicate_listing($post_id, $request_info) {
|
@@ -2645,7 +2644,7 @@ discard block |
||
| 2645 | 2644 | * @param int $master_post_id Original Post ID. |
| 2646 | 2645 | * @param int $tr_post_id Translation Post ID. |
| 2647 | 2646 | * @param string $lang Language code for translating post. |
| 2648 | - * @return bool True for success, False for fail. |
|
| 2647 | + * @return boolean|null True for success, False for fail. |
|
| 2649 | 2648 | */ |
| 2650 | 2649 | function geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang) {
|
| 2651 | 2650 | global $sitepress, $wpdb; |
@@ -2888,8 +2887,6 @@ discard block |
||
| 2888 | 2887 | * |
| 2889 | 2888 | * @since 1.6.16 |
| 2890 | 2889 | * |
| 2891 | - * @param string $post_type WP post type or WP texonomy. Ex: gd_place. |
|
| 2892 | - * @param bool $taxonomy Whether $post_type is taxonomy or not. |
|
| 2893 | 2890 | * @return bool True if review star disabled, otherwise false. |
| 2894 | 2891 | */ |
| 2895 | 2892 | function geodir_rating_disabled_post_types() {
|
@@ -52,31 +52,31 @@ discard block |
||
| 52 | 52 | jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefourth', 'gridview_onefifth', 600);
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - jQuery.post("<?php echo geodir_get_ajax_url();?>&gd_listing_view=" + val, function (data) {
|
|
| 55 | + jQuery.post("<?php echo geodir_get_ajax_url(); ?>&gd_listing_view=" + val, function (data) {
|
|
| 56 | 56 | //alert(data ); |
| 57 | 57 | }); |
| 58 | 58 | } |
| 59 | 59 | </script> |
| 60 | 60 | <div class="geodir-list-view-select"> |
| 61 | 61 | <select name="gd_list_view" id="gd_list_view" onchange="geodir_list_view_select(this);"> |
| 62 | - <?php $listing_view = (int) $gd_session->get( 'gd_listing_view' ); ?> |
|
| 63 | - <option value=""><?php _e( 'View:', 'geodirectory' ); ?></option> |
|
| 62 | + <?php $listing_view = (int) $gd_session->get('gd_listing_view'); ?>
|
|
| 63 | + <option value=""><?php _e('View:', 'geodirectory'); ?></option>
|
|
| 64 | 64 | <option |
| 65 | - value="1" <?php selected( 1, $listing_view ); ?>><?php _e( 'View: List', 'geodirectory' ); ?></option> |
|
| 65 | + value="1" <?php selected(1, $listing_view); ?>><?php _e('View: List', 'geodirectory'); ?></option>
|
|
| 66 | 66 | <option |
| 67 | - value="2" <?php selected( 2, $listing_view ); ?>><?php _e( 'View: Grid 2', 'geodirectory' ); ?></option> |
|
| 67 | + value="2" <?php selected(2, $listing_view); ?>><?php _e('View: Grid 2', 'geodirectory'); ?></option>
|
|
| 68 | 68 | <option |
| 69 | - value="3" <?php selected( 3, $listing_view ); ?>><?php _e( 'View: Grid 3', 'geodirectory' ); ?></option> |
|
| 69 | + value="3" <?php selected(3, $listing_view); ?>><?php _e('View: Grid 3', 'geodirectory'); ?></option>
|
|
| 70 | 70 | <option |
| 71 | - value="4" <?php selected( 4, $listing_view ); ?>><?php _e( 'View: Grid 4', 'geodirectory' ); ?></option> |
|
| 71 | + value="4" <?php selected(4, $listing_view); ?>><?php _e('View: Grid 4', 'geodirectory'); ?></option>
|
|
| 72 | 72 | <option |
| 73 | - value="5" <?php selected( 5, $listing_view ); ?>><?php _e( 'View: Grid 5', 'geodirectory' ); ?></option> |
|
| 73 | + value="5" <?php selected(5, $listing_view); ?>><?php _e('View: Grid 5', 'geodirectory'); ?></option>
|
|
| 74 | 74 | </select> |
| 75 | 75 | </div> |
| 76 | 76 | <?php |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | -add_action( 'geodir_before_listing', 'geodir_list_view_select', 100 ); |
|
| 79 | +add_action('geodir_before_listing', 'geodir_list_view_select', 100);
|
|
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * Limit the listing excerpt. |
@@ -91,9 +91,9 @@ discard block |
||
| 91 | 91 | * @global object $post The current post object. |
| 92 | 92 | * @return string The modified excerpt. |
| 93 | 93 | */ |
| 94 | -function geodir_max_excerpt( $charlength ) {
|
|
| 94 | +function geodir_max_excerpt($charlength) {
|
|
| 95 | 95 | global $post; |
| 96 | - if ( $charlength == '0' ) {
|
|
| 96 | + if ($charlength == '0') {
|
|
| 97 | 97 | return; |
| 98 | 98 | } |
| 99 | 99 | $out = ''; |
@@ -101,46 +101,46 @@ discard block |
||
| 101 | 101 | $temp_post = $post; |
| 102 | 102 | $excerpt = get_the_excerpt(); |
| 103 | 103 | |
| 104 | - $charlength ++; |
|
| 105 | - $excerpt_more = function_exists( 'geodirf_excerpt_more' ) ? geodirf_excerpt_more( '' ) : geodir_excerpt_more( '' ); |
|
| 106 | - if ( mb_strlen( $excerpt ) > $charlength ) {
|
|
| 107 | - if ( mb_strlen( $excerpt_more ) > 0 && mb_strpos( $excerpt, $excerpt_more ) !== false ) {
|
|
| 108 | - $excut = - ( mb_strlen( $excerpt_more ) ); |
|
| 109 | - $subex = mb_substr( $excerpt, 0, $excut ); |
|
| 110 | - if ( $charlength > 0 && mb_strlen( $subex ) > $charlength ) {
|
|
| 111 | - $subex = mb_substr( $subex, 0, $charlength ); |
|
| 104 | + $charlength++; |
|
| 105 | + $excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more('');
|
|
| 106 | + if (mb_strlen($excerpt) > $charlength) {
|
|
| 107 | + if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
|
|
| 108 | + $excut = - (mb_strlen($excerpt_more)); |
|
| 109 | + $subex = mb_substr($excerpt, 0, $excut); |
|
| 110 | + if ($charlength > 0 && mb_strlen($subex) > $charlength) {
|
|
| 111 | + $subex = mb_substr($subex, 0, $charlength); |
|
| 112 | 112 | } |
| 113 | 113 | $out .= $subex; |
| 114 | 114 | } else {
|
| 115 | - $subex = mb_substr( $excerpt, 0, $charlength - 5 ); |
|
| 116 | - $exwords = explode( ' ', $subex ); |
|
| 117 | - $excut = - ( mb_strlen( $exwords[ count( $exwords ) - 1 ] ) ); |
|
| 118 | - if ( $excut < 0 ) {
|
|
| 119 | - $out .= mb_substr( $subex, 0, $excut ); |
|
| 115 | + $subex = mb_substr($excerpt, 0, $charlength - 5); |
|
| 116 | + $exwords = explode(' ', $subex);
|
|
| 117 | + $excut = - (mb_strlen($exwords[count($exwords) - 1])); |
|
| 118 | + if ($excut < 0) {
|
|
| 119 | + $out .= mb_substr($subex, 0, $excut); |
|
| 120 | 120 | } else {
|
| 121 | 121 | $out .= $subex; |
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | - $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">'; |
|
| 124 | + $out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">'; |
|
| 125 | 125 | /** |
| 126 | 126 | * Filter excerpt read more text. |
| 127 | 127 | * |
| 128 | 128 | * @since 1.0.0 |
| 129 | 129 | */ |
| 130 | - $out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) ); |
|
| 130 | + $out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
|
|
| 131 | 131 | $out .= '</a>'; |
| 132 | 132 | |
| 133 | 133 | } else {
|
| 134 | - if ( mb_strlen( $excerpt_more ) > 0 && mb_strpos( $excerpt, $excerpt_more ) !== false ) {
|
|
| 135 | - $excut = - ( mb_strlen( $excerpt_more ) ); |
|
| 136 | - $out .= mb_substr( $excerpt, 0, $excut ); |
|
| 137 | - $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">'; |
|
| 134 | + if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
|
|
| 135 | + $excut = - (mb_strlen($excerpt_more)); |
|
| 136 | + $out .= mb_substr($excerpt, 0, $excut); |
|
| 137 | + $out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">'; |
|
| 138 | 138 | /** |
| 139 | 139 | * Filter excerpt read more text. |
| 140 | 140 | * |
| 141 | 141 | * @since 1.0.0 |
| 142 | 142 | */ |
| 143 | - $out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) ); |
|
| 143 | + $out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
|
|
| 144 | 144 | $out .= '</a>'; |
| 145 | 145 | } else {
|
| 146 | 146 | $out .= $excerpt; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * |
| 164 | 164 | * @return object Returns filtered package info as an object. |
| 165 | 165 | */ |
| 166 | -function geodir_post_package_info( $package_info, $post = '', $post_type = '' ) {
|
|
| 166 | +function geodir_post_package_info($package_info, $post = '', $post_type = '') {
|
|
| 167 | 167 | $package_info['pid'] = 0; |
| 168 | 168 | $package_info['days'] = 0; |
| 169 | 169 | $package_info['amount'] = 0; |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | * @param object|string $post The post object. |
| 193 | 193 | * @param string $post_type The post type. |
| 194 | 194 | */ |
| 195 | - return (object) apply_filters( 'geodir_post_package_info', $package_info, $post, $post_type ); |
|
| 195 | + return (object) apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
|
|
| 196 | 196 | |
| 197 | 197 | } |
| 198 | 198 | |
@@ -220,11 +220,11 @@ discard block |
||
| 220 | 220 | * |
| 221 | 221 | * } |
| 222 | 222 | */ |
| 223 | -function geodir_send_inquiry( $request ) {
|
|
| 223 | +function geodir_send_inquiry($request) {
|
|
| 224 | 224 | global $wpdb; |
| 225 | 225 | |
| 226 | 226 | // strip slashes from text |
| 227 | - $request = ! empty( $request ) ? stripslashes_deep( $request ) : $request; |
|
| 227 | + $request = !empty($request) ? stripslashes_deep($request) : $request; |
|
| 228 | 228 | |
| 229 | 229 | $yourname = $request['inq_name']; |
| 230 | 230 | $youremail = $request['inq_email']; |
@@ -235,26 +235,26 @@ discard block |
||
| 235 | 235 | $author_id = ''; |
| 236 | 236 | $post_title = ''; |
| 237 | 237 | |
| 238 | - if ( $request['pid'] ) {
|
|
| 238 | + if ($request['pid']) {
|
|
| 239 | 239 | |
| 240 | 240 | $productinfosql = $wpdb->prepare( |
| 241 | 241 | "select ID,post_author,post_title from $wpdb->posts where ID =%d", |
| 242 | - array( $request['pid'] ) |
|
| 242 | + array($request['pid']) |
|
| 243 | 243 | ); |
| 244 | - $productinfo = $wpdb->get_row( $productinfosql ); |
|
| 244 | + $productinfo = $wpdb->get_row($productinfosql); |
|
| 245 | 245 | |
| 246 | 246 | $author_id = $productinfo->post_author; |
| 247 | 247 | $post_title = $productinfo->post_title; |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - $post_title = '<a href="' . get_permalink( $pid ) . '">' . $post_title . '</a>'; |
|
| 250 | + $post_title = '<a href="'.get_permalink($pid).'">'.$post_title.'</a>'; |
|
| 251 | 251 | |
| 252 | - $user_info = get_userdata( $author_id ); |
|
| 253 | - $to_email = geodir_get_post_meta( $pid, 'geodir_email', true ); |
|
| 254 | - $to_name = geodir_get_client_name( $author_id ); |
|
| 252 | + $user_info = get_userdata($author_id); |
|
| 253 | + $to_email = geodir_get_post_meta($pid, 'geodir_email', true); |
|
| 254 | + $to_name = geodir_get_client_name($author_id); |
|
| 255 | 255 | |
| 256 | - if ( $to_email == '' ) {
|
|
| 257 | - $to_email = get_option( 'admin_email' ); |
|
| 256 | + if ($to_email == '') {
|
|
| 257 | + $to_email = get_option('admin_email');
|
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | /** |
@@ -275,10 +275,10 @@ discard block |
||
| 275 | 275 | * } |
| 276 | 276 | * @param string $type The form type, default: `Enquiry`. |
| 277 | 277 | */ |
| 278 | - do_action( 'geodir_after_send_enquiry', $request, 'Enquiry' ); |
|
| 278 | + do_action('geodir_after_send_enquiry', $request, 'Enquiry');
|
|
| 279 | 279 | |
| 280 | 280 | $client_message = $frnd_comments; |
| 281 | - $client_message .= '<br>' . __( 'From :', 'geodirectory' ) . ' ' . $yourname . '<br>' . __( 'Phone :', 'geodirectory' ) . ' ' . $inq_phone . '<br>' . __( 'Email :', 'geodirectory' ) . ' ' . $youremail . '<br><br>' . __( 'Sent from', 'geodirectory' ) . ' - <b><a href="' . trailingslashit( home_url() ) . '">' . get_option( 'blogname' ) . '</a></b>.'; |
|
| 281 | + $client_message .= '<br>'.__('From :', 'geodirectory').' '.$yourname.'<br>'.__('Phone :', 'geodirectory').' '.$inq_phone.'<br>'.__('Email :', 'geodirectory').' '.$youremail.'<br><br>'.__('Sent from', 'geodirectory').' - <b><a href="'.trailingslashit(home_url()).'">'.get_option('blogname').'</a></b>.';
|
|
| 282 | 282 | /** |
| 283 | 283 | * Filter client message text. |
| 284 | 284 | * |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | * |
| 287 | 287 | * @param string $client_message Client message text. |
| 288 | 288 | */ |
| 289 | - $client_message = apply_filters( 'geodir_inquiry_email_msg', $client_message ); |
|
| 289 | + $client_message = apply_filters('geodir_inquiry_email_msg', $client_message);
|
|
| 290 | 290 | |
| 291 | 291 | /** |
| 292 | 292 | * Called before the send enquiry email is sent. |
@@ -305,12 +305,12 @@ discard block |
||
| 305 | 305 | * |
| 306 | 306 | * } |
| 307 | 307 | */ |
| 308 | - do_action( 'geodir_before_send_enquiry_email', $request ); |
|
| 309 | - if ( $to_email ) {
|
|
| 308 | + do_action('geodir_before_send_enquiry_email', $request);
|
|
| 309 | + if ($to_email) {
|
|
| 310 | 310 | // strip slashes message |
| 311 | - $client_message = stripslashes_deep( $client_message ); |
|
| 311 | + $client_message = stripslashes_deep($client_message); |
|
| 312 | 312 | |
| 313 | - geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid'] );//To client email |
|
| 313 | + geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']); //To client email |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | /** |
@@ -330,12 +330,12 @@ discard block |
||
| 330 | 330 | * |
| 331 | 331 | * } |
| 332 | 332 | */ |
| 333 | - do_action( 'geodir_after_send_enquiry_email', $request ); |
|
| 334 | - $url = get_permalink( $pid ); |
|
| 335 | - if ( strstr( $url, '?' ) ) {
|
|
| 336 | - $url = $url . "&send_inquiry=success"; |
|
| 333 | + do_action('geodir_after_send_enquiry_email', $request);
|
|
| 334 | + $url = get_permalink($pid); |
|
| 335 | + if (strstr($url, '?')) {
|
|
| 336 | + $url = $url."&send_inquiry=success"; |
|
| 337 | 337 | } else {
|
| 338 | - $url = $url . "?send_inquiry=success"; |
|
| 338 | + $url = $url."?send_inquiry=success"; |
|
| 339 | 339 | } |
| 340 | 340 | /** |
| 341 | 341 | * Filter redirect url after the send enquiry email is sent. |
@@ -344,8 +344,8 @@ discard block |
||
| 344 | 344 | * |
| 345 | 345 | * @param string $url Redirect url. |
| 346 | 346 | */ |
| 347 | - $url = apply_filters( 'geodir_send_enquiry_after_submit_redirect', $url ); |
|
| 348 | - wp_redirect( $url ); |
|
| 347 | + $url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url);
|
|
| 348 | + wp_redirect($url); |
|
| 349 | 349 | gd_die(); |
| 350 | 350 | |
| 351 | 351 | } |
@@ -374,11 +374,11 @@ discard block |
||
| 374 | 374 | * } |
| 375 | 375 | * @global object $wpdb WordPress Database object. |
| 376 | 376 | */ |
| 377 | -function geodir_send_friend( $request ) {
|
|
| 377 | +function geodir_send_friend($request) {
|
|
| 378 | 378 | global $wpdb; |
| 379 | 379 | |
| 380 | 380 | // strip slashes from text |
| 381 | - $request = ! empty( $request ) ? stripslashes_deep( $request ) : $request; |
|
| 381 | + $request = !empty($request) ? stripslashes_deep($request) : $request; |
|
| 382 | 382 | |
| 383 | 383 | $yourname = $request['yourname']; |
| 384 | 384 | $youremail = $request['youremail']; |
@@ -387,13 +387,13 @@ discard block |
||
| 387 | 387 | $pid = $request['pid']; |
| 388 | 388 | $to_email = $request['to_email']; |
| 389 | 389 | $to_name = $request['to_name']; |
| 390 | - if ( $request['pid'] ) {
|
|
| 390 | + if ($request['pid']) {
|
|
| 391 | 391 | $productinfosql = $wpdb->prepare( |
| 392 | 392 | "select ID,post_title from $wpdb->posts where ID =%d", |
| 393 | - array( $request['pid'] ) |
|
| 393 | + array($request['pid']) |
|
| 394 | 394 | ); |
| 395 | - $productinfo = $wpdb->get_results( $productinfosql ); |
|
| 396 | - foreach ( $productinfo as $productinfoObj ) {
|
|
| 395 | + $productinfo = $wpdb->get_results($productinfosql); |
|
| 396 | + foreach ($productinfo as $productinfoObj) {
|
|
| 397 | 397 | $post_title = $productinfoObj->post_title; |
| 398 | 398 | } |
| 399 | 399 | } |
@@ -417,8 +417,8 @@ discard block |
||
| 417 | 417 | * |
| 418 | 418 | * } |
| 419 | 419 | */ |
| 420 | - do_action( 'geodir_before_send_to_friend_email', $request ); |
|
| 421 | - geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid'] );//To client email |
|
| 420 | + do_action('geodir_before_send_to_friend_email', $request);
|
|
| 421 | + geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']); //To client email |
|
| 422 | 422 | |
| 423 | 423 | /** |
| 424 | 424 | * Called after the send to friend email is sent. |
@@ -439,13 +439,13 @@ discard block |
||
| 439 | 439 | * |
| 440 | 440 | * } |
| 441 | 441 | */ |
| 442 | - do_action( 'geodir_after_send_to_friend_email', $request ); |
|
| 442 | + do_action('geodir_after_send_to_friend_email', $request);
|
|
| 443 | 443 | |
| 444 | - $url = get_permalink( $pid ); |
|
| 445 | - if ( strstr( $url, '?' ) ) {
|
|
| 446 | - $url = $url . "&sendtofrnd=success"; |
|
| 444 | + $url = get_permalink($pid); |
|
| 445 | + if (strstr($url, '?')) {
|
|
| 446 | + $url = $url."&sendtofrnd=success"; |
|
| 447 | 447 | } else {
|
| 448 | - $url = $url . "?sendtofrnd=success"; |
|
| 448 | + $url = $url."?sendtofrnd=success"; |
|
| 449 | 449 | } |
| 450 | 450 | /** |
| 451 | 451 | * Filter redirect url after the send to friend email is sent. |
@@ -454,8 +454,8 @@ discard block |
||
| 454 | 454 | * |
| 455 | 455 | * @param string $url Redirect url. |
| 456 | 456 | */ |
| 457 | - $url = apply_filters( 'geodir_send_to_friend_after_submit_redirect', $url ); |
|
| 458 | - wp_redirect( $url ); |
|
| 457 | + $url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url);
|
|
| 458 | + wp_redirect($url); |
|
| 459 | 459 | gd_die(); |
| 460 | 460 | } |
| 461 | 461 | |
@@ -469,8 +469,8 @@ discard block |
||
| 469 | 469 | * |
| 470 | 470 | * @param string $hash_key |
| 471 | 471 | */ |
| 472 | -function geodir_before_tab_content( $hash_key ) {
|
|
| 473 | - switch ( $hash_key ) {
|
|
| 472 | +function geodir_before_tab_content($hash_key) {
|
|
| 473 | + switch ($hash_key) {
|
|
| 474 | 474 | case 'post_info' : |
| 475 | 475 | echo '<div class="geodir-company_info field-group">'; |
| 476 | 476 | break; |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | * |
| 481 | 481 | * @since 1.0.0 |
| 482 | 482 | */ |
| 483 | - echo ' <div id="' . apply_filters( 'geodir_post_gallery_id', 'geodir-post-gallery' ) . '" class="clearfix" >'; |
|
| 483 | + echo ' <div id="'.apply_filters('geodir_post_gallery_id', 'geodir-post-gallery').'" class="clearfix" >';
|
|
| 484 | 484 | break; |
| 485 | 485 | case 'reviews' : |
| 486 | 486 | echo '<div id="reviews-wrap" class="clearfix"> '; |
@@ -504,8 +504,8 @@ discard block |
||
| 504 | 504 | * |
| 505 | 505 | * @param string $hash_key |
| 506 | 506 | */ |
| 507 | -function geodir_after_tab_content( $hash_key ) {
|
|
| 508 | - switch ( $hash_key ) {
|
|
| 507 | +function geodir_after_tab_content($hash_key) {
|
|
| 508 | + switch ($hash_key) {
|
|
| 509 | 509 | case 'post_info' : |
| 510 | 510 | echo '</div>'; |
| 511 | 511 | break; |
@@ -536,25 +536,25 @@ discard block |
||
| 536 | 536 | * @global object $wpdb WordPress Database object. |
| 537 | 537 | * @return bool|null|string Returns default sort results, when the post type is valid. Otherwise returns false. |
| 538 | 538 | */ |
| 539 | -function geodir_get_posts_default_sort( $post_type ) {
|
|
| 539 | +function geodir_get_posts_default_sort($post_type) {
|
|
| 540 | 540 | |
| 541 | 541 | global $wpdb; |
| 542 | 542 | |
| 543 | - if ( $post_type != '' ) {
|
|
| 543 | + if ($post_type != '') {
|
|
| 544 | 544 | |
| 545 | 545 | $all_postypes = geodir_get_posttypes(); |
| 546 | 546 | |
| 547 | - if ( ! in_array( $post_type, $all_postypes ) ) {
|
|
| 547 | + if (!in_array($post_type, $all_postypes)) {
|
|
| 548 | 548 | return false; |
| 549 | 549 | } |
| 550 | 550 | |
| 551 | - $sort_field_info = $wpdb->get_var( $wpdb->prepare( "select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type= %s and is_active=%d and is_default=%d", array( |
|
| 551 | + $sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where post_type= %s and is_active=%d and is_default=%d", array(
|
|
| 552 | 552 | $post_type, |
| 553 | 553 | 1, |
| 554 | 554 | 1 |
| 555 | - ) ) ); |
|
| 555 | + ))); |
|
| 556 | 556 | |
| 557 | - if ( ! empty( $sort_field_info ) ) {
|
|
| 557 | + if (!empty($sort_field_info)) {
|
|
| 558 | 558 | return $sort_field_info; |
| 559 | 559 | } |
| 560 | 560 | |
@@ -574,20 +574,20 @@ discard block |
||
| 574 | 574 | * @global object $wpdb WordPress Database object. |
| 575 | 575 | * @return bool|mixed|void Returns sort results, when the post type is valid. Otherwise returns false. |
| 576 | 576 | */ |
| 577 | -function geodir_get_sort_options( $post_type ) {
|
|
| 577 | +function geodir_get_sort_options($post_type) {
|
|
| 578 | 578 | global $wpdb; |
| 579 | 579 | |
| 580 | - if ( $post_type != '' ) {
|
|
| 580 | + if ($post_type != '') {
|
|
| 581 | 581 | $all_postypes = geodir_get_posttypes(); |
| 582 | 582 | |
| 583 | - if ( ! in_array( $post_type, $all_postypes ) ) {
|
|
| 583 | + if (!in_array($post_type, $all_postypes)) {
|
|
| 584 | 584 | return false; |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | - $sort_field_info = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array( |
|
| 587 | + $sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array(
|
|
| 588 | 588 | $post_type, |
| 589 | 589 | 1 |
| 590 | - ) ) ); |
|
| 590 | + ))); |
|
| 591 | 591 | |
| 592 | 592 | /** |
| 593 | 593 | * Filter post sort options. |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | * @param array $sort_field_info Unfiltered sort field array. |
| 598 | 598 | * @param string $post_type Post type. |
| 599 | 599 | */ |
| 600 | - return apply_filters( 'geodir_get_sort_options', $sort_field_info, $post_type ); |
|
| 600 | + return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type);
|
|
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | } |
@@ -618,63 +618,63 @@ discard block |
||
| 618 | 618 | * |
| 619 | 619 | * @since 1.4.4 |
| 620 | 620 | */ |
| 621 | - if ( is_search() ) {
|
|
| 621 | + if (is_search()) {
|
|
| 622 | 622 | return; |
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | $sort_by = ''; |
| 626 | 626 | |
| 627 | - if ( isset( $_REQUEST['sort_by'] ) ) {
|
|
| 627 | + if (isset($_REQUEST['sort_by'])) {
|
|
| 628 | 628 | $sort_by = $_REQUEST['sort_by']; |
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | $gd_post_type = geodir_get_current_posttype(); |
| 632 | 632 | |
| 633 | - $sort_options = geodir_get_sort_options( $gd_post_type ); |
|
| 633 | + $sort_options = geodir_get_sort_options($gd_post_type); |
|
| 634 | 634 | |
| 635 | 635 | |
| 636 | 636 | $sort_field_options = ''; |
| 637 | 637 | |
| 638 | - if ( ! empty( $sort_options ) ) {
|
|
| 639 | - foreach ( $sort_options as $sort ) {
|
|
| 640 | - $sort = stripslashes_deep( $sort ); // strip slashes |
|
| 638 | + if (!empty($sort_options)) {
|
|
| 639 | + foreach ($sort_options as $sort) {
|
|
| 640 | + $sort = stripslashes_deep($sort); // strip slashes |
|
| 641 | 641 | |
| 642 | - $label = __( $sort->site_title, 'geodirectory' ); |
|
| 642 | + $label = __($sort->site_title, 'geodirectory'); |
|
| 643 | 643 | |
| 644 | - if ( $sort->field_type == 'random' ) {
|
|
| 644 | + if ($sort->field_type == 'random') {
|
|
| 645 | 645 | $key = $sort->field_type; |
| 646 | - ( $sort_by == $key || ( $sort->is_default == '1' && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = ''; |
|
| 647 | - $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>'; |
|
| 646 | + ($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = ''; |
|
| 647 | + $sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
|
|
| 648 | 648 | } |
| 649 | 649 | |
| 650 | - if ( $sort->htmlvar_name == 'comment_count' ) {
|
|
| 650 | + if ($sort->htmlvar_name == 'comment_count') {
|
|
| 651 | 651 | $sort->htmlvar_name = 'rating_count'; |
| 652 | 652 | } |
| 653 | 653 | |
| 654 | - if ( $sort->sort_asc ) {
|
|
| 655 | - $key = $sort->htmlvar_name . '_asc'; |
|
| 654 | + if ($sort->sort_asc) {
|
|
| 655 | + $key = $sort->htmlvar_name.'_asc'; |
|
| 656 | 656 | $label = $sort->site_title; |
| 657 | - if ( $sort->asc_title ) {
|
|
| 657 | + if ($sort->asc_title) {
|
|
| 658 | 658 | $label = $sort->asc_title; |
| 659 | 659 | } |
| 660 | - ( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = ''; |
|
| 661 | - $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>'; |
|
| 660 | + ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = ''; |
|
| 661 | + $sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
|
|
| 662 | 662 | } |
| 663 | 663 | |
| 664 | - if ( $sort->sort_desc ) {
|
|
| 665 | - $key = $sort->htmlvar_name . '_desc'; |
|
| 664 | + if ($sort->sort_desc) {
|
|
| 665 | + $key = $sort->htmlvar_name.'_desc'; |
|
| 666 | 666 | $label = $sort->site_title; |
| 667 | - if ( $sort->desc_title ) {
|
|
| 667 | + if ($sort->desc_title) {
|
|
| 668 | 668 | $label = $sort->desc_title; |
| 669 | 669 | } |
| 670 | - ( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = ''; |
|
| 671 | - $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>'; |
|
| 670 | + ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = ''; |
|
| 671 | + $sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
|
|
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | } |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | - if ( $sort_field_options != '' ) {
|
|
| 677 | + if ($sort_field_options != '') {
|
|
| 678 | 678 | |
| 679 | 679 | ?> |
| 680 | 680 | |
@@ -683,9 +683,9 @@ discard block |
||
| 683 | 683 | <select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;"> |
| 684 | 684 | |
| 685 | 685 | <option |
| 686 | - value="<?php echo esc_url( add_query_arg( 'sort_by', '' ) ); ?>" <?php if ( $sort_by == '' ) {
|
|
| 686 | + value="<?php echo esc_url(add_query_arg('sort_by', '')); ?>" <?php if ($sort_by == '') {
|
|
| 687 | 687 | echo 'selected="selected"'; |
| 688 | - } ?>><?php _e( 'Sort By', 'geodirectory' ); ?></option><?php |
|
| 688 | + } ?>><?php _e('Sort By', 'geodirectory'); ?></option><?php
|
|
| 689 | 689 | |
| 690 | 690 | echo $sort_field_options; ?> |
| 691 | 691 | |
@@ -713,9 +713,9 @@ discard block |
||
| 713 | 713 | * |
| 714 | 714 | * @return string Returns the section title. |
| 715 | 715 | */ |
| 716 | -function geodir_advance_customfields_heading( $title, $field_type ) {
|
|
| 716 | +function geodir_advance_customfields_heading($title, $field_type) {
|
|
| 717 | 717 | |
| 718 | - if ( in_array( $field_type, array( 'multiselect', 'textarea', 'taxonomy' ) ) ) {
|
|
| 718 | + if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) {
|
|
| 719 | 719 | $title = ''; |
| 720 | 720 | } |
| 721 | 721 | |
@@ -737,19 +737,19 @@ discard block |
||
| 737 | 737 | * @global object $gd_session GeoDirectory Session object. |
| 738 | 738 | * @return string Returns related posts html. |
| 739 | 739 | */ |
| 740 | -function geodir_related_posts_display( $request ) {
|
|
| 741 | - if ( ! empty( $request ) ) {
|
|
| 742 | - $before_title = ( isset( $request['before_title'] ) && ! empty( $request['before_title'] ) ) ? $request['before_title'] : ''; |
|
| 743 | - $after_title = ( isset( $request['after_title'] ) && ! empty( $request['after_title'] ) ) ? $request['after_title'] : ''; |
|
| 744 | - |
|
| 745 | - $title = ( isset( $request['title'] ) && ! empty( $request['title'] ) ) ? $request['title'] : __( 'Related Listings', 'geodirectory' ); |
|
| 746 | - $post_number = ( isset( $request['post_number'] ) && ! empty( $request['post_number'] ) ) ? $request['post_number'] : '5'; |
|
| 747 | - $relate_to = ( isset( $request['relate_to'] ) && ! empty( $request['relate_to'] ) ) ? $request['relate_to'] : 'category'; |
|
| 748 | - $layout = ( isset( $request['layout'] ) && ! empty( $request['layout'] ) ) ? $request['layout'] : 'gridview_onehalf'; |
|
| 749 | - $add_location_filter = ( isset( $request['add_location_filter'] ) && ! empty( $request['add_location_filter'] ) ) ? $request['add_location_filter'] : '0'; |
|
| 750 | - $listing_width = ( isset( $request['listing_width'] ) && ! empty( $request['listing_width'] ) ) ? $request['listing_width'] : ''; |
|
| 751 | - $list_sort = ( isset( $request['list_sort'] ) && ! empty( $request['list_sort'] ) ) ? $request['list_sort'] : 'latest'; |
|
| 752 | - $character_count = ( isset( $request['character_count'] ) && ! empty( $request['character_count'] ) ) ? $request['character_count'] : ''; |
|
| 740 | +function geodir_related_posts_display($request) {
|
|
| 741 | + if (!empty($request)) {
|
|
| 742 | + $before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : ''; |
|
| 743 | + $after_title = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : ''; |
|
| 744 | + |
|
| 745 | + $title = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory');
|
|
| 746 | + $post_number = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5'; |
|
| 747 | + $relate_to = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category'; |
|
| 748 | + $layout = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf'; |
|
| 749 | + $add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0'; |
|
| 750 | + $listing_width = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : ''; |
|
| 751 | + $list_sort = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest'; |
|
| 752 | + $character_count = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : ''; |
|
| 753 | 753 | |
| 754 | 754 | global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon; |
| 755 | 755 | $related_parent_lat = !empty($post->post_latitude) ? $post->post_latitude : ''; |
@@ -757,10 +757,10 @@ discard block |
||
| 757 | 757 | $arr_detail_page_tabs = geodir_detail_page_tabs_list(); |
| 758 | 758 | |
| 759 | 759 | $related_listing_array = array(); |
| 760 | - if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
|
|
| 761 | - $related_listing_array = get_option( 'geodir_add_related_listing_posttypes' ); |
|
| 760 | + if (get_option('geodir_add_related_listing_posttypes')) {
|
|
| 761 | + $related_listing_array = get_option('geodir_add_related_listing_posttypes');
|
|
| 762 | 762 | } |
| 763 | - if ( isset($post->post_type) && in_array( $post->post_type, $related_listing_array ) ) {
|
|
| 763 | + if (isset($post->post_type) && in_array($post->post_type, $related_listing_array)) {
|
|
| 764 | 764 | $arr_detail_page_tabs['related_listing']['is_display'] = true; |
| 765 | 765 | } |
| 766 | 766 | |
@@ -772,90 +772,90 @@ discard block |
||
| 772 | 772 | $tax_field = 'id'; |
| 773 | 773 | $category = array(); |
| 774 | 774 | |
| 775 | - if ( isset( $_REQUEST['backandedit'] ) ) {
|
|
| 776 | - $post = (object) $gd_session->get( 'listing' ); |
|
| 775 | + if (isset($_REQUEST['backandedit'])) {
|
|
| 776 | + $post = (object) $gd_session->get('listing');
|
|
| 777 | 777 | $post_type = $post->listing_type; |
| 778 | - if ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
|
|
| 778 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 779 | 779 | $post_id = $_REQUEST['pid']; |
| 780 | 780 | } |
| 781 | - } elseif ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
|
|
| 782 | - $post = geodir_get_post_info( $_REQUEST['pid'] ); |
|
| 781 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
|
| 782 | + $post = geodir_get_post_info($_REQUEST['pid']); |
|
| 783 | 783 | $post_type = $post->post_type; |
| 784 | 784 | $post_id = $_REQUEST['pid']; |
| 785 | - } elseif ( isset( $post->post_type ) && $post->post_type != '' ) {
|
|
| 785 | + } elseif (isset($post->post_type) && $post->post_type != '') {
|
|
| 786 | 786 | $post_type = $post->post_type; |
| 787 | 787 | $post_id = $post->ID; |
| 788 | 788 | } |
| 789 | 789 | |
| 790 | - if ( $relate_to == 'category' ) {
|
|
| 790 | + if ($relate_to == 'category') {
|
|
| 791 | 791 | |
| 792 | - $category_taxonomy = $post_type . $relate_to; |
|
| 793 | - if ( isset( $post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '' ) {
|
|
| 794 | - $category = explode( ',', trim( $post->{$category_taxonomy}, ',' ) );
|
|
| 792 | + $category_taxonomy = $post_type.$relate_to; |
|
| 793 | + if (isset($post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '') {
|
|
| 794 | + $category = explode(',', trim($post->{$category_taxonomy}, ','));
|
|
| 795 | 795 | } |
| 796 | 796 | |
| 797 | - } elseif ( $relate_to == 'tags' ) {
|
|
| 797 | + } elseif ($relate_to == 'tags') {
|
|
| 798 | 798 | |
| 799 | - $category_taxonomy = $post_type . '_' . $relate_to; |
|
| 800 | - if ( $post->post_tags != '' ) {
|
|
| 801 | - $category = explode( ',', trim( $post->post_tags, ',' ) ); |
|
| 799 | + $category_taxonomy = $post_type.'_'.$relate_to; |
|
| 800 | + if ($post->post_tags != '') {
|
|
| 801 | + $category = explode(',', trim($post->post_tags, ','));
|
|
| 802 | 802 | } |
| 803 | 803 | $tax_field = 'name'; |
| 804 | 804 | } |
| 805 | 805 | |
| 806 | 806 | /* --- return false in invalid request --- */ |
| 807 | - if ( empty( $category ) ) {
|
|
| 807 | + if (empty($category)) {
|
|
| 808 | 808 | return false; |
| 809 | 809 | } |
| 810 | 810 | |
| 811 | 811 | $all_postypes = geodir_get_posttypes(); |
| 812 | 812 | |
| 813 | - if ( ! in_array( $post_type, $all_postypes ) ) {
|
|
| 813 | + if (!in_array($post_type, $all_postypes)) {
|
|
| 814 | 814 | return false; |
| 815 | 815 | } |
| 816 | 816 | |
| 817 | 817 | /* --- return false in invalid request --- */ |
| 818 | 818 | |
| 819 | 819 | $location_url = ''; |
| 820 | - if ( $add_location_filter != '0' ) {
|
|
| 820 | + if ($add_location_filter != '0') {
|
|
| 821 | 821 | $location_url = array(); |
| 822 | - $geodir_show_location_url = get_option( 'geodir_show_location_url' ); |
|
| 822 | + $geodir_show_location_url = get_option('geodir_show_location_url');
|
|
| 823 | 823 | |
| 824 | - $gd_city = get_query_var( 'gd_city' ); |
|
| 824 | + $gd_city = get_query_var('gd_city');
|
|
| 825 | 825 | |
| 826 | - if ( $gd_city ) {
|
|
| 827 | - $gd_country = get_query_var( 'gd_country' ); |
|
| 828 | - $gd_region = get_query_var( 'gd_region' ); |
|
| 826 | + if ($gd_city) {
|
|
| 827 | + $gd_country = get_query_var('gd_country');
|
|
| 828 | + $gd_region = get_query_var('gd_region');
|
|
| 829 | 829 | } else {
|
| 830 | 830 | $location = geodir_get_default_location(); |
| 831 | 831 | |
| 832 | - $gd_country = isset( $location->country_slug ) ? $location->country_slug : ''; |
|
| 833 | - $gd_region = isset( $location->region_slug ) ? $location->region_slug : ''; |
|
| 834 | - $gd_city = isset( $location->city_slug ) ? $location->city_slug : ''; |
|
| 832 | + $gd_country = isset($location->country_slug) ? $location->country_slug : ''; |
|
| 833 | + $gd_region = isset($location->region_slug) ? $location->region_slug : ''; |
|
| 834 | + $gd_city = isset($location->city_slug) ? $location->city_slug : ''; |
|
| 835 | 835 | } |
| 836 | 836 | |
| 837 | - if ( $geodir_show_location_url == 'all' ) {
|
|
| 837 | + if ($geodir_show_location_url == 'all') {
|
|
| 838 | 838 | $location_url[] = $gd_country; |
| 839 | 839 | $location_url[] = $gd_region; |
| 840 | - } else if ( $geodir_show_location_url == 'country_city' ) {
|
|
| 840 | + } else if ($geodir_show_location_url == 'country_city') {
|
|
| 841 | 841 | $location_url[] = $gd_country; |
| 842 | - } else if ( $geodir_show_location_url == 'region_city' ) {
|
|
| 842 | + } else if ($geodir_show_location_url == 'region_city') {
|
|
| 843 | 843 | $location_url[] = $gd_region; |
| 844 | 844 | } |
| 845 | 845 | |
| 846 | 846 | $location_url[] = $gd_city; |
| 847 | 847 | |
| 848 | - $location_url = implode( '/', $location_url ); |
|
| 848 | + $location_url = implode('/', $location_url);
|
|
| 849 | 849 | } |
| 850 | 850 | |
| 851 | 851 | |
| 852 | - if ( ! empty( $category ) ) {
|
|
| 852 | + if (!empty($category)) {
|
|
| 853 | 853 | global $geodir_add_location_url; |
| 854 | 854 | $geodir_add_location_url = '0'; |
| 855 | - if ( $add_location_filter != '0' ) {
|
|
| 855 | + if ($add_location_filter != '0') {
|
|
| 856 | 856 | $geodir_add_location_url = '1'; |
| 857 | 857 | } |
| 858 | - $viewall_url = get_term_link( (int) $category[0], $post_type . $category_taxonomy ); |
|
| 858 | + $viewall_url = get_term_link((int) $category[0], $post_type.$category_taxonomy); |
|
| 859 | 859 | $geodir_add_location_url = null; |
| 860 | 860 | } |
| 861 | 861 | ob_start(); |
@@ -865,24 +865,24 @@ discard block |
||
| 865 | 865 | <div class="geodir_locations geodir_location_listing"> |
| 866 | 866 | |
| 867 | 867 | <?php |
| 868 | - if ( isset( $request['is_widget'] ) && $request['is_widget'] == '1' ) {
|
|
| 868 | + if (isset($request['is_widget']) && $request['is_widget'] == '1') {
|
|
| 869 | 869 | /** geodir_before_title filter Documented in geodirectory_widgets.php */ |
| 870 | - $before_title = isset( $before_title ) ? $before_title : apply_filters( 'geodir_before_title', '<h3 class="widget-title">' ); |
|
| 870 | + $before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
|
|
| 871 | 871 | /** geodir_after_title filter Documented in geodirectory_widgets.php */ |
| 872 | - $after_title = isset( $after_title ) ? $after_title : apply_filters( 'geodir_after_title', '</h3>' ); |
|
| 872 | + $after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
|
|
| 873 | 873 | ?> |
| 874 | 874 | <div class="location_list_heading clearfix"> |
| 875 | - <?php echo $before_title . $title . $after_title; ?> |
|
| 875 | + <?php echo $before_title.$title.$after_title; ?> |
|
| 876 | 876 | </div> |
| 877 | 877 | <?php |
| 878 | 878 | } |
| 879 | 879 | $query_args = array( |
| 880 | 880 | 'posts_per_page' => $post_number, |
| 881 | 881 | 'is_geodir_loop' => true, |
| 882 | - 'gd_location' => ( $add_location_filter ) ? true : false, |
|
| 882 | + 'gd_location' => ($add_location_filter) ? true : false, |
|
| 883 | 883 | 'post_type' => $post_type, |
| 884 | 884 | 'order_by' => $list_sort, |
| 885 | - 'post__not_in' => array( $post_id ), |
|
| 885 | + 'post__not_in' => array($post_id), |
|
| 886 | 886 | 'excerpt_length' => $character_count, |
| 887 | 887 | 'related_listings' => $is_display |
| 888 | 888 | ); |
@@ -893,7 +893,7 @@ discard block |
||
| 893 | 893 | 'terms' => $category |
| 894 | 894 | ); |
| 895 | 895 | |
| 896 | - $query_args['tax_query'] = array( $tax_query ); |
|
| 896 | + $query_args['tax_query'] = array($tax_query); |
|
| 897 | 897 | |
| 898 | 898 | global $gridview_columns, $post; |
| 899 | 899 | |
@@ -905,21 +905,21 @@ discard block |
||
| 905 | 905 | * @param array $query_args The query array. |
| 906 | 906 | * @param array $request Related posts request array. |
| 907 | 907 | */ |
| 908 | - $query_args = apply_filters( 'geodir_related_posts_widget_query_args', $query_args, $request ); |
|
| 908 | + $query_args = apply_filters('geodir_related_posts_widget_query_args', $query_args, $request);
|
|
| 909 | 909 | |
| 910 | - query_posts( $query_args ); |
|
| 910 | + query_posts($query_args); |
|
| 911 | 911 | |
| 912 | - if ( strstr( $layout, 'gridview' ) ) {
|
|
| 913 | - $listing_view_exp = explode( '_', $layout ); |
|
| 912 | + if (strstr($layout, 'gridview')) {
|
|
| 913 | + $listing_view_exp = explode('_', $layout);
|
|
| 914 | 914 | $gridview_columns = $layout; |
| 915 | 915 | $layout = $listing_view_exp[0]; |
| 916 | - } else if ( $layout == 'list' ) {
|
|
| 916 | + } else if ($layout == 'list') {
|
|
| 917 | 917 | $gridview_columns = ''; |
| 918 | 918 | } |
| 919 | 919 | $related_posts = true; |
| 920 | 920 | |
| 921 | 921 | $related_nearest = false; |
| 922 | - if ( $list_sort == 'nearest' ) {
|
|
| 922 | + if ($list_sort == 'nearest') {
|
|
| 923 | 923 | $related_nearest = true; |
| 924 | 924 | } |
| 925 | 925 | |
@@ -929,14 +929,14 @@ discard block |
||
| 929 | 929 | * |
| 930 | 930 | * @since 1.0.0 |
| 931 | 931 | */ |
| 932 | - $template = apply_filters( "geodir_template_part-related-listing-listview", geodir_locate_template( 'listing-listview' ) ); |
|
| 932 | + $template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
|
|
| 933 | 933 | |
| 934 | 934 | /** |
| 935 | 935 | * Includes related listing listview template. |
| 936 | 936 | * |
| 937 | 937 | * @since 1.0.0 |
| 938 | 938 | */ |
| 939 | - include( $template ); |
|
| 939 | + include($template); |
|
| 940 | 940 | |
| 941 | 941 | wp_reset_query(); |
| 942 | 942 | $post = $origi_post; |
@@ -964,12 +964,12 @@ discard block |
||
| 964 | 964 | function geodir_category_count_script() {
|
| 965 | 965 | global $geodir_post_category_str; |
| 966 | 966 | |
| 967 | - if ( ! empty( $geodir_post_category_str ) ) {
|
|
| 968 | - $geodir_post_category_str = serialize( $geodir_post_category_str ); |
|
| 967 | + if (!empty($geodir_post_category_str)) {
|
|
| 968 | + $geodir_post_category_str = serialize($geodir_post_category_str); |
|
| 969 | 969 | } |
| 970 | 970 | |
| 971 | - $all_var['post_category_array'] = html_entity_decode( (string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8' ); |
|
| 972 | - $script = "var post_category_array = " . json_encode( $all_var ) . ';'; |
|
| 971 | + $all_var['post_category_array'] = html_entity_decode((string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8'); |
|
| 972 | + $script = "var post_category_array = ".json_encode($all_var).';'; |
|
| 973 | 973 | echo '<script>'; |
| 974 | 974 | echo $script; |
| 975 | 975 | echo '</script>'; |
@@ -984,8 +984,8 @@ discard block |
||
| 984 | 984 | * @return string Returns the default language. |
| 985 | 985 | */ |
| 986 | 986 | function geodir_get_map_default_language() {
|
| 987 | - $geodir_default_map_language = get_option( 'geodir_default_map_language' ); |
|
| 988 | - if ( empty( $geodir_default_map_language ) ) {
|
|
| 987 | + $geodir_default_map_language = get_option('geodir_default_map_language');
|
|
| 988 | + if (empty($geodir_default_map_language)) {
|
|
| 989 | 989 | $geodir_default_map_language = 'en'; |
| 990 | 990 | } |
| 991 | 991 | |
@@ -996,7 +996,7 @@ discard block |
||
| 996 | 996 | * |
| 997 | 997 | * @param string $geodir_default_map_language Default map language. |
| 998 | 998 | */ |
| 999 | - return apply_filters( 'geodir_default_map_language', $geodir_default_map_language ); |
|
| 999 | + return apply_filters('geodir_default_map_language', $geodir_default_map_language);
|
|
| 1000 | 1000 | } |
| 1001 | 1001 | |
| 1002 | 1002 | /** |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | * @return string Returns the api key. |
| 1008 | 1008 | */ |
| 1009 | 1009 | function geodir_get_map_api_key() {
|
| 1010 | - $key = get_option( 'geodir_google_api_key' ); |
|
| 1010 | + $key = get_option('geodir_google_api_key');
|
|
| 1011 | 1011 | |
| 1012 | 1012 | /** |
| 1013 | 1013 | * Filter Google maps api key. |
@@ -1016,7 +1016,7 @@ discard block |
||
| 1016 | 1016 | * |
| 1017 | 1017 | * @param string $key Google maps api key. |
| 1018 | 1018 | */ |
| 1019 | - return apply_filters( 'geodir_google_api_key', $key ); |
|
| 1019 | + return apply_filters('geodir_google_api_key', $key);
|
|
| 1020 | 1020 | } |
| 1021 | 1021 | |
| 1022 | 1022 | |
@@ -1035,20 +1035,20 @@ discard block |
||
| 1035 | 1035 | global $wp, $post, $wp_query, $wpdb, $geodir_addon_list; |
| 1036 | 1036 | |
| 1037 | 1037 | $is_geodir_page = geodir_is_geodir_page(); |
| 1038 | - if ( ! $is_geodir_page ) {
|
|
| 1038 | + if (!$is_geodir_page) {
|
|
| 1039 | 1039 | return; |
| 1040 | 1040 | }// if non GD page, bail |
| 1041 | 1041 | |
| 1042 | 1042 | $use_gd_meta = true; |
| 1043 | - if ( class_exists( 'WPSEO_Frontend' ) || class_exists( 'All_in_One_SEO_Pack' ) ) {
|
|
| 1043 | + if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
|
|
| 1044 | 1044 | $use_gd_meta = false; |
| 1045 | 1045 | |
| 1046 | - if ( geodir_is_page( 'search' ) ) {
|
|
| 1046 | + if (geodir_is_page('search')) {
|
|
| 1047 | 1047 | $use_gd_meta = true; |
| 1048 | 1048 | } |
| 1049 | 1049 | } |
| 1050 | 1050 | |
| 1051 | - if ( ! $use_gd_meta ) {
|
|
| 1051 | + if (!$use_gd_meta) {
|
|
| 1052 | 1052 | return; |
| 1053 | 1053 | }// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active. |
| 1054 | 1054 | |
@@ -1056,170 +1056,170 @@ discard block |
||
| 1056 | 1056 | |
| 1057 | 1057 | $all_postypes = geodir_get_posttypes(); |
| 1058 | 1058 | |
| 1059 | - $geodir_taxonomies = geodir_get_taxonomies( '', true ); |
|
| 1059 | + $geodir_taxonomies = geodir_get_taxonomies('', true);
|
|
| 1060 | 1060 | |
| 1061 | 1061 | $meta_desc = ''; |
| 1062 | 1062 | $meta_key = ''; |
| 1063 | - if ( isset( $current_term->ID ) && $current_term->ID == geodir_location_page_id() ) {
|
|
| 1063 | + if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
|
|
| 1064 | 1064 | /** |
| 1065 | 1065 | * Filter SEO meta location description. |
| 1066 | 1066 | * |
| 1067 | 1067 | * @since 1.0.0 |
| 1068 | 1068 | */ |
| 1069 | - $meta_desc = apply_filters( 'geodir_seo_meta_location_description', '' ); |
|
| 1069 | + $meta_desc = apply_filters('geodir_seo_meta_location_description', '');
|
|
| 1070 | 1070 | $meta_desc .= ''; |
| 1071 | 1071 | } |
| 1072 | - if ( have_posts() && is_single() OR is_page() ) {
|
|
| 1073 | - while ( have_posts() ) {
|
|
| 1072 | + if (have_posts() && is_single() OR is_page()) {
|
|
| 1073 | + while (have_posts()) {
|
|
| 1074 | 1074 | the_post(); |
| 1075 | 1075 | |
| 1076 | - if ( has_excerpt() ) {
|
|
| 1077 | - $out_excerpt = strip_tags( strip_shortcodes( get_the_excerpt() ) ); |
|
| 1078 | - if ( empty( $out_excerpt ) ) {
|
|
| 1079 | - $out_excerpt = strip_tags( do_shortcode( get_the_excerpt() ) ); |
|
| 1076 | + if (has_excerpt()) {
|
|
| 1077 | + $out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt())); |
|
| 1078 | + if (empty($out_excerpt)) {
|
|
| 1079 | + $out_excerpt = strip_tags(do_shortcode(get_the_excerpt())); |
|
| 1080 | 1080 | } |
| 1081 | - $out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $out_excerpt ); |
|
| 1081 | + $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
|
|
| 1082 | 1082 | } else {
|
| 1083 | - $out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $post->post_content ); |
|
| 1084 | - $out_excerpt = strip_tags( strip_shortcodes( $out_excerpt ) ); |
|
| 1085 | - if ( empty( $out_excerpt ) ) {
|
|
| 1086 | - $out_excerpt = strip_tags( do_shortcode( $out_excerpt ) ); // parse short code from content |
|
| 1083 | + $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
|
|
| 1084 | + $out_excerpt = strip_tags(strip_shortcodes($out_excerpt)); |
|
| 1085 | + if (empty($out_excerpt)) {
|
|
| 1086 | + $out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content |
|
| 1087 | 1087 | } |
| 1088 | - $out_excerpt = trim( wp_trim_words( $out_excerpt, 35, '' ), '.!?,;:-' ); |
|
| 1088 | + $out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-'); |
|
| 1089 | 1089 | } |
| 1090 | 1090 | |
| 1091 | 1091 | $meta_desc .= $out_excerpt; |
| 1092 | 1092 | } |
| 1093 | - } elseif ( ( is_category() || is_tag() ) && isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
|
|
| 1094 | - if ( is_category() ) {
|
|
| 1095 | - $meta_desc .= __( "Posts related to Category:", 'geodirectory' ) . " " . ucfirst( single_cat_title( "", false ) ); |
|
| 1096 | - } elseif ( is_tag() ) {
|
|
| 1097 | - $meta_desc .= __( "Posts related to Tag:", 'geodirectory' ) . " " . ucfirst( single_tag_title( "", false ) ); |
|
| 1093 | + } elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
|
|
| 1094 | + if (is_category()) {
|
|
| 1095 | + $meta_desc .= __("Posts related to Category:", 'geodirectory')." ".ucfirst(single_cat_title("", false));
|
|
| 1096 | + } elseif (is_tag()) {
|
|
| 1097 | + $meta_desc .= __("Posts related to Tag:", 'geodirectory')." ".ucfirst(single_tag_title("", false));
|
|
| 1098 | 1098 | } |
| 1099 | - } elseif ( isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
|
|
| 1100 | - $meta_desc .= isset( $current_term->description ) ? $current_term->description : ''; |
|
| 1099 | + } elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
|
|
| 1100 | + $meta_desc .= isset($current_term->description) ? $current_term->description : ''; |
|
| 1101 | 1101 | } |
| 1102 | 1102 | |
| 1103 | 1103 | |
| 1104 | 1104 | $geodir_post_type = geodir_get_current_posttype(); |
| 1105 | - $geodir_post_type_info = get_post_type_object( $geodir_post_type ); |
|
| 1106 | - $geodir_is_page_listing = geodir_is_page( 'listing' ) ? true : false; |
|
| 1107 | - |
|
| 1108 | - $category_taxonomy = geodir_get_taxonomies( $geodir_post_type ); |
|
| 1109 | - $tag_taxonomy = geodir_get_taxonomies( $geodir_post_type, true ); |
|
| 1110 | - |
|
| 1111 | - $geodir_is_category = isset( $category_taxonomy[0] ) && get_query_var( $category_taxonomy[0] ) ? get_query_var( $category_taxonomy[0] ) : false; |
|
| 1112 | - $geodir_is_tag = isset( $tag_taxonomy[0] ) && get_query_var( $tag_taxonomy[0] ) ? true : false; |
|
| 1113 | - |
|
| 1114 | - $geodir_is_search = geodir_is_page( 'search' ) ? true : false; |
|
| 1115 | - $geodir_is_location = geodir_is_page( 'location' ) ? true : false; |
|
| 1116 | - $geodir_location_manager = isset( $geodir_addon_list['geodir_location_manager'] ) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false; |
|
| 1117 | - $godir_location_terms = geodir_get_current_location_terms( 'query_vars' ); |
|
| 1118 | - $gd_city = $geodir_location_manager && isset( $godir_location_terms['gd_city'] ) ? $godir_location_terms['gd_city'] : null; |
|
| 1119 | - $gd_region = $geodir_location_manager && isset( $godir_location_terms['gd_region'] ) ? $godir_location_terms['gd_region'] : null; |
|
| 1120 | - $gd_country = $geodir_location_manager && isset( $godir_location_terms['gd_country'] ) ? $godir_location_terms['gd_country'] : null; |
|
| 1121 | - $replace_location = __( 'Everywhere', 'geodirectory' ); |
|
| 1105 | + $geodir_post_type_info = get_post_type_object($geodir_post_type); |
|
| 1106 | + $geodir_is_page_listing = geodir_is_page('listing') ? true : false;
|
|
| 1107 | + |
|
| 1108 | + $category_taxonomy = geodir_get_taxonomies($geodir_post_type); |
|
| 1109 | + $tag_taxonomy = geodir_get_taxonomies($geodir_post_type, true); |
|
| 1110 | + |
|
| 1111 | + $geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false; |
|
| 1112 | + $geodir_is_tag = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false; |
|
| 1113 | + |
|
| 1114 | + $geodir_is_search = geodir_is_page('search') ? true : false;
|
|
| 1115 | + $geodir_is_location = geodir_is_page('location') ? true : false;
|
|
| 1116 | + $geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false; |
|
| 1117 | + $godir_location_terms = geodir_get_current_location_terms('query_vars');
|
|
| 1118 | + $gd_city = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : null; |
|
| 1119 | + $gd_region = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : null; |
|
| 1120 | + $gd_country = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : null; |
|
| 1121 | + $replace_location = __('Everywhere', 'geodirectory');
|
|
| 1122 | 1122 | $location_id = null; |
| 1123 | - if ( $geodir_location_manager ) {
|
|
| 1124 | - $sql = $wpdb->prepare( "SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array( $gd_city ) ); |
|
| 1125 | - $location_id = (int) $wpdb->get_var( $sql ); |
|
| 1123 | + if ($geodir_location_manager) {
|
|
| 1124 | + $sql = $wpdb->prepare("SELECT location_id FROM ".POST_LOCATION_TABLE." WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
|
|
| 1125 | + $location_id = (int) $wpdb->get_var($sql); |
|
| 1126 | 1126 | $location_type = geodir_what_is_current_location(); |
| 1127 | - if ( $location_type == 'city' ) {
|
|
| 1128 | - $replace_location = geodir_get_current_location( array( 'what' => 'city', 'echo' => false ) ); |
|
| 1129 | - } elseif ( $location_type == 'region' ) {
|
|
| 1130 | - $replace_location = geodir_get_current_location( array( 'what' => 'region', 'echo' => false ) ); |
|
| 1131 | - } elseif ( $location_type == 'country' ) {
|
|
| 1132 | - $replace_location = geodir_get_current_location( array( 'what' => 'country', 'echo' => false ) ); |
|
| 1133 | - $replace_location = __( $replace_location, 'geodirectory' ); |
|
| 1127 | + if ($location_type == 'city') {
|
|
| 1128 | + $replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
|
|
| 1129 | + } elseif ($location_type == 'region') {
|
|
| 1130 | + $replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
|
|
| 1131 | + } elseif ($location_type == 'country') {
|
|
| 1132 | + $replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
|
|
| 1133 | + $replace_location = __($replace_location, 'geodirectory'); |
|
| 1134 | 1134 | } |
| 1135 | - $country = get_query_var( 'gd_country' ); |
|
| 1136 | - $region = get_query_var( 'gd_region' ); |
|
| 1137 | - $city = get_query_var( 'gd_city' ); |
|
| 1135 | + $country = get_query_var('gd_country');
|
|
| 1136 | + $region = get_query_var('gd_region');
|
|
| 1137 | + $city = get_query_var('gd_city');
|
|
| 1138 | 1138 | $current_location = ''; |
| 1139 | - if ( $country != '' ) {
|
|
| 1140 | - $current_location = get_actual_location_name( 'country', $country, true ); |
|
| 1139 | + if ($country != '') {
|
|
| 1140 | + $current_location = get_actual_location_name('country', $country, true);
|
|
| 1141 | 1141 | } |
| 1142 | - if ( $region != '' ) {
|
|
| 1143 | - $current_location = get_actual_location_name( 'region', $region ); |
|
| 1142 | + if ($region != '') {
|
|
| 1143 | + $current_location = get_actual_location_name('region', $region);
|
|
| 1144 | 1144 | } |
| 1145 | - if ( $city != '' ) {
|
|
| 1146 | - $current_location = get_actual_location_name( 'city', $city ); |
|
| 1145 | + if ($city != '') {
|
|
| 1146 | + $current_location = get_actual_location_name('city', $city);
|
|
| 1147 | 1147 | } |
| 1148 | 1148 | $replace_location = $current_location != '' ? $current_location : $replace_location; |
| 1149 | 1149 | } |
| 1150 | 1150 | |
| 1151 | 1151 | $geodir_meta_keys = ''; |
| 1152 | 1152 | $geodir_meta_desc = ''; |
| 1153 | - if ( $is_geodir_page && ! empty( $geodir_post_type_info ) ) {
|
|
| 1154 | - if ( $geodir_is_page_listing || $geodir_is_search || geodir_is_page( 'add-listing' ) ) {
|
|
| 1155 | - $geodir_meta_keys = isset( $geodir_post_type_info->seo['meta_keyword'] ) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys; |
|
| 1153 | + if ($is_geodir_page && !empty($geodir_post_type_info)) {
|
|
| 1154 | + if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
|
|
| 1155 | + $geodir_meta_keys = isset($geodir_post_type_info->seo['meta_keyword']) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys; |
|
| 1156 | 1156 | |
| 1157 | - $geodir_meta_desc = isset( $geodir_post_type_info->description ) ? $geodir_post_type_info->description : $geodir_meta_desc; |
|
| 1158 | - $geodir_meta_desc = isset( $geodir_post_type_info->seo['meta_description'] ) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc; |
|
| 1157 | + $geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc; |
|
| 1158 | + $geodir_meta_desc = isset($geodir_post_type_info->seo['meta_description']) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc; |
|
| 1159 | 1159 | |
| 1160 | - if ( $geodir_is_category ) {
|
|
| 1161 | - $category = $geodir_is_category ? get_term_by( 'slug', $geodir_is_category, $category_taxonomy[0] ) : null; |
|
| 1162 | - if ( isset( $category->term_id ) && ! empty( $category->term_id ) ) {
|
|
| 1160 | + if ($geodir_is_category) {
|
|
| 1161 | + $category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : null;
|
|
| 1162 | + if (isset($category->term_id) && !empty($category->term_id)) {
|
|
| 1163 | 1163 | $category_id = $category->term_id; |
| 1164 | - $category_desc = trim( $category->description ) != '' ? trim( $category->description ) : get_tax_meta( $category_id, 'ct_cat_top_desc', false, $geodir_post_type ); |
|
| 1165 | - if ( $location_id ) {
|
|
| 1166 | - $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id; |
|
| 1167 | - $cat_loc_option = get_option( $option_name ); |
|
| 1168 | - |
|
| 1169 | - $gd_cat_loc_default = ! empty( $cat_loc_option ) && isset( $cat_loc_option['gd_cat_loc_default'] ) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false; |
|
| 1170 | - if ( ! $gd_cat_loc_default ) {
|
|
| 1171 | - $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id; |
|
| 1172 | - $option = get_option( $option_name ); |
|
| 1173 | - $category_desc = isset( $option['gd_cat_loc_desc'] ) && trim( $option['gd_cat_loc_desc'] ) != '' ? trim( $option['gd_cat_loc_desc'] ) : $category_desc; |
|
| 1164 | + $category_desc = trim($category->description) != '' ? trim($category->description) : get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type); |
|
| 1165 | + if ($location_id) {
|
|
| 1166 | + $option_name = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id; |
|
| 1167 | + $cat_loc_option = get_option($option_name); |
|
| 1168 | + |
|
| 1169 | + $gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false; |
|
| 1170 | + if (!$gd_cat_loc_default) {
|
|
| 1171 | + $option_name = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id.'_'.$location_id; |
|
| 1172 | + $option = get_option($option_name); |
|
| 1173 | + $category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc; |
|
| 1174 | 1174 | } |
| 1175 | 1175 | } |
| 1176 | - $geodir_meta_desc = __( "Posts related to Category:", 'geodirectory' ) . " " . ucfirst( single_cat_title( "", false ) ) . '. ' . $category_desc; |
|
| 1176 | + $geodir_meta_desc = __("Posts related to Category:", 'geodirectory')." ".ucfirst(single_cat_title("", false)).'. '.$category_desc;
|
|
| 1177 | 1177 | } |
| 1178 | - } else if ( $geodir_is_tag ) {
|
|
| 1179 | - $geodir_meta_desc = __( "Posts related to Tag:", 'geodirectory' ) . " " . ucfirst( single_tag_title( "", false ) ) . '. ' . $geodir_meta_desc; |
|
| 1178 | + } else if ($geodir_is_tag) {
|
|
| 1179 | + $geodir_meta_desc = __("Posts related to Tag:", 'geodirectory')." ".ucfirst(single_tag_title("", false)).'. '.$geodir_meta_desc;
|
|
| 1180 | 1180 | } |
| 1181 | 1181 | } |
| 1182 | 1182 | } |
| 1183 | 1183 | |
| 1184 | 1184 | |
| 1185 | 1185 | $gd_page = ''; |
| 1186 | - if ( geodir_is_page( 'home' ) ) {
|
|
| 1186 | + if (geodir_is_page('home')) {
|
|
| 1187 | 1187 | $gd_page = 'home'; |
| 1188 | - $meta_desc = ( get_option( 'geodir_meta_desc_homepage' ) ) ? get_option( 'geodir_meta_desc_homepage' ) : $meta_desc; |
|
| 1189 | - } elseif ( geodir_is_page( 'detail' ) ) {
|
|
| 1188 | + $meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
|
|
| 1189 | + } elseif (geodir_is_page('detail')) {
|
|
| 1190 | 1190 | $gd_page = 'detail'; |
| 1191 | - $meta_desc = ( get_option( 'geodir_meta_desc_detail' ) ) ? get_option( 'geodir_meta_desc_detail' ) : $meta_desc; |
|
| 1192 | - } elseif ( geodir_is_page( 'pt' ) ) {
|
|
| 1191 | + $meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
|
|
| 1192 | + } elseif (geodir_is_page('pt')) {
|
|
| 1193 | 1193 | $gd_page = 'pt'; |
| 1194 | - $meta_desc = ( get_option( 'geodir_meta_desc_pt' ) ) ? get_option( 'geodir_meta_desc_pt' ) : $meta_desc; |
|
| 1195 | - } elseif ( geodir_is_page( 'listing' ) ) {
|
|
| 1194 | + $meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
|
|
| 1195 | + } elseif (geodir_is_page('listing')) {
|
|
| 1196 | 1196 | $gd_page = 'listing'; |
| 1197 | - $meta_desc = ( get_option( 'geodir_meta_desc_listing' ) ) ? get_option( 'geodir_meta_desc_listing' ) : $meta_desc; |
|
| 1198 | - } elseif ( geodir_is_page( 'location' ) ) {
|
|
| 1197 | + $meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
|
|
| 1198 | + } elseif (geodir_is_page('location')) {
|
|
| 1199 | 1199 | $gd_page = 'location'; |
| 1200 | - $meta_desc = ( get_option( 'geodir_meta_desc_location' ) ) ? get_option( 'geodir_meta_desc_location' ) : $meta_desc; |
|
| 1201 | - $meta_desc = apply_filters( 'geodir_seo_meta_location_description', $meta_desc ); |
|
| 1200 | + $meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
|
|
| 1201 | + $meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
|
|
| 1202 | 1202 | |
| 1203 | - } elseif ( geodir_is_page( 'search' ) ) {
|
|
| 1203 | + } elseif (geodir_is_page('search')) {
|
|
| 1204 | 1204 | $gd_page = 'search'; |
| 1205 | - $meta_desc = ( get_option( 'geodir_meta_desc_search' ) ) ? get_option( 'geodir_meta_desc_search' ) : $meta_desc; |
|
| 1206 | - } elseif ( geodir_is_page( 'add-listing' ) ) {
|
|
| 1205 | + $meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
|
|
| 1206 | + } elseif (geodir_is_page('add-listing')) {
|
|
| 1207 | 1207 | $gd_page = 'add-listing'; |
| 1208 | - $meta_desc = ( get_option( 'geodir_meta_desc_add-listing' ) ) ? get_option( 'geodir_meta_desc_add-listing' ) : $meta_desc; |
|
| 1209 | - } elseif ( geodir_is_page( 'author' ) ) {
|
|
| 1208 | + $meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
|
|
| 1209 | + } elseif (geodir_is_page('author')) {
|
|
| 1210 | 1210 | $gd_page = 'author'; |
| 1211 | - $meta_desc = ( get_option( 'geodir_meta_desc_author' ) ) ? get_option( 'geodir_meta_desc_author' ) : $meta_desc; |
|
| 1212 | - } elseif ( geodir_is_page( 'login' ) ) {
|
|
| 1211 | + $meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
|
|
| 1212 | + } elseif (geodir_is_page('login')) {
|
|
| 1213 | 1213 | $gd_page = 'login'; |
| 1214 | - $meta_desc = ( get_option( 'geodir_meta_desc_login' ) ) ? get_option( 'geodir_meta_desc_login' ) : $meta_desc; |
|
| 1215 | - } elseif ( geodir_is_page( 'listing-success' ) ) {
|
|
| 1214 | + $meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
|
|
| 1215 | + } elseif (geodir_is_page('listing-success')) {
|
|
| 1216 | 1216 | $gd_page = 'listing-success'; |
| 1217 | - $meta_desc = ( get_option( 'geodir_meta_desc_listing-success' ) ) ? get_option( 'geodir_meta_desc_listing-success' ) : $meta_desc; |
|
| 1217 | + $meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
|
|
| 1218 | 1218 | } |
| 1219 | 1219 | |
| 1220 | 1220 | |
| 1221 | - if ( $meta_desc ) {
|
|
| 1222 | - $meta_desc = stripslashes_deep( $meta_desc ); |
|
| 1221 | + if ($meta_desc) {
|
|
| 1222 | + $meta_desc = stripslashes_deep($meta_desc); |
|
| 1223 | 1223 | /** |
| 1224 | 1224 | * Filter page description to replace variables. |
| 1225 | 1225 | * |
@@ -1228,7 +1228,7 @@ discard block |
||
| 1228 | 1228 | * @param string $title The page description including variables. |
| 1229 | 1229 | * @param string $gd_page The GeoDirectory page type if any. |
| 1230 | 1230 | */ |
| 1231 | - $meta_desc = apply_filters( 'geodir_seo_meta_description_pre', __( $meta_desc, 'geodirectory' ), $gd_page, '' ); |
|
| 1231 | + $meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'), $gd_page, '');
|
|
| 1232 | 1232 | |
| 1233 | 1233 | /** |
| 1234 | 1234 | * Filter SEO meta description. |
@@ -1237,49 +1237,49 @@ discard block |
||
| 1237 | 1237 | * |
| 1238 | 1238 | * @param string $meta_desc Meta description content. |
| 1239 | 1239 | */ |
| 1240 | - echo apply_filters( 'geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc ); |
|
| 1240 | + echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="'.$meta_desc.'" />', $meta_desc);
|
|
| 1241 | 1241 | } |
| 1242 | 1242 | |
| 1243 | 1243 | // meta keywords |
| 1244 | - if ( isset( $post->post_type ) && in_array( $post->post_type, $all_postypes ) ) {
|
|
| 1245 | - $place_tags = wp_get_post_terms( $post->ID, $post->post_type . '_tags', array( "fields" => "names" ) ); |
|
| 1246 | - $place_cats = wp_get_post_terms( $post->ID, $post->post_type . 'category', array( "fields" => "names" ) ); |
|
| 1244 | + if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
|
|
| 1245 | + $place_tags = wp_get_post_terms($post->ID, $post->post_type.'_tags', array("fields" => "names"));
|
|
| 1246 | + $place_cats = wp_get_post_terms($post->ID, $post->post_type.'category', array("fields" => "names"));
|
|
| 1247 | 1247 | |
| 1248 | - $meta_key .= implode( ", ", array_merge( (array) $place_cats, (array) $place_tags ) ); |
|
| 1248 | + $meta_key .= implode(", ", array_merge((array) $place_cats, (array) $place_tags));
|
|
| 1249 | 1249 | } else {
|
| 1250 | 1250 | $posttags = get_the_tags(); |
| 1251 | - if ( $posttags ) {
|
|
| 1252 | - foreach ( $posttags as $tag ) {
|
|
| 1253 | - $meta_key .= $tag->name . ' '; |
|
| 1251 | + if ($posttags) {
|
|
| 1252 | + foreach ($posttags as $tag) {
|
|
| 1253 | + $meta_key .= $tag->name.' '; |
|
| 1254 | 1254 | } |
| 1255 | 1255 | } else {
|
| 1256 | - $tags = get_tags( array( 'orderby' => 'count', 'order' => 'DESC' ) ); |
|
| 1256 | + $tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
|
|
| 1257 | 1257 | $xt = 1; |
| 1258 | 1258 | |
| 1259 | - foreach ( $tags as $tag ) {
|
|
| 1260 | - if ( $xt <= 20 ) {
|
|
| 1261 | - $meta_key .= $tag->name . ", "; |
|
| 1259 | + foreach ($tags as $tag) {
|
|
| 1260 | + if ($xt <= 20) {
|
|
| 1261 | + $meta_key .= $tag->name.", "; |
|
| 1262 | 1262 | } |
| 1263 | 1263 | |
| 1264 | - $xt ++; |
|
| 1264 | + $xt++; |
|
| 1265 | 1265 | } |
| 1266 | 1266 | } |
| 1267 | 1267 | } |
| 1268 | 1268 | |
| 1269 | - $meta_key = $meta_key != '' ? rtrim( trim( $meta_key ), "," ) : $meta_key; |
|
| 1270 | - $geodir_meta_keys = $geodir_meta_keys != '' ? ( $meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys ) : $meta_key; |
|
| 1271 | - if ( $geodir_meta_keys != '' ) {
|
|
| 1272 | - $geodir_meta_keys = strip_tags( $geodir_meta_keys ); |
|
| 1273 | - $geodir_meta_keys = esc_html( $geodir_meta_keys ); |
|
| 1274 | - $geodir_meta_keys = geodir_strtolower( $geodir_meta_keys ); |
|
| 1275 | - $geodir_meta_keys = wp_html_excerpt( $geodir_meta_keys, 1000, '' ); |
|
| 1276 | - $geodir_meta_keys = str_replace( '%location%', $replace_location, $geodir_meta_keys ); |
|
| 1269 | + $meta_key = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key; |
|
| 1270 | + $geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key.', '.$geodir_meta_keys : $geodir_meta_keys) : $meta_key; |
|
| 1271 | + if ($geodir_meta_keys != '') {
|
|
| 1272 | + $geodir_meta_keys = strip_tags($geodir_meta_keys); |
|
| 1273 | + $geodir_meta_keys = esc_html($geodir_meta_keys); |
|
| 1274 | + $geodir_meta_keys = geodir_strtolower($geodir_meta_keys); |
|
| 1275 | + $geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, ''); |
|
| 1276 | + $geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
|
|
| 1277 | 1277 | |
| 1278 | - $meta_key = rtrim( trim( $geodir_meta_keys ), "," ); |
|
| 1278 | + $meta_key = rtrim(trim($geodir_meta_keys), ","); |
|
| 1279 | 1279 | } |
| 1280 | 1280 | |
| 1281 | - if ( $meta_key ) {
|
|
| 1282 | - $meta_key = stripslashes_deep( $meta_key ); |
|
| 1281 | + if ($meta_key) {
|
|
| 1282 | + $meta_key = stripslashes_deep($meta_key); |
|
| 1283 | 1283 | /** |
| 1284 | 1284 | * Filter SEO meta keywords. |
| 1285 | 1285 | * |
@@ -1287,7 +1287,7 @@ discard block |
||
| 1287 | 1287 | * |
| 1288 | 1288 | * @param string $meta_desc Meta keywords. |
| 1289 | 1289 | */ |
| 1290 | - echo apply_filters( 'geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key ); |
|
| 1290 | + echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="'.$meta_key.'" />', $meta_key);
|
|
| 1291 | 1291 | } |
| 1292 | 1292 | |
| 1293 | 1293 | } |
@@ -1307,8 +1307,8 @@ discard block |
||
| 1307 | 1307 | |
| 1308 | 1308 | $geodir_detail_page_tabs_array = geodir_detail_page_tabs_array(); |
| 1309 | 1309 | |
| 1310 | - foreach ( $geodir_detail_page_tabs_array as $key => $tabs_obj ) {
|
|
| 1311 | - $geodir_detail_page_tabs_key_value_array[ $key ] = $tabs_obj['heading_text']; |
|
| 1310 | + foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
|
|
| 1311 | + $geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text']; |
|
| 1312 | 1312 | } |
| 1313 | 1313 | |
| 1314 | 1314 | return $geodir_detail_page_tabs_key_value_array; |
@@ -1330,57 +1330,57 @@ discard block |
||
| 1330 | 1330 | * @since 1.0.0 |
| 1331 | 1331 | */ |
| 1332 | 1332 | $arr_tabs['post_profile'] = array( |
| 1333 | - 'heading_text' => __( 'Profile', 'geodirectory' ), |
|
| 1333 | + 'heading_text' => __('Profile', 'geodirectory'),
|
|
| 1334 | 1334 | 'is_active_tab' => true, |
| 1335 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_profile' ), |
|
| 1335 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
|
|
| 1336 | 1336 | 'tab_content' => '' |
| 1337 | 1337 | ); |
| 1338 | - $arr_tabs['post_info'] = array( |
|
| 1339 | - 'heading_text' => __( 'More Info', 'geodirectory' ), |
|
| 1338 | + $arr_tabs['post_info'] = array( |
|
| 1339 | + 'heading_text' => __('More Info', 'geodirectory'),
|
|
| 1340 | 1340 | 'is_active_tab' => false, |
| 1341 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_info' ), |
|
| 1341 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
|
|
| 1342 | 1342 | 'tab_content' => '' |
| 1343 | 1343 | ); |
| 1344 | 1344 | |
| 1345 | 1345 | $arr_tabs['post_images'] = array( |
| 1346 | - 'heading_text' => __( 'Photos', 'geodirectory' ), |
|
| 1346 | + 'heading_text' => __('Photos', 'geodirectory'),
|
|
| 1347 | 1347 | 'is_active_tab' => false, |
| 1348 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_images' ), |
|
| 1348 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
|
|
| 1349 | 1349 | 'tab_content' => '' |
| 1350 | 1350 | ); |
| 1351 | 1351 | |
| 1352 | 1352 | $arr_tabs['post_video'] = array( |
| 1353 | - 'heading_text' => __( 'Video', 'geodirectory' ), |
|
| 1353 | + 'heading_text' => __('Video', 'geodirectory'),
|
|
| 1354 | 1354 | 'is_active_tab' => false, |
| 1355 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_video' ), |
|
| 1355 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
|
|
| 1356 | 1356 | 'tab_content' => '' |
| 1357 | 1357 | ); |
| 1358 | 1358 | |
| 1359 | 1359 | $arr_tabs['special_offers'] = array( |
| 1360 | - 'heading_text' => __( 'Special Offers', 'geodirectory' ), |
|
| 1360 | + 'heading_text' => __('Special Offers', 'geodirectory'),
|
|
| 1361 | 1361 | 'is_active_tab' => false, |
| 1362 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'special_offers' ), |
|
| 1362 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
|
|
| 1363 | 1363 | 'tab_content' => '' |
| 1364 | 1364 | ); |
| 1365 | 1365 | |
| 1366 | 1366 | $arr_tabs['post_map'] = array( |
| 1367 | - 'heading_text' => __( 'Map', 'geodirectory' ), |
|
| 1367 | + 'heading_text' => __('Map', 'geodirectory'),
|
|
| 1368 | 1368 | 'is_active_tab' => false, |
| 1369 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_map' ), |
|
| 1369 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
|
|
| 1370 | 1370 | 'tab_content' => '' |
| 1371 | 1371 | ); |
| 1372 | 1372 | |
| 1373 | 1373 | $arr_tabs['reviews'] = array( |
| 1374 | - 'heading_text' => __( 'Reviews', 'geodirectory' ), |
|
| 1374 | + 'heading_text' => __('Reviews', 'geodirectory'),
|
|
| 1375 | 1375 | 'is_active_tab' => false, |
| 1376 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'reviews' ), |
|
| 1376 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
|
|
| 1377 | 1377 | 'tab_content' => 'review display' |
| 1378 | 1378 | ); |
| 1379 | 1379 | |
| 1380 | 1380 | $arr_tabs['related_listing'] = array( |
| 1381 | - 'heading_text' => __( 'Related Listing', 'geodirectory' ), |
|
| 1381 | + 'heading_text' => __('Related Listing', 'geodirectory'),
|
|
| 1382 | 1382 | 'is_active_tab' => false, |
| 1383 | - 'is_display' => apply_filters( 'geodir_detail_page_tab_is_display', true, 'related_listing' ), |
|
| 1383 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
|
|
| 1384 | 1384 | 'tab_content' => '' |
| 1385 | 1385 | ); |
| 1386 | 1386 | |
@@ -1389,7 +1389,7 @@ discard block |
||
| 1389 | 1389 | * |
| 1390 | 1390 | * @since 1.0.0 |
| 1391 | 1391 | */ |
| 1392 | - return apply_filters( 'geodir_detail_page_tab_list_extend', $arr_tabs ); |
|
| 1392 | + return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
|
|
| 1393 | 1393 | |
| 1394 | 1394 | |
| 1395 | 1395 | } |
@@ -1403,13 +1403,13 @@ discard block |
||
| 1403 | 1403 | * @return mixed|array Tabs array. |
| 1404 | 1404 | */ |
| 1405 | 1405 | function geodir_detail_page_tabs_list() {
|
| 1406 | - $tabs_excluded = get_option( 'geodir_detail_page_tabs_excluded' ); |
|
| 1406 | + $tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
|
|
| 1407 | 1407 | $tabs_array = geodir_detail_page_tabs_array(); |
| 1408 | 1408 | |
| 1409 | - if ( ! empty( $tabs_excluded ) ) {
|
|
| 1410 | - foreach ( $tabs_excluded as $tab ) {
|
|
| 1411 | - if ( array_key_exists( $tab, $tabs_array ) ) {
|
|
| 1412 | - unset( $tabs_array[ $tab ] ); |
|
| 1409 | + if (!empty($tabs_excluded)) {
|
|
| 1410 | + foreach ($tabs_excluded as $tab) {
|
|
| 1411 | + if (array_key_exists($tab, $tabs_array)) {
|
|
| 1412 | + unset($tabs_array[$tab]); |
|
| 1413 | 1413 | } |
| 1414 | 1414 | } |
| 1415 | 1415 | } |
@@ -1433,58 +1433,58 @@ discard block |
||
| 1433 | 1433 | function geodir_show_detail_page_tabs() {
|
| 1434 | 1434 | global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields, $preview; |
| 1435 | 1435 | |
| 1436 | - $post_id = ! empty( $post ) && isset( $post->ID ) ? (int) $post->ID : 0; |
|
| 1437 | - $request_post_id = ! empty( $_REQUEST['p'] ) ? (int) $_REQUEST['p'] : 0; |
|
| 1438 | - $is_backend_preview = ( is_single() && ! empty( $_REQUEST['post_type'] ) && ! empty( $_REQUEST['preview'] ) && ! empty( $_REQUEST['p'] ) ) && is_super_admin() ? true : false; // skip if preview from backend |
|
| 1436 | + $post_id = !empty($post) && isset($post->ID) ? (int) $post->ID : 0; |
|
| 1437 | + $request_post_id = !empty($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0; |
|
| 1438 | + $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend |
|
| 1439 | 1439 | |
| 1440 | - if ( $is_backend_preview && ! $post_id > 0 && $request_post_id > 0 ) {
|
|
| 1441 | - $post = geodir_get_post_info( $request_post_id ); |
|
| 1442 | - setup_postdata( $post ); |
|
| 1440 | + if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
|
|
| 1441 | + $post = geodir_get_post_info($request_post_id); |
|
| 1442 | + setup_postdata($post); |
|
| 1443 | 1443 | } |
| 1444 | 1444 | |
| 1445 | - $geodir_post_detail_fields = geodir_show_listing_info( 'moreinfo' ); |
|
| 1445 | + $geodir_post_detail_fields = geodir_show_listing_info('moreinfo');
|
|
| 1446 | 1446 | |
| 1447 | 1447 | |
| 1448 | - if ( geodir_is_page( 'detail' ) ) {
|
|
| 1449 | - $video = geodir_get_video( $post->ID ); |
|
| 1450 | - $special_offers = geodir_get_special_offers( $post->ID ); |
|
| 1448 | + if (geodir_is_page('detail')) {
|
|
| 1449 | + $video = geodir_get_video($post->ID); |
|
| 1450 | + $special_offers = geodir_get_special_offers($post->ID); |
|
| 1451 | 1451 | $related_listing_array = array(); |
| 1452 | - if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
|
|
| 1453 | - $related_listing_array = get_option( 'geodir_add_related_listing_posttypes' ); |
|
| 1452 | + if (get_option('geodir_add_related_listing_posttypes')) {
|
|
| 1453 | + $related_listing_array = get_option('geodir_add_related_listing_posttypes');
|
|
| 1454 | 1454 | } |
| 1455 | 1455 | |
| 1456 | 1456 | |
| 1457 | - $excluded_tabs = get_option( 'geodir_detail_page_tabs_excluded' ); |
|
| 1458 | - if ( ! $excluded_tabs ) {
|
|
| 1457 | + $excluded_tabs = get_option('geodir_detail_page_tabs_excluded');
|
|
| 1458 | + if (!$excluded_tabs) {
|
|
| 1459 | 1459 | $excluded_tabs = array(); |
| 1460 | 1460 | } |
| 1461 | 1461 | |
| 1462 | 1462 | $related_listing = ''; |
| 1463 | - if ( in_array( $post->post_type, $related_listing_array ) && ! in_array( 'related_listing', $excluded_tabs ) ) {
|
|
| 1463 | + if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) {
|
|
| 1464 | 1464 | $request = array( |
| 1465 | - 'post_number' => get_option( 'geodir_related_post_count' ), |
|
| 1466 | - 'relate_to' => get_option( 'geodir_related_post_relate_to' ), |
|
| 1467 | - 'layout' => get_option( 'geodir_related_post_listing_view' ), |
|
| 1468 | - 'add_location_filter' => get_option( 'geodir_related_post_location_filter' ), |
|
| 1469 | - 'list_sort' => get_option( 'geodir_related_post_sortby' ), |
|
| 1470 | - 'character_count' => get_option( 'geodir_related_post_excerpt' ) |
|
| 1465 | + 'post_number' => get_option('geodir_related_post_count'),
|
|
| 1466 | + 'relate_to' => get_option('geodir_related_post_relate_to'),
|
|
| 1467 | + 'layout' => get_option('geodir_related_post_listing_view'),
|
|
| 1468 | + 'add_location_filter' => get_option('geodir_related_post_location_filter'),
|
|
| 1469 | + 'list_sort' => get_option('geodir_related_post_sortby'),
|
|
| 1470 | + 'character_count' => get_option('geodir_related_post_excerpt')
|
|
| 1471 | 1471 | ); |
| 1472 | 1472 | |
| 1473 | - if ( $post->post_type == 'gd_event' && defined( 'GDEVENTS_VERSION' ) ) {
|
|
| 1474 | - $related_listing = geodir_get_detail_page_related_events( $request ); |
|
| 1473 | + if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
|
|
| 1474 | + $related_listing = geodir_get_detail_page_related_events($request); |
|
| 1475 | 1475 | } else {
|
| 1476 | - $related_listing = geodir_related_posts_display( $request ); |
|
| 1476 | + $related_listing = geodir_related_posts_display($request); |
|
| 1477 | 1477 | } |
| 1478 | 1478 | |
| 1479 | 1479 | } |
| 1480 | 1480 | |
| 1481 | - $post_images = geodir_get_images( $post->ID, 'thumbnail' ); |
|
| 1481 | + $post_images = geodir_get_images($post->ID, 'thumbnail'); |
|
| 1482 | 1482 | $thumb_image = ''; |
| 1483 | - if ( ! empty( $post_images ) ) {
|
|
| 1484 | - foreach ( $post_images as $image ) {
|
|
| 1485 | - $caption = ( ! empty( $image->caption ) ) ? $image->caption : ''; |
|
| 1486 | - $thumb_image .= '<a href="' . $image->src . '" title="' . $caption . '">'; |
|
| 1487 | - $thumb_image .= geodir_show_image( $image, 'thumbnail', true, false ); |
|
| 1483 | + if (!empty($post_images)) {
|
|
| 1484 | + foreach ($post_images as $image) {
|
|
| 1485 | + $caption = (!empty($image->caption)) ? $image->caption : ''; |
|
| 1486 | + $thumb_image .= '<a href="'.$image->src.'" title="'.$caption.'">'; |
|
| 1487 | + $thumb_image .= geodir_show_image($image, 'thumbnail', true, false); |
|
| 1488 | 1488 | $thumb_image .= '</a>'; |
| 1489 | 1489 | } |
| 1490 | 1490 | } |
@@ -1493,11 +1493,11 @@ discard block |
||
| 1493 | 1493 | $map_args['map_canvas_name'] = 'detail_page_map_canvas'; |
| 1494 | 1494 | $map_args['width'] = '600'; |
| 1495 | 1495 | $map_args['height'] = '300'; |
| 1496 | - if ( $post->post_mapzoom ) {
|
|
| 1497 | - $map_args['zoom'] = '' . $post->post_mapzoom . ''; |
|
| 1496 | + if ($post->post_mapzoom) {
|
|
| 1497 | + $map_args['zoom'] = ''.$post->post_mapzoom.''; |
|
| 1498 | 1498 | } |
| 1499 | 1499 | $map_args['autozoom'] = false; |
| 1500 | - $map_args['scrollwheel'] = ( get_option( 'geodir_add_listing_mouse_scroll' ) ) ? 0 : 1; |
|
| 1500 | + $map_args['scrollwheel'] = (get_option('geodir_add_listing_mouse_scroll')) ? 0 : 1;
|
|
| 1501 | 1501 | $map_args['child_collapse'] = '0'; |
| 1502 | 1502 | $map_args['enable_cat_filters'] = false; |
| 1503 | 1503 | $map_args['enable_text_search'] = false; |
@@ -1506,43 +1506,43 @@ discard block |
||
| 1506 | 1506 | $map_args['enable_jason_on_load'] = true; |
| 1507 | 1507 | $map_args['enable_map_direction'] = true; |
| 1508 | 1508 | $map_args['map_class_name'] = 'geodir-map-detail-page'; |
| 1509 | - $map_args['maptype'] = ( ! empty( $post->post_mapview ) ) ? $post->post_mapview : 'ROADMAP'; |
|
| 1510 | - } else if ( geodir_is_page( 'preview' ) ) {
|
|
| 1511 | - $video = isset( $post->geodir_video ) ? $post->geodir_video : ''; |
|
| 1512 | - $special_offers = isset( $post->geodir_special_offers ) ? $post->geodir_special_offers : ''; |
|
| 1509 | + $map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP'; |
|
| 1510 | + } else if (geodir_is_page('preview')) {
|
|
| 1511 | + $video = isset($post->geodir_video) ? $post->geodir_video : ''; |
|
| 1512 | + $special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : ''; |
|
| 1513 | 1513 | |
| 1514 | - if ( isset( $post->post_images ) ) {
|
|
| 1515 | - $post->post_images = trim( $post->post_images, "," ); |
|
| 1514 | + if (isset($post->post_images)) {
|
|
| 1515 | + $post->post_images = trim($post->post_images, ","); |
|
| 1516 | 1516 | } |
| 1517 | 1517 | |
| 1518 | - if ( isset( $post->post_images ) && ! empty( $post->post_images ) ) {
|
|
| 1519 | - $post_images = explode( ",", $post->post_images ); |
|
| 1518 | + if (isset($post->post_images) && !empty($post->post_images)) {
|
|
| 1519 | + $post_images = explode(",", $post->post_images);
|
|
| 1520 | 1520 | } |
| 1521 | 1521 | |
| 1522 | 1522 | $thumb_image = ''; |
| 1523 | - if ( ! empty( $post_images ) ) {
|
|
| 1524 | - foreach ( $post_images as $image ) {
|
|
| 1525 | - if ( $image != '' ) {
|
|
| 1526 | - $thumb_image .= '<a href="' . $image . '">'; |
|
| 1527 | - $thumb_image .= geodir_show_image( array( 'src' => $image ), 'thumbnail', true, false ); |
|
| 1523 | + if (!empty($post_images)) {
|
|
| 1524 | + foreach ($post_images as $image) {
|
|
| 1525 | + if ($image != '') {
|
|
| 1526 | + $thumb_image .= '<a href="'.$image.'">'; |
|
| 1527 | + $thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
|
|
| 1528 | 1528 | $thumb_image .= '</a>'; |
| 1529 | 1529 | } |
| 1530 | 1530 | } |
| 1531 | 1531 | } |
| 1532 | 1532 | |
| 1533 | 1533 | global $map_jason; |
| 1534 | - $marker_json = $post->marker_json != '' ? json_decode( $post->marker_json, true ) : array(); |
|
| 1535 | - $marker_icon = ( ! empty( $marker_json ) && ! empty( $marker_json['i'] ) ) ? $marker_json['i'] : ''; |
|
| 1536 | - $icon_size = geodir_get_marker_size( $marker_icon ); |
|
| 1534 | + $marker_json = $post->marker_json != '' ? json_decode($post->marker_json, true) : array(); |
|
| 1535 | + $marker_icon = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : ''; |
|
| 1536 | + $icon_size = geodir_get_marker_size($marker_icon); |
|
| 1537 | 1537 | $marker_json['w'] = $icon_size['w']; |
| 1538 | 1538 | $marker_json['h'] = $icon_size['h']; |
| 1539 | - $map_jason[] = json_encode( $marker_json ); |
|
| 1539 | + $map_jason[] = json_encode($marker_json); |
|
| 1540 | 1540 | |
| 1541 | - $address_latitude = isset( $post->post_latitude ) ? $post->post_latitude : ''; |
|
| 1542 | - $address_longitude = isset( $post->post_longitude ) ? $post->post_longitude : ''; |
|
| 1543 | - $mapview = isset( $post->post_mapview ) ? $post->post_mapview : ''; |
|
| 1544 | - $mapzoom = isset( $post->post_mapzoom ) ? $post->post_mapzoom : ''; |
|
| 1545 | - if ( ! $mapzoom ) {
|
|
| 1541 | + $address_latitude = isset($post->post_latitude) ? $post->post_latitude : ''; |
|
| 1542 | + $address_longitude = isset($post->post_longitude) ? $post->post_longitude : ''; |
|
| 1543 | + $mapview = isset($post->post_mapview) ? $post->post_mapview : ''; |
|
| 1544 | + $mapzoom = isset($post->post_mapzoom) ? $post->post_mapzoom : ''; |
|
| 1545 | + if (!$mapzoom) {
|
|
| 1546 | 1546 | $mapzoom = 12; |
| 1547 | 1547 | } |
| 1548 | 1548 | |
@@ -1565,37 +1565,37 @@ discard block |
||
| 1565 | 1565 | $map_args['map_class_name'] = 'geodir-map-preview-page'; |
| 1566 | 1566 | } |
| 1567 | 1567 | |
| 1568 | - $arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user |
|
| 1568 | + $arr_detail_page_tabs = geodir_detail_page_tabs_list(); // get this sooner so we can get the active tab for the user |
|
| 1569 | 1569 | |
| 1570 | 1570 | $active_tab = ''; |
| 1571 | 1571 | $active_tab_name = ''; |
| 1572 | 1572 | $default_tab = ''; |
| 1573 | 1573 | $default_tab_name = ''; |
| 1574 | - foreach ( $arr_detail_page_tabs as $tab_index => $tabs ) {
|
|
| 1575 | - if ( isset( $tabs['is_active_tab'] ) && $tabs['is_active_tab'] && ! empty( $tabs['is_display'] ) && isset( $tabs['heading_text'] ) && $tabs['heading_text'] ) {
|
|
| 1574 | + foreach ($arr_detail_page_tabs as $tab_index => $tabs) {
|
|
| 1575 | + if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
|
|
| 1576 | 1576 | $active_tab = $tab_index; |
| 1577 | - $active_tab_name = __( $tabs['heading_text'], 'geodirectory' ); |
|
| 1577 | + $active_tab_name = __($tabs['heading_text'], 'geodirectory'); |
|
| 1578 | 1578 | } |
| 1579 | 1579 | |
| 1580 | - if ( $default_tab === '' && ! empty( $tabs['is_display'] ) && ! empty( $tabs['heading_text'] ) ) {
|
|
| 1580 | + if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
|
|
| 1581 | 1581 | $default_tab = $tab_index; |
| 1582 | - $default_tab_name = __( $tabs['heading_text'], 'geodirectory' ); |
|
| 1582 | + $default_tab_name = __($tabs['heading_text'], 'geodirectory'); |
|
| 1583 | 1583 | } |
| 1584 | 1584 | } |
| 1585 | 1585 | |
| 1586 | - if ( $active_tab === '' && $default_tab !== '' ) { // Make first tab acs a active tab if not any tab is active.
|
|
| 1587 | - if ( isset( $arr_detail_page_tabs[ $active_tab ] ) && isset( $arr_detail_page_tabs[ $active_tab ]['is_active_tab'] ) ) {
|
|
| 1588 | - $arr_detail_page_tabs[ $active_tab ]['is_active_tab'] = false; |
|
| 1586 | + if ($active_tab === '' && $default_tab !== '') { // Make first tab acs a active tab if not any tab is active.
|
|
| 1587 | + if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
|
|
| 1588 | + $arr_detail_page_tabs[$active_tab]['is_active_tab'] = false; |
|
| 1589 | 1589 | } |
| 1590 | 1590 | |
| 1591 | - $arr_detail_page_tabs[ $default_tab ]['is_active_tab'] = true; |
|
| 1591 | + $arr_detail_page_tabs[$default_tab]['is_active_tab'] = true; |
|
| 1592 | 1592 | $active_tab = $default_tab; |
| 1593 | 1593 | $active_tab_name = $default_tab_name; |
| 1594 | 1594 | } |
| 1595 | - $tab_list = ( get_option( 'geodir_disable_tabs', false ) ) ? true : false; |
|
| 1595 | + $tab_list = (get_option('geodir_disable_tabs', false)) ? true : false;
|
|
| 1596 | 1596 | ?> |
| 1597 | 1597 | <div class="geodir-tabs" id="gd-tabs" style="position:relative;"> |
| 1598 | - <?php if ( ! $tab_list ){ ?>
|
|
| 1598 | + <?php if (!$tab_list) { ?>
|
|
| 1599 | 1599 | <div id="geodir-tab-mobile-menu"> |
| 1600 | 1600 | <i class="fa fa-bars"></i> |
| 1601 | 1601 | <span class="geodir-mobile-active-tab"><?php echo $active_tab_name; ?></span> |
@@ -1610,26 +1610,26 @@ discard block |
||
| 1610 | 1610 | * @since 1.0.0 |
| 1611 | 1611 | * @see 'geodir_after_tab_list' |
| 1612 | 1612 | */ |
| 1613 | - do_action( 'geodir_before_tab_list' ); ?> |
|
| 1613 | + do_action('geodir_before_tab_list'); ?>
|
|
| 1614 | 1614 | <?php |
| 1615 | 1615 | |
| 1616 | - foreach ( $arr_detail_page_tabs as $tab_index => $detail_page_tab ) {
|
|
| 1617 | - if ( $detail_page_tab['is_display'] ) {
|
|
| 1616 | + foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
|
|
| 1617 | + if ($detail_page_tab['is_display']) {
|
|
| 1618 | 1618 | |
| 1619 | - if ( ! $tab_list ) {
|
|
| 1619 | + if (!$tab_list) {
|
|
| 1620 | 1620 | ?> |
| 1621 | 1621 | <dt></dt> <!-- added to comply with validation --> |
| 1622 | - <dd <?php if ( $detail_page_tab['is_active_tab'] ){ ?>class="geodir-tab-active"<?php } ?> ><a
|
|
| 1622 | + <dd <?php if ($detail_page_tab['is_active_tab']) { ?>class="geodir-tab-active"<?php } ?> ><a
|
|
| 1623 | 1623 | data-tab="#<?php echo $tab_index; ?>" |
| 1624 | - data-status="enable"><?php _e( $detail_page_tab['heading_text'], 'geodirectory' ); ?></a> |
|
| 1624 | + data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a> |
|
| 1625 | 1625 | </dd> |
| 1626 | 1626 | <?php |
| 1627 | 1627 | } |
| 1628 | 1628 | ob_start() // start tab content buffering |
| 1629 | 1629 | ?> |
| 1630 | 1630 | <li id="<?php echo $tab_index; ?>Tab"> |
| 1631 | - <?php if ( $tab_list ) {
|
|
| 1632 | - $tab_title = '<span class="gd-tab-list-title" ><a href="#' . $tab_index . '">' . __( $detail_page_tab['heading_text'], 'geodirectory' ) . '</a></span><hr />'; |
|
| 1631 | + <?php if ($tab_list) {
|
|
| 1632 | + $tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'], 'geodirectory').'</a></span><hr />'; |
|
| 1633 | 1633 | /** |
| 1634 | 1634 | * Filter the tab list title html. |
| 1635 | 1635 | * |
@@ -1639,7 +1639,7 @@ discard block |
||
| 1639 | 1639 | * @param string $tab_index The tab index type. |
| 1640 | 1640 | * @param array $detail_page_tab The array of values including title text. |
| 1641 | 1641 | */ |
| 1642 | - echo apply_filters( 'geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab ); |
|
| 1642 | + echo apply_filters('geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab);
|
|
| 1643 | 1643 | } ?> |
| 1644 | 1644 | <div id="<?php echo $tab_index; ?>" class="hash-offset"></div> |
| 1645 | 1645 | <?php |
@@ -1650,7 +1650,7 @@ discard block |
||
| 1650 | 1650 | * |
| 1651 | 1651 | * @param string $tab_index The tab name ID. |
| 1652 | 1652 | */ |
| 1653 | - do_action( 'geodir_before_tab_content', $tab_index ); |
|
| 1653 | + do_action('geodir_before_tab_content', $tab_index);
|
|
| 1654 | 1654 | |
| 1655 | 1655 | /** |
| 1656 | 1656 | * Called before the details tab content is output per tab. |
@@ -1660,21 +1660,21 @@ discard block |
||
| 1660 | 1660 | * @since 1.0.0 |
| 1661 | 1661 | * @todo do we need this if we have the hook above? 'geodir_before_tab_content' |
| 1662 | 1662 | */ |
| 1663 | - do_action( 'geodir_before_' . $tab_index . '_tab_content' ); |
|
| 1663 | + do_action('geodir_before_'.$tab_index.'_tab_content');
|
|
| 1664 | 1664 | /// write a code to generate content of each tab |
| 1665 | - switch ( $tab_index ) {
|
|
| 1665 | + switch ($tab_index) {
|
|
| 1666 | 1666 | case 'post_profile': |
| 1667 | 1667 | /** |
| 1668 | 1668 | * Called before the listing description content on the details page tab. |
| 1669 | 1669 | * |
| 1670 | 1670 | * @since 1.0.0 |
| 1671 | 1671 | */ |
| 1672 | - do_action( 'geodir_before_description_on_listing_detail' ); |
|
| 1673 | - if ( geodir_is_page( 'detail' ) ) {
|
|
| 1672 | + do_action('geodir_before_description_on_listing_detail');
|
|
| 1673 | + if (geodir_is_page('detail')) {
|
|
| 1674 | 1674 | the_content(); |
| 1675 | 1675 | } else {
|
| 1676 | 1676 | /** This action is documented in geodirectory_template_actions.php */ |
| 1677 | - echo apply_filters( 'the_content', stripslashes( $post->post_desc ) ); |
|
| 1677 | + echo apply_filters('the_content', stripslashes($post->post_desc));
|
|
| 1678 | 1678 | } |
| 1679 | 1679 | |
| 1680 | 1680 | /** |
@@ -1682,7 +1682,7 @@ discard block |
||
| 1682 | 1682 | * |
| 1683 | 1683 | * @since 1.0.0 |
| 1684 | 1684 | */ |
| 1685 | - do_action( 'geodir_after_description_on_listing_detail' ); |
|
| 1685 | + do_action('geodir_after_description_on_listing_detail');
|
|
| 1686 | 1686 | break; |
| 1687 | 1687 | case 'post_info': |
| 1688 | 1688 | echo $geodir_post_detail_fields; |
@@ -1692,32 +1692,32 @@ discard block |
||
| 1692 | 1692 | break; |
| 1693 | 1693 | case 'post_video': |
| 1694 | 1694 | // some browsers hide $_POST data if used for embeds so we repalce with a placeholder |
| 1695 | - if ( $preview ) {
|
|
| 1696 | - if ( $video ) {
|
|
| 1697 | - echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />" . __( 'Video Preview Placeholder', 'geodirectory' ) . "</p></span>"; |
|
| 1695 | + if ($preview) {
|
|
| 1696 | + if ($video) {
|
|
| 1697 | + echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />".__('Video Preview Placeholder', 'geodirectory')."</p></span>";
|
|
| 1698 | 1698 | } |
| 1699 | 1699 | } else {
|
| 1700 | 1700 | |
| 1701 | 1701 | // stop payment manager filtering content length |
| 1702 | - $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' ); |
|
| 1703 | - if ( false !== $filter_priority ) {
|
|
| 1704 | - remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority ); |
|
| 1702 | + $filter_priority = has_filter('the_content', 'geodir_payments_the_content');
|
|
| 1703 | + if (false !== $filter_priority) {
|
|
| 1704 | + remove_filter('the_content', 'geodir_payments_the_content', $filter_priority);
|
|
| 1705 | 1705 | } |
| 1706 | 1706 | |
| 1707 | 1707 | /** This action is documented in geodirectory_template_actions.php */ |
| 1708 | - echo apply_filters( 'the_content', stripslashes( $video ) );// we apply the_content filter so oembed works also; |
|
| 1708 | + echo apply_filters('the_content', stripslashes($video)); // we apply the_content filter so oembed works also;
|
|
| 1709 | 1709 | |
| 1710 | - if ( false !== $filter_priority ) {
|
|
| 1711 | - add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority ); |
|
| 1710 | + if (false !== $filter_priority) {
|
|
| 1711 | + add_filter('the_content', 'geodir_payments_the_content', $filter_priority);
|
|
| 1712 | 1712 | } |
| 1713 | 1713 | } |
| 1714 | 1714 | break; |
| 1715 | 1715 | case 'special_offers': |
| 1716 | - echo apply_filters( 'gd_special_offers_content', wpautop( stripslashes( $special_offers ) ) ); |
|
| 1716 | + echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
|
|
| 1717 | 1717 | |
| 1718 | 1718 | break; |
| 1719 | 1719 | case 'post_map': |
| 1720 | - geodir_draw_map( $map_args ); |
|
| 1720 | + geodir_draw_map($map_args); |
|
| 1721 | 1721 | break; |
| 1722 | 1722 | case 'reviews': |
| 1723 | 1723 | comments_template(); |
@@ -1726,7 +1726,7 @@ discard block |
||
| 1726 | 1726 | echo $related_listing; |
| 1727 | 1727 | break; |
| 1728 | 1728 | default: {
|
| 1729 | - if ( ( isset( $post->{$tab_index} ) || ( ! isset( $post->{$tab_index} ) && ( strpos( $tab_index, 'gd_tab_' ) !== false || $tab_index == 'link_business' ) ) ) && ! empty( $detail_page_tab['tab_content'] ) ) {
|
|
| 1729 | + if ((isset($post->{$tab_index} ) || (!isset($post->{$tab_index} ) && (strpos($tab_index, 'gd_tab_') !== false || $tab_index == 'link_business'))) && !empty($detail_page_tab['tab_content'])) {
|
|
| 1730 | 1730 | echo $detail_page_tab['tab_content']; |
| 1731 | 1731 | } |
| 1732 | 1732 | } |
@@ -1738,7 +1738,7 @@ discard block |
||
| 1738 | 1738 | * |
| 1739 | 1739 | * @since 1.0.0 |
| 1740 | 1740 | */ |
| 1741 | - do_action( 'geodir_after_tab_content', $tab_index ); |
|
| 1741 | + do_action('geodir_after_tab_content', $tab_index);
|
|
| 1742 | 1742 | |
| 1743 | 1743 | /** |
| 1744 | 1744 | * Called after the details tab content is output per tab. |
@@ -1748,7 +1748,7 @@ discard block |
||
| 1748 | 1748 | * @since 1.0.0 |
| 1749 | 1749 | * @todo do we need this if we have the hook above? 'geodir_after_tab_content' |
| 1750 | 1750 | */ |
| 1751 | - do_action( 'geodir_after_' . $tab_index . '_tab_content' ); |
|
| 1751 | + do_action('geodir_after_'.$tab_index.'_tab_content');
|
|
| 1752 | 1752 | ?> </li> |
| 1753 | 1753 | <?php |
| 1754 | 1754 | /** |
@@ -1756,7 +1756,7 @@ discard block |
||
| 1756 | 1756 | * |
| 1757 | 1757 | * @since 1.0.0 |
| 1758 | 1758 | */ |
| 1759 | - $arr_detail_page_tabs[ $tab_index ]['tab_content'] = apply_filters( "geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean() ); |
|
| 1759 | + $arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_".$detail_page_tab['tab_content']."_tab_content", ob_get_clean());
|
|
| 1760 | 1760 | } // end of if for is_display |
| 1761 | 1761 | }// end of foreach |
| 1762 | 1762 | |
@@ -1766,14 +1766,14 @@ discard block |
||
| 1766 | 1766 | * @since 1.0.0 |
| 1767 | 1767 | * @see 'geodir_before_tab_list' |
| 1768 | 1768 | */ |
| 1769 | - do_action( 'geodir_after_tab_list' ); |
|
| 1769 | + do_action('geodir_after_tab_list');
|
|
| 1770 | 1770 | ?> |
| 1771 | - <?php if ( ! $tab_list ){ ?></dl><?php } ?>
|
|
| 1772 | - <ul class="geodir-tabs-content entry-content <?php if ( $tab_list ) { ?>geodir-tabs-list<?php } ?>"
|
|
| 1771 | + <?php if (!$tab_list) { ?></dl><?php } ?>
|
|
| 1772 | + <ul class="geodir-tabs-content entry-content <?php if ($tab_list) { ?>geodir-tabs-list<?php } ?>"
|
|
| 1773 | 1773 | style="position:relative;"> |
| 1774 | 1774 | <?php |
| 1775 | - foreach ( $arr_detail_page_tabs as $detail_page_tab ) {
|
|
| 1776 | - if ( $detail_page_tab['is_display'] && ! empty( $detail_page_tab['tab_content'] ) ) {
|
|
| 1775 | + foreach ($arr_detail_page_tabs as $detail_page_tab) {
|
|
| 1776 | + if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
|
|
| 1777 | 1777 | echo $detail_page_tab['tab_content']; |
| 1778 | 1778 | }// end of if |
| 1779 | 1779 | }// end of foreach |
@@ -1783,11 +1783,11 @@ discard block |
||
| 1783 | 1783 | * |
| 1784 | 1784 | * @since 1.0.0 |
| 1785 | 1785 | */ |
| 1786 | - do_action( 'geodir_add_tab_content' ); ?> |
|
| 1786 | + do_action('geodir_add_tab_content'); ?>
|
|
| 1787 | 1787 | </ul> |
| 1788 | 1788 | <!--gd-tabs-content ul end--> |
| 1789 | 1789 | </div> |
| 1790 | - <?php if ( ! $tab_list ) { ?>
|
|
| 1790 | + <?php if (!$tab_list) { ?>
|
|
| 1791 | 1791 | <script> |
| 1792 | 1792 | if (window.location.hash && window.location.hash.indexOf('&') === -1 && jQuery(window.location.hash + 'Tab').length) {
|
| 1793 | 1793 | hashVal = window.location.hash; |
@@ -1819,31 +1819,31 @@ discard block |
||
| 1819 | 1819 | * |
| 1820 | 1820 | * @return mixed Image file. |
| 1821 | 1821 | */ |
| 1822 | -function geodir_exif( $file ) {
|
|
| 1823 | - if ( empty( $file ) || ! is_array( $file ) ) {
|
|
| 1822 | +function geodir_exif($file) {
|
|
| 1823 | + if (empty($file) || !is_array($file)) {
|
|
| 1824 | 1824 | return $file; |
| 1825 | 1825 | } |
| 1826 | 1826 | |
| 1827 | - $file_path = ! empty( $file['tmp_name'] ) ? sanitize_text_field( $file['tmp_name'] ) : ''; |
|
| 1828 | - if ( ! ( $file_path && file_exists( $file_path ) ) ) {
|
|
| 1827 | + $file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : ''; |
|
| 1828 | + if (!($file_path && file_exists($file_path))) {
|
|
| 1829 | 1829 | return $file; |
| 1830 | 1830 | } |
| 1831 | 1831 | $file['file'] = $file_path; |
| 1832 | 1832 | |
| 1833 | - if ( ! file_is_valid_image( $file_path ) ) {
|
|
| 1833 | + if (!file_is_valid_image($file_path)) {
|
|
| 1834 | 1834 | return $file; // Bail if file is not an image. |
| 1835 | 1835 | } |
| 1836 | 1836 | |
| 1837 | - if ( ! function_exists( 'wp_get_image_editor' ) ) {
|
|
| 1837 | + if (!function_exists('wp_get_image_editor')) {
|
|
| 1838 | 1838 | return $file; |
| 1839 | 1839 | } |
| 1840 | 1840 | |
| 1841 | 1841 | $mime_type = $file['type']; |
| 1842 | 1842 | $exif = array(); |
| 1843 | - if ( $mime_type == 'image/jpeg' && function_exists( 'exif_read_data' ) ) {
|
|
| 1843 | + if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
|
|
| 1844 | 1844 | try {
|
| 1845 | - $exif = exif_read_data( $file_path ); |
|
| 1846 | - } catch ( Exception $e ) {
|
|
| 1845 | + $exif = exif_read_data($file_path); |
|
| 1846 | + } catch (Exception $e) {
|
|
| 1847 | 1847 | $exif = array(); |
| 1848 | 1848 | } |
| 1849 | 1849 | } |
@@ -1852,13 +1852,13 @@ discard block |
||
| 1852 | 1852 | $flip = false; |
| 1853 | 1853 | $modify = false; |
| 1854 | 1854 | $orientation = 0; |
| 1855 | - if ( ! empty( $exif ) && isset( $exif['Orientation'] ) ) {
|
|
| 1856 | - switch ( (int) $exif['Orientation'] ) {
|
|
| 1855 | + if (!empty($exif) && isset($exif['Orientation'])) {
|
|
| 1856 | + switch ((int) $exif['Orientation']) {
|
|
| 1857 | 1857 | case 1: |
| 1858 | 1858 | // do nothing |
| 1859 | 1859 | break; |
| 1860 | 1860 | case 2: |
| 1861 | - $flip = array( false, true ); |
|
| 1861 | + $flip = array(false, true); |
|
| 1862 | 1862 | $modify = true; |
| 1863 | 1863 | break; |
| 1864 | 1864 | case 3: |
@@ -1867,13 +1867,13 @@ discard block |
||
| 1867 | 1867 | $modify = true; |
| 1868 | 1868 | break; |
| 1869 | 1869 | case 4: |
| 1870 | - $flip = array( true, false ); |
|
| 1870 | + $flip = array(true, false); |
|
| 1871 | 1871 | $modify = true; |
| 1872 | 1872 | break; |
| 1873 | 1873 | case 5: |
| 1874 | 1874 | $orientation = - 90; |
| 1875 | 1875 | $rotate = true; |
| 1876 | - $flip = array( false, true ); |
|
| 1876 | + $flip = array(false, true); |
|
| 1877 | 1877 | $modify = true; |
| 1878 | 1878 | break; |
| 1879 | 1879 | case 6: |
@@ -1884,7 +1884,7 @@ discard block |
||
| 1884 | 1884 | case 7: |
| 1885 | 1885 | $orientation = - 270; |
| 1886 | 1886 | $rotate = true; |
| 1887 | - $flip = array( false, true ); |
|
| 1887 | + $flip = array(false, true); |
|
| 1888 | 1888 | $modify = true; |
| 1889 | 1889 | break; |
| 1890 | 1890 | case 8: |
@@ -1910,31 +1910,31 @@ discard block |
||
| 1910 | 1910 | * @param int|null $quality Image Compression quality between 1-100% scale. Default null. |
| 1911 | 1911 | * @param string $quality Image mime type. |
| 1912 | 1912 | */ |
| 1913 | - $quality = apply_filters( 'geodir_image_upload_set_quality', $quality, $mime_type ); |
|
| 1914 | - if ( $quality !== null ) {
|
|
| 1913 | + $quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
|
|
| 1914 | + if ($quality !== null) {
|
|
| 1915 | 1915 | $modify = true; |
| 1916 | 1916 | } |
| 1917 | 1917 | |
| 1918 | - if ( ! $modify ) {
|
|
| 1918 | + if (!$modify) {
|
|
| 1919 | 1919 | return $file; // no change |
| 1920 | 1920 | } |
| 1921 | 1921 | |
| 1922 | - $image = wp_get_image_editor( $file_path ); |
|
| 1923 | - if ( ! is_wp_error( $image ) ) {
|
|
| 1924 | - if ( $rotate ) {
|
|
| 1925 | - $image->rotate( $orientation ); |
|
| 1922 | + $image = wp_get_image_editor($file_path); |
|
| 1923 | + if (!is_wp_error($image)) {
|
|
| 1924 | + if ($rotate) {
|
|
| 1925 | + $image->rotate($orientation); |
|
| 1926 | 1926 | } |
| 1927 | 1927 | |
| 1928 | - if ( ! empty( $flip ) ) {
|
|
| 1929 | - $image->flip( $flip[0], $flip[1] ); |
|
| 1928 | + if (!empty($flip)) {
|
|
| 1929 | + $image->flip($flip[0], $flip[1]); |
|
| 1930 | 1930 | } |
| 1931 | 1931 | |
| 1932 | - if ( $quality !== null ) {
|
|
| 1933 | - $image->set_quality( (int) $quality ); |
|
| 1932 | + if ($quality !== null) {
|
|
| 1933 | + $image->set_quality((int) $quality); |
|
| 1934 | 1934 | } |
| 1935 | 1935 | |
| 1936 | - $result = $image->save( $file_path ); |
|
| 1937 | - if ( ! is_wp_error( $result ) ) {
|
|
| 1936 | + $result = $image->save($file_path); |
|
| 1937 | + if (!is_wp_error($result)) {
|
|
| 1938 | 1938 | $file['file'] = $result['path']; |
| 1939 | 1939 | $file['tmp_name'] = $result['path']; |
| 1940 | 1940 | } |
@@ -1961,7 +1961,7 @@ discard block |
||
| 1961 | 1961 | * |
| 1962 | 1962 | * @return string Returns the recent reviews html. |
| 1963 | 1963 | */ |
| 1964 | -function geodir_get_recent_reviews( $g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false ) {
|
|
| 1964 | +function geodir_get_recent_reviews($g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false) {
|
|
| 1965 | 1965 | global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session; |
| 1966 | 1966 | $tablecomments = $wpdb->comments; |
| 1967 | 1967 | $tableposts = $wpdb->posts; |
@@ -1971,28 +1971,28 @@ discard block |
||
| 1971 | 1971 | $region_filter = ''; |
| 1972 | 1972 | $country_filter = ''; |
| 1973 | 1973 | |
| 1974 | - if ( $gd_session->get( 'gd_multi_location' ) ) {
|
|
| 1975 | - if ( $gd_ses_country = $gd_session->get( 'gd_country' ) ) {
|
|
| 1976 | - $country_filter = $wpdb->prepare( " AND r.post_country=%s ", str_replace( "-", " ", $gd_ses_country ) ); |
|
| 1974 | + if ($gd_session->get('gd_multi_location')) {
|
|
| 1975 | + if ($gd_ses_country = $gd_session->get('gd_country')) {
|
|
| 1976 | + $country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
|
|
| 1977 | 1977 | } |
| 1978 | 1978 | |
| 1979 | - if ( $gd_ses_region = $gd_session->get( 'gd_region' ) ) {
|
|
| 1980 | - $region_filter = $wpdb->prepare( " AND r.post_region=%s ", str_replace( "-", " ", $gd_ses_region ) ); |
|
| 1979 | + if ($gd_ses_region = $gd_session->get('gd_region')) {
|
|
| 1980 | + $region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
|
|
| 1981 | 1981 | } |
| 1982 | 1982 | |
| 1983 | - if ( $gd_ses_city = $gd_session->get( 'gd_city' ) ) {
|
|
| 1984 | - $city_filter = $wpdb->prepare( " AND r.post_city=%s ", str_replace( "-", " ", $gd_ses_city ) ); |
|
| 1983 | + if ($gd_ses_city = $gd_session->get('gd_city')) {
|
|
| 1984 | + $city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
|
|
| 1985 | 1985 | } |
| 1986 | 1986 | } |
| 1987 | 1987 | |
| 1988 | 1988 | $review_table = GEODIR_REVIEW_TABLE; |
| 1989 | 1989 | $request = "SELECT r.id as ID, r.post_type, r.comment_id as comment_ID, r.post_date as comment_date,r.overall_rating, r.user_id, r.post_id FROM $review_table as r WHERE r.post_status = 1 AND r.status =1 AND r.overall_rating>=1 $country_filter $region_filter $city_filter ORDER BY r.post_date DESC, r.id DESC LIMIT $no_comments"; |
| 1990 | 1990 | |
| 1991 | - $comments = $wpdb->get_results( $request ); |
|
| 1991 | + $comments = $wpdb->get_results($request); |
|
| 1992 | 1992 | |
| 1993 | - foreach ( $comments as $comment ) {
|
|
| 1993 | + foreach ($comments as $comment) {
|
|
| 1994 | 1994 | // Set the extra comment info needed. |
| 1995 | - $comment_extra = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID" ); |
|
| 1995 | + $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
|
|
| 1996 | 1996 | //echo "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID"; |
| 1997 | 1997 | $comment->comment_content = $comment_extra->comment_content; |
| 1998 | 1998 | $comment->comment_author = $comment_extra->comment_author; |
@@ -2000,75 +2000,75 @@ discard block |
||
| 2000 | 2000 | |
| 2001 | 2001 | $comment_id = ''; |
| 2002 | 2002 | $comment_id = $comment->comment_ID; |
| 2003 | - $comment_content = strip_tags( $comment->comment_content ); |
|
| 2003 | + $comment_content = strip_tags($comment->comment_content); |
|
| 2004 | 2004 | |
| 2005 | - $comment_content = preg_replace( '#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content ); |
|
| 2005 | + $comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
|
|
| 2006 | 2006 | |
| 2007 | - $permalink = get_permalink( $comment->ID ) . "#comment-" . $comment->comment_ID; |
|
| 2007 | + $permalink = get_permalink($comment->ID)."#comment-".$comment->comment_ID; |
|
| 2008 | 2008 | $comment_author_email = $comment->comment_author_email; |
| 2009 | 2009 | $comment_post_ID = $comment->post_id; |
| 2010 | 2010 | |
| 2011 | 2011 | $na = true; |
| 2012 | - if ( function_exists( 'icl_object_id' ) && icl_object_id( $comment_post_ID, $comment->post_type, true ) ) {
|
|
| 2013 | - $comment_post_ID2 = icl_object_id( $comment_post_ID, $comment->post_type, false ); |
|
| 2014 | - if ( $comment_post_ID == $comment_post_ID2 ) {
|
|
| 2012 | + if (function_exists('icl_object_id') && icl_object_id($comment_post_ID, $comment->post_type, true)) {
|
|
| 2013 | + $comment_post_ID2 = icl_object_id($comment_post_ID, $comment->post_type, false); |
|
| 2014 | + if ($comment_post_ID == $comment_post_ID2) {
|
|
| 2015 | 2015 | } else {
|
| 2016 | 2016 | $na = false; |
| 2017 | 2017 | } |
| 2018 | 2018 | } |
| 2019 | 2019 | |
| 2020 | - $post_title = get_the_title( $comment_post_ID ); |
|
| 2021 | - $permalink = get_permalink( $comment_post_ID ); |
|
| 2022 | - $comment_permalink = $permalink . "#comment-" . $comment->comment_ID; |
|
| 2023 | - $read_more = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __( 'Read more', 'geodirectory' ) . '</a>'; |
|
| 2020 | + $post_title = get_the_title($comment_post_ID); |
|
| 2021 | + $permalink = get_permalink($comment_post_ID); |
|
| 2022 | + $comment_permalink = $permalink."#comment-".$comment->comment_ID; |
|
| 2023 | + $read_more = '<a class="comment_excerpt" href="'.$comment_permalink.'">'.__('Read more', 'geodirectory').'</a>';
|
|
| 2024 | 2024 | |
| 2025 | - $comment_content_length = strlen( $comment_content ); |
|
| 2026 | - if ( $comment_content_length > $comment_lenth ) {
|
|
| 2027 | - $comment_excerpt = mb_substr( $comment_content, 0, $comment_lenth ) . '... ' . $read_more; |
|
| 2025 | + $comment_content_length = strlen($comment_content); |
|
| 2026 | + if ($comment_content_length > $comment_lenth) {
|
|
| 2027 | + $comment_excerpt = mb_substr($comment_content, 0, $comment_lenth).'... '.$read_more; |
|
| 2028 | 2028 | } else {
|
| 2029 | 2029 | $comment_excerpt = $comment_content; |
| 2030 | 2030 | } |
| 2031 | 2031 | |
| 2032 | - if ( $comment->user_id ) {
|
|
| 2033 | - $user_profile_url = get_author_posts_url( $comment->user_id ); |
|
| 2032 | + if ($comment->user_id) {
|
|
| 2033 | + $user_profile_url = get_author_posts_url($comment->user_id); |
|
| 2034 | 2034 | } else {
|
| 2035 | 2035 | $user_profile_url = ''; |
| 2036 | 2036 | } |
| 2037 | 2037 | |
| 2038 | - if ( $comment_id && $na ) {
|
|
| 2038 | + if ($comment_id && $na) {
|
|
| 2039 | 2039 | $comments_echo .= '<li class="clearfix">'; |
| 2040 | - $comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">"; |
|
| 2041 | - if ( function_exists( 'get_avatar' ) ) {
|
|
| 2042 | - if ( ! isset( $comment->comment_type ) ) {
|
|
| 2043 | - if ( $user_profile_url ) {
|
|
| 2044 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 2040 | + $comments_echo .= "<span class=\"li".$comment_id." geodir_reviewer_image\">"; |
|
| 2041 | + if (function_exists('get_avatar')) {
|
|
| 2042 | + if (!isset($comment->comment_type)) {
|
|
| 2043 | + if ($user_profile_url) {
|
|
| 2044 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
| 2045 | 2045 | } |
| 2046 | - $comments_echo .= get_avatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' ); |
|
| 2047 | - if ( $user_profile_url ) {
|
|
| 2046 | + $comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
| 2047 | + if ($user_profile_url) {
|
|
| 2048 | 2048 | $comments_echo .= '</a>'; |
| 2049 | 2049 | } |
| 2050 | - } elseif ( ( isset( $comment->comment_type ) && $comment->comment_type == 'trackback' ) || ( isset( $comment->comment_type ) && $comment->comment_type == 'pingback' ) ) {
|
|
| 2051 | - if ( $user_profile_url ) {
|
|
| 2052 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 2050 | + } elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
|
|
| 2051 | + if ($user_profile_url) {
|
|
| 2052 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
| 2053 | 2053 | } |
| 2054 | - $comments_echo .= get_avatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' ); |
|
| 2054 | + $comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
| 2055 | 2055 | } |
| 2056 | - } elseif ( function_exists( 'gravatar' ) ) {
|
|
| 2057 | - if ( $user_profile_url ) {
|
|
| 2058 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 2056 | + } elseif (function_exists('gravatar')) {
|
|
| 2057 | + if ($user_profile_url) {
|
|
| 2058 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
| 2059 | 2059 | } |
| 2060 | 2060 | $comments_echo .= "<img src=\""; |
| 2061 | - if ( '' == $comment->comment_type ) {
|
|
| 2062 | - $comments_echo .= gravatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' ); |
|
| 2063 | - if ( $user_profile_url ) {
|
|
| 2061 | + if ('' == $comment->comment_type) {
|
|
| 2062 | + $comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
| 2063 | + if ($user_profile_url) {
|
|
| 2064 | 2064 | $comments_echo .= '</a>'; |
| 2065 | 2065 | } |
| 2066 | - } elseif ( ( 'trackback' == $comment->comment_type ) || ( 'pingback' == $comment->comment_type ) ) {
|
|
| 2067 | - if ( $user_profile_url ) {
|
|
| 2068 | - $comments_echo .= '<a href="' . $user_profile_url . '">'; |
|
| 2066 | + } elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
|
|
| 2067 | + if ($user_profile_url) {
|
|
| 2068 | + $comments_echo .= '<a href="'.$user_profile_url.'">'; |
|
| 2069 | 2069 | } |
| 2070 | - $comments_echo .= gravatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' ); |
|
| 2071 | - if ( $user_profile_url ) {
|
|
| 2070 | + $comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png'); |
|
| 2071 | + if ($user_profile_url) {
|
|
| 2072 | 2072 | $comments_echo .= '</a>'; |
| 2073 | 2073 | } |
| 2074 | 2074 | } |
@@ -2078,17 +2078,17 @@ discard block |
||
| 2078 | 2078 | $comments_echo .= "</span>\n"; |
| 2079 | 2079 | |
| 2080 | 2080 | $comments_echo .= '<span class="geodir_reviewer_content">'; |
| 2081 | - if ( $comment->user_id ) {
|
|
| 2082 | - $comments_echo .= '<a href="' . get_author_posts_url( $comment->user_id ) . '">'; |
|
| 2081 | + if ($comment->user_id) {
|
|
| 2082 | + $comments_echo .= '<a href="'.get_author_posts_url($comment->user_id).'">'; |
|
| 2083 | 2083 | } |
| 2084 | - $comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> '; |
|
| 2085 | - if ( $comment->user_id ) {
|
|
| 2084 | + $comments_echo .= '<span class="geodir_reviewer_author">'.$comment->comment_author.'</span> '; |
|
| 2085 | + if ($comment->user_id) {
|
|
| 2086 | 2086 | $comments_echo .= '</a>'; |
| 2087 | 2087 | } |
| 2088 | - $comments_echo .= '<span class="geodir_reviewer_reviewed">' . __( 'reviewed', 'geodirectory' ) . '</span> '; |
|
| 2089 | - $comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>'; |
|
| 2090 | - $comments_echo .= geodir_get_rating_stars( $comment->overall_rating, $comment_post_ID ); |
|
| 2091 | - $comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . ''; |
|
| 2088 | + $comments_echo .= '<span class="geodir_reviewer_reviewed">'.__('reviewed', 'geodirectory').'</span> ';
|
|
| 2089 | + $comments_echo .= '<a href="'.$permalink.'" class="geodir_reviewer_title">'.$post_title.'</a>'; |
|
| 2090 | + $comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID); |
|
| 2091 | + $comments_echo .= '<p class="geodir_reviewer_text">'.$comment_excerpt.''; |
|
| 2092 | 2092 | //echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
|
| 2093 | 2093 | $comments_echo .= '</p>'; |
| 2094 | 2094 | |
@@ -2108,25 +2108,25 @@ discard block |
||
| 2108 | 2108 | * @return array Returns post categories as an array. |
| 2109 | 2109 | */ |
| 2110 | 2110 | function geodir_home_map_cats_key_value_array() {
|
| 2111 | - $post_types = geodir_get_posttypes( 'object' ); |
|
| 2111 | + $post_types = geodir_get_posttypes('object');
|
|
| 2112 | 2112 | |
| 2113 | 2113 | $return = array(); |
| 2114 | - if ( ! empty( $post_types ) ) {
|
|
| 2115 | - foreach ( $post_types as $key => $post_type ) {
|
|
| 2116 | - $cpt_name = __( $post_type->labels->singular_name, 'geodirectory' ); |
|
| 2117 | - $post_type_name = sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name ); |
|
| 2118 | - $taxonomies = geodir_get_taxonomies( $key ); |
|
| 2119 | - $cat_taxonomy = ! empty( $taxonomies[0] ) ? $taxonomies[0] : null; |
|
| 2120 | - $cat_terms = $cat_taxonomy ? get_terms( $cat_taxonomy ) : null; |
|
| 2121 | - |
|
| 2122 | - if ( ! empty( $cat_terms ) ) {
|
|
| 2123 | - $return[ 'optgroup_start-' . $key ] = $post_type_name; |
|
| 2124 | - |
|
| 2125 | - foreach ( $cat_terms as $cat_term ) {
|
|
| 2126 | - $return[ $key . '_' . $cat_term->term_id ] = $cat_term->name; |
|
| 2114 | + if (!empty($post_types)) {
|
|
| 2115 | + foreach ($post_types as $key => $post_type) {
|
|
| 2116 | + $cpt_name = __($post_type->labels->singular_name, 'geodirectory'); |
|
| 2117 | + $post_type_name = sprintf(__('%s Categories', 'geodirectory'), $cpt_name);
|
|
| 2118 | + $taxonomies = geodir_get_taxonomies($key); |
|
| 2119 | + $cat_taxonomy = !empty($taxonomies[0]) ? $taxonomies[0] : null; |
|
| 2120 | + $cat_terms = $cat_taxonomy ? get_terms($cat_taxonomy) : null; |
|
| 2121 | + |
|
| 2122 | + if (!empty($cat_terms)) {
|
|
| 2123 | + $return['optgroup_start-'.$key] = $post_type_name; |
|
| 2124 | + |
|
| 2125 | + foreach ($cat_terms as $cat_term) {
|
|
| 2126 | + $return[$key.'_'.$cat_term->term_id] = $cat_term->name; |
|
| 2127 | 2127 | } |
| 2128 | 2128 | |
| 2129 | - $return[ 'optgroup_end-' . $key ] = $post_type_name; |
|
| 2129 | + $return['optgroup_end-'.$key] = $post_type_name; |
|
| 2130 | 2130 | } |
| 2131 | 2131 | } |
| 2132 | 2132 | } |
@@ -2142,14 +2142,14 @@ discard block |
||
| 2142 | 2142 | * @package GeoDirectory |
| 2143 | 2143 | */ |
| 2144 | 2144 | function geodir_twitter_tweet_button() {
|
| 2145 | - if ( isset( $_GET['gde'] ) ) {
|
|
| 2146 | - $link = '?url=' . urlencode( geodir_curPageURL() ); |
|
| 2145 | + if (isset($_GET['gde'])) {
|
|
| 2146 | + $link = '?url='.urlencode(geodir_curPageURL()); |
|
| 2147 | 2147 | } else {
|
| 2148 | 2148 | $link = ''; |
| 2149 | 2149 | } |
| 2150 | 2150 | ?> |
| 2151 | 2151 | <a href="http://twitter.com/share<?php echo $link; ?>" |
| 2152 | - class="twitter-share-button"><?php _e( 'Tweet', 'geodirectory' ); ?></a> |
|
| 2152 | + class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
|
|
| 2153 | 2153 | <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script> |
| 2154 | 2154 | <?php |
| 2155 | 2155 | } |
@@ -2166,10 +2166,10 @@ discard block |
||
| 2166 | 2166 | function geodir_fb_like_button() {
|
| 2167 | 2167 | global $post; |
| 2168 | 2168 | ?> |
| 2169 | - <iframe <?php if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) ) {
|
|
| 2169 | + <iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
|
|
| 2170 | 2170 | echo 'allowtransparency="true"'; |
| 2171 | 2171 | } ?> class="facebook" |
| 2172 | - src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode( get_permalink( $post->ID ) ); ?>&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light" |
|
| 2172 | + src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&layout=button_count&show_faces=false&width=100&action=like&colorscheme=light" |
|
| 2173 | 2173 | style="border:none; overflow:hidden; width:100px; height:20px"></iframe> |
| 2174 | 2174 | <?php |
| 2175 | 2175 | } |
@@ -2200,7 +2200,7 @@ discard block |
||
| 2200 | 2200 | |
| 2201 | 2201 | |
| 2202 | 2202 | function geodir_listing_bounce_map_pin_on_hover() {
|
| 2203 | - if ( get_option( 'geodir_listing_hover_bounce_map_pin', true ) ) {
|
|
| 2203 | + if (get_option('geodir_listing_hover_bounce_map_pin', true)) {
|
|
| 2204 | 2204 | ?> |
| 2205 | 2205 | <script> |
| 2206 | 2206 | jQuery(function ($) {
|
@@ -2223,44 +2223,44 @@ discard block |
||
| 2223 | 2223 | } |
| 2224 | 2224 | } |
| 2225 | 2225 | |
| 2226 | -add_action( 'geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10 ); |
|
| 2226 | +add_action('geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10);
|
|
| 2227 | 2227 | |
| 2228 | -add_action( 'geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1 ); |
|
| 2229 | -function geodir_output_favourite_html_listings( $post_id ) {
|
|
| 2230 | - geodir_favourite_html( '', $post_id ); |
|
| 2228 | +add_action('geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1);
|
|
| 2229 | +function geodir_output_favourite_html_listings($post_id) {
|
|
| 2230 | + geodir_favourite_html('', $post_id);
|
|
| 2231 | 2231 | } |
| 2232 | 2232 | |
| 2233 | -add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2 ); |
|
| 2234 | -function geodir_output_pinpoint_html_listings( $post_id, $post ) {
|
|
| 2233 | +add_action('geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2);
|
|
| 2234 | +function geodir_output_pinpoint_html_listings($post_id, $post) {
|
|
| 2235 | 2235 | global $wp_query; |
| 2236 | 2236 | |
| 2237 | 2237 | $show_pin_point = $wp_query->is_main_query(); |
| 2238 | 2238 | |
| 2239 | - if ( ! empty( $show_pin_point ) && is_active_widget( false, "", "geodir_map_v3_listing_map" ) ) {
|
|
| 2240 | - $term_icon_url = get_tax_meta( $post->default_category, 'ct_cat_icon', false, $post->post_type ); |
|
| 2241 | - $marker_icon = isset( $term_icon_url['src'] ) ? $term_icon_url['src'] : get_option( 'geodir_default_marker_icon' ); |
|
| 2239 | + if (!empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
|
|
| 2240 | + $term_icon_url = get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type); |
|
| 2241 | + $marker_icon = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
|
|
| 2242 | 2242 | ?> |
| 2243 | 2243 | <span class="geodir-pinpoint" |
| 2244 | - style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters( 'geodir_listing_listview_pinpoint_inner_content', '', 'listing' ); ?></span>
|
|
| 2244 | + style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters('geodir_listing_listview_pinpoint_inner_content', '', 'listing'); ?></span>
|
|
| 2245 | 2245 | <a class="geodir-pinpoint-link" href="javascript:void(0)" |
| 2246 | 2246 | onclick="openMarker('listing_map_canvas' ,'<?php echo $post->ID; ?>')"
|
| 2247 | 2247 | onmouseover="animate_marker('listing_map_canvas' ,'<?php echo $post->ID; ?>')"
|
| 2248 | - onmouseout="stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')"><?php _e( 'Pinpoint', 'geodirectory' ); ?></a>
|
|
| 2248 | + onmouseout="stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')"><?php _e('Pinpoint', 'geodirectory'); ?></a>
|
|
| 2249 | 2249 | <?php |
| 2250 | 2250 | } |
| 2251 | 2251 | } |
| 2252 | 2252 | |
| 2253 | 2253 | function geodir_search_form_submit_button() {
|
| 2254 | 2254 | |
| 2255 | - $new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true; |
|
| 2255 | + $new_style = get_option('geodir_show_search_old_search_from') ? false : true;
|
|
| 2256 | 2256 | |
| 2257 | - if ( $new_style ) {
|
|
| 2257 | + if ($new_style) {
|
|
| 2258 | 2258 | $default_search_button_label = '<i class="fa fa-search" aria-hidden="true"></i>'; |
| 2259 | - }else{
|
|
| 2259 | + } else {
|
|
| 2260 | 2260 | $default_search_button_label = 'Search'; |
| 2261 | 2261 | } |
| 2262 | - if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) {
|
|
| 2263 | - $default_search_button_label = __( get_option( 'geodir_search_button_label' ), 'geodirectory' ); |
|
| 2262 | + if (get_option('geodir_search_button_label') && get_option('geodir_search_button_label') != 'Search') {
|
|
| 2263 | + $default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
|
|
| 2264 | 2264 | } |
| 2265 | 2265 | |
| 2266 | 2266 | /** |
@@ -2272,78 +2272,78 @@ discard block |
||
| 2272 | 2272 | * |
| 2273 | 2273 | * @param string $default_search_button_label The current search button text. |
| 2274 | 2274 | */ |
| 2275 | - $default_search_button_label = apply_filters( 'geodir_search_default_search_button_text', $default_search_button_label ); |
|
| 2275 | + $default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);
|
|
| 2276 | 2276 | |
| 2277 | 2277 | $fa_class = ''; |
| 2278 | - if ( strpos( $default_search_button_label, '&#' ) !== false ) {
|
|
| 2278 | + if (strpos($default_search_button_label, '&#') !== false) {
|
|
| 2279 | 2279 | $fa_class = 'fa'; |
| 2280 | 2280 | } |
| 2281 | 2281 | |
| 2282 | 2282 | |
| 2283 | - if ( $new_style ) {
|
|
| 2283 | + if ($new_style) {
|
|
| 2284 | 2284 | ?> |
| 2285 | - <button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e( $default_search_button_label ,'geodirectory'); ?></button> |
|
| 2286 | -<?php }else{?>
|
|
| 2287 | - <input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>" |
|
| 2285 | + <button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e($default_search_button_label, 'geodirectory'); ?></button> |
|
| 2286 | +<?php } else {?>
|
|
| 2287 | + <input type="button" value="<?php esc_attr_e($default_search_button_label); ?>" |
|
| 2288 | 2288 | class="geodir_submit_search <?php echo $fa_class; ?>"/> |
| 2289 | 2289 | <?php } |
| 2290 | 2290 | } |
| 2291 | 2291 | |
| 2292 | -add_action( 'geodir_before_search_button', 'geodir_search_form_submit_button', 5000 ); |
|
| 2292 | +add_action('geodir_before_search_button', 'geodir_search_form_submit_button', 5000);
|
|
| 2293 | 2293 | |
| 2294 | 2294 | function geodir_search_form_post_type_input() {
|
| 2295 | 2295 | global $geodir_search_post_type; |
| 2296 | - $post_types = apply_filters( 'geodir_search_form_post_types', geodir_get_posttypes( 'object' ) ); |
|
| 2296 | + $post_types = apply_filters('geodir_search_form_post_types', geodir_get_posttypes('object'));
|
|
| 2297 | 2297 | $curr_post_type = $geodir_search_post_type; |
| 2298 | 2298 | |
| 2299 | - if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
|
|
| 2299 | + if (!empty($post_types) && count((array) $post_types) > 1) {
|
|
| 2300 | 2300 | |
| 2301 | - foreach ( $post_types as $post_type => $info ){
|
|
| 2301 | + foreach ($post_types as $post_type => $info) {
|
|
| 2302 | 2302 | global $wpdb; |
| 2303 | - $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) ); |
|
| 2304 | - if ( ! $has_posts ) {
|
|
| 2303 | + $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
|
|
| 2304 | + if (!$has_posts) {
|
|
| 2305 | 2305 | unset($post_types->{$post_type});
|
| 2306 | 2306 | } |
| 2307 | 2307 | } |
| 2308 | 2308 | |
| 2309 | - if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
|
|
| 2309 | + if (!empty($post_types) && count((array) $post_types) > 1) {
|
|
| 2310 | 2310 | |
| 2311 | - $new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true; |
|
| 2312 | - if ( $new_style ) {
|
|
| 2311 | + $new_style = get_option('geodir_show_search_old_search_from') ? false : true;
|
|
| 2312 | + if ($new_style) {
|
|
| 2313 | 2313 | echo "<div class='gd-search-input-wrapper gd-search-field-cpt'>"; |
| 2314 | 2314 | } |
| 2315 | 2315 | ?> |
| 2316 | 2316 | <select name="stype" class="search_by_post"> |
| 2317 | - <?php foreach ( $post_types as $post_type => $info ): |
|
| 2317 | + <?php foreach ($post_types as $post_type => $info): |
|
| 2318 | 2318 | global $wpdb; |
| 2319 | 2319 | ?> |
| 2320 | 2320 | |
| 2321 | - <option data-label="<?php echo get_post_type_archive_link( $post_type ); ?>" |
|
| 2322 | - value="<?php echo $post_type; ?>" <?php if ( isset( $_REQUEST['stype'] ) ) {
|
|
| 2323 | - if ( $post_type == $_REQUEST['stype'] ) {
|
|
| 2321 | + <option data-label="<?php echo get_post_type_archive_link($post_type); ?>" |
|
| 2322 | + value="<?php echo $post_type; ?>" <?php if (isset($_REQUEST['stype'])) {
|
|
| 2323 | + if ($post_type == $_REQUEST['stype']) {
|
|
| 2324 | 2324 | echo 'selected="selected"'; |
| 2325 | 2325 | } |
| 2326 | - } elseif ( $curr_post_type == $post_type ) {
|
|
| 2326 | + } elseif ($curr_post_type == $post_type) {
|
|
| 2327 | 2327 | echo 'selected="selected"'; |
| 2328 | - } ?>><?php _e( ucfirst( $info->labels->name ), 'geodirectory' ); ?></option> |
|
| 2328 | + } ?>><?php _e(ucfirst($info->labels->name), 'geodirectory'); ?></option> |
|
| 2329 | 2329 | |
| 2330 | 2330 | <?php endforeach; ?> |
| 2331 | 2331 | </select> |
| 2332 | 2332 | <?php |
| 2333 | - if ( $new_style ) {
|
|
| 2333 | + if ($new_style) {
|
|
| 2334 | 2334 | echo "</div>"; |
| 2335 | 2335 | } |
| 2336 | - }else{
|
|
| 2337 | - if(! empty( $post_types )){
|
|
| 2338 | - $pt_arr = (array)$post_types; |
|
| 2339 | - echo '<input type="hidden" name="stype" value="' . key( $pt_arr ) . '" />'; |
|
| 2340 | - }else{
|
|
| 2336 | + } else {
|
|
| 2337 | + if (!empty($post_types)) {
|
|
| 2338 | + $pt_arr = (array) $post_types; |
|
| 2339 | + echo '<input type="hidden" name="stype" value="'.key($pt_arr).'" />'; |
|
| 2340 | + } else {
|
|
| 2341 | 2341 | echo '<input type="hidden" name="stype" value="gd_place" />'; |
| 2342 | 2342 | } |
| 2343 | 2343 | |
| 2344 | 2344 | } |
| 2345 | 2345 | |
| 2346 | - }elseif ( ! empty( $post_types ) ) {
|
|
| 2346 | + }elseif (!empty($post_types)) {
|
|
| 2347 | 2347 | echo '<input type="hidden" name="stype" value="gd_place" />'; |
| 2348 | 2348 | } |
| 2349 | 2349 | } |
@@ -2351,26 +2351,26 @@ discard block |
||
| 2351 | 2351 | function geodir_search_form_search_input() {
|
| 2352 | 2352 | |
| 2353 | 2353 | $default_search_for_text = SEARCH_FOR_TEXT; |
| 2354 | - if ( get_option( 'geodir_search_field_default_text' ) ) {
|
|
| 2355 | - $default_search_for_text = __( get_option( 'geodir_search_field_default_text' ), 'geodirectory' ); |
|
| 2354 | + if (get_option('geodir_search_field_default_text')) {
|
|
| 2355 | + $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
|
|
| 2356 | 2356 | } |
| 2357 | 2357 | |
| 2358 | 2358 | $new_style = get_option('geodir_show_search_old_search_from') ? false : true;
|
| 2359 | - if($new_style){
|
|
| 2359 | + if ($new_style) {
|
|
| 2360 | 2360 | echo "<div class='gd-search-input-wrapper gd-search-field-search'>"; |
| 2361 | 2361 | } |
| 2362 | 2362 | ?> |
| 2363 | 2363 | <input class="search_text" name="s" |
| 2364 | - value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) {
|
|
| 2365 | - echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) ); |
|
| 2364 | + value="<?php if (isset($_REQUEST['s']) && trim($_REQUEST['s']) != '') {
|
|
| 2365 | + echo esc_attr(stripslashes_deep($_REQUEST['s'])); |
|
| 2366 | 2366 | } else {
|
| 2367 | 2367 | echo $default_search_for_text; |
| 2368 | 2368 | } ?>" type="text" |
| 2369 | - onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}"
|
|
| 2370 | - onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}"
|
|
| 2369 | + onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql($default_search_for_text); ?>';}"
|
|
| 2370 | + onfocus="if (this.value == '<?php echo esc_sql($default_search_for_text); ?>') {this.value = '';}"
|
|
| 2371 | 2371 | onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);"> |
| 2372 | 2372 | <?php |
| 2373 | - if($new_style){
|
|
| 2373 | + if ($new_style) {
|
|
| 2374 | 2374 | echo "</div>"; |
| 2375 | 2375 | } |
| 2376 | 2376 | } |
@@ -2378,12 +2378,12 @@ discard block |
||
| 2378 | 2378 | function geodir_search_form_near_input() {
|
| 2379 | 2379 | |
| 2380 | 2380 | $default_near_text = NEAR_TEXT; |
| 2381 | - if ( get_option( 'geodir_near_field_default_text' ) ) {
|
|
| 2382 | - $default_near_text = __( get_option( 'geodir_near_field_default_text' ), 'geodirectory' ); |
|
| 2381 | + if (get_option('geodir_near_field_default_text')) {
|
|
| 2382 | + $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
|
|
| 2383 | 2383 | } |
| 2384 | 2384 | |
| 2385 | - if ( isset( $_REQUEST['snear'] ) && $_REQUEST['snear'] != '' ) {
|
|
| 2386 | - $near = esc_attr( stripslashes_deep( $_REQUEST['snear'] ) ); |
|
| 2385 | + if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') {
|
|
| 2386 | + $near = esc_attr(stripslashes_deep($_REQUEST['snear'])); |
|
| 2387 | 2387 | } else {
|
| 2388 | 2388 | $near = $default_near_text; |
| 2389 | 2389 | } |
@@ -2397,7 +2397,7 @@ discard block |
||
| 2397 | 2397 | * @since 1.6.9 |
| 2398 | 2398 | * @param string $curr_post_type The current post type. |
| 2399 | 2399 | */ |
| 2400 | - $near_input_extra = apply_filters('geodir_near_input_extra','',$curr_post_type);
|
|
| 2400 | + $near_input_extra = apply_filters('geodir_near_input_extra', '', $curr_post_type);
|
|
| 2401 | 2401 | |
| 2402 | 2402 | |
| 2403 | 2403 | /** |
@@ -2410,7 +2410,7 @@ discard block |
||
| 2410 | 2410 | * @param string $near The current near value. |
| 2411 | 2411 | * @param string $default_near_text The default near value. |
| 2412 | 2412 | */ |
| 2413 | - $near = apply_filters( 'geodir_search_near_text', $near, $default_near_text ); |
|
| 2413 | + $near = apply_filters('geodir_search_near_text', $near, $default_near_text);
|
|
| 2414 | 2414 | /** |
| 2415 | 2415 | * Filter the default "Near" text value for the search form. |
| 2416 | 2416 | * |
@@ -2421,7 +2421,7 @@ discard block |
||
| 2421 | 2421 | * @param string $near The current near value. |
| 2422 | 2422 | * @param string $default_near_text The default near value. |
| 2423 | 2423 | */ |
| 2424 | - $default_near_text = apply_filters( 'geodir_search_default_near_text', $default_near_text, $near ); |
|
| 2424 | + $default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near);
|
|
| 2425 | 2425 | /** |
| 2426 | 2426 | * Filter the class for the near search input. |
| 2427 | 2427 | * |
@@ -2429,10 +2429,10 @@ discard block |
||
| 2429 | 2429 | * |
| 2430 | 2430 | * @param string $class The class for the HTML near input, default is blank. |
| 2431 | 2431 | */ |
| 2432 | - $near_class = apply_filters( 'geodir_search_near_class', '' ); |
|
| 2432 | + $near_class = apply_filters('geodir_search_near_class', '');
|
|
| 2433 | 2433 | |
| 2434 | 2434 | $new_style = get_option('geodir_show_search_old_search_from') ? false : true;
|
| 2435 | - if($new_style){
|
|
| 2435 | + if ($new_style) {
|
|
| 2436 | 2436 | echo "<div class='gd-search-input-wrapper gd-search-field-near' $near_input_extra>"; |
| 2437 | 2437 | |
| 2438 | 2438 | do_action('geodir_before_near_input');
|
@@ -2440,30 +2440,30 @@ discard block |
||
| 2440 | 2440 | |
| 2441 | 2441 | ?> |
| 2442 | 2442 | <input name="snear" class="snear <?php echo $near_class; ?>" type="text" value="<?php echo $near; ?>" |
| 2443 | - onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql( $near ); ?>' != '' ? '<?php echo esc_sql( $near ); ?>' : '<?php echo $default_near_text; ?>');}"
|
|
| 2444 | - onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql( $near ); ?>') {this.value = '';}"
|
|
| 2445 | - onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra;?>/> |
|
| 2443 | + onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql($near); ?>' != '' ? '<?php echo esc_sql($near); ?>' : '<?php echo $default_near_text; ?>');}"
|
|
| 2444 | + onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql($near); ?>') {this.value = '';}"
|
|
| 2445 | + onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra; ?>/> |
|
| 2446 | 2446 | <?php |
| 2447 | - if($new_style){
|
|
| 2447 | + if ($new_style) {
|
|
| 2448 | 2448 | do_action('geodir_after_near_input');
|
| 2449 | 2449 | |
| 2450 | 2450 | echo "</div>"; |
| 2451 | 2451 | } |
| 2452 | 2452 | } |
| 2453 | 2453 | |
| 2454 | -add_action( 'geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10 ); |
|
| 2455 | -add_action( 'geodir_search_form_inputs', 'geodir_search_form_search_input', 20 ); |
|
| 2456 | -add_action( 'geodir_search_form_inputs', 'geodir_search_form_near_input', 30 ); |
|
| 2454 | +add_action('geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10);
|
|
| 2455 | +add_action('geodir_search_form_inputs', 'geodir_search_form_search_input', 20);
|
|
| 2456 | +add_action('geodir_search_form_inputs', 'geodir_search_form_near_input', 30);
|
|
| 2457 | 2457 | |
| 2458 | -function geodir_get_search_post_type($pt=''){
|
|
| 2458 | +function geodir_get_search_post_type($pt = '') {
|
|
| 2459 | 2459 | global $geodir_search_post_type; |
| 2460 | 2460 | |
| 2461 | - if($pt!=''){return $geodir_search_post_type = $pt;}
|
|
| 2462 | - if(!empty($geodir_search_post_type)){ return $geodir_search_post_type;}
|
|
| 2461 | + if ($pt != '') {return $geodir_search_post_type = $pt; }
|
|
| 2462 | + if (!empty($geodir_search_post_type)) { return $geodir_search_post_type; }
|
|
| 2463 | 2463 | |
| 2464 | 2464 | $geodir_search_post_type = geodir_get_current_posttype(); |
| 2465 | 2465 | |
| 2466 | - if(!$geodir_search_post_type) {
|
|
| 2466 | + if (!$geodir_search_post_type) {
|
|
| 2467 | 2467 | $geodir_search_post_type = geodir_get_default_posttype(); |
| 2468 | 2468 | } |
| 2469 | 2469 | |
@@ -2471,7 +2471,7 @@ discard block |
||
| 2471 | 2471 | return $geodir_search_post_type; |
| 2472 | 2472 | } |
| 2473 | 2473 | |
| 2474 | -function geodir_search_form(){
|
|
| 2474 | +function geodir_search_form() {
|
|
| 2475 | 2475 | |
| 2476 | 2476 | geodir_get_search_post_type(); |
| 2477 | 2477 | |
@@ -2481,8 +2481,8 @@ discard block |
||
| 2481 | 2481 | die(); |
| 2482 | 2482 | } |
| 2483 | 2483 | |
| 2484 | -add_action( 'wp_ajax_geodir_search_form', 'geodir_search_form' ); |
|
| 2485 | -add_action( 'wp_ajax_nopriv_geodir_search_form', 'geodir_search_form' ); |
|
| 2484 | +add_action('wp_ajax_geodir_search_form', 'geodir_search_form');
|
|
| 2485 | +add_action('wp_ajax_nopriv_geodir_search_form', 'geodir_search_form');
|
|
| 2486 | 2486 | |
| 2487 | 2487 | /** |
| 2488 | 2488 | * Check wpml active or not. |
@@ -2553,7 +2553,7 @@ discard block |
||
| 2553 | 2553 | } |
| 2554 | 2554 | } |
| 2555 | 2555 | } |
| 2556 | -add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 ); |
|
| 2556 | +add_filter('icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4);
|
|
| 2557 | 2557 | |
| 2558 | 2558 | /** |
| 2559 | 2559 | * Duplicate post listing manually after listing saved. |
@@ -2591,7 +2591,7 @@ discard block |
||
| 2591 | 2591 | function geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang) {
|
| 2592 | 2592 | global $wpdb; |
| 2593 | 2593 | |
| 2594 | - $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
|
|
| 2594 | + $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM ".GEODIR_REVIEW_TABLE." WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
|
|
| 2595 | 2595 | |
| 2596 | 2596 | if (!empty($reviews)) {
|
| 2597 | 2597 | foreach ($reviews as $review) {
|
@@ -2619,14 +2619,14 @@ discard block |
||
| 2619 | 2619 | global $wpdb, $plugin_prefix; |
| 2620 | 2620 | |
| 2621 | 2621 | $post_type = get_post_type($master_post_id); |
| 2622 | - $post_table = $plugin_prefix . $post_type . '_detail'; |
|
| 2622 | + $post_table = $plugin_prefix.$post_type.'_detail'; |
|
| 2623 | 2623 | |
| 2624 | - $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
|
|
| 2625 | - $data = (array)$wpdb->get_row($query); |
|
| 2624 | + $query = $wpdb->prepare("SELECT * FROM ".$post_table." WHERE post_id = %d", array($master_post_id));
|
|
| 2625 | + $data = (array) $wpdb->get_row($query); |
|
| 2626 | 2626 | |
| 2627 | - if ( !empty( $data ) ) {
|
|
| 2627 | + if (!empty($data)) {
|
|
| 2628 | 2628 | $data['post_id'] = $tr_post_id; |
| 2629 | - unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category']); |
|
| 2629 | + unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type.'category']); |
|
| 2630 | 2630 | $wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
|
| 2631 | 2631 | return true; |
| 2632 | 2632 | } |
@@ -2651,7 +2651,7 @@ discard block |
||
| 2651 | 2651 | global $sitepress, $wpdb; |
| 2652 | 2652 | $post_type = get_post_type($master_post_id); |
| 2653 | 2653 | |
| 2654 | - remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
|
|
| 2654 | + remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language
|
|
| 2655 | 2655 | |
| 2656 | 2656 | $taxonomies = get_object_taxonomies($post_type); |
| 2657 | 2657 | foreach ($taxonomies as $taxonomy) {
|
@@ -2660,9 +2660,9 @@ discard block |
||
| 2660 | 2660 | |
| 2661 | 2661 | if ($terms) {
|
| 2662 | 2662 | foreach ($terms as $term) {
|
| 2663 | - $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang); |
|
| 2663 | + $tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang);
|
|
| 2664 | 2664 | |
| 2665 | - if (!is_null($tr_id)){
|
|
| 2665 | + if (!is_null($tr_id)) {
|
|
| 2666 | 2666 | // not using get_term - unfiltered get_term |
| 2667 | 2667 | $translated_term = $wpdb->get_row($wpdb->prepare("
|
| 2668 | 2668 | SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
|
@@ -2671,14 +2671,14 @@ discard block |
||
| 2671 | 2671 | } |
| 2672 | 2672 | } |
| 2673 | 2673 | |
| 2674 | - if (!is_taxonomy_hierarchical($taxonomy)){
|
|
| 2675 | - $terms_array = array_unique( array_map( 'intval', $terms_array ) ); |
|
| 2674 | + if (!is_taxonomy_hierarchical($taxonomy)) {
|
|
| 2675 | + $terms_array = array_unique(array_map('intval', $terms_array));
|
|
| 2676 | 2676 | } |
| 2677 | 2677 | |
| 2678 | 2678 | wp_set_post_terms($tr_post_id, $terms_array, $taxonomy); |
| 2679 | 2679 | |
| 2680 | - if ($taxonomy == $post_type . 'category') {
|
|
| 2681 | - geodir_set_postcat_structure($tr_post_id, $post_type . 'category'); |
|
| 2680 | + if ($taxonomy == $post_type.'category') {
|
|
| 2681 | + geodir_set_postcat_structure($tr_post_id, $post_type.'category'); |
|
| 2682 | 2682 | } |
| 2683 | 2683 | } |
| 2684 | 2684 | } |
@@ -2699,15 +2699,15 @@ discard block |
||
| 2699 | 2699 | function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) {
|
| 2700 | 2700 | global $wpdb; |
| 2701 | 2701 | |
| 2702 | - $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
|
|
| 2702 | + $query = $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
|
|
| 2703 | 2703 | $wpdb->query($query); |
| 2704 | 2704 | |
| 2705 | - $query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
|
|
| 2705 | + $query = $wpdb->prepare("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
|
|
| 2706 | 2706 | $post_images = $wpdb->get_results($query); |
| 2707 | 2707 | |
| 2708 | - if ( !empty( $post_images ) ) {
|
|
| 2709 | - foreach ( $post_images as $post_image) {
|
|
| 2710 | - $image_data = (array)$post_image; |
|
| 2708 | + if (!empty($post_images)) {
|
|
| 2709 | + foreach ($post_images as $post_image) {
|
|
| 2710 | + $image_data = (array) $post_image; |
|
| 2711 | 2711 | unset($image_data['ID']); |
| 2712 | 2712 | $image_data['post_id'] = $tr_post_id; |
| 2713 | 2713 | |
@@ -2740,13 +2740,13 @@ discard block |
||
| 2740 | 2740 | function geodir_wpml_duplicate_post_review($master_comment_id, $master_post_id, $tr_post_id, $lang) {
|
| 2741 | 2741 | global $wpdb, $plugin_prefix, $sitepress; |
| 2742 | 2742 | |
| 2743 | - $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
|
|
| 2743 | + $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
|
|
| 2744 | 2744 | |
| 2745 | 2745 | if (empty($review)) {
|
| 2746 | 2746 | return false; |
| 2747 | 2747 | } |
| 2748 | 2748 | if ($review['post_id'] != $master_post_id) {
|
| 2749 | - $wpdb->query($wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
|
|
| 2749 | + $wpdb->query($wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
|
|
| 2750 | 2750 | geodir_update_postrating($master_post_id, $post_type); |
| 2751 | 2751 | } |
| 2752 | 2752 | |
@@ -2757,9 +2757,9 @@ discard block |
||
| 2757 | 2757 | } |
| 2758 | 2758 | |
| 2759 | 2759 | $post_type = get_post_type($master_post_id); |
| 2760 | - $post_table = $plugin_prefix . $post_type . '_detail'; |
|
| 2760 | + $post_table = $plugin_prefix.$post_type.'_detail'; |
|
| 2761 | 2761 | |
| 2762 | - $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM " . $post_table . " WHERE post_id = %d", $tr_post_id), ARRAY_A);
|
|
| 2762 | + $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM ".$post_table." WHERE post_id = %d", $tr_post_id), ARRAY_A);
|
|
| 2763 | 2763 | if (empty($translated_post)) {
|
| 2764 | 2764 | return false; |
| 2765 | 2765 | } |
@@ -2777,7 +2777,7 @@ discard block |
||
| 2777 | 2777 | unset($review['id']); |
| 2778 | 2778 | } |
| 2779 | 2779 | |
| 2780 | - $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
|
|
| 2780 | + $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
|
|
| 2781 | 2781 | |
| 2782 | 2782 | if ($tr_review_id) { // update review
|
| 2783 | 2783 | $wpdb->update(GEODIR_REVIEW_TABLE, $review, array('id' => $tr_review_id));
|
@@ -2790,8 +2790,8 @@ discard block |
||
| 2790 | 2790 | geodir_update_postrating($tr_post_id, $post_type); |
| 2791 | 2791 | |
| 2792 | 2792 | if (defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_review') && $sitepress->get_setting('sync_comments_on_duplicates')) {
|
| 2793 | - $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id = %d", array($tr_comment_id)));
|
|
| 2794 | - $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
|
|
| 2793 | + $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id = %d", array($tr_comment_id)));
|
|
| 2794 | + $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
|
|
| 2795 | 2795 | |
| 2796 | 2796 | if (!empty($likes)) {
|
| 2797 | 2797 | foreach ($likes as $like) {
|
@@ -2893,7 +2893,7 @@ discard block |
||
| 2893 | 2893 | * @return bool True if review star disabled, otherwise false. |
| 2894 | 2894 | */ |
| 2895 | 2895 | function geodir_rating_disabled_post_types() {
|
| 2896 | - $post_types = get_option( 'geodir_disable_rating_cpt' ); |
|
| 2896 | + $post_types = get_option('geodir_disable_rating_cpt');
|
|
| 2897 | 2897 | |
| 2898 | 2898 | /** |
| 2899 | 2899 | * Filter the post types array which have rating disabled. |
@@ -2902,7 +2902,7 @@ discard block |
||
| 2902 | 2902 | * |
| 2903 | 2903 | * @param array $post_types Array of post types which have rating starts disabled. |
| 2904 | 2904 | */ |
| 2905 | - return apply_filters( 'geodir_rating_disabled_post_types', $post_types ); |
|
| 2905 | + return apply_filters('geodir_rating_disabled_post_types', $post_types);
|
|
| 2906 | 2906 | } |
| 2907 | 2907 | |
| 2908 | 2908 | /** |
@@ -2914,30 +2914,30 @@ discard block |
||
| 2914 | 2914 | * @param bool $taxonomy Whether $post_type is taxonomy or not. |
| 2915 | 2915 | * @return bool True if review star disabled, otherwise false. |
| 2916 | 2916 | */ |
| 2917 | -function geodir_cpt_has_rating_disabled( $post_type = '', $taxonomy = false ) {
|
|
| 2917 | +function geodir_cpt_has_rating_disabled($post_type = '', $taxonomy = false) {
|
|
| 2918 | 2918 | $post_types = geodir_rating_disabled_post_types(); |
| 2919 | 2919 | |
| 2920 | - if ( empty( $post_types ) ) {
|
|
| 2920 | + if (empty($post_types)) {
|
|
| 2921 | 2921 | return false; |
| 2922 | 2922 | } |
| 2923 | 2923 | |
| 2924 | - if ( is_int( $post_type ) ) {
|
|
| 2925 | - $post_type = get_post_type( $post_type ); |
|
| 2924 | + if (is_int($post_type)) {
|
|
| 2925 | + $post_type = get_post_type($post_type); |
|
| 2926 | 2926 | } |
| 2927 | 2927 | |
| 2928 | - if ( $taxonomy && !empty( $post_types ) ) {
|
|
| 2928 | + if ($taxonomy && !empty($post_types)) {
|
|
| 2929 | 2929 | $posttypes = array(); |
| 2930 | 2930 | |
| 2931 | - foreach ( $post_types as $posttype ) {
|
|
| 2932 | - $posttypes[] = $posttype . 'category'; |
|
| 2933 | - $posttypes[] = $posttype . '_tags'; |
|
| 2931 | + foreach ($post_types as $posttype) {
|
|
| 2932 | + $posttypes[] = $posttype.'category'; |
|
| 2933 | + $posttypes[] = $posttype.'_tags'; |
|
| 2934 | 2934 | } |
| 2935 | 2935 | |
| 2936 | 2936 | $post_types = $posttypes; |
| 2937 | 2937 | } |
| 2938 | 2938 | |
| 2939 | 2939 | $return = false; |
| 2940 | - if ( $post_type != '' && !empty( $post_types ) && in_array( $post_type, $post_types ) ) {
|
|
| 2940 | + if ($post_type != '' && !empty($post_types) && in_array($post_type, $post_types)) {
|
|
| 2941 | 2941 | $return = true; |
| 2942 | 2942 | } |
| 2943 | 2943 | |
@@ -2362,10 +2362,10 @@ discard block |
||
| 2362 | 2362 | ?> |
| 2363 | 2363 | <input class="search_text" name="s" |
| 2364 | 2364 | value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) {
|
| 2365 | - echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) ); |
|
| 2366 | - } else {
|
|
| 2367 | - echo $default_search_for_text; |
|
| 2368 | - } ?>" type="text" |
|
| 2365 | + echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) ); |
|
| 2366 | + } else {
|
|
| 2367 | + echo $default_search_for_text; |
|
| 2368 | + } ?>" type="text" |
|
| 2369 | 2369 | onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}"
|
| 2370 | 2370 | onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}"
|
| 2371 | 2371 | onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);"> |
@@ -2492,11 +2492,11 @@ discard block |
||
| 2492 | 2492 | * @return True if WPML is active else False. |
| 2493 | 2493 | */ |
| 2494 | 2494 | function geodir_is_wpml() {
|
| 2495 | - if (function_exists('icl_object_id')) {
|
|
| 2496 | - return true; |
|
| 2497 | - } |
|
| 2495 | + if (function_exists('icl_object_id')) {
|
|
| 2496 | + return true; |
|
| 2497 | + } |
|
| 2498 | 2498 | |
| 2499 | - return false; |
|
| 2499 | + return false; |
|
| 2500 | 2500 | } |
| 2501 | 2501 | |
| 2502 | 2502 | /** |
@@ -2511,9 +2511,9 @@ discard block |
||
| 2511 | 2511 | * @return Language code. |
| 2512 | 2512 | */ |
| 2513 | 2513 | function geodir_get_language_for_element($element_id, $element_type) {
|
| 2514 | - global $sitepress; |
|
| 2514 | + global $sitepress; |
|
| 2515 | 2515 | |
| 2516 | - return $sitepress->get_language_for_element($element_id, $element_type); |
|
| 2516 | + return $sitepress->get_language_for_element($element_id, $element_type); |
|
| 2517 | 2517 | } |
| 2518 | 2518 | |
| 2519 | 2519 | /** |
@@ -2530,31 +2530,31 @@ discard block |
||
| 2530 | 2530 | * Added to fix duplicate transaltion for front end. |
| 2531 | 2531 | */ |
| 2532 | 2532 | function geodir_icl_make_duplicate($master_post_id, $lang, $postarr, $tr_post_id, $after_save = false) {
|
| 2533 | - global $sitepress; |
|
| 2533 | + global $sitepress; |
|
| 2534 | 2534 | |
| 2535 | - $post_type = get_post_type($master_post_id); |
|
| 2536 | - $icl_ajx_action = !empty($_REQUEST['icl_ajx_action']) && $_REQUEST['icl_ajx_action'] == 'make_duplicates' ? true : false; |
|
| 2537 | - if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpml_duplicate_dashboard' && !empty($_REQUEST['duplicate_post_ids'])) {
|
|
| 2538 | - $icl_ajx_action = true; |
|
| 2539 | - } |
|
| 2535 | + $post_type = get_post_type($master_post_id); |
|
| 2536 | + $icl_ajx_action = !empty($_REQUEST['icl_ajx_action']) && $_REQUEST['icl_ajx_action'] == 'make_duplicates' ? true : false; |
|
| 2537 | + if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpml_duplicate_dashboard' && !empty($_REQUEST['duplicate_post_ids'])) {
|
|
| 2538 | + $icl_ajx_action = true; |
|
| 2539 | + } |
|
| 2540 | 2540 | |
| 2541 | - if (in_array($post_type, geodir_get_posttypes())) {
|
|
| 2542 | - if ($icl_ajx_action || $after_save) {
|
|
| 2543 | - // Duplicate post details |
|
| 2544 | - geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang); |
|
| 2541 | + if (in_array($post_type, geodir_get_posttypes())) {
|
|
| 2542 | + if ($icl_ajx_action || $after_save) {
|
|
| 2543 | + // Duplicate post details |
|
| 2544 | + geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang); |
|
| 2545 | 2545 | |
| 2546 | - // Duplicate taxonomies |
|
| 2547 | - geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang); |
|
| 2546 | + // Duplicate taxonomies |
|
| 2547 | + geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang); |
|
| 2548 | 2548 | |
| 2549 | - // Duplicate post images |
|
| 2550 | - geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang); |
|
| 2551 | - } |
|
| 2549 | + // Duplicate post images |
|
| 2550 | + geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang); |
|
| 2551 | + } |
|
| 2552 | 2552 | |
| 2553 | - // Sync post reviews |
|
| 2554 | - if ($sitepress->get_setting('sync_comments_on_duplicates')) {
|
|
| 2555 | - geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang); |
|
| 2556 | - } |
|
| 2557 | - } |
|
| 2553 | + // Sync post reviews |
|
| 2554 | + if ($sitepress->get_setting('sync_comments_on_duplicates')) {
|
|
| 2555 | + geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang); |
|
| 2556 | + } |
|
| 2557 | + } |
|
| 2558 | 2558 | } |
| 2559 | 2559 | add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 ); |
| 2560 | 2560 | |
@@ -2568,18 +2568,18 @@ discard block |
||
| 2568 | 2568 | * @param array $request_info The post details in an array. |
| 2569 | 2569 | */ |
| 2570 | 2570 | function geodir_wpml_duplicate_listing($post_id, $request_info) {
|
| 2571 | - global $sitepress; |
|
| 2571 | + global $sitepress; |
|
| 2572 | 2572 | |
| 2573 | - $icl_ajx_action = !empty($_REQUEST['icl_ajx_action']) && $_REQUEST['icl_ajx_action'] == 'make_duplicates' ? true : false; |
|
| 2574 | - if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpml_duplicate_dashboard' && !empty($_REQUEST['duplicate_post_ids'])) {
|
|
| 2575 | - $icl_ajx_action = true; |
|
| 2576 | - } |
|
| 2573 | + $icl_ajx_action = !empty($_REQUEST['icl_ajx_action']) && $_REQUEST['icl_ajx_action'] == 'make_duplicates' ? true : false; |
|
| 2574 | + if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpml_duplicate_dashboard' && !empty($_REQUEST['duplicate_post_ids'])) {
|
|
| 2575 | + $icl_ajx_action = true; |
|
| 2576 | + } |
|
| 2577 | 2577 | |
| 2578 | - if (!$icl_ajx_action && in_array(get_post_type($post_id), geodir_get_posttypes()) && $post_duplicates = $sitepress->get_duplicates($post_id)) {
|
|
| 2579 | - foreach ($post_duplicates as $lang => $dup_post_id) {
|
|
| 2580 | - geodir_icl_make_duplicate($post_id, $lang, $request_info, $dup_post_id, true); |
|
| 2581 | - } |
|
| 2582 | - } |
|
| 2578 | + if (!$icl_ajx_action && in_array(get_post_type($post_id), geodir_get_posttypes()) && $post_duplicates = $sitepress->get_duplicates($post_id)) {
|
|
| 2579 | + foreach ($post_duplicates as $lang => $dup_post_id) {
|
|
| 2580 | + geodir_icl_make_duplicate($post_id, $lang, $request_info, $dup_post_id, true); |
|
| 2581 | + } |
|
| 2582 | + } |
|
| 2583 | 2583 | } |
| 2584 | 2584 | |
| 2585 | 2585 | /** |
@@ -2595,17 +2595,17 @@ discard block |
||
| 2595 | 2595 | * @return bool True for success, False for fail. |
| 2596 | 2596 | */ |
| 2597 | 2597 | function geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang) {
|
| 2598 | - global $wpdb; |
|
| 2598 | + global $wpdb; |
|
| 2599 | 2599 | |
| 2600 | - $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
|
|
| 2600 | + $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
|
|
| 2601 | 2601 | |
| 2602 | - if (!empty($reviews)) {
|
|
| 2603 | - foreach ($reviews as $review) {
|
|
| 2604 | - geodir_wpml_duplicate_post_review($review['comment_id'], $master_post_id, $tr_post_id, $lang); |
|
| 2605 | - } |
|
| 2606 | - } |
|
| 2602 | + if (!empty($reviews)) {
|
|
| 2603 | + foreach ($reviews as $review) {
|
|
| 2604 | + geodir_wpml_duplicate_post_review($review['comment_id'], $master_post_id, $tr_post_id, $lang); |
|
| 2605 | + } |
|
| 2606 | + } |
|
| 2607 | 2607 | |
| 2608 | - return false; |
|
| 2608 | + return false; |
|
| 2609 | 2609 | } |
| 2610 | 2610 | |
| 2611 | 2611 | /** |
@@ -2622,22 +2622,22 @@ discard block |
||
| 2622 | 2622 | * @return bool True for success, False for fail. |
| 2623 | 2623 | */ |
| 2624 | 2624 | function geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang) {
|
| 2625 | - global $wpdb, $plugin_prefix; |
|
| 2625 | + global $wpdb, $plugin_prefix; |
|
| 2626 | 2626 | |
| 2627 | - $post_type = get_post_type($master_post_id); |
|
| 2628 | - $post_table = $plugin_prefix . $post_type . '_detail'; |
|
| 2627 | + $post_type = get_post_type($master_post_id); |
|
| 2628 | + $post_table = $plugin_prefix . $post_type . '_detail'; |
|
| 2629 | 2629 | |
| 2630 | - $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
|
|
| 2631 | - $data = (array)$wpdb->get_row($query); |
|
| 2630 | + $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
|
|
| 2631 | + $data = (array)$wpdb->get_row($query); |
|
| 2632 | 2632 | |
| 2633 | - if ( !empty( $data ) ) {
|
|
| 2634 | - $data['post_id'] = $tr_post_id; |
|
| 2635 | - unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category']); |
|
| 2636 | - $wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
|
|
| 2637 | - return true; |
|
| 2638 | - } |
|
| 2633 | + if ( !empty( $data ) ) {
|
|
| 2634 | + $data['post_id'] = $tr_post_id; |
|
| 2635 | + unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category']); |
|
| 2636 | + $wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
|
|
| 2637 | + return true; |
|
| 2638 | + } |
|
| 2639 | 2639 | |
| 2640 | - return false; |
|
| 2640 | + return false; |
|
| 2641 | 2641 | } |
| 2642 | 2642 | |
| 2643 | 2643 | /** |
@@ -2654,40 +2654,40 @@ discard block |
||
| 2654 | 2654 | * @return bool True for success, False for fail. |
| 2655 | 2655 | */ |
| 2656 | 2656 | function geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang) {
|
| 2657 | - global $sitepress, $wpdb; |
|
| 2658 | - $post_type = get_post_type($master_post_id); |
|
| 2657 | + global $sitepress, $wpdb; |
|
| 2658 | + $post_type = get_post_type($master_post_id); |
|
| 2659 | 2659 | |
| 2660 | - remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
|
|
| 2660 | + remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
|
|
| 2661 | 2661 | |
| 2662 | - $taxonomies = get_object_taxonomies($post_type); |
|
| 2663 | - foreach ($taxonomies as $taxonomy) {
|
|
| 2664 | - $terms = get_the_terms($master_post_id, $taxonomy); |
|
| 2665 | - $terms_array = array(); |
|
| 2662 | + $taxonomies = get_object_taxonomies($post_type); |
|
| 2663 | + foreach ($taxonomies as $taxonomy) {
|
|
| 2664 | + $terms = get_the_terms($master_post_id, $taxonomy); |
|
| 2665 | + $terms_array = array(); |
|
| 2666 | 2666 | |
| 2667 | - if ($terms) {
|
|
| 2668 | - foreach ($terms as $term) {
|
|
| 2669 | - $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang); |
|
| 2667 | + if ($terms) {
|
|
| 2668 | + foreach ($terms as $term) {
|
|
| 2669 | + $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang); |
|
| 2670 | 2670 | |
| 2671 | - if (!is_null($tr_id)){
|
|
| 2672 | - // not using get_term - unfiltered get_term |
|
| 2673 | - $translated_term = $wpdb->get_row($wpdb->prepare("
|
|
| 2671 | + if (!is_null($tr_id)){
|
|
| 2672 | + // not using get_term - unfiltered get_term |
|
| 2673 | + $translated_term = $wpdb->get_row($wpdb->prepare("
|
|
| 2674 | 2674 | SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
|
| 2675 | 2675 | |
| 2676 | - $terms_array[] = $translated_term->term_id; |
|
| 2677 | - } |
|
| 2678 | - } |
|
| 2676 | + $terms_array[] = $translated_term->term_id; |
|
| 2677 | + } |
|
| 2678 | + } |
|
| 2679 | 2679 | |
| 2680 | - if (!is_taxonomy_hierarchical($taxonomy)){
|
|
| 2681 | - $terms_array = array_unique( array_map( 'intval', $terms_array ) ); |
|
| 2682 | - } |
|
| 2680 | + if (!is_taxonomy_hierarchical($taxonomy)){
|
|
| 2681 | + $terms_array = array_unique( array_map( 'intval', $terms_array ) ); |
|
| 2682 | + } |
|
| 2683 | 2683 | |
| 2684 | - wp_set_post_terms($tr_post_id, $terms_array, $taxonomy); |
|
| 2684 | + wp_set_post_terms($tr_post_id, $terms_array, $taxonomy); |
|
| 2685 | 2685 | |
| 2686 | - if ($taxonomy == $post_type . 'category') {
|
|
| 2687 | - geodir_set_postcat_structure($tr_post_id, $post_type . 'category'); |
|
| 2688 | - } |
|
| 2689 | - } |
|
| 2690 | - } |
|
| 2686 | + if ($taxonomy == $post_type . 'category') {
|
|
| 2687 | + geodir_set_postcat_structure($tr_post_id, $post_type . 'category'); |
|
| 2688 | + } |
|
| 2689 | + } |
|
| 2690 | + } |
|
| 2691 | 2691 | } |
| 2692 | 2692 | |
| 2693 | 2693 | /** |
@@ -2703,29 +2703,29 @@ discard block |
||
| 2703 | 2703 | * @return bool True for success, False for fail. |
| 2704 | 2704 | */ |
| 2705 | 2705 | function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) {
|
| 2706 | - global $wpdb; |
|
| 2706 | + global $wpdb; |
|
| 2707 | 2707 | |
| 2708 | - $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
|
|
| 2709 | - $wpdb->query($query); |
|
| 2708 | + $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
|
|
| 2709 | + $wpdb->query($query); |
|
| 2710 | 2710 | |
| 2711 | - $query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
|
|
| 2712 | - $post_images = $wpdb->get_results($query); |
|
| 2711 | + $query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
|
|
| 2712 | + $post_images = $wpdb->get_results($query); |
|
| 2713 | 2713 | |
| 2714 | - if ( !empty( $post_images ) ) {
|
|
| 2715 | - foreach ( $post_images as $post_image) {
|
|
| 2716 | - $image_data = (array)$post_image; |
|
| 2717 | - unset($image_data['ID']); |
|
| 2718 | - $image_data['post_id'] = $tr_post_id; |
|
| 2714 | + if ( !empty( $post_images ) ) {
|
|
| 2715 | + foreach ( $post_images as $post_image) {
|
|
| 2716 | + $image_data = (array)$post_image; |
|
| 2717 | + unset($image_data['ID']); |
|
| 2718 | + $image_data['post_id'] = $tr_post_id; |
|
| 2719 | 2719 | |
| 2720 | - $wpdb->insert(GEODIR_ATTACHMENT_TABLE, $image_data); |
|
| 2720 | + $wpdb->insert(GEODIR_ATTACHMENT_TABLE, $image_data); |
|
| 2721 | 2721 | |
| 2722 | - geodir_set_wp_featured_image($tr_post_id); |
|
| 2723 | - } |
|
| 2722 | + geodir_set_wp_featured_image($tr_post_id); |
|
| 2723 | + } |
|
| 2724 | 2724 | |
| 2725 | - return true; |
|
| 2726 | - } |
|
| 2725 | + return true; |
|
| 2726 | + } |
|
| 2727 | 2727 | |
| 2728 | - return false; |
|
| 2728 | + return false; |
|
| 2729 | 2729 | } |
| 2730 | 2730 | |
| 2731 | 2731 | |
@@ -2744,73 +2744,73 @@ discard block |
||
| 2744 | 2744 | * @return bool True for success, False for fail. |
| 2745 | 2745 | */ |
| 2746 | 2746 | function geodir_wpml_duplicate_post_review($master_comment_id, $master_post_id, $tr_post_id, $lang) {
|
| 2747 | - global $wpdb, $plugin_prefix, $sitepress; |
|
| 2748 | - |
|
| 2749 | - $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
|
|
| 2750 | - |
|
| 2751 | - if (empty($review)) {
|
|
| 2752 | - return false; |
|
| 2753 | - } |
|
| 2754 | - if ($review['post_id'] != $master_post_id) {
|
|
| 2755 | - $wpdb->query($wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
|
|
| 2756 | - geodir_update_postrating($master_post_id, $post_type); |
|
| 2757 | - } |
|
| 2758 | - |
|
| 2759 | - $tr_comment_id = geodir_wpml_duplicate_comment_exists($tr_post_id, $master_comment_id); |
|
| 2760 | - |
|
| 2761 | - if (empty($tr_comment_id)) {
|
|
| 2762 | - return false; |
|
| 2763 | - } |
|
| 2764 | - |
|
| 2765 | - $post_type = get_post_type($master_post_id); |
|
| 2766 | - $post_table = $plugin_prefix . $post_type . '_detail'; |
|
| 2767 | - |
|
| 2768 | - $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM " . $post_table . " WHERE post_id = %d", $tr_post_id), ARRAY_A);
|
|
| 2769 | - if (empty($translated_post)) {
|
|
| 2770 | - return false; |
|
| 2771 | - } |
|
| 2772 | - |
|
| 2773 | - $review['comment_id'] = $tr_comment_id; |
|
| 2774 | - $review['post_id'] = $tr_post_id; |
|
| 2775 | - $review['post_title'] = $translated_post['post_title']; |
|
| 2776 | - $review['post_city'] = $translated_post['post_city']; |
|
| 2777 | - $review['post_region'] = $translated_post['post_region']; |
|
| 2778 | - $review['post_country'] = $translated_post['post_country']; |
|
| 2779 | - $review['post_latitude'] = $translated_post['post_latitude']; |
|
| 2780 | - $review['post_longitude'] = $translated_post['post_longitude']; |
|
| 2781 | - |
|
| 2782 | - if (isset($review['id'])) {
|
|
| 2783 | - unset($review['id']); |
|
| 2784 | - } |
|
| 2785 | - |
|
| 2786 | - $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
|
|
| 2787 | - |
|
| 2788 | - if ($tr_review_id) { // update review
|
|
| 2789 | - $wpdb->update(GEODIR_REVIEW_TABLE, $review, array('id' => $tr_review_id));
|
|
| 2790 | - } else { // insert review
|
|
| 2791 | - $wpdb->insert(GEODIR_REVIEW_TABLE, $review); |
|
| 2792 | - $tr_review_id = $wpdb->insert_id; |
|
| 2793 | - } |
|
| 2794 | - |
|
| 2795 | - if ($tr_post_id) {
|
|
| 2796 | - geodir_update_postrating($tr_post_id, $post_type); |
|
| 2747 | + global $wpdb, $plugin_prefix, $sitepress; |
|
| 2748 | + |
|
| 2749 | + $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
|
|
| 2750 | + |
|
| 2751 | + if (empty($review)) {
|
|
| 2752 | + return false; |
|
| 2753 | + } |
|
| 2754 | + if ($review['post_id'] != $master_post_id) {
|
|
| 2755 | + $wpdb->query($wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
|
|
| 2756 | + geodir_update_postrating($master_post_id, $post_type); |
|
| 2757 | + } |
|
| 2758 | + |
|
| 2759 | + $tr_comment_id = geodir_wpml_duplicate_comment_exists($tr_post_id, $master_comment_id); |
|
| 2760 | + |
|
| 2761 | + if (empty($tr_comment_id)) {
|
|
| 2762 | + return false; |
|
| 2763 | + } |
|
| 2764 | + |
|
| 2765 | + $post_type = get_post_type($master_post_id); |
|
| 2766 | + $post_table = $plugin_prefix . $post_type . '_detail'; |
|
| 2767 | + |
|
| 2768 | + $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM " . $post_table . " WHERE post_id = %d", $tr_post_id), ARRAY_A);
|
|
| 2769 | + if (empty($translated_post)) {
|
|
| 2770 | + return false; |
|
| 2771 | + } |
|
| 2772 | + |
|
| 2773 | + $review['comment_id'] = $tr_comment_id; |
|
| 2774 | + $review['post_id'] = $tr_post_id; |
|
| 2775 | + $review['post_title'] = $translated_post['post_title']; |
|
| 2776 | + $review['post_city'] = $translated_post['post_city']; |
|
| 2777 | + $review['post_region'] = $translated_post['post_region']; |
|
| 2778 | + $review['post_country'] = $translated_post['post_country']; |
|
| 2779 | + $review['post_latitude'] = $translated_post['post_latitude']; |
|
| 2780 | + $review['post_longitude'] = $translated_post['post_longitude']; |
|
| 2781 | + |
|
| 2782 | + if (isset($review['id'])) {
|
|
| 2783 | + unset($review['id']); |
|
| 2784 | + } |
|
| 2785 | + |
|
| 2786 | + $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
|
|
| 2787 | + |
|
| 2788 | + if ($tr_review_id) { // update review
|
|
| 2789 | + $wpdb->update(GEODIR_REVIEW_TABLE, $review, array('id' => $tr_review_id));
|
|
| 2790 | + } else { // insert review
|
|
| 2791 | + $wpdb->insert(GEODIR_REVIEW_TABLE, $review); |
|
| 2792 | + $tr_review_id = $wpdb->insert_id; |
|
| 2793 | + } |
|
| 2794 | + |
|
| 2795 | + if ($tr_post_id) {
|
|
| 2796 | + geodir_update_postrating($tr_post_id, $post_type); |
|
| 2797 | 2797 | |
| 2798 | - if (defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_review') && $sitepress->get_setting('sync_comments_on_duplicates')) {
|
|
| 2799 | - $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id = %d", array($tr_comment_id)));
|
|
| 2800 | - $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
|
|
| 2801 | - |
|
| 2802 | - if (!empty($likes)) {
|
|
| 2803 | - foreach ($likes as $like) {
|
|
| 2804 | - unset($like['like_id']); |
|
| 2805 | - $like['comment_id'] = $tr_comment_id; |
|
| 2798 | + if (defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_review') && $sitepress->get_setting('sync_comments_on_duplicates')) {
|
|
| 2799 | + $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id = %d", array($tr_comment_id)));
|
|
| 2800 | + $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
|
|
| 2801 | + |
|
| 2802 | + if (!empty($likes)) {
|
|
| 2803 | + foreach ($likes as $like) {
|
|
| 2804 | + unset($like['like_id']); |
|
| 2805 | + $like['comment_id'] = $tr_comment_id; |
|
| 2806 | 2806 | |
| 2807 | - $wpdb->insert(GEODIR_COMMENTS_REVIEWS_TABLE, $like); |
|
| 2808 | - } |
|
| 2809 | - } |
|
| 2810 | - } |
|
| 2811 | - } |
|
| 2807 | + $wpdb->insert(GEODIR_COMMENTS_REVIEWS_TABLE, $like); |
|
| 2808 | + } |
|
| 2809 | + } |
|
| 2810 | + } |
|
| 2811 | + } |
|
| 2812 | 2812 | |
| 2813 | - return $tr_review_id; |
|
| 2813 | + return $tr_review_id; |
|
| 2814 | 2814 | } |
| 2815 | 2815 | |
| 2816 | 2816 | /** |
@@ -2825,36 +2825,36 @@ discard block |
||
| 2825 | 2825 | * @param int $comment_id The Comment ID. |
| 2826 | 2826 | */ |
| 2827 | 2827 | function gepdir_wpml_sync_comment($comment_id) {
|
| 2828 | - global $wpdb, $sitepress, $gd_wpml_posttypes; |
|
| 2829 | - |
|
| 2830 | - if (empty($gd_post_types)) {
|
|
| 2831 | - $gd_wpml_posttypes = geodir_get_posttypes(); |
|
| 2832 | - } |
|
| 2833 | - |
|
| 2834 | - $comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->comments} WHERE comment_ID=%d", $comment_id), ARRAY_A);
|
|
| 2835 | - if (empty($comment)) {
|
|
| 2836 | - return; |
|
| 2837 | - } |
|
| 2838 | - |
|
| 2839 | - $post_id = $comment['comment_post_ID']; |
|
| 2840 | - $post_type = $post_id ? get_post_type($post_id) : NULL; |
|
| 2841 | - |
|
| 2842 | - if (!($post_type && in_array($post_type, $gd_wpml_posttypes))) {
|
|
| 2843 | - return; |
|
| 2844 | - } |
|
| 2845 | - |
|
| 2846 | - $post_duplicates = $sitepress->get_duplicates($post_id); |
|
| 2847 | - if (empty($post_duplicates)) {
|
|
| 2848 | - return; |
|
| 2849 | - } |
|
| 2850 | - |
|
| 2851 | - foreach ($post_duplicates as $lang => $dup_post_id) {
|
|
| 2852 | - if (empty($comment['comment_parent'])) {
|
|
| 2853 | - geodir_wpml_duplicate_post_review($comment_id, $post_id, $dup_post_id, $lang); |
|
| 2854 | - } |
|
| 2855 | - } |
|
| 2828 | + global $wpdb, $sitepress, $gd_wpml_posttypes; |
|
| 2829 | + |
|
| 2830 | + if (empty($gd_post_types)) {
|
|
| 2831 | + $gd_wpml_posttypes = geodir_get_posttypes(); |
|
| 2832 | + } |
|
| 2833 | + |
|
| 2834 | + $comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->comments} WHERE comment_ID=%d", $comment_id), ARRAY_A);
|
|
| 2835 | + if (empty($comment)) {
|
|
| 2836 | + return; |
|
| 2837 | + } |
|
| 2838 | + |
|
| 2839 | + $post_id = $comment['comment_post_ID']; |
|
| 2840 | + $post_type = $post_id ? get_post_type($post_id) : NULL; |
|
| 2841 | + |
|
| 2842 | + if (!($post_type && in_array($post_type, $gd_wpml_posttypes))) {
|
|
| 2843 | + return; |
|
| 2844 | + } |
|
| 2845 | + |
|
| 2846 | + $post_duplicates = $sitepress->get_duplicates($post_id); |
|
| 2847 | + if (empty($post_duplicates)) {
|
|
| 2848 | + return; |
|
| 2849 | + } |
|
| 2850 | + |
|
| 2851 | + foreach ($post_duplicates as $lang => $dup_post_id) {
|
|
| 2852 | + if (empty($comment['comment_parent'])) {
|
|
| 2853 | + geodir_wpml_duplicate_post_review($comment_id, $post_id, $dup_post_id, $lang); |
|
| 2854 | + } |
|
| 2855 | + } |
|
| 2856 | 2856 | |
| 2857 | - return true; |
|
| 2857 | + return true; |
|
| 2858 | 2858 | } |
| 2859 | 2859 | |
| 2860 | 2860 | /** |
@@ -2869,11 +2869,11 @@ discard block |
||
| 2869 | 2869 | * @return int The duplicate comment ID. |
| 2870 | 2870 | */ |
| 2871 | 2871 | function geodir_wpml_duplicate_comment_exists($dup_post_id, $original_cid) {
|
| 2872 | - global $wpdb; |
|
| 2872 | + global $wpdb; |
|
| 2873 | 2873 | |
| 2874 | - $duplicate = $wpdb->get_var( |
|
| 2875 | - $wpdb->prepare( |
|
| 2876 | - " SELECT comm.comment_ID |
|
| 2874 | + $duplicate = $wpdb->get_var( |
|
| 2875 | + $wpdb->prepare( |
|
| 2876 | + " SELECT comm.comment_ID |
|
| 2877 | 2877 | FROM {$wpdb->comments} comm
|
| 2878 | 2878 | JOIN {$wpdb->commentmeta} cm
|
| 2879 | 2879 | ON comm.comment_ID = cm.comment_id |
@@ -2881,12 +2881,12 @@ discard block |
||
| 2881 | 2881 | AND cm.meta_key = '_icl_duplicate_of' |
| 2882 | 2882 | AND cm.meta_value = %d |
| 2883 | 2883 | LIMIT 1", |
| 2884 | - $dup_post_id, |
|
| 2885 | - $original_cid |
|
| 2886 | - ) |
|
| 2887 | - ); |
|
| 2884 | + $dup_post_id, |
|
| 2885 | + $original_cid |
|
| 2886 | + ) |
|
| 2887 | + ); |
|
| 2888 | 2888 | |
| 2889 | - return $duplicate; |
|
| 2889 | + return $duplicate; |
|
| 2890 | 2890 | } |
| 2891 | 2891 | |
| 2892 | 2892 | /** |
@@ -225,10 +225,11 @@ discard block |
||
| 225 | 225 | <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/> |
| 226 | 226 | <?php } |
| 227 | 227 | |
| 228 | - if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
|
| 229 | - $show_entire_cat_panel = "none"; |
|
| 230 | - else |
|
| 231 | - $show_entire_cat_panel = "''"; |
|
| 228 | + if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) { |
|
| 229 | + $show_entire_cat_panel = "none"; |
|
| 230 | + } else { |
|
| 231 | + $show_entire_cat_panel = "''"; |
|
| 232 | + } |
|
| 232 | 233 | ?> |
| 233 | 234 | |
| 234 | 235 | <?php if ($geodir_map_options['enable_map_direction']) { ?>
|
@@ -302,8 +303,9 @@ discard block |
||
| 302 | 303 | } |
| 303 | 304 | |
| 304 | 305 | $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
|
| 305 | - if (empty($geodir_default_map_search_pt)) |
|
| 306 | - $geodir_default_map_search_pt = 'gd_place'; |
|
| 306 | + if (empty($geodir_default_map_search_pt)) { |
|
| 307 | + $geodir_default_map_search_pt = 'gd_place'; |
|
| 308 | + } |
|
| 307 | 309 | |
| 308 | 310 | global $gd_session; |
| 309 | 311 | $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
|
@@ -67,77 +67,77 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | function geodir_draw_map($map_args = array()) |
| 69 | 69 | {
|
| 70 | - global $map_canvas_arr; |
|
| 71 | - $map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas'; |
|
| 72 | - $map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : ''; |
|
| 73 | - |
|
| 74 | - $default_location = geodir_get_default_location(); |
|
| 75 | - |
|
| 76 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 77 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 78 | - $map_default_zoom = 12; |
|
| 79 | - // map options default values |
|
| 80 | - $width = 950; |
|
| 81 | - $height = 450; |
|
| 82 | - $child_collapse = '0'; |
|
| 83 | - $sticky = ''; |
|
| 84 | - $enable_cat_filters = false; |
|
| 85 | - $enable_text_search = false; |
|
| 86 | - $enable_post_type_filters = false; |
|
| 87 | - $enable_location_filters = false; |
|
| 88 | - $enable_jason_on_load = false; |
|
| 89 | - $enable_map_direction = false; |
|
| 90 | - $enable_marker_cluster = false; |
|
| 91 | - $enable_map_resize_button = false; |
|
| 92 | - $maptype = 'ROADMAP'; |
|
| 93 | - |
|
| 94 | - $geodir_map_options = array( |
|
| 95 | - 'width' => $width, |
|
| 96 | - 'height' => $height, |
|
| 97 | - 'child_collapse' => $child_collapse, |
|
| 98 | - 'sticky' => $sticky, |
|
| 99 | - 'enable_map_resize_button' => $enable_map_resize_button, |
|
| 100 | - 'enable_cat_filters' => $enable_cat_filters, |
|
| 101 | - 'enable_text_search' => $enable_text_search, |
|
| 102 | - 'enable_post_type_filters' => $enable_post_type_filters, |
|
| 103 | - 'enable_location_filters' => $enable_location_filters, |
|
| 104 | - 'enable_jason_on_load' => $enable_jason_on_load, |
|
| 105 | - 'enable_map_direction' => $enable_map_direction, |
|
| 106 | - 'enable_marker_cluster' => $enable_marker_cluster, |
|
| 107 | - 'ajax_url' => geodir_get_ajax_url(), |
|
| 108 | - 'map_canvas_name' => $map_canvas_name, |
|
| 109 | - 'inputText' => __('Title or Keyword', 'geodirectory'),
|
|
| 110 | - 'latitude' => $map_default_lat, |
|
| 111 | - 'longitude' => $map_default_lng, |
|
| 112 | - 'zoom' => $map_default_zoom, |
|
| 113 | - 'scrollwheel' => true, |
|
| 114 | - 'streetViewControl' => true, |
|
| 115 | - 'maptype' => $maptype, |
|
| 116 | - 'showPreview' => '0', |
|
| 117 | - 'maxZoom' => 21, |
|
| 118 | - 'autozoom' => true, |
|
| 119 | - 'bubble_size' => 'small', |
|
| 120 | - 'token' => '68f48005e256696074e1da9bf9f67f06', |
|
| 121 | - 'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN')
|
|
| 122 | - ); |
|
| 123 | - |
|
| 124 | - if (!empty($map_args)) {
|
|
| 125 | - foreach ($map_args as $map_option_key => $map_option_value) {
|
|
| 126 | - $geodir_map_options[$map_option_key] = $map_option_value; |
|
| 127 | - } |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
|
|
| 131 | - } else {
|
|
| 132 | - $geodir_map_options['height'] = $geodir_map_options['height'] . 'px'; |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
|
|
| 136 | - } else {
|
|
| 137 | - $geodir_map_options['width'] = $geodir_map_options['width'] . 'px'; |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - /** |
|
| 70 | + global $map_canvas_arr; |
|
| 71 | + $map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas'; |
|
| 72 | + $map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : ''; |
|
| 73 | + |
|
| 74 | + $default_location = geodir_get_default_location(); |
|
| 75 | + |
|
| 76 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
| 77 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
| 78 | + $map_default_zoom = 12; |
|
| 79 | + // map options default values |
|
| 80 | + $width = 950; |
|
| 81 | + $height = 450; |
|
| 82 | + $child_collapse = '0'; |
|
| 83 | + $sticky = ''; |
|
| 84 | + $enable_cat_filters = false; |
|
| 85 | + $enable_text_search = false; |
|
| 86 | + $enable_post_type_filters = false; |
|
| 87 | + $enable_location_filters = false; |
|
| 88 | + $enable_jason_on_load = false; |
|
| 89 | + $enable_map_direction = false; |
|
| 90 | + $enable_marker_cluster = false; |
|
| 91 | + $enable_map_resize_button = false; |
|
| 92 | + $maptype = 'ROADMAP'; |
|
| 93 | + |
|
| 94 | + $geodir_map_options = array( |
|
| 95 | + 'width' => $width, |
|
| 96 | + 'height' => $height, |
|
| 97 | + 'child_collapse' => $child_collapse, |
|
| 98 | + 'sticky' => $sticky, |
|
| 99 | + 'enable_map_resize_button' => $enable_map_resize_button, |
|
| 100 | + 'enable_cat_filters' => $enable_cat_filters, |
|
| 101 | + 'enable_text_search' => $enable_text_search, |
|
| 102 | + 'enable_post_type_filters' => $enable_post_type_filters, |
|
| 103 | + 'enable_location_filters' => $enable_location_filters, |
|
| 104 | + 'enable_jason_on_load' => $enable_jason_on_load, |
|
| 105 | + 'enable_map_direction' => $enable_map_direction, |
|
| 106 | + 'enable_marker_cluster' => $enable_marker_cluster, |
|
| 107 | + 'ajax_url' => geodir_get_ajax_url(), |
|
| 108 | + 'map_canvas_name' => $map_canvas_name, |
|
| 109 | + 'inputText' => __('Title or Keyword', 'geodirectory'),
|
|
| 110 | + 'latitude' => $map_default_lat, |
|
| 111 | + 'longitude' => $map_default_lng, |
|
| 112 | + 'zoom' => $map_default_zoom, |
|
| 113 | + 'scrollwheel' => true, |
|
| 114 | + 'streetViewControl' => true, |
|
| 115 | + 'maptype' => $maptype, |
|
| 116 | + 'showPreview' => '0', |
|
| 117 | + 'maxZoom' => 21, |
|
| 118 | + 'autozoom' => true, |
|
| 119 | + 'bubble_size' => 'small', |
|
| 120 | + 'token' => '68f48005e256696074e1da9bf9f67f06', |
|
| 121 | + 'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN')
|
|
| 122 | + ); |
|
| 123 | + |
|
| 124 | + if (!empty($map_args)) {
|
|
| 125 | + foreach ($map_args as $map_option_key => $map_option_value) {
|
|
| 126 | + $geodir_map_options[$map_option_key] = $map_option_value; |
|
| 127 | + } |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
|
|
| 131 | + } else {
|
|
| 132 | + $geodir_map_options['height'] = $geodir_map_options['height'] . 'px'; |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
|
|
| 136 | + } else {
|
|
| 137 | + $geodir_map_options['width'] = $geodir_map_options['width'] . 'px'; |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + /** |
|
| 141 | 141 | * Filter the options to use in google map. |
| 142 | 142 | * |
| 143 | 143 | * @since 1.0.0 |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | $geodir_map_options = apply_filters("geodir_map_options_{$map_canvas_name}", $geodir_map_options);
|
| 148 | 148 | |
| 149 | - $map_canvas_arr[$map_canvas_name] = array(); |
|
| 149 | + $map_canvas_arr[$map_canvas_name] = array(); |
|
| 150 | 150 | |
| 151 | - /** |
|
| 151 | + /** |
|
| 152 | 152 | * Filter the post types to display data on map. |
| 153 | 153 | * |
| 154 | 154 | * @since 1.0.0 |
@@ -166,20 +166,20 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | $exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map'));
|
| 168 | 168 | |
| 169 | - if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
| 170 | - // Set default map options |
|
| 169 | + if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
| 170 | + // Set default map options |
|
| 171 | 171 | |
| 172 | - wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
|
|
| 172 | + wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
|
|
| 173 | 173 | |
| 174 | - wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
|
|
| 174 | + wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
|
|
| 175 | 175 | |
| 176 | - if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
|
|
| 177 | - $map_width = '100%'; |
|
| 178 | - } else {
|
|
| 179 | - $map_width = $geodir_map_options['width']; |
|
| 180 | - } |
|
| 176 | + if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
|
|
| 177 | + $map_width = '100%'; |
|
| 178 | + } else {
|
|
| 179 | + $map_width = $geodir_map_options['width']; |
|
| 180 | + } |
|
| 181 | 181 | |
| 182 | - /** |
|
| 182 | + /** |
|
| 183 | 183 | * Filter the width of map. |
| 184 | 184 | * |
| 185 | 185 | * @since 1.0.0 |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * @param int $map_width Width of map box, eg: gd_place. |
| 188 | 188 | */ |
| 189 | 189 | $map_width = apply_filters('geodir_change_map_width', $map_width);
|
| 190 | - ?> |
|
| 190 | + ?> |
|
| 191 | 191 | <div id="catcher_<?php echo $map_canvas_name;?>"></div> |
| 192 | 192 | <div class="stick_trigger_container"> |
| 193 | 193 | <div class="trigger_sticky triggeroff_sticky"></div> |
@@ -221,15 +221,15 @@ discard block |
||
| 221 | 221 | <?php if ($geodir_map_options['enable_jason_on_load']) { ?>
|
| 222 | 222 | <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/> |
| 223 | 223 | <?php } else {
|
| 224 | - ?> |
|
| 224 | + ?> |
|
| 225 | 225 | <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/> |
| 226 | 226 | <?php } |
| 227 | 227 | |
| 228 | - if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
|
| 229 | - $show_entire_cat_panel = "none"; |
|
| 230 | - else |
|
| 231 | - $show_entire_cat_panel = "''"; |
|
| 232 | - ?> |
|
| 228 | + if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
|
| 229 | + $show_entire_cat_panel = "none"; |
|
| 230 | + else |
|
| 231 | + $show_entire_cat_panel = "''"; |
|
| 232 | + ?> |
|
| 233 | 233 | |
| 234 | 234 | <?php if ($geodir_map_options['enable_map_direction']) { ?>
|
| 235 | 235 | <div class="gd-input-group gd-get-directions"> |
@@ -292,8 +292,8 @@ discard block |
||
| 292 | 292 | <select id="travel-units" onchange="calcRoute('<?php echo $map_canvas_name; ?>')">
|
| 293 | 293 | <option value="miles"><?php _e('Miles', 'geodirectory'); ?></option>
|
| 294 | 294 | <option <?php if (get_option('geodir_search_dist_1') == 'km') {
|
| 295 | - echo 'selected="selected"'; |
|
| 296 | - } ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option>
|
|
| 295 | + echo 'selected="selected"'; |
|
| 296 | + } ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option>
|
|
| 297 | 297 | </select> |
| 298 | 298 | </div> |
| 299 | 299 | |
@@ -305,12 +305,12 @@ discard block |
||
| 305 | 305 | if (empty($geodir_default_map_search_pt)) |
| 306 | 306 | $geodir_default_map_search_pt = 'gd_place'; |
| 307 | 307 | |
| 308 | - global $gd_session; |
|
| 309 | - $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
|
|
| 308 | + global $gd_session; |
|
| 309 | + $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
|
|
| 310 | 310 | |
| 311 | - if ($homemap_catlist_ptype) {
|
|
| 312 | - $geodir_default_map_search_pt = $homemap_catlist_ptype; |
|
| 313 | - } |
|
| 311 | + if ($homemap_catlist_ptype) {
|
|
| 312 | + $geodir_default_map_search_pt = $homemap_catlist_ptype; |
|
| 313 | + } |
|
| 314 | 314 | |
| 315 | 315 | /** |
| 316 | 316 | * Filter the post type to retrieve data for map |
@@ -323,13 +323,13 @@ discard block |
||
| 323 | 323 | ?> |
| 324 | 324 | <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>"> |
| 325 | 325 | <?php |
| 326 | - $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
|
|
| 327 | - $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
|
|
| 326 | + $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
|
|
| 327 | + $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
|
|
| 328 | 328 | $map_cat_class = ''; |
| 329 | 329 | if ($geodir_map_options['enable_post_type_filters']) {
|
| 330 | 330 | $map_cat_class = $geodir_available_pt_on_map > 1 ? ' map-cat-ptypes' : ' map-cat-floor'; |
| 331 | 331 | } |
| 332 | - ?> |
|
| 332 | + ?> |
|
| 333 | 333 | <div |
| 334 | 334 | class="map-category-listing<?php echo $map_cat_class;?>"> |
| 335 | 335 | <div class="gd-trigger gd-triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div> |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | <?php if ($geodir_map_options['child_collapse']) { $child_collapse = "1"; ?>
|
| 348 | 348 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/> |
| 349 | 349 | <?php } else {$child_collapse = "0";
|
| 350 | - ?> |
|
| 350 | + ?> |
|
| 351 | 351 | <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/> |
| 352 | 352 | <?php } ?> |
| 353 | 353 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/> |
@@ -369,17 +369,17 @@ discard block |
||
| 369 | 369 | <!-- map-category-listings--> |
| 370 | 370 | |
| 371 | 371 | <?php |
| 372 | - if ($geodir_map_options['enable_location_filters']) {
|
|
| 372 | + if ($geodir_map_options['enable_location_filters']) {
|
|
| 373 | 373 | $country = get_query_var('gd_country');
|
| 374 | 374 | $region = get_query_var('gd_region');
|
| 375 | 375 | $city = get_query_var('gd_city');
|
| 376 | 376 | |
| 377 | - //fix for location/me page |
|
| 378 | - $country = $country != 'me' ? $country : ''; |
|
| 377 | + //fix for location/me page |
|
| 378 | + $country = $country != 'me' ? $country : ''; |
|
| 379 | 379 | $region = $region != 'me' ? $region : ''; |
| 380 | 380 | $city = $country != 'me' ? $city : ''; |
| 381 | - $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : ''; |
|
| 382 | - ?> |
|
| 381 | + $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : ''; |
|
| 382 | + ?> |
|
| 383 | 383 | <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/> |
| 384 | 384 | <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country" |
| 385 | 385 | value="<?php echo $country;?>"/> |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood" |
| 391 | 391 | value="<?php echo $gd_neighbourhood;?>"/> |
| 392 | 392 | <?php } else { //end of location filter
|
| 393 | - ?> |
|
| 393 | + ?> |
|
| 394 | 394 | <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/> |
| 395 | 395 | <?php }?> |
| 396 | 396 | |
@@ -401,9 +401,9 @@ discard block |
||
| 401 | 401 | |
| 402 | 402 | |
| 403 | 403 | <?php if ($geodir_map_options['enable_post_type_filters']) {
|
| 404 | - $post_types = geodir_get_posttypes('object');
|
|
| 405 | - if (count((array)($post_types)) > 1) {
|
|
| 406 | - ?> |
|
| 404 | + $post_types = geodir_get_posttypes('object');
|
|
| 405 | + if (count((array)($post_types)) > 1) {
|
|
| 406 | + ?> |
|
| 407 | 407 | <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu" |
| 408 | 408 | style="max-width:<?php echo $map_width;?>!important;"> |
| 409 | 409 | |
@@ -411,15 +411,15 @@ discard block |
||
| 411 | 411 | <div class="geodir-map-posttype-list"><?php } ?> |
| 412 | 412 | <ul class="clearfix place-list"> |
| 413 | 413 | <?php |
| 414 | - $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
|
|
| 414 | + $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
|
|
| 415 | 415 | |
| 416 | - foreach ($post_types as $post_type => $args) {
|
|
| 417 | - if (!in_array($post_type, $exclude_post_types)) {
|
|
| 418 | - $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
|
| 416 | + foreach ($post_types as $post_type => $args) {
|
|
| 417 | + if (!in_array($post_type, $exclude_post_types)) {
|
|
| 418 | + $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
|
| 419 | 419 | echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __($args->labels->name, 'geodirectory') . '</a></li>'; |
| 420 | - } |
|
| 421 | - } |
|
| 422 | - ?> |
|
| 420 | + } |
|
| 421 | + } |
|
| 422 | + ?> |
|
| 423 | 423 | </ul> |
| 424 | 424 | <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
|
| 425 | 425 | </div><?php } ?> |
@@ -433,8 +433,8 @@ discard block |
||
| 433 | 433 | |
| 434 | 434 | </div> <!-- map-places-listings--> |
| 435 | 435 | <?php } |
| 436 | - } // end of post type filter if |
|
| 437 | - ?> |
|
| 436 | + } // end of post type filter if |
|
| 437 | + ?> |
|
| 438 | 438 | |
| 439 | 439 | </div> |
| 440 | 440 | </div> <!--end of stick trigger container--> |
@@ -449,8 +449,8 @@ discard block |
||
| 449 | 449 | </script> |
| 450 | 450 | <?php |
| 451 | 451 | |
| 452 | - if (strpos($geodir_map_options['height'], 'vh')) {
|
|
| 453 | - ?> |
|
| 452 | + if (strpos($geodir_map_options['height'], 'vh')) {
|
|
| 453 | + ?> |
|
| 454 | 454 | <script> |
| 455 | 455 | (function () {
|
| 456 | 456 | var screenH = jQuery(window).height(); |
@@ -472,8 +472,8 @@ discard block |
||
| 472 | 472 | |
| 473 | 473 | <?php |
| 474 | 474 | |
| 475 | - } elseif (strpos($geodir_map_options['height'], 'px')) {
|
|
| 476 | - ?> |
|
| 475 | + } elseif (strpos($geodir_map_options['height'], 'px')) {
|
|
| 476 | + ?> |
|
| 477 | 477 | <script> |
| 478 | 478 | (function () {
|
| 479 | 479 | var screenH = jQuery(window).height(); |
@@ -488,20 +488,20 @@ discard block |
||
| 488 | 488 | }()); |
| 489 | 489 | </script> |
| 490 | 490 | <?php |
| 491 | - } |
|
| 491 | + } |
|
| 492 | 492 | |
| 493 | - /** |
|
| 494 | - * Action that runs after all the map code has been output; |
|
| 495 | - * |
|
| 496 | - * @since 1.5.3 |
|
| 497 | - * |
|
| 498 | - * @param array $geodir_map_options Array of map settings. |
|
| 499 | - * @param string $map_canvas_name The canvas name and ID for the map. |
|
| 500 | - */ |
|
| 501 | - do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
|
|
| 493 | + /** |
|
| 494 | + * Action that runs after all the map code has been output; |
|
| 495 | + * |
|
| 496 | + * @since 1.5.3 |
|
| 497 | + * |
|
| 498 | + * @param array $geodir_map_options Array of map settings. |
|
| 499 | + * @param string $map_canvas_name The canvas name and ID for the map. |
|
| 500 | + */ |
|
| 501 | + do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
|
|
| 502 | 502 | |
| 503 | 503 | |
| 504 | - endif; // Exclude posttypes if end |
|
| 504 | + endif; // Exclude posttypes if end |
|
| 505 | 505 | } |
| 506 | 506 | |
| 507 | 507 | /** |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
|
| 131 | 131 | } else {
|
| 132 | - $geodir_map_options['height'] = $geodir_map_options['height'] . 'px'; |
|
| 132 | + $geodir_map_options['height'] = $geodir_map_options['height'].'px'; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
|
| 136 | 136 | } else {
|
| 137 | - $geodir_map_options['width'] = $geodir_map_options['width'] . 'px'; |
|
| 137 | + $geodir_map_options['width'] = $geodir_map_options['width'].'px'; |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -166,10 +166,10 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | $exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map'));
|
| 168 | 168 | |
| 169 | - if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
| 169 | + if (count((array) $post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
| 170 | 170 | // Set default map options |
| 171 | 171 | |
| 172 | - wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
|
|
| 172 | + wp_enqueue_script('geodir-map-widget', geodir_plugin_url().'/geodirectory-functions/map-functions/js/map.min.js', array(), false, true);
|
|
| 173 | 173 | |
| 174 | 174 | wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
|
| 175 | 175 | |
@@ -188,41 +188,41 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | $map_width = apply_filters('geodir_change_map_width', $map_width);
|
| 190 | 190 | ?> |
| 191 | - <div id="catcher_<?php echo $map_canvas_name;?>"></div> |
|
| 191 | + <div id="catcher_<?php echo $map_canvas_name; ?>"></div> |
|
| 192 | 192 | <div class="stick_trigger_container"> |
| 193 | 193 | <div class="trigger_sticky triggeroff_sticky"></div> |
| 194 | - <div class="top_banner_section geodir_map_container <?php echo $map_class_name;?>" |
|
| 195 | - id="sticky_map_<?php echo $map_canvas_name;?>" |
|
| 196 | - style="min-height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"> |
|
| 194 | + <div class="top_banner_section geodir_map_container <?php echo $map_class_name; ?>" |
|
| 195 | + id="sticky_map_<?php echo $map_canvas_name; ?>" |
|
| 196 | + style="min-height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"> |
|
| 197 | 197 | |
| 198 | 198 | <div class="map_background"> |
| 199 | 199 | <div class="top_banner_section_in clearfix"> |
| 200 | - <div class="<?php echo $map_canvas_name;?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name;?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div>
|
|
| 201 | - <div class="<?php echo $map_canvas_name;?>_TopRight TopRight"></div> |
|
| 202 | - <div id="<?php echo $map_canvas_name;?>_wrapper" class="main_map_wrapper" |
|
| 203 | - style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"> |
|
| 200 | + <div class="<?php echo $map_canvas_name; ?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name; ?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div>
|
|
| 201 | + <div class="<?php echo $map_canvas_name; ?>_TopRight TopRight"></div> |
|
| 202 | + <div id="<?php echo $map_canvas_name; ?>_wrapper" class="main_map_wrapper" |
|
| 203 | + style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"> |
|
| 204 | 204 | <!-- new map start --> |
| 205 | 205 | <div class="iprelative"> |
| 206 | - <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name;?>" |
|
| 207 | - style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div> |
|
| 208 | - <div id="<?php echo $map_canvas_name;?>_loading_div" class="loading_div" |
|
| 209 | - style=" height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div> |
|
| 206 | + <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name; ?>" |
|
| 207 | + style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div> |
|
| 208 | + <div id="<?php echo $map_canvas_name; ?>_loading_div" class="loading_div" |
|
| 209 | + style=" height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div> |
|
| 210 | 210 | <!--<div id="home_map_counter"></div> --> |
| 211 | - <div id="<?php echo $map_canvas_name;?>_map_nofound" |
|
| 211 | + <div id="<?php echo $map_canvas_name; ?>_map_nofound" |
|
| 212 | 212 | class="advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div> |
| 213 | - <div id="<?php echo $map_canvas_name;?>_map_notloaded" |
|
| 213 | + <div id="<?php echo $map_canvas_name; ?>_map_notloaded" |
|
| 214 | 214 | class="advmap_notloaded"><?php _e('<h3>Google Map Not Loaded</h3><p>Sorry, unable to load Google Maps API.', 'geodirectory'); ?></div>
|
| 215 | 215 | </div> |
| 216 | 216 | <!-- new map end --> |
| 217 | 217 | </div> |
| 218 | - <div class="<?php echo $map_canvas_name;?>_BottomLeft BottomLeft"></div> |
|
| 218 | + <div class="<?php echo $map_canvas_name; ?>_BottomLeft BottomLeft"></div> |
|
| 219 | 219 | </div> |
| 220 | 220 | </div> |
| 221 | 221 | <?php if ($geodir_map_options['enable_jason_on_load']) { ?>
|
| 222 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/> |
|
| 222 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="1"/> |
|
| 223 | 223 | <?php } else {
|
| 224 | 224 | ?> |
| 225 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/> |
|
| 225 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="0"/> |
|
| 226 | 226 | <?php } |
| 227 | 227 | |
| 228 | 228 | if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | <div class="gd-input-group-addon gd-directions-right gd-mylocation-go"><input type="button" value="<?php _e('Get Directions', 'geodirectory'); ?>" class="<?php echo $map_canvas_name; ?>_getdirection" id="directions" onclick="calcRoute('<?php echo $map_canvas_name; ?>')" /></div>
|
| 243 | 243 | </div> |
| 244 | 244 | <script> |
| 245 | - <?php if(geodir_is_page('detail')){?>
|
|
| 245 | + <?php if (geodir_is_page('detail')) {?>
|
|
| 246 | 246 | jQuery(function () {
|
| 247 | 247 | gd_initialize_ac(); |
| 248 | 248 | }); |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | // Create the autocomplete object, restricting the search |
| 254 | 254 | // to geographical location types. |
| 255 | 255 | autocomplete = new google.maps.places.Autocomplete( |
| 256 | - /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name;?>_fromAddress')),
|
|
| 256 | + /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name; ?>_fromAddress')),
|
|
| 257 | 257 | {types: ['geocode']});
|
| 258 | 258 | // When the user selects an address from the dropdown, |
| 259 | 259 | // populate the address fields in the form. |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | |
| 268 | 268 | if (window.gdMaps == 'osm') {
|
| 269 | 269 | window.setTimeout(function() {
|
| 270 | - calcRoute('<?php echo $map_canvas_name;?>');
|
|
| 270 | + calcRoute('<?php echo $map_canvas_name; ?>');
|
|
| 271 | 271 | }, 1000); |
| 272 | 272 | } |
| 273 | 273 | } |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | */ |
| 322 | 322 | $map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt);
|
| 323 | 323 | ?> |
| 324 | - <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>"> |
|
| 324 | + <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel; ?>"> |
|
| 325 | 325 | <?php |
| 326 | 326 | $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
|
| 327 | 327 | $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
|
@@ -331,12 +331,12 @@ discard block |
||
| 331 | 331 | } |
| 332 | 332 | ?> |
| 333 | 333 | <div |
| 334 | - class="map-category-listing<?php echo $map_cat_class;?>"> |
|
| 334 | + class="map-category-listing<?php echo $map_cat_class; ?>"> |
|
| 335 | 335 | <div class="gd-trigger gd-triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div> |
| 336 | - <div id="<?php echo $map_canvas_name;?>_cat" |
|
| 337 | - class="<?php echo $map_canvas_name;?>_map_category map_category" |
|
| 338 | - <?php if ($child_collapse){ ?>checked="checked" <?php }?>
|
|
| 339 | - style="max-height:<?php echo $geodir_map_options['height'];?>;"> |
|
| 336 | + <div id="<?php echo $map_canvas_name; ?>_cat" |
|
| 337 | + class="<?php echo $map_canvas_name; ?>_map_category map_category" |
|
| 338 | + <?php if ($child_collapse) { ?>checked="checked" <?php }?>
|
|
| 339 | + style="max-height:<?php echo $geodir_map_options['height']; ?>;"> |
|
| 340 | 340 | <input |
| 341 | 341 | onkeydown="if(event.keyCode == 13){build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false)}"
|
| 342 | 342 | type="text" |
@@ -348,11 +348,11 @@ discard block |
||
| 348 | 348 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/> |
| 349 | 349 | <?php } else {$child_collapse = "0";
|
| 350 | 350 | ?> |
| 351 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/> |
|
| 351 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="0"/> |
|
| 352 | 352 | <?php } ?> |
| 353 | 353 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/> |
| 354 | 354 | <div class="geodir_toggle"> |
| 355 | - <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'),0,true,0,$map_canvas_name,$child_collapse,true); ?> |
|
| 355 | + <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'), 0, true, 0, $map_canvas_name, $child_collapse, true); ?> |
|
| 356 | 356 | <script>jQuery( document ).ready(function() {
|
| 357 | 357 | geodir_show_sub_cat_collapse_button(); |
| 358 | 358 | });</script> |
@@ -380,21 +380,21 @@ discard block |
||
| 380 | 380 | $city = $country != 'me' ? $city : ''; |
| 381 | 381 | $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : ''; |
| 382 | 382 | ?> |
| 383 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/> |
|
| 384 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country" |
|
| 385 | - value="<?php echo $country;?>"/> |
|
| 386 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_region" name="gd_region" |
|
| 387 | - value="<?php echo $region;?>"/> |
|
| 388 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_city" name="gd_city" |
|
| 389 | - value="<?php echo $city;?>"/> |
|
| 390 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood" |
|
| 391 | - value="<?php echo $gd_neighbourhood;?>"/> |
|
| 383 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="1"/> |
|
| 384 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_country" name="gd_country" |
|
| 385 | + value="<?php echo $country; ?>"/> |
|
| 386 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_region" name="gd_region" |
|
| 387 | + value="<?php echo $region; ?>"/> |
|
| 388 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_city" name="gd_city" |
|
| 389 | + value="<?php echo $city; ?>"/> |
|
| 390 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_neighbourhood" name="gd_neighbourhood" |
|
| 391 | + value="<?php echo $gd_neighbourhood; ?>"/> |
|
| 392 | 392 | <?php } else { //end of location filter
|
| 393 | 393 | ?> |
| 394 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/> |
|
| 394 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="0"/> |
|
| 395 | 395 | <?php }?> |
| 396 | 396 | |
| 397 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt;?>"/> |
|
| 397 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt; ?>"/> |
|
| 398 | 398 | |
| 399 | 399 | <input type="hidden" name="limitstart" value=""/> |
| 400 | 400 | |
@@ -402,10 +402,10 @@ discard block |
||
| 402 | 402 | |
| 403 | 403 | <?php if ($geodir_map_options['enable_post_type_filters']) {
|
| 404 | 404 | $post_types = geodir_get_posttypes('object');
|
| 405 | - if (count((array)($post_types)) > 1) {
|
|
| 405 | + if (count((array) ($post_types)) > 1) {
|
|
| 406 | 406 | ?> |
| 407 | - <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu" |
|
| 408 | - style="max-width:<?php echo $map_width;?>!important;"> |
|
| 407 | + <div class="map-places-listing" id="<?php echo $map_canvas_name; ?>_posttype_menu" |
|
| 408 | + style="max-width:<?php echo $map_width; ?>!important;"> |
|
| 409 | 409 | |
| 410 | 410 | <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
|
| 411 | 411 | <div class="geodir-map-posttype-list"><?php } ?> |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | foreach ($post_types as $post_type => $args) {
|
| 417 | 417 | if (!in_array($post_type, $exclude_post_types)) {
|
| 418 | 418 | $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
| 419 | - echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __($args->labels->name, 'geodirectory') . '</a></li>'; |
|
| 419 | + echo '<li id="'.$post_type.'" '.$class.'><a href="javascript:void(0);" onclick="jQuery(\'#'.$map_canvas_name.'_posttype\').val(\''.$post_type.'\');build_map_ajax_search_param(\''.$map_canvas_name.'\', true)">'.__($args->labels->name, 'geodirectory').'</a></li>'; |
|
| 420 | 420 | } |
| 421 | 421 | } |
| 422 | 422 | ?> |
@@ -441,9 +441,9 @@ discard block |
||
| 441 | 441 | <script type="text/javascript"> |
| 442 | 442 | |
| 443 | 443 | jQuery(document).ready(function () {
|
| 444 | - //initMap('<?php echo $map_canvas_name;?>'); // depreciated, no need to load this twice
|
|
| 445 | - build_map_ajax_search_param('<?php echo $map_canvas_name;?>', false);
|
|
| 446 | - map_sticky('<?php echo $map_canvas_name;?>');
|
|
| 444 | + //initMap('<?php echo $map_canvas_name; ?>'); // depreciated, no need to load this twice
|
|
| 445 | + build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false);
|
|
| 446 | + map_sticky('<?php echo $map_canvas_name; ?>');
|
|
| 447 | 447 | }); |
| 448 | 448 | |
| 449 | 449 | </script> |
@@ -454,18 +454,18 @@ discard block |
||
| 454 | 454 | <script> |
| 455 | 455 | (function () {
|
| 456 | 456 | var screenH = jQuery(window).height(); |
| 457 | - var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']);?>";
|
|
| 457 | + var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']); ?>";
|
|
| 458 | 458 | |
| 459 | 459 | var ptypeH = ''; |
| 460 | - if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
|
|
| 461 | - ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
|
|
| 460 | + if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
|
|
| 461 | + ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
|
|
| 462 | 462 | } |
| 463 | 463 | |
| 464 | - jQuery("#sticky_map_<?php echo $map_canvas_name;?>").css("min-height", screenH * (heightVH / 100) + 'px');
|
|
| 465 | - jQuery("#<?php echo $map_canvas_name;?>_wrapper").height(screenH * (heightVH / 100) + 'px');
|
|
| 466 | - jQuery("#<?php echo $map_canvas_name;?>").height(screenH * (heightVH / 100) + 'px');
|
|
| 467 | - jQuery("#<?php echo $map_canvas_name;?>_loading_div").height(screenH * (heightVH / 100) + 'px');
|
|
| 468 | - jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
|
|
| 464 | + jQuery("#sticky_map_<?php echo $map_canvas_name; ?>").css("min-height", screenH * (heightVH / 100) + 'px');
|
|
| 465 | + jQuery("#<?php echo $map_canvas_name; ?>_wrapper").height(screenH * (heightVH / 100) + 'px');
|
|
| 466 | + jQuery("#<?php echo $map_canvas_name; ?>").height(screenH * (heightVH / 100) + 'px');
|
|
| 467 | + jQuery("#<?php echo $map_canvas_name; ?>_loading_div").height(screenH * (heightVH / 100) + 'px');
|
|
| 468 | + jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
|
|
| 469 | 469 | |
| 470 | 470 | }()); |
| 471 | 471 | </script> |
@@ -477,13 +477,13 @@ discard block |
||
| 477 | 477 | <script> |
| 478 | 478 | (function () {
|
| 479 | 479 | var screenH = jQuery(window).height(); |
| 480 | - var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']);?>";
|
|
| 480 | + var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']); ?>";
|
|
| 481 | 481 | var ptypeH = ''; |
| 482 | - if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
|
|
| 483 | - ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
|
|
| 482 | + if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
|
|
| 483 | + ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
|
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | - jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", heightVH - ptypeH + 'px');
|
|
| 486 | + jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", heightVH - ptypeH + 'px');
|
|
| 487 | 487 | |
| 488 | 488 | }()); |
| 489 | 489 | </script> |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | * @param array $geodir_map_options Array of map settings. |
| 499 | 499 | * @param string $map_canvas_name The canvas name and ID for the map. |
| 500 | 500 | */ |
| 501 | - do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
|
|
| 501 | + do_action('geodir_map_after_render', $geodir_map_options, $map_canvas_name);
|
|
| 502 | 502 | |
| 503 | 503 | |
| 504 | 504 | endif; // Exclude posttypes if end |