/** * Load language strings in to file to translate via po editor * * @since 1.4.2 * @package GeoDirectory * * @global null|object $wp_filesystem WP_Filesystem object. * * @return bool True if file created otherwise false */ function geodirectory_load_db_language() { global $wp_filesystem; if (empty($wp_filesystem)) { require_once ABSPATH . '/wp-admin/includes/file.php'; WP_Filesystem(); global $wp_filesystem; } $language_file = geodir_plugin_path() . '/db-language.php'; if (is_file($language_file) && !is_writable($language_file)) { return false; } // Not possible to create. if (!is_file($language_file) && !is_writable(dirname($language_file))) { return false; } // Not possible to create. $contents_strings = array(); /** * Filter the language string from database to translate via po editor * * @since 1.4.2 * * @param array $contents_strings Array of strings. */ $contents_strings = apply_filters('geodir_load_db_language', $contents_strings); $contents_strings = array_unique($contents_strings); $contents_head = array(); $contents_head[] = "<?php"; $contents_head[] = "/**"; $contents_head[] = " * Translate language string stored in database. Ex: Custom Fields"; $contents_head[] = " *"; $contents_head[] = " * @since 1.4.2"; $contents_head[] = " * @package GeoDirectory"; $contents_head[] = " */"; $contents_head[] = ""; $contents_head[] = "// Language keys"; $contents_foot = array(); $contents_foot[] = ""; $contents_foot[] = "?>"; $contents = implode(PHP_EOL, $contents_head); if (!empty($contents_strings)) { foreach ($contents_strings as $string) { if (is_scalar($string) && $string != '') { $string = str_replace("'", "\\'", $string); $contents .= PHP_EOL . "__('" . $string . "', 'geodirectory');"; } } } $contents .= implode(PHP_EOL, $contents_foot); if ($wp_filesystem->put_contents($language_file, $contents, FS_CHMOD_FILE)) { return false; } // Failure; could not write file. return true; }
/** * * @global object $wpdb WordPress Database object. * * @param $atts * @return string */ function geodir_sc_popular_in_neighbourhood($atts) { ob_start(); $defaults = array('post_type' => 'gd_place', 'category' => '0', 'list_sort' => 'latest', 'post_number' => 5, 'layout' => 'gridview_onehalf', 'character_count' => 20, 'add_location_filter' => 1); $params = shortcode_atts($defaults, $atts); /** * Being validating $params */ // Check we have a valid post_type if (!gdsc_is_post_type_valid($params['post_type'])) { $params['post_type'] = 'gd_place'; } // Manage the entered categories if (0 != $params['category'] || '' != $params['category']) { $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']); } // Validate our sorting choice $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']); // Post_number needs to be a positive integer $params['post_number'] = absint($params['post_number']); if (0 == $params['post_number']) { $params['post_number'] = 1; } // Validate our layout choice // Outside of the norm, I added some more simple terms to match the existing // So now I just run the switch to set it properly. $params['layout'] = gdsc_validate_layout_choice($params['layout']); // Validate character_count $params['character_count'] = absint($params['character_count']); if (20 > $params['character_count']) { $params['character_count'] = 20; } /** * End validation */ global $wpdb, $post, $geodir_post_type; if ($geodir_post_type == '') { $geodir_post_type = 'gd_place'; } $all_postypes = geodir_get_posttypes(); $location_id = ''; $not_in_array = array(); if (geodir_is_page('detail') || geodir_is_page('preview') || geodir_is_page('add-listing')) { if (isset($post->post_type) && $post->post_type == $params['post_type'] && isset($post->post_location_id)) { $not_in_array[] = $post->ID; $location_id = $post->post_location_id; } } elseif (in_array($geodir_post_type, $all_postypes) && $geodir_post_type == $params['post_type']) { if (isset($_SESSION['gd_city']) && $_SESSION['gd_city'] != '') { $location_id = $wpdb->get_var($wpdb->prepare("SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug = %s", array($_SESSION['gd_city']))); } else { $default_location = geodir_get_default_location(); $location_id = $default_location->location_id; } } $gd_neighbourhoods = geodir_get_neighbourhoods($location_id); if ($gd_neighbourhoods) { ?> <div class="geodir_locations geodir_location_listing"> <?php $hood_slug_arr = array(); if (!empty($gd_neighbourhoods)) { foreach ($gd_neighbourhoods as $hoodslug) { $hood_slug_arr[] = $hoodslug->hood_slug; } } $query_args = array('posts_per_page' => $params['post_number'], 'is_geodir_loop' => true, 'post__not_in' => $not_in_array, 'gd_neighbourhood' => $hood_slug_arr, 'gd_location' => $params['add_location_filter'] ? true : false, 'post_type' => $params['post_type'], 'order_by' => $params['list_sort'], 'excerpt_length' => $params['character_count']); if ($params['category'] != 0 || $params['category'] != '') { $category_taxonomy = geodir_get_taxonomies($params['post_type']); $tax_query = array('taxonomy' => $category_taxonomy[0], 'field' => 'id', 'terms' => $params['category']); $query_args['tax_query'] = array($tax_query); } global $gridview_columns; query_posts($query_args); if (strstr($params['layout'], 'gridview')) { $listing_view_exp = explode('_', $params['layout']); $gridview_columns = $params['layout']; $layout = $listing_view_exp[0]; } $template = apply_filters("geodir_template_part-listing-listview", geodir_plugin_path() . '/geodirectory-templates/listing-listview.php'); include $template; wp_reset_query(); ?> </div> <?php } $output = ob_get_contents(); ob_end_clean(); return $output; }
/** * Loads custom fields in to file for translation. * * @since 1.0.0 * @package GeoDirectory * @global object $wpdb WordPress Database object. */ function geodir_diagnose_load_db_language() { global $wpdb; $is_error_during_diagnose = geodirectory_load_db_language(); $output_str = ''; if ($is_error_during_diagnose) { $output_str .= "<li>" . __('Fail to load custom fields in to file for translation, please check file permission:', 'geodirectory') . ' ' . geodir_plugin_path() . '/db-language.php' . "</li>"; $info_div_class = "geodir_problem_info"; } else { $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>"; $info_div_class = "geodir_noproblem_info"; $fix_button_txt = ''; } echo "<ul class='{$info_div_class}'>"; echo $output_str; echo $fix_button_txt; echo "</ul>"; }
/** * * @global object $wpdb WordPress Database object. * * @param array $args * @param array $instance */ public function widget($args, $instance) { extract($args, EXTR_SKIP); echo $before_widget; $title = empty($instance['title']) ? $instance['category_title'] : apply_filters('widget_title', $instance['title']); $hood_post_type = empty($instance['hood_post_type']) ? 'gd_place' : apply_filters('widget_hood_post_type', $instance['hood_post_type']); $hood_category = empty($instance['hood_category']) ? '0' : apply_filters('widget_hood_category', $instance['hood_category']); $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']); $layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']); $add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_layout', $instance['add_location_filter']); $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']); $character_count = empty($instance['character_count']) ? 20 : apply_filters('widget_list_sort', $instance['character_count']); if (empty($title) || $title == 'All') { $title .= ' Neighbourhood ' . get_post_type_plural_label($hood_post_type); } global $wpdb, $post, $geodir_post_type; if ($geodir_post_type == '') { $geodir_post_type = 'gd_place'; } $all_postypes = geodir_get_posttypes(); $location_id = ''; $not_in_array = array(); if (geodir_is_page('detail') || geodir_is_page('preview') || geodir_is_page('add-listing')) { if (isset($post->post_type) && $post->post_type == $hood_post_type && isset($post->post_location_id)) { $not_in_array[] = $post->ID; $location_id = $post->post_location_id; } } elseif (in_array($geodir_post_type, $all_postypes) && $geodir_post_type == $hood_post_type) { if (isset($_SESSION['gd_city']) && $_SESSION['gd_city'] != '') { $location_id = $wpdb->get_var($wpdb->prepare("SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug = %s", array($_SESSION['gd_city']))); } else { $default_location = geodir_get_default_location(); $location_id = $default_location->location_id; } } $gd_neighbourhoods = geodir_get_neighbourhoods($location_id); if ($gd_neighbourhoods) { ?> <div class="geodir_locations geodir_location_listing"> <div class="locatin_list_heading clearfix"> <h3><?php _e(ucfirst($title), GEODIRLOCATION_TEXTDOMAIN); ?> </h3> </div> <?php $hood_slug_arr = array(); if (!empty($gd_neighbourhoods)) { foreach ($gd_neighbourhoods as $hoodslug) { $hood_slug_arr[] = $hoodslug->hood_slug; } } $query_args = array('posts_per_page' => $post_number, 'is_geodir_loop' => true, 'post__not_in' => $not_in_array, 'gd_neighbourhood' => $hood_slug_arr, 'gd_location' => $add_location_filter ? true : false, 'post_type' => $hood_post_type, 'order_by' => $list_sort, 'excerpt_length' => $character_count); if ($hood_category != 0 || $hood_category != '') { $category_taxonomy = geodir_get_taxonomies($hood_post_type); $tax_query = array('taxonomy' => $category_taxonomy[0], 'field' => 'id', 'terms' => $hood_category); $query_args['tax_query'] = array($tax_query); } global $gridview_columns; query_posts($query_args); if (strstr($layout, 'gridview')) { $listing_view_exp = explode('_', $layout); $gridview_columns = $layout; $layout = $listing_view_exp[0]; } $template = apply_filters("geodir_template_part-listing-listview", geodir_plugin_path() . '/geodirectory-templates/listing-listview.php'); include $template; wp_reset_query(); ?> </div> <?php } echo $after_widget; }
/** * Processes GeoDirectory ajax url calls. * * @see geodir_get_ajax_url() * @since 1.0.0 * @package GeoDirectory * @global object $wpdb WordPress Database object. * @global object $current_user Current user object. * @todo check if nonce is required here and if so add one. */ function geodir_ajax_handler() { global $wpdb; if (isset($_REQUEST['gd_listing_view']) && $_REQUEST['gd_listing_view'] != '') { $_SESSION['gd_listing_view'] = $_REQUEST['gd_listing_view']; echo '1'; } if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'category_ajax') { if (isset($_REQUEST['main_catid']) && isset($_REQUEST['cat_tax']) && isset($_REQUEST['exclude'])) { geodir_addpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['main_catid'], '', '', '', $_REQUEST['exclude']); } elseif (isset($_REQUEST['catpid']) && isset($_REQUEST['cat_tax'])) { geodir_editpost_categories_html($_REQUEST['cat_tax'], $_REQUEST['catpid']); } } if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'admin_ajax' || isset($_REQUEST['create_field']) || isset($_REQUEST['sort_create_field'])) { if (current_user_can('manage_options')) { /** * Contains admin ajax handling functions. * * @since 1.0.0 * @package GeoDirectory */ include_once geodir_plugin_path() . '/geodirectory-admin/geodir_admin_ajax.php'; } else { wp_redirect(home_url() . '/?geodir_signup=true'); exit; } } if (isset($_REQUEST['geodir_autofill']) && $_REQUEST['geodir_autofill'] != '' && isset($_REQUEST['_wpnonce'])) { if (current_user_can('manage_options')) { switch ($_REQUEST['geodir_autofill']) { case "geodir_dummy_delete": if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_delete_noncename')) { return; } if (isset($_REQUEST['posttype'])) { /** * Used to delete the dummy post data per post type. * * Uses dynamic hook, geodir_delete_dummy_posts_$_REQUEST['posttype']. * * @since 1.0.0 */ do_action('geodir_delete_dummy_posts_' . $_REQUEST['posttype']); } break; case "geodir_dummy_insert": if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir_dummy_posts_insert_noncename')) { return; } global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2; $dummy_post_index = $_REQUEST['insert_dummy_post_index']; $city_bound_lat1 = $_REQUEST['city_bound_lat1']; $city_bound_lng1 = $_REQUEST['city_bound_lng1']; $city_bound_lat2 = $_REQUEST['city_bound_lat2']; $city_bound_lng2 = $_REQUEST['city_bound_lng2']; if (isset($_REQUEST['posttype'])) { /** * Used to insert the dummy post data per post type. * * Uses dynamic hook, geodir_insert_dummy_posts_$_REQUEST['posttype']. * * @since 1.0.0 */ do_action('geodir_insert_dummy_posts_' . $_REQUEST['posttype']); } break; } } else { wp_redirect(home_url() . '/?geodir_signup=true'); exit; } } if (isset($_REQUEST['geodir_import_data']) && $_REQUEST['geodir_import_data'] != '') { if (current_user_can('manage_options')) { geodir_import_data(); } else { wp_redirect(home_url() . '/?geodir_signup=true'); exit; } } if (isset($_REQUEST['popuptype']) && $_REQUEST['popuptype'] != '' && isset($_REQUEST['post_id']) && $_REQUEST['post_id'] != '') { if ($_REQUEST['popuptype'] == 'b_send_inquiry' || $_REQUEST['popuptype'] == 'b_sendtofriend') { require_once geodir_plugin_path() . '/geodirectory-templates/popup-forms.php'; } exit; } /*if(isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'filter_ajax'){ include_once ( geodir_plugin_path() . '/geodirectory-templates/advance-search-form.php'); }*/ if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'map_ajax') { /** * Contains map marker functions. * * @since 1.0.0 * @package GeoDirectory */ include_once geodir_plugin_path() . '/geodirectory-functions/map-functions/get_markers.php'; } if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'favorite') { if (is_user_logged_in()) { switch ($_REQUEST['ajax_action']) { case "add": geodir_add_to_favorite($_REQUEST['pid']); break; case "remove": geodir_remove_from_favorite($_REQUEST['pid']); break; } } else { wp_redirect(home_url() . '/?geodir_signup=true'); exit; } } if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'add_listing') { $is_current_user_owner = true; if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { $is_current_user_owner = geodir_listing_belong_to_current_user($_REQUEST['pid']); } $request = isset($_SESSION['listing']) ? unserialize($_SESSION['listing']) : ''; if (is_user_logged_in() && $is_current_user_owner) { switch ($_REQUEST['ajax_action']) { case "add": case "update": if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') { $last_id = geodir_save_listing(); if ($last_id) { //$redirect_to = get_permalink( $last_id ); $redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id)); } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { $redirect_to = get_permalink(geodir_add_listing_page_id()); $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false); } else { $redirect_to = get_permalink(geodir_add_listing_page_id()); } wp_redirect($redirect_to); } else { if (isset($_SESSION['listing'])) { unset($_SESSION['listing']); } wp_redirect(home_url()); } break; case "cancel": unset($_SESSION['listing']); if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && get_permalink($_REQUEST['pid'])) { wp_redirect(get_permalink($_REQUEST['pid'])); } else { geodir_remove_temp_images(); wp_redirect(geodir_getlink(get_permalink(geodir_add_listing_page_id()), array('listing_type' => $_REQUEST['listing_type']))); } break; case "publish": if (isset($request['geodir_spamblocker']) && $request['geodir_spamblocker'] == '64' && isset($request['geodir_filled_by_spam_bot']) && $request['geodir_filled_by_spam_bot'] == '') { if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { $new_post = array(); $new_post['ID'] = $_REQUEST['pid']; //$new_post['post_status'] = 'publish'; $lastid = wp_update_post($new_post); if (isset($_SESSION['listing'])) { unset($_SESSION['listing']); } wp_redirect(get_permalink($lastid)); } else { $last_id = geodir_save_listing(); if ($last_id) { //$redirect_to = get_permalink( $last_id ); $redirect_to = geodir_getlink(get_permalink(geodir_success_page_id()), array('pid' => $last_id)); } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { $redirect_to = get_permalink(geodir_add_listing_page_id()); $redirect_to = geodir_getlink($redirect_to, array('pid' => $post->pid), false); } else { $redirect_to = get_permalink(geodir_add_listing_page_id()); } if (isset($_SESSION['listing'])) { unset($_SESSION['listing']); } wp_redirect($redirect_to); } } else { if (isset($_SESSION['listing'])) { unset($_SESSION['listing']); } wp_redirect(home_url()); } break; case "delete": if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { global $current_user; get_currentuserinfo(); $post_type = get_post_type($_REQUEST['pid']); $lastid = wp_delete_post($_REQUEST['pid']); if ($lastid && !is_wp_error($lastid)) { wp_redirect($_SERVER['HTTP_REFERER']); } //wp_redirect( geodir_getlink(get_author_posts_url($current_user->ID),array('geodir_dashbord'=>'true','stype'=>$post_type ),false) ); } break; } if (isset($_SESSION['listing'])) { unset($_SESSION['listing']); } } else { if (isset($_SESSION['listing'])) { unset($_SESSION['listing']); } wp_redirect(home_url() . '/?geodir_signup=true'); exit; } } if (isset($_REQUEST['geodir_ajax']) && $_REQUEST['geodir_ajax'] == 'user_login') { /** * Contains registration and login functions. * @todo Fix the file path. * * @since 1.0.0 * @package GeoDirectory */ include_once geodir_plugin_path() . '/geodirectory-functions/geodirectory_reg.php'; } if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'geodir_get_term_list') { $terms_o = get_terms(sanitize_text_field($_REQUEST['term'])); // Skip terms which has no listing if (!empty($terms_o)) { $filter_terms = array(); foreach ($terms_o as $term) { if ($term->count > 0) { $filter_terms[] = $term; } } $terms_o = $filter_terms; } $terms = geodir_sort_terms($terms_o, 'count'); geodir_helper_cat_list_output($terms, intval($_REQUEST['limit'])); exit; } die; }
/** * Output the signup and register forms with included JS to make them work properly. * * @global bool $user_login True if user is logged in. False if not. * @since 1.0.0 * @package GeoDirectory */ function geodir_action_signup_forms() { global $user_login; ?> <script type="text/javascript"> <?php if ($user_login) { ?> setTimeout(function () { try { d = document.getElementById('user_pass'); d.value = ''; d.focus(); } catch (e) { } }, 200); <?php } else { ?> try { document.getElementById('user_login').focus(); } catch (e) { } <?php } ?> </script> <script type="text/javascript"> <?php if ($user_login) { ?> setTimeout(function () { try { d = document.getElementById('user_pass'); d.value = ''; d.focus(); } catch (e) { } }, 200); <?php } else { ?> try { document.getElementById('user_login').focus(); } catch (e) { } <?php } ?> </script><?php global $errors; if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim') { $errors->add('claim_login', LOGIN_CLAIM); } if (!empty($errors)) { foreach ($errors as $errorsObj) { foreach ($errorsObj as $key => $val) { for ($i = 0; $i < count($val); $i++) { echo "<div class=sucess_msg>" . $val[$i] . '</div>'; $registration_error_msg = 1; } } } } if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') { ?> <div class="login_form"> <?php /** * Contains login form template. * * @since 1.0.0 */ include geodir_plugin_path() . "/geodirectory-templates/login_frm.php"; ?> </div> <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up') { ?> <div class="registration_form"> <?php /** * Contains registration form template. * * @since 1.0.0 */ include geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"; ?> </div> <?php } else { ?> <div class="login_form_l"> <?php /** * Contains login form template. * * @since 1.0.0 */ include geodir_plugin_path() . "/geodirectory-templates/login_frm.php"; ?> </div> <div class="registration_form_r"> <?php /** * Contains registration form template. * * @since 1.0.0 */ include geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"; ?> </div> <?php } ?> <script type="text/javascript"> try { document.getElementById('user_login').focus(); } catch (e) { } </script> <?php if (isset($errors->errors['invalidcombo']) && $errors->errors['invalidcombo'] != '' || isset($errors->errors['empty_username']) && $errors->errors['empty_username'] != '') { ?> <script type="text/javascript">document.getElementById('lostpassword_form').style.display = '';</script> <?php } }
<?php /** * Admin ajax. * * @since 1.0.0 * @package GeoDirectory */ if (isset($_REQUEST['create_field'])) { /** * Includes file to create custom fields. * * @since 1.0.0 */ include_once geodir_plugin_path() . '/geodirectory-admin/option-pages/create_field.php'; die; } if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] != '') { switch ($_REQUEST['ajax_action']) { case 'get_cat_dl': geodir_get_categories_dl($_REQUEST['post_type'], $_REQUEST['selected'], false, true); break; } }
/** * Displays setting form for the given tab. * * @since 1.0.0 * @package GeoDirectory * @global array $geodir_settings Geodirectory settings array. * @global object $wpdb WordPress Database object. * @param string $tab_name Tab name. */ function geodir_admin_option_form($tab_name) { //echo $tab_name.'_array.php' ; global $geodir_settings, $is_default, $mapzoom; if (file_exists(dirname(__FILE__) . '/option-pages/' . $tab_name . '_array.php')) { /** * Contains settings array for given tab. * * @since 1.0.0 * @package GeoDirectory */ include_once 'option-pages/' . $tab_name . '_array.php'; } $listing_type = isset($_REQUEST['listing_type']) ? $_REQUEST['listing_type'] : ''; switch ($tab_name) { case 'general_settings': geodir_admin_fields($geodir_settings['general_settings']); /** * * Update Taxonomy Options * * **/ /*add_action('updated_option_place_prefix','update_listing_prefix'); function update_listing_prefix(){ geodir_register_defaults(); }*/ if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings')) { $hide_save_button = "style='display:none;'"; } else { $hide_save_button = ''; } /** * Filter weather the default save button in the GD admin settings pages should be shown. * * @since 1.0.0 * @param string $hide_save_button The style element, either blank or: style='display:none;'. */ $hide_save_button = apply_filters('geodir_hide_save_button', $hide_save_button); ?> <p class="submit"> <input <?php echo $hide_save_button; ?> name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?> " /> <input type="hidden" name="subtab" id="last_tab" /> </p> </div> <?php break; case 'design_settings': geodir_admin_fields($geodir_settings['design_settings']); ?> <p class="submit"> <input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?> " /> <input type="hidden" name="subtab" id="last_tab" /> </p> </div> <?php break; case 'permalink_settings': geodir_admin_fields($geodir_settings['permalink_settings']); ?> <p class="submit"> <input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?> " /> <input type="hidden" name="subtab" id="last_tab" /> </p> </div> <?php break; case 'title_meta_settings': geodir_admin_fields($geodir_settings['title_meta_settings']); ?> <p class="submit"> <input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?> " /> <input type="hidden" name="subtab" id="last_tab" /> </p> </div> <?php break; case 'notifications_settings': geodir_admin_fields($geodir_settings['notifications_settings']); ?> <p class="submit"> <input name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?> " /> <input type="hidden" name="subtab" id="last_tab" /> </p> </div> <?php break; case 'default_location_settings': ?> <div class="inner_content_tab_main"> <div class="gd-content-heading"> <?php global $wpdb; $location_result = geodir_get_default_location(); $prefix = ''; $lat = isset($location_result->city_latitude) ? $location_result->city_latitude : ''; $lng = isset($location_result->city_longitude) ? $location_result->city_longitude : ''; $city = isset($location_result->city) ? $location_result->city : ''; $region = isset($location_result->region) ? $location_result->region : ''; $country = isset($location_result->country) ? $location_result->country : ''; $map_title = __("Set Address On Map", 'geodirectory'); ?> <h3><?php _e('Set Default Location', 'geodirectory'); ?> </h3> <input type="hidden" name="add_location" value="location"> <input type="hidden" name="update_city" value="<?php if (isset($location_result->location_id)) { echo $location_result->location_id; } ?> "> <input type="hidden" name="address" id="<?php echo $prefix; ?> address" value=""> <table class="form-table default_location_form"> <tbody> <tr valign="top" class="single_select_page"> <th class="titledesc" scope="row"><?php _e('City', 'geodirectory'); ?> </th> <td class="forminp"> <div class="gtd-formfeild required"> <input class="require" type="text" size="80" style="width:440px" id="<?php echo $prefix; ?> city" name="city" value="<?php if (isset($location_result->city)) { echo $location_result->city; } ?> "/> <div class="gd-location_message_error"> <?php _e('This field is required.', 'geodirectory'); ?> </div> </div> <span class="description"></span> </td> </tr> <tr valign="top" class="single_select_page"> <th class="titledesc" scope="row"><?php _e('Region', 'geodirectory'); ?> </th> <td class="forminp"> <div class="gtd-formfeild required"> <input class="require" type="text" size="80" style="width:440px" id="<?php echo $prefix; ?> region" name="region" value="<?php if (isset($location_result->region)) { echo $location_result->region; } ?> "/> <div class="gd-location_message_error"> <?php _e('This field is required.', 'geodirectory'); ?> </div> </div> <span class="description"></span> </td> </tr> <tr valign="top" class="single_select_page"> <th class="titledesc" scope="row"><?php _e('Country', 'geodirectory'); ?> </th> <td class="forminp"> <div class="gtd-formfeild required" style="padding-top:10px;"> <?php $country_result = isset($location_result->country) ? $location_result->country : ''; ?> <select id="<?php echo $prefix; ?> country" class="chosen_select" data-location_type="country" name="<?php echo $prefix; ?> country" data-placeholder="<?php _e('Choose a country.', 'geodirectory'); ?> " data-addsearchtermonnorecord="1" data-ajaxchosen="0" data-autoredirect="0" data-showeverywhere="0"> <?php geodir_get_country_dl($country, $prefix); ?> </select> <div class="gd-location_message_error"><?php _e('This field is required.', 'geodirectory'); ?> </div> </div> <span class="description"></span> </td> </tr> <tr valign="top" class="single_select_page"> <th class="titledesc" scope="row"><?php _e('Set Location on Map', 'geodirectory'); ?> </th> <td class="forminp"> <?php /** * Contains add listing page map functions. * * @since 1.0.0 */ include geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php"; ?> </td> </tr> <tr valign="top" class="single_select_page"> <th class="titledesc" scope="row"><?php _e('City Latitude', 'geodirectory'); ?> </th> <td class="forminp"> <div class="gtd-formfeild required" style="padding-top:10px;"> <input type="text" class="require" size="80" style="width:440px" id="<?php echo $prefix; ?> latitude" name="latitude" value="<?php if (isset($location_result->city_latitude)) { echo $location_result->city_latitude; } ?> "/> <div class="gd-location_message_error"><?php _e('This field is required.', 'geodirectory'); ?> </div> </div> <span class="description"></span> </td> </tr> <tr valign="top" class="single_select_page"> <th class="titledesc" scope="row"><?php _e('City Longitude', 'geodirectory'); ?> </th> <td class="forminp"> <div class="gtd-formfeild required" style="padding-top:10px;"> <input type="text" class="require" size="80" style="width:440px" id="<?php echo $prefix; ?> longitude" name="longitude" value="<?php if (isset($location_result->city_longitude)) { echo $location_result->city_longitude; } ?> "/> <div class="gd-location_message_error"><?php _e('This field is required.', 'geodirectory'); ?> </div> </div> <span class="description"></span> </td> </tr> <?php if (isset($location_result->location_id) && $location_result->location_id >= 0) { ?> <tr valign="top" class="single_select_page"> <th class="titledesc" scope="row"><?php _e('Action For Listing', 'geodirectory'); ?> </th> <td class="forminp"> <div class="gtd-formfeild" style="padding-top:10px;"> <input style="display:none;" type="radio" name="listing_action" checked="checked" value="delete"/> <label><?php _e('Post will be updated if both city and map marker position has been changed.', 'geodirectory'); ?> </label> </div> </td> </tr> <?php } ?> </tbody> </table> <p class="submit"> <input type="hidden" name="is_default" value="1"/> <input id="location_save" type="submit" value="Save changes" class="button-primary" name="save"> </p> </div> </div> <?php break; case $listing_type . '_fields_settings': geodir_custom_post_type_form(); break; case 'tools_settings': geodir_diagnostic_tools_setting_page(); break; case 'compatibility_settings': geodir_theme_compatibility_setting_page(); break; case 'import_export': geodir_import_export_page(); break; } // end of switch }
function geodir_claim_template_loader($template) { global $wp_query, $current_user, $plugin_prefix, $wpdb; if (isset($_REQUEST['geodir_ptype'])) { global $information; if ($current_user->ID) { if (get_option('geodir_claim_auto_approve') == 'yes') { if (!isset($_REQUEST['rs']) || isset($_REQUEST['rs']) && $_REQUEST['rs'] == '') { $information .= CLAIM_VARIFY_CODE_NOT_EXIST; } else { $rand_string = isset($_REQUEST['rs']) ? $_REQUEST['rs'] : ''; $approvesql = $wpdb->prepare("select * from " . GEODIR_CLAIM_TABLE . " where rand_string=%s", array($rand_string)); $approveinfo = $wpdb->get_results($approvesql); if ($approveinfo) { $pid = $approveinfo[0]->pid; $post_id = $approveinfo[0]->list_id; $author_id = $approveinfo[0]->user_id; $user_id = $current_user->ID; $status = $approveinfo[0]->status; if ($author_id == $user_id) { if ($status == 1) { $information .= CLAIM_LISTING_ALREADY_VARIFIED; } elseif ($status == 2) { $information .= CLAIM_LISTING_VERIFICATION_REJECTED; } else { $wpdb->query($wpdb->prepare("update {$wpdb->posts} set post_author=%d where ID=%d", array($author_id, $post_id))); $wpdb->query($wpdb->prepare("update " . GEODIR_CLAIM_TABLE . " set status='1' where pid=%d", array($pid))); geodir_save_post_meta($post_id, 'claimed', '1'); geodir_clientEmail($post_id, $author_id, 'claim_approved'); /* email to client */ $information .= CLAIM_LISTING_SUCCESS_VERIFIED . ' <a href="' . get_option('siteurl') . '/?p=' . $post_id . '">' . $approveinfo[0]->list_title . '</a>'; } } else { $information .= CLAIM_VARIFY_CODE_NOT_MATCH; } } else { $information .= CLAIM_VARIFY_CODE_NOT_EXIST; } } } else { $information .= CLAIM_AUTO_VARIFY_DISABLE; } } else { $site_login_url = get_option('siteurl') . '?geodir_signup=true'; $information .= sprintf(CLAIM_LOGIN_REQUIRED, '<a href="' . $site_login_url . '" >'); } $template = geodir_locate_template('information'); if (!$template) { $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php'; } $template = apply_filters('geodir_template_information', $template); } return $template; }
/** * Locates template part based on the template slug. * * @since 1.0.0 * @package GeoDirectory * @global object $post The current post object. * @global object $geodirectory Not yet implemented. * @param string $slug The template slug. * @param null $name The template name. */ function geodir_get_template_part($slug = '', $name = NULL) { global $geodirectory, $post; /** * Called at the start for the geodir_get_template_part() function. * * Used dynamic hook name: geodir_get_template_part_{$slug} * * @since 1.0.0 * @package GeoDirectory * @param string $slug The template slug. * @param string $name The template name. */ do_action("geodir_get_template_part_{$slug}", $slug, $name); $templates = array(); $name = (string) $name; if ('' !== $name) { $template_name = "{$slug}-{$name}.php"; } else { $template_name = "{$slug}.php"; } if (!locate_template(array("geodirectory/" . $template_name))) { /** * Filter the template part with slug and name. * * @since 1.0.0 * @param string $template_name The template name. */ $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name); /** * Includes the template part with slug and name. * * @since 1.0.0 */ include $template; } else { locate_template(array("geodirectory/" . $template_name), true, false); } }
/** * Displays custom fields html. * * @since 1.0.0 * @since 1.5.2 Added TERRAIN map type. * @package GeoDirectory * @global object $wpdb WordPress Database object. * @global object $post The current post object. * @global array $geodir_addon_list List of active GeoDirectory extensions. * @param int|string $package_id The package ID. * @param string $default Optional. When set to "default" it will display only default fields. * @param string $post_type Optional. The wordpress post type. */ function geodir_get_custom_fields_html($package_id = '', $default = 'custom', $post_type = 'gd_place') { global $is_default, $mapzoom; $show_editors = array(); $listing_type = $post_type; $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type); foreach ($custom_fields as $key => $val) { $val = stripslashes_deep($val); // strip slashes from labels $name = $val['name']; $site_title = $val['site_title']; $type = $val['type']; $admin_desc = $val['desc']; $option_values = $val['option_values']; $is_required = $val['is_required']; $is_default = $val['is_default']; $is_admin = $val['is_admin']; $required_msg = $val['required_msg']; $extra_fields = unserialize($val['extra_fields']); $value = ''; /* field available to site admin only for edit */ $for_admin_use = isset($val['for_admin_use']) && (int) $val['for_admin_use'] == 1 ? true : false; if ($for_admin_use && !is_super_admin()) { continue; } if (is_admin()) { global $post; if (isset($_REQUEST['post'])) { $_REQUEST['pid'] = $_REQUEST['post']; } } if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && isset($_SESSION['listing'])) { $post = unserialize($_SESSION['listing']); $value = isset($post[$name]) ? $post[$name] : ''; } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { $value = geodir_get_post_meta($_REQUEST['pid'], $name, true); } else { if ($value == '') { $value = $val['default']; } } /** * Called before the custom fields info is output for submitting a post. * * Used dynamic hook type geodir_before_custom_form_field_$name. * * @since 1.0.0 * @param string $listing_type The post post type. * @param int $package_id The price package ID for the post. * @param array $val The settings array for the field. {@see geodir_custom_field_save()}. * @see 'geodir_after_custom_form_field_$name' */ do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val); if ($type == 'fieldset') { ?> <h5><?php echo $site_title; ?> <?php if ($admin_desc != '') { echo '<small>( ' . $admin_desc . ' )</small>'; } ?> </h5><?php } elseif ($type == 'address') { $prefix = $name . '_'; $site_title != '' ? $address_title = $site_title : ($address_title = ucwords($prefix . ' address')); $extra_fields['zip_lable'] != '' ? $zip_title = $extra_fields['zip_lable'] : ($zip_title = ucwords($prefix . ' zip/post code ')); $extra_fields['map_lable'] != '' ? $map_title = $extra_fields['map_lable'] : ($map_title = ucwords('set address on map')); $extra_fields['mapview_lable'] != '' ? $mapview_title = $extra_fields['mapview_lable'] : ($mapview_title = ucwords($prefix . ' mapview')); $address = ''; $zip = ''; $mapview = ''; $mapzoom = ''; $lat = ''; $lng = ''; if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && isset($_SESSION['listing'])) { $post = unserialize($_SESSION['listing']); $address = $post[$prefix . 'address']; $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : ''; $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : ''; $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : ''; $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : ''; $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : ''; } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && ($post_info = geodir_get_post_info($_REQUEST['pid']))) { $post_info = (array) $post_info; $address = $post_info[$prefix . 'address']; $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : ''; $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : ''; $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : ''; $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : ''; $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : ''; } $location = geodir_get_default_location(); if (empty($city)) { $city = isset($location->city) ? $location->city : ''; } if (empty($region)) { $region = isset($location->region) ? $location->region : ''; } if (empty($country)) { $country = isset($location->country) ? $location->country : ''; } $lat_lng_blank = false; if (empty($lat) && empty($lng)) { $lat_lng_blank = true; } if (empty($lat)) { $lat = isset($location->city_latitude) ? $location->city_latitude : ''; } if (empty($lng)) { $lng = isset($location->city_longitude) ? $location->city_longitude : ''; } /** * Filter the default latitude. * * @since 1.0.0 * * @param float $lat Default latitude. * @param bool $is_admin For admin use only?. */ $lat = apply_filters('geodir_default_latitude', $lat, $is_admin); /** * Filter the default longitude. * * @since 1.0.0 * * @param float $lat Default longitude. * @param bool $is_admin For admin use only?. */ $lng = apply_filters('geodir_default_longitude', $lng, $is_admin); ?> <div id="geodir_<?php echo $prefix . 'address'; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php _e($address_title, 'geodirectory'); ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <input type="text" field_type="<?php echo $type; ?> " name="<?php echo $prefix . 'address'; ?> " id="<?php echo $prefix . 'address'; ?> " class="geodir_textfield" value="<?php echo esc_attr(stripslashes($address)); ?> "/> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php /** * Called after the address input on the add listings. * * This is used by the location manage to add further locations info etc. * * @since 1.0.0 * @param array $val The array of setting for the custom field. {@see geodir_custom_field_save()}. */ do_action('geodir_address_extra_listing_fields', $val); if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?> <div id="geodir_<?php echo $prefix . 'zip'; ?> _row" class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix"> <label> <?php _e($zip_title, 'geodirectory'); ?> <?php /*if($is_required) echo '<span>*</span>';*/ ?> </label> <input type="text" field_type="<?php echo $type; ?> " name="<?php echo $prefix . 'zip'; ?> " id="<?php echo $prefix . 'zip'; ?> " class="geodir_textfield autofill" value="<?php echo esc_attr(stripslashes($zip)); ?> "/> <?php /*if($is_required) {?> <span class="geodir_message_error"><?php echo _e($required_msg,'geodirectory');?></span> <?php }*/ ?> </div> <?php } ?> <?php if (isset($extra_fields['show_map']) && $extra_fields['show_map']) { ?> <div id="geodir_<?php echo $prefix . 'map'; ?> _row" class="geodir_form_row clearfix"> <?php /** * Contains add listing page map functions. * * @since 1.0.0 */ include geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php"; if ($lat_lng_blank) { $lat = ''; $lng = ''; } ?> <span class="geodir_message_note"><?php echo GET_MAP_MSG; ?> </span> </div> <?php /* show lat lng */ $style_latlng = isset($extra_fields['show_latlng']) && $extra_fields['show_latlng'] || is_admin() ? '' : 'style="display:none"'; ?> <div id="geodir_<?php echo $prefix . 'latitude'; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix" <?php echo $style_latlng; ?> > <label> <?php echo PLACE_ADDRESS_LAT; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <input type="text" field_type="<?php echo $type; ?> " name="<?php echo $prefix . 'latitude'; ?> " id="<?php echo $prefix . 'latitude'; ?> " class="geodir_textfield" value="<?php echo esc_attr(stripslashes($lat)); ?> " size="25"/> <span class="geodir_message_note"><?php echo GET_LATITUDE_MSG; ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <div id="geodir_<?php echo $prefix . 'longitude'; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix" <?php echo $style_latlng; ?> > <label> <?php echo PLACE_ADDRESS_LNG; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <input type="text" field_type="<?php echo $type; ?> " name="<?php echo $prefix . 'longitude'; ?> " id="<?php echo $prefix . 'longitude'; ?> " class="geodir_textfield" value="<?php echo esc_attr(stripslashes($lng)); ?> " size="25"/> <span class="geodir_message_note"><?php echo GET_LOGNGITUDE_MSG; ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } ?> <?php if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) { ?> <div id="geodir_<?php echo $prefix . 'mapview'; ?> _row" class="geodir_form_row clearfix "> <label><?php _e($mapview_title, 'geodirectory'); ?> </label> <span class="geodir_user_define"><input field_type="<?php echo $type; ?> " type="radio" class="gd-checkbox" name="<?php echo $prefix . 'mapview'; ?> " id="<?php echo $prefix . 'mapview'; ?> " <?php if ($mapview == 'ROADMAP' || $mapview == '') { echo 'checked="checked"'; } ?> value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?> </span> <span class="geodir_user_define"> <input field_type="<?php echo $type; ?> " type="radio" class="gd-checkbox" name="<?php echo $prefix . 'mapview'; ?> " id="map_view1" <?php if ($mapview == 'SATELLITE') { echo 'checked="checked"'; } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?> </span> <span class="geodir_user_define"><input field_type="<?php echo $type; ?> " type="radio" class="gd-checkbox" name="<?php echo $prefix . 'mapview'; ?> " id="map_view2" <?php if ($mapview == 'HYBRID') { echo 'checked="checked"'; } ?> value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?> </span> <span class="geodir_user_define"><input field_type="<?php echo $type; ?> " type="radio" class="gd-checkbox" name="<?php echo $prefix . 'mapview'; ?> " id="map_view3" <?php if ($mapview == 'TERRAIN') { echo 'checked="checked"'; } ?> value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?> </span> </div> <?php } ?> <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?> <input type="hidden" value="<?php if (isset($mapzoom)) { echo esc_attr($mapzoom); } ?> " name="<?php echo $prefix . 'mapzoom'; ?> " id="<?php echo $prefix . 'mapzoom'; ?> "/> <?php } ?> <?php } elseif ($type == 'text') { ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <input field_type="<?php echo $type; ?> " name="<?php echo $name; ?> " id="<?php echo $name; ?> " value="<?php echo esc_attr(stripslashes($value)); ?> " type="text" class="geodir_textfield"/> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } elseif ($type == 'email') { if ($value == $val['default']) { $value = ''; } ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <input field_type="<?php echo $type; ?> " name="<?php echo $name; ?> " id="<?php echo $name; ?> " value="<?php echo esc_attr(stripslashes($value)); ?> " type="text" class="geodir_textfield"/> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } elseif ($type == 'phone') { if ($value == $val['default']) { $value = ''; } ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <input field_type="<?php echo $type; ?> " name="<?php echo $name; ?> " id="<?php echo $name; ?> " value="<?php echo esc_attr(stripslashes($value)); ?> " type="text" class="geodir_textfield"/> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } elseif ($type == 'url') { if ($value == $val['default']) { $value = ''; } ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <input field_type="<?php echo $type; ?> " name="<?php echo $name; ?> " id="<?php echo $name; ?> " value="<?php echo esc_attr(stripslashes($value)); ?> " type="text" class="geodir_textfield"/> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } elseif ($type == 'radio') { ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <?php if ($option_values) { $option_values_arr = explode(',', $option_values); for ($i = 0; $i < count($option_values_arr); $i++) { if (strstr($option_values_arr[$i], "/")) { $radio_attr = explode("/", $option_values_arr[$i]); $radio_lable = ucfirst($radio_attr[0]); $radio_value = $radio_attr[1]; } else { $radio_lable = ucfirst($option_values_arr[$i]); $radio_value = $option_values_arr[$i]; } ?> <input name="<?php echo $name; ?> " id="<?php echo $name; ?> " <?php if ($radio_value == $value) { echo 'checked="checked"'; } ?> value="<?php echo $radio_value; ?> " class="gd-checkbox" field_type="<?php echo $type; ?> " type="radio" /><?php _e($radio_lable); ?> <?php } } ?> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } elseif ($type == 'checkbox') { ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <?php if ($value != '1') { $value = '0'; } ?> <input type="hidden" name="<?php echo $name; ?> " id="<?php echo $name; ?> " value="<?php echo esc_attr($value); ?> "/> <input <?php if ($value == '1') { echo 'checked="checked"'; } ?> value="1" class="gd-checkbox" field_type="<?php echo $type; ?> " type="checkbox" onchange="if(this.checked){jQuery('#<?php echo $name; ?> ').val('1');} else{ jQuery('#<?php echo $name; ?> ').val('0');}"/> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } elseif ($type == 'textarea') { ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label><?php if (is_array($extra_fields) && in_array('1', $extra_fields)) { $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?> <div class="editor" field_id="<?php echo $name; ?> " field_type="editor"> <?php wp_editor(stripslashes($value), $name, $editor_settings); ?> </div><?php } else { ?> <textarea field_type="<?php echo $type; ?> " class="geodir_textarea" name="<?php echo $name; ?> " id="<?php echo $name; ?> "><?php echo stripslashes($value); ?> </textarea><?php } ?> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } elseif ($type == 'select') { ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row geodir_custom_fields clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <?php $option_values_arr = geodir_string_values_to_options($option_values); $select_options = ''; if (!empty($option_values_arr)) { foreach ($option_values_arr as $option_row) { if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) { $option_label = isset($option_row['label']) ? $option_row['label'] : ''; $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; } else { $option_label = isset($option_row['label']) ? $option_row['label'] : ''; $option_value = isset($option_row['value']) ? $option_row['value'] : ''; $selected = $option_value == $value ? 'selected="selected"' : ''; $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; } } } ?> <select field_type="<?php echo $type; ?> " name="<?php echo $name; ?> " id="<?php echo $name; ?> " class="geodir_textfield textfield_x chosen_select" data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '…'; ?> " option-ajaxchosen="false"><?php echo $select_options; ?> </select> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } else { if ($type == 'multiselect') { $multi_display = 'select'; if (!empty($val['extra_fields'])) { $multi_display = unserialize($val['extra_fields']); } ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <input type="hidden" name="gd_field_<?php echo $name; ?> " value="1"/> <?php if ($multi_display == 'select') { ?> <div class="geodir_multiselect_list"> <select field_type="<?php echo $type; ?> " name="<?php echo $name; ?> []" id="<?php echo $name; ?> " multiple="multiple" class="geodir_textfield textfield_x chosen_select" data-placeholder="<?php _e('Select', 'geodirectory'); ?> " option-ajaxchosen="false"> <?php } else { echo '<ul class="gd_multi_choice">'; } $option_values_arr = geodir_string_values_to_options($option_values); $select_options = ''; if (!empty($option_values_arr)) { foreach ($option_values_arr as $option_row) { if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) { $option_label = isset($option_row['label']) ? $option_row['label'] : ''; if ($multi_display == 'select') { $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>'; } else { $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : ''; } } else { $option_label = isset($option_row['label']) ? $option_row['label'] : ''; $option_value = isset($option_row['value']) ? $option_row['value'] : ''; $selected = $option_value == $value ? 'selected="selected"' : ''; $selected = ''; $checked = ''; if (!is_array($value) && trim($value) != '' || is_array($value) && !empty($value)) { if (!is_array($value)) { $value_array = explode(',', $value); } else { $value_array = $value; } if (is_array($value_array)) { if (in_array($option_value, $value_array)) { $selected = 'selected="selected"'; $checked = 'checked="checked"'; } } } if ($multi_display == 'select') { $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>'; } else { $select_options .= '<li><input name="' . $name . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" /> ' . $option_label . ' </li>'; } } } } echo $select_options; if ($multi_display == 'select') { ?> </select></div> <?php } else { ?> </ul><?php } ?> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } else { if ($type == 'html') { ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <?php $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?> <div class="editor" field_id="<?php echo $name; ?> " field_type="editor"> <?php wp_editor(stripslashes($value), $name, $editor_settings); ?> </div> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } elseif ($type == 'datepicker') { if ($extra_fields['date_format'] == '') { $extra_fields['date_format'] = 'yy-mm-dd'; } $search = array('dd', 'mm', 'yy'); $replace = array('d', 'm', 'Y'); $date_format = str_replace($search, $replace, $extra_fields['date_format']); if ($value && !isset($_REQUEST['backandedit'])) { $time = strtotime($value); $value = date($date_format, $time); } ?> <script type="text/javascript"> jQuery(function () { jQuery("#<?php echo $name; ?> ").datepicker({changeMonth: true, changeYear: true,}); jQuery("#<?php echo $name; ?> ").datepicker("option", "dateFormat", '<?php echo $extra_fields['date_format']; ?> '); <?php if (!empty($value)) { ?> jQuery("#<?php echo $name; ?> ").datepicker("setDate", "<?php echo $value; ?> "); <?php } ?> }); </script> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <input field_type="<?php echo $type; ?> " name="<?php echo $name; ?> " id="<?php echo $name; ?> " value="<?php echo esc_attr($value); ?> " type="text" class="geodir_textfield"/> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } elseif ($type == 'time') { if ($value != '') { $value = date('H:i', strtotime($value)); } ?> <script type="text/javascript"> jQuery(document).ready(function () { jQuery('#<?php echo $name; ?> ').timepicker({ showPeriod: true, showLeadingZero: true, showPeriod: true, }); }); </script> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <input readonly="readonly" field_type="<?php echo $type; ?> " name="<?php echo $name; ?> " id="<?php echo $name; ?> " value="<?php echo esc_attr($value); ?> " type="text" class="geodir_textfield"/> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } elseif ($type == 'taxonomy') { if ($value == $val['default']) { $value = ''; } ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <label> <?php $site_title = __($site_title, 'geodirectory'); echo trim($site_title) ? $site_title : ' '; ?> <?php if ($is_required) { echo '<span>*</span>'; } ?> </label> <div id="<?php echo $name; ?> " class="geodir_taxonomy_field" style="float:left; width:70%;"> <?php global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats; $exclude_cats = array(); if ($is_admin == '1') { $post_type = get_post_type(); $package_info = array(); $package_info = (array) geodir_post_package_info($package_info, $post, $post_type); if (!empty($package_info)) { if (isset($package_info['cat']) && $package_info['cat'] != '') { $exclude_cats = explode(',', $package_info['cat']); } } } $cat_display = unserialize($val['extra_fields']); if (isset($_REQUEST['backandedit']) && (is_array($post_cat[$name]) && !empty($post_cat[$name]))) { $post_cat = implode(",", $post_cat[$name]); } else { if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true); } } global $geodir_addon_list; if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') { $catadd_limit = $wpdb->get_var($wpdb->prepare("SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d", array($package_id))); } else { $catadd_limit = 0; } if ($cat_display != '' && $cat_display != 'ajax_chained') { $required_limit_msg = ''; if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') { $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory'); } else { $required_limit_msg = $required_msg; } echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']" />'; if ($cat_display == 'select' || $cat_display == 'multiselect') { $cat_display == ''; $multiple = ''; if ($cat_display == 'multiselect') { $multiple = 'multiple="multiple"'; } echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">'; if ($cat_display == 'select') { echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>'; } } echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0); if ($cat_display == 'select' || $cat_display == 'multiselect') { echo '</select>'; } } else { echo geodir_custom_taxonomy_walker2($name, $catadd_limit); } ?> </div> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } elseif ($type == 'file') { ?> <?php // adjust values here $file_id = $name; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls if ($value != '') { $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls. } else { $file_value = ''; } if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) { $file_multiple = true; } else { $file_multiple = false; } if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) { $file_image_limit = $extra_fields['image_limit']; } else { $file_image_limit = 1; } $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels) $file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels) if (!empty($file_value)) { $curImages = explode(',', $file_value); if (!empty($curImages)) { $file_totImg = count($curImages); } } $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? implode(",", $extra_fields['gd_file_types']) : ''; $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : ''; ?> <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?> <?php if($file_image_limit!=0 && $file_image_limit==1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('image with this package').')</small>';} ?> <?php if($file_image_limit!=0 && $file_image_limit>1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('images with this package').')</small>';} ?> <?php if($file_image_limit==0){echo '<br /><small>('.__('You can upload unlimited images with this package').')</small>';} ?> </h5> <?php */ ?> <div id="<?php echo $name; ?> _row" class="<?php if ($is_required) { echo 'required_field'; } ?> geodir_form_row clearfix"> <div id="<?php echo $file_id; ?> dropbox" align="center" style=""> <label style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory'); echo $site_title; if ($is_required) { echo '<span>*</span>'; } ?> </label> <input class="geodir-custom-file-upload" field_type="file" type="hidden" name="<?php echo $file_id; ?> " id="<?php echo $file_id; ?> " value="<?php echo esc_attr($file_value); ?> "/> <input type="hidden" name="<?php echo $file_id; ?> image_limit" id="<?php echo $file_id; ?> image_limit" value="<?php echo $file_image_limit; ?> "/> <?php if ($allowed_file_types != '') { ?> <input type="hidden" name="<?php echo $file_id; ?> _allowed_types" id="<?php echo $file_id; ?> _allowed_types" value="<?php echo esc_attr($allowed_file_types); ?> " data-exts="<?php echo esc_attr($display_file_types); ?> "/> <?php } ?> <input type="hidden" name="<?php echo $file_id; ?> totImg" id="<?php echo $file_id; ?> totImg" value="<?php if (isset($file_totImg)) { echo esc_attr($file_totImg); } else { echo '0'; } ?> "/> <div style="float:left; width:55%;"> <div class="plupload-upload-uic hide-if-no-js <?php if ($file_multiple) { ?> plupload-upload-uic-multiple<?php } ?> " id="<?php echo $file_id; ?> plupload-upload-ui" style="float:left; width:30%;"> <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */ ?> <input id="<?php echo $file_id; ?> plupload-browse-button" type="button" value="<?php $file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory'); ?> " class="geodir_button" style="margin-top:10px;"/> <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($file_id . 'pluploadan'); ?> "></span> <?php if ($file_width && $file_height) { ?> <span class="plupload-resize"></span> <span class="plupload-width" id="plupload-width<?php echo $file_width; ?> "></span> <span class="plupload-height" id="plupload-height<?php echo $file_height; ?> "></span> <?php } ?> <div class="filelist"></div> </div> <div class="plupload-thumbs <?php if ($file_multiple) { ?> plupload-thumbs-multiple<?php } ?> " id="<?php echo $file_id; ?> plupload-thumbs" style=" clear:inherit; margin-top:0; margin-left:15px; padding-top:10px; float:left; width:50%;"> </div> <?php /*?><span id="upload-msg" ><?php _e('Please drag & drop the images to rearrange the order');?></span><?php */ ?> <span id="<?php echo $file_id; ?> upload-error" style="display:none"></span> </div> </div> <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> <?php echo $display_file_types != '' ? __('Allowed file types:', 'geodirectory') . ' ' . $display_file_types : ''; ?> </span> <?php if ($is_required) { ?> <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?> </span> <?php } ?> </div> <?php } } } /** * Called after the custom fields info is output for submitting a post. * * Used dynamic hook type geodir_after_custom_form_field_$name. * * @since 1.0.0 * @param string $listing_type The post post type. * @param int $package_id The price package ID for the post. * @param array $val The settings array for the field. {@see geodir_custom_field_save()}. * @see 'geodir_before_custom_form_field_$name' */ do_action('geodir_after_custom_form_field_' . $name, $listing_type, $package_id, $val); } }
function gd_list_create_pages() { $list_page_id = get_option('geodir_add_list_page'); if (!$list_page_id || FALSE === get_post_status($list_page_id)) { include_once geodir_plugin_path() . '/geodirectory-admin/admin_install.php'; geodir_create_page(esc_sql(_x('add-list', 'page_slug', GEODIRLISTS_TEXTDOMAIN)), 'geodir_add_list_page', __('Add List', GEODIRLISTS_TEXTDOMAIN), ''); } }
/** * BuddyPress Listings Tab content. * * @since 1.0.0 * @package GeoDirectory_BuddyPress_Integration * * @param array $args Query arguments. */ function geodir_buddypress_listings_html($args = array()) { wp_register_style('gdbuddypress-style.css', GEODIR_BUDDYPRESS_PLUGIN_URL . '/css/gdbuddypress-style.css', array(), GEODIR_BUDDYPRESS_VERSION); wp_enqueue_style('gdbuddypress-style.css'); global $posts_per_page, $found_posts, $paged; $current_posts_per_page = $posts_per_page; $current_found_posts = $found_posts; $current_paged = $paged; $posts_per_page = $posts_per_page > 0 ? $posts_per_page : 5; $post_type = $args['post_type']; $posts_per_page = apply_filters('gdbp_listing_post_limit', $posts_per_page); $layout = apply_filters('gdbp_listing_layout', ''); $list_sort = apply_filters('gdbp_listing_list_sort', 'latest'); $character_count = apply_filters('gdbp_list_character_count', 200); $post_type_name = !empty($args['post_type_name']) ? strtolower($args['post_type_name']) : __('listings', GDBUDDYPRESS_TEXTDOMAIN); // sorting options add_action('geodir_before_listing', 'geodir_buddypress_display_sort_options'); add_filter('geodir_buddypress_posts_orderby', 'geodir_posts_orderby', 100, 1); // pagination add_action('geodir_after_listing', 'geodir_buddypress_pagination', 20); $query_args = array('posts_per_page' => $posts_per_page, 'is_geodir_loop' => true, 'gd_location' => false, 'post_type' => $post_type, 'order_by' => $list_sort); if ($character_count) { $query_args['excerpt_length'] = $character_count; } if ((bool) bp_is_current_component('favorites')) { $query_args['filter_favorite'] = true; } global $gridview_columns, $geodir_is_widget_listing; $query_args['count_only'] = true; $found_posts = geodir_buddypress_get_bp_listings($query_args); $query_args['count_only'] = false; $widget_listings = geodir_buddypress_get_bp_listings($query_args); $listing_view = $layout; if (strstr($listing_view, 'gridview')) { $gridview_columns = $listing_view; $listing_view_exp = explode('_', $listing_view); $listing_view = $listing_view_exp[0]; } $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php'); ###### MAIN CONTENT WRAPPERS OPEN ###### // this adds the opening html tags to the content div, this required the closing tag below :: ($type='',$id='',$class='') do_action('geodir_wrapper_content_open', 'listings-page', 'geodir-wrapper-content', 'gdbp-wrapper-content gdbp-listings-page'); // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='') do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'gdbp-main-content gdbp-listings-page listings-page'); if (empty($widget_listings)) { ?> <a class="fav-add-more" href="http://mannabliss.com/<?php echo wp_sprintf(__('%s', GDBUDDYPRESS_TEXTDOMAIN), $post_type); ?> "><?php echo wp_sprintf(__('Add %s', GDBUDDYPRESS_TEXTDOMAIN), $post_type_name); ?> </a> <div class="info" id="message"><p><?php echo wp_sprintf(__('There were no %s found.', GDBUDDYPRESS_TEXTDOMAIN), $post_type_name); ?> </p></div> <?php } else { // currently set values global $post, $geodir_event_widget_listview, $map_jason, $map_canvas_arr, $posts_per_page, $found_posts, $paged; $current_post = $post; $current_map_jason = $map_jason; $current_map_canvas_arr = $map_canvas_arr; $geodir_is_widget_listing = true; $my_lisitngs = false; $old_event_widget_listview = $geodir_event_widget_listview; if (bp_loggedin_user_id() && bp_displayed_user_id() == bp_loggedin_user_id()) { $my_lisitngs = true; $_REQUEST['geodir_dashbord'] = true; add_action('geodir_after_edit_post_link_on_listing', 'geodir_buddypress_post_status_on_listing', 12); } if ($post_type == 'gd_event') { $geodir_event_widget_listview = true; } echo '<div class="clearfix">'; do_action('geodir_before_listing'); echo '</div>'; // all listings html include $template; echo '<div class="clearfix">'; do_action('geodir_after_listing'); echo '</div>'; // release original values global $post, $geodir_event_widget_listview, $map_jason, $map_canvas_arr; $GLOBALS['post'] = $current_post; setup_postdata($current_post); $geodir_event_widget_listview = $old_event_widget_listview; $map_jason = $current_map_jason; $map_canvas_arr = $current_map_canvas_arr; if ($my_lisitngs) { unset($_REQUEST['geodir_dashbord']); remove_filter('geodir_after_edit_post_link_on_listing', 'geodir_buddypress_post_status_on_listing'); } } global $posts_per_page, $found_posts, $paged; $posts_per_page = $current_posts_per_page; $found_posts = $current_found_posts; $paged = $current_paged; do_action('geodir_main_content_close', 'listings-page'); ###### MAIN CONTENT WRAPPERS CLOSE ###### // this adds the closing html tags to the wrapper_content div :: ($type='') do_action('geodir_wrapper_content_close', 'listings-page'); }
* @since 1.0.0 */ require_once 'geodirectory-admin/admin_template_tags.php'; /** * Include any functions needed for upgrades. * * @since 1.0.0 */ require_once geodir_plugin_path() . '/upgrade.php'; if (get_option('geodir_installed') != 1) { /** * Define language constants, here as they are not loaded yet. * * @since 1.0.0 */ require_once geodir_plugin_path() . '/language.php'; /** * Include the plugin install file that sets up the databases and any options on first run. * * @since 1.0.0 */ require_once 'geodirectory-admin/admin_install.php'; register_activation_hook(__FILE__, 'geodir_activation'); } register_deactivation_hook(__FILE__, 'geodir_deactivation'); register_uninstall_hook(__FILE__, 'geodir_uninstall'); /* * Show a upgrade warning message if applicable. * * @since 1.5.6 */
?> <div class="gd-location_message_error"><?php echo GD_LOCATION_FIELD_REQ; ?> </div> <span class="description"></span> </td> </tr> <tr valign="top" class="single_select_page"> <th class="titledesc" scope="row"> </th> <td class="forminp"> <div class="gtd-formfeild"> <?php include geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php"; ?> </td> </tr> <tr valign="top" class="single_select_page"> <th class="titledesc" scope="row"> <?php if (isset($_REQUEST['add_hood'])) { _e('Neighbourhood Latitude', GEODIRLOCATION_TEXTDOMAIN); } else { echo GD_LOCATION_LATITUDE; } ?>