@@ -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,21 +68,21 @@ 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 | if (isset($field_info->data_type) && $field_info->data_type == 'VARCHAR') {
|
| 85 | - $field_info->data_type = 'XVARCHAR'; |
|
| 85 | + $field_info->data_type = 'XVARCHAR'; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | ?> |
@@ -92,45 +92,45 @@ discard block |
||
| 92 | 92 | ondblclick="show_hide('field_frm<?php echo $result_str; ?>')" >
|
| 93 | 93 | <?php |
| 94 | 94 | |
| 95 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 96 | - ?> |
|
| 95 | + $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 96 | + ?> |
|
| 97 | 97 | |
| 98 | 98 | <?php if (!$default): ?> |
| 99 | 99 | <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
|
| 100 | 100 | onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
|
| 101 | 101 | class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div> |
| 102 | 102 | <?php endif; |
| 103 | - if ($field_type == 'fieldset') {
|
|
| 104 | - ?> |
|
| 103 | + if ($field_type == 'fieldset') {
|
|
| 104 | + ?> |
|
| 105 | 105 | <i class="fa fa-long-arrow-left " aria-hidden="true"></i> |
| 106 | 106 | <i class="fa fa-long-arrow-right " aria-hidden="true"></i> |
| 107 | 107 | <b style="cursor:pointer;" |
| 108 | 108 | onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
|
| 109 | 109 | <?php |
| 110 | - } else {echo $field_icon;
|
|
| 111 | - ?> |
|
| 110 | + } else {echo $field_icon;
|
|
| 111 | + ?> |
|
| 112 | 112 | <b style="cursor:pointer;" |
| 113 | 113 | onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b>
|
| 114 | 114 | <?php |
| 115 | - } |
|
| 116 | - ?> |
|
| 115 | + } |
|
| 116 | + ?> |
|
| 117 | 117 | </div> |
| 118 | 118 | |
| 119 | 119 | <form><!-- we need to wrap in a fom so we can use radio buttons with same name --> |
| 120 | 120 | <div id="field_frm<?php echo $result_str; ?>" class="field_frm" |
| 121 | 121 | style="display:<?php if ($field_ins_upd == 'submit') {
|
| 122 | - echo 'block;'; |
|
| 123 | - } else {
|
|
| 124 | - echo 'none;'; |
|
| 125 | - } ?>"> |
|
| 122 | + echo 'block;'; |
|
| 123 | + } else {
|
|
| 124 | + echo 'none;'; |
|
| 125 | + } ?>"> |
|
| 126 | 126 | <input type="hidden" name="_wpnonce" value="<?php echo esc_attr($nonce); ?>"/> |
| 127 | 127 | <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/> |
| 128 | 128 | <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/> |
| 129 | 129 | <input type="hidden" name="field_type_key" id="field_type_key" value="<?php echo $field_type_key; ?>"/> |
| 130 | 130 | <input type="hidden" name="field_id" id="field_id" value="<?php echo esc_attr($result_str); ?>"/> |
| 131 | 131 | <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
|
| 132 | - echo $field_info->data_type; |
|
| 133 | - } ?>"/> |
|
| 132 | + echo $field_info->data_type; |
|
| 133 | + } ?>"/> |
|
| 134 | 134 | <input type="hidden" name="is_active" id="is_active" value="1"/> |
| 135 | 135 | |
| 136 | 136 | <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?> |
@@ -142,37 +142,37 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | <?php |
| 144 | 144 | |
| 145 | - // data_type |
|
| 146 | - if(has_filter("geodir_cfa_data_type_{$field_type}")){
|
|
| 145 | + // data_type |
|
| 146 | + if(has_filter("geodir_cfa_data_type_{$field_type}")){
|
|
| 147 | 147 | |
| 148 | - echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 148 | + echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 149 | 149 | |
| 150 | - }else{
|
|
| 151 | - $value = ''; |
|
| 152 | - if (isset($field_info->data_type)) {
|
|
| 153 | - $value = esc_attr($field_info->data_type); |
|
| 154 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 155 | - $value = $cf['defaults']['data_type']; |
|
| 156 | - } |
|
| 157 | - ?> |
|
| 150 | + }else{
|
|
| 151 | + $value = ''; |
|
| 152 | + if (isset($field_info->data_type)) {
|
|
| 153 | + $value = esc_attr($field_info->data_type); |
|
| 154 | + }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 155 | + $value = $cf['defaults']['data_type']; |
|
| 156 | + } |
|
| 157 | + ?> |
|
| 158 | 158 | <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/> |
| 159 | 159 | <?php |
| 160 | - } |
|
| 160 | + } |
|
| 161 | 161 | |
| 162 | 162 | |
| 163 | - // admin_title |
|
| 164 | - if(has_filter("geodir_cfa_admin_title_{$field_type}")){
|
|
| 163 | + // admin_title |
|
| 164 | + if(has_filter("geodir_cfa_admin_title_{$field_type}")){
|
|
| 165 | 165 | |
| 166 | - echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 166 | + echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 167 | 167 | |
| 168 | - }else{
|
|
| 169 | - $value = ''; |
|
| 170 | - if (isset($field_info->admin_title)) {
|
|
| 171 | - $value = esc_attr($field_info->admin_title); |
|
| 172 | - }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
|
|
| 173 | - $value = $cf['defaults']['admin_title']; |
|
| 174 | - } |
|
| 175 | - ?> |
|
| 168 | + }else{
|
|
| 169 | + $value = ''; |
|
| 170 | + if (isset($field_info->admin_title)) {
|
|
| 171 | + $value = esc_attr($field_info->admin_title); |
|
| 172 | + }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
|
|
| 173 | + $value = $cf['defaults']['admin_title']; |
|
| 174 | + } |
|
| 175 | + ?> |
|
| 176 | 176 | <li> |
| 177 | 177 | <label for="admin_title" class="gd-cf-tooltip-wrap"> |
| 178 | 178 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Admin title :', 'geodirectory'); ?>
|
@@ -186,22 +186,22 @@ discard block |
||
| 186 | 186 | </div> |
| 187 | 187 | </li> |
| 188 | 188 | <?php |
| 189 | - } |
|
| 189 | + } |
|
| 190 | 190 | |
| 191 | 191 | |
| 192 | - // site_title |
|
| 193 | - if(has_filter("geodir_cfa_site_title_{$field_type}")){
|
|
| 192 | + // site_title |
|
| 193 | + if(has_filter("geodir_cfa_site_title_{$field_type}")){
|
|
| 194 | 194 | |
| 195 | - echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 195 | + echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 196 | 196 | |
| 197 | - }else{
|
|
| 198 | - $value = ''; |
|
| 199 | - if (isset($field_info->site_title)) {
|
|
| 200 | - $value = esc_attr($field_info->site_title); |
|
| 201 | - }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
|
|
| 202 | - $value = $cf['defaults']['site_title']; |
|
| 203 | - } |
|
| 204 | - ?> |
|
| 197 | + }else{
|
|
| 198 | + $value = ''; |
|
| 199 | + if (isset($field_info->site_title)) {
|
|
| 200 | + $value = esc_attr($field_info->site_title); |
|
| 201 | + }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
|
|
| 202 | + $value = $cf['defaults']['site_title']; |
|
| 203 | + } |
|
| 204 | + ?> |
|
| 205 | 205 | <li> |
| 206 | 206 | <label for="site_title" class="gd-cf-tooltip-wrap"> <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend title :', 'geodirectory'); ?>
|
| 207 | 207 | <div class="gdcf-tooltip"> |
@@ -214,22 +214,22 @@ discard block |
||
| 214 | 214 | </div> |
| 215 | 215 | </li> |
| 216 | 216 | <?php |
| 217 | - } |
|
| 217 | + } |
|
| 218 | 218 | |
| 219 | 219 | |
| 220 | - // admin_desc |
|
| 221 | - if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
|
|
| 220 | + // admin_desc |
|
| 221 | + if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
|
|
| 222 | 222 | |
| 223 | - echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 223 | + echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 224 | 224 | |
| 225 | - }else{
|
|
| 226 | - $value = ''; |
|
| 227 | - if (isset($field_info->admin_desc)) {
|
|
| 228 | - $value = esc_attr($field_info->admin_desc); |
|
| 229 | - }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
|
|
| 230 | - $value = $cf['defaults']['admin_desc']; |
|
| 231 | - } |
|
| 232 | - ?> |
|
| 225 | + }else{
|
|
| 226 | + $value = ''; |
|
| 227 | + if (isset($field_info->admin_desc)) {
|
|
| 228 | + $value = esc_attr($field_info->admin_desc); |
|
| 229 | + }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
|
|
| 230 | + $value = $cf['defaults']['admin_desc']; |
|
| 231 | + } |
|
| 232 | + ?> |
|
| 233 | 233 | <li> |
| 234 | 234 | <label for="admin_desc" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend description :', 'geodirectory'); ?>
|
| 235 | 235 | <div class="gdcf-tooltip"> |
@@ -241,23 +241,23 @@ discard block |
||
| 241 | 241 | </div> |
| 242 | 242 | </li> |
| 243 | 243 | <?php |
| 244 | - } |
|
| 244 | + } |
|
| 245 | 245 | |
| 246 | 246 | |
| 247 | 247 | |
| 248 | - // htmlvar_name |
|
| 249 | - if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
|
|
| 248 | + // htmlvar_name |
|
| 249 | + if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
|
|
| 250 | 250 | |
| 251 | - echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 251 | + echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 252 | 252 | |
| 253 | - }else{
|
|
| 254 | - $value = ''; |
|
| 255 | - if (isset($field_info->htmlvar_name)) {
|
|
| 256 | - $value = esc_attr($field_info->htmlvar_name); |
|
| 257 | - }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
|
|
| 258 | - $value = $cf['defaults']['htmlvar_name']; |
|
| 259 | - } |
|
| 260 | - ?> |
|
| 253 | + }else{
|
|
| 254 | + $value = ''; |
|
| 255 | + if (isset($field_info->htmlvar_name)) {
|
|
| 256 | + $value = esc_attr($field_info->htmlvar_name); |
|
| 257 | + }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
|
|
| 258 | + $value = $cf['defaults']['htmlvar_name']; |
|
| 259 | + } |
|
| 260 | + ?> |
|
| 261 | 261 | <li> |
| 262 | 262 | <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');?>
|
| 263 | 263 | <div class="gdcf-tooltip"> |
@@ -267,29 +267,29 @@ discard block |
||
| 267 | 267 | <div class="gd-cf-input-wrap"> |
| 268 | 268 | <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');?>"
|
| 269 | 269 | value="<?php if ($value) {
|
| 270 | - echo preg_replace('/geodir_/', '', $value, 1);
|
|
| 271 | - }?>" <?php if ($default) {
|
|
| 272 | - echo 'readonly="readonly"'; |
|
| 273 | - }?> /> |
|
| 270 | + echo preg_replace('/geodir_/', '', $value, 1);
|
|
| 271 | + }?>" <?php if ($default) {
|
|
| 272 | + echo 'readonly="readonly"'; |
|
| 273 | + }?> /> |
|
| 274 | 274 | </div> |
| 275 | 275 | </li> |
| 276 | 276 | <?php |
| 277 | - } |
|
| 277 | + } |
|
| 278 | 278 | |
| 279 | 279 | |
| 280 | - // is_active |
|
| 281 | - if(has_filter("geodir_cfa_is_active_{$field_type}")){
|
|
| 280 | + // is_active |
|
| 281 | + if(has_filter("geodir_cfa_is_active_{$field_type}")){
|
|
| 282 | 282 | |
| 283 | - echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 283 | + echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 284 | 284 | |
| 285 | - }else{
|
|
| 286 | - $value = ''; |
|
| 287 | - if (isset($field_info->is_active)) {
|
|
| 288 | - $value = esc_attr($field_info->is_active); |
|
| 289 | - }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
|
|
| 290 | - $value = $cf['defaults']['is_active']; |
|
| 291 | - } |
|
| 292 | - ?> |
|
| 285 | + }else{
|
|
| 286 | + $value = ''; |
|
| 287 | + if (isset($field_info->is_active)) {
|
|
| 288 | + $value = esc_attr($field_info->is_active); |
|
| 289 | + }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
|
|
| 290 | + $value = $cf['defaults']['is_active']; |
|
| 291 | + } |
|
| 292 | + ?> |
|
| 293 | 293 | <li <?php echo $field_display; ?>> |
| 294 | 294 | <label for="is_active" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active :', 'geodirectory'); ?>
|
| 295 | 295 | <div class="gdcf-tooltip"> |
@@ -300,35 +300,35 @@ discard block |
||
| 300 | 300 | |
| 301 | 301 | <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
| 302 | 302 | <?php if ($value == '1') {
|
| 303 | - echo 'checked'; |
|
| 304 | - } ?>/> |
|
| 303 | + echo 'checked'; |
|
| 304 | + } ?>/> |
|
| 305 | 305 | <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 306 | 306 | |
| 307 | 307 | <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
| 308 | 308 | <?php if ($value == '0' || !$value) {
|
| 309 | - echo 'checked'; |
|
| 310 | - } ?>/> |
|
| 309 | + echo 'checked'; |
|
| 310 | + } ?>/> |
|
| 311 | 311 | <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 312 | 312 | |
| 313 | 313 | </div> |
| 314 | 314 | </li> |
| 315 | 315 | <?php |
| 316 | - } |
|
| 316 | + } |
|
| 317 | 317 | |
| 318 | 318 | |
| 319 | - // for_admin_use |
|
| 320 | - if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
|
|
| 319 | + // for_admin_use |
|
| 320 | + if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
|
|
| 321 | 321 | |
| 322 | - echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 322 | + echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 323 | 323 | |
| 324 | - }else{
|
|
| 325 | - $value = ''; |
|
| 326 | - if (isset($field_info->for_admin_use)) {
|
|
| 327 | - $value = esc_attr($field_info->for_admin_use); |
|
| 328 | - }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
|
|
| 329 | - $value = $cf['defaults']['for_admin_use']; |
|
| 330 | - } |
|
| 331 | - ?> |
|
| 324 | + }else{
|
|
| 325 | + $value = ''; |
|
| 326 | + if (isset($field_info->for_admin_use)) {
|
|
| 327 | + $value = esc_attr($field_info->for_admin_use); |
|
| 328 | + }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
|
|
| 329 | + $value = $cf['defaults']['for_admin_use']; |
|
| 330 | + } |
|
| 331 | + ?> |
|
| 332 | 332 | <li> |
| 333 | 333 | <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'); ?>
|
| 334 | 334 | <div class="gdcf-tooltip"> |
@@ -339,47 +339,47 @@ discard block |
||
| 339 | 339 | |
| 340 | 340 | <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled" value="1" |
| 341 | 341 | <?php if ($value == '1') {
|
| 342 | - echo 'checked'; |
|
| 343 | - } ?>/> |
|
| 342 | + echo 'checked'; |
|
| 343 | + } ?>/> |
|
| 344 | 344 | <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 345 | 345 | |
| 346 | 346 | <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0" |
| 347 | 347 | <?php if ($value == '0' || !$value) {
|
| 348 | - echo 'checked'; |
|
| 349 | - } ?>/> |
|
| 348 | + echo 'checked'; |
|
| 349 | + } ?>/> |
|
| 350 | 350 | <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 351 | 351 | |
| 352 | 352 | </div> |
| 353 | 353 | </li> |
| 354 | 354 | <?php |
| 355 | - } |
|
| 355 | + } |
|
| 356 | 356 | |
| 357 | 357 | |
| 358 | - // default_value |
|
| 359 | - if(has_filter("geodir_cfa_default_value_{$field_type}")){
|
|
| 358 | + // default_value |
|
| 359 | + if(has_filter("geodir_cfa_default_value_{$field_type}")){
|
|
| 360 | 360 | |
| 361 | - echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 361 | + echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 362 | 362 | |
| 363 | - }else{
|
|
| 364 | - $value = ''; |
|
| 365 | - if (isset($field_info->default_value)) {
|
|
| 366 | - $value = esc_attr($field_info->default_value); |
|
| 367 | - }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
|
|
| 368 | - $value = $cf['defaults']['default_value']; |
|
| 369 | - } |
|
| 370 | - ?> |
|
| 363 | + }else{
|
|
| 364 | + $value = ''; |
|
| 365 | + if (isset($field_info->default_value)) {
|
|
| 366 | + $value = esc_attr($field_info->default_value); |
|
| 367 | + }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
|
|
| 368 | + $value = $cf['defaults']['default_value']; |
|
| 369 | + } |
|
| 370 | + ?> |
|
| 371 | 371 | <li> |
| 372 | 372 | <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
|
| 373 | 373 | <div class="gdcf-tooltip"> |
| 374 | 374 | <?php |
| 375 | - if ($field_type == 'checkbox') {
|
|
| 376 | - _e('Should the checkbox be checked by default?', 'geodirectory');
|
|
| 377 | - } else if ($field_type == 'email') {
|
|
| 378 | - _e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory');
|
|
| 379 | - } else {
|
|
| 380 | - _e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory');
|
|
| 381 | - } |
|
| 382 | - ?> |
|
| 375 | + if ($field_type == 'checkbox') {
|
|
| 376 | + _e('Should the checkbox be checked by default?', 'geodirectory');
|
|
| 377 | + } else if ($field_type == 'email') {
|
|
| 378 | + _e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory');
|
|
| 379 | + } else {
|
|
| 380 | + _e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory');
|
|
| 381 | + } |
|
| 382 | + ?> |
|
| 383 | 383 | </div> |
| 384 | 384 | </label> |
| 385 | 385 | <div class="gd-cf-input-wrap"> |
@@ -396,22 +396,22 @@ discard block |
||
| 396 | 396 | </div> |
| 397 | 397 | </li> |
| 398 | 398 | <?php |
| 399 | - } |
|
| 399 | + } |
|
| 400 | 400 | |
| 401 | 401 | |
| 402 | - // show_in |
|
| 403 | - if(has_filter("geodir_cfa_show_in_{$field_type}")){
|
|
| 402 | + // show_in |
|
| 403 | + if(has_filter("geodir_cfa_show_in_{$field_type}")){
|
|
| 404 | 404 | |
| 405 | - echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 405 | + echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 406 | 406 | |
| 407 | - }else{
|
|
| 408 | - $value = ''; |
|
| 409 | - if (isset($field_info->show_in)) {
|
|
| 410 | - $value = esc_attr($field_info->show_in); |
|
| 411 | - }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
|
|
| 412 | - $value = esc_attr($cf['defaults']['show_in']); |
|
| 413 | - } |
|
| 414 | - ?> |
|
| 407 | + }else{
|
|
| 408 | + $value = ''; |
|
| 409 | + if (isset($field_info->show_in)) {
|
|
| 410 | + $value = esc_attr($field_info->show_in); |
|
| 411 | + }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
|
|
| 412 | + $value = esc_attr($cf['defaults']['show_in']); |
|
| 413 | + } |
|
| 414 | + ?> |
|
| 415 | 415 | <li> |
| 416 | 416 | <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'); ?>
|
| 417 | 417 | <div class="gdcf-tooltip"> |
@@ -422,41 +422,41 @@ discard block |
||
| 422 | 422 | |
| 423 | 423 | <?php |
| 424 | 424 | |
| 425 | - /* |
|
| 425 | + /* |
|
| 426 | 426 | * We wrap the key values in [] so we can search the DB easier with a LIKE query. |
| 427 | 427 | */ |
| 428 | - $show_in_locations = array( |
|
| 429 | - "[detail]" => __("Details page sidebar", 'geodirectory'),
|
|
| 430 | - "[moreinfo]" => __("More info tab", 'geodirectory'),
|
|
| 431 | - "[listing]" => __("Listings page", 'geodirectory'),
|
|
| 432 | - "[owntab]" => __("Details page own tab", 'geodirectory'),
|
|
| 433 | - "[mapbubble]" => __("Map bubble", 'geodirectory'),
|
|
| 434 | - ); |
|
| 435 | - |
|
| 436 | - /** |
|
| 437 | - * Filter the locations array for where to display custom fields. |
|
| 438 | - * |
|
| 439 | - * @since 1.6.6 |
|
| 440 | - * @param array $show_in_locations The array of locations and descriptions. |
|
| 441 | - * @param object $field_info The field being displayed info. |
|
| 442 | - * @param string $field_info The type of field. |
|
| 443 | - */ |
|
| 444 | - $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
|
|
| 445 | - |
|
| 446 | - |
|
| 447 | - // remove some locations for some field types |
|
| 448 | - |
|
| 449 | - // don't show new tab option for some types |
|
| 450 | - if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
|
|
| 451 | - }else{
|
|
| 452 | - unset($show_in_locations['[owntab]']); |
|
| 453 | - } |
|
| 454 | - |
|
| 455 | - if(!$display_on_listing){
|
|
| 456 | - unset($show_in_locations['[listings]']); |
|
| 457 | - } |
|
| 458 | - |
|
| 459 | - ?> |
|
| 428 | + $show_in_locations = array( |
|
| 429 | + "[detail]" => __("Details page sidebar", 'geodirectory'),
|
|
| 430 | + "[moreinfo]" => __("More info tab", 'geodirectory'),
|
|
| 431 | + "[listing]" => __("Listings page", 'geodirectory'),
|
|
| 432 | + "[owntab]" => __("Details page own tab", 'geodirectory'),
|
|
| 433 | + "[mapbubble]" => __("Map bubble", 'geodirectory'),
|
|
| 434 | + ); |
|
| 435 | + |
|
| 436 | + /** |
|
| 437 | + * Filter the locations array for where to display custom fields. |
|
| 438 | + * |
|
| 439 | + * @since 1.6.6 |
|
| 440 | + * @param array $show_in_locations The array of locations and descriptions. |
|
| 441 | + * @param object $field_info The field being displayed info. |
|
| 442 | + * @param string $field_info The type of field. |
|
| 443 | + */ |
|
| 444 | + $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
|
|
| 445 | + |
|
| 446 | + |
|
| 447 | + // remove some locations for some field types |
|
| 448 | + |
|
| 449 | + // don't show new tab option for some types |
|
| 450 | + if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
|
|
| 451 | + }else{
|
|
| 452 | + unset($show_in_locations['[owntab]']); |
|
| 453 | + } |
|
| 454 | + |
|
| 455 | + if(!$display_on_listing){
|
|
| 456 | + unset($show_in_locations['[listings]']); |
|
| 457 | + } |
|
| 458 | + |
|
| 459 | + ?> |
|
| 460 | 460 | |
| 461 | 461 | <select multiple="multiple" name="show_in[]" |
| 462 | 462 | id="show_in" |
@@ -466,38 +466,38 @@ discard block |
||
| 466 | 466 | option-ajaxchosen="false"> |
| 467 | 467 | <?php |
| 468 | 468 | |
| 469 | - $show_in_values = explode(',',$value);
|
|
| 469 | + $show_in_values = explode(',',$value);
|
|
| 470 | 470 | |
| 471 | - foreach( $show_in_locations as $key => $val){
|
|
| 472 | - $selected = ''; |
|
| 471 | + foreach( $show_in_locations as $key => $val){
|
|
| 472 | + $selected = ''; |
|
| 473 | 473 | |
| 474 | - if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
|
|
| 475 | - $selected = 'selected'; |
|
| 476 | - } |
|
| 474 | + if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
|
|
| 475 | + $selected = 'selected'; |
|
| 476 | + } |
|
| 477 | 477 | |
| 478 | - ?> |
|
| 478 | + ?> |
|
| 479 | 479 | <option value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option> |
| 480 | 480 | <?php |
| 481 | - } |
|
| 482 | - ?> |
|
| 481 | + } |
|
| 482 | + ?> |
|
| 483 | 483 | </select> |
| 484 | 484 | </div> |
| 485 | 485 | </li> |
| 486 | 486 | <?php |
| 487 | - } |
|
| 487 | + } |
|
| 488 | 488 | |
| 489 | 489 | |
| 490 | - // advanced_editor |
|
| 491 | - if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
|
|
| 490 | + // advanced_editor |
|
| 491 | + if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
|
|
| 492 | 492 | |
| 493 | - echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 493 | + echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 494 | 494 | |
| 495 | - } |
|
| 495 | + } |
|
| 496 | 496 | |
| 497 | 497 | |
| 498 | 498 | |
| 499 | 499 | |
| 500 | - ?> |
|
| 500 | + ?> |
|
| 501 | 501 | |
| 502 | 502 | |
| 503 | 503 | <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?> |
@@ -510,38 +510,38 @@ discard block |
||
| 510 | 510 | |
| 511 | 511 | <?php |
| 512 | 512 | |
| 513 | - $pricearr = array(); |
|
| 514 | - if (isset($field_info->packages) && $field_info->packages != '') {
|
|
| 515 | - $pricearr = explode(',', trim($field_info->packages, ','));
|
|
| 516 | - } else {
|
|
| 517 | - $package_info = array(); |
|
| 513 | + $pricearr = array(); |
|
| 514 | + if (isset($field_info->packages) && $field_info->packages != '') {
|
|
| 515 | + $pricearr = explode(',', trim($field_info->packages, ','));
|
|
| 516 | + } else {
|
|
| 517 | + $package_info = array(); |
|
| 518 | 518 | |
| 519 | - $package_info = geodir_post_package_info($package_info, '', $post_type); |
|
| 520 | - $pricearr[] = $package_info->pid; |
|
| 521 | - } |
|
| 519 | + $package_info = geodir_post_package_info($package_info, '', $post_type); |
|
| 520 | + $pricearr[] = $package_info->pid; |
|
| 521 | + } |
|
| 522 | 522 | |
| 523 | - ob_start() |
|
| 524 | - ?> |
|
| 523 | + ob_start() |
|
| 524 | + ?> |
|
| 525 | 525 | |
| 526 | 526 | <select style="display:none" name="show_on_pkg[]" id="show_on_pkg" multiple="multiple"> |
| 527 | 527 | <?php |
| 528 | - if (!empty($pricearr)) {
|
|
| 529 | - foreach ($pricearr as $val) {
|
|
| 530 | - ?> |
|
| 528 | + if (!empty($pricearr)) {
|
|
| 529 | + foreach ($pricearr as $val) {
|
|
| 530 | + ?> |
|
| 531 | 531 | <option selected="selected" value="<?php echo esc_attr($val); ?>" ><?php echo $val; ?></option><?php |
| 532 | - } |
|
| 533 | - } |
|
| 534 | - ?> |
|
| 532 | + } |
|
| 533 | + } |
|
| 534 | + ?> |
|
| 535 | 535 | </select> |
| 536 | 536 | |
| 537 | 537 | <?php |
| 538 | - $html = ob_get_clean(); |
|
| 538 | + $html = ob_get_clean(); |
|
| 539 | 539 | |
| 540 | 540 | /** |
| 541 | 541 | * Filter the price packages list. |
| 542 | 542 | * |
| 543 | 543 | * Filter the price packages list in custom field form in admin |
| 544 | - * custom fields settings. |
|
| 544 | + * custom fields settings. |
|
| 545 | 545 | * |
| 546 | 546 | * @since 1.0.0 |
| 547 | 547 | * |
@@ -550,25 +550,25 @@ discard block |
||
| 550 | 550 | */ |
| 551 | 551 | echo $html = apply_filters('geodir_packages_list_on_custom_fields', $html, $field_info);
|
| 552 | 552 | |
| 553 | - ?> |
|
| 553 | + ?> |
|
| 554 | 554 | |
| 555 | 555 | |
| 556 | 556 | |
| 557 | 557 | <?php |
| 558 | 558 | |
| 559 | - // is_required |
|
| 560 | - if(has_filter("geodir_cfa_is_required_{$field_type}")){
|
|
| 559 | + // is_required |
|
| 560 | + if(has_filter("geodir_cfa_is_required_{$field_type}")){
|
|
| 561 | 561 | |
| 562 | - echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 562 | + echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 563 | 563 | |
| 564 | - }else{
|
|
| 565 | - $value = ''; |
|
| 566 | - if (isset($field_info->is_required)) {
|
|
| 567 | - $value = esc_attr($field_info->is_required); |
|
| 568 | - }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
|
|
| 569 | - $value = $cf['defaults']['is_required']; |
|
| 570 | - } |
|
| 571 | - ?> |
|
| 564 | + }else{
|
|
| 565 | + $value = ''; |
|
| 566 | + if (isset($field_info->is_required)) {
|
|
| 567 | + $value = esc_attr($field_info->is_required); |
|
| 568 | + }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
|
|
| 569 | + $value = $cf['defaults']['is_required']; |
|
| 570 | + } |
|
| 571 | + ?> |
|
| 572 | 572 | <li> |
| 573 | 573 | <label for="is_required" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is required :', 'geodirectory'); ?>
|
| 574 | 574 | <div class="gdcf-tooltip"> |
@@ -580,14 +580,14 @@ discard block |
||
| 580 | 580 | |
| 581 | 581 | <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled" value="1" |
| 582 | 582 | <?php if ($value == '1') {
|
| 583 | - echo 'checked'; |
|
| 584 | - } ?>/> |
|
| 583 | + echo 'checked'; |
|
| 584 | + } ?>/> |
|
| 585 | 585 | <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>
|
| 586 | 586 | |
| 587 | 587 | <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0" |
| 588 | 588 | <?php if ($value == '0' || !$value) {
|
| 589 | - echo 'checked'; |
|
| 590 | - } ?>/> |
|
| 589 | + echo 'checked'; |
|
| 590 | + } ?>/> |
|
| 591 | 591 | <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>
|
| 592 | 592 | |
| 593 | 593 | </div> |
@@ -595,21 +595,21 @@ discard block |
||
| 595 | 595 | </li> |
| 596 | 596 | |
| 597 | 597 | <?php |
| 598 | - } |
|
| 598 | + } |
|
| 599 | 599 | |
| 600 | - // required_msg |
|
| 601 | - if(has_filter("geodir_cfa_required_msg_{$field_type}")){
|
|
| 600 | + // required_msg |
|
| 601 | + if(has_filter("geodir_cfa_required_msg_{$field_type}")){
|
|
| 602 | 602 | |
| 603 | - echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 603 | + echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 604 | 604 | |
| 605 | - }else{
|
|
| 606 | - $value = ''; |
|
| 607 | - if (isset($field_info->required_msg)) {
|
|
| 608 | - $value = esc_attr($field_info->required_msg); |
|
| 609 | - }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
|
|
| 610 | - $value = $cf['defaults']['required_msg']; |
|
| 611 | - } |
|
| 612 | - ?> |
|
| 605 | + }else{
|
|
| 606 | + $value = ''; |
|
| 607 | + if (isset($field_info->required_msg)) {
|
|
| 608 | + $value = esc_attr($field_info->required_msg); |
|
| 609 | + }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
|
|
| 610 | + $value = $cf['defaults']['required_msg']; |
|
| 611 | + } |
|
| 612 | + ?> |
|
| 613 | 613 | <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;'";}?>>
|
| 614 | 614 | <label for="required_msg" class="gd-cf-tooltip-wrap"> |
| 615 | 615 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
|
@@ -623,38 +623,38 @@ discard block |
||
| 623 | 623 | </div> |
| 624 | 624 | </li> |
| 625 | 625 | <?php |
| 626 | - } |
|
| 626 | + } |
|
| 627 | 627 | |
| 628 | 628 | |
| 629 | - // required_msg |
|
| 630 | - if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
|
|
| 629 | + // required_msg |
|
| 630 | + if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
|
|
| 631 | 631 | |
| 632 | - echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 632 | + echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 633 | 633 | |
| 634 | - } |
|
| 634 | + } |
|
| 635 | 635 | |
| 636 | 636 | |
| 637 | - // extra_fields |
|
| 638 | - if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
|
|
| 637 | + // extra_fields |
|
| 638 | + if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
|
|
| 639 | 639 | |
| 640 | - echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 640 | + echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 641 | 641 | |
| 642 | - } |
|
| 642 | + } |
|
| 643 | 643 | |
| 644 | 644 | |
| 645 | - // field_icon |
|
| 646 | - if(has_filter("geodir_cfa_field_icon_{$field_type}")){
|
|
| 645 | + // field_icon |
|
| 646 | + if(has_filter("geodir_cfa_field_icon_{$field_type}")){
|
|
| 647 | 647 | |
| 648 | - echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 648 | + echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 649 | 649 | |
| 650 | - }else{
|
|
| 651 | - $value = ''; |
|
| 652 | - if (isset($field_info->field_icon)) {
|
|
| 653 | - $value = esc_attr($field_info->field_icon); |
|
| 654 | - }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
|
|
| 655 | - $value = $cf['defaults']['field_icon']; |
|
| 656 | - } |
|
| 657 | - ?> |
|
| 650 | + }else{
|
|
| 651 | + $value = ''; |
|
| 652 | + if (isset($field_info->field_icon)) {
|
|
| 653 | + $value = esc_attr($field_info->field_icon); |
|
| 654 | + }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
|
|
| 655 | + $value = $cf['defaults']['field_icon']; |
|
| 656 | + } |
|
| 657 | + ?> |
|
| 658 | 658 | <li> |
| 659 | 659 | <h3><?php echo __('Custom css', 'geodirectory'); ?></h3>
|
| 660 | 660 | |
@@ -672,22 +672,22 @@ discard block |
||
| 672 | 672 | |
| 673 | 673 | </li> |
| 674 | 674 | <?php |
| 675 | - } |
|
| 675 | + } |
|
| 676 | 676 | |
| 677 | 677 | |
| 678 | - // css_class |
|
| 679 | - if(has_filter("geodir_cfa_css_class_{$field_type}")){
|
|
| 678 | + // css_class |
|
| 679 | + if(has_filter("geodir_cfa_css_class_{$field_type}")){
|
|
| 680 | 680 | |
| 681 | - echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 681 | + echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 682 | 682 | |
| 683 | - }else{
|
|
| 684 | - $value = ''; |
|
| 685 | - if (isset($field_info->css_class)) {
|
|
| 686 | - $value = esc_attr($field_info->css_class); |
|
| 687 | - }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
|
|
| 688 | - $value = $cf['defaults']['css_class']; |
|
| 689 | - } |
|
| 690 | - ?> |
|
| 683 | + }else{
|
|
| 684 | + $value = ''; |
|
| 685 | + if (isset($field_info->css_class)) {
|
|
| 686 | + $value = esc_attr($field_info->css_class); |
|
| 687 | + }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
|
|
| 688 | + $value = $cf['defaults']['css_class']; |
|
| 689 | + } |
|
| 690 | + ?> |
|
| 691 | 691 | <li> |
| 692 | 692 | |
| 693 | 693 | <label for="css_class" class="gd-cf-tooltip-wrap"> |
@@ -700,47 +700,47 @@ discard block |
||
| 700 | 700 | <div class="gd-cf-input-wrap"> |
| 701 | 701 | <input type="text" name="css_class" id="css_class" |
| 702 | 702 | value="<?php if (isset($field_info->css_class)) {
|
| 703 | - echo esc_attr($field_info->css_class); |
|
| 704 | - }?>"/> |
|
| 703 | + echo esc_attr($field_info->css_class); |
|
| 704 | + }?>"/> |
|
| 705 | 705 | </div> |
| 706 | 706 | </li> |
| 707 | 707 | <?php |
| 708 | - } |
|
| 708 | + } |
|
| 709 | 709 | |
| 710 | 710 | |
| 711 | - // cat_sort |
|
| 712 | - if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
|
|
| 711 | + // cat_sort |
|
| 712 | + if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
|
|
| 713 | 713 | |
| 714 | - echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 714 | + echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 715 | 715 | |
| 716 | - }else{
|
|
| 717 | - $value = ''; |
|
| 718 | - $hide_cat_sort =''; |
|
| 719 | - if (isset($field_info->cat_sort)) {
|
|
| 720 | - $value = esc_attr($field_info->cat_sort); |
|
| 721 | - }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
|
|
| 722 | - $value = $cf['defaults']['cat_sort']; |
|
| 723 | - $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
|
| 724 | - } |
|
| 716 | + }else{
|
|
| 717 | + $value = ''; |
|
| 718 | + $hide_cat_sort =''; |
|
| 719 | + if (isset($field_info->cat_sort)) {
|
|
| 720 | + $value = esc_attr($field_info->cat_sort); |
|
| 721 | + }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
|
|
| 722 | + $value = $cf['defaults']['cat_sort']; |
|
| 723 | + $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
|
| 724 | + } |
|
| 725 | 725 | |
| 726 | - $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : ''; |
|
| 727 | - ?> |
|
| 726 | + $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : ''; |
|
| 727 | + ?> |
|
| 728 | 728 | <li <?php echo $hide_cat_sort ;?>> |
| 729 | 729 | <h3><?php |
| 730 | - /** |
|
| 731 | - * Filter the section title. |
|
| 732 | - * |
|
| 733 | - * Filter the section title in custom field form in admin |
|
| 734 | - * custom fields settings. |
|
| 735 | - * |
|
| 736 | - * @since 1.0.0 |
|
| 737 | - * |
|
| 738 | - * @param string $title Title of the section. |
|
| 739 | - * @param string $field_type Current field type. |
|
| 740 | - */ |
|
| 741 | - echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
|
|
| 742 | - |
|
| 743 | - ?></h3> |
|
| 730 | + /** |
|
| 731 | + * Filter the section title. |
|
| 732 | + * |
|
| 733 | + * Filter the section title in custom field form in admin |
|
| 734 | + * custom fields settings. |
|
| 735 | + * |
|
| 736 | + * @since 1.0.0 |
|
| 737 | + * |
|
| 738 | + * @param string $title Title of the section. |
|
| 739 | + * @param string $field_type Current field type. |
|
| 740 | + */ |
|
| 741 | + echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
|
|
| 742 | + |
|
| 743 | + ?></h3> |
|
| 744 | 744 | <label for="cat_sort" class="gd-cf-tooltip-wrap"> |
| 745 | 745 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
|
| 746 | 746 | <div class="gdcf-tooltip"> |
@@ -752,42 +752,42 @@ discard block |
||
| 752 | 752 | |
| 753 | 753 | <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled" value="1" |
| 754 | 754 | <?php if ($value == '1') {
|
| 755 | - echo 'checked'; |
|
| 756 | - } ?>/> |
|
| 755 | + echo 'checked'; |
|
| 756 | + } ?>/> |
|
| 757 | 757 | <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
| 758 | 758 | |
| 759 | 759 | <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0" |
| 760 | 760 | <?php if (!$value) {
|
| 761 | - echo 'checked'; |
|
| 762 | - } ?>/> |
|
| 761 | + echo 'checked'; |
|
| 762 | + } ?>/> |
|
| 763 | 763 | <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
| 764 | 764 | |
| 765 | 765 | </div> |
| 766 | 766 | </li> |
| 767 | 767 | <?php |
| 768 | - } |
|
| 769 | - |
|
| 770 | - |
|
| 771 | - |
|
| 772 | - switch ($field_type): |
|
| 773 | - case 'html': |
|
| 774 | - case 'file': |
|
| 775 | - case 'url': |
|
| 776 | - case 'fieldset': |
|
| 777 | - break; |
|
| 778 | - default: |
|
| 779 | - |
|
| 780 | - /** |
|
| 781 | - * Called at the end of the advanced custom fields settings page loop. |
|
| 782 | - * |
|
| 783 | - * Can be used to add or deal with different settings types. |
|
| 784 | - * |
|
| 785 | - * @since 1.0.0 |
|
| 786 | - * @since 1.6.6 $cf param added. |
|
| 787 | - * @param object $field_info The current fields info. |
|
| 788 | - * @param array $cf The custom field settings |
|
| 789 | - */ |
|
| 790 | - do_action('geodir_advance_custom_fields', $field_info,$cf);?>
|
|
| 768 | + } |
|
| 769 | + |
|
| 770 | + |
|
| 771 | + |
|
| 772 | + switch ($field_type): |
|
| 773 | + case 'html': |
|
| 774 | + case 'file': |
|
| 775 | + case 'url': |
|
| 776 | + case 'fieldset': |
|
| 777 | + break; |
|
| 778 | + default: |
|
| 779 | + |
|
| 780 | + /** |
|
| 781 | + * Called at the end of the advanced custom fields settings page loop. |
|
| 782 | + * |
|
| 783 | + * Can be used to add or deal with different settings types. |
|
| 784 | + * |
|
| 785 | + * @since 1.0.0 |
|
| 786 | + * @since 1.6.6 $cf param added. |
|
| 787 | + * @param object $field_info The current fields info. |
|
| 788 | + * @param array $cf The custom field settings |
|
| 789 | + */ |
|
| 790 | + do_action('geodir_advance_custom_fields', $field_info,$cf);?>
|
|
| 791 | 791 | |
| 792 | 792 | |
| 793 | 793 | <?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 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | ondblclick="show_hide('field_frm<?php echo $result_str; ?>')" >
|
| 93 | 93 | <?php |
| 94 | 94 | |
| 95 | - $nonce = wp_create_nonce('custom_fields_' . $result_str);
|
|
| 95 | + $nonce = wp_create_nonce('custom_fields_'.$result_str);
|
|
| 96 | 96 | ?> |
| 97 | 97 | |
| 98 | 98 | <?php if (!$default): ?> |
@@ -105,12 +105,12 @@ discard block |
||
| 105 | 105 | <i class="fa fa-long-arrow-left " aria-hidden="true"></i> |
| 106 | 106 | <i class="fa fa-long-arrow-right " aria-hidden="true"></i> |
| 107 | 107 | <b style="cursor:pointer;" |
| 108 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
|
|
| 108 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory').' '.$field_admin_title); ?></b>
|
|
| 109 | 109 | <?php |
| 110 | 110 | } else {echo $field_icon;
|
| 111 | 111 | ?> |
| 112 | 112 | <b style="cursor:pointer;" |
| 113 | - onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b>
|
|
| 113 | + onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(' '.$field_admin_title.' ('.$field_type_name.')'); ?></b>
|
|
| 114 | 114 | <?php |
| 115 | 115 | } |
| 116 | 116 | ?> |
@@ -133,43 +133,43 @@ discard block |
||
| 133 | 133 | } ?>"/> |
| 134 | 134 | <input type="hidden" name="is_active" id="is_active" value="1"/> |
| 135 | 135 | |
| 136 | - <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?> |
|
| 137 | - <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" /> |
|
| 138 | - <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" /> |
|
| 139 | - <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : '';?>" /> |
|
| 136 | + <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : ''; ?>" /><?php // show in sidebar value?> |
|
| 137 | + <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" /> |
|
| 138 | + <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" /> |
|
| 139 | + <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : ''; ?>" /> |
|
| 140 | 140 | |
| 141 | 141 | <ul class="widefat post fixed" border="0" style="width:100%;"> |
| 142 | 142 | |
| 143 | 143 | <?php |
| 144 | 144 | |
| 145 | 145 | // data_type |
| 146 | - if(has_filter("geodir_cfa_data_type_{$field_type}")){
|
|
| 146 | + if (has_filter("geodir_cfa_data_type_{$field_type}")) {
|
|
| 147 | 147 | |
| 148 | - echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 148 | + echo apply_filters("geodir_cfa_data_type_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 149 | 149 | |
| 150 | - }else{
|
|
| 150 | + } else {
|
|
| 151 | 151 | $value = ''; |
| 152 | 152 | if (isset($field_info->data_type)) {
|
| 153 | 153 | $value = esc_attr($field_info->data_type); |
| 154 | - }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
|
|
| 154 | + }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) {
|
|
| 155 | 155 | $value = $cf['defaults']['data_type']; |
| 156 | 156 | } |
| 157 | 157 | ?> |
| 158 | - <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/> |
|
| 158 | + <input type="hidden" name="data_type" id="data_type" value="<?php echo $value; ?>"/> |
|
| 159 | 159 | <?php |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | |
| 163 | 163 | // admin_title |
| 164 | - if(has_filter("geodir_cfa_admin_title_{$field_type}")){
|
|
| 164 | + if (has_filter("geodir_cfa_admin_title_{$field_type}")) {
|
|
| 165 | 165 | |
| 166 | - echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 166 | + echo apply_filters("geodir_cfa_admin_title_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 167 | 167 | |
| 168 | - }else{
|
|
| 168 | + } else {
|
|
| 169 | 169 | $value = ''; |
| 170 | 170 | if (isset($field_info->admin_title)) {
|
| 171 | 171 | $value = esc_attr($field_info->admin_title); |
| 172 | - }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
|
|
| 172 | + }elseif (isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']) {
|
|
| 173 | 173 | $value = $cf['defaults']['admin_title']; |
| 174 | 174 | } |
| 175 | 175 | ?> |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | </label> |
| 183 | 183 | <div class="gd-cf-input-wrap"> |
| 184 | 184 | <input type="text" name="admin_title" id="admin_title" |
| 185 | - value="<?php echo $value;?>"/> |
|
| 185 | + value="<?php echo $value; ?>"/> |
|
| 186 | 186 | </div> |
| 187 | 187 | </li> |
| 188 | 188 | <?php |
@@ -190,15 +190,15 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | |
| 192 | 192 | // site_title |
| 193 | - if(has_filter("geodir_cfa_site_title_{$field_type}")){
|
|
| 193 | + if (has_filter("geodir_cfa_site_title_{$field_type}")) {
|
|
| 194 | 194 | |
| 195 | - echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 195 | + echo apply_filters("geodir_cfa_site_title_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 196 | 196 | |
| 197 | - }else{
|
|
| 197 | + } else {
|
|
| 198 | 198 | $value = ''; |
| 199 | 199 | if (isset($field_info->site_title)) {
|
| 200 | 200 | $value = esc_attr($field_info->site_title); |
| 201 | - }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
|
|
| 201 | + }elseif (isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']) {
|
|
| 202 | 202 | $value = $cf['defaults']['site_title']; |
| 203 | 203 | } |
| 204 | 204 | ?> |
@@ -218,15 +218,15 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | |
| 220 | 220 | // admin_desc |
| 221 | - if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
|
|
| 221 | + if (has_filter("geodir_cfa_admin_desc_{$field_type}")) {
|
|
| 222 | 222 | |
| 223 | - echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 223 | + echo apply_filters("geodir_cfa_admin_desc_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 224 | 224 | |
| 225 | - }else{
|
|
| 225 | + } else {
|
|
| 226 | 226 | $value = ''; |
| 227 | 227 | if (isset($field_info->admin_desc)) {
|
| 228 | 228 | $value = esc_attr($field_info->admin_desc); |
| 229 | - }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
|
|
| 229 | + }elseif (isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']) {
|
|
| 230 | 230 | $value = $cf['defaults']['admin_desc']; |
| 231 | 231 | } |
| 232 | 232 | ?> |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | </div> |
| 238 | 238 | </label> |
| 239 | 239 | <div class="gd-cf-input-wrap"> |
| 240 | - <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value;?>"/> |
|
| 240 | + <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value; ?>"/> |
|
| 241 | 241 | </div> |
| 242 | 242 | </li> |
| 243 | 243 | <?php |
@@ -246,26 +246,26 @@ discard block |
||
| 246 | 246 | |
| 247 | 247 | |
| 248 | 248 | // htmlvar_name |
| 249 | - if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
|
|
| 249 | + if (has_filter("geodir_cfa_htmlvar_name_{$field_type}")) {
|
|
| 250 | 250 | |
| 251 | - echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 251 | + echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 252 | 252 | |
| 253 | - }else{
|
|
| 253 | + } else {
|
|
| 254 | 254 | $value = ''; |
| 255 | 255 | if (isset($field_info->htmlvar_name)) {
|
| 256 | 256 | $value = esc_attr($field_info->htmlvar_name); |
| 257 | - }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
|
|
| 257 | + }elseif (isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']) {
|
|
| 258 | 258 | $value = $cf['defaults']['htmlvar_name']; |
| 259 | 259 | } |
| 260 | 260 | ?> |
| 261 | 261 | <li> |
| 262 | - <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');?>
|
|
| 262 | + <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'); ?>
|
|
| 263 | 263 | <div class="gdcf-tooltip"> |
| 264 | 264 | <?php _e('This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.', 'geodirectory'); ?>
|
| 265 | 265 | </div> |
| 266 | 266 | </label> |
| 267 | 267 | <div class="gd-cf-input-wrap"> |
| 268 | - <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');?>"
|
|
| 268 | + <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'); ?>"
|
|
| 269 | 269 | value="<?php if ($value) {
|
| 270 | 270 | echo preg_replace('/geodir_/', '', $value, 1);
|
| 271 | 271 | }?>" <?php if ($default) {
|
@@ -278,15 +278,15 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | |
| 280 | 280 | // is_active |
| 281 | - if(has_filter("geodir_cfa_is_active_{$field_type}")){
|
|
| 281 | + if (has_filter("geodir_cfa_is_active_{$field_type}")) {
|
|
| 282 | 282 | |
| 283 | - echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 283 | + echo apply_filters("geodir_cfa_is_active_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 284 | 284 | |
| 285 | - }else{
|
|
| 285 | + } else {
|
|
| 286 | 286 | $value = ''; |
| 287 | 287 | if (isset($field_info->is_active)) {
|
| 288 | 288 | $value = esc_attr($field_info->is_active); |
| 289 | - }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
|
|
| 289 | + }elseif (isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']) {
|
|
| 290 | 290 | $value = $cf['defaults']['is_active']; |
| 291 | 291 | } |
| 292 | 292 | ?> |
@@ -298,17 +298,17 @@ discard block |
||
| 298 | 298 | </label> |
| 299 | 299 | <div class="gd-cf-input-wrap gd-switch"> |
| 300 | 300 | |
| 301 | - <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled" value="1" |
|
| 301 | + <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled" value="1" |
|
| 302 | 302 | <?php if ($value == '1') {
|
| 303 | 303 | echo 'checked'; |
| 304 | 304 | } ?>/> |
| 305 | - <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 305 | + <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 306 | 306 | |
| 307 | - <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0" |
|
| 307 | + <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0" |
|
| 308 | 308 | <?php if ($value == '0' || !$value) {
|
| 309 | 309 | echo 'checked'; |
| 310 | 310 | } ?>/> |
| 311 | - <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 311 | + <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 312 | 312 | |
| 313 | 313 | </div> |
| 314 | 314 | </li> |
@@ -317,15 +317,15 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | |
| 319 | 319 | // for_admin_use |
| 320 | - if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
|
|
| 320 | + if (has_filter("geodir_cfa_for_admin_use_{$field_type}")) {
|
|
| 321 | 321 | |
| 322 | - echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 322 | + echo apply_filters("geodir_cfa_for_admin_use_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 323 | 323 | |
| 324 | - }else{
|
|
| 324 | + } else {
|
|
| 325 | 325 | $value = ''; |
| 326 | 326 | if (isset($field_info->for_admin_use)) {
|
| 327 | 327 | $value = esc_attr($field_info->for_admin_use); |
| 328 | - }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
|
|
| 328 | + }elseif (isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']) {
|
|
| 329 | 329 | $value = $cf['defaults']['for_admin_use']; |
| 330 | 330 | } |
| 331 | 331 | ?> |
@@ -337,17 +337,17 @@ discard block |
||
| 337 | 337 | </label> |
| 338 | 338 | <div class="gd-cf-input-wrap gd-switch"> |
| 339 | 339 | |
| 340 | - <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled" value="1" |
|
| 340 | + <input type="radio" id="for_admin_use_yes<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-enabled" value="1" |
|
| 341 | 341 | <?php if ($value == '1') {
|
| 342 | 342 | echo 'checked'; |
| 343 | 343 | } ?>/> |
| 344 | - <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 344 | + <label for="for_admin_use_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 345 | 345 | |
| 346 | - <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0" |
|
| 346 | + <input type="radio" id="for_admin_use_no<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-disabled" value="0" |
|
| 347 | 347 | <?php if ($value == '0' || !$value) {
|
| 348 | 348 | echo 'checked'; |
| 349 | 349 | } ?>/> |
| 350 | - <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 350 | + <label for="for_admin_use_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 351 | 351 | |
| 352 | 352 | </div> |
| 353 | 353 | </li> |
@@ -356,20 +356,20 @@ discard block |
||
| 356 | 356 | |
| 357 | 357 | |
| 358 | 358 | // default_value |
| 359 | - if(has_filter("geodir_cfa_default_value_{$field_type}")){
|
|
| 359 | + if (has_filter("geodir_cfa_default_value_{$field_type}")) {
|
|
| 360 | 360 | |
| 361 | - echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 361 | + echo apply_filters("geodir_cfa_default_value_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 362 | 362 | |
| 363 | - }else{
|
|
| 363 | + } else {
|
|
| 364 | 364 | $value = ''; |
| 365 | 365 | if (isset($field_info->default_value)) {
|
| 366 | 366 | $value = esc_attr($field_info->default_value); |
| 367 | - }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
|
|
| 367 | + }elseif (isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']) {
|
|
| 368 | 368 | $value = $cf['defaults']['default_value']; |
| 369 | 369 | } |
| 370 | 370 | ?> |
| 371 | 371 | <li> |
| 372 | - <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
|
|
| 372 | + <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory'); ?>
|
|
| 373 | 373 | <div class="gdcf-tooltip"> |
| 374 | 374 | <?php |
| 375 | 375 | if ($field_type == 'checkbox') {
|
@@ -386,12 +386,12 @@ discard block |
||
| 386 | 386 | <?php if ($field_type == 'checkbox') { ?>
|
| 387 | 387 | <select name="default_value" id="default_value"> |
| 388 | 388 | <option value=""><?php _e('Unchecked', 'geodirectory'); ?></option>
|
| 389 | - <option value="1" <?php selected(true, (int)$value === 1);?>><?php _e('Checked', 'geodirectory'); ?></option>
|
|
| 389 | + <option value="1" <?php selected(true, (int) $value === 1); ?>><?php _e('Checked', 'geodirectory'); ?></option>
|
|
| 390 | 390 | </select> |
| 391 | 391 | <?php } else if ($field_type == 'email') { ?>
|
| 392 | - <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory') ;?>" id="default_value" value="<?php echo esc_attr($value);?>" /><br/>
|
|
| 392 | + <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory'); ?>" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/>
|
|
| 393 | 393 | <?php } else { ?>
|
| 394 | - <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value);?>" /><br/> |
|
| 394 | + <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/> |
|
| 395 | 395 | <?php } ?> |
| 396 | 396 | </div> |
| 397 | 397 | </li> |
@@ -400,15 +400,15 @@ discard block |
||
| 400 | 400 | |
| 401 | 401 | |
| 402 | 402 | // show_in |
| 403 | - if(has_filter("geodir_cfa_show_in_{$field_type}")){
|
|
| 403 | + if (has_filter("geodir_cfa_show_in_{$field_type}")) {
|
|
| 404 | 404 | |
| 405 | - echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 405 | + echo apply_filters("geodir_cfa_show_in_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 406 | 406 | |
| 407 | - }else{
|
|
| 407 | + } else {
|
|
| 408 | 408 | $value = ''; |
| 409 | 409 | if (isset($field_info->show_in)) {
|
| 410 | 410 | $value = esc_attr($field_info->show_in); |
| 411 | - }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
|
|
| 411 | + }elseif (isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']) {
|
|
| 412 | 412 | $value = esc_attr($cf['defaults']['show_in']); |
| 413 | 413 | } |
| 414 | 414 | ?> |
@@ -441,18 +441,18 @@ discard block |
||
| 441 | 441 | * @param object $field_info The field being displayed info. |
| 442 | 442 | * @param string $field_info The type of field. |
| 443 | 443 | */ |
| 444 | - $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
|
|
| 444 | + $show_in_locations = apply_filters('geodir_show_in_locations', $show_in_locations, $field_info, $field_type);
|
|
| 445 | 445 | |
| 446 | 446 | |
| 447 | 447 | // remove some locations for some field types |
| 448 | 448 | |
| 449 | 449 | // don't show new tab option for some types |
| 450 | - if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
|
|
| 451 | - }else{
|
|
| 450 | + if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) {
|
|
| 451 | + } else {
|
|
| 452 | 452 | unset($show_in_locations['[owntab]']); |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | - if(!$display_on_listing){
|
|
| 455 | + if (!$display_on_listing) {
|
|
| 456 | 456 | unset($show_in_locations['[listings]']); |
| 457 | 457 | } |
| 458 | 458 | |
@@ -466,17 +466,17 @@ discard block |
||
| 466 | 466 | option-ajaxchosen="false"> |
| 467 | 467 | <?php |
| 468 | 468 | |
| 469 | - $show_in_values = explode(',',$value);
|
|
| 469 | + $show_in_values = explode(',', $value);
|
|
| 470 | 470 | |
| 471 | - foreach( $show_in_locations as $key => $val){
|
|
| 471 | + foreach ($show_in_locations as $key => $val) {
|
|
| 472 | 472 | $selected = ''; |
| 473 | 473 | |
| 474 | - if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
|
|
| 474 | + if (is_array($show_in_values) && in_array($key, $show_in_values)) {
|
|
| 475 | 475 | $selected = 'selected'; |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | ?> |
| 479 | - <option value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option> |
|
| 479 | + <option value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $val; ?></option> |
|
| 480 | 480 | <?php |
| 481 | 481 | } |
| 482 | 482 | ?> |
@@ -488,9 +488,9 @@ discard block |
||
| 488 | 488 | |
| 489 | 489 | |
| 490 | 490 | // advanced_editor |
| 491 | - if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
|
|
| 491 | + if (has_filter("geodir_cfa_advanced_editor_{$field_type}")) {
|
|
| 492 | 492 | |
| 493 | - echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 493 | + echo apply_filters("geodir_cfa_advanced_editor_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 494 | 494 | |
| 495 | 495 | } |
| 496 | 496 | |
@@ -501,10 +501,10 @@ discard block |
||
| 501 | 501 | |
| 502 | 502 | |
| 503 | 503 | <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?> |
| 504 | - <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels);} ?>"/>
|
|
| 504 | + <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels); } ?>"/>
|
|
| 505 | 505 | |
| 506 | 506 | <?php // we dont need to show the sort order ?> |
| 507 | - <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order);} ?>"/>
|
|
| 507 | + <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); } ?>"/>
|
|
| 508 | 508 | |
| 509 | 509 | |
| 510 | 510 | |
@@ -557,15 +557,15 @@ discard block |
||
| 557 | 557 | <?php |
| 558 | 558 | |
| 559 | 559 | // is_required |
| 560 | - if(has_filter("geodir_cfa_is_required_{$field_type}")){
|
|
| 560 | + if (has_filter("geodir_cfa_is_required_{$field_type}")) {
|
|
| 561 | 561 | |
| 562 | - echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 562 | + echo apply_filters("geodir_cfa_is_required_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 563 | 563 | |
| 564 | - }else{
|
|
| 564 | + } else {
|
|
| 565 | 565 | $value = ''; |
| 566 | 566 | if (isset($field_info->is_required)) {
|
| 567 | 567 | $value = esc_attr($field_info->is_required); |
| 568 | - }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
|
|
| 568 | + }elseif (isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']) {
|
|
| 569 | 569 | $value = $cf['defaults']['is_required']; |
| 570 | 570 | } |
| 571 | 571 | ?> |
@@ -578,17 +578,17 @@ discard block |
||
| 578 | 578 | |
| 579 | 579 | <div class="gd-cf-input-wrap gd-switch"> |
| 580 | 580 | |
| 581 | - <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled" value="1" |
|
| 581 | + <input type="radio" id="is_required_yes<?php echo $radio_id; ?>" name="is_required" class="gdri-enabled" value="1" |
|
| 582 | 582 | <?php if ($value == '1') {
|
| 583 | 583 | echo 'checked'; |
| 584 | 584 | } ?>/> |
| 585 | - <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 585 | + <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>
|
|
| 586 | 586 | |
| 587 | - <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0" |
|
| 587 | + <input type="radio" id="is_required_no<?php echo $radio_id; ?>" name="is_required" class="gdri-disabled" value="0" |
|
| 588 | 588 | <?php if ($value == '0' || !$value) {
|
| 589 | 589 | echo 'checked'; |
| 590 | 590 | } ?>/> |
| 591 | - <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 591 | + <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>
|
|
| 592 | 592 | |
| 593 | 593 | </div> |
| 594 | 594 | |
@@ -598,19 +598,19 @@ discard block |
||
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | // required_msg |
| 601 | - if(has_filter("geodir_cfa_required_msg_{$field_type}")){
|
|
| 601 | + if (has_filter("geodir_cfa_required_msg_{$field_type}")) {
|
|
| 602 | 602 | |
| 603 | - echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 603 | + echo apply_filters("geodir_cfa_required_msg_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 604 | 604 | |
| 605 | - }else{
|
|
| 605 | + } else {
|
|
| 606 | 606 | $value = ''; |
| 607 | 607 | if (isset($field_info->required_msg)) {
|
| 608 | 608 | $value = esc_attr($field_info->required_msg); |
| 609 | - }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
|
|
| 609 | + }elseif (isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']) {
|
|
| 610 | 610 | $value = $cf['defaults']['required_msg']; |
| 611 | 611 | } |
| 612 | 612 | ?> |
| 613 | - <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>>
|
|
| 613 | + <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;'"; }?>>
|
|
| 614 | 614 | <label for="required_msg" class="gd-cf-tooltip-wrap"> |
| 615 | 615 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
|
| 616 | 616 | <div class="gdcf-tooltip"> |
@@ -627,31 +627,31 @@ discard block |
||
| 627 | 627 | |
| 628 | 628 | |
| 629 | 629 | // required_msg |
| 630 | - if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
|
|
| 630 | + if (has_filter("geodir_cfa_validation_pattern_{$field_type}")) {
|
|
| 631 | 631 | |
| 632 | - echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 632 | + echo apply_filters("geodir_cfa_validation_pattern_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 633 | 633 | |
| 634 | 634 | } |
| 635 | 635 | |
| 636 | 636 | |
| 637 | 637 | // extra_fields |
| 638 | - if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
|
|
| 638 | + if (has_filter("geodir_cfa_extra_fields_{$field_type}")) {
|
|
| 639 | 639 | |
| 640 | - echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 640 | + echo apply_filters("geodir_cfa_extra_fields_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 641 | 641 | |
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | |
| 645 | 645 | // field_icon |
| 646 | - if(has_filter("geodir_cfa_field_icon_{$field_type}")){
|
|
| 646 | + if (has_filter("geodir_cfa_field_icon_{$field_type}")) {
|
|
| 647 | 647 | |
| 648 | - echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 648 | + echo apply_filters("geodir_cfa_field_icon_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 649 | 649 | |
| 650 | - }else{
|
|
| 650 | + } else {
|
|
| 651 | 651 | $value = ''; |
| 652 | 652 | if (isset($field_info->field_icon)) {
|
| 653 | 653 | $value = esc_attr($field_info->field_icon); |
| 654 | - }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
|
|
| 654 | + }elseif (isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']) {
|
|
| 655 | 655 | $value = $cf['defaults']['field_icon']; |
| 656 | 656 | } |
| 657 | 657 | ?> |
@@ -662,12 +662,12 @@ discard block |
||
| 662 | 662 | <label for="field_icon" class="gd-cf-tooltip-wrap"> |
| 663 | 663 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Upload icon :', 'geodirectory'); ?>
|
| 664 | 664 | <div class="gdcf-tooltip"> |
| 665 | - <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory');?>
|
|
| 665 | + <?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'); ?>
|
|
| 666 | 666 | </div> |
| 667 | 667 | </label> |
| 668 | 668 | <div class="gd-cf-input-wrap"> |
| 669 | 669 | <input type="text" name="field_icon" id="field_icon" |
| 670 | - value="<?php echo $value;?>"/> |
|
| 670 | + value="<?php echo $value; ?>"/> |
|
| 671 | 671 | </div> |
| 672 | 672 | |
| 673 | 673 | </li> |
@@ -676,15 +676,15 @@ discard block |
||
| 676 | 676 | |
| 677 | 677 | |
| 678 | 678 | // css_class |
| 679 | - if(has_filter("geodir_cfa_css_class_{$field_type}")){
|
|
| 679 | + if (has_filter("geodir_cfa_css_class_{$field_type}")) {
|
|
| 680 | 680 | |
| 681 | - echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 681 | + echo apply_filters("geodir_cfa_css_class_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 682 | 682 | |
| 683 | - }else{
|
|
| 683 | + } else {
|
|
| 684 | 684 | $value = ''; |
| 685 | 685 | if (isset($field_info->css_class)) {
|
| 686 | 686 | $value = esc_attr($field_info->css_class); |
| 687 | - }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
|
|
| 687 | + }elseif (isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']) {
|
|
| 688 | 688 | $value = $cf['defaults']['css_class']; |
| 689 | 689 | } |
| 690 | 690 | ?> |
@@ -693,8 +693,8 @@ discard block |
||
| 693 | 693 | <label for="css_class" class="gd-cf-tooltip-wrap"> |
| 694 | 694 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Css class :', 'geodirectory'); ?>
|
| 695 | 695 | <div class="gdcf-tooltip"> |
| 696 | - <?php _e('Enter custom css class for field custom style.', 'geodirectory');?>
|
|
| 697 | - <?php if($field_type=='multiselect'){_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory');}?>
|
|
| 696 | + <?php _e('Enter custom css class for field custom style.', 'geodirectory'); ?>
|
|
| 697 | + <?php if ($field_type == 'multiselect') {_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory'); }?>
|
|
| 698 | 698 | </div> |
| 699 | 699 | </label> |
| 700 | 700 | <div class="gd-cf-input-wrap"> |
@@ -709,23 +709,23 @@ discard block |
||
| 709 | 709 | |
| 710 | 710 | |
| 711 | 711 | // cat_sort |
| 712 | - if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
|
|
| 712 | + if (has_filter("geodir_cfa_cat_sort_{$field_type}")) {
|
|
| 713 | 713 | |
| 714 | - echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
|
|
| 714 | + echo apply_filters("geodir_cfa_cat_sort_{$field_type}", '', $result_str, $cf, $field_info);
|
|
| 715 | 715 | |
| 716 | - }else{
|
|
| 716 | + } else {
|
|
| 717 | 717 | $value = ''; |
| 718 | - $hide_cat_sort =''; |
|
| 718 | + $hide_cat_sort = ''; |
|
| 719 | 719 | if (isset($field_info->cat_sort)) {
|
| 720 | 720 | $value = esc_attr($field_info->cat_sort); |
| 721 | - }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
|
|
| 721 | + }elseif (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']) {
|
|
| 722 | 722 | $value = $cf['defaults']['cat_sort']; |
| 723 | - $hide_cat_sort = ($value===false) ? "style='display:none;'" : ''; |
|
| 723 | + $hide_cat_sort = ($value === false) ? "style='display:none;'" : ''; |
|
| 724 | 724 | } |
| 725 | 725 | |
| 726 | - $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : ''; |
|
| 726 | + $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort'] === false) ? "style='display:none;'" : ''; |
|
| 727 | 727 | ?> |
| 728 | - <li <?php echo $hide_cat_sort ;?>> |
|
| 728 | + <li <?php echo $hide_cat_sort; ?>> |
|
| 729 | 729 | <h3><?php |
| 730 | 730 | /** |
| 731 | 731 | * Filter the section title. |
@@ -744,23 +744,23 @@ discard block |
||
| 744 | 744 | <label for="cat_sort" class="gd-cf-tooltip-wrap"> |
| 745 | 745 | <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
|
| 746 | 746 | <div class="gdcf-tooltip"> |
| 747 | - <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory');?>
|
|
| 747 | + <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory'); ?>
|
|
| 748 | 748 | </div> |
| 749 | 749 | </label> |
| 750 | 750 | |
| 751 | 751 | <div class="gd-cf-input-wrap gd-switch"> |
| 752 | 752 | |
| 753 | - <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled" value="1" |
|
| 753 | + <input type="radio" id="cat_sort_yes<?php echo $radio_id; ?>" name="cat_sort" class="gdri-enabled" value="1" |
|
| 754 | 754 | <?php if ($value == '1') {
|
| 755 | 755 | echo 'checked'; |
| 756 | 756 | } ?>/> |
| 757 | - <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 757 | + <label for="cat_sort_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
|
|
| 758 | 758 | |
| 759 | - <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0" |
|
| 759 | + <input type="radio" id="cat_sort_no<?php echo $radio_id; ?>" name="cat_sort" class="gdri-disabled" value="0" |
|
| 760 | 760 | <?php if (!$value) {
|
| 761 | 761 | echo 'checked'; |
| 762 | 762 | } ?>/> |
| 763 | - <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 763 | + <label for="cat_sort_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
|
|
| 764 | 764 | |
| 765 | 765 | </div> |
| 766 | 766 | </li> |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | * @param object $field_info The current fields info. |
| 788 | 788 | * @param array $cf The custom field settings |
| 789 | 789 | */ |
| 790 | - do_action('geodir_advance_custom_fields', $field_info,$cf);?>
|
|
| 790 | + do_action('geodir_advance_custom_fields', $field_info, $cf); ?>
|
|
| 791 | 791 | |
| 792 | 792 | |
| 793 | 793 | <?php endswitch; ?> |
@@ -799,10 +799,10 @@ discard block |
||
| 799 | 799 | <h3></h3> |
| 800 | 800 | </label> |
| 801 | 801 | <div class="gd-cf-input-wrap"> |
| 802 | - <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
|
|
| 802 | + <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
|
|
| 803 | 803 | onclick="save_field('<?php echo esc_attr($result_str); ?>')"/>
|
| 804 | 804 | <?php if (!$default): ?> |
| 805 | - <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
|
|
| 805 | + <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
|
|
| 806 | 806 | onclick="delete_field('<?php echo esc_attr($result_str); ?>', '<?php echo $nonce; ?>')"
|
| 807 | 807 | class="button"/></a> |
| 808 | 808 | <?php endif; ?> |
@@ -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 | ' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . ' |
| 73 | 73 | </a> |
| 74 | 74 | </li>'; |
| 75 | - } |
|
| 76 | - } |
|
| 77 | - } |
|
| 78 | - } |
|
| 79 | - } |
|
| 80 | - //END LISTING OF POST TYPE IN MAIN NAVIGATION |
|
| 81 | - |
|
| 82 | - $view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
|
|
| 83 | - $is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false; |
|
| 84 | - if ($is_listing_sub_meny_exists) {
|
|
| 85 | - /** |
|
| 86 | - * Filter the menu li class. |
|
| 87 | - * |
|
| 88 | - * @since 1.0.0 |
|
| 89 | - * @param string $menu_class The menu HTML class. |
|
| 90 | - */ |
|
| 91 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
|
|
| 92 | - /** |
|
| 93 | - * Filter the sub menu li class. |
|
| 94 | - * |
|
| 95 | - * @since 1.0.0 |
|
| 96 | - * @param string $menu_class The menu HTML class. |
|
| 97 | - */ |
|
| 98 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 99 | - /** |
|
| 100 | - * Filter the sub menu ul class. |
|
| 101 | - * |
|
| 102 | - * @since 1.0.0 |
|
| 103 | - */ |
|
| 104 | - $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
|
|
| 105 | - /** |
|
| 106 | - * Filter the menu a class. |
|
| 107 | - * |
|
| 108 | - * @since 1.0.0 |
|
| 109 | - */ |
|
| 110 | - $a_class = apply_filters('geodir_menu_a_class', '');
|
|
| 111 | - /** |
|
| 112 | - * Filter the sub menu a class. |
|
| 113 | - * |
|
| 114 | - * @since 1.0.0 |
|
| 115 | - */ |
|
| 116 | - $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
|
|
| 117 | - $items .= '<li class="' . $li_class . '"> |
|
| 75 | + } |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | + //END LISTING OF POST TYPE IN MAIN NAVIGATION |
|
| 81 | + |
|
| 82 | + $view_posttype_listing = get_option('geodir_add_posttype_in_listing_nav');
|
|
| 83 | + $is_listing_sub_meny_exists = (!empty($view_posttype_listing)) ? true : false; |
|
| 84 | + if ($is_listing_sub_meny_exists) {
|
|
| 85 | + /** |
|
| 86 | + * Filter the menu li class. |
|
| 87 | + * |
|
| 88 | + * @since 1.0.0 |
|
| 89 | + * @param string $menu_class The menu HTML class. |
|
| 90 | + */ |
|
| 91 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class);
|
|
| 92 | + /** |
|
| 93 | + * Filter the sub menu li class. |
|
| 94 | + * |
|
| 95 | + * @since 1.0.0 |
|
| 96 | + * @param string $menu_class The menu HTML class. |
|
| 97 | + */ |
|
| 98 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 99 | + /** |
|
| 100 | + * Filter the sub menu ul class. |
|
| 101 | + * |
|
| 102 | + * @since 1.0.0 |
|
| 103 | + */ |
|
| 104 | + $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
|
|
| 105 | + /** |
|
| 106 | + * Filter the menu a class. |
|
| 107 | + * |
|
| 108 | + * @since 1.0.0 |
|
| 109 | + */ |
|
| 110 | + $a_class = apply_filters('geodir_menu_a_class', '');
|
|
| 111 | + /** |
|
| 112 | + * Filter the sub menu a class. |
|
| 113 | + * |
|
| 114 | + * @since 1.0.0 |
|
| 115 | + */ |
|
| 116 | + $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
|
|
| 117 | + $items .= '<li class="' . $li_class . '"> |
|
| 118 | 118 | <a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a>
|
| 119 | 119 | <ul class="' . $sub_ul_class . '">'; |
| 120 | - $post_types = geodir_get_posttypes('object');
|
|
| 120 | + $post_types = geodir_get_posttypes('object');
|
|
| 121 | 121 | |
| 122 | - $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
|
|
| 122 | + $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
|
|
| 123 | 123 | |
| 124 | - if (!empty($post_types)) {
|
|
| 125 | - global $geodir_add_location_url; |
|
| 126 | - $geodir_add_location_url = true; |
|
| 127 | - foreach ($post_types as $post_type => $args) {
|
|
| 128 | - if (!empty($show_listing_post_types)) {
|
|
| 129 | - if (in_array($post_type, $show_listing_post_types)) {
|
|
| 130 | - if (get_post_type_archive_link($post_type)) {
|
|
| 124 | + if (!empty($post_types)) {
|
|
| 125 | + global $geodir_add_location_url; |
|
| 126 | + $geodir_add_location_url = true; |
|
| 127 | + foreach ($post_types as $post_type => $args) {
|
|
| 128 | + if (!empty($show_listing_post_types)) {
|
|
| 129 | + if (in_array($post_type, $show_listing_post_types)) {
|
|
| 130 | + if (get_post_type_archive_link($post_type)) {
|
|
| 131 | 131 | |
| 132 | - $menu_class = ''; |
|
| 133 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
|
|
| 134 | - $menu_class = 'current-menu-item'; |
|
| 132 | + $menu_class = ''; |
|
| 133 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
|
|
| 134 | + $menu_class = 'current-menu-item'; |
|
| 135 | 135 | |
| 136 | - $items .= '<li class="' . $sub_li_class . '"> |
|
| 136 | + $items .= '<li class="' . $sub_li_class . '"> |
|
| 137 | 137 | <a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '"> |
| 138 | 138 | ' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . ' |
| 139 | 139 | </a> |
| 140 | 140 | </li>'; |
| 141 | - } |
|
| 142 | - } |
|
| 143 | - } |
|
| 144 | - } |
|
| 145 | - $geodir_add_location_url = NULL; |
|
| 146 | - } |
|
| 141 | + } |
|
| 142 | + } |
|
| 143 | + } |
|
| 144 | + } |
|
| 145 | + $geodir_add_location_url = NULL; |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | - $items .= ' </ul> '; |
|
| 149 | - /** |
|
| 150 | - * Filter called after the sub menu closing ul tag for dynamic added menu items. |
|
| 151 | - * |
|
| 152 | - * @since 1.5.9 |
|
| 153 | - */ |
|
| 154 | - $items .= apply_filters('geodir_menu_after_sub_ul','');
|
|
| 155 | - $items .= '</li>'; |
|
| 156 | - } |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - if (get_option('geodir_show_addlisting_nav')) {
|
|
| 160 | - |
|
| 161 | - $menu_class = ''; |
|
| 162 | - if (geodir_is_page('add-listing'))
|
|
| 163 | - $menu_class = 'current-menu-item'; |
|
| 164 | - |
|
| 165 | - //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
| 166 | - $post_types = geodir_get_posttypes('object');
|
|
| 167 | - $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
|
|
| 168 | - $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
|
|
| 169 | - |
|
| 170 | - if (!empty($post_types)) {
|
|
| 171 | - foreach ($post_types as $post_type => $args) {
|
|
| 172 | - if (!empty($geodir_allow_posttype_frontend)) {
|
|
| 173 | - if (in_array($post_type, $geodir_allow_posttype_frontend)) {
|
|
| 174 | - if (!empty($show_add_listing_post_types_main_nav)) {
|
|
| 175 | - if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
|
|
| 176 | - if (geodir_get_addlisting_link($post_type)) {
|
|
| 177 | - |
|
| 178 | - $menu_class = ''; |
|
| 179 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
|
|
| 180 | - $menu_class = 'current-menu-item'; |
|
| 181 | - /** |
|
| 182 | - * Filter the menu li class. |
|
| 183 | - * |
|
| 184 | - * @since 1.0.0 |
|
| 185 | - * @param string $menu_class The menu HTML class. |
|
| 186 | - */ |
|
| 187 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 188 | - /** |
|
| 189 | - * Filter the menu a class. |
|
| 190 | - * |
|
| 191 | - * @since 1.0.0 |
|
| 192 | - */ |
|
| 193 | - $a_class = apply_filters('geodir_menu_a_class', '');
|
|
| 194 | - $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
| 195 | - $items .= '<li class="' . $li_class . '"> |
|
| 148 | + $items .= ' </ul> '; |
|
| 149 | + /** |
|
| 150 | + * Filter called after the sub menu closing ul tag for dynamic added menu items. |
|
| 151 | + * |
|
| 152 | + * @since 1.5.9 |
|
| 153 | + */ |
|
| 154 | + $items .= apply_filters('geodir_menu_after_sub_ul','');
|
|
| 155 | + $items .= '</li>'; |
|
| 156 | + } |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + if (get_option('geodir_show_addlisting_nav')) {
|
|
| 160 | + |
|
| 161 | + $menu_class = ''; |
|
| 162 | + if (geodir_is_page('add-listing'))
|
|
| 163 | + $menu_class = 'current-menu-item'; |
|
| 164 | + |
|
| 165 | + //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
| 166 | + $post_types = geodir_get_posttypes('object');
|
|
| 167 | + $show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_main_nav');
|
|
| 168 | + $geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
|
|
| 169 | + |
|
| 170 | + if (!empty($post_types)) {
|
|
| 171 | + foreach ($post_types as $post_type => $args) {
|
|
| 172 | + if (!empty($geodir_allow_posttype_frontend)) {
|
|
| 173 | + if (in_array($post_type, $geodir_allow_posttype_frontend)) {
|
|
| 174 | + if (!empty($show_add_listing_post_types_main_nav)) {
|
|
| 175 | + if (in_array($post_type, $show_add_listing_post_types_main_nav)) {
|
|
| 176 | + if (geodir_get_addlisting_link($post_type)) {
|
|
| 177 | + |
|
| 178 | + $menu_class = ''; |
|
| 179 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
|
|
| 180 | + $menu_class = 'current-menu-item'; |
|
| 181 | + /** |
|
| 182 | + * Filter the menu li class. |
|
| 183 | + * |
|
| 184 | + * @since 1.0.0 |
|
| 185 | + * @param string $menu_class The menu HTML class. |
|
| 186 | + */ |
|
| 187 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 188 | + /** |
|
| 189 | + * Filter the menu a class. |
|
| 190 | + * |
|
| 191 | + * @since 1.0.0 |
|
| 192 | + */ |
|
| 193 | + $a_class = apply_filters('geodir_menu_a_class', '');
|
|
| 194 | + $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
| 195 | + $items .= '<li class="' . $li_class . '"> |
|
| 196 | 196 | <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '"> |
| 197 | 197 | ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
|
| 198 | 198 | </a> |
| 199 | 199 | </li>'; |
| 200 | - } |
|
| 201 | - } |
|
| 202 | - } |
|
| 203 | - } |
|
| 204 | - } |
|
| 205 | - } |
|
| 206 | - } |
|
| 207 | - //END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - $view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
|
|
| 211 | - $is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false; |
|
| 212 | - if ($is_add_listing_sub_meny_exists) {
|
|
| 213 | - |
|
| 214 | - if (get_option('geodir_show_addlisting_nav')) {
|
|
| 215 | - /** |
|
| 216 | - * Filter the menu li class. |
|
| 217 | - * |
|
| 218 | - * @since 1.0.0 |
|
| 219 | - * @param string $menu_class The menu HTML class. |
|
| 220 | - */ |
|
| 221 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
|
|
| 222 | - /** |
|
| 223 | - * Filter the sub menu li class. |
|
| 224 | - * |
|
| 225 | - * @since 1.0.0 |
|
| 226 | - * @param string $menu_class The menu HTML class. |
|
| 227 | - */ |
|
| 228 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 229 | - /** |
|
| 230 | - * Filter the sub menu ul class. |
|
| 231 | - * |
|
| 232 | - * @since 1.0.0 |
|
| 233 | - */ |
|
| 234 | - $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
|
|
| 235 | - /** |
|
| 236 | - * Filter the menu a class. |
|
| 237 | - * |
|
| 238 | - * @since 1.0.0 |
|
| 239 | - */ |
|
| 240 | - $a_class = apply_filters('geodir_menu_a_class', '');
|
|
| 241 | - /** |
|
| 242 | - * Filter the sub menu a class. |
|
| 243 | - * |
|
| 244 | - * @since 1.0.0 |
|
| 245 | - */ |
|
| 246 | - $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
|
|
| 247 | - $items .= '<li class="' . $li_class . '"> |
|
| 200 | + } |
|
| 201 | + } |
|
| 202 | + } |
|
| 203 | + } |
|
| 204 | + } |
|
| 205 | + } |
|
| 206 | + } |
|
| 207 | + //END SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + $view_add_posttype_listing = get_option('geodir_add_listing_link_add_listing_nav');
|
|
| 211 | + $is_add_listing_sub_meny_exists = (!empty($view_add_posttype_listing)) ? true : false; |
|
| 212 | + if ($is_add_listing_sub_meny_exists) {
|
|
| 213 | + |
|
| 214 | + if (get_option('geodir_show_addlisting_nav')) {
|
|
| 215 | + /** |
|
| 216 | + * Filter the menu li class. |
|
| 217 | + * |
|
| 218 | + * @since 1.0.0 |
|
| 219 | + * @param string $menu_class The menu HTML class. |
|
| 220 | + */ |
|
| 221 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class);
|
|
| 222 | + /** |
|
| 223 | + * Filter the sub menu li class. |
|
| 224 | + * |
|
| 225 | + * @since 1.0.0 |
|
| 226 | + * @param string $menu_class The menu HTML class. |
|
| 227 | + */ |
|
| 228 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 229 | + /** |
|
| 230 | + * Filter the sub menu ul class. |
|
| 231 | + * |
|
| 232 | + * @since 1.0.0 |
|
| 233 | + */ |
|
| 234 | + $sub_ul_class = apply_filters('geodir_sub_menu_ul_class', 'sub-menu');
|
|
| 235 | + /** |
|
| 236 | + * Filter the menu a class. |
|
| 237 | + * |
|
| 238 | + * @since 1.0.0 |
|
| 239 | + */ |
|
| 240 | + $a_class = apply_filters('geodir_menu_a_class', '');
|
|
| 241 | + /** |
|
| 242 | + * Filter the sub menu a class. |
|
| 243 | + * |
|
| 244 | + * @since 1.0.0 |
|
| 245 | + */ |
|
| 246 | + $sub_a_class = apply_filters('geodir_sub_menu_a_class', '');
|
|
| 247 | + $items .= '<li class="' . $li_class . '"> |
|
| 248 | 248 | <a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a>
|
| 249 | 249 | <ul class="' . $sub_ul_class . '">'; |
| 250 | 250 | |
| 251 | - $post_types = geodir_get_posttypes('object');
|
|
| 252 | - |
|
| 253 | - $show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
|
|
| 254 | - |
|
| 255 | - if (!empty($post_types)) {
|
|
| 256 | - foreach ($post_types as $post_type => $args) {
|
|
| 257 | - if (!empty($geodir_allow_posttype_frontend)) {
|
|
| 258 | - if (in_array($post_type, $geodir_allow_posttype_frontend)) {
|
|
| 259 | - if (!empty($show_add_listing_post_types)) {
|
|
| 260 | - if (in_array($post_type, $show_add_listing_post_types)) {
|
|
| 261 | - if (geodir_get_addlisting_link($post_type)) {
|
|
| 262 | - |
|
| 263 | - $menu_class = ''; |
|
| 264 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
|
|
| 265 | - $menu_class = 'current-menu-item'; |
|
| 266 | - /** |
|
| 267 | - * Filter the menu li class. |
|
| 268 | - * |
|
| 269 | - * @since 1.0.0 |
|
| 270 | - * @param string $menu_class The menu HTML class. |
|
| 271 | - */ |
|
| 272 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 273 | - $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
| 274 | - $items .= '<li class="' . $sub_li_class . '"> |
|
| 251 | + $post_types = geodir_get_posttypes('object');
|
|
| 252 | + |
|
| 253 | + $show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
|
|
| 254 | + |
|
| 255 | + if (!empty($post_types)) {
|
|
| 256 | + foreach ($post_types as $post_type => $args) {
|
|
| 257 | + if (!empty($geodir_allow_posttype_frontend)) {
|
|
| 258 | + if (in_array($post_type, $geodir_allow_posttype_frontend)) {
|
|
| 259 | + if (!empty($show_add_listing_post_types)) {
|
|
| 260 | + if (in_array($post_type, $show_add_listing_post_types)) {
|
|
| 261 | + if (geodir_get_addlisting_link($post_type)) {
|
|
| 262 | + |
|
| 263 | + $menu_class = ''; |
|
| 264 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
|
|
| 265 | + $menu_class = 'current-menu-item'; |
|
| 266 | + /** |
|
| 267 | + * Filter the menu li class. |
|
| 268 | + * |
|
| 269 | + * @since 1.0.0 |
|
| 270 | + * @param string $menu_class The menu HTML class. |
|
| 271 | + */ |
|
| 272 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
|
|
| 273 | + $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
|
| 274 | + $items .= '<li class="' . $sub_li_class . '"> |
|
| 275 | 275 | <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '"> |
| 276 | 276 | ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . '
|
| 277 | 277 | </a> |
| 278 | 278 | </li>'; |
| 279 | - } |
|
| 280 | - } |
|
| 281 | - } |
|
| 282 | - } |
|
| 283 | - } |
|
| 284 | - } |
|
| 285 | - } |
|
| 279 | + } |
|
| 280 | + } |
|
| 281 | + } |
|
| 282 | + } |
|
| 283 | + } |
|
| 284 | + } |
|
| 285 | + } |
|
| 286 | 286 | |
| 287 | - $items .= ' </ul> '; |
|
| 288 | - $items .= apply_filters('geodir_menu_after_sub_ul','');
|
|
| 289 | - $items .= '</li>'; |
|
| 287 | + $items .= ' </ul> '; |
|
| 288 | + $items .= apply_filters('geodir_menu_after_sub_ul','');
|
|
| 289 | + $items .= '</li>'; |
|
| 290 | 290 | |
| 291 | - } |
|
| 292 | - } |
|
| 293 | - // apply filter to add more navigations // -Filter-Location-Manager |
|
| 294 | - return $items; |
|
| 291 | + } |
|
| 292 | + } |
|
| 293 | + // apply filter to add more navigations // -Filter-Location-Manager |
|
| 294 | + return $items; |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | |
@@ -309,20 +309,20 @@ discard block |
||
| 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 | |
@@ -402,49 +402,49 @@ discard block |
||
| 402 | 402 | * @return string The post type. |
| 403 | 403 | */ |
| 404 | 404 | function geodir_get_current_posttype() {
|
| 405 | - global $wp_query, $post, $geodir_post_type; |
|
| 405 | + global $wp_query, $post, $geodir_post_type; |
|
| 406 | 406 | |
| 407 | - $geodir_post_type = get_query_var('post_type');
|
|
| 407 | + $geodir_post_type = get_query_var('post_type');
|
|
| 408 | 408 | |
| 409 | - if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
|
|
| 410 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 411 | - $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
| 412 | - elseif (isset($_REQUEST['listing_type'])) |
|
| 413 | - $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 414 | - } |
|
| 409 | + if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
|
|
| 410 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
| 411 | + $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
| 412 | + elseif (isset($_REQUEST['listing_type'])) |
|
| 413 | + $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
| 414 | + } |
|
| 415 | 415 | |
| 416 | - if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
|
|
| 417 | - $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
| 416 | + if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype']))
|
|
| 417 | + $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
| 418 | 418 | |
| 419 | - if (is_tax()) |
|
| 420 | - $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
| 419 | + if (is_tax()) |
|
| 420 | + $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
| 421 | 421 | |
| 422 | - // Retrive post type for map marker html ajax request on preview page. |
|
| 423 | - if (empty($geodir_post_type) && defined('DOING_AJAX') && !empty($post)) {
|
|
| 424 | - if (!empty($post->post_type)) {
|
|
| 425 | - $geodir_post_type = $post->post_type; |
|
| 426 | - } else if (!empty($post->listing_type)) {
|
|
| 427 | - $geodir_post_type = $post->listing_type; |
|
| 428 | - } |
|
| 429 | - } |
|
| 422 | + // Retrive post type for map marker html ajax request on preview page. |
|
| 423 | + if (empty($geodir_post_type) && defined('DOING_AJAX') && !empty($post)) {
|
|
| 424 | + if (!empty($post->post_type)) {
|
|
| 425 | + $geodir_post_type = $post->post_type; |
|
| 426 | + } else if (!empty($post->listing_type)) {
|
|
| 427 | + $geodir_post_type = $post->listing_type; |
|
| 428 | + } |
|
| 429 | + } |
|
| 430 | 430 | |
| 431 | - $all_postypes = geodir_get_posttypes(); |
|
| 432 | - $all_postypes = stripslashes_deep($all_postypes); |
|
| 431 | + $all_postypes = geodir_get_posttypes(); |
|
| 432 | + $all_postypes = stripslashes_deep($all_postypes); |
|
| 433 | 433 | |
| 434 | - if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
|
| 435 | - $geodir_post_type = ''; |
|
| 434 | + if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
|
| 435 | + $geodir_post_type = ''; |
|
| 436 | 436 | |
| 437 | - if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
|
|
| 438 | - $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
| 439 | - } |
|
| 437 | + if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
|
|
| 438 | + $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
| 439 | + } |
|
| 440 | 440 | |
| 441 | 441 | |
| 442 | - /** |
|
| 443 | - * Filter the default CPT return. |
|
| 444 | - * |
|
| 445 | - * @since 1.6.9 |
|
| 446 | - */ |
|
| 447 | - return apply_filters('geodir_get_current_posttype',$geodir_post_type);
|
|
| 442 | + /** |
|
| 443 | + * Filter the default CPT return. |
|
| 444 | + * |
|
| 445 | + * @since 1.6.9 |
|
| 446 | + */ |
|
| 447 | + return apply_filters('geodir_get_current_posttype',$geodir_post_type);
|
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | /** |
@@ -458,22 +458,22 @@ discard block |
||
| 458 | 458 | */ |
| 459 | 459 | function geodir_get_default_posttype() |
| 460 | 460 | {
|
| 461 | - $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) ); |
|
| 462 | - |
|
| 463 | - $stype = false; |
|
| 464 | - foreach ( $post_types as $post_type => $info ) {
|
|
| 465 | - global $wpdb; |
|
| 466 | - $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) ); |
|
| 467 | - if ( $has_posts ) {
|
|
| 468 | - $stype = $post_type; break; |
|
| 469 | - } |
|
| 470 | - } |
|
| 471 | - |
|
| 472 | - if(!$stype){
|
|
| 473 | - $stype = 'gd_place'; |
|
| 474 | - } |
|
| 475 | - |
|
| 476 | - return $stype; |
|
| 461 | + $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) ); |
|
| 462 | + |
|
| 463 | + $stype = false; |
|
| 464 | + foreach ( $post_types as $post_type => $info ) {
|
|
| 465 | + global $wpdb; |
|
| 466 | + $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) ); |
|
| 467 | + if ( $has_posts ) {
|
|
| 468 | + $stype = $post_type; break; |
|
| 469 | + } |
|
| 470 | + } |
|
| 471 | + |
|
| 472 | + if(!$stype){
|
|
| 473 | + $stype = 'gd_place'; |
|
| 474 | + } |
|
| 475 | + |
|
| 476 | + return $stype; |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | /** |
@@ -487,21 +487,21 @@ discard block |
||
| 487 | 487 | */ |
| 488 | 488 | function geodir_get_posttypes($output = 'names') |
| 489 | 489 | {
|
| 490 | - $post_types = array(); |
|
| 491 | - $post_types = get_option('geodir_post_types');
|
|
| 492 | - $post_types = stripslashes_deep($post_types); |
|
| 493 | - if (!empty($post_types)) {
|
|
| 494 | - switch ($output): |
|
| 495 | - case 'object': |
|
| 496 | - case 'Object': |
|
| 497 | - $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types; |
|
| 498 | - break; |
|
| 499 | - case 'array': |
|
| 500 | - case 'Array': |
|
| 501 | - $post_types = (array)$post_types; |
|
| 502 | - break; |
|
| 490 | + $post_types = array(); |
|
| 491 | + $post_types = get_option('geodir_post_types');
|
|
| 492 | + $post_types = stripslashes_deep($post_types); |
|
| 493 | + if (!empty($post_types)) {
|
|
| 494 | + switch ($output): |
|
| 495 | + case 'object': |
|
| 496 | + case 'Object': |
|
| 497 | + $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types; |
|
| 498 | + break; |
|
| 499 | + case 'array': |
|
| 500 | + case 'Array': |
|
| 501 | + $post_types = (array)$post_types; |
|
| 502 | + break; |
|
| 503 | 503 | case 'options': |
| 504 | - $post_types = (array)$post_types; |
|
| 504 | + $post_types = (array)$post_types; |
|
| 505 | 505 | |
| 506 | 506 | $options = array(); |
| 507 | 507 | if (!empty($post_types)) {
|
@@ -510,17 +510,17 @@ discard block |
||
| 510 | 510 | } |
| 511 | 511 | } |
| 512 | 512 | $post_types = $options; |
| 513 | - break; |
|
| 514 | - default: |
|
| 515 | - $post_types = array_keys($post_types); |
|
| 516 | - break; |
|
| 517 | - endswitch; |
|
| 518 | - } |
|
| 519 | - |
|
| 520 | - if (!empty($post_types)) |
|
| 521 | - return $post_types; |
|
| 522 | - else |
|
| 523 | - return array(); |
|
| 513 | + break; |
|
| 514 | + default: |
|
| 515 | + $post_types = array_keys($post_types); |
|
| 516 | + break; |
|
| 517 | + endswitch; |
|
| 518 | + } |
|
| 519 | + |
|
| 520 | + if (!empty($post_types)) |
|
| 521 | + return $post_types; |
|
| 522 | + else |
|
| 523 | + return array(); |
|
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | /** |
@@ -533,104 +533,104 @@ discard block |
||
| 533 | 533 | */ |
| 534 | 534 | function geodir_get_posttype_info($post_type = '') |
| 535 | 535 | {
|
| 536 | - $post_types = array(); |
|
| 537 | - $post_types = get_option('geodir_post_types');
|
|
| 538 | - $post_types = stripslashes_deep($post_types); |
|
| 539 | - if (!empty($post_types) && $post_type != '') {
|
|
| 540 | - return $post_types[$post_type]; |
|
| 541 | - } else |
|
| 542 | - return false; |
|
| 536 | + $post_types = array(); |
|
| 537 | + $post_types = get_option('geodir_post_types');
|
|
| 538 | + $post_types = stripslashes_deep($post_types); |
|
| 539 | + if (!empty($post_types) && $post_type != '') {
|
|
| 540 | + return $post_types[$post_type]; |
|
| 541 | + } else |
|
| 542 | + return false; |
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | if (!function_exists('geodir_get_taxonomies')) {
|
| 546 | - /** |
|
| 547 | - * Get all custom taxonomies. |
|
| 548 | - * |
|
| 549 | - * @since 1.0.0 |
|
| 550 | - * @package GeoDirectory |
|
| 551 | - * @param string $post_type The post type. |
|
| 552 | - * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
| 553 | - * @return array|bool Taxonomies on success. false on failure. |
|
| 554 | - */ |
|
| 555 | - function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false) {
|
|
| 556 | - $taxonomies = array(); |
|
| 557 | - $gd_taxonomies = array(); |
|
| 558 | - |
|
| 559 | - if ($taxonomies = get_option('geodir_taxonomies')) {
|
|
| 560 | - $gd_taxonomies = array_keys($taxonomies); |
|
| 561 | - |
|
| 562 | - if ($post_type != '') {
|
|
| 563 | - $gd_taxonomies = array(); |
|
| 564 | - } |
|
| 546 | + /** |
|
| 547 | + * Get all custom taxonomies. |
|
| 548 | + * |
|
| 549 | + * @since 1.0.0 |
|
| 550 | + * @package GeoDirectory |
|
| 551 | + * @param string $post_type The post type. |
|
| 552 | + * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
| 553 | + * @return array|bool Taxonomies on success. false on failure. |
|
| 554 | + */ |
|
| 555 | + function geodir_get_taxonomies($post_type = '', $tages_taxonomies = false) {
|
|
| 556 | + $taxonomies = array(); |
|
| 557 | + $gd_taxonomies = array(); |
|
| 558 | + |
|
| 559 | + if ($taxonomies = get_option('geodir_taxonomies')) {
|
|
| 560 | + $gd_taxonomies = array_keys($taxonomies); |
|
| 561 | + |
|
| 562 | + if ($post_type != '') {
|
|
| 563 | + $gd_taxonomies = array(); |
|
| 564 | + } |
|
| 565 | 565 | |
| 566 | - $i = 0; |
|
| 567 | - foreach ($taxonomies as $taxonomy => $args) {
|
|
| 568 | - if ($post_type != '' && $args['object_type'] == $post_type) {
|
|
| 569 | - $gd_taxonomies[] = $taxonomy; |
|
| 570 | - } |
|
| 566 | + $i = 0; |
|
| 567 | + foreach ($taxonomies as $taxonomy => $args) {
|
|
| 568 | + if ($post_type != '' && $args['object_type'] == $post_type) {
|
|
| 569 | + $gd_taxonomies[] = $taxonomy; |
|
| 570 | + } |
|
| 571 | 571 | |
| 572 | - if ($tages_taxonomies === false && substr($taxonomy , -5) == '_tags') {
|
|
| 573 | - if (array_search($taxonomy, $gd_taxonomies) !== false) {
|
|
| 574 | - unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
|
| 575 | - } |
|
| 576 | - } |
|
| 577 | - } |
|
| 572 | + if ($tages_taxonomies === false && substr($taxonomy , -5) == '_tags') {
|
|
| 573 | + if (array_search($taxonomy, $gd_taxonomies) !== false) {
|
|
| 574 | + unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
|
| 575 | + } |
|
| 576 | + } |
|
| 577 | + } |
|
| 578 | 578 | |
| 579 | - $gd_taxonomies = array_values($gd_taxonomies); |
|
| 580 | - } |
|
| 581 | - |
|
| 582 | - /** |
|
| 583 | - * Filter the taxonomies. |
|
| 584 | - * |
|
| 585 | - * @since 1.0.0 |
|
| 586 | - * @param array $gd_taxonomies The taxonomy array. |
|
| 587 | - */ |
|
| 588 | - $taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
|
|
| 589 | - |
|
| 590 | - if (!empty($taxonomies)) {
|
|
| 591 | - return $taxonomies; |
|
| 592 | - } else {
|
|
| 593 | - return false; |
|
| 594 | - } |
|
| 595 | - } |
|
| 579 | + $gd_taxonomies = array_values($gd_taxonomies); |
|
| 580 | + } |
|
| 581 | + |
|
| 582 | + /** |
|
| 583 | + * Filter the taxonomies. |
|
| 584 | + * |
|
| 585 | + * @since 1.0.0 |
|
| 586 | + * @param array $gd_taxonomies The taxonomy array. |
|
| 587 | + */ |
|
| 588 | + $taxonomies = apply_filters('geodir_taxonomy', $gd_taxonomies);
|
|
| 589 | + |
|
| 590 | + if (!empty($taxonomies)) {
|
|
| 591 | + return $taxonomies; |
|
| 592 | + } else {
|
|
| 593 | + return false; |
|
| 594 | + } |
|
| 595 | + } |
|
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | if (!function_exists(' geodir_get_categories_dl')) {
|
| 599 | - /** |
|
| 600 | - * Get categories dropdown HTML. |
|
| 601 | - * |
|
| 602 | - * @since 1.0.0 |
|
| 603 | - * @package GeoDirectory |
|
| 604 | - * @param string $post_type The post type. |
|
| 605 | - * @param string $selected The selected value. |
|
| 606 | - * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
| 607 | - * @param bool $echo Prints the HTML when set to true. Default: true. |
|
| 608 | - * @return void|string Dropdown HTML. |
|
| 609 | - */ |
|
| 610 | - function geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true) |
|
| 611 | - {
|
|
| 612 | - |
|
| 613 | - $html = ''; |
|
| 614 | - $taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies); |
|
| 615 | - |
|
| 616 | - $categories = get_terms($taxonomies); |
|
| 617 | - |
|
| 618 | - $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
|
|
| 619 | - |
|
| 620 | - foreach ($categories as $category_obj) {
|
|
| 621 | - $select_opt = ''; |
|
| 622 | - if ($selected == $category_obj->term_id) {
|
|
| 623 | - $select_opt = 'selected="selected"'; |
|
| 624 | - } |
|
| 625 | - $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">' |
|
| 626 | - . geodir_utf8_ucfirst($category_obj->name) . '</option>'; |
|
| 627 | - } |
|
| 628 | - |
|
| 629 | - if ($echo) |
|
| 630 | - echo $html; |
|
| 631 | - else |
|
| 632 | - return $html; |
|
| 633 | - } |
|
| 599 | + /** |
|
| 600 | + * Get categories dropdown HTML. |
|
| 601 | + * |
|
| 602 | + * @since 1.0.0 |
|
| 603 | + * @package GeoDirectory |
|
| 604 | + * @param string $post_type The post type. |
|
| 605 | + * @param string $selected The selected value. |
|
| 606 | + * @param bool $tages_taxonomies Is this a tag taxonomy?. Default: false. |
|
| 607 | + * @param bool $echo Prints the HTML when set to true. Default: true. |
|
| 608 | + * @return void|string Dropdown HTML. |
|
| 609 | + */ |
|
| 610 | + function geodir_get_categories_dl($post_type = '', $selected = '', $tages_taxonomies = false, $echo = true) |
|
| 611 | + {
|
|
| 612 | + |
|
| 613 | + $html = ''; |
|
| 614 | + $taxonomies = geodir_get_taxonomies($post_type, $tages_taxonomies); |
|
| 615 | + |
|
| 616 | + $categories = get_terms($taxonomies); |
|
| 617 | + |
|
| 618 | + $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
|
|
| 619 | + |
|
| 620 | + foreach ($categories as $category_obj) {
|
|
| 621 | + $select_opt = ''; |
|
| 622 | + if ($selected == $category_obj->term_id) {
|
|
| 623 | + $select_opt = 'selected="selected"'; |
|
| 624 | + } |
|
| 625 | + $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">' |
|
| 626 | + . geodir_utf8_ucfirst($category_obj->name) . '</option>'; |
|
| 627 | + } |
|
| 628 | + |
|
| 629 | + if ($echo) |
|
| 630 | + echo $html; |
|
| 631 | + else |
|
| 632 | + return $html; |
|
| 633 | + } |
|
| 634 | 634 | } |
| 635 | 635 | |
| 636 | 636 | |
@@ -645,28 +645,28 @@ discard block |
||
| 645 | 645 | function geodir_get_listing_slug($object_type = '') |
| 646 | 646 | {
|
| 647 | 647 | |
| 648 | - $listing_slug = ''; |
|
| 648 | + $listing_slug = ''; |
|
| 649 | 649 | |
| 650 | - $post_types = get_option('geodir_post_types');
|
|
| 651 | - $taxonomies = get_option('geodir_taxonomies');
|
|
| 650 | + $post_types = get_option('geodir_post_types');
|
|
| 651 | + $taxonomies = get_option('geodir_taxonomies');
|
|
| 652 | 652 | |
| 653 | 653 | |
| 654 | - if ($object_type != '') {
|
|
| 655 | - if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
|
|
| 654 | + if ($object_type != '') {
|
|
| 655 | + if (!empty($post_types) && array_key_exists($object_type, $post_types)) {
|
|
| 656 | 656 | |
| 657 | - $object_info = $post_types[$object_type]; |
|
| 658 | - $listing_slug = $object_info['listing_slug']; |
|
| 659 | - } elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
|
|
| 660 | - $object_info = $taxonomies[$object_type]; |
|
| 661 | - $listing_slug = $object_info['listing_slug']; |
|
| 662 | - } |
|
| 657 | + $object_info = $post_types[$object_type]; |
|
| 658 | + $listing_slug = $object_info['listing_slug']; |
|
| 659 | + } elseif (!empty($taxonomies) && array_key_exists($object_type, $taxonomies)) {
|
|
| 660 | + $object_info = $taxonomies[$object_type]; |
|
| 661 | + $listing_slug = $object_info['listing_slug']; |
|
| 662 | + } |
|
| 663 | 663 | |
| 664 | - } |
|
| 664 | + } |
|
| 665 | 665 | |
| 666 | - if (!empty($listing_slug)) |
|
| 667 | - return $listing_slug; |
|
| 668 | - else |
|
| 669 | - return false; |
|
| 666 | + if (!empty($listing_slug)) |
|
| 667 | + return $listing_slug; |
|
| 668 | + else |
|
| 669 | + return false; |
|
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | |
@@ -681,212 +681,212 @@ discard block |
||
| 681 | 681 | */ |
| 682 | 682 | function geodir_get_taxonomy_posttype($taxonomy = '') |
| 683 | 683 | {
|
| 684 | - global $wp_query; |
|
| 685 | - |
|
| 686 | - $post_type = array(); |
|
| 687 | - $taxonomies = array(); |
|
| 688 | - |
|
| 689 | - if (!empty($taxonomy)) {
|
|
| 690 | - $taxonomies[] = $taxonomy; |
|
| 691 | - } elseif (isset($wp_query->tax_query->queries)) {
|
|
| 692 | - $tax_arr = $wp_query->tax_query->queries; |
|
| 693 | - //if tax query has 'relation' set then it will break wp_list_pluck so we remove it |
|
| 694 | - if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
|
|
| 695 | - $taxonomies = wp_list_pluck($tax_arr, 'taxonomy'); |
|
| 696 | - } |
|
| 697 | - |
|
| 698 | - if (!empty($taxonomies)) {
|
|
| 699 | - foreach (geodir_get_posttypes() as $pt) {
|
|
| 700 | - $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt); |
|
| 701 | - if (array_intersect($taxonomies, $object_taxonomies)) |
|
| 702 | - $post_type[] = $pt; |
|
| 703 | - } |
|
| 704 | - } |
|
| 705 | - |
|
| 706 | - if (!empty($post_type)) |
|
| 707 | - return $post_type[0]; |
|
| 708 | - else |
|
| 709 | - return false; |
|
| 684 | + global $wp_query; |
|
| 685 | + |
|
| 686 | + $post_type = array(); |
|
| 687 | + $taxonomies = array(); |
|
| 688 | + |
|
| 689 | + if (!empty($taxonomy)) {
|
|
| 690 | + $taxonomies[] = $taxonomy; |
|
| 691 | + } elseif (isset($wp_query->tax_query->queries)) {
|
|
| 692 | + $tax_arr = $wp_query->tax_query->queries; |
|
| 693 | + //if tax query has 'relation' set then it will break wp_list_pluck so we remove it |
|
| 694 | + if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
|
|
| 695 | + $taxonomies = wp_list_pluck($tax_arr, 'taxonomy'); |
|
| 696 | + } |
|
| 697 | + |
|
| 698 | + if (!empty($taxonomies)) {
|
|
| 699 | + foreach (geodir_get_posttypes() as $pt) {
|
|
| 700 | + $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt); |
|
| 701 | + if (array_intersect($taxonomies, $object_taxonomies)) |
|
| 702 | + $post_type[] = $pt; |
|
| 703 | + } |
|
| 704 | + } |
|
| 705 | + |
|
| 706 | + if (!empty($post_type)) |
|
| 707 | + return $post_type[0]; |
|
| 708 | + else |
|
| 709 | + return false; |
|
| 710 | 710 | } |
| 711 | 711 | |
| 712 | 712 | if (!function_exists('geodir_custom_taxonomy_walker')) {
|
| 713 | - /** |
|
| 714 | - * Custom taxonomy walker function. |
|
| 715 | - * |
|
| 716 | - * @since 1.0.0 |
|
| 717 | - * @package GeoDirectory |
|
| 718 | - * @param string $cat_taxonomy The taxonomy name. |
|
| 719 | - * @param int $cat_parent The parent term ID. |
|
| 720 | - * @param bool $hide_empty Hide empty taxonomies? Default: false. |
|
| 721 | - * @param int $pading CSS padding in pixels. |
|
| 722 | - * @return string|void taxonomy HTML. |
|
| 723 | - */ |
|
| 724 | - function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0) |
|
| 725 | - {
|
|
| 726 | - global $cat_display, $post_cat, $exclude_cats; |
|
| 727 | - |
|
| 728 | - $search_terms = trim($post_cat, ","); |
|
| 729 | - |
|
| 730 | - $search_terms = explode(",", $search_terms);
|
|
| 731 | - |
|
| 732 | - $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
|
|
| 733 | - |
|
| 734 | - $display = ''; |
|
| 735 | - $onchange = ''; |
|
| 736 | - $term_check = ''; |
|
| 737 | - $main_list_class = ''; |
|
| 738 | - $out = ''; |
|
| 739 | - //If there are terms, start displaying |
|
| 740 | - if (count($cat_terms) > 0) {
|
|
| 741 | - //Displaying as a list |
|
| 742 | - $p = $pading * 20; |
|
| 743 | - $pading++; |
|
| 744 | - |
|
| 745 | - |
|
| 746 | - if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
|
|
| 747 | - if ($cat_parent == 0) {
|
|
| 748 | - $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display; |
|
| 749 | - $main_list_class = 'class="main_list_selecter"'; |
|
| 750 | - } else {
|
|
| 751 | - //$display = 'display:none'; |
|
| 752 | - $list_class = 'sub_list gd-sub-cats-list'; |
|
| 753 | - } |
|
| 754 | - } |
|
| 713 | + /** |
|
| 714 | + * Custom taxonomy walker function. |
|
| 715 | + * |
|
| 716 | + * @since 1.0.0 |
|
| 717 | + * @package GeoDirectory |
|
| 718 | + * @param string $cat_taxonomy The taxonomy name. |
|
| 719 | + * @param int $cat_parent The parent term ID. |
|
| 720 | + * @param bool $hide_empty Hide empty taxonomies? Default: false. |
|
| 721 | + * @param int $pading CSS padding in pixels. |
|
| 722 | + * @return string|void taxonomy HTML. |
|
| 723 | + */ |
|
| 724 | + function geodir_custom_taxonomy_walker($cat_taxonomy, $cat_parent = 0, $hide_empty = false, $pading = 0) |
|
| 725 | + {
|
|
| 726 | + global $cat_display, $post_cat, $exclude_cats; |
|
| 727 | + |
|
| 728 | + $search_terms = trim($post_cat, ","); |
|
| 729 | + |
|
| 730 | + $search_terms = explode(",", $search_terms);
|
|
| 731 | + |
|
| 732 | + $cat_terms = get_terms($cat_taxonomy, array('parent' => $cat_parent, 'hide_empty' => $hide_empty, 'exclude' => $exclude_cats));
|
|
| 733 | + |
|
| 734 | + $display = ''; |
|
| 735 | + $onchange = ''; |
|
| 736 | + $term_check = ''; |
|
| 737 | + $main_list_class = ''; |
|
| 738 | + $out = ''; |
|
| 739 | + //If there are terms, start displaying |
|
| 740 | + if (count($cat_terms) > 0) {
|
|
| 741 | + //Displaying as a list |
|
| 742 | + $p = $pading * 20; |
|
| 743 | + $pading++; |
|
| 744 | + |
|
| 745 | + |
|
| 746 | + if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
|
|
| 747 | + if ($cat_parent == 0) {
|
|
| 748 | + $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display; |
|
| 749 | + $main_list_class = 'class="main_list_selecter"'; |
|
| 750 | + } else {
|
|
| 751 | + //$display = 'display:none'; |
|
| 752 | + $list_class = 'sub_list gd-sub-cats-list'; |
|
| 753 | + } |
|
| 754 | + } |
|
| 755 | 755 | |
| 756 | - if ($cat_display == 'checkbox' || $cat_display == 'radio') {
|
|
| 757 | - $p = 0; |
|
| 758 | - $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
| 759 | - } |
|
| 756 | + if ($cat_display == 'checkbox' || $cat_display == 'radio') {
|
|
| 757 | + $p = 0; |
|
| 758 | + $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
| 759 | + } |
|
| 760 | 760 | |
| 761 | - foreach ($cat_terms as $cat_term) {
|
|
| 761 | + foreach ($cat_terms as $cat_term) {
|
|
| 762 | 762 | |
| 763 | - $checked = ''; |
|
| 763 | + $checked = ''; |
|
| 764 | 764 | |
| 765 | - if (in_array($cat_term->term_id, $search_terms)) {
|
|
| 766 | - if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 767 | - $checked = 'selected="selected"'; |
|
| 768 | - else |
|
| 769 | - $checked = 'checked="checked"'; |
|
| 770 | - } |
|
| 765 | + if (in_array($cat_term->term_id, $search_terms)) {
|
|
| 766 | + if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 767 | + $checked = 'selected="selected"'; |
|
| 768 | + else |
|
| 769 | + $checked = 'checked="checked"'; |
|
| 770 | + } |
|
| 771 | 771 | |
| 772 | - if ($cat_display == 'radio') |
|
| 773 | - $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
| 774 | - elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 775 | - $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
| 772 | + if ($cat_display == 'radio') |
|
| 773 | + $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
| 774 | + elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
|
| 775 | + $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
| 776 | 776 | |
| 777 | - else {
|
|
| 778 | - $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
| 779 | - } |
|
| 777 | + else {
|
|
| 778 | + $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
| 779 | + } |
|
| 780 | 780 | |
| 781 | - // Call recurson to print sub cats |
|
| 782 | - $out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading); |
|
| 781 | + // Call recurson to print sub cats |
|
| 782 | + $out .= geodir_custom_taxonomy_walker($cat_taxonomy, $cat_term->term_id, $hide_empty, $pading); |
|
| 783 | 783 | |
| 784 | - } |
|
| 784 | + } |
|
| 785 | 785 | |
| 786 | - if ($cat_display == 'checkbox' || $cat_display == 'radio') |
|
| 787 | - $out .= '</div>'; |
|
| 786 | + if ($cat_display == 'checkbox' || $cat_display == 'radio') |
|
| 787 | + $out .= '</div>'; |
|
| 788 | 788 | |
| 789 | - return $out; |
|
| 790 | - } |
|
| 791 | - return; |
|
| 792 | - } |
|
| 789 | + return $out; |
|
| 790 | + } |
|
| 791 | + return; |
|
| 792 | + } |
|
| 793 | 793 | } |
| 794 | 794 | |
| 795 | 795 | if (!function_exists('geodir_custom_taxonomy_walker2')) {
|
| 796 | - /** |
|
| 797 | - * Custom taxonomy walker function. |
|
| 798 | - * |
|
| 799 | - * @since 1.0.0 |
|
| 800 | - * @package GeoDirectory |
|
| 801 | - * @global object $post WordPress Post object. |
|
| 802 | - * @global object $gd_session GeoDirectory Session object. |
|
| 803 | - * @param string $cat_taxonomy The taxonomy name. |
|
| 804 | - * @param string $cat_limit Number of categories to display. |
|
| 805 | - */ |
|
| 806 | - function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '') |
|
| 807 | - {
|
|
| 808 | - $post_category = ''; |
|
| 809 | - $post_category_str = ''; |
|
| 810 | - global $exclude_cats, $gd_session; |
|
| 811 | - |
|
| 812 | - $cat_exclude = ''; |
|
| 813 | - if (is_array($exclude_cats) && !empty($exclude_cats)) |
|
| 814 | - $cat_exclude = serialize($exclude_cats); |
|
| 815 | - |
|
| 816 | - if (isset($_REQUEST['backandedit'])) {
|
|
| 817 | - $post = (object)$gd_session->get('listing');
|
|
| 818 | - |
|
| 819 | - if (!is_array($post->post_category[$cat_taxonomy])) |
|
| 820 | - $post_category = $post->post_category[$cat_taxonomy]; |
|
| 821 | - |
|
| 822 | - $post_categories = $post->post_category_str; |
|
| 823 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) |
|
| 824 | - $post_category_str = $post_categories[$cat_taxonomy]; |
|
| 825 | - |
|
| 826 | - } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
|
|
| 827 | - global $post; |
|
| 828 | - |
|
| 829 | - $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true); |
|
| 830 | - if (empty($post_category) && isset($post->{$cat_taxonomy})) {
|
|
| 831 | - $post_category = $post->{$cat_taxonomy};
|
|
| 832 | - } |
|
| 796 | + /** |
|
| 797 | + * Custom taxonomy walker function. |
|
| 798 | + * |
|
| 799 | + * @since 1.0.0 |
|
| 800 | + * @package GeoDirectory |
|
| 801 | + * @global object $post WordPress Post object. |
|
| 802 | + * @global object $gd_session GeoDirectory Session object. |
|
| 803 | + * @param string $cat_taxonomy The taxonomy name. |
|
| 804 | + * @param string $cat_limit Number of categories to display. |
|
| 805 | + */ |
|
| 806 | + function geodir_custom_taxonomy_walker2($cat_taxonomy, $cat_limit = '') |
|
| 807 | + {
|
|
| 808 | + $post_category = ''; |
|
| 809 | + $post_category_str = ''; |
|
| 810 | + global $exclude_cats, $gd_session; |
|
| 811 | + |
|
| 812 | + $cat_exclude = ''; |
|
| 813 | + if (is_array($exclude_cats) && !empty($exclude_cats)) |
|
| 814 | + $cat_exclude = serialize($exclude_cats); |
|
| 815 | + |
|
| 816 | + if (isset($_REQUEST['backandedit'])) {
|
|
| 817 | + $post = (object)$gd_session->get('listing');
|
|
| 818 | + |
|
| 819 | + if (!is_array($post->post_category[$cat_taxonomy])) |
|
| 820 | + $post_category = $post->post_category[$cat_taxonomy]; |
|
| 821 | + |
|
| 822 | + $post_categories = $post->post_category_str; |
|
| 823 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) |
|
| 824 | + $post_category_str = $post_categories[$cat_taxonomy]; |
|
| 825 | + |
|
| 826 | + } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) {
|
|
| 827 | + global $post; |
|
| 828 | + |
|
| 829 | + $post_category = geodir_get_post_meta($post->ID, $cat_taxonomy, true); |
|
| 830 | + if (empty($post_category) && isset($post->{$cat_taxonomy})) {
|
|
| 831 | + $post_category = $post->{$cat_taxonomy};
|
|
| 832 | + } |
|
| 833 | 833 | |
| 834 | - $post_categories = get_post_meta($post->ID, 'post_categories', true); |
|
| 834 | + $post_categories = get_post_meta($post->ID, 'post_categories', true); |
|
| 835 | 835 | |
| 836 | - if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
|
|
| 837 | - foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
|
|
| 838 | - if (is_numeric($cat_part)) {
|
|
| 839 | - $cat_part_arr[] = $cat_part; |
|
| 840 | - } |
|
| 841 | - } |
|
| 842 | - if (is_array($cat_part_arr)) {
|
|
| 843 | - $post_category = implode(',', $cat_part_arr);
|
|
| 844 | - } |
|
| 845 | - } |
|
| 836 | + if (empty($post_category) && !empty($post_categories) && !empty($post_categories[$cat_taxonomy])) {
|
|
| 837 | + foreach (explode(",", $post_categories[$cat_taxonomy]) as $cat_part) {
|
|
| 838 | + if (is_numeric($cat_part)) {
|
|
| 839 | + $cat_part_arr[] = $cat_part; |
|
| 840 | + } |
|
| 841 | + } |
|
| 842 | + if (is_array($cat_part_arr)) {
|
|
| 843 | + $post_category = implode(',', $cat_part_arr);
|
|
| 844 | + } |
|
| 845 | + } |
|
| 846 | 846 | |
| 847 | - if (!empty($post_category)) {
|
|
| 848 | - $cat1 = array_filter(explode(',', $post_category));
|
|
| 849 | - $post_category = ',' . implode(',', $cat1) . ',';
|
|
| 847 | + if (!empty($post_category)) {
|
|
| 848 | + $cat1 = array_filter(explode(',', $post_category));
|
|
| 849 | + $post_category = ',' . implode(',', $cat1) . ',';
|
|
| 850 | 850 | |
| 851 | - } |
|
| 851 | + } |
|
| 852 | 852 | |
| 853 | - if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
|
|
| 853 | + if ($post_category != '' && is_array($exclude_cats) && !empty($exclude_cats)) {
|
|
| 854 | 854 | |
| 855 | - $post_category_upd = explode(',', $post_category);
|
|
| 856 | - $post_category_change = ''; |
|
| 857 | - foreach ($post_category_upd as $cat) {
|
|
| 855 | + $post_category_upd = explode(',', $post_category);
|
|
| 856 | + $post_category_change = ''; |
|
| 857 | + foreach ($post_category_upd as $cat) {
|
|
| 858 | 858 | |
| 859 | - if (!in_array($cat, $exclude_cats) && $cat != '') {
|
|
| 860 | - $post_category_change .= ',' . $cat; |
|
| 861 | - } |
|
| 862 | - } |
|
| 863 | - $post_category = $post_category_change; |
|
| 864 | - } |
|
| 859 | + if (!in_array($cat, $exclude_cats) && $cat != '') {
|
|
| 860 | + $post_category_change .= ',' . $cat; |
|
| 861 | + } |
|
| 862 | + } |
|
| 863 | + $post_category = $post_category_change; |
|
| 864 | + } |
|
| 865 | 865 | |
| 866 | 866 | |
| 867 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
|
|
| 868 | - $post_category_str = $post_categories[$cat_taxonomy]; |
|
| 869 | - } |
|
| 870 | - } |
|
| 867 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
|
|
| 868 | + $post_category_str = $post_categories[$cat_taxonomy]; |
|
| 869 | + } |
|
| 870 | + } |
|
| 871 | 871 | |
| 872 | - echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']" />'; |
|
| 872 | + echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']" />'; |
|
| 873 | 873 | |
| 874 | - echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']" />'; |
|
| 874 | + echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']" />'; |
|
| 875 | 875 | |
| 876 | - echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']" />'; |
|
| 876 | + echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']" />'; |
|
| 877 | 877 | |
| 878 | 878 | |
| 879 | - ?> |
|
| 879 | + ?> |
|
| 880 | 880 | <div class="cat_sublist"> |
| 881 | 881 | <?php |
| 882 | 882 | |
| 883 | - $post_id = isset($post->ID) ? $post->ID : ''; |
|
| 883 | + $post_id = isset($post->ID) ? $post->ID : ''; |
|
| 884 | 884 | |
| 885 | - if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
|
|
| 885 | + if ((geodir_is_page('add-listing') || is_admin()) && !empty($post_categories[$cat_taxonomy])) {
|
|
| 886 | 886 | |
| 887 | - geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories); |
|
| 888 | - } |
|
| 889 | - ?> |
|
| 887 | + geodir_editpost_categories_html($cat_taxonomy, $post_id, $post_categories); |
|
| 888 | + } |
|
| 889 | + ?> |
|
| 890 | 890 | </div> |
| 891 | 891 | <script type="text/javascript"> |
| 892 | 892 | |
@@ -1009,22 +1009,22 @@ discard block |
||
| 1009 | 1009 | |
| 1010 | 1010 | </script> |
| 1011 | 1011 | <?php |
| 1012 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
|
|
| 1013 | - $post_cat_str = $post_categories[$cat_taxonomy]; |
|
| 1014 | - $post_cat_array = explode("#", $post_cat_str);
|
|
| 1015 | - if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) |
|
| 1016 | - $style = "display:none;"; |
|
| 1017 | - } |
|
| 1018 | - ?> |
|
| 1012 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) {
|
|
| 1013 | + $post_cat_str = $post_categories[$cat_taxonomy]; |
|
| 1014 | + $post_cat_array = explode("#", $post_cat_str);
|
|
| 1015 | + if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) |
|
| 1016 | + $style = "display:none;"; |
|
| 1017 | + } |
|
| 1018 | + ?> |
|
| 1019 | 1019 | <div class="main_cat_list" style=" <?php if (isset($style)) {
|
| 1020 | - echo $style; |
|
| 1021 | - }?> "> |
|
| 1020 | + echo $style; |
|
| 1021 | + }?> "> |
|
| 1022 | 1022 | <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
| 1023 | - ?> |
|
| 1023 | + ?> |
|
| 1024 | 1024 | </div> |
| 1025 | 1025 | <?php |
| 1026 | 1026 | |
| 1027 | - } |
|
| 1027 | + } |
|
| 1028 | 1028 | } |
| 1029 | 1029 | |
| 1030 | 1030 | /** |
@@ -1041,23 +1041,23 @@ discard block |
||
| 1041 | 1041 | */ |
| 1042 | 1042 | function geodir_addpost_categories_html($request_taxonomy, $parrent, $selected = false, $main_selected = true, $default = false, $exclude = '') |
| 1043 | 1043 | {
|
| 1044 | - global $exclude_cats; |
|
| 1044 | + global $exclude_cats; |
|
| 1045 | 1045 | |
| 1046 | - if ($exclude != '') {
|
|
| 1047 | - $exclude_cats = maybe_unserialize(base64_decode($exclude)); |
|
| 1046 | + if ($exclude != '') {
|
|
| 1047 | + $exclude_cats = maybe_unserialize(base64_decode($exclude)); |
|
| 1048 | 1048 | |
| 1049 | - if(is_array( $exclude_cats)){
|
|
| 1050 | - $exclude_cats = array_map( 'intval', $exclude_cats ); |
|
| 1051 | - }else{
|
|
| 1052 | - $exclude_cats = intval($exclude_cats); |
|
| 1053 | - } |
|
| 1049 | + if(is_array( $exclude_cats)){
|
|
| 1050 | + $exclude_cats = array_map( 'intval', $exclude_cats ); |
|
| 1051 | + }else{
|
|
| 1052 | + $exclude_cats = intval($exclude_cats); |
|
| 1053 | + } |
|
| 1054 | 1054 | |
| 1055 | - } |
|
| 1055 | + } |
|
| 1056 | 1056 | |
| 1057 | - if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) || |
|
| 1058 | - (!is_array($exclude_cats) || empty($exclude_cats)) |
|
| 1059 | - ) {
|
|
| 1060 | - ?> |
|
| 1057 | + if ((is_array($exclude_cats) && !empty($exclude_cats) && !in_array($parrent, $exclude_cats)) || |
|
| 1058 | + (!is_array($exclude_cats) || empty($exclude_cats)) |
|
| 1059 | + ) {
|
|
| 1060 | + ?> |
|
| 1061 | 1061 | |
| 1062 | 1062 | <?php $main_cat = get_term($parrent, $request_taxonomy); ?> |
| 1063 | 1063 | |
@@ -1086,8 +1086,8 @@ discard block |
||
| 1086 | 1086 | |
| 1087 | 1087 | <br/> |
| 1088 | 1088 | <?php |
| 1089 | - $cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
|
|
| 1090 | - if (!empty($cat_terms)) { ?>
|
|
| 1089 | + $cat_terms = get_terms($request_taxonomy, array('parent' => $main_cat->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats));
|
|
| 1090 | + if (!empty($cat_terms)) { ?>
|
|
| 1091 | 1091 | <span> <?php printf(__('Add listing in category', 'geodirectory')); ?></span>
|
| 1092 | 1092 | <?php geodir_get_catlist($request_taxonomy, $parrent, $selected) ?> |
| 1093 | 1093 | <?php } ?> |
@@ -1109,53 +1109,53 @@ discard block |
||
| 1109 | 1109 | function geodir_editpost_categories_html($request_taxonomy, $request_postid, $post_categories) |
| 1110 | 1110 | {
|
| 1111 | 1111 | |
| 1112 | - if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
|
|
| 1113 | - $post_cat_str = $post_categories[$request_taxonomy]; |
|
| 1114 | - $post_cat_array = explode("#", $post_cat_str);
|
|
| 1115 | - if (is_array($post_cat_array)) {
|
|
| 1116 | - $post_cat_array = array_unique( $post_cat_array ); |
|
| 1112 | + if (!empty($post_categories) && array_key_exists($request_taxonomy, $post_categories)) {
|
|
| 1113 | + $post_cat_str = $post_categories[$request_taxonomy]; |
|
| 1114 | + $post_cat_array = explode("#", $post_cat_str);
|
|
| 1115 | + if (is_array($post_cat_array)) {
|
|
| 1116 | + $post_cat_array = array_unique( $post_cat_array ); |
|
| 1117 | 1117 | |
| 1118 | 1118 | foreach ($post_cat_array as $post_cat_html) {
|
| 1119 | 1119 | |
| 1120 | - $post_cat_info = explode(":", $post_cat_html);
|
|
| 1121 | - $post_maincat_str = $post_cat_info[0]; |
|
| 1120 | + $post_cat_info = explode(":", $post_cat_html);
|
|
| 1121 | + $post_maincat_str = $post_cat_info[0]; |
|
| 1122 | 1122 | |
| 1123 | - if (!empty($post_maincat_str)) {
|
|
| 1124 | - $post_maincat_info = explode(",", $post_maincat_str);
|
|
| 1125 | - $post_maincat_id = $post_maincat_info[0]; |
|
| 1126 | - ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
| 1127 | - (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
| 1128 | - } |
|
| 1129 | - $post_sub_catid = ''; |
|
| 1130 | - if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
|
|
| 1131 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
| 1132 | - } |
|
| 1123 | + if (!empty($post_maincat_str)) {
|
|
| 1124 | + $post_maincat_info = explode(",", $post_maincat_str);
|
|
| 1125 | + $post_maincat_id = $post_maincat_info[0]; |
|
| 1126 | + ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
| 1127 | + (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
| 1128 | + } |
|
| 1129 | + $post_sub_catid = ''; |
|
| 1130 | + if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
|
|
| 1131 | + $post_sub_catid = (int)$post_cat_info[1]; |
|
| 1132 | + } |
|
| 1133 | 1133 | |
| 1134 | - geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
| 1134 | + geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
| 1135 | 1135 | |
| 1136 | - } |
|
| 1137 | - } else {
|
|
| 1136 | + } |
|
| 1137 | + } else {
|
|
| 1138 | 1138 | |
| 1139 | - $post_cat_info = explode(":", $post_cat_str);
|
|
| 1140 | - $post_maincat_str = $post_cat_info[0]; |
|
| 1139 | + $post_cat_info = explode(":", $post_cat_str);
|
|
| 1140 | + $post_maincat_str = $post_cat_info[0]; |
|
| 1141 | 1141 | |
| 1142 | - $post_sub_catid = ''; |
|
| 1142 | + $post_sub_catid = ''; |
|
| 1143 | 1143 | |
| 1144 | - if (!empty($post_maincat_str)) {
|
|
| 1145 | - $post_maincat_info = explode(",", $post_maincat_str);
|
|
| 1146 | - $post_maincat_id = $post_maincat_info[0]; |
|
| 1147 | - ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
| 1148 | - (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
| 1149 | - } |
|
| 1144 | + if (!empty($post_maincat_str)) {
|
|
| 1145 | + $post_maincat_info = explode(",", $post_maincat_str);
|
|
| 1146 | + $post_maincat_id = $post_maincat_info[0]; |
|
| 1147 | + ($post_maincat_info[1] == 'y') ? $post_maincat_selected = true : $post_maincat_selected = false; |
|
| 1148 | + (end($post_maincat_info) == 'd') ? $post_maincat_default = true : $post_maincat_default = false; |
|
| 1149 | + } |
|
| 1150 | 1150 | |
| 1151 | - if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
|
|
| 1152 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
| 1153 | - } |
|
| 1151 | + if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
|
|
| 1152 | + $post_sub_catid = (int)$post_cat_info[1]; |
|
| 1153 | + } |
|
| 1154 | 1154 | |
| 1155 | - geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
| 1155 | + geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
|
| 1156 | 1156 | |
| 1157 | - } |
|
| 1158 | - } |
|
| 1157 | + } |
|
| 1158 | + } |
|
| 1159 | 1159 | } |
| 1160 | 1160 | |
| 1161 | 1161 | /** |
@@ -1169,35 +1169,35 @@ discard block |
||
| 1169 | 1169 | */ |
| 1170 | 1170 | function geodir_get_catlist($cat_taxonomy, $parrent = 0, $selected = false) |
| 1171 | 1171 | {
|
| 1172 | - global $exclude_cats; |
|
| 1172 | + global $exclude_cats; |
|
| 1173 | 1173 | |
| 1174 | - $cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
|
|
| 1174 | + $cat_terms = get_terms($cat_taxonomy, array('parent' => $parrent, 'hide_empty' => false, 'exclude' => $exclude_cats));
|
|
| 1175 | 1175 | |
| 1176 | - if (!empty($cat_terms)) {
|
|
| 1177 | - $onchange = ''; |
|
| 1178 | - $onchange = ' onchange="show_subcatlist(this.value, this)" '; |
|
| 1176 | + if (!empty($cat_terms)) {
|
|
| 1177 | + $onchange = ''; |
|
| 1178 | + $onchange = ' onchange="show_subcatlist(this.value, this)" '; |
|
| 1179 | 1179 | |
| 1180 | - $option_selected = ''; |
|
| 1181 | - if (!$selected) |
|
| 1182 | - $option_slected = ' selected="selected" '; |
|
| 1180 | + $option_selected = ''; |
|
| 1181 | + if (!$selected) |
|
| 1182 | + $option_slected = ' selected="selected" '; |
|
| 1183 | 1183 | |
| 1184 | - echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
|
| 1184 | + echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
|
| 1185 | 1185 | |
| 1186 | - echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
|
|
| 1186 | + echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
|
|
| 1187 | 1187 | |
| 1188 | - foreach ($cat_terms as $cat_term) {
|
|
| 1189 | - $option_selected = ''; |
|
| 1190 | - if ($selected == $cat_term->term_id) |
|
| 1191 | - $option_selected = ' selected="selected" '; |
|
| 1188 | + foreach ($cat_terms as $cat_term) {
|
|
| 1189 | + $option_selected = ''; |
|
| 1190 | + if ($selected == $cat_term->term_id) |
|
| 1191 | + $option_selected = ' selected="selected" '; |
|
| 1192 | 1192 | |
| 1193 | - // Count child terms |
|
| 1194 | - $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
|
| 1195 | - $has_child = !empty( $child_terms ) ? 't' : 'f'; |
|
| 1193 | + // Count child terms |
|
| 1194 | + $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
|
| 1195 | + $has_child = !empty( $child_terms ) ? 't' : 'f'; |
|
| 1196 | 1196 | |
| 1197 | - echo '<option ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
| 1198 | - } |
|
| 1199 | - echo '</select>'; |
|
| 1200 | - } |
|
| 1197 | + echo '<option ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
| 1198 | + } |
|
| 1199 | + echo '</select>'; |
|
| 1200 | + } |
|
| 1201 | 1201 | } |
| 1202 | 1202 | |
| 1203 | 1203 | /** |
@@ -1213,28 +1213,28 @@ discard block |
||
| 1213 | 1213 | */ |
| 1214 | 1214 | function geodir_custom_update_messages($messages) |
| 1215 | 1215 | {
|
| 1216 | - global $post, $post_ID; |
|
| 1217 | - |
|
| 1218 | - $post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
|
|
| 1219 | - |
|
| 1220 | - foreach ($post_types as $post_type => $post_object) {
|
|
| 1221 | - |
|
| 1222 | - $messages[$post_type] = array( |
|
| 1223 | - 0 => '', // Unused. Messages start at index 1. |
|
| 1224 | - 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),
|
|
| 1225 | - 2 => __('Custom field updated.', 'geodirectory'),
|
|
| 1226 | - 3 => __('Custom field deleted.', 'geodirectory'),
|
|
| 1227 | - 4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
|
|
| 1228 | - 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,
|
|
| 1229 | - 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),
|
|
| 1230 | - 7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
|
|
| 1231 | - 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),
|
|
| 1232 | - 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),
|
|
| 1233 | - 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),
|
|
| 1234 | - ); |
|
| 1235 | - } |
|
| 1236 | - |
|
| 1237 | - return $messages; |
|
| 1216 | + global $post, $post_ID; |
|
| 1217 | + |
|
| 1218 | + $post_types = get_post_types(array('show_ui' => true, '_builtin' => false), 'objects');
|
|
| 1219 | + |
|
| 1220 | + foreach ($post_types as $post_type => $post_object) {
|
|
| 1221 | + |
|
| 1222 | + $messages[$post_type] = array( |
|
| 1223 | + 0 => '', // Unused. Messages start at index 1. |
|
| 1224 | + 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),
|
|
| 1225 | + 2 => __('Custom field updated.', 'geodirectory'),
|
|
| 1226 | + 3 => __('Custom field deleted.', 'geodirectory'),
|
|
| 1227 | + 4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
|
|
| 1228 | + 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,
|
|
| 1229 | + 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),
|
|
| 1230 | + 7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
|
|
| 1231 | + 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),
|
|
| 1232 | + 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),
|
|
| 1233 | + 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),
|
|
| 1234 | + ); |
|
| 1235 | + } |
|
| 1236 | + |
|
| 1237 | + return $messages; |
|
| 1238 | 1238 | } |
| 1239 | 1239 | |
| 1240 | 1240 | |
@@ -1249,182 +1249,182 @@ discard block |
||
| 1249 | 1249 | function geodir_register_defaults() |
| 1250 | 1250 | {
|
| 1251 | 1251 | |
| 1252 | - global $wpdb; |
|
| 1253 | - |
|
| 1254 | - $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
|
| 1255 | - |
|
| 1256 | - if (!$listing_slug = get_option('geodir_listing_prefix'))
|
|
| 1257 | - $listing_slug = 'places'; |
|
| 1258 | - |
|
| 1259 | - /** |
|
| 1260 | - * Taxonomies |
|
| 1261 | - **/ |
|
| 1262 | - //if ( ! taxonomy_exists('gd_place_tags') )
|
|
| 1263 | - {
|
|
| 1264 | - |
|
| 1265 | - $gd_placetags = array(); |
|
| 1266 | - $gd_placetags['object_type'] = 'gd_place'; |
|
| 1267 | - $gd_placetags['listing_slug'] = $listing_slug . '/tags'; |
|
| 1268 | - $gd_placetags['args'] = array( |
|
| 1269 | - 'public' => true, |
|
| 1270 | - 'hierarchical' => false, |
|
| 1271 | - 'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
|
|
| 1272 | - 'query_var' => true, |
|
| 1273 | - |
|
| 1274 | - 'labels' => array( |
|
| 1275 | - 'name' => __('Place Tags', 'geodirectory'),
|
|
| 1276 | - 'singular_name' => __('Place Tag', 'geodirectory'),
|
|
| 1277 | - 'search_items' => __('Search Place Tags', 'geodirectory'),
|
|
| 1278 | - 'popular_items' => __('Popular Place Tags', 'geodirectory'),
|
|
| 1279 | - 'all_items' => __('All Place Tags', 'geodirectory'),
|
|
| 1280 | - 'edit_item' => __('Edit Place Tag', 'geodirectory'),
|
|
| 1281 | - 'update_item' => __('Update Place Tag', 'geodirectory'),
|
|
| 1282 | - 'add_new_item' => __('Add New Place Tag', 'geodirectory'),
|
|
| 1283 | - 'new_item_name' => __('New Place Tag Name', 'geodirectory'),
|
|
| 1284 | - 'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
|
|
| 1285 | - 'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
|
|
| 1286 | - 'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
|
|
| 1287 | - ), |
|
| 1288 | - ); |
|
| 1289 | - |
|
| 1290 | - |
|
| 1291 | - $geodir_taxonomies = get_option('geodir_taxonomies');
|
|
| 1292 | - $geodir_taxonomies['gd_place_tags'] = $gd_placetags; |
|
| 1293 | - update_option('geodir_taxonomies', $geodir_taxonomies);
|
|
| 1294 | - |
|
| 1295 | - |
|
| 1296 | - // Update post types and delete tmp options |
|
| 1297 | - flush_rewrite_rules(); |
|
| 1298 | - |
|
| 1299 | - } |
|
| 1300 | - |
|
| 1301 | - //if ( ! taxonomy_exists('gd_placecategory') )
|
|
| 1302 | - {
|
|
| 1303 | - |
|
| 1304 | - $gd_placecategory = array(); |
|
| 1305 | - $gd_placecategory['object_type'] = 'gd_place'; |
|
| 1306 | - $gd_placecategory['listing_slug'] = $listing_slug; |
|
| 1307 | - $gd_placecategory['args'] = array( |
|
| 1308 | - 'public' => true, |
|
| 1309 | - 'hierarchical' => true, |
|
| 1310 | - 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
|
|
| 1311 | - 'query_var' => true, |
|
| 1312 | - 'labels' => array( |
|
| 1313 | - 'name' => __('Place Categories', 'geodirectory'),
|
|
| 1314 | - 'singular_name' => __('Place Category', 'geodirectory'),
|
|
| 1315 | - 'search_items' => __('Search Place Categories', 'geodirectory'),
|
|
| 1316 | - 'popular_items' => __('Popular Place Categories', 'geodirectory'),
|
|
| 1317 | - 'all_items' => __('All Place Categories', 'geodirectory'),
|
|
| 1318 | - 'edit_item' => __('Edit Place Category', 'geodirectory'),
|
|
| 1319 | - 'update_item' => __('Update Place Category', 'geodirectory'),
|
|
| 1320 | - 'add_new_item' => __('Add New Place Category', 'geodirectory'),
|
|
| 1321 | - 'new_item_name' => __('New Place Category', 'geodirectory'),
|
|
| 1322 | - 'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
|
|
| 1323 | - ), |
|
| 1324 | - ); |
|
| 1325 | - |
|
| 1326 | - |
|
| 1327 | - $geodir_taxonomies = get_option('geodir_taxonomies');
|
|
| 1328 | - $geodir_taxonomies['gd_placecategory'] = $gd_placecategory; |
|
| 1329 | - update_option('geodir_taxonomies', $geodir_taxonomies);
|
|
| 1330 | - |
|
| 1331 | - |
|
| 1332 | - flush_rewrite_rules(); |
|
| 1333 | - } |
|
| 1334 | - |
|
| 1335 | - /** |
|
| 1336 | - * Post Types |
|
| 1337 | - **/ |
|
| 1338 | - |
|
| 1339 | - //if ( ! post_type_exists('gd_place') )
|
|
| 1340 | - {
|
|
| 1341 | - |
|
| 1342 | - $labels = array( |
|
| 1343 | - 'name' => __('Places', 'geodirectory'),
|
|
| 1344 | - 'singular_name' => __('Place', 'geodirectory'),
|
|
| 1345 | - 'add_new' => __('Add New', 'geodirectory'),
|
|
| 1346 | - 'add_new_item' => __('Add New Place', 'geodirectory'),
|
|
| 1347 | - 'edit_item' => __('Edit Place', 'geodirectory'),
|
|
| 1348 | - 'new_item' => __('New Place', 'geodirectory'),
|
|
| 1349 | - 'view_item' => __('View Place', 'geodirectory'),
|
|
| 1350 | - 'search_items' => __('Search Places', 'geodirectory'),
|
|
| 1351 | - 'not_found' => __('No Place Found', 'geodirectory'),
|
|
| 1352 | - 'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
|
|
| 1353 | - |
|
| 1354 | - $place_default = array( |
|
| 1355 | - 'labels' => $labels, |
|
| 1356 | - 'can_export' => true, |
|
| 1357 | - 'capability_type' => 'post', |
|
| 1358 | - 'description' => 'Place post type.', |
|
| 1359 | - 'has_archive' => $listing_slug, |
|
| 1360 | - 'hierarchical' => false, |
|
| 1361 | - 'map_meta_cap' => true, |
|
| 1362 | - 'menu_icon' => $menu_icon, |
|
| 1363 | - 'public' => true, |
|
| 1364 | - 'query_var' => true, |
|
| 1365 | - 'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
|
|
| 1366 | - 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
|
|
| 1367 | - 'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
|
|
| 1368 | - |
|
| 1369 | - //Update custom post types |
|
| 1370 | - $geodir_post_types = get_option('geodir_post_types');
|
|
| 1371 | - $geodir_post_types['gd_place'] = $place_default; |
|
| 1372 | - update_option('geodir_post_types', $geodir_post_types);
|
|
| 1373 | - |
|
| 1374 | - // Update post types and delete tmp options |
|
| 1375 | - flush_rewrite_rules(); |
|
| 1376 | - } |
|
| 1377 | - |
|
| 1378 | - |
|
| 1379 | - geodir_register_taxonomies(); |
|
| 1380 | - geodir_register_post_types(); |
|
| 1381 | - |
|
| 1382 | - //die; |
|
| 1252 | + global $wpdb; |
|
| 1253 | + |
|
| 1254 | + $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
|
| 1255 | + |
|
| 1256 | + if (!$listing_slug = get_option('geodir_listing_prefix'))
|
|
| 1257 | + $listing_slug = 'places'; |
|
| 1258 | + |
|
| 1259 | + /** |
|
| 1260 | + * Taxonomies |
|
| 1261 | + **/ |
|
| 1262 | + //if ( ! taxonomy_exists('gd_place_tags') )
|
|
| 1263 | + {
|
|
| 1264 | + |
|
| 1265 | + $gd_placetags = array(); |
|
| 1266 | + $gd_placetags['object_type'] = 'gd_place'; |
|
| 1267 | + $gd_placetags['listing_slug'] = $listing_slug . '/tags'; |
|
| 1268 | + $gd_placetags['args'] = array( |
|
| 1269 | + 'public' => true, |
|
| 1270 | + 'hierarchical' => false, |
|
| 1271 | + 'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
|
|
| 1272 | + 'query_var' => true, |
|
| 1273 | + |
|
| 1274 | + 'labels' => array( |
|
| 1275 | + 'name' => __('Place Tags', 'geodirectory'),
|
|
| 1276 | + 'singular_name' => __('Place Tag', 'geodirectory'),
|
|
| 1277 | + 'search_items' => __('Search Place Tags', 'geodirectory'),
|
|
| 1278 | + 'popular_items' => __('Popular Place Tags', 'geodirectory'),
|
|
| 1279 | + 'all_items' => __('All Place Tags', 'geodirectory'),
|
|
| 1280 | + 'edit_item' => __('Edit Place Tag', 'geodirectory'),
|
|
| 1281 | + 'update_item' => __('Update Place Tag', 'geodirectory'),
|
|
| 1282 | + 'add_new_item' => __('Add New Place Tag', 'geodirectory'),
|
|
| 1283 | + 'new_item_name' => __('New Place Tag Name', 'geodirectory'),
|
|
| 1284 | + 'add_or_remove_items' => __('Add or remove Place tags', 'geodirectory'),
|
|
| 1285 | + 'choose_from_most_used' => __('Choose from the most used Place tags', 'geodirectory'),
|
|
| 1286 | + 'separate_items_with_commas' => __('Separate Place tags with commas', 'geodirectory'),
|
|
| 1287 | + ), |
|
| 1288 | + ); |
|
| 1289 | + |
|
| 1290 | + |
|
| 1291 | + $geodir_taxonomies = get_option('geodir_taxonomies');
|
|
| 1292 | + $geodir_taxonomies['gd_place_tags'] = $gd_placetags; |
|
| 1293 | + update_option('geodir_taxonomies', $geodir_taxonomies);
|
|
| 1294 | + |
|
| 1295 | + |
|
| 1296 | + // Update post types and delete tmp options |
|
| 1297 | + flush_rewrite_rules(); |
|
| 1298 | + |
|
| 1299 | + } |
|
| 1300 | + |
|
| 1301 | + //if ( ! taxonomy_exists('gd_placecategory') )
|
|
| 1302 | + {
|
|
| 1303 | + |
|
| 1304 | + $gd_placecategory = array(); |
|
| 1305 | + $gd_placecategory['object_type'] = 'gd_place'; |
|
| 1306 | + $gd_placecategory['listing_slug'] = $listing_slug; |
|
| 1307 | + $gd_placecategory['args'] = array( |
|
| 1308 | + 'public' => true, |
|
| 1309 | + 'hierarchical' => true, |
|
| 1310 | + 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true),
|
|
| 1311 | + 'query_var' => true, |
|
| 1312 | + 'labels' => array( |
|
| 1313 | + 'name' => __('Place Categories', 'geodirectory'),
|
|
| 1314 | + 'singular_name' => __('Place Category', 'geodirectory'),
|
|
| 1315 | + 'search_items' => __('Search Place Categories', 'geodirectory'),
|
|
| 1316 | + 'popular_items' => __('Popular Place Categories', 'geodirectory'),
|
|
| 1317 | + 'all_items' => __('All Place Categories', 'geodirectory'),
|
|
| 1318 | + 'edit_item' => __('Edit Place Category', 'geodirectory'),
|
|
| 1319 | + 'update_item' => __('Update Place Category', 'geodirectory'),
|
|
| 1320 | + 'add_new_item' => __('Add New Place Category', 'geodirectory'),
|
|
| 1321 | + 'new_item_name' => __('New Place Category', 'geodirectory'),
|
|
| 1322 | + 'add_or_remove_items' => __('Add or remove Place categories', 'geodirectory'),
|
|
| 1323 | + ), |
|
| 1324 | + ); |
|
| 1325 | + |
|
| 1326 | + |
|
| 1327 | + $geodir_taxonomies = get_option('geodir_taxonomies');
|
|
| 1328 | + $geodir_taxonomies['gd_placecategory'] = $gd_placecategory; |
|
| 1329 | + update_option('geodir_taxonomies', $geodir_taxonomies);
|
|
| 1330 | + |
|
| 1331 | + |
|
| 1332 | + flush_rewrite_rules(); |
|
| 1333 | + } |
|
| 1334 | + |
|
| 1335 | + /** |
|
| 1336 | + * Post Types |
|
| 1337 | + **/ |
|
| 1338 | + |
|
| 1339 | + //if ( ! post_type_exists('gd_place') )
|
|
| 1340 | + {
|
|
| 1341 | + |
|
| 1342 | + $labels = array( |
|
| 1343 | + 'name' => __('Places', 'geodirectory'),
|
|
| 1344 | + 'singular_name' => __('Place', 'geodirectory'),
|
|
| 1345 | + 'add_new' => __('Add New', 'geodirectory'),
|
|
| 1346 | + 'add_new_item' => __('Add New Place', 'geodirectory'),
|
|
| 1347 | + 'edit_item' => __('Edit Place', 'geodirectory'),
|
|
| 1348 | + 'new_item' => __('New Place', 'geodirectory'),
|
|
| 1349 | + 'view_item' => __('View Place', 'geodirectory'),
|
|
| 1350 | + 'search_items' => __('Search Places', 'geodirectory'),
|
|
| 1351 | + 'not_found' => __('No Place Found', 'geodirectory'),
|
|
| 1352 | + 'not_found_in_trash' => __('No Place Found In Trash', 'geodirectory'));
|
|
| 1353 | + |
|
| 1354 | + $place_default = array( |
|
| 1355 | + 'labels' => $labels, |
|
| 1356 | + 'can_export' => true, |
|
| 1357 | + 'capability_type' => 'post', |
|
| 1358 | + 'description' => 'Place post type.', |
|
| 1359 | + 'has_archive' => $listing_slug, |
|
| 1360 | + 'hierarchical' => false, |
|
| 1361 | + 'map_meta_cap' => true, |
|
| 1362 | + 'menu_icon' => $menu_icon, |
|
| 1363 | + 'public' => true, |
|
| 1364 | + 'query_var' => true, |
|
| 1365 | + 'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
|
|
| 1366 | + 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
|
|
| 1367 | + 'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
|
|
| 1368 | + |
|
| 1369 | + //Update custom post types |
|
| 1370 | + $geodir_post_types = get_option('geodir_post_types');
|
|
| 1371 | + $geodir_post_types['gd_place'] = $place_default; |
|
| 1372 | + update_option('geodir_post_types', $geodir_post_types);
|
|
| 1373 | + |
|
| 1374 | + // Update post types and delete tmp options |
|
| 1375 | + flush_rewrite_rules(); |
|
| 1376 | + } |
|
| 1377 | + |
|
| 1378 | + |
|
| 1379 | + geodir_register_taxonomies(); |
|
| 1380 | + geodir_register_post_types(); |
|
| 1381 | + |
|
| 1382 | + //die; |
|
| 1383 | 1383 | |
| 1384 | 1384 | } |
| 1385 | 1385 | |
| 1386 | 1386 | $gd_wpml_get_languages = ""; |
| 1387 | 1387 | function gd_wpml_get_lang_from_url($url) {
|
| 1388 | - global $sitepress, $gd_wpml_get_languages; |
|
| 1388 | + global $sitepress, $gd_wpml_get_languages; |
|
| 1389 | 1389 | |
| 1390 | - if (geodir_is_wpml()) {
|
|
| 1391 | - return $sitepress->get_language_from_url($url); |
|
| 1392 | - } |
|
| 1390 | + if (geodir_is_wpml()) {
|
|
| 1391 | + return $sitepress->get_language_from_url($url); |
|
| 1392 | + } |
|
| 1393 | 1393 | |
| 1394 | - if (isset($_REQUEST['lang']) && $_REQUEST['lang']) {
|
|
| 1395 | - return $_REQUEST['lang']; |
|
| 1396 | - } |
|
| 1394 | + if (isset($_REQUEST['lang']) && $_REQUEST['lang']) {
|
|
| 1395 | + return $_REQUEST['lang']; |
|
| 1396 | + } |
|
| 1397 | 1397 | |
| 1398 | - $url = str_replace(array("http://","https://"),"",$url);
|
|
| 1398 | + $url = str_replace(array("http://","https://"),"",$url);
|
|
| 1399 | 1399 | |
| 1400 | - // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
|
|
| 1401 | - $site_url = str_replace(array("http://","https://"),"",site_url());
|
|
| 1400 | + // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
|
|
| 1401 | + $site_url = str_replace(array("http://","https://"),"",site_url());
|
|
| 1402 | 1402 | |
| 1403 | - $url = str_replace($site_url,"",$url); |
|
| 1403 | + $url = str_replace($site_url,"",$url); |
|
| 1404 | 1404 | |
| 1405 | - $segments = explode('/', trim($url, '/'));
|
|
| 1405 | + $segments = explode('/', trim($url, '/'));
|
|
| 1406 | 1406 | |
| 1407 | - if ($gd_wpml_get_languages) {
|
|
| 1408 | - $langs = $gd_wpml_get_languages; |
|
| 1409 | - } else {
|
|
| 1410 | - $gd_wpml_get_languages = $sitepress->get_active_languages(); |
|
| 1411 | - } |
|
| 1407 | + if ($gd_wpml_get_languages) {
|
|
| 1408 | + $langs = $gd_wpml_get_languages; |
|
| 1409 | + } else {
|
|
| 1410 | + $gd_wpml_get_languages = $sitepress->get_active_languages(); |
|
| 1411 | + } |
|
| 1412 | 1412 | |
| 1413 | - if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
|
|
| 1414 | - return $segments[0]; |
|
| 1415 | - } |
|
| 1413 | + if (isset($segments[0]) && $segments[0] && array_key_exists($segments[0], $gd_wpml_get_languages)) {
|
|
| 1414 | + return $segments[0]; |
|
| 1415 | + } |
|
| 1416 | 1416 | |
| 1417 | - return false; |
|
| 1417 | + return false; |
|
| 1418 | 1418 | } |
| 1419 | 1419 | |
| 1420 | 1420 | function gd_wpml_slug_translation_turned_on($post_type) {
|
| 1421 | 1421 | |
| 1422 | - global $sitepress; |
|
| 1423 | - $settings = $sitepress->get_settings(); |
|
| 1424 | - return isset($settings['posts_slug_translation']['types'][$post_type]) |
|
| 1425 | - && $settings['posts_slug_translation']['types'][$post_type] |
|
| 1426 | - && isset($settings['posts_slug_translation']['on']) |
|
| 1427 | - && $settings['posts_slug_translation']['on']; |
|
| 1422 | + global $sitepress; |
|
| 1423 | + $settings = $sitepress->get_settings(); |
|
| 1424 | + return isset($settings['posts_slug_translation']['types'][$post_type]) |
|
| 1425 | + && $settings['posts_slug_translation']['types'][$post_type] |
|
| 1426 | + && isset($settings['posts_slug_translation']['on']) |
|
| 1427 | + && $settings['posts_slug_translation']['on']; |
|
| 1428 | 1428 | } |
| 1429 | 1429 | |
| 1430 | 1430 | |
@@ -1451,162 +1451,162 @@ discard block |
||
| 1451 | 1451 | */ |
| 1452 | 1452 | function geodir_listing_permalink_structure($post_link, $post_obj, $leavename, $sample) |
| 1453 | 1453 | {
|
| 1454 | - //echo $post_link."<br />".$sample ; |
|
| 1454 | + //echo $post_link."<br />".$sample ; |
|
| 1455 | 1455 | |
| 1456 | 1456 | |
| 1457 | - global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache; |
|
| 1458 | - if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
|
|
| 1459 | - if($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending'){return $post_link;}
|
|
| 1460 | - } elseif (isset($post_obj->post_status) && ($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending')) {
|
|
| 1461 | - return $post_link; |
|
| 1462 | - } else {
|
|
| 1463 | - $orig_post = $post; |
|
| 1464 | - $post = $post_obj; |
|
| 1465 | - } |
|
| 1457 | + global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache; |
|
| 1458 | + if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
|
|
| 1459 | + if($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending'){return $post_link;}
|
|
| 1460 | + } elseif (isset($post_obj->post_status) && ($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending')) {
|
|
| 1461 | + return $post_link; |
|
| 1462 | + } else {
|
|
| 1463 | + $orig_post = $post; |
|
| 1464 | + $post = $post_obj; |
|
| 1465 | + } |
|
| 1466 | 1466 | |
| 1467 | 1467 | |
| 1468 | 1468 | |
| 1469 | - if (in_array($post->post_type, geodir_get_posttypes())) {//print_r($post );exit;
|
|
| 1469 | + if (in_array($post->post_type, geodir_get_posttypes())) {//print_r($post );exit;
|
|
| 1470 | 1470 | |
| 1471 | 1471 | |
| 1472 | - // if we dont have a GD post then try to grab it |
|
| 1473 | - if(!isset($post->default_category)){
|
|
| 1474 | - $gd_post = geodir_get_post_info($post->ID); |
|
| 1475 | - if(!empty($gd_post)){
|
|
| 1476 | - $post = $gd_post; |
|
| 1477 | - } |
|
| 1478 | - } |
|
| 1472 | + // if we dont have a GD post then try to grab it |
|
| 1473 | + if(!isset($post->default_category)){
|
|
| 1474 | + $gd_post = geodir_get_post_info($post->ID); |
|
| 1475 | + if(!empty($gd_post)){
|
|
| 1476 | + $post = $gd_post; |
|
| 1477 | + } |
|
| 1478 | + } |
|
| 1479 | 1479 | |
| 1480 | 1480 | |
| 1481 | - $post_types = get_option('geodir_post_types');
|
|
| 1482 | - $slug = $post_types[$post->post_type]['rewrite']['slug']; |
|
| 1481 | + $post_types = get_option('geodir_post_types');
|
|
| 1482 | + $slug = $post_types[$post->post_type]['rewrite']['slug']; |
|
| 1483 | 1483 | |
| 1484 | - // Alter the CPT slug if WPML is set to do so |
|
| 1485 | - if(geodir_wpml_is_post_type_translated($post->post_type)){
|
|
| 1486 | - if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
|
|
| 1484 | + // Alter the CPT slug if WPML is set to do so |
|
| 1485 | + if(geodir_wpml_is_post_type_translated($post->post_type)){
|
|
| 1486 | + if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
|
|
| 1487 | 1487 | |
| 1488 | - $org_slug = $slug; |
|
| 1489 | - $slug = apply_filters( 'wpml_translate_single_string', |
|
| 1490 | - $slug, |
|
| 1491 | - 'WordPress', |
|
| 1492 | - 'URL slug: ' . $slug, |
|
| 1493 | - $language_code); |
|
| 1488 | + $org_slug = $slug; |
|
| 1489 | + $slug = apply_filters( 'wpml_translate_single_string', |
|
| 1490 | + $slug, |
|
| 1491 | + 'WordPress', |
|
| 1492 | + 'URL slug: ' . $slug, |
|
| 1493 | + $language_code); |
|
| 1494 | 1494 | |
| 1495 | - if(!$slug){$slug = $org_slug;}
|
|
| 1495 | + if(!$slug){$slug = $org_slug;}
|
|
| 1496 | 1496 | |
| 1497 | - } |
|
| 1498 | - } |
|
| 1497 | + } |
|
| 1498 | + } |
|
| 1499 | 1499 | |
| 1500 | - if (function_exists('geodir_location_geo_home_link')) {
|
|
| 1501 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
|
|
| 1502 | - } |
|
| 1500 | + if (function_exists('geodir_location_geo_home_link')) {
|
|
| 1501 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
|
|
| 1502 | + } |
|
| 1503 | 1503 | |
| 1504 | - // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz. |
|
| 1505 | - $site_url = trailingslashit(get_bloginfo('url'));
|
|
| 1504 | + // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz. |
|
| 1505 | + $site_url = trailingslashit(get_bloginfo('url'));
|
|
| 1506 | 1506 | |
| 1507 | - if (function_exists('geodir_location_geo_home_link')) {
|
|
| 1508 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
|
|
| 1509 | - } |
|
| 1510 | - |
|
| 1511 | - $fix_url = strpos($post_link, $site_url) === 0 ? true : false; |
|
| 1512 | - if ($fix_url) {
|
|
| 1513 | - $post_link = str_replace($site_url, '', $post_link); |
|
| 1514 | - } |
|
| 1515 | - |
|
| 1516 | - $post_link = trailingslashit( |
|
| 1517 | - preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
|
| 1518 | - ); |
|
| 1519 | - |
|
| 1520 | - if ($fix_url) {
|
|
| 1521 | - $post_link = $site_url . $post_link; |
|
| 1522 | - } |
|
| 1523 | - |
|
| 1524 | - if (isset($comment_post_cache[$post->ID])) {
|
|
| 1525 | - $post = $comment_post_cache[$post->ID]; |
|
| 1526 | - } |
|
| 1527 | - if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
|
|
| 1528 | - $post_id = $post->ID; |
|
| 1529 | - if (isset($orig_post)) {
|
|
| 1530 | - $post = $orig_post; |
|
| 1531 | - } |
|
| 1532 | - return $gd_permalink_cache[$post_id]; |
|
| 1533 | - } |
|
| 1507 | + if (function_exists('geodir_location_geo_home_link')) {
|
|
| 1508 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
|
|
| 1509 | + } |
|
| 1534 | 1510 | |
| 1535 | - if (!isset($post->post_locations)) {
|
|
| 1536 | - $post_type = $post->post_type; |
|
| 1537 | - $ID = $post->ID; |
|
| 1538 | - $post2 = $wpdb->get_row( |
|
| 1539 | - $wpdb->prepare( |
|
| 1540 | - "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
| 1541 | - array($post->ID) |
|
| 1542 | - ) |
|
| 1543 | - ); |
|
| 1511 | + $fix_url = strpos($post_link, $site_url) === 0 ? true : false; |
|
| 1512 | + if ($fix_url) {
|
|
| 1513 | + $post_link = str_replace($site_url, '', $post_link); |
|
| 1514 | + } |
|
| 1544 | 1515 | |
| 1545 | - $post = (object)array_merge((array)$post, (array)$post2); |
|
| 1516 | + $post_link = trailingslashit( |
|
| 1517 | + preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
|
| 1518 | + ); |
|
| 1546 | 1519 | |
| 1547 | - $comment_post_cache[$post->ID] = $post; |
|
| 1548 | - } |
|
| 1520 | + if ($fix_url) {
|
|
| 1521 | + $post_link = $site_url . $post_link; |
|
| 1522 | + } |
|
| 1549 | 1523 | |
| 1524 | + if (isset($comment_post_cache[$post->ID])) {
|
|
| 1525 | + $post = $comment_post_cache[$post->ID]; |
|
| 1526 | + } |
|
| 1527 | + if (isset($gd_permalink_cache[$post->ID]) && $gd_permalink_cache[$post->ID] && !$sample) {
|
|
| 1528 | + $post_id = $post->ID; |
|
| 1529 | + if (isset($orig_post)) {
|
|
| 1530 | + $post = $orig_post; |
|
| 1531 | + } |
|
| 1532 | + return $gd_permalink_cache[$post_id]; |
|
| 1533 | + } |
|
| 1550 | 1534 | |
| 1535 | + if (!isset($post->post_locations)) {
|
|
| 1536 | + $post_type = $post->post_type; |
|
| 1537 | + $ID = $post->ID; |
|
| 1538 | + $post2 = $wpdb->get_row( |
|
| 1539 | + $wpdb->prepare( |
|
| 1540 | + "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
| 1541 | + array($post->ID) |
|
| 1542 | + ) |
|
| 1543 | + ); |
|
| 1551 | 1544 | |
| 1552 | - if (false !== strpos($post_link, '%gd_taxonomy%')) {
|
|
| 1545 | + $post = (object)array_merge((array)$post, (array)$post2); |
|
| 1553 | 1546 | |
| 1554 | - if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
|
|
| 1555 | - $location_request = ''; |
|
| 1547 | + $comment_post_cache[$post->ID] = $post; |
|
| 1548 | + } |
|
| 1556 | 1549 | |
| 1557 | 1550 | |
| 1558 | - if (!empty($post->post_locations)) {
|
|
| 1559 | - $geodir_arr_locations = explode(',', $post->post_locations);
|
|
| 1560 | - if (count($geodir_arr_locations) == 3) {
|
|
| 1561 | - $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
|
|
| 1562 | - $post->city_slug = str_replace(']', '', $post->city_slug);
|
|
| 1563 | - $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
|
|
| 1564 | - $post->region_slug = str_replace(']', '', $post->region_slug);
|
|
| 1565 | - $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
|
|
| 1566 | - $post->country_slug = str_replace(']', '', $post->country_slug);
|
|
| 1567 | 1551 | |
| 1568 | - $post_location = (object)array('country_slug' => $post->country_slug,
|
|
| 1569 | - 'region_slug' => $post->region_slug, |
|
| 1570 | - 'city_slug' => $post->city_slug |
|
| 1571 | - ); |
|
| 1552 | + if (false !== strpos($post_link, '%gd_taxonomy%')) {
|
|
| 1572 | 1553 | |
| 1573 | - } else |
|
| 1574 | - $post_location = geodir_get_location(); |
|
| 1554 | + if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
|
|
| 1555 | + $location_request = ''; |
|
| 1575 | 1556 | |
| 1576 | 1557 | |
| 1577 | - } else {
|
|
| 1558 | + if (!empty($post->post_locations)) {
|
|
| 1559 | + $geodir_arr_locations = explode(',', $post->post_locations);
|
|
| 1560 | + if (count($geodir_arr_locations) == 3) {
|
|
| 1561 | + $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
|
|
| 1562 | + $post->city_slug = str_replace(']', '', $post->city_slug);
|
|
| 1563 | + $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
|
|
| 1564 | + $post->region_slug = str_replace(']', '', $post->region_slug);
|
|
| 1565 | + $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
|
|
| 1566 | + $post->country_slug = str_replace(']', '', $post->country_slug);
|
|
| 1578 | 1567 | |
| 1579 | - $post_location_sql = $wpdb->get_results( |
|
| 1580 | - $wpdb->prepare( |
|
| 1581 | - "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
| 1582 | - array($post->ID) |
|
| 1583 | - ) |
|
| 1584 | - ); |
|
| 1585 | - |
|
| 1586 | - if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
|
|
| 1587 | - |
|
| 1588 | - $geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
|
|
| 1589 | - if (count($geodir_arr_locations) == 3) {
|
|
| 1590 | - $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
|
|
| 1591 | - $post->city_slug = str_replace(']', '', $post->city_slug);
|
|
| 1592 | - $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
|
|
| 1593 | - $post->region_slug = str_replace(']', '', $post->region_slug);
|
|
| 1594 | - $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
|
|
| 1595 | - $post->country_slug = str_replace(']', '', $post->country_slug);
|
|
| 1596 | - |
|
| 1597 | - $post_location = (object)array('country_slug' => $post->country_slug,
|
|
| 1598 | - 'region_slug' => $post->region_slug, |
|
| 1599 | - 'city_slug' => $post->city_slug |
|
| 1600 | - ); |
|
| 1568 | + $post_location = (object)array('country_slug' => $post->country_slug,
|
|
| 1569 | + 'region_slug' => $post->region_slug, |
|
| 1570 | + 'city_slug' => $post->city_slug |
|
| 1571 | + ); |
|
| 1601 | 1572 | |
| 1602 | - } |
|
| 1603 | - } else |
|
| 1604 | - $post_location = geodir_get_location(); |
|
| 1605 | - } |
|
| 1573 | + } else |
|
| 1574 | + $post_location = geodir_get_location(); |
|
| 1575 | + |
|
| 1576 | + |
|
| 1577 | + } else {
|
|
| 1578 | + |
|
| 1579 | + $post_location_sql = $wpdb->get_results( |
|
| 1580 | + $wpdb->prepare( |
|
| 1581 | + "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
| 1582 | + array($post->ID) |
|
| 1583 | + ) |
|
| 1584 | + ); |
|
| 1585 | + |
|
| 1586 | + if (!empty($post_location_sql) && is_array($post_location_sql) && !empty($post_location_sql[0]->post_locations)) {
|
|
| 1587 | + |
|
| 1588 | + $geodir_arr_locations = explode(',', $post_location_sql[0]->post_locations);
|
|
| 1589 | + if (count($geodir_arr_locations) == 3) {
|
|
| 1590 | + $post->city_slug = str_replace('[', '', $geodir_arr_locations[0]);
|
|
| 1591 | + $post->city_slug = str_replace(']', '', $post->city_slug);
|
|
| 1592 | + $post->region_slug = str_replace('[', '', $geodir_arr_locations[1]);
|
|
| 1593 | + $post->region_slug = str_replace(']', '', $post->region_slug);
|
|
| 1594 | + $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
|
|
| 1595 | + $post->country_slug = str_replace(']', '', $post->country_slug);
|
|
| 1596 | + |
|
| 1597 | + $post_location = (object)array('country_slug' => $post->country_slug,
|
|
| 1598 | + 'region_slug' => $post->region_slug, |
|
| 1599 | + 'city_slug' => $post->city_slug |
|
| 1600 | + ); |
|
| 1601 | + |
|
| 1602 | + } |
|
| 1603 | + } else |
|
| 1604 | + $post_location = geodir_get_location(); |
|
| 1605 | + } |
|
| 1606 | 1606 | |
| 1607 | 1607 | |
| 1608 | - if (!empty($post_location)) {
|
|
| 1609 | - $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : ''; |
|
| 1608 | + if (!empty($post_location)) {
|
|
| 1609 | + $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : ''; |
|
| 1610 | 1610 | $region_slug = isset($post_location->region_slug) ? $post_location->region_slug : ''; |
| 1611 | 1611 | $city_slug = isset($post_location->city_slug) ? $post_location->city_slug : ''; |
| 1612 | 1612 | |
@@ -1624,88 +1624,88 @@ discard block |
||
| 1624 | 1624 | $location_slug[] = $city_slug; |
| 1625 | 1625 | |
| 1626 | 1626 | $location_request .= implode('/', $location_slug) . '/';
|
| 1627 | - } |
|
| 1628 | - } |
|
| 1627 | + } |
|
| 1628 | + } |
|
| 1629 | 1629 | |
| 1630 | - if (get_option('geodir_add_categories_url')) {
|
|
| 1630 | + if (get_option('geodir_add_categories_url')) {
|
|
| 1631 | 1631 | |
| 1632 | - $term_request = ''; |
|
| 1633 | - $taxonomies = geodir_get_taxonomies($post->post_type); |
|
| 1634 | - $taxonomies = !empty($taxonomies) && is_array($taxonomies) ? end($taxonomies) : ''; |
|
| 1632 | + $term_request = ''; |
|
| 1633 | + $taxonomies = geodir_get_taxonomies($post->post_type); |
|
| 1634 | + $taxonomies = !empty($taxonomies) && is_array($taxonomies) ? end($taxonomies) : ''; |
|
| 1635 | 1635 | |
| 1636 | - if (!empty($post->default_category)) {
|
|
| 1637 | - $post_terms = $post->default_category; |
|
| 1638 | - } else {
|
|
| 1639 | - $post_terms = ''; |
|
| 1640 | - |
|
| 1641 | - if(isset($_POST['post_default_category']) && $_POST['post_default_category']){
|
|
| 1642 | - $post_terms = absint($_POST['post_default_category']); |
|
| 1643 | - }elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) {
|
|
| 1644 | - $post_terms = is_array($_POST['post_category'][$taxonomies]) ? $_POST['post_category'][$taxonomies] : explode(",", trim($_POST['post_category'][$taxonomies], ","));
|
|
| 1645 | - $post_terms = !empty($post_terms) ? absint($post_terms[0]) : 0; |
|
| 1646 | - }elseif (isset($post->{$taxonomies})) {
|
|
| 1647 | - $post_terms = explode(",", trim($post->{$taxonomies}, ","));
|
|
| 1648 | - $post_terms = $post_terms[0]; |
|
| 1649 | - } |
|
| 1636 | + if (!empty($post->default_category)) {
|
|
| 1637 | + $post_terms = $post->default_category; |
|
| 1638 | + } else {
|
|
| 1639 | + $post_terms = ''; |
|
| 1640 | + |
|
| 1641 | + if(isset($_POST['post_default_category']) && $_POST['post_default_category']){
|
|
| 1642 | + $post_terms = absint($_POST['post_default_category']); |
|
| 1643 | + }elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) {
|
|
| 1644 | + $post_terms = is_array($_POST['post_category'][$taxonomies]) ? $_POST['post_category'][$taxonomies] : explode(",", trim($_POST['post_category'][$taxonomies], ","));
|
|
| 1645 | + $post_terms = !empty($post_terms) ? absint($post_terms[0]) : 0; |
|
| 1646 | + }elseif (isset($post->{$taxonomies})) {
|
|
| 1647 | + $post_terms = explode(",", trim($post->{$taxonomies}, ","));
|
|
| 1648 | + $post_terms = $post_terms[0]; |
|
| 1649 | + } |
|
| 1650 | 1650 | |
| 1651 | - if (!$post_terms) |
|
| 1652 | - $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
| 1651 | + if (!$post_terms) |
|
| 1652 | + $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
| 1653 | 1653 | |
| 1654 | - if (!$post_terms) {
|
|
| 1655 | - $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true); |
|
| 1654 | + if (!$post_terms) {
|
|
| 1655 | + $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true); |
|
| 1656 | 1656 | |
| 1657 | - if ($post_terms) {
|
|
| 1658 | - $post_terms = explode(",", trim($post_terms, ","));
|
|
| 1659 | - $post_terms = $post_terms[0]; |
|
| 1660 | - } |
|
| 1661 | - } |
|
| 1662 | - } |
|
| 1657 | + if ($post_terms) {
|
|
| 1658 | + $post_terms = explode(",", trim($post_terms, ","));
|
|
| 1659 | + $post_terms = $post_terms[0]; |
|
| 1660 | + } |
|
| 1661 | + } |
|
| 1662 | + } |
|
| 1663 | 1663 | |
| 1664 | - $term = get_term_by('id', $post_terms, $taxonomies);
|
|
| 1664 | + $term = get_term_by('id', $post_terms, $taxonomies);
|
|
| 1665 | 1665 | |
| 1666 | - if (!empty($term)) |
|
| 1667 | - $term_request = $term->slug; |
|
| 1668 | - //$term_request = $term->slug.'/'; |
|
| 1669 | - } |
|
| 1666 | + if (!empty($term)) |
|
| 1667 | + $term_request = $term->slug; |
|
| 1668 | + //$term_request = $term->slug.'/'; |
|
| 1669 | + } |
|
| 1670 | 1670 | |
| 1671 | - $request_term = ''; |
|
| 1672 | - $listingurl_separator = ''; |
|
| 1673 | - //$detailurl_separator = get_option('geodir_detailurl_separator');
|
|
| 1674 | - $detailurl_separator = ''; |
|
| 1675 | - if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
|
|
| 1676 | - $request_term = $location_request; |
|
| 1677 | - //$listingurl_separator = get_option('geodir_listingurl_separator');
|
|
| 1678 | - //$request_term .= $listingurl_separator.'/'.$term_request; |
|
| 1679 | - $request_term .= $term_request; |
|
| 1671 | + $request_term = ''; |
|
| 1672 | + $listingurl_separator = ''; |
|
| 1673 | + //$detailurl_separator = get_option('geodir_detailurl_separator');
|
|
| 1674 | + $detailurl_separator = ''; |
|
| 1675 | + if (isset($location_request) && $location_request != '' && isset($term_request) && $term_request != '') {
|
|
| 1676 | + $request_term = $location_request; |
|
| 1677 | + //$listingurl_separator = get_option('geodir_listingurl_separator');
|
|
| 1678 | + //$request_term .= $listingurl_separator.'/'.$term_request; |
|
| 1679 | + $request_term .= $term_request; |
|
| 1680 | 1680 | |
| 1681 | - } else {
|
|
| 1682 | - if (isset($location_request) && $location_request != '') $request_term = $location_request; |
|
| 1681 | + } else {
|
|
| 1682 | + if (isset($location_request) && $location_request != '') $request_term = $location_request; |
|
| 1683 | 1683 | |
| 1684 | - if (isset($term_request) && $term_request != '') $request_term .= $term_request; |
|
| 1685 | - } |
|
| 1686 | - $request_term = trim($request_term, '/'); |
|
| 1684 | + if (isset($term_request) && $term_request != '') $request_term .= $term_request; |
|
| 1685 | + } |
|
| 1686 | + $request_term = trim($request_term, '/'); |
|
| 1687 | 1687 | |
| 1688 | - // Fix with WPML the location terms added twice when CPT slug is translated. |
|
| 1689 | - if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/' . $request_term . $detailurl_separator) !== false) {
|
|
| 1690 | - $post_link = str_replace('%gd_taxonomy%/', '', $post_link);
|
|
| 1691 | - } |
|
| 1688 | + // Fix with WPML the location terms added twice when CPT slug is translated. |
|
| 1689 | + if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/' . $request_term . $detailurl_separator) !== false) {
|
|
| 1690 | + $post_link = str_replace('%gd_taxonomy%/', '', $post_link);
|
|
| 1691 | + } |
|
| 1692 | 1692 | |
| 1693 | - if (!empty($request_term)) |
|
| 1694 | - $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
|
|
| 1695 | - else |
|
| 1696 | - $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
|
|
| 1697 | - //echo $post_link ; |
|
| 1698 | - } |
|
| 1699 | - // temp cache the permalink |
|
| 1700 | - if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
|
|
| 1701 | - $gd_permalink_cache[$post->ID] = $post_link; |
|
| 1702 | - } |
|
| 1703 | - } |
|
| 1704 | - if (isset($orig_post)) {
|
|
| 1705 | - $post = $orig_post; |
|
| 1706 | - } |
|
| 1707 | - |
|
| 1708 | - return $post_link; |
|
| 1693 | + if (!empty($request_term)) |
|
| 1694 | + $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
|
|
| 1695 | + else |
|
| 1696 | + $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
|
|
| 1697 | + //echo $post_link ; |
|
| 1698 | + } |
|
| 1699 | + // temp cache the permalink |
|
| 1700 | + if (!$sample && (!isset($_REQUEST['geodir_ajax']) || (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] != 'add_listing'))) {
|
|
| 1701 | + $gd_permalink_cache[$post->ID] = $post_link; |
|
| 1702 | + } |
|
| 1703 | + } |
|
| 1704 | + if (isset($orig_post)) {
|
|
| 1705 | + $post = $orig_post; |
|
| 1706 | + } |
|
| 1707 | + |
|
| 1708 | + return $post_link; |
|
| 1709 | 1709 | } |
| 1710 | 1710 | |
| 1711 | 1711 | /** |
@@ -1721,117 +1721,117 @@ discard block |
||
| 1721 | 1721 | * @return string The term link. |
| 1722 | 1722 | */ |
| 1723 | 1723 | function geodir_term_link($termlink, $term, $taxonomy) {
|
| 1724 | - $geodir_taxonomies = geodir_get_taxonomies('', true);
|
|
| 1724 | + $geodir_taxonomies = geodir_get_taxonomies('', true);
|
|
| 1725 | 1725 | |
| 1726 | - if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
|
|
| 1727 | - global $geodir_add_location_url, $gd_session; |
|
| 1728 | - $include_location = false; |
|
| 1729 | - $request_term = array(); |
|
| 1730 | - $add_location_url = get_option('geodir_add_location_url');
|
|
| 1731 | - $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
|
|
| 1726 | + if (isset($taxonomy) && !empty($geodir_taxonomies) && in_array($taxonomy, $geodir_taxonomies)) {
|
|
| 1727 | + global $geodir_add_location_url, $gd_session; |
|
| 1728 | + $include_location = false; |
|
| 1729 | + $request_term = array(); |
|
| 1730 | + $add_location_url = get_option('geodir_add_location_url');
|
|
| 1731 | + $location_manager = defined('POST_LOCATION_TABLE') ? true : false;
|
|
| 1732 | 1732 | |
| 1733 | - $listing_slug = geodir_get_listing_slug($taxonomy); |
|
| 1733 | + $listing_slug = geodir_get_listing_slug($taxonomy); |
|
| 1734 | 1734 | |
| 1735 | - if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
|
|
| 1736 | - if ($geodir_add_location_url && $add_location_url) {
|
|
| 1737 | - $include_location = true; |
|
| 1738 | - } |
|
| 1739 | - } elseif ($add_location_url && $gd_session->get('gd_multi_location') == 1) {
|
|
| 1740 | - $include_location = true; |
|
| 1741 | - } elseif ($add_location_url && $location_manager && geodir_is_page('detail')) {
|
|
| 1742 | - $include_location = true; |
|
| 1743 | - } |
|
| 1744 | - |
|
| 1745 | - if ($include_location) {
|
|
| 1746 | - global $post; |
|
| 1747 | - $location_terms = array(); |
|
| 1735 | + if ($geodir_add_location_url != NULL && $geodir_add_location_url != '') {
|
|
| 1736 | + if ($geodir_add_location_url && $add_location_url) {
|
|
| 1737 | + $include_location = true; |
|
| 1738 | + } |
|
| 1739 | + } elseif ($add_location_url && $gd_session->get('gd_multi_location') == 1) {
|
|
| 1740 | + $include_location = true; |
|
| 1741 | + } elseif ($add_location_url && $location_manager && geodir_is_page('detail')) {
|
|
| 1742 | + $include_location = true; |
|
| 1743 | + } |
|
| 1744 | + |
|
| 1745 | + if ($include_location) {
|
|
| 1746 | + global $post; |
|
| 1747 | + $location_terms = array(); |
|
| 1748 | 1748 | |
| 1749 | - $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
|
|
| 1749 | + $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
|
|
| 1750 | 1750 | |
| 1751 | - if (geodir_is_page('detail')) {
|
|
| 1752 | - if (!isset($post->country_slug) && !empty($post->post_locations)) {
|
|
| 1753 | - $post_locations = explode(',', $post->post_locations);
|
|
| 1754 | - |
|
| 1755 | - if (count($post_locations) == 3) {
|
|
| 1756 | - $post->city_slug = str_replace('[', '', $post_locations[0]);
|
|
| 1757 | - $post->city_slug = str_replace(']', '', $post->city_slug);
|
|
| 1758 | - $post->region_slug = str_replace('[', '', $post_locations[1]);
|
|
| 1759 | - $post->region_slug = str_replace(']', '', $post->region_slug);
|
|
| 1760 | - $post->country_slug = str_replace('[', '', $post_locations[2]);
|
|
| 1761 | - $post->country_slug = str_replace(']', '', $post->country_slug);
|
|
| 1762 | - } |
|
| 1763 | - } |
|
| 1751 | + if (geodir_is_page('detail')) {
|
|
| 1752 | + if (!isset($post->country_slug) && !empty($post->post_locations)) {
|
|
| 1753 | + $post_locations = explode(',', $post->post_locations);
|
|
| 1754 | + |
|
| 1755 | + if (count($post_locations) == 3) {
|
|
| 1756 | + $post->city_slug = str_replace('[', '', $post_locations[0]);
|
|
| 1757 | + $post->city_slug = str_replace(']', '', $post->city_slug);
|
|
| 1758 | + $post->region_slug = str_replace('[', '', $post_locations[1]);
|
|
| 1759 | + $post->region_slug = str_replace(']', '', $post->region_slug);
|
|
| 1760 | + $post->country_slug = str_replace('[', '', $post_locations[2]);
|
|
| 1761 | + $post->country_slug = str_replace(']', '', $post->country_slug);
|
|
| 1762 | + } |
|
| 1763 | + } |
|
| 1764 | 1764 | |
| 1765 | - if (isset($post->country_slug)) {
|
|
| 1766 | - $location_terms = array( |
|
| 1767 | - 'gd_country' => $post->country_slug, |
|
| 1768 | - 'gd_region' => $post->region_slug, |
|
| 1769 | - 'gd_city' => $post->city_slug |
|
| 1770 | - ); |
|
| 1765 | + if (isset($post->country_slug)) {
|
|
| 1766 | + $location_terms = array( |
|
| 1767 | + 'gd_country' => $post->country_slug, |
|
| 1768 | + 'gd_region' => $post->region_slug, |
|
| 1769 | + 'gd_city' => $post->city_slug |
|
| 1770 | + ); |
|
| 1771 | 1771 | |
| 1772 | - if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
|
|
| 1773 | - $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood; |
|
| 1774 | - } |
|
| 1775 | - } |
|
| 1776 | - } |
|
| 1772 | + if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) {
|
|
| 1773 | + $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood; |
|
| 1774 | + } |
|
| 1775 | + } |
|
| 1776 | + } |
|
| 1777 | 1777 | |
| 1778 | - if (empty($location_terms)) {
|
|
| 1779 | - $location_terms = geodir_get_current_location_terms('query_vars');
|
|
| 1780 | - } |
|
| 1778 | + if (empty($location_terms)) {
|
|
| 1779 | + $location_terms = geodir_get_current_location_terms('query_vars');
|
|
| 1780 | + } |
|
| 1781 | 1781 | |
| 1782 | - $geodir_show_location_url = get_option('geodir_show_location_url');
|
|
| 1783 | - $location_terms = geodir_remove_location_terms($location_terms); |
|
| 1782 | + $geodir_show_location_url = get_option('geodir_show_location_url');
|
|
| 1783 | + $location_terms = geodir_remove_location_terms($location_terms); |
|
| 1784 | 1784 | |
| 1785 | - if (!empty($location_terms)) {
|
|
| 1786 | - $url_separator = ''; |
|
| 1785 | + if (!empty($location_terms)) {
|
|
| 1786 | + $url_separator = ''; |
|
| 1787 | 1787 | |
| 1788 | - if (get_option('permalink_structure') != '') {
|
|
| 1789 | - $old_listing_slug = '/' . $listing_slug . '/'; |
|
| 1790 | - $request_term = implode("/", $location_terms);
|
|
| 1791 | - $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/'; |
|
| 1788 | + if (get_option('permalink_structure') != '') {
|
|
| 1789 | + $old_listing_slug = '/' . $listing_slug . '/'; |
|
| 1790 | + $request_term = implode("/", $location_terms);
|
|
| 1791 | + $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/'; |
|
| 1792 | 1792 | |
| 1793 | - $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug)); |
|
| 1794 | - } else {
|
|
| 1795 | - $termlink = geodir_getlink($termlink, $request_term); |
|
| 1796 | - } |
|
| 1797 | - } |
|
| 1798 | - } |
|
| 1793 | + $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug)); |
|
| 1794 | + } else {
|
|
| 1795 | + $termlink = geodir_getlink($termlink, $request_term); |
|
| 1796 | + } |
|
| 1797 | + } |
|
| 1798 | + } |
|
| 1799 | 1799 | |
| 1800 | - // Alter the CPT slug is WPML is set to do so |
|
| 1801 | - /* we can replace this with the below function |
|
| 1800 | + // Alter the CPT slug is WPML is set to do so |
|
| 1801 | + /* we can replace this with the below function |
|
| 1802 | 1802 | if(geodir_is_wpml()){
|
| 1803 | 1803 | global $sitepress; |
| 1804 | 1804 | $post_type = str_replace("category","",$taxonomy);
|
| 1805 | 1805 | $termlink = $sitepress->post_type_archive_link_filter( $termlink, $post_type); |
| 1806 | 1806 | }*/ |
| 1807 | 1807 | |
| 1808 | - // Alter the CPT slug if WPML is set to do so |
|
| 1809 | - if (geodir_is_wpml()) {
|
|
| 1810 | - $post_types = get_option('geodir_post_types');
|
|
| 1811 | - $post_type = str_replace("category","",$taxonomy);
|
|
| 1812 | - $post_type = str_replace("_tags","",$post_type);
|
|
| 1813 | - $slug = $post_types[$post_type]['rewrite']['slug']; |
|
| 1814 | - if (geodir_wpml_is_post_type_translated($post_type) && gd_wpml_slug_translation_turned_on($post_type)) {
|
|
| 1815 | - global $sitepress; |
|
| 1816 | - $default_lang = $sitepress->get_default_language(); |
|
| 1817 | - $language_code = gd_wpml_get_lang_from_url($termlink); |
|
| 1818 | - if (!$language_code ) {
|
|
| 1819 | - $language_code = $default_lang; |
|
| 1820 | - } |
|
| 1808 | + // Alter the CPT slug if WPML is set to do so |
|
| 1809 | + if (geodir_is_wpml()) {
|
|
| 1810 | + $post_types = get_option('geodir_post_types');
|
|
| 1811 | + $post_type = str_replace("category","",$taxonomy);
|
|
| 1812 | + $post_type = str_replace("_tags","",$post_type);
|
|
| 1813 | + $slug = $post_types[$post_type]['rewrite']['slug']; |
|
| 1814 | + if (geodir_wpml_is_post_type_translated($post_type) && gd_wpml_slug_translation_turned_on($post_type)) {
|
|
| 1815 | + global $sitepress; |
|
| 1816 | + $default_lang = $sitepress->get_default_language(); |
|
| 1817 | + $language_code = gd_wpml_get_lang_from_url($termlink); |
|
| 1818 | + if (!$language_code ) {
|
|
| 1819 | + $language_code = $default_lang; |
|
| 1820 | + } |
|
| 1821 | 1821 | |
| 1822 | - $org_slug = $slug; |
|
| 1823 | - $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code);
|
|
| 1822 | + $org_slug = $slug; |
|
| 1823 | + $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code);
|
|
| 1824 | 1824 | |
| 1825 | - if (!$slug) {
|
|
| 1826 | - $slug = $org_slug; |
|
| 1827 | - } |
|
| 1825 | + if (!$slug) {
|
|
| 1826 | + $slug = $org_slug; |
|
| 1827 | + } |
|
| 1828 | 1828 | |
| 1829 | - $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug ,$termlink, 1));
|
|
| 1830 | - } |
|
| 1831 | - } |
|
| 1832 | - } |
|
| 1829 | + $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug ,$termlink, 1));
|
|
| 1830 | + } |
|
| 1831 | + } |
|
| 1832 | + } |
|
| 1833 | 1833 | |
| 1834 | - return $termlink; |
|
| 1834 | + return $termlink; |
|
| 1835 | 1835 | } |
| 1836 | 1836 | |
| 1837 | 1837 | /** |
@@ -1857,14 +1857,14 @@ discard block |
||
| 1857 | 1857 | if (in_array($post_type, geodir_get_posttypes())) {
|
| 1858 | 1858 | if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
|
| 1859 | 1859 | if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
|
| 1860 | - $location_terms = array( |
|
| 1861 | - 'gd_country' => $post->country_slug, |
|
| 1862 | - 'gd_region' => $post->region_slug, |
|
| 1863 | - 'gd_city' => $post->city_slug |
|
| 1864 | - ); |
|
| 1865 | - } else {
|
|
| 1866 | - $location_terms = geodir_get_current_location_terms('query_vars');
|
|
| 1867 | - } |
|
| 1860 | + $location_terms = array( |
|
| 1861 | + 'gd_country' => $post->country_slug, |
|
| 1862 | + 'gd_region' => $post->region_slug, |
|
| 1863 | + 'gd_city' => $post->city_slug |
|
| 1864 | + ); |
|
| 1865 | + } else {
|
|
| 1866 | + $location_terms = geodir_get_current_location_terms('query_vars');
|
|
| 1867 | + } |
|
| 1868 | 1868 | |
| 1869 | 1869 | $location_terms = geodir_remove_location_terms($location_terms); |
| 1870 | 1870 | |
@@ -1896,17 +1896,17 @@ discard block |
||
| 1896 | 1896 | * @return void|string Label. |
| 1897 | 1897 | */ |
| 1898 | 1898 | function get_post_type_singular_label($post_type, $echo = false, $translate = false) {
|
| 1899 | - $obj_post_type = get_post_type_object($post_type); |
|
| 1900 | - if (!is_object($obj_post_type)) {
|
|
| 1901 | - return; |
|
| 1902 | - } |
|
| 1899 | + $obj_post_type = get_post_type_object($post_type); |
|
| 1900 | + if (!is_object($obj_post_type)) {
|
|
| 1901 | + return; |
|
| 1902 | + } |
|
| 1903 | 1903 | |
| 1904 | - $label = $translate ? __($obj_post_type->labels->singular_name, 'geodirectory') : $obj_post_type->labels->singular_name; |
|
| 1904 | + $label = $translate ? __($obj_post_type->labels->singular_name, 'geodirectory') : $obj_post_type->labels->singular_name; |
|
| 1905 | 1905 | |
| 1906 | - if ($echo) |
|
| 1907 | - echo $label; |
|
| 1908 | - else |
|
| 1909 | - return $label; |
|
| 1906 | + if ($echo) |
|
| 1907 | + echo $label; |
|
| 1908 | + else |
|
| 1909 | + return $label; |
|
| 1910 | 1910 | } |
| 1911 | 1911 | |
| 1912 | 1912 | /** |
@@ -1921,19 +1921,19 @@ discard block |
||
| 1921 | 1921 | * @return void|string Label. |
| 1922 | 1922 | */ |
| 1923 | 1923 | function get_post_type_plural_label($post_type, $echo = false, $translate = false) {
|
| 1924 | - $all_postypes = geodir_get_posttypes(); |
|
| 1924 | + $all_postypes = geodir_get_posttypes(); |
|
| 1925 | 1925 | |
| 1926 | - if (!in_array($post_type, $all_postypes)) |
|
| 1927 | - return false; |
|
| 1926 | + if (!in_array($post_type, $all_postypes)) |
|
| 1927 | + return false; |
|
| 1928 | 1928 | |
| 1929 | - $obj_post_type = get_post_type_object($post_type); |
|
| 1929 | + $obj_post_type = get_post_type_object($post_type); |
|
| 1930 | 1930 | |
| 1931 | - $label = $translate ? __($obj_post_type->labels->name, 'geodirectory') : $obj_post_type->labels->name; |
|
| 1931 | + $label = $translate ? __($obj_post_type->labels->name, 'geodirectory') : $obj_post_type->labels->name; |
|
| 1932 | 1932 | |
| 1933 | - if ($echo) |
|
| 1934 | - echo $label; |
|
| 1935 | - else |
|
| 1936 | - return $label; |
|
| 1933 | + if ($echo) |
|
| 1934 | + echo $label; |
|
| 1935 | + else |
|
| 1936 | + return $label; |
|
| 1937 | 1937 | } |
| 1938 | 1938 | |
| 1939 | 1939 | /** |
@@ -1951,51 +1951,51 @@ discard block |
||
| 1951 | 1951 | */ |
| 1952 | 1952 | function geodir_term_exists($term, $taxonomy = '', $parent = 0) |
| 1953 | 1953 | {
|
| 1954 | - global $wpdb; |
|
| 1955 | - |
|
| 1956 | - $select = "SELECT term_id FROM $wpdb->terms as t WHERE "; |
|
| 1957 | - $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 "; |
|
| 1958 | - |
|
| 1959 | - if (is_int($term)) {
|
|
| 1960 | - if (0 == $term) |
|
| 1961 | - return 0; |
|
| 1962 | - $where = 't.term_id = %d'; |
|
| 1963 | - if (!empty($taxonomy)) |
|
| 1964 | - return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
| 1965 | - else |
|
| 1966 | - return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
| 1967 | - } |
|
| 1954 | + global $wpdb; |
|
| 1955 | + |
|
| 1956 | + $select = "SELECT term_id FROM $wpdb->terms as t WHERE "; |
|
| 1957 | + $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 "; |
|
| 1958 | + |
|
| 1959 | + if (is_int($term)) {
|
|
| 1960 | + if (0 == $term) |
|
| 1961 | + return 0; |
|
| 1962 | + $where = 't.term_id = %d'; |
|
| 1963 | + if (!empty($taxonomy)) |
|
| 1964 | + return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
| 1965 | + else |
|
| 1966 | + return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
| 1967 | + } |
|
| 1968 | 1968 | |
| 1969 | - $term = trim(wp_unslash($term)); |
|
| 1969 | + $term = trim(wp_unslash($term)); |
|
| 1970 | 1970 | |
| 1971 | - if ('' === $slug = sanitize_title($term))
|
|
| 1972 | - return 0; |
|
| 1971 | + if ('' === $slug = sanitize_title($term))
|
|
| 1972 | + return 0; |
|
| 1973 | 1973 | |
| 1974 | - $where = 't.slug = %s'; |
|
| 1974 | + $where = 't.slug = %s'; |
|
| 1975 | 1975 | |
| 1976 | - $where_fields = array($slug); |
|
| 1977 | - if (!empty($taxonomy)) {
|
|
| 1978 | - $parent = (int)$parent; |
|
| 1979 | - if ($parent > 0) {
|
|
| 1980 | - $where_fields[] = $parent; |
|
| 1981 | - $else_where_fields[] = $parent; |
|
| 1982 | - $where .= ' AND tt.parent = %d'; |
|
| 1976 | + $where_fields = array($slug); |
|
| 1977 | + if (!empty($taxonomy)) {
|
|
| 1978 | + $parent = (int)$parent; |
|
| 1979 | + if ($parent > 0) {
|
|
| 1980 | + $where_fields[] = $parent; |
|
| 1981 | + $else_where_fields[] = $parent; |
|
| 1982 | + $where .= ' AND tt.parent = %d'; |
|
| 1983 | 1983 | |
| 1984 | - } |
|
| 1984 | + } |
|
| 1985 | 1985 | |
| 1986 | - $where_fields[] = $taxonomy; |
|
| 1986 | + $where_fields[] = $taxonomy; |
|
| 1987 | 1987 | |
| 1988 | 1988 | |
| 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; |
|
| 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 | 1991 | |
| 1992 | - return false; |
|
| 1993 | - } |
|
| 1992 | + return false; |
|
| 1993 | + } |
|
| 1994 | 1994 | |
| 1995 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
|
|
| 1996 | - return $result; |
|
| 1995 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields)))
|
|
| 1996 | + return $result; |
|
| 1997 | 1997 | |
| 1998 | - return false; |
|
| 1998 | + return false; |
|
| 1999 | 1999 | } |
| 2000 | 2000 | |
| 2001 | 2001 | /** |
@@ -2007,7 +2007,7 @@ discard block |
||
| 2007 | 2007 | function geodir_get_term_icon_rebuild() |
| 2008 | 2008 | {
|
| 2009 | 2009 | |
| 2010 | - update_option('gd_term_icons', '');
|
|
| 2010 | + update_option('gd_term_icons', '');
|
|
| 2011 | 2011 | |
| 2012 | 2012 | } |
| 2013 | 2013 | |
@@ -2025,61 +2025,61 @@ discard block |
||
| 2025 | 2025 | */ |
| 2026 | 2026 | function geodir_get_term_icon($term_id = false, $rebuild = false) |
| 2027 | 2027 | {
|
| 2028 | - global $wpdb; |
|
| 2029 | - if (!$rebuild) {
|
|
| 2030 | - $terms_icons = get_option('gd_term_icons');
|
|
| 2031 | - } else {
|
|
| 2032 | - $terms_icons = array(); |
|
| 2033 | - } |
|
| 2034 | - |
|
| 2035 | - if (empty($terms_icons)) {
|
|
| 2036 | - $terms_icons = array(); |
|
| 2037 | - $default_icon_url = get_option('geodir_default_marker_icon');
|
|
| 2038 | - $taxonomy = geodir_get_taxonomies(); |
|
| 2039 | - $post_types = geodir_get_posttypes(); |
|
| 2040 | - $tax_arr = array(); |
|
| 2041 | - foreach ($post_types as $post_type) {
|
|
| 2042 | - $tax_arr[] = "'" . $post_type . "category'"; |
|
| 2043 | - } |
|
| 2044 | - $tax_c = implode(',', $tax_arr);
|
|
| 2045 | - $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
|
|
| 2046 | - //$terms = get_terms( $taxonomy ); |
|
| 2047 | - |
|
| 2048 | - if($terms) {
|
|
| 2049 | - foreach ($terms as $term) {
|
|
| 2050 | - $post_type = str_replace("category", "", $term->taxonomy);
|
|
| 2051 | - $a_terms[$post_type][] = $term; |
|
| 2028 | + global $wpdb; |
|
| 2029 | + if (!$rebuild) {
|
|
| 2030 | + $terms_icons = get_option('gd_term_icons');
|
|
| 2031 | + } else {
|
|
| 2032 | + $terms_icons = array(); |
|
| 2033 | + } |
|
| 2052 | 2034 | |
| 2053 | - } |
|
| 2054 | - } |
|
| 2035 | + if (empty($terms_icons)) {
|
|
| 2036 | + $terms_icons = array(); |
|
| 2037 | + $default_icon_url = get_option('geodir_default_marker_icon');
|
|
| 2038 | + $taxonomy = geodir_get_taxonomies(); |
|
| 2039 | + $post_types = geodir_get_posttypes(); |
|
| 2040 | + $tax_arr = array(); |
|
| 2041 | + foreach ($post_types as $post_type) {
|
|
| 2042 | + $tax_arr[] = "'" . $post_type . "category'"; |
|
| 2043 | + } |
|
| 2044 | + $tax_c = implode(',', $tax_arr);
|
|
| 2045 | + $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
|
|
| 2046 | + //$terms = get_terms( $taxonomy ); |
|
| 2055 | 2047 | |
| 2056 | - if($a_terms) {
|
|
| 2057 | - foreach ($a_terms as $pt => $t2) {
|
|
| 2048 | + if($terms) {
|
|
| 2049 | + foreach ($terms as $term) {
|
|
| 2050 | + $post_type = str_replace("category", "", $term->taxonomy);
|
|
| 2051 | + $a_terms[$post_type][] = $term; |
|
| 2058 | 2052 | |
| 2059 | - foreach ($t2 as $term) {
|
|
| 2060 | - $term_icon = geodir_get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt); |
|
| 2061 | - if ($term_icon) {
|
|
| 2062 | - $term_icon_url = $term_icon["src"]; |
|
| 2063 | - } else {
|
|
| 2064 | - $term_icon_url = $default_icon_url; |
|
| 2065 | - } |
|
| 2066 | - $terms_icons[$term->term_id] = $term_icon_url; |
|
| 2067 | - } |
|
| 2068 | - } |
|
| 2069 | - } |
|
| 2053 | + } |
|
| 2054 | + } |
|
| 2055 | + |
|
| 2056 | + if($a_terms) {
|
|
| 2057 | + foreach ($a_terms as $pt => $t2) {
|
|
| 2070 | 2058 | |
| 2071 | - update_option('gd_term_icons', $terms_icons);
|
|
| 2072 | - } |
|
| 2059 | + foreach ($t2 as $term) {
|
|
| 2060 | + $term_icon = geodir_get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt); |
|
| 2061 | + if ($term_icon) {
|
|
| 2062 | + $term_icon_url = $term_icon["src"]; |
|
| 2063 | + } else {
|
|
| 2064 | + $term_icon_url = $default_icon_url; |
|
| 2065 | + } |
|
| 2066 | + $terms_icons[$term->term_id] = $term_icon_url; |
|
| 2067 | + } |
|
| 2068 | + } |
|
| 2069 | + } |
|
| 2073 | 2070 | |
| 2074 | - if ($term_id && isset($terms_icons[$term_id])) {
|
|
| 2075 | - return $terms_icons[$term_id]; |
|
| 2076 | - } elseif ($term_id && !isset($terms_icons[$term_id])) {
|
|
| 2077 | - return get_option('geodir_default_marker_icon');
|
|
| 2078 | - } |
|
| 2071 | + update_option('gd_term_icons', $terms_icons);
|
|
| 2072 | + } |
|
| 2073 | + |
|
| 2074 | + if ($term_id && isset($terms_icons[$term_id])) {
|
|
| 2075 | + return $terms_icons[$term_id]; |
|
| 2076 | + } elseif ($term_id && !isset($terms_icons[$term_id])) {
|
|
| 2077 | + return get_option('geodir_default_marker_icon');
|
|
| 2078 | + } |
|
| 2079 | 2079 | |
| 2080 | - if (is_ssl()) {
|
|
| 2081 | - $terms_icons = str_replace("http:","https:",$terms_icons );
|
|
| 2082 | - } |
|
| 2080 | + if (is_ssl()) {
|
|
| 2081 | + $terms_icons = str_replace("http:","https:",$terms_icons );
|
|
| 2082 | + } |
|
| 2083 | 2083 | |
| 2084 | - return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
|
|
| 2084 | + return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
|
|
| 2085 | 2085 | } |
| 2086 | 2086 | \ 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 | - ' . __(geodir_utf8_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 | + ' . __(geodir_utf8_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 | - ' . __(geodir_utf8_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 | + ' . __(geodir_utf8_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="' . $sub_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="'.$sub_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 | |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | |
| 409 | 409 | if (geodir_is_page('add-listing') || geodir_is_page('preview')) {
|
| 410 | 410 | if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
| 411 | - $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
| 411 | + $geodir_post_type = get_post_type((int) $_REQUEST['pid']); |
|
| 412 | 412 | elseif (isset($_REQUEST['listing_type'])) |
| 413 | 413 | $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
| 414 | 414 | } |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
| 435 | 435 | $geodir_post_type = ''; |
| 436 | 436 | |
| 437 | - if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){
|
|
| 437 | + if (defined('DOING_AJAX') && isset($_REQUEST['stype'])) {
|
|
| 438 | 438 | $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
| 439 | 439 | } |
| 440 | 440 | |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | * |
| 445 | 445 | * @since 1.6.9 |
| 446 | 446 | */ |
| 447 | - return apply_filters('geodir_get_current_posttype',$geodir_post_type);
|
|
| 447 | + return apply_filters('geodir_get_current_posttype', $geodir_post_type);
|
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | /** |
@@ -458,18 +458,18 @@ discard block |
||
| 458 | 458 | */ |
| 459 | 459 | function geodir_get_default_posttype() |
| 460 | 460 | {
|
| 461 | - $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) ); |
|
| 461 | + $post_types = apply_filters('geodir_get_default_posttype', geodir_get_posttypes('object'));
|
|
| 462 | 462 | |
| 463 | 463 | $stype = false; |
| 464 | - foreach ( $post_types as $post_type => $info ) {
|
|
| 464 | + foreach ($post_types as $post_type => $info) {
|
|
| 465 | 465 | global $wpdb; |
| 466 | - $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) ); |
|
| 467 | - if ( $has_posts ) {
|
|
| 466 | + $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
|
|
| 467 | + if ($has_posts) {
|
|
| 468 | 468 | $stype = $post_type; break; |
| 469 | 469 | } |
| 470 | 470 | } |
| 471 | 471 | |
| 472 | - if(!$stype){
|
|
| 472 | + if (!$stype) {
|
|
| 473 | 473 | $stype = 'gd_place'; |
| 474 | 474 | } |
| 475 | 475 | |
@@ -494,14 +494,14 @@ discard block |
||
| 494 | 494 | switch ($output): |
| 495 | 495 | case 'object': |
| 496 | 496 | case 'Object': |
| 497 | - $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types; |
|
| 497 | + $post_types = json_decode(json_encode($post_types), FALSE); //(object)$post_types; |
|
| 498 | 498 | break; |
| 499 | 499 | case 'array': |
| 500 | 500 | case 'Array': |
| 501 | - $post_types = (array)$post_types; |
|
| 501 | + $post_types = (array) $post_types; |
|
| 502 | 502 | break; |
| 503 | 503 | case 'options': |
| 504 | - $post_types = (array)$post_types; |
|
| 504 | + $post_types = (array) $post_types; |
|
| 505 | 505 | |
| 506 | 506 | $options = array(); |
| 507 | 507 | if (!empty($post_types)) {
|
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | $gd_taxonomies[] = $taxonomy; |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | - if ($tages_taxonomies === false && substr($taxonomy , -5) == '_tags') {
|
|
| 572 | + if ($tages_taxonomies === false && substr($taxonomy, -5) == '_tags') {
|
|
| 573 | 573 | if (array_search($taxonomy, $gd_taxonomies) !== false) {
|
| 574 | 574 | unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
| 575 | 575 | } |
@@ -615,15 +615,15 @@ discard block |
||
| 615 | 615 | |
| 616 | 616 | $categories = get_terms($taxonomies); |
| 617 | 617 | |
| 618 | - $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>';
|
|
| 618 | + $html .= '<option value="0">'.__('All', 'geodirectory').'</option>';
|
|
| 619 | 619 | |
| 620 | 620 | foreach ($categories as $category_obj) {
|
| 621 | 621 | $select_opt = ''; |
| 622 | 622 | if ($selected == $category_obj->term_id) {
|
| 623 | 623 | $select_opt = 'selected="selected"'; |
| 624 | 624 | } |
| 625 | - $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">' |
|
| 626 | - . geodir_utf8_ucfirst($category_obj->name) . '</option>'; |
|
| 625 | + $html .= '<option '.$select_opt.' value="'.$category_obj->term_id.'">' |
|
| 626 | + . geodir_utf8_ucfirst($category_obj->name).'</option>'; |
|
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | if ($echo) |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | } elseif (isset($wp_query->tax_query->queries)) {
|
| 692 | 692 | $tax_arr = $wp_query->tax_query->queries; |
| 693 | 693 | //if tax query has 'relation' set then it will break wp_list_pluck so we remove it |
| 694 | - if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);}
|
|
| 694 | + if (isset($tax_arr['relation'])) {unset($tax_arr['relation']); }
|
|
| 695 | 695 | $taxonomies = wp_list_pluck($tax_arr, 'taxonomy'); |
| 696 | 696 | } |
| 697 | 697 | |
@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | |
| 746 | 746 | if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) {
|
| 747 | 747 | if ($cat_parent == 0) {
|
| 748 | - $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display; |
|
| 748 | + $list_class = 'main_list gd-parent-cats-list gd-cats-display-'.$cat_display; |
|
| 749 | 749 | $main_list_class = 'class="main_list_selecter"'; |
| 750 | 750 | } else {
|
| 751 | 751 | //$display = 'display:none'; |
@@ -755,7 +755,7 @@ discard block |
||
| 755 | 755 | |
| 756 | 756 | if ($cat_display == 'checkbox' || $cat_display == 'radio') {
|
| 757 | 757 | $p = 0; |
| 758 | - $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
| 758 | + $out = '<div class="'.$list_class.' gd-cat-row-'.$cat_parent.'" style="margin-left:'.$p.'px;'.$display.';">'; |
|
| 759 | 759 | } |
| 760 | 760 | |
| 761 | 761 | foreach ($cat_terms as $cat_term) {
|
@@ -770,12 +770,12 @@ discard block |
||
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | if ($cat_display == 'radio') |
| 773 | - $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
| 773 | + $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.geodir_utf8_ucfirst($cat_term->name).'</span>'; |
|
| 774 | 774 | elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
| 775 | - $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
| 775 | + $out .= '<option '.$main_list_class.' style="margin-left:'.$p.'px;" alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' >'.$term_check.geodir_utf8_ucfirst($cat_term->name).'</option>'; |
|
| 776 | 776 | |
| 777 | 777 | else {
|
| 778 | - $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
| 778 | + $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.geodir_utf8_ucfirst($cat_term->name).'</span>'; |
|
| 779 | 779 | } |
| 780 | 780 | |
| 781 | 781 | // Call recurson to print sub cats |
@@ -814,7 +814,7 @@ discard block |
||
| 814 | 814 | $cat_exclude = serialize($exclude_cats); |
| 815 | 815 | |
| 816 | 816 | if (isset($_REQUEST['backandedit'])) {
|
| 817 | - $post = (object)$gd_session->get('listing');
|
|
| 817 | + $post = (object) $gd_session->get('listing');
|
|
| 818 | 818 | |
| 819 | 819 | if (!is_array($post->post_category[$cat_taxonomy])) |
| 820 | 820 | $post_category = $post->post_category[$cat_taxonomy]; |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | |
| 847 | 847 | if (!empty($post_category)) {
|
| 848 | 848 | $cat1 = array_filter(explode(',', $post_category));
|
| 849 | - $post_category = ',' . implode(',', $cat1) . ',';
|
|
| 849 | + $post_category = ','.implode(',', $cat1).',';
|
|
| 850 | 850 | |
| 851 | 851 | } |
| 852 | 852 | |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | foreach ($post_category_upd as $cat) {
|
| 858 | 858 | |
| 859 | 859 | if (!in_array($cat, $exclude_cats) && $cat != '') {
|
| 860 | - $post_category_change .= ',' . $cat; |
|
| 860 | + $post_category_change .= ','.$cat; |
|
| 861 | 861 | } |
| 862 | 862 | } |
| 863 | 863 | $post_category = $post_category_change; |
@@ -869,11 +869,11 @@ discard block |
||
| 869 | 869 | } |
| 870 | 870 | } |
| 871 | 871 | |
| 872 | - echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']" />'; |
|
| 872 | + echo '<input type="hidden" id="cat_limit" value="'.$cat_limit.'" name="cat_limit['.$cat_taxonomy.']" />'; |
|
| 873 | 873 | |
| 874 | - echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']" />'; |
|
| 874 | + echo '<input type="hidden" id="post_category" value="'.$post_category.'" name="post_category['.$cat_taxonomy.']" />'; |
|
| 875 | 875 | |
| 876 | - echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']" />'; |
|
| 876 | + echo '<input type="hidden" id="post_category_str" value="'.$post_category_str.'" name="post_category_str['.$cat_taxonomy.']" />'; |
|
| 877 | 877 | |
| 878 | 878 | |
| 879 | 879 | ?> |
@@ -892,14 +892,14 @@ discard block |
||
| 892 | 892 | |
| 893 | 893 | function show_subcatlist(main_cat, catObj) {
|
| 894 | 894 | if (main_cat != '') {
|
| 895 | - var url = '<?php echo geodir_get_ajax_url();?>'; |
|
| 896 | - var cat_taxonomy = '<?php echo $cat_taxonomy;?>'; |
|
| 897 | - var cat_exclude = '<?php echo base64_encode($cat_exclude);?>'; |
|
| 895 | + var url = '<?php echo geodir_get_ajax_url(); ?>'; |
|
| 896 | + var cat_taxonomy = '<?php echo $cat_taxonomy; ?>'; |
|
| 897 | + var cat_exclude = '<?php echo base64_encode($cat_exclude); ?>'; |
|
| 898 | 898 | var cat_limit = jQuery('#' + cat_taxonomy).find('#cat_limit').val();
|
| 899 | - <?php if ((int)$cat_limit > 0) { ?>
|
|
| 899 | + <?php if ((int) $cat_limit > 0) { ?>
|
|
| 900 | 900 | var selected = parseInt(jQuery('#' + cat_taxonomy).find('.cat_sublist > div.post_catlist_item').length);
|
| 901 | 901 | if (cat_limit != '' && selected > 0 && selected >= cat_limit && cat_limit != 0) {
|
| 902 | - alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int)$cat_limit));?>");
|
|
| 902 | + alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int) $cat_limit)); ?>");
|
|
| 903 | 903 | return false; |
| 904 | 904 | } |
| 905 | 905 | <?php } ?> |
@@ -938,7 +938,7 @@ discard block |
||
| 938 | 938 | } |
| 939 | 939 | |
| 940 | 940 | function update_listing_cat(el) {
|
| 941 | - var cat_taxonomy = '<?php echo $cat_taxonomy;?>'; |
|
| 941 | + var cat_taxonomy = '<?php echo $cat_taxonomy; ?>'; |
|
| 942 | 942 | var cat_ids = ''; |
| 943 | 943 | var main_cat = ''; |
| 944 | 944 | var sub_cat = ''; |
@@ -1019,7 +1019,7 @@ discard block |
||
| 1019 | 1019 | <div class="main_cat_list" style=" <?php if (isset($style)) {
|
| 1020 | 1020 | echo $style; |
| 1021 | 1021 | }?> "> |
| 1022 | - <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
|
| 1022 | + <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
|
| 1023 | 1023 | ?> |
| 1024 | 1024 | </div> |
| 1025 | 1025 | <?php |
@@ -1046,9 +1046,9 @@ discard block |
||
| 1046 | 1046 | if ($exclude != '') {
|
| 1047 | 1047 | $exclude_cats = maybe_unserialize(base64_decode($exclude)); |
| 1048 | 1048 | |
| 1049 | - if(is_array( $exclude_cats)){
|
|
| 1050 | - $exclude_cats = array_map( 'intval', $exclude_cats ); |
|
| 1051 | - }else{
|
|
| 1049 | + if (is_array($exclude_cats)) {
|
|
| 1050 | + $exclude_cats = array_map('intval', $exclude_cats);
|
|
| 1051 | + } else {
|
|
| 1052 | 1052 | $exclude_cats = intval($exclude_cats); |
| 1053 | 1053 | } |
| 1054 | 1054 | |
@@ -1062,25 +1062,25 @@ discard block |
||
| 1062 | 1062 | <?php $main_cat = get_term($parrent, $request_taxonomy); ?> |
| 1063 | 1063 | |
| 1064 | 1064 | <div class="post_catlist_item" style="border:1px solid #CCCCCC; margin:5px auto; padding:5px;"> |
| 1065 | - <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png';?>" |
|
| 1065 | + <img alt="move icon" src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png'; ?>" |
|
| 1066 | 1066 | onclick="jQuery(this).closest('div').remove();update_listing_cat(this);" align="right"/>
|
| 1067 | 1067 | <?php /* ?> |
| 1068 | 1068 | <img src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png';?>" onclick="jQuery(this).closest('div').remove();show_subcatlist();" align="right" />
|
| 1069 | 1069 | <?php */ ?> |
| 1070 | 1070 | |
| 1071 | - <input type="checkbox" value="<?php echo $main_cat->term_id;?>" class="listing_main_cat" |
|
| 1071 | + <input type="checkbox" value="<?php echo $main_cat->term_id; ?>" class="listing_main_cat" |
|
| 1072 | 1072 | 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()"
|
| 1073 | 1073 | checked="checked" disabled="disabled"/> |
| 1074 | 1074 | <span> |
| 1075 | - <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
|
|
| 1075 | + <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
|
|
| 1076 | 1076 | </span> |
| 1077 | 1077 | <br/> |
| 1078 | 1078 | |
| 1079 | 1079 | <div class="post_default_category"> |
| 1080 | - <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>" |
|
| 1081 | - onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?> /> |
|
| 1080 | + <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id; ?>" |
|
| 1081 | + onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" '; ?> /> |
|
| 1082 | 1082 | <span> |
| 1083 | - <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?>
|
|
| 1083 | + <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?>
|
|
| 1084 | 1084 | </span> |
| 1085 | 1085 | </div> |
| 1086 | 1086 | |
@@ -1113,7 +1113,7 @@ discard block |
||
| 1113 | 1113 | $post_cat_str = $post_categories[$request_taxonomy]; |
| 1114 | 1114 | $post_cat_array = explode("#", $post_cat_str);
|
| 1115 | 1115 | if (is_array($post_cat_array)) {
|
| 1116 | - $post_cat_array = array_unique( $post_cat_array ); |
|
| 1116 | + $post_cat_array = array_unique($post_cat_array); |
|
| 1117 | 1117 | |
| 1118 | 1118 | foreach ($post_cat_array as $post_cat_html) {
|
| 1119 | 1119 | |
@@ -1128,7 +1128,7 @@ discard block |
||
| 1128 | 1128 | } |
| 1129 | 1129 | $post_sub_catid = ''; |
| 1130 | 1130 | if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
|
| 1131 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
| 1131 | + $post_sub_catid = (int) $post_cat_info[1]; |
|
| 1132 | 1132 | } |
| 1133 | 1133 | |
| 1134 | 1134 | geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
@@ -1149,7 +1149,7 @@ discard block |
||
| 1149 | 1149 | } |
| 1150 | 1150 | |
| 1151 | 1151 | if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) {
|
| 1152 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
| 1152 | + $post_sub_catid = (int) $post_cat_info[1]; |
|
| 1153 | 1153 | } |
| 1154 | 1154 | |
| 1155 | 1155 | geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
@@ -1181,9 +1181,9 @@ discard block |
||
| 1181 | 1181 | if (!$selected) |
| 1182 | 1182 | $option_slected = ' selected="selected" '; |
| 1183 | 1183 | |
| 1184 | - echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
|
| 1184 | + echo '<select field_type="select" id="'.sanitize_text_field($cat_taxonomy).'" class="chosen_select" '.$onchange.' option-ajaxChosen="false" >'; |
|
| 1185 | 1185 | |
| 1186 | - echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>';
|
|
| 1186 | + echo '<option value="" '.$option_selected.' >'.__('Select Category', 'geodirectory').'</option>';
|
|
| 1187 | 1187 | |
| 1188 | 1188 | foreach ($cat_terms as $cat_term) {
|
| 1189 | 1189 | $option_selected = ''; |
@@ -1191,10 +1191,10 @@ discard block |
||
| 1191 | 1191 | $option_selected = ' selected="selected" '; |
| 1192 | 1192 | |
| 1193 | 1193 | // Count child terms |
| 1194 | - $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
|
| 1195 | - $has_child = !empty( $child_terms ) ? 't' : 'f'; |
|
| 1194 | + $child_terms = get_terms($cat_taxonomy, array('parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1));
|
|
| 1195 | + $has_child = !empty($child_terms) ? 't' : 'f'; |
|
| 1196 | 1196 | |
| 1197 | - echo '<option ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
| 1197 | + echo '<option '.$option_selected.' alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" _hc="'.$has_child.'" >'.geodir_utf8_ucfirst($cat_term->name).'</option>'; |
|
| 1198 | 1198 | } |
| 1199 | 1199 | echo '</select>'; |
| 1200 | 1200 | } |
@@ -1225,7 +1225,7 @@ discard block |
||
| 1225 | 1225 | 2 => __('Custom field updated.', 'geodirectory'),
|
| 1226 | 1226 | 3 => __('Custom field deleted.', 'geodirectory'),
|
| 1227 | 1227 | 4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name),
|
| 1228 | - 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,
|
|
| 1228 | + 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,
|
|
| 1229 | 1229 | 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),
|
| 1230 | 1230 | 7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name),
|
| 1231 | 1231 | 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),
|
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | |
| 1252 | 1252 | global $wpdb; |
| 1253 | 1253 | |
| 1254 | - $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
|
| 1254 | + $menu_icon = geodir_plugin_url().'/geodirectory-assets/images/favicon.ico'; |
|
| 1255 | 1255 | |
| 1256 | 1256 | if (!$listing_slug = get_option('geodir_listing_prefix'))
|
| 1257 | 1257 | $listing_slug = 'places'; |
@@ -1264,11 +1264,11 @@ discard block |
||
| 1264 | 1264 | |
| 1265 | 1265 | $gd_placetags = array(); |
| 1266 | 1266 | $gd_placetags['object_type'] = 'gd_place'; |
| 1267 | - $gd_placetags['listing_slug'] = $listing_slug . '/tags'; |
|
| 1267 | + $gd_placetags['listing_slug'] = $listing_slug.'/tags'; |
|
| 1268 | 1268 | $gd_placetags['args'] = array( |
| 1269 | 1269 | 'public' => true, |
| 1270 | 1270 | 'hierarchical' => false, |
| 1271 | - 'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true),
|
|
| 1271 | + 'rewrite' => array('slug' => $listing_slug.'/tags', 'with_front' => false, 'hierarchical' => true),
|
|
| 1272 | 1272 | 'query_var' => true, |
| 1273 | 1273 | |
| 1274 | 1274 | 'labels' => array( |
@@ -1362,7 +1362,7 @@ discard block |
||
| 1362 | 1362 | 'menu_icon' => $menu_icon, |
| 1363 | 1363 | 'public' => true, |
| 1364 | 1364 | 'query_var' => true, |
| 1365 | - 'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
|
|
| 1365 | + 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true, 'feeds' => true),
|
|
| 1366 | 1366 | 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/),
|
| 1367 | 1367 | 'taxonomies' => array('gd_placecategory', 'gd_place_tags'));
|
| 1368 | 1368 | |
@@ -1395,12 +1395,12 @@ discard block |
||
| 1395 | 1395 | return $_REQUEST['lang']; |
| 1396 | 1396 | } |
| 1397 | 1397 | |
| 1398 | - $url = str_replace(array("http://","https://"),"",$url);
|
|
| 1398 | + $url = str_replace(array("http://", "https://"), "", $url);
|
|
| 1399 | 1399 | |
| 1400 | 1400 | // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang.
|
| 1401 | - $site_url = str_replace(array("http://","https://"),"",site_url());
|
|
| 1401 | + $site_url = str_replace(array("http://", "https://"), "", site_url());
|
|
| 1402 | 1402 | |
| 1403 | - $url = str_replace($site_url,"",$url); |
|
| 1403 | + $url = str_replace($site_url, "", $url); |
|
| 1404 | 1404 | |
| 1405 | 1405 | $segments = explode('/', trim($url, '/'));
|
| 1406 | 1406 | |
@@ -1456,7 +1456,7 @@ discard block |
||
| 1456 | 1456 | |
| 1457 | 1457 | global $wpdb, $wp_query, $plugin_prefix, $post, $comment_post_cache, $gd_permalink_cache; |
| 1458 | 1458 | if (isset($post_obj->ID) && isset($post->ID) && $post_obj->ID == $post->ID) {
|
| 1459 | - if($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending'){return $post_link;}
|
|
| 1459 | + if ($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending') {return $post_link; }
|
|
| 1460 | 1460 | } elseif (isset($post_obj->post_status) && ($post_obj->post_status == 'auto-draft' || $post_obj->post_status == 'draft' || $post_obj->post_status == 'pending')) {
|
| 1461 | 1461 | return $post_link; |
| 1462 | 1462 | } else {
|
@@ -1470,9 +1470,9 @@ discard block |
||
| 1470 | 1470 | |
| 1471 | 1471 | |
| 1472 | 1472 | // if we dont have a GD post then try to grab it |
| 1473 | - if(!isset($post->default_category)){
|
|
| 1473 | + if (!isset($post->default_category)) {
|
|
| 1474 | 1474 | $gd_post = geodir_get_post_info($post->ID); |
| 1475 | - if(!empty($gd_post)){
|
|
| 1475 | + if (!empty($gd_post)) {
|
|
| 1476 | 1476 | $post = $gd_post; |
| 1477 | 1477 | } |
| 1478 | 1478 | } |
@@ -1482,17 +1482,17 @@ discard block |
||
| 1482 | 1482 | $slug = $post_types[$post->post_type]['rewrite']['slug']; |
| 1483 | 1483 | |
| 1484 | 1484 | // Alter the CPT slug if WPML is set to do so |
| 1485 | - if(geodir_wpml_is_post_type_translated($post->post_type)){
|
|
| 1486 | - if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
|
|
| 1485 | + if (geodir_wpml_is_post_type_translated($post->post_type)) {
|
|
| 1486 | + if (gd_wpml_slug_translation_turned_on($post->post_type) && $language_code = gd_wpml_get_lang_from_url($post_link)) {
|
|
| 1487 | 1487 | |
| 1488 | 1488 | $org_slug = $slug; |
| 1489 | - $slug = apply_filters( 'wpml_translate_single_string', |
|
| 1489 | + $slug = apply_filters('wpml_translate_single_string',
|
|
| 1490 | 1490 | $slug, |
| 1491 | 1491 | 'WordPress', |
| 1492 | - 'URL slug: ' . $slug, |
|
| 1492 | + 'URL slug: '.$slug, |
|
| 1493 | 1493 | $language_code); |
| 1494 | 1494 | |
| 1495 | - if(!$slug){$slug = $org_slug;}
|
|
| 1495 | + if (!$slug) {$slug = $org_slug; }
|
|
| 1496 | 1496 | |
| 1497 | 1497 | } |
| 1498 | 1498 | } |
@@ -1514,11 +1514,11 @@ discard block |
||
| 1514 | 1514 | } |
| 1515 | 1515 | |
| 1516 | 1516 | $post_link = trailingslashit( |
| 1517 | - preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
|
| 1517 | + preg_replace("/".preg_quote($slug, "/")."/", $slug."/%gd_taxonomy%", $post_link, 1)
|
|
| 1518 | 1518 | ); |
| 1519 | 1519 | |
| 1520 | 1520 | if ($fix_url) {
|
| 1521 | - $post_link = $site_url . $post_link; |
|
| 1521 | + $post_link = $site_url.$post_link; |
|
| 1522 | 1522 | } |
| 1523 | 1523 | |
| 1524 | 1524 | if (isset($comment_post_cache[$post->ID])) {
|
@@ -1537,12 +1537,12 @@ discard block |
||
| 1537 | 1537 | $ID = $post->ID; |
| 1538 | 1538 | $post2 = $wpdb->get_row( |
| 1539 | 1539 | $wpdb->prepare( |
| 1540 | - "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
| 1540 | + "SELECT * from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ", |
|
| 1541 | 1541 | array($post->ID) |
| 1542 | 1542 | ) |
| 1543 | 1543 | ); |
| 1544 | 1544 | |
| 1545 | - $post = (object)array_merge((array)$post, (array)$post2); |
|
| 1545 | + $post = (object) array_merge((array) $post, (array) $post2); |
|
| 1546 | 1546 | |
| 1547 | 1547 | $comment_post_cache[$post->ID] = $post; |
| 1548 | 1548 | } |
@@ -1551,7 +1551,7 @@ discard block |
||
| 1551 | 1551 | |
| 1552 | 1552 | if (false !== strpos($post_link, '%gd_taxonomy%')) {
|
| 1553 | 1553 | |
| 1554 | - if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) {
|
|
| 1554 | + if (apply_filters("geodir_add_location_url_to_url", get_option('geodir_add_location_url'), $post->post_type, $post)) {
|
|
| 1555 | 1555 | $location_request = ''; |
| 1556 | 1556 | |
| 1557 | 1557 | |
@@ -1565,7 +1565,7 @@ discard block |
||
| 1565 | 1565 | $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
|
| 1566 | 1566 | $post->country_slug = str_replace(']', '', $post->country_slug);
|
| 1567 | 1567 | |
| 1568 | - $post_location = (object)array('country_slug' => $post->country_slug,
|
|
| 1568 | + $post_location = (object) array('country_slug' => $post->country_slug,
|
|
| 1569 | 1569 | 'region_slug' => $post->region_slug, |
| 1570 | 1570 | 'city_slug' => $post->city_slug |
| 1571 | 1571 | ); |
@@ -1578,7 +1578,7 @@ discard block |
||
| 1578 | 1578 | |
| 1579 | 1579 | $post_location_sql = $wpdb->get_results( |
| 1580 | 1580 | $wpdb->prepare( |
| 1581 | - "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
| 1581 | + "SELECT post_locations from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ", |
|
| 1582 | 1582 | array($post->ID) |
| 1583 | 1583 | ) |
| 1584 | 1584 | ); |
@@ -1594,7 +1594,7 @@ discard block |
||
| 1594 | 1594 | $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]);
|
| 1595 | 1595 | $post->country_slug = str_replace(']', '', $post->country_slug);
|
| 1596 | 1596 | |
| 1597 | - $post_location = (object)array('country_slug' => $post->country_slug,
|
|
| 1597 | + $post_location = (object) array('country_slug' => $post->country_slug,
|
|
| 1598 | 1598 | 'region_slug' => $post->region_slug, |
| 1599 | 1599 | 'city_slug' => $post->city_slug |
| 1600 | 1600 | ); |
@@ -1623,7 +1623,7 @@ discard block |
||
| 1623 | 1623 | } |
| 1624 | 1624 | $location_slug[] = $city_slug; |
| 1625 | 1625 | |
| 1626 | - $location_request .= implode('/', $location_slug) . '/';
|
|
| 1626 | + $location_request .= implode('/', $location_slug).'/';
|
|
| 1627 | 1627 | } |
| 1628 | 1628 | } |
| 1629 | 1629 | |
@@ -1638,9 +1638,9 @@ discard block |
||
| 1638 | 1638 | } else {
|
| 1639 | 1639 | $post_terms = ''; |
| 1640 | 1640 | |
| 1641 | - if(isset($_POST['post_default_category']) && $_POST['post_default_category']){
|
|
| 1641 | + if (isset($_POST['post_default_category']) && $_POST['post_default_category']) {
|
|
| 1642 | 1642 | $post_terms = absint($_POST['post_default_category']); |
| 1643 | - }elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) {
|
|
| 1643 | + }elseif (isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) {
|
|
| 1644 | 1644 | $post_terms = is_array($_POST['post_category'][$taxonomies]) ? $_POST['post_category'][$taxonomies] : explode(",", trim($_POST['post_category'][$taxonomies], ","));
|
| 1645 | 1645 | $post_terms = !empty($post_terms) ? absint($post_terms[0]) : 0; |
| 1646 | 1646 | }elseif (isset($post->{$taxonomies})) {
|
@@ -1686,14 +1686,14 @@ discard block |
||
| 1686 | 1686 | $request_term = trim($request_term, '/'); |
| 1687 | 1687 | |
| 1688 | 1688 | // Fix with WPML the location terms added twice when CPT slug is translated. |
| 1689 | - if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/' . $request_term . $detailurl_separator) !== false) {
|
|
| 1689 | + if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/'.$request_term.$detailurl_separator) !== false) {
|
|
| 1690 | 1690 | $post_link = str_replace('%gd_taxonomy%/', '', $post_link);
|
| 1691 | 1691 | } |
| 1692 | 1692 | |
| 1693 | 1693 | if (!empty($request_term)) |
| 1694 | - $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
|
|
| 1694 | + $post_link = str_replace('%gd_taxonomy%', $request_term.$detailurl_separator, $post_link);
|
|
| 1695 | 1695 | else |
| 1696 | - $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link);
|
|
| 1696 | + $post_link = str_replace('/%gd_taxonomy%', $request_term.$detailurl_separator, $post_link);
|
|
| 1697 | 1697 | //echo $post_link ; |
| 1698 | 1698 | } |
| 1699 | 1699 | // temp cache the permalink |
@@ -1786,9 +1786,9 @@ discard block |
||
| 1786 | 1786 | $url_separator = ''; |
| 1787 | 1787 | |
| 1788 | 1788 | if (get_option('permalink_structure') != '') {
|
| 1789 | - $old_listing_slug = '/' . $listing_slug . '/'; |
|
| 1789 | + $old_listing_slug = '/'.$listing_slug.'/'; |
|
| 1790 | 1790 | $request_term = implode("/", $location_terms);
|
| 1791 | - $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/'; |
|
| 1791 | + $new_listing_slug = '/'.$listing_slug.'/'.$request_term.'/'; |
|
| 1792 | 1792 | |
| 1793 | 1793 | $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug)); |
| 1794 | 1794 | } else {
|
@@ -1808,25 +1808,25 @@ discard block |
||
| 1808 | 1808 | // Alter the CPT slug if WPML is set to do so |
| 1809 | 1809 | if (geodir_is_wpml()) {
|
| 1810 | 1810 | $post_types = get_option('geodir_post_types');
|
| 1811 | - $post_type = str_replace("category","",$taxonomy);
|
|
| 1812 | - $post_type = str_replace("_tags","",$post_type);
|
|
| 1811 | + $post_type = str_replace("category", "", $taxonomy);
|
|
| 1812 | + $post_type = str_replace("_tags", "", $post_type);
|
|
| 1813 | 1813 | $slug = $post_types[$post_type]['rewrite']['slug']; |
| 1814 | 1814 | if (geodir_wpml_is_post_type_translated($post_type) && gd_wpml_slug_translation_turned_on($post_type)) {
|
| 1815 | 1815 | global $sitepress; |
| 1816 | 1816 | $default_lang = $sitepress->get_default_language(); |
| 1817 | 1817 | $language_code = gd_wpml_get_lang_from_url($termlink); |
| 1818 | - if (!$language_code ) {
|
|
| 1819 | - $language_code = $default_lang; |
|
| 1818 | + if (!$language_code) {
|
|
| 1819 | + $language_code = $default_lang; |
|
| 1820 | 1820 | } |
| 1821 | 1821 | |
| 1822 | 1822 | $org_slug = $slug; |
| 1823 | - $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code);
|
|
| 1823 | + $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: '.$slug, $language_code);
|
|
| 1824 | 1824 | |
| 1825 | 1825 | if (!$slug) {
|
| 1826 | 1826 | $slug = $org_slug; |
| 1827 | 1827 | } |
| 1828 | 1828 | |
| 1829 | - $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug ,$termlink, 1));
|
|
| 1829 | + $termlink = trailingslashit(preg_replace("/".preg_quote($org_slug, "/")."/", $slug, $termlink, 1));
|
|
| 1830 | 1830 | } |
| 1831 | 1831 | } |
| 1832 | 1832 | } |
@@ -1856,7 +1856,7 @@ discard block |
||
| 1856 | 1856 | |
| 1857 | 1857 | if (in_array($post_type, geodir_get_posttypes())) {
|
| 1858 | 1858 | if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) {
|
| 1859 | - if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
|
|
| 1859 | + if (geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) {
|
|
| 1860 | 1860 | $location_terms = array( |
| 1861 | 1861 | 'gd_country' => $post->country_slug, |
| 1862 | 1862 | 'gd_region' => $post->region_slug, |
@@ -1873,7 +1873,7 @@ discard block |
||
| 1873 | 1873 | $location_terms = implode("/", $location_terms);
|
| 1874 | 1874 | $location_terms = rtrim($location_terms, '/'); |
| 1875 | 1875 | |
| 1876 | - $link .= urldecode($location_terms) . '/'; |
|
| 1876 | + $link .= urldecode($location_terms).'/'; |
|
| 1877 | 1877 | } else {
|
| 1878 | 1878 | $link = geodir_getlink($link, $location_terms); |
| 1879 | 1879 | } |
@@ -1961,9 +1961,9 @@ discard block |
||
| 1961 | 1961 | return 0; |
| 1962 | 1962 | $where = 't.term_id = %d'; |
| 1963 | 1963 | if (!empty($taxonomy)) |
| 1964 | - return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
| 1964 | + return $wpdb->get_row($wpdb->prepare($tax_select.$where." AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
| 1965 | 1965 | else |
| 1966 | - return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
| 1966 | + return $wpdb->get_var($wpdb->prepare($select.$where, $term)); |
|
| 1967 | 1967 | } |
| 1968 | 1968 | |
| 1969 | 1969 | $term = trim(wp_unslash($term)); |
@@ -1975,7 +1975,7 @@ discard block |
||
| 1975 | 1975 | |
| 1976 | 1976 | $where_fields = array($slug); |
| 1977 | 1977 | if (!empty($taxonomy)) {
|
| 1978 | - $parent = (int)$parent; |
|
| 1978 | + $parent = (int) $parent; |
|
| 1979 | 1979 | if ($parent > 0) {
|
| 1980 | 1980 | $where_fields[] = $parent; |
| 1981 | 1981 | $else_where_fields[] = $parent; |
@@ -2039,13 +2039,13 @@ discard block |
||
| 2039 | 2039 | $post_types = geodir_get_posttypes(); |
| 2040 | 2040 | $tax_arr = array(); |
| 2041 | 2041 | foreach ($post_types as $post_type) {
|
| 2042 | - $tax_arr[] = "'" . $post_type . "category'"; |
|
| 2042 | + $tax_arr[] = "'".$post_type."category'"; |
|
| 2043 | 2043 | } |
| 2044 | 2044 | $tax_c = implode(',', $tax_arr);
|
| 2045 | 2045 | $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)");
|
| 2046 | 2046 | //$terms = get_terms( $taxonomy ); |
| 2047 | 2047 | |
| 2048 | - if($terms) {
|
|
| 2048 | + if ($terms) {
|
|
| 2049 | 2049 | foreach ($terms as $term) {
|
| 2050 | 2050 | $post_type = str_replace("category", "", $term->taxonomy);
|
| 2051 | 2051 | $a_terms[$post_type][] = $term; |
@@ -2053,7 +2053,7 @@ discard block |
||
| 2053 | 2053 | } |
| 2054 | 2054 | } |
| 2055 | 2055 | |
| 2056 | - if($a_terms) {
|
|
| 2056 | + if ($a_terms) {
|
|
| 2057 | 2057 | foreach ($a_terms as $pt => $t2) {
|
| 2058 | 2058 | |
| 2059 | 2059 | foreach ($t2 as $term) {
|
@@ -2078,7 +2078,7 @@ discard block |
||
| 2078 | 2078 | } |
| 2079 | 2079 | |
| 2080 | 2080 | if (is_ssl()) {
|
| 2081 | - $terms_icons = str_replace("http:","https:",$terms_icons );
|
|
| 2081 | + $terms_icons = str_replace("http:", "https:", $terms_icons);
|
|
| 2082 | 2082 | } |
| 2083 | 2083 | |
| 2084 | 2084 | return apply_filters('geodir_get_term_icons', $terms_icons, $term_id);
|
@@ -13,34 +13,34 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | function geodir_user_favourite_listing_count($user_id=false) |
| 15 | 15 | { |
| 16 | - global $wpdb, $plugin_prefix, $current_user; |
|
| 16 | + global $wpdb, $plugin_prefix, $current_user; |
|
| 17 | 17 | |
| 18 | - if(!$user_id){$user_id = $current_user->ID;} |
|
| 19 | - if(!$user_id){return array();} |
|
| 18 | + if(!$user_id){$user_id = $current_user->ID;} |
|
| 19 | + if(!$user_id){return array();} |
|
| 20 | 20 | |
| 21 | - $site_id = ''; |
|
| 22 | - if ( is_multisite() ) { |
|
| 23 | - $blog_id = get_current_blog_id(); |
|
| 24 | - if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
| 25 | - } |
|
| 21 | + $site_id = ''; |
|
| 22 | + if ( is_multisite() ) { |
|
| 23 | + $blog_id = get_current_blog_id(); |
|
| 24 | + if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - $user_favorites = geodir_get_user_favourites($user_id); |
|
| 28 | - $all_posts = get_option('geodir_favorite_link_user_dashboard'); |
|
| 27 | + $user_favorites = geodir_get_user_favourites($user_id); |
|
| 28 | + $all_posts = get_option('geodir_favorite_link_user_dashboard'); |
|
| 29 | 29 | |
| 30 | - $user_listing = array(); |
|
| 31 | - if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) { |
|
| 32 | - $user_favorites = "'" . implode("','", $user_favorites) . "'"; |
|
| 30 | + $user_listing = array(); |
|
| 31 | + if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) { |
|
| 32 | + $user_favorites = "'" . implode("','", $user_favorites) . "'"; |
|
| 33 | 33 | |
| 34 | - foreach ($all_posts as $ptype) { |
|
| 35 | - $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")"); |
|
| 34 | + foreach ($all_posts as $ptype) { |
|
| 35 | + $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")"); |
|
| 36 | 36 | |
| 37 | - if ($total_posts > 0) { |
|
| 38 | - $user_listing[$ptype] = $total_posts; |
|
| 39 | - } |
|
| 40 | - } |
|
| 41 | - } |
|
| 37 | + if ($total_posts > 0) { |
|
| 38 | + $user_listing[$ptype] = $total_posts; |
|
| 39 | + } |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - return $user_listing; |
|
| 43 | + return $user_listing; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
@@ -53,51 +53,51 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | |
| 55 | 55 | function geodir_user_show_favourites($user_id='',$output_type='select'){ |
| 56 | - // My Favourites in Dashboard |
|
| 57 | - $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard'); |
|
| 58 | - $user_favourite = geodir_user_favourite_listing_count($user_id); |
|
| 59 | - |
|
| 60 | - if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) { |
|
| 61 | - $favourite_links = ''; |
|
| 62 | - $post_types = geodir_get_posttypes('object'); |
|
| 63 | - |
|
| 64 | - $author_link = get_author_posts_url($user_id); |
|
| 65 | - $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false); |
|
| 66 | - |
|
| 67 | - foreach ($post_types as $key => $postobj) { |
|
| 68 | - if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) { |
|
| 69 | - $name = $postobj->labels->name; |
|
| 70 | - $post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false); |
|
| 71 | - |
|
| 72 | - $selected = ''; |
|
| 73 | - |
|
| 74 | - if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) { |
|
| 75 | - $selected = 'selected="selected"'; |
|
| 76 | - } |
|
| 77 | - /** |
|
| 78 | - * Filter favorite listing link. |
|
| 79 | - * |
|
| 80 | - * @since 1.0.0 |
|
| 81 | - * @param string $post_type_link Favorite listing link. |
|
| 82 | - * @param string $key Favorite listing array key. |
|
| 83 | - * @param int $current_user->ID Current user ID. |
|
| 84 | - */ |
|
| 85 | - $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id); |
|
| 86 | - |
|
| 87 | - if($output_type=='select'){ |
|
| 88 | - $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</option>'; |
|
| 89 | - }elseif($output_type=='link'){ |
|
| 90 | - $favourite_links[] = '<a href="' . $post_type_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</a>'; |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - |
|
| 94 | - } |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - if ($favourite_links != '') { |
|
| 98 | - $user = get_user_by( 'ID', $user_id ); |
|
| 99 | - if($output_type=='select') { |
|
| 100 | - ?> |
|
| 56 | + // My Favourites in Dashboard |
|
| 57 | + $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard'); |
|
| 58 | + $user_favourite = geodir_user_favourite_listing_count($user_id); |
|
| 59 | + |
|
| 60 | + if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) { |
|
| 61 | + $favourite_links = ''; |
|
| 62 | + $post_types = geodir_get_posttypes('object'); |
|
| 63 | + |
|
| 64 | + $author_link = get_author_posts_url($user_id); |
|
| 65 | + $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false); |
|
| 66 | + |
|
| 67 | + foreach ($post_types as $key => $postobj) { |
|
| 68 | + if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) { |
|
| 69 | + $name = $postobj->labels->name; |
|
| 70 | + $post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false); |
|
| 71 | + |
|
| 72 | + $selected = ''; |
|
| 73 | + |
|
| 74 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) { |
|
| 75 | + $selected = 'selected="selected"'; |
|
| 76 | + } |
|
| 77 | + /** |
|
| 78 | + * Filter favorite listing link. |
|
| 79 | + * |
|
| 80 | + * @since 1.0.0 |
|
| 81 | + * @param string $post_type_link Favorite listing link. |
|
| 82 | + * @param string $key Favorite listing array key. |
|
| 83 | + * @param int $current_user->ID Current user ID. |
|
| 84 | + */ |
|
| 85 | + $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id); |
|
| 86 | + |
|
| 87 | + if($output_type=='select'){ |
|
| 88 | + $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</option>'; |
|
| 89 | + }elseif($output_type=='link'){ |
|
| 90 | + $favourite_links[] = '<a href="' . $post_type_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</a>'; |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + |
|
| 94 | + } |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + if ($favourite_links != '') { |
|
| 98 | + $user = get_user_by( 'ID', $user_id ); |
|
| 99 | + if($output_type=='select') { |
|
| 100 | + ?> |
|
| 101 | 101 | <li> |
| 102 | 102 | <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" |
| 103 | 103 | option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false" |
@@ -108,62 +108,62 @@ discard block |
||
| 108 | 108 | </select> |
| 109 | 109 | </li> |
| 110 | 110 | <?php |
| 111 | - }elseif($output_type=='link'){ |
|
| 112 | - if(!empty($favourite_links)){ |
|
| 113 | - echo implode(" | ",$favourite_links); |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - } |
|
| 117 | - } |
|
| 118 | - } |
|
| 111 | + }elseif($output_type=='link'){ |
|
| 112 | + if(!empty($favourite_links)){ |
|
| 113 | + echo implode(" | ",$favourite_links); |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + } |
|
| 117 | + } |
|
| 118 | + } |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | |
| 122 | 122 | |
| 123 | 123 | function geodir_user_show_listings($user_id='',$output_type='select'){ |
| 124 | 124 | |
| 125 | - $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard'); |
|
| 126 | - $user_listing = geodir_user_post_listing_count($user_id); |
|
| 127 | - |
|
| 128 | - if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) { |
|
| 129 | - $listing_links = array(); |
|
| 130 | - |
|
| 131 | - $post_types = geodir_get_posttypes('object'); |
|
| 132 | - |
|
| 133 | - $author_link = get_author_posts_url($user_id); |
|
| 134 | - $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false); |
|
| 135 | - |
|
| 136 | - foreach ($post_types as $key => $postobj) { |
|
| 137 | - if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) { |
|
| 138 | - $name = $postobj->labels->name; |
|
| 139 | - $listing_link = geodir_getlink($author_link, array('stype' => $key), false); |
|
| 140 | - |
|
| 141 | - $selected = ''; |
|
| 142 | - if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) { |
|
| 143 | - $selected = 'selected="selected"'; |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * Filter my listing link. |
|
| 148 | - * |
|
| 149 | - * @since 1.0.0 |
|
| 150 | - * @param string $listing_link My listing link. |
|
| 151 | - * @param string $key My listing array key. |
|
| 152 | - * @param int $current_user->ID Current user ID. |
|
| 153 | - */ |
|
| 154 | - $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $user_id); |
|
| 155 | - if($output_type=='select') { |
|
| 156 | - $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</option>'; |
|
| 157 | - }elseif($output_type=='link'){ |
|
| 158 | - $listing_links[] = '<a href="' .$listing_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</a>'; |
|
| 159 | - } |
|
| 160 | - } |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | - if ($listing_links != '') { |
|
| 164 | - $user = get_user_by( 'ID', $user_id ); |
|
| 165 | - if($output_type=='select') { |
|
| 166 | - ?> |
|
| 125 | + $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard'); |
|
| 126 | + $user_listing = geodir_user_post_listing_count($user_id); |
|
| 127 | + |
|
| 128 | + if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) { |
|
| 129 | + $listing_links = array(); |
|
| 130 | + |
|
| 131 | + $post_types = geodir_get_posttypes('object'); |
|
| 132 | + |
|
| 133 | + $author_link = get_author_posts_url($user_id); |
|
| 134 | + $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false); |
|
| 135 | + |
|
| 136 | + foreach ($post_types as $key => $postobj) { |
|
| 137 | + if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) { |
|
| 138 | + $name = $postobj->labels->name; |
|
| 139 | + $listing_link = geodir_getlink($author_link, array('stype' => $key), false); |
|
| 140 | + |
|
| 141 | + $selected = ''; |
|
| 142 | + if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) { |
|
| 143 | + $selected = 'selected="selected"'; |
|
| 144 | + } |
|
| 145 | + |
|
| 146 | + /** |
|
| 147 | + * Filter my listing link. |
|
| 148 | + * |
|
| 149 | + * @since 1.0.0 |
|
| 150 | + * @param string $listing_link My listing link. |
|
| 151 | + * @param string $key My listing array key. |
|
| 152 | + * @param int $current_user->ID Current user ID. |
|
| 153 | + */ |
|
| 154 | + $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $user_id); |
|
| 155 | + if($output_type=='select') { |
|
| 156 | + $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</option>'; |
|
| 157 | + }elseif($output_type=='link'){ |
|
| 158 | + $listing_links[] = '<a href="' .$listing_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</a>'; |
|
| 159 | + } |
|
| 160 | + } |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + if ($listing_links != '') { |
|
| 164 | + $user = get_user_by( 'ID', $user_id ); |
|
| 165 | + if($output_type=='select') { |
|
| 166 | + ?> |
|
| 167 | 167 | <li> |
| 168 | 168 | <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" |
| 169 | 169 | option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false" |
@@ -174,14 +174,14 @@ discard block |
||
| 174 | 174 | </select> |
| 175 | 175 | </li> |
| 176 | 176 | <?php |
| 177 | - }elseif($output_type=='link'){ |
|
| 178 | - if(!empty($listing_links )){ |
|
| 179 | - echo implode(" | ",$listing_links ); |
|
| 180 | - } |
|
| 177 | + }elseif($output_type=='link'){ |
|
| 178 | + if(!empty($listing_links )){ |
|
| 179 | + echo implode(" | ",$listing_links ); |
|
| 180 | + } |
|
| 181 | 181 | |
| 182 | - } |
|
| 183 | - } |
|
| 184 | - } |
|
| 182 | + } |
|
| 183 | + } |
|
| 184 | + } |
|
| 185 | 185 | |
| 186 | 186 | } |
| 187 | 187 | |
@@ -193,12 +193,12 @@ discard block |
||
| 193 | 193 | * @return mixed |
| 194 | 194 | */ |
| 195 | 195 | function geodir_get_user_favourites($user_id=''){ |
| 196 | - if(!$user_id){$user_id = get_current_user_id();} |
|
| 197 | - $site_id = ''; |
|
| 198 | - if ( is_multisite() ) { |
|
| 199 | - $blog_id = get_current_blog_id(); |
|
| 200 | - if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - return get_user_meta($user_id, 'gd_user_favourite_post'.$site_id, true); |
|
| 196 | + if(!$user_id){$user_id = get_current_user_id();} |
|
| 197 | + $site_id = ''; |
|
| 198 | + if ( is_multisite() ) { |
|
| 199 | + $blog_id = get_current_blog_id(); |
|
| 200 | + if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + return get_user_meta($user_id, 'gd_user_favourite_post'.$site_id, true); |
|
| 204 | 204 | } |
| 205 | 205 | \ No newline at end of file |
@@ -11,17 +11,17 @@ discard block |
||
| 11 | 11 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
| 12 | 12 | * @return array User listing count for each post type. |
| 13 | 13 | */ |
| 14 | -function geodir_user_favourite_listing_count($user_id=false) |
|
| 14 | +function geodir_user_favourite_listing_count($user_id = false) |
|
| 15 | 15 | { |
| 16 | 16 | global $wpdb, $plugin_prefix, $current_user; |
| 17 | 17 | |
| 18 | - if(!$user_id){$user_id = $current_user->ID;} |
|
| 19 | - if(!$user_id){return array();} |
|
| 18 | + if (!$user_id) {$user_id = $current_user->ID; } |
|
| 19 | + if (!$user_id) {return array(); } |
|
| 20 | 20 | |
| 21 | 21 | $site_id = ''; |
| 22 | - if ( is_multisite() ) { |
|
| 22 | + if (is_multisite()) { |
|
| 23 | 23 | $blog_id = get_current_blog_id(); |
| 24 | - if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
| 24 | + if ($blog_id && $blog_id != '1') {$site_id = '_'.$blog_id; } |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | $user_favorites = geodir_get_user_favourites($user_id); |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | $user_listing = array(); |
| 31 | 31 | if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) { |
| 32 | - $user_favorites = "'" . implode("','", $user_favorites) . "'"; |
|
| 32 | + $user_favorites = "'".implode("','", $user_favorites)."'"; |
|
| 33 | 33 | |
| 34 | 34 | foreach ($all_posts as $ptype) { |
| 35 | - $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")"); |
|
| 35 | + $total_posts = $wpdb->get_var("SELECT count( ID ) FROM ".$wpdb->prefix."posts WHERE post_type='".$ptype."' AND post_status = 'publish' AND ID IN (".$user_favorites.")"); |
|
| 36 | 36 | |
| 37 | 37 | if ($total_posts > 0) { |
| 38 | 38 | $user_listing[$ptype] = $total_posts; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @package GeoDirectory |
| 53 | 53 | */ |
| 54 | 54 | |
| 55 | -function geodir_user_show_favourites($user_id='',$output_type='select'){ |
|
| 55 | +function geodir_user_show_favourites($user_id = '', $output_type = 'select') { |
|
| 56 | 56 | // My Favourites in Dashboard |
| 57 | 57 | $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard'); |
| 58 | 58 | $user_favourite = geodir_user_favourite_listing_count($user_id); |
@@ -84,10 +84,10 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id); |
| 86 | 86 | |
| 87 | - if($output_type=='select'){ |
|
| 88 | - $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</option>'; |
|
| 89 | - }elseif($output_type=='link'){ |
|
| 90 | - $favourite_links[] = '<a href="' . $post_type_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</a>'; |
|
| 87 | + if ($output_type == 'select') { |
|
| 88 | + $favourite_links .= '<option '.$selected.' value="'.$post_type_link.'">'.__(geodir_utf8_ucfirst($name), 'geodirectory').'</option>'; |
|
| 89 | + }elseif ($output_type == 'link') { |
|
| 90 | + $favourite_links[] = '<a href="'.$post_type_link.'">'.__(geodir_utf8_ucfirst($name), 'geodirectory').'</a>'; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | |
@@ -95,8 +95,8 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | if ($favourite_links != '') { |
| 98 | - $user = get_user_by( 'ID', $user_id ); |
|
| 99 | - if($output_type=='select') { |
|
| 98 | + $user = get_user_by('ID', $user_id); |
|
| 99 | + if ($output_type == 'select') { |
|
| 100 | 100 | ?> |
| 101 | 101 | <li> |
| 102 | 102 | <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value" |
@@ -108,9 +108,9 @@ discard block |
||
| 108 | 108 | </select> |
| 109 | 109 | </li> |
| 110 | 110 | <?php |
| 111 | - }elseif($output_type=='link'){ |
|
| 112 | - if(!empty($favourite_links)){ |
|
| 113 | - echo implode(" | ",$favourite_links); |
|
| 111 | + }elseif ($output_type == 'link') { |
|
| 112 | + if (!empty($favourite_links)) { |
|
| 113 | + echo implode(" | ", $favourite_links); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | |
| 122 | 122 | |
| 123 | -function geodir_user_show_listings($user_id='',$output_type='select'){ |
|
| 123 | +function geodir_user_show_listings($user_id = '', $output_type = 'select') { |
|
| 124 | 124 | |
| 125 | 125 | $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard'); |
| 126 | 126 | $user_listing = geodir_user_post_listing_count($user_id); |
@@ -152,17 +152,17 @@ discard block |
||
| 152 | 152 | * @param int $current_user->ID Current user ID. |
| 153 | 153 | */ |
| 154 | 154 | $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $user_id); |
| 155 | - if($output_type=='select') { |
|
| 156 | - $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</option>'; |
|
| 157 | - }elseif($output_type=='link'){ |
|
| 158 | - $listing_links[] = '<a href="' .$listing_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</a>'; |
|
| 155 | + if ($output_type == 'select') { |
|
| 156 | + $listing_links .= '<option '.$selected.' value="'.$listing_link.'">'.__(geodir_utf8_ucfirst($name), 'geodirectory').'</option>'; |
|
| 157 | + }elseif ($output_type == 'link') { |
|
| 158 | + $listing_links[] = '<a href="'.$listing_link.'">'.__(geodir_utf8_ucfirst($name), 'geodirectory').'</a>'; |
|
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | if ($listing_links != '') { |
| 164 | - $user = get_user_by( 'ID', $user_id ); |
|
| 165 | - if($output_type=='select') { |
|
| 164 | + $user = get_user_by('ID', $user_id); |
|
| 165 | + if ($output_type == 'select') { |
|
| 166 | 166 | ?> |
| 167 | 167 | <li> |
| 168 | 168 | <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value" |
@@ -174,9 +174,9 @@ discard block |
||
| 174 | 174 | </select> |
| 175 | 175 | </li> |
| 176 | 176 | <?php |
| 177 | - }elseif($output_type=='link'){ |
|
| 178 | - if(!empty($listing_links )){ |
|
| 179 | - echo implode(" | ",$listing_links ); |
|
| 177 | + }elseif ($output_type == 'link') { |
|
| 178 | + if (!empty($listing_links)) { |
|
| 179 | + echo implode(" | ", $listing_links); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | } |
@@ -192,12 +192,12 @@ discard block |
||
| 192 | 192 | * @since 1.6.24 |
| 193 | 193 | * @return mixed |
| 194 | 194 | */ |
| 195 | -function geodir_get_user_favourites($user_id=''){ |
|
| 196 | - if(!$user_id){$user_id = get_current_user_id();} |
|
| 195 | +function geodir_get_user_favourites($user_id = '') { |
|
| 196 | + if (!$user_id) {$user_id = get_current_user_id(); } |
|
| 197 | 197 | $site_id = ''; |
| 198 | - if ( is_multisite() ) { |
|
| 198 | + if (is_multisite()) { |
|
| 199 | 199 | $blog_id = get_current_blog_id(); |
| 200 | - if($blog_id && $blog_id!='1'){$site_id = '_' . $blog_id ;} |
|
| 200 | + if ($blog_id && $blog_id != '1') {$site_id = '_'.$blog_id; } |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | return get_user_meta($user_id, 'gd_user_favourite_post'.$site_id, true); |